@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
@@ -4,9 +4,9 @@ var _postcss = _interopRequireDefault(require("postcss"));
4
4
 
5
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
6
 
7
- /**
8
- * we have give support for ignore(exclude) comments
9
- * These are the comments' keyword
7
+ /**
8
+ * we have give support for ignore(exclude) comments
9
+ * These are the comments' keyword
10
10
  */
11
11
  const hoverIgnoreQuery = 'Hover:ignore',
12
12
  activeIgnoreQuery = 'Active:ignore',
@@ -8,30 +8,53 @@ exports.ErrorHandler = void 0;
8
8
  class ErrorHandler {
9
9
  constructor(allowedErrs) {
10
10
  this.errors = [];
11
+ this.errorTable = [];
11
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
+ });
12
31
  }
13
32
 
14
33
  addError(errstr) {
15
34
  this.errors.push(`{\n${errstr}\n}\n`);
16
35
  }
17
36
 
18
- errorFunction(errStr, type) {
19
- const {
20
- addError,
21
- allowedErrs
22
- } = this;
23
-
24
- if (type === 'DECLARATION_IGNORED' && allowedErrs.DECLARATION_IGNORED) {
25
- addError(errStr);
26
- } else if (type === 'UNIT_ERROR' && allowedErrs.UNIT_ERROR) {
27
- addError(errStr);
28
- } else if (type === 'RANGE_ERROR' && allowedErrs.RANGE_ERROR) {
29
- addError(errStr);
30
- } else if (type === 'VARIABLE_PRESENT' && allowedErrs.VARIABLE_PRESENT) {
31
- addError(errStr);
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);
32
41
  }
33
42
  }
34
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
+
35
58
  }
36
59
 
37
60
  exports.ErrorHandler = ErrorHandler;
@@ -6,8 +6,13 @@ const fs = require('fs');
6
6
 
7
7
  const path = require('path');
8
8
 
9
+ const {
10
+ ErrorHandler
11
+ } = require('./ErrorHandler');
12
+
9
13
  const errors = [];
