@zohodesk/client_build_tool 0.0.22-exp.4 → 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 (240) 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 +3 -6
  7. package/lib/shared/babel/babelWebConfig.js +2 -1
  8. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/utils.js +15 -0
  9. package/lib/shared/bundler/webpack/entryConfig.js +2 -3
  10. package/lib/shared/bundler/webpack/moduleConcatenationConfig.js +18 -0
  11. package/lib/shared/bundler/webpack/optimizationConfig.js +8 -10
  12. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +1 -1
  13. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +1 -1
  14. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +1 -1
  15. package/package.json +1 -1
  16. package/es/allCommandsConfigs.js +0 -15
  17. package/es/commands/build/commandExecutor.js +0 -6
  18. package/es/commands/build/config.js +0 -5
  19. package/es/commands/build/optionsProcessor.js +0 -25
  20. package/es/commands/build/preProcessor.js +0 -4
  21. package/es/commands/buildEs/commandExecutor.js +0 -29
  22. package/es/commands/buildEs/config.js +0 -5
  23. package/es/commands/buildEs/preProcessor.js +0 -9
  24. package/es/commands/buildLib/commandExecutor.js +0 -24
  25. package/es/commands/buildLib/config.js +0 -5
  26. package/es/commands/buildLib/preProcessor.js +0 -9
  27. package/es/commands/mockserver/commandExecutor.js +0 -32
  28. package/es/commands/mockserver/config.js +0 -5
  29. package/es/commands/pre_process/commandExecutor.js +0 -10
  30. package/es/commands/pre_process/config.js +0 -5
  31. package/es/commands/start/commandExecutor.js +0 -4
  32. package/es/commands/start/config.js +0 -5
  33. package/es/commands/start/optionsProcessor.js +0 -21
  34. package/es/commands/start/preProcessor.js +0 -4
  35. package/es/commands/template/commandExecutor.js +0 -17
  36. package/es/commands/template/config.js +0 -5
  37. package/es/commands/version/commandExecutor.js +0 -5
  38. package/es/commands/version/config.js +0 -5
  39. package/es/commandsRouter.js +0 -58
  40. package/es/index.js +0 -4
  41. package/es/logger.js +0 -23
  42. package/es/schemas/applyValuesToSchema/index.js +0 -25
  43. package/es/schemas/applyValuesToSchema/isObject.js +0 -3
  44. package/es/schemas/applyValuesToSchema/isValid.js +0 -7
  45. package/es/schemas/cliArgsToObject.js +0 -32
  46. package/es/schemas/defaultConfigValues.js +0 -394
  47. package/es/schemas/defaultConfigValuesOnly.js +0 -196
  48. package/es/schemas/deprecatedOptionsHandler.js +0 -60
  49. package/es/schemas/getNpmVersion.js +0 -13
  50. package/es/schemas/giveDefaultValue.js +0 -11
  51. package/es/schemas/npmConfigToObject.js +0 -27
  52. package/es/schemas/readOptions.js +0 -67
  53. package/es/schemas/readOptionsForConfigFile.js +0 -28
  54. package/es/shared/babel/addDefaultPlugins.js +0 -8
  55. package/es/shared/babel/babelWebConfig.js +0 -43
  56. package/es/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -21
  57. package/es/shared/babel/getBabelPlugin.js +0 -36
  58. package/es/shared/babel/runBabelForJSFile.js +0 -15
  59. package/es/shared/babel/runBabelForTsFile.js +0 -34
  60. package/es/shared/bundler/webpack/common/decidePublicPath.js +0 -45
  61. package/es/shared/bundler/webpack/common/libAlias.js +0 -24
  62. package/es/shared/bundler/webpack/common/modeUtils.js +0 -24
  63. package/es/shared/bundler/webpack/common/nameTemplates.js +0 -95
  64. package/es/shared/bundler/webpack/common/resourceBasedPublicPath.js +0 -12
  65. package/es/shared/bundler/webpack/configCustomLoaders.js +0 -3
  66. package/es/shared/bundler/webpack/cssLoaders.js +0 -8
  67. package/es/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +0 -76
  68. package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +0 -102
  69. package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +0 -36
  70. package/es/shared/bundler/webpack/custom_plugins/ChunkHierarchyPlugin.js +0 -65
  71. package/es/shared/bundler/webpack/custom_plugins/CssCustomOrderPlugin.js +0 -37
  72. package/es/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +0 -97
  73. package/es/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +0 -98
  74. package/es/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +0 -211
  75. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +0 -11
  76. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +0 -160
  77. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +0 -66
  78. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +0 -201
  79. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +0 -95
  80. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +0 -59
  81. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -82
  82. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +0 -25
  83. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +0 -13
  84. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -15
  85. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +0 -72
  86. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +0 -23
  87. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +0 -40
  88. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +0 -59
  89. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -15
  90. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +0 -22
  91. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +0 -35
  92. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +0 -70
  93. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +0 -56
  94. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -6
  95. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +0 -10
  96. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -2
  97. package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -121
  98. package/es/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +0 -85
  99. package/es/shared/bundler/webpack/custom_plugins/InjectChunkGraphPlugin.js +0 -47
  100. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +0 -20
  101. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +0 -11
  102. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -26
  103. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -11
  104. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -34
  105. package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -11
  106. package/es/shared/bundler/webpack/custom_plugins/MurphyInjectorPlugin/index.js +0 -79
  107. package/es/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +0 -0
  108. package/es/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +0 -185
  109. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +0 -47
  110. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +0 -70
  111. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +0 -34
  112. package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +0 -14
  113. package/es/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -63
  114. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -9
  115. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +0 -63
  116. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +0 -43
  117. package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +0 -7
  118. package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +0 -104
  119. package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -6
  120. package/es/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +0 -74
  121. package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +0 -10
  122. package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +0 -36
  123. package/es/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +0 -35
  124. package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +0 -52
  125. package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +0 -341
  126. package/es/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +0 -67
  127. package/es/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -7
  128. package/es/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +0 -43
  129. package/es/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +0 -79
  130. package/es/shared/bundler/webpack/defaultVendorPatternList.js +0 -3
  131. package/es/shared/bundler/webpack/devtoolConfig.js +0 -6
  132. package/es/shared/bundler/webpack/entryConfig.js +0 -25
  133. package/es/shared/bundler/webpack/externals.js +0 -10
  134. package/es/shared/bundler/webpack/getCSSLoaders.js +0 -17
  135. package/es/shared/bundler/webpack/getFilenameFromModule.js +0 -15
  136. package/es/shared/bundler/webpack/jsLoaders.js +0 -16
  137. package/es/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -4
  138. package/es/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +0 -10
  139. package/es/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +0 -45
  140. package/es/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -11
  141. package/es/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +0 -23
  142. package/es/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -13
  143. package/es/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -71
  144. package/es/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +0 -56
  145. package/es/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +0 -11
  146. package/es/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +0 -40
  147. package/es/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +0 -116
  148. package/es/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +0 -5
  149. package/es/shared/bundler/webpack/loaders/workerLoader.js +0 -121
  150. package/es/shared/bundler/webpack/optimizationConfig.js +0 -42
  151. package/es/shared/bundler/webpack/outputConfig.js +0 -35
  152. package/es/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +0 -30
  153. package/es/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -27
  154. package/es/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +0 -17
  155. package/es/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +0 -16
  156. package/es/shared/bundler/webpack/pluginConfigs/configChunkHierarchyPlugin.js +0 -10
  157. package/es/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +0 -50
  158. package/es/shared/bundler/webpack/pluginConfigs/configCssCustomOrderPlugin.js +0 -8
  159. package/es/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -12
  160. package/es/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -67
  161. package/es/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -37
  162. package/es/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -43
  163. package/es/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +0 -52
  164. package/es/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +0 -17
  165. package/es/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +0 -29
  166. package/es/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -8
  167. package/es/shared/bundler/webpack/pluginConfigs/configInjectChunkGraphPlugin.js +0 -12
  168. package/es/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -36
  169. package/es/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +0 -13
  170. package/es/shared/bundler/webpack/pluginConfigs/configMurphyInjectorPlugin.js +0 -19
  171. package/es/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +0 -18
  172. package/es/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +0 -11
  173. package/es/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -19
  174. package/es/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +0 -20
  175. package/es/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +0 -18
  176. package/es/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +0 -29
  177. package/es/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -12
  178. package/es/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +0 -20
  179. package/es/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +0 -15
  180. package/es/shared/bundler/webpack/plugins.js +0 -33
  181. package/es/shared/bundler/webpack/resolvers.js +0 -70
  182. package/es/shared/bundler/webpack/splitChunksConfig.js +0 -106
  183. package/es/shared/bundler/webpack/statsConfig.js +0 -23
  184. package/es/shared/bundler/webpack/tsLoaders.js +0 -16
  185. package/es/shared/bundler/webpack/utils/index.js +0 -8
  186. package/es/shared/bundler/webpack/utils/object-manipulation.js +0 -82
  187. package/es/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -29
  188. package/es/shared/bundler/webpack/webpackBuild.js +0 -14
  189. package/es/shared/bundler/webpack/webpackConfig.js +0 -35
  190. package/es/shared/commands-utils/doBasicRequirementCheck.js +0 -10
  191. package/es/shared/commands-utils/getCliPath.js +0 -28
  192. package/es/shared/commands-utils/index.js +0 -3
  193. package/es/shared/commands-utils/log.js +0 -4
  194. package/es/shared/commands-utils/readArgsFormCommandLine.js +0 -4
  195. package/es/shared/commands-utils/readOptionFormCommandLine.js +0 -4
  196. package/es/shared/commands-utils/spawnSyncIO.js +0 -24
  197. package/es/shared/constants.js +0 -22
  198. package/es/shared/fileUtils/copyFile.js +0 -23
  199. package/es/shared/fileUtils/directoryIterator.js +0 -12
  200. package/es/shared/fileUtils/watchRun.js +0 -96
  201. package/es/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +0 -18
  202. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +0 -2
  203. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +0 -58
  204. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +0 -122
  205. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +0 -22
  206. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -11
  207. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +0 -13
  208. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -17
  209. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +0 -32
  210. package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -28
  211. package/es/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +0 -125
  212. package/es/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -82
  213. package/es/shared/postcss/custom_postcss_plugins/ValueReplacer.js +0 -50
  214. package/es/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +0 -318
  215. package/es/shared/postcss/filterPluginsAllowedForSpecficFile.js +0 -41
  216. package/es/shared/postcss/getAllowedPostCssPlugins.js +0 -20
  217. package/es/shared/postcss/getSpecificPostCssPlugin.js +0 -38
  218. package/es/shared/postcss/runPostCssForCssFile.js +0 -25
  219. package/es/shared/pre_process/runPreProcess.js +0 -47
  220. package/es/shared/server/configWebpackDevMiddleware.js +0 -26
  221. package/es/shared/server/corsHandling.js +0 -23
  222. package/es/shared/server/getIp.js +0 -18
  223. package/es/shared/server/getServerURL.js +0 -28
  224. package/es/shared/server/httpsOptions.js +0 -36
  225. package/es/shared/server/initExpressApp.js +0 -9
  226. package/es/shared/server/initialHTMLHandling.js +0 -92
  227. package/es/shared/server/mockApiHandler.js +0 -53
  228. package/es/shared/server/mockServer.js +0 -34
  229. package/es/shared/server/serveContextFiles.js +0 -17
  230. package/es/shared/server/serverBywebpackDevMiddleware.js +0 -21
  231. package/es/shared/server/startHttpServer.js +0 -18
  232. package/es/shared/server/startHttpsServer.js +0 -26
  233. package/es/shared/server/unwanted/addHttp2Server.js +0 -32
  234. package/es/shared/server/unwanted/configWebpackDevMiddleware.js +0 -35
  235. package/es/shared/server/unwanted/mockApiSupport.js +0 -11
  236. package/es/shared/server/unwanted/websocketMockSetup.js +0 -36
  237. package/es/shared/server/urlConcat.js +0 -35
  238. package/es/shared/utils/requireLocalOrGlobal.js +0 -57
  239. package/es/shared/utils/utils.js +0 -0
  240. package/es/shared/utils/versionPrint.js +0 -9
