@modern-js/app-tools 2.27.1-alpha.0 → 2.28.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/cjs/analyze/generateCode.js +16 -7
  3. package/dist/cjs/analyze/getFileSystemEntry.js +2 -1
  4. package/dist/cjs/analyze/getServerRoutes.js +5 -4
  5. package/dist/cjs/analyze/index.js +209 -211
  6. package/dist/cjs/analyze/nestedRoutes.js +58 -15
  7. package/dist/cjs/analyze/templates.js +4 -4
  8. package/dist/cjs/builder/builder-rspack/adapterCopy.js +41 -43
  9. package/dist/cjs/builder/builder-webpack/adapterModern.js +23 -25
  10. package/dist/cjs/builder/generator/createBuilderProviderConfig.js +2 -1
  11. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +12 -15
  12. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +33 -75
  13. package/dist/cjs/commands/build.js +2 -1
  14. package/dist/cjs/commands/inspect.js +2 -1
  15. package/dist/cjs/commands/serve.js +2 -2
  16. package/dist/cjs/index.js +3 -2
  17. package/dist/cjs/initialize/index.js +70 -72
  18. package/dist/esm/analyze/generateCode.js +35 -10
  19. package/dist/esm/analyze/getFileSystemEntry.js +2 -1
  20. package/dist/esm/analyze/getServerRoutes.js +5 -4
  21. package/dist/esm/analyze/nestedRoutes.js +59 -13
  22. package/dist/esm/analyze/templates.js +4 -4
  23. package/dist/esm/builder/builder-rspack/adapterCopy.js +1 -1
  24. package/dist/esm/builder/generator/createBuilderProviderConfig.js +2 -1
  25. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +13 -16
  26. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +41 -101
  27. package/dist/esm/commands/build.js +2 -2
  28. package/dist/esm/commands/inspect.js +2 -2
  29. package/dist/esm/commands/serve.js +2 -2
  30. package/dist/esm/index.js +3 -2
  31. package/dist/esm-node/analyze/generateCode.js +16 -7
  32. package/dist/esm-node/analyze/getFileSystemEntry.js +2 -1
  33. package/dist/esm-node/analyze/getServerRoutes.js +5 -4
  34. package/dist/esm-node/analyze/index.js +209 -211
  35. package/dist/esm-node/analyze/nestedRoutes.js +55 -15
  36. package/dist/esm-node/analyze/templates.js +4 -4
  37. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +41 -43
  38. package/dist/esm-node/builder/builder-webpack/adapterModern.js +23 -25
  39. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +2 -1
  40. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +12 -15
  41. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +33 -75
  42. package/dist/esm-node/commands/build.js +2 -1
  43. package/dist/esm-node/commands/inspect.js +2 -1
  44. package/dist/esm-node/commands/serve.js +2 -2
  45. package/dist/esm-node/index.js +3 -2
  46. package/dist/esm-node/initialize/index.js +70 -72
  47. package/dist/types/analyze/nestedRoutes.d.ts +2 -1
  48. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +0 -8
  49. package/package.json +24 -24
@@ -1,7 +1,6 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
2
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
3
3
  import { _ as _create_class } from "@swc/helpers/_/_create_class";
4
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
5
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
6
5
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
7
6
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
@@ -14,10 +13,8 @@ import { transform } from "esbuild";
14
13
  var PLUGIN_NAME = "ModernjsRoutePlugin";
