@zohodesk/client_build_tool 0.0.11-exp.16.0 → 0.0.11-exp.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +102 -0
  2. package/README_backup.md +102 -0
  3. package/lib/allCommandsConfigs.js +7 -2
  4. package/lib/commands/build/commandExecutor.js +5 -1
  5. package/lib/commands/build/config.js +3 -2
  6. package/lib/commands/build/optionsProcessor.js +5 -2
  7. package/lib/commands/build/preProcessor.js +2 -0
  8. package/lib/commands/buildEs/commandExecutor.js +5 -0
  9. package/lib/commands/buildEs/config.js +3 -2
  10. package/lib/commands/buildEs/preProcessor.js +2 -0
  11. package/lib/commands/buildLib/commandExecutor.js +5 -0
  12. package/lib/commands/buildLib/config.js +3 -2
  13. package/lib/commands/buildLib/preProcessor.js +2 -0
  14. package/lib/commands/mockserver/commandExecutor.js +9 -2
  15. package/lib/commands/mockserver/config.js +3 -2
  16. package/lib/commands/pre_process/commandExecutor.js +2 -0
  17. package/lib/commands/pre_process/config.js +3 -2
  18. package/lib/commands/start/commandExecutor.js +2 -0
  19. package/lib/commands/start/config.js +3 -2
  20. package/lib/commands/start/optionsProcessor.js +4 -2
  21. package/lib/commands/start/preProcessor.js +2 -0
  22. package/lib/commands/template/commandExecutor.js +7 -0
  23. package/lib/commands/template/config.js +3 -2
  24. package/lib/commands/version/commandExecutor.js +3 -0
  25. package/lib/commands/version/config.js +3 -2
  26. package/lib/commandsRouter.js +21 -5
  27. package/lib/index.js +2 -0
  28. package/lib/logger.js +5 -0
  29. package/lib/schemas/applyValuesToSchema/index.js +8 -0
  30. package/lib/schemas/applyValuesToSchema/isObject.js +1 -0
  31. package/lib/schemas/applyValuesToSchema/isValid.js +2 -0
  32. package/lib/schemas/cliArgsToObject.js +6 -2
  33. package/lib/schemas/defaultConfigValues.js +17 -4
  34. package/lib/schemas/defaultConfigValuesOnly.js +33 -4
  35. package/lib/schemas/deprecatedOptionsHandler.js +16 -7
  36. package/lib/schemas/getNpmVersion.js +5 -0
  37. package/lib/schemas/giveDefaultValue.js +3 -0
  38. package/lib/schemas/npmConfigToObject.js +5 -2
  39. package/lib/schemas/readOptions.js +30 -10
  40. package/lib/schemas/readOptionsForConfigFile.js +12 -2
  41. package/lib/shared/babel/addDefaultPlugins.js +2 -0
  42. package/lib/shared/babel/babelWebConfig.js +10 -1
  43. package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +4 -0
  44. package/lib/shared/babel/getBabelPlugin.js +7 -2
  45. package/lib/shared/babel/runBabelForJSFile.js +4 -1
  46. package/lib/shared/babel/runBabelForTsFile.js +5 -1
  47. package/lib/shared/bundler/webpack/common/decidePublicPath.js +5 -0
  48. package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
  49. package/lib/shared/bundler/webpack/common/modeUtils.js +5 -0
  50. package/lib/shared/bundler/webpack/common/nameTemplates.js +18 -11
  51. package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +3 -2
  52. package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -0
  53. package/lib/shared/bundler/webpack/cssLoaders.js +2 -0
  54. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +20 -1
  55. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +25 -20
  56. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +9 -4
  57. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +23 -3
  58. package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +19 -8
  59. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +61 -37
  60. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +33 -15
  61. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +108 -60
  62. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +26 -20
  63. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +26 -5
  64. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +16 -13
  65. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +53 -19
  66. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +17 -2
  67. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +13 -0
  68. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +21 -11
  69. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +4 -0
  70. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +14 -4
  71. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +13 -3
  72. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +12 -3
  73. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +7 -2
  74. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +2 -0
  75. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +3 -2
  76. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +4 -2
  77. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +13 -8
  78. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +14 -2
  79. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +1 -0
  80. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +3 -1
  81. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +4 -0
  82. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +25 -5
  83. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +10 -3
  84. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +6 -1
  85. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +6 -1
  86. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +6 -0
  87. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +1 -0
  88. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +7 -0
  89. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +1 -0
  90. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +17 -13
  91. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +15 -6
  92. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +13 -4
  93. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +6 -4
  94. package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +10 -0
  95. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +3 -0
  96. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +20 -4
  97. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +12 -10
  98. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +3 -2
  99. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +20 -7
  100. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +1 -0
  101. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +10 -7
  102. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +6 -1
  103. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +16 -1
  104. package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +11 -4
  105. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +10 -3
  106. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +62 -27
  107. package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +15 -3
  108. package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +1 -0
  109. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +12 -2
  110. package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +7 -2
  111. package/lib/shared/bundler/webpack/defaultVendorPatternList.js +6 -2
  112. package/lib/shared/bundler/webpack/devtoolConfig.js +1 -0
  113. package/lib/shared/bundler/webpack/entryConfig.js +4 -0
  114. package/lib/shared/bundler/webpack/externals.js +1 -0
  115. package/lib/shared/bundler/webpack/getCSSLoaders.js +6 -1
  116. package/lib/shared/bundler/webpack/getFilenameFromModule.js +5 -1
  117. package/lib/shared/bundler/webpack/jsLoaders.js +10 -6
  118. package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +2 -0
  119. package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +3 -2
  120. package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +12 -3
  121. package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +1 -0
  122. package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +10 -2
  123. package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +2 -0
  124. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +12 -0
  125. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +15 -1
  126. package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +4 -1
  127. package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +16 -8
  128. package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +29 -22
  129. package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
  130. package/lib/shared/bundler/webpack/loaders/workerLoader.js +19 -8
  131. package/lib/shared/bundler/webpack/optimizationConfig.js +13 -5
  132. package/lib/shared/bundler/webpack/outputConfig.js +9 -1
  133. package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +9 -5
  134. package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +5 -0
  135. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +9 -4
  136. package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +8 -3
  137. package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +16 -1
  138. package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +4 -0
  139. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +16 -0
  140. package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +5 -0
  141. package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +5 -0
  142. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +8 -2
  143. package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +9 -5
  144. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +25 -19
  145. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +26 -12
  146. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +9 -3
  147. package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +2 -0
  148. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +7 -0
  149. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +7 -3
  150. package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +5 -1
  151. package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +4 -1
  152. package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +4 -0
  153. package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +8 -3
  154. package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +6 -1
  155. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +8 -3
  156. package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +4 -0
  157. package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +8 -1
  158. package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +6 -1
  159. package/lib/shared/bundler/webpack/plugins.js +24 -1
  160. package/lib/shared/bundler/webpack/resolvers.js +17 -3
  161. package/lib/shared/bundler/webpack/splitChunksConfig.js +15 -2
  162. package/lib/shared/bundler/webpack/statsConfig.js +5 -2
  163. package/lib/shared/bundler/webpack/tsLoaders.js +4 -2
  164. package/lib/shared/bundler/webpack/utils/index.js +12 -1
  165. package/lib/shared/bundler/webpack/utils/object-manipulation.js +16 -2
  166. package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +7 -0
  167. package/lib/shared/bundler/webpack/webpackBuild.js +8 -1
  168. package/lib/shared/bundler/webpack/webpackConfig.js +17 -0
  169. package/lib/shared/commands-utils/doBasicRequirementCheck.js +3 -0
  170. package/lib/shared/commands-utils/getCliPath.js +9 -5
  171. package/lib/shared/commands-utils/index.js +3 -0
  172. package/lib/shared/commands-utils/log.js +2 -0
  173. package/lib/shared/commands-utils/readArgsFormCommandLine.js +1 -0
  174. package/lib/shared/commands-utils/readOptionFormCommandLine.js +1 -0
  175. package/lib/shared/commands-utils/spawnSyncIO.js +13 -5
  176. package/lib/shared/constants.js +29 -9
  177. package/lib/shared/fileUtils/copyFile.js +8 -1
  178. package/lib/shared/fileUtils/directoryIterator.js +4 -0
  179. package/lib/shared/fileUtils/watchRun.js +24 -3
  180. package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +6 -1
  181. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +3 -2
  182. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +13 -6
  183. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +26 -6
  184. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +9 -6
  185. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +3 -0
  186. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +7 -2
  187. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +2 -0
  188. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +9 -4
  189. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +10 -0
  190. package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +29 -16
  191. package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +17 -0
  192. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +9 -4
  193. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +63 -27
  194. package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +13 -5
  195. package/lib/shared/postcss/getAllowedPostCssPlugins.js +3 -0
  196. package/lib/shared/postcss/getSpecificPostCssPlugin.js +17 -7
  197. package/lib/shared/postcss/runPostCssForCssFile.js +9 -1
  198. package/lib/shared/pre_process/runPreProcess.js +11 -0
  199. package/lib/shared/server/configWebpackDevMiddleware.js +8 -1
  200. package/lib/shared/server/corsHandling.js +6 -2
  201. package/lib/shared/server/getIp.js +7 -1
  202. package/lib/shared/server/getServerURL.js +6 -0
  203. package/lib/shared/server/httpsOptions.js +11 -0
  204. package/lib/shared/server/initExpressApp.js +4 -1
  205. package/lib/shared/server/initialHTMLHandling.js +16 -7
  206. package/lib/shared/server/mockApiHandler.js +16 -8
  207. package/lib/shared/server/mockServer.js +7 -0
  208. package/lib/shared/server/serveContextFiles.js +5 -1
  209. package/lib/shared/server/serverBywebpackDevMiddleware.js +9 -4
  210. package/lib/shared/server/startHttpServer.js +3 -0
  211. package/lib/shared/server/startHttpsServer.js +9 -1
  212. package/lib/shared/server/unwanted/addHttp2Server.js +7 -2
  213. package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +8 -1
  214. package/lib/shared/server/unwanted/mockApiSupport.js +2 -0
  215. package/lib/shared/server/unwanted/websocketMockSetup.js +7 -1
  216. package/lib/shared/server/urlConcat.js +8 -3
  217. package/lib/shared/utils/requireLocalOrGlobal.js +25 -10
  218. package/lib/shared/utils/versionPrint.js +6 -1
  219. package/npm-shrinkwrap.json +2 -2
  220. package/package.json +1 -1
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.checkIsPatternsMatchFilename = checkIsPatternsMatchFilename;
7
7
  exports.modifyAsExclude = modifyAsExclude;
