@modern-js/core 2.27.0 → 2.28.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 +9 -0
- package/dist/config/createLoadedConfig.js +2 -1
- package/dist/config/createResolvedConfig.js +2 -1
- package/dist/createCli.js +12 -12
- package/dist/loadPlugins.js +2 -1
- package/dist/runBin.js +2 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -70,7 +70,8 @@ async function createLoadedConfig(appDirectory, filePath, packageJsonConfig, loa
|
|
|
70
70
|
const config = await getConfigObject(loaded.config);
|
|
71
71
|
let mergedConfig = config;
|
|
72
72
|
if (loaded.pkgConfig) {
|
|
73
|
-
|
|
73
|
+
var _loaded;
|
|
74
|
+
mergedConfig = assignPkgConfig(config, (_loaded = loaded) === null || _loaded === void 0 ? void 0 : _loaded.pkgConfig);
|
|
74
75
|
}
|
|
75
76
|
if ((0, _utils.isDevCommand)()) {
|
|
76
77
|
const localConfig = await loadLocalConfig(appDirectory, configFile);
|
|
@@ -41,7 +41,8 @@ const createResolveConfig = async (loaded, configs, schemas, onSchemaError) => {
|
|
|
41
41
|
};
|
|
42
42
|
if (!valid && ((_validate_errors = validate.errors) === null || _validate_errors === void 0 ? void 0 : _validate_errors.length)) {
|
|
43
43
|
if (onSchemaError) {
|
|
44
|
-
|
|
44
|
+
var _validate;
|
|
45
|
+
await onSchemaError((_validate = validate) === null || _validate === void 0 ? void 0 : _validate.errors[0]);
|
|
45
46
|
}
|
|
46
47
|
const errors = formatValidateError(userConfig);
|
|
47
48
|
_utils.logger.log(errors);
|
package/dist/createCli.js
CHANGED
|
@@ -41,21 +41,21 @@ const createCli = () => {
|
|
|
41
41
|
let hooksRunner;
|
|
42
42
|
let initOptions;
|
|
43
43
|
const init = async (options) => {
|
|
44
|
-
var _mergedOptions_options, _mergedOptions_internalPlugins, _mergedOptions_internalPlugins1, _mergedOptions_internalPlugins2;
|
|
44
|
+
var _options, _options1, _mergedOptions_options, _mergedOptions, _mergedOptions1, _mergedOptions2, _mergedOptions3, _mergedOptions_internalPlugins, _mergedOptions4, _mergedOptions_internalPlugins1, _mergedOptions5, _mergedOptions6, _mergedOptions7, _mergedOptions8, _mergedOptions_internalPlugins2, _mergedOptions9, _options2;
|
|
45
45
|
_manager.manager.clear();
|
|
46
46
|
const mergedOptions = mergeOptions(options);
|
|
47
47
|
initOptions = mergedOptions;
|
|
48
|
-
const appDirectory = await (0, _utils1.initAppDir)(options === null ||
|
|
48
|
+
const appDirectory = await (0, _utils1.initAppDir)((_options = options) === null || _options === void 0 ? void 0 : _options.cwd);
|
|
49
49
|
(0, _utils1.initCommandsMap)();
|
|
50
|
-
setProgramVersion(options === null ||
|
|
50
|
+
setProgramVersion((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.version);
|
|
51
51
|
var _mergedOptions_options_metaName;
|
|
52
|
-
const metaName = (_mergedOptions_options_metaName = mergedOptions === null ||
|
|
52
|
+
const metaName = (_mergedOptions_options_metaName = (_mergedOptions = mergedOptions) === null || _mergedOptions === void 0 ? void 0 : (_mergedOptions_options = _mergedOptions.options) === null || _mergedOptions_options === void 0 ? void 0 : _mergedOptions_options.metaName) !== null && _mergedOptions_options_metaName !== void 0 ? _mergedOptions_options_metaName : "MODERN";
|
|
53
53
|
(0, _loadEnv.loadEnv)(appDirectory, process.env[`${metaName.toUpperCase()}_ENV`]);
|
|
54
|
-
const loaded = await (0, _config.createLoadedConfig)(appDirectory, mergedOptions === null ||
|
|
54
|
+
const loaded = await (0, _config.createLoadedConfig)(appDirectory, (_mergedOptions1 = mergedOptions) === null || _mergedOptions1 === void 0 ? void 0 : _mergedOptions1.configFile, (_mergedOptions2 = mergedOptions) === null || _mergedOptions2 === void 0 ? void 0 : _mergedOptions2.packageJsonConfig, (_mergedOptions3 = mergedOptions) === null || _mergedOptions3 === void 0 ? void 0 : _mergedOptions3.loadedConfig);
|
|
55
55
|
const plugins = await (0, _loadPlugins.loadPlugins)(appDirectory, loaded.config, {
|
|
56
|
-
internalPlugins: mergedOptions === null ||
|
|
57
|
-
autoLoad: mergedOptions === null ||
|
|
58
|
-
forceAutoLoadPlugins: mergedOptions === null ||
|
|
56
|
+
internalPlugins: (_mergedOptions4 = mergedOptions) === null || _mergedOptions4 === void 0 ? void 0 : (_mergedOptions_internalPlugins = _mergedOptions4.internalPlugins) === null || _mergedOptions_internalPlugins === void 0 ? void 0 : _mergedOptions_internalPlugins.cli,
|
|
57
|
+
autoLoad: (_mergedOptions5 = mergedOptions) === null || _mergedOptions5 === void 0 ? void 0 : (_mergedOptions_internalPlugins1 = _mergedOptions5.internalPlugins) === null || _mergedOptions_internalPlugins1 === void 0 ? void 0 : _mergedOptions_internalPlugins1.autoLoad,
|
|
58
|
+
forceAutoLoadPlugins: (_mergedOptions6 = mergedOptions) === null || _mergedOptions6 === void 0 ? void 0 : _mergedOptions6.forceAutoLoadPlugins
|
|
59
59
|
});
|
|
60
60
|
(0, _checkIsDuplicationPlugin.checkIsDuplicationPlugin)(plugins.map((plugin) => plugin.name), loaded.config.autoLoadPlugins);
|
|
61
61
|
plugins.forEach((plugin) => plugin && _manager.manager.usePlugin(plugin));
|
|
@@ -63,9 +63,9 @@ const createCli = () => {
|
|
|
63
63
|
appDirectory,
|
|
64
64
|
plugins,
|
|
65
65
|
configFile: loaded.filePath,
|
|
66
|
-
options: mergedOptions === null ||
|
|
67
|
-
serverConfigFile: mergedOptions === null ||
|
|
68
|
-
serverInternalPlugins: (mergedOptions === null ||
|
|
66
|
+
options: (_mergedOptions7 = mergedOptions) === null || _mergedOptions7 === void 0 ? void 0 : _mergedOptions7.options,
|
|
67
|
+
serverConfigFile: (_mergedOptions8 = mergedOptions) === null || _mergedOptions8 === void 0 ? void 0 : _mergedOptions8.serverConfigFile,
|
|
68
|
+
serverInternalPlugins: ((_mergedOptions9 = mergedOptions) === null || _mergedOptions9 === void 0 ? void 0 : (_mergedOptions_internalPlugins2 = _mergedOptions9.internalPlugins) === null || _mergedOptions_internalPlugins2 === void 0 ? void 0 : _mergedOptions_internalPlugins2.server) || _utils.INTERNAL_SERVER_PLUGINS
|
|
69
69
|
});
|
|
70
70
|
_context.ConfigContext.set(loaded.config);
|
|
71
71
|
_context.AppContext.set(appContext);
|
|
@@ -89,7 +89,7 @@ const createCli = () => {
|
|
|
89
89
|
await hooksRunner.beforeConfig();
|
|
90
90
|
const extraConfigs = await hooksRunner.config();
|
|
91
91
|
const extraSchemas = await hooksRunner.validateSchema();
|
|
92
|
-
const normalizedConfig = await (0, _config.createResolveConfig)(loaded, extraConfigs, extraSchemas, options === null ||
|
|
92
|
+
const normalizedConfig = await (0, _config.createResolveConfig)(loaded, extraConfigs, extraSchemas, (_options2 = options) === null || _options2 === void 0 ? void 0 : _options2.onSchemaError);
|
|
93
93
|
const { resolved } = await hooksRunner.resolvedConfig({
|
|
94
94
|
resolved: normalizedConfig
|
|
95
95
|
});
|
package/dist/loadPlugins.js
CHANGED
|
@@ -52,7 +52,8 @@ const loadPlugins = async (appDirectory, userConfig, options = {}) => {
|
|
|
52
52
|
return loadedPlugin;
|
|
53
53
|
}));
|
|
54
54
|
if (!isOldPluginConfig(pluginConfig)) {
|
|
55
|
-
|
|
55
|
+
var _pluginConfig;
|
|
56
|
+
if ((_pluginConfig = pluginConfig) === null || _pluginConfig === void 0 ? void 0 : _pluginConfig.length) {
|
|
56
57
|
loadedPlugins.push(...pluginConfig.map((item) => (0, _manager.createPlugin)(item.setup, item)));
|
|
57
58
|
}
|
|
58
59
|
}
|
package/dist/runBin.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "run", {
|
|
|
12
12
|
const _utils = require("@modern-js/utils");
|
|
13
13
|
const _ = require(".");
|
|
14
14
|
const run = async (otherCoreOptions = {}, options = {}) => {
|
|
15
|
+
var _options;
|
|
15
16
|
const command = process.argv[2];
|
|
16
17
|
if (!process.env.NODE_ENV) {
|
|
17
18
|
if ([
|
|
@@ -53,7 +54,7 @@ const run = async (otherCoreOptions = {}, options = {}) => {
|
|
|
53
54
|
}
|
|
54
55
|
if (typeof options.override === "boolean" && options.override) {
|
|
55
56
|
await _.cli.run(otherCoreOptions);
|
|
56
|
-
} else if (typeof (options === null ||
|
|
57
|
+
} else if (typeof ((_options = options) === null || _options === void 0 ? void 0 : _options.override) === "function") {
|
|
57
58
|
await _.cli.run(await options.override(runOptions));
|
|
58
59
|
} else {
|
|
59
60
|
await _.cli.run(_utils.lodash.merge({}, runOptions, otherCoreOptions));
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"modern",
|
|
15
15
|
"modern.js"
|
|
16
16
|
],
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.28.0",
|
|
18
18
|
"jsnext:source": "./src/index.ts",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@swc/helpers": "0.5.1",
|
|
73
|
-
"@modern-js/node-bundle-require": "2.
|
|
74
|
-
"@modern-js/plugin": "2.
|
|
75
|
-
"@modern-js/utils": "2.
|
|
73
|
+
"@modern-js/node-bundle-require": "2.28.0",
|
|
74
|
+
"@modern-js/plugin": "2.28.0",
|
|
75
|
+
"@modern-js/utils": "2.28.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/jest": "^29",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"tsm": "2.3.0",
|
|
81
81
|
"jest": "^29",
|
|
82
82
|
"typescript": "^5",
|
|
83
|
-
"@modern-js/builder-shared": "2.
|
|
84
|
-
"@modern-js/types": "2.
|
|
85
|
-
"@scripts/build": "2.
|
|
86
|
-
"@scripts/jest-config": "2.
|
|
83
|
+
"@modern-js/builder-shared": "2.28.0",
|
|
84
|
+
"@modern-js/types": "2.28.0",
|
|
85
|
+
"@scripts/build": "2.28.0",
|
|
86
|
+
"@scripts/jest-config": "2.28.0"
|
|
87
87
|
},
|
|
88
88
|
"sideEffects": false,
|
|
89
89
|
"publishConfig": {
|