@zohodesk/react-cli 1.1.29-exp.1 → 1.1.29-exp.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/lib/babel/babel-option-utils/babel-preset-react-option.js +0 -3
- package/lib/babel/cmjs-plugins-presets.js +1 -8
- package/lib/babel/es-plugins-presets.js +1 -8
- package/lib/common/buildEs.js +1 -0
- package/lib/common/getEntries.js +2 -13
- package/lib/common/getPublicPathConfig.js +0 -6
- package/lib/common/index.js +1 -6
- package/lib/common/runPreProcess.js +6 -15
- package/lib/common/splitChunks.js +2 -21
- package/lib/common/sslcertUpdater.js +7 -18
- package/lib/common/templateParameters.js +0 -2
- package/lib/common/testPattern.js +10 -21
- package/lib/common/valueReplacer.js +1 -16
- package/lib/configs/jest.config.js +1 -10
- package/lib/configs/libAlias.js +8 -14
- package/lib/configs/resolvers.js +4 -14
- package/lib/configs/webpack.component.umd.config.js +1 -6
- package/lib/configs/webpack.css.umd.config.js +6 -14
- package/lib/configs/webpack.dev.config.js +1 -14
- package/lib/configs/webpack.docs.config.js +1 -9
- package/lib/configs/webpack.impact.config.js +1 -8
- package/lib/configs/webpack.prod.config.js +4 -17
- package/lib/constants.js +9 -18
- package/lib/deprecationLogger.js +0 -7
- package/lib/hooks/docsProptypeHook.js +4 -8
- package/lib/jest/commitedFilesResult.js +4 -46
- package/lib/jest/coverageCollector.js +1 -12
- package/lib/jest/jsonMaker.js +0 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +1 -9
- package/lib/jest/preProcessors/jsPreprocessor.js +1 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +1 -4
- package/lib/jest/result.js +1 -23
- package/lib/jest/run.js +7 -18
- package/lib/jest/setup.js +8 -60
- package/lib/loaderUtils/configsAssetsLoaders.js +2 -12
- package/lib/loaderUtils/getCSSLoaders.js +10 -22
- package/lib/loaderUtils/getDevJsLoaders.js +4 -13
- package/lib/loaderUtils/index.js +1 -4
- package/lib/loaderUtils/tests/windowsModification.test.js +0 -1
- package/lib/loaderUtils/windowsModification.js +2 -3
- package/lib/loaders/__test__/markdownLoader.spec.js +0 -1
- package/lib/loaders/composeLoader.js +13 -37
- package/lib/loaders/docsLoader.js +1 -12
- package/lib/loaders/docsPropsLoader.js +4 -8
- package/lib/loaders/enhancedReactLiveConverter.js +2 -23
- package/lib/loaders/fileBountryLoader.js +1 -3
- package/lib/loaders/fileLoader.js +12 -23
- package/lib/loaders/markdownLoader.js +14 -19
- package/lib/loaders/reactLiveConvertor.js +5 -15
- package/lib/loaders/scriptInstrumentLoader.js +7 -16
- package/lib/loaders/selectorMappingLoader.js +7 -26
- package/lib/loaders/workerLoader.js +9 -24
- package/lib/logger.js +0 -4
- package/lib/middlewares/HMRMiddleware.js +13 -27
- package/lib/middlewares/SSTMiddleware.js +1 -5
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +1 -24
- package/lib/pluginUtils/getDevPlugins.js +9 -42
- package/lib/pluginUtils/getDocsPlugins.js +3 -13
- package/lib/pluginUtils/getLibraryImactPlugins.js +5 -6
- package/lib/pluginUtils/getLibraryPlugins.js +2 -8
- package/lib/pluginUtils/getProdPlugins.js +8 -47
- package/lib/pluginUtils/getServerPlugins.js +2 -8
- package/lib/pluginUtils/getUMDCSSPlugins.js +2 -10
- package/lib/pluginUtils/getUMDComponentPlugins.js +2 -10
- package/lib/pluginUtils/index.js +1 -9
- package/lib/plugins/CdnChangePlugin.js +2 -18
- package/lib/plugins/CleanupStatsPlugin.js +0 -5
- package/lib/plugins/CssOrderControlPlugin.js +3 -6
- package/lib/plugins/CustomAttributePlugin.js +14 -19
- package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +3 -23
- package/lib/plugins/EFCPlugin.js +20 -34
- package/lib/plugins/EFCTemplatePlugin.js +19 -30
- package/lib/plugins/EfcResourceCleanupPlugin.js +0 -3
- package/lib/plugins/EventsHandlingPlugin.js +2 -4
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +11 -37
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +10 -15
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +12 -25
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +55 -133
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +12 -23
- package/lib/plugins/I18nSplitPlugin/index.js +13 -24
- package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +64 -58
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
- package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +10 -29
- package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +8 -19
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +1 -8
- package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -20
- package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +0 -1
- package/lib/plugins/ManifestPlugin.js +1 -18
- package/lib/plugins/MinifyPlugin.js +1 -10
- package/lib/plugins/ModuleStatsPlugin.js +1 -24
- package/lib/plugins/OptimizeJSPlugin.js +2 -10
- package/lib/plugins/PublicPathCallbackPlugin.js +1 -12
- package/lib/plugins/PublicPathChangePlugin.js +6 -39
- package/lib/plugins/ReportGeneratePlugin.js +5 -32
- package/lib/plugins/RequireVariablePublicPlugin.js +1 -8
- package/lib/plugins/ResourceHintsPlugin.js +4 -13
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +10 -17
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
- package/lib/plugins/ScriptInstrumentPlugin.js +1 -8
- package/lib/plugins/SelectorPlugin.js +6 -32
- package/lib/plugins/ServiceWorkerPlugin.js +5 -22
- package/lib/plugins/ShadowDOMSupportPlugin.js +4 -41
- package/lib/plugins/SourceMapHookPlugin.js +2 -12
- package/lib/plugins/StatsPlugin.js +0 -14
- package/lib/plugins/TPHashMappingPlugin.js +3 -18
- package/lib/plugins/UnusedFilesFindPlugin.js +4 -39
- package/lib/plugins/VariableConversionCollector.js +15 -42
- package/lib/plugins/index.js +1 -20
- package/lib/plugins/libraryImpactPlugin.js +1 -33
- package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +306 -0
- package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +363 -0
- package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +694 -0
- package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +1258 -0
- package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +542 -0
- package/lib/plugins/newi18nsplitplugin/18nplugin.js +974 -0
- package/lib/plugins/newi18nsplitplugin/ChunkManager.js +131 -0
- package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +59 -0
- package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +262 -0
- package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +166 -0
- package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +111 -0
- package/lib/plugins/newi18nsplitplugin/KeyCollector.js +163 -0
- package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +88 -0
- package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +101 -0
- package/lib/plugins/newi18nsplitplugin/constants.js +162 -0
- package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +78 -0
- package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +22 -0
- package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +18 -0
- package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +580 -0
- package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +54 -0
- package/lib/plugins/utils/classHandling.js +0 -6
- package/lib/plugins/utils/fileHandling.js +6 -15
- package/lib/plugins/utils/tests/fileHandling.test.js +0 -4
- package/lib/plugins/variableConvertorUtils.js +14 -29
- package/lib/plugins/webpackwatchrunplugin.js +0 -5
- package/lib/postcss-plugins/EmptyPlugin.js +3 -4
- package/lib/postcss-plugins/ExcludePlugin.js +1 -5
- package/lib/postcss-plugins/IncludePlugin.js +1 -5
- package/lib/postcss-plugins/RTLSplitPlugin.js +14 -27
- package/lib/postcss-plugins/SelectorReplace.js +1 -16
- package/lib/postcss-plugins/ValueReplacer.js +7 -6
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
- package/lib/postcss-plugins/__test__/selectorReplace.test.js +6 -3
- package/lib/postcss-plugins/__test__/valueReplacer.spec.js +2 -5
- package/lib/postcss-plugins/hoverActivePlugin.js +31 -67
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -7
- package/lib/postcss-plugins/variableModificationPlugin/index.js +28 -49
- package/lib/schemas/index.js +3 -9
- package/lib/servers/clusterHubServer.js +1 -11
- package/lib/servers/devBuild.js +14 -26
- package/lib/servers/docsServer.js +1 -3
- package/lib/servers/docsServerCore.js +1 -22
- package/lib/servers/getCliPath.js +0 -9
- package/lib/servers/helpServer.js +1 -6
- package/lib/servers/httpsOptions.js +2 -8
- package/lib/servers/impactServer.js +3 -35
- package/lib/servers/mockserver.js +1 -10
- package/lib/servers/nowatchserver.js +12 -37
- package/lib/servers/requireLocalOrGlobal.js +6 -17
- package/lib/servers/scrServer.js +14 -21
- package/lib/servers/server.js +6 -36
- package/lib/servers/ssServer.js +1 -17
- package/lib/templates/CoverageScriptTemplate.js +0 -14
- package/lib/templates/WMSTemplate.js +7 -13
- package/lib/templates/linterConstant.js +2 -4
- package/lib/utils/babelPresets.js +3 -7
- package/lib/utils/clean.js +3 -9
- package/lib/utils/copy.js +1 -7
- package/lib/utils/copyTimezones.js +1 -9
- package/lib/utils/createEventStream.js +1 -6
- package/lib/utils/cssClassNameGenerate.js +10 -30
- package/lib/utils/cssURLReplacer.js +1 -22
- package/lib/utils/dependencyPostPublish.js +1 -10
- package/lib/utils/deprecationSupport.js +7 -32
- package/lib/utils/fileUtils.js +1 -28
- package/lib/utils/folderIterator.js +2 -13
- package/lib/utils/getComponents.js +0 -21
- package/lib/utils/getCurrentBranch.js +0 -5
- package/lib/utils/getDependenciesImpactList.js +1 -22
- package/lib/utils/getFileType.js +2 -10
- package/lib/utils/getHash.js +1 -8
- package/lib/utils/getIp.js +0 -2
- package/lib/utils/getOptions.js +16 -53
- package/lib/utils/getServerURL.js +1 -10
- package/lib/utils/index.js +4 -51
- package/lib/utils/init.js +0 -1
- package/lib/utils/initPreCommitHook.js +7 -30
- package/lib/utils/jsonHelper.js +3 -22
- package/lib/utils/libraryImpactConfig.js +2 -5
- package/lib/utils/lint/addScripts.js +2 -5
- package/lib/utils/lint/checkExistingConfig.js +3 -12
- package/lib/utils/lint/copyConfigs.js +0 -3
- package/lib/utils/lint/index.js +0 -9
- package/lib/utils/lint/lintScripts.js +0 -1
- package/lib/utils/lint/lintSetup.js +3 -4
- package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
- package/lib/utils/lint/question.js +0 -7
- package/lib/utils/lintReporter.js +0 -20
- package/lib/utils/log.js +0 -1
- package/lib/utils/mailSender.js +1 -8
- package/lib/utils/object-manipulation.js +1 -17
- package/lib/utils/pullOrigin.js +0 -4
- package/lib/utils/reinstallDependencies.js +1 -29
- package/lib/utils/removeAttributes.js +1 -8
- package/lib/utils/repoClone.js +3 -28
- package/lib/utils/request.js +0 -12
- package/lib/utils/rtl.js +5 -17
- package/lib/utils/selectorReplacer.js +10 -16
- package/lib/utils/setEnvVariables.js +0 -2
- package/lib/utils/ssTestHack.js +1 -11
- package/lib/utils/switchBranch.js +0 -5
- package/lib/utils/typeCheck.js +0 -1
- package/lib/utils/urlConcat.js +0 -4
- package/lib/utils/useExitCleanup.js +9 -10
- package/lib/utils/variableConverter.js +22 -31
- package/{npm-shrinkwrap.json → package-lock.json} +2098 -1999
- package/package.json +1 -1
@@ -4,46 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
-
|
12
9
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
13
|
-
|
14
10
|
var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
|
15
|
-
|
16
11
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
17
|
-
|
18
12
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
19
|
-
|
20
13
|
var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
|
21
|
-
|
22
14
|
var _CssOrderControlPlugin = _interopRequireDefault(require("../plugins/CssOrderControlPlugin"));
|
23
|
-
|
24
15
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
25
|
-
|
26
16
|
var _webpack = _interopRequireDefault(require("webpack"));
|
27
|
-
|
28
17
|
var _plugins = require("../plugins");
|
29
|
-
|
30
18
|
var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
|
31
|
-
|
32
19
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
33
|
-
|
34
20
|
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
35
|
-
|
36
21
|
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
37
|
-
|
38
22
|
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
39
|
-
|
40
23
|
var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
|
41
|
-
|
42
24
|
var _EventsHandlingPlugin = require("../plugins/EventsHandlingPlugin");
|
43
|
-
|
44
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
45
|
-
|
25
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
46
26
|
// import { windowsModification } from '../loaderUtils/windowsModification';
|
27
|
+
|
47
28
|
const getDevPlugins = (options, publicPath) => {
|
48
29
|
const {
|
49
30
|
app: {
|
@@ -86,8 +67,8 @@ const getDevPlugins = (options, publicPath) => {
|
|
86
67
|
} = options;
|
87
68
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
88
69
|
const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
|
89
|
-
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
90
|
-
|
70
|
+
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
71
|
+
// const selectorWeightLocal = windowsModification(exclude.selectorWeight);
|
91
72
|
const pluginsArr = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
92
73
|
__CLIENT__: true,
|
93
74
|
__TEST__: false,
|
@@ -105,7 +86,6 @@ const getDevPlugins = (options, publicPath) => {
|
|
105
86
|
// ignoreOrder: true,
|
106
87
|
chunkFilename: cssLTRFileNameTempalte
|
107
88
|
}), new _plugins.ResourceHintsPlugin(resourceHints)];
|
108
|
-
|
109
89
|
if (enableRTLSplit) {
|
110
90
|
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
111
91
|
templateLabel: options.css.templateLabel,
|
@@ -116,13 +96,11 @@ const getDevPlugins = (options, publicPath) => {
|
|
116
96
|
filename: cssRTLFileNameTempalte
|
117
97
|
}));
|
118
98
|
}
|
119
|
-
|
120
99
|
if (unusedFiles.enable) {
|
121
100
|
pluginsArr.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
122
101
|
origin: _path.default.join(process.cwd(), folder)
|
123
102
|
})));
|
124
103
|
}
|
125
|
-
|
126
104
|
const i18nManifestFileName = 'i18n-manifest.json';
|
127
105
|
/**
|
128
106
|
* NOTE:
|
@@ -133,7 +111,6 @@ const getDevPlugins = (options, publicPath) => {
|
|
133
111
|
|
134
112
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
|
135
113
|
const i18nPublicPath = publicPath || '';
|
136
|
-
|
137
114
|
if (i18n.chunkSplitEnable) {
|
138
115
|
pluginsArr.push(new _I18nSplitPlugin.default({
|
139
116
|
jsResource: i18n.jsResource,
|
@@ -148,7 +125,6 @@ const getDevPlugins = (options, publicPath) => {
|
|
148
125
|
}));
|
149
126
|
} else {
|
150
127
|
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
151
|
-
|
152
128
|
if (_fs.default.existsSync(i18nPath)) {
|
153
129
|
pluginsArr.push(new _copyWebpackPlugin.default([{
|
154
130
|
from: `${i18nPath}/`,
|
@@ -157,7 +133,6 @@ const getDevPlugins = (options, publicPath) => {
|
|
157
133
|
}]));
|
158
134
|
}
|
159
135
|
}
|
160
|
-
|
161
136
|
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
162
137
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
163
138
|
to: `./${tpFolder}/`,
|
@@ -176,7 +151,6 @@ const getDevPlugins = (options, publicPath) => {
|
|
176
151
|
hasEFC,
|
177
152
|
customScriptLoadingStrategey
|
178
153
|
});
|
179
|
-
|
180
154
|
if (hasEFC) {
|
181
155
|
pluginsArr.push(new _plugins.EFCPlugin({
|
182
156
|
isDevelopment: true,
|
@@ -186,11 +160,10 @@ const getDevPlugins = (options, publicPath) => {
|
|
186
160
|
serverUrl: publicPath,
|
187
161
|
entryPointName: 'efc',
|
188
162
|
nameScope: efcNameSpace,
|
189
|
-
localeAttr: efcLocaleAttr
|
190
|
-
|
163
|
+
localeAttr: efcLocaleAttr
|
164
|
+
// outputFile: 'zohodesk-efc-sdk-latest.js',
|
191
165
|
}));
|
192
166
|
}
|
193
|
-
|
194
167
|
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
195
168
|
publicPath: i18nPublicPath,
|
196
169
|
isDevelopment: true,
|
@@ -206,20 +179,17 @@ const getDevPlugins = (options, publicPath) => {
|
|
206
179
|
globalCacheObj: context
|
207
180
|
})));
|
208
181
|
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
209
|
-
|
210
182
|
if (devCssFileBountry) {
|
211
183
|
pluginsArr.push(new _RequireVariablePublicPlugin.default({
|
212
184
|
requireFuncName: 'require'
|
213
185
|
}));
|
214
186
|
}
|
215
|
-
|
216
187
|
if (pluginObject.cssVariableReplacement) {
|
217
188
|
pluginsArr.push(new _VariableConversionCollector.default({
|
218
189
|
cssVariableReplacementConfig,
|
219
190
|
patterns
|
220
191
|
}));
|
221
192
|
}
|
222
|
-
|
223
193
|
if (pluginObject.selectorWeight) {
|
224
194
|
pluginsArr.push(new _SelectorPlugin.default({
|
225
195
|
selectorWeightConfig,
|
@@ -227,14 +197,11 @@ const getDevPlugins = (options, publicPath) => {
|
|
227
197
|
patterns
|
228
198
|
}));
|
229
199
|
}
|
230
|
-
|
231
|
-
|
200
|
+
pluginsArr.push(new _EventsHandlingPlugin.EventsHandlingPlugin());
|
201
|
+
// if (pluginObject.minifier) {
|
232
202
|
// // console.log('minifier active');
|
233
203
|
// pluginsArr.push(new MinifierPlugin());
|
234
204
|
// }
|
235
|
-
|
236
205
|
return pluginsArr.filter(Boolean);
|
237
206
|
};
|
238
|
-
|
239
|
-
var _default = getDevPlugins;
|
240
|
-
exports.default = _default;
|
207
|
+
var _default = exports.default = getDevPlugins;
|
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
9
|
-
|
10
8
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
11
|
-
|
12
9
|
var _webpack = _interopRequireDefault(require("webpack"));
|
13
|
-
|
14
10
|
var _path = _interopRequireDefault(require("path"));
|
15
|
-
|
16
11
|
var _plugins = require("../plugins");
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
20
13
|
// isForLibraryImpact this variable for now only used in getLibraryImactPlugins.
|
21
14
|
// So you gona use it please check with that function as well
|
15
|
+
|
22
16
|
let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
|
23
17
|
let {
|
24
18
|
app: {
|
@@ -38,7 +32,6 @@ let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
|
|
38
32
|
filename: 'css/[name].css',
|
39
33
|
chunkFilename: 'css/[name].css'
|
40
34
|
})].filter(Boolean);
|
41
|
-
|
42
35
|
if (unusedFiles.enable) {
|
43
36
|
plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
44
37
|
docsFilename: 'Undocsfiles.json',
|
@@ -46,9 +39,6 @@ let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
|
|
46
39
|
origin: _path.default.join(process.cwd(), folder)
|
47
40
|
})));
|
48
41
|
}
|
49
|
-
|
50
42
|
return plugins;
|
51
43
|
};
|
52
|
-
|
53
|
-
var _default = getDocsPlugins;
|
54
|
-
exports.default = _default;
|
44
|
+
var _default = exports.default = getDocsPlugins;
|
@@ -4,16 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = getLibraryImactPlugins;
|
7
|
-
|
8
7
|
var _libraryImpactPlugin = _interopRequireDefault(require("../plugins/libraryImpactPlugin"));
|
9
|
-
|
10
8
|
var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
|
11
|
-
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
14
10
|
// import ModuleStatsPlugin from '../plugins/ModuleStatsPlugin';
|
11
|
+
|
15
12
|
function getLibraryImactPlugins(options) {
|
16
|
-
let plugins = (0, _getDocsPlugins.default)(false, options, true);
|
13
|
+
let plugins = (0, _getDocsPlugins.default)(false, options, true);
|
14
|
+
|
15
|
+
// for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
|
17
16
|
// plugins.filter(plugin => !(plugin instanceof ModuleStatsPlugin));
|
18
17
|
|
19
18
|
plugins.push(new _libraryImpactPlugin.default({
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
9
|
-
|
10
8
|
var _webpack = _interopRequireDefault(require("webpack"));
|
11
|
-
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
14
10
|
let getLibraryPlugins = () => {
|
15
11
|
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
16
12
|
__TEST__: false,
|
@@ -23,6 +19,4 @@ let getLibraryPlugins = () => {
|
|
23
19
|
})];
|
24
20
|
return plugins;
|
25
21
|
};
|
26
|
-
|
27
|
-
var _default = getLibraryPlugins;
|
28
|
-
exports.default = _default;
|
22
|
+
var _default = exports.default = getLibraryPlugins;
|
@@ -4,47 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
-
|
12
9
|
var _webpack = _interopRequireDefault(require("webpack"));
|
13
|
-
|
14
10
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
15
|
-
|
16
11
|
var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
17
|
-
|
18
12
|
var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
|
19
|
-
|
20
13
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
21
|
-
|
22
14
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
23
|
-
|
24
15
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
25
|
-
|
26
16
|
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
27
|
-
|
28
17
|
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
29
|
-
|
30
18
|
var _EventsHandlingPlugin = require("../plugins/EventsHandlingPlugin");
|
31
|
-
|
32
19
|
var _plugins = require("../plugins");
|
33
|
-
|
34
20
|
var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
|
35
|
-
|
36
21
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
37
|
-
|
38
22
|
var _CssOrderControlPlugin = _interopRequireDefault(require("../plugins/CssOrderControlPlugin"));
|
39
|
-
|
40
23
|
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
41
|
-
|
42
24
|
var _StatsPlugin = _interopRequireDefault(require("../plugins/StatsPlugin"));
|
43
|
-
|
44
25
|
var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
|
45
|
-
|
46
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
47
|
-
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
48
27
|
// eslint-disable-next-line no-unused-vars
|
49
28
|
const getProdPlugins = (options, publicPath = '') => {
|
50
29
|
let {
|
@@ -125,7 +104,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
125
104
|
filename: cssLTRFileNameTempalte,
|
126
105
|
chunkFilename: cssLTRFileNameTempalte
|
127
106
|
}), new _plugins.ResourceHintsPlugin(options.resourceHints), new _plugins.MinifyPlugin()];
|
128
|
-
|
129
107
|
if (enableRTLSplit) {
|
130
108
|
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
131
109
|
templateLabel: options.css.templateLabel,
|
@@ -136,7 +114,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
136
114
|
filename: cssRTLFileNameTempalte
|
137
115
|
}));
|
138
116
|
}
|
139
|
-
|
140
117
|
const i18nManifestFileName = 'i18n-manifest.json';
|
141
118
|
/**
|
142
119
|
* NOTE:
|
@@ -146,7 +123,8 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
146
123
|
*/
|
147
124
|
|
148
125
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
|
149
|
-
const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : '';
|
126
|
+
const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : '';
|
127
|
+
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[contentHash]_.js';
|
150
128
|
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
|
151
129
|
|
152
130
|
if (i18n.chunkSplitEnable) {
|
@@ -163,7 +141,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
163
141
|
}));
|
164
142
|
} else {
|
165
143
|
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
166
|
-
|
167
144
|
if (_fs.default.existsSync(i18nPath)) {
|
168
145
|
pluginsArr.push(new _copyWebpackPlugin.default([{
|
169
146
|
from: `${i18nPath}/`,
|
@@ -172,7 +149,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
172
149
|
}]));
|
173
150
|
}
|
174
151
|
}
|
175
|
-
|
176
152
|
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
177
153
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
178
154
|
to: `./${tpFolder}/`,
|
@@ -187,7 +163,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
187
163
|
crossorigin,
|
188
164
|
hasEFC
|
189
165
|
});
|
190
|
-
|
191
166
|
if (hasEFC) {
|
192
167
|
pluginsArr.push(new _plugins.EFCPlugin({
|
193
168
|
isDevelopment,
|
@@ -202,7 +177,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
202
177
|
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
203
178
|
}));
|
204
179
|
}
|
205
|
-
|
206
180
|
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
207
181
|
// Because we will handle cdn url in CdnChangePlugin
|
208
182
|
publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
|
@@ -212,7 +186,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
212
186
|
i18nManifestFileName,
|
213
187
|
mainChunkName: 'main'
|
214
188
|
}));
|
215
|
-
|
216
189
|
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
217
190
|
const {
|
218
191
|
callback
|
@@ -224,24 +197,20 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
224
197
|
resourceHints
|
225
198
|
}));
|
226
199
|
}
|
227
|
-
|
228
200
|
if (cdnMapping.isCdnEnabled) {
|
229
201
|
pluginsArr.push(new _plugins.CdnChangePlugin(cdnMapping));
|
230
202
|
}
|
231
|
-
|
232
203
|
pluginsArr.push(new _lodashWebpackPlugin.default({
|
233
204
|
collections: true,
|
234
205
|
shorthands: true
|
235
206
|
}));
|
236
207
|
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
237
|
-
|
238
208
|
if (!isDevelopment) {
|
239
209
|
enableSMap && enableSMapHook && pluginsArr.push(new _plugins.SourceMapHookPlugin());
|
240
210
|
optimize && pluginsArr.push(new _plugins.OptimizeJSPlugin());
|
241
211
|
pluginsArr.push(new _plugins.ManifestPlugin({
|
242
212
|
fileName: manifestFileName
|
243
213
|
}));
|
244
|
-
|
245
214
|
if (bundleAnalyze) {
|
246
215
|
pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
247
216
|
analyzerMode: 'static',
|
@@ -256,9 +225,9 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
256
225
|
assets: true,
|
257
226
|
assetsSort: 'name'
|
258
227
|
}
|
259
|
-
}));
|
228
|
+
}));
|
229
|
+
// plugins.push(new ReportGeneratePlugin());
|
260
230
|
}
|
261
|
-
|
262
231
|
if (tpHashMapping && tpHashMapping.length > 0) {
|
263
232
|
pluginsArr.push(new _plugins.TPHashMappingPlugin({
|
264
233
|
fileMappings: tpHashMapping,
|
@@ -266,7 +235,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
266
235
|
}));
|
267
236
|
}
|
268
237
|
}
|
269
|
-
|
270
238
|
if (!isDevelopment && serviceWorker.enableSw) {
|
271
239
|
const {
|
272
240
|
filePath,
|
@@ -274,11 +242,9 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
274
242
|
exitPath = '/',
|
275
243
|
replaceText = '@@'
|
276
244
|
} = serviceWorker;
|
277
|
-
|
278
245
|
if (!filePath) {
|
279
246
|
throw new Error('File Path required for service worker plugin');
|
280
247
|
}
|
281
|
-
|
282
248
|
pluginsArr.push(new _plugins.ServiceWorkerPlugin({
|
283
249
|
filePath: _path.default.join(process.cwd(), filePath),
|
284
250
|
i18nFileNameTemplate,
|
@@ -288,23 +254,20 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
288
254
|
publicPaths
|
289
255
|
}));
|
290
256
|
}
|
291
|
-
|
292
257
|
if (pluginObject.cssVariableReplacement) {
|
293
258
|
pluginsArr.push(new _VariableConversionCollector.default({
|
294
259
|
cssVariableReplacementConfig,
|
295
260
|
patterns
|
296
261
|
}));
|
297
262
|
}
|
298
|
-
|
299
263
|
if (pluginObject.selectorWeight) {
|
300
264
|
pluginsArr.push(new _SelectorPlugin.default({
|
301
265
|
selectorWeightConfig,
|
302
266
|
exclude: exclude.selectorWeight,
|
303
267
|
patterns
|
304
268
|
}));
|
305
|
-
}
|
306
|
-
|
307
|
-
|
269
|
+
}
|
270
|
+
// plugins.push(new VariableConversionCollector({}));
|
308
271
|
cssOrderControler.enable && pluginsArr.push(new _CssOrderControlPlugin.default(cssOrderControler));
|
309
272
|
customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
|
310
273
|
customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
|
@@ -318,6 +281,4 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
318
281
|
pluginsArr.push(new _EventsHandlingPlugin.EventsHandlingPlugin());
|
319
282
|
return pluginsArr;
|
320
283
|
};
|
321
|
-
|
322
|
-
var _default = getProdPlugins;
|
323
|
-
exports.default = _default;
|
284
|
+
var _default = exports.default = getProdPlugins;
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _webpack = _interopRequireDefault(require("webpack"));
|
9
|
-
|
10
8
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
11
|
-
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
14
10
|
let getProdPlugins = () => {
|
15
11
|
let plugins = [new _webpack.default.optimize.ModuleConcatenationPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
16
12
|
__TEST__: false,
|
@@ -20,6 +16,4 @@ let getProdPlugins = () => {
|
|
20
16
|
})];
|
21
17
|
return plugins;
|
22
18
|
};
|
23
|
-
|
24
|
-
var _default = getProdPlugins;
|
25
|
-
exports.default = _default;
|
19
|
+
var _default = exports.default = getProdPlugins;
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
9
|
-
|
10
8
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
11
|
-
|
12
9
|
var _plugins = require("../plugins");
|
13
|
-
|
14
10
|
var _webpack = _interopRequireDefault(require("webpack"));
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
18
12
|
let getUMDCSSPlugins = () => {
|
19
13
|
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
20
14
|
__TEST__: false,
|
@@ -30,6 +24,4 @@ let getUMDCSSPlugins = () => {
|
|
30
24
|
}), new _plugins.MinifyPlugin()];
|
31
25
|
return plugins;
|
32
26
|
};
|
33
|
-
|
34
|
-
var _default = getUMDCSSPlugins;
|
35
|
-
exports.default = _default;
|
27
|
+
var _default = exports.default = getUMDCSSPlugins;
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
9
|
-
|
10
8
|
var _webpack = _interopRequireDefault(require("webpack"));
|
11
|
-
|
12
9
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
13
|
-
|
14
10
|
var _plugins = require("../plugins");
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
18
12
|
let getUMDComponentPlugins = isDocs => {
|
19
13
|
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
20
14
|
__TEST__: false,
|
@@ -30,6 +24,4 @@ let getUMDComponentPlugins = isDocs => {
|
|
30
24
|
}), new _plugins.MinifyPlugin()];
|
31
25
|
return plugins;
|
32
26
|
};
|
33
|
-
|
34
|
-
var _default = getUMDComponentPlugins;
|
35
|
-
exports.default = _default;
|
27
|
+
var _default = exports.default = getUMDComponentPlugins;
|
package/lib/pluginUtils/index.js
CHANGED
@@ -45,19 +45,11 @@ Object.defineProperty(exports, "getUMDComponentPlugins", {
|
|
45
45
|
return _getUMDComponentPlugins.default;
|
46
46
|
}
|
47
47
|
});
|
48
|
-
|
49
48
|
var _getDevPlugins = _interopRequireDefault(require("./getDevPlugins"));
|
50
|
-
|
51
49
|
var _getProdPlugins = _interopRequireDefault(require("./getProdPlugins"));
|
52
|
-
|
53
50
|
var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
|
54
|
-
|
55
51
|
var _getServerPlugins = _interopRequireDefault(require("./getServerPlugins"));
|
56
|
-
|
57
52
|
var _getLibraryPlugins = _interopRequireDefault(require("./getLibraryPlugins"));
|
58
|
-
|
59
53
|
var _getUMDComponentPlugins = _interopRequireDefault(require("./getUMDComponentPlugins"));
|
60
|
-
|
61
54
|
var _getUMDCSSPlugins = _interopRequireDefault(require("./getUMDCSSPlugins"));
|
62
|
-
|
63
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
55
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
@@ -4,23 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
9
|
-
|
10
8
|
var _utils = require("../utils");
|
11
|
-
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
14
10
|
const MODULE_TYPE = 'css/mini-extract';
|
15
|
-
|
16
11
|
const isI18nFile = url => url.endsWith('.i18n.js');
|
17
|
-
|
18
12
|
const {
|
19
13
|
app: {
|
20
14
|
enableSMap
|
21
15
|
}
|
22
16
|
} = (0, _utils.getOptions)();
|
23
|
-
|
24
17
|
class CdnChangePlugin {
|
25
18
|
constructor(options) {
|
26
19
|
this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
|
@@ -28,10 +21,8 @@ class CdnChangePlugin {
|
|
28
21
|
this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
|
29
22
|
this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
|
30
23
|
}
|
31
|
-
|
32
24
|
getCssChunkObject(mainChunk) {
|
33
25
|
const obj = {};
|
34
|
-
|
35
26
|
for (const chunk of mainChunk.getAllAsyncChunks()) {
|
36
27
|
for (const module of chunk.modulesIterable) {
|
37
28
|
if (module.type === MODULE_TYPE) {
|
@@ -40,15 +31,12 @@ class CdnChangePlugin {
|
|
40
31
|
}
|
41
32
|
}
|
42
33
|
}
|
43
|
-
|
44
34
|
return obj;
|
45
35
|
}
|
46
|
-
|
47
36
|
apply(compiler) {
|
48
37
|
compiler.hooks.thisCompilation.tap('CdnChangePlugin', compilation => {
|
49
38
|
compilation.mainTemplate.hooks.requireEnsure.tap('CdnChangePlugin', (source, chunk) => {
|
50
39
|
const chunkMap = this.getCssChunkObject(chunk);
|
51
|
-
|
52
40
|
if (Object.keys(chunkMap).length > 0) {
|
53
41
|
return source.replace('__webpack_require__.p', `window['${this.variableName}']`);
|
54
42
|
}
|
@@ -62,7 +50,6 @@ class CdnChangePlugin {
|
|
62
50
|
if (enableSMap && !isI18nFile(js)) {
|
63
51
|
js = js.replace('js/', `{{--js-smap}}js/`); //eslint-disable-line
|
64
52
|
}
|
65
|
-
|
66
53
|
return `${isI18nFile(js) ? this.i18nTemplate : this.jsTemplate}${js}`;
|
67
54
|
})
|
68
55
|
});
|
@@ -70,8 +57,5 @@ class CdnChangePlugin {
|
|
70
57
|
});
|
71
58
|
});
|
72
59
|
}
|
73
|
-
|
74
60
|
}
|
75
|
-
|
76
|
-
var _default = CdnChangePlugin;
|
77
|
-
exports.default = _default;
|
61
|
+
var _default = exports.default = CdnChangePlugin;
|
@@ -4,25 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
class CleanUpStatsPlugin {
|
9
8
|
shouldPickStatChild(child) {
|
10
9
|
return child.name.indexOf('mini-css-extract-plugin') !== 0;
|
11
10
|
}
|
12
|
-
|
13
11
|
apply(compiler) {
|
14
12
|
compiler.hooks.done.tap('CleanUpStatsPlugin', stats => {
|
15
13
|
const {
|
16
14
|
children
|
17
15
|
} = stats.compilation;
|
18
|
-
|
19
16
|
if (Array.isArray(children)) {
|
20
17
|
// eslint-disable-next-line no-param-reassign
|
21
18
|
stats.compilation.children = children.filter(child => this.shouldPickStatChild(child));
|
22
19
|
}
|
23
20
|
});
|
24
21
|
}
|
25
|
-
|
26
22
|
}
|
27
|
-
|
28
23
|
exports.default = CleanUpStatsPlugin;
|
@@ -4,17 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
class CssOrderControlPlugin {
|
9
8
|
constructor(options) {
|
10
9
|
this.options = {
|
11
10
|
className: options.className
|
12
11
|
};
|
13
12
|
}
|
14
|
-
|
15
13
|
apply(compiler) {
|
16
14
|
// NOTE: we not using this, Reason currently this option is only need for EFC,
|
17
15
|
// So it do not needed.
|
16
|
+
|
18
17
|
const className = this.options.className;
|
19
18
|
compiler.hooks.thisCompilation.tap({
|
20
19
|
name: 'CssOrderControlPlugin',
|
@@ -23,14 +22,12 @@ class CssOrderControlPlugin {
|
|
23
22
|
compilation.mainTemplate.hooks.requireEnsure.tap('CssOrderControlPlugin', source => {
|
24
23
|
// const str = attributeSetTemplate(cssAttributes, 'linkTag');
|
25
24
|
const replacedStr = source.replace('head.appendChild(linkTag);', `var referenceTag = document.getElementById('${className}');
|
26
|
-
head.insertBefore(linkTag, referenceTag);`);
|
27
|
-
|
25
|
+
head.insertBefore(linkTag, referenceTag);`);
|
26
|
+
// console.log({ s: source, r: replacedStr });
|
28
27
|
return replacedStr;
|
29
28
|
});
|
30
29
|
}
|
31
30
|
});
|
32
31
|
}
|
33
|
-
|
34
32
|
}
|
35
|
-
|
36
33
|
exports.default = CssOrderControlPlugin;
|