@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
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
-
5
4
  var _ValueReplacer = _interopRequireDefault(require("../ValueReplacer"));
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
5
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
6
  /* eslint-disable no-use-before-define */
7
+
10
8
  describe('postcss value replacer tests', () => {
11
9
  it('is creating value replaced code', () => {
12
10
  const cssInputStr = `.abc{ cursor : text }`;
@@ -37,7 +35,6 @@ describe('postcss value replacer tests', () => {
37
35
  expect(result.css).toEqual(cssOutputStr);
38
36
  });
39
37
  });
40
-
41
38
  function runValueReplacerForCssString(cssInputStr, cssOptions) {
42
39
  return (0, _postcss.default)([(0, _ValueReplacer.default)(cssOptions)]).process(cssInputStr);
43
40
  }
@@ -1,28 +1,24 @@
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
  /**
8
6
  * we have give support for ignore(exclude) comments
9
7
  * These are the comments' keyword
10
8
  */
11
9
  const hoverIgnoreQuery = 'Hover:ignore',
12
- activeIgnoreQuery = 'Active:ignore',
13
- hoverActiveIgnoreQuery = 'HoverActive:ignore';
10
+ activeIgnoreQuery = 'Active:ignore',
11
+ hoverActiveIgnoreQuery = 'HoverActive:ignore';
14
12
  const medHoverIgnoreQuery = 'MedHover:ignore',
15
- medActiveIgnoreQuery = 'MedActive:ignore',
16
- medHoverActiveIgnoreQuery = 'MedHoverActive:ignore';
13
+ medActiveIgnoreQuery = 'MedActive:ignore',
14
+ medHoverActiveIgnoreQuery = 'MedHoverActive:ignore';
17
15
  let hoverMedQuerySuffix = '';
18
16
  let hoverNoneMedQuerySuffix = '';
19
17
  const ruleIgnoreCommentRegex = /(Hover:ignore|Active:ignore|HoverActive:ignore)/g;
20
18
  const mediaQueryIgnoreCommentRegex = /(MedHover:ignore|MedActive:ignore|MedHoverActive:ignore)/g;
21
-
22
19
  function isComment(node) {
23
20
  return node && node.type === 'comment' && node.text !== undefined;
24
21
  }
25
-
26
22
  function isHoverPresent(atrule) {
27
23
  let hoverPresent = false;
28
24
  atrule.walkRules(rule => {
@@ -32,7 +28,6 @@ function isHoverPresent(atrule) {
32
28
  });
33
29
  return hoverPresent;
34
30
  }
35
-
36
31
  function checkForUsualClass(root, sel) {
37
32
  let present = false;
38
33
  sel.split(',').forEach(value => {
@@ -47,31 +42,24 @@ function checkForUsualClass(root, sel) {
47
42
  });
48
43
  return present;
49
44
  }
50
-
51
45
  module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHoverActiveString => rootOriginal => {
52
46
  const hoverRules = [];
53
47
  const positionsObj = {};
54
48
  hoverMedQuerySuffix = mediaQueryHoverActiveString.hover;
55
49
  hoverNoneMedQuerySuffix = mediaQueryHoverActiveString.none;
56
-
57
50
  function isRuleHasIgnoreComment(index, type) {
58
51
  const prevNode = rootOriginal.nodes[index - 1];
59
-
60
52
  if (isComment(prevNode)) {
61
53
  return prevNode.text === type;
62
54
  }
63
-
64
55
  return false;
65
56
  }
66
-
67
57
  function isMediaQueryHasIgnoreComment(node, type) {
68
58
  if (isComment(node)) {
69
59
  return node.text === type;
70
60
  }
71
-
72
61
  return false;
73
62
  }
74
-
75
63
  function hasIgnoreComment({
76
64
  index,
77
65
  atrule,
@@ -80,14 +68,11 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
80
68
  if (type.match(mediaQueryIgnoreCommentRegex)) {
81
69
  return isMediaQueryHasIgnoreComment(atrule.nodes[index - 1], type.slice(3));
82
70
  }
83
-
84
71
  if (type.match(ruleIgnoreCommentRegex)) {
85
72
  return isRuleHasIgnoreComment(index, type);
86
73
  }
87
-
88
74
  return false;
89
75
  }
90
-
91
76
  function getPositionsOfHoverAndActiveMedQueries(parent) {
92
77
  const allNodes = rootOriginal.nodes;
93
78
  const hoverMediaQuery = `${parent.params} and ${hoverMedQuerySuffix}`;
@@ -98,7 +83,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
98
83
  };
99
84
  return positions;
100
85
  }
101
-
102
86
  function handleMedHoverAndHoverActiveIgnore(atrule, index) {
103
87
  return !hasIgnoreComment({
104
88
  atrule,
@@ -110,7 +94,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
110
94
  type: medHoverActiveIgnoreQuery
111
95
  });
112
96
  }
113
-
114
97
  function handleMedActiveAndHoverActiveIgnore(atrule, index) {
115
98
  return !hasIgnoreComment({
116
99
  atrule,
@@ -122,7 +105,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
122
105
  type: medHoverActiveIgnoreQuery
123
106
  });
124
107
  }
125
-
126
108
  function handleHoverAndHoverActiveIgnore(index) {
127
109
  return !hasIgnoreComment({
128
110
  index,
@@ -132,7 +114,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
132
114
  type: hoverActiveIgnoreQuery
133
115
  });
134
116
  }
135
-
136
117
  function handleActiveAndHoverActiveIgnore(index) {
137
118
  return !hasIgnoreComment({
138
119
  index,
@@ -142,7 +123,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
142
123
  type: hoverActiveIgnoreQuery
143
124
  });
144
125
  }
145
-
146
126
  function handleAllIgnoreCases(index) {
147
127
  return !hasIgnoreComment({
148
128
  index,
@@ -155,7 +135,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
155
135
  type: hoverActiveIgnoreQuery
156
136
  });
157
137
  }
158
-
159
138
  function mediaCommaQuery(rule, index) {
160
139
  if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
161
140
  let newSelector = '';
@@ -167,16 +146,12 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
167
146
  const actQueries = [];
168
147
  rule.selector.split(/\s*,\s*/).forEach(_subrule => {
169
148
  const subrule = _subrule.trim();
170
-
171
149
  const clone = rule.clone();
172
-
173
150
  if (subrule.includes('hover')) {
174
151
  clone.selector = subrule;
175
-
176
152
  if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
177
153
  hovQueries.push(subrule);
178
154
  }
179
-
180
155
  if (handleMedActiveAndHoverActiveIgnore(rule.parent, index)) {
181
156
  actQueries.push(subrule);
182
157
  }
@@ -184,13 +159,11 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
184
159
  newSelector += `${subrule}, `;
185
160
  }
186
161
  });
187
-
188
162
  if (hovQueries.length > 0) {
189
163
  const clone = rule.clone();
190
164
  clone.selector = hovQueries.join(',');
191
165
  hovMed.append(clone);
192
166
  }
193
-
194
167
  if (actQueries.length > 0) {
195
168
  const clone = rule.clone();
196
169
  clone.selector = actQueries.join(',');
@@ -198,29 +171,24 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
198
171
  selector: clone.selector.replace(/:hover/gi, ':active')
199
172
  }));
200
173
  }
201
-
202
174
  if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
203
175
  rule.selector = newSelector.substring(0, newSelector.length - 2);
204
176
  }
205
-
206
177
  if (rule.selector === '') {
207
178
  rule.remove();
208
179
  }
209
180
  }
