@zohodesk/react-cli 0.0.1-exp.175.1 → 0.0.1-exp.176.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -180
  3. package/.prettierrc +6 -6
  4. package/README.md +1025 -1028
  5. package/bin/cli.js +482 -482
  6. package/cert/Tsicsezwild-22-23.crt +37 -37
  7. package/cert/Tsicsezwild-22-23.key +27 -27
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevStart.md +18 -18
  10. package/docs/HoverActive.md +12 -12
  11. package/docs/InstallNode.md +28 -28
  12. package/docs/SelectorWeight.md +6 -0
  13. package/docs/TODOS.md +10 -10
  14. package/docs/ValueReplacer.md +60 -60
  15. package/docs/VariableConversion.md +719 -678
  16. package/docs/warnings_while_install.txt +35 -35
  17. package/files/eslintrc.js +62 -62
  18. package/files/prettierrc.js +3 -3
  19. package/lib/babel/cmjs-plugins-presets.js +4 -0
  20. package/lib/babel/es-plugins-presets.js +4 -0
  21. package/lib/common/getEntries.js +10 -0
  22. package/lib/common/getPublicPathConfig.js +6 -0
  23. package/lib/common/index.js +5 -0
  24. package/lib/common/splitChunks.js +13 -2
  25. package/lib/common/sslcertUpdater.js +17 -6
  26. package/lib/common/templateParameters.js +2 -0
  27. package/lib/common/testPattern.js +21 -10
  28. package/lib/common/valueReplacer.js +15 -0
  29. package/lib/configs/jest.config.js +9 -0
  30. package/lib/configs/libAlias.js +2 -4
  31. package/lib/configs/webpack.component.umd.config.js +5 -0
  32. package/lib/configs/webpack.css.umd.config.js +13 -5
  33. package/lib/configs/webpack.dev.config.js +36 -2
  34. package/lib/configs/webpack.docs.config.js +21 -1
  35. package/lib/configs/webpack.impact.config.js +19 -1
  36. package/lib/configs/webpack.prod.config.js +37 -3
  37. package/lib/hooks/docsProptypeHook.js +7 -3
  38. package/lib/jest/commitedFilesResult.js +45 -3
  39. package/lib/jest/coverageCollector.js +11 -0
  40. package/lib/jest/jsonMaker.js +6 -0
  41. package/lib/jest/preProcessors/cssPreprocessor.js +8 -0
  42. package/lib/jest/preProcessors/jsPreprocessor.js +2 -0
  43. package/lib/jest/preProcessors/otherFilesPreprocessor.js +3 -0
  44. package/lib/jest/result.js +22 -0
  45. package/lib/jest/run.js +17 -6
  46. package/lib/jest/setup.js +57 -5
  47. package/lib/loaderUtils/configsAssetsLoaders.js +44 -34
  48. package/lib/loaderUtils/getCSSLoaders.js +35 -20
  49. package/lib/loaderUtils/getDevJsLoaders.js +8 -0
  50. package/lib/loaderUtils/index.js +3 -0
  51. package/lib/loaderUtils/windowsModification.js +11 -0
  52. package/lib/loaders/docsLoader.js +7 -0
  53. package/lib/loaders/docsPropsLoader.js +7 -3
  54. package/lib/loaders/fileBountryLoader.js +2 -0
  55. package/lib/loaders/fileLoader.js +22 -11
  56. package/lib/loaders/scriptInstrumentLoader.js +13 -5
  57. package/lib/loaders/selectorMappingLoader.js +25 -7
  58. package/lib/loaders/workerLoader.js +29 -13
  59. package/lib/middlewares/HMRMiddleware.js +26 -13
  60. package/lib/middlewares/SSTMiddleware.js +3 -0
  61. package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -3
  62. package/lib/pluginUtils/getDevPlugins.js +68 -22
  63. package/lib/pluginUtils/getDocsPlugins.js +10 -1
  64. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -4
  65. package/lib/pluginUtils/getLibraryPlugins.js +5 -0
  66. package/lib/pluginUtils/getProdPlugins.js +77 -28
  67. package/lib/pluginUtils/getServerPlugins.js +5 -0
  68. package/lib/pluginUtils/getUMDCSSPlugins.js +7 -0
  69. package/lib/pluginUtils/getUMDComponentPlugins.js +7 -0
  70. package/lib/pluginUtils/index.js +8 -0
  71. package/lib/plugins/CdnChangePlugin.js +14 -0
  72. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  73. package/lib/plugins/EFCPlugin.js +34 -23
  74. package/lib/plugins/EFCPlugin.md +6 -6
  75. package/lib/plugins/EFCTemplatePlugin.js +32 -23
  76. package/lib/plugins/I18NInjectIntoIndexPlugin.js +38 -12
  77. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +17 -12
  78. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  79. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +77 -46
  80. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +59 -44
  81. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +30 -21
  82. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  83. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  84. package/lib/plugins/I18nSplitPlugin/index.js +80 -70
  85. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  86. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  87. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  88. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +6 -0
  89. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  90. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -2
  91. package/lib/plugins/ManifestPlugin.js +17 -0
  92. package/lib/plugins/ModuleStatsPlugin.js +23 -0
  93. package/lib/plugins/OptimizeJSPlugin.js +7 -0
  94. package/lib/plugins/PublicPathCallbackPlugin.js +10 -0
  95. package/lib/plugins/PublicPathChangePlugin.js +36 -4
  96. package/lib/plugins/ReportGeneratePlugin.js +30 -4
  97. package/lib/plugins/RequireVariablePublicPlugin.js +6 -0
  98. package/lib/plugins/ResourceHintsPlugin.js +27 -20
  99. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  100. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +22 -15
  101. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  102. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  103. package/lib/plugins/ScriptInstrumentPlugin.js +7 -0
  104. package/lib/plugins/SelectorPlugin.js +97 -0
  105. package/lib/plugins/ServiceWorkerPlugin.js +29 -13
  106. package/lib/plugins/ShadowDOMSupportPlugin.js +40 -3
  107. package/lib/plugins/SourceMapHookPlugin.js +9 -0
  108. package/lib/plugins/TPHashMappingPlugin.js +19 -5
  109. package/lib/plugins/UglifyCSSPlugin.js +9 -0
  110. package/lib/plugins/UnusedFilesFindPlugin.js +35 -2
  111. package/lib/plugins/VariableConversionCollector.js +322 -0
  112. package/lib/plugins/composeCommonPlugin.js +30 -0
  113. package/lib/plugins/index.js +19 -0
  114. package/lib/plugins/libraryImpactPlugin.js +32 -0
  115. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  116. package/lib/postcss-plugins/ExcludePlugin.js +4 -0
  117. package/lib/postcss-plugins/RTLSplitPlugin.js +37 -24
  118. package/lib/postcss-plugins/ValueReplacer.js +6 -9
  119. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  120. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  121. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  122. package/lib/postcss-plugins/hoverActivePlugin.js +69 -33
  123. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +42 -13
  124. package/lib/postcss-plugins/variableModificationPlugin/index.js +216 -141
  125. package/lib/postcss-plugins/variableModifier.js +20 -13
  126. package/lib/schemas/index.js +23 -4
  127. package/lib/servers/clusterHubServer.js +10 -0
  128. package/lib/servers/devBuild.js +24 -13
  129. package/lib/servers/docsServer.js +2 -0
  130. package/lib/servers/docsServerCore.js +21 -0
  131. package/lib/servers/getCliPath.js +9 -0
  132. package/lib/servers/helpServer.js +5 -0
  133. package/lib/servers/httpsOptions.js +4 -0
  134. package/lib/servers/impactServer.js +34 -2
  135. package/lib/servers/mockserver.js +9 -0
  136. package/lib/servers/nowatchserver.js +34 -12
  137. package/lib/servers/scrServer.js +20 -13
  138. package/lib/servers/server.js +35 -7
  139. package/lib/servers/ssServer.js +16 -0
  140. package/lib/sh/pre-commit.sh +34 -34
  141. package/lib/sh/reportPublish.sh +45 -45
  142. package/lib/templates/CoverageScriptTemplate.js +14 -0
  143. package/lib/templates/WMSTemplate.js +12 -6
  144. package/lib/utils/babelPresets.js +2 -0
  145. package/lib/utils/buildstats.html +148 -148
  146. package/lib/utils/clean.js +8 -2
  147. package/lib/utils/copy.js +6 -0
  148. package/lib/utils/copyTimezones.js +8 -0
  149. package/lib/utils/createEventStream.js +4 -0
  150. package/lib/utils/cssClassNameGenerate.js +19 -3
  151. package/lib/utils/cssURLReplacer.js +25 -0
  152. package/lib/utils/dependencyPostPublish.js +9 -0
  153. package/lib/utils/fileUtils.js +26 -0
  154. package/lib/utils/folderIterator.js +10 -0
  155. package/lib/utils/getComponents.js +21 -0
  156. package/lib/utils/getCurrentBranch.js +5 -0
  157. package/lib/utils/getDependenciesImpactList.js +21 -0
  158. package/lib/utils/getHash.js +7 -0
  159. package/lib/utils/getIp.js +2 -0
  160. package/lib/utils/getOptions.js +39 -14
  161. package/lib/utils/getServerURL.js +7 -0
  162. package/lib/utils/index.js +47 -2
  163. package/lib/utils/init.js +1 -0
  164. package/lib/utils/initPreCommitHook.js +29 -6
  165. package/lib/utils/jsonHelper.js +19 -2
  166. package/lib/utils/libraryImpactConfig.js +2 -0
  167. package/lib/utils/lint/addScripts.js +5 -2
  168. package/lib/utils/lint/checkExistingConfig.js +12 -3
  169. package/lib/utils/lint/copyConfigs.js +3 -0
  170. package/lib/utils/lint/index.js +9 -0
  171. package/lib/utils/lint/lintScripts.js +1 -0
  172. package/lib/utils/lint/lintSetup.js +4 -3
  173. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  174. package/lib/utils/lint/question.js +7 -0
  175. package/lib/utils/lintReporter.js +20 -0
  176. package/lib/utils/mailSender.js +7 -0
  177. package/lib/utils/pullOrigin.js +4 -0
  178. package/lib/utils/reinstallDependencies.js +28 -0
  179. package/lib/utils/removeAttributes.js +7 -0
  180. package/lib/utils/repoClone.js +27 -2
  181. package/lib/utils/request.js +12 -0
  182. package/lib/utils/resultSchema.json +73 -73
  183. package/lib/utils/rtl.js +16 -4
  184. package/lib/utils/setEnvVariables.js +2 -0
  185. package/lib/utils/ssTestHack.js +10 -0
  186. package/lib/utils/switchBranch.js +4 -0
  187. package/lib/utils/urlConcat.js +4 -0
  188. package/lib/utils/useExitCleanup.js +10 -9
  189. package/npm8.md +9 -9
  190. package/package.json +146 -146
  191. package/postpublish.js +6 -6
  192. package/templates/app/.eslintrc.js +140 -140
  193. package/templates/app/README.md +12 -12
  194. package/templates/app/app/index.html +24 -24
  195. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  196. package/templates/app/app/properties/i18nkeys.json +3 -3
  197. package/templates/app/docs/all.html +69 -69
  198. package/templates/app/mockapi/index.js +18 -18
  199. package/templates/app/package.json +37 -37
  200. package/templates/app/src/actions/SampleActions/index.js +37 -37
  201. package/templates/app/src/actions/index.js +65 -65
  202. package/templates/app/src/appUrls.js +19 -19
  203. package/templates/app/src/components/Alert/Alert.js +134 -134
  204. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  205. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  206. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  207. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  208. package/templates/app/src/components/Sample/SampleList.js +61 -61
  209. package/templates/app/src/components/Slider/Slider.css +41 -41
  210. package/templates/app/src/components/Slider/Slider.js +55 -55
  211. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  212. package/templates/app/src/containers/AppContainer/index.js +96 -96
  213. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  214. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  215. package/templates/app/src/containers/DevTools/index.js +10 -10
  216. package/templates/app/src/containers/Header/index.js +67 -67
  217. package/templates/app/src/containers/Header/index.module.css +43 -43
  218. package/templates/app/src/containers/Redirect/index.js +63 -63
  219. package/templates/app/src/containers/Redirector/index.js +47 -47
  220. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  221. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  222. package/templates/app/src/historyChange.js +5 -5
  223. package/templates/app/src/index.html +10 -10
  224. package/templates/app/src/index.js +24 -24
  225. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  226. package/templates/app/src/reducers/alertData.js +11 -11
  227. package/templates/app/src/reducers/index.js +6 -6
  228. package/templates/app/src/reducers/samples.js +19 -19
  229. package/templates/app/src/store/configureStore.dev.js +51 -51
  230. package/templates/app/src/store/configureStore.js +5 -5
  231. package/templates/app/src/store/configureStore.prod.js +26 -26
  232. package/templates/app/src/util/Common.js +5 -5
  233. package/templates/app/src/util/RequestAPI.js +132 -132
  234. package/templates/docs/all.html +249 -249
  235. package/templates/docs/component.html +178 -178
  236. package/templates/docs/components.html +221 -221
  237. package/templates/docs/css/b.min.css +6 -6
  238. package/templates/docs/css/component.css +42 -42
  239. package/templates/docs/css/componentTest.css +6 -6
  240. package/templates/docs/css/hopscotch.css +585 -585
  241. package/templates/docs/css/style.css +1022 -1022
  242. package/templates/docs/impactReportTemplate.html +154 -154
  243. package/templates/docs/index.html +1501 -1501
  244. package/templates/docs/js/active-line.js +72 -72
  245. package/templates/docs/js/b.min.js +7 -7
  246. package/templates/docs/js/codemirror.js +9680 -9680
  247. package/templates/docs/js/designTokens.js +334 -334
  248. package/templates/docs/js/j.min.js +4 -4
  249. package/templates/docs/js/javascript.js +874 -874
  250. package/templates/docs/js/matchbrackets.js +145 -145
