@zohodesk/client_build_tool 0.0.22-exp.3 → 0.0.22-exp.5

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.
Files changed (242) hide show
  1. package/README.md +0 -723
  2. package/README_backup.md +0 -723
  3. package/app/README.MD +30 -0
  4. package/app/es/test.js +47 -0
  5. package/app/package.json +12 -0
  6. package/lib/schemas/defaultConfigValues.js +2 -2
  7. package/lib/schemas/defaultConfigValuesOnly.js +0 -5
  8. package/lib/shared/babel/babelWebConfig.js +2 -1
  9. package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -4
  10. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/utils.js +15 -0
  11. package/lib/shared/bundler/webpack/entryConfig.js +2 -3
  12. package/lib/shared/bundler/webpack/moduleConcatenationConfig.js +18 -0
  13. package/lib/shared/bundler/webpack/optimizationConfig.js +4 -9
  14. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +1 -1
  15. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +1 -1
  16. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +1 -1
  17. package/package.json +1 -1
  18. package/es/allCommandsConfigs.js +0 -15
  19. package/es/commands/build/commandExecutor.js +0 -6
  20. package/es/commands/build/config.js +0 -5
  21. package/es/commands/build/optionsProcessor.js +0 -25
  22. package/es/commands/build/preProcessor.js +0 -4
  23. package/es/commands/buildEs/commandExecutor.js +0 -29
  24. package/es/commands/buildEs/config.js +0 -5
  25. package/es/commands/buildEs/preProcessor.js +0 -9
  26. package/es/commands/buildLib/commandExecutor.js +0 -24
  27. package/es/commands/buildLib/config.js +0 -5
  28. package/es/commands/buildLib/preProcessor.js +0 -9
  29. package/es/commands/mockserver/commandExecutor.js +0 -32
  30. package/es/commands/mockserver/config.js +0 -5
  31. package/es/commands/pre_process/commandExecutor.js +0 -10
  32. package/es/commands/pre_process/config.js +0 -5
  33. package/es/commands/start/commandExecutor.js +0 -4
  34. package/es/commands/start/config.js +0 -5
  35. package/es/commands/start/optionsProcessor.js +0 -21
  36. package/es/commands/start/preProcessor.js +0 -4
  37. package/es/commands/template/commandExecutor.js +0 -17
  38. package/es/commands/template/config.js +0 -5
  39. package/es/commands/version/commandExecutor.js +0 -5
  40. package/es/commands/version/config.js +0 -5
  41. package/es/commandsRouter.js +0 -58
  42. package/es/index.js +0 -4
  43. package/es/logger.js +0 -23
  44. package/es/schemas/applyValuesToSchema/index.js +0 -25
  45. package/es/schemas/applyValuesToSchema/isObject.js +0 -3
  46. package/es/schemas/applyValuesToSchema/isValid.js +0 -7
  47. package/es/schemas/cliArgsToObject.js +0 -32
  48. package/es/schemas/defaultConfigValues.js +0 -394
  49. package/es/schemas/defaultConfigValuesOnly.js +0 -196
  50. package/es/schemas/deprecatedOptionsHandler.js +0 -60
  51. package/es/schemas/getNpmVersion.js +0 -13
  52. package/es/schemas/giveDefaultValue.js +0 -11
  53. package/es/schemas/npmConfigToObject.js +0 -27
  54. package/es/schemas/readOptions.js +0 -67
  55. package/es/schemas/readOptionsForConfigFile.js +0 -28
  56. package/es/shared/babel/addDefaultPlugins.js +0 -8
  57. package/es/shared/babel/babelWebConfig.js +0 -43
  58. package/es/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -21
  59. package/es/shared/babel/getBabelPlugin.js +0 -36
  60. package/es/shared/babel/runBabelForJSFile.js +0 -15
  61. package/es/shared/babel/runBabelForTsFile.js +0 -34
  62. package/es/shared/bundler/webpack/common/decidePublicPath.js +0 -45
  63. package/es/shared/bundler/webpack/common/libAlias.js +0 -24
  64. package/es/shared/bundler/webpack/common/modeUtils.js +0 -24
  65. package/es/shared/bundler/webpack/common/nameTemplates.js +0 -95
  66. package/es/shared/bundler/webpack/common/resourceBasedPublicPath.js +0 -12
  67. package/es/shared/bundler/webpack/configCustomLoaders.js +0 -3
  68. package/es/shared/bundler/webpack/cssLoaders.js +0 -8
  69. package/es/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +0 -76
  70. package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +0 -102
  71. package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +0 -36
  72. package/es/shared/bundler/webpack/custom_plugins/ChunkHierarchyPlugin.js +0 -65
  73. package/es/shared/bundler/webpack/custom_plugins/CssCustomOrderPlugin.js +0 -37
  74. package/es/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +0 -97
  75. package/es/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +0 -98
  76. package/es/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +0 -211
  77. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +0 -11
  78. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +0 -160
  79. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +0 -66
  80. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +0 -201
  81. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +0 -95
  82. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +0 -59
  83. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -82
  84. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +0 -25
  85. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +0 -13
  86. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -15
  87. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +0 -72
  88. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +0 -23
  89. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +0 -40
  90. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +0 -59
  91. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -15
  92. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +0 -22
  93. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +0 -35
  94. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +0 -70
  95. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +0 -56
  96. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -6
  97. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +0 -10
  98. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -2
  99. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -121
  100. package/es/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +0 -85
  101. package/es/shared/bundler/webpack/custom_plugins/InjectChunkGraphPlugin.js +0 -47
  102. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +0 -20
  103. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +0 -11
  104. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -26
  105. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -11
  106. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -34
  107. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -11
  108. package/es/shared/bundler/webpack/custom_plugins/MurphyInjectorPlugin/index.js +0 -79
  109. package/es/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +0 -0
  110. package/es/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +0 -185
  111. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +0 -47
  112. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +0 -70
  113. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +0 -34
  114. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +0 -14
  115. package/es/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -63
  116. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -9
  117. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +0 -63
  118. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +0 -43
  119. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +0 -7
  120. package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +0 -104
  121. package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -6
  122. package/es/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +0 -74
  123. package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +0 -10
  124. package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +0 -36
  125. package/es/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +0 -35
  126. package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +0 -52
  127. package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +0 -341
  128. package/es/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +0 -67
  129. package/es/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -7
  130. package/es/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +0 -43
  131. package/es/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +0 -79
  132. package/es/shared/bundler/webpack/defaultVendorPatternList.js +0 -3
  133. package/es/shared/bundler/webpack/devtoolConfig.js +0 -6
  134. package/es/shared/bundler/webpack/entryConfig.js +0 -25
  135. package/es/shared/bundler/webpack/externals.js +0 -10
  136. package/es/shared/bundler/webpack/getCSSLoaders.js +0 -17
  137. package/es/shared/bundler/webpack/getFilenameFromModule.js +0 -15
  138. package/es/shared/bundler/webpack/jsLoaders.js +0 -16
  139. package/es/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -4
  140. package/es/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +0 -10
  141. package/es/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +0 -45
  142. package/es/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -11
  143. package/es/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +0 -23
  144. package/es/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -13
  145. package/es/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -71
  146. package/es/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +0 -56
  147. package/es/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +0 -11
  148. package/es/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +0 -40
  149. package/es/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +0 -116
  150. package/es/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +0 -5
  151. package/es/shared/bundler/webpack/loaders/workerLoader.js +0 -121
  152. package/es/shared/bundler/webpack/optimizationConfig.js +0 -42
  153. package/es/shared/bundler/webpack/outputConfig.js +0 -35
  154. package/es/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +0 -30
  155. package/es/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -27
  156. package/es/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +0 -17
  157. package/es/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +0 -16
  158. package/es/shared/bundler/webpack/pluginConfigs/configChunkHierarchyPlugin.js +0 -10
  159. package/es/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +0 -50
  160. package/es/shared/bundler/webpack/pluginConfigs/configCssCustomOrderPlugin.js +0 -8
  161. package/es/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -12
  162. package/es/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -67
  163. package/es/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -37
  164. package/es/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -43
  165. package/es/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +0 -52
  166. package/es/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +0 -17
  167. package/es/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +0 -29
  168. package/es/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -8
  169. package/es/shared/bundler/webpack/pluginConfigs/configInjectChunkGraphPlugin.js +0 -12
  170. package/es/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -36
  171. package/es/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +0 -13
  172. package/es/shared/bundler/webpack/pluginConfigs/configMurphyInjectorPlugin.js +0 -19
  173. package/es/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +0 -18
  174. package/es/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +0 -11
  175. package/es/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -19
  176. package/es/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +0 -20
  177. package/es/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +0 -18
  178. package/es/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +0 -29
  179. package/es/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -12
  180. package/es/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +0 -20
  181. package/es/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +0 -15
  182. package/es/shared/bundler/webpack/plugins.js +0 -33
  183. package/es/shared/bundler/webpack/resolvers.js +0 -70
  184. package/es/shared/bundler/webpack/splitChunksConfig.js +0 -106
  185. package/es/shared/bundler/webpack/statsConfig.js +0 -23
  186. package/es/shared/bundler/webpack/tsLoaders.js +0 -16
  187. package/es/shared/bundler/webpack/utils/index.js +0 -8
  188. package/es/shared/bundler/webpack/utils/object-manipulation.js +0 -82
  189. package/es/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -29
  190. package/es/shared/bundler/webpack/webpackBuild.js +0 -14
  191. package/es/shared/bundler/webpack/webpackConfig.js +0 -35
  192. package/es/shared/commands-utils/doBasicRequirementCheck.js +0 -10
  193. package/es/shared/commands-utils/getCliPath.js +0 -28
  194. package/es/shared/commands-utils/index.js +0 -3
  195. package/es/shared/commands-utils/log.js +0 -4
  196. package/es/shared/commands-utils/readArgsFormCommandLine.js +0 -4
  197. package/es/shared/commands-utils/readOptionFormCommandLine.js +0 -4
  198. package/es/shared/commands-utils/spawnSyncIO.js +0 -24
  199. package/es/shared/constants.js +0 -22
  200. package/es/shared/fileUtils/copyFile.js +0 -23
  201. package/es/shared/fileUtils/directoryIterator.js +0 -12
  202. package/es/shared/fileUtils/watchRun.js +0 -96
  203. package/es/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +0 -18
  204. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +0 -2
  205. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +0 -58
  206. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +0 -122
  207. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +0 -22
  208. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -11
  209. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +0 -13
  210. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -17
  211. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +0 -32
  212. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -28
  213. package/es/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +0 -125
  214. package/es/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -82
  215. package/es/shared/postcss/custom_postcss_plugins/ValueReplacer.js +0 -50
  216. package/es/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +0 -318
  217. package/es/shared/postcss/filterPluginsAllowedForSpecficFile.js +0 -41
  218. package/es/shared/postcss/getAllowedPostCssPlugins.js +0 -20
  219. package/es/shared/postcss/getSpecificPostCssPlugin.js +0 -38
  220. package/es/shared/postcss/runPostCssForCssFile.js +0 -25
  221. package/es/shared/pre_process/runPreProcess.js +0 -47
  222. package/es/shared/server/configWebpackDevMiddleware.js +0 -26
  223. package/es/shared/server/corsHandling.js +0 -23
  224. package/es/shared/server/getIp.js +0 -18
  225. package/es/shared/server/getServerURL.js +0 -28
  226. package/es/shared/server/httpsOptions.js +0 -36
  227. package/es/shared/server/initExpressApp.js +0 -9
  228. package/es/shared/server/initialHTMLHandling.js +0 -92
  229. package/es/shared/server/mockApiHandler.js +0 -53
  230. package/es/shared/server/mockServer.js +0 -34
  231. package/es/shared/server/serveContextFiles.js +0 -17
  232. package/es/shared/server/serverBywebpackDevMiddleware.js +0 -21
  233. package/es/shared/server/startHttpServer.js +0 -18
  234. package/es/shared/server/startHttpsServer.js +0 -26
  235. package/es/shared/server/unwanted/addHttp2Server.js +0 -32
  236. package/es/shared/server/unwanted/configWebpackDevMiddleware.js +0 -35
  237. package/es/shared/server/unwanted/mockApiSupport.js +0 -11
  238. package/es/shared/server/unwanted/websocketMockSetup.js +0 -36
  239. package/es/shared/server/urlConcat.js +0 -35
  240. package/es/shared/utils/requireLocalOrGlobal.js +0 -57
  241. package/es/shared/utils/utils.js +0 -0
  242. package/es/shared/utils/versionPrint.js +0 -9
