@modern-js/app-tools 2.63.3 → 2.63.4

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.
@@ -49,7 +49,6 @@ const compatPlugin = () => ({
49
49
  };
50
50
  },
51
51
  registryHooks: {
52
- appendEntryCode: (0, import_plugin_v2.createCollectAsyncHook)(),
53
52
  jestConfig: (0, import_plugin_v2.createAsyncHook)(),
54
53
  afterTest: (0, import_plugin_v2.createAsyncHook)()
55
54
  },
@@ -29,7 +29,7 @@ var import_constants = require("../constants");
29
29
  var import_getConfigFile = require("../utils/getConfigFile");
30
30
  var import_isAutoLoadPlugins = require("../utils/isAutoLoadPlugins");
31
31
  var import_loadPlugins = require("../utils/loadPlugins");
32
- async function run({ cwd, initialLog, version, internalPlugins, packageJsonConfig, configFile }) {
32
+ async function run({ cwd, initialLog, metaName, version, internalPlugins, packageJsonConfig, configFile }) {
33
33
  const command = process.argv[2];
34
34
  const cliParams = (0, import_utils.minimist)(process.argv.slice(2));
35
35
  const SUPPORT_CONFIG_PARAM_COMMANDS = [
@@ -48,6 +48,20 @@ async function run({ cwd, initialLog, version, internalPlugins, packageJsonConfi
48
48
  if (command === "new") {
49
49
  customConfigFile = cliParams["config-file"];
50
50
  }
51
+ if (!process.env.NODE_ENV) {
52
+ if ([
53
+ "build",
54
+ "serve",
55
+ "deploy",
56
+ "analyze"
57
+ ].includes(command)) {
58
+ process.env.NODE_ENV = "production";
59
+ } else if (command === "test") {
60
+ process.env.NODE_ENV = "test";
61
+ } else {
62
+ process.env.NODE_ENV = "development";
63
+ }
64
+ }
51
65
  const appDirectory = await (0, import_cli.initAppDir)(cwd);
52
66
  const finalConfigFile = customConfigFile || (0, import_getConfigFile.getConfigFile)(configFile);
53
67
  const autoLoadPlugins = await (0, import_isAutoLoadPlugins.isAutoLoadPlugins)(appDirectory, finalConfigFile);
@@ -56,6 +70,7 @@ async function run({ cwd, initialLog, version, internalPlugins, packageJsonConfi
56
70
  cwd,
57
71
  initialLog: initialLog || `Modern.js Framework v${version}`,
58
72
  configFile: finalConfigFile,
73
+ metaName,
59
74
  packageJsonConfig: packageJsonConfig || import_constants.PACKAGE_JSON_CONFIG_NAME,
60
75
  internalPlugins: plugins,
61
76
  handleSetupResult: import_hooks.handleSetupResult
@@ -1,5 +1,5 @@
1
1
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
2
- import { createAsyncHook, createCollectAsyncHook } from "@modern-js/plugin-v2";
2
+ import { createAsyncHook } from "@modern-js/plugin-v2";
3
3
  import { getHookRunners } from "./hooks";
4
4
  var compatPlugin = function() {
5
5
  return {
@@ -30,7 +30,6 @@ var compatPlugin = function() {
30
30
  };
31
31
  },
32
32
  registryHooks: {
33
- appendEntryCode: createCollectAsyncHook(),
34
33
  jestConfig: createAsyncHook(),
35
34
  afterTest: createAsyncHook()
36
35
  },
@@ -13,11 +13,11 @@ function run(_) {
13
13
  }
14
14
  function _run() {
15
15
  _run = _async_to_generator(function(param) {
16
- var cwd, initialLog, version, internalPlugins, packageJsonConfig, configFile, command, cliParams, SUPPORT_CONFIG_PARAM_COMMANDS, customConfigFile, appDirectory, finalConfigFile, autoLoadPlugins, plugins;
16
+ var cwd, initialLog, metaName, version, internalPlugins, packageJsonConfig, configFile, command, cliParams, SUPPORT_CONFIG_PARAM_COMMANDS, customConfigFile, appDirectory, finalConfigFile, autoLoadPlugins, plugins;
17
17
  return _ts_generator(this, function(_state) {
18
18
  switch (_state.label) {
19
19
  case 0:
20
- cwd = param.cwd, initialLog = param.initialLog, version = param.version, internalPlugins = param.internalPlugins, packageJsonConfig = param.packageJsonConfig, configFile = param.configFile;
20
+ cwd = param.cwd, initialLog = param.initialLog, metaName = param.metaName, version = param.version, internalPlugins = param.internalPlugins, packageJsonConfig = param.packageJsonConfig, configFile = param.configFile;
21
21
  command = process.argv[2];
22
22
  cliParams = minimist(process.argv.slice(2));
23
23
  SUPPORT_CONFIG_PARAM_COMMANDS = [
@@ -35,6 +35,20 @@ function _run() {
35
35
  if (command === "new") {
36
36
  customConfigFile = cliParams["config-file"];
37
37
  }
38
+ if (!process.env.NODE_ENV) {
39
+ if ([
40
+ "build",
41
+ "serve",
42
+ "deploy",
43
+ "analyze"
44
+ ].includes(command)) {
45
+ process.env.NODE_ENV = "production";
46
+ } else if (command === "test") {
47
+ process.env.NODE_ENV = "test";
48
+ } else {
49
+ process.env.NODE_ENV = "development";
50
+ }
51
+ }
38
52
  return [
39
53
  4,
40
54
  initAppDir(cwd)
@@ -60,6 +74,7 @@ function _run() {
60
74
  cwd,
61
75
  initialLog: initialLog || "Modern.js Framework v".concat(version),
62
76
  configFile: finalConfigFile,
77
+ metaName,
63
78
  packageJsonConfig: packageJsonConfig || PACKAGE_JSON_CONFIG_NAME,
64
79
  internalPlugins: plugins,
65
80
  handleSetupResult
@@ -1,4 +1,4 @@
1
- import { createAsyncHook, createCollectAsyncHook } from "@modern-js/plugin-v2";
1
+ import { createAsyncHook } from "@modern-js/plugin-v2";
2
2
  import { getHookRunners } from "./hooks";
3
3
  const compatPlugin = () => ({
4
4
  name: "@modern-js/app-tools-compat",
@@ -26,7 +26,6 @@ const compatPlugin = () => ({
26
26
  };
27
27
  },
28
28
  registryHooks: {
29
- appendEntryCode: createCollectAsyncHook(),
30
29
  jestConfig: createAsyncHook(),
31
30
  afterTest: createAsyncHook()
32
31
  },
@@ -6,7 +6,7 @@ import { PACKAGE_JSON_CONFIG_NAME } from "../constants";
6
6
  import { getConfigFile } from "../utils/getConfigFile";
7
7
  import { isAutoLoadPlugins } from "../utils/isAutoLoadPlugins";
8
8
  import { loadInternalPlugins } from "../utils/loadPlugins";
9
- async function run({ cwd, initialLog, version, internalPlugins, packageJsonConfig, configFile }) {
9
+ async function run({ cwd, initialLog, metaName, version, internalPlugins, packageJsonConfig, configFile }) {
10
10
  const command = process.argv[2];
11
11
  const cliParams = minimist(process.argv.slice(2));
12
12
  const SUPPORT_CONFIG_PARAM_COMMANDS = [
@@ -25,6 +25,20 @@ async function run({ cwd, initialLog, version, internalPlugins, packageJsonConfi
25
25
  if (command === "new") {
26
26
  customConfigFile = cliParams["config-file"];
27
27
  }
28
+ if (!process.env.NODE_ENV) {
29
+ if ([
30
+ "build",
31
+ "serve",
32
+ "deploy",
33
+ "analyze"
34
+ ].includes(command)) {
35
+ process.env.NODE_ENV = "production";
36
+ } else if (command === "test") {
37
+ process.env.NODE_ENV = "test";
38
+ } else {
39
+ process.env.NODE_ENV = "development";
40
+ }
41
+ }
28
42
  const appDirectory = await initAppDir(cwd);
29
43
  const finalConfigFile = customConfigFile || getConfigFile(configFile);
30
44
  const autoLoadPlugins = await isAutoLoadPlugins(appDirectory, finalConfigFile);
@@ -33,6 +47,7 @@ async function run({ cwd, initialLog, version, internalPlugins, packageJsonConfi
33
47
  cwd,
34
48
  initialLog: initialLog || `Modern.js Framework v${version}`,
35
49
  configFile: finalConfigFile,
50
+ metaName,
36
51
  packageJsonConfig: packageJsonConfig || PACKAGE_JSON_CONFIG_NAME,
37
52
  internalPlugins: plugins,
38
53
  handleSetupResult
@@ -2,6 +2,7 @@ import type { InternalPlugins } from '@modern-js/types';
2
2
  export interface RunOptions {
3
3
  cwd?: string;
4
4
  configFile?: string;
5
+ metaName?: string;
5
6
  packageJsonConfig?: string;
6
7
  internalPlugins?: {
7
8
  cli?: InternalPlugins;
@@ -10,4 +11,4 @@ export interface RunOptions {
10
11
  initialLog?: string;
11
12
  version: string;
12
13
  }
13
- export declare function run({ cwd, initialLog, version, internalPlugins, packageJsonConfig, configFile, }: RunOptions): Promise<void>;
14
+ export declare function run({ cwd, initialLog, metaName, version, internalPlugins, packageJsonConfig, configFile, }: RunOptions): Promise<void>;
@@ -118,7 +118,7 @@ export interface AppToolsExtendHooks extends Record<string, PluginHook<(...args:
118
118
  */
119
119
  addRuntimeExports: AsyncHook<AddRuntimeExportsFn>;
120
120
  }
121
- export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
121
+ export interface AppToolsExtendContext<B extends Bundler = 'webpack'> {
122
122
  metaName: string;
123
123
  internalDirectory: string;
124
124
  sharedDirectory: string;
@@ -127,6 +127,7 @@ export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
127
127
  apiDirectory: string;
128
128
  lambdaDirectory: string;
129
129
  serverConfigFile: string;
130
+ runtimeConfigFile: string;
130
131
  serverPlugins: ServerPlugin[];
131
132
  moduleType: 'module' | 'commonjs';
132
133
  /** Information for entry points */
@@ -152,6 +153,6 @@ export type AppToolsExtendContext<B extends Bundler = 'webpack'> = {
152
153
  * @deprecated compat old plugin, default is app tools
153
154
  */
154
155
  toolsType?: string;
155
- };
156
+ }
156
157
  export type AppToolsContext<B extends Bundler = 'webpack'> = AppContext<AppTools<B>> & AppToolsExtendContext<B>;
157
158
  export type AppToolsHooks<B extends Bundler = 'webpack'> = Hooks<AppToolsUserConfig<B>, AppToolsNormalizedConfig> & AppToolsExtendHooks;
@@ -1,6 +1,6 @@
1
1
  export declare const initAppContext: ({ appDirectory, runtimeConfigFile, options, serverConfigFile, tempDir, }: {
2
2
  appDirectory: string;
3
- runtimeConfigFile: string | false;
3
+ runtimeConfigFile: string;
4
4
  options?: {
5
5
  metaName?: string | undefined;
6
6
  srcDir?: string | undefined;
@@ -12,7 +12,7 @@ export declare const initAppContext: ({ appDirectory, runtimeConfigFile, options
12
12
  tempDir?: string | undefined;
13
13
  }) => {
14
14
  metaName: string;
15
- runtimeConfigFile: string | false;
15
+ runtimeConfigFile: string;
16
16
  serverConfigFile: string;
17
17
  ip: any;
18
18
  port: number;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.63.3",
18
+ "version": "2.63.4",
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.1.10",
83
+ "@rsbuild/core": "1.1.12",
84
84
  "@rsbuild/plugin-node-polyfill": "1.2.0",
85
85
  "@swc/helpers": "0.5.13",
86
86
  "@vercel/nft": "^0.26.4",
@@ -92,20 +92,20 @@
92
92
  "pkg-types": "^1.1.0",
93
93
  "ndepe": "0.1.4",
94
94
  "std-env": "^3.7.0",
95
- "@modern-js/core": "2.63.3",
96
- "@modern-js/node-bundle-require": "2.63.3",
97
- "@modern-js/plugin-data-loader": "2.63.3",
98
- "@modern-js/plugin": "2.63.3",
99
- "@modern-js/plugin-i18n": "2.63.3",
100
- "@modern-js/plugin-v2": "2.63.3",
101
- "@modern-js/prod-server": "2.63.3",
102
- "@modern-js/rsbuild-plugin-esbuild": "2.63.3",
103
- "@modern-js/server": "2.63.3",
104
- "@modern-js/server-core": "2.63.3",
105
- "@modern-js/server-utils": "2.63.3",
106
- "@modern-js/uni-builder": "2.63.3",
107
- "@modern-js/utils": "2.63.3",
108
- "@modern-js/types": "2.63.3"
95
+ "@modern-js/core": "2.63.4",
96
+ "@modern-js/node-bundle-require": "2.63.4",
97
+ "@modern-js/plugin": "2.63.4",
98
+ "@modern-js/plugin-data-loader": "2.63.4",
99
+ "@modern-js/plugin-i18n": "2.63.4",
100
+ "@modern-js/plugin-v2": "2.63.4",
101
+ "@modern-js/prod-server": "2.63.4",
102
+ "@modern-js/rsbuild-plugin-esbuild": "2.63.4",
103
+ "@modern-js/server": "2.63.4",
104
+ "@modern-js/types": "2.63.4",
105
+ "@modern-js/server-core": "2.63.4",
106
+ "@modern-js/server-utils": "2.63.4",
107
+ "@modern-js/uni-builder": "2.63.4",
108
+ "@modern-js/utils": "2.63.4"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@rsbuild/plugin-webpack-swc": "1.0.9",
@@ -117,8 +117,8 @@
117
117
  "tsconfig-paths": "^4.2.0",
118
118
  "typescript": "^5",
119
119
  "webpack": "^5.97.1",
120
- "@scripts/jest-config": "2.63.3",
121
- "@scripts/build": "2.63.3"
120
+ "@scripts/build": "2.63.4",
121
+ "@scripts/jest-config": "2.63.4"
122
122
  },
123
123
  "peerDependencies": {
124
124
  "ts-node": "^10.7.0",