@modern-js/app-tools 2.35.0 → 2.35.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.
Files changed (54) hide show
  1. package/dist/cjs/analyze/constants.js +1 -0
  2. package/dist/cjs/analyze/generateCode.js +3 -4
  3. package/dist/cjs/analyze/getFileSystemEntry.js +1 -2
  4. package/dist/cjs/analyze/getServerRoutes.js +4 -5
  5. package/dist/cjs/analyze/nestedRoutes.js +11 -2
  6. package/dist/cjs/analyze/templates.js +4 -4
  7. package/dist/cjs/builder/generator/createBuilderProviderConfig.js +1 -2
  8. package/dist/cjs/builder/index.js +1 -1
  9. package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +4 -20
  10. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +12 -14
  11. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +2 -2
  12. package/dist/cjs/commands/build.js +2 -3
  13. package/dist/cjs/commands/inspect.js +1 -2
  14. package/dist/cjs/commands/serve.js +3 -3
  15. package/dist/cjs/index.js +127 -130
  16. package/dist/cjs/utils/config.js +1 -1
  17. package/dist/cjs/utils/printInstructions.js +1 -1
  18. package/dist/esm/analyze/constants.js +1 -0
  19. package/dist/esm/analyze/generateCode.js +4 -4
  20. package/dist/esm/analyze/getFileSystemEntry.js +1 -2
  21. package/dist/esm/analyze/getServerRoutes.js +4 -5
  22. package/dist/esm/analyze/nestedRoutes.js +11 -2
  23. package/dist/esm/analyze/templates.js +4 -4
  24. package/dist/esm/builder/generator/createBuilderProviderConfig.js +1 -2
  25. package/dist/esm/builder/index.js +1 -1
  26. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +12 -43
  27. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +12 -14
  28. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +2 -2
  29. package/dist/esm/commands/build.js +3 -3
  30. package/dist/esm/commands/inspect.js +2 -2
  31. package/dist/esm/commands/serve.js +4 -4
  32. package/dist/esm/index.js +2 -3
  33. package/dist/esm/utils/config.js +2 -2
  34. package/dist/esm/utils/printInstructions.js +1 -1
  35. package/dist/esm-node/analyze/constants.js +1 -0
  36. package/dist/esm-node/analyze/generateCode.js +3 -4
  37. package/dist/esm-node/analyze/getFileSystemEntry.js +1 -2
  38. package/dist/esm-node/analyze/getServerRoutes.js +4 -5
  39. package/dist/esm-node/analyze/nestedRoutes.js +11 -2
  40. package/dist/esm-node/analyze/templates.js +4 -4
  41. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +1 -2
  42. package/dist/esm-node/builder/index.js +1 -1
  43. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +4 -19
  44. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +12 -14
  45. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +2 -2
  46. package/dist/esm-node/commands/build.js +2 -3
  47. package/dist/esm-node/commands/inspect.js +1 -2
  48. package/dist/esm-node/commands/serve.js +4 -4
  49. package/dist/esm-node/index.js +127 -130
  50. package/dist/esm-node/utils/config.js +2 -2
  51. package/dist/esm-node/utils/printInstructions.js +1 -1
  52. package/dist/types/analyze/constants.d.ts +1 -0
  53. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -0
  54. package/package.json +24 -25
package/dist/cjs/index.js CHANGED
@@ -93,140 +93,137 @@ const buildCommand = async (program, api) => {
93
93
  };
