Skip to content

Commit 0d5463e

Browse files
committed
some improvement in transpile js native
1 parent 8228456 commit 0d5463e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/cubejs-schema-compiler/src/compiler/DataSchemaCompiler.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,21 +284,18 @@ export class DataSchemaCompiler {
284284
}
285285

286286
if (transpilationNative) {
287-
// Warming up swc compiler cache
288-
const dummyFile = {
289-
fileName: 'dummy.js',
290-
content: ';',
291-
};
292-
293-
await this.transpileJsFile(dummyFile, errorsReport, { cubeNames, cubeSymbols, transpilerNames, contextSymbols: CONTEXT_SYMBOLS, compilerId, stage });
294-
295-
const nonJsFilesTasks = toCompile.filter(file => !file.fileName.endsWith('.js') && !file.convertedToJs)
296-
.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbols, transpilerNames, compilerId }));
297-
298287
const jsFiles = toCompile.filter(file => file.fileName.endsWith('.js') || file.convertedToJs);
299288
let JsFilesTasks = [];
300289

301290
if (jsFiles.length > 0) {
291+
// Warming up swc compiler cache
292+
const dummyFile = {
293+
fileName: 'dummy.js',
294+
content: ';',
295+
};
296+
297+
await this.transpileJsFile(dummyFile, errorsReport, { cubeNames, cubeSymbols, transpilerNames, contextSymbols: CONTEXT_SYMBOLS, compilerId, stage });
298+
302299
let jsChunks;
303300
if (jsFiles.length < transpilationNativeThreadsCount * transpilationNativeThreadsCount) {
304301
jsChunks = [jsFiles];
@@ -315,6 +312,9 @@ export class DataSchemaCompiler {
315312
JsFilesTasks = jsChunks.map(chunk => this.transpileJsFilesBulk(chunk, errorsReport, { transpilerNames, compilerId }));
316313
}
317314

315+
const nonJsFilesTasks = toCompile.filter(file => !file.fileName.endsWith('.js') && !file.convertedToJs)
316+
.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbols, transpilerNames, compilerId }));
317+
318318
results = (await Promise.all([...nonJsFilesTasks, ...JsFilesTasks])).flat();
319319
} else if (transpilationWorkerThreads) {
320320
results = await Promise.all(toCompile.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbols, transpilerNames })));

0 commit comments

Comments
 (0)