@modern-js/app-tools 3.9.1 → 3.9.2

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.
@@ -92,7 +92,7 @@ function handleSetupResult(setupResult, api) {
92
92
  if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
93
93
  const { isMultiple, params: transformParams } = (0, external_utils_js_namespaceObject.transformHookParams)(key, params);
94
94
  if (isMultiple) return (0, external_utils_js_namespaceObject.transformHookResult)(key, await fn(...transformParams));
95
- return (0, external_utils_js_namespaceObject.transformHookResult)(key, await fn(transformParams));
95
+ else return (0, external_utils_js_namespaceObject.transformHookResult)(key, await fn(transformParams));
96
96
  });
97
97
  }
98
98
  });
package/dist/cjs/index.js CHANGED
@@ -39,9 +39,6 @@ var __webpack_modules__ = {
39
39
  "./plugins/serverBuild" (module) {
40
40
  module.exports = require("./plugins/serverBuild.js");
41
41
  },
42
- "./plugins/serverRuntime" (module) {
43
- module.exports = require("./plugins/serverRuntime.js");
44
- },
45
42
  "./rsbuild" (module) {
46
43
  module.exports = require("./rsbuild.js");
47
44
  },
@@ -144,14 +141,12 @@ var __webpack_exports__ = {};
144
141
  var _plugins_initialize__rspack_import_11_default = /*#__PURE__*/ __webpack_require__.n(_plugins_initialize__rspack_import_11);
145
142
  var _plugins_serverBuild__rspack_import_12 = __webpack_require__("./plugins/serverBuild");
146
143
  var _plugins_serverBuild__rspack_import_12_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverBuild__rspack_import_12);
147
- var _plugins_serverRuntime__rspack_import_13 = __webpack_require__("./plugins/serverRuntime");
148
- var _plugins_serverRuntime__rspack_import_13_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverRuntime__rspack_import_13);
149
- var _utils_generateWatchFiles__rspack_import_14 = __webpack_require__("./utils/generateWatchFiles");
150
- var _utils_initAppContext__rspack_import_15 = __webpack_require__("./utils/initAppContext");
151
- var _utils_restart__rspack_import_16 = __webpack_require__("./utils/restart");
152
- var _defineConfig__rspack_import_17 = __webpack_require__("./defineConfig");
144
+ var _utils_generateWatchFiles__rspack_import_13 = __webpack_require__("./utils/generateWatchFiles");
145
+ var _utils_initAppContext__rspack_import_14 = __webpack_require__("./utils/initAppContext");
146
+ var _utils_restart__rspack_import_15 = __webpack_require__("./utils/restart");
147
+ var _defineConfig__rspack_import_16 = __webpack_require__("./defineConfig");
153
148
  var __rspack_reexport = {};
