@modern-js/app-tools 2.19.1 → 2.21.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.
Files changed (116) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/bin/modern.js +0 -1
  3. package/dist/cjs/analyze/generateCode.js +22 -48
  4. package/dist/cjs/analyze/getBundleEntry.js +3 -7
  5. package/dist/cjs/analyze/getClientRoutes/getRoutes.js +2 -6
  6. package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +2 -6
  7. package/dist/cjs/analyze/getClientRoutes/utils.js +2 -6
  8. package/dist/cjs/analyze/getFileSystemEntry.js +3 -7
  9. package/dist/cjs/analyze/getHtmlTemplate.js +4 -47
  10. package/dist/cjs/analyze/getServerRoutes.js +5 -7
  11. package/dist/cjs/analyze/index.js +11 -48
  12. package/dist/cjs/analyze/isDefaultExportFunction.js +5 -48
  13. package/dist/cjs/analyze/nestedRoutes.js +2 -41
  14. package/dist/cjs/analyze/templates.js +2 -6
  15. package/dist/cjs/analyze/utils.js +3 -7
  16. package/dist/cjs/builder/builder-rspack/adapterCopy.js +4 -21
  17. package/dist/cjs/builder/builder-webpack/index.js +2 -41
  18. package/dist/cjs/builder/generator/index.js +3 -42
  19. package/dist/cjs/builder/index.js +4 -43
  20. package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +6 -56
  21. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +6 -45
  22. package/dist/cjs/builder/shared/builderPlugins/index.js +4 -16
  23. package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +3 -15
  24. package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +5 -17
  25. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +2 -6
  26. package/dist/cjs/builder/shared/bundlerPlugins/index.js +4 -16
  27. package/dist/cjs/builder/shared/createCopyInfo.js +2 -6
  28. package/dist/cjs/builder/shared/index.js +4 -16
  29. package/dist/cjs/commands/index.js +4 -16
  30. package/dist/cjs/commands/serve.js +2 -6
  31. package/dist/cjs/config/index.js +4 -16
  32. package/dist/cjs/config/initialize/inits.js +2 -41
  33. package/dist/cjs/index.js +41 -80
  34. package/dist/cjs/schema/Schema.js +2 -14
  35. package/dist/cjs/schema/index.js +2 -6
  36. package/dist/cjs/types/config/index.js +2 -14
  37. package/dist/cjs/types/index.js +4 -16
  38. package/dist/cjs/utils/config.js +2 -41
  39. package/dist/cjs/utils/generateWatchFiles.js +2 -6
  40. package/dist/cjs/utils/routes.js +2 -6
  41. package/dist/esm/analyze/generateCode.js +13 -170
  42. package/dist/esm/analyze/getBundleEntry.js +1 -1
  43. package/dist/esm/analyze/getClientRoutes/getRoutes.js +2 -52
  44. package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +2 -52
  45. package/dist/esm/analyze/getHtmlTemplate.js +6 -151
  46. package/dist/esm/analyze/getServerRoutes.js +6 -118
  47. package/dist/esm/analyze/index.js +19 -251
  48. package/dist/esm/analyze/nestedRoutes.js +5 -184
  49. package/dist/esm/analyze/templates.js +6 -242
  50. package/dist/esm/analyze/utils.js +6 -205
  51. package/dist/esm/builder/builder-rspack/adapterCopy.js +10 -235
  52. package/dist/esm/builder/builder-webpack/adapterModern.js +1 -34
  53. package/dist/esm/builder/builder-webpack/index.js +7 -219
  54. package/dist/esm/builder/generator/createBuilderProviderConfig.js +2 -52
  55. package/dist/esm/builder/generator/index.js +4 -133
  56. package/dist/esm/builder/index.js +3 -132
  57. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +9 -191
  58. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +10 -139
  59. package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +4 -69
  60. package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +3 -35
  61. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +7 -226
  62. package/dist/esm/commands/build.js +5 -184
  63. package/dist/esm/commands/deploy.js +3 -132
  64. package/dist/esm/commands/dev.js +6 -185
  65. package/dist/esm/commands/inspect.js +3 -132
  66. package/dist/esm/commands/serve.js +6 -185
  67. package/dist/esm/config/default.js +3 -52
  68. package/dist/esm/config/initialize/inits.js +3 -86
  69. package/dist/esm/defineConfig.js +2 -52
  70. package/dist/esm/index.js +49 -207
  71. package/dist/esm/initialize/index.js +6 -185
  72. package/dist/esm/schema/Schema.js +8 -213
  73. package/dist/esm/schema/index.js +1 -13
  74. package/dist/esm/schema/legacy.js +1 -13
  75. package/dist/esm/utils/config.js +7 -186
  76. package/dist/esm/utils/createServer.js +6 -185
  77. package/dist/esm/utils/generateWatchFiles.js +5 -167
  78. package/dist/esm/utils/getSelectedEntries.js +3 -132
  79. package/dist/esm/utils/getServerInternalPlugins.js +5 -184
  80. package/dist/esm/utils/printInstructions.js +3 -132
  81. package/dist/esm/utils/restart.js +3 -132
  82. package/dist/esm/utils/routes.js +3 -132
  83. package/dist/esm-node/analyze/generateCode.js +19 -2
  84. package/dist/esm-node/analyze/getBundleEntry.js +1 -1
  85. package/dist/esm-node/analyze/getServerRoutes.js +2 -0
  86. package/dist/esm-node/analyze/index.js +4 -2
  87. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +1 -14
  88. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +2 -6
  89. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +5 -5
  90. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +1 -13
  91. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +1 -13
  92. package/dist/esm-node/index.js +22 -6
  93. package/dist/esm-node/schema/Schema.js +1 -13
  94. package/dist/types/analyze/index.d.ts +0 -2
  95. package/dist/types/builder/builder-rspack/index.d.ts +1 -1
  96. package/dist/types/builder/builder-webpack/adapterModern.d.ts +0 -1
  97. package/dist/types/builder/generator/index.d.ts +1 -2
  98. package/dist/types/builder/shared/builderPlugins/adapterBasic.d.ts +0 -1
  99. package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +2 -3
  100. package/dist/types/defineConfig.d.ts +0 -1
  101. package/dist/types/index.d.ts +0 -2
  102. package/dist/types/initialize/index.d.ts +0 -2
  103. package/dist/types/types/config/index.d.ts +2 -2
  104. package/dist/types/types/config/output.d.ts +1 -0
  105. package/dist/types/types/config/security.d.ts +2 -0
  106. package/dist/types/types/config/source.d.ts +0 -1
  107. package/dist/types/types/config/tools.d.ts +0 -2
  108. package/dist/types/types/hooks.d.ts +3 -1
  109. package/dist/types/types/legacyConfig/dev.d.ts +0 -1
  110. package/dist/types/types/legacyConfig/output.d.ts +2 -3
  111. package/dist/types/types/legacyConfig/source.d.ts +0 -1
  112. package/dist/types/types/legacyConfig/tools.d.ts +0 -1
  113. package/dist/types/utils/config.d.ts +0 -1
  114. package/dist/types/utils/getSelectedEntries.d.ts +0 -1
  115. package/lib/types.d.ts +8 -8
  116. package/package.json +29 -29
