@zohodesk/react-cli 1.1.29-exp.2 → 1.1.29-exp.3

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 (222) hide show
  1. package/README.md +18 -0
  2. package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
  3. package/lib/babel/cmjs-plugins-presets.js +13 -2
  4. package/lib/babel/es-plugins-presets.js +14 -3
  5. package/lib/common/buildEs.js +0 -1
  6. package/lib/common/getEntries.js +13 -2
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +6 -1
  9. package/lib/common/runPreProcess.js +15 -6
  10. package/lib/common/splitChunks.js +21 -2
  11. package/lib/common/sslcertUpdater.js +18 -7
  12. package/lib/common/templateParameters.js +2 -0
  13. package/lib/common/testPattern.js +21 -10
  14. package/lib/common/valueReplacer.js +16 -1
  15. package/lib/configs/jest.config.js +11 -2
  16. package/lib/configs/libAlias.js +16 -10
  17. package/lib/configs/resolvers.js +16 -6
  18. package/lib/configs/webpack.component.umd.config.js +6 -1
  19. package/lib/configs/webpack.css.umd.config.js +14 -6
  20. package/lib/configs/webpack.dev.config.js +14 -1
  21. package/lib/configs/webpack.docs.config.js +9 -1
  22. package/lib/configs/webpack.impact.config.js +8 -1
  23. package/lib/configs/webpack.prod.config.js +17 -4
  24. package/lib/constants.js +18 -9
  25. package/lib/deprecationLogger.js +7 -0
  26. package/lib/hooks/docsProptypeHook.js +8 -4
  27. package/lib/jest/commitedFilesResult.js +46 -4
  28. package/lib/jest/coverageCollector.js +12 -1
  29. package/lib/jest/jsonMaker.js +6 -0
  30. package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
  31. package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
  32. package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
  33. package/lib/jest/result.js +23 -1
  34. package/lib/jest/run.js +18 -7
  35. package/lib/jest/setup.js +60 -8
  36. package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
  37. package/lib/loaderUtils/getCSSLoaders.js +22 -10
  38. package/lib/loaderUtils/getDevJsLoaders.js +13 -4
  39. package/lib/loaderUtils/index.js +4 -1
  40. package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
  41. package/lib/loaderUtils/windowsModification.js +3 -2
  42. package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
  43. package/lib/loaders/composeLoader.js +37 -13
  44. package/lib/loaders/docsLoader.js +12 -1
  45. package/lib/loaders/docsPropsLoader.js +8 -4
  46. package/lib/loaders/enhancedReactLiveConverter.js +23 -2
  47. package/lib/loaders/fileBountryLoader.js +3 -1
  48. package/lib/loaders/fileLoader.js +23 -12
  49. package/lib/loaders/markdownLoader.js +19 -14
  50. package/lib/loaders/reactLiveConvertor.js +15 -5
  51. package/lib/loaders/scriptInstrumentLoader.js +16 -7
  52. package/lib/loaders/selectorMappingLoader.js +26 -7
  53. package/lib/loaders/workerLoader.js +24 -9
  54. package/lib/logger.js +4 -0
  55. package/lib/middlewares/HMRMiddleware.js +27 -13
  56. package/lib/middlewares/SSTMiddleware.js +5 -1
  57. package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
  58. package/lib/pluginUtils/getDevPlugins.js +42 -9
  59. package/lib/pluginUtils/getDocsPlugins.js +13 -3
  60. package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
  61. package/lib/pluginUtils/getLibraryPlugins.js +8 -2
  62. package/lib/pluginUtils/getProdPlugins.js +47 -8
  63. package/lib/pluginUtils/getServerPlugins.js +8 -2
  64. package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
  65. package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
  66. package/lib/pluginUtils/index.js +9 -1
  67. package/lib/plugins/CdnChangePlugin.js +18 -2
  68. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  69. package/lib/plugins/CssOrderControlPlugin.js +6 -3
  70. package/lib/plugins/CustomAttributePlugin.js +19 -14
  71. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
  72. package/lib/plugins/EFCPlugin.js +34 -20
  73. package/lib/plugins/EFCTemplatePlugin.js +30 -19
  74. package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
  75. package/lib/plugins/EventsHandlingPlugin.js +4 -2
  76. package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
  77. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  79. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
  80. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
  81. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
  82. package/lib/plugins/I18nSplitPlugin/index.js +24 -13
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +8 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
  89. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
  90. package/lib/plugins/ManifestPlugin.js +18 -1
  91. package/lib/plugins/MinifyPlugin.js +10 -1
  92. package/lib/plugins/ModuleStatsPlugin.js +24 -1
  93. package/lib/plugins/OptimizeJSPlugin.js +10 -2
  94. package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
  95. package/lib/plugins/PublicPathChangePlugin.js +39 -6
  96. package/lib/plugins/ReportGeneratePlugin.js +32 -5
  97. package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
  98. package/lib/plugins/ResourceHintsPlugin.js +13 -4
  99. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  100. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
  101. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  102. package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
  103. package/lib/plugins/SelectorPlugin.js +32 -6
  104. package/lib/plugins/ServiceWorkerPlugin.js +22 -5
  105. package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
  106. package/lib/plugins/SourceMapHookPlugin.js +12 -2
  107. package/lib/plugins/StatsPlugin.js +14 -0
  108. package/lib/plugins/TPHashMappingPlugin.js +18 -3
  109. package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
  110. package/lib/plugins/VariableConversionCollector.js +42 -15
  111. package/lib/plugins/index.js +20 -1
  112. package/lib/plugins/libraryImpactPlugin.js +33 -1
  113. package/lib/plugins/utils/classHandling.js +6 -0
  114. package/lib/plugins/utils/fileHandling.js +15 -6
  115. package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
  116. package/lib/plugins/variableConvertorUtils.js +29 -14
  117. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  118. package/lib/postcss-plugins/EmptyPlugin.js +4 -3
  119. package/lib/postcss-plugins/ExcludePlugin.js +5 -1
  120. package/lib/postcss-plugins/IncludePlugin.js +5 -1
  121. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  122. package/lib/postcss-plugins/SelectorReplace.js +16 -1
  123. package/lib/postcss-plugins/ValueReplacer.js +6 -7
  124. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  125. package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
  126. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
  127. package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
  128. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
  129. package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
  130. package/lib/schemas/index.js +10 -3
  131. package/lib/servers/clusterHubServer.js +11 -1
  132. package/lib/servers/devBuild.js +26 -14
  133. package/lib/servers/docsServer.js +3 -1
  134. package/lib/servers/docsServerCore.js +22 -1
  135. package/lib/servers/getCliPath.js +9 -0
  136. package/lib/servers/helpServer.js +6 -1
  137. package/lib/servers/httpsOptions.js +8 -2
  138. package/lib/servers/impactServer.js +35 -3
  139. package/lib/servers/mockserver.js +10 -1
  140. package/lib/servers/nowatchserver.js +37 -12
  141. package/lib/servers/requireLocalOrGlobal.js +17 -6
  142. package/lib/servers/scrServer.js +21 -14
  143. package/lib/servers/server.js +36 -6
  144. package/lib/servers/ssServer.js +17 -1
  145. package/lib/templates/CoverageScriptTemplate.js +14 -0
  146. package/lib/templates/WMSTemplate.js +13 -7
  147. package/lib/templates/linterConstant.js +4 -2
  148. package/lib/utils/babelPresets.js +7 -3
  149. package/lib/utils/clean.js +9 -3
  150. package/lib/utils/copy.js +7 -1
  151. package/lib/utils/copyTimezones.js +9 -1
  152. package/lib/utils/createEventStream.js +6 -1
  153. package/lib/utils/cssClassNameGenerate.js +30 -10
  154. package/lib/utils/cssURLReplacer.js +22 -1
  155. package/lib/utils/dependencyPostPublish.js +10 -1
  156. package/lib/utils/deprecationSupport.js +32 -7
  157. package/lib/utils/fileUtils.js +28 -1
  158. package/lib/utils/folderIterator.js +13 -2
  159. package/lib/utils/getComponents.js +21 -0
  160. package/lib/utils/getCurrentBranch.js +5 -0
  161. package/lib/utils/getDependenciesImpactList.js +22 -1
  162. package/lib/utils/getFileType.js +10 -2
  163. package/lib/utils/getHash.js +8 -1
  164. package/lib/utils/getIp.js +2 -0
  165. package/lib/utils/getOptions.js +53 -16
  166. package/lib/utils/getServerURL.js +10 -1
  167. package/lib/utils/index.js +51 -4
  168. package/lib/utils/init.js +1 -0
  169. package/lib/utils/initPreCommitHook.js +30 -7
  170. package/lib/utils/jsonHelper.js +22 -3
  171. package/lib/utils/libraryImpactConfig.js +5 -2
  172. package/lib/utils/lint/addScripts.js +5 -2
  173. package/lib/utils/lint/checkExistingConfig.js +12 -3
  174. package/lib/utils/lint/copyConfigs.js +3 -0
  175. package/lib/utils/lint/index.js +9 -0
  176. package/lib/utils/lint/lintScripts.js +1 -0
  177. package/lib/utils/lint/lintSetup.js +4 -3
  178. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  179. package/lib/utils/lint/question.js +7 -0
  180. package/lib/utils/lintReporter.js +20 -0
  181. package/lib/utils/log.js +1 -0
  182. package/lib/utils/mailSender.js +8 -1
  183. package/lib/utils/object-manipulation.js +17 -1
  184. package/lib/utils/pullOrigin.js +4 -0
  185. package/lib/utils/reinstallDependencies.js +29 -1
  186. package/lib/utils/removeAttributes.js +8 -1
  187. package/lib/utils/repoClone.js +28 -3
  188. package/lib/utils/request.js +12 -0
  189. package/lib/utils/rtl.js +17 -5
  190. package/lib/utils/selectorReplacer.js +16 -10
  191. package/lib/utils/setEnvVariables.js +2 -0
  192. package/lib/utils/ssTestHack.js +11 -1
  193. package/lib/utils/switchBranch.js +5 -0
  194. package/lib/utils/typeCheck.js +1 -0
  195. package/lib/utils/urlConcat.js +4 -0
  196. package/lib/utils/useExitCleanup.js +10 -9
  197. package/lib/utils/variableConverter.js +31 -22
  198. package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
  199. package/package.json +3 -2
  200. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
  201. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
  202. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
  203. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
  204. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
  205. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
  206. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
  207. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
  208. package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
  209. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
  210. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
  211. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
  212. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
  213. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
  214. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
  215. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
  216. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
  217. package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
  218. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
  219. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
  220. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
  221. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
  222. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +0 -54