15
14
  export var RouterPlugin = /* @__PURE__ */ function() {
16
15
  "use strict";
17
- function RouterPlugin2(options) {
16
+ function RouterPlugin2() {
18
17
  _class_call_check(this, RouterPlugin2);
19
- _define_property(this, "minimize", false);
20
- this.minimize = options.minimize;
21
18
  }
22
19
  _create_class(RouterPlugin2, [
23
20
  {
@@ -32,36 +29,9 @@ export var RouterPlugin = /* @__PURE__ */ function() {
32
29
  return false;
33
30
  }
34
31
  },
35
- {
36
- key: "getEntryChunks",
37
- value: function getEntryChunks(compilation, chunks) {
38
- var entrypointsArray = Array.from(compilation.entrypoints.entries());
39
- var entryChunkIds = entrypointsArray.map(function(entrypoint) {
40
- return entrypoint[0];
41
- });
42
- var entryChunks = _to_consumable_array(chunks).filter(function(chunk) {
43
- var _chunk_names;
44
- return (_chunk_names = chunk.names) === null || _chunk_names === void 0 ? void 0 : _chunk_names.some(function(name) {
45
- return entryChunkIds.includes(name);
46
- });
47
- });
48
- return entryChunks;
49
- }
50
- },
51
- {
52
- key: "getEntryChunkFiles",
53
- value: function getEntryChunkFiles(entryChunks) {
54
- return entryChunks.map(function(chunk) {
55
- return _to_consumable_array(chunk.files || []).find(function(fname) {
56
- return fname.includes(".js");
57
- });
58
- });
59
- }
60
- },
61
32
  {
62
33
  key: "apply",
63
34
  value: function apply(compiler) {
64
- var _this = this;
65
35
  var target = compiler.options.target;
66
36
  if (this.isTargetNodeOrWebWorker(target)) {
67
37
  return;
@@ -75,15 +45,13 @@ export var RouterPlugin = /* @__PURE__ */ function() {
75
45
  }
76
46
  return path2;
77
47
  };
78
- var chunkToSource = /* @__PURE__ */ new Map();
79
- var chunkToMap = /* @__PURE__ */ new Map();
48
+ var chunkToSourceAndMap = /* @__PURE__ */ new Map();
80
49
  compiler.hooks.thisCompilation.tap(PLUGIN_NAME, function(compilation) {
81
- var _this1 = _this;
82
50
  compilation.hooks.processAssets.tapPromise({
83
51
  name: PLUGIN_NAME,
84
52
  stage: Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING
85
53
  }, /* @__PURE__ */ _async_to_generator(function() {
86
- var stats, _stats_chunks, chunks, namedChunkGroups, entryChunks, entryChunkFiles, entryChunkFileIds, i, file, chunkId, asset, map;
54
+ var stats, _stats_chunks, chunks, namedChunkGroups, entrypointsArray, entryChunkIds, entryChunks, entryChunkFiles, entryChunkFileIds, i, file, chunkId, asset, _asset_sourceAndMap, source, map;
87
55
  return _ts_generator(this, function(_state) {
88
56
  stats = compilation.getStats().toJson({
89
57
  all: false,
@@ -97,50 +65,16 @@ export var RouterPlugin = /* @__PURE__ */ function() {
97
65
  2
98
66
  ];
99
67
  }
100
- entryChunks = _this1.getEntryChunks(compilation, chunks);
101
- entryChunkFiles = entryChunks.map(function(chunk) {
102
- return _to_consumable_array(chunk.files || []).find(function(fname) {
103
- return fname.includes(".js");
104
- });
68
+ entrypointsArray = Array.from(compilation.entrypoints.entries());
69
+ entryChunkIds = entrypointsArray.map(function(entrypoint) {
70
+ return entrypoint[0];
105
71
  });
106
- entryChunkFileIds = entryChunks.map(function(chunk) {
107
- return chunk.id;
108
- });
109
- for (i = 0; i <= entryChunkFiles.length - 1; i++) {
110
- file = entryChunkFiles[i];
111
- chunkId = entryChunkFileIds[i];
112
- asset = compilation.assets[file];
113
- if (!asset) {
114
- continue;
115
- }
116
- map = asset.sourceAndMap().map;
117
- chunkToMap.set(chunkId, map);
118
- }
119
- return [
120
- 2
121
- ];
122
- });
123
- }));
124
- var _this2 = _this;
125
- compilation.hooks.processAssets.tapPromise({
126
- name: PLUGIN_NAME,
127
- stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
128
- }, /* @__PURE__ */ _async_to_generator(function() {
129
- var stats, _stats_chunks, chunks, namedChunkGroups, entryChunks, entryChunkFiles, entryChunkFileIds, i, file, chunkId, asset, source;
130
- return _ts_generator(this, function(_state) {
131
- stats = compilation.getStats().toJson({
132
- all: false,
133
- chunkGroups: true,
134
- chunks: true,
135
- ids: true
72
+ entryChunks = _to_consumable_array(chunks).filter(function(chunk) {
73
+ var _chunk_names;
74
+ return (_chunk_names = chunk.names) === null || _chunk_names === void 0 ? void 0 : _chunk_names.some(function(name) {
75
+ return entryChunkIds.includes(name);
76
+ });
136
77
  });
137
- _stats_chunks = stats.chunks, chunks = _stats_chunks === void 0 ? [] : _stats_chunks, namedChunkGroups = stats.namedChunkGroups;
138
- if (!namedChunkGroups) {
139
- return [
140
- 2
141
- ];
142
- }
143
- entryChunks = _this2.getEntryChunks(compilation, chunks);
144
78
  entryChunkFiles = entryChunks.map(function(chunk) {
145
79
  return _to_consumable_array(chunk.files || []).find(function(fname) {
146
80
  return fname.includes(".js");
@@ -156,30 +90,31 @@ export var RouterPlugin = /* @__PURE__ */ function() {
156
90
  if (!asset) {
157
91
  continue;
158
92
  }
159
- source = asset.sourceAndMap().source;
160
- chunkToSource.set(chunkId, source);
93
+ _asset_sourceAndMap = asset.sourceAndMap(), source = _asset_sourceAndMap.source, map = _asset_sourceAndMap.map;
94
+ chunkToSourceAndMap.set(chunkId, {
95
+ source: source,
96
+ map: map
97
+ });
161
98
  }
162
99
  return [
163
100
  2
164
101
  ];
165
102
  });
166
103
  }));
167
- var _this3 = _this;
168
104
  compilation.hooks.processAssets.tapPromise({
169
105
  name: PLUGIN_NAME,
170
106
  stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
171
107
  }, /* @__PURE__ */ _async_to_generator(function() {
172
- var _loop, stats, publicPath, _stats_chunks, chunks, namedChunkGroups, routeAssets, prevManifestAsset, prevManifestStr, prevManifest, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, assets, referenceCssAssets, manifest, entryChunks, entryChunkFiles, entryChunkFileIds, i;
108
+ var _loop, stats, publicPath, _stats_chunks, chunks, namedChunkGroups, routeAssets, prevManifestAsset, prevManifestStr, prevManifest, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, assets, referenceCssAssets, manifest, entrypointsArray, entryChunkIds, entryChunks, entryChunkFiles, entryChunkFileIds, i;
173
109
  return _ts_generator(this, function(_state) {
174
110
  switch (_state.label) {
175
111
  case 0:
176
112
  _loop = function(i2) {
177
- var file, chunkNames, chunkId, asset, relatedAssets, manifest2, injectedContent, source, map, newContent, result, newSource;
113
+ var file, chunkId, asset, relatedAssets, manifest2, injectedContent, _chunkToSourceAndMap_get, source, map, newContent, result, newSource;
178
114
  return _ts_generator(this, function(_state2) {
179
115
  switch (_state2.label) {
180
116
  case 0:
181
117
  file = entryChunkFiles[i2];
182
- chunkNames = entryChunks[i2].names;
183
118
  chunkId = entryChunkFileIds[i2];
184
119
  asset = compilation.assets[file];
185
120
  if (!asset || !chunkId) {
@@ -189,17 +124,11 @@ export var RouterPlugin = /* @__PURE__ */ function() {
189
124
  ];
190
125
  }
191
126
  relatedAssets = {};
192
- if (entryChunkFiles.length > 1) {
193
- Object.keys(routeAssets).forEach(function(routeId) {
194
- var segments = routeId.split("_");
195
- var chunkName = segments[0];
196
- if (chunkNames === null || chunkNames === void 0 ? void 0 : chunkNames.includes(chunkName)) {
197
- relatedAssets[routeId] = routeAssets[routeId];
198
- }
199
- });
200
- } else {
201
- relatedAssets = routeAssets;
202
- }
127
+ Object.keys(routeAssets).forEach(function(routeId) {
128
+ if (routeId.startsWith("".concat(chunkId))) {
129
+ relatedAssets[routeId] = routeAssets[routeId];
130
+ }
131
+ });
203
132
  manifest2 = {
204
133
  routeAssets: relatedAssets
205
134
  };
@@ -211,15 +140,14 @@ export var RouterPlugin = /* @__PURE__ */ function() {
211
140
  }
212
141
  return v;
213
142
  }), ";\n })();\n ");
214
- source = chunkToSource.get(chunkId);
215
- map = chunkToMap.get(chunkId);
143
+ _chunkToSourceAndMap_get = chunkToSourceAndMap.get(chunkId), source = _chunkToSourceAndMap_get.source, map = _chunkToSourceAndMap_get.map;
216
144
  newContent = "".concat(injectedContent).concat(source.toString());
217
145
  return [
218
146
  4,
219
147
  transform(newContent, {
220
148
  loader: path.extname(file).slice(1),
221
149
  sourcemap: true,
222
- minify: _this3.minimize
150
+ minify: process.env.NODE_ENV === "production"
223
151
  })
224
152
  ];
225
153
  case 1:
@@ -270,7 +198,6 @@ export var RouterPlugin = /* @__PURE__ */ function() {
270
198
  });
271
199
  routeAssets[name] = {
272
200
  chunkIds: chunkGroup.chunks,
273
- chunkName: chunkGroup.name,
274
201
  assets: assets,
275
202
  referenceCssAssets: referenceCssAssets
276
203
  };
@@ -300,15 +227,28 @@ export var RouterPlugin = /* @__PURE__ */ function() {
300
227
  manifest = {
301
228
  routeAssets: routeAssets
302
229
  };
303
- entryChunks = _this3.getEntryChunks(compilation, chunks);
304
- entryChunkFiles = _this3.getEntryChunkFiles(entryChunks);
230
+ entrypointsArray = Array.from(compilation.entrypoints.entries());
231
+ entryChunkIds = entrypointsArray.map(function(entrypoint) {
232
+ return entrypoint[0];
233
+ });
234
+ entryChunks = _to_consumable_array(chunks).filter(function(chunk) {
235
+ var _chunk_names;
236
+ return (_chunk_names = chunk.names) === null || _chunk_names === void 0 ? void 0 : _chunk_names.some(function(name2) {
237
+ return entryChunkIds.includes(name2);
238
+ });
239
+ });
240
+ entryChunkFiles = entryChunks.map(function(chunk) {
241
+ return _to_consumable_array(chunk.files || []).find(function(fname) {
242
+ return fname.includes(".js");
243
+ });
244
+ });
305
245
  entryChunkFileIds = entryChunks.map(function(chunk) {
306
246
  return chunk.id;
307
247
  });
308
248
  i = 0;
309
249
  _state.label = 1;
310
250
  case 1:
311
- if (!(i < entryChunkFiles.length))
251
+ if (!(i <= entryChunkFiles.length - 1))
312
252
  return [
313
253
  3,
314
254
  4
@@ -8,11 +8,11 @@ import { generateRoutes } from "../utils/routes";
8
8
  import { buildServerConfig } from "../utils/config";
9
9
  export var build = function() {
10
10
  var _ref = _async_to_generator(function(api, options) {
11
- var resolvedConfig, appContext, hookRunners, apiOnly, appDirectory, distDirectory, serverConfigFile, distDirectory1, appDirectory1, serverConfigFile1;
11
+ var _options, resolvedConfig, appContext, hookRunners, apiOnly, appDirectory, distDirectory, serverConfigFile, distDirectory1, appDirectory1, serverConfigFile1;
12
12
  return _ts_generator(this, function(_state) {
13
13
  switch (_state.label) {
14
14
  case 0:
15
- if (options === null || options === void 0 ? void 0 : options.analyze) {
15
+ if ((_options = options) === null || _options === void 0 ? void 0 : _options.analyze) {
16
16
  process.env.BUNDLE_ANALYZE = "true";
17
17
  }
18
18
  resolvedConfig = api.useResolvedConfigContext();
@@ -3,7 +3,7 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
3
  import { join } from "path";
4
4
  export var inspect = function() {
5
5
  var _ref = _async_to_generator(function(api, options) {
6
- var appContext;
6
+ var _appContext, appContext;
7
7
  return _ts_generator(this, function(_state) {
8
8
  appContext = api.useAppContext();
9
9
  if (!appContext.builder) {
@@ -14,7 +14,7 @@ export var inspect = function() {
14
14
  appContext.builder.inspectConfig({
15
15
  env: options.env,
16
16
  verbose: options.verbose,
17
- outputPath: join(appContext === null || appContext === void 0 ? void 0 : appContext.builder.context.distPath, options.output),
17
+ outputPath: join((_appContext = appContext) === null || _appContext === void 0 ? void 0 : _appContext.builder.context.distPath, options.output),
18
18
  writeToDisk: true
19
19
  })
20
20
  ];
@@ -9,7 +9,7 @@ import { injectDataLoaderPlugin } from "../utils/createServer";
9
9
  import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
10
10
  export var start = function() {
11
11
  var _ref = _async_to_generator(function(api) {
12
- var _userConfig_source, _userConfig_output_distPath, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, metaName, apiOnly, serverInternalPlugins, app;
12
+ var _userConfig_source, _userConfig, _userConfig_output_distPath, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, metaName, apiOnly, serverInternalPlugins, app;
13
13
  return _ts_generator(this, function(_state) {
14
14
  switch (_state.label) {
15
15
  case 0:
@@ -20,7 +20,7 @@ export var start = function() {
20
20
  logger.log(chalk.cyan("Starting the modern server..."));
21
21
  return [
22
22
  4,
23
- isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory)
23
+ isApiOnly(appContext.appDirectory, (_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory)
24
24
  ];
25
25
  case 1:
26
26
  apiOnly = _state.sent();
package/dist/esm/index.js CHANGED
@@ -273,6 +273,7 @@ export var appTools = function() {
273
273
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
274
274
  bundler: "webpack"
275
275
  };
276
+ var _options, _options1;
276
277
  return {
277
278
  name: "@modern-js/app-tools",
278
279
  post: [
@@ -288,10 +289,10 @@ export var appTools = function() {
288
289
  registerHook: hooks,
289
290
  usePlugins: [
290
291
  initializePlugin({
291
- bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
292
+ bundler: ((_options = options) === null || _options === void 0 ? void 0 : _options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
292
293
  }),
293
294
  analyzePlugin({
294
- bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
295
+ bundler: ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.bundler) === "experimental-rspack" ? "rspack" : "webpack"
295
296
  }),
296
297
  lintPlugin()
297
298
  ],
@@ -50,11 +50,13 @@ ${initialize || ""}`);
50
50
  ${initialize || ""}`).join("\n");
51
51
  };
52
52
  export const generateCode = async (appContext, config, entrypoints, api) => {
53
+ var _config, _config_runtime_router, _config_runtime, _config1;
53
54
  const { internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
54
55
  const hookRunners = api.useHookRunners();
55
56
  const isV5 = isRouterV5(config);
56
57
  const getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
57
58
  const importsStatemets = /* @__PURE__ */ new Map();
59
+ const oldVersion = typeof ((_config = config) === null || _config === void 0 ? void 0 : _config.runtime.router) === "object" ? Boolean((_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_runtime = _config1.runtime) === null || _config_runtime === void 0 ? void 0 : (_config_runtime_router = _config_runtime.router) === null || _config_runtime_router === void 0 ? void 0 : _config_runtime_router.oldVersion) : false;
58
60
  await Promise.all(entrypoints.map(generateEntryCode));
59
61
  return {
60
62
  importsStatemets
@@ -63,9 +65,9 @@ export const generateCode = async (appContext, config, entrypoints, api) => {
63
65
  const { entryName, isMainEntry, isAutoMount, fileSystemRoutes } = entrypoint;
64
66
  if (isAutoMount) {
65
67
  if (fileSystemRoutes) {
66
- var _config_output;
68
+ var _config_output, _config2;
67
69
  let initialRoutes = [];
68
- let nestedRoute = null;
70
+ let nestedRoutes = null;
69
71
  if (entrypoint.entry) {
70
72
  initialRoutes = getRoutes({
71
73
  entrypoint,
@@ -76,12 +78,19 @@ export const generateCode = async (appContext, config, entrypoints, api) => {
76
78
  });
77
79
  }
78
80
  if (!isV5 && entrypoint.nestedRoutesEntry) {
79
- nestedRoute = await walk(entrypoint.nestedRoutesEntry, entrypoint.nestedRoutesEntry, {
81
+ nestedRoutes = await walk(entrypoint.nestedRoutesEntry, entrypoint.nestedRoutesEntry, {
80
82
  name: internalSrcAlias,
81
83
  basename: srcDirectory
82
- }, entrypoint.entryName, entrypoint.isMainEntry);
83
- if (nestedRoute) {
84
- initialRoutes.unshift(nestedRoute);
84
+ }, entrypoint.entryName, entrypoint.isMainEntry, oldVersion);
85
+ if (nestedRoutes) {
86
+ if (!Array.isArray(nestedRoutes)) {
87
+ nestedRoutes = [
88
+ nestedRoutes
89
+ ];
90
+ }
91
+ for (const route of nestedRoutes) {
92
+ initialRoutes.unshift(route);
93
+ }
85
94
  }
86
95
  }
87
96
  const { routes } = await hookRunners.modifyFileSystemRoutes({
@@ -110,7 +119,7 @@ export const generateCode = async (appContext, config, entrypoints, api) => {
110
119
  nestedRoutesEntry: entrypoint.nestedRoutesEntry,
111
120
  entryName: entrypoint.entryName,
112
121
  internalDirectory,
113
- splitRouteChunks: config2 === null || config2 === void 0 ? void 0 : (_config_output = config2.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
122
+ splitRouteChunks: (_config2 = config2) === null || _config2 === void 0 ? void 0 : (_config_output = _config2.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
114
123
  })
115
124
  });
116
125
  if (entrypoint.nestedRoutesEntry && isUseSSRBundle(config2)) {
@@ -69,7 +69,8 @@ export const getFileSystemEntry = (appContext, config) => {
69
69
  const { source: { entriesDir, disableEntryDirs } } = config;
70
70
  let disabledDirs = [];
71
71
  if (disableEntryDirs && Array.isArray(disableEntryDirs)) {
72
- disabledDirs = disableEntryDirs === null || disableEntryDirs === void 0 ? void 0 : disableEntryDirs.map((dir) => ensureAbsolutePath(appDirectory, dir));
72
+ var _disableEntryDirs;
73
+ disabledDirs = (_disableEntryDirs = disableEntryDirs) === null || _disableEntryDirs === void 0 ? void 0 : _disableEntryDirs.map((dir) => ensureAbsolutePath(appDirectory, dir));
73
74
  }
74
75
  const src = ensureAbsolutePath(appDirectory, entriesDir || "");
75
76
  if (fs.existsSync(src)) {
@@ -68,17 +68,18 @@ const applyRouteOptions = (original, routeOptions) => {
68
68
  return routes;
69
69
  };
70
70
  const collectHtmlRoutes = (entrypoints, appContext, config) => {
71
- var _deploy_worker;
71
+ var _deploy_worker, _deploy;
72
72
  const { source: { mainEntryName }, html: { disableHtmlFolder }, output: { distPath: { html: htmlPath } = {} }, server: { baseUrl, routes, ssr, ssrByEntries }, deploy } = config;
73
73
  const { packageName } = appContext;
74
- const workerSSR = deploy === null || deploy === void 0 ? void 0 : (_deploy_worker = deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr;
74
+ const workerSSR = (_deploy = deploy) === null || _deploy === void 0 ? void 0 : (_deploy_worker = _deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr;
75
75
  let htmlRoutes = entrypoints.reduce((previous, { entryName }) => {
76
+ var _routes, _routes1;
76
77
  const isMainEntry = entryName === (mainEntryName || MAIN_ENTRY_NAME);
77
78
  const entryOptions = getEntryOptions(entryName, isMainEntry, ssr, ssrByEntries, packageName);
78
79
  const isSSR = Boolean(entryOptions);
79
80
  const isWorker = Boolean(workerSSR);
80
81
  const isStream = typeof entryOptions === "object" && entryOptions.mode === "stream";
81
- const { resHeaders } = (routes === null || routes === void 0 ? void 0 : routes[entryName]) || {};
82
+ const { resHeaders } = ((_routes = routes) === null || _routes === void 0 ? void 0 : _routes[entryName]) || {};
82
83
  let route = {
83
84
  urlPath: `/${isMainEntry ? "" : entryName}`,
84
85
  entryName,
@@ -90,7 +91,7 @@ const collectHtmlRoutes = (entrypoints, appContext, config) => {
90
91
  worker: isWorker ? `${SERVER_WORKER_BUNDLE_DIRECTORY}/${entryName}.js` : void 0,
91
92
  bundle: isSSR ? `${SERVER_BUNDLE_DIRECTORY}/${entryName}.js` : void 0
92
93
  };
93
- if (routes === null || routes === void 0 ? void 0 : routes.hasOwnProperty(entryName)) {
94
+ if ((_routes1 = routes) === null || _routes1 === void 0 ? void 0 : _routes1.hasOwnProperty(entryName)) {
94
95
  const routeOptions = isPlainObject(routes[entryName]) ? routes[entryName] : {
95
96
  route: routes[entryName]
96
97
  };