@modern-js/plugin-v2 2.67.1-alpha.0 → 2.67.1-alpha.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/dist/cjs/cli/api.js +17 -14
- package/dist/esm/cli/api.js +39 -12
- package/dist/esm-node/cli/api.js +18 -15
- package/package.json +5 -5
package/dist/cjs/cli/api.js
CHANGED
|
@@ -21,8 +21,8 @@ __export(api_exports, {
|
|
|
21
21
|
initPluginAPI: () => initPluginAPI
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(api_exports);
|
|
24
|
-
var import_utils = require("@modern-js/utils");
|
|
25
24
|
var import_lodash = require("@modern-js/utils/lodash");
|
|
25
|
+
var import_context = require("./context");
|
|
26
26
|
var import_debug = require("./run/utils/debug");
|
|
27
27
|
function initPluginAPI({ context, pluginManager }) {
|
|
28
28
|
const { hooks, extendsHooks, plugins } = context;
|
|
@@ -65,19 +65,21 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
function updateAppContext(updateContext) {
|
|
68
|
-
context = (0, import_lodash.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
68
|
+
context = (0, import_lodash.assign)(context, updateContext);
|
|
69
|
+
}
|
|
70
|
+
async function _internal_resetAppContext(appContext) {
|
|
71
|
+
const { config, normalizedConfig, packageName, configFile, command, appDirectory, metaName } = context;
|
|
72
|
+
context = await (0, import_context.createContext)({
|
|
73
|
+
appContext: (0, import_lodash.assign)((0, import_context.initAppContext)({
|
|
74
|
+
packageName,
|
|
75
|
+
configFile,
|
|
76
|
+
command,
|
|
77
|
+
appDirectory,
|
|
78
|
+
plugins,
|
|
79
|
+
metaName
|
|
80
|
+
}), appContext),
|
|
81
|
+
config,
|
|
82
|
+
normalizedConfig
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
const pluginAPI = {
|
|
@@ -87,6 +89,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
87
89
|
getNormalizedConfig,
|
|
88
90
|
getHooks,
|
|
89
91
|
updateAppContext,
|
|
92
|
+
_internal_resetAppContext,
|
|
90
93
|
config: hooks.config.tap,
|
|
91
94
|
modifyConfig: hooks.modifyConfig.tap,
|
|
92
95
|
modifyResolvedConfig: hooks.modifyResolvedConfig.tap,
|
package/dist/esm/cli/api.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
1
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
3
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
|
+
import { assign } from "@modern-js/utils/lodash";
|
|
6
|
+
import { createContext, initAppContext } from "./context";
|
|
6
7
|
import { debug } from "./run/utils/debug";
|
|
7
8
|
function initPluginAPI(param) {
|
|
8
9
|
var context = param.context, pluginManager = param.pluginManager;
|
|
@@ -52,17 +53,42 @@ function initPluginAPI(param) {
|
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
function updateAppContext(updateContext) {
|
|
55
|
-
context =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
context = assign(context, updateContext);
|
|
57
|
+
}
|
|
58
|
+
function _internal_resetAppContext(appContext) {
|
|
59
|
+
return __internal_resetAppContext.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
function __internal_resetAppContext() {
|
|
62
|
+
__internal_resetAppContext = _async_to_generator(function(appContext) {
|
|
63
|
+
var config, normalizedConfig, packageName, configFile, command, appDirectory, metaName;
|
|
64
|
+
return _ts_generator(this, function(_state) {
|
|
65
|
+
switch (_state.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
config = context.config, normalizedConfig = context.normalizedConfig, packageName = context.packageName, configFile = context.configFile, command = context.command, appDirectory = context.appDirectory, metaName = context.metaName;
|
|
68
|
+
return [
|
|
69
|
+
4,
|
|
70
|
+
createContext({
|
|
71
|
+
appContext: assign(initAppContext({
|
|
72
|
+
packageName,
|
|
73
|
+
configFile,
|
|
74
|
+
command,
|
|
75
|
+
appDirectory,
|
|
76
|
+
plugins,
|
|
77
|
+
metaName
|
|
78
|
+
}), appContext),
|
|
79
|
+
config,
|
|
80
|
+
normalizedConfig
|
|
81
|
+
})
|
|
82
|
+
];
|
|
83
|
+
case 1:
|
|
84
|
+
context = _state.sent();
|
|
85
|
+
return [
|
|
86
|
+
2
|
|
87
|
+
];
|
|
62
88
|
}
|
|
63
|
-
|
|
64
|
-
}
|
|
89
|
+
});
|
|
65
90
|
});
|
|
91
|
+
return __internal_resetAppContext.apply(this, arguments);
|
|
66
92
|
}
|
|
67
93
|
var pluginAPI = _object_spread({
|
|
68
94
|
isPluginExists: pluginManager.isPluginExists,
|
|
@@ -71,6 +97,7 @@ function initPluginAPI(param) {
|
|
|
71
97
|
getNormalizedConfig,
|
|
72
98
|
getHooks,
|
|
73
99
|
updateAppContext,
|
|
100
|
+
_internal_resetAppContext,
|
|
74
101
|
config: hooks.config.tap,
|
|
75
102
|
modifyConfig: hooks.modifyConfig.tap,
|
|
76
103
|
modifyResolvedConfig: hooks.modifyResolvedConfig.tap,
|
package/dist/esm-node/cli/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { assign } from "@modern-js/utils/lodash";
|
|
2
|
+
import { createContext, initAppContext } from "./context";
|
|
3
3
|
import { debug } from "./run/utils/debug";
|
|
4
4
|
function initPluginAPI({ context, pluginManager }) {
|
|
5
5
|
const { hooks, extendsHooks, plugins } = context;
|
|
@@ -42,19 +42,21 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
function updateAppContext(updateContext) {
|
|
45
|
-
context =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
45
|
+
context = assign(context, updateContext);
|
|
46
|
+
}
|
|
47
|
+
async function _internal_resetAppContext(appContext) {
|
|
48
|
+
const { config, normalizedConfig, packageName, configFile, command, appDirectory, metaName } = context;
|
|
49
|
+
context = await createContext({
|
|
50
|
+
appContext: assign(initAppContext({
|
|
51
|
+
packageName,
|
|
52
|
+
configFile,
|
|
53
|
+
command,
|
|
54
|
+
appDirectory,
|
|
55
|
+
plugins,
|
|
56
|
+
metaName
|
|
57
|
+
}), appContext),
|
|
58
|
+
config,
|
|
59
|
+
normalizedConfig
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
const pluginAPI = {
|
|
@@ -64,6 +66,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
64
66
|
getNormalizedConfig,
|
|
65
67
|
getHooks,
|
|
66
68
|
updateAppContext,
|
|
69
|
+
_internal_resetAppContext,
|
|
67
70
|
config: hooks.config.tap,
|
|
68
71
|
modifyConfig: hooks.modifyConfig.tap,
|
|
69
72
|
modifyResolvedConfig: hooks.modifyResolvedConfig.tap,
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.67.1-alpha.
|
|
18
|
+
"version": "2.67.1-alpha.1",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@swc/helpers": "0.5.13",
|
|
83
83
|
"jiti": "1.21.7",
|
|
84
|
-
"@modern-js/
|
|
85
|
-
"@modern-js/utils": "2.67.0"
|
|
84
|
+
"@modern-js/utils": "2.67.0",
|
|
85
|
+
"@modern-js/runtime-utils": "2.67.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@rsbuild/core": "1.3.2",
|
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
"@types/react": "^18.3.11",
|
|
92
92
|
"jest": "^29",
|
|
93
93
|
"typescript": "^5",
|
|
94
|
-
"@modern-js/types": "2.67.0",
|
|
95
94
|
"@modern-js/uni-builder": "2.67.0",
|
|
96
95
|
"@scripts/build": "2.66.0",
|
|
97
|
-
"@scripts/jest-config": "2.66.0"
|
|
96
|
+
"@scripts/jest-config": "2.66.0",
|
|
97
|
+
"@modern-js/types": "2.67.0"
|
|
98
98
|
},
|
|
99
99
|
"sideEffects": false,
|
|
100
100
|
"publishConfig": {
|