@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.19 → 3.9.0-ultramodern.20

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.
@@ -68,13 +68,16 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
68
68
  return userTestFn(m);
69
69
  };
70
70
  }
71
- function buildDefaultLazyCompilationTest(internalDirectory) {
72
- let internalDir;
71
+ function buildDefaultLazyCompilationTest(appDirectory, internalDirectory) {
72
+ let dirs;
73
73
  return (m)=>{
74
74
  if (!('resource' in m) || 'string' != typeof m.resource) return true;
75
- internalDir ??= (0, utils_namespaceObject.normalizeModulePath)(internalDirectory);
75
+ dirs ??= {
76
+ app: (0, utils_namespaceObject.normalizeModulePath)(appDirectory),
77
+ internal: (0, utils_namespaceObject.normalizeModulePath)(internalDirectory)
78
+ };
76
79
  const file = m.resource.split('?')[0].split(external_node_path_default().sep).join('/');
77
- return !('index.jsx' === external_node_path_default().posix.basename(file) && file.startsWith(`${internalDir}/`));
80
+ return file.startsWith(`${dirs.app}/`) && !file.startsWith(`${dirs.internal}/`) && !file.slice(dirs.app.length).includes('/node_modules/');
78
81
  };
79
82
  }
80
83
  function planSSRLazyCompilation(current, info) {
@@ -36,6 +36,10 @@ __webpack_require__.d(__webpack_exports__, {
36
36
  serverCommand: ()=>serverCommand
37
37
  });
38
38
  const index_js_namespaceObject = require("../locale/index.js");
39
+ const deployTargetOption = [
40
+ '--deploy-target <target>',
41
+ 'deploy target; overrides deploy.target and MODERNJS_DEPLOY'
42
+ ];
39
43
  const devCommand = async (program, api)=>{
40
44
  program.command('dev').alias('start').usage('[options]').description(index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.dev.describe)).option('-c --config <config>', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.config)).option('-e --entry [entry...]', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.dev.entry)).option('--analyze', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.analyze)).option('--api-only', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.dev.apiOnly)).option('--web-only', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.dev.webOnly)).action(async (options)=>{
41
45
  const { dev } = await import("./dev.js");
@@ -43,7 +47,7 @@ const devCommand = async (program, api)=>{
43
47
  });
44
48
  };
45
49
  const buildCommand = async (program, api)=>{
46
- program.command('build').usage('[options]').description(index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.build.describe)).option('-c --config <config>', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.config)).option('--analyze', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.analyze)).option('-w --watch', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.build.watch)).action(async (options)=>{
50
+ program.command('build').usage('[options]').description(index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.build.describe)).option('-c --config <config>', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.config)).option('--analyze', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.analyze)).option('-w --watch', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.build.watch)).option(...deployTargetOption).action(async (options)=>{
47
51
  const { build } = await import("./build.js");
48
52
  await build(api, options);
49
53
  });
@@ -55,7 +59,7 @@ const serverCommand = (program, api)=>{
55
59
  });
56
60
  };