@@ -1,45 +0,0 @@
1
- import ignore from 'ignore';
2
- /**
3
- @param {Array<String>} patterns:
4
- // include src folder, include deskapp folder, exclude node modules
5
- [
6
- "src",
7
- "deskapp",
8
- "!node_modules"
9
- ]
10
- @param {String} filename :
11
- filename : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
12
-
13
- @return {Boolean} : true or false
14
- */
15
-
16
- export function checkIsPatternsMatchFilename(patterns, filename) {
17
- if (!filename) {
18
- return false;
19
- }
20
-
21
- if (typeof patterns === 'undefined') {
22
- return true;
23
- }
24
-
25
- if (typeof patterns === 'function') {
26
- return patterns(filename);
27
- }
28
-
29
- if (typeof patterns === 'string') {
30
- // eslint-disable-next-line no-param-reassign
31
- patterns = [patterns];
32
- }
33
-
34
- if (Array.isArray(patterns)) {
35
- return patterns.length ? ignore({
36
- allowRelativePaths: true
37
- }).add(patterns).ignores(filename) : true;
38
- } // eslint-disable-next-line no-throw-literal
39
-
40
-
41
- throw `UnKnown pattern Error ${JSON.stringify(patterns)}`;
42
- }
43
- export function modifyAsExclude(patterns) {
44
- return patterns.map(pattern => pattern[0] === '!' ? pattern.slice(1) : `!${pattern}`);
45
- }
@@ -1,11 +0,0 @@
1
- export function configHtmlTemplateLoader(options) {
2
- return {
3
- test: /\.tmpl$/,
4
- use: [{
5
- loader: 'html-loader',
6
- options: {
7
- minimize: true
8
- }
9
- }]
10
- };
11
- }
@@ -1,23 +0,0 @@
1
- import path from 'path';
2
- import { getEnabledPlugins } from "../../../postcss/filterPluginsAllowedForSpecficFile";
3
- import { postcssPluginGetter } from "../../../postcss/getAllowedPostCssPlugins";
4
- import { appPath } from "../../../constants"; // import EmptyPlugin from '../custom_postcss_plugins/EmptyPlugin';
5
-
6
- export function configPostCssLoader(options) {
7
- const pluginsOptions = options.css.plugins;
8
- const enabledPlugins = getEnabledPlugins(pluginsOptions);
9
- const getAllowedPostCssPlugins = postcssPluginGetter(options);
10
-
11
- function configPostCssPlugins(params) {
12
- const filename = path.relative(appPath, params.resourcePath);
13
- const allowedPostCssPlugins = getAllowedPostCssPlugins(filename);
14
- return allowedPostCssPlugins;
15
- }
16
-
17
- return enabledPlugins.length && {
18
- loader: 'postcss-loader',
19
- options: {
20
- postcssOptions: configPostCssPlugins
21
- }
22
- };
23
- }
@@ -1,13 +0,0 @@
1
- import { nameTemplates } from "../common/nameTemplates";
2
- export function configWebWorkerLoader(options) {
3
- return {
4
- test: /\.worker.js$/,
5
- use: {
6
- loader: require.resolve("../loaders/workerLoader.js"),
7
- options: {
8
- esModule: true,
9
- filename: nameTemplates('workerjs', options)
10
- }
11
- }
12
- };
13
- }
@@ -1,71 +0,0 @@
1
- import { nameTemplates } from "../common/nameTemplates";
2
- const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
3
- const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
4
- const SVGExtRegex = /\.svg$/;
5
- const AudioExtRegex = /\.ogg|\.mp3$/;
6
- const VideoExtRegex = /\.mp4|\.webm$/;
7
-
8
- function createAssetLoader(_ref) {
9
- let {
10
- test,
11
- nameTemplate,
12
- limit
13
- } = _ref;
14
- const conf = {
15
- test,
16
- type: 'asset'
17
- };
18
-
19
- if (limit) {
20
- conf.parser = {
21
- dataUrlCondition: {
22
- maxSize: limit // 4 * 1024 // 4kb
23
-
24
- }
25
- };
26
- } else {
27
- conf.type = 'asset/resource';
28
- }
29
-
30
- if (nameTemplate) {
31
- conf.generator = {
32
- filename: nameTemplate
33
- };
34
- }
35
-
36
- return conf;
37
- }
38
-
39
- export function configImageLoader(options) {
40
- return createAssetLoader({
41
- test: ImageExtRegex,
42
- nameTemplate: nameTemplates('image', options),
43
- limit: 1000
44
- });
45
- }
46
- export function configFontLoader(options) {
47
- return createAssetLoader({
48
- test: FontExtRegex,
49
- nameTemplate: nameTemplates('font', options),
50
- limit: 1000
51
- });
52
- }
53
- export function configSVGLoader(options) {
54
- return createAssetLoader({
55
- test: SVGExtRegex,
56
- nameTemplate: nameTemplates('svg', options),
57
- limit: 1000
58
- });
59
- }
60
- export function configAudioLoader(options) {
61
- return createAssetLoader({
62
- test: AudioExtRegex,
63
- nameTemplate: nameTemplates('audio', options)
64
- });
65
- }
66
- export function configVideoLoader(options) {
67
- return createAssetLoader({
68
- test: VideoExtRegex,
69
- nameTemplate: nameTemplates('video', options)
70
- });
71
- }
@@ -1,56 +0,0 @@
1
- import { createHash } from 'crypto';
2
- import path from 'path';
3
- import { checkIsPatternsMatchFilename } from "./checkIsPatternsMatchFilename";
4
- export function getHash(str, length) {
5
- return createHash('md5').update(str).digest('hex').slice(0, length);
6
- }
7
- const defaultSelectorBlob = '[prefix]-[filename]-[local]';
8
-
9
- function getSuitableBlob() {
10
- let customizations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11
- let filename = arguments.length > 1 ? arguments[1] : undefined;
12
- const custom = customizations.find(_ref => {
13
- let {
14
- enable,
15
- patterns
16
- } = _ref;
17
- return enable && checkIsPatternsMatchFilename(patterns, filename);
18
- });
19
- return custom && custom.blob || defaultSelectorBlob;
20
- }
21
-
22
- export default (options => {
23
- const {
24
- classNameOptions
25
- } = options.css;
26
- const {
27
- classNamePrefix,
28
- customizations,
29
- caseOnlyFilename
30
- } = classNameOptions;
31
- return (context, localIdentName, localName) => {
32
- // NOTE: in build machine we use date as folder path.
33
- // So every time we create new build there is path will alway different
34
- // So, in order to minimize that problem we try in relative path;
35
- // console.log('context.resourcePath', context.resourcePath, context);
36
- // let contextResourcePath = context.resourcePath;
37
- const {
38
- rootContext,
39
- resourcePath
40
- } = context;
41
- const relativePath = path.relative(rootContext, resourcePath);
42
- const fileNameWithoutExt = path.parse(relativePath).name;
43
- let cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
44
-
45
- if (caseOnlyFilename) {
46
- cleanFileName = fileNameWithoutExt;
47
- }
48
-
49
- if (cleanFileName.endsWith('.module')) {
50
- cleanFileName = cleanFileName.slice(0, -7);
51
- }
52
-
53
- const suitableBlob = getSuitableBlob(customizations, resourcePath);
54
- return suitableBlob.replaceAll('[local]', localName).replaceAll('[prefix]', classNamePrefix).replaceAll('[filename]', cleanFileName).replaceAll('[hash]', getHash(`${relativePath}-${localName}`, 10));
55
- };
56
- });
@@ -1,11 +0,0 @@
1
- import cssClassNameGenerate from "./cssClassNameGenerate";
2
- export function getCssLoaderOptions(options) {
3
- const cssLoaderOptions = {
4
- importLoaders: 1,
5
- modules: {
6
- getLocalIdent: cssClassNameGenerate(options)
7
- },
8
- sourceMap: false
9
- };
10
- return cssLoaderOptions;
11
- }
@@ -1,40 +0,0 @@
1
- import { getPropertiesAsJSON } from "../custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js";
2
-
3
- function getI18nConfig(options) {
4
- return {
5
- jsResourcePath: options.i18nIndexing.jsResourcePath,
6
- numericMapPath: options.i18nIndexing.numericMapPath
7
- };
8
- }
9
-
10
- function loadJSResources(jsResourcePath) {
11
- const i18nData = getPropertiesAsJSON(jsResourcePath);
12
-
13
- if (Object.keys(i18nData).length === 0) {
14
- console.warn(`[i18nIdReplaceLoaderConfig] Warning: No i18n data found in JSResource file: ${jsResourcePath}`);
15
- return {};
16
- }
17
-
18
- return i18nData;
19
- }
20
-
21
- export function i18nIdReplaceLoaderConfig(options) {
22
- const config = getI18nConfig(options);
23
-
24
- if (!config.jsResourcePath) {
25
- throw new Error('Missing required jsResourcePath in i18n options');
26
- }
27
-
28
- if (!config.numericMapPath) {
29
- throw new Error('numericMapPath is required in i18nIndexing config');
30
- }
31
-
32
- return {
33
- loader: require.resolve("../loaders/i18nIdReplaceLoader.js"),
34
- options: {
35
- allI18nData: loadJSResources(config.jsResourcePath),
36
- numericMapPath: config.numericMapPath,
37
- sourceMaps: false
38
- }
39
- };
40
- }
@@ -1,116 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require('fs');
4
-
5
- const parser = require('@babel/parser');
6
-
7
- const traverse = require('@babel/traverse').default;
8
-
9
- const generator = require('@babel/generator').default;
10
-
11
- const t = require('@babel/types');
12
-
13
- const {
14
- getOptions
15
- } = require('loader-utils');
16
-
17
- function loadNumericMap(numericMapPath) {
18
- if (!numericMapPath) {
19
- console.warn('[i18nIdReplaceLoader] numericMapPath option is missing');
20
- return null;
21
- }
22
-
23
- if (!fs.existsSync(numericMapPath)) {
24
- console.warn(`[i18nIdReplaceLoader] Numeric map file not found: ${numericMapPath}`);
25
- return null;
26
- }
27
-
28
- try {
29
- const fileContent = fs.readFileSync(numericMapPath, 'utf-8');
30
- const parsedData = JSON.parse(fileContent);
31
-
32
- if (!parsedData?.originalKeyToNumericId) {
33
- console.warn(`[i18nIdReplaceLoader] Invalid numeric map format: missing 'originalKeyToNumericId'`);
34
- return null;
35
- }
36
-
37
- return parsedData.originalKeyToNumericId;
38
- } catch (err) {
39
- console.warn(`[i18nIdReplaceLoader] Error reading numeric map: ${err.message}`);
40
- return null;
41
- }
42
- }
43
-
44
- function transformSource(source, resourcePath, numericIdMap, allI18nData, options) {
45
- const ast = parser.parse(source, {
46
- sourceType: 'module',
47
- plugins: ['jsx', 'typescript', 'classProperties', 'optionalChaining', 'nullishCoalescingOperator'],
48
- sourceFilename: resourcePath
49
- });
50
- let hasTransformations = false;
51
- traverse(ast, {
52
- StringLiteral(path) {
53
- const {
54
- node
55
- } = path;
56
-
57
- if (!(node.value in allI18nData)) {
58
- return;
59
- }
60
-
61
- if (node.value in numericIdMap) {
62
- path.replaceWith(t.stringLiteral(String(numericIdMap[node.value])));
63
- hasTransformations = true;
64
- }
65
- }
66
-
67
- });
68
-
69
- if (!hasTransformations) {
70
- return null;
71
- }
72
-
73
- return generator(ast, {
74
- sourceMaps: !!options.sourceMaps,
75
- sourceFileName: resourcePath,
76
- retainLines: false,
77
- comments: true
78
- }, source);
79
- }
80
-
81
- module.exports = function i18nIdReplaceLoader(source, map) {
82
- const resourcePath = this.resourcePath;
83
- if (this.cacheable) this.cacheable();
84
- const options = getOptions(this) || {};
85
- const callback = this.async();
86
-
87
- if (!resourcePath.includes('src')) {
88
- return callback(null, source, map);
89
- }
90
-
91
- if (!options.allI18nData) {
92
- return callback(null, source, map);
93
- }
94
-
95
- if (options.numericMapPath) {
96
- this.addDependency(options.numericMapPath);
97
- }
98
-
99
- const numericIdMap = loadNumericMap(options.numericMapPath);
100
-
101
- if (!numericIdMap) {
102
- return callback(null, source, map);
103
- }
104
-
105
- try {
106
- const output = transformSource(source, resourcePath, numericIdMap, options.allI18nData, options);
107
-
108
- if (output) {
109
- callback(null, output.code, output.map);
110
- } else {
111
- callback(null, source, map);
112
- }
113
- } catch (err) {
114
- callback(err);
115
- }
116
- };
@@ -1,5 +0,0 @@
1
- module.exports = function miniCssFallBackLoader(source) {
2
- const replacedStr = source.replace('export default ', 'module.exports = '); // console.log('src/loaders/docsLoader.js', replacedStr);
3
-
4
- return replacedStr;
5
- };
@@ -1,121 +0,0 @@
1
- import path from 'path'; // import { getOptions } from 'loader-utils';
2
- // import validateOptions from 'schema-utils';
3
-
4
- import SingleEntryPlugin from 'webpack/lib/SingleEntryPlugin';
5
- const schema = {
6
- 'type': 'object',
7
- 'properties': {
8
- 'publicPath': {
9
- 'anyOf': [{
10
- 'type': 'string'
11
- }, {
12
- 'instanceof': 'Function'
13
- }]
14
- },
15
- 'filename': {
16
- 'anyOf': [{
17
- 'type': 'string',
18
- 'minLength': 1
19
- }, {
20
- 'instanceof': 'Function'
21
- }]
22
- },
23
- 'chunkFilename': {
24
- 'type': 'string',
25
- 'minLength': 1
26
- },
27
- 'esModule': {
28
- 'type': 'boolean'
29
- }
30
- },
31
- 'additionalProperties': false
32
- }; // eslint-disable-next-line
33
-
34
- export default function loader() {}
35
-
36
- function getDefaultFilename(filename) {
37
- if (typeof filename === 'function') {
38
- return filename;
39
- }
40
-
41
- return filename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
42
- }
43
-
44
- function getDefaultChunkFilename(chunkFilename) {
45
- return chunkFilename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
46
- }
47
-
48
- export function pitch(request) {
49
- this.cacheable(false);
50
- const options = this.getOptions(); // console.log(this.getOptions());
51
- // validateOptions(schema, options, {
52
- // name: 'Worker Loader',
53
- // baseDataPath: 'options'
54
- // });
55
-
56
- const workerContext = {};
57
- const compilerOptions = this._compiler.options || {};
58
- const filename = options.filename ? options.filename : getDefaultFilename(compilerOptions.output.filename);
59
- const chunkFilename = options.chunkFilename ? options.chunkFilename : getDefaultChunkFilename(compilerOptions.output.chunkFilename);
60
- const publicPath = options.publicPath ? options.publicPath : compilerOptions.output.publicPath;
61
- workerContext.options = {
62
- filename,
63
- chunkFilename,
64
- publicPath,
65
- globalObject: 'self'
66
- };
67
- workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
68
- /*
69
- new WebWorkerTemplatePlugin().apply(workerContext.compiler);
70
-
71
- if (compilerOptions.externals) {
72
- new ExternalsPlugin(
73
- getExternalsType(compilerOptions),
74
- compilerOptions.externals
75
- ).apply(workerContext.compiler);
76
- } */
77
-
78
- new SingleEntryPlugin(this.context, `!!${request}`, path.parse(this.resourcePath).name).apply(workerContext.compiler);
79
- workerContext.request = request;
80
- const cb = this.async();
81
- workerContext.compiler.runAsChild((errorArg, entries, compilation) => {
82
- let error = errorArg;
83
-
84
- if (!error && compilation.errors && compilation.errors.length) {
85
- // eslint-disable-next-line
86
- error = compilation.errors[0];
87
- }
88
-
89
- const entry = entries && entries[0] && entries[0].files.values().next().value;
90
-
91
- if (!error && !entry) {
92
- error = Error(`WorkerPlugin: no entry for ${request}`);
93
- }
94
-
95
- if (error) {
96
- return cb(error);
97
- }
98
-
99
- function workerCode() {
100
- let blob;
101
-
102
- try {
103
- blob = new Blob([`importScripts('${this.workerUrl}');`], {
104
- 'type': 'application/javascript'
105
- });
106
- } catch (e1) {
107
- throw new Error(e1);
108
- }
109
-
110
- let url = window.URL || window.webkitURL;
111
- let blobUrl = url.createObjectURL(blob);
112
- let worker = new Worker(blobUrl);
113
- return worker;
114
- }
115
-
116
- return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
117
- workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
118
- getInstance: ${workerCode} \n
119
- }`);
120
- });
121
- }
@@ -1,42 +0,0 @@
1
- import TerserPlugin from 'terser-webpack-plugin';
2
- import { nameTemplates } from "./common/nameTemplates";
3
- import { hasContentHash } from "./custom_plugins/I18nSplitPlugin/utils/hashUtils";
4
- import { configCSSMinifierPlugin } from "./pluginConfigs/configCSSMinifierPlugin";
5
- import { splitChunksConfig } from "./splitChunksConfig";
6
- export function optimizationConfig(options) {
7
- const {
8
- changeRuntimeChunkChar
9
- } = options;
10
- const {
11
- chunkSplitEnable
12
- } = options.i18nChunkSplit;
13
- const i18nChunkFilename = nameTemplates('i18njs', options);
14
- const chunkFilenameHasContentHash = hasContentHash(i18nChunkFilename);
15
- /**
16
- * NOTE: we only need multiple runtime files when we use contentHash
17
- * other wise we don't need multiple runtime files based locale
18
- * that's why we added chunkSplitEnable && chunkFilenameHasContentHash logic
19
- */
20
-
21
- const suffix = // chunkSplitEnable ? '_[locale]' : '';
22
- chunkSplitEnable && chunkFilenameHasContentHash ? '_[locale]' : '';
23
- const char = changeRuntimeChunkChar;
24
- const excludeList = options.optimization.jsExcludePath;
25
- return {
26
- splitChunks: splitChunksConfig(options),
27
- minimizer: [// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
28
- // '...',
29
- excludeList !== '' ? new TerserPlugin({
30
- exclude: excludeList,
31
- extractComments: false // Do not extract comments to .LICENSE.txt files
32
-
33
- }) : new TerserPlugin({
34
- extractComments: false // Do not extract comments to .LICENSE.txt files
35
-
36
- }), configCSSMinifierPlugin(options)].filter(Boolean),
37
- moduleIds: 'named',
38
- runtimeChunk: {
39
- name: entrypoint => `runtime${char}${entrypoint.name}${suffix}`
40
- }
41
- };
42
- }
@@ -1,35 +0,0 @@
1
- import path from 'path';
2
- import { appPath } from "../../constants";
3
- import { nameTemplates } from "./common/nameTemplates";
4
- import { getGlobalCacheStorageName } from "./common/modeUtils";
5
- export function outputConfig(options) {
6
- const {
7
- output,
8
- publicPath,
9
- htmlTemplate
10
- } = options;
11
- const outputO = {
12
- filename: nameTemplates('js', options),
13
- chunkFilename: nameTemplates('chunkjs', options),
14
- chunkLoadingGlobal: getGlobalCacheStorageName(options),
15
- publicPath,
16
- // clean: true,
17
- path: path.resolve(appPath, output),
18
- devtoolModuleFilenameTemplate: info => {
19
- let resourcePath = info.resourcePath;
20
- const namespace = info.namespace;
21
-
22
- if (resourcePath.startsWith('./')) {
23
- resourcePath = resourcePath.substring(2);
24
- }
25
-
26
- return `webpack://${namespace}/${resourcePath}`;
27
- }
28
- };
29
-
30
- if (htmlTemplate.crossorigin) {
31
- outputO.crossOriginLoading = 'anonymous';
32
- }
33
-
34
- return outputO;
35
- }
@@ -1,30 +0,0 @@
1
- /* eslint-disable no-use-before-define */
2
- import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
3
- import { getWebpackMode, isProductionMode } from "../common/modeUtils";
4
- export function configBundleAnalyzer(options) {
5
- const mode = getWebpackMode(options);
6
-
7
- if (isProductionMode(mode) && options.bundleAnalyze) {
8
- const bundleAnalyzerOptions = getBundleAnalyzerOptions(options);
9
- return new BundleAnalyzerPlugin(bundleAnalyzerOptions);
10
- }
11
-
12
- return null;
13
- } // eslint-disable-next-line no-unused-vars
14
-
15
- function getBundleAnalyzerOptions(options) {
16
- return {
17
- analyzerMode: 'static',
18
- // generateStatsFile: false,
19
- openAnalyzer: false // statsOptions: {
20
- // source: false,
21
- // normal: true,
22
- // chunks: false,
23
- // chunkGroups: false,
24
- // module: false,
25
- // assets: true,
26
- // assetsSort: 'name'
27
- // }
28
-
29
- };
30
- }
@@ -1,27 +0,0 @@
1
- import { getWebpackMode, isProductionMode } from "../common/modeUtils";
2
- import { BundleIntegrityReport } from "../custom_plugins/BundleIntegrityReport";
3
- export function configBundleIntegrityReport(options) {
4
- const webpackMode = getWebpackMode(options);
5
- const isProduction = isProductionMode(webpackMode);
6
- const {
7
- enable: statsEnable
8
- } = options.stats;
9
-
10
- if (isProduction && statsEnable) {
11
- return new BundleIntegrityReport({
12
- fileName: options.stats.fileName || 'bundle-report-integrity.json',
13
- excludeKeysInReport: options.stats.excludeKeys || [],
14
- options: {
15
- preset: 'verbose',
16
- ...options.stats.options,
17
- assets: true,
18
- chunks: true,
19
- modules: true,
20
- builtAt: true,
21
- hash: true
22
- }
23
- });
24
- }
25
-
26
- return null;
27
- }
@@ -1,17 +0,0 @@
1
- // import UglifyCSSPlugin from '../custom_plugins/UglifyCSSPlugin';
2
- import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
3
- import { isNotProduction } from "../common/modeUtils"; // eslint-disable-next-line no-unused-vars
4
-
5
- export function configCSSMinifierPlugin(options) {
6
- const excludeList = options.optimization.cssExcludePath;
7
-
8
- if (isNotProduction(options)) {
9
- return null;
10
- } // return null;
11
- // return new UglifyCSSPlugin();
12
-
13
-
14
- return excludeList !== '' ? new CssMinimizerPlugin({
15
- exclude: excludeList
16
- }) : new CssMinimizerPlugin();
17
- }