210
181
  }
211
-
212
182
  function mediaQuery(rule, index) {
213
183
  if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
214
184
  const {
215
185
  hovMed,
216
186
  actMed
217
187
  } = getPositionsOfHoverAndActiveMedQueries(rule.parent);
218
-
219
188
  if (rule.selector.includes('hover') && hovMed !== undefined && rule.parent.type === 'atrule') {
220
189
  if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
221
190
  hovMed.append(rule);
222
191
  }
223
-
224
192
  if (handleMedActiveAndHoverActiveIgnore(rule.parent, index)) {
225
193
  actMed.append(rule.clone({
226
194
  selector: rule.selector.replace(/:hover/gi, ':active')
@@ -229,13 +197,11 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
229
197
  }
230
198
  }
231
199
  }
232
-
233
200
  function commaQuery(rule, index) {
234
201
  let newSelector = '';
235
202
  const hovQueries = [];
236
203
  rule.selector.split(/\s*,\s*/).forEach(_subrule => {
237
204
  const subrule = _subrule.trim();
238
-
239
205
  if (subrule.includes('hover')) {
240
206
  // hoverRules.push({ rule: clone, index });
241
207
  hovQueries.push(subrule);
@@ -243,7 +209,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
243
209
  newSelector += `${subrule}, `;
244
210
  }
245
211
  });
246
-
247
212
  if (hovQueries.length > 0) {
248
213
  const clone = rule.clone();
249
214
  clone.selector = hovQueries.join(',');
@@ -252,23 +217,20 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
252
217
  index
253
218
  });
254
219
  }
255
-
256
220
  if (handleHoverAndHoverActiveIgnore(index)) {
257
221
  if (checkForUsualClass(rootOriginal, rule.selector)) {
258
222
  rule.selector = newSelector.substring(0, newSelector.length - 2).trim();
259
223
  }
260
224
  }
261
-
262
225
  if (rule.selector === '') {
263
226
  rule.remove();
264
227
  }
265
- } // Start by identifying all :hover rules
266
-
228
+ }
267
229
 