@@ -1,140 +1,10 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(void 0);
27
- });
28
- };
29
- }
30
- var __generator = function(thisArg, body) {
31
- var f, y, t, g, _ = {
32
- label: 0,
33
- sent: function() {
34
- if (t[0] & 1)
35
- throw t[1];
36
- return t[1];
37
- },
38
- trys: [],
39
- ops: []
40
- };
41
- return g = {
42
- next: verb(0),
43
- "throw": verb(1),
44
- "return": verb(2)
45
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
46
- return this;
47
- }), g;
48
- function verb(n) {
49
- return function(v) {
50
- return step([
51
- n,
52
- v
53
- ]);
54
- };
55
- }
56
- function step(op) {
57
- if (f)
58
- throw new TypeError("Generator is already executing.");
59
- while (_)
60
- try {
61
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
62
- return t;
63
- if (y = 0, t)
64
- op = [
65
- op[0] & 2,
66
- t.value
67
- ];
68
- switch (op[0]) {
69
- case 0:
70
- case 1:
71
- t = op;
72
- break;
73
- case 4:
74
- _.label++;
75
- return {
76
- value: op[1],
77
- done: false
78
- };
79
- case 5:
80
- _.label++;
81
- y = op[1];
82
- op = [
83
- 0
84
- ];
85
- continue;
86
- case 7:
87
- op = _.ops.pop();
88
- _.trys.pop();
89
- continue;
90
- default:
91
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
92
- _ = 0;
93
- continue;
94
- }
95
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
96
- _.label = op[1];
97
- break;
98
- }
99
- if (op[0] === 6 && _.label < t[1]) {
100
- _.label = t[1];
101
- t = op;
102
- break;
103
- }
104
- if (t && _.label < t[2]) {
105
- _.label = t[2];
106
- _.ops.push(op);
107
- break;
108
- }
109
- if (t[2])
110
- _.ops.pop();
111
- _.trys.pop();
112
- continue;
113
- }
114
- op = body.call(thisArg, _);
115
- } catch (e) {
116
- op = [
117
- 6,
118
- e
119
- ];
120
- y = 0;
121
- } finally {
122
- f = t = 0;
123
- }
124
- if (op[0] & 5)
125
- throw op[1];
126
- return {
127
- value: op[0] ? op[1] : void 0,
128
- done: true
129
- };
130
- }
131
- };
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
132
3
  import * as path from "path";