94
94
  const appTools = (options = {
95
95
  bundler: "webpack"
96
- }) => {
97
- var _options, _options1;
98
- return {
99
- name: "@modern-js/app-tools",
100
- post: [
101
- "@modern-js/plugin-initialize",
102
- "@modern-js/plugin-analyze",
103
- "@modern-js/plugin-ssr",
104
- "@modern-js/plugin-document",
105
- "@modern-js/plugin-state",
106
- "@modern-js/plugin-router",
107
- "@modern-js/plugin-router-v5",
108
- "@modern-js/plugin-polyfill"
109
- ],
110
- registerHook: _hooks.hooks,
111
- usePlugins: [
112
- (0, _initialize.default)({
113
- bundler: ((_options = options) === null || _options === void 0 ? void 0 : _options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
114
- }),
115
- (0, _analyze.default)({
116
- bundler: ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.bundler) === "experimental-rspack" ? "rspack" : "webpack"
117
- }),
118
- (0, _pluginlint.lintPlugin)()
119
- ],
120
- setup: (api) => {
121
- const appContext = api.useAppContext();
122
- api.setAppContext({
123
- ...appContext,
124
- toolsType: "app-tools"
125
- });
126
- const nestedRoutes = {};
127
- const locale = (0, _languagedetector.getLocaleLanguage)();
128
- _locale.i18n.changeLanguage({
129
- locale
130
- });
131
- return {
132
- async beforeConfig() {
133
- var _userConfig_output;
134
- const userConfig = api.useConfigContext();
135
- const appContext2 = api.useAppContext();
136
- if ((_userConfig_output = userConfig.output) === null || _userConfig_output === void 0 ? void 0 : _userConfig_output.tempDir) {
137
- api.setAppContext({
138
- ...appContext2,
139
- internalDirectory: _path.default.resolve(appContext2.appDirectory, userConfig.output.tempDir)
140
- });
141
- }
142
- },
143
- async commands({ program }) {
144
- await devCommand(program, api);
145
- await buildCommand(program, api);
146
- program.command("serve").usage("[options]").description(_locale.i18n.t(_locale.localeKeys.command.serve.describe)).option("--api-only", _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async () => {
147
- const { start } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/serve")));
148
- await start(api);
149
- });
150
- program.command("deploy").usage("[options]").option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("-s --skip-build", _locale.i18n.t(_locale.localeKeys.command.shared.skipBuild)).description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async (options2) => {
151
- if (!options2.skipBuild) {
152
- const { build } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/build")));
153
- await build(api);
154
- }
155
- const { deploy } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/deploy")));
156
- await deploy(api, options2);
157
- process.exit(0);
96
+ }) => ({
97
+ name: "@modern-js/app-tools",
98
+ post: [
99
+ "@modern-js/plugin-initialize",
100
+ "@modern-js/plugin-analyze",
101
+ "@modern-js/plugin-ssr",
102
+ "@modern-js/plugin-document",
103
+ "@modern-js/plugin-state",
104
+ "@modern-js/plugin-router",
105
+ "@modern-js/plugin-router-v5",
106
+ "@modern-js/plugin-polyfill"
107
+ ],
108
+ registerHook: _hooks.hooks,
109
+ usePlugins: [
110
+ (0, _initialize.default)({
111
+ bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
112
+ }),
113
+ (0, _analyze.default)({
114
+ bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
115
+ }),
116
+ (0, _pluginlint.lintPlugin)()
117
+ ],
118
+ setup: (api) => {
119
+ const appContext = api.useAppContext();
120
+ api.setAppContext({
121
+ ...appContext,
122
+ toolsType: "app-tools"
123
+ });
124
+ const nestedRoutes = {};
125
+ const locale = (0, _languagedetector.getLocaleLanguage)();
126
+ _locale.i18n.changeLanguage({
127
+ locale
128
+ });
129
+ return {
130
+ async beforeConfig() {
131
+ var _userConfig_output;
132
+ const userConfig = api.useConfigContext();
133
+ const appContext2 = api.useAppContext();
134
+ if ((_userConfig_output = userConfig.output) === null || _userConfig_output === void 0 ? void 0 : _userConfig_output.tempDir) {
135
+ api.setAppContext({
136
+ ...appContext2,
137
+ internalDirectory: _path.default.resolve(appContext2.appDirectory, userConfig.output.tempDir)
158
138
  });
159
- program.command("new").usage("[options]").description(_locale.i18n.t(_locale.localeKeys.command.new.describe)).option("--config-file <configFile>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("--lang <lang>", _locale.i18n.t(_locale.localeKeys.command.new.lang)).option("-c, --config <config>", _locale.i18n.t(_locale.localeKeys.command.new.config)).option("-d, --debug", _locale.i18n.t(_locale.localeKeys.command.new.debug), false).option("--dist-tag <tag>", _locale.i18n.t(_locale.localeKeys.command.new.distTag)).option("--registry", _locale.i18n.t(_locale.localeKeys.command.new.registry)).option("--no-need-install", _locale.i18n.t(_locale.localeKeys.command.shared.noNeedInstall)).action(async (options2) => {
160
- const { MWANewAction } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/new-action")));
161
- await MWANewAction({
162
- ...options2,
163
- locale: options2.lang || locale
164
- });
139
+ }
140
+ },
141
+ async commands({ program }) {
142
+ await devCommand(program, api);
143
+ await buildCommand(program, api);
144
+ program.command("serve").usage("[options]").description(_locale.i18n.t(_locale.localeKeys.command.serve.describe)).option("--api-only", _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async () => {
145
+ const { start } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/serve")));
146
+ await start(api);
147
+ });
148
+ program.command("deploy").usage("[options]").option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("-s --skip-build", _locale.i18n.t(_locale.localeKeys.command.shared.skipBuild)).description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async (options2) => {
149
+ if (!options2.skipBuild) {
150
+ const { build } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/build")));
151
+ await build(api);
152
+ }
153
+ const { deploy } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/deploy")));
154
+ await deploy(api, options2);
155
+ process.exit(0);
156
+ });
157
+ program.command("new").usage("[options]").description(_locale.i18n.t(_locale.localeKeys.command.new.describe)).option("--config-file <configFile>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("--lang <lang>", _locale.i18n.t(_locale.localeKeys.command.new.lang)).option("-c, --config <config>", _locale.i18n.t(_locale.localeKeys.command.new.config)).option("-d, --debug", _locale.i18n.t(_locale.localeKeys.command.new.debug), false).option("--dist-tag <tag>", _locale.i18n.t(_locale.localeKeys.command.new.distTag)).option("--registry", _locale.i18n.t(_locale.localeKeys.command.new.registry)).option("--no-need-install", _locale.i18n.t(_locale.localeKeys.command.shared.noNeedInstall)).action(async (options2) => {
158
+ const { MWANewAction } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/new-action")));
159
+ await MWANewAction({
160
+ ...options2,
161
+ locale: options2.lang || locale
165
162
  });
166
- program.command("inspect").description("inspect the internal configs").option(`--env <env>`, _locale.i18n.t(_locale.localeKeys.command.inspect.env), "development").option("--output <output>", _locale.i18n.t(_locale.localeKeys.command.inspect.output), "/").option("--verbose", _locale.i18n.t(_locale.localeKeys.command.inspect.verbose)).option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async (options2) => {
167
- const { inspect } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/inspect")));
168
- inspect(api, options2);
163
+ });
164
+ program.command("inspect").description("inspect the internal configs").option(`--env <env>`, _locale.i18n.t(_locale.localeKeys.command.inspect.env), "development").option("--output <output>", _locale.i18n.t(_locale.localeKeys.command.inspect.output), "/").option("--verbose", _locale.i18n.t(_locale.localeKeys.command.inspect.verbose)).option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async (options2) => {
165
+ const { inspect } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/inspect")));
166
+ inspect(api, options2);
167
+ });
168
+ const { defineCommand } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/upgrade")));
169
+ defineCommand(program.command("upgrade").option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("--no-need-install", _locale.i18n.t(_locale.localeKeys.command.shared.noNeedInstall)));
170
+ },
171
+ async prepare() {
172
+ const command = (0, _utils.getCommand)();
173
+ if (command === "deploy") {
174
+ const isSkipBuild = [
175
+ "-s",
176
+ "--skip-build"
177
+ ].some((tag) => {
178
+ return (0, _utils.getArgv)().includes(tag);
169
179
  });
170
- const { defineCommand } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("@modern-js/upgrade")));
171
- defineCommand(program.command("upgrade").option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("--no-need-install", _locale.i18n.t(_locale.localeKeys.command.shared.noNeedInstall)));
172
- },
173
- async prepare() {
174
- const command = (0, _utils.getCommand)();
175
- if (command === "deploy") {
176
- const isSkipBuild = [
177
- "-s",
178
- "--skip-build"
179
- ].some((tag) => {
180
- return (0, _utils.getArgv)().includes(tag);
181
- });
182
- if (isSkipBuild) {
183
- return;
184
- }
185
- }
186
- if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
187
- const resolvedConfig = api.useResolvedConfigContext();
188
- if (resolvedConfig.output.cleanDistPath) {
189
- const appContext2 = api.useAppContext();
190
- await (0, _utils.emptyDir)(appContext2.distDirectory);
191
- }
180
+ if (isSkipBuild) {
181
+ return;
192
182
  }
193
- },
194
- async watchFiles() {
195
- const appContext2 = api.useAppContext();
196
- const config = api.useResolvedConfigContext();
197
- return await (0, _generateWatchFiles.generateWatchFiles)(appContext2, config.source.configDir);
198
- },
199
- // 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
200
- async fileChange(e) {
201
- const { filename, eventType, isPrivate } = e;
202
- if (!isPrivate && (eventType === "change" || eventType === "unlink")) {
203
- const { closeServer } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./utils/createServer")));
204
- await closeServer();
205
- await (0, _restart.restart)(api.useHookRunners(), filename);
183
+ }
184
+ if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
185
+ const resolvedConfig = api.useResolvedConfigContext();
186
+ if (resolvedConfig.output.cleanDistPath) {
187
+ const appContext2 = api.useAppContext();
188
+ await (0, _utils.emptyDir)(appContext2.distDirectory);
206
189
  }
207
- },
208
- async beforeRestart() {
209
- (0, _utils.cleanRequireCache)([
210
- require.resolve("./analyze")
211
- ]);
212
- },
213
- async modifyFileSystemRoutes({ entrypoint, routes }) {
214
- nestedRoutes[entrypoint.entryName] = routes;
215
- return {
216
- entrypoint,
217
- routes
218
- };
219
- },
220
- async beforeGenerateRoutes({ entrypoint, code }) {
221
- const { distDirectory } = api.useAppContext();
222
- await _utils.fs.outputJSON(_path.default.resolve(distDirectory, _utils.NESTED_ROUTE_SPEC_FILE), nestedRoutes);
223
- return {
224
- entrypoint,
225
- code
226
- };
227
190
  }
228
- };
229
- }
230
- };
231
- };
191
+ },
192
+ async watchFiles() {
193
+ const appContext2 = api.useAppContext();
194
+ const config = api.useResolvedConfigContext();
195
+ return await (0, _generateWatchFiles.generateWatchFiles)(appContext2, config.source.configDir);
196
+ },
197
+ // 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
198
+ async fileChange(e) {
199
+ const { filename, eventType, isPrivate } = e;
200
+ if (!isPrivate && (eventType === "change" || eventType === "unlink")) {
201
+ const { closeServer } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./utils/createServer")));
202
+ await closeServer();
203
+ await (0, _restart.restart)(api.useHookRunners(), filename);
204
+ }
205
+ },
206
+ async beforeRestart() {
207
+ (0, _utils.cleanRequireCache)([
208
+ require.resolve("./analyze")
209
+ ]);
210
+ },
211
+ async modifyFileSystemRoutes({ entrypoint, routes }) {
212
+ nestedRoutes[entrypoint.entryName] = routes;
213
+ return {
214
+ entrypoint,
215
+ routes
216
+ };
217
+ },
218
+ async beforeGenerateRoutes({ entrypoint, code }) {
219
+ const { distDirectory } = api.useAppContext();
220
+ await _utils.fs.outputJSON(_path.default.resolve(distDirectory, _utils.NESTED_ROUTE_SPEC_FILE), nestedRoutes);
221
+ return {
222
+ entrypoint,
223
+ code
224
+ };
225
+ }
226
+ };
227
+ }
228
+ });
232
229
  const _default = appTools;