230
+ // Start by identifying all :hover rules
268
231
  rootOriginal.walkAtRules(atrule => {
269
232
  const hoverQuery = `${atrule.params} and ${hoverMedQuerySuffix}`;
270
233
  const activeQuery = `${atrule.params} and ${hoverNoneMedQuerySuffix}`;
271
-
272
234
  if (isHoverPresent(atrule)) {
273
235
  if (!positionsObj[hoverQuery] && !positionsObj[activeQuery]) {
274
236
  rootOriginal.append({
@@ -291,17 +253,17 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
291
253
  } else {
292
254
  // plus, space and other media queries
293
255
  mediaQuery(rule, index);
294
- } // usual hover query
295
-
256
+ }
296
257
 
258
+ // usual hover query
297
259
  if (!rule.selector.match(/,+| +|\++/g) && rule.parent !== undefined && rule.parent.name === undefined) {
298
260
  hoverRules.push({
299
261
  rule,
300
262
  index
301
263
  });
302
- } //usual hover query with ',' ' ' '+'
303
-
264
+ }
304
265
 
266
+ //usual hover query with ',' ' ' '+'
305
267
  if (rule.selector.match(/,+| +|\++/g) && rule.parent.name === undefined) {
306
268
  if (rule.selector.includes(',')) {
307
269
  commaQuery(rule, index);
@@ -310,66 +272,69 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
310
272
  hoverRules.push({
311
273
  rule,
312
274
  index
313
- }); //rule.remove();
275
+ });
276
+ //rule.remove();
314
277
  }
315
278
  }
316
279
  }
317
- }); // If there are any :hover rules in the input, then create media queries
280
+ });
281
+ // If there are any :hover rules in the input, then create media queries
318
282
  // to automatically translate it into :active on touch-based devices
319
-
320
283
  if (hoverRules.length > 0) {
321
284
  // Create a media query targetting devices that actually support
322
285
  // hover
323
286
  const hoverQuery = rootOriginal.append({
324
287
  name: 'media',
325
288
  params: `${hoverMedQuerySuffix}`
326
- }).last; // Create a media query targetting devices that don't support hover
289
+ }).last;
290
+ // Create a media query targetting devices that don't support hover
327
291
  // (ie. devices where we should fall back to :active instead)
328
-
329
292
  const activeQuery = rootOriginal.append({
330
293
  name: 'media',
331
294
  params: `${hoverNoneMedQuerySuffix}`
332
- }).last; // Loop through the hover rules and apply them to each of the media
295
+ }).last;
296
+
297
+ // Loop through the hover rules and apply them to each of the media
333
298
  // queries
334
299
  // eslint-disable-next-line no-labels
335
-
336
300
  outerLoop: for (const hoverRule of hoverRules) {
337
301
  // determine if the rule has been nested inside another media
338
302
  // query; in that case bail out as we have no way of reliably
339
303
  // nesting these queries
340
304
  let parentRule = hoverRule.rule.parent;
341
-
342
305
  while (parentRule) {
343
306
  if (parentRule.type === 'atrule' && parentRule.name === 'media') {
344
307
  // eslint-disable-next-line no-labels
345
308
  continue outerLoop;
346
309
  }
347
-
348
310
  parentRule = parentRule.parent;
349
- } // Push a clone of the :hover rule 'as is' to queries where we
311
+ }
312
+
313
+ // Push a clone of the :hover rule 'as is' to queries where we
350
314
  // expect the user's device to support hover
