@modern-js/app-tools 2.0.0-beta.0 → 2.0.0-beta.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.
- package/CHANGELOG.md +375 -0
- package/dist/js/modern/analyze/generateCode.js +30 -38
- package/dist/js/modern/analyze/getBundleEntry.js +5 -13
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +5 -30
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +5 -30
- package/dist/js/modern/analyze/getClientRoutes/utils.js +0 -3
- package/dist/js/modern/analyze/getFileSystemEntry.js +5 -18
- package/dist/js/modern/analyze/getHtmlTemplate.js +3 -10
- package/dist/js/modern/analyze/getServerRoutes.js +25 -38
- package/dist/js/modern/analyze/index.js +90 -48
- package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -4
- package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -2
- package/dist/js/modern/analyze/nestedRoutes.js +8 -33
- package/dist/js/modern/analyze/templates.js +22 -37
- package/dist/js/modern/analyze/utils.js +0 -7
- package/dist/js/modern/builder/builderPlugins/compatModern.js +41 -58
- package/dist/js/modern/builder/index.js +56 -37
- package/dist/js/modern/builder/share.js +1 -5
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -8
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +2 -13
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +97 -0
- package/dist/js/modern/commands/build.js +12 -46
- package/dist/js/modern/commands/dev.js +20 -23
- package/dist/js/modern/commands/inspect.js +4 -19
- package/dist/js/modern/commands/start.js +1 -2
- package/dist/js/modern/config/default.js +207 -0
- package/dist/js/modern/config/index.js +2 -0
- package/dist/js/modern/config/initial/createHtmlConfig.js +32 -0
- package/dist/js/modern/{builder → config/initial}/createOutputConfig.js +19 -18
- package/dist/js/modern/config/initial/createSourceConfig.js +32 -0
- package/dist/js/modern/config/initial/createToolsConfig.js +41 -0
- package/dist/js/modern/config/initial/index.js +11 -0
- package/dist/js/modern/config/initial/inits.js +117 -0
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +40 -0
- package/dist/js/modern/defineConfig.js +12 -0
- package/dist/js/modern/hooks.js +23 -19
- package/dist/js/modern/index.js +12 -19
- package/dist/js/modern/initialize/index.js +72 -0
- package/dist/js/modern/schema/Schema.js +39 -0
- package/dist/js/modern/schema/index.js +139 -0
- package/dist/js/modern/schema/legacy.js +284 -0
- package/dist/js/modern/types/config/deploy.js +0 -0
- package/dist/js/modern/types/config/dev.js +0 -0
- package/dist/js/modern/types/config/experiments.js +0 -0
- package/dist/js/modern/types/config/html.js +0 -0
- package/dist/js/modern/types/config/index.js +2 -0
- package/dist/js/modern/types/config/output.js +0 -0
- package/dist/js/modern/types/config/performance.js +0 -0
- package/dist/js/modern/types/config/security.js +0 -0
- package/dist/js/modern/types/config/source.js +0 -0
- package/dist/js/modern/types/config/tools.js +0 -0
- package/dist/js/modern/types/hooks.js +0 -0
- package/dist/js/modern/types/index.js +4 -0
- package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
- package/dist/js/modern/types/legacyConfig/dev.js +0 -0
- package/dist/js/modern/types/legacyConfig/index.js +0 -0
- package/dist/js/modern/types/legacyConfig/output.js +1 -0
- package/dist/js/modern/types/legacyConfig/source.js +0 -0
- package/dist/js/modern/types/legacyConfig/tools.js +0 -0
- package/dist/js/modern/utils/config.js +2 -13
- package/dist/js/modern/utils/createFileWatcher.js +82 -0
- package/dist/js/modern/utils/createServer.js +0 -5
- package/dist/js/modern/utils/getSpecifiedEntries.js +0 -6
- package/dist/js/modern/utils/printInstructions.js +2 -1
- package/dist/js/modern/utils/restart.js +17 -0
- package/dist/js/modern/utils/routes.js +0 -2
- package/dist/js/node/analyze/generateCode.js +30 -61
- package/dist/js/node/analyze/getBundleEntry.js +5 -19
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +5 -45
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +5 -45
- package/dist/js/node/analyze/getClientRoutes/index.js +0 -2
- package/dist/js/node/analyze/getClientRoutes/utils.js +0 -14
- package/dist/js/node/analyze/getFileSystemEntry.js +5 -26
- package/dist/js/node/analyze/getHtmlTemplate.js +3 -24
- package/dist/js/node/analyze/getServerRoutes.js +24 -46
- package/dist/js/node/analyze/index.js +91 -70
- package/dist/js/node/analyze/isDefaultExportFunction.js +0 -12
- package/dist/js/node/analyze/makeLegalIdentifier.js +0 -4
- package/dist/js/node/analyze/nestedRoutes.js +8 -41
- package/dist/js/node/analyze/templates.js +22 -47
- package/dist/js/node/analyze/utils.js +0 -20
- package/dist/js/node/builder/builderPlugins/compatModern.js +41 -69
- package/dist/js/node/builder/index.js +57 -51
- package/dist/js/node/builder/share.js +1 -13
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -10
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +2 -15
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +105 -0
- package/dist/js/node/commands/build.js +10 -57
- package/dist/js/node/commands/deploy.js +0 -2
- package/dist/js/node/commands/dev.js +19 -34
- package/dist/js/node/commands/index.js +0 -6
- package/dist/js/node/commands/inspect.js +4 -26
- package/dist/js/node/commands/start.js +1 -11
- package/dist/js/node/config/default.js +214 -0
- package/dist/js/node/config/index.js +31 -0
- package/dist/js/node/config/initial/createHtmlConfig.js +38 -0
- package/dist/js/node/{builder → config/initial}/createOutputConfig.js +19 -20
- package/dist/js/node/config/initial/createSourceConfig.js +38 -0
- package/dist/js/node/config/initial/createToolsConfig.js +47 -0
- package/dist/js/node/config/initial/index.js +24 -0
- package/dist/js/node/config/initial/inits.js +127 -0
- package/dist/js/node/config/initial/transformNormalizedConfig.js +46 -0
- package/dist/js/node/defineConfig.js +20 -0
- package/dist/js/node/exports/server.js +0 -1
- package/dist/js/node/hooks.js +23 -30
- package/dist/js/node/index.js +35 -48
- package/dist/js/node/initialize/index.js +79 -0
- package/dist/js/node/locale/index.js +0 -4
- package/dist/js/node/schema/Schema.js +46 -0
- package/dist/js/node/schema/index.js +152 -0
- package/dist/js/node/schema/legacy.js +291 -0
- package/dist/js/node/types/config/deploy.js +0 -0
- package/dist/js/node/types/config/dev.js +0 -0
- package/dist/js/node/types/config/experiments.js +0 -0
- package/dist/js/node/types/config/html.js +0 -0
- package/dist/js/node/types/config/index.js +16 -0
- package/dist/js/node/types/config/output.js +0 -0
- package/dist/js/node/types/config/performance.js +0 -0
- package/dist/js/node/types/config/security.js +0 -0
- package/dist/js/node/types/config/source.js +0 -0
- package/dist/js/node/types/config/tools.js +0 -0
- package/dist/js/node/types/hooks.js +0 -0
- package/dist/js/node/types/index.js +38 -0
- package/dist/js/node/types/legacyConfig/deploy.js +0 -0
- package/dist/js/node/types/legacyConfig/dev.js +0 -0
- package/dist/js/node/types/legacyConfig/index.js +0 -0
- package/dist/js/node/types/legacyConfig/output.js +5 -0
- package/dist/js/node/types/legacyConfig/source.js +0 -0
- package/dist/js/node/types/legacyConfig/tools.js +0 -0
- package/dist/js/node/utils/commands.js +0 -2
- package/dist/js/node/utils/config.js +2 -26
- package/dist/js/node/utils/createFileWatcher.js +90 -0
- package/dist/js/node/utils/createServer.js +0 -15
- package/dist/js/node/utils/getSpecifiedEntries.js +0 -9
- package/dist/js/node/utils/language.js +0 -2
- package/dist/js/node/utils/printInstructions.js +2 -5
- package/dist/js/node/utils/restart.js +23 -0
- package/dist/js/node/utils/routes.js +0 -5
- package/dist/js/treeshaking/analyze/generateCode.js +58 -101
- package/dist/js/treeshaking/analyze/getBundleEntry.js +12 -20
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +16 -42
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +16 -42
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -3
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +5 -18
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +3 -27
- package/dist/js/treeshaking/analyze/getServerRoutes.js +29 -41
- package/dist/js/treeshaking/analyze/index.js +195 -91
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -4
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -2
- package/dist/js/treeshaking/analyze/nestedRoutes.js +9 -51
- package/dist/js/treeshaking/analyze/templates.js +31 -50
- package/dist/js/treeshaking/analyze/utils.js +7 -14
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +50 -68
- package/dist/js/treeshaking/builder/index.js +69 -65
- package/dist/js/treeshaking/builder/share.js +1 -5
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +1 -13
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +2 -14
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +121 -0
- package/dist/js/treeshaking/commands/build.js +41 -116
- package/dist/js/treeshaking/commands/deploy.js +0 -3
- package/dist/js/treeshaking/commands/dev.js +38 -46
- package/dist/js/treeshaking/commands/inspect.js +9 -27
- package/dist/js/treeshaking/commands/start.js +1 -9
- package/dist/js/treeshaking/config/default.js +200 -0
- package/dist/js/treeshaking/config/index.js +2 -0
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +31 -0
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +67 -0
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -0
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +38 -0
- package/dist/js/treeshaking/config/initial/index.js +11 -0
- package/dist/js/treeshaking/config/initial/inits.js +114 -0
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +38 -0
- package/dist/js/treeshaking/defineConfig.js +14 -0
- package/dist/js/treeshaking/hooks.js +23 -19
- package/dist/js/treeshaking/index.js +8 -43
- package/dist/js/treeshaking/initialize/index.js +121 -0
- package/dist/js/treeshaking/schema/Schema.js +75 -0
- package/dist/js/treeshaking/schema/index.js +138 -0
- package/dist/js/treeshaking/schema/legacy.js +273 -0
- package/dist/js/treeshaking/types/config/deploy.js +0 -0
- package/dist/js/treeshaking/types/config/dev.js +0 -0
- package/dist/js/treeshaking/types/config/experiments.js +0 -0
- package/dist/js/treeshaking/types/config/html.js +0 -0
- package/dist/js/treeshaking/types/config/index.js +2 -0
- package/dist/js/treeshaking/types/config/output.js +0 -0
- package/dist/js/treeshaking/types/config/performance.js +0 -0
- package/dist/js/treeshaking/types/config/security.js +0 -0
- package/dist/js/treeshaking/types/config/source.js +0 -0
- package/dist/js/treeshaking/types/config/tools.js +0 -0
- package/dist/js/treeshaking/types/hooks.js +0 -0
- package/dist/js/treeshaking/types/index.js +4 -0
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/source.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -0
- package/dist/js/treeshaking/utils/config.js +2 -18
- package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
- package/dist/js/treeshaking/utils/createServer.js +0 -10
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +0 -10
- package/dist/js/treeshaking/utils/printInstructions.js +0 -5
- package/dist/js/treeshaking/utils/restart.js +45 -0
- package/dist/js/treeshaking/utils/routes.js +0 -4
- package/dist/types/analyze/generateCode.d.ts +3 -2
- package/dist/types/analyze/getBundleEntry.d.ts +2 -2
- package/dist/types/analyze/getFileSystemEntry.d.ts +2 -2
- package/dist/types/analyze/getHtmlTemplate.d.ts +3 -3
- package/dist/types/analyze/getServerRoutes.d.ts +3 -2
- package/dist/types/analyze/index.d.ts +3 -42
- package/dist/types/analyze/nestedRoutes.d.ts +1 -1
- package/dist/types/analyze/templates.d.ts +4 -2
- package/dist/types/analyze/utils.d.ts +1 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -3
- package/dist/types/builder/index.d.ts +7 -8
- package/dist/types/builder/share.d.ts +2 -2
- package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +10 -0
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/deploy.d.ts +2 -2
- package/dist/types/commands/dev.d.ts +2 -2
- package/dist/types/commands/inspect.d.ts +6 -1
- package/dist/types/commands/start.d.ts +2 -2
- package/dist/types/config/default.d.ts +3 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/initial/createHtmlConfig.d.ts +2 -0
- package/dist/types/config/initial/createOutputConfig.d.ts +2 -0
- package/dist/types/config/initial/createSourceConfig.d.ts +2 -0
- package/dist/types/config/initial/createToolsConfig.d.ts +2 -0
- package/dist/types/config/initial/index.d.ts +4 -0
- package/dist/types/config/initial/inits.d.ts +4 -0
- package/dist/types/config/initial/transformNormalizedConfig.d.ts +2 -0
- package/dist/types/defineConfig.d.ts +7 -0
- package/dist/types/hooks.d.ts +2 -42
- package/dist/types/index.d.ts +5 -7
- package/dist/types/initialize/index.d.ts +3 -0
- package/dist/types/schema/Schema.d.ts +14 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/dist/types/schema/legacy.d.ts +3 -0
- package/dist/types/types/config/deploy.d.ts +9 -0
- package/dist/types/types/config/dev.d.ts +13 -0
- package/dist/types/types/config/experiments.d.ts +4 -0
- package/dist/types/types/config/html.d.ts +4 -0
- package/dist/types/types/config/index.d.ts +62 -0
- package/dist/types/types/config/output.d.ts +23 -0
- package/dist/types/types/config/performance.d.ts +4 -0
- package/dist/types/types/config/security.d.ts +4 -0
- package/dist/types/types/config/source.d.ts +22 -0
- package/dist/types/types/config/tools.d.ts +15 -0
- package/dist/types/types/hooks.d.ts +80 -0
- package/dist/types/types/index.d.ts +23 -0
- package/dist/types/types/legacyConfig/deploy.d.ts +8 -0
- package/dist/types/types/legacyConfig/dev.d.ts +12 -0
- package/dist/types/types/legacyConfig/index.d.ts +33 -0
- package/dist/types/types/legacyConfig/output.d.ts +51 -0
- package/dist/types/types/legacyConfig/source.d.ts +25 -0
- package/dist/types/types/legacyConfig/tools.d.ts +16 -0
- package/dist/types/utils/config.d.ts +2 -3
- package/dist/types/utils/createFileWatcher.d.ts +3 -0
- package/dist/types/utils/printInstructions.d.ts +3 -3
- package/dist/types/utils/restart.d.ts +3 -0
- package/package.json +26 -25
- package/dist/js/modern/builder/createHtmlConfig.js +0 -58
- package/dist/js/modern/builder/createSourceConfig.js +0 -85
- package/dist/js/modern/builder/createToolsConfig.js +0 -94
- package/dist/js/modern/utils/createCompiler.js +0 -58
- package/dist/js/node/builder/createHtmlConfig.js +0 -76
- package/dist/js/node/builder/createSourceConfig.js +0 -99
- package/dist/js/node/builder/createToolsConfig.js +0 -103
- package/dist/js/node/utils/createCompiler.js +0 -75
- package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
- package/dist/js/treeshaking/builder/createOutputConfig.js +0 -67
- package/dist/js/treeshaking/builder/createSourceConfig.js +0 -100
- package/dist/js/treeshaking/builder/createToolsConfig.js +0 -90
- package/dist/js/treeshaking/utils/createCompiler.js +0 -117
- package/dist/types/builder/createHtmlConfig.d.ts +0 -6
- package/dist/types/builder/createOutputConfig.d.ts +0 -3
- package/dist/types/builder/createSourceConfig.d.ts +0 -5
- package/dist/types/builder/createToolsConfig.d.ts +0 -13
- package/dist/types/utils/createCompiler.d.ts +0 -12
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
-
import { applyOptionsChain } from '@modern-js/utils';
|
|
5
|
-
export function createToolsConfig(normalizedConfig) {
|
|
6
|
-
var _normalizedConfig$out = normalizedConfig.output,
|
|
7
|
-
disableCssExtract = _normalizedConfig$out.disableCssExtract,
|
|
8
|
-
enableTsLoader = _normalizedConfig$out.enableTsLoader;
|
|
9
|
-
var _normalizedConfig$too = normalizedConfig.tools,
|
|
10
|
-
autoprefixer = _normalizedConfig$too.autoprefixer,
|
|
11
|
-
babel = _normalizedConfig$too.babel,
|
|
12
|
-
minifyCss = _normalizedConfig$too.minifyCss,
|
|
13
|
-
terser = _normalizedConfig$too.terser,
|
|
14
|
-
webpack = _normalizedConfig$too.webpack,
|
|
15
|
-
webpackChain = _normalizedConfig$too.webpackChain,
|
|
16
|
-
tsLoader = _normalizedConfig$too.tsLoader,
|
|
17
|
-
styledComponents = _normalizedConfig$too.styledComponents,
|
|
18
|
-
sass = _normalizedConfig$too.sass,
|
|
19
|
-
postcss = _normalizedConfig$too.postcss,
|
|
20
|
-
less = _normalizedConfig$too.less,
|
|
21
|
-
htmlPlugin = _normalizedConfig$too.htmlPlugin,
|
|
22
|
-
lodash = _normalizedConfig$too.lodash;
|
|
23
|
-
var builderTsLoader = createBuilderTsLoader(tsLoader, enableTsLoader);
|
|
24
|
-
var builderTsChecker = createBuilderTsChecker(normalizedConfig.output);
|
|
25
|
-
return {
|
|
26
|
-
tsChecker: builderTsChecker,
|
|
27
|
-
styleLoader: disableCssExtract ? {} : undefined,
|
|
28
|
-
cssExtract: disableCssExtract ? false : undefined,
|
|
29
|
-
autoprefixer: autoprefixer,
|
|
30
|
-
babel: babel,
|
|
31
|
-
minifyCss: minifyCss,
|
|
32
|
-
terser: terser,
|
|
33
|
-
webpack: webpack,
|
|
34
|
-
webpackChain: webpackChain,
|
|
35
|
-
tsLoader: builderTsLoader,
|
|
36
|
-
styledComponents: styledComponents,
|
|
37
|
-
sass: sass,
|
|
38
|
-
postcss: postcss,
|
|
39
|
-
less: less,
|
|
40
|
-
// can't remove comment in html minify.
|
|
41
|
-
// some html template insert by using those comments.
|
|
42
|
-
htmlPlugin: [function (config) {
|
|
43
|
-
return _objectSpread(_objectSpread({}, config), {}, {
|
|
44
|
-
minify: _typeof(config.minify) === 'object' ? _objectSpread(_objectSpread({}, config.minify), {}, {
|
|
45
|
-
removeComments: false
|
|
46
|
-
}) : config.minify
|
|
47
|
-
});
|
|
48
|
-
}].concat(_toConsumableArray(Array.isArray(htmlPlugin) ? htmlPlugin : htmlPlugin ? [htmlPlugin] : []))
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function createBuilderTsLoader(tsLoader, enableTsLoader) {
|
|
53
|
-
var useTsLoader = Boolean(enableTsLoader);
|
|
54
|
-
|
|
55
|
-
if (!useTsLoader) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var defaultTsLoader = {
|
|
60
|
-
compilerOptions: {
|
|
61
|
-
target: 'es5',
|
|
62
|
-
module: 'ESNext'
|
|
63
|
-
},
|
|
64
|
-
transpileOnly: false,
|
|
65
|
-
allowTsInNodeModules: true
|
|
66
|
-
};
|
|
67
|
-
return function (_, utils) {
|
|
68
|
-
return applyOptionsChain(defaultTsLoader, tsLoader, utils);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function createBuilderTsChecker(output) {
|
|
73
|
-
if (output.enableTsLoader || output.disableTsChecker) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var defaultTsChecker = {
|
|
78
|
-
issue: {
|
|
79
|
-
include: [{
|
|
80
|
-
file: '**/src/**/*'
|
|
81
|
-
}],
|
|
82
|
-
exclude: [{
|
|
83
|
-
file: '**/*.(spec|test).ts'
|
|
84
|
-
}, {
|
|
85
|
-
file: '**/node_modules/**/*'
|
|
86
|
-
}]
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
return defaultTsChecker;
|
|
90
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import { chalk, logger } from '@modern-js/utils';
|
|
4
|
-
import createBuilder from "../builder";
|
|
5
|
-
import { printInstructions } from "./printInstructions";
|
|
6
|
-
export var createDevCompiler = /*#__PURE__*/function () {
|
|
7
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref) {
|
|
8
|
-
var api, target, normalizedConfig, appContext, hookRunners, builder;
|
|
9
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
10
|
-
while (1) {
|
|
11
|
-
switch (_context4.prev = _context4.next) {
|
|
12
|
-
case 0:
|
|
13
|
-
api = _ref.api, target = _ref.target, normalizedConfig = _ref.normalizedConfig, appContext = _ref.appContext;
|
|
14
|
-
_context4.prev = 1;
|
|
15
|
-
hookRunners = api.useHookRunners();
|
|
16
|
-
_context4.next = 5;
|
|
17
|
-
return createBuilder({
|
|
18
|
-
target: target,
|
|
19
|
-
normalizedConfig: normalizedConfig,
|
|
20
|
-
appContext: appContext,
|
|
21
|
-
compatPluginConfig: {
|
|
22
|
-
onDevCompileDone: function onDevCompileDone(_ref3) {
|
|
23
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
24
|
-
var isFirstCompile;
|
|
25
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
26
|
-
while (1) {
|
|
27
|
-
switch (_context.prev = _context.next) {
|
|
28
|
-
case 0:
|
|
29
|
-
isFirstCompile = _ref3.isFirstCompile;
|
|
30
|
-
|
|
31
|
-
if (process.stdout.isTTY || isFirstCompile) {
|
|
32
|
-
hookRunners.afterDev();
|
|
33
|
-
|
|
34
|
-
if (isFirstCompile) {
|
|
35
|
-
printInstructions(hookRunners, appContext, normalizedConfig);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
case 2:
|
|
40
|
-
case "end":
|
|
41
|
-
return _context.stop();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, _callee);
|
|
45
|
-
}))();
|
|
46
|
-
},
|
|
47
|
-
onBeforeCreateCompiler: function onBeforeCreateCompiler(_ref4) {
|
|
48
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
49
|
-
var bundlerConfigs;
|
|
50
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
51
|
-
while (1) {
|
|
52
|
-
switch (_context2.prev = _context2.next) {
|
|
53
|
-
case 0:
|
|
54
|
-
bundlerConfigs = _ref4.bundlerConfigs;
|
|
55
|
-
_context2.next = 3;
|
|
56
|
-
return hookRunners.beforeCreateCompiler({
|
|
57
|
-
bundlerConfigs: bundlerConfigs
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
case 3:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context2.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee2);
|
|
66
|
-
}))();
|
|
67
|
-
},
|
|
68
|
-
onAfterCreateCompiler: function onAfterCreateCompiler(_ref5) {
|
|
69
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
70
|
-
var compiler;
|
|
71
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
72
|
-
while (1) {
|
|
73
|
-
switch (_context3.prev = _context3.next) {
|
|
74
|
-
case 0:
|
|
75
|
-
compiler = _ref5.compiler;
|
|
76
|
-
_context3.next = 3;
|
|
77
|
-
return hookRunners.afterCreateCompiler({
|
|
78
|
-
compiler: compiler
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
case 3:
|
|
82
|
-
case "end":
|
|
83
|
-
return _context3.stop();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, _callee3);
|
|
87
|
-
}))();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
case 5:
|
|
93
|
-
builder = _context4.sent;
|
|
94
|
-
return _context4.abrupt("return", builder.createCompiler());
|
|
95
|
-
|
|
96
|
-
case 9:
|
|
97
|
-
_context4.prev = 9;
|
|
98
|
-
_context4.t0 = _context4["catch"](1);
|
|
99
|
-
logger.log(chalk.red("Failed to compile."));
|
|
100
|
-
logger.log();
|
|
101
|
-
logger.log(_context4.t0); // FIXME: 这里最好抛出异常,执行 process.exit 的地方尽可能少或者控制在几个统一的地方比较合适
|
|
102
|
-
// eslint-disable-next-line no-process-exit
|
|
103
|
-
|
|
104
|
-
process.exit(1);
|
|
105
|
-
|
|
106
|
-
case 15:
|
|
107
|
-
case "end":
|
|
108
|
-
return _context4.stop();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, _callee4, null, [[1, 9]]);
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
return function createDevCompiler(_x) {
|
|
115
|
-
return _ref2.apply(this, arguments);
|
|
116
|
-
};
|
|
117
|
-
}();
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BuilderConfig } from '@modern-js/builder-webpack-provider';
|
|
2
|
-
import type { IAppContext, NormalizedConfig } from '@modern-js/core';
|
|
3
|
-
export declare function createHtmlConfig(normalizedConfig: NormalizedConfig, appContext: IAppContext): BuilderConfig['html'];
|
|
4
|
-
export declare function createBuilderAppIcon(configDir: NormalizedConfig['source']['configDir'], appContext: IAppContext): string | undefined;
|
|
5
|
-
export declare function createBuilderCrossorigin(scriptExt: NormalizedConfig['output']['scriptExt']): "anonymous" | "use-credentials" | undefined;
|
|
6
|
-
export declare function createBuilderFavicon(favicon: NormalizedConfig['output']['favicon'], configDir: NormalizedConfig['source']['configDir'], appContext: IAppContext): string | undefined;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { BuilderConfig } from '@modern-js/builder-webpack-provider';
|
|
2
|
-
import type { IAppContext, NormalizedConfig } from '@modern-js/core';
|
|
3
|
-
export declare function createOutputConfig(normalizedConfig: NormalizedConfig, appContext: IAppContext): BuilderConfig['output'];
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { BuilderConfig } from '@modern-js/builder-webpack-provider';
|
|
2
|
-
import { IAppContext, NormalizedConfig } from '@modern-js/core';
|
|
3
|
-
export declare function createSourceConfig(normalizedConfig: NormalizedConfig, appContext: IAppContext): BuilderConfig['source'];
|
|
4
|
-
export declare function createBuilderInclude(include: NormalizedConfig['source']['include'], appContext: IAppContext): (string | RegExp)[];
|
|
5
|
-
export declare function createBuilderModuleScope(moduleScopes: NormalizedConfig['source']['moduleScopes']): any[] | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { BuilderConfig } from '@modern-js/builder-webpack-provider';
|
|
2
|
-
import type { NormalizedConfig } from '@modern-js/core';
|
|
3
|
-
export declare function createToolsConfig(normalizedConfig: NormalizedConfig): BuilderConfig['tools'];
|
|
4
|
-
export declare function createBuilderTsChecker(output: NormalizedConfig['output']): false | {
|
|
5
|
-
issue: {
|
|
6
|
-
include: {
|
|
7
|
-
file: string;
|
|
8
|
-
}[];
|
|
9
|
-
exclude: {
|
|
10
|
-
file: string;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type webpack from '@modern-js/builder-webpack-provider/webpack';
|
|
2
|
-
import type { PluginAPI } from '@modern-js/core';
|
|
3
|
-
import type { AppHooks } from '../hooks';
|
|
4
|
-
import { BuilderOptions } from '../builder';
|
|
5
|
-
export declare const createDevCompiler: ({
|
|
6
|
-
api,
|
|
7
|
-
target,
|
|
8
|
-
normalizedConfig,
|
|
9
|
-
appContext
|
|
10
|
-
}: {
|
|
11
|
-
api: PluginAPI<AppHooks>;
|
|
12
|
-
} & BuilderOptions) => Promise<webpack.Compiler | webpack.MultiCompiler>;
|