@esmx/core 3.0.0-rc.39 → 3.0.0-rc.41
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/cli/cli.mjs +17 -4
- package/package.json +4 -4
- package/src/cli/cli.ts +23 -4
package/dist/cli/cli.mjs
CHANGED
|
@@ -8,10 +8,20 @@ async function getSrcOptions() {
|
|
|
8
8
|
(m) => m.default
|
|
9
9
|
);
|
|
10
10
|
}
|
|
11
|
+
async function getDistOptions() {
|
|
12
|
+
try {
|
|
13
|
+
return import(resolveImportPath(process.cwd(), "./dist/index.mjs")).then((m) => m.default);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
`Failed to load configuration from dist/index.mjs. Please make sure you have run 'esmx build' first.
|
|
17
|
+
${e}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
11
21
|
export async function cli(command) {
|
|
12
22
|
console.log(`\u{1F525} ${styleText("yellow", "Esmx")} v${pkg.version}
|
|
13
23
|
`);
|
|
14
|
-
if (command !== COMMAND.dev) {
|
|
24
|
+
if (command !== COMMAND.dev && typeof process.env.NODE_ENV === "undefined") {
|
|
15
25
|
process.env.NODE_ENV = "production";
|
|
16
26
|
}
|
|
17
27
|
let esmx;
|
|
@@ -25,9 +35,12 @@ export async function cli(command) {
|
|
|
25
35
|
opts = null;
|
|
26
36
|
break;
|
|
27
37
|
case COMMAND.start:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
38
|
+
opts = await getDistOptions();
|
|
39
|
+
esmx = new Esmx(opts);
|
|
40
|
+
exit(await esmx.init(COMMAND.start));
|
|
41
|
+
esmx = null;
|
|
42
|
+
opts = null;
|
|
43
|
+
break;
|
|
31
44
|
case COMMAND.build:
|
|
32
45
|
opts = await getSrcOptions();
|
|
33
46
|
esmx = new Esmx(opts);
|
package/package.json
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"build": "unbuild"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@esmx/import": "3.0.0-rc.
|
|
62
|
+
"@esmx/import": "3.0.0-rc.41",
|
|
63
63
|
"@types/serialize-javascript": "^5.0.4",
|
|
64
64
|
"es-module-lexer": "^1.7.0",
|
|
65
65
|
"find": "^0.3.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@biomejs/biome": "1.9.4",
|
|
71
|
-
"@esmx/lint": "3.0.0-rc.
|
|
71
|
+
"@esmx/lint": "3.0.0-rc.41",
|
|
72
72
|
"@types/find": "^0.2.4",
|
|
73
73
|
"@types/node": "^24.0.0",
|
|
74
74
|
"@types/send": "^0.17.4",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"unbuild": "3.5.0",
|
|
80
80
|
"vitest": "3.2.4"
|
|
81
81
|
},
|
|
82
|
-
"version": "3.0.0-rc.
|
|
82
|
+
"version": "3.0.0-rc.41",
|
|
83
83
|
"type": "module",
|
|
84
84
|
"private": false,
|
|
85
85
|
"exports": {
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"template",
|
|
103
103
|
"public"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "d3d8a4787b62ec580d61adc6bf2a907f27c413a9"
|
|
106
106
|
}
|
package/src/cli/cli.ts
CHANGED
|
@@ -11,10 +11,25 @@ async function getSrcOptions(): Promise<EsmxOptions> {
|
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
async function getDistOptions(): Promise<EsmxOptions> {
|
|
15
|
+
try {
|
|
16
|
+
return import(
|
|
17
|
+
resolveImportPath(process.cwd(), './dist/index.mjs')
|
|
18
|
+
).then((m) => m.default);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
`Failed to load configuration from dist/index.mjs. Please make sure you have run 'esmx build' first.\n${e}`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
export async function cli(command: string) {
|
|
15
27
|
console.log(`🔥 ${styleText('yellow', 'Esmx')} v${pkg.version}
|
|
16
28
|
`);
|
|
17
|
-
if (
|
|
29
|
+
if (
|
|
30
|
+
command !== COMMAND.dev &&
|
|
31
|
+
typeof process.env.NODE_ENV === 'undefined'
|
|
32
|
+
) {
|
|
18
33
|
process.env.NODE_ENV = 'production';
|
|
19
34
|
}
|
|
20
35
|
let esmx: Esmx | null;
|
|
@@ -29,9 +44,13 @@ export async function cli(command: string) {
|
|
|
29
44
|
opts = null;
|
|
30
45
|
break;
|
|
31
46
|
case COMMAND.start:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
47
|
+
opts = await getDistOptions();
|
|
48
|
+
esmx = new Esmx(opts);
|
|
49
|
+
exit(await esmx.init(COMMAND.start));
|
|
50
|
+
|
|
51
|
+
esmx = null;
|
|
52
|
+
opts = null;
|
|
53
|
+
break;
|
|
35
54
|
case COMMAND.build:
|
|
36
55
|
opts = await getSrcOptions();
|
|
37
56
|
esmx = new Esmx(opts);
|