351
315
  // ieQuery.append(hoverRule.clone());
352
316
 
353
-
354
317
  if (handleHoverAndHoverActiveIgnore(hoverRule.index)) {
355
318
  hoverQuery.append(hoverRule.rule.clone());
356
- } // Push a clone of the :hover rule, where we transform the
319
+ }
320
+
321
+ // Push a clone of the :hover rule, where we transform the
357
322
  // selector to :active to the query targetting devices that
358
323
  // don't support hover
359
-
360
-
361
324
  if (handleActiveAndHoverActiveIgnore(hoverRule.index)) {
362
325
  activeQuery.append(hoverRule.rule.clone({
363
326
  selector: hoverRule.rule.selector.replace(/:hover/gi, ':active')
364
327
  }));
365
- } // remove legacy rule from output
366
-
328
+ }
367
329
 
330
+ // remove legacy rule from output
368
331
  if (handleAllIgnoreCases(hoverRule.index)) {
369
332
  hoverRule.rule.remove();
370
333
  }
371
334
  }
372
- } // rootOriginal.walkAtRules(atrule => {
335
+ }
336
+
337
+ // rootOriginal.walkAtRules(atrule => {
373
338
  // if (
374
339
  // (atrule !== undefined &&
375
340
  // atrule.nodes !== undefined &&
@@ -379,5 +344,4 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
379
344
  // atrule.remove();
380
345
  // }
381
346
  // });
