@zohodesk/react-cli 1.0.2-exp.2 → 1.0.3
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.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -180
- package/.prettierrc +6 -6
- package/Changelog.md +1019 -1019
- package/README.md +1184 -1165
- package/bin/cli.js +483 -483
- package/docs/CustomChunks.md +26 -26
- package/docs/DevServerPort.md +39 -39
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/SelectorWeight.md +8 -8
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +729 -729
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/testPattern.js +0 -2
- package/lib/common/valueReplacer.js +1 -3
- package/lib/configs/resolvers.js +14 -3
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +0 -6
- package/lib/configs/webpack.docs.config.js +0 -4
- package/lib/configs/webpack.impact.config.js +0 -4
- package/lib/configs/webpack.prod.config.js +0 -6
- package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
- package/lib/loaderUtils/getCSSLoaders.js +47 -81
- package/lib/loaderUtils/windowsModification.js +1 -6
- package/lib/loaders/selectorMappingLoader.js +9 -9
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/logger.js +20 -0
- package/lib/pluginUtils/getDevPlugins.js +12 -18
- package/lib/pluginUtils/getProdPlugins.js +10 -6
- package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
- package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
- package/lib/plugins/CustomAttributePlugin.js +82 -0
- package/lib/plugins/CustomAttributePlugin.md +35 -0
- package/lib/plugins/EFCPlugin.js +9 -9
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +10 -12
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -13
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +10 -15
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/SelectorPlugin.js +36 -53
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/{MinifyPlugin.js → UglifyCSSPlugin.js} +3 -3
- package/lib/plugins/VariableConversionCollector.js +84 -97
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +7 -7
- package/lib/postcss-plugins/ExcludePlugin.js +1 -1
- package/lib/postcss-plugins/IncludePlugin.js +0 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +14 -20
- package/lib/postcss-plugins/ValueReplacer.js +14 -5
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +3 -9
- package/lib/postcss-plugins/variableModificationPlugin/index.js +20 -3
- package/lib/postcss-plugins/variableModifier.js +24 -58
- package/lib/schemas/index.js +11 -35
- package/lib/servers/devBuild.js +13 -11
- package/lib/servers/httpsOptions.js +12 -13
- package/lib/servers/nowatchserver.js +5 -3
- package/lib/servers/requireLocalOrGlobal.js +61 -0
- package/lib/servers/server.js +3 -5
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssClassNameGenerate.js +12 -41
- package/lib/utils/resultSchema.json +73 -73
- package/npm8.md +9 -9
- package/package-lock.json +14407 -0
- package/package.json +120 -122
- package/postpublish.js +8 -8
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1501
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/lib/loaderUtils/tests/windowsModification.test.js +0 -10
- package/lib/loaders/composeLoader.js +0 -175
- package/lib/plugins/utils/classHandling.js +0 -20
- package/lib/plugins/utils/fileHandling.js +0 -92
- package/lib/plugins/utils/tests/fileHandling.test.js +0 -30
- package/lib/postcss-plugins/EmptyPlugin.js +0 -8
|
@@ -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;
|
package/lib/plugins/index.js
CHANGED
|
@@ -33,12 +33,6 @@ Object.defineProperty(exports, "ManifestPlugin", {
|
|
|
33
33
|
return _ManifestPlugin.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "MinifyPlugin", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _MinifyPlugin.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
36
|
Object.defineProperty(exports, "ModuleStatsPlugin", {
|
|
43
37
|
enumerable: true,
|
|
44
38
|
get: function () {
|
|
@@ -105,6 +99,12 @@ Object.defineProperty(exports, "TPHashMappingPlugin", {
|
|
|
105
99
|
return _TPHashMappingPlugin.default;
|
|
106
100
|
}
|
|
107
101
|
});
|
|
102
|
+
Object.defineProperty(exports, "UglifyCSSPlugin", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _UglifyCSSPlugin.default;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
108
|
Object.defineProperty(exports, "UnusedFilesFindPlugin", {
|
|
109
109
|
enumerable: true,
|
|
110
110
|
get: function () {
|
|
@@ -126,7 +126,7 @@ var _OptimizeJSPlugin = _interopRequireDefault(require("./OptimizeJSPlugin"));
|
|
|
126
126
|
|
|
127
127
|
var _ResourceHintsPlugin = _interopRequireDefault(require("./ResourceHintsPlugin"));
|
|
128
128
|
|
|
129
|
-
var
|
|
129
|
+
var _UglifyCSSPlugin = _interopRequireDefault(require("./UglifyCSSPlugin"));
|
|
130
130
|
|
|
131
131
|
var _ManifestPlugin = _interopRequireDefault(require("./ManifestPlugin"));
|
|
132
132
|
|
|
@@ -10,7 +10,7 @@ module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
|
|
|
10
10
|
} = opts;
|
|
11
11
|
return (root, result) => {
|
|
12
12
|
const inputFile = root.source.input.file;
|
|
13
|
-
|
|
13
|
+
let isIgnoredFile = opts.ignore.some(file => inputFile.indexOf(file) !== -1);
|
|
14
14
|
|
|
15
15
|
if (!isIgnoredFile) {
|
|
16
16
|
const handler = response => response.messages.forEach(msg => result.messages.push(msg));
|
|
@@ -13,7 +13,6 @@ module.exports = _postcss.default.plugin('postcss-include-files', opts => {
|
|
|
13
13
|
const includeFile = opts.include.some(file => inputFile.indexOf(file) !== -1);
|
|
14
14
|
|
|
15
15
|
if (includeFile) {
|
|
16
|
-
// console.log(inputFile);
|
|
17
16
|
const handler = response => response.messages.forEach(msg => result.messages.push(msg));
|
|
18
17
|
|
|
19
18
|
return (0, _postcss.default)(plugins).process(root, {
|
|
@@ -18,7 +18,6 @@ const oppositeDir = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
function compareSelector(selector1, selector2) {
|
|
21
|
-
// console.log({ selector1, selector2 }, selector1 === selector2);
|
|
22
21
|
return selector1 === selector2;
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -38,11 +37,11 @@ function selectorMinifySameDir(selector, direction) {
|
|
|
38
37
|
const regex = getRegex(direction);
|
|
39
38
|
return selector.replace(regex, '').trim();
|
|
40
39
|
}
|
|
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
|
|
40
|
+
/**
|
|
41
|
+
* this funtion will remove given rule,
|
|
42
|
+
* if given selector and it's previous sibiling rule selector are same
|
|
43
|
+
* current rule properties will move to previous sibiling rule.
|
|
44
|
+
* @param {Rule} rule current rule
|
|
46
45
|
*/
|
|
47
46
|
|
|
48
47
|
|
|
@@ -57,16 +56,15 @@ function mergeIfSameSelector(rule) {
|
|
|
57
56
|
rule.remove();
|
|
58
57
|
}
|
|
59
58
|
}
|
|
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
|
|
59
|
+
/**
|
|
60
|
+
* this funtion will remove given rule,
|
|
61
|
+
* if given selector and it's previous sibiling rule selector are same
|
|
62
|
+
* current rule properties will move to previous sibiling rule.
|
|
63
|
+
* @param {Rule} rule current rule
|
|
65
64
|
*/
|
|
66
65
|
|
|
67
66
|
|
|
68
67
|
function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
69
|
-
// console.log({ rule, type: rule.type });
|
|
70
68
|
const selectors = rule.selector.split(/\s*,\s*/); // NOTE: if we use opposite dir selector as custom override reason,
|
|
71
69
|
// and compain normal selector with it, In this case
|
|
72
70
|
// we just a have to remove that selector only not full rule
|
|
@@ -87,11 +85,10 @@ function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
function removeIfOppsiteDirKeyframe(rule, direction) {
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const name = rule.params;
|
|
89
|
+
const keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
|
|
92
90
|
|
|
93
91
|
if (keyFrameDirName === oppositeDir[direction]) {
|
|
94
|
-
// console.log({ m: 'removed', keyFrameName: rule.params });
|
|
95
92
|
rule.remove();
|
|
96
93
|
}
|
|
97
94
|
}
|
|
@@ -109,12 +106,10 @@ function separateSingleDir(root, direction, rootOptions) {
|
|
|
109
106
|
|
|
110
107
|
function separateRtlAndLtr(css, rootOptions) {
|
|
111
108
|
// let processor = postcss([]).process(css);
|
|
112
|
-
|
|
113
|
-
// console.log(processor, root);
|
|
109
|
+
const root = postcss.parse(css); // let { root } = processor;
|
|
114
110
|
// NOTE: I did first rtl then ltr , Because for ltr I use original root ref
|
|
115
111
|
|
|
116
|
-
const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions);
|
|
117
|
-
|
|
112
|
+
const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions);
|
|
118
113
|
const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
|
|
119
114
|
return {
|
|
120
115
|
ltrRoot,
|
|
@@ -132,7 +127,6 @@ function separateRtlAndLtr(css, rootOptions) {
|
|
|
132
127
|
// // root.append(postcss.comment({ text: 'comment' }));
|
|
133
128
|
// root.append(postcss.comment({ text: 'this is spliting part ' }));
|
|
134
129
|
// root.append(rtlRoot);
|
|
135
|
-
// //console.log({root, roots:root+""}, root+"")
|
|
136
130
|
// // Transform CSS AST here
|
|
137
131
|
// }
|
|
138
132
|
// );
|
|
@@ -18,18 +18,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
// }
|
|
19
19
|
// };
|
|
20
20
|
// });
|
|
21
|
-
// export default
|
|
21
|
+
// export default
|
|
22
22
|
module.exports = _postcss.default.plugin('postcss-value-replacer', (valueReplacer = {}) => // Work with options here
|
|
23
23
|
root => {
|
|
24
24
|
root.walkDecls(decl => {
|
|
25
25
|
valueReplacer.forEach(obj => {
|
|
26
26
|
if (obj.props.indexOf(decl.prop) !== -1) {
|
|
27
|
-
|
|
27
|
+
const ks = Object.keys(obj.values).sort((a, b) => b.length - a.length);
|
|
28
28
|
ks.forEach(k => {
|
|
29
29
|
decl.value = decl.value.replace(k, obj.values[k]);
|
|
30
30
|
}); //decl.value = obj.values[decl.value];
|
|
31
31
|
}
|
|
32
|
-
}); //
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
}); // Transform CSS AST here
|
|
33
|
+
}); // root.walkDecls(decl => {
|
|
34
|
+
// valueReplacer.forEach(obj => {
|
|
35
|
+
// if (
|
|
36
|
+
// obj.props.indexOf(decl.prop) !== -1 &&
|
|
37
|
+
// obj.values[decl.value] !== undefined
|
|
38
|
+
// ) {
|
|
39
|
+
// decl.value = obj.values[decl.value];
|
|
40
|
+
// }
|
|
41
|
+
// });
|
|
42
|
+
// // Transform CSS AST here
|
|
43
|
+
// });
|
|
35
44
|
});
|
|
@@ -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
|
}
|
|
@@ -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',
|
|
@@ -158,7 +158,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
158
158
|
|
|
159
159
|
function mediaCommaQuery(rule, index) {
|
|
160
160
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
|
161
|
-
//console.log(hovMed, actMed);
|
|
162
161
|
let newSelector = '';
|
|
163
162
|
const {
|
|
164
163
|
hovMed,
|
|
@@ -232,7 +231,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
function commaQuery(rule, index) {
|
|
235
|
-
//console.log("comma" , rule.selector.split('\n'));
|
|
236
234
|
let newSelector = '';
|
|
237
235
|
const hovQueries = [];
|
|
238
236
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
|
@@ -288,13 +286,10 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
288
286
|
});
|
|
289
287
|
rootOriginal.walkRules(/:hover/i, (rule, index) => {
|
|
290
288
|
// media hover query with ',' ' ' '+'
|
|
291
|
-
// console.log("media query" , rule.selector)
|
|
292
289
|
if (rule.parent.type === 'atrule' && rule.selector.includes(',')) {
|
|
293
|
-
//console.log("media comma", rule.selector)
|
|
294
290
|
mediaCommaQuery(rule, index);
|
|
295
291
|
} else {
|
|
296
292
|
// plus, space and other media queries
|
|
297
|
-
//console.log("media", rule.selector)
|
|
298
293
|
mediaQuery(rule, index);
|
|
299
294
|
} // usual hover query
|
|
300
295
|
|
|
@@ -311,7 +306,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
|
311
306
|
if (rule.selector.includes(',')) {
|
|
312
307
|
commaQuery(rule, index);
|
|
313
308
|
} else if (rule.selector.match(/ +|\++/g)) {
|
|
314
|
-
//console.log("plus or space" , rule.selector);
|
|
315
309
|
if (rule.selector.includes('hover')) {
|
|
316
310
|
hoverRules.push({
|
|
317
311
|
rule,
|
|
@@ -127,7 +127,25 @@ const singleConvertor = (value, changeVal, details, range) => {
|
|
|
127
127
|
path: path
|
|
128
128
|
};
|
|
129
129
|
errHandler.errorTable.push(errObj);
|
|
130
|
-
errHandler.errorFunction(errObj);
|
|
130
|
+
errHandler.errorFunction(errObj); // errorFunction(
|
|
131
|
+
// {
|
|
132
|
+
// decl,
|
|
133
|
+
// type: 'RANGE_ERROR',
|
|
134
|
+
// filename,
|
|
135
|
+
// message: `value (${value}) (${typeof value}) not within range (${
|
|
136
|
+
// range.start
|
|
137
|
+
// },${range.end})\r`,
|
|
138
|
+
// path: path
|
|
139
|
+
// },
|
|
140
|
+
// 'RANGE_ERROR'
|
|
141
|
+
// );
|
|
142
|
+
// }
|
|
143
|
+
// 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`)
|
|
144
|
+
// return value;
|
|
145
|
+
// } else {
|
|
146
|
+
// console.log('++++++++++++++++++++++rect val!', value);
|
|
147
|
+
// }
|
|
148
|
+
|
|
131
149
|
return;
|
|
132
150
|
};
|
|
133
151
|
|
|
@@ -188,8 +206,7 @@ module.exports = {
|
|
|
188
206
|
}
|
|
189
207
|
|
|
190
208
|
if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
|
|
191
|
-
const settings = settingsObject[decl.prop];
|
|
192
|
-
|
|
209
|
+
const settings = settingsObject[decl.prop];
|
|
193
210
|
const {
|
|
194
211
|
allowed,
|
|
195
212
|
range
|
|
@@ -7,19 +7,19 @@ const path = require('path');
|
|
|
7
7
|
const fs = require('fs');
|
|
8
8
|
|
|
9
9
|
function populateArray(start, end) {
|
|
10
|
-
|
|
10
|
+
const temp = [];
|
|
11
11
|
|
|
12
|
-
for (
|
|
12
|
+
for (let i = start; i < end; i++) {
|
|
13
13
|
temp.push(i);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return temp;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const allwdVars = {
|
|
20
20
|
'font-size': ['px', 'em']
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const numberObject = {
|
|
23
23
|
'font-size': {
|
|
24
24
|
allowed: ['px', 'em'],
|
|
25
25
|
replacements: {
|
|
@@ -89,27 +89,21 @@ function hasIgnoreComment(node) {
|
|
|
89
89
|
return node ? node.type == 'comment' ? node.text == 'Variable:Ignore' ? true : false : false : false;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
const errors = [];
|
|
93
93
|
module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal => {
|
|
94
|
-
// console.log('inside postcss plugin')
|
|
95
|
-
// fs.writeFile('./css_error.log', '\r\nLog File: \r\n\r\n', (err) => {
|
|
96
|
-
// if(err)console.log(err);
|
|
97
|
-
// });
|
|
98
|
-
// console.log(rootOriginal.source.input.file);
|
|
99
94
|
if (!rootOriginal.source.input.file.includes('css_error')) {
|
|
100
95
|
rootOriginal.walkRules(rule => {
|
|
101
96
|
rule.walkDecls((decl, position) => {
|
|
102
97
|
// case font-size
|
|
103
98
|
if (!hasIgnoreComment(rule.nodes[position - 1])) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
let path = rootOriginal.source.input.from;
|
|
99
|
+
const unit = decl.value.replace(/[0-9]/g, '');
|
|
100
|
+
const settings = numberObject[decl.prop];
|
|
101
|
+
const path = rootOriginal.source.input.from;
|
|
108
102
|
let filename = path.split('\\');
|
|
109
103
|
filename = filename[filename.length - 1];
|
|
110
104
|
|
|
111
105
|
if (decl.prop === 'font-size' || decl.prop === 'margin-left' || decl.prop === 'margin-right' || decl.prop === 'margin-top' || decl.prop === 'margin-bottom') {
|
|
112
|
-
|
|
106
|
+
const {
|
|
113
107
|
allowed,
|
|
114
108
|
replacements,
|
|
115
109
|
available
|
|
@@ -118,12 +112,11 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
|
|
|
118
112
|
if (!rootOriginal.source.input.from.includes('node_modules')) {
|
|
119
113
|
if (unit != 0) {
|
|
120
114
|
if (allowed.includes(unit)) {
|
|
121
|
-
// console.log(available, parseInt(decl.value))
|
|
122
115
|
if (available.includes(parseInt(decl.value))) {
|
|
123
116
|
// replacementValues[unit].push({[decl.value] : replacements[unit].replace('$$', parseInt(decl.value))})
|
|
124
|
-
decl.value = replacements[unit].replace('$$', parseInt(decl.value));
|
|
117
|
+
decl.value = replacements[unit].replace('$$', parseInt(decl.value));
|
|
125
118
|
} else {
|
|
126
|
-
|
|
119
|
+
const err = {
|
|
127
120
|
prop: decl.prop,
|
|
128
121
|
value: decl.value,
|
|
129
122
|
filename,
|
|
@@ -135,7 +128,7 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
|
|
|
135
128
|
errors.push(err);
|
|
136
129
|
}
|
|
137
130
|
} else {
|
|
138
|
-
|
|
131
|
+
const err = {
|
|
139
132
|
prop: decl.prop,
|
|
140
133
|
value: decl.value,
|
|
141
134
|
filename,
|
|
@@ -149,36 +142,33 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
|
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
} else if (decl.prop === 'margin') {
|
|
152
|
-
|
|
145
|
+
const {
|
|
153
146
|
allowed,
|
|
154
147
|
replacements,
|
|
155
148
|
available
|
|
156
|
-
} = settings;
|
|
157
|
-
|
|
158
|
-
let valArr = decl.value.split(' '); //console.log(valArr)
|
|
159
|
-
//console.log(allowed, replacements, available)
|
|
160
|
-
|
|
149
|
+
} = settings;
|
|
150
|
+
const valArr = decl.value.split(' ');
|
|
161
151
|
let hasError = false;
|
|
162
152
|
let newVal = '';
|
|
163
153
|
valArr.forEach(val => {
|
|
164
|
-
|
|
165
|
-
|
|
154
|
+
const unit = val.replace(parseInt(val), '');
|
|
155
|
+
const numVal = parseInt(val);
|
|
166
156
|
|
|
167
157
|
if (unit != 0) {
|
|
168
158
|
if (allowed.includes(unit)) {
|
|
169
159
|
if (available.includes(numVal)) {
|
|
170
160
|
if (numVal >= 0) {
|
|
171
161
|
if (!hasError) {
|
|
172
|
-
newVal += replacements[unit].replace('$$', numVal)
|
|
162
|
+
newVal += `${replacements[unit].replace('$$', numVal)} `;
|
|
173
163
|
}
|
|
174
164
|
} else {
|
|
175
165
|
if (!hasError) {
|
|
176
|
-
newVal += `calc(${replacements[unit].replace('$$', numVal * -1)} * -1)` +
|
|
166
|
+
newVal += `calc(${replacements[unit].replace('$$', numVal * -1)} * -1)` + ' ';
|
|
177
167
|
}
|
|
178
168
|
}
|
|
179
169
|
} else {
|
|
180
170
|
hasError = true;
|
|
181
|
-
|
|
171
|
+
const err = {
|
|
182
172
|
prop: decl.prop,
|
|
183
173
|
value: numVal,
|
|
184
174
|
filename,
|
|
@@ -191,7 +181,7 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
|
|
|
191
181
|
}
|
|
192
182
|
} else {
|
|
193
183
|
hasError = true;
|
|
194
|
-
|
|
184
|
+
const err = {
|
|
195
185
|
prop: decl.prop,
|
|
196
186
|
value: decl.value,
|
|
197
187
|
filename,
|
|
@@ -211,34 +201,10 @@ module.exports = postcss.plugin('postcss-variable-report', () => rootOriginal =>
|
|
|
211
201
|
}
|
|
212
202
|
}
|
|
213
203
|
});
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// else{
|
|
217
|
-
// console.log('updated successfully');
|
|
218
|
-
// }
|
|
219
|
-
// })
|
|
220
|
-
// console.log(errors)
|
|
221
|
-
|
|
222
|
-
let errorArr = [];
|
|
204
|
+
});
|
|
205
|
+
const errorArr = [];
|
|
223
206
|
errors.forEach(errStr => {
|
|
224
207
|
errorArr.push(` prop: ${errStr.prop} ,\n value : ${errStr.value} ,\n filename : ${errStr.filename} ,\n filepath : ${errStr.filepath} ,\n line : ${errStr.line} ,\n unit : ${errStr.unit} ,\n message : ${errStr.message} \r`);
|
|
225
|
-
});
|
|
226
|
-
// if(err){
|
|
227
|
-
// console.log(err);
|
|
228
|
-
// }
|
|
229
|
-
//});
|
|
230
|
-
// errorArr.forEach(err => {
|
|
231
|
-
// let data = `\n{\n${err}\n},\n`;
|
|
232
|
-
// //fs.appendFile('./css_error.log',data,(err)=>{
|
|
233
|
-
// // if(err){
|
|
234
|
-
// // console.log(err);
|
|
235
|
-
// // }
|
|
236
|
-
// //})
|
|
237
|
-
// });
|
|
238
|
-
// fs.writeFileSync('./css_error.log','');
|
|
239
|
-
// errorArr.forEach(err => {
|
|
240
|
-
// let data = `\n{\n${err}\n},\n`;
|
|
241
|
-
// fs.appendFileSync('./css_error.log',data);
|
|
242
|
-
// });
|
|
208
|
+
});
|
|
243
209
|
}
|
|
244
210
|
});
|