@zohodesk/react-cli 1.1.14-kubernetes → 1.1.15
Sign up to get free protection for your applications and to get access to all the features.
- package/.vscode/settings.json +25 -0
- package/README.md +294 -16
- package/bin/cli.js +30 -55
- package/docs/ComposeMinification.md +13 -0
- package/docs/CustomChunks.md +12 -9
- package/docs/MarkdownParser.md +18 -0
- package/docs/ReactLive.md +14 -0
- package/docs/SelectorWeight.md +3 -0
- package/docs/ValueReplacer.md +27 -0
- package/docs/VariableConversion.md +6 -1
- package/docs/patternFiltering.md +57 -0
- package/lib/common/buildEs.js +12 -0
- package/lib/common/runPreProcess.js +71 -0
- package/lib/common/splitChunks.js +65 -45
- package/lib/common/testPattern.js +9 -11
- package/lib/common/valueReplacer.js +1 -3
- package/lib/configs/resolvers.js +16 -5
- package/lib/configs/webpack.css.umd.config.js +3 -2
- package/lib/configs/webpack.dev.config.js +15 -5
- package/lib/configs/webpack.docs.config.js +17 -5
- package/lib/configs/webpack.impact.config.js +11 -4
- package/lib/configs/webpack.prod.config.js +15 -5
- package/lib/constants.js +3 -3
- package/lib/deprecationLogger.js +40 -0
- package/lib/loaderUtils/getCSSLoaders.js +98 -49
- package/lib/loaderUtils/tests/windowsModification.test.js +10 -0
- package/lib/loaderUtils/windowsModification.js +6 -1
- package/lib/loaders/__test__/markdownLoader.spec.js +145 -0
- package/lib/loaders/composeLoader.js +298 -0
- package/lib/loaders/docsLoader.js +18 -7
- package/lib/loaders/markdownLoader.js +71 -0
- package/lib/loaders/reactLiveConvertor.js +105 -0
- package/lib/loaders/selectorMappingLoader.js +9 -9
- package/lib/logger.js +27 -0
- package/lib/pluginUtils/getDevPlugins.js +25 -6
- package/lib/pluginUtils/getProdPlugins.js +32 -5
- 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/EFCTemplatePlugin.js +10 -12
- package/lib/plugins/EfcResourceCleanupPlugin.js +43 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +8 -9
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +2 -7
- package/lib/plugins/I18nSplitPlugin/index.js +1 -1
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
- package/lib/plugins/{UglifyCSSPlugin.js → MinifyPlugin.js} +3 -3
- package/lib/plugins/ReportGeneratePlugin.js +8 -6
- package/lib/plugins/ResourceHintsPlugin.js +13 -3
- package/lib/plugins/SelectorPlugin.js +77 -37
- package/lib/plugins/StatsPlugin.js +82 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +7 -5
- package/lib/plugins/VariableConversionCollector.js +40 -101
- package/lib/plugins/index.js +7 -7
- package/lib/plugins/utils/classHandling.js +35 -0
- package/lib/plugins/utils/fileHandling.js +92 -0
- package/lib/plugins/utils/tests/fileHandling.test.js +30 -0
- package/lib/plugins/variableConvertorUtils.js +133 -0
- package/lib/postcss-plugins/EmptyPlugin.js +8 -0
- package/lib/postcss-plugins/ExcludePlugin.js +1 -1
- package/lib/postcss-plugins/IncludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +4 -10
- package/lib/postcss-plugins/SelectorReplace.js +80 -0
- package/lib/postcss-plugins/ValueReplacer.js +8 -29
- package/lib/postcss-plugins/__test__/selectorReplace.test.js +28 -0
- package/lib/postcss-plugins/__test__/valueReplacer.spec.js +43 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +0 -6
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -1
- package/lib/postcss-plugins/variableModificationPlugin/index.js +94 -38
- package/lib/schemas/index.js +95 -18
- package/lib/servers/devBuild.js +13 -11
- package/lib/servers/getCliPath.js +3 -5
- package/lib/servers/httpsOptions.js +12 -13
- package/lib/servers/nowatchserver.js +62 -55
- package/lib/servers/requireLocalOrGlobal.js +61 -0
- package/lib/servers/server.js +53 -52
- package/lib/utils/cssClassNameGenerate.js +70 -13
- package/lib/utils/deprecationSupport.js +134 -0
- package/lib/utils/getOptions.js +35 -28
- package/lib/utils/getServerURL.js +1 -9
- package/lib/utils/index.js +14 -12
- package/lib/utils/initPreCommitHook.js +5 -5
- package/lib/utils/log.js +11 -0
- package/lib/utils/object-manipulation.js +88 -0
- package/lib/utils/pullOrigin.js +3 -3
- package/lib/utils/reinstallDependencies.js +3 -3
- package/lib/utils/selectorReplacer.js +47 -0
- package/lib/utils/switchBranch.js +4 -2
- package/lib/utils/variableConverter.js +104 -0
- package/npm-shrinkwrap.json +33485 -0
- package/package.json +5 -3
- package/templates/docs/all.html +1 -0
- package/templates/docs/component.html +1 -0
- package/templates/docs/components.html +1 -0
- package/templates/docs/css/markdown.css +202 -0
- package/templates/docs/css/style.css +136 -169
- package/templates/docs/index.html +796 -632
- package/lib/plugins/composeCommonPlugin.js +0 -30
- package/lib/postcss-plugins/variableModifier.js +0 -244
@@ -1,30 +0,0 @@
|
|
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;
|
@@ -1,244 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const postcss = require('postcss');
|
4
|
-
|
5
|
-
const path = require('path');
|
6
|
-
|
7
|
-
const fs = require('fs');
|
8
|
-
|
9
|
-
function populateArray(start, end) {
|
10
|
-
let temp = [];
|
11
|
-
|
12
|
-
for (var i = start; i < end; i++) {
|
13
|
-
temp.push(i);
|
14
|
-
}
|
15
|
-
|
16
|
-
return temp;
|
17
|
-
}
|
18
|
-
|
19
|
-
let allwdVars = {
|
20
|
-
'font-size': ['px', 'em']
|
21
|
-
};
|
22
|
-
let numberObject = {
|
23
|
-
'font-size': {
|
24
|
-
allowed: ['px', 'em'],
|
25
|
-
replacements: {
|
26
|
-
px: 'var(--zd_font_size$$)',
|
27
|
-
em: 'var(--zd_font_size$$em)'
|
28
|
-
},
|
29
|
-
//[5,10,15,20,25],
|
30
|
-
available: populateArray(0, 251),
|
31
|
-
replacementValues: {
|
32
|
-
px: [],
|
33
|
-
em: []
|
34
|
-
}
|
35
|
-
},
|
36
|
-
'margin': {
|
37
|
-
allowed: ['px'],
|
38
|
-
replacements: {
|
39
|
-
px: 'var(--zd_size$$)'
|
40
|
-
},
|
41
|
-
available: populateArray(-250, 251),
|
42
|
-
replacementValues: {
|
43
|
-
px: []
|
44
|
-
}
|
45
|
-
},
|
46
|
-
'margin-left': {
|
47
|
-
allowed: ['px'],
|
48
|
-
replacements: {
|
49
|
-
px: 'var(--zd_size$$)'
|
50
|
-
},
|
51
|
-
available: populateArray(-250, 251),
|
52
|
-
replacementValues: {
|
53
|
-
px: []
|
54
|
-
}
|
55
|
-
},
|
56
|
-
'margin-right': {
|
57
|
-
allowed: ['px'],
|
58
|
-
replacements: {
|
59
|
-
px: 'var(--zd_size$$)'
|
60
|
-
},
|
61
|
-
available: populateArray(-250, 251),
|
62
|
-
replacementValues: {
|
63
|
-
px: []
|
64
|
-
}
|
65
|
-
},
|
66
|
-
'margin-top': {
|
67
|
-
allowed: ['px'],
|
68
|
-
replacements: {
|
69
|
-
px: 'var(--zd_size$$)'
|
70
|
-
},
|
71
|
-
available: populateArray(-250, 251),
|
72
|
-
replacementValues: {
|
73
|
-
px: []
|
74
|
-
}
|
75
|
-
},
|
76
|
-
'margin-bottom': {
|
77
|
-
allowed: ['px'],
|
78
|
-
replacements: {
|
79
|
-
px: 'var(--zd_size$$)'
|
80
|
-
},
|
81
|
-
available: populateArray(-250, 251),
|
82
|
-
replacementValues: {
|
83
|
-
px: []
|
84
|
-
}
|
85
|
-
}
|
86
|
-
};
|
87
|
-
|
88
|
-
function hasIgnoreComment(node) {
|
89
|
-
return node ? node.type == 'comment' ? node.text == 'Variable:Ignore' ? true : false : false : false;
|
90
|
-
}
|
91
|
-
|
92
|
-
let errors = [];
|
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
|
-
if (!rootOriginal.source.input.file.includes('css_error')) {
|
100
|
-
rootOriginal.walkRules(rule => {
|
101
|
-
rule.walkDecls((decl, position) => {
|
102
|
-
// case font-size
|
103
|
-
if (!hasIgnoreComment(rule.nodes[position - 1])) {
|
104
|
-
console.log(settings);
|
105
|
-
let unit = decl.value.replace(/[0-9]/g, '');
|
106
|
-
let settings = numberObject[decl.prop];
|
107
|
-
let path = rootOriginal.source.input.from;
|
108
|
-
let filename = path.split('\\');
|
109
|
-
filename = filename[filename.length - 1];
|
110
|
-
|
111
|
-
if (decl.prop === 'font-size' || decl.prop === 'margin-left' || decl.prop === 'margin-right' || decl.prop === 'margin-top' || decl.prop === 'margin-bottom') {
|
112
|
-
let {
|
113
|
-
allowed,
|
114
|
-
replacements,
|
115
|
-
available
|
116
|
-
} = settings;
|
117
|
-
|
118
|
-
if (!rootOriginal.source.input.from.includes('node_modules')) {
|
119
|
-
if (unit != 0) {
|
120
|
-
if (allowed.includes(unit)) {
|
121
|
-
// console.log(available, parseInt(decl.value))
|
122
|
-
if (available.includes(parseInt(decl.value))) {
|
123
|
-
// replacementValues[unit].push({[decl.value] : replacements[unit].replace('$$', parseInt(decl.value))})
|
124
|
-
decl.value = replacements[unit].replace('$$', parseInt(decl.value)); //console.log("replacements:")
|
125
|
-
} else {
|
126
|
-
let err = {
|
127
|
-
prop: decl.prop,
|
128
|
-
value: decl.value,
|
129
|
-
filename,
|
130
|
-
filepath: rootOriginal.source.input.from,
|
131
|
-
line: decl.source.start.line,
|
132
|
-
unit,
|
133
|
-
message: 'value not available consider others'
|
134
|
-
};
|
135
|
-
errors.push(err);
|
136
|
-
}
|
137
|
-
} else {
|
138
|
-
let err = {
|
139
|
-
prop: decl.prop,
|
140
|
-
value: decl.value,
|
141
|
-
filename,
|
142
|
-
filepath: rootOriginal.source.input.from,
|
143
|
-
line: decl.source.start.line,
|
144
|
-
unit,
|
145
|
-
message: 'Unit not supported'
|
146
|
-
};
|
147
|
-
errors.push(err);
|
148
|
-
}
|
149
|
-
}
|
150
|
-
}
|
151
|
-
} else if (decl.prop === 'margin') {
|
152
|
-
let {
|
153
|
-
allowed,
|
154
|
-
replacements,
|
155
|
-
available
|
156
|
-
} = settings; //console.log(decl.prop + " " + decl.value)
|
157
|
-
|
158
|
-
let valArr = decl.value.split(' '); //console.log(valArr)
|
159
|
-
//console.log(allowed, replacements, available)
|
160
|
-
|
161
|
-
let hasError = false;
|
162
|
-
let newVal = '';
|
163
|
-
valArr.forEach(val => {
|
164
|
-
let unit = val.replace(parseInt(val), '');
|
165
|
-
let numVal = parseInt(val);
|
166
|
-
|
167
|
-
if (unit != 0) {
|
168
|
-
if (allowed.includes(unit)) {
|
169
|
-
if (available.includes(numVal)) {
|
170
|
-
if (numVal >= 0) {
|
171
|
-
if (!hasError) {
|
172
|
-
newVal += replacements[unit].replace('$$', numVal) + " ";
|
173
|
-
}
|
174
|
-
} else {
|
175
|
-
if (!hasError) {
|
176
|
-
newVal += `calc(${replacements[unit].replace('$$', numVal * -1)} * -1)` + " ";
|
177
|
-
}
|
178
|
-
}
|
179
|
-
} else {
|
180
|
-
hasError = true;
|
181
|
-
let err = {
|
182
|
-
prop: decl.prop,
|
183
|
-
value: numVal,
|
184
|
-
filename,
|
185
|
-
filepath: rootOriginal.source.input.from,
|
186
|
-
line: decl.source.start.line,
|
187
|
-
unit,
|
188
|
-
message: 'value not available consider others'
|
189
|
-
};
|
190
|
-
errors.push(err);
|
191
|
-
}
|
192
|
-
} else {
|
193
|
-
hasError = true;
|
194
|
-
let err = {
|
195
|
-
prop: decl.prop,
|
196
|
-
value: decl.value,
|
197
|
-
filename,
|
198
|
-
filepath: rootOriginal.source.input.from,
|
199
|
-
line: decl.source.start.line,
|
200
|
-
unit,
|
201
|
-
message: 'Unit not supported'
|
202
|
-
};
|
203
|
-
errors.push(err);
|
204
|
-
}
|
205
|
-
}
|
206
|
-
});
|
207
|
-
|
208
|
-
if (!hasError) {
|
209
|
-
decl.value = newVal;
|
210
|
-
}
|
211
|
-
}
|
212
|
-
}
|
213
|
-
});
|
214
|
-
}); //fs.writeFile('./src/trial.json', JSON.stringify(variables) ,(err) =>{
|
215
|
-
// if(err)console.log(err);
|
216
|
-
// else{
|
217
|
-
// console.log('updated successfully');
|
218
|
-
// }
|
219
|
-
// })
|
220
|
-
// console.log(errors)
|
221
|
-
|
222
|
-
let errorArr = [];
|
223
|
-
errors.forEach(errStr => {
|
224
|
-
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
|
-
}); //fs.writeFile('./css_error.log','', (err) =>{
|
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
|
-
// });
|
243
|
-
}
|
244
|
-
});
|