@zohodesk/react-cli 0.0.1-test.148.2 → 1.0.0

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 (174) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -183
  3. package/.prettierrc +6 -0
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +1152 -678
  7. package/bin/cli.js +483 -392
  8. package/docs/CustomChunks.md +26 -0
  9. package/docs/DevServerPort.md +39 -0
  10. package/docs/DevStart.md +18 -0
  11. package/docs/HoverActive.md +12 -0
  12. package/docs/InstallNode.md +28 -0
  13. package/docs/SelectorWeight.md +6 -0
  14. package/docs/TODOS.md +10 -0
  15. package/docs/ValueReplacer.md +60 -0
  16. package/docs/VariableConversion.md +724 -0
  17. package/docs/warnings_while_install.txt +35 -0
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/common/index.js +6 -6
  21. package/lib/common/splitChunks.js +60 -12
  22. package/lib/common/sslcertUpdater.js +59 -0
  23. package/lib/common/testPattern.js +69 -0
  24. package/lib/common/valueReplacer.js +55 -0
  25. package/lib/configs/jest.config.js +18 -8
  26. package/lib/configs/libAlias.js +38 -0
  27. package/lib/configs/resolvers.js +40 -0
  28. package/lib/configs/webpack.css.umd.config.js +4 -4
  29. package/lib/configs/webpack.dev.config.js +59 -54
  30. package/lib/configs/webpack.docs.config.js +56 -53
  31. package/lib/configs/webpack.impact.config.js +54 -50
  32. package/lib/configs/webpack.prod.config.js +72 -47
  33. package/lib/constants.js +31 -0
  34. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  35. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  36. package/lib/loaderUtils/getCSSLoaders.js +89 -21
  37. package/lib/loaderUtils/index.js +4 -4
  38. package/lib/loaderUtils/windowsModification.js +11 -0
  39. package/lib/loaders/fileBountryLoader.js +17 -0
  40. package/lib/loaders/scriptInstrumentLoader.js +2 -2
  41. package/lib/loaders/selectorMappingLoader.js +75 -0
  42. package/lib/loaders/workerLoader.js +9 -9
  43. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  44. package/lib/pluginUtils/getDevPlugins.js +69 -45
  45. package/lib/pluginUtils/getDocsPlugins.js +6 -8
  46. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  47. package/lib/pluginUtils/getProdPlugins.js +73 -58
  48. package/lib/pluginUtils/index.js +12 -12
  49. package/lib/plugins/CdnChangePlugin.js +16 -2
  50. package/lib/plugins/EFCPlugin.js +52 -20
  51. package/lib/plugins/EFCPlugin.md +6 -0
  52. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  53. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  54. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  55. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  56. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  57. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
  58. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  59. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  60. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  61. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  62. package/lib/plugins/ManifestPlugin.js +8 -0
  63. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  64. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  65. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +11 -7
  66. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  67. package/lib/plugins/SelectorPlugin.js +97 -0
  68. package/lib/plugins/ServiceWorkerPlugin.js +13 -9
  69. package/lib/plugins/SourceMapHookPlugin.js +9 -3
  70. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  71. package/lib/plugins/VariableConversionCollector.js +352 -0
  72. package/lib/plugins/composeCommonPlugin.js +30 -0
  73. package/lib/plugins/index.js +36 -36
  74. package/lib/plugins/libraryImpactPlugin.js +14 -2
  75. package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
  76. package/lib/postcss-plugins/RTLSplitPlugin.js +36 -32
  77. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  78. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  79. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  80. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  81. package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
  82. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
  83. package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
  84. package/lib/postcss-plugins/variableModifier.js +244 -0
  85. package/lib/schemas/index.js +166 -11
  86. package/lib/servers/devBuild.js +102 -0
  87. package/lib/servers/docsServerCore.js +16 -18
  88. package/lib/servers/getCliPath.js +28 -0
  89. package/lib/servers/httpsOptions.js +49 -0
  90. package/lib/servers/nowatchserver.js +206 -0
  91. package/lib/servers/server.js +114 -82
  92. package/lib/sh/pre-commit.sh +34 -34
  93. package/lib/sh/reportPublish.sh +45 -45
  94. package/lib/templates/linterConstant.js +1 -1
  95. package/lib/utils/buildstats.html +148 -148
  96. package/lib/utils/cssClassNameGenerate.js +9 -2
  97. package/lib/utils/cssURLReplacer.js +30 -43
  98. package/lib/utils/getCurrentBranch.js +1 -1
  99. package/lib/utils/getDependenciesImpactList.js +14 -12
  100. package/lib/utils/getFileType.js +49 -0
  101. package/lib/utils/getOptions.js +118 -10
  102. package/lib/utils/index.js +44 -20
  103. package/lib/utils/jsonHelper.js +12 -3
  104. package/lib/utils/reinstallDependencies.js +1 -1
  105. package/lib/utils/repoClone.js +16 -4
  106. package/lib/utils/resultSchema.json +73 -73
  107. package/lib/utils/rtl.js +19 -2
  108. package/lib/utils/useExitCleanup.js +55 -0
  109. package/npm8.md +9 -0
  110. package/package.json +121 -142
  111. package/postpublish.js +8 -0
  112. package/result.json +1 -0
  113. package/templates/app/.eslintrc.js +140 -140
  114. package/templates/app/README.md +12 -12
  115. package/templates/app/app/index.html +24 -24
  116. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  117. package/templates/app/app/properties/i18nkeys.json +3 -3
  118. package/templates/app/docs/all.html +69 -69
  119. package/templates/app/mockapi/index.js +18 -18
  120. package/templates/app/package.json +37 -37
  121. package/templates/app/src/actions/SampleActions/index.js +37 -37
  122. package/templates/app/src/actions/index.js +65 -65
  123. package/templates/app/src/appUrls.js +19 -19
  124. package/templates/app/src/components/Alert/Alert.js +134 -134
  125. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  126. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  127. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  128. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  129. package/templates/app/src/components/Sample/SampleList.js +61 -61
  130. package/templates/app/src/components/Slider/Slider.css +41 -41
  131. package/templates/app/src/components/Slider/Slider.js +55 -55
  132. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  133. package/templates/app/src/containers/AppContainer/index.js +96 -96
  134. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  135. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  136. package/templates/app/src/containers/DevTools/index.js +10 -10
  137. package/templates/app/src/containers/Header/index.js +67 -67
  138. package/templates/app/src/containers/Header/index.module.css +43 -43
  139. package/templates/app/src/containers/Redirect/index.js +63 -63
  140. package/templates/app/src/containers/Redirector/index.js +47 -47
  141. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  142. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  143. package/templates/app/src/historyChange.js +5 -5
  144. package/templates/app/src/index.html +10 -10
  145. package/templates/app/src/index.js +24 -24
  146. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  147. package/templates/app/src/reducers/alertData.js +11 -11
  148. package/templates/app/src/reducers/index.js +6 -6
  149. package/templates/app/src/reducers/samples.js +19 -19
  150. package/templates/app/src/store/configureStore.dev.js +51 -51
  151. package/templates/app/src/store/configureStore.js +5 -5
  152. package/templates/app/src/store/configureStore.prod.js +26 -26
  153. package/templates/app/src/util/Common.js +5 -5
  154. package/templates/app/src/util/RequestAPI.js +132 -132
  155. package/templates/docs/all.html +249 -249
  156. package/templates/docs/component.html +178 -178
  157. package/templates/docs/components.html +221 -221
  158. package/templates/docs/css/b.min.css +6 -6
  159. package/templates/docs/css/component.css +42 -42
  160. package/templates/docs/css/componentTest.css +6 -6
  161. package/templates/docs/css/hopscotch.css +585 -585
  162. package/templates/docs/css/style.css +1022 -1022
  163. package/templates/docs/impactReportTemplate.html +154 -154
  164. package/templates/docs/index.html +1501 -1493
  165. package/templates/docs/js/active-line.js +72 -72
  166. package/templates/docs/js/b.min.js +7 -7
  167. package/templates/docs/js/codemirror.js +9680 -9680
  168. package/templates/docs/js/designTokens.js +334 -334
  169. package/templates/docs/js/j.min.js +4 -4
  170. package/templates/docs/js/javascript.js +874 -874
  171. package/templates/docs/js/matchbrackets.js +145 -145
  172. package/unittest/index.html +37 -0
  173. package/cert/cert.pem +0 -105
  174. package/cert/key.pem +0 -30