@@ -4,19 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
11
+
9
12
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
13
+
10
14
  var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
15
+
11
16
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
17
+
12
18
  var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
19
+
13
20
  var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
21
+
14
22
  var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
23
+
15
24
  var _webpack = _interopRequireDefault(require("webpack"));
25
+
16
26
  var _plugins = require("../plugins");
27
+
17
28
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
29
+
30
+ var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
31
+
32
+ var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
33
+
18
34
  var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
35
+
19
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
38
+ // import { windowsModification } from '../loaderUtils/windowsModification';
20
39
  const getDevPlugins = (options, publicPath) => {
21
40
  const {
22
41
  app: {
@@ -27,6 +46,10 @@ const getDevPlugins = (options, publicPath) => {
27
46
  context,
28
47
  hasEFC: prevOptionForEnableEFC,
29
48
  hasShadowDOM,
49
+ cssVariableReplacementConfig,
50
+ plugins: pluginObject,
51
+ // exclude,
52
+ selectorWeightConfig,
30
53
  server: {
31
54
  mode
32
55
  },
@@ -49,8 +72,9 @@ const getDevPlugins = (options, publicPath) => {
49
72
  } = options;
50
73
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
51
74
  const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
52
- const cssRTLFileNameTempalte = 'css/[name].rtl.css';
53
- const plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
75
+ const cssRTLFileNameTempalte = 'css/[name].rtl.css'; // const selectorWeightLocal = windowsModification(exclude.selectorWeight);
76
+
77
+ const pluginsArr = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
54
78
  __CLIENT__: true,
55
79
  __TEST__: false,
56
80
  __SERVER__: false,
@@ -66,8 +90,9 @@ const getDevPlugins = (options, publicPath) => {
66
90
  // ignoreOrder: true,
67
91
  chunkFilename: cssLTRFileNameTempalte
68
92
  }), new _plugins.ResourceHintsPlugin()];
93
+
69
94
  if (enableRTLSplit) {
70
- plugins.push(new _RtlCssPlugin.RtlCssPlugin({
95
+ pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
71
96
  templateLabel: options.css.templateLabel,
72
97
  dirVarName: options.css.dirVarName,
73
98
  disableMiniFiySelector: options.css.disableMiniFiySelector,
@@ -76,23 +101,26 @@ const getDevPlugins = (options, publicPath) => {
76
101
  filename: cssRTLFileNameTempalte
77
102
  }));
78
103
  }
104
+
79
105
  if (unusedFiles.enable) {
80
- plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
106
+ pluginsArr.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
81
107
  origin: _path.default.join(process.cwd(), folder)
82
108
  })));
