@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,63 +0,0 @@
1
- import postcss from 'postcss';
2
- import fs from 'fs';
3
- import { selectorWeightPrefixAdder } from "./selectorWeightPrefixAdder";
4
- import { checkIsPatternsMatchFilename } from "../../loaderConfigs/checkIsPatternsMatchFilename";
5
-
6
- class SelectorWeightPlugin {
7
- constructor() {
8
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- this.options = {
10
- selectorWeightConfig: options.configFile,
11
- defaultSelector: options.defaultSelector,
12
- customFileDetails: options.customFileDetails,
13
- excludeStrings: options.excludeStrings,
14
- patterns: options.patterns
15
- };
16
- }
17
-
18
- apply(compiler) {
19
- const {
20
- defaultSelector,
21
- customFileDetails,
22
- excludeStrings,
23
- patterns
24
- } = this.options;
25
- const rawdata = fs.readFileSync(customFileDetails);
26
- const data = JSON.parse(rawdata);
27
- compiler.hooks.compilation.tap('selector-weight-rewrite', compilation => {
28
- compilation.hooks.optimizeModules.tap('selector-weight-rewrite', modules => {
29
- const mods = Array.from(modules).filter(x => x.type.includes('css'));
30
- mods.forEach(module => {
31
- const filename = module.issuer.resource;
32
-
33
- if (!checkIsPatternsMatchFilename(patterns, filename)) {
34
- return;
35
- }
36
- /*
37
-
38
- filename : Deskapp.module.css ?
39
- data :
40
- {
41
- "DeskApp.module.css": {"defaultSelector" : ".desk_app_ui "}
42
- }
43
- selectorWeightConfig :
44
- defaultSelector : .zoho_desk_ui
45
-
46
- case filename = 'DeskApp.module.css' ?
47
- data[filename].defaultSelector = '.desk_app_ui'
48
- case filename is different ?
49
- defaultSelector = '.zoho_desk_ui'
50
- */
51
-
52
-
53
- const rootOriginal = postcss.parse(module.content); // eslint-disable-next-line no-param-reassign
54
-
55
- module.content = selectorWeightPrefixAdder(rootOriginal, data[filename] ? data[filename].defaultSelector : defaultSelector, excludeStrings).toString();
56
- });
57
- });
58
- });
59
- }
60
-
61
- }
62
-
63
- export default SelectorWeightPlugin;
@@ -1,43 +0,0 @@
1
- import { hasPrevNodeIgnore, isInsideMediaQuery } from "./classHandling";
2
- export function selectorWeightPrefixAdder(rootOriginal, selector, excludeStrings) {
3
- rootOriginal.walkRules((rule, index) => {
4
- const prevNode = rootOriginal.nodes[index - 1];
5
-
6
- if (hasPrevNodeIgnore(index, prevNode, 'updateselector:ignore')) {
7
- return;
8
- } // TODO: need to verify cases
9
- // if (!isInsideMediaQuery(rule)) {
10
- // return;
11
- // }
12
-
13
-
14
- const selectorArr = rule.selector.split(',');
15
- selectorArr.forEach((singleSelectorStr, index) => {
16
- if (excludeStrings.includes(singleSelectorStr.trim())) {
17
- return;
18
- }
19
-
20
- if (singleSelectorStr.includes(']')) {
21
- if (singleSelectorStr.slice(singleSelectorStr.lastIndexOf(']') + 2).trim() === '') {
22
- return;
23
- }
24
-
25
- selectorArr[index] = `${singleSelectorStr.slice(0, singleSelectorStr.lastIndexOf(']') + 1).trim()} ${selector}${singleSelectorStr.slice(singleSelectorStr.lastIndexOf(']') + 2).trim()}`;
26
- return;
27
- }
28
-
29
- selectorArr[index] = `${selector}${singleSelectorStr}`;
30
- }); // eslint-disable-next-line no-param-reassign
31
-
32
- rule.selector = selectorArr.join(',\n');
33
- });
34
- return rootOriginal;
35
- } // function convertSelectorWithoutAttribute (selector, conjunction) {
36
- // const front = selector
37
- // .slice(0, selector.lastIndexOf(']') + 1)
38
- // .trim();
39
- // const back = selector
40
- // .slice(selector.lastIndexOf(']') + 2)
41
- // .trim();
42
- // return `${front} ${conjunction}${back}`;
43
- // }
@@ -1,7 +0,0 @@
1
- const isWin = process.platform === 'win32';
2
- export function windowsModification(array) {
3
- return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
4
- }
5
- export function windowsModificationFile(filename) {
6
- return isWin ? filename.replace(/\//g, '\\') : filename;
7
- } // module.exports = { windowsModification, windowsModificationFile };
@@ -1,104 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { getLocaleChunkAssetsStore } from "./I18nSplitPlugin/LocaleChunkAssetsStore";
3
- import { emitAsset } from "./emitAsset";
4
- import { replaceCssDirTemplateMapper } from "./RtlSplitPlugin/replaceCssDirTemplate";
5
- import { cssDirTemplate, getInitialAssetsFuncTemplate } from "./getInitialAssetsFuncTemplate";
6
- import { getI18nFileUrlPathTemplate } from "./ServiceWorkerPluginUtils";
7
- const pluginName = 'ServiceWorkerPlugin';
8
- export default class ServiceWorkerPlugin {
9
- constructor(options) {
10
- this.templateFilePath = options.templateFilePath;
11
- this.outputFilePath = options.outputFilePath;
12
- this.publicPath = options.publicPath;
13
- this.i18nFileNameTemplate = options.i18nFileNameTemplate;
14
- this.chunkSplitEnable = options.chunkSplitEnable;
15
- this.enableRTLSplit = options.enableRTLSplit;
16
- this.entryPointName = options.entryPointName;
17
- this.replaceText = options.replaceText; // this.publicPaths = options.publicPaths;
18
- } // eslint-disable-next-line class-methods-use-this
19
-
20
-
21
- isInitialChunk(chunk) {
22
- if ('canBeInitial' in chunk) {
23
- return chunk.canBeInitial();
24
- }
25
-
26
- return chunk.isInitial();
27
- }
28
-
29
- apply(compiler) {
30
- compiler.hooks.thisCompilation.tap(pluginName, compilation => {
31
- // Get store for cache
32
- this.store = getLocaleChunkAssetsStore(compilation);
33
- });
34
- compiler.hooks.thisCompilation.tap(pluginName, compilation => {
35
- compilation.hooks.processAssets.tap({
36
- name: pluginName,
37
- stage: compilation.PROCESS_ASSETS_STAGE_DERIVED
38
- }, () => {
39
- this.createServiceWorkerFile(compilation, compiler);
40
- });
41
- });
42
- }
43
-
44
- createServiceWorkerFile(compilation) {
45
- const {
46
- templateFilePath,
47
- entryPointName,
48
- outputFilePath,
49
- chunkSplitEnable,
50
- enableRTLSplit
51
- } = this;
52
- const templateContent = readFileSync(templateFilePath, 'utf-8');
53
- let allChunkUrls = [];
54
- const allI18nAssets = [];
55
- const entryPoint = compilation.entrypoints.get(entryPointName);
56
- const initialAssetsFuncTemplate = getInitialAssetsFuncTemplate({
57
- entryPoint,
58
- compilation,
59
- enableRTLSplit,
60
- i18nStore: this.store,
61
- chunkSplitEnable,
62
- i18nFileNameTemplate: this.i18nFileNameTemplate,
63
- functionName: 'getInitialAssets'
64
- });
65
- /**
66
- * NOTE:
67
- * if chunkSplitEnable is false means,
68
- * serviceWorker will get i18n files path for html
69
- */
70
- // chunkSplitEnable &&
71
-
72
- [...compilation.chunks].filter(c => !this.isInitialChunk(c)).forEach(chunk => {
73
- allChunkUrls = [...allChunkUrls, ...chunk.files]; // allI18nAssets.push(
74
- // getI18nFileUrlPathTemplate(
75
- // compilation,
76
- // chunk,
77
- // this.i18nFileNameTemplate,
78
- // '@locale@'
79
- // )
80
- // );
81
- });
82
- allChunkUrls = allChunkUrls.filter(fileName => !fileName.endsWith('.map'));
83
- allChunkUrls = allChunkUrls.map(fileName => fileName.replace('smap/', ''));
84
-
85
- if (enableRTLSplit) {
86
- allChunkUrls = replaceCssDirTemplateMapper(allChunkUrls, cssDirTemplate);
87
- }
88
-
89
- const mod = templateContent.replace(this.replaceText, `
90
- ${initialAssetsFuncTemplate}
91
-
92
- let initialAssetsObj = getInitialAssets();
93
-
94
- let initialAssets = initialAssetsObj.i18n.concat(
95
- initialAssetsObj.css,
96
- initialAssetsObj.js
97
- );
98
- self.assets = initialAssets;
99
-
100
- self.allChunks = ${JSON.stringify(allChunkUrls.concat(allI18nAssets))};`);
101
- emitAsset(compilation, outputFilePath, mod);
102
- }
103
-
104
- }
@@ -1,6 +0,0 @@
1
- export function getI18nFileUrlPathTemplate(compilation, chunk, filenameTemplate, localeTemplate) {
2
- const urlpath = compilation.getPath(filenameTemplate, {
3
- chunk
4
- });
5
- return urlpath.replace('[locale]', localeTemplate);
6
- }
@@ -1,74 +0,0 @@
1
- /* eslint-disable class-methods-use-this */
2
- import { Compilation } from 'webpack';
3
-
4
- function checkSmapFilePattern(assetName) {
5
- return /\.js$/.test(assetName) && !/\.i18n\.js$/.test(assetName) || /\.js\.map$/.test(assetName) && !/\.i18n\.js\.map$/.test(assetName);
6
- }
7
-
8
- function skipRuntimeFiles(assetName) {
9
- return !assetName.includes('[locale]');
10
- }
11
-
12
- const pluginName = 'SplitSourceMapPlugin'; // Purpose:
13
-
14
- /**
15
- * we want build that can load files source map and without sourcemap at the same time,
16
- * or can be mentioned as so single build need to support two different clients that one for fast load and one for debugging.
17
- */
18
-
19
- export class SourceMapPlugin {
20
- apply(compiler) {
21
- const {
22
- RawSource
23
- } = compiler.webpack.sources;
24
- compiler.hooks.thisCompilation.tap(pluginName, compilation => {
25
- compilation.hooks.processAssets.tap({
26
- name: pluginName,
27
- stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
28
- }, assets => {
29
- Object.keys(assets).forEach(assetName => {
30
- const assetCode = assets[assetName].source();
31
-
32
- if (checkSmapFilePattern(assetName) && skipRuntimeFiles(assetName)) {
33
- compilation.renameAsset(assetName, `smap/${assetName}`);
34
-
35
- if (!/\.map$/.test(assetName)) {
36
- compilation.emitAsset(assetName, new RawSource(assetCode));
37
- }
38
- }
39
- });
40
- });
41
- compilation.hooks.processAssets.tap({
42
- name: pluginName,
43
- stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
44
- }, assets => {
45
- Object.keys(assets).forEach(assetName => {
46
- const assetCode = assets[assetName].source();
47
-
48
- if (/\.map$/.test(assetName)) {
49
- compilation.emitAsset(assetName.split('smap/')[1], new RawSource(assetCode));
50
- }
51
- });
52
- }); // if contenthash enabled we need to add this to include the runtime files
53
- // compilation.hooks.processAssets.tap(
54
- // {
55
- // name: pluginName,
56
- // stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED
57
- // // additionalAssets: true
58
- // },
59
- // assets => {
60
- // Object.keys(assets).forEach(assetName => {
61
- // if (assetName.includes('runtime') && skipRuntimeFiles(assetName) ) {
62
- // const runtimeAssetCode = assets[assetName].source();
63
- // const newAssetName = `smap/${assetName}`;
64
- // compilation.emitAsset(
65
- // newAssetName,
66
- // new RawSource(runtimeAssetCode)
67
- // );
68
- // };
69
- // });
70
- // });
71
- });
72
- }
73
-
74
- }
@@ -1,10 +0,0 @@
1
- import path from 'path';
2
- export function addHashToFilePath(filePath, hash) {
3
- const pathObj = path.parse(filePath);
4
- const updatedFilePath = path.format({
5
- dir: pathObj.dir,
6
- name: `${pathObj.name}.${hash}`,
7
- ext: pathObj.ext
8
- });
9
- return updatedFilePath;
10
- }
@@ -1,36 +0,0 @@
1
- import { DefinePlugin } from 'webpack';
2
- import fs from 'fs';
3
- import path from 'path';
4
- import { addHashToFilePath } from "./addHashToFilePath";
5
- import { getHash } from "../../loaderConfigs/cssClassNameGenerate";
6
- export class TPHashMappingPlugin {
7
- constructor(options) {
8
- this.fileMappings = options.fileMappings;
9
- this.tpFolder = options.tpFolder;
10
- }
11
-
12
- apply(compiler) {
13
- new DefinePlugin(this.getFiles()).apply(compiler);
14
- }
15
-
16
- getFiles() {
17
- const hashMapping = {};
18
- this.fileMappings.forEach(fileInfo => {
19
- const filePath = path.join(this.tpFolder, fileInfo.filePath);
20
-
21
- if (fs.existsSync(filePath)) {
22
- const fileContent = fs.readFileSync(filePath, {
23
- encoding: 'utf-8'
24
- });
25
- const generatedHash = getHash(fileContent, fileInfo.hashLength || 10);
26
- const outputFilePath = addHashToFilePath(filePath, generatedHash);
27
- fs.writeFileSync(outputFilePath, fileContent);
28
- hashMapping[fileInfo.key] = JSON.stringify(generatedHash);
29
- } else {
30
- throw new Error(`Third party file ${fileInfo.fileName} does not exist`);
31
- }
32
- });
33
- return hashMapping;
34
- }
35
-
36
- }
@@ -1,35 +0,0 @@
1
- /* eslint-disable class-methods-use-this */
2
- // import { RawSource } from 'webpack-sources';
3
- import uglifyCss from 'uglifycss';
4
- import { Compilation } from 'webpack';
5
- const pluginName = 'UglifyCSSPlugin'; // TODO: Check for css minimizer plugin
6
-
7
- export default class UglifyCSSPlugin {
8
- apply(compiler) {
9
- const {
10
- RawSource
11
- } = compiler.webpack.sources;
12
- compiler.hooks.compilation.tap(pluginName, compilation => {
13
- compilation.hooks.processAssets.tapAsync({
14
- name: pluginName,
15
- stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
16
- }, assets => {
17
- Object.keys(assets).filter(filename => /\.css$/.test(filename)).forEach(filename => {
18
- try {
19
- let asset = assets[filename].source();
20
-
21
- if (typeof asset !== 'string') {
22
- asset = asset.toString();
23
- }
24
-
25
- const result = uglifyCss.processString(asset);
26
- compilation.updateAsset(filename, new RawSource(result));
27
- } catch (e) {
28
- compilation.errors.push(e);
29
- }
30
- });
31
- });
32
- });
33
- }
34
-
35
- }
@@ -1,52 +0,0 @@
1
- export class ErrorHandler {
2
- constructor(allowedErrs) {
3
- this.errors = [];
4
- this.errorTable = [];
5
- this.allowedErrs = allowedErrs;
6
- Object.assign(this, {
7
- DECLARATION_IGNORED: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : Declaration Ignored`),
8
- DECIMAL_CHECK: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
9
- DECIMAL_REJECT: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
10
- UNIT_ERROR: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
11
- RANGE_ERROR: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}\r`),
12
- VARIABLE_PRESENT: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}`),
13
- MULTIPLE_OCCURANCES: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}`)
14
- });
15
- }
16
-
17
- setAllowedErrs(allErrs) {
18
- this.allowedErrs = allErrs;
19
- ['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT', 'MULTIPLE_OCCURANCES'].forEach(err => {
20
- if (!this.allowedErrs[err]) {
21
- this[err] = () => null;
22
- }
23
- });
24
- }
25
-
26
- addError(errstr) {
27
- this.errors.push(`{\n${errstr}\n}\n`);
28
- }
29
-
30
- errorFunction(errObj) {
31
- if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
32
- this[errObj.type](errObj);
33
- }
34
- } // eslint-disable-next-line class-methods-use-this
35
-
36
-
37
- printError(errObj) {
38
- console.log('{');
39
- Object.keys(errObj).sort().forEach(key => {
40
- if (key !== 'decl') {
41
- console.log(`${key} : ${errObj[key]}`);
42
- } else {
43
- console.log(`prop : ${errObj.decl.prop}`);
44
- console.log(`value : ${errObj.decl.value}`);
45
- console.log(`linenum : ${errObj.decl.source.start.line}`);
46
- }
47
- });
48
- console.log('}\n');
49
- }
50
-
51
- }
52
- export const errHandler = new ErrorHandler();