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

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 (221) hide show
  1. package/lib/babel/babel-option-utils/babel-preset-react-option.js +0 -3
  2. package/lib/babel/cmjs-plugins-presets.js +1 -8
  3. package/lib/babel/es-plugins-presets.js +1 -8
  4. package/lib/common/buildEs.js +1 -0
  5. package/lib/common/getEntries.js +2 -13
  6. package/lib/common/getPublicPathConfig.js +0 -6
  7. package/lib/common/index.js +1 -6
  8. package/lib/common/runPreProcess.js +6 -15
  9. package/lib/common/splitChunks.js +2 -21
  10. package/lib/common/sslcertUpdater.js +7 -18
  11. package/lib/common/templateParameters.js +0 -2
  12. package/lib/common/testPattern.js +10 -21
  13. package/lib/common/valueReplacer.js +1 -16
  14. package/lib/configs/jest.config.js +1 -10
  15. package/lib/configs/libAlias.js +8 -14
  16. package/lib/configs/resolvers.js +4 -14
  17. package/lib/configs/webpack.component.umd.config.js +1 -6
  18. package/lib/configs/webpack.css.umd.config.js +6 -14
  19. package/lib/configs/webpack.dev.config.js +1 -14
  20. package/lib/configs/webpack.docs.config.js +1 -9
  21. package/lib/configs/webpack.impact.config.js +1 -8
  22. package/lib/configs/webpack.prod.config.js +4 -17
  23. package/lib/constants.js +9 -18
  24. package/lib/deprecationLogger.js +0 -7
  25. package/lib/hooks/docsProptypeHook.js +4 -8
  26. package/lib/jest/commitedFilesResult.js +4 -46
  27. package/lib/jest/coverageCollector.js +1 -12
  28. package/lib/jest/jsonMaker.js +0 -6
  29. package/lib/jest/preProcessors/cssPreprocessor.js +1 -9
  30. package/lib/jest/preProcessors/jsPreprocessor.js +1 -6
  31. package/lib/jest/preProcessors/otherFilesPreprocessor.js +1 -4
  32. package/lib/jest/result.js +1 -23
  33. package/lib/jest/run.js +7 -18
  34. package/lib/jest/setup.js +8 -60
  35. package/lib/loaderUtils/configsAssetsLoaders.js +2 -12
  36. package/lib/loaderUtils/getCSSLoaders.js +10 -22
  37. package/lib/loaderUtils/getDevJsLoaders.js +4 -13
  38. package/lib/loaderUtils/index.js +1 -4
  39. package/lib/loaderUtils/tests/windowsModification.test.js +0 -1
  40. package/lib/loaderUtils/windowsModification.js +2 -3
  41. package/lib/loaders/__test__/markdownLoader.spec.js +0 -1
  42. package/lib/loaders/composeLoader.js +13 -37
  43. package/lib/loaders/docsLoader.js +1 -12
  44. package/lib/loaders/docsPropsLoader.js +4 -8
  45. package/lib/loaders/enhancedReactLiveConverter.js +2 -23
  46. package/lib/loaders/fileBountryLoader.js +1 -3
  47. package/lib/loaders/fileLoader.js +12 -23
  48. package/lib/loaders/markdownLoader.js +14 -19
  49. package/lib/loaders/reactLiveConvertor.js +5 -15
  50. package/lib/loaders/scriptInstrumentLoader.js +7 -16
  51. package/lib/loaders/selectorMappingLoader.js +7 -26
  52. package/lib/loaders/workerLoader.js +9 -24
  53. package/lib/logger.js +0 -4
  54. package/lib/middlewares/HMRMiddleware.js +13 -27
  55. package/lib/middlewares/SSTMiddleware.js +1 -5
  56. package/lib/pluginUtils/configHtmlWebpackPlugins.js +1 -24
  57. package/lib/pluginUtils/getDevPlugins.js +9 -42
  58. package/lib/pluginUtils/getDocsPlugins.js +3 -13
  59. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -6
  60. package/lib/pluginUtils/getLibraryPlugins.js +2 -8
  61. package/lib/pluginUtils/getProdPlugins.js +8 -47
  62. package/lib/pluginUtils/getServerPlugins.js +2 -8
  63. package/lib/pluginUtils/getUMDCSSPlugins.js +2 -10
  64. package/lib/pluginUtils/getUMDComponentPlugins.js +2 -10
  65. package/lib/pluginUtils/index.js +1 -9
  66. package/lib/plugins/CdnChangePlugin.js +2 -18
  67. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  68. package/lib/plugins/CssOrderControlPlugin.js +3 -6
  69. package/lib/plugins/CustomAttributePlugin.js +14 -19
  70. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +3 -23
  71. package/lib/plugins/EFCPlugin.js +20 -34
  72. package/lib/plugins/EFCTemplatePlugin.js +19 -30
  73. package/lib/plugins/EfcResourceCleanupPlugin.js +0 -3
  74. package/lib/plugins/EventsHandlingPlugin.js +2 -4
  75. package/lib/plugins/I18NInjectIntoIndexPlugin.js +11 -37
  76. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +10 -15
  77. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +12 -25
  79. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +55 -133
  80. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +12 -23
  81. package/lib/plugins/I18nSplitPlugin/index.js +13 -24
  82. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +64 -58
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +10 -29
  85. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +8 -19
  86. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  88. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +1 -8
  89. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  90. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -20
  91. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +0 -1
  92. package/lib/plugins/ManifestPlugin.js +1 -18
  93. package/lib/plugins/MinifyPlugin.js +1 -10
  94. package/lib/plugins/ModuleStatsPlugin.js +1 -24
  95. package/lib/plugins/OptimizeJSPlugin.js +2 -10
  96. package/lib/plugins/PublicPathCallbackPlugin.js +1 -12
  97. package/lib/plugins/PublicPathChangePlugin.js +6 -39
  98. package/lib/plugins/ReportGeneratePlugin.js +5 -32
  99. package/lib/plugins/RequireVariablePublicPlugin.js +1 -8
  100. package/lib/plugins/ResourceHintsPlugin.js +4 -13
  101. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  102. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +10 -17
  103. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  104. package/lib/plugins/ScriptInstrumentPlugin.js +1 -8
  105. package/lib/plugins/SelectorPlugin.js +6 -32
  106. package/lib/plugins/ServiceWorkerPlugin.js +5 -22
  107. package/lib/plugins/ShadowDOMSupportPlugin.js +4 -41
  108. package/lib/plugins/SourceMapHookPlugin.js +2 -12
  109. package/lib/plugins/StatsPlugin.js +0 -14
  110. package/lib/plugins/TPHashMappingPlugin.js +3 -18
  111. package/lib/plugins/UnusedFilesFindPlugin.js +4 -39
  112. package/lib/plugins/VariableConversionCollector.js +15 -42
  113. package/lib/plugins/index.js +1 -20
  114. package/lib/plugins/libraryImpactPlugin.js +1 -33
  115. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +306 -0
  116. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +363 -0
  117. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +694 -0
  118. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +1258 -0
  119. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +542 -0
  120. package/lib/plugins/newi18nsplitplugin/18nplugin.js +974 -0
  121. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +131 -0
  122. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +59 -0
  123. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +262 -0
  124. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +166 -0
  125. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +111 -0
  126. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +163 -0
  127. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +88 -0
  128. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +101 -0
  129. package/lib/plugins/newi18nsplitplugin/constants.js +162 -0
  130. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +78 -0
  131. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +22 -0
  132. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +18 -0
  133. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +580 -0
  134. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +54 -0
  135. package/lib/plugins/utils/classHandling.js +0 -6
  136. package/lib/plugins/utils/fileHandling.js +6 -15
  137. package/lib/plugins/utils/tests/fileHandling.test.js +0 -4
  138. package/lib/plugins/variableConvertorUtils.js +14 -29
  139. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  140. package/lib/postcss-plugins/EmptyPlugin.js +3 -4
  141. package/lib/postcss-plugins/ExcludePlugin.js +1 -5
  142. package/lib/postcss-plugins/IncludePlugin.js +1 -5
  143. package/lib/postcss-plugins/RTLSplitPlugin.js +14 -27
  144. package/lib/postcss-plugins/SelectorReplace.js +1 -16
  145. package/lib/postcss-plugins/ValueReplacer.js +7 -6
  146. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  147. package/lib/postcss-plugins/__test__/selectorReplace.test.js +6 -3
  148. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +2 -5
  149. package/lib/postcss-plugins/hoverActivePlugin.js +31 -67
  150. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -7
  151. package/lib/postcss-plugins/variableModificationPlugin/index.js +28 -49
  152. package/lib/schemas/index.js +3 -9
  153. package/lib/servers/clusterHubServer.js +1 -11
  154. package/lib/servers/devBuild.js +14 -26
  155. package/lib/servers/docsServer.js +1 -3
  156. package/lib/servers/docsServerCore.js +1 -22
  157. package/lib/servers/getCliPath.js +0 -9
  158. package/lib/servers/helpServer.js +1 -6
  159. package/lib/servers/httpsOptions.js +2 -8
  160. package/lib/servers/impactServer.js +3 -35
  161. package/lib/servers/mockserver.js +1 -10
  162. package/lib/servers/nowatchserver.js +12 -37
  163. package/lib/servers/requireLocalOrGlobal.js +6 -17
  164. package/lib/servers/scrServer.js +14 -21
  165. package/lib/servers/server.js +6 -36
  166. package/lib/servers/ssServer.js +1 -17
  167. package/lib/templates/CoverageScriptTemplate.js +0 -14
  168. package/lib/templates/WMSTemplate.js +7 -13
  169. package/lib/templates/linterConstant.js +2 -4
  170. package/lib/utils/babelPresets.js +3 -7
  171. package/lib/utils/clean.js +3 -9
  172. package/lib/utils/copy.js +1 -7
  173. package/lib/utils/copyTimezones.js +1 -9
  174. package/lib/utils/createEventStream.js +1 -6
  175. package/lib/utils/cssClassNameGenerate.js +10 -30
  176. package/lib/utils/cssURLReplacer.js +1 -22
  177. package/lib/utils/dependencyPostPublish.js +1 -10
  178. package/lib/utils/deprecationSupport.js +7 -32
  179. package/lib/utils/fileUtils.js +1 -28
  180. package/lib/utils/folderIterator.js +2 -13
  181. package/lib/utils/getComponents.js +0 -21
  182. package/lib/utils/getCurrentBranch.js +0 -5
  183. package/lib/utils/getDependenciesImpactList.js +1 -22
  184. package/lib/utils/getFileType.js +2 -10
  185. package/lib/utils/getHash.js +1 -8
  186. package/lib/utils/getIp.js +0 -2
  187. package/lib/utils/getOptions.js +16 -53
  188. package/lib/utils/getServerURL.js +1 -10
  189. package/lib/utils/index.js +4 -51
  190. package/lib/utils/init.js +0 -1
  191. package/lib/utils/initPreCommitHook.js +7 -30
  192. package/lib/utils/jsonHelper.js +3 -22
  193. package/lib/utils/libraryImpactConfig.js +2 -5
  194. package/lib/utils/lint/addScripts.js +2 -5
  195. package/lib/utils/lint/checkExistingConfig.js +3 -12
  196. package/lib/utils/lint/copyConfigs.js +0 -3
  197. package/lib/utils/lint/index.js +0 -9
  198. package/lib/utils/lint/lintScripts.js +0 -1
  199. package/lib/utils/lint/lintSetup.js +3 -4
  200. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  201. package/lib/utils/lint/question.js +0 -7
  202. package/lib/utils/lintReporter.js +0 -20
  203. package/lib/utils/log.js +0 -1
  204. package/lib/utils/mailSender.js +1 -8
  205. package/lib/utils/object-manipulation.js +1 -17
  206. package/lib/utils/pullOrigin.js +0 -4
  207. package/lib/utils/reinstallDependencies.js +1 -29
  208. package/lib/utils/removeAttributes.js +1 -8
  209. package/lib/utils/repoClone.js +3 -28
  210. package/lib/utils/request.js +0 -12
  211. package/lib/utils/rtl.js +5 -17
  212. package/lib/utils/selectorReplacer.js +10 -16
  213. package/lib/utils/setEnvVariables.js +0 -2
  214. package/lib/utils/ssTestHack.js +1 -11
  215. package/lib/utils/switchBranch.js +0 -5
  216. package/lib/utils/typeCheck.js +0 -1
  217. package/lib/utils/urlConcat.js +0 -4
  218. package/lib/utils/useExitCleanup.js +9 -10
  219. package/lib/utils/variableConverter.js +22 -31
  220. package/{npm-shrinkwrap.json → package-lock.json} +2098 -1999
  221. package/package.json +1 -1
