@dimina/compiler 1.0.12-beta.9 → 1.0.12
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/bin/index.cjs +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/core/logic-compiler.cjs +178 -83
- package/dist/core/logic-compiler.js +179 -84
- package/dist/core/style-compiler.cjs +28 -6
- package/dist/core/style-compiler.js +30 -8
- package/dist/core/view-compiler.cjs +3403 -3588
- package/dist/core/view-compiler.js +3404 -3589
- package/dist/{env-Csj3AHY4.js → env-QQjdhY-G.js} +7 -7
- package/dist/index.cjs +22 -8
- package/dist/index.js +23 -9
- package/package.json +21 -17
|
@@ -525,13 +525,13 @@ function getPages() {
|
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
527
|
export {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
528
|
+
getContentByPath as a,
|
|
529
|
+
getAbsolutePath as b,
|
|
530
|
+
collectAssets as c,
|
|
531
|
+
getAppId as d,
|
|
532
|
+
getTargetPath as e,
|
|
533
|
+
getWorkPath as f,
|
|
534
|
+
getComponent as g,
|
|
535
535
|
tagWhiteList as h,
|
|
536
536
|
hasCompileInfo as i,
|
|
537
537
|
getAppConfigInfo as j,
|
package/dist/index.cjs
CHANGED
|
@@ -420,6 +420,14 @@ function runCompileInWorker(script, ctx, task) {
|
|
|
420
420
|
workerPool.getWorkerOptions()
|
|
421
421
|
);
|
|
422
422
|
const totalTasks = Object.keys(ctx.pages.mainPages).length + Object.values(ctx.pages.subPages).reduce((sum, item) => sum + item.info.length, 0);
|
|
423
|
+
let isResolved = false;
|
|
424
|
+
let workerError = null;
|
|
425
|
+
const handleError = (error) => {
|
|
426
|
+
if (isResolved) return;
|
|
427
|
+
isResolved = true;
|
|
428
|
+
worker.terminate();
|
|
429
|
+
reject(error);
|
|
430
|
+
};
|
|
423
431
|
worker.postMessage({ pages: ctx.pages, storeInfo: ctx.storeInfo });
|
|
424
432
|
worker.on("message", (message) => {
|
|
425
433
|
try {
|
|
@@ -432,8 +440,10 @@ function runCompileInWorker(script, ctx, task) {
|
|
|
432
440
|
task.output = `[${bar}] ${percentage.toFixed(2)}%`;
|
|
433
441
|
}
|
|
434
442
|
if (message.success) {
|
|
435
|
-
|
|
443
|
+
if (isResolved) return;
|
|
444
|
+
isResolved = true;
|
|
436
445
|
worker.terminate();
|
|
446
|
+
resolve();
|
|
437
447
|
} else if (message.error) {
|
|
438
448
|
const error = new Error(message.error.message || message.error);
|
|
439
449
|
if (message.error.stack)
|
|
@@ -442,19 +452,23 @@ function runCompileInWorker(script, ctx, task) {
|
|
|
442
452
|
error.file = message.error.file;
|
|
443
453
|
if (message.error.line)
|
|
444
454
|
error.line = message.error.line;
|
|
445
|
-
|
|
446
|
-
worker.terminate();
|
|
455
|
+
handleError(error);
|
|
447
456
|
}
|
|
448
457
|
} catch (err) {
|
|
449
|
-
|
|
458
|
+
handleError(new Error(`Error processing worker message: ${err.message}
|
|
450
459
|
${err.stack}`));
|
|
451
|
-
worker.terminate();
|
|
452
460
|
}
|
|
453
461
|
});
|
|
454
|
-
worker.on("error",
|
|
462
|
+
worker.on("error", (err) => {
|
|
463
|
+
workerError = err;
|
|
464
|
+
handleError(err);
|
|
465
|
+
});
|
|
455
466
|
worker.on("exit", (code) => {
|
|
456
|
-
if (code !== 0) {
|
|
457
|
-
|
|
467
|
+
if (code !== 0 && !isResolved) {
|
|
468
|
+
const error = workerError || new Error(
|
|
469
|
+
code === 1 ? "Worker terminated due to reaching memory limit: JS heap out of memory" : `Worker stopped with exit code ${code}`
|
|
470
|
+
);
|
|
471
|
+
handleError(error);
|
|
458
472
|
}
|
|
459
473
|
});
|
|
460
474
|
}));
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Worker } from "node:worker_threads";
|
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import fs from "node:fs";
|
|
7
|
-
import {
|
|
7
|
+
import { e as getTargetPath, d as getAppId, k as getAppName, l as getPageConfigInfo, j as getAppConfigInfo, s as storeInfo, f as getWorkPath, m as getPages } from "./env-QQjdhY-G.js";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
const artCode = `
|
|
10
10
|
██████╗ ██╗███╗ ███╗██╗███╗ ██╗ █████╗
|
|
@@ -418,6 +418,14 @@ function runCompileInWorker(script, ctx, task) {
|
|
|
418
418
|
workerPool.getWorkerOptions()
|
|
419
419
|
);
|
|
420
420
|
const totalTasks = Object.keys(ctx.pages.mainPages).length + Object.values(ctx.pages.subPages).reduce((sum, item) => sum + item.info.length, 0);
|
|
421
|
+
let isResolved = false;
|
|
422
|
+
let workerError = null;
|
|
423
|
+
const handleError = (error) => {
|
|
424
|
+
if (isResolved) return;
|
|
425
|
+
isResolved = true;
|
|
426
|
+
worker.terminate();
|
|
427
|
+
reject(error);
|
|
428
|
+
};
|
|
421
429
|
worker.postMessage({ pages: ctx.pages, storeInfo: ctx.storeInfo });
|
|
422
430
|
worker.on("message", (message) => {
|
|
423
431
|
try {
|
|
@@ -430,8 +438,10 @@ function runCompileInWorker(script, ctx, task) {
|
|
|
430
438
|
task.output = `[${bar}] ${percentage.toFixed(2)}%`;
|
|
431
439
|
}
|
|
432
440
|
if (message.success) {
|
|
433
|
-
|
|
441
|
+
if (isResolved) return;
|
|
442
|
+
isResolved = true;
|
|
434
443
|
worker.terminate();
|
|
444
|
+
resolve();
|
|
435
445
|
} else if (message.error) {
|
|
436
446
|
const error = new Error(message.error.message || message.error);
|
|
437
447
|
if (message.error.stack)
|
|
@@ -440,19 +450,23 @@ function runCompileInWorker(script, ctx, task) {
|
|
|
440
450
|
error.file = message.error.file;
|
|
441
451
|
if (message.error.line)
|
|
442
452
|
error.line = message.error.line;
|
|
443
|
-
|
|
444
|
-
worker.terminate();
|
|
453
|
+
handleError(error);
|
|
445
454
|
}
|
|
446
455
|
} catch (err) {
|
|
447
|
-
|
|
456
|
+
handleError(new Error(`Error processing worker message: ${err.message}
|
|
448
457
|
${err.stack}`));
|
|
449
|
-
worker.terminate();
|
|
450
458
|
}
|
|
451
459
|
});
|
|
452
|
-
worker.on("error",
|
|
460
|
+
worker.on("error", (err) => {
|
|
461
|
+
workerError = err;
|
|
462
|
+
handleError(err);
|
|
463
|
+
});
|
|
453
464
|
worker.on("exit", (code) => {
|
|
454
|
-
if (code !== 0) {
|
|
455
|
-
|
|
465
|
+
if (code !== 0 && !isResolved) {
|
|
466
|
+
const error = workerError || new Error(
|
|
467
|
+
code === 1 ? "Worker terminated due to reaching memory limit: JS heap out of memory" : `Worker stopped with exit code ${code}`
|
|
468
|
+
);
|
|
469
|
+
handleError(error);
|
|
456
470
|
}
|
|
457
471
|
});
|
|
458
472
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimina/compiler",
|
|
3
|
-
"version": "1.0.12
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "星河编译工具",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -47,24 +47,28 @@
|
|
|
47
47
|
"星河"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@babel/core": "^7.
|
|
51
|
-
"@babel/generator": "^7.
|
|
52
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
53
|
-
"@babel/traverse": "^7.
|
|
54
|
-
"@babel/types": "^7.
|
|
55
|
-
"@vue/compiler-sfc": "^3.5.
|
|
56
|
-
"autoprefixer": "^10.4.
|
|
57
|
-
"cheerio": "^1.
|
|
50
|
+
"@babel/core": "^7.29.0",
|
|
51
|
+
"@babel/generator": "^7.29.1",
|
|
52
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
|
|
53
|
+
"@babel/traverse": "^7.29.0",
|
|
54
|
+
"@babel/types": "^7.29.0",
|
|
55
|
+
"@vue/compiler-sfc": "^3.5.30",
|
|
56
|
+
"autoprefixer": "^10.4.27",
|
|
57
|
+
"cheerio": "^1.2.0",
|
|
58
58
|
"chokidar": "^4.0.3",
|
|
59
|
-
"commander": "^14.0.
|
|
60
|
-
"cssnano": "^7.1.
|
|
61
|
-
"esbuild": "^0.
|
|
62
|
-
"htmlparser2": "^10.
|
|
63
|
-
"less": "^4.
|
|
64
|
-
"listr2": "
|
|
65
|
-
"
|
|
59
|
+
"commander": "^14.0.3",
|
|
60
|
+
"cssnano": "^7.1.3",
|
|
61
|
+
"esbuild": "^0.27.3",
|
|
62
|
+
"htmlparser2": "^10.1.0",
|
|
63
|
+
"less": "^4.6.3",
|
|
64
|
+
"listr2": "^9.0.5",
|
|
65
|
+
"magic-string": "^0.30.21",
|
|
66
|
+
"oxc-parser": "^0.110.0",
|
|
67
|
+
"oxc-transform": "^0.110.0",
|
|
68
|
+
"oxc-walker": "^0.7.0",
|
|
69
|
+
"postcss": "^8.5.8",
|
|
66
70
|
"postcss-selector-parser": "^7.1.1",
|
|
67
|
-
"sass": "^1.
|
|
71
|
+
"sass": "^1.98.0",
|
|
68
72
|
"typescript": "^5.9.3"
|
|
69
73
|
},
|
|
70
74
|
"publishConfig": {
|