83
109
  }
110
+
84
111
  const i18nManifestFileName = 'i18n-manifest.json';
85
- /**
86
- * NOTE:
87
- * this file name ext .i18n.js added
88
- * Because, in service worker they maintain cache as file name based
89
- * So, to make differce we added .i18n.js ext.
112
+ /**
113
+ * NOTE:
114
+ * this file name ext .i18n.js added
115
+ * Because, in service worker they maintain cache as file name based
116
+ * So, to make differce we added .i18n.js ext.
90
117
  */
91
118
 
92
119
  const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
93
120
  const i18nPublicPath = publicPath || '';
121
+
94
122
  if (i18n.chunkSplitEnable) {
95
- plugins.push(new _I18nSplitPlugin.default({
123
+ pluginsArr.push(new _I18nSplitPlugin.default({
96
124
  jsResource: i18n.jsResource,
97
125
  localeVarName: i18n.localeVarName,
98
126
  jsonpFunc: i18n.jsonpFunc,
@@ -105,24 +133,26 @@ const getDevPlugins = (options, publicPath) => {
105
133
  }));
106
134
  } else {
107
135
  const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
136
+
108
137
  if (_fs.default.existsSync(i18nPath)) {
109
- plugins.push(new _copyWebpackPlugin.default([{
138
+ pluginsArr.push(new _copyWebpackPlugin.default([{
110
139
  from: `${i18nPath}/`,
111
140
  to: './i18n/[name].[ext]',
112
141
  toType: 'template'
113
142
  }]));
114
143
  }
115
144
  }
116
- tpFolder && plugins.push(new _copyWebpackPlugin.default([{
145
+
146
+ tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
117
147
  from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
118
148
  to: `./${tpFolder}/`,
119
149
  toType: 'dir'
120
150
  }]));
121
- plugins.push(new _lodashWebpackPlugin.default({
151
+ pluginsArr.push(new _lodashWebpackPlugin.default({
122
152
  collections: true,
123
153
  shorthands: true
124
154
  }));
125
- (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
155
+ (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
126
156
  enableChunkHash: false,
127
157
  folder,
128
158
  minify: false,
@@ -130,8 +160,9 @@ const getDevPlugins = (options, publicPath) => {
130
160
  crossorigin,
131
161
  hasEFC
132
162
  });
163
+
133
164
  if (hasEFC) {
134
- plugins.push(new _plugins.EFCPlugin({
165
+ pluginsArr.push(new _plugins.EFCPlugin({
135
166
  isDevelopment: true,
136
167
  i18nManifestFileName,
137
168
  templateFilePath,
@@ -139,12 +170,12 @@ const getDevPlugins = (options, publicPath) => {
139
170
  serverUrl: publicPath,
140
171
  entryPointName: 'efc',
141
172
  nameScope: efcNameSpace,
142
- localeAttr: efcLocaleAttr
143
- // outputFile: 'zohodesk-efc-sdk-latest.js',
173
+ localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
174
+
144
175
  }));
145
176
  }
146
177
 
147
- plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
178
+ pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
148
179
  publicPath: i18nPublicPath,
149
180
  isDevelopment: true,
150
181
  templateLabel: i18n.templateLabel || '{{--user-locale}}',
@@ -152,14 +183,29 @@ const getDevPlugins = (options, publicPath) => {
152
183
  i18nManifestFileName,
153
184
  mainChunkName: 'main'
154
185
  }));
155
- instrumentScript && plugins.push(new _plugins.ScriptInstrumentPlugin());
156
- hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
186
+ instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
187
+ hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
188
+
157
189
  if (devCssFileBountry) {
158
- plugins.push(new _RequireVariablePublicPlugin.default({
190
+ pluginsArr.push(new _RequireVariablePublicPlugin.default({
159
191
  requireFuncName: 'require'
160
192
  }));
161
193
  }
162
- return plugins.filter(Boolean);
194
+
195
+ if (pluginObject.cssVariableReplacement) {
196
+ pluginsArr.push(new _VariableConversionCollector.default({
197
+ cssVariableReplacementConfig
198
+ }));
199
+ }
200
+
201
+ if (pluginObject.selectorWeight) {
202
+ pluginsArr.push(new _SelectorPlugin.default({
203
+ selectorWeightConfig
204
+ }));
205
+ }
206
+
207
+ return pluginsArr.filter(Boolean);
163
208
  };
209
+
164
210
  var _default = getDevPlugins;
165
211
  exports.default = _default;
@@ -4,15 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
9
+
8
10
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
11
+
9
12
  var _webpack = _interopRequireDefault(require("webpack"));
13
+
10
14
  var _path = _interopRequireDefault(require("path"));
15
+
11
16
  var _plugins = require("../plugins");
17
+
12
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
13
20
  // isForLibraryImpact this variable for now only used in getLibraryImactPlugins.
14
21
  // So you gona use it please check with that function as well
15
-
16
22
  let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
17
23
  let {
18
24
  app: {
@@ -32,6 +38,7 @@ let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
32
38
  filename: 'css/[name].css',
33
39
  chunkFilename: 'css/[name].css'
34
40
  })].filter(Boolean);
41
+
35
42
  if (unusedFiles.enable) {
36
43
  plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
37
44
  docsFilename: 'Undocsfiles.json',
@@ -39,7 +46,9 @@ let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
39
46
  origin: _path.default.join(process.cwd(), folder)
40
47
  })));
41
48
  }
49
+
42
50
  return plugins;
43
51
  };
52
+
44
53
  var _default = getDocsPlugins;
45
54
  exports.default = _default;
@@ -4,15 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getLibraryImactPlugins;
7
+
7
8
  var _libraryImpactPlugin = _interopRequireDefault(require("../plugins/libraryImpactPlugin"));
9
+
8
10
  var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- // import ModuleStatsPlugin from '../plugins/ModuleStatsPlugin';
11
13
 
14
+ // import ModuleStatsPlugin from '../plugins/ModuleStatsPlugin';
12
15
  function getLibraryImactPlugins(options) {
13
- let plugins = (0, _getDocsPlugins.default)(false, options, true);
14
-
15
- // for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
16
+ let plugins = (0, _getDocsPlugins.default)(false, options, true); // for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
16
17
  // plugins.filter(plugin => !(plugin instanceof ModuleStatsPlugin));
17
18
 
18
19
  plugins.push(new _libraryImpactPlugin.default({
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
9
+
8
10
  var _webpack = _interopRequireDefault(require("webpack"));
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  let getLibraryPlugins = () => {
11
15
  let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
12
16
  __TEST__: false,
@@ -19,5 +23,6 @@ let getLibraryPlugins = () => {
19
23
  })];
20
24
  return plugins;
21
25
  };
26
+
22
27
  var _default = getLibraryPlugins;
23
28
  exports.default = _default;
@@ -4,19 +4,37 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
11
+
9
12
  var _webpack = _interopRequireDefault(require("webpack"));
13
+
10
14
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
15
+
11
16
  var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
17
+
12
18
  var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
19
+
13
20
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
21
+
14
22
  var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
23
+
15
24
  var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
25
+
26
+ var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
27
+
28
+ var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
29
+
16
30
  var _plugins = require("../plugins");
31
+
17
32
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
33
+
18
34
  var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
35
+
19
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
20
38
  // eslint-disable-next-line no-unused-vars
21
39
  const getProdPlugins = (options, publicPath = '') => {
22
40
  let {
@@ -38,6 +56,10 @@ const getProdPlugins = (options, publicPath = '') => {
38
56
  mode
39
57
  },
40
58
  hasShadowDOM,
59
+ cssVariableReplacementConfig,
60
+ plugins: pluginObject,
61
+ // exclude,
62
+ selectorWeightConfig,
41
63
  resourceHints,
42
64
  serviceWorker,
43
65
  htmlTemplate,
@@ -67,7 +89,7 @@ const getProdPlugins = (options, publicPath = '') => {
67
89
  const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
68
90
  const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
69
91
  enableChunkHash = !isDevelopment && enableChunkHash;
70
- const plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
92
+ const pluginsArr = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
71
93
  __TEST__: false,
72
94
  __DEVELOPMENT__: false,
73
95
  __LOCAL_PRODUCTION__: isDevelopment,
@@ -81,8 +103,9 @@ const getProdPlugins = (options, publicPath = '') => {
81
103
  filename: cssLTRFileNameTempalte,
82
104
  chunkFilename: cssLTRFileNameTempalte
83
105
  }), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
106
+
84
107
  if (enableRTLSplit) {
85
- plugins.push(new _RtlCssPlugin.RtlCssPlugin({
108
+ pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
86
109
  templateLabel: options.css.templateLabel,
87
110
  disableMiniFiySelector: options.css.disableMiniFiySelector,
88
111
  dirVarName: options.css.dirVarName,
@@ -91,21 +114,21 @@ const getProdPlugins = (options, publicPath = '') => {
91
114
  filename: cssRTLFileNameTempalte
92
115
  }));
93
116
  }
117
+
94
118
  const i18nManifestFileName = 'i18n-manifest.json';
95
- /**
96
- * NOTE:
97
- * this file name ext .i18n.js added
98
- * Because, in service worker they maintain cache as file name based
99
- * So, to make differce we added .i18n.js ext.
119
+ /**
120
+ * NOTE:
121
+ * this file name ext .i18n.js added
122
+ * Because, in service worker they maintain cache as file name based
123
+ * So, to make differce we added .i18n.js ext.
100
124
  */
101
125
 
102
126
  const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
103
- const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : '';
104
- // const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[contentHash]_.js';
127
+ const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : ''; // const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[contentHash]_.js';
105
128
  // const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
106
129
 
107
130
  if (i18n.chunkSplitEnable) {
108
- plugins.push(new _I18nSplitPlugin.default({
131
+ pluginsArr.push(new _I18nSplitPlugin.default({
109
132
  jsResource: i18n.jsResource,
110
133
  localeVarName: i18n.localeVarName,
111
134
  jsonpFunc: i18n.jsonpFunc,
@@ -118,20 +141,22 @@ const getProdPlugins = (options, publicPath = '') => {
118
141
  }));
119
142
  } else {
120
143
  const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
144
+
121
145
  if (_fs.default.existsSync(i18nPath)) {
122
- plugins.push(new _copyWebpackPlugin.default([{
146
+ pluginsArr.push(new _copyWebpackPlugin.default([{
123
147
  from: `${i18nPath}/`,
124
148
  to: enableChunkHash ? './i18n/[name].[hash:20]_.[ext]' : './i18n/[name]_.[ext]',
125
149
  toType: 'template'
126
150
  }]));
127
151
  }
128
152
  }
129
- tpFolder && plugins.push(new _copyWebpackPlugin.default([{
153
+
154
+ tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
130
155
  from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
131
156
  to: `./${tpFolder}/`,
132
157
  toType: 'dir'
133
158
  }]));
134
- (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
159
+ (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
135
160
  enableChunkHash,
136
161
  folder,
137
162
  inject,
@@ -139,8 +164,9 @@ const getProdPlugins = (options, publicPath = '') => {
139
164
  crossorigin,
140
165
  hasEFC
141
166
  });
167
+
142
168
  if (hasEFC) {
143
- plugins.push(new _plugins.EFCPlugin({
169
+ pluginsArr.push(new _plugins.EFCPlugin({
144
170
  isDevelopment,
145
171
  serverUrl: publicPath,
146
172
  i18nFileNameTemplate,
@@ -153,7 +179,8 @@ const getProdPlugins = (options, publicPath = '') => {
153
179
  cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
154
180
  }));
155
181
  }
156
- plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
182
+
183
+ pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
157
184
  // Because we will handle cdn url in CdnChangePlugin
158
185
  publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
159
186
  isDevelopment,
@@ -162,33 +189,38 @@ const getProdPlugins = (options, publicPath = '') => {
162
189
  i18nManifestFileName,
163
190
  mainChunkName: 'main'
164
191
  }));
192
+
165
193
  if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
166
194
  const {
167
195
  callback
168
196
  } = publicPaths;
169
- plugins.push(callback ? new _plugins.PublicPathCallbackPlugin({
197
+ pluginsArr.push(callback ? new _plugins.PublicPathCallbackPlugin({
170
198
  callback
171
199
  }) : new _plugins.PublicPathChangePlugin({
172
200
  publicPaths,
173
201
  resourceHints
174
202
  }));
175
203
  }
204
+
176
205
  if (cdnMapping.isCdnEnabled) {
177
- plugins.push(new _plugins.CdnChangePlugin(cdnMapping));
206
+ pluginsArr.push(new _plugins.CdnChangePlugin(cdnMapping));
178
207
  }
179
- plugins.push(new _lodashWebpackPlugin.default({
208
+
209
+ pluginsArr.push(new _lodashWebpackPlugin.default({
180
210
  collections: true,
181
211
  shorthands: true
182
212
  }));
183
- hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
213
+ hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
214
+
184
215
  if (!isDevelopment) {
185
- enableSMap && enableSMapHook && plugins.push(new _plugins.SourceMapHookPlugin());
186
- optimize && plugins.push(new _plugins.OptimizeJSPlugin());
187
- plugins.push(new _plugins.ManifestPlugin({
216
+ enableSMap && enableSMapHook && pluginsArr.push(new _plugins.SourceMapHookPlugin());
217
+ optimize && pluginsArr.push(new _plugins.OptimizeJSPlugin());
218
+ pluginsArr.push(new _plugins.ManifestPlugin({
188
219
  fileName: manifestFileName
189
220
  }));
221
+
190
222
  if (bundleAnalyze) {
191
- plugins.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
223
+ pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
192
224
  analyzerMode: 'static',
193
225
  generateStatsFile: true,
194
226
  openAnalyzer: false,
@@ -201,17 +233,17 @@ const getProdPlugins = (options, publicPath = '') => {
201
233
  assets: true,
202
234
  assetsSort: 'name'
203
235
  }
204
- }));
205
- // plugins.push(new ReportGeneratePlugin());
236
+ })); // plugins.push(new ReportGeneratePlugin());
206
237
  }
207
238
 
208
239
  if (tpHashMapping && tpHashMapping.length > 0) {
209
- plugins.push(new _plugins.TPHashMappingPlugin({
240
+ pluginsArr.push(new _plugins.TPHashMappingPlugin({
210
241
  fileMappings: tpHashMapping,
211
242
  tpFolder: `${_path.default.join(process.cwd(), context, tpFolder)}/`
212
243
  }));
213
244
  }
214
245
  }
246
+
215
247
  if (!isDevelopment && serviceWorker.enableSw) {
216
248
  const {
217
249
  filePath,
@@ -219,10 +251,12 @@ const getProdPlugins = (options, publicPath = '') => {
219
251
  exitPath = '/',
220
252
  replaceText = '@@'
221
253
  } = serviceWorker;
254
+
222
255
  if (!filePath) {
223
256
  throw new Error('File Path required for service worker plugin');
224
257
  }
225
- plugins.push(new _plugins.ServiceWorkerPlugin({
258
+
259
+ pluginsArr.push(new _plugins.ServiceWorkerPlugin({
226
260
  filePath: _path.default.join(process.cwd(), filePath),
227
261
  i18nFileNameTemplate,
228
262
  fileName: fileName,
@@ -231,7 +265,22 @@ const getProdPlugins = (options, publicPath = '') => {
231
265
  publicPaths
232
266
  }));
233
267
  }
234
- return plugins;
268
+
269
+ if (pluginObject.cssVariableReplacement) {
270
+ pluginsArr.push(new _VariableConversionCollector.default({
271
+ cssVariableReplacementConfig
272
+ }));
273
+ }
274
+
275
+ if (pluginObject.selectorWeight) {
276
+ pluginsArr.push(new _SelectorPlugin.default({
277
+ selectorWeightConfig
278
+ }));
279
+ } // plugins.push(new VariableConversionCollector({}));
280
+
281
+
282
+ return pluginsArr;
235
283
  };
284
+
236
285
  var _default = getProdPlugins;
237
286
  exports.default = _default;
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _webpack = _interopRequireDefault(require("webpack"));
9
+
8
10
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  let getProdPlugins = () => {
11
15
  let plugins = [new _webpack.default.optimize.ModuleConcatenationPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
12
16
  __TEST__: false,
@@ -16,5 +20,6 @@ let getProdPlugins = () => {
16
20
  })];
17
21
  return plugins;
18
22
  };
23
+
19
24
  var _default = getProdPlugins;
20
25
  exports.default = _default;
@@ -4,11 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
9
+
8
10
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
11
+
9
12
  var _plugins = require("../plugins");
13
+
10
14
  var _webpack = _interopRequireDefault(require("webpack"));
15
+
11
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
12
18
  let getUMDCSSPlugins = () => {
13
19
  let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
14
20
  __TEST__: false,
@@ -24,5 +30,6 @@ let getUMDCSSPlugins = () => {
24
30
  }), new _plugins.UglifyCSSPlugin()];
25
31
  return plugins;
26
32
  };
33
+
27
34
  var _default = getUMDCSSPlugins;
28
35
  exports.default = _default;
@@ -4,11 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
9
+
8
10
  var _webpack = _interopRequireDefault(require("webpack"));
11
+
9
12
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
13
+
10
14
  var _plugins = require("../plugins");
15
+
11
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
12
18
  let getUMDComponentPlugins = isDocs => {
13
19
  let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
14
20
  __TEST__: false,
@@ -24,5 +30,6 @@ let getUMDComponentPlugins = isDocs => {
24
30
  }), new _plugins.UglifyCSSPlugin()];
25
31
  return plugins;
26
32
  };
33
+
27
34
  var _default = getUMDComponentPlugins;
28
35
  exports.default = _default;
@@ -45,11 +45,19 @@ Object.defineProperty(exports, "getUMDComponentPlugins", {
45
45
  return _getUMDComponentPlugins.default;
46
46
  }
47
47
  });
48
+
48
49
  var _getDevPlugins = _interopRequireDefault(require("./getDevPlugins"));
50
+
49
51
  var _getProdPlugins = _interopRequireDefault(require("./getProdPlugins"));
52
+
50
53
  var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
54
+
51
55
  var _getServerPlugins = _interopRequireDefault(require("./getServerPlugins"));
56
+
52
57
  var _getLibraryPlugins = _interopRequireDefault(require("./getLibraryPlugins"));
58
+
53
59
  var _getUMDComponentPlugins = _interopRequireDefault(require("./getUMDComponentPlugins"));
60
+
54
61
  var _getUMDCSSPlugins = _interopRequireDefault(require("./getUMDCSSPlugins"));
62
+
55
63
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4,16 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
9
+
8
10
  var _utils = require("../utils");
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  const MODULE_TYPE = 'css/mini-extract';
15
+
11
16
  const isI18nFile = url => url.endsWith('.i18n.js');
17
+
12
18
  const {
13
19
  app: {
14
20
  enableSMap
15
21
  }
16
22
  } = (0, _utils.getOptions)();
23
+
17
24
  class CdnChangePlugin {
18
25
  constructor(options) {
19
26
  this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
@@ -21,8 +28,10 @@ class CdnChangePlugin {
21
28
  this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
22
29
  this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
23
30
  }
31
+
24
32
  getCssChunkObject(mainChunk) {
25
33
  const obj = {};
34
+
26
35
  for (const chunk of mainChunk.getAllAsyncChunks()) {
27
36
  for (const module of chunk.modulesIterable) {
28
37
  if (module.type === MODULE_TYPE) {
@@ -31,12 +40,15 @@ class CdnChangePlugin {
31
40
  }
32
41
  }
33
42
  }
43
+
34
44
  return obj;
35
45
  }
46
+
36
47
  apply(compiler) {
37
48
  compiler.hooks.thisCompilation.tap('CdnChangePlugin', compilation => {
38
49
  compilation.mainTemplate.hooks.requireEnsure.tap('CdnChangePlugin', (source, chunk) => {
39
50
  const chunkMap = this.getCssChunkObject(chunk);
51
+
40
52
  if (Object.keys(chunkMap).length > 0) {
41
53
  return source.replace('__webpack_require__.p', `window['${this.variableName}']`);
42
54
  }
@@ -58,6 +70,8 @@ class CdnChangePlugin {
58
70
  });
59
71
  });
60
72
  }
73
+
61
74
  }
75
+
62
76
  var _default = CdnChangePlugin;
63
77
  exports.default = _default;