@adep/cli 0.5.3 → 0.5.5
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/README.md +19 -6
- package/dist/index.js +1240 -207
- package/dist/vite.js +419 -40
- package/dist/worker-entry.js +20 -8
- package/package.json +8 -13
package/dist/worker-entry.js
CHANGED
|
@@ -467,12 +467,24 @@ function errorLineIn(stack, path) {
|
|
|
467
467
|
if (own !== null) return own[1];
|
|
468
468
|
return /(?:^|\n):(\d+)(?:\n|$)/.exec(stack)?.[1];
|
|
469
469
|
}
|
|
470
|
-
|
|
470
|
+
var DYNAMIC_IMPORT_HINT = "\u63D0\u793A\uFF1AM1 \u6C99\u7BB1\u4E0D\u652F\u6301\u52A8\u6001 import\uFF0C\u6539\u9759\u6001 import";
|
|
471
|
+
function isDynamicImportRejection(error) {
|
|
472
|
+
const code = error.code;
|
|
473
|
+
if (code === "ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING") return true;
|
|
474
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
475
|
+
return /dynamic import callback/i.test(message);
|
|
476
|
+
}
|
|
477
|
+
function containsDynamicImport(source) {
|
|
478
|
+
return /(^|[^\w$.])import\s*\(/.test(source);
|
|
479
|
+
}
|
|
480
|
+
function syntaxErrorWithLocation(error, path, source) {
|
|
471
481
|
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
472
482
|
const stack = error.stack;
|
|
473
483
|
const line = typeof stack === "string" ? errorLineIn(stack, path) : void 0;
|
|
474
484
|
const location = line === void 0 ? path : `${path}:${line}`;
|
|
475
|
-
const
|
|
485
|
+
const hint = containsDynamicImport(source) ? `
|
|
486
|
+
${DYNAMIC_IMPORT_HINT}` : "";
|
|
487
|
+
const wrapped = new Error(`\u6E90\u7801\u8BED\u6CD5\u9519\u8BEF\uFF08${location}\uFF09\uFF1A${rawMessage}${hint}`, { cause: error });
|
|
476
488
|
const code = error.code;
|
|
477
489
|
if (typeof code === "string") wrapped.code = code;
|
|
478
490
|
return wrapped;
|
|
@@ -517,7 +529,7 @@ function loadModule(path, files, sandboxGlobals, cache, resolveBare, bareCache,
|
|
|
517
529
|
try {
|
|
518
530
|
transformed = transformExports(transpile(source));
|
|
519
531
|
} catch (error) {
|
|
520
|
-
throw syntaxErrorWithLocation(error, path);
|
|
532
|
+
throw syntaxErrorWithLocation(error, path, source);
|
|
521
533
|
}
|
|
522
534
|
const context = createSandboxContext(sandboxGlobals);
|
|
523
535
|
let wrapper;
|
|
@@ -529,7 +541,7 @@ function loadModule(path, files, sandboxGlobals, cache, resolveBare, bareCache,
|
|
|
529
541
|
{ filename: path }
|
|
530
542
|
);
|
|
531
543
|
} catch (error) {
|
|
532
|
-
throw syntaxErrorWithLocation(error, path);
|
|
544
|
+
throw syntaxErrorWithLocation(error, path, source);
|
|
533
545
|
}
|
|
534
546
|
wrapper(module, exports, require2);
|
|
535
547
|
if (module.default !== void 0 && exports["default"] === void 0) {
|
|
@@ -1124,10 +1136,10 @@ function firstUserFrame(stack, files) {
|
|
|
1124
1136
|
function errorMessageWithLocation(error, files) {
|
|
1125
1137
|
const message = errorMessageOf2(error);
|
|
1126
1138
|
const stack = error.stack;
|
|
1127
|
-
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1139
|
+
const frame = typeof stack === "string" ? firstUserFrame(stack, files) : void 0;
|
|
1140
|
+
const located = frame === void 0 || message.includes(`\uFF08${frame}\uFF09`) ? message : `${message}\uFF08${frame}\uFF09`;
|
|
1141
|
+
return isDynamicImportRejection(error) ? `${located}
|
|
1142
|
+
${DYNAMIC_IMPORT_HINT}` : located;
|
|
1131
1143
|
}
|
|
1132
1144
|
function createBareResolver(deps) {
|
|
1133
1145
|
const platformRequire = createRequire(import.meta.url);
|
package/package.json
CHANGED
|
@@ -7,17 +7,12 @@
|
|
|
7
7
|
},
|
|
8
8
|
"homepage": "https://adep.top",
|
|
9
9
|
"bugs": "https://gitcode.com/yunqiang_wu/ai-yunke/issues",
|
|
10
|
-
"version": "0.5.
|
|
10
|
+
"version": "0.5.5",
|
|
11
11
|
"adep": {
|
|
12
12
|
"releaseTasks": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"CLI-
|
|
16
|
-
"CLI-052",
|
|
17
|
-
"CLI-053",
|
|
18
|
-
"CLI-054",
|
|
19
|
-
"CLI-055",
|
|
20
|
-
"CLI-056"
|
|
13
|
+
"CLI-105",
|
|
14
|
+
"CLI-106",
|
|
15
|
+
"CLI-108"
|
|
21
16
|
]
|
|
22
17
|
},
|
|
23
18
|
"type": "module",
|
|
@@ -42,14 +37,14 @@
|
|
|
42
37
|
"esbuild": "0.25.12",
|
|
43
38
|
"yaml": "2.9.1",
|
|
44
39
|
"zod": "^4.6.6",
|
|
45
|
-
"@adep/vite-plugin": "0.1.12",
|
|
46
40
|
"@adep/app-runtime": "0.1.1",
|
|
47
|
-
"@adep/crypto": "0.1.1",
|
|
48
41
|
"@adep/cf-compat": "0.1.4",
|
|
49
|
-
"@adep/
|
|
42
|
+
"@adep/crypto": "0.1.1",
|
|
43
|
+
"@adep/runtime": "0.3.11",
|
|
44
|
+
"@adep/vite-plugin": "0.1.13"
|
|
50
45
|
},
|
|
51
46
|
"devDependencies": {
|
|
52
|
-
"@adep/types": "0.4.
|
|
47
|
+
"@adep/types": "0.4.3"
|
|
53
48
|
},
|
|
54
49
|
"scripts": {
|
|
55
50
|
"test": "vitest run",
|