@modern-js/app-tools 2.25.1 → 2.26.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/CHANGELOG.md +81 -0
- package/dist/cjs/commands/build.js +4 -9
- package/dist/cjs/index.js +13 -2
- package/dist/esm/commands/build.js +3 -24
- package/dist/esm/index.js +23 -4
- package/dist/esm-node/commands/build.js +5 -10
- package/dist/esm-node/index.js +14 -3
- package/package.json +25 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 2.26.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 05480f1: fix: @modern-js/server-core should be a dependencies of @modern-js/app-tools
|
|
8
|
+
fix: @modern-js/server-core 应该是 @modern-js/app-tools 的 dependencies
|
|
9
|
+
- fbcac63: perf(cli): improve upgrade command load performance
|
|
10
|
+
|
|
11
|
+
perf(cli): 优化 upgrade 命令加载性能
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [150ddb1]
|
|
14
|
+
- Updated dependencies [786c195]
|
|
15
|
+
- Updated dependencies [e26b05e]
|
|
16
|
+
- Updated dependencies [b36ece4]
|
|
17
|
+
- Updated dependencies [e26b05e]
|
|
18
|
+
- Updated dependencies [15ad760]
|
|
19
|
+
- Updated dependencies [fac4ee0]
|
|
20
|
+
- Updated dependencies [786c195]
|
|
21
|
+
- Updated dependencies [ad7139b]
|
|
22
|
+
- Updated dependencies [cdf5b6b]
|
|
23
|
+
- Updated dependencies [786c195]
|
|
24
|
+
- Updated dependencies [fbcac63]
|
|
25
|
+
- @modern-js/builder-webpack-provider@2.26.0
|
|
26
|
+
- @modern-js/builder-rspack-provider@2.26.0
|
|
27
|
+
- @modern-js/builder-shared@2.26.0
|
|
28
|
+
- @modern-js/builder@2.26.0
|
|
29
|
+
- @modern-js/upgrade@2.26.0
|
|
30
|
+
- @modern-js/builder-plugin-esbuild@2.26.0
|
|
31
|
+
- @modern-js/builder-plugin-node-polyfill@2.26.0
|
|
32
|
+
- @modern-js/core@2.26.0
|
|
33
|
+
- @modern-js/server@2.26.0
|
|
34
|
+
- @modern-js/new-action@2.26.0
|
|
35
|
+
- @modern-js/plugin-data-loader@2.26.0
|
|
36
|
+
- @modern-js/plugin-i18n@2.26.0
|
|
37
|
+
- @modern-js/plugin-lint@2.26.0
|
|
38
|
+
- @modern-js/server-core@2.26.0
|
|
39
|
+
- @modern-js/prod-server@2.26.0
|
|
40
|
+
- @modern-js/node-bundle-require@2.26.0
|
|
41
|
+
- @modern-js/plugin@2.26.0
|
|
42
|
+
- @modern-js/types@2.26.0
|
|
43
|
+
- @modern-js/utils@2.26.0
|
|
44
|
+
|
|
45
|
+
## 2.25.2
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 6651684: fix(app-tools): failed to print error stack
|
|
50
|
+
|
|
51
|
+
fix(app-tools): 修复 build 报错时未打印错误堆栈的问题
|
|
52
|
+
|
|
53
|
+
- ae723ab: fix: should not clean dist path if run deploy command but skip build
|
|
54
|
+
fix: 如果运行 deploy 命令,但是跳过构建阶段,不应该清理产物目录
|
|
55
|
+
- 272646c: feat(builder): bump webpack v5.88, support top level await
|
|
56
|
+
|
|
57
|
+
feat(builder): 升级 webpack v5.88, 支持 top level await
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [63d8247]
|
|
60
|
+
- Updated dependencies [f54bb68]
|
|
61
|
+
- Updated dependencies [6651684]
|
|
62
|
+
- Updated dependencies [15a8276]
|
|
63
|
+
- Updated dependencies [272646c]
|
|
64
|
+
- Updated dependencies [358ed24]
|
|
65
|
+
- @modern-js/utils@2.25.2
|
|
66
|
+
- @modern-js/builder-rspack-provider@2.25.2
|
|
67
|
+
- @modern-js/builder-webpack-provider@2.25.2
|
|
68
|
+
- @modern-js/builder-shared@2.25.2
|
|
69
|
+
- @modern-js/plugin-data-loader@2.25.2
|
|
70
|
+
- @modern-js/server@2.25.2
|
|
71
|
+
- @modern-js/builder@2.25.2
|
|
72
|
+
- @modern-js/builder-plugin-esbuild@2.25.2
|
|
73
|
+
- @modern-js/builder-plugin-node-polyfill@2.25.2
|
|
74
|
+
- @modern-js/core@2.25.2
|
|
75
|
+
- @modern-js/plugin-i18n@2.25.2
|
|
76
|
+
- @modern-js/plugin-lint@2.25.2
|
|
77
|
+
- @modern-js/new-action@2.25.2
|
|
78
|
+
- @modern-js/prod-server@2.25.2
|
|
79
|
+
- @modern-js/node-bundle-require@2.25.2
|
|
80
|
+
- @modern-js/plugin@2.25.2
|
|
81
|
+
- @modern-js/upgrade@2.25.2
|
|
82
|
+
- @modern-js/types@2.25.2
|
|
83
|
+
|
|
3
84
|
## 2.25.1
|
|
4
85
|
|
|
5
86
|
### Patch Changes
|
|
@@ -49,14 +49,9 @@ const build = async (api, options) => {
|
|
|
49
49
|
distDirectory,
|
|
50
50
|
configFile: serverConfigFile
|
|
51
51
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
56
|
-
}
|
|
57
|
-
await appContext.builder.build();
|
|
58
|
-
} catch (error) {
|
|
59
|
-
(0, _utils.printBuildError)(error);
|
|
60
|
-
process.exit(1);
|
|
52
|
+
_utils.logger.info("Create a production build...\n");
|
|
53
|
+
if (!appContext.builder) {
|
|
54
|
+
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
61
55
|
}
|
|
56
|
+
await appContext.builder.build();
|
|
62
57
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -43,7 +43,6 @@ const _generateWatchFiles = require("./utils/generateWatchFiles");
|
|
|
43
43
|
const _core = require("@modern-js/core");
|
|
44
44
|
_export_star._(require("./defineConfig"), exports);
|
|
45
45
|
_export_star._(require("./types"), exports);
|
|
46
|
-
const upgradeModel = _utils.Import.lazy("@modern-js/upgrade", require);
|
|
47
46
|
const devCommand = async (program, api) => {
|
|
48
47
|
const runner = api.useHookRunners();
|
|
49
48
|
const devToolMetas = await runner.registerDev();
|
|
@@ -162,10 +161,22 @@ const appTools = (options = {
|
|
|
162
161
|
const { inspect } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/inspect")));
|
|
163
162
|
inspect(api, options2);
|
|
164
163
|
});
|
|
165
|
-
|
|
164
|
+
const { defineCommand } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/upgrade")));
|
|
165
|
+
defineCommand(program.command("upgrade").option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)));
|
|
166
166
|
},
|
|
167
167
|
async prepare() {
|
|
168
168
|
const command = (0, _utils.getCommand)();
|
|
169
|
+
if (command === "deploy") {
|
|
170
|
+
const isSkipBuild = [
|
|
171
|
+
"-s",
|
|
172
|
+
"--skip-build"
|
|
173
|
+
].some((tag) => {
|
|
174
|
+
return (0, _utils.getArgv)().includes(tag);
|
|
175
|
+
});
|
|
176
|
+
if (isSkipBuild) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
169
180
|
if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
|
|
170
181
|
const resolvedConfig = api.useResolvedConfigContext();
|
|
171
182
|
if (resolvedConfig.output.cleanDistPath) {
|
|
@@ -3,12 +3,12 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
5
|
import { ResolvedConfigContext } from "@modern-js/core";
|
|
6
|
-
import { logger
|
|
6
|
+
import { logger } from "@modern-js/utils";
|
|
7
7
|
import { generateRoutes } from "../utils/routes";
|
|
8
8
|
import { buildServerConfig } from "../utils/config";
|
|
9
9
|
export var build = function() {
|
|
10
10
|
var _ref = _async_to_generator(function(api, options) {
|
|
11
|
-
var resolvedConfig, appContext, hookRunners, apiOnly, appDirectory, distDirectory, serverConfigFile, distDirectory1, appDirectory1, serverConfigFile1
|
|
11
|
+
var resolvedConfig, appContext, hookRunners, apiOnly, appDirectory, distDirectory, serverConfigFile, distDirectory1, appDirectory1, serverConfigFile1;
|
|
12
12
|
return _ts_generator(this, function(_state) {
|
|
13
13
|
switch (_state.label) {
|
|
14
14
|
case 0:
|
|
@@ -78,14 +78,6 @@ export var build = function() {
|
|
|
78
78
|
];
|
|
79
79
|
case 6:
|
|
80
80
|
_state.sent();
|
|
81
|
-
_state.label = 7;
|
|
82
|
-
case 7:
|
|
83
|
-
_state.trys.push([
|
|
84
|
-
7,
|
|
85
|
-
9,
|
|
86
|
-
,
|
|
87
|
-
10
|
|
88
|
-
]);
|
|
89
81
|
logger.info("Create a production build...\n");
|
|
90
82
|
if (!appContext.builder) {
|
|
91
83
|
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
@@ -94,21 +86,8 @@ export var build = function() {
|
|
|
94
86
|
4,
|
|
95
87
|
appContext.builder.build()
|
|
96
88
|
];
|
|
97
|
-
case
|
|
89
|
+
case 7:
|
|
98
90
|
_state.sent();
|
|
99
|
-
return [
|
|
100
|
-
3,
|
|
101
|
-
10
|
|
102
|
-
];
|
|
103
|
-
case 9:
|
|
104
|
-
error = _state.sent();
|
|
105
|
-
printBuildError(error);
|
|
106
|
-
process.exit(1);
|
|
107
|
-
return [
|
|
108
|
-
3,
|
|
109
|
-
10
|
|
110
|
-
];
|
|
111
|
-
case 10:
|
|
112
91
|
return [
|
|
113
92
|
2
|
|
114
93
|
];
|
package/dist/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { lintPlugin } from "@modern-js/plugin-lint";
|
|
7
|
-
import { cleanRequireCache, emptyDir,
|
|
7
|
+
import { cleanRequireCache, emptyDir, getCommand, getArgv } from "@modern-js/utils";
|
|
8
8
|
import { castArray } from "@modern-js/utils/lodash";
|
|
9
9
|
import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
|
|
10
10
|
import analyzePlugin from "./analyze";
|
|
@@ -16,7 +16,6 @@ import { generateWatchFiles } from "./utils/generateWatchFiles";
|
|
|
16
16
|
export { mergeConfig } from "@modern-js/core";
|
|
17
17
|
export * from "./defineConfig";
|
|
18
18
|
export * from "./types";
|
|
19
|
-
var upgradeModel = Import.lazy("@modern-js/upgrade", require);
|
|
20
19
|
export var devCommand = function() {
|
|
21
20
|
var _ref = _async_to_generator(function(program, api) {
|
|
22
21
|
var runner, devToolMetas, devProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, meta, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, subCmd;
|
|
@@ -325,6 +324,7 @@ export var appTools = function() {
|
|
|
325
324
|
commands: function commands(param) {
|
|
326
325
|
var program = param.program;
|
|
327
326
|
return _async_to_generator(function() {
|
|
327
|
+
var defineCommand;
|
|
328
328
|
return _ts_generator(this, function(_state) {
|
|
329
329
|
switch (_state.label) {
|
|
330
330
|
case 0:
|
|
@@ -464,7 +464,13 @@ export var appTools = function() {
|
|
|
464
464
|
return _ref.apply(this, arguments);
|
|
465
465
|
};
|
|
466
466
|
}());
|
|
467
|
-
|
|
467
|
+
return [
|
|
468
|
+
4,
|
|
469
|
+
import("@modern-js/upgrade")
|
|
470
|
+
];
|
|
471
|
+
case 3:
|
|
472
|
+
defineCommand = _state.sent().defineCommand;
|
|
473
|
+
defineCommand(program.command("upgrade").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)));
|
|
468
474
|
return [
|
|
469
475
|
2
|
|
470
476
|
];
|
|
@@ -474,11 +480,24 @@ export var appTools = function() {
|
|
|
474
480
|
},
|
|
475
481
|
prepare: function prepare() {
|
|
476
482
|
return _async_to_generator(function() {
|
|
477
|
-
var command, resolvedConfig, appContext2;
|
|
483
|
+
var command, isSkipBuild, resolvedConfig, appContext2;
|
|
478
484
|
return _ts_generator(this, function(_state) {
|
|
479
485
|
switch (_state.label) {
|
|
480
486
|
case 0:
|
|
481
487
|
command = getCommand();
|
|
488
|
+
if (command === "deploy") {
|
|
489
|
+
isSkipBuild = [
|
|
490
|
+
"-s",
|
|
491
|
+
"--skip-build"
|
|
492
|
+
].some(function(tag) {
|
|
493
|
+
return getArgv().includes(tag);
|
|
494
|
+
});
|
|
495
|
+
if (isSkipBuild) {
|
|
496
|
+
return [
|
|
497
|
+
2
|
|
498
|
+
];
|
|
499
|
+
}
|
|
500
|
+
}
|
|
482
501
|
if (!(command === "dev" || command === "start" || command === "build" || command === "deploy"))
|
|
483
502
|
return [
|
|
484
503
|
3,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedConfigContext } from "@modern-js/core";
|
|
2
|
-
import { logger
|
|
2
|
+
import { logger } from "@modern-js/utils";
|
|
3
3
|
import { generateRoutes } from "../utils/routes";
|
|
4
4
|
import { buildServerConfig } from "../utils/config";
|
|
5
5
|
export const build = async (api, options) => {
|
|
@@ -39,14 +39,9 @@ export const build = async (api, options) => {
|
|
|
39
39
|
distDirectory,
|
|
40
40
|
configFile: serverConfigFile
|
|
41
41
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
46
|
-
}
|
|
47
|
-
await appContext.builder.build();
|
|
48
|
-
} catch (error) {
|
|
49
|
-
printBuildError(error);
|
|
50
|
-
process.exit(1);
|
|
42
|
+
logger.info("Create a production build...\n");
|
|
43
|
+
if (!appContext.builder) {
|
|
44
|
+
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
51
45
|
}
|
|
46
|
+
await appContext.builder.build();
|
|
52
47
|
};
|
package/dist/esm-node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { lintPlugin } from "@modern-js/plugin-lint";
|
|
3
|
-
import { cleanRequireCache, emptyDir,
|
|
3
|
+
import { cleanRequireCache, emptyDir, getCommand, getArgv } from "@modern-js/utils";
|
|
4
4
|
import { castArray } from "@modern-js/utils/lodash";
|
|
5
5
|
import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
|
|
6
6
|
import analyzePlugin from "./analyze";
|
|
@@ -12,7 +12,6 @@ import { generateWatchFiles } from "./utils/generateWatchFiles";
|
|
|
12
12
|
export { mergeConfig } from "@modern-js/core";
|
|
13
13
|
export * from "./defineConfig";
|
|
14
14
|
export * from "./types";
|
|
15
|
-
const upgradeModel = Import.lazy("@modern-js/upgrade", require);
|
|
16
15
|
export const devCommand = async (program, api) => {
|
|
17
16
|
const runner = api.useHookRunners();
|
|
18
17
|
const devToolMetas = await runner.registerDev();
|
|
@@ -131,10 +130,22 @@ export const appTools = (options = {
|
|
|
131
130
|
const { inspect } = await import("./commands/inspect");
|
|
132
131
|
inspect(api, options2);
|
|
133
132
|
});
|
|
134
|
-
|
|
133
|
+
const { defineCommand } = await import("@modern-js/upgrade");
|
|
134
|
+
defineCommand(program.command("upgrade").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)));
|
|
135
135
|
},
|
|
136
136
|
async prepare() {
|
|
137
137
|
const command = getCommand();
|
|
138
|
+
if (command === "deploy") {
|
|
139
|
+
const isSkipBuild = [
|
|
140
|
+
"-s",
|
|
141
|
+
"--skip-build"
|
|
142
|
+
].some((tag) => {
|
|
143
|
+
return getArgv().includes(tag);
|
|
144
|
+
});
|
|
145
|
+
if (isSkipBuild) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
138
149
|
if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
|
|
139
150
|
const resolvedConfig = api.useResolvedConfigContext();
|
|
140
151
|
if (resolvedConfig.output.cleanDistPath) {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.26.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -73,23 +73,24 @@
|
|
|
73
73
|
"esbuild": "0.17.19",
|
|
74
74
|
"rspack-plugin-virtual-module": "0.1.0",
|
|
75
75
|
"@swc/helpers": "0.5.1",
|
|
76
|
-
"@modern-js/builder": "2.
|
|
77
|
-
"@modern-js/builder-plugin-esbuild": "2.
|
|
78
|
-
"@modern-js/builder-plugin-node-polyfill": "2.
|
|
79
|
-
"@modern-js/builder-shared": "2.
|
|
80
|
-
"@modern-js/builder-webpack-provider": "2.
|
|
81
|
-
"@modern-js/core": "2.
|
|
82
|
-
"@modern-js/new-action": "2.
|
|
83
|
-
"@modern-js/node-bundle-require": "2.
|
|
84
|
-
"@modern-js/plugin": "2.
|
|
85
|
-
"@modern-js/plugin-data-loader": "2.
|
|
86
|
-
"@modern-js/plugin-i18n": "2.
|
|
87
|
-
"@modern-js/plugin-lint": "2.
|
|
88
|
-
"@modern-js/prod-server": "2.
|
|
89
|
-
"@modern-js/server": "2.
|
|
90
|
-
"@modern-js/types": "2.
|
|
91
|
-
"@modern-js/upgrade": "2.
|
|
92
|
-
"@modern-js/utils": "2.
|
|
76
|
+
"@modern-js/builder": "2.26.0",
|
|
77
|
+
"@modern-js/builder-plugin-esbuild": "2.26.0",
|
|
78
|
+
"@modern-js/builder-plugin-node-polyfill": "2.26.0",
|
|
79
|
+
"@modern-js/builder-shared": "2.26.0",
|
|
80
|
+
"@modern-js/builder-webpack-provider": "2.26.0",
|
|
81
|
+
"@modern-js/core": "2.26.0",
|
|
82
|
+
"@modern-js/new-action": "2.26.0",
|
|
83
|
+
"@modern-js/node-bundle-require": "2.26.0",
|
|
84
|
+
"@modern-js/plugin": "2.26.0",
|
|
85
|
+
"@modern-js/plugin-data-loader": "2.26.0",
|
|
86
|
+
"@modern-js/plugin-i18n": "2.26.0",
|
|
87
|
+
"@modern-js/plugin-lint": "2.26.0",
|
|
88
|
+
"@modern-js/prod-server": "2.26.0",
|
|
89
|
+
"@modern-js/server": "2.26.0",
|
|
90
|
+
"@modern-js/types": "2.26.0",
|
|
91
|
+
"@modern-js/upgrade": "2.26.0",
|
|
92
|
+
"@modern-js/utils": "2.26.0",
|
|
93
|
+
"@modern-js/server-core": "2.26.0"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|
|
95
96
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -97,15 +98,14 @@
|
|
|
97
98
|
"@types/node": "^14",
|
|
98
99
|
"jest": "^29",
|
|
99
100
|
"typescript": "^5",
|
|
100
|
-
"webpack": "^5.
|
|
101
|
-
"@modern-js/builder-plugin-swc": "2.
|
|
102
|
-
"@modern-js/builder-rspack-provider": "2.
|
|
103
|
-
"@
|
|
104
|
-
"@scripts/build": "2.
|
|
105
|
-
"@scripts/jest-config": "2.25.1"
|
|
101
|
+
"webpack": "^5.88.1",
|
|
102
|
+
"@modern-js/builder-plugin-swc": "2.26.0",
|
|
103
|
+
"@modern-js/builder-rspack-provider": "2.26.0",
|
|
104
|
+
"@scripts/jest-config": "2.26.0",
|
|
105
|
+
"@scripts/build": "2.26.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
|
-
"@modern-js/builder-rspack-provider": "^2.
|
|
108
|
+
"@modern-js/builder-rspack-provider": "^2.26.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependenciesMeta": {
|
|
111
111
|
"@modern-js/builder-rspack-provider": {
|