8
+
8
9
  var _ignore = _interopRequireDefault(require("ignore"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
10
13
  /**
11
14
  @param {Array<String>} patterns:
12
15
  // include src folder, include deskapp folder, exclude node modules
@@ -24,24 +27,30 @@ function checkIsPatternsMatchFilename(patterns, filename) {
24
27
  if (!filename) {
25
28
  return false;
26
29
  }
30
+
27
31
  if (typeof patterns === 'undefined') {
28
32
  return true;
29
33
  }
34
+
30
35
  if (typeof patterns === 'function') {
31
36
  return patterns(filename);
32
37
  }
38
+
33
39
  if (typeof patterns === 'string') {
34
40
  // eslint-disable-next-line no-param-reassign
35
41
  patterns = [patterns];
36
42
  }
43
+
37
44
  if (Array.isArray(patterns)) {
38
45
  return patterns.length ? (0, _ignore.default)({
39
46
  allowRelativePaths: true
40
47
  }).add(patterns).ignores(filename) : true;
41
- }
42
- // eslint-disable-next-line no-throw-literal
48
+ } // eslint-disable-next-line no-throw-literal
49
+
50
+
43
51
  throw `UnKnown pattern Error ${JSON.stringify(patterns)}`;
44
52
  }
53
+
45
54
  function modifyAsExclude(patterns) {
46
55
  return patterns.map(pattern => pattern[0] === '!' ? pattern.slice(1) : `!${pattern}`);
47
56
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.configHtmlTemplateLoader = configHtmlTemplateLoader;
7
+
7
8
  function configHtmlTemplateLoader(options) {
8
9
  return {
9
10
  test: /\.tmpl$/,
@@ -4,22 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.configPostCssLoader = configPostCssLoader;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _filterPluginsAllowedForSpecficFile = require("../../../postcss/filterPluginsAllowedForSpecficFile");
11
+
9
12
  var _getAllowedPostCssPlugins = require("../../../postcss/getAllowedPostCssPlugins");
13
+
10
14
  var _constants = require("../../../constants");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- // import EmptyPlugin from '../custom_postcss_plugins/EmptyPlugin';
13
15
 
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ // import EmptyPlugin from '../custom_postcss_plugins/EmptyPlugin';
14
19
  function configPostCssLoader(options) {
15
20
  const pluginsOptions = options.css.plugins;
16
21
  const enabledPlugins = (0, _filterPluginsAllowedForSpecficFile.getEnabledPlugins)(pluginsOptions);
17
22
  const getAllowedPostCssPlugins = (0, _getAllowedPostCssPlugins.postcssPluginGetter)(options);
23
+
18
24
  function configPostCssPlugins(params) {
19
25
  const filename = _path.default.relative(_constants.appPath, params.resourcePath);
26
+
20
27
  const allowedPostCssPlugins = getAllowedPostCssPlugins(filename);
21
28
  return allowedPostCssPlugins;
22
29
  }
30
+
23
31
  return enabledPlugins.length && {
24
32
  loader: 'postcss-loader',
25
33
  options: {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.configWebWorkerLoader = configWebWorkerLoader;
7
+
7
8
  var _nameTemplates = require("../common/nameTemplates");
9
+
8
10
  function configWebWorkerLoader(options) {
9
11
  return {
10
12
  test: /\.worker.js$/,
@@ -8,12 +8,15 @@ exports.configFontLoader = configFontLoader;
8
8
  exports.configImageLoader = configImageLoader;
9
9
  exports.configSVGLoader = configSVGLoader;
10
10
  exports.configVideoLoader = configVideoLoader;
11
+
11
12
  var _nameTemplates = require("../common/nameTemplates");
13
+
12
14
  const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
13
15
  const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
14
16
  const SVGExtRegex = /\.svg$/;
15
17
  const AudioExtRegex = /\.ogg|\.mp3$/;
16
18
  const VideoExtRegex = /\.mp4|\.webm$/;
19
+
17
20
  function createAssetLoader({
18
21
  test,
19
22
  nameTemplate,
@@ -23,22 +26,27 @@ function createAssetLoader({
23
26
  test,
24
27
  type: 'asset'
25
28
  };
29
+
26
30
  if (limit) {
27
31
  conf.parser = {
28
32
  dataUrlCondition: {
29
33
  maxSize: limit // 4 * 1024 // 4kb
34
+
30
35
  }
31
36
  };
32
37
  } else {
33
38
  conf.type = 'asset/resource';
34
39
  }
40
+
35
41
  if (nameTemplate) {
36
42
  conf.generator = {
37
43
  filename: nameTemplate
38
44
  };
39
45
  }
46
+
40
47
  return conf;
41
48
  }
49
+
42
50
  function configImageLoader(options) {
43
51
  return createAssetLoader({
44
52
  test: ImageExtRegex,
@@ -46,6 +54,7 @@ function configImageLoader(options) {
46
54
  limit: 1000
47
55
  });
48
56
  }
57
+
49
58
  function configFontLoader(options) {
50
59
  return createAssetLoader({
51
60
  test: FontExtRegex,
@@ -53,6 +62,7 @@ function configFontLoader(options) {
53
62
  limit: 1000
54
63
  });
55
64
  }
65
+
56
66
  function configSVGLoader(options) {
57
67
  return createAssetLoader({
58
68
  test: SVGExtRegex,
@@ -60,12 +70,14 @@ function configSVGLoader(options) {
60
70
  limit: 1000
61
71
  });
62
72
  }
73
+
63
74
  function configAudioLoader(options) {
64
75
  return createAssetLoader({
65
76
  test: AudioExtRegex,
66
77
  nameTemplate: (0, _nameTemplates.nameTemplates)('audio', options)
67
78
  });
68
79
  }
80
+
69
81
  function configVideoLoader(options) {
70
82
  return createAssetLoader({
71
83
  test: VideoExtRegex,
@@ -5,14 +5,21 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  exports.getHash = getHash;
8
+
8
9
  var _crypto = require("crypto");
10
+
9
11
  var _path = _interopRequireDefault(require("path"));
12
+
10
13
  var _checkIsPatternsMatchFilename = require("./checkIsPatternsMatchFilename");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
12
17
  function getHash(str, length) {
13
18
  return (0, _crypto.createHash)('md5').update(str).digest('hex').slice(0, length);
14
19
  }
20
+
15
21
  const defaultSelectorBlob = '[prefix]-[filename]-[local]';
22
+
16
23
  function getSuitableBlob(customizations = [], filename) {
17
24
  const custom = customizations.find(({
18
25
  enable,
@@ -20,6 +27,7 @@ function getSuitableBlob(customizations = [], filename) {
20
27
  }) => enable && (0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(patterns, filename));
21
28
  return custom && custom.blob || defaultSelectorBlob;
22
29
  }
30
+
23
31
  var _default = options => {
24
32
  const {
25
33
  classNameOptions
@@ -38,14 +46,20 @@ var _default = options => {
38
46
  rootContext,
39
47
  resourcePath
40
48
  } = context;
49
+
41
50
  const relativePath = _path.default.relative(rootContext, resourcePath);
51
+
42
52
  const fileNameWithoutExt = _path.default.parse(relativePath).name;
53
+
43
54
  let cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
55
+
44
56
  if (cleanFileName.endsWith('.module')) {
45
57
  cleanFileName = cleanFileName.slice(0, -7);
46
58
  }
59
+
47
60
  const suitableBlob = getSuitableBlob(customizations, resourcePath);
48
61
  return suitableBlob.replaceAll('[local]', localName).replaceAll('[prefix]', classNamePrefix).replaceAll('[filename]', cleanFileName).replaceAll('[hash]', getHash(`${relativePath}-${localName}`, 10));
49
62
  };
50
63
  };
64
+
51
65
  exports.default = _default;
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getCssLoaderOptions = getCssLoaderOptions;
7
+
7
8
  var _cssClassNameGenerate = _interopRequireDefault(require("./cssClassNameGenerate"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
9
12
  function getCssLoaderOptions(options) {
10
13
  const cssLoaderOptions = {
11
14
  importLoaders: 1,
@@ -3,14 +3,14 @@
3
3
  const {
4
4
  getPropertiesAsJSON
5
5
  } = require('../custom_plugins/I18nSplitPlugin/utils/propertiesUtils');
6
-
7
6
  /**
8
7
  * Load i18n data from JSResources file once for all chunks
9
8
  */
9
+
10
+
10
11
  function loadJSResourcesOnce(options) {
11
- let jsResourcePath;
12
+ let jsResourcePath; // Determine the JSResource path based on configuration
12
13
 
13
- // Determine the JSResource path based on configuration
14
14
  if (options.i18nIndexing && options.i18nIndexing.enable) {
15
15
  jsResourcePath = options.i18nIndexing.jsResourcePath;
16
16
  } else if (options.i18nChunkSplit && options.i18nChunkSplit.chunkSplitEnable && options.i18nChunkSplit.useNumericIndexing) {
@@ -18,28 +18,32 @@ function loadJSResourcesOnce(options) {
18
18
  } else {
19
19
  throw new Error('i18nIdReplaceLoader requires either i18nIndexing to be enabled or i18nChunkSplit with useNumericIndexing');
20
20
  }
21
+
21
22
  if (!jsResourcePath) {
22
23
  throw new Error('Missing required jsResourcePath in i18n options');
23
24
  }
25
+
24
26
  try {
25
27
  const i18nData = getPropertiesAsJSON(jsResourcePath);
28
+
26
29
  if (Object.keys(i18nData).length === 0) {
27
30
  console.warn(`[i18nIdReplaceLoaderConfig] Warning: No i18n data found in JSResource file: ${jsResourcePath}`);
28
31
  return {};
29
32
  }
33
+
30
34
  return i18nData;
31
35
  } catch (err) {
32
36
  throw new Error(`Error reading JSResource file ${jsResourcePath}: ${err.message}`);
33
37
  }
34
38
  }
35
-
36
39
  /**
37
40
  * Configure the i18n ID replace loader
38
41
  */
42
+
43
+
39
44
  function i18nIdReplaceLoaderConfig(options, webpackContext) {
40
- let numericMapPath;
45
+ let numericMapPath; // Determine the numeric map path based on configuration
41
46
 
42
- // Determine the numeric map path based on configuration
43
47
  if (options.i18nIndexing && options.i18nIndexing.enable) {
44
48
  numericMapPath = options.i18nIndexing.numericMapPath;
45
49
  } else if (options.i18nChunkSplit && options.i18nChunkSplit.chunkSplitEnable && options.i18nChunkSplit.useNumericIndexing) {
@@ -47,13 +51,16 @@ function i18nIdReplaceLoaderConfig(options, webpackContext) {
47
51
  } else {
48
52
  throw new Error('i18nIdReplaceLoader requires either i18nIndexing to be enabled or i18nChunkSplit with useNumericIndexing');
49
53
  }
54
+
50
55
  if (!numericMapPath) {
51
56
  throw new Error('numericMapPath is required in i18nIndexing or i18nChunkSplit config');
52
- }
57
+ } // Load all i18n data for key detection
58
+
53
59
 
54
- // Load all i18n data for key detection
55
60
  const allI18nData = loadJSResourcesOnce(options);
61
+
56
62
  const i18nKeyReplaceLoaderPath = require.resolve('../loaders/i18nIdReplaceLoader.js');
63
+
57
64
  const loaderOptions = {
58
65
  allI18nData: allI18nData,
59
66
  sourceMaps: false,
@@ -67,6 +74,7 @@ function i18nIdReplaceLoaderConfig(options, webpackContext) {
67
74
  options: loaderOptions
68
75
  };
69
76
  }
77
+
70
78
  module.exports = {
71
79
  i18nIdReplaceLoaderConfig
72
80
  };
@@ -1,50 +1,58 @@
1
1
  "use strict";
2
2
 
3
3
  const fs = require('fs');
4
+
4
5
  const path = require('path');
6
+
5
7
  const parser = require('@babel/parser');
8
+
6
9
  const traverse = require('@babel/traverse').default;
10
+
7
11
  const generator = require('@babel/generator').default;
12
+
8
13
  const t = require('@babel/types');
14
+
9
15
  const {
10
16
  getOptions
11
17
  } = require('loader-utils');
18
+
12
19
  module.exports = function i18nIdReplaceLoader(source, map) {
13
20
  const resourcePath = this.resourcePath;
14
21
  this.cacheable && this.cacheable();
15
22
  const options = getOptions(this) || {};
16
- const callback = this.async();
23
+ const callback = this.async(); // Skip files in excluded paths
17
24
 
18
- // Skip files in excluded paths
19
25
  if (options.excludePaths) {
20
26
  const shouldExclude = options.excludePaths.some(excludePath => resourcePath.includes(excludePath));
27
+
21
28
  if (shouldExclude) {
22
29
  return callback(null, source, map);
23
30
  }
24
- }
31
+ } // Only process files in included paths if specified
32
+
25
33
 
26
- // Only process files in included paths if specified
27
34
  if (options.includePaths && options.includePaths.length > 0) {
28
35
  const shouldInclude = options.includePaths.some(includePath => resourcePath.includes(includePath));
36
+
29
37
  if (!shouldInclude) {
30
38
  return callback(null, source, map);
31
39
  }
32
- }
40
+ } // Validate i18n data exists
41
+
33
42
 
34
- // Validate i18n data exists
35
43
  if (!options.allI18nData || Object.keys(options.allI18nData).length === 0) {
36
44
  return callback(new Error(`i18nIdReplaceLoader: 'allI18nData' option is missing or empty`));
37
- }
45
+ } // Load numeric ID mapping
46
+
38
47
 
39
- // Load numeric ID mapping
40
48
  let numericIdMap = null;
49
+
41
50
  if (options.numericMapPath) {
42
51
  try {
43
52
  if (fs.existsSync(options.numericMapPath)) {
44
53
  const fileContent = fs.readFileSync(options.numericMapPath, 'utf-8');
45
- const parsedData = JSON.parse(fileContent);
54
+ const parsedData = JSON.parse(fileContent); // Handle both wrapped and flat formats
46
55
 
47
- // Handle both wrapped and flat formats
48
56
  if (parsedData) {
49
57
  if (parsedData.originalKeyToNumericId) {
50
58
  // New format with wrapper
@@ -55,16 +63,17 @@ module.exports = function i18nIdReplaceLoader(source, map) {
55
63
  }
56
64
  }
57
65
  }
58
- } catch (err) {
59
- // Silently continue without numeric mapping
66
+ } catch (err) {// Silently continue without numeric mapping
60
67
  }
61
- }
68
+ } // If no numeric map available, return source as-is
69
+
62
70
 
63
- // If no numeric map available, return source as-is
64
71
  if (!numericIdMap) {
65
72
  return callback(null, source, map);
66
73
  }
74
+
67
75
  const isDevMode = options.devMode || process.env.NODE_ENV === 'development';
76
+
68
77
  try {
69
78
  // Parse the JavaScript/TypeScript source code
70
79
  const ast = parser.parse(source, {
@@ -72,30 +81,28 @@ module.exports = function i18nIdReplaceLoader(source, map) {
72
81
  plugins: ['jsx', 'typescript', 'classProperties', 'optionalChaining', 'nullishCoalescingOperator'],
73
82
  sourceFilename: resourcePath
74
83
  });
75
- let hasTransformations = false;
84
+ let hasTransformations = false; // Traverse AST and replace i18n keys with numeric IDs
76
85
 
77
- // Traverse AST and replace i18n keys with numeric IDs
78
86
  traverse(ast, {
79
87
  StringLiteral(path) {
80
88
  const {
81
89
  node
82
- } = path;
90
+ } = path; // Check if this string is an i18n key
83
91
 
84
- // Check if this string is an i18n key
85
92
  if (!options.allI18nData.hasOwnProperty(node.value)) {
86
93
  return;
87
- }
94
+ } // Replace with numeric ID if available
95
+
88
96
 
89
- // Replace with numeric ID if available
90
97
  if (numericIdMap.hasOwnProperty(node.value)) {
91
98
  const numericId = String(numericIdMap[node.value]);
92
99
  path.replaceWith(t.stringLiteral(numericId));
93
100
  hasTransformations = true;
94
101
  }
95
102
  }
96
- });
97
103
 
98
- // Generate code if transformations were made
104
+ }); // Generate code if transformations were made
105
+
99
106
  if (hasTransformations) {
100
107
  const output = generator(ast, {
101
108
  sourceMaps: !!options.sourceMaps,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  module.exports = function miniCssFallBackLoader(source) {
4
- const replacedStr = source.replace('export default ', 'module.exports = ');
5
- // console.log('src/loaders/docsLoader.js', replacedStr);
4
+ const replacedStr = source.replace('export default ', 'module.exports = '); // console.log('src/loaders/docsLoader.js', replacedStr);
5
+
6
6
  return replacedStr;
7
7
  };
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = loader;
7
7
  exports.pitch = pitch;
8
+
8
9
  var _path = _interopRequireDefault(require("path"));
10
+
9
11
  var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntryPlugin"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
11
15
  // import { getOptions } from 'loader-utils';
12
16
  // import validateOptions from 'schema-utils';
13
-
14
17
  const schema = {
15
18
  'type': 'object',
16
19
  'properties': {
@@ -38,24 +41,25 @@ const schema = {
38
41
  }
39
42
  },
40
43
  'additionalProperties': false
41
- };
44
+ }; // eslint-disable-next-line
42
45
 
43
- // eslint-disable-next-line
44
46
  function loader() {}
47
+
45
48
  function getDefaultFilename(filename) {
46
49
  if (typeof filename === 'function') {
47
50
  return filename;
48
51
  }
52
+
49
53
  return filename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
50
54
  }
55
+
51
56
  function getDefaultChunkFilename(chunkFilename) {
52
57
  return chunkFilename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
53
58
  }
59
+
54
60
  function pitch(request) {
55
61
  this.cacheable(false);
56
- const options = this.getOptions();
57
- // console.log(this.getOptions());
58
-
62
+ const options = this.getOptions(); // console.log(this.getOptions());
59
63
  // validateOptions(schema, options, {
60
64
  // name: 'Worker Loader',
61
65
  // baseDataPath: 'options'
@@ -73,7 +77,6 @@ function pitch(request) {
73
77
  globalObject: 'self'
74
78
  };
75
79
  workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
76
-
77
80
  /*
78
81
  new WebWorkerTemplatePlugin().apply(workerContext.compiler);
79
82
 
@@ -89,19 +92,25 @@ function pitch(request) {
89
92
  const cb = this.async();
90
93
  workerContext.compiler.runAsChild((errorArg, entries, compilation) => {
91
94
  let error = errorArg;
95
+
92
96
  if (!error && compilation.errors && compilation.errors.length) {
93
97
  // eslint-disable-next-line
94
98
  error = compilation.errors[0];
95
99
  }
100
+
96
101
  const entry = entries && entries[0] && entries[0].files.values().next().value;
102
+
97
103
  if (!error && !entry) {
98
104
  error = Error(`WorkerPlugin: no entry for ${request}`);
99
105
  }
106
+
100
107
  if (error) {
101
108
  return cb(error);
102
109
  }
110
+
103
111
  function workerCode() {
104
112
  let blob;
113
+
105
114
  try {
106
115
  blob = new Blob([`importScripts('${this.workerUrl}');`], {
107
116
  'type': 'application/javascript'
@@ -109,11 +118,13 @@ function pitch(request) {
109
118
  } catch (e1) {
110
119
  throw new Error(e1);
111
120
  }
121
+
112
122
  let url = window.URL || window.webkitURL;
113
123
  let blobUrl = url.createObjectURL(blob);
114
124
  let worker = new Worker(blobUrl);
115
125
  return worker;
116
126
  }
127
+
117
128
  return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
118
129
  workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
119
130
  getInstance: ${workerCode} \n
@@ -4,12 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.optimizationConfig = optimizationConfig;
7
+
7
8
  var _terserWebpackPlugin = _interopRequireDefault(require("terser-webpack-plugin"));
9
+
8
10
  var _nameTemplates = require("./common/nameTemplates");
11
+
9
12
  var _hashUtils = require("./custom_plugins/I18nSplitPlugin/utils/hashUtils");
13
+
10
14
  var _configCSSMinifierPlugin = require("./pluginConfigs/configCSSMinifierPlugin");
15
+
11
16
  var _splitChunksConfig = require("./splitChunksConfig");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
13
20
  function optimizationConfig(options) {
14
21
  const {
15
22
  changeRuntimeChunkChar
@@ -24,21 +31,22 @@ function optimizationConfig(options) {
24
31
  * other wise we don't need multiple runtime files based locale
25
32
  * that's why we added chunkSplitEnable && chunkFilenameHasContentHash logic
26
33
  */
27
- const suffix =
28
- // chunkSplitEnable ? '_[locale]' : '';
34
+
35
+ const suffix = // chunkSplitEnable ? '_[locale]' : '';
29
36
  chunkSplitEnable && chunkFilenameHasContentHash ? '_[locale]' : '';
30
37
  const char = changeRuntimeChunkChar;
31
38
  const excludeList = options.optimization.jsExcludePath;
32
39
  return {
33
40
  splitChunks: (0, _splitChunksConfig.splitChunksConfig)(options),
34
- minimizer: [
35
- // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
41
+ minimizer: [// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
36
42
  // '...',
37
43
  excludeList !== '' ? new _terserWebpackPlugin.default({
38
44
  exclude: excludeList,
39
45
  extractComments: false // Do not extract comments to .LICENSE.txt files
46
+
40
47
  }) : new _terserWebpackPlugin.default({
41
48
  extractComments: false // Do not extract comments to .LICENSE.txt files
49
+
42
50
  }), (0, _configCSSMinifierPlugin.configCSSMinifierPlugin)(options)].filter(Boolean),
43
51
  moduleIds: 'named',
44
52
  runtimeChunk: {
@@ -4,11 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.outputConfig = outputConfig;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _constants = require("../../constants");
11
+
9
12
  var _nameTemplates = require("./common/nameTemplates");
13
+
10
14
  var _modeUtils = require("./common/modeUtils");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
12
18
  function outputConfig(options) {
13
19
  const {
14
20
  output,
@@ -23,8 +29,10 @@ function outputConfig(options) {
23
29
  // clean: true,
24
30
  path: _path.default.resolve(_constants.appPath, output)
25
31
  };
32
+
26
33
  if (htmlTemplate.crossorigin) {
27
34
  outputO.crossOriginLoading = 'anonymous';
28
35
  }
36
+
29
37
  return outputO;
30
38
  }
@@ -4,26 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.configBundleAnalyzer = configBundleAnalyzer;
7
+
7
8
  var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
9
+
8
10
  var _modeUtils = require("../common/modeUtils");
9
- /* eslint-disable no-use-before-define */
10
11
 
12
+ /* eslint-disable no-use-before-define */
11
13
  function configBundleAnalyzer(options) {
12
14
  const mode = (0, _modeUtils.getWebpackMode)(options);
15
+
13
16
  if ((0, _modeUtils.isProductionMode)(mode) && options.bundleAnalyze) {
14
17
  const bundleAnalyzerOptions = getBundleAnalyzerOptions(options);
15
18
  return new _webpackBundleAnalyzer.BundleAnalyzerPlugin(bundleAnalyzerOptions);
16
19
  }
20
+
17
21
  return null;
18
- }
22
+ } // eslint-disable-next-line no-unused-vars
23
+
19
24
 
20
- // eslint-disable-next-line no-unused-vars
21
25
  function getBundleAnalyzerOptions(options) {
22
26
  return {
23
27
  analyzerMode: 'static',
24
28
  // generateStatsFile: false,
25
- openAnalyzer: false
26
- // statsOptions: {
29
+ openAnalyzer: false // statsOptions: {
27
30
  // source: false,
28
31
  // normal: true,
29
32
  // chunks: false,
@@ -32,5 +35,6 @@ function getBundleAnalyzerOptions(options) {
32
35
  // assets: true,
33
36
  // assetsSort: 'name'
34
37
  // }
38
+
35
39
  };
36
40
  }