57
61
  const deployCommand = (program, api)=>{
58
- program.command('deploy').usage('[options]').option('-c --config <config>', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.config)).option('-s --skip-build', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.skipBuild)).description(index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.deploy.describe)).action(async (options)=>{
62
+ program.command('deploy').usage('[options]').option('-c --config <config>', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.config)).option('-s --skip-build', index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.shared.skipBuild)).option(...deployTargetOption).description(index_js_namespaceObject.i18n.t(index_js_namespaceObject.localeKeys.command.deploy.describe)).action(async (options)=>{
59
63
  const { deploy } = await import("./deploy.js");
60
64
  await deploy(api, options);
61
65
  process.exit(0);
package/dist/cjs/index.js CHANGED
@@ -60,6 +60,9 @@ var __webpack_modules__ = {
60
60
  "./utils/restart" (module) {
61
61
  module.exports = require("./utils/restart.js");
62
62
  },
63
+ "@modern-js/app-tools-extensions/deploy-output/target" (module) {
64
+ module.exports = require("@modern-js/app-tools-extensions/deploy-output/target");
65
+ },
63
66
  "@modern-js/app-tools-extensions/policy-defaults" (module) {
64
67
  module.exports = require("@modern-js/app-tools-extensions/policy-defaults");
65
68
  },
@@ -129,33 +132,34 @@ function __webpack_require__(moduleId) {
129
132
  var __webpack_exports__ = {};
130
133
  (()=>{
131
134
  __webpack_require__.r(__webpack_exports__);
132
- var _modern_js_app_tools_extensions_policy_defaults__rspack_import_0 = __webpack_require__("@modern-js/app-tools-extensions/policy-defaults");
133
- var _modern_js_builder__rspack_import_1 = __webpack_require__("@modern-js/builder");
134
- var _modern_js_i18n_utils_language_detector__rspack_import_2 = __webpack_require__("@modern-js/i18n-utils/language-detector");
135
- var _modern_js_plugin__rspack_import_3 = __webpack_require__("@modern-js/plugin");
136
- var _modern_js_utils__rspack_import_4 = __webpack_require__("@modern-js/utils");
137
- var path__rspack_import_5 = __webpack_require__("path");
138
- var path__rspack_import_5_default = /*#__PURE__*/ __webpack_require__.n(path__rspack_import_5);
139
- var _commands__rspack_import_6 = __webpack_require__("./commands");
140
- var _compat__rspack_import_7 = __webpack_require__("./compat");
141
- var _constants__rspack_import_8 = __webpack_require__("./constants");
142
- var _locale__rspack_import_9 = __webpack_require__("./locale");
143
- var _plugins_analyze__rspack_import_10 = __webpack_require__("./plugins/analyze");
144
- var _plugins_analyze__rspack_import_10_default = /*#__PURE__*/ __webpack_require__.n(_plugins_analyze__rspack_import_10);
145
- var _plugins_deploy__rspack_import_11 = __webpack_require__("./plugins/deploy");
146
- var _plugins_deploy__rspack_import_11_default = /*#__PURE__*/ __webpack_require__.n(_plugins_deploy__rspack_import_11);
147
- var _plugins_initialize__rspack_import_12 = __webpack_require__("./plugins/initialize");
148
- var _plugins_initialize__rspack_import_12_default = /*#__PURE__*/ __webpack_require__.n(_plugins_initialize__rspack_import_12);
149
- var _plugins_serverBuild__rspack_import_13 = __webpack_require__("./plugins/serverBuild");
150
- var _plugins_serverBuild__rspack_import_13_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverBuild__rspack_import_13);
151
- var _plugins_serverRuntime__rspack_import_14 = __webpack_require__("./plugins/serverRuntime");
152
- var _plugins_serverRuntime__rspack_import_14_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverRuntime__rspack_import_14);
153
- var _utils_generateWatchFiles__rspack_import_15 = __webpack_require__("./utils/generateWatchFiles");
154
- var _utils_initAppContext__rspack_import_16 = __webpack_require__("./utils/initAppContext");
155
- var _utils_restart__rspack_import_17 = __webpack_require__("./utils/restart");
156
- var _defineConfig__rspack_import_18 = __webpack_require__("./defineConfig");
135
+ var _modern_js_app_tools_extensions_deploy_output_target__rspack_import_0 = __webpack_require__("@modern-js/app-tools-extensions/deploy-output/target");
136
+ var _modern_js_app_tools_extensions_policy_defaults__rspack_import_1 = __webpack_require__("@modern-js/app-tools-extensions/policy-defaults");
137
+ var _modern_js_builder__rspack_import_2 = __webpack_require__("@modern-js/builder");
138
+ var _modern_js_i18n_utils_language_detector__rspack_import_3 = __webpack_require__("@modern-js/i18n-utils/language-detector");
139
+ var _modern_js_plugin__rspack_import_4 = __webpack_require__("@modern-js/plugin");
140
+ var _modern_js_utils__rspack_import_5 = __webpack_require__("@modern-js/utils");
141
+ var path__rspack_import_6 = __webpack_require__("path");
142
+ var path__rspack_import_6_default = /*#__PURE__*/ __webpack_require__.n(path__rspack_import_6);
143
+ var _commands__rspack_import_7 = __webpack_require__("./commands");
144
+ var _compat__rspack_import_8 = __webpack_require__("./compat");
145
+ var _constants__rspack_import_9 = __webpack_require__("./constants");
146
+ var _locale__rspack_import_10 = __webpack_require__("./locale");
147
+ var _plugins_analyze__rspack_import_11 = __webpack_require__("./plugins/analyze");
148
+ var _plugins_analyze__rspack_import_11_default = /*#__PURE__*/ __webpack_require__.n(_plugins_analyze__rspack_import_11);
149
+ var _plugins_deploy__rspack_import_12 = __webpack_require__("./plugins/deploy");
150
+ var _plugins_deploy__rspack_import_12_default = /*#__PURE__*/ __webpack_require__.n(_plugins_deploy__rspack_import_12);
151
+ var _plugins_initialize__rspack_import_13 = __webpack_require__("./plugins/initialize");
152
+ var _plugins_initialize__rspack_import_13_default = /*#__PURE__*/ __webpack_require__.n(_plugins_initialize__rspack_import_13);
153
+ var _plugins_serverBuild__rspack_import_14 = __webpack_require__("./plugins/serverBuild");
154
+ var _plugins_serverBuild__rspack_import_14_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverBuild__rspack_import_14);
155
+ var _plugins_serverRuntime__rspack_import_15 = __webpack_require__("./plugins/serverRuntime");
156
+ var _plugins_serverRuntime__rspack_import_15_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverRuntime__rspack_import_15);
157
+ var _utils_generateWatchFiles__rspack_import_16 = __webpack_require__("./utils/generateWatchFiles");
158
+ var _utils_initAppContext__rspack_import_17 = __webpack_require__("./utils/initAppContext");
159
+ var _utils_restart__rspack_import_18 = __webpack_require__("./utils/restart");
160
+ var _defineConfig__rspack_import_19 = __webpack_require__("./defineConfig");
157
161
  var __rspack_reexport = {};
158
- for(const __rspack_import_key in _defineConfig__rspack_import_18)if ([
162
+ for(const __rspack_import_key in _defineConfig__rspack_import_19)if ([
159
163
  "dev",
160
164
  "resolveModernRsbuildConfig",
161
165
  "mergeConfig",
@@ -168,16 +172,16 @@ var __webpack_exports__ = {};
168
172
  "defineConfig",
169
173
  "build",
170
174
  "closeServer"
171
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_defineConfig__rspack_import_18[__rspack_import_key];
175
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_defineConfig__rspack_import_19[__rspack_import_key];
172
176
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
173
- var _commands_build__rspack_import_19 = __webpack_require__("./commands/build");
174
- var _commands_deploy__rspack_import_20 = __webpack_require__("./commands/deploy");
175
- var _commands_dev__rspack_import_21 = __webpack_require__("./commands/dev");
176
- var _commands_serve__rspack_import_22 = __webpack_require__("./commands/serve");
177
- var _rsbuild__rspack_import_23 = __webpack_require__("./rsbuild");
178
- var _types__rspack_import_24 = __webpack_require__("./types?6efa");
177
+ var _commands_build__rspack_import_20 = __webpack_require__("./commands/build");
178
+ var _commands_deploy__rspack_import_21 = __webpack_require__("./commands/deploy");
179
+ var _commands_dev__rspack_import_22 = __webpack_require__("./commands/dev");
180
+ var _commands_serve__rspack_import_23 = __webpack_require__("./commands/serve");
181
+ var _rsbuild__rspack_import_24 = __webpack_require__("./rsbuild");
182
+ var _types__rspack_import_25 = __webpack_require__("./types?6efa");
179
183
  var __rspack_reexport = {};
180
- for(const __rspack_import_key in _types__rspack_import_24)if ([
184
+ for(const __rspack_import_key in _types__rspack_import_25)if ([
181
185
  "dev",
182
186
  "resolveModernRsbuildConfig",
183
187
  "mergeConfig",
@@ -190,20 +194,20 @@ var __webpack_exports__ = {};
190
194
  "defineConfig",
191
195
  "build",
192
196
  "closeServer"
193
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_24[__rspack_import_key];
197
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_25[__rspack_import_key];
194
198
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
195
- var _utils_createServer__rspack_import_25 = __webpack_require__("./utils/createServer");
196
- var _modern_js_plugin_cli__rspack_import_26 = __webpack_require__("@modern-js/plugin/cli");
199
+ var _utils_createServer__rspack_import_26 = __webpack_require__("./utils/createServer");
200
+ var _modern_js_plugin_cli__rspack_import_27 = __webpack_require__("@modern-js/plugin/cli");
197
201
  const appTools = (options = {})=>({
198
202
  name: '@modern-js/app-tools',
199
203
  usePlugins: [
200
- _plugins_serverRuntime__rspack_import_14_default()(),
201
- (0, _compat__rspack_import_7.compatPlugin)(),
202
- _plugins_initialize__rspack_import_12_default()(),
203
- _plugins_analyze__rspack_import_10_default()(),
204
- _plugins_serverBuild__rspack_import_13_default()(),
205
- _plugins_deploy__rspack_import_11_default()(),
206
- (0, _modern_js_app_tools_extensions_policy_defaults__rspack_import_0.createPolicyDefaultsPlugin)(options)
204
+ _plugins_serverRuntime__rspack_import_15_default()(),
205
+ (0, _compat__rspack_import_8.compatPlugin)(),
206
+ _plugins_initialize__rspack_import_13_default()(),
207
+ _plugins_analyze__rspack_import_11_default()(),
208
+ _plugins_serverBuild__rspack_import_14_default()(),
209
+ _plugins_deploy__rspack_import_12_default()(),
210
+ (0, _modern_js_app_tools_extensions_policy_defaults__rspack_import_1.createPolicyDefaultsPlugin)(options)
207
211
  ],
208
212
  post: [
209
213
  '@modern-js/plugin-initialize',
@@ -214,48 +218,53 @@ var __webpack_exports__ = {};
214
218
  '@modern-js/plugin-polyfill'
215
219
  ],
216
220
  registryHooks: {
217
- onAfterPrepare: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
218
- deploy: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
219
- checkEntryPoint: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
220
- modifyEntrypoints: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
221
- modifyBuilderEnvironments: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
222
- modifyFileSystemRoutes: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
223
- generateEntryCode: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
224
- onBeforeGenerateRoutes: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)(),
225
- onBeforePrintInstructions: (0, _modern_js_plugin__rspack_import_3.createAsyncHook)()
221
+ onAfterPrepare: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
222
+ deploy: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
223
+ checkEntryPoint: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
224
+ modifyEntrypoints: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
225
+ modifyBuilderEnvironments: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
226
+ modifyFileSystemRoutes: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
227
+ generateEntryCode: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
228
+ onBeforeGenerateRoutes: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)(),
229
+ onBeforePrintInstructions: (0, _modern_js_plugin__rspack_import_4.createAsyncHook)()
226
230
  },
227
231
  setup: (api)=>{
228
232
  const context = api.getAppContext();
229
233
  const userConfig = api.getConfig();
230
- const locale = (0, _modern_js_i18n_utils_language_detector__rspack_import_2.getLocaleLanguage)();
231
- _locale__rspack_import_9.i18n.changeLanguage({
234
+ const locale = (0, _modern_js_i18n_utils_language_detector__rspack_import_3.getLocaleLanguage)();
235
+ _locale__rspack_import_10.i18n.changeLanguage({
232
236
  locale
233
237
  });
234
- api.updateAppContext((0, _utils_initAppContext__rspack_import_16.initAppContext)({
238
+ api.updateAppContext((0, _utils_initAppContext__rspack_import_17.initAppContext)({
235
239
  metaName: context.metaName,
236
240
  appDirectory: context.appDirectory,
237
- runtimeConfigFile: _constants__rspack_import_8.DEFAULT_RUNTIME_CONFIG_FILE,
241
+ runtimeConfigFile: _constants__rspack_import_9.DEFAULT_RUNTIME_CONFIG_FILE,
238
242
  options: {
239
243
  bffRuntimeFramework: userConfig.bff?.runtimeFramework
240
244
  },
241
245
  tempDir: userConfig.output?.tempDir
242
246
  }));
243
247
  api.addCommand(async ({ program })=>{
244
- await (0, _commands__rspack_import_6.devCommand)(program, api);
245
- await (0, _commands__rspack_import_6.buildCommand)(program, api);
246
- (0, _commands__rspack_import_6.serverCommand)(program, api);
247
- (0, _commands__rspack_import_6.deployCommand)(program, api);
248
- (0, _commands__rspack_import_6.inspectCommand)(program, api);
249
- (0, _commands__rspack_import_6.infoCommand)(program, api);
250
- (0, _modern_js_utils__rspack_import_4.deprecatedCommands)(program);
248
+ await (0, _commands__rspack_import_7.devCommand)(program, api);
249
+ await (0, _commands__rspack_import_7.buildCommand)(program, api);
250
+ (0, _commands__rspack_import_7.serverCommand)(program, api);
251
+ (0, _commands__rspack_import_7.deployCommand)(program, api);
252
+ (0, _commands__rspack_import_7.inspectCommand)(program, api);
253
+ (0, _commands__rspack_import_7.infoCommand)(program, api);
254
+ (0, _modern_js_utils__rspack_import_5.deprecatedCommands)(program);
251
255
  });
252
256
  api.onPrepare(async ()=>{
253
- const command = (0, _modern_js_utils__rspack_import_4.getCommand)();
257
+ api.updateAppContext({
258
+ deployTarget: (0, _modern_js_app_tools_extensions_deploy_output_target__rspack_import_0.resolveDeployTarget)({
259
+ configTarget: api.getNormalizedConfig().deploy?.target
260
+ })
261
+ });
262
+ const command = (0, _modern_js_utils__rspack_import_5.getCommand)();
254
263
  if ('deploy' === command) {
255
264
  const isSkipBuild = [
256
265
  '-s',
257
266
  '--skip-build'
258
- ].some((tag)=>(0, _modern_js_utils__rspack_import_4.getArgv)().includes(tag));
267
+ ].some((tag)=>(0, _modern_js_utils__rspack_import_5.getArgv)().includes(tag));
259
268
  if (isSkipBuild) return;
260
269
  }
261
270
  const { command: contextCommand } = api.getAppContext();
@@ -273,15 +282,15 @@ var __webpack_exports__ = {};
273
282
  const resolvedConfig = api.getNormalizedConfig();
274
283
  if (resolvedConfig.output.cleanDistPath) {
275
284
  const appContext = api.getAppContext();
276
- await (0, _modern_js_utils__rspack_import_4.emptyDir)(appContext.distDirectory);
285
+ await (0, _modern_js_utils__rspack_import_5.emptyDir)(appContext.distDirectory);
277
286
  }
278
287
  }
279
288
  });
280
289
  api.addWatchFiles(async ()=>{
281
290
  const appContext = api.getAppContext();
282
291
  const config = api.getNormalizedConfig();
283
- const files = await (0, _utils_generateWatchFiles__rspack_import_15.generateWatchFiles)(appContext, config.source.configDir);
284
- const watchFiles = (0, _modern_js_builder__rspack_import_1.castArray)(config.dev.watchFiles);
292
+ const files = await (0, _utils_generateWatchFiles__rspack_import_16.generateWatchFiles)(appContext, config.source.configDir);
293
+ const watchFiles = (0, _modern_js_builder__rspack_import_2.castArray)(config.dev.watchFiles);
285
294
  watchFiles.forEach(({ type, paths })=>{
286
295
  if ('reload-server' === type) files.push(...Array.isArray(paths) ? paths : [
287
296
  paths
@@ -292,16 +301,16 @@ var __webpack_exports__ = {};
292
301
  api.onFileChanged(async (e)=>{
293
302
  const { filename, eventType, isPrivate } = e;
294
303
  const { appDirectory, apiDirectory } = api.getAppContext();
295
- const relativeApiPath = path__rspack_import_5_default().relative(appDirectory, apiDirectory);
304
+ const relativeApiPath = path__rspack_import_6_default().relative(appDirectory, apiDirectory);
296
305
  const isApiProject = filename.startsWith(`${relativeApiPath}/`);
297
306
  if (!isPrivate && ('change' === eventType || 'unlink' === eventType) && !isApiProject) {
298
307
  const { closeServer } = await import("./utils/createServer.js");
299
308
  await closeServer();
300
- await (0, _utils_restart__rspack_import_17.restart)(api.getHooks(), filename);
309
+ await (0, _utils_restart__rspack_import_18.restart)(api.getHooks(), filename);
301
310
  }
302
311
  });
303
312
  api.onBeforeRestart(()=>{
304
- (0, _modern_js_utils__rspack_import_4.cleanRequireCache)([
313
+ (0, _modern_js_utils__rspack_import_5.cleanRequireCache)([
305
314
  require.resolve('./plugins/analyze')
306
315
  ]);
307
316
  });
@@ -309,16 +318,16 @@ var __webpack_exports__ = {};
309
318
  });
310
319
  const __rspack_default_export = appTools;
311
320
  __webpack_require__.d(__webpack_exports__, {
312
- build: ()=>_commands_build__rspack_import_19.build,
313
- closeServer: ()=>_utils_createServer__rspack_import_25.closeServer,
314
- defineConfig: ()=>_defineConfig__rspack_import_18.defineConfig,
315
- deploy: ()=>_commands_deploy__rspack_import_20.deploy,
316
- dev: ()=>_commands_dev__rspack_import_21.dev,
317
- generateWatchFiles: ()=>_utils_generateWatchFiles__rspack_import_15.generateWatchFiles,
318
- initAppContext: ()=>_utils_initAppContext__rspack_import_16.initAppContext,
319
- mergeConfig: ()=>_modern_js_plugin_cli__rspack_import_26.mergeConfig,
320
- resolveModernRsbuildConfig: ()=>_rsbuild__rspack_import_23.resolveModernRsbuildConfig,
321
- serve: ()=>_commands_serve__rspack_import_22.serve
321
+ build: ()=>_commands_build__rspack_import_20.build,
322
+ closeServer: ()=>_utils_createServer__rspack_import_26.closeServer,
323
+ defineConfig: ()=>_defineConfig__rspack_import_19.defineConfig,
324
+ deploy: ()=>_commands_deploy__rspack_import_21.deploy,
325
+ dev: ()=>_commands_dev__rspack_import_22.dev,
326
+ generateWatchFiles: ()=>_utils_generateWatchFiles__rspack_import_16.generateWatchFiles,
327
+ initAppContext: ()=>_utils_initAppContext__rspack_import_17.initAppContext,
328
+ mergeConfig: ()=>_modern_js_plugin_cli__rspack_import_27.mergeConfig,
329
+ resolveModernRsbuildConfig: ()=>_rsbuild__rspack_import_24.resolveModernRsbuildConfig,
330
+ serve: ()=>_commands_serve__rspack_import_23.serve
322
331
  }, {
323
332
  appTools: appTools,
324
333
  default: __rspack_default_export
@@ -28,12 +28,10 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
- default: ()=>deploy,
32
- getSupportedDeployTargets: ()=>getSupportedDeployTargets,
33
- resolveDeployTarget: ()=>resolveDeployTarget
31
+ default: ()=>deploy
34
32
  });
35
33
  const cloudflare_namespaceObject = require("@modern-js/app-tools-extensions/cloudflare");
36
- const external_std_env_namespaceObject = require("std-env");
34
+ const target_namespaceObject = require("@modern-js/app-tools-extensions/deploy-output/target");
37
35
  const gh_pages_js_namespaceObject = require("./platforms/gh-pages.js");
38
36
  const netlify_js_namespaceObject = require("./platforms/netlify.js");
39
37
  const node_js_namespaceObject = require("./platforms/node.js");
@@ -46,24 +44,11 @@ const deployPresets = {
46
44
  ghPages: gh_pages_js_namespaceObject.createGhPagesPreset,
47
45
  cloudflare: cloudflare_namespaceObject.createCloudflarePreset
48
46
  };
49
- const getSupportedDeployTargets = ()=>Object.keys(deployPresets);
50
- const isDeployTarget = (target)=>Object.prototype.hasOwnProperty.call(deployPresets, target);
51
- const providerDeployTargets = {
52
- vercel: 'vercel',
53
- netlify: 'netlify',
54
- cloudflare: 'cloudflare',
55
- cloudflare_pages: 'cloudflare',
56
- cloudflare_workers: 'cloudflare'
57
- };
58
- const normalizeDetectedProvider = (value)=>value ? providerDeployTargets[value] : void 0;
59
- const resolveDeployTarget = (modernConfig, envDeployTarget = process.env.MODERNJS_DEPLOY, detectedProvider = external_std_env_namespaceObject.provider)=>modernConfig.deploy?.target || envDeployTarget || normalizeDetectedProvider(detectedProvider) || 'node';
60
47
  async function getDeployPreset(appContext, modernConfig, deployTarget, api) {
61
48
  const { appDirectory, distDirectory, metaName } = appContext;
62
49
  const { useSSR, useAPI, useWebServer } = (0, index_js_namespaceObject.getProjectUsage)(appDirectory, distDirectory, metaName);
63
50
  const needModernServer = useSSR || useAPI || useWebServer;
64
- if (!isDeployTarget(deployTarget)) throw new Error(`Unknown deploy target: '${deployTarget}'. deploy.target or MODERNJS_DEPLOY should be one of: ${getSupportedDeployTargets().join(', ')}.`);
65
- const createPreset = deployPresets[deployTarget];
66
- return createPreset({
51
+ return deployPresets[deployTarget]({
67
52
  appContext,
68
53
  modernConfig,
69
54
  needModernServer,
@@ -75,11 +60,9 @@ const deploy = ()=>({
75
60
  setup: (api)=>{
76
61
  api.deploy(async ()=>{
77
62
  const appContext = api.getAppContext();
78
- const { metaName } = appContext;
79
- const modernConfig = api.getNormalizedConfig();
80
- const deployTarget = resolveDeployTarget(modernConfig);
81
- if ('modern-js' !== metaName && !modernConfig.deploy?.target && !process.env.MODERNJS_DEPLOY) return;
82
- const deployPreset = await getDeployPreset(appContext, modernConfig, deployTarget, api);
63
+ const deployTarget = (0, target_namespaceObject.getDeployingTarget)(appContext);
64
+ if (!deployTarget) return;
65
+ const deployPreset = await getDeployPreset(appContext, api.getNormalizedConfig(), deployTarget, api);
83
66
  deployPreset?.prepare && await deployPreset?.prepare();
84
67
  deployPreset?.writeOutput && await deployPreset?.writeOutput();
85
68
  deployPreset?.genEntry && await deployPreset?.genEntry();
@@ -88,12 +71,8 @@ const deploy = ()=>({
88
71
  }
89
72
  });
90
73
  exports["default"] = __webpack_exports__["default"];
91
- exports.getSupportedDeployTargets = __webpack_exports__.getSupportedDeployTargets;
92
- exports.resolveDeployTarget = __webpack_exports__.resolveDeployTarget;
93
74
  for(var __rspack_i in __webpack_exports__)if (-1 === [
94
- "default",
95
- "getSupportedDeployTargets",
96
- "resolveDeployTarget"
75
+ "default"
97
76
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
98
77
  Object.defineProperty(exports, '__esModule', {
99
78
  value: true
@@ -51,7 +51,7 @@ const initialize = ()=>({
51
51
  lazyCompilation: {
52
52
  imports: true,
53
53
  entries: false,
54
- test: (0, lazyCompilation_js_namespaceObject.buildDefaultLazyCompilationTest)(appContext.internalDirectory)
54
+ test: (0, lazyCompilation_js_namespaceObject.buildDefaultLazyCompilationTest)(appContext.appDirectory, appContext.internalDirectory)
55
55
  }
56
56
  };
57
57
  return defaultConfig;
@@ -21,13 +21,16 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
21
21
  return userTestFn(m);
22
22
  };
23
23
  }
24
- function buildDefaultLazyCompilationTest(internalDirectory) {
25
- let internalDir;
24
+ function buildDefaultLazyCompilationTest(appDirectory, internalDirectory) {
25
+ let dirs;
26
26
  return (m)=>{
27
27
  if (!('resource' in m) || 'string' != typeof m.resource) return true;
28
- internalDir ??= normalizeModulePath(internalDirectory);
28
+ dirs ??= {
29
+ app: normalizeModulePath(appDirectory),
30
+ internal: normalizeModulePath(internalDirectory)
31
+ };
29
32
  const file = m.resource.split('?')[0].split(node_path.sep).join('/');
30
- return !('index.jsx' === node_path.posix.basename(file) && file.startsWith(`${internalDir}/`));
33
+ return file.startsWith(`${dirs.app}/`) && !file.startsWith(`${dirs.internal}/`) && !file.slice(dirs.app.length).includes('/node_modules/');
31
34
  };
32
35
  }
33
36
  function planSSRLazyCompilation(current, info) {
@@ -1,4 +1,8 @@
1
1
  import { i18n, localeKeys } from "../locale/index.mjs";
2
+ const deployTargetOption = [
3
+ '--deploy-target <target>',
4
+ 'deploy target; overrides deploy.target and MODERNJS_DEPLOY'
5
+ ];
2
6
  const devCommand = async (program, api)=>{
3
7
  program.command('dev').alias('start').usage('[options]').description(i18n.t(localeKeys.command.dev.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-e --entry [entry...]', i18n.t(localeKeys.command.dev.entry)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('--api-only', i18n.t(localeKeys.command.dev.apiOnly)).option('--web-only', i18n.t(localeKeys.command.dev.webOnly)).action(async (options)=>{
4
8
  const { dev } = await import("./dev.mjs");
@@ -6,7 +10,7 @@ const devCommand = async (program, api)=>{
6
10
  });
7
11
  };
8
12
  const buildCommand = async (program, api)=>{
9
- program.command('build').usage('[options]').description(i18n.t(localeKeys.command.build.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('-w --watch', i18n.t(localeKeys.command.build.watch)).action(async (options)=>{
13
+ program.command('build').usage('[options]').description(i18n.t(localeKeys.command.build.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('-w --watch', i18n.t(localeKeys.command.build.watch)).option(...deployTargetOption).action(async (options)=>{
10
14
  const { build } = await import("./build.mjs");
11
15
  await build(api, options);
12
16
  });
@@ -18,7 +22,7 @@ const serverCommand = (program, api)=>{
18
22
  });
19
23
  };
20
24
  const deployCommand = (program, api)=>{
21
- program.command('deploy').usage('[options]').option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-s --skip-build', i18n.t(localeKeys.command.shared.skipBuild)).description(i18n.t(localeKeys.command.deploy.describe)).action(async (options)=>{
25
+ program.command('deploy').usage('[options]').option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-s --skip-build', i18n.t(localeKeys.command.shared.skipBuild)).option(...deployTargetOption).description(i18n.t(localeKeys.command.deploy.describe)).action(async (options)=>{
22
26
  const { deploy } = await import("./deploy.mjs");
23
27
  await deploy(api, options);
24
28
  process.exit(0);
@@ -1,3 +1,4 @@
1
+ import { resolveDeployTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
1
2
  import { createPolicyDefaultsPlugin } from "@modern-js/app-tools-extensions/policy-defaults";
2
3
  import { castArray } from "@modern-js/builder";
3
4
  import { getLocaleLanguage } from "@modern-js/i18n-utils/language-detector";
@@ -74,6 +75,11 @@ const appTools = (options = {})=>({
74
75
  deprecatedCommands(program);
75
76
  });
76
77
  api.onPrepare(async ()=>{
78
+ api.updateAppContext({
79
+ deployTarget: resolveDeployTarget({
80
+ configTarget: api.getNormalizedConfig().deploy?.target
81
+ })
82
+ });
77
83
  const command = getCommand();
78
84
  if ('deploy' === command) {
79
85
  const isSkipBuild = [
@@ -1,5 +1,5 @@
1
1
  import { createCloudflarePreset } from "@modern-js/app-tools-extensions/cloudflare";
2
- import { provider } from "std-env";
2
+ import { getDeployingTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
3
3
  import { createGhPagesPreset } from "./platforms/gh-pages.mjs";
4
4
  import { createNetlifyPreset } from "./platforms/netlify.mjs";
5
5
  import { createNodePreset } from "./platforms/node.mjs";
@@ -12,24 +12,11 @@ const deployPresets = {
12
12
  ghPages: createGhPagesPreset,
13
13
  cloudflare: createCloudflarePreset
14
14
  };
15
- const getSupportedDeployTargets = ()=>Object.keys(deployPresets);
16
- const isDeployTarget = (target)=>Object.prototype.hasOwnProperty.call(deployPresets, target);
17
- const providerDeployTargets = {
18
- vercel: 'vercel',
19
- netlify: 'netlify',
20
- cloudflare: 'cloudflare',
21
- cloudflare_pages: 'cloudflare',
22
- cloudflare_workers: 'cloudflare'
23
- };
24
- const normalizeDetectedProvider = (value)=>value ? providerDeployTargets[value] : void 0;
25
- const resolveDeployTarget = (modernConfig, envDeployTarget = process.env.MODERNJS_DEPLOY, detectedProvider = provider)=>modernConfig.deploy?.target || envDeployTarget || normalizeDetectedProvider(detectedProvider) || 'node';
26
15
  async function getDeployPreset(appContext, modernConfig, deployTarget, api) {
27
16
  const { appDirectory, distDirectory, metaName } = appContext;
28
17
  const { useSSR, useAPI, useWebServer } = getProjectUsage(appDirectory, distDirectory, metaName);
29
18
  const needModernServer = useSSR || useAPI || useWebServer;
30
- if (!isDeployTarget(deployTarget)) throw new Error(`Unknown deploy target: '${deployTarget}'. deploy.target or MODERNJS_DEPLOY should be one of: ${getSupportedDeployTargets().join(', ')}.`);
31
- const createPreset = deployPresets[deployTarget];
32
- return createPreset({
19
+ return deployPresets[deployTarget]({
33
20
  appContext,
34
21
  modernConfig,
35
22
  needModernServer,
@@ -41,11 +28,9 @@ const deploy = ()=>({
41
28
  setup: (api)=>{
42
29
  api.deploy(async ()=>{
43
30
  const appContext = api.getAppContext();
44
- const { metaName } = appContext;
45
- const modernConfig = api.getNormalizedConfig();
46
- const deployTarget = resolveDeployTarget(modernConfig);
47
- if ('modern-js' !== metaName && !modernConfig.deploy?.target && !process.env.MODERNJS_DEPLOY) return;
48
- const deployPreset = await getDeployPreset(appContext, modernConfig, deployTarget, api);
31
+ const deployTarget = getDeployingTarget(appContext);
32
+ if (!deployTarget) return;
33
+ const deployPreset = await getDeployPreset(appContext, api.getNormalizedConfig(), deployTarget, api);
49
34
  deployPreset?.prepare && await deployPreset?.prepare();
50
35
  deployPreset?.writeOutput && await deployPreset?.writeOutput();
51
36
  deployPreset?.genEntry && await deployPreset?.genEntry();
@@ -54,4 +39,3 @@ const deploy = ()=>({
54
39
  }
55
40
  });
56
41
  export default deploy;
57
- export { getSupportedDeployTargets, resolveDeployTarget };
@@ -19,7 +19,7 @@ const initialize = ()=>({
19
19
  lazyCompilation: {
20
20
  imports: true,
21
21
  entries: false,
22
- test: buildDefaultLazyCompilationTest(appContext.internalDirectory)
22
+ test: buildDefaultLazyCompilationTest(appContext.appDirectory, appContext.internalDirectory)
23
23
  }
24
24
  };
25
25
  return defaultConfig;
@@ -22,13 +22,16 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
22
22
  return userTestFn(m);
23
23
  };
24
24
  }
25
- function buildDefaultLazyCompilationTest(internalDirectory) {
26
- let internalDir;
25
+ function buildDefaultLazyCompilationTest(appDirectory, internalDirectory) {
26
+ let dirs;
27
27
  return (m)=>{
28
28
  if (!('resource' in m) || 'string' != typeof m.resource) return true;
29
- internalDir ??= normalizeModulePath(internalDirectory);
29
+ dirs ??= {
30
+ app: normalizeModulePath(appDirectory),
31
+ internal: normalizeModulePath(internalDirectory)
32
+ };
30
33
  const file = m.resource.split('?')[0].split(node_path.sep).join('/');
31
- return !('index.jsx' === node_path.posix.basename(file) && file.startsWith(`${internalDir}/`));
34
+ return file.startsWith(`${dirs.app}/`) && !file.startsWith(`${dirs.internal}/`) && !file.slice(dirs.app.length).includes('/node_modules/');
32
35
  };
33
36
  }
34
37
  function planSSRLazyCompilation(current, info) {
@@ -1,5 +1,9 @@
1
1
  import "node:module";
2
2
  import { i18n, localeKeys } from "../locale/index.mjs";
3
+ const deployTargetOption = [
4
+ '--deploy-target <target>',
5
+ 'deploy target; overrides deploy.target and MODERNJS_DEPLOY'
6
+ ];
3
7
  const devCommand = async (program, api)=>{
4
8
  program.command('dev').alias('start').usage('[options]').description(i18n.t(localeKeys.command.dev.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-e --entry [entry...]', i18n.t(localeKeys.command.dev.entry)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('--api-only', i18n.t(localeKeys.command.dev.apiOnly)).option('--web-only', i18n.t(localeKeys.command.dev.webOnly)).action(async (options)=>{
5
9
  const { dev } = await import("./dev.mjs");
@@ -7,7 +11,7 @@ const devCommand = async (program, api)=>{
7
11
  });
8
12
  };
9
13
  const buildCommand = async (program, api)=>{
10
- program.command('build').usage('[options]').description(i18n.t(localeKeys.command.build.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('-w --watch', i18n.t(localeKeys.command.build.watch)).action(async (options)=>{
14
+ program.command('build').usage('[options]').description(i18n.t(localeKeys.command.build.describe)).option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('--analyze', i18n.t(localeKeys.command.shared.analyze)).option('-w --watch', i18n.t(localeKeys.command.build.watch)).option(...deployTargetOption).action(async (options)=>{
11
15
  const { build } = await import("./build.mjs");
12
16
  await build(api, options);
13
17
  });
@@ -19,7 +23,7 @@ const serverCommand = (program, api)=>{
19
23
  });
20
24
  };
21
25
  const deployCommand = (program, api)=>{
22
- program.command('deploy').usage('[options]').option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-s --skip-build', i18n.t(localeKeys.command.shared.skipBuild)).description(i18n.t(localeKeys.command.deploy.describe)).action(async (options)=>{
26
+ program.command('deploy').usage('[options]').option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).option('-s --skip-build', i18n.t(localeKeys.command.shared.skipBuild)).option(...deployTargetOption).description(i18n.t(localeKeys.command.deploy.describe)).action(async (options)=>{
23
27
  const { deploy } = await import("./deploy.mjs");
24
28
  await deploy(api, options);
25
29
  process.exit(0);
@@ -1,5 +1,6 @@
1
1
  import __rslib_shim_module__ from "node:module";
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
3
+ import { resolveDeployTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
3
4
  import { createPolicyDefaultsPlugin } from "@modern-js/app-tools-extensions/policy-defaults";
4
5
  import { castArray } from "@modern-js/builder";
5
6
  import { getLocaleLanguage } from "@modern-js/i18n-utils/language-detector";
@@ -76,6 +77,11 @@ const appTools = (options = {})=>({
76
77
  deprecatedCommands(program);
77
78
  });
78
79
  api.onPrepare(async ()=>{
80
+ api.updateAppContext({
81
+ deployTarget: resolveDeployTarget({
82
+ configTarget: api.getNormalizedConfig().deploy?.target
83
+ })
84
+ });
79
85
  const command = getCommand();
80
86
  if ('deploy' === command) {
81
87
  const isSkipBuild = [
@@ -1,6 +1,6 @@
1
1
  import "node:module";
2
2
  import { createCloudflarePreset } from "@modern-js/app-tools-extensions/cloudflare";
3
- import { provider } from "std-env";
3
+ import { getDeployingTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
4
4
  import { createGhPagesPreset } from "./platforms/gh-pages.mjs";
5
5
  import { createNetlifyPreset } from "./platforms/netlify.mjs";
6
6
  import { createNodePreset } from "./platforms/node.mjs";
@@ -13,24 +13,11 @@ const deployPresets = {
13
13
  ghPages: createGhPagesPreset,
14
14
  cloudflare: createCloudflarePreset
15
15
  };
16
- const getSupportedDeployTargets = ()=>Object.keys(deployPresets);
17
- const isDeployTarget = (target)=>Object.prototype.hasOwnProperty.call(deployPresets, target);
18
- const providerDeployTargets = {
19
- vercel: 'vercel',
20
- netlify: 'netlify',
21
- cloudflare: 'cloudflare',
22
- cloudflare_pages: 'cloudflare',
23
- cloudflare_workers: 'cloudflare'
24
- };
25
- const normalizeDetectedProvider = (value)=>value ? providerDeployTargets[value] : void 0;
26
- const resolveDeployTarget = (modernConfig, envDeployTarget = process.env.MODERNJS_DEPLOY, detectedProvider = provider)=>modernConfig.deploy?.target || envDeployTarget || normalizeDetectedProvider(detectedProvider) || 'node';
27
16
  async function getDeployPreset(appContext, modernConfig, deployTarget, api) {
28
17
  const { appDirectory, distDirectory, metaName } = appContext;
29
18
  const { useSSR, useAPI, useWebServer } = getProjectUsage(appDirectory, distDirectory, metaName);
30
19
  const needModernServer = useSSR || useAPI || useWebServer;
31
- if (!isDeployTarget(deployTarget)) throw new Error(`Unknown deploy target: '${deployTarget}'. deploy.target or MODERNJS_DEPLOY should be one of: ${getSupportedDeployTargets().join(', ')}.`);
32
- const createPreset = deployPresets[deployTarget];
33
- return createPreset({
20
+ return deployPresets[deployTarget]({
34
21
  appContext,
35
22
  modernConfig,
36
23
  needModernServer,
@@ -42,11 +29,9 @@ const deploy = ()=>({
42
29
  setup: (api)=>{
43
30
  api.deploy(async ()=>{
44
31
  const appContext = api.getAppContext();
45
- const { metaName } = appContext;
46
- const modernConfig = api.getNormalizedConfig();
47
- const deployTarget = resolveDeployTarget(modernConfig);
48
- if ('modern-js' !== metaName && !modernConfig.deploy?.target && !process.env.MODERNJS_DEPLOY) return;
49
- const deployPreset = await getDeployPreset(appContext, modernConfig, deployTarget, api);
32
+ const deployTarget = getDeployingTarget(appContext);
33
+ if (!deployTarget) return;
34
+ const deployPreset = await getDeployPreset(appContext, api.getNormalizedConfig(), deployTarget, api);
50
35
  deployPreset?.prepare && await deployPreset?.prepare();
51
36
  deployPreset?.writeOutput && await deployPreset?.writeOutput();
52
37
  deployPreset?.genEntry && await deployPreset?.genEntry();
@@ -55,4 +40,3 @@ const deploy = ()=>({
55
40
  }
56
41
  });
57
42
  export default deploy;
58
- export { getSupportedDeployTargets, resolveDeployTarget };
@@ -20,7 +20,7 @@ const initialize = ()=>({
20
20
  lazyCompilation: {
21
21
  imports: true,
22
22
  entries: false,
23
- test: buildDefaultLazyCompilationTest(appContext.internalDirectory)
23
+ test: buildDefaultLazyCompilationTest(appContext.appDirectory, appContext.internalDirectory)
24
24
  }
25
25
  };
26
26
  return defaultConfig;
@@ -27,17 +27,20 @@ export declare function aggregateEagerRouteComponentFiles(byEntry: EagerRouteCom
27
27
  */
28
28
  export declare function buildSSRLazyCompilationTest(eagerRouteFiles: Set<string>, userTest?: LazyCompilationTest): LazyCompilationTestFn;
29
29
  /**
30
- * Build the default dev `lazyCompilation.test`: every dynamically imported
31
- * module is lazy except the generated entry module
32
- * `<internalDirectory>/<entry>/index.jsx` (`<entry>` may be nested). With
33
- * `source.enableAsyncEntry` the build entry is `bootstrap.jsx`, whose only
34
- * statement is `import('./index')`; that import is the async entry boundary
35
- * Module Federation needs to initialize shared scopes, not a code-split point.
36
- * A lazy boundary rebuilds the whole entry on the first page load
37
- * (`building .modern-js/<entry>/index.jsx`) and starts an extra HMR cycle.
30
+ * Build the default dev `lazyCompilation.test`: a dynamic import is lazy only
31
+ * when it targets the app's own source. Everything else compiles eagerly:
32
+ * - the generated `<internalDirectory>/<entry>/index.jsx`, which
33
+ * `bootstrap.jsx` imports as the async entry boundary Module Federation
34
+ * needs to initialize shared scopes, not a code-split point;
35
+ * - framework and dependency modules (outside `appDirectory` or under
36
+ * `node_modules`), such as plugin-i18n's backend, utils and react-i18next.
37
+ * Each lazy module costs one on-demand compile and HMR cycle on the first page
38
+ * load. Back-to-back cycles for framework imports raced on loaded CI runners
39
+ * ("Cannot read properties of undefined (reading 'call')"), and the app never
40
+ * rendered.
38
41
  * Typed `object` so it is assignable to Rspack's `(module: Module) => boolean`.
39
42
  */
40
- export declare function buildDefaultLazyCompilationTest(internalDirectory: string): (m: object) => boolean;
43
+ export declare function buildDefaultLazyCompilationTest(appDirectory: string, internalDirectory: string): (m: object) => boolean;
41
44
  export type SSRLazyPlan = {
42
45
  apply: false;
43
46
  unresolvedByEntry?: Map<string, string[]>;
@@ -1,6 +1,3 @@
1
- import type { AppTools, AppToolsNormalizedConfig, CliPlugin } from '../../types/index.js';
2
- import type { DeployTarget } from '../../types/config/deploy.js';
3
- export declare const getSupportedDeployTargets: () => DeployTarget[];
4
- export declare const resolveDeployTarget: (modernConfig: AppToolsNormalizedConfig, envDeployTarget?: string | undefined, detectedProvider?: import("std-env").ProviderName) => string;
1
+ import type { AppTools, CliPlugin } from '../../types/index.js';
5
2
  export default _default;
6
3
  declare function _default(): CliPlugin<AppTools>;
@@ -1,3 +1,4 @@
1
+ import type { ResolvedDeployTarget } from '@modern-js/app-tools-extensions/deploy-output/target';
1
2
  import type { AppContext, AsyncHook, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin';
2
3
  import type { Hooks } from '@modern-js/plugin/cli';
3
4
  import type { BffRuntimeFramework } from '@modern-js/plugin/server';
@@ -150,6 +151,7 @@ export interface AppToolsExtendContext {
150
151
  serverRoutes: ServerRoute[];
151
152
  /** Whether to use api only mode */
152
153
  apiOnly: boolean;
154
+ deployTarget: ResolvedDeployTarget;
153
155
  _internalContext: InternalContext<AppTools>;
154
156
  /**
155
157
  * Information for HTML templates by entry
@@ -227,6 +227,7 @@ Usage: modern deploy [options]
227
227
  Options:
228
228
  -c --config <config> Specify configuration file path, either relative or absolute
229
229
  -s --skip-build Skip the build stage
230
+ --deploy-target <target> Deploy target (node, vercel, netlify, ghPages, cloudflare); overrides deploy.target and MODERNJS_DEPLOY
230
231
  -h, --help Display command help
231
232
  ```
232
233
 
@@ -77,7 +77,7 @@ target.
77
77
  | Effect compiler | `@effect/tsgo@0.45.0` |
78
78
  | Oxc and Ultracite | `oxlint@1.85.0`, `oxfmt@0.70.0`, `ultracite@7.12.0` |
79
79
  | TanStack Router | `@tanstack/react-router@1.170.39`, `@tanstack/router-core@1.171.32`, `@tanstack/history@1.162.4` |
80
- | Module Federation | `bridge-react`, `manifest`, `modern-js-v3`, and `rspack`: `2.9.1`; `@module-federation/node@2.7.51` |
80
+ | Module Federation | `bridge-react`, `manifest`, `modern-js-v3`, and `rspack`: `2.9.2`; `@module-federation/node@2.7.52` |
81
81
  | Tailwind CSS | `tailwindcss@4.3.3` |
82
82
  | Node and package tooling | Node `26.7.0`, `@types/node@^26.6.2`, pnpm `11.27.1` |
83
83
 
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.9.0-ultramodern.19",
20
+ "version": "3.9.0-ultramodern.20",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -127,18 +127,18 @@
127
127
  "@babel/traverse": "^8.0.6",
128
128
  "@babel/types": "^8.0.6",
129
129
  "@loadable/component": "5.16.7",
130
- "@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.19",
131
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.19",
132
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.19",
133
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.19",
134
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.19",
135
- "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.19",
136
- "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.19",
137
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.19",
138
- "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.19",
139
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.19",
140
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.19",
141
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.19",
130
+ "@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.20",
131
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.20",
132
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.20",
133
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.20",
134
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.20",
135
+ "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.20",
136
+ "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.20",
137
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.20",
138
+ "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.20",
139
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.20",
140
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.20",
141
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.20",
142
142
  "@rsbuild/core": "2.2.9",
143
143
  "@swc/core": "1.16.2",
144
144
  "@swc/helpers": "^0.5.23",