@modern-js/core 1.19.0 → 1.20.1
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 +30 -1
- package/dist/config/index.js +12 -7
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @modern-js/core
|
|
2
2
|
|
|
3
|
+
## 1.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [49515c5]
|
|
8
|
+
- @modern-js/utils@1.20.1
|
|
9
|
+
- @modern-js/node-bundle-require@1.20.1
|
|
10
|
+
- @modern-js/plugin@1.20.1
|
|
11
|
+
|
|
12
|
+
## 1.20.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 4ddc185: chore(builder): bump webpack to 5.74.0
|
|
17
|
+
|
|
18
|
+
chore(builder): 升级 webpack 到 5.74.0 版本
|
|
19
|
+
|
|
20
|
+
- d5d570b: fix(core): failed to log validate config errors from plugins
|
|
21
|
+
|
|
22
|
+
fix(core): 修复校验 plugin 中的 config 异常时,日志格式不正确的问题
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [d5d570b]
|
|
25
|
+
- Updated dependencies [4ddc185]
|
|
26
|
+
- Updated dependencies [df8ee7e]
|
|
27
|
+
- Updated dependencies [8c05089]
|
|
28
|
+
- @modern-js/utils@1.20.0
|
|
29
|
+
- @modern-js/node-bundle-require@1.20.0
|
|
30
|
+
- @modern-js/plugin@1.20.0
|
|
31
|
+
|
|
3
32
|
## 1.19.0
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -99,7 +128,7 @@
|
|
|
99
128
|
|
|
100
129
|
### Minor Changes
|
|
101
130
|
|
|
102
|
-
- 7b9067f: add babel plugin for
|
|
131
|
+
- 7b9067f: add babel plugin for builder
|
|
103
132
|
|
|
104
133
|
### Patch Changes
|
|
105
134
|
|
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.1",
|
|
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.1",
|
|
42
|
+
"@modern-js/plugin": "1.20.1",
|
|
43
|
+
"@modern-js/utils": "1.20.1"
|
|
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.1",
|
|
48
|
+
"@modern-js/types": "1.20.1",
|
|
49
|
+
"@scripts/build": "1.20.1",
|
|
50
|
+
"@scripts/jest-config": "1.20.1",
|
|
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": {
|