@modern-js/plugin-v2 2.66.0 → 2.67.1-alpha.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/dist/cjs/cli/api.js +15 -1
- package/dist/cjs/cli/context.js +1 -0
- package/dist/cjs/cli/run/create.js +5 -3
- package/dist/esm/cli/api.js +14 -2
- package/dist/esm/cli/context.js +1 -0
- package/dist/esm/cli/run/create.js +6 -4
- package/dist/esm-node/cli/api.js +16 -2
- package/dist/esm-node/cli/context.js +1 -0
- package/dist/esm-node/cli/run/create.js +5 -3
- package/dist/types/cli/context.d.ts +1 -0
- package/dist/types/types/cli/context.d.ts +1 -0
- package/package.json +8 -8
package/dist/cjs/cli/api.js
CHANGED
|
@@ -21,6 +21,7 @@ __export(api_exports, {
|
|
|
21
21
|
initPluginAPI: () => initPluginAPI
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(api_exports);
|
|
24
|
+
var import_utils = require("@modern-js/utils");
|
|
24
25
|
var import_lodash = require("@modern-js/utils/lodash");
|
|
25
26
|
var import_debug = require("./run/utils/debug");
|
|
26
27
|
function initPluginAPI({ context, pluginManager }) {
|
|
@@ -64,7 +65,20 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
function updateAppContext(updateContext) {
|
|
67
|
-
context = (0, import_lodash.
|
|
68
|
+
context = (0, import_lodash.assignWith)(context, updateContext, (source, target) => {
|
|
69
|
+
if (Array.isArray(target) || Array.isArray(source)) {
|
|
70
|
+
if (target === void 0) {
|
|
71
|
+
return source;
|
|
72
|
+
}
|
|
73
|
+
if (source === void 0) {
|
|
74
|
+
return target;
|
|
75
|
+
}
|
|
76
|
+
return [
|
|
77
|
+
...(0, import_utils.ensureArray)(target),
|
|
78
|
+
...(0, import_utils.ensureArray)(source)
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
68
82
|
}
|
|
69
83
|
const pluginAPI = {
|
|
70
84
|
isPluginExists: pluginManager.isPluginExists,
|
package/dist/cjs/cli/context.js
CHANGED
|
@@ -37,6 +37,7 @@ var import_hooks = require("./hooks");
|
|
|
37
37
|
function initAppContext(params) {
|
|
38
38
|
const { appDirectory, srcDir = "src", distDir = "dist" } = params;
|
|
39
39
|
return {
|
|
40
|
+
metaName: params.metaName,
|
|
40
41
|
packageName: params.packageName,
|
|
41
42
|
configFile: params.configFile,
|
|
42
43
|
command: params.command,
|
|
@@ -58,11 +58,12 @@ const createCli = () => {
|
|
|
58
58
|
var _context_hooks_onAfterPrepare, _context_hooks;
|
|
59
59
|
pluginManager.clear();
|
|
60
60
|
initOptions = options;
|
|
61
|
-
const { metaName = "
|
|
61
|
+
const { metaName = "modern-js", configFile, config, command, version, packageJsonConfig, internalPlugins, handleSetupResult } = options;
|
|
62
62
|
const appDirectory = await (0, import_initAppDir.initAppDir)(options === null || options === void 0 ? void 0 : options.cwd);
|
|
63
63
|
(0, import_commander2.initCommandsMap)();
|
|
64
64
|
(0, import_commander2.setProgramVersion)(version);
|
|
65
|
-
|
|
65
|
+
const envName = metaName === "modern-js" ? "MODERN" : metaName;
|
|
66
|
+
(0, import_loadEnv.loadEnv)(appDirectory, process.env[`${envName.toUpperCase()}_ENV`]);
|
|
66
67
|
const loaded = await (0, import_createLoadedConfig.createLoadedConfig)(appDirectory, configFile, packageJsonConfig, config);
|
|
67
68
|
const allPlugins = [
|
|
68
69
|
...internalPlugins || [],
|
|
@@ -78,7 +79,8 @@ const createCli = () => {
|
|
|
78
79
|
configFile: loaded.configFile,
|
|
79
80
|
command,
|
|
80
81
|
appDirectory,
|
|
81
|
-
plugins
|
|
82
|
+
plugins,
|
|
83
|
+
metaName
|
|
82
84
|
}),
|
|
83
85
|
config: loaded.config,
|
|
84
86
|
normalizedConfig: {}
|
package/dist/esm/cli/api.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
3
|
-
import {
|
|
3
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
|
+
import { ensureArray } from "@modern-js/utils";
|
|
5
|
+
import { assignWith } from "@modern-js/utils/lodash";
|
|
4
6
|
import { debug } from "./run/utils/debug";
|
|
5
7
|
function initPluginAPI(param) {
|
|
6
8
|
var context = param.context, pluginManager = param.pluginManager;
|
|
@@ -50,7 +52,17 @@ function initPluginAPI(param) {
|
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
54
|
function updateAppContext(updateContext) {
|
|
53
|
-
context =
|
|
55
|
+
context = assignWith(context, updateContext, function(source, target) {
|
|
56
|
+
if (Array.isArray(target) || Array.isArray(source)) {
|
|
57
|
+
if (target === void 0) {
|
|
58
|
+
return source;
|
|
59
|
+
}
|
|
60
|
+
if (source === void 0) {
|
|
61
|
+
return target;
|
|
62
|
+
}
|
|
63
|
+
return _to_consumable_array(ensureArray(target)).concat(_to_consumable_array(ensureArray(source)));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
54
66
|
}
|
|
55
67
|
var pluginAPI = _object_spread({
|
|
56
68
|
isPluginExists: pluginManager.isPluginExists,
|
package/dist/esm/cli/context.js
CHANGED
|
@@ -7,6 +7,7 @@ import { initHooks } from "./hooks";
|
|
|
7
7
|
function initAppContext(params) {
|
|
8
8
|
var appDirectory = params.appDirectory, _params_srcDir = params.srcDir, srcDir = _params_srcDir === void 0 ? "src" : _params_srcDir, _params_distDir = params.distDir, distDir = _params_distDir === void 0 ? "dist" : _params_distDir;
|
|
9
9
|
return {
|
|
10
|
+
metaName: params.metaName,
|
|
10
11
|
packageName: params.packageName,
|
|
11
12
|
configFile: params.configFile,
|
|
12
13
|
command: params.command,
|
|
@@ -62,13 +62,13 @@ var createCli = function() {
|
|
|
62
62
|
var existListenerMap = /* @__PURE__ */ new Map();
|
|
63
63
|
function _init() {
|
|
64
64
|
_init = _async_to_generator(function(options) {
|
|
65
|
-
var _context_hooks_onAfterPrepare, _context_hooks, _options_metaName, metaName, configFile, config, command, version, packageJsonConfig, internalPlugins, handleSetupResult, appDirectory, loaded, allPlugins, plugins, context, pluginAPI, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _plugin_setup, setupResult, err, extraConfigs, normalizedConfig, resolved;
|
|
65
|
+
var _context_hooks_onAfterPrepare, _context_hooks, _options_metaName, metaName, configFile, config, command, version, packageJsonConfig, internalPlugins, handleSetupResult, appDirectory, envName, loaded, allPlugins, plugins, context, pluginAPI, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _plugin_setup, setupResult, err, extraConfigs, normalizedConfig, resolved;
|
|
66
66
|
return _ts_generator(this, function(_state) {
|
|
67
67
|
switch (_state.label) {
|
|
68
68
|
case 0:
|
|
69
69
|
pluginManager.clear();
|
|
70
70
|
initOptions = options;
|
|
71
|
-
_options_metaName = options.metaName, metaName = _options_metaName === void 0 ? "
|
|
71
|
+
_options_metaName = options.metaName, metaName = _options_metaName === void 0 ? "modern-js" : _options_metaName, configFile = options.configFile, config = options.config, command = options.command, version = options.version, packageJsonConfig = options.packageJsonConfig, internalPlugins = options.internalPlugins, handleSetupResult = options.handleSetupResult;
|
|
72
72
|
return [
|
|
73
73
|
4,
|
|
74
74
|
initAppDir(options === null || options === void 0 ? void 0 : options.cwd)
|
|
@@ -77,7 +77,8 @@ var createCli = function() {
|
|
|
77
77
|
appDirectory = _state.sent();
|
|
78
78
|
initCommandsMap();
|
|
79
79
|
setProgramVersion(version);
|
|
80
|
-
|
|
80
|
+
envName = metaName === "modern-js" ? "MODERN" : metaName;
|
|
81
|
+
loadEnv(appDirectory, process.env["".concat(envName.toUpperCase(), "_ENV")]);
|
|
81
82
|
return [
|
|
82
83
|
4,
|
|
83
84
|
createLoadedConfig(appDirectory, configFile, packageJsonConfig, config)
|
|
@@ -106,7 +107,8 @@ var createCli = function() {
|
|
|
106
107
|
configFile: loaded.configFile,
|
|
107
108
|
command,
|
|
108
109
|
appDirectory,
|
|
109
|
-
plugins
|
|
110
|
+
plugins,
|
|
111
|
+
metaName
|
|
110
112
|
}),
|
|
111
113
|
config: loaded.config,
|
|
112
114
|
normalizedConfig: {}
|
package/dist/esm-node/cli/api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureArray } from "@modern-js/utils";
|
|
2
|
+
import { assignWith } from "@modern-js/utils/lodash";
|
|
2
3
|
import { debug } from "./run/utils/debug";
|
|
3
4
|
function initPluginAPI({ context, pluginManager }) {
|
|
4
5
|
const { hooks, extendsHooks, plugins } = context;
|
|
@@ -41,7 +42,20 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
function updateAppContext(updateContext) {
|
|
44
|
-
context =
|
|
45
|
+
context = assignWith(context, updateContext, (source, target) => {
|
|
46
|
+
if (Array.isArray(target) || Array.isArray(source)) {
|
|
47
|
+
if (target === void 0) {
|
|
48
|
+
return source;
|
|
49
|
+
}
|
|
50
|
+
if (source === void 0) {
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
return [
|
|
54
|
+
...ensureArray(target),
|
|
55
|
+
...ensureArray(source)
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
45
59
|
}
|
|
46
60
|
const pluginAPI = {
|
|
47
61
|
isPluginExists: pluginManager.isPluginExists,
|
|
@@ -3,6 +3,7 @@ import { initHooks } from "./hooks";
|
|
|
3
3
|
function initAppContext(params) {
|
|
4
4
|
const { appDirectory, srcDir = "src", distDir = "dist" } = params;
|
|
5
5
|
return {
|
|
6
|
+
metaName: params.metaName,
|
|
6
7
|
packageName: params.packageName,
|
|
7
8
|
configFile: params.configFile,
|
|
8
9
|
command: params.command,
|
|
@@ -35,11 +35,12 @@ const createCli = () => {
|
|
|
35
35
|
var _context_hooks_onAfterPrepare, _context_hooks;
|
|
36
36
|
pluginManager.clear();
|
|
37
37
|
initOptions = options;
|
|
38
|
-
const { metaName = "
|
|
38
|
+
const { metaName = "modern-js", configFile, config, command, version, packageJsonConfig, internalPlugins, handleSetupResult } = options;
|
|
39
39
|
const appDirectory = await initAppDir(options === null || options === void 0 ? void 0 : options.cwd);
|
|
40
40
|
initCommandsMap();
|
|
41
41
|
setProgramVersion(version);
|
|
42
|
-
|
|
42
|
+
const envName = metaName === "modern-js" ? "MODERN" : metaName;
|
|
43
|
+
loadEnv(appDirectory, process.env[`${envName.toUpperCase()}_ENV`]);
|
|
43
44
|
const loaded = await createLoadedConfig(appDirectory, configFile, packageJsonConfig, config);
|
|
44
45
|
const allPlugins = [
|
|
45
46
|
...internalPlugins || [],
|
|
@@ -55,7 +56,8 @@ const createCli = () => {
|
|
|
55
56
|
configFile: loaded.configFile,
|
|
56
57
|
command,
|
|
57
58
|
appDirectory,
|
|
58
|
-
plugins
|
|
59
|
+
plugins,
|
|
60
|
+
metaName
|
|
59
61
|
}),
|
|
60
62
|
config: loaded.config,
|
|
61
63
|
normalizedConfig: {}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.67.1-alpha.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -81,20 +81,20 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@swc/helpers": "0.5.13",
|
|
83
83
|
"jiti": "1.21.7",
|
|
84
|
-
"@modern-js/runtime-utils": "2.
|
|
85
|
-
"@modern-js/utils": "2.
|
|
84
|
+
"@modern-js/runtime-utils": "2.67.0",
|
|
85
|
+
"@modern-js/utils": "2.67.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@rsbuild/core": "1.2
|
|
88
|
+
"@rsbuild/core": "1.3.2",
|
|
89
89
|
"@types/jest": "^29",
|
|
90
90
|
"@types/node": "^14",
|
|
91
91
|
"@types/react": "^18.3.11",
|
|
92
92
|
"jest": "^29",
|
|
93
93
|
"typescript": "^5",
|
|
94
|
-
"@modern-js/types": "2.
|
|
95
|
-
"@modern-js/uni-builder": "2.
|
|
96
|
-
"@scripts/
|
|
97
|
-
"@scripts/
|
|
94
|
+
"@modern-js/types": "2.67.0",
|
|
95
|
+
"@modern-js/uni-builder": "2.67.0",
|
|
96
|
+
"@scripts/build": "2.66.0",
|
|
97
|
+
"@scripts/jest-config": "2.66.0"
|
|
98
98
|
},
|
|
99
99
|
"sideEffects": false,
|
|
100
100
|
"publishConfig": {
|