@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.170
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/.eslintignore +1 -0
- package/.eslintrc.js +49 -10
- package/.prettierrc +6 -0
- package/CHANGELOG.md +5 -0
- package/README.md +855 -0
- package/bin/cli.js +215 -46
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/CustomChunks.md +26 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +24 -0
- package/lib/babel/es-plugins-presets.js +34 -0
- package/lib/common/getEntries.js +33 -46
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +24 -19
- package/lib/common/splitChunks.js +110 -25
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +31 -27
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.component.umd.config.js +46 -53
- package/lib/configs/webpack.css.umd.config.js +47 -46
- package/lib/configs/webpack.dev.config.js +98 -84
- package/lib/configs/webpack.docs.config.js +64 -57
- package/lib/configs/webpack.impact.config.js +108 -0
- package/lib/configs/webpack.prod.config.js +146 -104
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +68 -35
- package/lib/jest/jsonMaker.js +54 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +92 -42
- package/lib/jest/run.js +75 -28
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +113 -0
- package/lib/loaderUtils/getDevJsLoaders.js +35 -23
- package/lib/loaderUtils/index.js +14 -7
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/fileLoader.js +47 -38
- package/lib/loaders/scriptInstrumentLoader.js +23 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +90 -72
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +177 -30
- package/lib/pluginUtils/getDocsPlugins.js +36 -15
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +244 -37
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
- package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +77 -0
- package/lib/plugins/CleanupStatsPlugin.js +28 -0
- package/lib/plugins/EFCPlugin.js +241 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +86 -0
- package/lib/plugins/ModuleStatsPlugin.js +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +41 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +226 -0
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +67 -0
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +107 -0
- package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
- package/lib/plugins/SourceMapHookPlugin.js +25 -59
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +39 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +127 -37
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +365 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +534 -66
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +94 -79
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +18 -0
- package/lib/servers/impactServer.js +123 -115
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +200 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +134 -132
- package/lib/servers/ssServer.js +106 -70
- package/lib/sh/reportPublish.sh +16 -10
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +10 -0
- package/lib/utils/babelPresets.js +12 -4
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +16 -109
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +77 -0
- package/lib/utils/cssURLReplacer.js +136 -0
- package/lib/utils/dependencyPostPublish.js +42 -0
- package/lib/utils/fileUtils.js +125 -0
- package/lib/utils/folderIterator.js +47 -0
- package/lib/utils/getComponents.js +126 -0
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +151 -0
- package/lib/utils/getHash.js +26 -0
- package/lib/utils/getIp.js +20 -0
- package/lib/utils/getOptions.js +113 -28
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +283 -68
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +47 -27
- package/lib/utils/jsonHelper.js +106 -0
- package/lib/utils/libraryImpactConfig.js +63 -0
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +142 -0
- package/lib/utils/mailSender.js +16 -25
- package/lib/utils/pullOrigin.js +28 -0
- package/lib/utils/reinstallDependencies.js +133 -0
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +59 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +59 -0
- package/lib/utils/setEnvVariables.js +13 -0
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +96 -64
- package/postpublish.js +6 -0
- package/templates/app/.eslintrc.js +140 -0
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -8
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -13
- package/templates/app/package.json +37 -17
- package/templates/app/src/actions/SampleActions/index.js +37 -0
- package/templates/app/src/actions/index.js +65 -0
- package/templates/app/src/appUrls.js +19 -0
- package/templates/app/src/components/Alert/Alert.js +134 -0
- package/templates/app/src/components/Alert/Alert.module.css +79 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
- package/templates/app/src/components/Sample/Sample.module.css +11 -0
- package/templates/app/src/components/Sample/SampleList.js +61 -0
- package/templates/app/src/components/Slider/Slider.css +41 -0
- package/templates/app/src/components/Slider/Slider.js +55 -0
- package/templates/app/src/containers/AlertContainer/index.js +15 -0
- package/templates/app/src/containers/AppContainer/index.js +96 -0
- package/templates/app/src/containers/AppContainer/index.module.css +27 -0
- package/templates/app/src/containers/CustomMatch/index.js +65 -0
- package/templates/app/src/containers/DevTools/index.js +10 -0
- package/templates/app/src/containers/Header/index.js +67 -0
- package/templates/app/src/containers/Header/index.module.css +43 -0
- package/templates/app/src/containers/Redirect/index.js +63 -0
- package/templates/app/src/containers/Redirector/index.js +47 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
- package/templates/app/src/historyChange.js +5 -0
- package/templates/app/src/index.html +10 -0
- package/templates/app/src/index.js +24 -0
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
- package/templates/app/src/reducers/alertData.js +11 -0
- package/templates/app/src/reducers/index.js +6 -0
- package/templates/app/src/reducers/samples.js +19 -0
- package/templates/app/src/store/configureStore.dev.js +51 -0
- package/templates/app/src/store/configureStore.js +5 -0
- package/templates/app/src/store/configureStore.prod.js +26 -0
- package/templates/app/src/util/Common.js +5 -0
- package/templates/app/src/util/RequestAPI.js +132 -0
- package/templates/appold/README.md +12 -0
- package/templates/appold/app/index.html +8 -0
- package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
- package/templates/appold/app/properties/i18nkeys.json +3 -0
- package/templates/appold/docs/all.html +69 -0
- package/templates/appold/mockapi/index.js +13 -0
- package/templates/{app → appold}/mockapi/tickets.json +0 -0
- package/templates/appold/package.json +17 -0
- package/templates/appold/src/components/Text/Text.css +0 -0
- package/templates/appold/src/components/Text/Text.js +23 -0
- package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
- package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
- package/templates/appold/src/components/docs.js +1 -0
- package/templates/appold/src/components/index.js +5 -0
- package/templates/appold/src/index.js +13 -0
- package/templates/docs/all.html +1 -1
- package/templates/docs/component.html +110 -69
- package/templates/docs/components.html +221 -0
- package/templates/docs/css/component.css +12 -14
- package/templates/docs/css/componentTest.css +7 -0
- package/templates/docs/css/style.css +150 -206
- package/templates/docs/impactReportTemplate.html +154 -0
- package/templates/docs/index.html +1482 -1336
- package/templates/library/src/index.js +0 -0
- package/.npmignore +0 -3
- package/cert/cert.pem +0 -129
- package/cert/key.pem +0 -27
- package/lib/common/getInsertAt.js +0 -36
- package/lib/common/getInsertIntoFunction.js +0 -13
- package/lib/configs/webpack.server.config.js +0 -93
- package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
- package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
- package/lib/rmcntrlm.sh +0 -14
- package/lib/servers/nodeServer.js +0 -238
- package/lib/templates/HMRTemplate.js +0 -256
- package/lib/templates/publicPathTemplate.js +0 -16
- package/lib/utils/setConfig.js +0 -14
- package/node_modules/history/CHANGES.md +0 -395
- package/node_modules/history/DOMUtils.js +0 -3
- package/node_modules/history/ExecutionEnvironment.js +0 -3
- package/node_modules/history/LICENSE +0 -21
- package/node_modules/history/LocationUtils.js +0 -3
- package/node_modules/history/PathUtils.js +0 -3
- package/node_modules/history/README.md +0 -282
- package/node_modules/history/cjs/history.js +0 -933
- package/node_modules/history/cjs/history.min.js +0 -1
- package/node_modules/history/createBrowserHistory.js +0 -3
- package/node_modules/history/createHashHistory.js +0 -3
- package/node_modules/history/createMemoryHistory.js +0 -3
- package/node_modules/history/createTransitionManager.js +0 -3
- package/node_modules/history/es/DOMUtils.js +0 -7
- package/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/node_modules/history/es/LocationUtils.js +0 -7
- package/node_modules/history/es/PathUtils.js +0 -7
- package/node_modules/history/es/createBrowserHistory.js +0 -7
- package/node_modules/history/es/createHashHistory.js +0 -7
- package/node_modules/history/es/createMemoryHistory.js +0 -7
- package/node_modules/history/es/createTransitionManager.js +0 -7
- package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/node_modules/history/esm/history.js +0 -904
- package/node_modules/history/index.js +0 -7
- package/node_modules/history/package.json +0 -134
- package/node_modules/history/umd/history.js +0 -1059
- package/node_modules/history/umd/history.min.js +0 -1
- package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
- package/templates/app/.npmignore +0 -9
- package/templates/library/.npmignore +0 -9
@@ -1,76 +1,283 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
8
9
|
|
9
|
-
var
|
10
|
+
var _fs = _interopRequireDefault(require("fs"));
|
10
11
|
|
11
|
-
var
|
12
|
+
var _webpack = _interopRequireDefault(require("webpack"));
|
12
13
|
|
13
|
-
var
|
14
|
+
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
14
15
|
|
15
|
-
var _webpackBundleAnalyzer = require(
|
16
|
+
var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
16
17
|
|
17
|
-
var
|
18
|
+
var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
|
18
19
|
|
19
|
-
var
|
20
|
+
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
20
21
|
|
21
|
-
var
|
22
|
+
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
22
23
|
|
23
|
-
var
|
24
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
24
25
|
|
25
|
-
var
|
26
|
+
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
26
27
|
|
27
|
-
|
28
|
+
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
29
|
+
|
30
|
+
var _plugins = require("../plugins");
|
28
31
|
|
29
|
-
var
|
30
|
-
var _options$app = options.app,
|
31
|
-
enableChunkHash = _options$app.enableChunkHash,
|
32
|
-
manifestFileName = _options$app.manifestFileName,
|
33
|
-
bundleAnalyze = _options$app.bundleAnalyze,
|
34
|
-
optimize = _options$app.optimize;
|
32
|
+
var _common = require("../common");
|
35
33
|
|
34
|
+
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
|
+
|
38
|
+
// eslint-disable-next-line no-unused-vars
|
39
|
+
let getProdPlugins = (options, publicPath = '') => {
|
40
|
+
let {
|
41
|
+
enableChunkHash,
|
42
|
+
manifestFileName,
|
43
|
+
bundleAnalyze,
|
44
|
+
optimize,
|
45
|
+
publicPaths,
|
46
|
+
hasEFC: prevOptionForEnableEFC,
|
47
|
+
enableSMapHook,
|
48
|
+
tpFolder,
|
49
|
+
folder,
|
50
|
+
outputFolder,
|
51
|
+
context,
|
52
|
+
enableSMap,
|
53
|
+
server: {
|
54
|
+
mode
|
55
|
+
},
|
56
|
+
hasShadowDOM,
|
57
|
+
resourceHints,
|
58
|
+
serviceWorker,
|
59
|
+
htmlTemplate: {
|
60
|
+
inject
|
61
|
+
},
|
62
|
+
tpHashMapping,
|
63
|
+
cdnMapping,
|
64
|
+
crossorigin
|
65
|
+
} = options.app;
|
66
|
+
const {
|
67
|
+
i18n
|
68
|
+
} = options;
|
69
|
+
const {
|
70
|
+
enableRTLSplit
|
71
|
+
} = options.css;
|
72
|
+
const {
|
73
|
+
hasEFC: newOptionForEnableEFC,
|
74
|
+
nameScope: efcNameSpace,
|
75
|
+
templateFilePath,
|
76
|
+
localeAttr: efcLocaleAttr
|
77
|
+
} = options.efc;
|
78
|
+
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
79
|
+
const hashTempalate = enableChunkHash ? '.[chunkhash:20]_' : '';
|
80
|
+
const cssLTRFileNameTempalte = `css/[name]${hashTempalate}${enableRTLSplit ? '.ltr' : ''}.css`;
|
81
|
+
const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
|
82
|
+
let isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
83
|
+
enableChunkHash = !isDevelopment && enableChunkHash;
|
84
|
+
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
|
40
85
|
__TEST__: false,
|
41
86
|
__DEVELOPMENT__: false,
|
42
|
-
__LOCAL_PRODUCTION__:
|
87
|
+
__LOCAL_PRODUCTION__: isDevelopment,
|
43
88
|
__DOCS__: false,
|
44
89
|
'process.env': {
|
45
90
|
NODE_ENV: JSON.stringify('production')
|
46
91
|
},
|
47
92
|
__SERVER__: false
|
48
|
-
}), new
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
93
|
+
}), new _miniCssExtractPlugin.default({
|
94
|
+
// ignoreOrder: true,
|
95
|
+
filename: cssLTRFileNameTempalte,
|
96
|
+
chunkFilename: cssLTRFileNameTempalte
|
97
|
+
}), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
|
98
|
+
|
99
|
+
if (enableRTLSplit) {
|
100
|
+
plugins.push(new _RtlCssPlugin.RtlCssPlugin({
|
101
|
+
templateLabel: options.css.templateLabel,
|
102
|
+
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
103
|
+
dirVarName: options.css.dirVarName,
|
104
|
+
// config: {},
|
105
|
+
// sourcemap: true,
|
106
|
+
filename: cssRTLFileNameTempalte
|
107
|
+
}));
|
108
|
+
}
|
109
|
+
|
110
|
+
const i18nManifestFileName = 'i18n-manifest.json';
|
111
|
+
/**
|
112
|
+
* NOTE:
|
113
|
+
* this file name ext .i18n.js added
|
114
|
+
* Because, in service worker they maintain cache as file name based
|
115
|
+
* So, to make differce we added .i18n.js ext.
|
116
|
+
*/
|
117
|
+
|
118
|
+
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
|
119
|
+
const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : ''; // const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[contentHash]_.js';
|
120
|
+
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
|
121
|
+
|
122
|
+
if (i18n.chunkSplitEnable) {
|
123
|
+
plugins.push(new _I18nSplitPlugin.default({
|
124
|
+
jsResource: i18n.jsResource,
|
125
|
+
localeVarName: i18n.localeVarName,
|
126
|
+
jsonpFunc: i18n.jsonpFunc,
|
127
|
+
disableDefault: i18n.disableDefault,
|
128
|
+
publicPath: i18nPublicPath,
|
129
|
+
i18nManifestFileName,
|
130
|
+
// template: (object, locale) => `window.loadI18n(${JSON.stringify(object)}, ${JSON.stringify(locale)})`,
|
131
|
+
filenameTemplate: i18nFileNameTemplate,
|
132
|
+
propertiesFolder: i18n.propertiesFolder
|
133
|
+
}));
|
134
|
+
} else {
|
135
|
+
let i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
136
|
+
|
137
|
+
if (_fs.default.existsSync(i18nPath)) {
|
138
|
+
plugins.push(new _copyWebpackPlugin.default([{
|
139
|
+
from: `${i18nPath}/`,
|
140
|
+
to: enableChunkHash ? './i18n/[name].[hash:20]_.[ext]' : './i18n/[name]_.[ext]',
|
141
|
+
toType: 'template'
|
142
|
+
}]));
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
tpFolder && plugins.push(new _copyWebpackPlugin.default([{
|
147
|
+
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
148
|
+
to: `./${tpFolder}/`,
|
149
|
+
toType: 'dir'
|
150
|
+
}]));
|
151
|
+
|
152
|
+
if (hasEFC) {
|
153
|
+
plugins.push(new _htmlWebpackPlugin.default({
|
154
|
+
chunksSortMode: 'none',
|
155
|
+
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
156
|
+
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
157
|
+
excludeChunks: ['efc', 'widget'],
|
158
|
+
minify: false,
|
159
|
+
templateParameters: _common.templateParameters,
|
160
|
+
scriptLoading: 'defer',
|
161
|
+
inject: inject
|
162
|
+
}));
|
163
|
+
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
164
|
+
crossorigin: 'anonymous'
|
60
165
|
}));
|
166
|
+
plugins.push(new _plugins.EFCPlugin({
|
167
|
+
isDevelopment,
|
168
|
+
serverUrl: publicPath,
|
169
|
+
i18nFileNameTemplate,
|
170
|
+
templateFilePath,
|
171
|
+
i18nManifestFileName,
|
172
|
+
entryPointName: 'efc',
|
173
|
+
// outputFile: 'zohodesk-efc-sdk-latest.js',
|
174
|
+
nameScope: efcNameSpace,
|
175
|
+
localeAttr: efcLocaleAttr,
|
176
|
+
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
177
|
+
}));
|
178
|
+
} else {
|
179
|
+
plugins.push(new _htmlWebpackPlugin.default({
|
180
|
+
chunksSortMode: 'none',
|
181
|
+
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
182
|
+
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
183
|
+
minify: false,
|
184
|
+
templateParameters: _common.templateParameters,
|
185
|
+
scriptLoading: 'defer',
|
186
|
+
inject: inject
|
187
|
+
}));
|
188
|
+
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
189
|
+
crossorigin: 'anonymous'
|
190
|
+
}));
|
191
|
+
}
|
192
|
+
|
193
|
+
plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
|
194
|
+
// Because we will handle cdn url in CdnChangePlugin
|
195
|
+
publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
|
196
|
+
isDevelopment,
|
197
|
+
templateLabel: i18n.templateLabel || '{{--user-locale}}',
|
198
|
+
i18nFileNameTemplate,
|
199
|
+
i18nManifestFileName,
|
200
|
+
mainChunkName: 'main'
|
201
|
+
}));
|
202
|
+
|
203
|
+
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
204
|
+
let {
|
205
|
+
callback
|
206
|
+
} = publicPaths;
|
207
|
+
plugins.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
208
|
+
callback
|
209
|
+
}) : new _plugins.PublicPathChangePlugin({
|
210
|
+
publicPaths,
|
211
|
+
resourceHints
|
212
|
+
}));
|
213
|
+
}
|
214
|
+
|
215
|
+
if (cdnMapping.isCdnEnabled) {
|
216
|
+
plugins.push(new _plugins.CdnChangePlugin(cdnMapping));
|
217
|
+
}
|
61
218
|
|
62
|
-
|
219
|
+
plugins.push(new _lodashWebpackPlugin.default({
|
220
|
+
collections: true,
|
221
|
+
shorthands: true
|
222
|
+
}));
|
223
|
+
hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
|
224
|
+
|
225
|
+
if (!isDevelopment) {
|
226
|
+
enableSMap && enableSMapHook && plugins.push(new _plugins.SourceMapHookPlugin());
|
227
|
+
optimize && plugins.push(new _plugins.OptimizeJSPlugin());
|
228
|
+
plugins.push(new _plugins.ManifestPlugin({
|
63
229
|
fileName: manifestFileName
|
64
230
|
}));
|
65
231
|
|
66
232
|
if (bundleAnalyze) {
|
67
233
|
plugins.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
68
|
-
analyzerMode: 'static'
|
234
|
+
analyzerMode: 'static',
|
235
|
+
generateStatsFile: true,
|
236
|
+
openAnalyzer: false,
|
237
|
+
statsOptions: {
|
238
|
+
source: false,
|
239
|
+
normal: true,
|
240
|
+
chunks: false,
|
241
|
+
chunkGroups: false,
|
242
|
+
module: false,
|
243
|
+
assets: true,
|
244
|
+
assetsSort: 'name'
|
245
|
+
}
|
246
|
+
})); // plugins.push(new ReportGeneratePlugin());
|
247
|
+
}
|
248
|
+
|
249
|
+
if (tpHashMapping && tpHashMapping.length > 0) {
|
250
|
+
plugins.push(new _plugins.TPHashMappingPlugin({
|
251
|
+
fileMappings: tpHashMapping,
|
252
|
+
tpFolder: `${_path.default.join(process.cwd(), context, tpFolder)}/`
|
69
253
|
}));
|
70
254
|
}
|
71
255
|
}
|
72
256
|
|
257
|
+
if (!isDevelopment && serviceWorker.enableSw) {
|
258
|
+
let {
|
259
|
+
filePath,
|
260
|
+
fileName = 'sw.js',
|
261
|
+
exitPath = '/',
|
262
|
+
replaceText = '@@'
|
263
|
+
} = serviceWorker;
|
264
|
+
|
265
|
+
if (!filePath) {
|
266
|
+
throw new Error('File Path required for service worker plugin');
|
267
|
+
}
|
268
|
+
|
269
|
+
plugins.push(new _plugins.ServiceWorkerPlugin({
|
270
|
+
filePath: _path.default.join(process.cwd(), filePath),
|
271
|
+
i18nFileNameTemplate,
|
272
|
+
fileName: fileName,
|
273
|
+
exitPath: _path.default.join(outputFolder, exitPath),
|
274
|
+
replaceText,
|
275
|
+
publicPaths
|
276
|
+
}));
|
277
|
+
}
|
278
|
+
|
73
279
|
return plugins;
|
74
280
|
};
|
75
281
|
|
76
|
-
|
282
|
+
var _default = getProdPlugins;
|
283
|
+
exports.default = _default;
|
@@ -1,28 +1,25 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var _webpack = require(
|
8
|
+
var _webpack = _interopRequireDefault(require("webpack"));
|
8
9
|
|
9
|
-
var
|
10
|
-
|
11
|
-
var _caseSensitivePathsWebpackPlugin = require('case-sensitive-paths-webpack-plugin');
|
12
|
-
|
13
|
-
var _caseSensitivePathsWebpackPlugin2 = _interopRequireDefault(_caseSensitivePathsWebpackPlugin);
|
10
|
+
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
14
11
|
|
15
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
13
|
|
17
|
-
|
18
|
-
|
14
|
+
let getProdPlugins = () => {
|
15
|
+
let plugins = [new _webpack.default.optimize.ModuleConcatenationPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
19
16
|
__TEST__: false,
|
20
17
|
__DEVELOPMENT__: true,
|
21
18
|
__DOCS__: false,
|
22
19
|
__SERVER__: true
|
23
20
|
})];
|
24
|
-
|
25
21
|
return plugins;
|
26
22
|
};
|
27
23
|
|
28
|
-
|
24
|
+
var _default = getProdPlugins;
|
25
|
+
exports.default = _default;
|
@@ -1,25 +1,22 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var _caseSensitivePathsWebpackPlugin = require(
|
8
|
+
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
8
9
|
|
9
|
-
var
|
10
|
+
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
10
11
|
|
11
|
-
var
|
12
|
+
var _plugins = require("../plugins");
|
12
13
|
|
13
|
-
var
|
14
|
-
|
15
|
-
var _webpack = require('webpack');
|
16
|
-
|
17
|
-
var _webpack2 = _interopRequireDefault(_webpack);
|
14
|
+
var _webpack = _interopRequireDefault(require("webpack"));
|
18
15
|
|
19
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
17
|
|
21
|
-
|
22
|
-
|
18
|
+
let getUMDCSSPlugins = () => {
|
19
|
+
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
23
20
|
__TEST__: false,
|
24
21
|
__DEVELOPMENT__: false,
|
25
22
|
__DOCS__: false,
|
@@ -27,13 +24,12 @@ var getUMDCSSPlugins = function getUMDCSSPlugins() {
|
|
27
24
|
NODE_ENV: JSON.stringify('production')
|
28
25
|
},
|
29
26
|
__SERVER__: false
|
30
|
-
}), new
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
chunkFilename: '[id].css'
|
35
|
-
})];
|
27
|
+
}), new _miniCssExtractPlugin.default({
|
28
|
+
filename: 'css/[name].css',
|
29
|
+
chunkFilename: 'css/[id].css'
|
30
|
+
}), new _plugins.UglifyCSSPlugin()];
|
36
31
|
return plugins;
|
37
32
|
};
|
38
33
|
|
39
|
-
|
34
|
+
var _default = getUMDCSSPlugins;
|
35
|
+
exports.default = _default;
|
@@ -1,21 +1,22 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var _caseSensitivePathsWebpackPlugin = require(
|
8
|
+
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
8
9
|
|
9
|
-
var
|
10
|
+
var _webpack = _interopRequireDefault(require("webpack"));
|
10
11
|
|
11
|
-
var
|
12
|
+
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
12
13
|
|
13
|
-
var
|
14
|
+
var _plugins = require("../plugins");
|
14
15
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
let getUMDComponentPlugins = isDocs => {
|
19
|
+
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
19
20
|
__TEST__: false,
|
20
21
|
__DEVELOPMENT__: false,
|
21
22
|
__DOCS__: isDocs ? true : false,
|
@@ -23,8 +24,12 @@ var getUMDComponentPlugins = function getUMDComponentPlugins(isDocs) {
|
|
23
24
|
NODE_ENV: JSON.stringify('production')
|
24
25
|
},
|
25
26
|
__SERVER__: false
|
26
|
-
})
|
27
|
+
}), new _miniCssExtractPlugin.default({
|
28
|
+
filename: 'css/[name].css',
|
29
|
+
chunkFilename: 'css/[name].css'
|
30
|
+
}), new _plugins.UglifyCSSPlugin()];
|
27
31
|
return plugins;
|
28
32
|
};
|
29
33
|
|
30
|
-
|
34
|
+
var _default = getUMDComponentPlugins;
|
35
|
+
exports.default = _default;
|
package/lib/pluginUtils/index.js
CHANGED
@@ -1,70 +1,63 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
|
-
var _getDevPlugins = require('./getDevPlugins');
|
8
|
-
|
9
|
-
Object.defineProperty(exports, 'getDevPlugins', {
|
6
|
+
Object.defineProperty(exports, "getDevPlugins", {
|
10
7
|
enumerable: true,
|
11
|
-
get: function
|
12
|
-
return
|
8
|
+
get: function () {
|
9
|
+
return _getDevPlugins.default;
|
13
10
|
}
|
14
11
|
});
|
15
|
-
|
16
|
-
var _getProdPlugins = require('./getProdPlugins');
|
17
|
-
|
18
|
-
Object.defineProperty(exports, 'getProdPlugins', {
|
12
|
+
Object.defineProperty(exports, "getDocsPlugins", {
|
19
13
|
enumerable: true,
|
20
|
-
get: function
|
21
|
-
return
|
14
|
+
get: function () {
|
15
|
+
return _getDocsPlugins.default;
|
22
16
|
}
|
23
17
|
});
|
24
|
-
|
25
|
-
var _getDocsPlugins = require('./getDocsPlugins');
|
26
|
-
|
27
|
-
Object.defineProperty(exports, 'getDocsPlugins', {
|
18
|
+
Object.defineProperty(exports, "getLibraryPlugins", {
|
28
19
|
enumerable: true,
|
29
|
-
get: function
|
30
|
-
return
|
20
|
+
get: function () {
|
21
|
+
return _getLibraryPlugins.default;
|
31
22
|
}
|
32
23
|
});
|
33
|
-
|
34
|
-
var _getServerPlugins = require('./getServerPlugins');
|
35
|
-
|
36
|
-
Object.defineProperty(exports, 'getServerPlugins', {
|
24
|
+
Object.defineProperty(exports, "getProdPlugins", {
|
37
25
|
enumerable: true,
|
38
|
-
get: function
|
39
|
-
return
|
26
|
+
get: function () {
|
27
|
+
return _getProdPlugins.default;
|
40
28
|
}
|
41
29
|
});
|
42
|
-
|
43
|
-
var _getLibraryPlugins = require('./getLibraryPlugins');
|
44
|
-
|
45
|
-
Object.defineProperty(exports, 'getLibraryPlugins', {
|
30
|
+
Object.defineProperty(exports, "getServerPlugins", {
|
46
31
|
enumerable: true,
|
47
|
-
get: function
|
48
|
-
return
|
32
|
+
get: function () {
|
33
|
+
return _getServerPlugins.default;
|
49
34
|
}
|
50
35
|
});
|
51
|
-
|
52
|
-
var _getUMDComponentPlugins = require('./getUMDComponentPlugins');
|
53
|
-
|
54
|
-
Object.defineProperty(exports, 'getUMDComponentPlugins', {
|
36
|
+
Object.defineProperty(exports, "getUMDCSSPlugins", {
|
55
37
|
enumerable: true,
|
56
|
-
get: function
|
57
|
-
return
|
38
|
+
get: function () {
|
39
|
+
return _getUMDCSSPlugins.default;
|
58
40
|
}
|
59
41
|
});
|
60
|
-
|
61
|
-
var _getUMDCSSPlugins = require('./getUMDCSSPlugins');
|
62
|
-
|
63
|
-
Object.defineProperty(exports, 'getUMDCSSPlugins', {
|
42
|
+
Object.defineProperty(exports, "getUMDComponentPlugins", {
|
64
43
|
enumerable: true,
|
65
|
-
get: function
|
66
|
-
return
|
44
|
+
get: function () {
|
45
|
+
return _getUMDComponentPlugins.default;
|
67
46
|
}
|
68
47
|
});
|
69
48
|
|
49
|
+
var _getDevPlugins = _interopRequireDefault(require("./getDevPlugins"));
|
50
|
+
|
51
|
+
var _getProdPlugins = _interopRequireDefault(require("./getProdPlugins"));
|
52
|
+
|
53
|
+
var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
|
54
|
+
|
55
|
+
var _getServerPlugins = _interopRequireDefault(require("./getServerPlugins"));
|
56
|
+
|
57
|
+
var _getLibraryPlugins = _interopRequireDefault(require("./getLibraryPlugins"));
|
58
|
+
|
59
|
+
var _getUMDComponentPlugins = _interopRequireDefault(require("./getUMDComponentPlugins"));
|
60
|
+
|
61
|
+
var _getUMDCSSPlugins = _interopRequireDefault(require("./getUMDCSSPlugins"));
|
62
|
+
|
70
63
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
9
|
+
|
10
|
+
var _utils = require("../utils");
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
const MODULE_TYPE = 'css/mini-extract';
|
15
|
+
|
16
|
+
const isI18nFile = url => url.endsWith('.i18n.js');
|
17
|
+
|
18
|
+
const {
|
19
|
+
app: {
|
20
|
+
enableSMap
|
21
|
+
}
|
22
|
+
} = (0, _utils.getOptions)();
|
23
|
+
|
24
|
+
class CdnChangePlugin {
|
25
|
+
constructor(options) {
|
26
|
+
this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
|
27
|
+
this.variableName = options.variableName || '__CSS_CDN__';
|
28
|
+
this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
|
29
|
+
this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
|
30
|
+
}
|
31
|
+
|
32
|
+
getCssChunkObject(mainChunk) {
|
33
|
+
const obj = {};
|
34
|
+
|
35
|
+
for (const chunk of mainChunk.getAllAsyncChunks()) {
|
36
|
+
for (const module of chunk.modulesIterable) {
|
37
|
+
if (module.type === MODULE_TYPE) {
|
38
|
+
obj[chunk.id] = 1;
|
39
|
+
break;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
return obj;
|
45
|
+
}
|
46
|
+
|
47
|
+
apply(compiler) {
|
48
|
+
compiler.hooks.thisCompilation.tap('CdnChangePlugin', compilation => {
|
49
|
+
compilation.mainTemplate.hooks.requireEnsure.tap('CdnChangePlugin', (source, chunk) => {
|
50
|
+
const chunkMap = this.getCssChunkObject(chunk);
|
51
|
+
|
52
|
+
if (Object.keys(chunkMap).length > 0) {
|
53
|
+
return source.replace('__webpack_require__.p', `window['${this.variableName}']`);
|
54
|
+
}
|
55
|
+
});
|
56
|
+
});
|
57
|
+
compiler.hooks.make.tap('CdnChangePlugin', compilation => {
|
58
|
+
_htmlWebpackPlugin.default.getHooks(compilation).beforeAssetTagGeneration.tapAsync('CdnChangePlugin', (data, cb) => {
|
59
|
+
data.assets = Object.assign({}, data.assets, {
|
60
|
+
css: data.assets.css.map(css => `${this.cssTemplate}${css}`),
|
61
|
+
js: data.assets.js.map(js => {
|
62
|
+
if (enableSMap && !isI18nFile(js)) {
|
63
|
+
js = js.replace('js/', `{{--js-smap}}js/`); //eslint-disable-line
|
64
|
+
}
|
65
|
+
|
66
|
+
return `${isI18nFile(js) ? this.i18nTemplate : this.jsTemplate}${js}`;
|
67
|
+
})
|
68
|
+
});
|
69
|
+
cb(null, data);
|
70
|
+
});
|
71
|
+
});
|
72
|
+
}
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
var _default = CdnChangePlugin;
|
77
|
+
exports.default = _default;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
class CleanUpStatsPlugin {
|
9
|
+
shouldPickStatChild(child) {
|
10
|
+
return child.name.indexOf('mini-css-extract-plugin') !== 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
apply(compiler) {
|
14
|
+
compiler.hooks.done.tap('CleanUpStatsPlugin', stats => {
|
15
|
+
const {
|
16
|
+
children
|
17
|
+
} = stats.compilation;
|
18
|
+
|
19
|
+
if (Array.isArray(children)) {
|
20
|
+
// eslint-disable-next-line no-param-reassign
|
21
|
+
stats.compilation.children = children.filter(child => this.shouldPickStatChild(child));
|
22
|
+
}
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
exports.default = CleanUpStatsPlugin;
|