133
- import { mergeBuilderConfig } from "@modern-js/builder-shared";
4
+ import { isHtmlDisabled, mergeBuilderConfig } from "@modern-js/builder-shared";
134
5
  import { isSSR, fs } from "@modern-js/utils";
135
6
  import { HtmlAsyncChunkPlugin, RouterPlugin } from "../bundlerPlugins";
136
7
  import { getServerCombinedModueFile } from "../../../analyze/utils";
137
- import { isHtmlEnabled } from "./adapterHtml";
138
8
  export var builderPluginAdapterSSR = function(options) {
139
9
  return {
140
10
  name: "builder-plugin-adapter-modern-ssr",
@@ -153,7 +23,7 @@ export var builderPluginAdapterSSR = function(options) {
153
23
  api.modifyBundlerChain(function() {
154
24
  var _ref = _async_to_generator(function(chain, param) {
155
25
  var target, CHAIN_ID, isProd, HtmlBundlerPlugin, isServer, builderConfig, normalizedConfig2;
156
- return __generator(this, function(_state) {
26
+ return _ts_generator(this, function(_state) {
157
27
  switch (_state.label) {
158
28
  case 0:
159
29
  target = param.target, CHAIN_ID = param.CHAIN_ID, isProd = param.isProd, HtmlBundlerPlugin = param.HtmlPlugin, isServer = param.isServer;
@@ -184,7 +54,7 @@ export var builderPluginAdapterSSR = function(options) {
184
54
  appNormalizedConfig: normalizedConfig2
185
55
  });
186
56
  }
187
- if (isHtmlEnabled(builderConfig, target)) {
57
+ if (!isHtmlDisabled(builderConfig, target)) {
188
58
  applyAsyncChunkHtmlPlugin({
189
59
  chain: chain,
190
60
  modernConfig: options.normalizedConfig,
@@ -248,7 +118,7 @@ function applyAsyncChunkHtmlPlugin(param) {
248
118
  }
249
119
  }
250
120
  function applyRouterPlugin(chain, options) {
251
- var _normalizedConfig_runtime;
121
+ var _normalizedConfig_runtime, _normalizedConfig_deploy_worker;
252
122
  var appContext = options.appContext, normalizedConfig = options.normalizedConfig;
253
123
  var entrypoints = appContext.entrypoints;
254
124
  var existNestedRoutes = entrypoints.some(function(entrypoint) {
@@ -256,7 +126,8 @@ function applyRouterPlugin(chain, options) {
256
126
  });
257
127
  var routerConfig = normalizedConfig === null || normalizedConfig === void 0 ? void 0 : (_normalizedConfig_runtime = normalizedConfig.runtime) === null || _normalizedConfig_runtime === void 0 ? void 0 : _normalizedConfig_runtime.router;
258
128
  var routerManifest = Boolean(routerConfig === null || routerConfig === void 0 ? void 0 : routerConfig.manifest);
259
- if (existNestedRoutes || routerManifest) {
129
+ var workerSSR = Boolean((_normalizedConfig_deploy_worker = normalizedConfig.deploy.worker) === null || _normalizedConfig_deploy_worker === void 0 ? void 0 : _normalizedConfig_deploy_worker.ssr);
130
+ if (existNestedRoutes || routerManifest || workerSSR) {
260
131
  chain.plugin("route-plugin").use(RouterPlugin);
261
132
  }
262
133
  }
@@ -297,7 +168,7 @@ function applySSRLoaderEntry(chain, optinos, isServer) {
297
168
  function _applySSRLoaderEntry() {
298
169
  _applySSRLoaderEntry = _async_to_generator(function(chain, optinos, isServer) {
299
170
  var appContext, internalDirectory, entrypoints;
300
- return __generator(this, function(_state) {
171
+ return _ts_generator(this, function(_state) {
301
172
  switch (_state.label) {
302
173
  case 0:
303
174
  appContext = optinos.appContext;
@@ -308,7 +179,7 @@ function _applySSRLoaderEntry() {
308
179
  Promise.all(entrypoints.map(function() {
309
180
  var _ref = _async_to_generator(function(entrypoint) {
310
181
  var entryName, serverLoadersFile, err;
311
- return __generator(this, function(_state2) {
182
+ return _ts_generator(this, function(_state2) {
312
183
  switch (_state2.label) {
313
184
  case 0:
314
185
  entryName = entrypoint.entryName;
@@ -1,72 +1,7 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length)
3
- len = arr.length;
4
- for (var i = 0, arr2 = new Array(len); i < len; i++)
5
- arr2[i] = arr[i];
6
- return arr2;
7
- }
8
- function _array_without_holes(arr) {
9
- if (Array.isArray(arr))
10
- return _array_like_to_array(arr);
11
- }
12
- function _class_call_check(instance, Constructor) {
13
- if (!(instance instanceof Constructor)) {
14
- throw new TypeError("Cannot call a class as a function");
15
- }
16
- }
17
- function _defineProperties(target, props) {
18
- for (var i = 0; i < props.length; i++) {
19
- var descriptor = props[i];
20
- descriptor.enumerable = descriptor.enumerable || false;
21
- descriptor.configurable = true;
22
- if ("value" in descriptor)
23
- descriptor.writable = true;
24
- Object.defineProperty(target, descriptor.key, descriptor);
25
- }
26
- }
27
- function _create_class(Constructor, protoProps, staticProps) {
28
- if (protoProps)
29
- _defineProperties(Constructor.prototype, protoProps);
30
- if (staticProps)
31
- _defineProperties(Constructor, staticProps);
32
- return Constructor;
33
- }
34
- function _define_property(obj, key, value) {
35
- if (key in obj) {
36
- Object.defineProperty(obj, key, {
37
- value: value,
38
- enumerable: true,
39
- configurable: true,
40
- writable: true
41
- });
42
- } else {
43
- obj[key] = value;
44
- }
45
- return obj;
46
- }
47
- function _iterable_to_array(iter) {
48
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
49
- return Array.from(iter);
50
- }
51
- function _non_iterable_spread() {
52
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53
- }
54
- function _to_consumable_array(arr) {
55
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
56
- }
57
- function _unsupported_iterable_to_array(o, minLen) {
58
- if (!o)
59
- return;
60
- if (typeof o === "string")
61
- return _array_like_to_array(o, minLen);
62
- var n = Object.prototype.toString.call(o).slice(8, -1);
63
- if (n === "Object" && o.constructor)
64
- n = o.constructor.name;
65
- if (n === "Map" || n === "Set")
66
- return Array.from(n);
67
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
68
- return _array_like_to_array(o, minLen);
69
- }
1
+ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
2
+ import { _ as _create_class } from "@swc/helpers/_/_create_class";
3
+ import { _ as _define_property } from "@swc/helpers/_/_define_property";
4
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
70
5
  export var HtmlAsyncChunkPlugin = /* @__PURE__ */ function() {
71
6
  "use strict";
72
7
  function HtmlAsyncChunkPlugin2(htmlWebpackPlugin) {
@@ -1,38 +1,6 @@
1
- function _class_call_check(instance, Constructor) {
2
- if (!(instance instanceof Constructor)) {
3
- throw new TypeError("Cannot call a class as a function");
4
- }
5
- }
6
- function _defineProperties(target, props) {
7
- for (var i = 0; i < props.length; i++) {
8
- var descriptor = props[i];
9
- descriptor.enumerable = descriptor.enumerable || false;
10
- descriptor.configurable = true;
11
- if ("value" in descriptor)
12
- descriptor.writable = true;
13
- Object.defineProperty(target, descriptor.key, descriptor);
14
- }
15
- }
16
- function _create_class(Constructor, protoProps, staticProps) {
17
- if (protoProps)
18
- _defineProperties(Constructor.prototype, protoProps);
19
- if (staticProps)
20
- _defineProperties(Constructor, staticProps);
21
- return Constructor;
22
- }
23
- function _define_property(obj, key, value) {
24
- if (key in obj) {
25
- Object.defineProperty(obj, key, {
26
- value: value,
27
- enumerable: true,
28
- configurable: true,
29
- writable: true
30
- });
31
- } else {
32
- obj[key] = value;
33
- }
34
- return obj;
35
- }
1
+ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
2
+ import { _ as _create_class } from "@swc/helpers/_/_create_class";
3
+ import { _ as _define_property } from "@swc/helpers/_/_define_property";
36
4
  export var BottomTemplatePlugin = /* @__PURE__ */ function() {
37
5
  "use strict";
38
6
  function BottomTemplatePlugin2(htmlWebpackPlugin) {
@@ -1,228 +1,9 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length)
3
- len = arr.length;
4
- for (var i = 0, arr2 = new Array(len); i < len; i++)
5
- arr2[i] = arr[i];
6
- return arr2;
7
- }
8
- function _array_with_holes(arr) {
9
- if (Array.isArray(arr))
10
- return arr;
11
- }
12
- function _array_without_holes(arr) {
13
- if (Array.isArray(arr))
14
- return _array_like_to_array(arr);
15
- }
16
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
17
- try {
18
- var info = gen[key](arg);
19
- var value = info.value;
20
- } catch (error) {
21
- reject(error);
22
- return;
23
- }
24
- if (info.done) {
25
- resolve(value);
26
- } else {
27
- Promise.resolve(value).then(_next, _throw);
28
- }
29
- }
30
- function _async_to_generator(fn) {
31
- return function() {
32
- var self = this, args = arguments;
33
- return new Promise(function(resolve, reject) {
34
- var gen = fn.apply(self, args);
35
- function _next(value) {
36
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
37
- }
38
- function _throw(err) {
39
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
40
- }
41
- _next(void 0);
42
- });
43
- };
44
- }
45
- function _class_call_check(instance, Constructor) {
46
- if (!(instance instanceof Constructor)) {
47
- throw new TypeError("Cannot call a class as a function");
48
- }
49
- }
50
- function _defineProperties(target, props) {
51
- for (var i = 0; i < props.length; i++) {
52
- var descriptor = props[i];
53
- descriptor.enumerable = descriptor.enumerable || false;
54
- descriptor.configurable = true;
55
- if ("value" in descriptor)
56
- descriptor.writable = true;
57
- Object.defineProperty(target, descriptor.key, descriptor);
58
- }
59
- }
60
- function _create_class(Constructor, protoProps, staticProps) {
61
- if (protoProps)
62
- _defineProperties(Constructor.prototype, protoProps);
63
- if (staticProps)
64
- _defineProperties(Constructor, staticProps);
65
- return Constructor;
66
- }
67
- function _iterable_to_array(iter) {
68
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
69
- return Array.from(iter);
70
- }
71
- function _iterable_to_array_limit(arr, i) {
72
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
73
- if (_i == null)
74
- return;
75
- var _arr = [];
76
- var _n = true;
77
- var _d = false;
78
- var _s, _e;
79
- try {
80
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
81
- _arr.push(_s.value);
82
- if (i && _arr.length === i)
83
- break;
84
- }
85
- } catch (err) {
86
- _d = true;
87
- _e = err;
88
- } finally {
89
- try {
90
- if (!_n && _i["return"] != null)
91
- _i["return"]();
92
- } finally {
93
- if (_d)
94
- throw _e;
95
- }
96
- }
97
- return _arr;
98
- }
99
- function _non_iterable_rest() {
100
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
101
- }
102
- function _non_iterable_spread() {
103
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
104
- }
105
- function _sliced_to_array(arr, i) {
106
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
107
- }
108
- function _to_consumable_array(arr) {
109
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
110
- }
111
- function _unsupported_iterable_to_array(o, minLen) {
112
- if (!o)
113
- return;
114
- if (typeof o === "string")
115
- return _array_like_to_array(o, minLen);
116
- var n = Object.prototype.toString.call(o).slice(8, -1);
117
- if (n === "Object" && o.constructor)
118
- n = o.constructor.name;
119
- if (n === "Map" || n === "Set")
120
- return Array.from(n);
121
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
122
- return _array_like_to_array(o, minLen);
123
- }
124
- var __generator = function(thisArg, body) {
125
- var f, y, t, g, _ = {
126
- label: 0,
127
- sent: function() {
128
- if (t[0] & 1)
129
- throw t[1];
130
- return t[1];
131
- },
132
- trys: [],
133
- ops: []
134
- };
135
- return g = {
136
- next: verb(0),
137
- "throw": verb(1),
138
- "return": verb(2)
139
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
140
- return this;
141
- }), g;
142
- function verb(n) {
143
- return function(v) {
144
- return step([
145
- n,
146
- v
147
- ]);
148
- };
149
- }
150
- function step(op) {
151
- if (f)
152
- throw new TypeError("Generator is already executing.");
153
- while (_)
154
- try {
155
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
156
- return t;
157
- if (y = 0, t)
158
- op = [
159
- op[0] & 2,
160
- t.value
161
- ];
162
- switch (op[0]) {
163
- case 0:
164
- case 1:
165
- t = op;
166
- break;
167
- case 4:
168
- _.label++;
169
- return {
170
- value: op[1],
171
- done: false
172
- };
173
- case 5:
174
- _.label++;
175
- y = op[1];
176
- op = [
177
- 0
178
- ];
179
- continue;
180
- case 7:
181
- op = _.ops.pop();
182
- _.trys.pop();
183
- continue;
184
- default:
185
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
186
- _ = 0;
187
- continue;
188
- }
189
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
190
- _.label = op[1];
191
- break;
192
- }
193
- if (op[0] === 6 && _.label < t[1]) {
194
- _.label = t[1];
195
- t = op;
196
- break;
197
- }
198
- if (t && _.label < t[2]) {
199
- _.label = t[2];
200
- _.ops.push(op);
201
- break;
202
- }
203
- if (t[2])
204
- _.ops.pop();
205
- _.trys.pop();
206
- continue;
207
- }
208
- op = body.call(thisArg, _);
209
- } catch (e) {
210
- op = [
211
- 6,
212
- e
213
- ];
214
- y = 0;
215
- } finally {
216
- f = t = 0;
217
- }
218
- if (op[0] & 5)
219
- throw op[1];
220
- return {
221
- value: op[0] ? op[1] : void 0,
222
- done: true
223
- };
224
- }
225
- };
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
3
+ import { _ as _create_class } from "@swc/helpers/_/_create_class";
4
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
6
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
226
7
  import path from "path";
227
8
  import { fs, ROUTE_MANIFEST_FILE } from "@modern-js/utils";
228
9
  import { ROUTE_MANIFEST } from "@modern-js/utils/universal/constants";
@@ -261,7 +42,7 @@ export var RouterPlugin = /* @__PURE__ */ function() {
261
42
  stage: PROCESS_ASSETS_STAGE_REPORT
262
43
  }, /* @__PURE__ */ _async_to_generator(function() {
263
44
  var stats, publicPath, _stats_chunks, chunks, namedChunkGroups, routeAssets, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, assets, referenceCssAssets, manifest, injectedContent, entrypointsArray, entryChunkIds, entryChunks, entryChunkFiles, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, file, asset, newContent, filename;
264
- return __generator(this, function(_state) {
45
+ return _ts_generator(this, function(_state) {
265
46
  switch (_state.label) {
266
47
  case 0:
267
48
  stats = compilation.getStats().toJson({