@modern-js/app-tools 1.21.3 → 2.0.0-beta.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/CHANGELOG.md +138 -16
- package/dist/js/modern/analyze/constants.js +1 -0
- package/dist/js/modern/analyze/generateCode.js +118 -16
- package/dist/js/modern/analyze/getBundleEntry.js +3 -2
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +198 -0
- package/dist/js/modern/analyze/{getClientRoutes.js → getClientRoutes/getRoutesLegacy.js} +8 -28
- package/dist/js/modern/analyze/getClientRoutes/index.js +2 -0
- package/dist/js/modern/analyze/getClientRoutes/utils.js +21 -0
- package/dist/js/modern/analyze/getFileSystemEntry.js +31 -12
- package/dist/js/modern/analyze/index.js +2 -1
- package/dist/js/modern/analyze/nestedRoutes.js +127 -0
- package/dist/js/modern/analyze/templates.js +164 -10
- package/dist/js/modern/analyze/utils.js +2 -1
- package/dist/js/modern/builder/builderPlugins/compatModern.js +226 -0
- package/dist/js/modern/builder/createHtmlConfig.js +58 -0
- package/dist/js/modern/builder/createOutputConfig.js +67 -0
- package/dist/js/modern/builder/createSourceConfig.js +85 -0
- package/dist/js/modern/builder/createToolsConfig.js +94 -0
- package/dist/js/modern/builder/index.js +106 -0
- package/dist/js/modern/builder/share.js +48 -0
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +37 -0
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +44 -0
- package/dist/js/modern/commands/build.js +41 -95
- package/dist/js/modern/commands/dev.js +15 -19
- package/dist/js/modern/commands/inspect.js +17 -58
- package/dist/js/modern/commands/start.js +2 -1
- package/dist/js/modern/index.js +14 -4
- package/dist/js/modern/locale/en.js +0 -1
- package/dist/js/modern/locale/zh.js +0 -1
- package/dist/js/modern/utils/commands.js +5 -0
- package/dist/js/modern/utils/createCompiler.js +37 -40
- package/dist/js/modern/utils/createServer.js +16 -0
- package/dist/js/modern/utils/printInstructions.js +1 -1
- package/dist/js/node/analyze/constants.js +3 -1
- package/dist/js/node/analyze/generateCode.js +121 -14
- package/dist/js/node/analyze/getBundleEntry.js +3 -2
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +221 -0
- package/dist/js/node/analyze/{getClientRoutes.js → getClientRoutes/getRoutesLegacy.js} +16 -35
- package/dist/js/node/analyze/getClientRoutes/index.js +21 -0
- package/dist/js/node/analyze/getClientRoutes/utils.js +42 -0
- package/dist/js/node/analyze/getFileSystemEntry.js +30 -11
- package/dist/js/node/analyze/index.js +2 -1
- package/dist/js/node/analyze/nestedRoutes.js +144 -0
- package/dist/js/node/analyze/templates.js +167 -10
- package/dist/js/node/analyze/utils.js +6 -2
- package/dist/js/node/builder/builderPlugins/compatModern.js +245 -0
- package/dist/js/node/builder/createHtmlConfig.js +76 -0
- package/dist/js/node/builder/createOutputConfig.js +75 -0
- package/dist/js/node/builder/createSourceConfig.js +99 -0
- package/dist/js/node/builder/createToolsConfig.js +103 -0
- package/dist/js/node/builder/index.js +129 -0
- package/dist/js/node/builder/share.js +63 -0
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +46 -0
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +53 -0
- package/dist/js/node/commands/build.js +44 -98
- package/dist/js/node/commands/dev.js +13 -23
- package/dist/js/node/commands/inspect.js +18 -74
- package/dist/js/node/commands/start.js +3 -1
- package/dist/js/node/index.js +19 -2
- package/dist/js/node/locale/en.js +0 -1
- package/dist/js/node/locale/zh.js +0 -1
- package/dist/js/node/utils/commands.js +14 -0
- package/dist/js/node/utils/createCompiler.js +43 -49
- package/dist/js/node/utils/createServer.js +21 -2
- package/dist/js/node/utils/printInstructions.js +1 -1
- package/dist/js/treeshaking/analyze/constants.js +16 -0
- package/dist/js/treeshaking/analyze/generateCode.js +412 -0
- package/dist/js/treeshaking/analyze/getBundleEntry.js +77 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +210 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +211 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +2 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +27 -0
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +109 -0
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +153 -0
- package/dist/js/treeshaking/analyze/getServerRoutes.js +170 -0
- package/dist/js/treeshaking/analyze/index.js +214 -0
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +32 -0
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +18 -0
- package/dist/js/treeshaking/analyze/nestedRoutes.js +207 -0
- package/dist/js/treeshaking/analyze/templates.js +189 -0
- package/dist/js/treeshaking/analyze/utils.js +95 -0
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +231 -0
- package/dist/js/treeshaking/builder/createHtmlConfig.js +59 -0
- package/dist/js/treeshaking/builder/createOutputConfig.js +67 -0
- package/dist/js/treeshaking/builder/createSourceConfig.js +100 -0
- package/dist/js/treeshaking/builder/createToolsConfig.js +90 -0
- package/dist/js/treeshaking/builder/index.js +172 -0
- package/dist/js/treeshaking/builder/share.js +50 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +58 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +53 -0
- package/dist/js/treeshaking/commands/build.js +168 -0
- package/dist/js/treeshaking/commands/deploy.js +29 -0
- package/dist/js/treeshaking/commands/dev.js +146 -0
- package/dist/js/treeshaking/commands/index.js +3 -0
- package/dist/js/treeshaking/commands/inspect.js +52 -0
- package/dist/js/treeshaking/commands/start.js +78 -0
- package/dist/js/treeshaking/exports/server.js +1 -0
- package/dist/js/treeshaking/hooks.js +21 -0
- package/dist/js/treeshaking/index.js +304 -0
- package/dist/js/treeshaking/locale/en.js +34 -0
- package/dist/js/treeshaking/locale/index.js +9 -0
- package/dist/js/treeshaking/locale/zh.js +34 -0
- package/dist/js/treeshaking/utils/commands.js +5 -0
- package/dist/js/treeshaking/utils/config.js +140 -0
- package/dist/js/treeshaking/utils/createCompiler.js +117 -0
- package/dist/js/treeshaking/utils/createServer.js +83 -0
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +68 -0
- package/dist/js/treeshaking/utils/language.js +5 -0
- package/dist/js/treeshaking/utils/printInstructions.js +35 -0
- package/dist/js/treeshaking/utils/routes.js +33 -0
- package/dist/js/treeshaking/utils/types.js +0 -0
- package/dist/types/analyze/constants.d.ts +1 -0
- package/dist/types/analyze/generateCode.d.ts +1 -1
- package/dist/types/analyze/{getClientRoutes.d.ts → getClientRoutes/getRoutes.d.ts} +2 -7
- package/dist/types/analyze/getClientRoutes/getRoutesLegacy.d.ts +15 -0
- package/dist/types/analyze/getClientRoutes/index.d.ts +2 -0
- package/dist/types/analyze/getClientRoutes/utils.d.ts +5 -0
- package/dist/types/analyze/index.d.ts +2 -2
- package/dist/types/analyze/nestedRoutes.d.ts +5 -0
- package/dist/types/analyze/templates.d.ts +17 -3
- package/dist/types/analyze/utils.d.ts +2 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +14 -0
- package/dist/types/builder/createHtmlConfig.d.ts +6 -0
- package/dist/types/builder/createOutputConfig.d.ts +3 -0
- package/dist/types/builder/createSourceConfig.d.ts +5 -0
- package/dist/types/builder/createToolsConfig.d.ts +13 -0
- package/dist/types/builder/index.d.ts +19 -0
- package/dist/types/builder/share.d.ts +26 -0
- package/dist/types/builder/webpackPlugins/htmlAsyncChunkPlugin.d.ts +8 -0
- package/dist/types/builder/webpackPlugins/htmlBottomTemplate.d.ts +10 -0
- package/dist/types/commands/build.d.ts +2 -1
- package/dist/types/commands/deploy.d.ts +2 -1
- package/dist/types/commands/dev.d.ts +2 -1
- package/dist/types/commands/inspect.d.ts +5 -6
- package/dist/types/commands/start.d.ts +2 -1
- package/dist/types/hooks.d.ts +15 -10
- package/dist/types/index.d.ts +4 -2
- package/dist/types/locale/en.d.ts +0 -1
- package/dist/types/locale/index.d.ts +0 -2
- package/dist/types/locale/zh.d.ts +0 -1
- package/dist/types/utils/commands.d.ts +1 -0
- package/dist/types/utils/createCompiler.d.ts +9 -10
- package/dist/types/utils/createServer.d.ts +8 -1
- package/dist/types/utils/printInstructions.d.ts +3 -2
- package/dist/types/utils/types.d.ts +2 -3
- package/package.json +25 -43
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { isReact18, normalizeToPosixPath } from '@modern-js/utils';
|
|
5
|
+
import { FILE_SYSTEM_ROUTES_FILE_NAME } from "./constants";
|
|
6
|
+
export var walkDirectory = function walkDirectory(dir) {
|
|
7
|
+
return fs.readdirSync(dir).reduce(function (previous, filename) {
|
|
8
|
+
var filePath = path.join(dir, filename);
|
|
9
|
+
|
|
10
|
+
if (fs.statSync(filePath).isDirectory()) {
|
|
11
|
+
return [].concat(_toConsumableArray(previous), _toConsumableArray(walkDirectory(filePath)));
|
|
12
|
+
} else {
|
|
13
|
+
return [].concat(_toConsumableArray(previous), [filePath]);
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
};
|
|
17
|
+
export var getDefaultImports = function getDefaultImports(_ref) {
|
|
18
|
+
var entrypoint = _ref.entrypoint,
|
|
19
|
+
srcDirectory = _ref.srcDirectory,
|
|
20
|
+
internalSrcAlias = _ref.internalSrcAlias,
|
|
21
|
+
internalDirAlias = _ref.internalDirAlias,
|
|
22
|
+
internalDirectory = _ref.internalDirectory;
|
|
23
|
+
var entryName = entrypoint.entryName,
|
|
24
|
+
fileSystemRoutes = entrypoint.fileSystemRoutes,
|
|
25
|
+
customBootstrap = entrypoint.customBootstrap,
|
|
26
|
+
entry = entrypoint.entry;
|
|
27
|
+
var imports = [{
|
|
28
|
+
specifiers: [{
|
|
29
|
+
local: 'React'
|
|
30
|
+
}],
|
|
31
|
+
value: 'react'
|
|
32
|
+
}, {
|
|
33
|
+
specifiers: [{
|
|
34
|
+
local: 'ReactDOM'
|
|
35
|
+
}],
|
|
36
|
+
value: isReact18(path.join(internalDirectory, '../../')) ? 'react-dom/client' : 'react-dom'
|
|
37
|
+
}, {
|
|
38
|
+
specifiers: [{
|
|
39
|
+
imported: 'createApp'
|
|
40
|
+
}, {
|
|
41
|
+
imported: 'bootstrap'
|
|
42
|
+
}],
|
|
43
|
+
value: '@modern-js/runtime'
|
|
44
|
+
}, customBootstrap && {
|
|
45
|
+
specifiers: [{
|
|
46
|
+
local: 'customBootstrap'
|
|
47
|
+
}],
|
|
48
|
+
value: normalizeToPosixPath(customBootstrap.replace(srcDirectory, internalSrcAlias))
|
|
49
|
+
}].filter(Boolean);
|
|
50
|
+
|
|
51
|
+
if (fileSystemRoutes) {
|
|
52
|
+
var route = {
|
|
53
|
+
specifiers: [{
|
|
54
|
+
imported: 'routes'
|
|
55
|
+
}],
|
|
56
|
+
value: normalizeToPosixPath("".concat(internalDirAlias, "/").concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_FILE_NAME))
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (fileSystemRoutes.globalApp) {
|
|
60
|
+
imports.push({
|
|
61
|
+
specifiers: [{
|
|
62
|
+
local: 'App'
|
|
63
|
+
}],
|
|
64
|
+
value: normalizeToPosixPath(fileSystemRoutes.globalApp.replace(srcDirectory, internalSrcAlias))
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
route.initialize = 'const App = false;';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
imports.push(route);
|
|
71
|
+
} else {
|
|
72
|
+
imports.push({
|
|
73
|
+
specifiers: [{
|
|
74
|
+
local: 'App'
|
|
75
|
+
}],
|
|
76
|
+
value: normalizeToPosixPath(entry.replace(srcDirectory, internalSrcAlias))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return imports;
|
|
81
|
+
};
|
|
82
|
+
export var isRouteComponentFile = function isRouteComponentFile(filePath) {
|
|
83
|
+
if (/\.(d|test|spec|e2e)\.(js|jsx|ts|tsx)$/.test(filePath)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (['.js', '.jsx', '.ts', '.tsx'].includes(path.extname(filePath))) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
93
|
+
export var replaceWithAlias = function replaceWithAlias(base, filePath, alias) {
|
|
94
|
+
return normalizeToPosixPath(path.join(alias, path.relative(base, filePath)));
|
|
95
|
+
};
|
|
@@ -0,0 +1,231 @@
|
|
|
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 { join } from 'path';
|
|
5
|
+
import { mergeBuilderConfig } from '@modern-js/builder-shared';
|
|
6
|
+
import { template as lodashTemplate } from '@modern-js/utils/lodash';
|
|
7
|
+
import HtmlWebpackPlugin from '@modern-js/builder-webpack-provider/html-webpack-plugin';
|
|
8
|
+
import { getEntryOptions } from '@modern-js/utils';
|
|
9
|
+
import { BottomTemplatePlugin } from "../webpackPlugins/htmlBottomTemplate";
|
|
10
|
+
import { HtmlAsyncChunkPlugin } from "../webpackPlugins/htmlAsyncChunkPlugin";
|
|
11
|
+
import { createCopyPattern } from "../share";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Provides default configuration consistent with `@modern-js/webpack`
|
|
15
|
+
*/
|
|
16
|
+
export var PluginCompatModern = function PluginCompatModern(appContext, modernConfig, options) {
|
|
17
|
+
return {
|
|
18
|
+
name: 'builder-plugin-compat-modern',
|
|
19
|
+
setup: function setup(api) {
|
|
20
|
+
api.modifyBuilderConfig(function (config) {
|
|
21
|
+
if (isStreamingSSR(modernConfig)) {
|
|
22
|
+
return mergeBuilderConfig(config, {
|
|
23
|
+
html: {
|
|
24
|
+
inject: 'body'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return config;
|
|
30
|
+
});
|
|
31
|
+
api.modifyWebpackChain(function (chain, _ref) {
|
|
32
|
+
var target = _ref.target,
|
|
33
|
+
CHAIN_ID = _ref.CHAIN_ID,
|
|
34
|
+
isProd = _ref.isProd;
|
|
35
|
+
var builderNormalizedConfig = api.getNormalizedConfig(); // set webpack config name
|
|
36
|
+
|
|
37
|
+
if (target === 'node') {
|
|
38
|
+
chain.name('server');
|
|
39
|
+
} else if (target === 'modern-web') {
|
|
40
|
+
chain.name('modern');
|
|
41
|
+
} else {
|
|
42
|
+
chain.name('client');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
chain.resolve.modules.add('node_modules').add(join(api.context.rootPath, 'node_modules')); // apply node compat
|
|
46
|
+
|
|
47
|
+
if (target === 'node') {
|
|
48
|
+
applyNodeCompat(chain, modernConfig, isProd);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (isHtmlEnabled(builderNormalizedConfig, target)) {
|
|
52
|
+
applyBottomHtmlWebpackPlugin({
|
|
53
|
+
api: api,
|
|
54
|
+
chain: chain,
|
|
55
|
+
CHAIN_ID: CHAIN_ID,
|
|
56
|
+
appContext: appContext,
|
|
57
|
+
modernConfig: modernConfig
|
|
58
|
+
});
|
|
59
|
+
applyAsyncChunkHtmlPlugin({
|
|
60
|
+
chain: chain,
|
|
61
|
+
CHAIN_ID: CHAIN_ID,
|
|
62
|
+
modernConfig: modernConfig
|
|
63
|
+
});
|
|
64
|
+
} // apply copy plugin
|
|
65
|
+
// const copyPatterns = createCopyPatterns(chain, appContext, modernConfig);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var defaultCopyPattern = createCopyPattern(appContext, modernConfig, 'public', chain);
|
|
69
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function (args) {
|
|
70
|
+
var _args$;
|
|
71
|
+
|
|
72
|
+
return [{
|
|
73
|
+
patterns: [].concat(_toConsumableArray(((_args$ = args[0]) === null || _args$ === void 0 ? void 0 : _args$.patterns) || []), [defaultCopyPattern])
|
|
74
|
+
}];
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
function isHtmlEnabled(config, target) {
|
|
78
|
+
var _config$tools;
|
|
79
|
+
|
|
80
|
+
return ((_config$tools = config.tools) === null || _config$tools === void 0 ? void 0 : _config$tools.htmlPlugin) !== false && target !== 'node' && target !== 'web-worker';
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (options) {
|
|
85
|
+
applyCallbacks(api, options);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* register builder hooks callback
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
function applyCallbacks(api, options) {
|
|
95
|
+
options.onAfterBuild && api.onAfterBuild(options.onAfterBuild);
|
|
96
|
+
options.onAfterCreateCompiler && api.onAfterCreateCompiler(options.onAfterCreateCompiler);
|
|
97
|
+
options.onAfterStartDevServer && api.onAfterStartDevServer(options.onAfterStartDevServer);
|
|
98
|
+
options.onBeforeBuild && api.onBeforeBuild(options.onBeforeBuild);
|
|
99
|
+
options.onBeforeCreateCompiler && api.onBeforeCreateCompiler(options.onBeforeCreateCompiler);
|
|
100
|
+
options.onBeforeStartDevServer && api.onBeforeStartDevServer(options.onBeforeStartDevServer);
|
|
101
|
+
options.onDevCompileDone && api.onDevCompileDone(options.onDevCompileDone);
|
|
102
|
+
options.onExit && api.onExit(options.onExit);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* compat some config, if target is `node`
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
function applyNodeCompat(chain, modernConfig, isProd) {
|
|
110
|
+
// apply node resolve extensions
|
|
111
|
+
for (var _i = 0, _arr = ['.node.js', '.node.jsx', '.node.ts', '.node.tsx']; _i < _arr.length; _i++) {
|
|
112
|
+
var ext = _arr[_i];
|
|
113
|
+
chain.resolve.extensions.prepend(ext);
|
|
114
|
+
} // apply filterEntriesBySSRConfig
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
|
|
118
|
+
|
|
119
|
+
function filterEntriesBySSRConfig(isProd, chain, serverConfig, outputConfig) {
|
|
120
|
+
var _outputConfig$ssg;
|
|
121
|
+
|
|
122
|
+
var entries = chain.entryPoints.entries(); // if prod and ssg config is true or function
|
|
123
|
+
|
|
124
|
+
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (_outputConfig$ssg = outputConfig.ssg) === null || _outputConfig$ssg === void 0 ? void 0 : _outputConfig$ssg[0]) === 'function')) {
|
|
125
|
+
return;
|
|
126
|
+
} // if single entry has ssg config
|
|
127
|
+
// `ssg: {}` is not allowed if multi entry
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
var entryNames = Object.keys(entries);
|
|
131
|
+
|
|
132
|
+
if (isProd && entryNames.length === 1 && outputConfig !== null && outputConfig !== void 0 && outputConfig.ssg) {
|
|
133
|
+
return;
|
|
134
|
+
} // collect all ssg entries
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
var ssgEntries = [];
|
|
138
|
+
|
|
139
|
+
if (isProd && outputConfig !== null && outputConfig !== void 0 && outputConfig.ssg) {
|
|
140
|
+
var ssg = outputConfig.ssg;
|
|
141
|
+
entryNames.forEach(function (name) {
|
|
142
|
+
if (ssg[name]) {
|
|
143
|
+
ssgEntries.push(name);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
var _ref2 = serverConfig || {},
|
|
149
|
+
ssr = _ref2.ssr,
|
|
150
|
+
ssrByEntries = _ref2.ssrByEntries;
|
|
151
|
+
|
|
152
|
+
entryNames.forEach(function (name) {
|
|
153
|
+
if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries !== null && ssrByEntries !== void 0 && ssrByEntries[name]))) {
|
|
154
|
+
chain.entryPoints["delete"](name);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* inject bottom template
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
function applyBottomHtmlWebpackPlugin(_ref3) {
|
|
165
|
+
var api = _ref3.api,
|
|
166
|
+
chain = _ref3.chain,
|
|
167
|
+
modernConfig = _ref3.modernConfig,
|
|
168
|
+
appContext = _ref3.appContext,
|
|
169
|
+
CHAIN_ID = _ref3.CHAIN_ID;
|
|
170
|
+
|
|
171
|
+
var _loop = function _loop() {
|
|
172
|
+
var entryName = _Object$keys[_i2];
|
|
173
|
+
|
|
174
|
+
// FIXME: the only need necessary
|
|
175
|
+
var baseTemplateParams = _objectSpread({
|
|
176
|
+
entryName: entryName,
|
|
177
|
+
title: getEntryOptions(entryName, modernConfig.output.title, modernConfig.output.titleByEntries, appContext.packageName),
|
|
178
|
+
mountId: modernConfig.output.mountId
|
|
179
|
+
}, getEntryOptions(entryName, modernConfig.output.templateParameters, modernConfig.output.templateParametersByEntries, appContext.packageName));
|
|
180
|
+
|
|
181
|
+
chain.plugin("".concat(CHAIN_ID.PLUGIN.HTML, "-").concat(entryName)).tap(function (args) {
|
|
182
|
+
return [_objectSpread(_objectSpread({}, args[0] || {}), {}, {
|
|
183
|
+
__internal__: true,
|
|
184
|
+
bottomTemplate: appContext.htmlTemplates["__".concat(entryName, "-bottom__")] && lodashTemplate(appContext.htmlTemplates["__".concat(entryName, "-bottom__")])(baseTemplateParams)
|
|
185
|
+
})];
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// inject bottomTemplate into html-webpack-plugin
|
|
190
|
+
for (var _i2 = 0, _Object$keys = Object.keys(api.context.entry); _i2 < _Object$keys.length; _i2++) {
|
|
191
|
+
_loop();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
chain.plugin(CHAIN_ID.PLUGIN.BOTTOM_TEMPLATE).use(BottomTemplatePlugin, [HtmlWebpackPlugin]);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var isStreamingSSR = function isStreamingSSR(userConfig) {
|
|
198
|
+
var isStreaming = function isStreaming(ssr) {
|
|
199
|
+
return ssr && _typeof(ssr) === 'object' && ssr.mode === 'stream';
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
var server = userConfig.server;
|
|
203
|
+
|
|
204
|
+
if (isStreaming(server.ssr)) {
|
|
205
|
+
return true;
|
|
206
|
+
} // Since we cannot apply different plugins for different entries,
|
|
207
|
+
// we regard the whole app as streaming ssr only if one entry meets the requirement.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
if (server !== null && server !== void 0 && server.ssrByEntries && _typeof(server.ssrByEntries) === 'object') {
|
|
211
|
+
for (var _i3 = 0, _Object$keys2 = Object.keys(server.ssrByEntries); _i3 < _Object$keys2.length; _i3++) {
|
|
212
|
+
var name = _Object$keys2[_i3];
|
|
213
|
+
|
|
214
|
+
if (isStreaming(server.ssrByEntries[name])) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return false;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
function applyAsyncChunkHtmlPlugin(_ref4) {
|
|
224
|
+
var chain = _ref4.chain,
|
|
225
|
+
modernConfig = _ref4.modernConfig,
|
|
226
|
+
CHAIN_ID = _ref4.CHAIN_ID;
|
|
227
|
+
|
|
228
|
+
if (isStreamingSSR(modernConfig)) {
|
|
229
|
+
chain.plugin(CHAIN_ID.PLUGIN.HTML_ASYNC_CHUNK).use(HtmlAsyncChunkPlugin, [HtmlWebpackPlugin]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { findExists } from '@modern-js/utils';
|
|
3
|
+
export function createHtmlConfig(normalizedConfig, appContext) {
|
|
4
|
+
var _normalizedConfig$out = normalizedConfig.output,
|
|
5
|
+
disableHtmlFolder = _normalizedConfig$out.disableHtmlFolder,
|
|
6
|
+
favicon = _normalizedConfig$out.favicon,
|
|
7
|
+
faviconByEntries = _normalizedConfig$out.faviconByEntries,
|
|
8
|
+
inject = _normalizedConfig$out.inject,
|
|
9
|
+
injectByEntries = _normalizedConfig$out.injectByEntries,
|
|
10
|
+
meta = _normalizedConfig$out.meta,
|
|
11
|
+
metaByEntries = _normalizedConfig$out.metaByEntries,
|
|
12
|
+
mountId = _normalizedConfig$out.mountId,
|
|
13
|
+
title = _normalizedConfig$out.title,
|
|
14
|
+
titleByEntries = _normalizedConfig$out.titleByEntries,
|
|
15
|
+
scriptExt = _normalizedConfig$out.scriptExt,
|
|
16
|
+
templateParameters = _normalizedConfig$out.templateParameters,
|
|
17
|
+
templateParametersByEntries = _normalizedConfig$out.templateParametersByEntries;
|
|
18
|
+
var configDir = normalizedConfig.source.configDir; // transform Modernjs `output.scriptExt` to Builder `html.crossorigin` configuration
|
|
19
|
+
|
|
20
|
+
var builderCrossorigin = createBuilderCrossorigin(scriptExt);
|
|
21
|
+
var builderAppIcon = createBuilderAppIcon(configDir, appContext);
|
|
22
|
+
var builderFavicon = createBuilderFavicon(favicon, configDir, appContext);
|
|
23
|
+
return {
|
|
24
|
+
appIcon: builderAppIcon,
|
|
25
|
+
disableHtmlFolder: disableHtmlFolder,
|
|
26
|
+
favicon: builderFavicon,
|
|
27
|
+
faviconByEntries: faviconByEntries,
|
|
28
|
+
inject: inject,
|
|
29
|
+
injectByEntries: injectByEntries,
|
|
30
|
+
meta: meta,
|
|
31
|
+
metaByEntries: metaByEntries,
|
|
32
|
+
mountId: mountId,
|
|
33
|
+
title: title,
|
|
34
|
+
titleByEntries: titleByEntries,
|
|
35
|
+
crossorigin: builderCrossorigin,
|
|
36
|
+
templateByEntries: appContext.htmlTemplates,
|
|
37
|
+
templateParameters: templateParameters,
|
|
38
|
+
templateParametersByEntries: templateParametersByEntries
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var ICON_EXTENSIONS = ['png', 'jpg', 'jpeg', 'svg', 'ico'];
|
|
42
|
+
export function createBuilderAppIcon(configDir, appContext) {
|
|
43
|
+
var appIcon = findExists(ICON_EXTENSIONS.map(function (ext) {
|
|
44
|
+
return path.resolve(appContext.appDirectory, configDir, "icon.".concat(ext));
|
|
45
|
+
}));
|
|
46
|
+
return typeof appIcon === 'string' ? appIcon : undefined;
|
|
47
|
+
}
|
|
48
|
+
export function createBuilderCrossorigin(scriptExt) {
|
|
49
|
+
var _scriptExtCustomConfi;
|
|
50
|
+
|
|
51
|
+
var scriptExtCustomConfig = scriptExt === null || scriptExt === void 0 ? void 0 : scriptExt.custom;
|
|
52
|
+
return scriptExtCustomConfig !== null && scriptExtCustomConfig !== void 0 && (_scriptExtCustomConfi = scriptExtCustomConfig.test) !== null && _scriptExtCustomConfi !== void 0 && _scriptExtCustomConfi.test('.js') && (scriptExtCustomConfig === null || scriptExtCustomConfig === void 0 ? void 0 : scriptExtCustomConfig.attribute) === 'crossorigin' ? scriptExtCustomConfig.value : undefined;
|
|
53
|
+
}
|
|
54
|
+
export function createBuilderFavicon(favicon, configDir, appContext) {
|
|
55
|
+
var defaultFavicon = findExists(ICON_EXTENSIONS.map(function (ext) {
|
|
56
|
+
return path.resolve(appContext.appDirectory, configDir, "favicon.".concat(ext));
|
|
57
|
+
}));
|
|
58
|
+
return favicon || defaultFavicon || undefined;
|
|
59
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { createCopyPattern } from "./share";
|
|
3
|
+
export function createOutputConfig(normalizedConfig, appContext) {
|
|
4
|
+
// TODO: add `externals` options in Modern.
|
|
5
|
+
var _normalizedConfig$out = normalizedConfig.output,
|
|
6
|
+
assetPrefix = _normalizedConfig$out.assetPrefix,
|
|
7
|
+
copy = _normalizedConfig$out.copy,
|
|
8
|
+
cssModuleLocalIdentName = _normalizedConfig$out.cssModuleLocalIdentName,
|
|
9
|
+
cssPath = _normalizedConfig$out.cssPath,
|
|
10
|
+
jsPath = _normalizedConfig$out.jsPath,
|
|
11
|
+
htmlPath = _normalizedConfig$out.htmlPath,
|
|
12
|
+
mediaPath = _normalizedConfig$out.mediaPath,
|
|
13
|
+
path = _normalizedConfig$out.path,
|
|
14
|
+
disableInlineRuntimeChunk = _normalizedConfig$out.disableInlineRuntimeChunk,
|
|
15
|
+
disableMinimize = _normalizedConfig$out.disableMinimize,
|
|
16
|
+
disableSourceMap = _normalizedConfig$out.disableSourceMap,
|
|
17
|
+
enableCssModuleTSDeclaration = _normalizedConfig$out.enableCssModuleTSDeclaration,
|
|
18
|
+
enableInlineScripts = _normalizedConfig$out.enableInlineScripts,
|
|
19
|
+
enableInlineStyles = _normalizedConfig$out.enableInlineStyles,
|
|
20
|
+
polyfill = _normalizedConfig$out.polyfill,
|
|
21
|
+
dataUriLimit = _normalizedConfig$out.dataUriLimit,
|
|
22
|
+
disableAssetsCache = _normalizedConfig$out.disableAssetsCache,
|
|
23
|
+
enableLatestDecorators = _normalizedConfig$out.enableLatestDecorators,
|
|
24
|
+
disableCssModuleExtension = _normalizedConfig$out.disableCssModuleExtension;
|
|
25
|
+
var defaultCopyPattern = createCopyPattern(appContext, normalizedConfig, 'upload');
|
|
26
|
+
var builderCopy = copy ? [].concat(_toConsumableArray(copy), [defaultCopyPattern]) : [defaultCopyPattern];
|
|
27
|
+
return {
|
|
28
|
+
assetPrefix: assetPrefix,
|
|
29
|
+
copy: builderCopy,
|
|
30
|
+
distPath: {
|
|
31
|
+
root: path,
|
|
32
|
+
css: cssPath,
|
|
33
|
+
js: jsPath,
|
|
34
|
+
html: htmlPath,
|
|
35
|
+
// `@modern-js/webpack` output all media files to `dist/media` by default
|
|
36
|
+
svg: mediaPath || 'midia',
|
|
37
|
+
image: mediaPath || 'midia',
|
|
38
|
+
font: mediaPath || 'midia',
|
|
39
|
+
media: mediaPath || 'midia'
|
|
40
|
+
},
|
|
41
|
+
dataUriLimit: {
|
|
42
|
+
svg: dataUriLimit,
|
|
43
|
+
image: dataUriLimit,
|
|
44
|
+
font: dataUriLimit,
|
|
45
|
+
media: dataUriLimit
|
|
46
|
+
},
|
|
47
|
+
disableCssModuleExtension: disableCssModuleExtension,
|
|
48
|
+
disableInlineRuntimeChunk: disableInlineRuntimeChunk,
|
|
49
|
+
disableMinimize: disableMinimize,
|
|
50
|
+
disableSourceMap: disableSourceMap,
|
|
51
|
+
enableCssModuleTSDeclaration: enableCssModuleTSDeclaration,
|
|
52
|
+
enableInlineScripts: enableInlineScripts,
|
|
53
|
+
enableInlineStyles: enableInlineStyles,
|
|
54
|
+
polyfill: polyfill,
|
|
55
|
+
// We need to do this in the app-tools prepare hook because some files will be generated into the dist directory in the analyze process
|
|
56
|
+
cleanDistPath: false,
|
|
57
|
+
disableFilenameHash: disableAssetsCache,
|
|
58
|
+
enableLatestDecorators: enableLatestDecorators,
|
|
59
|
+
filename: {
|
|
60
|
+
css: cssModuleLocalIdentName
|
|
61
|
+
},
|
|
62
|
+
// `@modern-js/webpack` used to generate asset manifest by default
|
|
63
|
+
enableAssetManifest: true,
|
|
64
|
+
// compatible the modern-js with fallback behavior
|
|
65
|
+
enableAssetFallback: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import { dirname, isAbsolute, posix, sep } from 'path';
|
|
4
|
+
import { globby, mergeAlias, findMonorepoRoot, isModernjsMonorepo } from '@modern-js/utils';
|
|
5
|
+
export function createSourceConfig(normalizedConfig, appContext) {
|
|
6
|
+
var _normalizedConfig$sou = normalizedConfig.source,
|
|
7
|
+
alias = _normalizedConfig$sou.alias,
|
|
8
|
+
envVars = _normalizedConfig$sou.envVars,
|
|
9
|
+
globalVars = _normalizedConfig$sou.globalVars,
|
|
10
|
+
include = _normalizedConfig$sou.include,
|
|
11
|
+
moduleScopes = _normalizedConfig$sou.moduleScopes,
|
|
12
|
+
preEntry = _normalizedConfig$sou.preEntry;
|
|
13
|
+
var builderGlobalVars = globalVars || {};
|
|
14
|
+
|
|
15
|
+
var _iterator = _createForOfIteratorHelper(envVars || []),
|
|
16
|
+
_step;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
+
var envVar = _step.value;
|
|
21
|
+
var envVarValue = process.env[envVar];
|
|
22
|
+
envVarValue && (builderGlobalVars["process.env.".concat(envVar)] = envVarValue);
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
_iterator.e(err);
|
|
26
|
+
} finally {
|
|
27
|
+
_iterator.f();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var builderModuleScope = createBuilderModuleScope(moduleScopes);
|
|
31
|
+
var builderInclude = createBuilderInclude(include, appContext);
|
|
32
|
+
return {
|
|
33
|
+
alias: mergeAlias(alias),
|
|
34
|
+
moduleScopes: builderModuleScope,
|
|
35
|
+
globalVars: builderGlobalVars,
|
|
36
|
+
include: builderInclude,
|
|
37
|
+
preEntry: preEntry,
|
|
38
|
+
// ensure resolve.extensions same as before
|
|
39
|
+
resolveExtensionPrefix: '.web'
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function createBuilderInclude(include, appContext) {
|
|
43
|
+
var defaultInclude = [appContext.internalDirectory];
|
|
44
|
+
var transformInclude = (include || []).map(function (include) {
|
|
45
|
+
if (typeof include === 'string') {
|
|
46
|
+
if (isAbsolute(include)) {
|
|
47
|
+
return include;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return new RegExp(include);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return include;
|
|
54
|
+
}).concat(defaultInclude); // concat default Include
|
|
55
|
+
|
|
56
|
+
var root = findMonorepoRoot(appContext.appDirectory);
|
|
57
|
+
|
|
58
|
+
if (!root) {
|
|
59
|
+
return transformInclude;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var modernjsMonorepo = isModernjsMonorepo(root);
|
|
63
|
+
|
|
64
|
+
if (modernjsMonorepo) {
|
|
65
|
+
var paths = globby.sync(posix.join(root, 'features', '**', 'package.json'), {
|
|
66
|
+
ignore: ['**/node_modules/**/*']
|
|
67
|
+
}).map(function (pathname) {
|
|
68
|
+
return dirname(pathname) + sep;
|
|
69
|
+
});
|
|
70
|
+
return [].concat(_toConsumableArray(paths), _toConsumableArray(transformInclude));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return transformInclude;
|
|
74
|
+
}
|
|
75
|
+
export function createBuilderModuleScope(moduleScopes) {
|
|
76
|
+
if (moduleScopes) {
|
|
77
|
+
var builderModuleScope = [];
|
|
78
|
+
var DEFAULT_SCOPES = ['./src', './shared', /node_modules/];
|
|
79
|
+
|
|
80
|
+
if (Array.isArray(moduleScopes)) {
|
|
81
|
+
if (isPrimitiveScope(moduleScopes)) {
|
|
82
|
+
builderModuleScope = DEFAULT_SCOPES.concat(moduleScopes);
|
|
83
|
+
} else {
|
|
84
|
+
builderModuleScope = [DEFAULT_SCOPES].concat(_toConsumableArray(moduleScopes));
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
builderModuleScope = [DEFAULT_SCOPES, moduleScopes];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return builderModuleScope;
|
|
91
|
+
} else {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function isPrimitiveScope(items) {
|
|
96
|
+
return items.every(function (item) {
|
|
97
|
+
return typeof item === 'string' || Object.prototype.toString.call(item) === '[object RegExp]';
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
}
|