@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,318 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { errHandler } from "../../../bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler";
4
- const convertableProps = {
5
- 'font-size': true,
6
- margin: true,
7
- 'margin-left': true,
8
- 'margin-right': true,
9
- 'margin-top': true,
10
- 'margin-bottom': true,
11
- padding: true,
12
- 'padding-top': true,
13
- 'padding-bottom': true,
14
- 'padding-left': true,
15
- 'padding-right': true,
16
- width: true,
17
- 'min-width': true,
18
- 'max-width': true,
19
- height: true,
20
- 'min-height': true,
21
- 'max-height': true,
22
- top: true,
23
- bottom: true,
24
- left: true,
25
- right: true,
26
- 'text-indent': true,
27
- clip: true,
28
- 'flex-basis': true,
29
- 'row-gap': true,
30
- gap: true,
31
- 'column-gap': true,
32
- flex: true
33
- };
34
- const constantValues = {
35
- inherit: true,
36
- initial: true,
37
- auto: true,
38
- 'fit-content': true,
39
- unset: true,
40
- cover: true,
41
- contain: true,
42
- top: true,
43
- bottom: true,
44
- left: true,
45
- center: true,
46
- right: true
47
- };
48
-
49
- function getNumericValue(value) {
50
- if (value.includes('var')) {
51
- return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
52
- }
53
-
54
- if (value.includes('rect')) {
55
- return parseInt(value.replace('rect(', '').replace(')', '').replace(',', ''));
56
- } // Not need for this dum loop
57
- // allowed.forEach(alwdUnit => {
58
- // if (value.includes(alwdUnit)) {
59
- // return parseInt(value);
60
- // }
61
- // });
62
-
63
-
64
- if (constantValues[value.toLowerCase()]) {
65
- return 1;
66
- }
67
-
68
- return parseInt(value);
69
- }
70
-
71
- function pxToCalc(value) {
72
- const arr = value.split(' ');
73
- arr.forEach((val, index) => {
74
- ['px'].forEach(unit => {
75
- const valWithUnit = new RegExp(`(\\d+)${unit}`, 'gi');
76
-
77
- if (valWithUnit.test(val)) {
78
- arr[index] = val.replace(valWithUnit, '(var(--zd_size$1))');
79
- }
80
- });
81
- });
82
- return arr.join(' ');
83
- }
84
-
85
- const singleConvertor = (value, changeVal, details, range) => {
86
- const {
87
- path,
88
- filename,
89
- decl
90
- } = details;
91
-
92
- if (decl.prop === 'background-position') {
93
- if (isNaN(parseInt(value))) {
94
- // console.log(`${value} skipped`);
95
- return;
96
- }
97
- }
98
-
99
- if (value == '0px') {
100
- value = value.replace('px', '');
101
- }
102
-
103
- if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
104
- let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
105
-
106
- if (/^-var/.test(retVal)) {
107
- retVal = `calc( ${retVal.substring(1)} * -1 )`;
108
- }
109
-
110
- return retVal;
111
- } // if (!value.includes('rect')) {
112
- // if(unitErrorVal && unitErrorVal != '0' ){
113
- // console.log(value, 'not within range')
114
-
115
-
116
- const errObj = {
117
- decl,
118
- type: 'RANGE_ERROR',
119
- filename,
120
- message: `value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`,
121
- path
122
- };
123
- errHandler.errorTable.push(errObj);
124
- errHandler.errorFunction(errObj); // errorFunction(
125
- // {
126
- // decl,
127
- // type: 'RANGE_ERROR',
128
- // filename,
129
- // message: `value (${value}) (${typeof value}) not within range (${
130
- // range.start
131
- // },${range.end})\r`,
132
- // path: path
133
- // },
134
- // 'RANGE_ERROR'
135
- // );
136
- // }
137
- // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n message : value (${value}) not within range (${range.start},${range.end})\r`)
138
- // return value;
139
- // } else {
140
- // console.log('++++++++++++++++++++++rect val!', value);
141
- // }
142
- };
143
-
144
- export default (_ref => {
145
- let {
146
- configFile
147
- } = _ref;
148
- const rawdata = fs.readFileSync(configFile);
149
- const data = JSON.parse(rawdata);
150
- const {
151
- errorsAllowed,
152
- settings: settingsObject // errorLog: errorLogStatus,
153
- // errorInConsole: errorConsoleStatus
154
-
155
- } = data; // const keys = Object.keys(settingsObject);
156
-
157
- errHandler.setAllowedErrs(errorsAllowed);
158
- const replacementArray = [];
159
- Object.keys(settingsObject).forEach(key => {
160
- Object.values(settingsObject[key].replacements).forEach(val => {
161
- if (!replacementArray.includes(val)) {
162
- replacementArray.push(val);
163
- }
164
- });
165
- });
166
- let regValStr = '';
167
- replacementArray.forEach((val, index) => {
168
- if (index !== replacementArray.length - 1) {
169
- regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
170
- } else {
171
- regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
172
- }
173
- });
174
- const valRegex = new RegExp(regValStr, 'gi');
175
- return {
176
- postcssPlugin: 'postcss-variable-report',
177
- Once: rootOriginal => {
178
- rootOriginal.walkRules(rule => {
179
- // rule.nodes[-1] = {}
180
- // need map, forEach fine less memory
181
- rule.nodes.forEach((decl, position) => {
182
- // case font-size
183
- const commentStr = 'variable:ignore';
184
- const prevNode = rule.nodes[position - 1];
185
- const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
186
- // split not need use slice and lastIndexOf less memory
187
-
188
- const filename = fromPath.split(path.sep).pop(); // if(filename.includes('AddFormResponsive.module.css'){
189
- // }
190
-
191
- if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
192
- const errObj = {
193
- decl,
194
- type: 'DECLARATION_IGNORED',
195
- filename,
196
- message: 'Declaration Ignored',
197
- path: fromPath
198
- };
199
- errHandler.errorTable.push(errObj);
200
- errHandler.DECLARATION_IGNORED(errObj);
201
- return;
202
- }
203
-
204
- if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
205
- const settings = settingsObject[decl.prop]; // console.log(settings)
206
-
207
- const {
208
- allowed,
209
- range
210
- } = settings; // suggestion filter !decl.value.includes('calc')
211
- // Reason below some of logic happen based on this
212
-
213
- const unit = decl.value.toString() // no need round braket since you do not need group for less memory
214
- .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
215
- // console.log('unit : ');
216
- // console.log(unit);
217
-
218
- unit.forEach((val, index) => {
219
- allowed.forEach(alwdVal => {
220
- if (val.includes(alwdVal)) {
221
- // ## for what purpose
222
- unit[index] = val // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
223
- .replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`).replace(`${alwdVal},`, `${alwdVal}`);
224
- }
225
- });
226
- });
227
- let unitError = false;
228
- let unitErrorVal = '';
229
- unit.forEach(val => {
230
- if (!val.includes('calc') && decl.prop !== 'clip') {
231
- if (!allowed.includes(val.toString())) {
232
- unitError = true;
233
- unitErrorVal = val;
234
- }
235
- }
236
- }); // console.log(allowed, replacements, range)
237
-
238
- if (!unitError) {
239
- // use variable decl.value.split(' ')
240
- if (range) {
241
- // console.log('multiple :', decl.value)
242
- let newVal = '';
243
- decl.value.split(' ').filter(Boolean).forEach(singleVal => {
244
- newVal += `${singleConvertor(singleVal, settings.replacements.px, {
245
- decl,
246
- filename,
247
- path: fromPath
248
- }, range)} `;
249
- });
250
- decl.value = newVal;
251
- }
252
- } else if (!decl.value.includes('calc')) {
253
- // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`);
254
- const errObj = {
255
- decl,
256
- filename,
257
- unitErrorVal,
258
- path: fromPath
259
- };
260
-
261
- if (unitErrorVal.trim() === '.') {
262
- errObj.type = 'DECIMAL_CHECK';
263
- errObj.message = `${unitErrorVal} (Decimal Value) Please check`;
264
- errHandler.errorTable.push(errObj);
265
- errHandler.DECIMAL_CHECK(errObj);
266
- } else if (unitErrorVal.includes('.') && !unitErrorVal.includes('%')) {
267
- errObj.type = 'DECIMAL_REJECT';
268
- errObj.message = `${unitErrorVal} (Decimal Value) Not Allowed \r`;
269
- errHandler.errorTable.push(errObj);
270
- errHandler.DECIMAL_REJECT(errObj);
271
- } else if (!unitErrorVal.includes('%')) {
272
- errObj.type = 'UNIT_ERROR';
273
- errObj.message = `${unitErrorVal} (Unit) Not Allowed`;
274
- errHandler.errorTable.push(errObj);
275
- errHandler.UNIT_ERROR(errObj);
276
- }
277
- } else {
278
- decl.value = pxToCalc(decl.value);
279
- }
280
- } else {
281
- if (settingsObject[decl.prop] && decl.value && decl.value.includes('px') && decl.value.includes('var(--')) {
282
- const valArr = decl.value.split(' ');
283
- const settings = settingsObject[decl.prop];
284
- const {
285
- range
286
- } = settings;
287
- const convertedVals = valArr.map(val => {
288
- if (val.includes('px')) {
289
- const convertedVal = singleConvertor(val, settings.replacements.px, {
290
- decl,
291
- filename,
292
- path: fromPath
293
- }, range);
294
- return convertedVal || val;
295
- }
296
-
297
- return val;
298
- });
299
- decl.value = convertedVals.join(' ');
300
- }
301
-
302
- if (decl.prop && decl.value && !decl.prop.includes('--') && valRegex.test(decl.value) && (settingsObject[decl.prop] || convertableProps[decl.prop]) && decl.value.includes('var') && !decl.value.includes('calc')) {
303
- const errObj = {
304
- decl,
305
- type: 'VARIABLE_PRESENT',
306
- filename,
307
- message: `value (${decl.value}) has var in it, kindly check`,
308
- path: fromPath
309
- };
310
- errHandler.errorTable.push(errObj);
311
- errHandler.VARIABLE_PRESENT(errObj);
312
- }
313
- }
314
- });
315
- });
316
- }
317
- };
318
- });
@@ -1,41 +0,0 @@
1
- /* eslint-disable no-use-before-define */
2
- import { checkIsPatternsMatchFilename } from "../bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename";
3
- import { getSpecificPostCssPlugin, supportedPluginsOptionNames } from "./getSpecificPostCssPlugin";
4
- export function mapDefaultSupportedPlugins(pluginsOptions) {
5
- return supportedPluginsOptionNames.map(pluginName => ({ ...pluginsOptions[pluginName],
6
- pluginName
7
- }));
8
- }
9
- export function getEnabledPlugins(pluginsOptions) {
10
- function isEnabled(pluginName) {
11
- return pluginsOptions[pluginName].enable;
12
- }
13
-
14
- return supportedPluginsOptionNames.filter(isEnabled).map(pluginName => ({ ...pluginsOptions[pluginName],
15
- pluginName
16
- }));
17
- }
18
- export function filterPluginsAllowedForSpecificFile(plugins, filename) {
19
- return plugins.filter(pluginOption => checkIsPluginAllowed(pluginOption, filename)).map(pluginOption => getSpecificPostCssPlugin(pluginOption)).filter(Boolean);
20
- }
21
-
22
- function checkIsPluginAllowed(pluginOption, filename) {
23
- return checkIsPatternsMatchFilename(pluginOption.patterns, filename);
24
- }
25
-
26
- function getCustomPlugins(pluginOption) {
27
- if (typeof pluginOption.plugin === 'string') {
28
- // eslint-disable-next-line import/no-dynamic-require, global-require
29
- return require(pluginOption.plugin).plugin(pluginOption);
30
- }
31
-
32
- if (typeof pluginOption.plugin === 'function') {
33
- return pluginOption.plugin(pluginOption);
34
- }
35
-
36
- return null;
37
- }
38
-
39
- export function filterCustomPluginsAllowedForSpecificFile(customPlugins, filename) {
40
- return customPlugins.filter(pluginOption => checkIsPluginAllowed(pluginOption, filename)).map(getCustomPlugins).filter(Boolean);
41
- }
@@ -1,20 +0,0 @@
1
- import { filterCustomPluginsAllowedForSpecificFile, filterPluginsAllowedForSpecificFile, getEnabledPlugins } from "./filterPluginsAllowedForSpecficFile";
2
- export function getAllowedPostCssPlugins(filename, enabledPlugins, enabledCustomPlugins) {
3
- const neededPostCssPlugins = filterPluginsAllowedForSpecificFile(enabledPlugins, filename);
4
- const neededCustomPlugins = filterCustomPluginsAllowedForSpecificFile(enabledCustomPlugins, filename);
5
- return {
6
- plugins: [...neededPostCssPlugins, ...neededCustomPlugins]
7
- };
8
- }
9
- export function postcssPluginGetter(options) {
10
- const pluginsOptions = options.css.plugins;
11
- const {
12
- customPlugins = []
13
- } = options.css;
14
- const enabledPlugins = getEnabledPlugins(pluginsOptions);
15
- const enabledCustomPlugins = customPlugins.filter(conf => conf.enable);
16
- return filename => {
17
- const allowedPostCssPlugins = getAllowedPostCssPlugins(filename, enabledPlugins, enabledCustomPlugins);
18
- return allowedPostCssPlugins;
19
- };
20
- }
@@ -1,38 +0,0 @@
1
- /* eslint-disable no-use-before-define */
2
- import { existsSync } from 'fs';
3
- import PostCssRTL from 'postcss-rtl';
4
- import SelectorReplace from "./custom_postcss_plugins/SelectorReplace";
5
- import ValueReplacer from "./custom_postcss_plugins/ValueReplacer";
6
- import HoverActivePlugin from "./custom_postcss_plugins/HoverActivePlugin";
7
- import VariableModificationPlugin from "./custom_postcss_plugins/VariableModificationPlugin";
8
- export function getSpecificPostCssPlugin(pluginOption) {
9
- return postcssPluginMapper[pluginOption.pluginName]?.(pluginOption);
10
- } // eslint-disable-next-line no-unused-vars
11
-
12
- export function configPostCssRtl(pluginOption) {
13
- return PostCssRTL({
14
- addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
15
- if (prefix === '[dir]') {
16
- return selector;
17
- }
18
-
19
- return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
20
- }
21
- });
22
- } // NOTE: we have keeping array because we need to maintain order (Just In Cases For Future)
23
-
24
- export const supportedPluginsOptionNames = ['rtl', 'valueReplacer', 'selectorReplace', 'hoverActive', 'cssVariableReplacement'];
25
- const postcssPluginMapper = {
26
- rtl: configPostCssRtl,
27
- selectorReplace: pluginOption => SelectorReplace(pluginOption),
28
- valueReplacer: pluginOption => ValueReplacer(pluginOption.config),
29
- hoverActive: pluginOption => HoverActivePlugin(pluginOption),
30
- cssVariableReplacement: configCssVariableReplacement
31
- };
32
-
33
- function configCssVariableReplacement(pluginOption) {
34
- const {
35
- configFile
36
- } = pluginOption;
37
- return configFile && existsSync(configFile) && VariableModificationPlugin(pluginOption);
38
- }
@@ -1,25 +0,0 @@
1
- import postcss from 'postcss';
2
- import { readFileSync } from 'fs';
3
- import { postcssPluginGetter } from "./getAllowedPostCssPlugins";
4
- import { writeFile } from "../fileUtils/copyFile";
5
- export function runPostCssForCssFile(_ref) {
6
- let {
7
- filename,
8
- outputFile,
9
- options
10
- } = _ref;
11
- const getAllowedPostCssPlugins = postcssPluginGetter(options);
12
- const allowedPostCssPlugins = getAllowedPostCssPlugins(filename);
13
-
14
- if (allowedPostCssPlugins.length === 0) {
15
- return;
16
- }
17
-
18
- const css = readFileSync(filename).toString();
19
- postcss(allowedPostCssPlugins).process(css, {
20
- from: filename,
21
- to: outputFile
22
- }).then(result => {
23
- writeFile(outputFile, result.css);
24
- });
25
- }
@@ -1,47 +0,0 @@
1
- import { dirname } from 'path';
2
- import { existsSync } from 'fs';
3
- import { spawnIO, spawnSyncIO } from "../commands-utils/spawnSyncIO";
4
- import { errorLogger, messageLogger } from "../../logger";
5
- import { joinWithAppPath } from "../constants";
6
- export function runPreProcess(options) {
7
- let runnerCli = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'node';
8
- const {
9
- preProcess
10
- } = options;
11
- const {
12
- enable,
13
- runner,
14
- stopNodemon
15
- } = preProcess;
16
-
17
- if (!enable || !runner) {
18
- return null;
19
- }
20
-
21
- const preprocessorPath = joinWithAppPath(runner);
22
- let result = null;
23
-
24
- if (existsSync(preprocessorPath)) {
25
- const preprocessorDirPath = dirname(preprocessorPath);
26
- const watchOptions = ['--watch', preprocessorDirPath];
27
- const preprocessCli = stopNodemon ? 'node' : runnerCli;
28
-
29
- if (preprocessCli === 'node') {
30
- result = spawnSyncIO(preprocessCli, [preprocessorPath], {
31
- stdio: 'inherit',
32
- cwd: preprocessorDirPath
33
- });
34
- messageLogger('pre_processor ran successfully');
35
- } else {
36
- result = spawnIO(preprocessCli, [preprocessorPath, ...watchOptions], {
37
- stdio: 'inherit',
38
- cwd: preprocessorDirPath
39
- });
40
- }
41
- } else {
42
- errorLogger(`preProcessor not exists ${preprocessorPath}`);
43
- process.exit(0);
44
- }
45
-
46
- return result;
47
- }
@@ -1,26 +0,0 @@
1
- import { webpack } from 'webpack';
2
- import webpackDevMiddleware from 'webpack-dev-middleware';
3
- import { statsConfig } from "../bundler/webpack/statsConfig";
4
- import webpackConfigCreator from "../bundler/webpack/webpackConfig";
5
- export function webpackDevMiddlewareConfig(options) {
6
- const {
7
- publicPath
8
- } = options;
9
- return {
10
- stats: statsConfig(options),
11
- index: 'index.html',
12
- publicPath,
13
- headers: {
14
- 'Access-Control-Allow-Origin': '*'
15
- }
16
- };
17
- }
18
- export function configWebpackDevMiddleware(app, options) {
19
- const config = webpackConfigCreator(options);
20
- const compiler = webpack(config);
21
- const devMiddleware = webpackDevMiddleware(compiler, webpackDevMiddlewareConfig(options));
22
- app.use(devMiddleware);
23
- return {
24
- compiler
25
- };
26
- }
@@ -1,23 +0,0 @@
1
- // eslint-disable-next-line no-unused-vars
2
- export function corsHandling(app, options) {
3
- app.use((req, res, next) => {
4
- // console.log('origin', req.get('origin'));
5
- res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
6
-
7
- res.setHeader('Access-Control-Allow-Private-Network', true);
8
- res.setHeader('Access-Control-Allow-Credentials', true);
9
-
10
- if (req.get('Access-Control-Request-Headers')) {
11
- res.setHeader('Access-Control-Allow-Headers', req.get('Access-Control-Request-Headers'));
12
- }
13
-
14
- if (req.get('Access-Control-Request-Method')) {
15
- res.setHeader('Access-Control-Allow-Methods', req.get('Access-Control-Request-Method'));
16
- }
17
-
18
- next();
19
- });
20
- app.options('/*', (req, res) => {
21
- res.send('Ok');
22
- });
23
- }
@@ -1,18 +0,0 @@
1
- import os from 'os';
2
- export function getIp() {
3
- const ifaces = os.networkInterfaces();
4
- let ips = [];
5
- Object.keys(ifaces).forEach(ifname => {
6
- const a = ifaces[ifname].map(iface => {
7
- if (iface.family !== 'IPv4' || iface.internal !== false) {
8
- return null;
9
- }
10
-
11
- return iface.address;
12
- }).filter(a => a);
13
- ips = ips.concat(a);
14
- });
15
- ips.push('127.0.0.1');
16
- return ips[0];
17
- }
18
- ;
@@ -1,28 +0,0 @@
1
- export function getServerDomain(serverInfo) {
2
- const {
3
- host,
4
- domain,
5
- k8s
6
- } = serverInfo;
7
-
8
- if (domain && !k8s) {
9
- return `${host}.${domain}.zohocorpin.com`;
10
- }
11
-
12
- return host;
13
- }
14
- export function getServerUrl(_ref) {
15
- let {
16
- domain,
17
- k8s,
18
- port,
19
- protocol = 'http'
20
- } = _ref;
21
- const prefix = protocol ? `${protocol}:` : '';
22
-
23
- if (k8s) {
24
- return `${prefix}//${domain}`;
25
- }
26
-
27
- return `${prefix}//${domain}:${port}/`;
28
- }
@@ -1,36 +0,0 @@
1
- import { errorLogger, messageLogger, verboseLogger } from "../../logger";
2
- import { requireAllPossible, requireGlobal } from "../utils/requireLocalOrGlobal";
3
- const defaultCertNpm = '@zohodesk-private/client_dev_cert';
4
- export function httpsOptionsWithUserFriendlyError(options) {
5
- const {
6
- httpsCerts
7
- } = options.server;
8
-
9
- if (typeof httpsCerts === 'string' && httpsCerts) {
10
- const certificate = requireAllPossible(httpsCerts);
11
-
12
- if (certificate.local) {
13
- verboseLogger(`Local '${httpsCerts}' package taken as HTTPS certificate`);
14
- return certificate.local.httpsOptions;
15
- }
16
-
17
- if (certificate.global) {
18
- messageLogger(`Global '${httpsCerts}' package taken as HTTPS certificate`);
19
- return certificate.global.httpsOptions;
20
- }
21
-
22
- errorLogger(`
23
- You have given 'server.httpsCerts' as "${httpsCerts}".
24
- But it seems that file path have some problem;`);
25
- process.exit(0);
26
- }
27
-
28
- const globalCertificate = requireGlobal(defaultCertNpm);
29
-
30
- if (globalCertificate) {
31
- messageLogger(`Global '${defaultCertNpm}' package taken as HTTPS certificate`);
32
- return globalCertificate.httpsOptions;
33
- }
34
-
35
- return null;
36
- }
@@ -1,9 +0,0 @@
1
- import express from 'express';
2
- export function initExpressApp() {
3
- const app = express();
4
- app.use(express.json());
5
- app.use(express.urlencoded({
6
- extended: true
7
- }));
8
- return app;
9
- }