382
-
383
347
  });
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ErrorHandler = void 0;
7
-
8
7
  class ErrorHandler {
9
8
  constructor(allowedErrs) {
10
9
  this.errors = [];
@@ -20,7 +19,6 @@ class ErrorHandler {
20
19
  MULTIPLE_OCCURANCES: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}`)
21
20
  });
22
21
  }
23
-
24
22
  setAllowedErrs(allErrs) {
25
23
  this.allowedErrs = allErrs;
26
24
  ['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT', 'MULTIPLE_OCCURANCES'].forEach(err => {
@@ -29,17 +27,14 @@ class ErrorHandler {
29
27
  }
30
28
  });
31
29
  }
32
-
33
30
  addError(errstr) {
34
31
  this.errors.push(`{\n${errstr}\n}\n`);
35
32
  }
36
-
37
33
  errorFunction(errObj) {
38
34
  if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
39
35
  this[errObj.type](errObj);
40
36
  }
41
37
  }
42
-
43
38
  printError(errObj) {
44
39
  console.log('{');
45
40
  Object.keys(errObj).sort().forEach(key => {
@@ -53,7 +48,5 @@ class ErrorHandler {
53
48
  });
54
49
  console.log('}\n');
55
50
  }
56
-
57
51
  }
58
-
59
52
  exports.ErrorHandler = ErrorHandler;
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  const postcss = require('postcss');
4
-
5
4
  const fs = require('fs');
6
-
7
5
  const path = require('path');
8
-
9
6
  const {
10
7
  ErrorHandler
11
8
  } = require('./ErrorHandler');
12
-
13
9
  const errHandler = new ErrorHandler();
14
10
  const convertableProps = {
15
11
  'font-size': true,
@@ -55,35 +51,30 @@ const constantValues = {
55
51
  center: true,
56
52
  right: true
57
53
  };
58
-
59
54
  function getNumericValue(value) {
60
55
  if (value.includes('var')) {
61
56
  return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
62
57
  }
63
-
64
58
  if (value.includes('rect')) {
65
59
  return parseInt(value.replace('rect(', '').replace(')', '').replace(',', ''));
66
- } // Not need for this dum loop
60
+ }
61
+ // Not need for this dum loop
67
62
  // allowed.forEach(alwdUnit => {
68
63
  // if (value.includes(alwdUnit)) {
69
64
  // return parseInt(value);
70
65
  // }
71
66
  // });
72
67
 
73
-
74
68
  if (constantValues[value.toLowerCase()]) {
75
69
  return 1;
76
70
  }
77
-
78
71
  return parseInt(value);
79
72
  }
80
-
81
73
  function pxToCalc(value) {
82
74
  const arr = value.split(' ');
83
75
  arr.forEach((val, index) => {
84
76
  ['px'].forEach(unit => {
85
77
  const valWithUnit = new RegExp(`(\\d+)${unit}`, 'gi');
86
-
87
78
  if (valWithUnit.test(val)) {
88
79
  arr[index] = val.replace(valWithUnit, '(var(--zd_size$1))');
89
80
  }
@@ -91,7 +82,6 @@ function pxToCalc(value) {
91
82
  });
92
83
  return arr.join(' ');
93
84
  }
94
-
95
85
  const singleConvertor = ({
96
86
  value,
97
87
  changeVal,
@@ -104,35 +94,28 @@ const singleConvertor = ({
104
94
  filename,
105
95
  decl
106
96
  } = details;
107
-
108
97
  if (decl.prop === 'background-position') {
109
98
  if (isNaN(parseInt(value))) {
110
99
  // console.log(`${value} skipped`);
111
100
  return;
112
101
  }
113
102
  }
114
-
115
103
  if (allowed && allowed.includes(decl.value) && decl.value.toString() !== '0') {
116
104
  return decl.value;
117
105
  }
118
-
119
106
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
120
107
  if (value.trim() === '0px') {
121
108
  return '0';
122
109
  }
123
-
124
110
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
125
-
126
111
  if (/^-var/.test(retVal)) {
127
112
  retVal = `calc( ${retVal.substring(1)} * -1 )`;
128
113
  }
129
-
130
114
  return retVal;
131
- } // if (!value.includes('rect')) {
115
+ }
116
+ // if (!value.includes('rect')) {
132
117
  // if(unitErrorVal && unitErrorVal != '0' ){
133
118
  // console.log(value, 'not within range')
134
-
135
-
136
119
  const errObj = {
137
120
  decl,
138
121
  type: 'RANGE_ERROR',
@@ -144,18 +127,17 @@ const singleConvertor = ({
144
127
  errHandler.errorFunction(errObj);
145
128
  return;
146
129
  };
147
-
148
130
  module.exports = {
149
131
  plugin: postcss.plugin('postcss-variable-report', cssVariableReplacementConfig => {
150
132
  const rawdata = fs.readFileSync(cssVariableReplacementConfig);
151
133
  const data = JSON.parse(rawdata);
152
134
  const {
153
135
  errorsAllowed,
154
- settings: settingsObject // errorLog: errorLogStatus,
136
+ settings: settingsObject
137
+ // errorLog: errorLogStatus,
155
138
  // errorInConsole: errorConsoleStatus
156
-
157
- } = data; // const keys = Object.keys(settingsObject);
158
-
139
+ } = data;
140
+ // const keys = Object.keys(settingsObject);
159
141
  errHandler.setAllowedErrs(errorsAllowed);
160
142
  const replacementArray = [];
161
143
  Object.keys(settingsObject).forEach(key => {
@@ -183,12 +165,12 @@ module.exports = {
183
165
  // case font-size
184
166
  const commentStr = 'variable:ignore';
185
167
  const prevNode = rule.nodes[position - 1];
186
- const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
168
+ const fromPath = rootOriginal.source.input.from;
169
+ // this will be problem for linux and mac use require('path').sep
187
170
  // split not need use slice and lastIndexOf less memory
188
-
189
- const filename = fromPath.split(path.sep).pop(); // if(filename.includes('AddFormResponsive.module.css'){
171
+ const filename = fromPath.split(path.sep).pop();
172
+ // if(filename.includes('AddFormResponsive.module.css'){
190
173
  // }
191
-
192
174
  if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
193
175
  const errObj = {
194
176
  decl,
@@ -201,28 +183,29 @@ module.exports = {
201
183
  errHandler.DECLARATION_IGNORED(errObj);
202
184
  return;
203
185
  }
204
-
205
186
  if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
206
187
  const settings = settingsObject[decl.prop];
207
188
  const {
208
189
  allowed,
209
190
  range
210
- } = settings; // suggestion filter !decl.value.includes('calc')
191
+ } = settings;
192
+ // suggestion filter !decl.value.includes('calc')
211
193
  // Reason below some of logic happen based on this
212
-
213
- const unit = decl.value.toString() // no need round braket since you do not need group for less memory
214
- .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
194
+ const unit = decl.value.toString()
195
+ // no need round braket since you do not need group for less memory
196
+ .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== '');
197
+ // unit = unit.replace(unit, unit.replace('-',''))
215
198
  // console.log('unit : ');
216
199
  // console.log(unit);
217
200
  // if (decl.prop === 'height') {
218
201
  // console.log(decl.prop, unit, 'case 1');
219
202
  // }
220
-
221
203
  unit.forEach((val, index) => {
222
204
  allowed.forEach(alwdVal => {
223
205
  if (val.includes(alwdVal)) {
224
206
  // ## for what purpose
225
- unit[index] = val // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
207
+ unit[index] = val
208
+ // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
226
209
  .replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`).replace(`${alwdVal},`, `${alwdVal}`);
227
210
  }