@@ -4,23 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _postcss = _interopRequireDefault(require("postcss"));
9
+
8
10
  var _ErrorHandler = require("../postcss-plugins/variableModificationPlugin/ErrorHandler");
11
+
9
12
  var _fileHandling = require("./utils/fileHandling");
13
+
10
14
  var _variableConvertorUtils = require("./variableConvertorUtils");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- // import { RawSource } from 'webpack-sources';
13
15
 
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ // import { RawSource } from 'webpack-sources';
14
19
  const fs = require('fs');
20
+
15
21
  let variablesRead = {};
22
+
16
23
  const {
17
24
  errors,
18
25
  errTable,
19
26
  errHandler
20
27
  } = require('../postcss-plugins/variableModificationPlugin/index');
21
- const supportedProps = ['font-size', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', '^top', '^right', '^bottom', '^left', '^width', 'min-width', 'max-width', '^height', 'min-height', 'max-height', 'text-indent', 'clip', 'flex-basis', 'row-gap', 'gap', 'column-gap', 'flex'];
22
28
 
23
- // -- to convert the hyphen values to values --
29
+ const supportedProps = ['font-size', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', '^top', '^right', '^bottom', '^left', '^width', 'min-width', 'max-width', '^height', 'min-height', 'max-height', 'text-indent', 'clip', 'flex-basis', 'row-gap', 'gap', 'column-gap', 'flex']; // -- to convert the hyphen values to values --
30
+
24
31
  /*
25
32
  input :
26
33
  var(--zdt_uploadlist_default_width)
@@ -38,19 +45,22 @@ function createFolderIfNonExistant(path) {
38
45
  });
39
46
  }
40
47
  }
48
+
41
49
  function createFileIfNonExistant(path, content) {
42
50
  if (fs.existsSync(path)) {
43
51
  fs.writeFileSync(path, content, 'utf-8');
44
52
  }
45
53
  }
54
+
46
55
  class VariableConversionCollector {
47
56
  constructor(options = {}) {
48
57
  this.optimize = options.optimize;
49
58
  this.filename = options.cssVariableReplacementConfig;
50
- this.patterns = options.patterns;
51
- // console.log(options.patterns, this.patterns);
59
+ this.patterns = options.patterns; // console.log(options.patterns, this.patterns);
60
+
52
61
  this.initializeFiles();
53
62
  }
63
+
54
64
  initializeFiles() {
55
65
  createFolderIfNonExistant('./.cli/logs/');
56
66
  createFolderIfNonExistant('./.cli/config/variables/');
@@ -58,10 +68,11 @@ class VariableConversionCollector {
58
68
  createFileIfNonExistant('./.cli/logs/unassignedVariables.log', '{}');
59
69
  createFileIfNonExistant('./.cli/logs/css_error.log', '{}');
60
70
  }
71
+
61
72
  apply(compiler) {
62
73
  const variables = {};
63
- const unassigned = {};
64
- // console.log(windowsModification([this.filename])[0]);
74
+ const unassigned = {}; // console.log(windowsModification([this.filename])[0]);
75
+
65
76
  const rawdata = fs.readFileSync(this.filename);
66
77
  const data = JSON.parse(rawdata);
67
78
  const {
@@ -70,8 +81,7 @@ class VariableConversionCollector {
70
81
  errorInConsole: errorConsoleStatus,
71
82
  errorsAllowed,
72
83
  strictMode
73
- } = data;
74
- // If theres is no setting for default prop in settingsObject, set one.
84
+ } = data; // If theres is no setting for default prop in settingsObject, set one.
75
85
 
76
86
  if (!settingsObject.default) {
77
87
  settingsObject.default = {
@@ -85,7 +95,6 @@ class VariableConversionCollector {
85
95
  }
86
96
  };
87
97
  }
88
-
89
98
  /*
90
99
  purpose of tap : to create a variable object such as:
91
100
  {
@@ -94,24 +103,30 @@ class VariableConversionCollector {
94
103
  }
95
104
  which will help in the conversion further
96
105
  */
106
+
107
+
97
108
  if (fs.existsSync('./.cli/config/variables/variableMapping.json')) {
98
109
  variablesRead = JSON.parse(fs.readFileSync('./.cli/config/variables/variableMapping.json', 'utf-8'));
99
110
  Object.keys(variablesRead.changes).forEach(key => {
100
111
  variables[key] = variablesRead.changes[key];
101
112
  });
102
113
  }
114
+
103
115
  compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
104
116
  compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
105
117
  const mods = modules.filter(x => x.type.includes('css'));
106
118
  mods.forEach(module => {
107
119
  const rootOriginal = _postcss.default.parse(module.content);
120
+
108
121
  const filename = module.issuer.resource;
122
+
109
123
  if (!filename.includes('node_modules')) {
110
124
  rootOriginal.walkRules(rule => {
111
125
  rule.walkDecls(decl => {
112
126
  decl.value.split(' ').forEach(val => {
113
127
  if (val && val.includes('--') && !new RegExp(_variableConvertorUtils.ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
114
128
  const extractedValue = (0, _variableConvertorUtils.extractVariableName)(val);
129
+
115
130
  if (!variables[extractedValue]) {
116
131
  variables[extractedValue] = decl.prop;
117
132
  } else {
@@ -152,6 +167,7 @@ class VariableConversionCollector {
152
167
 
153
168
  conversion is done in the while loop below
154
169
  */
170
+
155
171
  Object.keys(variables).forEach(key => {
156
172
  while (variables[variables[key]]) {
157
173
  variables[key] = variables[variables[key]];
@@ -159,9 +175,7 @@ class VariableConversionCollector {
159
175
  });
160
176
  }
161
177
  });
162
- });
163
-
164
- // -- conversion for the root using variableConvertor --
178
+ }); // -- conversion for the root using variableConvertor --
165
179
 
166
180
  /*
167
181
  input :
@@ -175,6 +189,7 @@ class VariableConversionCollector {
175
189
  padding : zd_size20;
176
190
  }
177
191
  */
192
+
178
193
  compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
179
194
  const mods = modules.filter(x => x.type.includes('css'));
180
195
  mods.forEach(module => {
@@ -194,13 +209,16 @@ class VariableConversionCollector {
194
209
  output :
195
210
  true or false
196
211
  */
212
+
197
213
  if (!(0, _fileHandling.isFileNameMatchingPluginPattern)({
198
214
  filename,
199
215
  filterArr: this.patterns.cssVariableReplacement
200
216
  })) {
201
217
  return;
202
218
  }
219
+
203
220
  const rootOriginal = _postcss.default.parse(module.content);
221
+
204
222
  module.content = (0, _variableConvertorUtils.variableConverter)(rootOriginal, variables, settingsObject).toString();
205
223
  });
206
224
  });
@@ -212,6 +230,7 @@ class VariableConversionCollector {
212
230
  output :
213
231
  all errors that are present in the errTable arr
214
232
  */
233
+
215
234
  compiler.hooks.afterEmit.tap('error-display', () => {
216
235
  if (Object.keys(unassigned).length > 0 && strictMode) {
217
236
  console.log();
@@ -225,14 +244,17 @@ class VariableConversionCollector {
225
244
  fs.writeFileSync('./.cli/logs/unassignedVariables.log', str, 'utf-8');
226
245
  throw new Error('^^^ Variables above have not been assigned! ^^^');
227
246
  }
247
+
228
248
  const avlTypes = new Set([]);
229
249
  const srtArr = errTable.sort((a, b) => {
230
250
  avlTypes.add(a.type);
231
251
  avlTypes.add(b.type);
252
+
232
253
  if (a.type < b.type) {
233
254
  return -1;
234
255
  }
235
256
  });
257
+
236
258
  if (errorConsoleStatus) {
237
259
  const errorHandler = new _ErrorHandler.ErrorHandler();
238
260
  avlTypes.forEach(type => {
@@ -247,9 +269,11 @@ class VariableConversionCollector {
247
269
  console.log('---------------------------------------------------------------------------------------------------------------------------');
248
270
  });
249
271
  }
272
+
250
273
  if (errorLogStatus) {
251
274
  fs.writeFileSync('./.cli/logs/css_error.log', '');
252
275
  console.log('writing to logFile...');
276
+
253
277
  if (errors.length > 0) {
254
278
  errors.forEach((err, index) => {
255
279
  if (errTable[index].decl.prop && errTable[index].decl.value) {
@@ -260,5 +284,8 @@ class VariableConversionCollector {
260
284
  }
261
285
  });
262
286
  }
287
+
263
288
  }
264
- var _default = exports.default = VariableConversionCollector;
289
+
290
+ var _default = VariableConversionCollector;
291
+ exports.default = _default;
@@ -111,22 +111,41 @@ Object.defineProperty(exports, "UnusedFilesFindPlugin", {
111
111
  return _UnusedFilesFindPlugin.default;
112
112
  }
113
113
  });
114
+
114
115
  var _ModuleStatsPlugin = _interopRequireDefault(require("./ModuleStatsPlugin"));
116
+
115
117
  var _SourceMapHookPlugin = _interopRequireDefault(require("./SourceMapHookPlugin"));
118
+
116
119
  var _UnusedFilesFindPlugin = _interopRequireDefault(require("./UnusedFilesFindPlugin"));
120
+
117
121
  var _ScriptInstrumentPlugin = _interopRequireDefault(require("./ScriptInstrumentPlugin"));
122
+
118
123
  var _PublicPathChangePlugin = _interopRequireDefault(require("./PublicPathChangePlugin"));
124
+
119
125
  var _OptimizeJSPlugin = _interopRequireDefault(require("./OptimizeJSPlugin"));
126
+
120
127
  var _ResourceHintsPlugin = _interopRequireDefault(require("./ResourceHintsPlugin"));
128
+
121
129
  var _MinifyPlugin = _interopRequireDefault(require("./MinifyPlugin"));
130
+
122
131
  var _ManifestPlugin = _interopRequireDefault(require("./ManifestPlugin"));
132
+
123
133
  var _CleanupStatsPlugin = _interopRequireDefault(require("./CleanupStatsPlugin"));
134
+
124
135
  var _EFCPlugin = _interopRequireDefault(require("./EFCPlugin"));
136
+
125
137
  var _PublicPathCallbackPlugin = _interopRequireDefault(require("./PublicPathCallbackPlugin"));
138
+
126
139
  var _I18NInjectIntoIndexPlugin = _interopRequireDefault(require("./I18NInjectIntoIndexPlugin"));
140
+
127
141
  var _ReportGeneratePlugin = _interopRequireDefault(require("./ReportGeneratePlugin"));
142
+
128
143
  var _ShadowDOMSupportPlugin = _interopRequireDefault(require("./ShadowDOMSupportPlugin"));
144
+
129
145
  var _ServiceWorkerPlugin = _interopRequireDefault(require("./ServiceWorkerPlugin"));
146
+
130
147
  var _TPHashMappingPlugin = _interopRequireDefault(require("./TPHashMappingPlugin"));
148
+
131
149
  var _CdnChangePlugin = _interopRequireDefault(require("./CdnChangePlugin"));
132
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
150
+
151
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4,12 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
11
+
9
12
  var _webpackSources = require("webpack-sources");
13
+
10
14
  var _jsonHelper = require("../utils/jsonHelper");
15
+
11
16
  var _utils = require("../utils");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
13
20
  let resultFileName = `${process.cwd()}/result.json`;
14
21
  let options = (0, _utils.getOptions)();
15
22
  let {
@@ -24,21 +31,27 @@ let {
24
31
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.compareBranch', referBranch);
25
32
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.TestBranch', currentBranch);
26
33
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.isExecuted', true);
34
+
27
35
  let isValidModule = name => {
28
36
  if (name.includes('node_modules') && (name.includes(`@zohodesk${_path.default.sep}components`) || name.includes(`@zohodesk${_path.default.sep}dot`) || name.includes(`@zohodesk${_path.default.sep}icons`) || name.includes(`@zohodesk${_path.default.sep}svg`)) && !name.endsWith('docs.js')) {
29
37
  return true;
30
38
  }
39
+
31
40
  return !name.includes('index.js') && !name.endsWith('.css') && !name.endsWith('.png') && !name.includes('node_modules') && name.includes('src');
32
41
  };
42
+
33
43
  let getModuleName = modulePath => {
34
44
  let [name] = _path.default.parse(modulePath).name.split('.');
45
+
35
46
  if (modulePath.includes(`@zohodesk${_path.default.sep}components`)) {
36
47
  name = `@zohodesk/components/${name}`;
37
48
  } else if (modulePath.includes(`@zohodesk${_path.default.sep}dot`)) {
38
49
  name = `@zohodesk/dot/${name}`;
39
50
  }
51
+
40
52
  return name;
41
53
  };
54
+
42
55
  class LibraryImpactPlugin {
43
56
  constructor(options = {}) {
44
57
  this.options = options;
@@ -47,10 +60,12 @@ class LibraryImpactPlugin {
47
60
  this.bottomHtml = '</div> <script type="text/javascript"> const details = document.querySelectorAll("details"); details.forEach((targetDetail) => { targetDetail.addEventListener("click", () => { // Close all the details that are not targetDetail. details.forEach((detail) => { if (detail !== targetDetail) { detail.removeAttribute("open"); } }); }); }); </script></body></html>';
48
61
  this.resultJson = {};
49
62
  }
63
+
50
64
  apply(compiler) {
51
65
  let loggedInfo = false;
52
66
  compiler.hooks.beforeCompile.tap('LibraryImpactPlugin', () => {
53
67
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.startTime', Date.now());
68
+
54
69
  if (!loggedInfo) {
55
70
  (0, _utils.log)('\x1b[33m%s\x1b[0m', '************************************************************ \n ');
56
71
  (0, _utils.log)('\x1b[5m\x1b[44m%s\x1b[0m', 'Finding Impacted Source Files Please Wait ...');
@@ -63,11 +78,13 @@ class LibraryImpactPlugin {
63
78
  let {
64
79
  modules
65
80
  } = stats;
81
+
66
82
  for (let module of modules) {
67
83
  let {
68
84
  name,
69
85
  reasons
70
86
  } = module;
87
+
71
88
  if (isValidModule(name)) {
72
89
  let references = new Set();
73
90
  let referencedby = new Set();
@@ -76,6 +93,7 @@ class LibraryImpactPlugin {
76
93
  compilation.modules.forEach(module => {
77
94
  module.reasons.forEach(reason => {
78
95
  let exportedValue = reason.dependency;
96
+
79
97
  if (exportedValue.type === 'harmony export imported specifier') {
80
98
  if (exportedValue.module.userRequest.includes(name.replace('.', ''))) {
81
99
  docsName = exportedValue.name;
@@ -84,29 +102,35 @@ class LibraryImpactPlugin {
84
102
  });
85
103
  });
86
104
  let currentModuleName = name;
105
+
87
106
  if (Array.isArray(reasons)) {
88
107
  for (let reason of reasons) {
89
108
  let {
90
109
  moduleName
91
110
  } = reason;
111
+
92
112
  if (isValidModule(moduleName)) {
93
113
  let reasonedModuleName = moduleName;
94
114
  referencedby.add(reasonedModuleName);
95
115
  }
96
116
  }
97
117
  }
118
+
98
119
  for (let subModule of modules) {
99
120
  let {
100
121
  name: subModuleName,
101
122
  reasons
102
123
  } = subModule;
124
+
103
125
  if (isValidModule(subModuleName)) {
104
126
  let currentModuleName = subModuleName;
127
+
105
128
  if (Array.isArray(reasons)) {
106
129
  for (let reason of reasons) {
107
130
  let {
108
131
  moduleName: reasonedModuleName
109
132
  } = reason;
133
+
110
134
  if (name === reasonedModuleName) {
111
135
  references.add(currentModuleName);
112
136
  }
@@ -114,6 +138,7 @@ class LibraryImpactPlugin {
114
138
  }
115
139
  }
116
140
  }
141
+
117
142
  results[currentModuleName] = {
118
143
  name: currentModuleName,
119
144
  references: Array.from(references),
@@ -123,9 +148,11 @@ class LibraryImpactPlugin {
123
148
  };
124
149
  }
125
150
  }
151
+
126
152
  (0, _utils.getDependenciesImpactList)(currentBranch, referBranch, tokenGit, serviceName).then(impactedList => {
127
153
  this.resultJson = (0, _utils.getLibraryConflict)(JSON.stringify(results), impactedList, changesOnly);
128
154
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.result', this.resultJson);
155
+
129
156
  if (this.resultJson.result.status) {
130
157
  (0, _utils.log)(this.resultJson.response);
131
158
  this.resultJson.response.forEach(fileObject => {
@@ -140,12 +167,15 @@ class LibraryImpactPlugin {
140
167
  (0, _utils.log)(this.resultJson.result.message);
141
168
  this.topHtml = this.topHtml + '<div style="font-size: xxx-large; text-align: center; padding-top: 50px;"> ' + this.resultJson.result.message + '</div>';
142
169
  }
170
+
143
171
  if (!_fs.default.existsSync('./coverageTest')) {
144
172
  _fs.default.mkdirSync('./coverageTest');
173
+
145
174
  _fs.default.writeFileSync('./coverageTest/impactLibrary.html', this.topHtml + this.bottomHtml, 'utf8');
146
175
  } else {
147
176
  _fs.default.writeFileSync('./coverageTest/impactLibrary.html', this.topHtml + this.bottomHtml, 'utf8');
148
177
  }
178
+
149
179
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.endTime', Date.now());
150
180
  });
151
181
  });
@@ -154,5 +184,7 @@ class LibraryImpactPlugin {
154
184
  (0, _utils.log)('Compilation finished!!!');
155
185
  });
156
186
  }
187
+
157
188
  }
189
+
158
190
  exports.default = LibraryImpactPlugin;
@@ -9,21 +9,27 @@ exports.isComment = isComment;
9
9
  exports.isCommentContentSame = isCommentContentSame;
10
10
  exports.isInsideMediaQuery = isInsideMediaQuery;
11
11
  exports.isThisComment = isThisComment;
12
+
12
13
  function isComment(node) {
13
14
  return node && node.type && node.type === 'comment';
14
15
  }
16
+
15
17
  function isCommentContentSame(node, content) {
16
18
  return node.text.toLowerCase() === content;
17
19
  }
20
+
18
21
  function isThisComment(node, ignoreComment) {
19
22
  return isComment(node) && isCommentContentSame(node, ignoreComment);
20
23
  }
24
+
21
25
  function hasPrevNodeIgnore(index, prevNode, ignoreComment) {
22
26
  return index !== 0 && isThisComment(prevNode, ignoreComment);
23
27
  }
28
+
24
29
  function isAtRule(rule) {
25
30
  return rule.parent && rule.parent.type === 'atrule';
26
31
  }
32
+
27
33
  function isInsideMediaQuery(rule) {
28
34
  return isAtRule(rule) && rule.parent && rule.parent.name === 'media' ? true : false;
29
35
  }
@@ -5,9 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isFileNameMatchingPattern = isFileNameMatchingPattern;
7
7
  exports.isFileNameMatchingPluginPattern = isFileNameMatchingPluginPattern;
8
+
8
9
  var _ignore = _interopRequireDefault(require("ignore"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
10
13
  const path = require('path');
14
+
11
15
  const aliasNames = {
12
16
  valueReplacer: 'postcss-value-replacer',
13
17
  selectorReplace: 'postcss-selector-replace-new',
@@ -17,7 +21,6 @@ const aliasNames = {
17
21
  cssVariableReplacement: 'postcss-variable-report',
18
22
  composeMinification: 'postcss-compose-plugin'
19
23
  };
20
-
21
24
  /*
22
25
 
23
26
  unique scenario
@@ -39,6 +42,7 @@ unique scenario
39
42
  // });
40
43
  // return include;
41
44
  // }
45
+
42
46
  function isFileNameMatchingPattern({
43
47
  filename,
44
48
  filterObject,
@@ -51,29 +55,34 @@ function isFileNameMatchingPattern({
51
55
  });
52
56
  const finalPlugins = order.filter(key => {
53
57
  const pluginSpecificFilter = filterObject[key];
58
+
54
59
  if (!pluginSpecificFilter || pluginSpecificFilter.length === 0) {
55
60
  return true;
56
- }
57
- // eslint-disable-next-line no-use-before-define
61
+ } // eslint-disable-next-line no-use-before-define
62
+
63
+
58
64
  const isMatching = isFilePathMatchingPattern(filename, pluginSpecificFilter);
59
65
  return isMatching;
60
66
  }).map(key => {
61
67
  const p = pluginObj[aliasNames[key]];
62
68
  return p;
63
- });
64
- // if unknown key given in plugins and pattern loop will run but post-css plugin won't be available and will be undefined in array
69
+ }); // if unknown key given in plugins and pattern loop will run but post-css plugin won't be available and will be undefined in array
65
70
  // So we do filter as safety measure.
71
+
66
72
  return finalPlugins.filter(Boolean);
67
73
  }
74
+
68
75
  function isFilePathMatchingPattern(filePath, patterns) {
69
76
  if (patterns.length === 0) {
70
77
  return true;
71
78
  }
79
+
72
80
  const ig = (0, _ignore.default)({
73
81
  allowRelativePaths: true
74
82
  }).add(patterns);
75
83
  return ig.ignores(filePath);
76
84
  }
85
+
77
86
  function isFileNameMatchingPluginPattern({
78
87
  filename,
79
88
  filterArr
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  const ignore = require('ignore');
4
+
4
5
  const ignoreArr1 = ['src', '!src\\components', 'src\\Accessibility'];
5
6
  const ignoreArr2 = ['src\\', '!node_modules\\'];
6
7
  const ignoreArr3 = ['*'];
8
+
7
9
  const {
8
10
  windowsModificationFile
9
11
  } = require('../../../../lib/loaderUtils/windowsModification');
12
+
10
13
  const files = ['D:\\MyWork\\React Build\\desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'D:\\MyWork\\React Build\\desk_client_app\\jsapps\\supportapp\\src\\components\\Avatar\\Avatar.module.css', 'D:/MyWork/React Build/desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'D:/MyWork/React Build/desk_client_app/jsapps/supportapp/src/components/Accessibility/AccessibilityNavigation.module.css', 'desk_client_app\\jsapps\\supportapp\\src\\components\\Test.module.css', 'desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'src\\components\\Accessibility\\Accessibility.module.css', 'src/components/Accessibility/Accessibility.module.css', 'Accessibility.module.css', ''];
11
14
  const ignore1 = ignore().add(ignoreArr1);
12
15
  const ignore2 = ignore().add(ignoreArr2);
@@ -17,6 +20,7 @@ files.forEach(file => {
17
20
  const regex = `^(.+?)${rootDir}?\\\\`;
18
21
  const newFilename = windowsModificationFile(file).replace(new RegExp(regex, 'gi'), '');
19
22
  console.log(newFilename);
23
+
20
24
  if (newFilename.trim() !== '') {
21
25
  console.log(ignore1.ignores(newFilename));
22
26
  console.log(ignore2.ignores(newFilename));
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.extractVariableName = extractVariableName;
7
7
  exports.ignoreVals = void 0;
8
8
  exports.variableConverter = variableConverter;
9
+
9
10
  var _classHandling = require("./utils/classHandling");
10
- const ignoreVals = exports.ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_'];
11
11
 
12
- // const avoidProps = [];
12
+ const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_']; // const avoidProps = [];
13
13
  // -- is issue IO --
14
+
14
15
  /*
15
16
  issues eg :
16
17
  issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
@@ -21,12 +22,15 @@ true
21
22
  comment :
22
23
  do not execute when --zd_size comes as prop
23
24
  */
25
+
26
+ exports.ignoreVals = ignoreVals;
27
+
24
28
  function extractVariableName(val) {
25
29
  return val.replace(/calc\((.+)\)/gi, '$1').replace(/var\((.+)\)/gi, '$1').replace('-1', '').replace('*', '').replace('\n', '').trim();
26
30
  }
31
+
27
32
  function isIgnoreValuePresent(ignoreVals, prop) {
28
- return ignoreVals.some(ignoreVal => prop && prop.includes(ignoreVal));
29
- // let present = false;
33
+ return ignoreVals.some(ignoreVal => prop && prop.includes(ignoreVal)); // let present = false;
30
34
  // return ignoreVals.forEach(issue => {
31
35
  // if (prop && prop.includes(issue)) {
32
36
  // present = true;
@@ -34,26 +38,29 @@ function isIgnoreValuePresent(ignoreVals, prop) {
34
38
  // });
35
39
  // return present;
36
40
  }
41
+
37
42
  function parseCalcValue(calcValue) {
38
43
  // Remove "calc(" and ")" from the string
39
- const value = calcValue.replace(/calc\(/gi, '').replace(/\)/gi, '').trim();
40
- // Split the string by "*" or "/"
41
- const parts = value.split(/[\\/*]/);
42
- // Parse the first part as a number
43
- const num1 = parts[0].trim();
44
- // Parse the second part as a number
44
+ const value = calcValue.replace(/calc\(/gi, '').replace(/\)/gi, '').trim(); // Split the string by "*" or "/"
45
+
46
+ const parts = value.split(/[\\/*]/); // Parse the first part as a number
47
+
48
+ const num1 = parts[0].trim(); // Parse the second part as a number
49
+
45
50
  const num2 = parts[1].trim();
46
51
  return {
47
52
  valOne: num1,
48
53
  valTwo: num2
49
54
  };
50
55
  }
56
+
51
57
  function convertToCalc(pxReplacement, value) {
52
58
  const parsedValue = parseFloat(value, 10);
53
59
  const sign = parsedValue < 0 ? '-' : '';
54
60
  const varName = `${parsedValue < 0 ? parsedValue * -1 : parsedValue}`;
55
61
  return `calc( ${pxReplacement.replace('$$', varName)} * ${sign}1 )`;
56
62
  }
63
+
57
64
  function convertCalcValue(pxReplacement, parsedValue) {
58
65
  Object.keys(parsedValue).forEach(key => {
59
66
  if (pxReplacement && parsedValue[key].includes('px')) {
@@ -62,32 +69,36 @@ function convertCalcValue(pxReplacement, parsedValue) {
62
69
  });
63
70
  return parsedValue;
64
71
  }
72
+
65
73
  function variableConverter(rootOriginal, variables, settingsObject) {
66
74
  rootOriginal.walkRules(rule => {
67
75
  rule.nodes.forEach((decl, index) => {
68
76
  const prevNode = rule.nodes[index - 1];
69
77
  const currentNode = rule.nodes[index];
78
+
70
79
  if (decl.prop && decl.prop.includes('--')) {
71
- if ((0, _classHandling.isThisComment)(prevNode, 'variable:ignore')
72
- // prevNode &&
80
+ if ((0, _classHandling.isThisComment)(prevNode, 'variable:ignore') // prevNode &&
73
81
  // prevNode.type === 'comment' &&
74
82
  // prevNode.text.toLowerCase() === 'variable:ignore'
75
83
  ) {
76
84
  return;
77
85
  }
86
+
78
87
  if (isIgnoreValuePresent(ignoreVals, decl.prop)) {
79
88
  return;
80
89
  }
90
+
81
91
  if (settingsObject[variables[decl.prop]]) {
82
92
  /* if there is no value for property, set it to default so that undefined doesn't get called as key */
83
93
  if (!variables[decl.prop]) {
84
94
  variables[decl.prop] = 'default';
85
95
  }
96
+
86
97
  const pxReplacement = settingsObject[variables[decl.prop]].replacements.px;
87
98
  let valArr = decl.value.split(' ');
88
99
  valArr = valArr.filter(x => x.trim() !== '');
89
- valArr = valArr.map(x => x.replace(/\r|\t|\n/gi, ''));
90
- // single values are considered in the above array and converted below
100
+ valArr = valArr.map(x => x.replace(/\r|\t|\n/gi, '')); // single values are considered in the above array and converted below
101
+
91
102
  valArr.forEach((value, index) => {
92
103
  if (value.includes('px')) {
93
104
  if (value.includes('calc')) {
@@ -95,15 +106,19 @@ function variableConverter(rootOriginal, variables, settingsObject) {
95
106
  valArr[index] = `calc( ${res.valOne.trim()} * ${res.valTwo.trim()} )`;
96
107
  return;
97
108
  }
109
+
98
110
  if (/-(\d+)/gi.test(value)) {
99
111
  valArr[index] = convertToCalc(pxReplacement, value);
100
112
  return;
101
113
  }
114
+
102
115
  const num = value.replace('px', '');
116
+
103
117
  if (value) {
104
118
  valArr[index] = pxReplacement.replace('$$', num);
105
119
  }
106
120
  }
121
+
107
122
  if (value.includes('px')) {
108
123
  const num = value.replace('px', '');
109
124
  valArr[index] = pxReplacement.replace('$$', num);