@modern-js/plugin-v2 2.67.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.
@@ -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.assign)(context, updateContext);
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,
@@ -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 { assign } from "@modern-js/utils/lodash";
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 = assign(context, updateContext);
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,
@@ -1,4 +1,5 @@
1
- import { assign } from "@modern-js/utils/lodash";
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 = assign(context, updateContext);
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,
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.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",