228
211
  });
@@ -236,29 +219,27 @@ module.exports = {
236
219
  unitErrorVal = val;
237
220
  }
238
221
  }
239
- }); // if (decl.prop === 'height') {
222
+ });
223
+ // if (decl.prop === 'height') {
240
224
  // console.log(decl.prop, unitErrorVal, unitError, unit, 'case 2');
241
225
  // }
242
226
  // console.log(allowed, replacements, range)
243
-
244
227
  if (!unitError) {
245
228
  let calcValue = false;
246
-
247
229
  if (decl.value.includes('calc')) {
248
230
  decl.value = pxToCalc(decl.value);
249
231
  calcValue = true;
250
- } // use variable decl.value.split(' ')
251
-
252
-
232
+ }
233
+ // use variable decl.value.split(' ')
253
234
  if (range && !calcValue) {
254
235
  // console.log('multiple :', decl.value)
255
- const tempVal = decl.value; // if (decl.prop === 'height') {
236
+ const tempVal = decl.value;
237
+ // if (decl.prop === 'height') {
256
238
  // console.log(decl.prop, tempVal, decl.value, allowed, 'case 3');
257
239
  // }
258
240
  // if (decl.prop === 'height') {
259
241
  // console.log('allowed!', decl.prop, decl.value, allowed);
260
242
  // }
261
-
262
243
  let newVal = '';
263
244
  let splitValues = decl.value.split(' ');
264
245
  splitValues = splitValues.filter(val => val.trim() !== '');
@@ -276,7 +257,8 @@ module.exports = {
276
257
  allowed
277
258
  })} `;
278
259
  });
279
- decl.value = newVal; // if (decl.prop === 'height') {
260
+ decl.value = newVal;
261
+ // if (decl.prop === 'height') {
280
262
  // console.log(decl.prop, tempVal, newVal, 'case 4');
281
263
  // }
282
264
  }
@@ -289,7 +271,6 @@ module.exports = {
289
271
  unitErrorVal: unitErrorVal,
290
272
  path: fromPath
291
273
  };
292
-
293
274
  if (unitErrorVal.trim() === '.') {
294
275
  errObj.type = 'DECIMAL_CHECK';
295
276
  errObj.message = `${unitErrorVal} (Decimal Value) Please check`;
@@ -335,12 +316,10 @@ module.exports = {
335
316
  });
336
317
  return convertedVal ? convertedVal : val;
337
318
  }
338
-
339
319
  return val;
340
320
  });
341
321
  decl.value = convertedVals.join(' ');
342
322
  }
343
-
344
323
  if (decl.prop && decl.value && !decl.prop.includes('--') && valRegex.test(decl.value) && (settingsObject[decl.prop] || convertableProps[decl.prop]) && decl.value.includes('var') && !decl.value.includes('calc')) {
345
324
  const errObj = {
346
325
  decl,
@@ -4,17 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _os = require("os");
9
-
10
8
  var _getIp = _interopRequireDefault(require("../utils/getIp"));
11
-
12
9
  var _getCurrentBranch = _interopRequireDefault(require("../utils/getCurrentBranch"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
11
  // TODO move deprecated options to separate file and manage seperately
17
- var _default = {
12
+ var _default = exports.default = {
18
13
  alias: null,
19
14
  unstableDepsInverse: {
20
15
  value: false,
@@ -763,5 +758,4 @@ var _default = {
763
758
  value: false,
764
759
  cli: 'enable_typescript'
765
760
  }
766
- };
767
- exports.default = _default;
761
+ };