@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
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getPropertiesAsJSON;
7
+ var _fs = require("fs");
8
+ function isComment(line) {
9
+ return line.startsWith('#');
10
+ }
11
+ function getPropertiesAsJSON(filePath) {
12
+ console.log(filePath);
13
+ try {
14
+ const data = (0, _fs.readFileSync)(filePath, 'utf8');
15
+ const lines = data.split(/\r?\n/);
16
+ const i18nObj = {};
17
+ let currentSection = null;
18
+ lines.forEach(fline => {
19
+ const line = fline.trim();
20
+ if (!line) {
21
+ return;
22
+ }
23
+ if (isComment(line)) {
24
+ // Check for section start or end
25
+ if (/^#.*Starts/i.test(line)) {
26
+ currentSection = line.replace(/^#\s*|\s*Starts.*$/gi, '').trim();
27
+ if (!i18nObj[currentSection]) {
28
+ i18nObj[currentSection] = {};
29
+ }
30
+ } else if (/^#.*Ends/i.test(line)) {
31
+ currentSection = null;
32
+ }
33
+ return;
34
+ }
35
+ const ind = line.indexOf('=');
36
+ if (ind > 0) {
37
+ const key = line.slice(0, ind).trim();
38
+ const value = line.slice(ind + 1).trim();
39
+ if (currentSection) {
40
+ if (!i18nObj[currentSection]) {
41
+ i18nObj[currentSection] = {};
42
+ }
43
+ i18nObj[currentSection][key] = value;
44
+ } else {
45
+ i18nObj[key] = value;
46
+ }
47
+ }
48
+ });
49
+ return i18nObj;
50
+ } catch (err) {
51
+ console.error(`Error reading properties file at ${filePath}:`, err);
52
+ return {};
53
+ }
54
+ }
@@ -9,27 +9,21 @@ exports.isComment = isComment;
9
9
  exports.isCommentContentSame = isCommentContentSame;
10
10
  exports.isInsideMediaQuery = isInsideMediaQuery;
11
11
  exports.isThisComment = isThisComment;
12
-
13
12
  function isComment(node) {
14
13
  return node && node.type && node.type === 'comment';
15
14
  }
16
-
17
15
  function isCommentContentSame(node, content) {
18
16
  return node.text.toLowerCase() === content;
19
17
  }
20
-
21
18
  function isThisComment(node, ignoreComment) {
22
19
  return isComment(node) && isCommentContentSame(node, ignoreComment);
23
20
  }
24
-
25
21
  function hasPrevNodeIgnore(index, prevNode, ignoreComment) {
26
22
  return index !== 0 && isThisComment(prevNode, ignoreComment);
27
23
  }
28
-
29
24
  function isAtRule(rule) {
30
25
  return rule.parent && rule.parent.type === 'atrule';
31
26
  }
32
-
33
27
  function isInsideMediaQuery(rule) {
34
28
  return isAtRule(rule) && rule.parent && rule.parent.name === 'media' ? true : false;
35
29
  }
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isFileNameMatchingPattern = isFileNameMatchingPattern;
7
7
  exports.isFileNameMatchingPluginPattern = isFileNameMatchingPluginPattern;
8
-
9
8
  var _ignore = _interopRequireDefault(require("ignore"));
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
10
  const path = require('path');
14
-
15
11
  const aliasNames = {
16
12
  valueReplacer: 'postcss-value-replacer',
17
13
  selectorReplace: 'postcss-selector-replace-new',
@@ -21,6 +17,7 @@ const aliasNames = {
21
17
  cssVariableReplacement: 'postcss-variable-report',
22
18
  composeMinification: 'postcss-compose-plugin'
23
19
  };
20
+
24
21
  /*
25
22
 
26
23
  unique scenario
@@ -42,7 +39,6 @@ unique scenario
42
39
  // });
43
40
  // return include;
44
41
  // }
45
-
46
42
  function isFileNameMatchingPattern({
47
43
  filename,
48
44
  filterObject,
@@ -55,34 +51,29 @@ function isFileNameMatchingPattern({
55
51
  });
56
52
  const finalPlugins = order.filter(key => {
57
53
  const pluginSpecificFilter = filterObject[key];
58
-
59
54
  if (!pluginSpecificFilter || pluginSpecificFilter.length === 0) {
60
55
  return true;
61
- } // eslint-disable-next-line no-use-before-define
62
-
63
-
56
+ }
57
+ // eslint-disable-next-line no-use-before-define
64
58
  const isMatching = isFilePathMatchingPattern(filename, pluginSpecificFilter);
65
59
  return isMatching;
66
60
  }).map(key => {
67
61
  const p = pluginObj[aliasNames[key]];
68
62
  return p;
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
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
70
65
  // So we do filter as safety measure.
71
-
72
66
  return finalPlugins.filter(Boolean);
73
67
  }
74
-
75
68
  function isFilePathMatchingPattern(filePath, patterns) {
76
69
  if (patterns.length === 0) {
77
70
  return true;
78
71
  }
79
-
80
72
  const ig = (0, _ignore.default)({
81
73
  allowRelativePaths: true
82
74
  }).add(patterns);
83
75
  return ig.ignores(filePath);
84
76
  }
85
-
86
77
  function isFileNameMatchingPluginPattern({
87
78
  filename,
88
79
  filterArr
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  const ignore = require('ignore');
4
-
5
4
  const ignoreArr1 = ['src', '!src\\components', 'src\\Accessibility'];
6
5
  const ignoreArr2 = ['src\\', '!node_modules\\'];
7
6
  const ignoreArr3 = ['*'];
8
-
9
7
  const {
10
8
  windowsModificationFile
11
9
  } = require('../../../../lib/loaderUtils/windowsModification');
12
-
13
10
  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', ''];
14
11
  const ignore1 = ignore().add(ignoreArr1);
15
12
  const ignore2 = ignore().add(ignoreArr2);
@@ -20,7 +17,6 @@ files.forEach(file => {
20
17
  const regex = `^(.+?)${rootDir}?\\\\`;
21
18
  const newFilename = windowsModificationFile(file).replace(new RegExp(regex, 'gi'), '');
22
19
  console.log(newFilename);
23
-
24
20
  if (newFilename.trim() !== '') {
25
21
  console.log(ignore1.ignores(newFilename));
26
22
  console.log(ignore2.ignores(newFilename));
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.extractVariableName = extractVariableName;
7
7
  exports.ignoreVals = void 0;
8
8
  exports.variableConverter = variableConverter;
9
-
10
9
  var _classHandling = require("./utils/classHandling");
10
+ const ignoreVals = exports.ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_'];
11
11
 
12
- const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_']; // const avoidProps = [];
12
+ // const avoidProps = [];
13
13
  // -- is issue IO --
14
-
15
14
  /*
16
15
  issues eg :
17
16
  issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
@@ -22,15 +21,12 @@ true
22
21
  comment :
23
22
  do not execute when --zd_size comes as prop
24
23
  */
25
-
26
- exports.ignoreVals = ignoreVals;
27
-
28
24
  function extractVariableName(val) {
29
25
  return val.replace(/calc\((.+)\)/gi, '$1').replace(/var\((.+)\)/gi, '$1').replace('-1', '').replace('*', '').replace('\n', '').trim();
30
26
  }
31
-
32
27
  function isIgnoreValuePresent(ignoreVals, prop) {
33
- return ignoreVals.some(ignoreVal => prop && prop.includes(ignoreVal)); // let present = false;
28
+ return ignoreVals.some(ignoreVal => prop && prop.includes(ignoreVal));
29
+ // let present = false;
34
30
  // return ignoreVals.forEach(issue => {
35
31
  // if (prop && prop.includes(issue)) {
36
32
  // present = true;
@@ -38,29 +34,26 @@ function isIgnoreValuePresent(ignoreVals, prop) {
38
34
  // });
39
35
  // return present;
40
36
  }
41
-
42
37
  function parseCalcValue(calcValue) {
43
38
  // Remove "calc(" and ")" from the string
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
-
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
50
45
  const num2 = parts[1].trim();
51
46
  return {
52
47
  valOne: num1,
53
48
  valTwo: num2
54
49
  };
55
50
  }
56
-
57
51
  function convertToCalc(pxReplacement, value) {
58
52
  const parsedValue = parseFloat(value, 10);
59
53
  const sign = parsedValue < 0 ? '-' : '';
60
54
  const varName = `${parsedValue < 0 ? parsedValue * -1 : parsedValue}`;
61
55
  return `calc( ${pxReplacement.replace('$$', varName)} * ${sign}1 )`;
62
56
  }
63
-
64
57
  function convertCalcValue(pxReplacement, parsedValue) {
65
58
  Object.keys(parsedValue).forEach(key => {
66
59
  if (pxReplacement && parsedValue[key].includes('px')) {
@@ -69,36 +62,32 @@ function convertCalcValue(pxReplacement, parsedValue) {
69
62
  });
70
63
  return parsedValue;
71
64
  }
72
-
73
65
  function variableConverter(rootOriginal, variables, settingsObject) {
74
66
  rootOriginal.walkRules(rule => {
75
67
  rule.nodes.forEach((decl, index) => {
76
68
  const prevNode = rule.nodes[index - 1];
77
69
  const currentNode = rule.nodes[index];
78
-
79
70
  if (decl.prop && decl.prop.includes('--')) {
80
- if ((0, _classHandling.isThisComment)(prevNode, 'variable:ignore') // prevNode &&
71
+ if ((0, _classHandling.isThisComment)(prevNode, 'variable:ignore')
72
+ // prevNode &&
81
73
  // prevNode.type === 'comment' &&
82
74
  // prevNode.text.toLowerCase() === 'variable:ignore'
83
75
  ) {
84
76
  return;
85
77
  }
86
-
87
78
  if (isIgnoreValuePresent(ignoreVals, decl.prop)) {
88
79
  return;
89
80
  }
90
-
91
81
  if (settingsObject[variables[decl.prop]]) {
92
82
  /* if there is no value for property, set it to default so that undefined doesn't get called as key */
93
83
  if (!variables[decl.prop]) {
94
84
  variables[decl.prop] = 'default';
95
85
  }
96
-
97
86
  const pxReplacement = settingsObject[variables[decl.prop]].replacements.px;
98
87
  let valArr = decl.value.split(' ');
99
88
  valArr = valArr.filter(x => x.trim() !== '');
100
- valArr = valArr.map(x => x.replace(/\r|\t|\n/gi, '')); // single values are considered in the above array and converted below
101
-
89
+ valArr = valArr.map(x => x.replace(/\r|\t|\n/gi, ''));
90
+ // single values are considered in the above array and converted below
102
91
  valArr.forEach((value, index) => {
103
92
  if (value.includes('px')) {
104
93
  if (value.includes('calc')) {
@@ -106,19 +95,15 @@ function variableConverter(rootOriginal, variables, settingsObject) {
106
95
  valArr[index] = `calc( ${res.valOne.trim()} * ${res.valTwo.trim()} )`;
107
96
  return;
108
97
  }
109
-
110
98
  if (/-(\d+)/gi.test(value)) {
111
99
  valArr[index] = convertToCalc(pxReplacement, value);
112
100
  return;
113
101
  }
114
-
115
102
  const num = value.replace('px', '');
116
-
117
103
  if (value) {
118
104
  valArr[index] = pxReplacement.replace('$$', num);
119
105
  }
120
106
  }
121
-
122
107
  if (value.includes('px')) {
123
108
  const num = value.replace('px', '');
124
109
  valArr[index] = pxReplacement.replace('$$', num);
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _utils = require("../utils");
9
-
10
8
  class WebpackWatchRunPlugin {
11
9
  apply(compiler) {
12
10
  compiler.hooks.watchRun.tap('WatchRun', comp => {
13
11
  const changedTimes = comp.watchFileSystem.watcher.mtimes;
14
12
  const changedFiles = Object.keys(changedTimes).map(file => `\n ${file}`).join('');
15
-
16
13
  if (changedFiles.length) {
17
14
  (0, _utils.log)('====================================');
18
15
  (0, _utils.log)('NEW BUILD FILES CHANGED:', changedFiles);
@@ -20,7 +17,5 @@ class WebpackWatchRunPlugin {
20
17
  }
21
18
  });
22
19
  }
23
-
24
20
  }
25
-
26
21
  exports.default = WebpackWatchRunPlugin;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
7
- module.exports = _postcss.default.plugin('postcss-empty', () => (root, result) => {// console.log(root.source.input.from, result);
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
5
+ module.exports = _postcss.default.plugin('postcss-empty', () => (root, result) => {
6
+ // console.log(root.source.input.from, result);
8
7
  });
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
5
  module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
8
6
  const {
9
7
  plugins
@@ -11,10 +9,8 @@ module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
11
9
  return (root, result) => {
12
10
  const inputFile = root.source.input.file;
13
11
  const isIgnoredFile = opts.ignore.some(file => inputFile.indexOf(file) !== -1);
14
-
15
12
  if (!isIgnoredFile) {
16
13
  const handler = response => response.messages.forEach(msg => result.messages.push(msg));
17
-
18
14
  return (0, _postcss.default)(plugins).process(root, {
19
15
  from: undefined
20
16
  }).then(handler);
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
5
  module.exports = _postcss.default.plugin('postcss-include-files', opts => {
8
6
  const {
9
7
  plugins
@@ -11,10 +9,8 @@ module.exports = _postcss.default.plugin('postcss-include-files', opts => {
11
9
  return (root, result) => {
12
10
  const inputFile = root.source.input.file;
13
11
  const includeFile = opts.include.some(file => inputFile.indexOf(file) !== -1);
14
-
15
12
  if (includeFile) {
16
13
  const handler = response => response.messages.forEach(msg => result.messages.push(msg));
17
-
18
14
  return (0, _postcss.default)(plugins).process(root, {
19
15
  from: undefined
20
16
  }).then(handler);
@@ -5,31 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.separateRtlAndLtr = separateRtlAndLtr;
7
7
  exports.separateSingleDir = separateSingleDir;
8
-
9
8
  var postcss = _interopRequireWildcard(require("postcss"));
10
-
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
-
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
-
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
11
  const oppositeDir = {
16
12
  ltr: 'rtl',
17
13
  rtl: 'ltr'
18
14
  };
19
-
20
15
  function compareSelector(selector1, selector2) {
21
16
  return selector1 === selector2;
22
17
  }
23
-
24
18
  const directionRegexs = {
25
19
  ltr: /\[dir=ltr\]/,
26
20
  rtl: /\[dir=rtl\]/
27
21
  };
28
-
29
22
  const getRegex = dir => directionRegexs[dir];
30
-
31
23
  const getOppositeRegex = dir => getRegex(oppositeDir[dir]);
32
-
33
24
  function selectorMinifySameDir(selector, direction) {
34
25
  // NOTE: if this rule is same dir as current need
35
26
  // then we can just remove that [dir=ltr] or [dir=rtl]
@@ -37,18 +28,16 @@ function selectorMinifySameDir(selector, direction) {
37
28
  const regex = getRegex(direction);
38
29
  return selector.replace(regex, '').trim();
39
30
  }
31
+
40
32
  /**
41
33
  * this funtion will remove given rule,
42
34
  * if given selector and it's previous sibiling rule selector are same
43
35
  * current rule properties will move to previous sibiling rule.
44
36
  * @param {Rule} rule current rule
45
37
  */
46
-
47
-
48
38
  function mergeIfSameSelector(rule) {
49
39
  // NOTE: to merge dublicate selector rules
50
40
  const prev = rule.prev();
51
-
52
41
  if (prev && compareSelector(prev.selector, rule.selector)) {
53
42
  rule.each(decl => {
54
43
  prev.append(decl);
@@ -56,26 +45,24 @@ function mergeIfSameSelector(rule) {
56
45
  rule.remove();
57
46
  }
58
47
  }
48
+
59
49
  /**
60
50
  * this funtion will remove given rule,
61
51
  * if given selector and it's previous sibiling rule selector are same
62
52
  * current rule properties will move to previous sibiling rule.
63
53
  * @param {Rule} rule current rule
64
54
  */
65
-
66
-
67
55
  function removeIfOppsiteDirRule(rule, direction, rootOptions) {
68
- const selectors = rule.selector.split(/\s*,\s*/); // NOTE: if we use opposite dir selector as custom override reason,
56
+ const selectors = rule.selector.split(/\s*,\s*/);
57
+
58
+ // NOTE: if we use opposite dir selector as custom override reason,
69
59
  // and compain normal selector with it, In this case
70
60
  // we just a have to remove that selector only not full rule
71
-
72
61
  const oppositeDirRegex = getOppositeRegex(direction);
73
62
  let remainingSelectors = selectors.filter(selector => !oppositeDirRegex.test(selector));
74
-
75
63
  if (!rootOptions.disableMiniFiySelector) {
76
64
  remainingSelectors = remainingSelectors.map(selector => selectorMinifySameDir(selector, direction));
77
65
  }
78
-
79
66
  if (remainingSelectors.length) {
80
67
  rule.selector = remainingSelectors.join(', ');
81
68
  } else {
@@ -83,16 +70,13 @@ function removeIfOppsiteDirRule(rule, direction, rootOptions) {
83
70
  rule.remove();
84
71
  }
85
72
  }
86
-
87
73
  function removeIfOppsiteDirKeyframe(rule, direction) {
88
74
  const name = rule.params;
89
75
  const keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
90
-
91
76
  if (keyFrameDirName === oppositeDir[direction]) {
92
77
  rule.remove();
93
78
  }
94
79
  }
95
-
96
80
  function separateSingleDir(root, direction, rootOptions) {
97
81
  root.walkRules(rule => {
98
82
  removeIfOppsiteDirRule(rule, direction, rootOptions);
@@ -103,12 +87,11 @@ function separateSingleDir(root, direction, rootOptions) {
103
87
  });
104
88
  return root;
105
89
  }
106
-
107
90
  function separateRtlAndLtr(css, rootOptions) {
108
91
  // let processor = postcss([]).process(css);
109
- const root = postcss.parse(css); // let { root } = processor;
92
+ const root = postcss.parse(css);
93
+ // let { root } = processor;
110
94
  // NOTE: I did first rtl then ltr , Because for ltr I use original root ref
111
-
112
95
  const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions);
113
96
  const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
114
97
  return {
@@ -117,8 +100,11 @@ function separateRtlAndLtr(css, rootOptions) {
117
100
  ltr: ltrRoot.toString(),
118
101
  rtl: rtlRoot.toString()
119
102
  };
120
- } // NOTE: to test in https://astexplorer.net/
103
+ }
104
+
105
+ // NOTE: to test in https://astexplorer.net/
121
106
  // you can test with sample input https://astexplorer.net/#/gist/a892a509eb585099355ef53ef094f836/1ca70d5f7af3b88ca4910296e12f118e9712c874
107
+
122
108
  // export default postcss.plugin('postcss-rtl-remove', (options = {}) =>
123
109
  // // Work with options here
124
110
  // root => {
@@ -127,6 +113,7 @@ function separateRtlAndLtr(css, rootOptions) {
127
113
  // // root.append(postcss.comment({ text: 'comment' }));
128
114
  // root.append(postcss.comment({ text: 'this is spliting part ' }));
129
115
  // root.append(rtlRoot);
116
+
130
117
  // // Transform CSS AST here
131
118
  // }
132
119
  // );
@@ -1,63 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
5
  function validator(opts) {
8
6
  if (!opts || typeof opts !== 'object') {
9
7
  throw new Error('Always requires argment');
10
8
  }
11
-
12
9
  const {
13
10
  before,
14
11
  after
15
12
  } = opts;
16
-
17
13
  if (!before || !after) {
18
14
  throw new Error('Be sure to have "before" and "after" object names');
19
15
  }
20
-
21
16
  if (!Array.isArray(before) || !Array.isArray(after)) {
22
17
  throw new Error('Objects "before" and "after" must be of type Array');
23
18
  }
24
-
25
19
  if (before.length !== after.length) {
26
20
  throw new Error('Length of before and after options must be the same');
27
21
  }
28
-
29
22
  if (before.length === 0) {
30
23
  throw new Error('Array length is 1 or more');
31
24
  }
32
-
33
25
  before.forEach((beforeOpt, idx) => {
34
26
  const afterOpt = after[idx];
35
-
36
27
  switch (true) {
37
28
  case typeof beforeOpt === 'string':
38
29
  {
39
30
  if (!typeof afterOpt === 'string') {
40
31
  throw new Error(`The after option ${afterOpt} must be a string. If you want to apply the replace callback function, then use a RegExp for the before option`);
41
32
  }
42
-
43
33
  break;
44
34
  }
45
-
46
35
  case beforeOpt instanceof RegExp:
47
36
  {
48
37
  if (!typeof afterOpt === 'string' && !typeof afterOpt === 'function') {
49
38
  throw new Error(`The after option ${afterOpt} must be either a string, or a function`);
50
39
  }
51
-
52
40
  break;
53
41
  }
54
-
55
42
  default:
56
43
  throw new Error(`The before option ${beforeOpt} must be either a string, or a RegExp`);
57
44
  }
58
45
  });
59
46
  }
60
-
61
47
  module.exports = _postcss.default.plugin('postcss-selector-replace-new', opts => {
62
48
  validator(opts);
63
49
  const {
@@ -68,7 +54,6 @@ module.exports = _postcss.default.plugin('postcss-selector-replace-new', opts =>
68
54
  root.walkRules(rule => {
69
55
  before.forEach((beforeOpt, idx) => {
70
56
  const afterOpt = after[idx];
71
-
72
57
  if (typeof beforeOpt === 'string') {
73
58
  rule.selector = rule.selector.split(beforeOpt).join(afterOpt);
74
59
  } else {
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
7
- module.exports = _postcss.default.plugin('postcss-value-replacer', (valueReplacer = {}) => // Work with options here
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
5
+ module.exports = _postcss.default.plugin('postcss-value-replacer', (valueReplacer = {}) =>
6
+ // Work with options here
8
7
  root => {
9
8
  root.walkDecls(decl => {
10
9
  valueReplacer.forEach(obj => {
@@ -17,9 +16,11 @@ root => {
17
16
  } else {
18
17
  decl.value = decl.value.replace(k, obj.values[k]);
19
18
  }
20
- }); //decl.value = obj.values[decl.value];
19
+ });
20
+ //decl.value = obj.values[decl.value];
21
21
  }
22
- }); //console.log({root, roots:root+""}, root+"")
22
+ });
23
+ //console.log({root, roots:root+""}, root+"")
23
24
  // Transform CSS AST here
24
25
  });
25
26
  });
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const fs = require('fs');
4
-
5
4
  const postcss = require('postcss');
6
-
7
5
  function expectRunPostCss(inputFile, outputfile, cb) {
8
6
  const inputStr = fs.readFileSync(inputFile, 'utf-8');
9
7
  postcss(plugins).process(inputStr, {
@@ -14,7 +12,6 @@ function expectRunPostCss(inputFile, outputfile, cb) {
14
12
  cb();
15
13
  });
16
14
  }
17
-
18
15
  describe('To Check Hover active postcss Plugin ', () => {
19
16
  test('should handle normal rule hover', cb => {
20
17
  expectRunPostCss('test1Input.css', 'test1Output.css', cb);
@@ -11,18 +11,21 @@ let settings2 = {
11
11
  before: [':root', 'data-'],
12
12
  after: [':global .zohodesk_controlpanel,:global .wms-mainui,:global .wms-hysearch, :global .mcf1ee8b17_overlay,:global .wms-hvalign, :global .KB_Editor_UploadImage,:global .zdeskEditor_popup, :global .ze_dd, :global .__baseZC_Container__', 'test-']
13
13
  }
14
- }; //error case
14
+ };
15
15
 
16
+ //error case
16
17
  let settings3 = {
17
18
  selectorReplace: {
18
19
  before: [':root', 'data-'],
19
20
  after: [':global .zohodesk_controlpanel,:global .wms-mainui,:global .wms-hysearch, :global .mcf1ee8b17_overlay,:global .wms-hvalign, :global .KB_Editor_UploadImage,:global .zdeskEditor_popup, :global .ze_dd, :global .__baseZC_Container__']
20
21
  }
21
- }; //error case
22
+ };
22
23
 
24
+ //error case
23
25
  let settings4 = {
24
26
  selectorReplace: {
25
27
  before: [':root'],
26
28
  after: [':global .zohodesk_controlpanel,:global .wms-mainui,:global .wms-hysearch, :global .mcf1ee8b17_overlay,:global .wms-hvalign, :global .KB_Editor_UploadImage,:global .zdeskEditor_popup, :global .ze_dd, :global .__baseZC_Container__', 'test-']
27
29
  }
28
- }; // here conversion happens for data from one index to another
30
+ };
31
+ // here conversion happens for data from one index to another