@plumeria/compiler 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +45 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -182,56 +182,52 @@ async function main() {
|
|
|
182
182
|
const optimizedCss = Buffer.from(light.code).toString('utf-8');
|
|
183
183
|
await (0, promises_1.writeFile)(coreFilePath, optimizedCss, 'utf-8');
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
const startTime = performance.now();
|
|
186
|
+
await cleanUp();
|
|
187
|
+
const scanRoot = process.cwd();
|
|
188
|
+
const files = (0, glob_1.globSync)('**/*.{js,jsx,ts,tsx,vue,svelte}', {
|
|
189
|
+
cwd: scanRoot,
|
|
190
|
+
exclude: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.next/**'],
|
|
191
|
+
});
|
|
192
|
+
const projectName = path_1.default.basename(projectRoot);
|
|
193
|
+
const filesSupportExtensions = await Promise.all(files.map(async (file) => {
|
|
194
|
+
const ext = path_1.default.extname(file);
|
|
195
|
+
if (ext === '.vue' || ext === '.svelte') {
|
|
196
|
+
return await (0, extract_1.extractVueAndSvelte)(file);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return await (0, extract_1.extractTSFile)(file);
|
|
200
|
+
}
|
|
201
|
+
}));
|
|
202
|
+
const styleFiles = await Promise.all(filesSupportExtensions.map(async (file) => {
|
|
203
|
+
const code = extract_1.generatedTsMap.get(file);
|
|
204
|
+
const isCssFile = code ? await isCSS(code, file) : false;
|
|
205
|
+
return isCssFile ? file : null;
|
|
206
|
+
}))
|
|
207
|
+
.then((results) => results.filter(Boolean))
|
|
208
|
+
.then((results) => results.sort());
|
|
209
|
+
for (const file of styleFiles) {
|
|
210
|
+
const code = extract_1.generatedTsMap.get(file);
|
|
211
|
+
if (code) {
|
|
200
212
|
const ext = path_1.default.extname(file);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return await (0, extract_1.extractTSFile)(file);
|
|
213
|
+
const tsPath = ext === '.vue' || ext === '.svelte' ? file.replace(ext, '.ts') : file;
|
|
214
|
+
await (0, execute_1.executeCode)(code, { filePath: tsPath });
|
|
215
|
+
if (process.argv.includes('--paths')) {
|
|
216
|
+
console.log(`✅: ${projectName}/${path_1.default.relative(projectRoot, file)}`);
|
|
206
217
|
}
|
|
207
|
-
}));
|
|
208
|
-
const styleFiles = await Promise.all(filesSupportExtensions.map(async (file) => {
|
|
209
|
-
const code = extract_1.generatedTsMap.get(file);
|
|
210
|
-
const isCssFile = code ? await isCSS(code, file) : false;
|
|
211
|
-
return isCssFile ? file : null;
|
|
212
|
-
}))
|
|
213
|
-
.then((results) => results.filter(Boolean))
|
|
214
|
-
.then((results) => results.sort());
|
|
215
|
-
for (const file of styleFiles) {
|
|
216
|
-
const code = extract_1.generatedTsMap.get(file);
|
|
217
|
-
if (code) {
|
|
218
|
-
const ext = path_1.default.extname(file);
|
|
219
|
-
const tsPath = ext === '.vue' || ext === '.svelte' ? file.replace(ext, '.ts') : file;
|
|
220
|
-
await (0, execute_1.executeCode)(code, { filePath: tsPath });
|
|
221
|
-
if (process.argv.includes('--paths')) {
|
|
222
|
-
console.log(`✅: ${projectName}/${path_1.default.relative(projectRoot, file)}`);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
await processors_1.gQueue.build(coreFilePath);
|
|
227
|
-
await processors_1.pQueue.build(coreFilePath);
|
|
228
|
-
await optimizeCSS();
|
|
229
|
-
extract_1.generatedTsMap.clear();
|
|
230
|
-
if (process.argv.includes('--stats')) {
|
|
231
|
-
const endTime = performance.now();
|
|
232
|
-
const buildTime = (endTime - startTime) / 1000;
|
|
233
|
-
await generateStats(buildTime, coreFilePath);
|
|
234
218
|
}
|
|
235
|
-
}
|
|
219
|
+
}
|
|
220
|
+
await processors_1.gQueue.build(coreFilePath);
|
|
221
|
+
await processors_1.pQueue.build(coreFilePath);
|
|
222
|
+
await optimizeCSS();
|
|
223
|
+
extract_1.generatedTsMap.clear();
|
|
224
|
+
if (process.argv.includes('--stats')) {
|
|
225
|
+
const endTime = performance.now();
|
|
226
|
+
const buildTime = (endTime - startTime) / 1000;
|
|
227
|
+
await generateStats(buildTime, coreFilePath);
|
|
228
|
+
}
|
|
236
229
|
}
|
|
237
|
-
main()
|
|
230
|
+
main().catch((error) => {
|
|
231
|
+
console.error('Compilation failed:', error);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
});
|