@@ -0,0 +1,389 @@
1
+ "use strict";
2
+
3
+ var _postcss = _interopRequireDefault(require("postcss"));
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
7
+ /**
8
+ * we have give support for ignore(exclude) comments
9
+ * These are the comments' keyword
10
+ */
11
+ const hoverIgnoreQuery = 'Hover:ignore',
12
+ activeIgnoreQuery = 'Active:ignore',
13
+ hoverActiveIgnoreQuery = 'HoverActive:ignore';
14
+ const medHoverIgnoreQuery = 'MedHover:ignore',
15
+ medActiveIgnoreQuery = 'MedActive:ignore',
16
+ medHoverActiveIgnoreQuery = 'MedHoverActive:ignore';
17
+ let hoverMedQuerySuffix = '';
18
+ let hoverNoneMedQuerySuffix = '';
19
+ const ruleIgnoreCommentRegex = /(Hover:ignore|Active:ignore|HoverActive:ignore)/g;
20
+ const mediaQueryIgnoreCommentRegex = /(MedHover:ignore|MedActive:ignore|MedHoverActive:ignore)/g;
21
+
22
+ function isComment(node) {
23
+ return node && node.type === 'comment' && node.text !== undefined;
24
+ }
25
+
26
+ function isHoverPresent(atrule) {
27
+ let hoverPresent = false;
28
+ atrule.walkRules(rule => {
29
+ if (rule.selector.includes('hover')) {
30
+ hoverPresent = true;
31
+ }
32
+ });
33
+ return hoverPresent;
34
+ }
35
+
36
+ function checkForUsualClass(root, sel) {
37
+ let present = false;
38
+ sel.split(',').forEach(value => {
39
+ if (value.includes('hover')) {
40
+ const valueNoHover = value.replace(':hover', '').trim();
41
+ root.walkRules(rule => {
42
+ if (rule.selector === valueNoHover) {
43
+ present = true;
44
+ }
45
+ });
46
+ }
47
+ });
48
+ return present;
49
+ }
50
+
51
+ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHoverActiveString => rootOriginal => {
52
+ const hoverRules = [];
53
+ const positionsObj = {};
54
+ hoverMedQuerySuffix = mediaQueryHoverActiveString.hover;
55
+ hoverNoneMedQuerySuffix = mediaQueryHoverActiveString.none;
56
+
57
+ function isRuleHasIgnoreComment(index, type) {
58
+ const prevNode = rootOriginal.nodes[index - 1];
59
+
60
+ if (isComment(prevNode)) {
61
+ return prevNode.text === type;
62
+ }
63
+
64
+ return false;
65
+ }
66
+
67
+ function isMediaQueryHasIgnoreComment(node, type) {
68
+ if (isComment(node)) {
69
+ return node.text === type;
70
+ }
71
+
72
+ return false;
73
+ }
74
+
75
+ function hasIgnoreComment({
76
+ index,
77
+ atrule,
78
+ type
79
+ }) {
80
+ if (type.match(mediaQueryIgnoreCommentRegex)) {
81
+ return isMediaQueryHasIgnoreComment(atrule.nodes[index - 1], type.slice(3));
82
+ }
83
+
84
+ if (type.match(ruleIgnoreCommentRegex)) {
85
+ return isRuleHasIgnoreComment(index, type);
86
+ }
87
+
88
+ return false;
89
+ }
90
+
91
+ function getPositionsOfHoverAndActiveMedQueries(parent) {
92
+ const allNodes = rootOriginal.nodes;
93
+ const hoverMediaQuery = `${parent.params} and ${hoverMedQuerySuffix}`;
94
+ const hoverNoneMediaQuery = `${parent.params} and ${hoverNoneMedQuerySuffix}`;
95
+ const positions = {
96
+ hovMed: allNodes[positionsObj[hoverMediaQuery]],
97
+ actMed: allNodes[positionsObj[hoverNoneMediaQuery]]
98
+ };
99
+ return positions;
100
+ }
101
+
102
+ function handleMedHoverAndHoverActiveIgnore(atrule, index) {
103
+ return !hasIgnoreComment({
104
+ atrule,
105
+ index,
106
+ type: medHoverIgnoreQuery
107
+ }) && !hasIgnoreComment({
108
+ atrule,
109
+ index,
110
+ type: medHoverActiveIgnoreQuery
111
+ });
112
+ }
113
+
114
+ function handleMedActiveAndHoverActiveIgnore(atrule, index) {
115
+ return !hasIgnoreComment({
116
+ atrule,
117
+ index,
118
+ type: medActiveIgnoreQuery
119
+ }) && !hasIgnoreComment({
120
+ atrule,
121
+ index,
122
+ type: medHoverActiveIgnoreQuery
123
+ });
124
+ }
125
+
126
+ function handleHoverAndHoverActiveIgnore(index) {
127
+ return !hasIgnoreComment({
128
+ index,
129
+ type: hoverIgnoreQuery
130
+ }) && !hasIgnoreComment({
131
+ index,
132
+ type: hoverActiveIgnoreQuery
133
+ });
134
+ }
135
+
136
+ function handleActiveAndHoverActiveIgnore(index) {
137
+ return !hasIgnoreComment({
138
+ index,
139
+ type: activeIgnoreQuery
140
+ }) && !hasIgnoreComment({
141
+ index,
142
+ type: hoverActiveIgnoreQuery
143
+ });
144
+ }
145
+
146
+ function handleAllIgnoreCases(index) {
147
+ return !hasIgnoreComment({
148
+ index,
149
+ type: activeIgnoreQuery
150
+ }) && !hasIgnoreComment({
151
+ index,
152
+ type: hoverIgnoreQuery
153
+ }) && !hasIgnoreComment({
154
+ index,
155
+ type: hoverActiveIgnoreQuery
156
+ });
157
+ }
158
+
159
+ function mediaCommaQuery(rule, index) {
160
+ if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
161
+ //console.log(hovMed, actMed);
162
+ let newSelector = '';
163
+ const {
164
+ hovMed,
165
+ actMed
166
+ } = getPositionsOfHoverAndActiveMedQueries(rule.parent);
167
+ const hovQueries = [];
168
+ const actQueries = [];
169
+ rule.selector.split(/\s*,\s*/).forEach(_subrule => {
170
+ const subrule = _subrule.trim();
171
+
172
+ const clone = rule.clone();
173
+
174
+ if (subrule.includes('hover')) {
175
+ clone.selector = subrule;
176
+
177
+ if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
178
+ hovQueries.push(subrule);
179
+ }
180
+
181
+ if (handleMedActiveAndHoverActiveIgnore(rule.parent, index)) {
182
+ actQueries.push(subrule);
183
+ }
184
+ } else {
185
+ newSelector += `${subrule}, `;
186
+ }
187
+ });
188
+
189
+ if (hovQueries.length > 0) {
190
+ const clone = rule.clone();
191
+ clone.selector = hovQueries.join(',');
192
+ hovMed.append(clone);
193
+ }
194
+
195
+ if (actQueries.length > 0) {
196
+ const clone = rule.clone();
197
+ clone.selector = actQueries.join(',');
198
+ actMed.append(clone.clone({
199
+ selector: clone.selector.replace(/:hover/gi, ':active')
200
+ }));
201
+ }
202
+
203
+ if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
204
+ rule.selector = newSelector.substring(0, newSelector.length - 2);
205
+ }
206
+
207
+ if (rule.selector === '') {
208
+ rule.remove();
209
+ }
210
+ }
211
+ }
212
+
213
+ function mediaQuery(rule, index) {
214
+ if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
215
+ const {
216
+ hovMed,
217
+ actMed
218
+ } = getPositionsOfHoverAndActiveMedQueries(rule.parent);
219
+
220
+ if (rule.selector.includes('hover') && hovMed !== undefined && rule.parent.type === 'atrule') {
221
+ if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
222
+ hovMed.append(rule);
223
+ }
224
+
225
+ if (handleMedActiveAndHoverActiveIgnore(rule.parent, index)) {
226
+ actMed.append(rule.clone({
227
+ selector: rule.selector.replace(/:hover/gi, ':active')
228
+ }));
229
+ }
230
+ }
231
+ }
232
+ }
233
+
234
+ function commaQuery(rule, index) {
235
+ //console.log("comma" , rule.selector.split('\n'));
236
+ let newSelector = '';
237
+ const hovQueries = [];
238
+ rule.selector.split(/\s*,\s*/).forEach(_subrule => {
239
+ const subrule = _subrule.trim();
240
+
241
+ if (subrule.includes('hover')) {
242
+ // hoverRules.push({ rule: clone, index });
243
+ hovQueries.push(subrule);
244
+ } else {
245
+ newSelector += `${subrule}, `;
246
+ }
247
+ });
248
+
249
+ if (hovQueries.length > 0) {
250
+ const clone = rule.clone();
251
+ clone.selector = hovQueries.join(',');
252
+ hoverRules.push({
253
+ rule: clone,
254
+ index
255
+ });
256
+ }
257
+
258
+ if (handleHoverAndHoverActiveIgnore(index)) {
259
+ if (checkForUsualClass(rootOriginal, rule.selector)) {
260
+ rule.selector = newSelector.substring(0, newSelector.length - 2).trim();
261
+ }
262
+ }
263
+
264
+ if (rule.selector === '') {
265
+ rule.remove();
266
+ }
267
+ } // Start by identifying all :hover rules
268
+
269
+
270
+ rootOriginal.walkAtRules(atrule => {
271
+ const hoverQuery = `${atrule.params} and ${hoverMedQuerySuffix}`;
272
+ const activeQuery = `${atrule.params} and ${hoverNoneMedQuerySuffix}`;
273
+
274
+ if (isHoverPresent(atrule)) {
275
+ if (!positionsObj[hoverQuery] && !positionsObj[activeQuery]) {
276
+ rootOriginal.append({
277
+ name: 'media',
278
+ params: hoverQuery
279
+ });
280
+ positionsObj[hoverQuery] = rootOriginal.nodes.length - 1;
281
+ rootOriginal.append({
282
+ name: 'media',
283
+ params: activeQuery
284
+ });
285
+ positionsObj[activeQuery] = rootOriginal.nodes.length - 1;
286
+ }
287
+ }
288
+ });
289
+ rootOriginal.walkRules(/:hover/i, (rule, index) => {
290
+ // media hover query with ',' ' ' '+'
291
+ // console.log("media query" , rule.selector)
292
+ if (rule.parent.type === 'atrule' && rule.selector.includes(',')) {
293
+ //console.log("media comma", rule.selector)
294
+ mediaCommaQuery(rule, index);
295
+ } else {
296
+ // plus, space and other media queries
297
+ //console.log("media", rule.selector)
298
+ mediaQuery(rule, index);
299
+ } // usual hover query
300
+
301
+
302
+ if (!rule.selector.match(/,+| +|\++/g) && rule.parent !== undefined && rule.parent.name === undefined) {
303
+ hoverRules.push({
304
+ rule,
305
+ index
306
+ });
307
+ } //usual hover query with ',' ' ' '+'
308
+
309
+
310
+ if (rule.selector.match(/,+| +|\++/g) && rule.parent.name === undefined) {
311
+ if (rule.selector.includes(',')) {
312
+ commaQuery(rule, index);
313
+ } else if (rule.selector.match(/ +|\++/g)) {
314
+ //console.log("plus or space" , rule.selector);
315
+ if (rule.selector.includes('hover')) {
316
+ hoverRules.push({
317
+ rule,
318
+ index
319
+ }); //rule.remove();
320
+ }
321
+ }
322
+ }
323
+ }); // If there are any :hover rules in the input, then create media queries
324
+ // to automatically translate it into :active on touch-based devices
325
+
326
+ if (hoverRules.length > 0) {
327
+ // Create a media query targetting devices that actually support
328
+ // hover
329
+ const hoverQuery = rootOriginal.append({
330
+ name: 'media',
331
+ params: `${hoverMedQuerySuffix}`
332
+ }).last; // Create a media query targetting devices that don't support hover
333
+ // (ie. devices where we should fall back to :active instead)
334
+
335
+ const activeQuery = rootOriginal.append({
336
+ name: 'media',
337
+ params: `${hoverNoneMedQuerySuffix}`
338
+ }).last; // Loop through the hover rules and apply them to each of the media
339
+ // queries
340
+ // eslint-disable-next-line no-labels
341
+
342
+ outerLoop: for (const hoverRule of hoverRules) {
343
+ // determine if the rule has been nested inside another media
344
+ // query; in that case bail out as we have no way of reliably
345
+ // nesting these queries
346
+ let parentRule = hoverRule.rule.parent;
347
+
348
+ while (parentRule) {
349
+ if (parentRule.type === 'atrule' && parentRule.name === 'media') {
350
+ // eslint-disable-next-line no-labels
351
+ continue outerLoop;
352
+ }
353
+
354
+ parentRule = parentRule.parent;
355
+ } // Push a clone of the :hover rule 'as is' to queries where we
356
+ // expect the user's device to support hover
357
+ // ieQuery.append(hoverRule.clone());
358
+
359
+
360
+ if (handleHoverAndHoverActiveIgnore(hoverRule.index)) {
361
+ hoverQuery.append(hoverRule.rule.clone());
362
+ } // Push a clone of the :hover rule, where we transform the
363
+ // selector to :active to the query targetting devices that
364
+ // don't support hover
365
+
366
+
367
+ if (handleActiveAndHoverActiveIgnore(hoverRule.index)) {
368
+ activeQuery.append(hoverRule.rule.clone({
369
+ selector: hoverRule.rule.selector.replace(/:hover/gi, ':active')
370
+ }));
371
+ } // remove legacy rule from output
372
+
373
+
374
+ if (handleAllIgnoreCases(hoverRule.index)) {
375
+ hoverRule.rule.remove();
376
+ }
377
+ }
378
+ } // rootOriginal.walkAtRules(atrule => {
379
+ // if (
380
+ // (atrule !== undefined &&
381
+ // atrule.nodes !== undefined &&
382
+ // atrule.nodes.length === 0) ||
383
+ // atrule.nodes === undefined
384
+ // ) {
385
+ // atrule.remove();
386
+ // }
387
+ // });
388
+
389
+ });
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ErrorHandler = void 0;
7
+
8
+ class ErrorHandler {
9
+ constructor(allowedErrs) {
10
+ this.errors = [];
11
+ this.errorTable = [];
12
+ this.allowedErrs = allowedErrs;
13
+ Object.assign(this, {
14
+ DECLARATION_IGNORED: 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 : Declaration Ignored`),
15
+ DECIMAL_CHECK: 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 unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
16
+ DECIMAL_REJECT: 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 unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
17
+ UNIT_ERROR: 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 unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
18
+ RANGE_ERROR: 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}\r`),
19
+ VARIABLE_PRESENT: 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}`),
20
+ 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
+ });
22
+ }
23
+
24
+ setAllowedErrs(allErrs) {
25
+ this.allowedErrs = allErrs;
26
+ ['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT', 'MULTIPLE_OCCURANCES'].forEach(err => {
27
+ if (!this.allowedErrs[err]) {
28
+ this[err] = () => null;
29
+ }
30
+ });
31
+ }
32
+
33
+ addError(errstr) {
34
+ this.errors.push(`{\n${errstr}\n}\n`);
35
+ }
36
+
37
+ errorFunction(errObj) {
38
+ if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
39
+ console.log(this.allowedErrs[errObj.type]);
40
+ this[errObj.type](errObj);
41
+ }
42
+ }
43
+
44
+ printError(errObj) {
45
+ console.log('{');
46
+ Object.keys(errObj).sort().forEach(key => {
47
+ if (key !== 'decl') {
48
+ console.log(`${key} : ${errObj[key]}`);
49
+ } else {
50
+ console.log(`prop : ${errObj.decl.prop}`);
51
+ console.log(`value : ${errObj.decl.value}`);
52
+ console.log(`linenum : ${errObj.decl.source.start.line}`);
53
+ }
54
+ });
55
+ console.log('}\n');
56
+ }
57
+
58
+ }
59
+
60
+ exports.ErrorHandler = ErrorHandler;