@modern-js/core 1.18.1 → 1.20.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 +31 -1
- package/dist/bin.js +1 -1
- package/dist/config/index.js +12 -7
- package/package.json +10 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @modern-js/core
|
|
2
2
|
|
|
3
|
+
## 1.20.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4ddc185: chore(builder): bump webpack to 5.74.0
|
|
8
|
+
|
|
9
|
+
chore(builder): 升级 webpack 到 5.74.0 版本
|
|
10
|
+
|
|
11
|
+
- d5d570b: fix(core): failed to log validate config errors from plugins
|
|
12
|
+
|
|
13
|
+
fix(core): 修复校验 plugin 中的 config 异常时,日志格式不正确的问题
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [d5d570b]
|
|
16
|
+
- Updated dependencies [4ddc185]
|
|
17
|
+
- Updated dependencies [df8ee7e]
|
|
18
|
+
- Updated dependencies [8c05089]
|
|
19
|
+
- @modern-js/utils@1.20.0
|
|
20
|
+
- @modern-js/node-bundle-require@1.20.0
|
|
21
|
+
- @modern-js/plugin@1.20.0
|
|
22
|
+
|
|
23
|
+
## 1.19.0
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- d2cfa69: feat: add production env for release command
|
|
28
|
+
feat: 为 release 命令增加 production 环境变量
|
|
29
|
+
- @modern-js/node-bundle-require@1.19.0
|
|
30
|
+
- @modern-js/plugin@1.19.0
|
|
31
|
+
- @modern-js/utils@1.19.0
|
|
32
|
+
|
|
3
33
|
## 1.18.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -89,7 +119,7 @@
|
|
|
89
119
|
|
|
90
120
|
### Minor Changes
|
|
91
121
|
|
|
92
|
-
- 7b9067f: add babel plugin for
|
|
122
|
+
- 7b9067f: add babel plugin for builder
|
|
93
123
|
|
|
94
124
|
### Patch Changes
|
|
95
125
|
|
package/dist/bin.js
CHANGED
|
@@ -8,7 +8,7 @@ const utils_1 = require("@modern-js/utils");
|
|
|
8
8
|
const _1 = require(".");
|
|
9
9
|
const command = process.argv[2];
|
|
10
10
|
if (!process.env.NODE_ENV) {
|
|
11
|
-
if (['build', 'start', 'deploy'].includes(command)) {
|
|
11
|
+
if (['build', 'start', 'deploy', 'release'].includes(command)) {
|
|
12
12
|
process.env.NODE_ENV = 'production';
|
|
13
13
|
}
|
|
14
14
|
else if (command === 'test') {
|
package/dist/config/index.js
CHANGED
|
@@ -89,12 +89,12 @@ const showAdditionalPropertiesError = async (error) => {
|
|
|
89
89
|
const name = Object.keys(utils_1.PLUGIN_SCHEMAS).find(key => utils_1.PLUGIN_SCHEMAS[key].some((schemaItem) => schemaItem.target === target));
|
|
90
90
|
if (name) {
|
|
91
91
|
const packageManager = await (0, utils_1.getPackageManager)();
|
|
92
|
-
utils_1.
|
|
92
|
+
utils_1.logger.warn(`The configuration of ${utils_1.chalk.bold(target)} is provided by plugin ${utils_1.chalk.bold(name)}. Please use ${utils_1.chalk.bold(`${packageManager} run new`)} to enable the corresponding capability.\n`);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
const resolveConfig = async (loaded, configs, schemas, restartWithExistingPort, argv, onSchemaError = showAdditionalPropertiesError) => {
|
|
97
|
-
var _a
|
|
97
|
+
var _a;
|
|
98
98
|
const { default: Ajv } = await Promise.resolve().then(() => __importStar(require('@modern-js/utils/ajv')));
|
|
99
99
|
const { default: ajvKeywords } = await Promise.resolve().then(() => __importStar(require('@modern-js/utils/ajv-keywords')));
|
|
100
100
|
const { default: betterAjvErrors } = await Promise.resolve().then(() => __importStar(require('@modern-js/utils/better-ajv-errors')));
|
|
@@ -106,21 +106,26 @@ const resolveConfig = async (loaded, configs, schemas, restartWithExistingPort,
|
|
|
106
106
|
(0, repeatKeyWarning_1.repeatKeyWarning)(validateSchema, jsConfig, pkgConfig);
|
|
107
107
|
// validate user config.
|
|
108
108
|
const valid = validate(userConfig);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const formatValidateError = (config) => {
|
|
110
|
+
var _a;
|
|
111
|
+
return betterAjvErrors(validateSchema, config, (_a = validate.errors) === null || _a === void 0 ? void 0 : _a.map(e => ({
|
|
112
112
|
...e,
|
|
113
113
|
dataPath: e.instancePath,
|
|
114
114
|
})), {
|
|
115
115
|
indent: 2,
|
|
116
116
|
});
|
|
117
|
-
|
|
117
|
+
};
|
|
118
|
+
if (!valid && ((_a = validate.errors) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
119
|
+
await onSchemaError(validate === null || validate === void 0 ? void 0 : validate.errors[0]);
|
|
120
|
+
const errors = formatValidateError(userConfig);
|
|
121
|
+
utils_1.logger.log(errors);
|
|
118
122
|
throw new Error(`Validate configuration error`);
|
|
119
123
|
}
|
|
120
124
|
// validate config from plugins.
|
|
121
125
|
for (const config of configs) {
|
|
122
126
|
if (!validate(config)) {
|
|
123
|
-
|
|
127
|
+
const errors = formatValidateError(config);
|
|
128
|
+
utils_1.logger.error(errors);
|
|
124
129
|
throw new Error(`Validate configuration error.`);
|
|
125
130
|
}
|
|
126
131
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"modern",
|
|
11
11
|
"modern.js"
|
|
12
12
|
],
|
|
13
|
-
"version": "1.
|
|
13
|
+
"version": "1.20.0",
|
|
14
14
|
"jsnext:source": "./src/index.ts",
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"main": "./dist/index.js",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@modern-js/node-bundle-require": "1.
|
|
42
|
-
"@modern-js/plugin": "1.
|
|
43
|
-
"@modern-js/utils": "1.
|
|
41
|
+
"@modern-js/node-bundle-require": "1.20.0",
|
|
42
|
+
"@modern-js/plugin": "1.20.0",
|
|
43
|
+
"@modern-js/utils": "1.20.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/types": "^27.0.6",
|
|
47
|
-
"@modern-js/babel-preset-app": "1.
|
|
48
|
-
"@modern-js/types": "1.
|
|
49
|
-
"@scripts/build": "1.
|
|
50
|
-
"@scripts/jest-config": "1.
|
|
47
|
+
"@modern-js/babel-preset-app": "1.20.0",
|
|
48
|
+
"@modern-js/types": "1.20.0",
|
|
49
|
+
"@scripts/build": "1.20.0",
|
|
50
|
+
"@scripts/jest-config": "1.20.0",
|
|
51
51
|
"@types/babel__code-frame": "^7.0.3",
|
|
52
52
|
"@types/babel__core": "^7.1.16",
|
|
53
53
|
"@types/jest": "^27",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"sass": "^1.45.0",
|
|
62
62
|
"terser-webpack-plugin": "^5.1.4",
|
|
63
63
|
"typescript": "^4",
|
|
64
|
-
"webpack": "^5.
|
|
64
|
+
"webpack": "^5.74.0"
|
|
65
65
|
},
|
|
66
66
|
"sideEffects": false,
|
|
67
67
|
"publishConfig": {
|
|
@@ -96,6 +96,5 @@
|
|
|
96
96
|
"build": "wireit",
|
|
97
97
|
"dev": "tsc --watch",
|
|
98
98
|
"test": "wireit"
|
|
99
|
-
}
|
|
100
|
-
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
|
99
|
+
}
|
|
101
100
|
}
|