@modern-js/core 2.9.0 → 2.10.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 +30 -0
- package/dist/config/createLoadedConfig.js +4 -0
- package/dist/index.js +5 -0
- package/dist/utils/checkIsDuplicationPlugin.d.ts +1 -0
- package/dist/utils/checkIsDuplicationPlugin.js +25 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +19 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @modern-js/core
|
|
2
2
|
|
|
3
|
+
## 2.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a16b9b0: feat: warning when user registe plugin duplication
|
|
8
|
+
feat: 当用户重复注册插件时进行 warning 提示
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 0da32d0: chore: upgrade jest and puppeteer
|
|
13
|
+
chore: 升级 jest 和 puppeteer 到 latest
|
|
14
|
+
- d3f0642: feat(core): throw warnings when config file is not found
|
|
15
|
+
|
|
16
|
+
feat(core): 找不到配置文件时抛出 warning
|
|
17
|
+
|
|
18
|
+
- 0d9962b: fix: add types field in package.json
|
|
19
|
+
fix: 添加 package.json 中的 types 字段
|
|
20
|
+
- fbefa7e: chore(deps): bump webpack from 5.75.0 to 5.76.2
|
|
21
|
+
|
|
22
|
+
chore(deps): 将 webpack 从 5.75.0 升级至 5.76.2
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [0da32d0]
|
|
25
|
+
- Updated dependencies [0d9962b]
|
|
26
|
+
- Updated dependencies [fbefa7e]
|
|
27
|
+
- Updated dependencies [4d54233]
|
|
28
|
+
- Updated dependencies [6db4864]
|
|
29
|
+
- @modern-js/node-bundle-require@2.10.0
|
|
30
|
+
- @modern-js/plugin@2.10.0
|
|
31
|
+
- @modern-js/utils@2.10.0
|
|
32
|
+
|
|
3
33
|
## 2.9.0
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -56,6 +56,10 @@ async function loadLocalConfig(appDirectory, configFile) {
|
|
|
56
56
|
async function createLoadedConfig(appDirectory, filePath, packageJsonConfig) {
|
|
57
57
|
const configFile = (0, loadConfig_1.getConfigFilePath)(appDirectory, filePath);
|
|
58
58
|
const loaded = await (0, loadConfig_1.loadConfig)(appDirectory, configFile, packageJsonConfig);
|
|
59
|
+
if (!loaded.config && !loaded.pkgConfig) {
|
|
60
|
+
utils_1.logger.warn(`Can not find any config file in the current project, please check if you have a correct config file.`);
|
|
61
|
+
utils_1.logger.warn(`Current project path: ${utils_1.chalk.yellow(appDirectory)}`);
|
|
62
|
+
}
|
|
59
63
|
const config = await getConfigObject(loaded.config);
|
|
60
64
|
let mergedConfig = config;
|
|
61
65
|
if (loaded.pkgConfig) {
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ Object.defineProperty(exports, "initAppContext", { enumerable: true, get: functi
|
|
|
27
27
|
const loadEnv_1 = require("./loadEnv");
|
|
28
28
|
const manager_1 = require("./manager");
|
|
29
29
|
const config_1 = require("./config");
|
|
30
|
+
const checkIsDuplicationPlugin_1 = require("./utils/checkIsDuplicationPlugin");
|
|
30
31
|
__exportStar(require("./types"), exports);
|
|
31
32
|
__exportStar(require("@modern-js/plugin"), exports);
|
|
32
33
|
var manager_2 = require("./manager");
|
|
@@ -84,6 +85,7 @@ const createCli = () => {
|
|
|
84
85
|
autoLoad: (_d = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _d === void 0 ? void 0 : _d.autoLoad,
|
|
85
86
|
forceAutoLoadPlugins: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.forceAutoLoadPlugins,
|
|
86
87
|
});
|
|
88
|
+
(0, checkIsDuplicationPlugin_1.checkIsDuplicationPlugin)(plugins.map(plugin => plugin.name), loaded.config.autoLoadPlugins);
|
|
87
89
|
plugins.forEach(plugin => plugin && manager_1.manager.usePlugin(plugin));
|
|
88
90
|
const appContext = (0, context_1.initAppContext)({
|
|
89
91
|
toolsType: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.toolsType,
|
|
@@ -131,6 +133,9 @@ const createCli = () => {
|
|
|
131
133
|
await hooksRunner.commands({ program: utils_1.program });
|
|
132
134
|
await (0, utils_2.createFileWatcher)(appContext, hooksRunner);
|
|
133
135
|
utils_1.program.parse(process.argv);
|
|
136
|
+
if (!utils_1.program.commands || !utils_1.program.commands.length) {
|
|
137
|
+
utils_1.logger.warn('No command found, please make sure you have registered plugins correctly.');
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
140
|
async function test(argv, options) {
|
|
136
141
|
const newProgram = new utils_1.Command();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkIsDuplicationPlugin(plugins: (string | undefined)[], autoLoadPlugin?: boolean): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkIsDuplicationPlugin = void 0;
|
|
4
|
+
const utils_1 = require("@modern-js/utils");
|
|
5
|
+
function checkIsDuplicationPlugin(plugins, autoLoadPlugin = false) {
|
|
6
|
+
const set = new Set();
|
|
7
|
+
const duplicationPlugins = [];
|
|
8
|
+
plugins
|
|
9
|
+
.filter(plugin => typeof plugin === 'string')
|
|
10
|
+
.forEach(plugin => {
|
|
11
|
+
if (set.has(plugin)) {
|
|
12
|
+
duplicationPlugins.push(plugin);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
set.add(plugin);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (duplicationPlugins.length > 0) {
|
|
19
|
+
utils_1.logger.warn(`Duplicate registration plugins: ${duplicationPlugins.join(',')}.`);
|
|
20
|
+
if (autoLoadPlugin) {
|
|
21
|
+
utils_1.logger.warn('This is probably because you enabled `autoLoadPlugin` configuration and also registered these plugins manually');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.checkIsDuplicationPlugin = checkIsDuplicationPlugin;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -18,3 +18,4 @@ __exportStar(require("./commander"), exports);
|
|
|
18
18
|
__exportStar(require("./createFileWatcher"), exports);
|
|
19
19
|
__exportStar(require("./mergeConfig"), exports);
|
|
20
20
|
__exportStar(require("./repeatKeyWarning"), exports);
|
|
21
|
+
__exportStar(require("./checkIsDuplicationPlugin"), exports);
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"modern",
|
|
11
11
|
"modern.js"
|
|
12
12
|
],
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.10.0",
|
|
14
14
|
"jsnext:source": "./src/index.ts",
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"main": "./dist/index.js",
|
|
@@ -28,11 +28,18 @@
|
|
|
28
28
|
"jsnext:source": "./src/bin.ts",
|
|
29
29
|
"default": "./dist/bin.js"
|
|
30
30
|
},
|
|
31
|
+
"./config": {
|
|
32
|
+
"jsnext:source": "./src/config.ts",
|
|
33
|
+
"types": "./dist/config/types/index.d.ts",
|
|
34
|
+
"default": "./dist/config/index.js"
|
|
35
|
+
},
|
|
31
36
|
"./runBin": {
|
|
32
37
|
"jsnext:source": "./src/runBin.ts",
|
|
38
|
+
"types": "./dist/runBin.d.ts",
|
|
33
39
|
"default": "./dist/runBin.js"
|
|
34
40
|
},
|
|
35
41
|
"./types": {
|
|
42
|
+
"types": "./dist/types/index.d.ts",
|
|
36
43
|
"default": "./dist/types/index.js"
|
|
37
44
|
}
|
|
38
45
|
},
|
|
@@ -50,31 +57,30 @@
|
|
|
50
57
|
}
|
|
51
58
|
},
|
|
52
59
|
"dependencies": {
|
|
53
|
-
"@modern-js/node-bundle-require": "2.
|
|
54
|
-
"@modern-js/plugin": "2.
|
|
55
|
-
"@modern-js/utils": "2.
|
|
60
|
+
"@modern-js/node-bundle-require": "2.10.0",
|
|
61
|
+
"@modern-js/plugin": "2.10.0",
|
|
62
|
+
"@modern-js/utils": "2.10.0"
|
|
56
63
|
},
|
|
57
64
|
"devDependencies": {
|
|
58
|
-
"@jest/types": "^27.0.6",
|
|
59
65
|
"@types/babel__code-frame": "^7.0.3",
|
|
60
66
|
"@types/babel__core": "^7.1.16",
|
|
61
|
-
"@types/jest": "^
|
|
67
|
+
"@types/jest": "^29",
|
|
62
68
|
"@types/less": "^3.0.3",
|
|
63
69
|
"@types/node": "^14",
|
|
64
70
|
"autoprefixer": "10.4.13",
|
|
65
71
|
"btsm": "2.2.2",
|
|
66
72
|
"html-webpack-plugin": "5.5.0",
|
|
67
|
-
"jest": "^
|
|
73
|
+
"jest": "^29",
|
|
68
74
|
"postcss": "8.4.21",
|
|
69
75
|
"sass": "^1.45.0",
|
|
70
76
|
"terser-webpack-plugin": "^5.1.4",
|
|
71
77
|
"typescript": "^4",
|
|
72
|
-
"webpack": "^5.
|
|
73
|
-
"@modern-js/builder-shared": "2.
|
|
74
|
-
"@modern-js/babel-preset-app": "2.
|
|
75
|
-
"@modern-js/types": "2.
|
|
76
|
-
"@scripts/
|
|
77
|
-
"@scripts/
|
|
78
|
+
"webpack": "^5.76.2",
|
|
79
|
+
"@modern-js/builder-shared": "2.10.0",
|
|
80
|
+
"@modern-js/babel-preset-app": "2.10.0",
|
|
81
|
+
"@modern-js/types": "2.10.0",
|
|
82
|
+
"@scripts/build": "2.10.0",
|
|
83
|
+
"@scripts/jest-config": "2.10.0"
|
|
78
84
|
},
|
|
79
85
|
"sideEffects": false,
|
|
80
86
|
"publishConfig": {
|