Skip to content

Commit 83d9561

Browse files
committed
some improvement in transpile js native
1 parent 10e1153 commit 83d9561

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
@@ -274,21 +274,18 @@ export class DataSchemaCompiler {
274274
}
275275

276276
if (transpilationNative) {
277-
// Warming up swc compiler cache
278-
const dummyFile = {
279-
fileName: 'dummy.js',
280-
content: ';',
281-
};
282-
283-
await this.transpileJsFile(dummyFile, errorsReport, { cubeNames, cubeSymbols, transpilerNames, contextSymbols: CONTEXT_SYMBOLS, compilerId, stage });
284-
285-
const nonJsFilesTasks = toCompile.filter(file => !file.fileName.endsWith('.js') && !file.convertedToJs)
286-
.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbols, transpilerNames, compilerId }));
287-
288277
const jsFiles = toCompile.filter(file => file.fileName.endsWith('.js') || file.convertedToJs);
289278
let JsFilesTasks = [];
290279

291280
if (jsFiles.length > 0) {
281+
// Warming up swc compiler cache
282+
const dummyFile = {
283+
fileName: 'dummy.js',
284+
content: ';',
285+
};
286+
287+
await this.transpileJsFile(dummyFile, errorsReport, { cubeNames, cubeSymbols, transpilerNames, contextSymbols: CONTEXT_SYMBOLS, compilerId, stage });
288+
292289
let jsChunks;
293290
if (jsFiles.length < transpilationNativeThreadsCount * transpilationNativeThreadsCount) {
294291
jsChunks = [jsFiles];
@@ -305,6 +302,9 @@ export class DataSchemaCompiler {
305302
JsFilesTasks = jsChunks.map(chunk => this.transpileJsFilesBulk(chunk, errorsReport, { transpilerNames, compilerId }));
306303
}
307304

305+
const nonJsFilesTasks = toCompile.filter(file => !file.fileName.endsWith('.js') && !file.convertedToJs)
306+
.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbols, transpilerNames, compilerId }));
307+
308308
results = (await Promise.all([...nonJsFilesTasks, ...JsFilesTasks])).flat();
309309
} else if (transpilationWorkerThreads) {
310310
results = await Promise.all(toCompile.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbols, transpilerNames })));

0 commit comments

Comments
 (0)