@@ -1,102 +0,0 @@
1
- import HtmlWebpackPlugin from 'html-webpack-plugin'; // import { RuntimeGlobals, RuntimeModule } from 'webpack';
2
-
3
- import { RuntimeGlobals } from 'webpack'; // eslint-disable-next-line import/extensions
4
-
5
- import { isI18nFile } from "../../common/nameTemplates"; // import { Template } from 'webpack';
6
- // eslint-disable-next-line import/extensions
7
-
8
- import { isProductionMode } from "../../common/modeUtils";
9
- import CustomizedGetChunkFilenameRuntimeModule from "./webpackCustomJsUrlLoader";
10
- const pluginName = 'CdnChangePlugin'; // const MODULE_TYPE = 'css/mini-extract';
11
- // class CdnChangeRuntimePlugin extends RuntimeModule {
12
- // constructor(compiler, { variableName }) {
13
- // super('cdn loading', 10);
14
- // this.variableName = variableName;
15
- // }
16
- // generate() {
17
- // return `${RuntimeGlobals.getChunkCssFilename} = function(chunkId) {
18
- // const cssCdnUrl = window[${this.variableName}] || chunkId;
19
- // return cssCdnUrl;
20
- // }`;
21
- // }
22
- // }
23
-
24
- class CdnChangePlugin {
25
- constructor(options) {
26
- this.createSeparateSMap = options.createSeparateSMap;
27
- this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
28
- this.variableName = options.variableName || 'window.__SMAP_PATH__';
29
- this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
30
- this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
31
- this.mode = options.mode || 'prod';
32
- }
33
-
34
- apply(compiler) {
35
- // compiler.hooks.thisCompilation.tap(pluginName, compilation => {
36
- // const enabledChunks = new WeakSet();
37
- // const handler = (entryRuntimeChunk, set) => {
38
- // if (enabledChunks.has(entryRuntimeChunk)) {
39
- // return;
40
- // }
41
- // enabledChunks.add(entryRuntimeChunk);
42
- // set.add(RuntimeGlobals.getFullHash);
43
- // set.add(RuntimeGlobals.getChunkCssFilename);
44
- // compilation.addRuntimeModule(
45
- // entryRuntimeChunk,
46
- // new CdnChangeRuntimePlugin(set, {
47
- // compiler,
48
- // variableName: this.variableName
49
- // })
50
- // );
51
- // };
52
- // compilation.hooks.runtimeRequirementInTree
53
- // .for(RuntimeGlobals.ensureChunkHandlers)
54
- // .tap(pluginName, handler);
55
- // });
56
- compiler.hooks.compilation.tap(pluginName, compilation => {
57
- HtmlWebpackPlugin.getHooks(compilation).beforeAssetTagGeneration.tap(pluginName, (data, cb) => {
58
- const {
59
- createSeparateSMap,
60
- mode
61
- } = this; // eslint-disable-next-line no-param-reassign
62
-
63
- data.assets = { ...data.assets,
64
- css: data.assets.css.map(css => `${this.cssTemplate}${css}`),
65
- js: data.assets.js.map(js => {
66
- if (isProductionMode(mode) && createSeparateSMap && !isI18nFile(js)) {
67
- if (js.includes('smap')) {
68
- js = js.replace('smap/js/', `{{--js-smap}}js/`); //eslint-disable-line
69
- } else {
70
- js = js.replace('js/', `{{--js-smap}}js/`); //eslint-disable-line
71
- }
72
- }
73
-
74
- return `${isI18nFile(js) ? this.i18nTemplate : this.jsTemplate}${js}`;
75
- })
76
- };
77
- cb && cb(null, data);
78
- });
79
- compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.getChunkScriptFilename).tap(pluginName, (chunk, set) => {
80
- if (typeof compilation.outputOptions.chunkFilename === 'string' && /\[(full)?hash(:\d+)?\]/.test(compilation.outputOptions.chunkFilename)) {
81
- set.add(RuntimeGlobals.getFullHash);
82
- }
83
-
84
- compilation.addRuntimeModule(chunk, // eslint-disable-next-line new-cap
85
- new CustomizedGetChunkFilenameRuntimeModule('javascript', 'javascript', RuntimeGlobals.getChunkScriptFilename, chunk => chunk.filenameTemplate || (chunk.canBeInitial() ? compilation.outputOptions.filename : compilation.outputOptions.chunkFilename), false, this.variableName));
86
- return true;
87
- });
88
- });
89
- }
90
-
91
- }
92
-
93
- export default CdnChangePlugin; // Cdn Change Plugin for runtime chunks???
94
-
95
- /**
96
- * the filename of the script part of the chunk
97
- */
98
- // exports.getChunkScriptFilename = "__webpack_require__.u";
99
- // /**
100
- // * the filename of the css part of the chunk
101
- // */
102
- // exports.getChunkCssFilename = "__webpack_require__.k";
@@ -1,36 +0,0 @@
1
- // import { RuntimeGlobals, RuntimeModule, Template } from 'webpack';
2
- // const GetChunkFilenameRuntimeModule = require('webpack/lib/runtime/GetChunkFilenameRuntimeModule');
3
- // import GetChunkFilenameRuntimeModule from 'webpack/lib/runtime/GetChunkFilenameRuntimeModule';
4
- // const first = set => {
5
- // const entry = set.values().next();
6
- // return entry.done ? undefined : entry.value;
7
- // };
8
- import GetChunkFilenameRuntimeModule from 'webpack/lib/runtime/GetChunkFilenameRuntimeModule';
9
-
10
- class CustomizedGetChunkFilenameRuntimeModule extends GetChunkFilenameRuntimeModule {
11
- /**
12
- * @param {string} contentType the to use the content hash for
13
- * @param {string} name kind of filename
14
- * @param {string} global function name to be assigned
15
- * @param {function(Chunk): string | FilenameFunction} getFilenameForChunk functor to get the filename or function
16
- * @param {boolean} allChunks when false, only async chunks are included
17
- */
18
- constructor(contentType, name, global, getFilenameForChunk, allChunks, variableName) {
19
- super(contentType, name, global, getFilenameForChunk, allChunks);
20
- this.contentType = contentType;
21
- this.global = global;
22
- this.getFilenameForChunk = getFilenameForChunk;
23
- this.allChunks = allChunks;
24
- this.dependentHash = true;
25
- this.variableName = variableName;
26
- }
27
-
28
- generate() {
29
- const sourceCode = super.generate().toString();
30
- const replaceCode = sourceCode.replaceAll('"js-chunks/', `${this.variableName} + "js-chunks/`);
31
- return replaceCode;
32
- }
33
-
34
- }
35
-
36
- export default CustomizedGetChunkFilenameRuntimeModule;
@@ -1,65 +0,0 @@
1
- // plugins/ChunkHierarchyPlugin.js
2
- const fs = require('fs');
3
-
4
- const path = require('path');
5
-
6
- class ChunkHierarchyPlugin {
7
- constructor(outputFile) {
8
- this.outputFile = outputFile || 'chunk-hierarchy-report.json';
9
- }
10
-
11
- apply(compiler) {
12
- compiler.hooks.emit.tapAsync('ChunkHierarchyPlugin', (compilation, callback) => {
13
- const result = {};
14
- const rootContext = path.resolve(compiler.context, '..', '..');
15
-
16
- for (const chunk of compilation.chunks) {
17
- const chunkName = chunk.name || chunk.id;
18
- const modules = [];
19
-
20
- for (const module of compilation.chunkGraph.getChunkModulesIterable(chunk)) {
21
- // Recursively extract real modules (handle ConcatenatedModules)
22
- collectModules(module, modules, rootContext);
23
- }
24
-
25
- result[chunkName] = modules;
26
- }
27
-
28
- const json = JSON.stringify(result, null, 2);
29
- const outputPath = compiler.outputPath;
30
- const outputFile = path.join(outputPath, this.outputFile);
31
- fs.mkdirSync(outputPath, {
32
- recursive: true
33
- });
34
- fs.writeFileSync(outputFile, json, 'utf-8');
35
- callback();
36
- });
37
- }
38
-
39
- }
40
-
41
- function collectModules(module, modules, context) {
42
- // Handle normal modules
43
- if (module.resource) {
44
- modules.push(path.relative(context, module.resource));
45
- return;
46
- } // Handle ConcatenatedModule (webpack internal)
47
-
48
-
49
- if (module.modules) {
50
- for (const innerModule of module.modules) {
51
- collectModules(innerModule, modules, context);
52
- }
53
- } // Handle Webpack 5 internal API (ConcatenatedModule inside _orderedConcatenationList)
54
-
55
-
56
- if (module._orderedConcatenationList) {
57
- for (const item of module._orderedConcatenationList) {
58
- if (item.module) {
59
- collectModules(item.module, modules, context);
60
- }
61
- }
62
- }
63
- }
64
-
65
- module.exports = ChunkHierarchyPlugin;
@@ -1,37 +0,0 @@
1
- /* eslint-disable class-methods-use-this */
2
- import { Compilation } from 'webpack';
3
- const pluginName = 'CssCustomOrderPlugin'; // TODO: Check for css minimizer plugin
4
-
5
- export default class CssCustomOrderPlugin {
6
- constructor(className) {
7
- this.className = className || 'customCss';
8
- }
9
-
10
- apply(compiler) {
11
- const {
12
- RawSource
13
- } = compiler.webpack.sources;
14
- compiler.hooks.compilation.tap(pluginName, compilation => {
15
- compilation.hooks.processAssets.tapAsync({
16
- name: pluginName,
17
- stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
18
- }, (assets, callback) => {
19
- Object.keys(assets).filter(file => file.includes('runtime')).forEach(filename => {
20
- try {
21
- let source = assets[filename].source().toString();
22
- let changedCode = `var referenceTag = document.getElementById('${this.className}');
23
- document.head.insertBefore(linkTag, referenceTag);`;
24
- const result = source.replace('document.head.appendChild(linkTag);', changedCode);
25
- compilation.updateAsset(filename, new RawSource(result));
26
- callback();
27
- } catch (e) {
28
- console.error("issue in CssCustomOrderPlugin");
29
- compilation.errors.push(e);
30
- callback(e);
31
- }
32
- });
33
- });
34
- });
35
- }
36
-
37
- }
@@ -1,97 +0,0 @@
1
- import HtmlWebpackPlugin from 'html-webpack-plugin';
2
- const pluginName = 'CustomScriptLoadingStrategyPlugin';
3
- export class CustomScriptLoadingStrategyPlugin {
4
- constructor() {
5
- let {
6
- scriptLoadingStategey
7
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
- this.scriptLoadingStrategy = scriptLoadingStategey;
9
- this.tagNamesToMatch = ['script'];
10
- }
11
-
12
- getFileNameFromTagSrc(src) {
13
- const fileNameArr = src.split('/');
14
- return fileNameArr[fileNameArr.length - 1];
15
- }
16
-
17
- addAttributestToTag(tag, attributes) {
18
- tag.attributes = Object.assign({}, tag.attributes, attributes);
19
- }
20
-
21
- matchFileName(tag, fileName) {
22
- return fileName.test(this.getFileNameFromTagSrc(tag.attributes.src));
23
- }
24
-
25
- blockingStrategy(tag) {
26
- delete tag.attributes.defer;
27
- delete tag.attributes.async;
28
- }
29
-
30
- deferStrategy(tag) {
31
- delete tag.attributes.async;
32
- }
33
-
34
- asyncStrategy(tag) {
35
- delete tag.attributes.defer;
36
- }
37
-
38
- moduleStrategy(tag) {
39
- this.deferStrategy(tag);
40
- }
41
-
42
- matchStrategy(scriptLoadingStrategy, tag) {
43
- if (scriptLoadingStrategy === 'blocking') {
44
- this.blockingStrategy(tag);
45
- }
46
-
47
- if (scriptLoadingStrategy === 'defer') {
48
- this.deferStrategy(tag);
49
- }
50
-
51
- if (scriptLoadingStrategy === 'async') {
52
- this.asyncStrategy(tag);
53
- }
54
-
55
- if (scriptLoadingStrategy === 'module') {
56
- this.moduleStrategy(tag);
57
- }
58
- }
59
-
60
- matchAndApplyCustomLoadingStrategyToScripts(tags) {
61
- Object.keys(this.scriptLoadingStrategy).forEach(scriptLoadingStrategy => {
62
- const filesToMatch = this.scriptLoadingStrategy[scriptLoadingStrategy];
63
- tags.forEach(tag => {
64
- if (this.tagNamesToMatch.includes(tag.tagName) && tag.attributes.src) {
65
- const isFileMatch = filesToMatch.some(fileName => this.matchFileName(tag, fileName));
66
-
67
- if (isFileMatch) {
68
- this.matchStrategy(scriptLoadingStrategy, tag);
69
- this.addAttributestToTag(tag, {
70
- [scriptLoadingStrategy]: true
71
- });
72
- }
73
- } // filesToMatch.forEach(fileName => {
74
- // if (!this.matchFileName(tag, fileName)) {
75
- // return;
76
- // }
77
- // this.matchStrategy(scriptLoadingStrategy, tag);
78
- // this.addAttributestToTag(tag, fileName, {
79
- // [scriptLoadingStrategy]: true
80
- // });
81
- // });
82
-
83
- });
84
- });
85
- }
86
-
87
- apply(compiler) {
88
- compiler.hooks.compilation.tap(pluginName, compilation => {
89
- HtmlWebpackPlugin.getHooks(compilation).alterAssetTagGroups.tapAsync(pluginName, (data, callback) => {
90
- const tags = [...data.bodyTags, ...data.headTags];
91
- this.matchAndApplyCustomLoadingStrategyToScripts(tags);
92
- callback(null, data);
93
- });
94
- });
95
- }
96
-
97
- }
@@ -1,98 +0,0 @@
1
- import { existsSync, readFileSync } from 'fs';
2
- import { errorLogger, messageLogger } from "../../../../logger";
3
- import { getLocaleChunkAssetsStore } from "./I18nSplitPlugin/LocaleChunkAssetsStore";
4
- import { joinWithAppPath } from "../../../constants";
5
- import { getInitialAssetsFuncTemplate } from "./getInitialAssetsFuncTemplate";
6
- const INITIAL_ASSETS_TEMPLATE = '// <--getInitialAssets-->';
7
- const PUBLIC_PATH_TEMPLATE = '"<--publicPath-->"';
8
- const pluginName = 'EFCTemplatePlugin';
9
- export class EFCTemplatePlugin {
10
- constructor() {
11
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- const {
13
- i18nFileNameTemplate,
14
- entryPointName,
15
- outputFile,
16
- version,
17
- publicPath,
18
- templateFilePath
19
- } = options;
20
- this.options = options;
21
- this.templateFilePath = joinWithAppPath(templateFilePath);
22
- this.i18nFileNameTemplate = i18nFileNameTemplate;
23
- this.publicPath = publicPath; // NOTE: this logic may be needed for i18n splitted file name with contenthash cases
24
- // this.i18nManifestFileName = options.i18nManifestFileName;
25
- // IMPORTANT: here we merging options from package.json and options via constructor
26
- // So when debugging consider this as well
27
- // this.options = Object.assign({}, efcOptions, options);
28
-
29
- this.entryPointName = entryPointName || 'efc';
30
- this.outputFile = outputFile.replace('[version]', version);
31
- } // NOTE: this logic may be needed for i18n splitted file name with contenthash cases
32
- // getI18nManifest(compilation) {
33
- // const i18nManifestFile =
34
- // compilation.assets[this.options.i18nManifestFileName];
35
- // if (i18nManifestFile) {
36
- // const manifest = JSON.parse(i18nManifestFile.source());
37
- // return manifest;
38
- // }
39
- // return {};
40
- // }
41
- // eslint-disable-next-line class-methods-use-this
42
-
43
-
44
- templateReplacer(entryPoint, compilation) {
45
- const {
46
- enableRTLSplit
47
- } = this.options; // const i18nManifest = this.getI18nManifest(compilation);
48
-
49
- const initialAssetsFuncTemplate = getInitialAssetsFuncTemplate({
50
- entryPoint,
51
- compilation,
52
- enableRTLSplit,
53
- i18nStore: this.store,
54
- chunkSplitEnable: this.options.chunkSplitEnable,
55
- i18nFileNameTemplate: this.i18nFileNameTemplate,
56
- functionName: 'getInitialAssets'
57
- });
58
- const templateStr = readFileSync(this.templateFilePath).toString();
59
- return templateStr.replace(INITIAL_ASSETS_TEMPLATE, initialAssetsFuncTemplate).replace(PUBLIC_PATH_TEMPLATE, this.publicPath);
60
- }
61
-
62
- apply(compiler) {
63
- const {
64
- RawSource
65
- } = compiler.webpack.sources;
66
- compiler.hooks.thisCompilation.tap(pluginName, compilation => {
67
- // Get store for cache
68
- this.store = getLocaleChunkAssetsStore(compilation);
69
- });
70
- compiler.hooks.thisCompilation.tap(pluginName, compilation => {
71
- compilation.hooks.processAssets.tap({
72
- name: pluginName,
73
- stage: compilation.PROCESS_ASSETS_STAGE_DERIVED
74
- }, () => {
75
- const {
76
- entryPointName,
77
- outputFile
78
- } = this;
79
- const entryPoint = compilation.entrypoints.get(entryPointName);
80
-
81
- if (!entryPoint) {
82
- return;
83
- }
84
-
85
- if (!existsSync(this.templateFilePath)) {
86
- errorLogger(`EFC Template file not exists ${this.templateFilePath}`);
87
- return;
88
- }
89
-
90
- const source = new RawSource(this.templateReplacer(entryPoint, compilation));
91
- compilation.emitAsset(outputFile, source);
92
- messageLogger('The EFC embedded code was created successfully..!!!');
93
- messageLogger(`The EFC SDK File name ${outputFile}`);
94
- });
95
- });
96
- }
97
-
98
- }
@@ -1,211 +0,0 @@
1
- const fs = require('fs');
2
-
3
- const path = require('path');
4
-
5
- const {
6
- sources,
7
- Compilation
8
- } = require('webpack');
9
-
10
- const {
11
- decodeUnicodeEscapes,
12
- getPropertiesAsJSON
13
- } = require("../I18nSplitPlugin/utils/propertiesUtils");
14
-
15
- const {
16
- createHash
17
- } = require("../I18nSplitPlugin/createHash");
18
-
19
- const {
20
- pathCreator
21
- } = require("../I18nSplitPlugin/pathCreator");
22
-
23
- const {
24
- RawSource
25
- } = sources;
26
- const PLUGIN_NAME = 'I18nNumericIndexPlugin';
27
- const DEFAULT_LOCALE = 'en_US';
28
- const LOCALE_PATTERN = /_([a-z]{2}_[A-Z]{2})\.properties$/;
29
-
30
- class I18nNumericIndexPlugin {
31
- constructor(options) {
32
- if (!options) {
33
- throw new Error('[I18nNumericIndexPlugin] options is required');
34
- }
35
-
36
- this.options = options;
37
- }
38
-
39
- apply(compiler) {
40
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
41
- compilation.hooks.processAssets.tapAsync({
42
- name: PLUGIN_NAME,
43
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
44
- }, (_assets, callback) => {
45
- if (!this.options.enable) {
46
- callback();
47
- return;
48
- }
49
-
50
- try {
51
- this.processI18nAssets(compilation);
52
- } catch (err) {
53
- compilation.errors.push(new Error(`[${PLUGIN_NAME}] ${err.message}`));
54
- }
55
-
56
- callback();
57
- });
58
- });
59
- }
60
-
61
- processI18nAssets(compilation) {
62
- const {
63
- numericMapPath,
64
- jsResourcePath,
65
- propertiesFolderPath
66
- } = this.options;
67
- const context = compilation.compiler.context;
68
- const numericMapFullPath = path.resolve(context, numericMapPath);
69
- const numericMapContent = JSON.parse(fs.readFileSync(numericMapFullPath, 'utf-8'));
70
- const keyToNumericId = numericMapContent.originalKeyToNumericId;
71
- const jsResourceFullPath = path.resolve(context, jsResourcePath);
72
- const baseTranslations = getPropertiesAsJSON(jsResourceFullPath);
73
- const baseKeys = Object.keys(baseTranslations);
74
-
75
- if (baseKeys.length === 0) {
76
- return;
77
- }
78
-
79
- const propertiesFolder = path.resolve(context, propertiesFolderPath);
80
- const propertyFiles = fs.readdirSync(propertiesFolder).filter(f => f.endsWith('.properties'));
81
- const manifest = {};
82
-
83
- for (const file of propertyFiles) {
84
- const locale = this.extractLocaleFromFilename(file);
85
-
86
- if (!locale) {
87
- continue;
88
- }
89
-
90
- const localeTranslations = getPropertiesAsJSON(path.join(propertiesFolder, file));
91
- const {
92
- numericData,
93
- dynamicData
94
- } = this.buildLocaleData(baseKeys, baseTranslations, localeTranslations, keyToNumericId);
95
- this.emitLocaleFiles(compilation, locale, numericData, dynamicData, manifest);
96
- }
97
-
98
- this.emitManifest(compilation, manifest);
99
- }
100
-
101
- extractLocaleFromFilename(filename) {
102
- // Base properties file (no locale suffix) defaults to en_US
103
- if (!filename.includes('_')) {
104
- return DEFAULT_LOCALE;
105
- }
106
-
107
- const match = filename.match(LOCALE_PATTERN);
108
- return match ? match[1] : null;
109
- }
110
-
111
- buildLocaleData(baseKeys, baseTranslations, localeTranslations, keyToNumericId) {
112
- const numericData = {};
113
- const dynamicData = {};
114
-
115
- for (const key of baseKeys) {
116
- const value = localeTranslations[key] ?? baseTranslations[key];
117
-
118
- if (key in keyToNumericId) {
119
- numericData[keyToNumericId[key]] = value;
120
- } else {
121
- dynamicData[key] = value;
122
- }
123
- }
124
-
125
- return {
126
- numericData,
127
- dynamicData
128
- };
129
- }
130
-
131
- emitLocaleFiles(compilation, locale, numericData, dynamicData, manifest) {
132
- const {
133
- singleFile,
134
- singleFileTemplate,
135
- outputFolder,
136
- numericFilenameTemplate,
137
- dynamicFilenameTemplate
138
- } = this.options;
139
-
140
- if (singleFile) {
141
- const combined = { ...numericData,
142
- ...dynamicData
143
- };
144
-
145
- if (Object.keys(combined).length > 0) {
146
- const template = `${outputFolder}/${singleFileTemplate}`;
147
- this.emitChunk(compilation, template, locale, combined, manifest);
148
- }
149
-
150
- return;
151
- }
152
-
153
- if (Object.keys(numericData).length > 0) {
154
- this.emitChunk(compilation, numericFilenameTemplate, locale, numericData, manifest);
155
- }
156
-
157
- if (Object.keys(dynamicData).length > 0) {
158
- this.emitChunk(compilation, dynamicFilenameTemplate, locale, dynamicData, manifest);
159
- }
160
- }
161
-
162
- emitChunk(compilation, filenameTemplate, locale, data, manifest) {
163
- const content = decodeUnicodeEscapes(JSON.stringify(data));
164
- const fileContent = `${this.options.jsonpFunc}(${content});`;
165
- const contentHash = createHash({
166
- outputOptions: compilation.outputOptions,
167
- content: fileContent
168
- });
169
- let outputPath = pathCreator(filenameTemplate, compilation, {
170
- hash: compilation.hash,
171
- locale,
172
- chunkName: null,
173
- chunkId: locale,
174
- chunkHash: null,
175
- contentHash
176
- });
177
-
178
- if (this.options.includeContentHash && !filenameTemplate.includes('[contenthash]')) {
179
- outputPath = outputPath.replace(/\.js$/, `.${contentHash}.js`);
180
- }
181
-
182
- if (this.options.generateManifest) {
183
- const filename = outputPath.split('/').pop();
184
- manifest[locale] = filename;
185
- }
186
-
187
- if (this.options.emitFiles) {
188
- compilation.emitAsset(outputPath, new RawSource(fileContent));
189
- }
190
-
191
- return outputPath;
192
- }
193
-
194
- emitManifest(compilation, manifest) {
195
- const hasEntries = Object.keys(manifest).length > 0;
196
-
197
- if (!this.options.generateManifest || !hasEntries) {
198
- return;
199
- }
200
-
201
- if (this.options.emitFiles) {
202
- const manifestContent = JSON.stringify(manifest, null, 2);
203
- compilation.emitAsset(this.options.manifestPath, new RawSource(manifestContent));
204
- }
205
- }
206
-
207
- }
208
-
209
- module.exports = {
210
- I18nNumericIndexPlugin
211
- };
@@ -1,11 +0,0 @@
1
- # I18n Split Plugin ContributionGuide
2
- we have modifyed mini-css-extract-plugin to sute our needs of i18n related extraction and downloading.
3
- So In future may be when we need to update mini-css-extract-plugin Kindly cross check with this I18n Plugin as well.
4
-
5
- Even not breaking change, may be just performacne update or feature update. addeding that to this plugin will be use full. Kindly consider it.
6
-
7
- ## Thing we Ignored
8
- * we use webpack ast hook for adding I18nDependency. So we did not need `loader.js`
9
- * we ignore order of import in single chunk since I18n going to be download as object.
10
- we did not need it.
11
- *