@modern-js/app-tools 2.65.3 → 2.65.5

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.
@@ -90,7 +90,9 @@ const build = async (api, options) => {
90
90
  if (!appContext.builder) {
91
91
  throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
92
92
  }
93
- await appContext.builder.build();
93
+ await appContext.builder.build({
94
+ watch: options === null || options === void 0 ? void 0 : options.watch
95
+ });
94
96
  };
95
97
  // Annotate the CommonJS export names for ESM import in node:
96
98
  0 && (module.exports = {
@@ -65,7 +65,7 @@ const devCommand = async (program, api) => {
65
65
  const buildCommand = async (program, api) => {
66
66
  const hooks = api.getHooks();
67
67
  const platformBuilders = await hooks.registerBuildPlatform.call();
68
- const buildProgram = program.command("build").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.build.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).action(async (options) => {
68
+ const buildProgram = program.command("build").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.build.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).option("-w --watch", import_locale.i18n.t(import_locale.localeKeys.command.build.watch)).action(async (options) => {
69
69
  const { build } = await import("./build.js");
70
70
  await build(api, options);
71
71
  });
@@ -38,7 +38,8 @@ const EN_LOCALE = {
38
38
  requireEntry: "You must choose at least one entry"
39
39
  },
40
40
  build: {
41
- describe: "build the app for production"
41
+ describe: "build the app for production",
42
+ watch: "turn on watch mode, watch for changes and rebuild"
42
43
  },
43
44
  serve: {
44
45
  describe: "preview the production build locally"
@@ -38,7 +38,8 @@ const ZH_LOCALE = {
38
38
  requireEntry: "请至少选择一个入口"
39
39
  },
40
40
  build: {
41
- describe: "构建生产环境产物"
41
+ describe: "构建生产环境产物",
42
+ watch: "开启 watch 模式, 监听文件变更并重新构建"
42
43
  },
43
44
  serve: {
44
45
  describe: "启动生产环境服务"
@@ -103,7 +103,7 @@ const applyRouteOptions = (original, routeOptions) => {
103
103
  };
104
104
  const collectHtmlRoutes = (entrypoints, appContext, config) => {
105
105
  var _deploy_worker;
106
- const { source: { mainEntryName }, html: { disableHtmlFolder }, output: { distPath: { html: htmlPath } = {} }, server: { baseUrl, routes, ssr, ssrByEntries, rsc }, deploy } = config;
106
+ const { source: { mainEntryName }, html: { disableHtmlFolder, outputStructure }, output: { distPath: { html: htmlPath } = {} }, server: { baseUrl, routes, ssr, ssrByEntries, rsc }, deploy } = config;
107
107
  const { packageName } = appContext;
108
108
  const workerSSR = deploy === null || deploy === void 0 ? void 0 : (_deploy_worker = deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr;
109
109
  let htmlRoutes = entrypoints.reduce((previous, { entryName }) => {
@@ -117,7 +117,7 @@ const collectHtmlRoutes = (entrypoints, appContext, config) => {
117
117
  let route = {
118
118
  urlPath: `/${isMain ? "" : entryName}`,
119
119
  entryName,
120
- entryPath: (0, import_utils.removeLeadingSlash)(import_path.default.posix.normalize(`${htmlPath}/${entryName}${disableHtmlFolder ? ".html" : "/index.html"}`)),
120
+ entryPath: (0, import_utils.removeLeadingSlash)(import_path.default.posix.normalize(`${htmlPath}/${entryName}${disableHtmlFolder || outputStructure === "flat" ? ".html" : "/index.html"}`)),
121
121
  isSPA: true,
122
122
  isStream: isStream || isRSC,
123
123
  isSSR,
@@ -120,7 +120,9 @@ var build = function() {
120
120
  }
121
121
  return [
122
122
  4,
123
- appContext.builder.build()
123
+ appContext.builder.build({
124
+ watch: options === null || options === void 0 ? void 0 : options.watch
125
+ })
124
126
  ];
125
127
  case 12:
126
128
  _state.sent();
@@ -140,7 +140,7 @@ var buildCommand = function() {
140
140
  ];
141
141
  case 1:
142
142
  platformBuilders = _state.sent();
143
- buildProgram = 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)).action(function() {
143
+ buildProgram = 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(function() {
144
144
  var _ref2 = _async_to_generator(function(options) {
145
145
  var build;
146
146
  return _ts_generator(this, function(_state2) {
@@ -15,7 +15,8 @@ var EN_LOCALE = {
15
15
  requireEntry: "You must choose at least one entry"
16
16
  },
17
17
  build: {
18
- describe: "build the app for production"
18
+ describe: "build the app for production",
19
+ watch: "turn on watch mode, watch for changes and rebuild"
19
20
  },
20
21
  serve: {
21
22
  describe: "preview the production build locally"
@@ -15,7 +15,8 @@ var ZH_LOCALE = {
15
15
  requireEntry: "请至少选择一个入口"
16
16
  },
17
17
  build: {
18
- describe: "构建生产环境产物"
18
+ describe: "构建生产环境产物",
19
+ watch: "开启 watch 模式, 监听文件变更并重新构建"
19
20
  },
20
21
  serve: {
21
22
  describe: "启动生产环境服务"
@@ -70,7 +70,7 @@ var applyRouteOptions = function(original, routeOptions) {
70
70
  };
71
71
  var collectHtmlRoutes = function(entrypoints, appContext, config) {
72
72
  var _deploy_worker;
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, rsc = _config_server.rsc, deploy = config.deploy;
73
+ var mainEntryName = config.source.mainEntryName, _config_html = config.html, disableHtmlFolder = _config_html.disableHtmlFolder, outputStructure = _config_html.outputStructure, _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, rsc = _config_server.rsc, deploy = config.deploy;
74
74
  var packageName = appContext.packageName;
75
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) {
@@ -85,7 +85,7 @@ var collectHtmlRoutes = function(entrypoints, appContext, config) {
85
85
  var route = {
86
86
  urlPath: "/".concat(isMain ? "" : entryName),
87
87
  entryName,
88
- entryPath: removeLeadingSlash(path.posix.normalize("".concat(htmlPath, "/").concat(entryName).concat(disableHtmlFolder ? ".html" : "/index.html"))),
88
+ entryPath: removeLeadingSlash(path.posix.normalize("".concat(htmlPath, "/").concat(entryName).concat(disableHtmlFolder || outputStructure === "flat" ? ".html" : "/index.html"))),
89
89
  isSPA: true,
90
90
  isStream: isStream || isRSC,
91
91
  isSSR,
@@ -57,7 +57,9 @@ const build = async (api, options) => {
57
57
  if (!appContext.builder) {
58
58
  throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
59
59
  }
60
- await appContext.builder.build();
60
+ await appContext.builder.build({
61
+ watch: options === null || options === void 0 ? void 0 : options.watch
62
+ });
61
63
  };
62
64
  export {
63
65
  build
@@ -26,7 +26,7 @@ const devCommand = async (program, api) => {
26
26
  const buildCommand = async (program, api) => {
27
27
  const hooks = api.getHooks();
28
28
  const platformBuilders = await hooks.registerBuildPlatform.call();
29
- const buildProgram = 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)).action(async (options) => {
29
+ const buildProgram = 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) => {
30
30
  const { build } = await import("./build.js");
31
31
  await build(api, options);
32
32
  });
@@ -15,7 +15,8 @@ const EN_LOCALE = {
15
15
  requireEntry: "You must choose at least one entry"
16
16
  },
17
17
  build: {
18
- describe: "build the app for production"
18
+ describe: "build the app for production",
19
+ watch: "turn on watch mode, watch for changes and rebuild"
19
20
  },
20
21
  serve: {
21
22
  describe: "preview the production build locally"
@@ -15,7 +15,8 @@ const ZH_LOCALE = {
15
15
  requireEntry: "请至少选择一个入口"
16
16
  },
17
17
  build: {
18
- describe: "构建生产环境产物"
18
+ describe: "构建生产环境产物",
19
+ watch: "开启 watch 模式, 监听文件变更并重新构建"
19
20
  },
20
21
  serve: {
21
22
  describe: "启动生产环境服务"
@@ -69,7 +69,7 @@ const applyRouteOptions = (original, routeOptions) => {
69
69
  };
70
70
  const collectHtmlRoutes = (entrypoints, appContext, config) => {
71
71
  var _deploy_worker;
72
- const { source: { mainEntryName }, html: { disableHtmlFolder }, output: { distPath: { html: htmlPath } = {} }, server: { baseUrl, routes, ssr, ssrByEntries, rsc }, deploy } = config;
72
+ const { source: { mainEntryName }, html: { disableHtmlFolder, outputStructure }, output: { distPath: { html: htmlPath } = {} }, server: { baseUrl, routes, ssr, ssrByEntries, rsc }, deploy } = config;
73
73
  const { packageName } = appContext;
74
74
  const workerSSR = deploy === null || deploy === void 0 ? void 0 : (_deploy_worker = deploy.worker) === null || _deploy_worker === void 0 ? void 0 : _deploy_worker.ssr;
75
75
  let htmlRoutes = entrypoints.reduce((previous, { entryName }) => {
@@ -83,7 +83,7 @@ const collectHtmlRoutes = (entrypoints, appContext, config) => {
83
83
  let route = {
84
84
  urlPath: `/${isMain ? "" : entryName}`,
85
85
  entryName,
86
- entryPath: removeLeadingSlash(path.posix.normalize(`${htmlPath}/${entryName}${disableHtmlFolder ? ".html" : "/index.html"}`)),
86
+ entryPath: removeLeadingSlash(path.posix.normalize(`${htmlPath}/${entryName}${disableHtmlFolder || outputStructure === "flat" ? ".html" : "/index.html"}`)),
87
87
  isSPA: true,
88
88
  isStream: isStream || isRSC,
89
89
  isSSR,
@@ -16,6 +16,7 @@ export declare const EN_LOCALE: {
16
16
  };
17
17
  build: {
18
18
  describe: string;
19
+ watch: string;
19
20
  };
20
21
  serve: {
21
22
  describe: string;
@@ -18,6 +18,7 @@ declare const localeKeys: {
18
18
  };
19
19
  build: {
20
20
  describe: string;
21
+ watch: string;
21
22
  };
22
23
  serve: {
23
24
  describe: string;
@@ -57,6 +58,7 @@ declare const localeKeys: {
57
58
  };
58
59
  build: {
59
60
  describe: string;
61
+ watch: string;
60
62
  };
61
63
  serve: {
62
64
  describe: string;
@@ -16,6 +16,7 @@ export declare const ZH_LOCALE: {
16
16
  };
17
17
  build: {
18
18
  describe: string;
19
+ watch: string;
19
20
  };
20
21
  serve: {
21
22
  describe: string;
@@ -7,6 +7,7 @@ export type DevOptions = {
7
7
  export type BuildOptions = {
8
8
  config?: string;
9
9
  analyze?: boolean;
10
+ watch?: boolean;
10
11
  };
11
12
  export type DeployOptions = {
12
13
  config?: string;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.65.3",
18
+ "version": "2.65.5",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -80,7 +80,7 @@
80
80
  "@babel/parser": "^7.22.15",
81
81
  "@babel/traverse": "^7.23.2",
82
82
  "@babel/types": "^7.26.0",
83
- "@rsbuild/core": "1.2.15",
83
+ "@rsbuild/core": "1.2.19",
84
84
  "@rsbuild/plugin-node-polyfill": "1.3.0",
85
85
  "@swc/helpers": "0.5.13",
86
86
  "es-module-lexer": "^1.1.0",
@@ -88,26 +88,26 @@
88
88
  "esbuild-register": "^3.5.0",
89
89
  "flatted": "^3.2.9",
90
90
  "mlly": "^1.6.1",
91
- "ndepe": "0.1.5",
91
+ "ndepe": "0.1.6",
92
92
  "pkg-types": "^1.1.0",
93
93
  "std-env": "^3.7.0",
94
- "@modern-js/core": "2.65.3",
95
- "@modern-js/node-bundle-require": "2.65.3",
96
- "@modern-js/plugin": "2.65.3",
97
- "@modern-js/plugin-data-loader": "2.65.3",
98
- "@modern-js/plugin-v2": "2.65.3",
99
- "@modern-js/prod-server": "2.65.3",
100
- "@modern-js/plugin-i18n": "2.65.3",
101
- "@modern-js/rsbuild-plugin-esbuild": "2.65.3",
102
- "@modern-js/server": "2.65.3",
103
- "@modern-js/server-core": "2.65.3",
104
- "@modern-js/server-utils": "2.65.3",
105
- "@modern-js/types": "2.65.3",
106
- "@modern-js/utils": "2.65.3",
107
- "@modern-js/uni-builder": "2.65.3"
94
+ "@modern-js/core": "2.65.5",
95
+ "@modern-js/node-bundle-require": "2.65.5",
96
+ "@modern-js/plugin-data-loader": "2.65.5",
97
+ "@modern-js/plugin-i18n": "2.65.5",
98
+ "@modern-js/plugin-v2": "2.65.5",
99
+ "@modern-js/rsbuild-plugin-esbuild": "2.65.5",
100
+ "@modern-js/prod-server": "2.65.5",
101
+ "@modern-js/server-core": "2.65.5",
102
+ "@modern-js/server": "2.65.5",
103
+ "@modern-js/server-utils": "2.65.5",
104
+ "@modern-js/types": "2.65.5",
105
+ "@modern-js/plugin": "2.65.5",
106
+ "@modern-js/uni-builder": "2.65.5",
107
+ "@modern-js/utils": "2.65.5"
108
108
  },
109
109
  "devDependencies": {
110
- "@rsbuild/plugin-webpack-swc": "1.0.11",
110
+ "@rsbuild/plugin-webpack-swc": "1.0.12",
111
111
  "@types/babel__traverse": "7.20.6",
112
112
  "@types/jest": "^29",
113
113
  "@types/node": "^16",
@@ -116,8 +116,8 @@
116
116
  "tsconfig-paths": "^4.2.0",
117
117
  "typescript": "^5",
118
118
  "webpack": "^5.98.0",
119
- "@scripts/jest-config": "2.65.3",
120
- "@scripts/build": "2.65.3"
119
+ "@scripts/build": "2.65.5",
120
+ "@scripts/jest-config": "2.65.5"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "ts-node": "^10.7.0",
@@ -134,8 +134,7 @@
134
134
  "sideEffects": false,
135
135
  "publishConfig": {
136
136
  "registry": "https://registry.npmjs.org/",
137
- "access": "public",
138
- "provenance": true
137
+ "access": "public"
139
138
  },
140
139
  "scripts": {
141
140
  "new": "modern-lib new",