@modern-js/app-tools 2.47.1 → 2.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/modern.js CHANGED
@@ -5,11 +5,17 @@ const {
5
5
  INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
6
6
  } = require('@modern-js/utils');
7
7
 
8
+ const { version } = require('../package.json');
9
+
10
+ if (!process.env.MODERN_JS_VERSION) {
11
+ process.env.MODERN_JS_VERSION = version;
12
+ }
13
+
8
14
  require('@modern-js/core/runBin').run({
9
15
  internalPlugins: {
10
16
  cli: INTERNAL_APP_TOOLS_PLUGINS,
11
17
  server: INTERNAL_SERVER_PLUGINS,
12
18
  autoLoad: INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
13
19
  },
14
- initialLog: `Modern.js Framework v${require('../package.json').version}`,
20
+ initialLog: `Modern.js Framework v${version}`,
15
21
  });
package/dist/cjs/index.js CHANGED
@@ -162,18 +162,18 @@ const appTools = (options = {
162
162
  process.exit(0);
163
163
  });
164
164
  program.command("new").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.new.describe)).option("--config-file <configFile>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--lang <lang>", import_locale.i18n.t(import_locale.localeKeys.command.new.lang)).option("-c, --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.new.config)).option("-d, --debug", import_locale.i18n.t(import_locale.localeKeys.command.new.debug), false).option("--dist-tag <tag>", import_locale.i18n.t(import_locale.localeKeys.command.new.distTag)).option("--registry", import_locale.i18n.t(import_locale.localeKeys.command.new.registry)).option("--no-need-install", import_locale.i18n.t(import_locale.localeKeys.command.shared.noNeedInstall)).action(async (options2) => {
165
- const { MWANewAction } = await Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
166
- await MWANewAction({
165
+ await (0, import_utils.newAction)({
167
166
  ...options2,
168
167
  locale: options2.lang || locale
169
- });
168
+ }, "mwa");
170
169
  });
171
170
  program.command("inspect").description("inspect the internal configs").option(`--env <env>`, import_locale.i18n.t(import_locale.localeKeys.command.inspect.env), "development").option("--output <output>", import_locale.i18n.t(import_locale.localeKeys.command.inspect.output), "/").option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.inspect.verbose)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).action(async (options2) => {
172
171
  const { inspect } = await Promise.resolve().then(() => __toESM(require("./commands/inspect")));
173
172
  inspect(api, options2);
174
173
  });
175
- const { defineCommand } = await Promise.resolve().then(() => __toESM(require("@modern-js/upgrade")));
176
- defineCommand(program.command("upgrade").option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--no-need-install", import_locale.i18n.t(import_locale.localeKeys.command.shared.noNeedInstall)));
174
+ program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(async () => {
175
+ await (0, import_utils.upgradeAction)();
176
+ });
177
177
  },
178
178
  async prepare() {
179
179
  const command = (0, import_utils.getCommand)();
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
5
  import path from "path";
6
6
  import { lintPlugin } from "@modern-js/plugin-lint";
7
- import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE } from "@modern-js/utils";
7
+ import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE, newAction, upgradeAction } from "@modern-js/utils";
8
8
  import { castArray } from "@modern-js/utils/lodash";
9
9
  import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
10
10
  import analyzePlugin from "./analyze";