154
- for(const __rspack_import_key in _defineConfig__rspack_import_17)if ([
149
+ for(const __rspack_import_key in _defineConfig__rspack_import_16)if ([
155
150
  "dev",
156
151
  "resolveModernRsbuildConfig",
157
152
  "mergeConfig",
@@ -164,17 +159,17 @@ var __webpack_exports__ = {};
164
159
  "defineConfig",
165
160
  "build",
166
161
  "closeServer"
167
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_defineConfig__rspack_import_17[__rspack_import_key];
162
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_defineConfig__rspack_import_16[__rspack_import_key];
168
163
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
169
- var _commands_build__rspack_import_18 = __webpack_require__("./commands/build");
170
- var _commands_deploy__rspack_import_19 = __webpack_require__("./commands/deploy");
171
- var _commands_dev__rspack_import_20 = __webpack_require__("./commands/dev");
172
- var _commands_serve__rspack_import_21 = __webpack_require__("./commands/serve");
173
- var _utils_createServer__rspack_import_22 = __webpack_require__("./utils/createServer");
174
- var _rsbuild__rspack_import_23 = __webpack_require__("./rsbuild");
175
- var _types__rspack_import_24 = __webpack_require__("./types?6efa");
164
+ var _commands_build__rspack_import_17 = __webpack_require__("./commands/build");
165
+ var _commands_deploy__rspack_import_18 = __webpack_require__("./commands/deploy");
166
+ var _commands_dev__rspack_import_19 = __webpack_require__("./commands/dev");
167
+ var _commands_serve__rspack_import_20 = __webpack_require__("./commands/serve");
168
+ var _utils_createServer__rspack_import_21 = __webpack_require__("./utils/createServer");
169
+ var _rsbuild__rspack_import_22 = __webpack_require__("./rsbuild");
170
+ var _types__rspack_import_23 = __webpack_require__("./types?6efa");
176
171
  var __rspack_reexport = {};
177
- for(const __rspack_import_key in _types__rspack_import_24)if ([
172
+ for(const __rspack_import_key in _types__rspack_import_23)if ([
178
173
  "dev",
179
174
  "resolveModernRsbuildConfig",
180
175
  "mergeConfig",
@@ -187,13 +182,12 @@ var __webpack_exports__ = {};
187
182
  "defineConfig",
188
183
  "build",
189
184
  "closeServer"
190
- ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_24[__rspack_import_key];
185
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_23[__rspack_import_key];
191
186
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
192
- var _modern_js_plugin_cli__rspack_import_25 = __webpack_require__("@modern-js/plugin/cli");
187
+ var _modern_js_plugin_cli__rspack_import_24 = __webpack_require__("@modern-js/plugin/cli");
193
188
  const appTools = ()=>({
194
189
  name: '@modern-js/app-tools',
195
190
  usePlugins: [
196
- _plugins_serverRuntime__rspack_import_13_default()(),
197
191
  (0, _compat__rspack_import_6.compatPlugin)(),
198
192
  _plugins_initialize__rspack_import_11_default()(),
199
193
  _plugins_analyze__rspack_import_9_default()(),
@@ -226,7 +220,7 @@ var __webpack_exports__ = {};
226
220
  _locale__rspack_import_8.i18n.changeLanguage({
227
221
  locale
228
222
  });
229
- api.updateAppContext((0, _utils_initAppContext__rspack_import_15.initAppContext)({
223
+ api.updateAppContext((0, _utils_initAppContext__rspack_import_14.initAppContext)({
230
224
  metaName: context.metaName,
231
225
  appDirectory: context.appDirectory,
232
226
  runtimeConfigFile: _constants__rspack_import_7.DEFAULT_RUNTIME_CONFIG_FILE,
@@ -272,7 +266,7 @@ var __webpack_exports__ = {};
272
266
  api.addWatchFiles(async ()=>{
273
267
  const appContext = api.getAppContext();
274
268
  const config = api.getNormalizedConfig();
275
- const files = await (0, _utils_generateWatchFiles__rspack_import_14.generateWatchFiles)(appContext, config.source.configDir);
269
+ const files = await (0, _utils_generateWatchFiles__rspack_import_13.generateWatchFiles)(appContext, config.source.configDir);
276
270
  const watchFiles = (0, _modern_js_builder__rspack_import_1.castArray)(config.dev.watchFiles);
277
271
  watchFiles.forEach(({ type, paths })=>{
278
272
  if ('reload-server' === type) files.push(...Array.isArray(paths) ? paths : [
@@ -289,7 +283,7 @@ var __webpack_exports__ = {};
289
283
  if (!isPrivate && ('change' === eventType || 'unlink' === eventType) && !isApiProject) {
290
284
  const { closeServer } = await import("./utils/createServer.js");
291
285
  await closeServer();
292
- await (0, _utils_restart__rspack_import_16.restart)(api.getHooks(), filename);
286
+ await (0, _utils_restart__rspack_import_15.restart)(api.getHooks(), filename);
293
287
  }
294
288
  });
295
289
  api.onBeforeRestart(()=>{
@@ -301,16 +295,16 @@ var __webpack_exports__ = {};
301
295
  });
302
296
  const __rspack_default_export = appTools;
303
297
  __webpack_require__.d(__webpack_exports__, {
304
- build: ()=>_commands_build__rspack_import_18.build,
305
- closeServer: ()=>_utils_createServer__rspack_import_22.closeServer,
306
- defineConfig: ()=>_defineConfig__rspack_import_17.defineConfig,
307
- deploy: ()=>_commands_deploy__rspack_import_19.deploy,
308
- dev: ()=>_commands_dev__rspack_import_20.dev,
309
- generateWatchFiles: ()=>_utils_generateWatchFiles__rspack_import_14.generateWatchFiles,
310
- initAppContext: ()=>_utils_initAppContext__rspack_import_15.initAppContext,
311
- mergeConfig: ()=>_modern_js_plugin_cli__rspack_import_25.mergeConfig,
312
- resolveModernRsbuildConfig: ()=>_rsbuild__rspack_import_23.resolveModernRsbuildConfig,
313
- serve: ()=>_commands_serve__rspack_import_21.serve
298
+ build: ()=>_commands_build__rspack_import_17.build,
299
+ closeServer: ()=>_utils_createServer__rspack_import_21.closeServer,
300
+ defineConfig: ()=>_defineConfig__rspack_import_16.defineConfig,
301
+ deploy: ()=>_commands_deploy__rspack_import_18.deploy,
302
+ dev: ()=>_commands_dev__rspack_import_19.dev,
303
+ generateWatchFiles: ()=>_utils_generateWatchFiles__rspack_import_13.generateWatchFiles,
304
+ initAppContext: ()=>_utils_initAppContext__rspack_import_14.initAppContext,
305
+ mergeConfig: ()=>_modern_js_plugin_cli__rspack_import_24.mergeConfig,
306
+ resolveModernRsbuildConfig: ()=>_rsbuild__rspack_import_22.resolveModernRsbuildConfig,
307
+ serve: ()=>_commands_serve__rspack_import_20.serve
314
308
  }, {
315
309
  appTools: appTools,
316
310
  default: __rspack_default_export
@@ -106,7 +106,7 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
106
106
  }));
107
107
  return scanDir(hooks, dirs);
108
108
  } else throw Error("source.entriesDir accept a directory.");
109
- throw Error(`src dir ${entriesDir} not found.`);
109
+ else throw Error(`src dir ${entriesDir} not found.`);
110
110
  };
111
111
  exports.getFileSystemEntry = __webpack_exports__.getFileSystemEntry;
112
112
  exports.hasEntry = __webpack_exports__.hasEntry;
@@ -69,7 +69,7 @@ const applyRouteOptions = (original, routeOptions)=>{
69
69
  ...original,
70
70
  urlPath: url
71
71
  };
72
- {
72
+ else {
73
73
  const { path: urlPath, ...other } = url;
74
74
  return {
75
75
  ...original,
@@ -58,14 +58,14 @@ const walkDirectory = (dir)=>external_fs_default().readdirSync(dir).reduce((prev
58
58
  ...previous,
59
59
  ...walkDirectory(filePath)
60
60
  ];
61
- return [
61
+ else return [
62
62
  ...previous,
63
63
  filePath
64
64
  ];
65
65
  }, []);
66
66
  const replaceWithAlias = (base, filePath, alias)=>{
67
67
  if (filePath.includes(base)) return (0, utils_namespaceObject.normalizeToPosixPath)(external_path_default().join(alias, external_path_default().relative(base, filePath)));
68
- return filePath;
68
+ else return filePath;
69
69
  };
70
70
  const parseModule = async ({ source, filename })=>{
71
71
  let content = source;
@@ -59,7 +59,7 @@ function handleSetupResult(setupResult, api) {
59
59
  if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
60
60
  const { isMultiple, params: transformParams } = transformHookParams(key, params);
61
61
  if (isMultiple) return transformHookResult(key, await fn(...transformParams));
62
- return transformHookResult(key, await fn(transformParams));
62
+ else return transformHookResult(key, await fn(transformParams));
63
63
  });
64
64
  }
65
65
  });
@@ -11,7 +11,6 @@ import analyze from "./plugins/analyze/index.mjs";
11
11
  import deploy from "./plugins/deploy/index.mjs";
12
12
  import initialize from "./plugins/initialize/index.mjs";
13
13
  import serverBuild from "./plugins/serverBuild.mjs";
14
- import serverRuntime from "./plugins/serverRuntime.mjs";
15
14
  import { generateWatchFiles } from "./utils/generateWatchFiles.mjs";
16
15
  import { initAppContext } from "./utils/initAppContext.mjs";
17
16
  import { restart } from "./utils/restart.mjs";
@@ -20,7 +19,6 @@ export * from "./types/index.mjs";
20
19
  const appTools = ()=>({
21
20
  name: '@modern-js/app-tools',
22
21
  usePlugins: [
23
- serverRuntime(),
24
22
  compatPlugin(),
25
23
  initialize(),
26
24
  analyze(),
@@ -61,6 +61,6 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
61
61
  }));
62
62
  return scanDir(hooks, dirs);
63
63
  } else throw Error("source.entriesDir accept a directory.");
64
- throw Error(`src dir ${entriesDir} not found.`);
64
+ else throw Error(`src dir ${entriesDir} not found.`);
65
65
  };
66
66
  export { getFileSystemEntry, hasEntry, hasServerEntry };
@@ -26,7 +26,7 @@ const applyRouteOptions = (original, routeOptions)=>{
26
26
  ...original,
27
27
  urlPath: url
28
28
  };
29
- {
29
+ else {
30
30
  const { path: urlPath, ...other } = url;
31
31
  return {
32
32
  ...original,
@@ -9,14 +9,14 @@ const walkDirectory = (dir)=>fs.readdirSync(dir).reduce((previous, filename)=>{
9
9
  ...previous,
10
10
  ...walkDirectory(filePath)
11
11
  ];
12
- return [
12
+ else return [
13
13
  ...previous,
14
14
  filePath
15
15
  ];
16
16
  }, []);
17
17
  const replaceWithAlias = (base, filePath, alias)=>{
18
18
  if (filePath.includes(base)) return normalizeToPosixPath(path.join(alias, path.relative(base, filePath)));
19
- return filePath;
19
+ else return filePath;
20
20
  };
21
21
  const parseModule = async ({ source, filename })=>{
22
22
  let content = source;
@@ -60,7 +60,7 @@ function handleSetupResult(setupResult, api) {
60
60
  if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
61
61
  const { isMultiple, params: transformParams } = transformHookParams(key, params);
62
62
  if (isMultiple) return transformHookResult(key, await fn(...transformParams));
63
- return transformHookResult(key, await fn(transformParams));
63
+ else return transformHookResult(key, await fn(transformParams));
64
64
  });
65
65
  }
66
66
  });
@@ -13,7 +13,6 @@ import analyze from "./plugins/analyze/index.mjs";
13
13
  import deploy from "./plugins/deploy/index.mjs";
14
14
  import initialize from "./plugins/initialize/index.mjs";
15
15
  import serverBuild from "./plugins/serverBuild.mjs";
16
- import serverRuntime from "./plugins/serverRuntime.mjs";
17
16
  import { generateWatchFiles } from "./utils/generateWatchFiles.mjs";
18
17
  import { initAppContext } from "./utils/initAppContext.mjs";
19
18
  import { restart } from "./utils/restart.mjs";
@@ -22,7 +21,6 @@ export * from "./types/index.mjs";
22
21
  const appTools = ()=>({
23
22
  name: '@modern-js/app-tools',
24
23
  usePlugins: [
25
- serverRuntime(),
26
24
  compatPlugin(),
27
25
  initialize(),
28
26
  analyze(),
@@ -62,6 +62,6 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
62
62
  }));
63
63
  return scanDir(hooks, dirs);
64
64
  } else throw Error("source.entriesDir accept a directory.");
65
- throw Error(`src dir ${entriesDir} not found.`);
65
+ else throw Error(`src dir ${entriesDir} not found.`);
66
66
  };
67
67
  export { getFileSystemEntry, hasEntry, hasServerEntry };
@@ -27,7 +27,7 @@ const applyRouteOptions = (original, routeOptions)=>{
27
27
  ...original,
28
28
  urlPath: url
29
29
  };
30
- {
30
+ else {
31
31
  const { path: urlPath, ...other } = url;
32
32
  return {
33
33
  ...original,
@@ -10,14 +10,14 @@ const walkDirectory = (dir)=>fs.readdirSync(dir).reduce((previous, filename)=>{
10
10
  ...previous,
11
11
  ...walkDirectory(filePath)
12
12
  ];
13
- return [
13
+ else return [
14
14
  ...previous,
15
15
  filePath
16
16
  ];
17
17
  }, []);
18
18
  const replaceWithAlias = (base, filePath, alias)=>{
19
19
  if (filePath.includes(base)) return normalizeToPosixPath(path.join(alias, path.relative(base, filePath)));
20
- return filePath;
20
+ else return filePath;
21
21
  };
22
22
  const parseModule = async ({ source, filename })=>{
23
23
  let content = source;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.9.1",
18
+ "version": "3.9.2",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -116,7 +116,7 @@
116
116
  "@babel/parser": "^7.29.7",
117
117
  "@babel/traverse": "^7.29.7",
118
118
  "@babel/types": "^7.29.7",
119
- "@rsbuild/core": "2.2.4",
119
+ "@rsbuild/core": "2.2.7",
120
120
  "@swc/core": "1.15.41",
121
121
  "@swc/helpers": "^0.5.17",
122
122
  "es-module-lexer": "^1.7.0",
@@ -126,16 +126,16 @@
126
126
  "ndepe": "^0.1.13",
127
127
  "pkg-types": "^1.3.1",
128
128
  "std-env": "^3.10.0",
129
- "@modern-js/builder": "3.9.1",
130
- "@modern-js/i18n-utils": "3.9.1",
131
- "@modern-js/plugin": "3.9.1",
132
- "@modern-js/plugin-data-loader": "3.9.1",
133
- "@modern-js/prod-server": "3.9.1",
134
- "@modern-js/server": "3.9.1",
135
- "@modern-js/server-core": "3.9.1",
136
- "@modern-js/server-utils": "3.9.1",
137
- "@modern-js/types": "3.9.1",
138
- "@modern-js/utils": "3.9.1"
129
+ "@modern-js/builder": "3.9.2",
130
+ "@modern-js/i18n-utils": "3.9.2",
131
+ "@modern-js/plugin": "3.9.2",
132
+ "@modern-js/plugin-data-loader": "3.9.2",
133
+ "@modern-js/prod-server": "3.9.2",
134
+ "@modern-js/server": "3.9.2",
135
+ "@modern-js/server-core": "3.9.2",
136
+ "@modern-js/server-utils": "3.9.2",
137
+ "@modern-js/types": "3.9.2",
138
+ "@modern-js/utils": "3.9.2"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@rslib/core": "1.0.0",
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- const __rspack_default_export = ()=>({
31
- name: '@modern-js/plugin-server-runtime',
32
- setup (api) {
33
- api.config(()=>({
34
- output: {
35
- externals: [
36
- {
37
- '@modern-js/server-runtime': '@modern-js/server-runtime'
38
- }
39
- ]
40
- }
41
- }));
42
- }
43
- });
44
- __webpack_require__.d(__webpack_exports__, {}, {
45
- default: __rspack_default_export
46
- });
47
- exports["default"] = __webpack_exports__["default"];
48
- for(var __rspack_i in __webpack_exports__)if (-1 === [
49
- "default"
50
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
51
- Object.defineProperty(exports, '__esModule', {
52
- value: true
53
- });
@@ -1,15 +0,0 @@
1
- const serverRuntime = ()=>({
2
- name: '@modern-js/plugin-server-runtime',
3
- setup (api) {
4
- api.config(()=>({
5
- output: {
6
- externals: [
7
- {
8
- '@modern-js/server-runtime': '@modern-js/server-runtime'
9
- }
10
- ]
11
- }
12
- }));
13
- }
14
- });
15
- export default serverRuntime;
@@ -1,16 +0,0 @@
1
- import "node:module";
2
- const serverRuntime = ()=>({
3
- name: '@modern-js/plugin-server-runtime',
4
- setup (api) {
5
- api.config(()=>({
6
- output: {
7
- externals: [
8
- {
9
- '@modern-js/server-runtime': '@modern-js/server-runtime'
10
- }
11
- ]
12
- }
13
- }));
14
- }
15
- });
16
- export default serverRuntime;
@@ -1,3 +0,0 @@
1
- import type { AppTools, CliPlugin } from '../types/index.js';
2
- declare const _default: () => CliPlugin<AppTools>;
3
- export default _default;