@@ -61,43 +61,39 @@ export class BlockFactorySync extends BlockFactoryBase {
61
61
}
62
62
63
63
/**
64
- * Parse a `postcss.Root` into a Block object. Save the Block promise and
65
- * return it. Use parseRoot if we need to catch errors.
64
+ * Parse a `postcss.Root` into a Block object. Use parseRoot if we need to
65
+ * catch errors.
66
66
*
67
67
* This function is referenced only in tests.
68
68
* @param root The postcss.Root to parse.
69
69
* @param identifier A unique identifier for this Block file.
70
70
* @param name Default name for the block.
71
71
* @param isDfnFile Whether to treat this as a definition file.
72
- * @returns The Block object promise .
72
+ * @returns The Block object.
73
73
*/
74
74
parseRootFaultTolerant ( root : postcss . Root , identifier : string , name : string , isDfnFile = false , expectedGuid ?: string ) : Block {
75
75
return this . parser . parseSync ( root , identifier , name , isDfnFile , expectedGuid ) ;
76
76
}
77
77
78
78
/**
79
- * Parse a `postcss.Root` into a Block object. Save the Block promise and return it.
80
- * Also assert that the block is valid so that we can catch any errors that
81
- * the block contains.
79
+ * Parse a `postcss.Root` into a Block object. Also assert that the block is
80
+ * valid so that we can catch any errors that the block contains.
82
81
*
83
82
* This function is only used in tests
84
83
* @param root The postcss.Root to parse.
85
84
* @param identifier A unique identifier for this Block file.
86
85
* @param name Default name for the block.
87
86
* @param isDfnFile Whether to treat this as a definition file.
88
- * @returns The Block object promise .
87
+ * @returns The Block object.
89
88
*/
90
- async parseRoot ( root : postcss . Root , identifier : string , name : string , isDfnFile = false , expectedGuid ?: string ) : Promise < Block > {
91
- const block = await this . parseRootFaultTolerant ( root , identifier , name , isDfnFile , expectedGuid ) ;
89
+ parseRoot ( root : postcss . Root , identifier : string , name : string , isDfnFile = false , expectedGuid ?: string ) : Block {
90
+ const block = this . parseRootFaultTolerant ( root , identifier , name , isDfnFile , expectedGuid ) ;
92
91
return this . _surfaceBlockErrors ( block ) ;
93
92
}
94
93
95
94
/**
96
- * In some cases (like when using preprocessors with native bindings), it may
97
- * be necessary to wait until the block factory has completed current
98
- * asynchronous work before exiting. Calling this method stops new pending
99
- * work from being performed and returns a promise that resolves when it is
100
- * safe to exit.
95
+ * This method doesn't do anything, but it's provided for parity with
96
+ * `BlockFactory`.
101
97
*/
102
98
prepareForExit ( ) : void {
103
99
}
@@ -125,13 +121,12 @@ export class BlockFactorySync extends BlockFactoryBase {
125
121
* into a CSS Block. In most cases, you'll likely want to use getBlockFromPath() instead.
126
122
*
127
123
* If the block for the given identifier has already been loaded and parsed,
128
- * the cached data will be returned instead. If loading and parsing is already in progress,
129
- * the existing promise for that identifier will be returned.
124
+ * the cached block will be returned instead.
130
125
*
131
126
* @param identifier - An identifier that points at a data file or blob in persistent storage.
132
127
* These identifiers are created by the Importer that you've configured
133
128
* to use.
134
- * @returns A promise that resolves to the parsed block.
129
+ * @returns The parsed block.
135
130
*/
136
131
getBlock ( identifier : FileIdentifier ) : Block {
137
132
if ( this . blocks [ identifier ] ) {
@@ -145,7 +140,7 @@ export class BlockFactorySync extends BlockFactoryBase {
145
140
* the Importer, then defer to another method to actually parse the data file into a Block.
146
141
*
147
142
* @param identifier - An identifier that points at a data file or blob in persistent storage.
148
- * @returns A promise that resolves to the parsed block.
143
+ * @returns The parsed block.
149
144
*/
150
145
private _getBlock ( identifier : FileIdentifier ) : Block {
151
146
let file = this . importer . importSync ( identifier , this . configuration ) ;
@@ -288,7 +283,7 @@ export class BlockFactorySync extends BlockFactoryBase {
288
283
* @param fromIdentifier - The FileIdentifier that references the base location that the
289
284
* import path is relative to.
290
285
* @param importPath - The relative import path for the file to import.
291
- * @returns A promise that resolves to a parsed block.
286
+ * @returns The parsed block.
292
287
*/
293
288
getBlockRelative ( fromIdentifier : FileIdentifier , importPath : string ) : Block {
294
289
let importer = this . importer ;
0 commit comments