@@ -328,7 +328,6 @@ var appTools = function() {
328
328
  commands: function commands(param) {
329
329
  var program = param.program;
330
330
  return _async_to_generator(function() {
331
- var defineCommand;
332
331
  return _ts_generator(this, function(_state) {
333
332
  switch (_state.label) {
334
333
  case 0:
@@ -417,23 +416,16 @@ var appTools = function() {
417
416
  }());
418
417
  program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(function() {
419
418
  var _ref = _async_to_generator(function(options2) {
420
- var MWANewAction;
421
419
  return _ts_generator(this, function(_state2) {
422
420
  switch (_state2.label) {
423
421
  case 0:
424
422
  return [
425
423
  4,
426
- import("@modern-js/new-action")
427
- ];
428
- case 1:
429
- MWANewAction = _state2.sent().MWANewAction;
430
- return [
431
- 4,
432
- MWANewAction(_object_spread_props(_object_spread({}, options2), {
424
+ newAction(_object_spread_props(_object_spread({}, options2), {
433
425
  locale: options2.lang || locale
434
- }))
426
+ }), "mwa")
435
427
  ];
436
- case 2:
428
+ case 1:
437
429
  _state2.sent();
438
430
  return [
439
431
  2
@@ -468,13 +460,22 @@ var appTools = function() {
468
460
  return _ref.apply(this, arguments);
469
461
  };
470
462
  }());
471
- return [
472
- 4,
473
- import("@modern-js/upgrade")
474
- ];
475
- case 3:
476
- defineCommand = _state.sent().defineCommand;
477
- defineCommand(program.command("upgrade").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)));
463
+ program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(/* @__PURE__ */ _async_to_generator(function() {
464
+ return _ts_generator(this, function(_state2) {
465
+ switch (_state2.label) {
466
+ case 0:
467
+ return [
468
+ 4,
469
+ upgradeAction()
470
+ ];
471
+ case 1:
472
+ _state2.sent();
473
+ return [
474
+ 2
475
+ ];
476
+ }
477
+ });
478
+ }));
478
479
  return [
479
480
  2
480
481
  ];
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import { lintPlugin } from "@modern-js/plugin-lint";
3
- import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE } from "@modern-js/utils";
3
+ import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE, newAction, upgradeAction } from "@modern-js/utils";
4
4
  import { castArray } from "@modern-js/utils/lodash";
5
5
  import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
6
6
  import analyzePlugin from "./analyze";
@@ -123,18 +123,18 @@ const appTools = (options = {
123
123
  process.exit(0);
124
124
  });
125
125
  program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(async (options2) => {
126
- const { MWANewAction } = await import("@modern-js/new-action");
127
- await MWANewAction({
126
+ await newAction({
128
127
  ...options2,
129
128
  locale: options2.lang || locale
130
- });
129
+ }, "mwa");
131
130
  });
132
131
  program.command("inspect").description("inspect the internal configs").option(`--env <env>`, i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "/").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(async (options2) => {
133
132
  const { inspect } = await import("./commands/inspect");
134
133
  inspect(api, options2);
135
134
  });
136
- const { defineCommand } = await import("@modern-js/upgrade");
137
- defineCommand(program.command("upgrade").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)));
135
+ program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(async () => {
136
+ await upgradeAction();
137
+ });
138
138
  },
139
139
  async prepare() {
140
140
  const command = getCommand();
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.47.1",
18
+ "version": "2.48.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -69,39 +69,37 @@
69
69
  "@babel/parser": "^7.22.15",
70
70
  "@babel/traverse": "^7.23.2",
71
71
  "@babel/types": "^7.23.0",
72
- "@rsbuild/plugin-esbuild": "0.4.6",
73
- "@rsbuild/plugin-node-polyfill": "0.4.6",
74
- "@rsbuild/shared": "0.4.6",
75
- "@rsbuild/core": "0.4.6",
72
+ "@rsbuild/plugin-esbuild": "0.4.8",
73
+ "@rsbuild/plugin-node-polyfill": "0.4.8",
74
+ "@rsbuild/shared": "0.4.8",
75
+ "@rsbuild/core": "0.4.8",
76
76
  "es-module-lexer": "^1.1.0",
77
77
  "esbuild": "0.17.19",
78
78
  "@swc/helpers": "0.5.3",
79
- "@modern-js/uni-builder": "2.47.1",
80
- "@modern-js/core": "2.47.1",
81
- "@modern-js/new-action": "2.47.1",
82
- "@modern-js/plugin": "2.47.1",
83
- "@modern-js/plugin-data-loader": "2.47.1",
84
- "@modern-js/node-bundle-require": "2.47.1",
85
- "@modern-js/plugin-i18n": "2.47.1",
86
- "@modern-js/prod-server": "2.47.1",
87
- "@modern-js/server": "2.47.1",
88
- "@modern-js/server-utils": "2.47.1",
89
- "@modern-js/plugin-lint": "2.47.1",
90
- "@modern-js/types": "2.47.1",
91
- "@modern-js/upgrade": "2.47.1",
92
- "@modern-js/utils": "2.47.1",
93
- "@modern-js/server-core": "2.47.1"
79
+ "@modern-js/uni-builder": "2.48.0",
80
+ "@modern-js/core": "2.48.0",
81
+ "@modern-js/node-bundle-require": "2.48.0",
82
+ "@modern-js/plugin": "2.48.0",
83
+ "@modern-js/plugin-i18n": "2.48.0",
84
+ "@modern-js/plugin-data-loader": "2.48.0",
85
+ "@modern-js/plugin-lint": "2.48.0",
86
+ "@modern-js/server": "2.48.0",
87
+ "@modern-js/prod-server": "2.48.0",
88
+ "@modern-js/server-utils": "2.48.0",
89
+ "@modern-js/types": "2.48.0",
90
+ "@modern-js/utils": "2.48.0",
91
+ "@modern-js/server-core": "2.48.0"
94
92
  },
95
93
  "devDependencies": {
96
- "@rsbuild/plugin-swc": "0.4.6",
94
+ "@rsbuild/plugin-swc": "0.4.8",
97
95
  "@types/babel__traverse": "7.18.5",
98
96
  "@types/jest": "^29",
99
97
  "@types/node": "^14",
100
98
  "jest": "^29",
101
99
  "typescript": "^5",
102
100
  "webpack": "^5.89.0",
103
- "@scripts/build": "2.47.1",
104
- "@scripts/jest-config": "2.47.1"
101
+ "@scripts/jest-config": "2.48.0",
102
+ "@scripts/build": "2.48.0"
105
103
  },
106
104
  "sideEffects": false,
107
105
  "publishConfig": {