@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,16 +0,0 @@
1
- import { isDevelopmentMode } from "../common/modeUtils";
2
- import CdnChangePlugin from "../custom_plugins/CdnChangePlugin";
3
- export function configCdnChangePlugin(options) {
4
- const {
5
- cdnMapping,
6
- mode
7
- } = options;
8
-
9
- if (!cdnMapping.isCdnEnabled || isDevelopmentMode(mode)) {
10
- return null;
11
- }
12
-
13
- return new CdnChangePlugin({ ...cdnMapping,
14
- createSeparateSMap: options.createSeparateSMap
15
- });
16
- }
@@ -1,10 +0,0 @@
1
- /* eslint-disable no-use-before-define */
2
- import { isProductionMode } from "../common/modeUtils";
3
- import ChunkHierarchyPlugin from "../custom_plugins/ChunkHierarchyPlugin";
4
- export function configChunkHierarchyPlugin(options) {
5
- if (options.chunkGraph.enable) {
6
- return new ChunkHierarchyPlugin(options.chunkGraph.fileName);
7
- }
8
-
9
- return null;
10
- }
@@ -1,50 +0,0 @@
1
- import path from 'path';
2
- import CopyPlugin from 'copy-webpack-plugin';
3
- import { existsSync } from 'fs';
4
- import { updateArrayWithDefault } from "../utils/updateArrayWithDefault";
5
- import { joinWithAppPath } from "../../../constants";
6
- const defaultPublicFolders = [{
7
- // source must be relative path not absolute path
8
- source: 'public',
9
- // target is the path that this copied file output path
10
- target: 'public',
11
- toType: 'dir'
12
- }];
13
-
14
- function folderPatterns(publicFolders) {
15
- return publicFolders.map(conf => {
16
- const publicFolderActualPath = joinWithAppPath(conf.source);
17
-
18
- if (!conf.source || !conf.target || path.isAbsolute(conf.source) || !existsSync(publicFolderActualPath)) {
19
- return null;
20
- }
21
-
22
- return {
23
- from: publicFolderActualPath,
24
- to: conf.target,
25
- toType: conf.toType || 'dir'
26
- };
27
- }).filter(Boolean);
28
- }
29
-
30
- export function configCopyPublicFolders(options) {
31
- let {
32
- publicFolders,
33
- mode = 'dev'
34
- } = options;
35
- publicFolders = updateArrayWithDefault(publicFolders[mode], defaultPublicFolders);
36
-
37
- if (publicFolders.length === 0) {
38
- return null;
39
- }
40
-
41
- const patterns = folderPatterns(publicFolders);
42
-
43
- if (patterns.length === 0) {
44
- return null;
45
- }
46
-
47
- return new CopyPlugin({
48
- patterns
49
- });
50
- }
@@ -1,8 +0,0 @@
1
- import CssCustomOrderPlugin from "../custom_plugins/CssCustomOrderPlugin";
2
- export function configCssCustomOrderPlugin(options) {
3
- if (options.cssOrderControler.enable) {
4
- return new CssCustomOrderPlugin(options.cssOrderControler.className);
5
- }
6
-
7
- return null;
8
- }
@@ -1,12 +0,0 @@
1
- import { CustomAttributesPlugin } from "../custom_plugins/custom_attribute_plugin";
2
- export function configCustomAttributesPlugin(options) {
3
- const {
4
- customAttributes
5
- } = options;
6
-
7
- if (customAttributes.enable) {
8
- return new CustomAttributesPlugin(customAttributes);
9
- }
10
-
11
- return null;
12
- }
@@ -1,67 +0,0 @@
1
- import { CustomScriptLoadingStrategyPlugin } from "../custom_plugins/CustomScriptLoadingPlugin";
2
- import { getTypeOf } from "../utils";
3
- const defaultScriptLoadingStrategy = 'defer';
4
- const allowedScriptLoadingStrategies = ['blocking', 'defer', 'async', 'module'];
5
-
6
- function isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey) {
7
- return allowedScriptLoadingStrategies.includes(scriptLoadingStategey);
8
- }
9
-
10
- function getScriptLoadingStrategyForStringType(scriptLoadingStategey) {
11
- if (isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey)) {
12
- return scriptLoadingStategey;
13
- }
14
-
15
- return defaultScriptLoadingStrategy;
16
- }
17
-
18
- function getScriptLoadingStrategyForObject(scriptLoadingStategey) {
19
- if (Object.keys(scriptLoadingStategey).length === 0) {
20
- return defaultScriptLoadingStrategy;
21
- }
22
-
23
- const isAllowedScriptLoadingStrategy = Object.keys(scriptLoadingStategey).every(key => isAllowedScriptLoadingStrategyUsed(key));
24
-
25
- if (isAllowedScriptLoadingStrategy) {
26
- return Object.assign({}, scriptLoadingStategey);
27
- }
28
-
29
- console.warn('un supported script loading strategy used', scriptLoadingStategey);
30
- return defaultScriptLoadingStrategy;
31
- }
32
-
33
- function getScriptLoadingStrategy(scriptLoadingStategey) {
34
- if (getTypeOf(scriptLoadingStategey) === 'string') {
35
- return {
36
- [getScriptLoadingStrategyForStringType(scriptLoadingStategey)]: [/.*/]
37
- };
38
- }
39
-
40
- if (getTypeOf(scriptLoadingStategey) === 'object') {
41
- return getScriptLoadingStrategyForObject(scriptLoadingStategey);
42
- }
43
-
44
- return {
45
- [defaultScriptLoadingStrategy]: [/.*/]
46
- };
47
- }
48
-
49
- export function configCustomScriptLoadingStrategyPlugin(options) {
50
- const {
51
- customScriptLoadingStrategey
52
- } = options;
53
-
54
- if (customScriptLoadingStrategey) {
55
- const currentScriptLoadingStrategy = getScriptLoadingStrategy(customScriptLoadingStrategey.options);
56
-
57
- if (getTypeOf(currentScriptLoadingStrategy) === 'object') {
58
- return new CustomScriptLoadingStrategyPlugin({
59
- scriptLoadingStategey: currentScriptLoadingStrategy
60
- });
61
- } else {
62
- return null;
63
- }
64
- } else {
65
- return null;
66
- }
67
- }
@@ -1,37 +0,0 @@
1
- import { nameTemplates } from "../common/nameTemplates";
2
- import { EFCTemplatePlugin } from "../custom_plugins/EFCTemplatePlugin";
3
- export function configEFCTemplatePlugin(options) {
4
- const {
5
- publicPath
6
- } = options;
7
- const {
8
- chunkSplitEnable
9
- } = options.i18nChunkSplit;
10
- const {
11
- enableRTLSplit
12
- } = options.css.plugins.rtlSplit;
13
- const {
14
- createSDkFile,
15
- hasEFC,
16
- entryPointName,
17
- outputFile,
18
- version,
19
- templateFilePath
20
- } = options.efc;
21
-
22
- if (!hasEFC || !createSDkFile) {
23
- return false;
24
- }
25
-
26
- const i18nFileNameTemplate = nameTemplates('i18njs', options);
27
- return new EFCTemplatePlugin({
28
- entryPointName,
29
- templateFilePath,
30
- outputFile,
31
- i18nFileNameTemplate,
32
- version,
33
- publicPath,
34
- chunkSplitEnable,
35
- enableRTLSplit
36
- });
37
- }
@@ -1,43 +0,0 @@
1
- import { DefinePlugin } from 'webpack';
2
- import { isDevelopmentMode } from "../common/modeUtils";
3
-
4
- function getDevEnvs(NODE_ENV) {
5
- return {
6
- __CLIENT__: true,
7
- __TEST__: false,
8
- __SERVER__: false,
9
- __DEVELOPMENT__: true,
10
- __LOCAL_PRODUCTION__: false,
11
- __DEVTOOLS__: true,
12
- __DOCS__: false,
13
- 'process.env': {
14
- NODE_ENV
15
- }
16
- };
17
- }
18
-
19
- function getProdEnvs(isDevelopment) {
20
- return {
21
- __CLIENT__: true,
22
- __TEST__: false,
23
- __SERVER__: false,
24
- __DEVELOPMENT__: false,
25
- __LOCAL_PRODUCTION__: isDevelopment,
26
- __DOCS__: false,
27
- 'process.env': {
28
- NODE_ENV: JSON.stringify('production')
29
- }
30
- };
31
- }
32
-
33
- export function configEnvVariables(options) {
34
- // const mode = getWebpackMode(options);
35
- const {
36
- disableReactDevWarning,
37
- mode,
38
- devLikeHash
39
- } = options;
40
- const isDevelopment = devLikeHash;
41
- const NODE_ENV = disableReactDevWarning ? JSON.stringify('production') : JSON.stringify('development');
42
- return new DefinePlugin(isDevelopmentMode(mode) ? getDevEnvs(NODE_ENV) : getProdEnvs(isDevelopment));
43
- }
@@ -1,52 +0,0 @@
1
- import { joinWithAppPath } from "../../../constants";
2
- import { nameTemplates } from "../common/nameTemplates";
3
- import { isProductionMode } from "../common/modeUtils";
4
- import { InitialHtmlPlugin } from "../custom_plugins/InitialHtmlPlugin";
5
- export function configHtmlWebpackPlugin(options) {
6
- const {
7
- htmlTemplate,
8
- mode,
9
- enableSubResourceIntegrity
10
- } = options;
11
- const {
12
- inject,
13
- templateFile,
14
- generateHtml
15
- } = htmlTemplate;
16
- const appInitialHTMLTemplatePath = joinWithAppPath(templateFile);
17
-
18
- if (!generateHtml) {
19
- return null;
20
- }
21
-
22
- const minifyHtmlOptions = isProductionMode(mode) ? // eslint-disable-next-line no-use-before-define
23
- getHTMLMinifyOptions(htmlTemplate) : false;
24
- return new InitialHtmlPlugin({
25
- mainChunkName: 'main',
26
- filename: nameTemplates('html', options),
27
- template: appInitialHTMLTemplatePath,
28
- minify: minifyHtmlOptions,
29
- inject,
30
- scriptLoading: 'defer',
31
- enableSubResourceIntegrity
32
- });
33
- }
34
- const defaultHTMLMiniFyOption = {
35
- collapseWhitespace: true,
36
- minifyCSS: true,
37
- minifyJS: true,
38
- keepClosingSlash: true,
39
- removeComments: false,
40
- removeRedundantAttributes: true,
41
- removeScriptTypeAttributes: true,
42
- removeStyleLinkTypeAttributes: true,
43
- useShortDoctype: true
44
- };
45
-
46
- function getHTMLMinifyOptions(htmlTemplate) {
47
- const {
48
- minify
49
- } = htmlTemplate;
50
- const minifyHtmlOptions = minify === null ? false : minify;
51
- return minifyHtmlOptions === true ? defaultHTMLMiniFyOption : minifyHtmlOptions;
52
- }
@@ -1,17 +0,0 @@
1
- import { I18nNumericIndexPlugin } from "../custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js";
2
- const REQUIRED_OPTIONS = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath'];
3
- export function configI18nNumericIndexPlugin(options) {
4
- const i18nOptions = options.i18nIndexing;
5
-
6
- if (!i18nOptions.enable) {
7
- return null;
8
- }
9
-
10
- const missingOptions = REQUIRED_OPTIONS.filter(opt => !i18nOptions[opt]);
11
-
12
- if (missingOptions.length > 0) {
13
- throw new Error(`[I18nNumericIndexPlugin] Missing required: ${missingOptions.join(', ')}`);
14
- }
15
-
16
- return new I18nNumericIndexPlugin(i18nOptions);
17
- }
@@ -1,29 +0,0 @@
1
- import { nameTemplates } from "../common/nameTemplates";
2
- import I18nSplitPlugin from "../custom_plugins/I18nSplitPlugin";
3
- import { resourceBasedPublicPath } from "../common/resourceBasedPublicPath";
4
- export function configI18nSplitPlugin(options) {
5
- const {
6
- i18nChunkSplit
7
- } = options;
8
-
9
- if (!i18nChunkSplit.chunkSplitEnable) {
10
- return null;
11
- }
12
-
13
- const i18nPublicPath = resourceBasedPublicPath('i18n', options); // const i18nPublicPathAsExpression = publicPathAsExpression('i18n', options);
14
-
15
- return new I18nSplitPlugin({
16
- mainChunkName: 'main',
17
- jsResource: i18nChunkSplit.jsResource,
18
- localeVarName: i18nChunkSplit.localeVarName,
19
- jsonpFunc: i18nChunkSplit.jsonpFunc,
20
- templateLabel: i18nChunkSplit.templateLabel,
21
- disableDefault: i18nChunkSplit.disableDefault,
22
- filename: nameTemplates('i18njs', options),
23
- chunkFilename: nameTemplates('i18njs', options),
24
- publicPath: i18nPublicPath,
25
- i18nManifestFileName: nameTemplates('i18nmanifest', options),
26
- // template: (object, locale) => `window.loadI18n(${JSON.stringify(object)}, ${JSON.stringify(locale)})`,
27
- propertiesFolder: i18nChunkSplit.propertiesFolder
28
- });
29
- }
@@ -1,8 +0,0 @@
1
- import { IgnorePlugin } from 'webpack'; // eslint-disable-next-line no-unused-vars
2
-
3
- export function configIgnorePlugin(options) {
4
- return new IgnorePlugin({
5
- resourceRegExp: /^\.\/domain$/,
6
- contextRegExp: /moment$/
7
- });
8
- }
@@ -1,12 +0,0 @@
1
- import InjectChunkGraphPlugin from "../custom_plugins/InjectChunkGraphPlugin";
2
- export function configInjectChunkGraphPlugin(options) {
3
- const {
4
- resourceHints
5
- } = options;
6
-
7
- if (resourceHints.enable) {
8
- return new InjectChunkGraphPlugin(resourceHints);
9
- }
10
-
11
- return null;
12
- }
@@ -1,36 +0,0 @@
1
- import { AddFileToManifestJson } from "../custom_plugins/ManifestJsonPlugin";
2
- export function configManifestJsonPlugin(options) {
3
- const {
4
- enable,
5
- i18nManifestJson,
6
- licenseManifest
7
- } = options.manifestJson;
8
-
9
- if (!enable) {
10
- return null;
11
- }
12
-
13
- const params = [{
14
- outputJsonFileName: 'manifest.json',
15
- test: f => !/\.i18n\.js$|\.LICENSE\.txt$|\.map$/.test(f),
16
- needInitialEntries: true
17
- }];
18
-
19
- if (i18nManifestJson) {
20
- params.push({
21
- outputJsonFileName: 'i18nManifest.json',
22
- test: f => /\.i18n\.js$/g.test(f),
23
- needInitialEntries: false
24
- });
25
- }
26
-
27
- if (licenseManifest) {
28
- params.push({
29
- outputJsonFileName: 'licenseManifest.json',
30
- test: f => /\.LICENSE\.txt$/g.test(f),
31
- needInitialEntries: false
32
- });
33
- }
34
-
35
- return new AddFileToManifestJson(params);
36
- }
@@ -1,13 +0,0 @@
1
- import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
- import { nameTemplates } from "../common/nameTemplates";
3
- export function configMiniCSSExtractPlugin(options) {
4
- const {
5
- enableRTLSplit
6
- } = options.css.plugins.rtlSplit;
7
- const cssLTRFileNameTempalte = enableRTLSplit ? nameTemplates('cssdir', options) : nameTemplates('css', options); // eslint-disable-next-line no-undef
8
-
9
- return new MiniCssExtractPlugin({
10
- filename: cssLTRFileNameTempalte,
11
- chunkFilename: cssLTRFileNameTempalte
12
- });
13
- }
@@ -1,19 +0,0 @@
1
- import { appPath } from "../../../constants";
2
- import MurphyInjectorPlugin from "../custom_plugins/MurphyInjectorPlugin";
3
- import path from 'path';
4
- export function configMurphyInjectorPlugin(options) {
5
- const {
6
- enable,
7
- chunkName,
8
- filePath
9
- } = options.murphyBootstrapHtml;
10
-
11
- if (enable) {
12
- return new MurphyInjectorPlugin([{
13
- name: chunkName,
14
- file: path.join(appPath, filePath)
15
- }], options);
16
- }
17
-
18
- return null;
19
- }
@@ -1,18 +0,0 @@
1
- import webpack from 'webpack'; // eslint-disable-next-line no-unused-vars
2
-
3
- export function configProgressPlugin(options) {
4
- if (!options.printProgress) {
5
- return null;
6
- }
7
-
8
- return new webpack.ProgressPlugin({
9
- handler: function (percentage, message) {
10
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
11
- args[_key - 2] = arguments[_key];
12
- }
13
-
14
- // eslint-disable-next-line no-console
15
- console.info(percentage, message, ...args);
16
- }
17
- });
18
- }
@@ -1,11 +0,0 @@
1
- import ResourceHintsPlugin from "../custom_plugins/ResourceHintsPlugin";
2
- export function configResourceHintsPlugin(options) {
3
- const {
4
- publicPath,
5
- resourceHints
6
- } = options;
7
- return new ResourceHintsPlugin({
8
- resourceHints,
9
- publicPath: JSON.stringify(publicPath)
10
- });
11
- }
@@ -1,19 +0,0 @@
1
- import { RtlCssPlugin } from "../custom_plugins/RtlSplitPlugin/RtlCssPlugin";
2
- export function configRtlCssPlugin(options) {
3
- const {
4
- enableRTLSplit,
5
- templateLabel,
6
- disableMinifySelector,
7
- dirVarName
8
- } = options.css.plugins.rtlSplit;
9
-
10
- if (!enableRTLSplit) {
11
- return null;
12
- }
13
-
14
- return new RtlCssPlugin({
15
- templateLabel,
16
- disableMinifySelector,
17
- dirVarName
18
- });
19
- }
@@ -1,20 +0,0 @@
1
- import { getGlobalCacheStorageName } from "../common/modeUtils";
2
- import RuntimeResourceCleanup from "../custom_plugins/RuntimeResourceCleanup";
3
- export function configRuntimeResourceCleanup(options) {
4
- const chunkLoadingGlobal = getGlobalCacheStorageName(options);
5
- const {
6
- resourceCleanup: runtimeResourceCleanupEnabled,
7
- hasEFC: efcEnabled
8
- } = options.efc;
9
- const {
10
- customAttributes = {}
11
- } = options;
12
-
13
- if (efcEnabled && runtimeResourceCleanupEnabled) {
14
- return new RuntimeResourceCleanup({ ...customAttributes,
15
- chunkLoadingGlobal
16
- });
17
- }
18
-
19
- return null;
20
- }
@@ -1,18 +0,0 @@
1
- import SelectorWeightPlugin from "../custom_plugins/SelectorWeightPlugin";
2
- export function configSelectorWeightPlugin(options) {
3
- const {
4
- selectorWeight
5
- } = options.css.plugins;
6
-
7
- if (!selectorWeight.enable) {
8
- return null;
9
- }
10
-
11
- return new SelectorWeightPlugin({
12
- selectorWeightConfig: selectorWeight.configFile,
13
- defaultSelector: selectorWeight.defaultSelector,
14
- customFileDetails: selectorWeight.customFileDetails,
15
- excludeStrings: selectorWeight.excludeStrings,
16
- patterns: selectorWeight.patterns
17
- });
18
- }
@@ -1,29 +0,0 @@
1
- import { nameTemplates } from "../common/nameTemplates";
2
- import ServiceWorkerPlugin from "../custom_plugins/ServiceWorkerPlugin";
3
- export function configServiceWorkerPlugin(options) {
4
- const {
5
- serviceWorker
6
- } = options;
7
- const {
8
- publicPath
9
- } = options;
10
- const {
11
- chunkSplitEnable
12
- } = options.i18nChunkSplit;
13
- const {
14
- enableRTLSplit
15
- } = options.css.plugins.rtlSplit;
16
-
17
- if (!serviceWorker.enable) {
18
- return null;
19
- }
20
-
21
- const i18nFileNameTemplate = nameTemplates('i18njs', options);
22
- return new ServiceWorkerPlugin({ ...serviceWorker,
23
- publicPath,
24
- i18nFileNameTemplate,
25
- chunkSplitEnable,
26
- enableRTLSplit,
27
- entryPointName: 'main'
28
- });
29
- }
@@ -1,12 +0,0 @@
1
- import { SourceMapPlugin } from "../custom_plugins/SourceMapPlugin";
2
- export function configSourceMapPlugin(options) {
3
- const {
4
- createSeparateSMap
5
- } = options;
6
-
7
- if (createSeparateSMap === false) {
8
- return null;
9
- }
10
-
11
- return new SourceMapPlugin();
12
- }
@@ -1,20 +0,0 @@
1
- import path from 'path';
2
- import { TPHashMappingPlugin } from "../custom_plugins/TPHashMappingPlugin";
3
- import { isProductionMode } from "../common/modeUtils";
4
- export function configTPHashMappingPlugin(options) {
5
- const {
6
- fileHashMappingToVariable,
7
- context,
8
- mode
9
- } = options;
10
-
11
- if (isProductionMode(mode) && fileHashMappingToVariable) {
12
- return new TPHashMappingPlugin({
13
- fileMappings: fileHashMappingToVariable,
14
- tpFolder: `${path.join(process.cwd(), context)}`
15
- });
16
- }
17
-
18
- ;
19
- return null;
20
- }
@@ -1,15 +0,0 @@
1
- import VariableConversionCollector from "../custom_plugins/VariableConversionCollector";
2
- export function configVariableConversionPlugin(options) {
3
- const {
4
- cssVariableReplacement
5
- } = options.css.plugins;
6
-
7
- if (cssVariableReplacement.enable === false) {
8
- return false;
9
- }
10
-
11
- return new VariableConversionCollector({
12
- configFile: cssVariableReplacement.configFile,
13
- patterns: cssVariableReplacement.patterns
14
- });
15
- }
@@ -1,33 +0,0 @@
1
- import { configHtmlWebpackPlugin } from "./pluginConfigs/configHtmlWebpackPlugin";
2
- import { configEnvVariables } from "./pluginConfigs/configEnvVariables";
3
- import { configI18nSplitPlugin } from "./pluginConfigs/configI18nSplitPlugin";
4
- import { configMiniCSSExtractPlugin } from "./pluginConfigs/configMiniCSSExtractPlugin";
5
- import { configRtlCssPlugin } from "./pluginConfigs/configRtlCssPlugin";
6
- import { configIgnorePlugin } from "./pluginConfigs/configIgnorePlugin";
7
- import { configCdnChangePlugin } from "./pluginConfigs/configCdnChangePlugin";
8
- import { configServiceWorkerPlugin } from "./pluginConfigs/configServiceWorkerPlugin";
9
- import { configProgressPlugin } from "./pluginConfigs/configProgressPlugin";
10
- import { configBundleAnalyzer } from "./pluginConfigs/configBundleAnalyzer";
11
- import { configSelectorWeightPlugin } from "./pluginConfigs/configSelectorWeightPlugin";
12
- import { configVariableConversionPlugin } from "./pluginConfigs/configVariableConversionPlugin";
13
- import { configEFCTemplatePlugin } from "./pluginConfigs/configEFCTemplatePlugin";
14
- import { configResourceHintsPlugin } from "./pluginConfigs/configResourceHintsPlugin";
15
- import { configManifestJsonPlugin } from "./pluginConfigs/configManifestJsonPlugin";
16
- import { configCopyPublicFolders } from "./pluginConfigs/configCopyPublicFolders";
17
- import { configSourceMapPlugin } from "./pluginConfigs/configSourceMapPlugin";
18
- import { configTPHashMappingPlugin } from "./pluginConfigs/configTPHashMappingPlugin";
19
- import { configCustomAttributesPlugin } from "./pluginConfigs/configCustomAttributesPlugin";
20
- import { configBundleIntegrityReport } from "./pluginConfigs/configBundleIntegrityReport";
21
- import { configRuntimeResourceCleanup } from "./pluginConfigs/configRuntimeResourceCleanup";
22
- import { configMurphyInjectorPlugin } from "./pluginConfigs/configMurphyInjectorPlugin";
23
- import { configCustomScriptLoadingStrategyPlugin } from "./pluginConfigs/configCustomScriptLoadingStrategyPlugin";
24
- import { configChunkHierarchyPlugin } from "./pluginConfigs/configChunkHierarchyPlugin";
25
- import { configInjectChunkGraphPlugin } from "./pluginConfigs/configInjectChunkGraphPlugin";
26
- import { configCssCustomOrderPlugin } from "./pluginConfigs/configCssCustomOrderPlugin";
27
- import { configI18nNumericIndexPlugin } from "./pluginConfigs/configI18nNumericIndexPlugin";
28
- export function plugins(options) {
29
- const {
30
- webpackPlugins
31
- } = options;
32
- return [configEnvVariables(options), configCustomAttributesPlugin(options), configTPHashMappingPlugin(options), configCopyPublicFolders(options), configIgnorePlugin(options), configMiniCSSExtractPlugin(options), configSelectorWeightPlugin(options), configVariableConversionPlugin(options), configI18nSplitPlugin(options), configRtlCssPlugin(options), configHtmlWebpackPlugin(options), configI18nNumericIndexPlugin(options), configCustomScriptLoadingStrategyPlugin(options), configCdnChangePlugin(options), configServiceWorkerPlugin(options), configEFCTemplatePlugin(options), configResourceHintsPlugin(options), configBundleAnalyzer(options), configManifestJsonPlugin(options), configSourceMapPlugin(options), configProgressPlugin(options), configBundleIntegrityReport(options), configRuntimeResourceCleanup(options), configMurphyInjectorPlugin(options), configCssCustomOrderPlugin(options), configChunkHierarchyPlugin(options), ...webpackPlugins].filter(Boolean);
33
- }