10
- let allowedErrs = {};
14
+ const errorTable = [];
15
+ const errHandler = new ErrorHandler();
11
16
  const convertableProps = {
12
17
  'font-size': true,
13
18
  margin: true,
@@ -29,19 +34,37 @@ const convertableProps = {
29
34
  top: true,
30
35
  bottom: true,
31
36
  left: true,
32
- right: true
37
+ right: true,
38
+ 'text-indent': true,
39
+ clip: true,
40
+ 'flex-basis': true,
41
+ 'row-gap': true,
42
+ gap: true,
43
+ 'column-gap': true,
44
+ flex: true
33
45
  };
34
46
  const constantValues = {
35
47
  inherit: true,
36
48
  initial: true,
37
49
  auto: true,
38
50
  'fit-content': true,
39
- unset: true
51
+ unset: true,
52
+ cover: true,
53
+ contain: true,
54
+ top: true,
55
+ bottom: true,
56
+ left: true,
57
+ center: true,
58
+ right: true
40
59
  };
41
60
 
42
61
  function getNumericValue(value) {
43
62
  if (value.includes('var')) {
44
63
  return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
64
+ }
65
+
66
+ if (value.includes('rect')) {
67
+ return parseInt(value.replace('rect(', '').replace(')', '').replace(',', ''));
45
68
  } // Not need for this dum loop
46
69
  // allowed.forEach(alwdUnit => {
47
70
  // if (value.includes(alwdUnit)) {
@@ -71,22 +94,6 @@ function pxToCalc(value) {
71
94
  return arr.join(' ');
72
95
  }
73
96
 
74
- const addError = errstr => {
75
- errors.push(`{\n${errstr}\n}\n`);
76
- };
77
-
78
- const errorFunction = (errStr, type) => {
79
- if (type === 'DECLARATION_IGNORED' && allowedErrs.DECLARATION_IGNORED) {
80
- addError(errStr);
81
- } else if (type === 'UNIT_ERROR' && allowedErrs.UNIT_ERROR) {
82
- addError(errStr);
83
- } else if (type === 'RANGE_ERROR' && allowedErrs.RANGE_ERROR) {
84
- addError(errStr);
85
- } else if (type === 'VARIABLE_PRESENT' && allowedErrs.VARIABLE_PRESENT) {
86
- addError(errStr);
87
- }
88
- };
89
-
90
97
  const singleConvertor = (value, changeVal, details, range) => {
91
98
  const {
92
99
  path,
@@ -94,6 +101,13 @@ const singleConvertor = (value, changeVal, details, range) => {
94
101
  decl
95
102
  } = details;
96
103
 
104
+ if (decl.prop === 'background-position') {
105
+ if (isNaN(parseInt(value))) {
106
+ // console.log(`${value} skipped`);
107
+ return;
108
+ }
109
+ }
110
+
97
111
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
98
112
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
99
113
 
@@ -102,147 +116,192 @@ const singleConvertor = (value, changeVal, details, range) => {
102
116
  }
103
117
 
104
118
  return retVal;
105
- } // if(unitErrorVal && unitErrorVal != '0' ){
119
+ } // if (!value.includes('rect')) {
120
+ // if(unitErrorVal && unitErrorVal != '0' ){
106
121
  // console.log(value, 'not within range')
107
122
 
108
123
 
109
- errorFunction(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n message : value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`, 'RANGE_ERROR'); // }
124
+ let errObj = {
125
+ decl,
126
+ type: 'RANGE_ERROR',
127
+ filename,
128
+ message: `value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`,
129
+ path: path
130
+ };
131
+ errHandler.errorTable.push(errObj);
132
+ errHandler.errorFunction(errObj); // errorFunction(
133
+ // {
134
+ // decl,
135
+ // type: 'RANGE_ERROR',
136
+ // filename,
137
+ // message: `value (${value}) (${typeof value}) not within range (${
138
+ // range.start
139
+ // },${range.end})\r`,
140
+ // path: path
141
+ // },
142
+ // 'RANGE_ERROR'
143
+ // );
144
+ // }
110
145
  // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n message : value (${value}) not within range (${range.start},${range.end})\r`)
111
-
112
- return value;
146
+ // return value;
147
+ // } else {
148
+ // console.log('++++++++++++++++++++++rect val!', value);
149
+ // }
113
150
  };
114
151
 
115
- module.exports = postcss.plugin('postcss-variable-report', cssVariableReplacementConfig => {
116
- const rawdata = fs.readFileSync(cssVariableReplacementConfig);
117
- const data = JSON.parse(rawdata);
118
- const {
119
- errorsAllowed,
120
- settings: settingsObject,
121
- errorLog: errorLogStatus,
122
- errorInConsole: errorConsoleStatus
123
- } = data; // const keys = Object.keys(settingsObject);
124
-
125
- fs.writeFileSync('./css_error.log', '');
126
- allowedErrs = errorsAllowed;
127
- const replacementArray = [];
128
- Object.keys(settingsObject).forEach(key => {
129
- Object.values(settingsObject[key].replacements).forEach(val => {
130
- if (!replacementArray.includes(val)) {
131
- replacementArray.push(val);
152
+ module.exports = {
153
+ plugin: postcss.plugin('postcss-variable-report', cssVariableReplacementConfig => {
154
+ const rawdata = fs.readFileSync(cssVariableReplacementConfig);
155
+ const data = JSON.parse(rawdata);
156
+ const {
157
+ errorsAllowed,
158
+ settings: settingsObject // errorLog: errorLogStatus,
159
+ // errorInConsole: errorConsoleStatus
160
+
161
+ } = data; // const keys = Object.keys(settingsObject);
162
+
163
+ errHandler.setAllowedErrs(errorsAllowed);
164
+ const replacementArray = [];
165
+ Object.keys(settingsObject).forEach(key => {
166
+ Object.values(settingsObject[key].replacements).forEach(val => {
167
+ if (!replacementArray.includes(val)) {
168
+ replacementArray.push(val);
169
+ }
170
+ });
171
+ });
172
+ let regValStr = '';
173
+ replacementArray.forEach((val, index) => {
174
+ if (index !== replacementArray.length - 1) {
175
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
176
+ } else {
177
+ regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
132
178
  }
133
179
  });
134
- });
135
- let regValStr = '';
136
- replacementArray.forEach((val, index) => {
137
- if (index !== replacementArray.length - 1) {
138
- regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
139
- } else {
140
- regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
141
- }
142
- });
143
- const valRegex = new RegExp(regValStr, 'gi');
144
- return rootOriginal => {
145
- rootOriginal.walkRules(rule => {
146
- // rule.nodes[-1] = {}
147
- // need map, forEach fine less memory
148
- rule.nodes.forEach((decl, position) => {
149
- // case font-size
150
- const commentStr = 'variable:ignore';
151
- const prevNode = rule.nodes[position - 1];
152
- const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
153
- // split not need use slice and lastIndexOf less memory
154
-
155
- const filename = fromPath.split(path.sep).pop();
156
-
157
- if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
158
- const errStr = ` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${fromPath} ,\n line : ${decl.source.start.line} ,\n message : Declaration Ignored \r`;
159
- errorFunction(errStr, 'DECLARATION_IGNORED');
160
- return;
161
- }
180
+ const valRegex = new RegExp(regValStr, 'gi');
181
+ return rootOriginal => {
182
+ rootOriginal.walkRules(rule => {
183
+ // rule.nodes[-1] = {}
184
+ // need map, forEach fine less memory
185
+ rule.nodes.forEach((decl, position) => {
186
+ // case font-size
187
+ const commentStr = 'variable:ignore';
188
+ const prevNode = rule.nodes[position - 1];
189
+ const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
190
+ // split not need use slice and lastIndexOf less memory
162
191
 
163
- if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
164
- const settings = settingsObject[decl.prop]; // console.log(settings)
165
-
166
- const {
167
- allowed,
168
- range
169
- } = settings; // suggestion filter !decl.value.includes('calc')
170
- // Reason below some of logic happen based on this
171
-
172
- const unit = decl.value.toString() // no need round braket since you do not need group for less memory
173
- .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
174
- // console.log('unit : ');
175
- // console.log(unit);
176
-
177
- unit.forEach((val, index) => {
178
- allowed.forEach(alwdVal => {
179
- if (val.includes(alwdVal)) {
180
- // ## for what purpose
181
- unit[index] = val.replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`);
182
- }
192
+ const filename = fromPath.split(path.sep).pop();
193
+
194
+ if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
195
+ let errObj = {
196
+ decl,
197
+ type: 'DECLARATION_IGNORED',
198
+ filename,
199
+ message: 'Declaration Ignored',
200
+ path: fromPath
201
+ };
202
+ errHandler.errorTable.push(errObj);
203
+ errHandler.DECLARATION_IGNORED(errObj);
204
+ return;
205
+ }
206
+
207
+ if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
208
+ const settings = settingsObject[decl.prop]; // console.log(settings)
209
+
210
+ const {
211
+ allowed,
212
+ range
213
+ } = settings; // suggestion filter !decl.value.includes('calc')
214
+ // Reason below some of logic happen based on this
215
+
216
+ const unit = decl.value.toString() // no need round braket since you do not need group for less memory
217
+ .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('-',''))
218
+ // console.log('unit : ');
219
+ // console.log(unit);
220
+
221
+ unit.forEach((val, index) => {
222
+ allowed.forEach(alwdVal => {
223
+ if (val.includes(alwdVal)) {
224
+ // ## for what purpose
225
+ unit[index] = val // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
226
+ .replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`).replace(`${alwdVal},`, `${alwdVal}`);
227
+ }
228
+ });
183
229
  });
184
- });
185
- let unitError = false;
186
- let unitErrorVal = '';
187
- unit.forEach(val => {
188
- if (!val.includes('calc')) {
189
- if (!allowed.includes(val.toString())) {
190
- unitError = true;
191
- unitErrorVal = val;
230
+ let unitError = false;
231
+ let unitErrorVal = '';
232
+ unit.forEach(val => {
233
+ if (!val.includes('calc') && decl.prop !== 'clip') {
234
+ if (!allowed.includes(val.toString())) {
235
+ unitError = true;
236
+ unitErrorVal = val;
237
+ }
192
238
  }
193
- }
194
- }); // console.log(allowed, replacements, range)
195
-
196
- if (!unitError) {
197
- // use variable decl.value.split(' ')
198
- if (range) {
199
- // console.log('multiple :', decl.value)
200
- let newVal = '';
201
- decl.value.split(' ').forEach(singleVal => {
202
- newVal += `${singleConvertor(singleVal, settings.replacements.px, {
239
+ }); // console.log(allowed, replacements, range)
240
+
241
+ if (!unitError) {
242
+ // use variable decl.value.split(' ')
243
+ if (range) {
244
+ // console.log('multiple :', decl.value)
245
+ let newVal = '';
246
+ decl.value.split(' ').forEach(singleVal => {
247
+ newVal += `${singleConvertor(singleVal, settings.replacements.px, {
248
+ decl,
249
+ filename,
250
+ path: fromPath
251
+ }, range)} `;
252
+ });
253
+ decl.value = newVal;
254
+ }
255
+ } else {
256
+ if (!decl.value.includes('calc')) {
257
+ // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`);
258
+ let errObj = {
203
259
  decl,
204
260
  filename,
261
+ unitErrorVal: unitErrorVal,
205
262
  path: fromPath
206
- }, range)} `;
207
- });
208
- decl.value = newVal;
263
+ };
264
+
265
+ if (unitErrorVal.trim() === '.') {
266
+ errObj.type = 'DECIMAL_CHECK';
267
+ errObj.message = `${unitErrorVal} (Decimal Value) Please check`;
268
+ errHandler.errorTable.push(errObj);
269
+ errHandler.DECIMAL_CHECK(errObj);
270
+ } else if (unitErrorVal.includes('.') && !unitErrorVal.includes('%')) {
271
+ errObj.type = 'DECIMAL_REJECT';
272
+ errObj.message = `${unitErrorVal} (Decimal Value) Not Allowed \r`;
273
+ errHandler.errorTable.push(errObj);
274
+ errHandler.DECIMAL_REJECT(errObj);
275
+ } else {
276
+ if (!unitErrorVal.includes('%')) {
277
+ errObj.type = 'UNIT_ERROR';
278
+ errObj.message = `${unitErrorVal} (Unit) Not Allowed`;
279
+ errHandler.errorTable.push(errObj);
280
+ errHandler.UNIT_ERROR(errObj);
281
+ }
282
+ }
283
+ } else {
284
+ decl.value = pxToCalc(decl.value);
285
+ }
209
286
  }
210
287
  } else {
211
- if (!decl.value.includes('calc')) {
212
- // addError(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${path} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`);
213
- errorFunction(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${fromPath} ,\n line : ${decl.source.start.line} ,\n unit : ${unitErrorVal} ,\n message : ${unitErrorVal} (Unit) Not Allowed \r`, 'UNIT_ERROR');
214
- } else {
215
- decl.value = pxToCalc(decl.value);
288
+ 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')) {
289
+ let errObj = {
290
+ decl,
291
+ type: 'VARIABLE_PRESENT',
292
+ filename,
293
+ message: `value (${decl.value}) has var in it, kindly check`,
294
+ path: fromPath
295
+ };
296
+ errHandler.errorTable.push(errObj);
297
+ errHandler.VARIABLE_PRESENT(errObj);
216
298
  }
217
299
  }
218
- } else {
219
- 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')) {
220
- errorFunction(` prop: ${decl.prop} ,\n value : ${decl.value} ,\n filename : ${filename} ,\n filepath : ${fromPath} ,\n line : ${decl.source.start.line} ,\n message : value (${decl.value}) has var in it, kindly check`, 'VARIABLE_PRESENT');
221
- }
222
- }
223
- });
224
- }); // console.log(filename)
225
- // console.log('Done!')
226
- // console.log('----------------------------------------------------------------------------------------------------------------------')
227
-
228
- if (errorLogStatus) {
229
- fs.writeFileSync('./css_error.log', '');
230
-
231
- if (errors.length > 0) {
232
- errors.forEach(err => {
233
- fs.appendFileSync('./css_error.log', err);
234
- }); // console.log('----------------------------------------------------------------------------------------------------------------------')
235
- }
236
- }
237
-
238
- if (errorConsoleStatus) {
239
- if (errors.length > 0) {
240
- errors.forEach(err => {
241
- // fs.appendFileSync('./css_error.log', err);
242
- console.log(err);
243
300
  });
244
- console.log('----------------------------------------------------------------------------------------------------------------------');
245
- }
246
- }
247
- };
248
- });
301
+ });
302
+ };
303
+ }),
304
+ errors: errHandler.errors,
305
+ errTable: errHandler.errorTable,
306
+ errHandler
307
+ };
@@ -91,10 +91,6 @@ var _default = {
91
91
  cssDirStatement: null
92
92
  },
93
93
  app: {
94
- moduleResolvePath: {
95
- value: '',
96
- cli: 'module_resolve_path'
97
- },
98
94
  // this option only for impact testing
99
95
  devCssFileBountry: {
100
96
  value: '',
@@ -141,10 +137,6 @@ var _default = {
141
137
  value: 'dev',
142
138
  cli: 'app_mode'
143
139
  },
144
- httpsCerts: {
145
- value: '',
146
- cli: 'https_certs'
147
- },
148
140
  branch: {
149
141
  value: 'master',
150
142
  cli: 'app_branch'
@@ -225,15 +217,22 @@ var _default = {
225
217
  hasRTL: false,
226
218
  hoverActive: false,
227
219
  combinerMediaQuery: false,
228
- cssVariableReplacement: false
220
+ cssVariableReplacement: false,
221
+ selectorWeight: false
229
222
  },
230
223
  exclude: {
231
224
  rtl: [],
232
225
  hoverActive: [],
233
226
  combinerMediaQuery: [],
234
- cssVariableReplacement: []
227
+ cssVariableReplacement: [],
228
+ selectorWeight: []
235
229
  },
236
230
  cssVariableReplacementConfig: '',
231
+ selectorWeightConfig: {
232
+ defaultSelector: '',
233
+ customFileDetails: '',
234
+ excludeStrings: []
235
+ },
237
236
  seperateCssModules: {
238
237
  value: false,
239
238
  cli: 'sep_cssmodules'
@@ -315,15 +314,22 @@ var _default = {
315
314
  hasRTL: false,
316
315
  hoverActive: false,
317
316
  combinerMediaQuery: false,
318
- cssVariableReplacement: false
317
+ cssVariableReplacement: false,
318
+ selectorWeight: false
319
319
  },
320
320
  exclude: {
321
321
  rtl: [],
322
322
  hoverActive: [],
323
323
  combinerMediaQuery: [],
324
- cssVariableReplacement: []
324
+ cssVariableReplacement: [],
325
+ selectorWeight: []
325
326
  },
326
327
  cssVariableReplacementConfig: '',
328
+ selectorWeightConfig: {
329
+ defaultSelector: '',
330
+ customFileDetails: '',
331
+ excludeStrings: []
332
+ },
327
333
  cssHashSelectors: {
328
334
  filenames: [],
329
335
  packages: []
@@ -29,29 +29,28 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
29
29
 
30
30
  // import fs from 'fs';
31
31
  var _default = isSSTest => {
32
- const options = (0, _utils.getOptions)();
33
- const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
34
- const {
32
+ let options = (0, _utils.getOptions)();
33
+ let {
35
34
  docs: {
36
35
  server
37
36
  }
38
37
  } = options;
39
- const {
38
+ let {
40
39
  port,
41
40
  branch,
42
41
  host,
43
42
  domain,
44
43
  iphost
45
44
  } = server;
46
- const appPath = process.cwd();
45
+ let appPath = process.cwd();
47
46
  const app = (0, _express.default)();
48
47
  app.use(_express.default.json());
49
48
  app.use(_express.default.urlencoded({
50
49
  extended: true
51
50
  }));
52
- const docsConfig = (0, _webpackDocs.default)(isSSTest);
53
- const compiler = (0, _webpack.default)(docsConfig);
54
- const wdm = (0, _webpackDevMiddleware.default)(compiler, {
51
+ let docsConfig = (0, _webpackDocs.default)(isSSTest);
52
+ let compiler = (0, _webpack.default)(docsConfig);
53
+ let wdm = (0, _webpackDevMiddleware.default)(compiler, {
55
54
  logLevel: 'error',
56
55
  publicPath: docsConfig.output.publicPath,
57
56
  headers: {
@@ -68,7 +67,7 @@ var _default = isSSTest => {
68
67
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
69
68
  });
70
69
  app.use('/author/get', (req, res) => {
71
- const {
70
+ let {
72
71
  query: {
73
72
  componentName = ''
74
73
  }
@@ -85,7 +84,7 @@ var _default = isSSTest => {
85
84
 
86
85
  if (branch) {
87
86
  app.post('/repo/merge', (req, res) => {
88
- const {
87
+ let {
89
88
  ref
90
89
  } = req.body;
91
90
 
@@ -99,7 +98,7 @@ var _default = isSSTest => {
99
98
  });
100
99
  }
101
100
 
102
- const httpsServer = _https.default.createServer(httpsOptions, app);
101
+ const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
103
102
 
104
103
  if (!isSSTest) {
105
104
  httpsServer.listen(port, err => {
@@ -111,8 +110,8 @@ var _default = isSSTest => {
111
110
  });
112
111
  }
113
112
 
114
- const httpPort = Number(port) + 1;
115
- const http = app.listen(httpPort, err => {
113
+ let httpPort = Number(port) + 1;
114
+ let http = app.listen(httpPort, err => {
116
115
  if (err) {
117
116
  throw err;
118
117
  }