@@ -76,7 +76,7 @@ const safeReplacer = () => {
76
76
  };
77
77
  const emitResolvedConfig = async (appDirectory, resolvedConfig) => {
78
78
  var _resolvedConfig_output_distPath;
79
- const outputPath = _path.join(appDirectory, ((_resolvedConfig_output_distPath = resolvedConfig.output.distPath) === null || _resolvedConfig_output_distPath === void 0 ? void 0 : _resolvedConfig_output_distPath.root) || "./dist", _utils.OUTPUT_CONFIG_FILE);
79
+ const outputPath = (0, _utils.ensureAbsolutePath)(appDirectory, _path.join(((_resolvedConfig_output_distPath = resolvedConfig.output.distPath) === null || _resolvedConfig_output_distPath === void 0 ? void 0 : _resolvedConfig_output_distPath.root) || "./dist", _utils.OUTPUT_CONFIG_FILE));
80
80
  await _utils.fs.writeJSON(outputPath, resolvedConfig, {
81
81
  spaces: 2,
82
82
  replacer: safeReplacer()
@@ -14,5 +14,5 @@ const printInstructions = async (hookRunners, appContext, config) => {
14
14
  const { instructions } = await hookRunners.beforePrintInstructions({
15
15
  instructions: message
16
16
  });
17
- _utils.logger.info(instructions);
17
+ _utils.logger.log(instructions);
18
18
  };
@@ -37,6 +37,7 @@ export var NESTED_ROUTE = {
37
37
  PAGE_DATA_FILE: "page.data",
38
38
  PAGE_CLIENT_LOADER: "page.data.client",
39
39
  SPLATE_FILE: "$",
40
+ SPLATE_CONFIG_FILE: "$.config",
40
41
  SPLATE_LOADER_FILE: "$.loader",
41
42
  SPLATE_DATA_FILE: "$.data",
42
43
  SPLATE_CLIENT_DATA: "$.data.client",
@@ -94,13 +94,13 @@ export var createImportStatements = function(statements) {
94
94
  };
95
95
  export var generateCode = function() {
96
96
  var _ref = _async_to_generator(function(appContext, config, entrypoints, api) {
97
- var _config, _config1, internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5, getRoutes, importsStatemets, oldVersion;
97
+ var internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5, getRoutes, importsStatemets, oldVersion;
98
98
  function generateEntryCode(entrypoint) {
99
99
  return _generateEntryCode.apply(this, arguments);
100
100
  }
101
101
  function _generateEntryCode() {
102
102
  _generateEntryCode = _async_to_generator(function(entrypoint) {
103
- var entryName, isMainEntry, isAutoMount, fileSystemRoutes, _config_output, _config2, initialRoutes, nestedRoutes, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, route, routes, _$config, ssr, useSSG, mode, hasPageRoute, code, _, _tmp, routesServerFile, code1, serverLoaderCombined, serverLoaderFile, imports, entryFile;
103
+ var entryName, isMainEntry, isAutoMount, fileSystemRoutes, _config_output, initialRoutes, nestedRoutes, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, route, routes, _$config, ssr, useSSG, mode, hasPageRoute, code, _, _tmp, routesServerFile, code1, serverLoaderCombined, serverLoaderFile, imports, entryFile;
104
104
  return _ts_generator(this, function(_state) {
105
105
  switch (_state.label) {
106
106
  case 0:
@@ -205,7 +205,7 @@ export var generateCode = function() {
205
205
  nestedRoutesEntry: entrypoint.nestedRoutesEntry,
206
206
  entryName: entrypoint.entryName,
207
207
  internalDirectory: internalDirectory,
208
- splitRouteChunks: (_config2 = _$config) === null || _config2 === void 0 ? void 0 : (_config_output = _config2.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
208
+ splitRouteChunks: _$config === null || _$config === void 0 ? void 0 : (_config_output = _$config.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
209
209
  })
210
210
  ];
211
211
  case 4:
@@ -294,7 +294,7 @@ export var generateCode = function() {
294
294
  isV5 = isRouterV5(config);
295
295
  getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
296
296
  importsStatemets = /* @__PURE__ */ new Map();
297
- oldVersion = typeof ((_config = config) === null || _config === void 0 ? void 0 : _config.runtime.router) === "object" ? Boolean(((_config1 = config) === null || _config1 === void 0 ? void 0 : _config1.runtime.router).oldVersion) : false;
297
+ oldVersion = typeof (config === null || config === void 0 ? void 0 : config.runtime.router) === "object" ? Boolean((config === null || config === void 0 ? void 0 : config.runtime.router).oldVersion) : false;
298
298
  return [
299
299
  4,
300
300
  Promise.all(entrypoints.map(generateEntryCode))
@@ -87,8 +87,7 @@ export var getFileSystemEntry = function(appContext, config) {
87
87
  var _config_source = config.source, entriesDir = _config_source.entriesDir, disableEntryDirs = _config_source.disableEntryDirs;
88
88
  var disabledDirs = [];
89
89
  if (disableEntryDirs && Array.isArray(disableEntryDirs)) {
90
- var _disableEntryDirs;
91
- disabledDirs = (_disableEntryDirs = disableEntryDirs) === null || _disableEntryDirs === void 0 ? void 0 : _disableEntryDirs.map(function(dir) {
90
+ disabledDirs = disableEntryDirs === null || disableEntryDirs === void 0 ? void 0 : disableEntryDirs.map(function(dir) {
92
91
  return ensureAbsolutePath(appDirectory, dir);
93
92
  });
94
93
  }
@@ -69,19 +69,18 @@ var applyRouteOptions = function(original, routeOptions) {
69
69
  return routes;
70
70
  };
71
71
  var collectHtmlRoutes = function(entrypoints, appContext, config) {
72
- var _deploy_worker, _deploy;
72
+ var _deploy_worker;
73
73
  var mainEntryName = config.source.mainEntryName, disableHtmlFolder = config.html.disableHtmlFolder, _config_output = config.output, tmp = _config_output.distPath, _ref = tmp === void 0 ? {} : tmp, htmlPath = _ref.html, _config_server = config.server, baseUrl = _config_server.baseUrl, routes = _config_server.routes, ssr = _config_server.ssr, ssrByEntries = _config_server.ssrByEntries, deploy = config.deploy;
74
74
  var packageName = appContext.packageName;
75
- var workerSSR = (_deploy = deploy) === null || _deploy === void 0 ? void 0 : (_deploy_worker = _deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr;
75
+ var workerSSR = deploy === null || deploy === void 0 ? void 0 : (_deploy_worker = deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr;
76
76
  var htmlRoutes = entrypoints.reduce(function(previous, param) {
77
77
  var entryName = param.entryName;
78
- var _routes, _routes1;
79
78
  var isMainEntry = entryName === (mainEntryName || MAIN_ENTRY_NAME);
80
79
  var entryOptions = getEntryOptions(entryName, isMainEntry, ssr, ssrByEntries, packageName);
81
80
  var isSSR = Boolean(entryOptions);
82
81
  var isWorker = Boolean(workerSSR);
83
82
  var isStream = typeof entryOptions === "object" && (entryOptions.mode === "stream" || Boolean(entryOptions.preload));
84
- var resHeaders = (((_routes = routes) === null || _routes === void 0 ? void 0 : _routes[entryName]) || {}).resHeaders;
83
+ var resHeaders = ((routes === null || routes === void 0 ? void 0 : routes[entryName]) || {}).resHeaders;
85
84
  var route = {
86
85
  urlPath: "/".concat(isMainEntry ? "" : entryName),
87
86
  entryName: entryName,
@@ -93,7 +92,7 @@ var collectHtmlRoutes = function(entrypoints, appContext, config) {
93
92
  worker: isWorker ? "".concat(SERVER_WORKER_BUNDLE_DIRECTORY, "/").concat(entryName, ".js") : void 0,
94
93
  bundle: isSSR ? "".concat(SERVER_BUNDLE_DIRECTORY, "/").concat(entryName, ".js") : void 0
95
94
  };
96
- if ((_routes1 = routes) === null || _routes1 === void 0 ? void 0 : _routes1.hasOwnProperty(entryName)) {
95
+ if (routes === null || routes === void 0 ? void 0 : routes.hasOwnProperty(entryName)) {
97
96
  var routeOptions = isPlainObject(routes[entryName]) ? routes[entryName] : {
98
97
  route: routes[entryName]
99
98
  };
@@ -73,7 +73,7 @@ export var optimizeRoute = function(routeTree) {
73
73
  };
74
74
  export var walk = function() {
75
75
  var _ref = _async_to_generator(function(dirname, rootDir, alias, entryName, isMainEntry, oldVersion) {
76
- var _routePath, _finalRoute_children, isDirectory, relativeDir, pathSegments, lastSegment, isRoot, isPathlessLayout, isWithoutLayoutPath, routePath, route, pageLoaderFile, pageRoute, splatLoaderFile, splatClientData, splatData, splatRoute, pageConfigFile, items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, itemPath, extname, itemWithoutExt, isDirectory1, childRoute, _route_children, _route_children1, _route_children2, err, finalRoute, childRoutes, childRoute1, _$path, optimizedRoutes;
76
+ var _finalRoute_children, isDirectory, relativeDir, pathSegments, lastSegment, isRoot, isPathlessLayout, isWithoutLayoutPath, routePath, route, pageLoaderFile, pageRoute, splatLoaderFile, splatClientData, splatData, splatRoute, pageConfigFile, splatConfigFile, items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item, itemPath, extname, itemWithoutExt, isDirectory1, childRoute, _route_children, _route_children1, _route_children2, err, finalRoute, childRoutes, childRoute1, _$path, optimizedRoutes;
77
77
  return _ts_generator(this, function(_state) {
78
78
  switch (_state.label) {
79
79
  case 0:
@@ -112,7 +112,7 @@ export var walk = function() {
112
112
  }
113
113
  routePath = replaceDynamicPath(routePath);
114
114
  route = {
115
- path: (_routePath = routePath) === null || _routePath === void 0 ? void 0 : _routePath.replace(/\$$/, "?"),
115
+ path: routePath === null || routePath === void 0 ? void 0 : routePath.replace(/\$$/, "?"),
116
116
  children: [],
117
117
  isRoot: isRoot
118
118
  };
@@ -123,6 +123,7 @@ export var walk = function() {
123
123
  splatData = "";
124
124
  splatRoute = null;
125
125
  pageConfigFile = "";
126
+ splatConfigFile = "";
126
127
  return [
127
128
  4,
128
129
  fs.readdir(dirname)
@@ -229,6 +230,11 @@ export var walk = function() {
229
230
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_CLIENT_DATA) {
230
231
  splatClientData = itemPath;
231
232
  }
233
+ if (itemWithoutExt === NESTED_ROUTE.SPLATE_CONFIG_FILE) {
234
+ if (!route.config) {
235
+ splatConfigFile = itemPath;
236
+ }
237
+ }
232
238
  if (itemWithoutExt === NESTED_ROUTE.SPLATE_DATA_FILE) {
233
239
  splatData = itemPath;
234
240
  }
@@ -247,6 +253,9 @@ export var walk = function() {
247
253
  if (splatData) {
248
254
  splatRoute.data = splatData;
249
255
  }
256
+ if (splatConfigFile) {
257
+ splatRoute.config = splatConfigFile;
258
+ }
250
259
  (_route_children2 = route.children) === null || _route_children2 === void 0 ? void 0 : _route_children2.push(splatRoute);
251
260
  }
252
261
  if (itemWithoutExt === NESTED_ROUTE.LOADING_FILE) {
@@ -28,8 +28,8 @@ export var routesForServer = function(param) {
28
28
  var traverseRouteTree = function(route2) {
29
29
  var children;
30
30
  if ("children" in route2 && route2.children) {
31
- var _route_children, _route;
32
- children = (_route = route2) === null || _route === void 0 ? void 0 : (_route_children = _route.children) === null || _route_children === void 0 ? void 0 : _route_children.map(traverseRouteTree);
31
+ var _route_children;
32
+ children = route2 === null || route2 === void 0 ? void 0 : (_route_children = route2.children) === null || _route_children === void 0 ? void 0 : _route_children.map(traverseRouteTree);
33
33
  }
34
34
  var loader;
35
35
  if (route2.type === "nested") {
@@ -112,8 +112,8 @@ export var fileSystemRoutes = function() {
112
112
  traverseRouteTree = function(route2) {
113
113
  var children;
114
114
  if ("children" in route2 && route2.children) {
115
- var _route_children, _route;
116
- children = (_route = route2) === null || _route === void 0 ? void 0 : (_route_children = _route.children) === null || _route_children === void 0 ? void 0 : _route_children.map(traverseRouteTree);
115
+ var _route_children;
116
+ children = route2 === null || route2 === void 0 ? void 0 : (_route_children = route2.children) === null || _route_children === void 0 ? void 0 : _route_children.map(traverseRouteTree);
117
117
  }
118
118
  var loading;
119
119
  var error;
@@ -3,10 +3,9 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
4
4
  import { createUploadPattern } from "../builder-webpack/createCopyPattern";
5
5
  function modifyOutputConfig(config, appContext) {
6
- var _copy;
7
6
  var defaultCopyPattern = createUploadPattern(appContext, config);
8
7
  var copy = config.output.copy;
9
- var copyOptions = Array.isArray(copy) ? copy : (_copy = copy) === null || _copy === void 0 ? void 0 : _copy.patterns;
8
+ var copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
10
9
  var builderCopy = _to_consumable_array(copyOptions || []).concat([
11
10
  defaultCopyPattern
12
11
  ]);
@@ -41,7 +41,7 @@ function _createBuilderGenerator() {
41
41
  ];
42
42
  case 4:
43
43
  version = _state.sent();
44
- logger.info("Using Rspack v".concat(version, " 🦀"));
44
+ logger.info("Using Rspack v".concat(version));
45
45
  return [
46
46
  2,
47
47
  createRspackBuilderForModern
@@ -1,5 +1,4 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
3
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
4
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
5
4
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
@@ -34,7 +33,6 @@ export var builderPluginAdapterHtml = function(options) {
34
33
  return [
35
34
  4,
36
35
  injectAssetPrefix({
37
- api: api,
38
36
  chain: chain
39
37
  })
40
38
  ];
@@ -60,48 +58,19 @@ function injectAssetPrefix(_) {
60
58
  }
61
59
  function _injectAssetPrefix() {
62
60
  _injectAssetPrefix = _async_to_generator(function(param) {
63
- var api, chain, entries, entryNames, assetPrefix, code, isRspack, fileName, _ref, RspackVirtualModulePlugin;
61
+ var chain, entries, entryNames, assetPrefix, code;
64
62
  return _ts_generator(this, function(_state) {
65
- switch (_state.label) {
66
- case 0:
67
- api = param.api, chain = param.chain;
68
- entries = chain.entryPoints.entries() || {};
69
- entryNames = Object.keys(entries);
70
- assetPrefix = removeTailSlash(chain.output.get("publicPath") || "");
71
- code = "window.__assetPrefix__ = '".concat(assetPrefix, "';");
72
- isRspack = api.context.bundlerType === "rspack";
73
- if (!isRspack)
74
- return [
75
- 3,
76
- 2
77
- ];
78
- fileName = "rspack-asset-prefix";
79
- return [
80
- 4,
81
- import("rspack-plugin-virtual-module")
82
- ];
83
- case 1:
84
- _ref = _state.sent(), RspackVirtualModulePlugin = _ref.default;
85
- entryNames.forEach(function(entryName) {
86
- entries[entryName].prepend(fileName);
87
- chain.plugin("rspack-asset-prefix").use(RspackVirtualModulePlugin, [
88
- _define_property({}, fileName, code)
89
- ]);
90
- });
91
- return [
92
- 3,
93
- 3
94
- ];
95
- case 2:
96
- entryNames.forEach(function(entryName) {
97
- entries[entryName].prepend(createVirtualModule(code));
98
- });
99
- _state.label = 3;
100
- case 3:
101
- return [
102
- 2
103
- ];
104
- }
63
+ chain = param.chain;
64
+ entries = chain.entryPoints.entries() || {};
65
+ entryNames = Object.keys(entries);
66
+ assetPrefix = removeTailSlash(chain.output.get("publicPath") || "");
67
+ code = "window.__assetPrefix__ = '".concat(assetPrefix, "';");
68
+ entryNames.forEach(function(entryName) {
69
+ entries[entryName].prepend(createVirtualModule(code));
70
+ });
71
+ return [
72
+ 2
73
+ ];
105
74
  });
106
75
  });
107
76
  return _injectAssetPrefix.apply(this, arguments);