@modern-js/app-tools 1.6.4 → 1.6.7
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/CHANGELOG.md +93 -0
- package/dist/js/modern/commands/dev.js +10 -7
- package/dist/js/modern/commands/inspect.js +69 -0
- package/dist/js/modern/index.js +12 -7
- package/dist/js/modern/locale/en.js +11 -3
- package/dist/js/modern/locale/zh.js +12 -4
- package/dist/js/modern/utils/createCompiler.js +0 -10
- package/dist/js/modern/utils/printInstructions.js +2 -10
- package/dist/js/node/commands/dev.js +13 -6
- package/dist/js/node/commands/inspect.js +98 -0
- package/dist/js/node/index.js +12 -8
- package/dist/js/node/locale/en.js +11 -3
- package/dist/js/node/locale/zh.js +12 -4
- package/dist/js/node/utils/createCompiler.js +0 -9
- package/dist/js/node/utils/printInstructions.js +1 -9
- package/dist/types/commands/dev.d.ts +1 -1
- package/dist/types/commands/inspect.d.ts +7 -0
- package/dist/types/locale/en.d.ts +10 -2
- package/dist/types/locale/index.d.ts +20 -4
- package/dist/types/locale/zh.d.ts +10 -2
- package/dist/types/utils/types.d.ts +12 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,98 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 1.6.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 64cf62697: feat(app-tools): support modern inspect command
|
|
8
|
+
- b7a1cea52: feat: support utils in tools.babel
|
|
9
|
+
- Updated dependencies [ded45811c]
|
|
10
|
+
- Updated dependencies [209d0a927]
|
|
11
|
+
- Updated dependencies [9d649884b]
|
|
12
|
+
- Updated dependencies [9377d2d9d]
|
|
13
|
+
- Updated dependencies [8e1cedd8a]
|
|
14
|
+
- Updated dependencies [8c9ad1749]
|
|
15
|
+
- Updated dependencies [6b2523f44]
|
|
16
|
+
- Updated dependencies [b7a1cea52]
|
|
17
|
+
- Updated dependencies [002dab527]
|
|
18
|
+
- Updated dependencies [1ac68424f]
|
|
19
|
+
- Updated dependencies [3dfee700c]
|
|
20
|
+
- @modern-js/webpack@1.11.0
|
|
21
|
+
- @modern-js/server@1.4.20
|
|
22
|
+
- @modern-js/core@1.12.0
|
|
23
|
+
- @modern-js/utils@1.7.7
|
|
24
|
+
- @modern-js/plugin@1.3.7
|
|
25
|
+
- @modern-js/plugin-analyze@1.4.6
|
|
26
|
+
- @modern-js/prod-server@1.1.8
|
|
27
|
+
|
|
28
|
+
## 1.6.6
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- a1198d509: feat: bump babel 7.18.0
|
|
33
|
+
- d12686040: feat(app-tools): support dev --analyze
|
|
34
|
+
- 8ee2b1b29: fix: remove some unnecessary logs during dev
|
|
35
|
+
- 8f7c0f898: feat(app-tools): support specify config file in build and deploy command
|
|
36
|
+
- Updated dependencies [8d508c6ed]
|
|
37
|
+
- Updated dependencies [0eff2473c]
|
|
38
|
+
- Updated dependencies [a1198d509]
|
|
39
|
+
- Updated dependencies [29728812e]
|
|
40
|
+
- Updated dependencies [f25d6a62e]
|
|
41
|
+
- Updated dependencies [a18926bbd]
|
|
42
|
+
- Updated dependencies [c7e38b4e6]
|
|
43
|
+
- Updated dependencies [147e090f7]
|
|
44
|
+
- Updated dependencies [18892c65c]
|
|
45
|
+
- Updated dependencies [a1198d509]
|
|
46
|
+
- Updated dependencies [8f7c0f898]
|
|
47
|
+
- @modern-js/core@1.11.2
|
|
48
|
+
- @modern-js/webpack@1.10.0
|
|
49
|
+
- @modern-js/server@1.4.18
|
|
50
|
+
- @modern-js/i18n-cli-language-detector@1.2.4
|
|
51
|
+
- @modern-js/plugin-analyze@1.4.6
|
|
52
|
+
- @modern-js/plugin-i18n@1.2.7
|
|
53
|
+
- @modern-js/new-action@1.3.10
|
|
54
|
+
- @modern-js/prod-server@1.1.8
|
|
55
|
+
- @modern-js/node-bundle-require@1.3.5
|
|
56
|
+
- @modern-js/plugin@1.3.6
|
|
57
|
+
|
|
58
|
+
## 1.6.5
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- da65bf12: chore: merge plugin-fast-refresh into webpack
|
|
63
|
+
- 437367c6: fix(server): hmr not working when using proxy
|
|
64
|
+
- 7394df61: feat: prebundle @loadable/webpack-plugin and fix peer deps warning
|
|
65
|
+
- Updated dependencies [5f7fccf0]
|
|
66
|
+
- Updated dependencies [02b0a22e]
|
|
67
|
+
- Updated dependencies [f730081c]
|
|
68
|
+
- Updated dependencies [d1ab1f05]
|
|
69
|
+
- Updated dependencies [da65bf12]
|
|
70
|
+
- Updated dependencies [2ec8181a]
|
|
71
|
+
- Updated dependencies [8854c600]
|
|
72
|
+
- Updated dependencies [f7cbc771]
|
|
73
|
+
- Updated dependencies [6451a098]
|
|
74
|
+
- Updated dependencies [cdc2df9c]
|
|
75
|
+
- Updated dependencies [f5c48c3f]
|
|
76
|
+
- Updated dependencies [b39b399e]
|
|
77
|
+
- Updated dependencies [192dbc78]
|
|
78
|
+
- Updated dependencies [430d417e]
|
|
79
|
+
- Updated dependencies [658b4dd5]
|
|
80
|
+
- Updated dependencies [7fcfd6cc]
|
|
81
|
+
- Updated dependencies [d5a2cfd8]
|
|
82
|
+
- Updated dependencies [45d5643a]
|
|
83
|
+
- Updated dependencies [0d161fa8]
|
|
84
|
+
- Updated dependencies [437367c6]
|
|
85
|
+
- Updated dependencies [280eebf9]
|
|
86
|
+
- Updated dependencies [2ba8d62f]
|
|
87
|
+
- Updated dependencies [7394df61]
|
|
88
|
+
- @modern-js/webpack@1.9.0
|
|
89
|
+
- @modern-js/core@1.11.1
|
|
90
|
+
- @modern-js/server@1.4.16
|
|
91
|
+
- @modern-js/utils@1.7.6
|
|
92
|
+
- @modern-js/types@1.5.4
|
|
93
|
+
- @modern-js/prod-server@1.1.6
|
|
94
|
+
- @modern-js/plugin-analyze@1.4.5
|
|
95
|
+
|
|
3
96
|
## 1.6.4
|
|
4
97
|
|
|
5
98
|
### Patch Changes
|
|
@@ -4,7 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
import { fs, logger,
|
|
7
|
+
import { fs, logger, chalk, isSSR } from '@modern-js/utils';
|
|
8
|
+
import { manager, ResolvedConfigContext } from '@modern-js/core';
|
|
8
9
|
import { createCompiler } from "../utils/createCompiler";
|
|
9
10
|
import { createServer } from "../utils/createServer";
|
|
10
11
|
import { generateRoutes } from "../utils/routes";
|
|
@@ -12,9 +13,15 @@ import { printInstructions } from "../utils/printInstructions";
|
|
|
12
13
|
import { getSpecifiedEntries } from "../utils/getSpecifiedEntries";
|
|
13
14
|
import { buildServerConfig } from "../utils/config";
|
|
14
15
|
export const dev = async (api, options) => {
|
|
16
|
+
let userConfig = api.useResolvedConfigContext();
|
|
15
17
|
const appContext = api.useAppContext();
|
|
16
|
-
const userConfig = api.useResolvedConfigContext();
|
|
17
18
|
const hookRunners = api.useHookRunners();
|
|
19
|
+
manager.run(() => {
|
|
20
|
+
userConfig = _objectSpread(_objectSpread({}, userConfig), {}, {
|
|
21
|
+
cliOptions: options
|
|
22
|
+
});
|
|
23
|
+
ResolvedConfigContext.set(userConfig);
|
|
24
|
+
});
|
|
18
25
|
const {
|
|
19
26
|
appDirectory,
|
|
20
27
|
distDirectory,
|
|
@@ -61,10 +68,7 @@ export const dev = async (api, options) => {
|
|
|
61
68
|
dev: _objectSpread(_objectSpread({}, {
|
|
62
69
|
client: {
|
|
63
70
|
port: port.toString(),
|
|
64
|
-
|
|
65
|
-
logging: 'none',
|
|
66
|
-
path: HMR_SOCK_PATH,
|
|
67
|
-
host: 'localhost'
|
|
71
|
+
logging: 'none'
|
|
68
72
|
},
|
|
69
73
|
devMiddleware: {
|
|
70
74
|
writeToDisk: file => !file.includes('.hot-update.')
|
|
@@ -89,7 +93,6 @@ export const dev = async (api, options) => {
|
|
|
89
93
|
return printInstructions(hookRunners, appContext, userConfig);
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
clearConsole();
|
|
93
96
|
return logger.log(chalk.cyan(`Starting the development server...`));
|
|
94
97
|
});
|
|
95
98
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
|
3
|
+
import { fs, logger, signale, isUseSSRBundle, chalk } from '@modern-js/utils';
|
|
4
|
+
import WebpackChain from '@modern-js/utils/webpack-chain';
|
|
5
|
+
export const formatWebpackConfig = (config, verbose) => {
|
|
6
|
+
const stringify = WebpackChain.toString;
|
|
7
|
+
return `module.exports = ${stringify(config, {
|
|
8
|
+
verbose
|
|
9
|
+
})};`;
|
|
10
|
+
};
|
|
11
|
+
export const inspect = (api, options) => {
|
|
12
|
+
process.env.NODE_ENV = options.env;
|
|
13
|
+
const resolvedConfig = api.useResolvedConfigContext();
|
|
14
|
+
const appContext = api.useAppContext();
|
|
15
|
+
const outputFiles = [];
|
|
16
|
+
outputFiles.push(printInspectResult(WebpackConfigTarget.CLIENT, appContext, resolvedConfig, options));
|
|
17
|
+
|
|
18
|
+
if (resolvedConfig.output.enableModernMode) {
|
|
19
|
+
outputFiles.push(printInspectResult(WebpackConfigTarget.MODERN, appContext, resolvedConfig, options));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (isUseSSRBundle(resolvedConfig)) {
|
|
23
|
+
outputFiles.push(printInspectResult(WebpackConfigTarget.NODE, appContext, resolvedConfig, options));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
signale.success('Inspect succeed, you can open following files to view the full webpack config: \n');
|
|
27
|
+
outputFiles.forEach(file => {
|
|
28
|
+
signale.log(` - ${chalk.yellow(path.relative(appContext.appDirectory, file))}`);
|
|
29
|
+
});
|
|
30
|
+
signale.log();
|
|
31
|
+
};
|
|
32
|
+
export const getTagByWebpackTarget = webpackTarget => {
|
|
33
|
+
switch (webpackTarget) {
|
|
34
|
+
case WebpackConfigTarget.CLIENT:
|
|
35
|
+
return 'client';
|
|
36
|
+
|
|
37
|
+
case WebpackConfigTarget.MODERN:
|
|
38
|
+
return 'modern';
|
|
39
|
+
|
|
40
|
+
case WebpackConfigTarget.NODE:
|
|
41
|
+
return 'ssr';
|
|
42
|
+
|
|
43
|
+
default:
|
|
44
|
+
throw Error(`Unsupported webpack target: ${webpackTarget}`);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export const printInspectResult = (webpackTarget, appContext, resolvedConfig, options) => {
|
|
48
|
+
const webpackConfig = getWebpackConfig(webpackTarget, appContext, resolvedConfig);
|
|
49
|
+
const {
|
|
50
|
+
output,
|
|
51
|
+
verbose,
|
|
52
|
+
console = true
|
|
53
|
+
} = options;
|
|
54
|
+
const outputPath = output ? path.posix.join(appContext.distDirectory, output) : appContext.distDirectory;
|
|
55
|
+
const tag = getTagByWebpackTarget(webpackTarget);
|
|
56
|
+
const outputFile = `webpack.${tag}.inspect.js`;
|
|
57
|
+
const outputFilePath = path.posix.join(outputPath, outputFile);
|
|
58
|
+
const rawWebpackConfig = formatWebpackConfig(webpackConfig, verbose);
|
|
59
|
+
fs.outputFileSync(outputFilePath, rawWebpackConfig);
|
|
60
|
+
|
|
61
|
+
if (console) {
|
|
62
|
+
logger.log(`
|
|
63
|
+
webpack config for ${tag} build:
|
|
64
|
+
${rawWebpackConfig}
|
|
65
|
+
`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return outputFilePath;
|
|
69
|
+
};
|
package/dist/js/modern/index.js
CHANGED
|
@@ -7,7 +7,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import * as path from 'path';
|
|
8
8
|
import { defineConfig, cli } from '@modern-js/core';
|
|
9
9
|
import AnalyzePlugin from '@modern-js/plugin-analyze';
|
|
10
|
-
import FastRefreshPlugin from '@modern-js/plugin-fast-refresh/cli';
|
|
11
10
|
import { cleanRequireCache } from '@modern-js/utils';
|
|
12
11
|
import { hooks } from "./hooks";
|
|
13
12
|
import { i18n, localeKeys } from "./locale";
|
|
@@ -18,9 +17,9 @@ import { closeServer } from "./utils/createServer";
|
|
|
18
17
|
export { defineConfig };
|
|
19
18
|
export default (() => ({
|
|
20
19
|
name: '@modern-js/app-tools',
|
|
21
|
-
post: ['@modern-js/plugin-analyze', '@modern-js/plugin-
|
|
20
|
+
post: ['@modern-js/plugin-analyze', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-router', '@modern-js/plugin-polyfill'],
|
|
22
21
|
registerHook: hooks,
|
|
23
|
-
usePlugins: [AnalyzePlugin()
|
|
22
|
+
usePlugins: [AnalyzePlugin()],
|
|
24
23
|
setup: api => {
|
|
25
24
|
const locale = getLocaleLanguage();
|
|
26
25
|
i18n.changeLanguage({
|
|
@@ -30,10 +29,10 @@ export default (() => ({
|
|
|
30
29
|
commands({
|
|
31
30
|
program
|
|
32
31
|
}) {
|
|
33
|
-
program.command('dev').usage('[options]').description(i18n.t(localeKeys.command.dev.describe)).option('-c --config <config>', i18n.t(localeKeys.command.
|
|
32
|
+
program.command('dev').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)).action(async options => {
|
|
34
33
|
await dev(api, options);
|
|
35
34
|
});
|
|
36
|
-
program.command('build').usage('[options]').description(i18n.t(localeKeys.command.build.describe)).option('--analyze', i18n.t(localeKeys.command.
|
|
35
|
+
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 => {
|
|
37
36
|
const {
|
|
38
37
|
build
|
|
39
38
|
} = await import("./commands/build");
|
|
@@ -45,7 +44,7 @@ export default (() => ({
|
|
|
45
44
|
program.command('start').usage('[options]').description(i18n.t(localeKeys.command.start.describe)).option('--api-only', i18n.t(localeKeys.command.dev.apiOnly)).action(async () => {
|
|
46
45
|
await start(api);
|
|
47
46
|
});
|
|
48
|
-
program.command('deploy').usage('[options]').description(i18n.t(localeKeys.command.deploy.describe)).action(async options => {
|
|
47
|
+
program.command('deploy').usage('[options]').option('-c --config <config>', i18n.t(localeKeys.command.shared.config)).description(i18n.t(localeKeys.command.deploy.describe)).action(async options => {
|
|
49
48
|
const {
|
|
50
49
|
build
|
|
51
50
|
} = await import("./commands/build");
|
|
@@ -65,6 +64,12 @@ export default (() => ({
|
|
|
65
64
|
locale
|
|
66
65
|
}));
|
|
67
66
|
});
|
|
67
|
+
program.command('inspect').description('inspect internal webpack config').option(`--env <env>`, i18n.t(localeKeys.command.inspect.env), 'development').option('--output <output>', i18n.t(localeKeys.command.inspect.output), '/').option('--no-console', i18n.t(localeKeys.command.inspect.noConsole)).option('--verbose', i18n.t(localeKeys.command.inspect.verbose)).action(async options => {
|
|
68
|
+
const {
|
|
69
|
+
inspect
|
|
70
|
+
} = await import("./commands/inspect");
|
|
71
|
+
inspect(api, options);
|
|
72
|
+
});
|
|
68
73
|
},
|
|
69
74
|
|
|
70
75
|
// 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
|
|
@@ -87,7 +92,7 @@ export default (() => ({
|
|
|
87
92
|
},
|
|
88
93
|
|
|
89
94
|
async beforeRestart() {
|
|
90
|
-
cleanRequireCache([require.resolve('@modern-js/plugin-analyze/cli')
|
|
95
|
+
cleanRequireCache([require.resolve('@modern-js/plugin-analyze/cli')]);
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export const EN_LOCALE = {
|
|
2
2
|
command: {
|
|
3
|
+
shared: {
|
|
4
|
+
analyze: 'analyze bundle size',
|
|
5
|
+
config: 'specify config file'
|
|
6
|
+
},
|
|
3
7
|
dev: {
|
|
4
8
|
describe: 'start dev server',
|
|
5
|
-
config: 'specify config file',
|
|
6
9
|
entry: 'compiler by entry',
|
|
7
10
|
apiOnly: 'start api server only'
|
|
8
11
|
},
|
|
9
12
|
build: {
|
|
10
|
-
describe: 'build application'
|
|
11
|
-
analyze: 'analyze bundle'
|
|
13
|
+
describe: 'build application'
|
|
12
14
|
},
|
|
13
15
|
start: {
|
|
14
16
|
describe: 'start server'
|
|
@@ -22,6 +24,12 @@ export const EN_LOCALE = {
|
|
|
22
24
|
config: 'set default generator config(json string)',
|
|
23
25
|
distTag: `use specified tag version for it's generator`,
|
|
24
26
|
registry: 'set npm registry url to run npm command'
|
|
27
|
+
},
|
|
28
|
+
inspect: {
|
|
29
|
+
env: 'specify env mode',
|
|
30
|
+
output: 'specify inspect content output path',
|
|
31
|
+
noConsole: 'do not log the result in terminal',
|
|
32
|
+
verbose: 'show full function definitions in output'
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export const ZH_LOCALE = {
|
|
2
2
|
command: {
|
|
3
|
+
shared: {
|
|
4
|
+
analyze: '分析构建产物体积,查看各个模块打包后的大小',
|
|
5
|
+
config: '指定配置文件路径,可以为相对路径或绝对路径'
|
|
6
|
+
},
|
|
3
7
|
dev: {
|
|
4
8
|
describe: '本地开发命令',
|
|
5
|
-
|
|
6
|
-
entry: '按入口编译',
|
|
9
|
+
entry: '指定入口,编译特定的页面',
|
|
7
10
|
apiOnly: '仅启动 API 接口服务'
|
|
8
11
|
},
|
|
9
12
|
build: {
|
|
10
|
-
describe: '构建应用命令'
|
|
11
|
-
analyze: '分析构建产物体积,查看各个模块打包后的大小'
|
|
13
|
+
describe: '构建应用命令'
|
|
12
14
|
},
|
|
13
15
|
start: {
|
|
14
16
|
describe: '应用启动命令'
|
|
@@ -22,6 +24,12 @@ export const ZH_LOCALE = {
|
|
|
22
24
|
config: '生成器运行默认配置(JSON 字符串)',
|
|
23
25
|
distTag: '生成器使用特殊的 npm Tag 版本',
|
|
24
26
|
registry: '生成器运行过程中定制 npm Registry'
|
|
27
|
+
},
|
|
28
|
+
inspect: {
|
|
29
|
+
env: '查看指定环境下的配置',
|
|
30
|
+
output: '指定在 dist 目录下输出的路径',
|
|
31
|
+
noConsole: '不在终端中输出完整结果',
|
|
32
|
+
verbose: '在结果中展示函数的完整内容'
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { webpack } from '@modern-js/webpack';
|
|
2
2
|
import { chalk, logger, formatWebpackMessages, clearConsole } from '@modern-js/utils';
|
|
3
3
|
import { printInstructions } from "./printInstructions";
|
|
4
|
-
|
|
5
|
-
const prettyTime = stats => {
|
|
6
|
-
var _stats$children;
|
|
7
|
-
|
|
8
|
-
return Math.max(...(((_stats$children = stats.children) === null || _stats$children === void 0 ? void 0 : _stats$children.map(child => child.time || 0)) || []));
|
|
9
|
-
};
|
|
10
|
-
|
|
11
4
|
export const createCompiler = async ({
|
|
12
5
|
api,
|
|
13
6
|
webpackConfigs,
|
|
@@ -30,7 +23,6 @@ export const createCompiler = async ({
|
|
|
30
23
|
logger.log('Compiling...');
|
|
31
24
|
});
|
|
32
25
|
compiler.hooks.done.tap('done', async stats => {
|
|
33
|
-
clearConsole();
|
|
34
26
|
const statsData = stats.toJson({
|
|
35
27
|
all: false,
|
|
36
28
|
warnings: true,
|
|
@@ -53,8 +45,6 @@ export const createCompiler = async ({
|
|
|
53
45
|
logger.log(chalk.yellow(`Compiled with warnings.\n`));
|
|
54
46
|
logger.log(warnings.join('\n\n'));
|
|
55
47
|
logger.log();
|
|
56
|
-
} else {
|
|
57
|
-
logger.log(chalk.green(`Compiled successfully in ${prettyTime(statsData)} ms.\n`));
|
|
58
48
|
}
|
|
59
49
|
|
|
60
50
|
await printInstructions(hookRunners, appContext, userConfig);
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { prettyInstructions, logger
|
|
1
|
+
import { prettyInstructions, logger } from '@modern-js/utils';
|
|
2
2
|
export const printInstructions = async (hookRunners, appContext, config) => {
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
apiOnly
|
|
6
|
-
} = appContext;
|
|
7
|
-
|
|
8
|
-
if (isDev() && !apiOnly) {
|
|
9
|
-
message += `\n${chalk.cyanBright([`Note that the development build is not optimized.`, `To create a production build, execute build command.`].join('\n'))}`;
|
|
10
|
-
} // call beforePrintInstructions hook.
|
|
11
|
-
|
|
3
|
+
const message = prettyInstructions(appContext, config); // call beforePrintInstructions hook.
|
|
12
4
|
|
|
13
5
|
const {
|
|
14
6
|
instructions
|
|
@@ -7,6 +7,8 @@ exports.dev = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
10
|
+
var _core = require("@modern-js/core");
|
|
11
|
+
|
|
10
12
|
var _createCompiler = require("../utils/createCompiler");
|
|
11
13
|
|
|
12
14
|
var _createServer = require("../utils/createServer");
|
|
@@ -30,9 +32,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
30
32
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
33
|
|
|
32
34
|
const dev = async (api, options) => {
|
|
35
|
+
let userConfig = api.useResolvedConfigContext();
|
|
33
36
|
const appContext = api.useAppContext();
|
|
34
|
-
const userConfig = api.useResolvedConfigContext();
|
|
35
37
|
const hookRunners = api.useHookRunners();
|
|
38
|
+
|
|
39
|
+
_core.manager.run(() => {
|
|
40
|
+
userConfig = _objectSpread(_objectSpread({}, userConfig), {}, {
|
|
41
|
+
cliOptions: options
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
_core.ResolvedConfigContext.set(userConfig);
|
|
45
|
+
});
|
|
46
|
+
|
|
36
47
|
const {
|
|
37
48
|
appDirectory,
|
|
38
49
|
distDirectory,
|
|
@@ -81,10 +92,7 @@ const dev = async (api, options) => {
|
|
|
81
92
|
dev: _objectSpread(_objectSpread({}, {
|
|
82
93
|
client: {
|
|
83
94
|
port: port.toString(),
|
|
84
|
-
|
|
85
|
-
logging: 'none',
|
|
86
|
-
path: _utils.HMR_SOCK_PATH,
|
|
87
|
-
host: 'localhost'
|
|
95
|
+
logging: 'none'
|
|
88
96
|
},
|
|
89
97
|
devMiddleware: {
|
|
90
98
|
writeToDisk: file => !file.includes('.hot-update.')
|
|
@@ -109,7 +117,6 @@ const dev = async (api, options) => {
|
|
|
109
117
|
return (0, _printInstructions.printInstructions)(hookRunners, appContext, userConfig);
|
|
110
118
|
}
|
|
111
119
|
|
|
112
|
-
(0, _utils.clearConsole)();
|
|
113
120
|
return _utils.logger.log(_utils.chalk.cyan(`Starting the development server...`));
|
|
114
121
|
});
|
|
115
122
|
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.printInspectResult = exports.inspect = exports.getTagByWebpackTarget = exports.formatWebpackConfig = void 0;
|
|
7
|
+
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
10
|
+
var _webpack = require("@modern-js/webpack");
|
|
11
|
+
|
|
12
|
+
var _utils = require("@modern-js/utils");
|
|
13
|
+
|
|
14
|
+
var _webpackChain = _interopRequireDefault(require("@modern-js/utils/webpack-chain"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const formatWebpackConfig = (config, verbose) => {
|
|
19
|
+
const stringify = _webpackChain.default.toString;
|
|
20
|
+
return `module.exports = ${stringify(config, {
|
|
21
|
+
verbose
|
|
22
|
+
})};`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.formatWebpackConfig = formatWebpackConfig;
|
|
26
|
+
|
|
27
|
+
const inspect = (api, options) => {
|
|
28
|
+
process.env.NODE_ENV = options.env;
|
|
29
|
+
const resolvedConfig = api.useResolvedConfigContext();
|
|
30
|
+
const appContext = api.useAppContext();
|
|
31
|
+
const outputFiles = [];
|
|
32
|
+
outputFiles.push(printInspectResult(_webpack.WebpackConfigTarget.CLIENT, appContext, resolvedConfig, options));
|
|
33
|
+
|
|
34
|
+
if (resolvedConfig.output.enableModernMode) {
|
|
35
|
+
outputFiles.push(printInspectResult(_webpack.WebpackConfigTarget.MODERN, appContext, resolvedConfig, options));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ((0, _utils.isUseSSRBundle)(resolvedConfig)) {
|
|
39
|
+
outputFiles.push(printInspectResult(_webpack.WebpackConfigTarget.NODE, appContext, resolvedConfig, options));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_utils.signale.success('Inspect succeed, you can open following files to view the full webpack config: \n');
|
|
43
|
+
|
|
44
|
+
outputFiles.forEach(file => {
|
|
45
|
+
_utils.signale.log(` - ${_utils.chalk.yellow(_path.default.relative(appContext.appDirectory, file))}`);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
_utils.signale.log();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.inspect = inspect;
|
|
52
|
+
|
|
53
|
+
const getTagByWebpackTarget = webpackTarget => {
|
|
54
|
+
switch (webpackTarget) {
|
|
55
|
+
case _webpack.WebpackConfigTarget.CLIENT:
|
|
56
|
+
return 'client';
|
|
57
|
+
|
|
58
|
+
case _webpack.WebpackConfigTarget.MODERN:
|
|
59
|
+
return 'modern';
|
|
60
|
+
|
|
61
|
+
case _webpack.WebpackConfigTarget.NODE:
|
|
62
|
+
return 'ssr';
|
|
63
|
+
|
|
64
|
+
default:
|
|
65
|
+
throw Error(`Unsupported webpack target: ${webpackTarget}`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.getTagByWebpackTarget = getTagByWebpackTarget;
|
|
70
|
+
|
|
71
|
+
const printInspectResult = (webpackTarget, appContext, resolvedConfig, options) => {
|
|
72
|
+
const webpackConfig = (0, _webpack.getWebpackConfig)(webpackTarget, appContext, resolvedConfig);
|
|
73
|
+
const {
|
|
74
|
+
output,
|
|
75
|
+
verbose,
|
|
76
|
+
console = true
|
|
77
|
+
} = options;
|
|
78
|
+
const outputPath = output ? _path.default.posix.join(appContext.distDirectory, output) : appContext.distDirectory;
|
|
79
|
+
const tag = getTagByWebpackTarget(webpackTarget);
|
|
80
|
+
const outputFile = `webpack.${tag}.inspect.js`;
|
|
81
|
+
|
|
82
|
+
const outputFilePath = _path.default.posix.join(outputPath, outputFile);
|
|
83
|
+
|
|
84
|
+
const rawWebpackConfig = formatWebpackConfig(webpackConfig, verbose);
|
|
85
|
+
|
|
86
|
+
_utils.fs.outputFileSync(outputFilePath, rawWebpackConfig);
|
|
87
|
+
|
|
88
|
+
if (console) {
|
|
89
|
+
_utils.logger.log(`
|
|
90
|
+
webpack config for ${tag} build:
|
|
91
|
+
${rawWebpackConfig}
|
|
92
|
+
`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return outputFilePath;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.printInspectResult = printInspectResult;
|
package/dist/js/node/index.js
CHANGED
|
@@ -17,8 +17,6 @@ var _core = require("@modern-js/core");
|
|
|
17
17
|
|
|
18
18
|
var _pluginAnalyze = _interopRequireDefault(require("@modern-js/plugin-analyze"));
|
|
19
19
|
|
|
20
|
-
var _cli = _interopRequireDefault(require("@modern-js/plugin-fast-refresh/cli"));
|
|
21
|
-
|
|
22
20
|
var _utils = require("@modern-js/utils");
|
|
23
21
|
|
|
24
22
|
var _hooks = require("./hooks");
|
|
@@ -47,9 +45,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
47
45
|
|
|
48
46
|
var _default = () => ({
|
|
49
47
|
name: '@modern-js/app-tools',
|
|
50
|
-
post: ['@modern-js/plugin-analyze', '@modern-js/plugin-
|
|
48
|
+
post: ['@modern-js/plugin-analyze', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-router', '@modern-js/plugin-polyfill'],
|
|
51
49
|
registerHook: _hooks.hooks,
|
|
52
|
-
usePlugins: [(0, _pluginAnalyze.default)()
|
|
50
|
+
usePlugins: [(0, _pluginAnalyze.default)()],
|
|
53
51
|
setup: api => {
|
|
54
52
|
const locale = (0, _language.getLocaleLanguage)();
|
|
55
53
|
|
|
@@ -61,10 +59,10 @@ var _default = () => ({
|
|
|
61
59
|
commands({
|
|
62
60
|
program
|
|
63
61
|
}) {
|
|
64
|
-
program.command('dev').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.dev.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.
|
|
62
|
+
program.command('dev').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.dev.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).option('-e --entry [entry...]', _locale.i18n.t(_locale.localeKeys.command.dev.entry)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.shared.analyze)).option('--api-only', _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).action(async options => {
|
|
65
63
|
await (0, _dev.dev)(api, options);
|
|
66
64
|
});
|
|
67
|
-
program.command('build').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.build.describe)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.
|
|
65
|
+
program.command('build').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.build.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.shared.analyze)).action(async options => {
|
|
68
66
|
const {
|
|
69
67
|
build
|
|
70
68
|
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/build")));
|
|
@@ -76,7 +74,7 @@ var _default = () => ({
|
|
|
76
74
|
program.command('start').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.start.describe)).option('--api-only', _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).action(async () => {
|
|
77
75
|
await (0, _start.start)(api);
|
|
78
76
|
});
|
|
79
|
-
program.command('deploy').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async options => {
|
|
77
|
+
program.command('deploy').usage('[options]').option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async options => {
|
|
80
78
|
const {
|
|
81
79
|
build
|
|
82
80
|
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/build")));
|
|
@@ -96,6 +94,12 @@ var _default = () => ({
|
|
|
96
94
|
locale
|
|
97
95
|
}));
|
|
98
96
|
});
|
|
97
|
+
program.command('inspect').description('inspect internal webpack config').option(`--env <env>`, _locale.i18n.t(_locale.localeKeys.command.inspect.env), 'development').option('--output <output>', _locale.i18n.t(_locale.localeKeys.command.inspect.output), '/').option('--no-console', _locale.i18n.t(_locale.localeKeys.command.inspect.noConsole)).option('--verbose', _locale.i18n.t(_locale.localeKeys.command.inspect.verbose)).action(async options => {
|
|
98
|
+
const {
|
|
99
|
+
inspect
|
|
100
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/inspect")));
|
|
101
|
+
inspect(api, options);
|
|
102
|
+
});
|
|
99
103
|
},
|
|
100
104
|
|
|
101
105
|
// 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
|
|
@@ -118,7 +122,7 @@ var _default = () => ({
|
|
|
118
122
|
},
|
|
119
123
|
|
|
120
124
|
async beforeRestart() {
|
|
121
|
-
(0, _utils.cleanRequireCache)([require.resolve('@modern-js/plugin-analyze/cli')
|
|
125
|
+
(0, _utils.cleanRequireCache)([require.resolve('@modern-js/plugin-analyze/cli')]);
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
};
|
|
@@ -6,15 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.EN_LOCALE = void 0;
|
|
7
7
|
const EN_LOCALE = {
|
|
8
8
|
command: {
|
|
9
|
+
shared: {
|
|
10
|
+
analyze: 'analyze bundle size',
|
|
11
|
+
config: 'specify config file'
|
|
12
|
+
},
|
|
9
13
|
dev: {
|
|
10
14
|
describe: 'start dev server',
|
|
11
|
-
config: 'specify config file',
|
|
12
15
|
entry: 'compiler by entry',
|
|
13
16
|
apiOnly: 'start api server only'
|
|
14
17
|
},
|
|
15
18
|
build: {
|
|
16
|
-
describe: 'build application'
|
|
17
|
-
analyze: 'analyze bundle'
|
|
19
|
+
describe: 'build application'
|
|
18
20
|
},
|
|
19
21
|
start: {
|
|
20
22
|
describe: 'start server'
|
|
@@ -28,6 +30,12 @@ const EN_LOCALE = {
|
|
|
28
30
|
config: 'set default generator config(json string)',
|
|
29
31
|
distTag: `use specified tag version for it's generator`,
|
|
30
32
|
registry: 'set npm registry url to run npm command'
|
|
33
|
+
},
|
|
34
|
+
inspect: {
|
|
35
|
+
env: 'specify env mode',
|
|
36
|
+
output: 'specify inspect content output path',
|
|
37
|
+
noConsole: 'do not log the result in terminal',
|
|
38
|
+
verbose: 'show full function definitions in output'
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
};
|
|
@@ -6,15 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ZH_LOCALE = void 0;
|
|
7
7
|
const ZH_LOCALE = {
|
|
8
8
|
command: {
|
|
9
|
+
shared: {
|
|
10
|
+
analyze: '分析构建产物体积,查看各个模块打包后的大小',
|
|
11
|
+
config: '指定配置文件路径,可以为相对路径或绝对路径'
|
|
12
|
+
},
|
|
9
13
|
dev: {
|
|
10
14
|
describe: '本地开发命令',
|
|
11
|
-
|
|
12
|
-
entry: '按入口编译',
|
|
15
|
+
entry: '指定入口,编译特定的页面',
|
|
13
16
|
apiOnly: '仅启动 API 接口服务'
|
|
14
17
|
},
|
|
15
18
|
build: {
|
|
16
|
-
describe: '构建应用命令'
|
|
17
|
-
analyze: '分析构建产物体积,查看各个模块打包后的大小'
|
|
19
|
+
describe: '构建应用命令'
|
|
18
20
|
},
|
|
19
21
|
start: {
|
|
20
22
|
describe: '应用启动命令'
|
|
@@ -28,6 +30,12 @@ const ZH_LOCALE = {
|
|
|
28
30
|
config: '生成器运行默认配置(JSON 字符串)',
|
|
29
31
|
distTag: '生成器使用特殊的 npm Tag 版本',
|
|
30
32
|
registry: '生成器运行过程中定制 npm Registry'
|
|
33
|
+
},
|
|
34
|
+
inspect: {
|
|
35
|
+
env: '查看指定环境下的配置',
|
|
36
|
+
output: '指定在 dist 目录下输出的路径',
|
|
37
|
+
noConsole: '不在终端中输出完整结果',
|
|
38
|
+
verbose: '在结果中展示函数的完整内容'
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
};
|
|
@@ -11,12 +11,6 @@ var _utils = require("@modern-js/utils");
|
|
|
11
11
|
|
|
12
12
|
var _printInstructions = require("./printInstructions");
|
|
13
13
|
|
|
14
|
-
const prettyTime = stats => {
|
|
15
|
-
var _stats$children;
|
|
16
|
-
|
|
17
|
-
return Math.max(...(((_stats$children = stats.children) === null || _stats$children === void 0 ? void 0 : _stats$children.map(child => child.time || 0)) || []));
|
|
18
|
-
};
|
|
19
|
-
|
|
20
14
|
const createCompiler = async ({
|
|
21
15
|
api,
|
|
22
16
|
webpackConfigs,
|
|
@@ -40,7 +34,6 @@ const createCompiler = async ({
|
|
|
40
34
|
_utils.logger.log('Compiling...');
|
|
41
35
|
});
|
|
42
36
|
compiler.hooks.done.tap('done', async stats => {
|
|
43
|
-
(0, _utils.clearConsole)();
|
|
44
37
|
const statsData = stats.toJson({
|
|
45
38
|
all: false,
|
|
46
39
|
warnings: true,
|
|
@@ -67,8 +60,6 @@ const createCompiler = async ({
|
|
|
67
60
|
_utils.logger.log(warnings.join('\n\n'));
|
|
68
61
|
|
|
69
62
|
_utils.logger.log();
|
|
70
|
-
} else {
|
|
71
|
-
_utils.logger.log(_utils.chalk.green(`Compiled successfully in ${prettyTime(statsData)} ms.\n`));
|
|
72
63
|
}
|
|
73
64
|
|
|
74
65
|
await (0, _printInstructions.printInstructions)(hookRunners, appContext, userConfig);
|
|
@@ -8,15 +8,7 @@ exports.printInstructions = void 0;
|
|
|
8
8
|
var _utils = require("@modern-js/utils");
|
|
9
9
|
|
|
10
10
|
const printInstructions = async (hookRunners, appContext, config) => {
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
apiOnly
|
|
14
|
-
} = appContext;
|
|
15
|
-
|
|
16
|
-
if ((0, _utils.isDev)() && !apiOnly) {
|
|
17
|
-
message += `\n${_utils.chalk.cyanBright([`Note that the development build is not optimized.`, `To create a production build, execute build command.`].join('\n'))}`;
|
|
18
|
-
} // call beforePrintInstructions hook.
|
|
19
|
-
|
|
11
|
+
const message = (0, _utils.prettyInstructions)(appContext, config); // call beforePrintInstructions hook.
|
|
20
12
|
|
|
21
13
|
const {
|
|
22
14
|
instructions
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Configuration, WebpackConfigTarget } from '@modern-js/webpack';
|
|
2
|
+
import type { PluginAPI, NormalizedConfig, IAppContext } from '@modern-js/core';
|
|
3
|
+
import type { InspectOptions } from '../utils/types';
|
|
4
|
+
export declare const formatWebpackConfig: (config: Configuration, verbose?: boolean | undefined) => string;
|
|
5
|
+
export declare const inspect: (api: PluginAPI, options: InspectOptions) => void;
|
|
6
|
+
export declare const getTagByWebpackTarget: (webpackTarget: WebpackConfigTarget) => "modern" | "client" | "ssr";
|
|
7
|
+
export declare const printInspectResult: (webpackTarget: WebpackConfigTarget, appContext: IAppContext, resolvedConfig: NormalizedConfig, options: InspectOptions) => string;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export declare const EN_LOCALE: {
|
|
2
2
|
command: {
|
|
3
|
+
shared: {
|
|
4
|
+
analyze: string;
|
|
5
|
+
config: string;
|
|
6
|
+
};
|
|
3
7
|
dev: {
|
|
4
8
|
describe: string;
|
|
5
|
-
config: string;
|
|
6
9
|
entry: string;
|
|
7
10
|
apiOnly: string;
|
|
8
11
|
};
|
|
9
12
|
build: {
|
|
10
13
|
describe: string;
|
|
11
|
-
analyze: string;
|
|
12
14
|
};
|
|
13
15
|
start: {
|
|
14
16
|
describe: string;
|
|
@@ -23,5 +25,11 @@ export declare const EN_LOCALE: {
|
|
|
23
25
|
distTag: string;
|
|
24
26
|
registry: string;
|
|
25
27
|
};
|
|
28
|
+
inspect: {
|
|
29
|
+
env: string;
|
|
30
|
+
output: string;
|
|
31
|
+
noConsole: string;
|
|
32
|
+
verbose: string;
|
|
33
|
+
};
|
|
26
34
|
};
|
|
27
35
|
};
|
|
@@ -2,15 +2,17 @@ import { I18n } from '@modern-js/plugin-i18n';
|
|
|
2
2
|
declare const i18n: I18n;
|
|
3
3
|
declare const localeKeys: {
|
|
4
4
|
command: {
|
|
5
|
+
shared: {
|
|
6
|
+
analyze: string;
|
|
7
|
+
config: string;
|
|
8
|
+
};
|
|
5
9
|
dev: {
|
|
6
10
|
describe: string;
|
|
7
|
-
config: string;
|
|
8
11
|
entry: string;
|
|
9
12
|
apiOnly: string;
|
|
10
13
|
};
|
|
11
14
|
build: {
|
|
12
15
|
describe: string;
|
|
13
|
-
analyze: string;
|
|
14
16
|
};
|
|
15
17
|
start: {
|
|
16
18
|
describe: string;
|
|
@@ -25,18 +27,26 @@ declare const localeKeys: {
|
|
|
25
27
|
distTag: string;
|
|
26
28
|
registry: string;
|
|
27
29
|
};
|
|
30
|
+
inspect: {
|
|
31
|
+
env: string;
|
|
32
|
+
output: string;
|
|
33
|
+
noConsole: string;
|
|
34
|
+
verbose: string;
|
|
35
|
+
};
|
|
28
36
|
};
|
|
29
37
|
} | {
|
|
30
38
|
command: {
|
|
39
|
+
shared: {
|
|
40
|
+
analyze: string;
|
|
41
|
+
config: string;
|
|
42
|
+
};
|
|
31
43
|
dev: {
|
|
32
44
|
describe: string;
|
|
33
|
-
config: string;
|
|
34
45
|
entry: string;
|
|
35
46
|
apiOnly: string;
|
|
36
47
|
};
|
|
37
48
|
build: {
|
|
38
49
|
describe: string;
|
|
39
|
-
analyze: string;
|
|
40
50
|
};
|
|
41
51
|
start: {
|
|
42
52
|
describe: string;
|
|
@@ -51,6 +61,12 @@ declare const localeKeys: {
|
|
|
51
61
|
distTag: string;
|
|
52
62
|
registry: string;
|
|
53
63
|
};
|
|
64
|
+
inspect: {
|
|
65
|
+
env: string;
|
|
66
|
+
output: string;
|
|
67
|
+
noConsole: string;
|
|
68
|
+
verbose: string;
|
|
69
|
+
};
|
|
54
70
|
};
|
|
55
71
|
};
|
|
56
72
|
export { i18n, localeKeys };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export declare const ZH_LOCALE: {
|
|
2
2
|
command: {
|
|
3
|
+
shared: {
|
|
4
|
+
analyze: string;
|
|
5
|
+
config: string;
|
|
6
|
+
};
|
|
3
7
|
dev: {
|
|
4
8
|
describe: string;
|
|
5
|
-
config: string;
|
|
6
9
|
entry: string;
|
|
7
10
|
apiOnly: string;
|
|
8
11
|
};
|
|
9
12
|
build: {
|
|
10
13
|
describe: string;
|
|
11
|
-
analyze: string;
|
|
12
14
|
};
|
|
13
15
|
start: {
|
|
14
16
|
describe: string;
|
|
@@ -23,5 +25,11 @@ export declare const ZH_LOCALE: {
|
|
|
23
25
|
distTag: string;
|
|
24
26
|
registry: string;
|
|
25
27
|
};
|
|
28
|
+
inspect: {
|
|
29
|
+
env: string;
|
|
30
|
+
output: string;
|
|
31
|
+
noConsole: string;
|
|
32
|
+
verbose: string;
|
|
33
|
+
};
|
|
26
34
|
};
|
|
27
35
|
};
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
export declare type DevOptions = {
|
|
2
2
|
entry?: string[] | boolean;
|
|
3
|
+
config?: string;
|
|
3
4
|
apiOnly?: boolean;
|
|
5
|
+
analyze?: boolean;
|
|
4
6
|
};
|
|
5
7
|
export declare type BuildOptions = {
|
|
8
|
+
config?: string;
|
|
6
9
|
analyze?: boolean;
|
|
7
10
|
};
|
|
11
|
+
export declare type DeployOptions = {
|
|
12
|
+
config?: string;
|
|
13
|
+
};
|
|
8
14
|
export declare type StartOptions = {
|
|
9
15
|
apiOnly?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare type InspectOptions = {
|
|
18
|
+
env?: string;
|
|
19
|
+
output?: string;
|
|
20
|
+
console?: boolean;
|
|
21
|
+
verbose?: boolean;
|
|
10
22
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.6.
|
|
14
|
+
"version": "1.6.7",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -56,20 +56,19 @@
|
|
|
56
56
|
"modern": "./bin/modern.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@babel/runtime": "^7",
|
|
60
|
-
"@modern-js/core": "^1.
|
|
61
|
-
"@modern-js/i18n-cli-language-detector": "^1.2.
|
|
62
|
-
"@modern-js/new-action": "^1.3.
|
|
63
|
-
"@modern-js/node-bundle-require": "^1.3.
|
|
64
|
-
"@modern-js/plugin": "^1.3.
|
|
65
|
-
"@modern-js/plugin-analyze": "^1.4.
|
|
66
|
-
"@modern-js/plugin-
|
|
67
|
-
"@modern-js/
|
|
68
|
-
"@modern-js/
|
|
69
|
-
"@modern-js/
|
|
70
|
-
"@modern-js/
|
|
71
|
-
"@modern-js/
|
|
72
|
-
"@modern-js/webpack": "^1.7.0"
|
|
59
|
+
"@babel/runtime": "^7.18.0",
|
|
60
|
+
"@modern-js/core": "^1.12.0",
|
|
61
|
+
"@modern-js/i18n-cli-language-detector": "^1.2.4",
|
|
62
|
+
"@modern-js/new-action": "^1.3.10",
|
|
63
|
+
"@modern-js/node-bundle-require": "^1.3.5",
|
|
64
|
+
"@modern-js/plugin": "^1.3.7",
|
|
65
|
+
"@modern-js/plugin-analyze": "^1.4.6",
|
|
66
|
+
"@modern-js/plugin-i18n": "^1.2.7",
|
|
67
|
+
"@modern-js/prod-server": "^1.1.8",
|
|
68
|
+
"@modern-js/server": "^1.4.20",
|
|
69
|
+
"@modern-js/types": "^1.5.4",
|
|
70
|
+
"@modern-js/utils": "^1.7.7",
|
|
71
|
+
"@modern-js/webpack": "^1.11.0"
|
|
73
72
|
},
|
|
74
73
|
"devDependencies": {
|
|
75
74
|
"@modern-js/server-core": "1.3.5",
|
|
@@ -104,7 +103,8 @@
|
|
|
104
103
|
"files": [
|
|
105
104
|
"src/**/*",
|
|
106
105
|
"tsconfig.json",
|
|
107
|
-
"package.json"
|
|
106
|
+
"package.json",
|
|
107
|
+
"tests/**/*"
|
|
108
108
|
],
|
|
109
109
|
"output": []
|
|
110
110
|
}
|