@zohodesk/react-cli 0.0.1-exp.175.0 → 0.0.1-exp.176.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -180
  3. package/.prettierrc +6 -6
  4. package/{CHANGELOG-fz.md → CHANGELOG.md} +0 -0
  5. package/README.md +1025 -27
  6. package/bin/cli.js +482 -482
  7. package/cert/Tsicsezwild-22-23.crt +37 -0
  8. package/cert/Tsicsezwild-22-23.key +27 -0
  9. package/docs/CustomChunks.md +26 -26
  10. package/docs/DevStart.md +18 -18
  11. package/docs/HoverActive.md +12 -12
  12. package/docs/InstallNode.md +28 -28
  13. package/docs/SelectorWeight.md +6 -0
  14. package/docs/TODOS.md +10 -10
  15. package/docs/ValueReplacer.md +60 -60
  16. package/docs/VariableConversion.md +719 -678
  17. package/docs/warnings_while_install.txt +35 -35
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/configs/webpack.css.umd.config.js +4 -4
  21. package/lib/configs/webpack.dev.config.js +34 -6
  22. package/lib/configs/webpack.docs.config.js +24 -5
  23. package/lib/configs/webpack.impact.config.js +20 -6
  24. package/lib/configs/webpack.prod.config.js +35 -10
  25. package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
  26. package/lib/loaderUtils/getCSSLoaders.js +27 -19
  27. package/lib/loaderUtils/windowsModification.js +11 -0
  28. package/lib/loaders/workerLoader.js +9 -9
  29. package/lib/pluginUtils/getDevPlugins.js +42 -20
  30. package/lib/pluginUtils/getProdPlugins.js +45 -24
  31. package/lib/plugins/EFCPlugin.md +6 -6
  32. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  33. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  34. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  35. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  36. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  37. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  38. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  39. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  40. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
  41. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  42. package/lib/plugins/SelectorPlugin.js +97 -0
  43. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  44. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  45. package/lib/plugins/VariableConversionCollector.js +322 -0
  46. package/lib/plugins/composeCommonPlugin.js +30 -0
  47. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
  48. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  49. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  50. package/lib/postcss-plugins/hoverActivePlugin.js +3 -3
  51. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -14
  52. package/lib/postcss-plugins/variableModificationPlugin/index.js +203 -144
  53. package/lib/schemas/index.js +18 -12
  54. package/lib/servers/docsServerCore.js +12 -13
  55. package/lib/servers/httpsOptions.js +9 -40
  56. package/lib/servers/nowatchserver.js +11 -12
  57. package/lib/servers/server.js +13 -14
  58. package/lib/sh/pre-commit.sh +34 -34
  59. package/lib/sh/reportPublish.sh +45 -45
  60. package/lib/utils/buildstats.html +148 -148
  61. package/lib/utils/getOptions.js +13 -13
  62. package/lib/utils/resultSchema.json +73 -73
  63. package/npm8.md +9 -9
  64. package/package.json +146 -119
  65. package/postpublish.js +6 -8
  66. package/templates/app/.eslintrc.js +140 -140
  67. package/templates/app/README.md +12 -12
  68. package/templates/app/app/index.html +24 -24
  69. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  70. package/templates/app/app/properties/i18nkeys.json +3 -3
  71. package/templates/app/docs/all.html +69 -69
  72. package/templates/app/mockapi/index.js +18 -18
  73. package/templates/app/package.json +37 -37
  74. package/templates/app/src/actions/SampleActions/index.js +37 -37
  75. package/templates/app/src/actions/index.js +65 -65
  76. package/templates/app/src/appUrls.js +19 -19
  77. package/templates/app/src/components/Alert/Alert.js +134 -134
  78. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  79. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  80. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  81. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  82. package/templates/app/src/components/Sample/SampleList.js +61 -61
  83. package/templates/app/src/components/Slider/Slider.css +41 -41
  84. package/templates/app/src/components/Slider/Slider.js +55 -55
  85. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  86. package/templates/app/src/containers/AppContainer/index.js +96 -96
  87. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  88. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  89. package/templates/app/src/containers/DevTools/index.js +10 -10
  90. package/templates/app/src/containers/Header/index.js +67 -67
  91. package/templates/app/src/containers/Header/index.module.css +43 -43
  92. package/templates/app/src/containers/Redirect/index.js +63 -63
  93. package/templates/app/src/containers/Redirector/index.js +47 -47
  94. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  95. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  96. package/templates/app/src/historyChange.js +5 -5
  97. package/templates/app/src/index.html +10 -10
  98. package/templates/app/src/index.js +24 -24
  99. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  100. package/templates/app/src/reducers/alertData.js +11 -11
  101. package/templates/app/src/reducers/index.js +6 -6
  102. package/templates/app/src/reducers/samples.js +19 -19
  103. package/templates/app/src/store/configureStore.dev.js +51 -51
  104. package/templates/app/src/store/configureStore.js +5 -5
  105. package/templates/app/src/store/configureStore.prod.js +26 -26
  106. package/templates/app/src/util/Common.js +5 -5
  107. package/templates/app/src/util/RequestAPI.js +132 -132
  108. package/templates/docs/all.html +249 -249
  109. package/templates/docs/component.html +178 -178
  110. package/templates/docs/components.html +221 -221
  111. package/templates/docs/css/b.min.css +6 -6
  112. package/templates/docs/css/component.css +42 -42
  113. package/templates/docs/css/componentTest.css +6 -6
  114. package/templates/docs/css/hopscotch.css +585 -585
  115. package/templates/docs/css/style.css +1022 -1022
  116. package/templates/docs/impactReportTemplate.html +154 -154
  117. package/templates/docs/index.html +1501 -1501
  118. package/templates/docs/js/active-line.js +72 -72
  119. package/templates/docs/js/b.min.js +7 -7
  120. package/templates/docs/js/codemirror.js +9680 -9680
  121. package/templates/docs/js/designTokens.js +334 -334
  122. package/templates/docs/js/j.min.js +4 -4
  123. package/templates/docs/js/javascript.js +874 -874
  124. package/templates/docs/js/matchbrackets.js +145 -145
  125. package/Changelog.md +0 -1019
  126. package/lib/configs/resolvers.js +0 -38
  127. package/lib/constants.js +0 -31
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _postcss = _interopRequireDefault(require("postcss"));
9
+
10
+ var _fs = _interopRequireDefault(require("fs"));
11
+
12
+ var _webpackSources = require("webpack-sources");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ const path = require('path');
17
+
18
+ const isCss = filename => path.extname(filename) === '.css';
19
+
20
+ function rootConvertor(rootOriginal, defaultSelector, data, chunkFilename, excludeStrings) {
21
+ rootOriginal.walkRules((rule, index) => {
22
+ const prevNode = rootOriginal.nodes[index - 1];
23
+
24
+ if (index !== 0 && prevNode.type && prevNode.type === 'comment' && prevNode.text.toLowerCase() === 'updateselector:ignore') {
25
+ return;
26
+ }
27
+
28
+ if (rule.parent && rule.parent.type === 'atrule') {
29
+ if (rule.parent.name !== 'media') {
30
+ return;
31
+ }
32
+ }
33
+
34
+ if (excludeStrings.includes(rule.selector)) {
35
+ return;
36
+ }
37
+
38
+ let ruleArr = rule.selector.split(',');
39
+ ruleArr.forEach((rule, index) => {
40
+ if (rule.includes(']')) {
41
+ if (rule.slice(rule.lastIndexOf(']') + 2).trim() === '') {
42
+ return;
43
+ } // console.log(
44
+ // rule.slice(rule.lastIndexOf(']') + 2).trim(),
45
+ // rule.slice(rule.lastIndexOf(']') + 2).trim() !== ''
46
+ // );
47
+
48
+
49
+ ruleArr[index] = `${rule.slice(0, rule.lastIndexOf(']') + 1).trim()} ${defaultSelector}${rule.slice(rule.lastIndexOf(']') + 2).trim()}`; // console.log(ruleArr[index]);
50
+
51
+ return;
52
+ }
53
+
54
+ ruleArr[index] = data[chunkFilename] ? `${data[chunkFilename].defaultSelector}${rule}` : `${defaultSelector}${rule}`;
55
+ });
56
+ rule.selector = ruleArr.join(',\n'); // console.log(`${rule.selector} converted`);
57
+ });
58
+ return rootOriginal;
59
+ }
60
+
61
+ class SelectorPlugin {
62
+ constructor(options = {}) {
63
+ this.optimize = options.optimize;
64
+ this.selectorWeightConfig = options.selectorWeightConfig;
65
+ }
66
+
67
+ apply(compiler) {
68
+ const {
69
+ defaultSelector,
70
+ customFileDetails,
71
+ excludeStrings
72
+ } = this.selectorWeightConfig;
73
+
74
+ const rawdata = _fs.default.readFileSync(customFileDetails);
75
+
76
+ const data = JSON.parse(rawdata);
77
+ compiler.hooks.compilation.tap('selector-weight-rewrite', compilation => {
78
+ compilation.hooks.optimizeChunkAssets.tapAsync('selector-weight-rewrite', (chunks, callback) => {
79
+ chunks.forEach(chunk => {
80
+ chunk.files.filter(isCss).forEach(chunkFilename => {
81
+ const asset = compilation.assets[chunkFilename];
82
+ const sourceStr = asset.source();
83
+
84
+ const rootOriginal = _postcss.default.parse(sourceStr);
85
+
86
+ compilation.assets[chunkFilename] = new _webpackSources.RawSource(rootConvertor(rootOriginal, defaultSelector, data, chunkFilename, excludeStrings).toString());
87
+ });
88
+ });
89
+ callback();
90
+ });
91
+ });
92
+ }
93
+
94
+ }
95
+
96
+ var _default = SelectorPlugin;
97
+ exports.default = _default;
@@ -51,11 +51,11 @@ class ServiceWorkerPlugin {
51
51
  if (err) {
52
52
  throw new Error(err);
53
53
  } else {
54
- /* const extractedChunks = compilation.chunks.filter(chunk => {
55
- if ('canBeInitial' in chunk) {
56
- return chunk.canBeInitial();
57
- }
58
- return chunk.isInitial();
54
+ /* const extractedChunks = compilation.chunks.filter(chunk => {
55
+ if ('canBeInitial' in chunk) {
56
+ return chunk.canBeInitial();
57
+ }
58
+ return chunk.isInitial();
59
59
  }); */
60
60
  // let [js, css, , , i18nPublicPath] = this.publicPaths;
61
61
  // let initialChunkUrls = [];
@@ -64,10 +64,10 @@ class ServiceWorkerPlugin {
64
64
  let entrypoint = compilation.entrypoints.get('main');
65
65
  let initialChunkUrls = entrypoint.getFiles();
66
66
  const cssDirTemplate = '@dir@';
67
- /**
68
- * NOTE:
69
- * if chunkSplitEnable is false means,
70
- * serviceWorker will get i18n files path for html
67
+ /**
68
+ * NOTE:
69
+ * if chunkSplitEnable is false means,
70
+ * serviceWorker will get i18n files path for html
71
71
  */
72
72
 
73
73
  let initalI18nAssets = chunkSplitEnable ? entrypoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@')) : [];
@@ -15,10 +15,10 @@ var _crypto = _interopRequireDefault(require("crypto"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- /**
19
- * Plugin that generates hash for the provided list of third party files
20
- * Map the provided key with the file hash and add it to the list of exisiting global constants.
21
- * Plugin in turn uses the defineplugin to generate global constants.
18
+ /**
19
+ * Plugin that generates hash for the provided list of third party files
20
+ * Map the provided key with the file hash and add it to the list of exisiting global constants.
21
+ * Plugin in turn uses the defineplugin to generate global constants.
22
22
  */
23
23
  class TPHashMappingPlugin {
24
24
  constructor(options) {
@@ -0,0 +1,322 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _postcss = _interopRequireDefault(require("postcss"));
9
+
10
+ var _ErrorHandler = require("../postcss-plugins/variableModificationPlugin/ErrorHandler");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ // import { RawSource } from 'webpack-sources';
15
+ const fs = require('fs');
16
+
17
+ const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_'];
18
+
19
+ const {
20
+ errors,
21
+ errTable,
22
+ errHandler
23
+ } = require('../postcss-plugins/variableModificationPlugin/index');
24
+
25
+ const supportedProps = ['font-size', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', '^top', '^right', '^bottom', '^left', '^width', 'min-width', 'max-width', '^height', 'min-height', 'max-height', 'text-indent', 'clip', 'flex-basis', 'row-gap', 'gap', 'column-gap', 'flex']; // const avoidProps = [];
26
+ // -- is issue IO --
27
+
28
+ /*
29
+ issues eg :
30
+ issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
31
+ input :
32
+ --zd_size
33
+ output :
34
+ true
35
+ comment :
36
+ do not execute when --zd_size comes as prop
37
+ */
38
+
39
+ function isIgnoreValuePresent(ignoreVals, prop) {
40
+ let present = false;
41
+ ignoreVals.forEach(issue => {
42
+ if (prop && prop.includes(issue)) {
43
+ present = true;
44
+ }
45
+ });
46
+ return present;
47
+ } // -- to convert the hyphen values to values --
48
+
49
+ /*
50
+ input :
51
+ var(--zdt_uploadlist_default_width)
52
+ output :
53
+ --zdt_uploadlist_default_width
54
+
55
+ comment :
56
+ to make the variable object using the output as key and decl.prop such as font-size as value
57
+ */
58
+
59
+
60
+ function extractVariableName(val) {
61
+ return val.replace(/calc\((.+)\)/gi, '$1').replace(/var\((.+)\)/gi, '$1').replace('-1', '').replace('*', '').replace('\n', '').trim();
62
+ }
63
+
64
+ function rootConvertor(rootOriginal, variables, settingsObject) {
65
+ rootOriginal.walkRules(rule => {
66
+ rule.nodes.forEach((decl, index) => {
67
+ let prevNode = rule.nodes[index - 1];
68
+ let currentNode = rule.nodes[index];
69
+
70
+ if (decl.prop && decl.prop.includes('--')) {
71
+ if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase() === 'variable:ignore') {
72
+ return;
73
+ }
74
+
75
+ if (isIgnoreValuePresent(ignoreVals, decl.prop)) {
76
+ return;
77
+ }
78
+
79
+ if (settingsObject[variables[decl.prop]]) {
80
+ /* if there is no value for property, set it to default so that undefined doesn't get called as key */
81
+ if (!variables[decl.prop]) {
82
+ variables[decl.prop] = 'default';
83
+ }
84
+
85
+ const pxReplacement = settingsObject[variables[decl.prop]].replacements.px;
86
+ let valArr = decl.value.split(' '); // single values are considered in the above array and converted below
87
+
88
+ valArr.forEach((value, index) => {
89
+ if (value.includes('px')) {
90
+ let num = value.replace('px', '');
91
+ valArr[index] = pxReplacement.replace('$$', num);
92
+ }
93
+ });
94
+ currentNode.value = valArr.join(' ');
95
+ }
96
+ }
97
+ });
98
+ });
99
+ return rootOriginal;
100
+ }
101
+
102
+ class VariableConversionCollector {
103
+ constructor(options = {}) {
104
+ this.optimize = options.optimize;
105
+ this.filename = options.cssVariableReplacementConfig;
106
+ }
107
+
108
+ apply(compiler) {
109
+ const variables = {};
110
+ const unassigned = {};
111
+ const rawdata = fs.readFileSync(this.filename);
112
+ const data = JSON.parse(rawdata);
113
+ const {
114
+ settings: settingsObject,
115
+ errorLog: errorLogStatus,
116
+ errorInConsole: errorConsoleStatus,
117
+ errorsAllowed
118
+ } = data; // If theres is no setting for default prop in settingsObject, set one.
119
+
120
+ if (!settingsObject.default) {
121
+ settingsObject.default = {
122
+ allowed: ['px', 'em', 'fit-content', 'auto', '%', 'inherit', '-moz-fit-content', 'vh', '0', 'initial', 'vw'],
123
+ replacements: {
124
+ px: 'var(--zd_size$$)'
125
+ },
126
+ range: {
127
+ start: -99999,
128
+ end: 99999
129
+ }
130
+ };
131
+ }
132
+ /*
133
+ purpose of tap : to create a variable object such as:
134
+ {
135
+ --zdt_uploadlist_default_width : width,
136
+ --zdt_uploadlist_default_height : height,
137
+ }
138
+ which will help in the conversion further
139
+ */
140
+
141
+
142
+ if (fs.existsSync('./variableMapping.json')) {
143
+ const data = JSON.parse(fs.readFileSync('./variableMapping.json', 'utf-8'));
144
+ Object.keys(data).forEach(key => {
145
+ variables[key] = data[key];
146
+ });
147
+ }
148
+
149
+ compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
150
+ compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
151
+ const mods = modules.filter(x => x.type.includes('css'));
152
+ mods.forEach(module => {
153
+ const rootOriginal = _postcss.default.parse(module.content);
154
+
155
+ const filename = module.issuer.resource;
156
+
157
+ if (!filename.includes('node_modules')) {
158
+ rootOriginal.walkRules(rule => {
159
+ rule.walkDecls(decl => {
160
+ decl.value.split(' ').forEach(val => {
161
+ if (val && val.includes('--') && !new RegExp(ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
162
+ const extractedValue = extractVariableName(val);
163
+
164
+ if (!variables[extractedValue]) {
165
+ variables[extractedValue] = decl.prop;
166
+ } else {
167
+ if (new RegExp(supportedProps.join('|'), 'gi').test(decl.prop)) {
168
+ // console.log(
169
+ // `${extractedValue} : ${variables[extractedValue]} already exists please check!`
170
+ // );
171
+ if (errorsAllowed.MULTIPLE_OCCURANCES) {
172
+ let errObj = {
173
+ decl,
174
+ type: 'MULTIPLE_OCCURANCES',
175
+ filename,
176
+ message: `${extractedValue} : ${variables[extractedValue]} already exists please check!`
177
+ };
178
+ errHandler.errorTable.push(errObj);
179
+ errHandler.errorFunction(errObj);
180
+ }
181
+ }
182
+ }
183
+ } else {
184
+ // console.log(decl.prop);
185
+ if (/^--/gi.test(decl.prop) && new RegExp(supportedProps.join('|'), 'gi').test(decl.prop) && val.trim() !== '' && !variables[decl.prop]) {
186
+ // console.log(
187
+ // `${decl.prop} : ${variables[decl.prop]},`
188
+ // );
189
+ unassigned[decl.prop] = variables[decl.prop];
190
+ }
191
+ }
192
+ });
193
+ });
194
+ });
195
+ /*
196
+ current value example:
197
+ {
198
+ --zdt_uploadlist_default_width : --zd_upload_width,
199
+ --zd_upload_width : width
200
+ }
201
+ expected value :
202
+ {
203
+ --zdt_uploadlist_default_width : width,
204
+ --zd_upload_width : width
205
+ }
206
+
207
+ conversion is done in the while loop below
208
+ */
209
+
210
+ Object.keys(variables).forEach(key => {
211
+ while (variables[variables[key]]) {
212
+ variables[key] = variables[variables[key]];
213
+ }
214
+ });
215
+ }
216
+ });
217
+ }); // -- conversion for the root using rootConvertor --
218
+
219
+ /*
220
+ input :
221
+ .a{
222
+ padding : 20px
223
+ }
224
+ output :
225
+ // on settingObject file :
226
+ { padding : { replacements : { px : 'zd_size$$' }}}
227
+ .a{
228
+ padding : zd_size20;
229
+ }
230
+ */
231
+
232
+ compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
233
+ const mods = modules.filter(x => x.type.includes('css'));
234
+ mods.forEach(module => {
235
+ const rootOriginal = _postcss.default.parse(module.content);
236
+
237
+ module.content = rootConvertor(rootOriginal, variables, settingsObject).toString();
238
+ });
239
+ });
240
+ });
241
+ /*
242
+ purpose of tap : to display the errors encountered so far
243
+ input :
244
+ all css files
245
+ output :
246
+ all errors that are present in the errTable arr
247
+ */
248
+
249
+ compiler.hooks.afterEmit.tap('error-display', () => {
250
+ if (Object.keys(unassigned).length > 0) {
251
+ console.log();
252
+ console.log(unassigned);
253
+ console.log();
254
+ throw new Error('^^^ Variables above have not been assigned! ^^^');
255
+ }
256
+
257
+ let avlTypes = new Set([]);
258
+ let srtArr = errTable.sort((a, b) => {
259
+ avlTypes.add(a.type);
260
+ avlTypes.add(b.type);
261
+
262
+ if (a.type < b.type) {
263
+ return -1;
264
+ }
265
+ }); // variable constructed now to be written in a json file
266
+ // const newVars = Object.keys(variables)
267
+ // //Filter Object with key contanis "NAME"
268
+ // .filter(key => variables[key].includes('--'))
269
+ // .reduce(
270
+ // (obj, key) =>
271
+ // Object.assign(obj, {
272
+ // [key]: variables[key]
273
+ // }),
274
+ // {}
275
+ // );
276
+ // console.log('new variables: ', newVars);
277
+ // try {
278
+ // fs.writeFileSync('./variableMapping.json', JSON.stringify(variables));
279
+ // } catch (err) {
280
+ // console.log(err);
281
+ // }
282
+ // fs.writeFile('./variableMapping.json', JSON.stringify(variables), err => {
283
+ // if (err) {
284
+ // throw err;
285
+ // }
286
+ // console.log('variable mapping file generated.');
287
+ // });
288
+
289
+ if (errorConsoleStatus) {
290
+ const errorHandler = new _ErrorHandler.ErrorHandler();
291
+ avlTypes.forEach(type => {
292
+ console.log('---------------------------------------------------------------------------------------------------------------------------');
293
+ console.log(`Error Type : ${type}`);
294
+ console.log('---------------------------------------------------------------------------------------------------------------------------');
295
+ srtArr.forEach(err => {
296
+ if (err.decl.prop && err.decl.value && err.type === type) {
297
+ errorHandler.printError(err);
298
+ }
299
+ });
300
+ console.log('---------------------------------------------------------------------------------------------------------------------------');
301
+ });
302
+ }
303
+
304
+ if (errorLogStatus) {
305
+ fs.writeFileSync('./css_error.log', '');
306
+ console.log('writing to logFile...');
307
+
308
+ if (errors.length > 0) {
309
+ errors.forEach((err, index) => {
310
+ if (errTable[index].decl.prop && errTable[index].decl.value) {
311
+ fs.appendFileSync('./css_error.log', err);
312
+ }
313
+ });
314
+ }
315
+ }
316
+ });
317
+ }
318
+
319
+ }
320
+
321
+ var _default = VariableConversionCollector;
322
+ exports.default = _default;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _postcss = _interopRequireDefault(require("postcss"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ class ComposeCommonPlugin {
13
+ constructor(options = {}) {
14
+ this.optimize = options.optimize;
15
+ }
16
+
17
+ apply(compiler) {
18
+ compiler.hooks.compilation.tap('OptimizeJSPlugin', compilation => {
19
+ compilation.hooks.optimizeModules.tap('OptimizeMods', modules => {
20
+ modules.forEach(module => {
21
+ console.log(module);
22
+ });
23
+ });
24
+ });
25
+ }
26
+
27
+ }
28
+
29
+ var _default = ComposeCommonPlugin;
30
+ exports.default = _default;
@@ -38,11 +38,11 @@ function selectorMinifySameDir(selector, direction) {
38
38
  const regex = getRegex(direction);
39
39
  return selector.replace(regex, '').trim();
40
40
  }
41
- /**
42
- * this funtion will remove given rule,
43
- * if given selector and it's previous sibiling rule selector are same
44
- * current rule properties will move to previous sibiling rule.
45
- * @param {Rule} rule current rule
41
+ /**
42
+ * this funtion will remove given rule,
43
+ * if given selector and it's previous sibiling rule selector are same
44
+ * current rule properties will move to previous sibiling rule.
45
+ * @param {Rule} rule current rule
46
46
  */
47
47
 
48
48
 
@@ -57,11 +57,11 @@ function mergeIfSameSelector(rule) {
57
57
  rule.remove();
58
58
  }
59
59
  }
60
- /**
61
- * this funtion will remove given rule,
62
- * if given selector and it's previous sibiling rule selector are same
63
- * current rule properties will move to previous sibiling rule.
64
- * @param {Rule} rule current rule
60
+ /**
61
+ * this funtion will remove given rule,
62
+ * if given selector and it's previous sibiling rule selector are same
63
+ * current rule properties will move to previous sibiling rule.
64
+ * @param {Rule} rule current rule
65
65
  */
66
66
 
67
67
 
@@ -1,39 +1,39 @@
1
- /*Hover_active:ignore*/
2
- g,a:hover{
3
- color : red
4
- }
5
- /*Hover:ignore*/
6
- h:hover{
7
- background : yellow
8
- }
9
-
10
- /* Hover_active:ignore */
11
- g,d+e:hover{
12
- color : black
13
- }
14
-
15
- g,d e:hover{
16
- color : black
17
- }
18
-
19
- @media screen and (max-width:61.25em){
20
- /* Hover_active:ignore */
21
- a,b,a:hover, b:hover{
22
- background-color : blue
23
- }
24
- a + b,a:hover + b:hover{
25
- background-color : blue
26
- }
27
- a b:hover{
28
- background-color : blue
29
- }
30
-
31
- .cc:hover {
32
- color: red;
33
- }
34
-
35
- c:hover{
36
- color : red
37
- }
38
-
1
+ /*Hover_active:ignore*/
2
+ g,a:hover{
3
+ color : red
4
+ }
5
+ /*Hover:ignore*/
6
+ h:hover{
7
+ background : yellow
8
+ }
9
+
10
+ /* Hover_active:ignore */
11
+ g,d+e:hover{
12
+ color : black
13
+ }
14
+
15
+ g,d e:hover{
16
+ color : black
17
+ }
18
+
19
+ @media screen and (max-width:61.25em){
20
+ /* Hover_active:ignore */
21
+ a,b,a:hover, b:hover{
22
+ background-color : blue
23
+ }
24
+ a + b,a:hover + b:hover{
25
+ background-color : blue
26
+ }
27
+ a b:hover{
28
+ background-color : blue
29
+ }
30
+
31
+ .cc:hover {
32
+ color: red;
33
+ }
34
+
35
+ c:hover{
36
+ color : red
37
+ }
38
+
39
39
  }
@@ -1,39 +1,39 @@
1
- /*Hover_active:ignore*/
2
- g,a:hover{
3
- color : red
4
- }
5
- /*Hover:ignore*/
6
- h:hover{
7
- background : yellow
8
- }
9
-
10
- /* Hover_active:ignore */
11
- g,d+e:hover{
12
- color : black
13
- }
14
-
15
- g,d e:hover{
16
- color : black
17
- }
18
-
19
- @media screen and (max-width:61.25em){
20
- /* Hover_active:ignore */
21
- a,b,a:hover, b:hover{
22
- background-color : blue
23
- }
24
- a + b,a:hover + b:hover{
25
- background-color : blue
26
- }
27
- a b:hover{
28
- background-color : blue
29
- }
30
-
31
- .cc:hover {
32
- color: red;
33
- }
34
-
35
- c:hover{
36
- color : red
37
- }
38
-
1
+ /*Hover_active:ignore*/
2
+ g,a:hover{
3
+ color : red
4
+ }
5
+ /*Hover:ignore*/
6
+ h:hover{
7
+ background : yellow
8
+ }
9
+
10
+ /* Hover_active:ignore */
11
+ g,d+e:hover{
12
+ color : black
13
+ }
14
+
15
+ g,d e:hover{
16
+ color : black
17
+ }
18
+
19
+ @media screen and (max-width:61.25em){
20
+ /* Hover_active:ignore */
21
+ a,b,a:hover, b:hover{
22
+ background-color : blue
23
+ }
24
+ a + b,a:hover + b:hover{
25
+ background-color : blue
26
+ }
27
+ a b:hover{
28
+ background-color : blue
29
+ }
30
+
31
+ .cc:hover {
32
+ color: red;
33
+ }
34
+
35
+ c:hover{
36
+ color : red
37
+ }
38
+
39
39
  }