@@ -4,32 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _fs = _interopRequireDefault(require("fs"));
11
-
12
9
  var _utils = require("../utils");
13
-
14
10
  var _log = require("../utils/log");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
12
  let excludeDocsJSON = '{}';
19
-
20
13
  if (_fs.default.existsSync('./__testUtils__/conf/excludeDocs.json')) {
21
14
  excludeDocsJSON = _fs.default.readFileSync('./__testUtils__/conf/excludeDocs.json').toString();
22
-
23
15
  if (excludeDocsJSON.indexOf('\\') !== -1) {
24
16
  excludeDocsJSON = excludeDocsJSON.replace(/\\/g, '\\\\');
25
17
  }
26
18
  }
27
-
28
- let excludeDocsArray = JSON.parse(excludeDocsJSON); // if (Object.keys(excludeDocsArray).length > 0) {
19
+ let excludeDocsArray = JSON.parse(excludeDocsJSON);
20
+ // if (Object.keys(excludeDocsArray).length > 0) {
29
21
  // }
30
22
 
31
23
  let getRegex = regexString => regexString.map(str => new RegExp(str));
32
-
33
24
  class UnusedFilesFindPlugin {
34
25
  constructor(options = {}) {
35
26
  this.usedFilesExcludes = getRegex(options.usedFilesExcludes);
@@ -39,38 +30,28 @@ class UnusedFilesFindPlugin {
39
30
  this.sstest = options.ssTest || false;
40
31
  this.outputFileName = options.outputFileName;
41
32
  this.docsFilename = options.docsFilename || 'Undocsfiles.json';
42
-
43
33
  if (!this.origin) {
44
34
  throw new Error('You must provide origin point of the app');
45
35
  }
46
36
  }
47
-
48
37
  isIgnoredUsedFile(file) {
49
38
  let result;
50
-
51
39
  for (let i = 0; i < this.usedFilesExcludes.length; i++) {
52
40
  let exclude = this.usedFilesExcludes[i];
53
41
  result = exclude.test(file);
54
-
55
42
  if (result) {
56
43
  break;
57
44
  }
58
45
  }
59
-
60
46
  return result;
61
47
  }
62
-
63
48
  unDocumentedFiles(outputPath) {
64
49
  let status = _fs.default.existsSync(_path.default.join(outputPath, this.outputFileName));
65
-
66
50
  let unDocsCompObj = {};
67
-
68
51
  if (status) {
69
52
  let data = _fs.default.readFileSync(_path.default.join(outputPath, this.outputFileName)).toString();
70
-
71
53
  let walkSync = (dir, filelist = [], undocList = []) => {
72
54
  let files = _fs.default.readdirSync(dir);
73
-
74
55
  files.forEach(file => {
75
56
  if (_fs.default.statSync(`${dir}/${file}`).isDirectory()) {
76
57
  filelist = walkSync(`${dir}/${file}`, filelist, undocList); //eslint-disable-line
@@ -93,7 +74,6 @@ class UnusedFilesFindPlugin {
93
74
  unDocsCompObj.withoutDocs = undocList;
94
75
  return filelist;
95
76
  };
96
-
97
77
  unDocsCompObj.noEnteredComp = walkSync(_path.default.join(process.cwd(), 'src', 'components'), [], []);
98
78
  (0, _utils.writeFile)(_path.default.join(outputPath, this.docsFilename), JSON.stringify(unDocsCompObj));
99
79
  Object.keys(unDocsCompObj).forEach(key => {
@@ -110,27 +90,20 @@ class UnusedFilesFindPlugin {
110
90
  });
111
91
  }
112
92
  }
113
-
114
93
  isIgnoredAllFile(file) {
115
94
  let result;
116
-
117
95
  for (let i = 0; i < this.appFilesExcludes.length; i++) {
118
96
  let exclude = this.appFilesExcludes[i];
119
97
  result = exclude.test(file);
120
-
121
98
  if (result) {
122
99
  break;
123
100
  }
124
101
  }
125
-
126
102
  return result;
127
103
  }
128
-
129
104
  getAllFiles(rootPath) {
130
105
  let allFiles = [];
131
-
132
106
  let files = _fs.default.readdirSync(rootPath).map(file => _path.default.join(rootPath, file));
133
-
134
107
  files.forEach(file => {
135
108
  if (_fs.default.statSync(file).isDirectory()) {
136
109
  allFiles = allFiles.concat(this.getAllFiles(file));
@@ -142,7 +115,6 @@ class UnusedFilesFindPlugin {
142
115
  });
143
116
  return allFiles;
144
117
  }
145
-
146
118
  apply(compiler) {
147
119
  compiler.hooks.afterEmit.tap('UnusedFilesShowPlugin', compilation => {
148
120
  let {
@@ -152,7 +124,6 @@ class UnusedFilesFindPlugin {
152
124
  if (!this.isIgnoredUsedFile(usedFile)) {
153
125
  files[usedFile] = true;
154
126
  }
155
-
156
127
  return files;
157
128
  }, {});
158
129
  let allFiles = this.getAllFiles(this.origin);
@@ -162,7 +133,6 @@ class UnusedFilesFindPlugin {
162
133
  unusedFiles.push(file);
163
134
  }
164
135
  });
165
-
166
136
  if (!unusedFiles.length) {
167
137
  (0, _log.log)('There is no unused files');
168
138
  } else {
@@ -176,18 +146,13 @@ class UnusedFilesFindPlugin {
176
146
  });
177
147
  }
178
148
  }
179
-
180
149
  if (this.delete) {
181
150
  unusedFiles.forEach(file => {
182
151
  _fs.default.unlinkSync(file);
183
-
184
152
  (0, _log.log)(`Deleted - ${file}`);
185
153
  });
186
154
  }
187
155
  });
188
156
  }
189
-
190
157
  }
191
-
192
- var _default = UnusedFilesFindPlugin;
193
- exports.default = _default;
158
+ var _default = exports.default = UnusedFilesFindPlugin;
@@ -4,30 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _postcss = _interopRequireDefault(require("postcss"));
9
-
10
8
  var _ErrorHandler = require("../postcss-plugins/variableModificationPlugin/ErrorHandler");
11
-
12
9
  var _fileHandling = require("./utils/fileHandling");
13
-
14
10
  var _variableConvertorUtils = require("./variableConvertorUtils");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
12
  // import { RawSource } from 'webpack-sources';
19
- const fs = require('fs');
20
13
 
14
+ const fs = require('fs');
21
15
  let variablesRead = {};
22
-
23
16
  const {
24
17
  errors,
25
18
  errTable,
26
19
  errHandler
27
20
  } = 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'];
28
22
 
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
-
23
+ // -- to convert the hyphen values to values --
31
24
  /*
32
25
  input :
33
26
  var(--zdt_uploadlist_default_width)
@@ -45,22 +38,19 @@ function createFolderIfNonExistant(path) {
45
38
  });
46
39
  }
47
40
  }
48
-
49
41
  function createFileIfNonExistant(path, content) {
50
42
  if (fs.existsSync(path)) {
51
43
  fs.writeFileSync(path, content, 'utf-8');
52
44
  }
53
45
  }
54
-
55
46
  class VariableConversionCollector {
56
47
  constructor(options = {}) {
57
48
  this.optimize = options.optimize;
58
49
  this.filename = options.cssVariableReplacementConfig;
59
- this.patterns = options.patterns; // console.log(options.patterns, this.patterns);
60
-
50
+ this.patterns = options.patterns;
51
+ // console.log(options.patterns, this.patterns);
61
52
  this.initializeFiles();
62
53
  }
63
-
64
54
  initializeFiles() {
65
55
  createFolderIfNonExistant('./.cli/logs/');
66
56
  createFolderIfNonExistant('./.cli/config/variables/');
@@ -68,11 +58,10 @@ class VariableConversionCollector {
68
58
  createFileIfNonExistant('./.cli/logs/unassignedVariables.log', '{}');
69
59
  createFileIfNonExistant('./.cli/logs/css_error.log', '{}');
70
60
  }
71
-
72
61
  apply(compiler) {
73
62
  const variables = {};
74
- const unassigned = {}; // console.log(windowsModification([this.filename])[0]);
75
-
63
+ const unassigned = {};
64
+ // console.log(windowsModification([this.filename])[0]);
76
65
  const rawdata = fs.readFileSync(this.filename);
77
66
  const data = JSON.parse(rawdata);
78
67
  const {
@@ -81,7 +70,8 @@ class VariableConversionCollector {
81
70
  errorInConsole: errorConsoleStatus,
82
71
  errorsAllowed,
83
72
  strictMode
84
- } = data; // If theres is no setting for default prop in settingsObject, set one.
73
+ } = data;
74
+ // If theres is no setting for default prop in settingsObject, set one.
85
75
 
86
76
  if (!settingsObject.default) {
87
77
  settingsObject.default = {
@@ -95,6 +85,7 @@ class VariableConversionCollector {
95
85
  }
96
86
  };
97
87
  }
88
+
98
89
  /*
99
90
  purpose of tap : to create a variable object such as:
100
91
  {
@@ -103,30 +94,24 @@ class VariableConversionCollector {
103
94
  }
104
95
  which will help in the conversion further
105
96
  */
106
-
107
-
108
97
  if (fs.existsSync('./.cli/config/variables/variableMapping.json')) {
109
98
  variablesRead = JSON.parse(fs.readFileSync('./.cli/config/variables/variableMapping.json', 'utf-8'));
110
99
  Object.keys(variablesRead.changes).forEach(key => {
111
100
  variables[key] = variablesRead.changes[key];
112
101
  });
113
102
  }
114
-
115
103
  compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
116
104
  compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
117
105
  const mods = modules.filter(x => x.type.includes('css'));
118
106
  mods.forEach(module => {
119
107
  const rootOriginal = _postcss.default.parse(module.content);
120
-
121
108
  const filename = module.issuer.resource;
122
-
123
109
  if (!filename.includes('node_modules')) {
124
110
  rootOriginal.walkRules(rule => {
125
111
  rule.walkDecls(decl => {
126
112
  decl.value.split(' ').forEach(val => {
127
113
  if (val && val.includes('--') && !new RegExp(_variableConvertorUtils.ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
128
114
  const extractedValue = (0, _variableConvertorUtils.extractVariableName)(val);
129
-
130
115
  if (!variables[extractedValue]) {
131
116
  variables[extractedValue] = decl.prop;
132
117
  } else {
@@ -167,7 +152,6 @@ class VariableConversionCollector {
167
152
 
168
153
  conversion is done in the while loop below
169
154
  */
170
-
171
155
  Object.keys(variables).forEach(key => {
172
156
  while (variables[variables[key]]) {
173
157
  variables[key] = variables[variables[key]];
@@ -175,7 +159,9 @@ class VariableConversionCollector {
175
159
  });
176
160
  }
177
161
  });
178
- }); // -- conversion for the root using variableConvertor --
162
+ });
163
+
164
+ // -- conversion for the root using variableConvertor --
179
165
 
180
166
  /*
181
167
  input :
@@ -189,7 +175,6 @@ class VariableConversionCollector {
189
175
  padding : zd_size20;
190
176
  }
191
177
  */
192
-
193
178
  compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
194
179
  const mods = modules.filter(x => x.type.includes('css'));
195
180
  mods.forEach(module => {
@@ -209,16 +194,13 @@ class VariableConversionCollector {
209
194
  output :
210
195
  true or false
211
196
  */
212
-
213
197
  if (!(0, _fileHandling.isFileNameMatchingPluginPattern)({
214
198
  filename,
215
199
  filterArr: this.patterns.cssVariableReplacement
216
200
  })) {
217
201
  return;
218
202
  }
219
-
220
203
  const rootOriginal = _postcss.default.parse(module.content);
221
-
222
204
  module.content = (0, _variableConvertorUtils.variableConverter)(rootOriginal, variables, settingsObject).toString();
223
205
  });
224
206
  });
@@ -230,7 +212,6 @@ class VariableConversionCollector {
230
212
  output :
231
213
  all errors that are present in the errTable arr
232
214
  */
233
-
234
215
  compiler.hooks.afterEmit.tap('error-display', () => {
235
216
  if (Object.keys(unassigned).length > 0 && strictMode) {
236
217
  console.log();
@@ -244,17 +225,14 @@ class VariableConversionCollector {
244
225
  fs.writeFileSync('./.cli/logs/unassignedVariables.log', str, 'utf-8');
245
226
  throw new Error('^^^ Variables above have not been assigned! ^^^');
246
227
  }
247
-
248
228
  const avlTypes = new Set([]);
249
229
  const srtArr = errTable.sort((a, b) => {
250
230
  avlTypes.add(a.type);
251
231
  avlTypes.add(b.type);
252
-
253
232
  if (a.type < b.type) {
254
233
  return -1;
255
234
  }
256
235
  });
257
-
258
236
  if (errorConsoleStatus) {
259
237
  const errorHandler = new _ErrorHandler.ErrorHandler();
260
238
  avlTypes.forEach(type => {
@@ -269,11 +247,9 @@ class VariableConversionCollector {
269
247
  console.log('---------------------------------------------------------------------------------------------------------------------------');
270
248
  });
271
249
  }
272
-
273
250
  if (errorLogStatus) {
274
251
  fs.writeFileSync('./.cli/logs/css_error.log', '');
275
252
  console.log('writing to logFile...');
276
-
277
253
  if (errors.length > 0) {
278
254
  errors.forEach((err, index) => {
279
255
  if (errTable[index].decl.prop && errTable[index].decl.value) {
@@ -284,8 +260,5 @@ class VariableConversionCollector {
284
260
  }
285
261
  });
286
262
  }
287
-
288
263
  }
289
-
290
- var _default = VariableConversionCollector;
291
- exports.default = _default;
264
+ var _default = exports.default = VariableConversionCollector;
@@ -111,41 +111,22 @@ Object.defineProperty(exports, "UnusedFilesFindPlugin", {
111
111
  return _UnusedFilesFindPlugin.default;
112
112
  }
113
113
  });
114
-
115
114
  var _ModuleStatsPlugin = _interopRequireDefault(require("./ModuleStatsPlugin"));
116
-
117
115
  var _SourceMapHookPlugin = _interopRequireDefault(require("./SourceMapHookPlugin"));
118
-
119
116
  var _UnusedFilesFindPlugin = _interopRequireDefault(require("./UnusedFilesFindPlugin"));
120
-
121
117
  var _ScriptInstrumentPlugin = _interopRequireDefault(require("./ScriptInstrumentPlugin"));
122
-
123
118
  var _PublicPathChangePlugin = _interopRequireDefault(require("./PublicPathChangePlugin"));
124
-
125
119
  var _OptimizeJSPlugin = _interopRequireDefault(require("./OptimizeJSPlugin"));
126
-
127
120
  var _ResourceHintsPlugin = _interopRequireDefault(require("./ResourceHintsPlugin"));
128
-
129
121
  var _MinifyPlugin = _interopRequireDefault(require("./MinifyPlugin"));
130
-
131
122
  var _ManifestPlugin = _interopRequireDefault(require("./ManifestPlugin"));
132
-
133
123
  var _CleanupStatsPlugin = _interopRequireDefault(require("./CleanupStatsPlugin"));
134
-
135
124
  var _EFCPlugin = _interopRequireDefault(require("./EFCPlugin"));
136
-
137
125
  var _PublicPathCallbackPlugin = _interopRequireDefault(require("./PublicPathCallbackPlugin"));
138
-
139
126
  var _I18NInjectIntoIndexPlugin = _interopRequireDefault(require("./I18NInjectIntoIndexPlugin"));
140
-
141
127
  var _ReportGeneratePlugin = _interopRequireDefault(require("./ReportGeneratePlugin"));
142
-
143
128
  var _ShadowDOMSupportPlugin = _interopRequireDefault(require("./ShadowDOMSupportPlugin"));
144
-
145
129
  var _ServiceWorkerPlugin = _interopRequireDefault(require("./ServiceWorkerPlugin"));
146
-
147
130
  var _TPHashMappingPlugin = _interopRequireDefault(require("./TPHashMappingPlugin"));
148
-
149
131
  var _CdnChangePlugin = _interopRequireDefault(require("./CdnChangePlugin"));
150
-
151
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
132
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _fs = _interopRequireDefault(require("fs"));
11
-
12
9
  var _webpackSources = require("webpack-sources");
13
-
14
10
  var _jsonHelper = require("../utils/jsonHelper");
15
-
16
11
  var _utils = require("../utils");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
13
  let resultFileName = `${process.cwd()}/result.json`;
21
14
  let options = (0, _utils.getOptions)();
22
15
  let {
@@ -31,27 +24,21 @@ let {
31
24
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.compareBranch', referBranch);
32
25
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.TestBranch', currentBranch);
33
26
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.isExecuted', true);
34
-
35
27
  let isValidModule = name => {
36
28
  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')) {
37
29
  return true;
38
30
  }
39
-
40
31
  return !name.includes('index.js') && !name.endsWith('.css') && !name.endsWith('.png') && !name.includes('node_modules') && name.includes('src');
41
32
  };
42
-
43
33
  let getModuleName = modulePath => {
44
34
  let [name] = _path.default.parse(modulePath).name.split('.');
45
-
46
35
  if (modulePath.includes(`@zohodesk${_path.default.sep}components`)) {
47
36
  name = `@zohodesk/components/${name}`;
48
37
  } else if (modulePath.includes(`@zohodesk${_path.default.sep}dot`)) {
49
38
  name = `@zohodesk/dot/${name}`;
50
39
  }
51
-
52
40
  return name;
53
41
  };
54
-
55
42
  class LibraryImpactPlugin {
56
43
  constructor(options = {}) {
57
44
  this.options = options;
@@ -60,12 +47,10 @@ class LibraryImpactPlugin {
60
47
  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>';
61
48
  this.resultJson = {};
62
49
  }
63
-
64
50
  apply(compiler) {
65
51
  let loggedInfo = false;
66
52
  compiler.hooks.beforeCompile.tap('LibraryImpactPlugin', () => {
67
53
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.startTime', Date.now());
68
-
69
54
  if (!loggedInfo) {
70
55
  (0, _utils.log)('\x1b[33m%s\x1b[0m', '************************************************************ \n ');
71
56
  (0, _utils.log)('\x1b[5m\x1b[44m%s\x1b[0m', 'Finding Impacted Source Files Please Wait ...');
@@ -78,13 +63,11 @@ class LibraryImpactPlugin {
78
63
  let {
79
64
  modules
80
65
  } = stats;
81
-
82
66
  for (let module of modules) {
83
67
  let {
84
68
  name,
85
69
  reasons
86
70
  } = module;
87
-
88
71
  if (isValidModule(name)) {
89
72
  let references = new Set();
90
73
  let referencedby = new Set();
@@ -93,7 +76,6 @@ class LibraryImpactPlugin {
93
76
  compilation.modules.forEach(module => {
94
77
  module.reasons.forEach(reason => {
95
78
  let exportedValue = reason.dependency;
96
-
97
79
  if (exportedValue.type === 'harmony export imported specifier') {
98
80
  if (exportedValue.module.userRequest.includes(name.replace('.', ''))) {
99
81
  docsName = exportedValue.name;
@@ -102,35 +84,29 @@ class LibraryImpactPlugin {
102
84
  });
103
85
  });
104
86
  let currentModuleName = name;
105
-
106
87
  if (Array.isArray(reasons)) {
107
88
  for (let reason of reasons) {
108
89
  let {
109
90
  moduleName
110
91
  } = reason;
111
-
112
92
  if (isValidModule(moduleName)) {
113
93
  let reasonedModuleName = moduleName;
114
94
  referencedby.add(reasonedModuleName);
115
95
  }
116
96
  }
117
97
  }
118
-
119
98
  for (let subModule of modules) {
120
99
  let {
121
100
  name: subModuleName,
122
101
  reasons
123
102
  } = subModule;
124
-
125
103
  if (isValidModule(subModuleName)) {
126
104
  let currentModuleName = subModuleName;
127
-
128
105
  if (Array.isArray(reasons)) {
129
106
  for (let reason of reasons) {
130
107
  let {
131
108
  moduleName: reasonedModuleName
132
109
  } = reason;
133
-
134
110
  if (name === reasonedModuleName) {
135
111
  references.add(currentModuleName);
136
112
  }
@@ -138,7 +114,6 @@ class LibraryImpactPlugin {
138
114
  }
139
115
  }
140
116
  }
141
-
142
117
  results[currentModuleName] = {
143
118
  name: currentModuleName,
144
119
  references: Array.from(references),
@@ -148,11 +123,9 @@ class LibraryImpactPlugin {
148
123
  };
149
124
  }
150
125
  }
151
-
152
126
  (0, _utils.getDependenciesImpactList)(currentBranch, referBranch, tokenGit, serviceName).then(impactedList => {
153
127
  this.resultJson = (0, _utils.getLibraryConflict)(JSON.stringify(results), impactedList, changesOnly);
154
128
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.result', this.resultJson);
155
-
156
129
  if (this.resultJson.result.status) {
157
130
  (0, _utils.log)(this.resultJson.response);
158
131
  this.resultJson.response.forEach(fileObject => {
@@ -167,15 +140,12 @@ class LibraryImpactPlugin {
167
140
  (0, _utils.log)(this.resultJson.result.message);
168
141
  this.topHtml = this.topHtml + '<div style="font-size: xxx-large; text-align: center; padding-top: 50px;"> ' + this.resultJson.result.message + '</div>';
169
142
  }
170
-
171
143
  if (!_fs.default.existsSync('./coverageTest')) {
172
144
  _fs.default.mkdirSync('./coverageTest');
173
-
174
145
  _fs.default.writeFileSync('./coverageTest/impactLibrary.html', this.topHtml + this.bottomHtml, 'utf8');
175
146
  } else {
176
147
  _fs.default.writeFileSync('./coverageTest/impactLibrary.html', this.topHtml + this.bottomHtml, 'utf8');
177
148
  }
178
-
179
149
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.endTime', Date.now());
180
150
  });
181
151
  });
@@ -184,7 +154,5 @@ class LibraryImpactPlugin {
184
154
  (0, _utils.log)('Compilation finished!!!');
185
155
  });
186
156
  }
187
-
188
157
  }
189
-
190
158
  exports.default = LibraryImpactPlugin;