@modern-js/plugin-v2 2.67.1-alpha.5 → 2.67.1-alpha.6

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.
@@ -25,29 +25,30 @@ var import_lodash = require("@modern-js/utils/lodash");
25
25
  var import_context = require("./context");
26
26
  var import_debug = require("./run/utils/debug");
27
27
  function initPluginAPI({ context, pluginManager }) {
28
- const { hooks, extendsHooks, plugins } = context;
28
+ let internalContext = context;
29
+ const { hooks, extendsHooks, plugins } = internalContext;
29
30
  function getAppContext() {
30
- if (context) {
31
- const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI: pluginAPI2, ...appContext } = context;
32
- appContext._internalContext = context;
31
+ if (internalContext) {
32
+ const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI: pluginAPI2, ...appContext } = internalContext;
33
+ appContext._internalContext = internalContext;
33
34
  return appContext;
34
35
  }
35
36
  throw new Error("Cannot access context");
36
37
  }
37
38
  function getConfig() {
38
- if (context.config) {
39
- return context.config;
39
+ if (internalContext.config) {
40
+ return internalContext.config;
40
41
  }
41
42
  throw new Error("Cannot access config");
42
43
  }
43
44
  function getNormalizedConfig() {
44
- if (context.normalizedConfig) {
45
- return context.normalizedConfig;
45
+ if (internalContext.normalizedConfig) {
46
+ return internalContext.normalizedConfig;
46
47
  }
47
48
  throw new Error("Cannot access normalized config");
48
49
  }
49
50
  function getHooks() {
50
- return context.hooks;
51
+ return internalContext.hooks;
51
52
  }
52
53
  const extendsPluginApi = {};
53
54
  plugins.forEach((plugin) => {
@@ -65,11 +66,11 @@ function initPluginAPI({ context, pluginManager }) {
65
66
  });
66
67
  }
67
68
  function updateAppContext(updateContext) {
68
- context = (0, import_lodash.assign)(context, updateContext);
69
+ internalContext = (0, import_lodash.assign)(internalContext, updateContext);
69
70
  }
70
71
  function _internal_resetAppContext({ appContext, config, normalizedConfig }) {
71
- const { packageName, configFile, command, appDirectory, metaName } = context;
72
- context = (0, import_context.createContext)({
72
+ const { packageName, configFile, command, appDirectory, metaName } = internalContext;
73
+ internalContext = (0, import_context.createContext)({
73
74
  appContext: (0, import_lodash.assign)({}, (0, import_context.initAppContext)({
74
75
  packageName,
75
76
  configFile,
@@ -5,35 +5,36 @@ import { createContext, initAppContext } from "./context";
5
5
  import { debug } from "./run/utils/debug";
6
6
  function initPluginAPI(param) {
7
7
  var context = param.context, pluginManager = param.pluginManager;
8
- var hooks = context.hooks, extendsHooks = context.extendsHooks, plugins = context.plugins;
8
+ var internalContext = context;
9
+ var hooks = internalContext.hooks, extendsHooks = internalContext.extendsHooks, plugins = internalContext.plugins;
9
10
  function getAppContext() {
10
- if (context) {
11
- var hooks2 = context.hooks, extendsHooks2 = context.extendsHooks, config = context.config, normalizedConfig = context.normalizedConfig, pluginAPI2 = context.pluginAPI, appContext = _object_without_properties(context, [
11
+ if (internalContext) {
12
+ var hooks2 = internalContext.hooks, extendsHooks2 = internalContext.extendsHooks, config = internalContext.config, normalizedConfig = internalContext.normalizedConfig, pluginAPI2 = internalContext.pluginAPI, appContext = _object_without_properties(internalContext, [
12
13
  "hooks",
13
14
  "extendsHooks",
14
15
  "config",
15
16
  "normalizedConfig",
16
17
  "pluginAPI"
17
18
  ]);
18
- appContext._internalContext = context;
19
+ appContext._internalContext = internalContext;
19
20
  return appContext;
20
21
  }
21
22
  throw new Error("Cannot access context");
22
23
  }
23
24
  function getConfig() {
24
- if (context.config) {
25
- return context.config;
25
+ if (internalContext.config) {
26
+ return internalContext.config;
26
27
  }
27
28
  throw new Error("Cannot access config");
28
29
  }
29
30
  function getNormalizedConfig() {
30
- if (context.normalizedConfig) {
31
- return context.normalizedConfig;
31
+ if (internalContext.normalizedConfig) {
32
+ return internalContext.normalizedConfig;
32
33
  }
33
34
  throw new Error("Cannot access normalized config");
34
35
  }
35
36
  function getHooks() {
36
- return context.hooks;
37
+ return internalContext.hooks;
37
38
  }
38
39
  var extendsPluginApi = {};
39
40
  plugins.forEach(function(plugin) {
@@ -51,12 +52,12 @@ function initPluginAPI(param) {
51
52
  });
52
53
  }
53
54
  function updateAppContext(updateContext) {
54
- context = assign(context, updateContext);
55
+ internalContext = assign(internalContext, updateContext);
55
56
  }
56
57
  function _internal_resetAppContext(param2) {
57
58
  var appContext = param2.appContext, config = param2.config, normalizedConfig = param2.normalizedConfig;
58
- var packageName = context.packageName, configFile = context.configFile, command = context.command, appDirectory = context.appDirectory, metaName = context.metaName;
59
- context = createContext({
59
+ var packageName = internalContext.packageName, configFile = internalContext.configFile, command = internalContext.command, appDirectory = internalContext.appDirectory, metaName = internalContext.metaName;
60
+ internalContext = createContext({
60
61
  appContext: assign({}, initAppContext({
61
62
  packageName,
62
63
  configFile,
@@ -2,29 +2,30 @@ import { assign } from "@modern-js/utils/lodash";
2
2
  import { createContext, initAppContext } from "./context";
3
3
  import { debug } from "./run/utils/debug";
4
4
  function initPluginAPI({ context, pluginManager }) {
5
- const { hooks, extendsHooks, plugins } = context;
5
+ let internalContext = context;
6
+ const { hooks, extendsHooks, plugins } = internalContext;
6
7
  function getAppContext() {
7
- if (context) {
8
- const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI: pluginAPI2, ...appContext } = context;
9
- appContext._internalContext = context;
8
+ if (internalContext) {
9
+ const { hooks: hooks2, extendsHooks: extendsHooks2, config, normalizedConfig, pluginAPI: pluginAPI2, ...appContext } = internalContext;
10
+ appContext._internalContext = internalContext;
10
11
  return appContext;
11
12
  }
12
13
  throw new Error("Cannot access context");
13
14
  }
14
15
  function getConfig() {
15
- if (context.config) {
16
- return context.config;
16
+ if (internalContext.config) {
17
+ return internalContext.config;
17
18
  }
18
19
  throw new Error("Cannot access config");
19
20
  }
20
21
  function getNormalizedConfig() {
21
- if (context.normalizedConfig) {
22
- return context.normalizedConfig;
22
+ if (internalContext.normalizedConfig) {
23
+ return internalContext.normalizedConfig;
23
24
  }
24
25
  throw new Error("Cannot access normalized config");
25
26
  }
26
27
  function getHooks() {
27
- return context.hooks;
28
+ return internalContext.hooks;
28
29
  }
29
30
  const extendsPluginApi = {};
30
31
  plugins.forEach((plugin) => {
@@ -42,11 +43,11 @@ function initPluginAPI({ context, pluginManager }) {
42
43
  });
43
44
  }
44
45
  function updateAppContext(updateContext) {
45
- context = assign(context, updateContext);
46
+ internalContext = assign(internalContext, updateContext);
46
47
  }
47
48
  function _internal_resetAppContext({ appContext, config, normalizedConfig }) {
48
- const { packageName, configFile, command, appDirectory, metaName } = context;
49
- context = createContext({
49
+ const { packageName, configFile, command, appDirectory, metaName } = internalContext;
50
+ internalContext = createContext({
50
51
  appContext: assign({}, initAppContext({
51
52
  packageName,
52
53
  configFile,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.1-alpha.5",
18
+ "version": "2.67.1-alpha.6",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -92,8 +92,8 @@
92
92
  "jest": "^29",
93
93
  "typescript": "^5",
94
94
  "@modern-js/types": "2.67.0",
95
- "@scripts/build": "2.66.0",
96
95
  "@modern-js/uni-builder": "2.67.0",
96
+ "@scripts/build": "2.66.0",
97
97
  "@scripts/jest-config": "2.66.0"
98
98
  },
99
99
  "sideEffects": false,