@modern-js/plugin-v2 2.67.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.
@@ -22,6 +22,7 @@ __export(api_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(api_exports);
24
24
  var import_lodash = require("@modern-js/utils/lodash");
25
+ var import_context = require("./context");
25
26
  var import_debug = require("./run/utils/debug");
26
27
  function initPluginAPI({ context, pluginManager }) {
27
28
  const { hooks, extendsHooks, plugins } = context;
@@ -66,6 +67,21 @@ function initPluginAPI({ context, pluginManager }) {
66
67
  function updateAppContext(updateContext) {
67
68
  context = (0, import_lodash.assign)(context, updateContext);
68
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
83
+ });
84
+ }
69
85
  const pluginAPI = {
70
86
  isPluginExists: pluginManager.isPluginExists,
71
87
  getAppContext,
@@ -73,6 +89,7 @@ function initPluginAPI({ context, pluginManager }) {
73
89
  getNormalizedConfig,
74
90
  getHooks,
75
91
  updateAppContext,
92
+ _internal_resetAppContext,
76
93
  config: hooks.config.tap,
77
94
  modifyConfig: hooks.modifyConfig.tap,
78
95
  modifyResolvedConfig: hooks.modifyResolvedConfig.tap,
@@ -1,6 +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";
4
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
5
  import { assign } from "@modern-js/utils/lodash";
6
+ import { createContext, initAppContext } from "./context";
4
7
  import { debug } from "./run/utils/debug";
5
8
  function initPluginAPI(param) {
6
9
  var context = param.context, pluginManager = param.pluginManager;
@@ -52,6 +55,41 @@ function initPluginAPI(param) {
52
55
  function updateAppContext(updateContext) {
53
56
  context = assign(context, updateContext);
54
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
+ ];
88
+ }
89
+ });
90
+ });
91
+ return __internal_resetAppContext.apply(this, arguments);
92
+ }
55
93
  var pluginAPI = _object_spread({
56
94
  isPluginExists: pluginManager.isPluginExists,
57
95
  getAppContext,
@@ -59,6 +97,7 @@ function initPluginAPI(param) {
59
97
  getNormalizedConfig,
60
98
  getHooks,
61
99
  updateAppContext,
100
+ _internal_resetAppContext,
62
101
  config: hooks.config.tap,
63
102
  modifyConfig: hooks.modifyConfig.tap,
64
103
  modifyResolvedConfig: hooks.modifyResolvedConfig.tap,
@@ -1,4 +1,5 @@
1
1
  import { assign } from "@modern-js/utils/lodash";
2
+ import { createContext, initAppContext } from "./context";
2
3
  import { debug } from "./run/utils/debug";
3
4
  function initPluginAPI({ context, pluginManager }) {
4
5
  const { hooks, extendsHooks, plugins } = context;
@@ -43,6 +44,21 @@ function initPluginAPI({ context, pluginManager }) {
43
44
  function updateAppContext(updateContext) {
44
45
  context = assign(context, updateContext);
45
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
60
+ });
61
+ }
46
62
  const pluginAPI = {
47
63
  isPluginExists: pluginManager.isPluginExists,
48
64
  getAppContext,
@@ -50,6 +66,7 @@ function initPluginAPI({ context, pluginManager }) {
50
66
  getNormalizedConfig,
51
67
  getHooks,
52
68
  updateAppContext,
69
+ _internal_resetAppContext,
53
70
  config: hooks.config.tap,
54
71
  modifyConfig: hooks.modifyConfig.tap,
55
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.0",
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/runtime-utils": "2.67.0",
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": {