@zohodesk/react-cli 0.0.1-exp.169.1 → 0.0.1-exp.175.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +1 -0
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +17 -936
- package/docs/VariableConversion.md +678 -0
- package/lib/configs/jest.config.js +8 -10
- package/lib/configs/libAlias.js +10 -3
- package/lib/configs/resolvers.js +38 -0
- package/lib/configs/webpack.dev.config.js +19 -26
- package/lib/configs/webpack.docs.config.js +12 -19
- package/lib/configs/webpack.impact.config.js +13 -15
- package/lib/configs/webpack.prod.config.js +24 -28
- package/lib/constants.js +31 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +14 -7
- package/lib/loaderUtils/getCSSLoaders.js +45 -8
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
- package/lib/pluginUtils/getDevPlugins.js +14 -34
- package/lib/pluginUtils/getProdPlugins.js +24 -42
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- package/lib/postcss-plugins/hoverActivePlugin.js +51 -27
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +248 -0
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +50 -10
- package/lib/servers/docsServerCore.js +13 -12
- package/lib/servers/getCliPath.js +1 -1
- package/lib/servers/httpsOptions.js +40 -9
- package/lib/servers/nowatchserver.js +12 -11
- package/lib/servers/server.js +14 -13
- package/lib/utils/getOptions.js +42 -14
- package/package.json +5 -34
- package/postpublish.js +6 -4
- package/templates/docs/css/style.css +1 -1
- package/templates/docs/index.html +9 -1
- package/cert/Tsicsezwild-22-23.crt +0 -37
- package/cert/Tsicsezwild-22-23.key +0 -27
@@ -15,10 +15,6 @@ var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin
|
|
15
15
|
|
16
16
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
17
17
|
|
18
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
19
|
-
|
20
|
-
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
21
|
-
|
22
18
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
23
19
|
|
24
20
|
var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
|
@@ -29,14 +25,14 @@ var _webpack = _interopRequireDefault(require("webpack"));
|
|
29
25
|
|
30
26
|
var _plugins = require("../plugins");
|
31
27
|
|
32
|
-
var _common = require("../common");
|
33
|
-
|
34
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
35
29
|
|
30
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
31
|
+
|
36
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
33
|
|
38
|
-
|
39
|
-
|
34
|
+
const getDevPlugins = (options, publicPath) => {
|
35
|
+
const {
|
40
36
|
app: {
|
41
37
|
tpFolder,
|
42
38
|
folder,
|
@@ -68,7 +64,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
68
64
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
69
65
|
const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
|
70
66
|
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
71
|
-
|
67
|
+
const plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
72
68
|
__CLIENT__: true,
|
73
69
|
__TEST__: false,
|
74
70
|
__SERVER__: false,
|
@@ -126,7 +122,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
126
122
|
propertiesFolder: i18n.propertiesFolder
|
127
123
|
}));
|
128
124
|
} else {
|
129
|
-
|
125
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
130
126
|
|
131
127
|
if (_fs.default.existsSync(i18nPath)) {
|
132
128
|
plugins.push(new _copyWebpackPlugin.default([{
|
@@ -146,20 +142,16 @@ let getDevPlugins = (options, publicPath) => {
|
|
146
142
|
collections: true,
|
147
143
|
shorthands: true
|
148
144
|
}));
|
145
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
|
146
|
+
enableChunkHash: false,
|
147
|
+
folder,
|
148
|
+
minify: false,
|
149
|
+
inject,
|
150
|
+
crossorigin,
|
151
|
+
hasEFC
|
152
|
+
});
|
149
153
|
|
150
154
|
if (hasEFC) {
|
151
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
152
|
-
chunksSortMode: 'none',
|
153
|
-
filename: 'index.html',
|
154
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
155
|
-
excludeChunks: ['efc', 'widget'],
|
156
|
-
templateParameters: _common.templateParameters,
|
157
|
-
scriptLoading: 'defer',
|
158
|
-
inject: inject
|
159
|
-
}));
|
160
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
161
|
-
crossorigin: 'anonymous'
|
162
|
-
}));
|
163
155
|
plugins.push(new _plugins.EFCPlugin({
|
164
156
|
isDevelopment: true,
|
165
157
|
i18nManifestFileName,
|
@@ -171,18 +163,6 @@ let getDevPlugins = (options, publicPath) => {
|
|
171
163
|
localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
|
172
164
|
|
173
165
|
}));
|
174
|
-
} else {
|
175
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
176
|
-
chunksSortMode: 'none',
|
177
|
-
filename: 'index.html',
|
178
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
179
|
-
templateParameters: _common.templateParameters,
|
180
|
-
scriptLoading: 'defer',
|
181
|
-
inject: inject
|
182
|
-
}));
|
183
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
184
|
-
crossorigin: 'anonymous'
|
185
|
-
}));
|
186
166
|
}
|
187
167
|
|
188
168
|
plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
|
@@ -21,24 +21,22 @@ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plu
|
|
21
21
|
|
22
22
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
23
23
|
|
24
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
25
|
-
|
26
|
-
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
27
|
-
|
28
24
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
29
25
|
|
30
26
|
var _plugins = require("../plugins");
|
31
27
|
|
32
|
-
var _common = require("../common");
|
33
|
-
|
34
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
35
29
|
|
30
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
31
|
+
|
36
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
33
|
|
38
34
|
// eslint-disable-next-line no-unused-vars
|
39
|
-
|
35
|
+
const getProdPlugins = (options, publicPath = '') => {
|
40
36
|
let {
|
41
|
-
enableChunkHash
|
37
|
+
enableChunkHash
|
38
|
+
} = options.app;
|
39
|
+
const {
|
42
40
|
manifestFileName,
|
43
41
|
bundleAnalyze,
|
44
42
|
optimize,
|
@@ -56,13 +54,15 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
56
54
|
hasShadowDOM,
|
57
55
|
resourceHints,
|
58
56
|
serviceWorker,
|
59
|
-
htmlTemplate
|
60
|
-
inject
|
61
|
-
},
|
57
|
+
htmlTemplate,
|
62
58
|
tpHashMapping,
|
63
59
|
cdnMapping,
|
64
60
|
crossorigin
|
65
61
|
} = options.app;
|
62
|
+
const {
|
63
|
+
inject,
|
64
|
+
minify: minifyHtmlOptions
|
65
|
+
} = htmlTemplate;
|
66
66
|
const {
|
67
67
|
i18n
|
68
68
|
} = options;
|
@@ -79,9 +79,9 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
79
79
|
const hashTempalate = enableChunkHash ? '.[chunkhash:20]_' : '';
|
80
80
|
const cssLTRFileNameTempalte = `css/[name]${hashTempalate}${enableRTLSplit ? '.ltr' : ''}.css`;
|
81
81
|
const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
|
82
|
-
|
82
|
+
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
83
83
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
84
|
-
|
84
|
+
const plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
|
85
85
|
__TEST__: false,
|
86
86
|
__DEVELOPMENT__: false,
|
87
87
|
__LOCAL_PRODUCTION__: isDevelopment,
|
@@ -132,7 +132,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
132
132
|
propertiesFolder: i18n.propertiesFolder
|
133
133
|
}));
|
134
134
|
} else {
|
135
|
-
|
135
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
136
136
|
|
137
137
|
if (_fs.default.existsSync(i18nPath)) {
|
138
138
|
plugins.push(new _copyWebpackPlugin.default([{
|
@@ -148,21 +148,16 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
148
148
|
to: `./${tpFolder}/`,
|
149
149
|
toType: 'dir'
|
150
150
|
}]));
|
151
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
|
152
|
+
enableChunkHash,
|
153
|
+
folder,
|
154
|
+
inject,
|
155
|
+
minify: minifyHtmlOptions,
|
156
|
+
crossorigin,
|
157
|
+
hasEFC
|
158
|
+
});
|
151
159
|
|
152
160
|
if (hasEFC) {
|
153
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
154
|
-
chunksSortMode: 'none',
|
155
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
156
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
157
|
-
excludeChunks: ['efc', 'widget'],
|
158
|
-
minify: false,
|
159
|
-
templateParameters: _common.templateParameters,
|
160
|
-
scriptLoading: 'defer',
|
161
|
-
inject: inject
|
162
|
-
}));
|
163
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
164
|
-
crossorigin: 'anonymous'
|
165
|
-
}));
|
166
161
|
plugins.push(new _plugins.EFCPlugin({
|
167
162
|
isDevelopment,
|
168
163
|
serverUrl: publicPath,
|
@@ -175,19 +170,6 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
175
170
|
localeAttr: efcLocaleAttr,
|
176
171
|
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
177
172
|
}));
|
178
|
-
} else {
|
179
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
180
|
-
chunksSortMode: 'none',
|
181
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
182
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
183
|
-
minify: false,
|
184
|
-
templateParameters: _common.templateParameters,
|
185
|
-
scriptLoading: 'defer',
|
186
|
-
inject: inject
|
187
|
-
}));
|
188
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
189
|
-
crossorigin: 'anonymous'
|
190
|
-
}));
|
191
173
|
}
|
192
174
|
|
193
175
|
plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
|
@@ -201,7 +183,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
201
183
|
}));
|
202
184
|
|
203
185
|
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
204
|
-
|
186
|
+
const {
|
205
187
|
callback
|
206
188
|
} = publicPaths;
|
207
189
|
plugins.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
@@ -255,7 +237,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
255
237
|
}
|
256
238
|
|
257
239
|
if (!isDevelopment && serviceWorker.enableSw) {
|
258
|
-
|
240
|
+
const {
|
259
241
|
filePath,
|
260
242
|
fileName = 'sw.js',
|
261
243
|
exitPath = '/',
|
@@ -4,7 +4,7 @@ var _postcss = _interopRequireDefault(require("postcss"));
|
|
4
4
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
6
|
|
7
|
-
module.exports = _postcss.default.plugin('postcss-exclude-
|
7
|
+
module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
|
8
8
|
const {
|
9
9
|
plugins
|
10
10
|
} = opts;
|
@@ -14,7 +14,8 @@ const hoverIgnoreQuery = 'Hover:ignore',
|
|
14
14
|
const medHoverIgnoreQuery = 'MedHover:ignore',
|
15
15
|
medActiveIgnoreQuery = 'MedActive:ignore',
|
16
16
|
medHoverActiveIgnoreQuery = 'MedHoverActive:ignore';
|
17
|
-
|
17
|
+
let hoverMedQuerySuffix = '';
|
18
|
+
let hoverNoneMedQuerySuffix = '';
|
18
19
|
const ruleIgnoreCommentRegex = /(Hover:ignore|Active:ignore|HoverActive:ignore)/g;
|
19
20
|
const mediaQueryIgnoreCommentRegex = /(MedHover:ignore|MedActive:ignore|MedHoverActive:ignore)/g;
|
20
21
|
|
@@ -32,9 +33,26 @@ function isHoverPresent(atrule) {
|
|
32
33
|
return hoverPresent;
|
33
34
|
}
|
34
35
|
|
35
|
-
|
36
|
+
function checkForUsualClass(root, sel) {
|
37
|
+
let present = false;
|
38
|
+
sel.split(',').forEach(value => {
|
39
|
+
if (value.includes('hover')) {
|
40
|
+
const valueNoHover = value.replace(':hover', '').trim();
|
41
|
+
root.walkRules(rule => {
|
42
|
+
if (rule.selector === valueNoHover) {
|
43
|
+
present = true;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
});
|
48
|
+
return present;
|
49
|
+
}
|
50
|
+
|
51
|
+
module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHoverActiveString => rootOriginal => {
|
36
52
|
const hoverRules = [];
|
37
|
-
|
53
|
+
const positionsObj = {};
|
54
|
+
hoverMedQuerySuffix = mediaQueryHoverActiveString.hover;
|
55
|
+
hoverNoneMedQuerySuffix = mediaQueryHoverActiveString.none;
|
38
56
|
|
39
57
|
function isRuleHasIgnoreComment(index, type) {
|
40
58
|
const prevNode = rootOriginal.nodes[index - 1];
|
@@ -72,8 +90,8 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
72
90
|
|
73
91
|
function getPositionsOfHoverAndActiveMedQueries(parent) {
|
74
92
|
const allNodes = rootOriginal.nodes;
|
75
|
-
const hoverMediaQuery = `${parent.params} and
|
76
|
-
const hoverNoneMediaQuery = `${parent.params} and
|
93
|
+
const hoverMediaQuery = `${parent.params} and ${hoverMedQuerySuffix}`;
|
94
|
+
const hoverNoneMediaQuery = `${parent.params} and ${hoverNoneMedQuerySuffix}`;
|
77
95
|
const positions = {
|
78
96
|
hovMed: allNodes[positionsObj[hoverMediaQuery]],
|
79
97
|
actMed: allNodes[positionsObj[hoverNoneMediaQuery]]
|
@@ -142,16 +160,16 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
142
160
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
143
161
|
//console.log(hovMed, actMed);
|
144
162
|
let newSelector = '';
|
145
|
-
|
163
|
+
const {
|
146
164
|
hovMed,
|
147
165
|
actMed
|
148
166
|
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
149
|
-
|
150
|
-
|
167
|
+
const hovQueries = [];
|
168
|
+
const actQueries = [];
|
151
169
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
152
|
-
|
170
|
+
const subrule = _subrule.trim();
|
153
171
|
|
154
|
-
|
172
|
+
const clone = rule.clone();
|
155
173
|
|
156
174
|
if (subrule.includes('hover')) {
|
157
175
|
clone.selector = subrule;
|
@@ -169,13 +187,13 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
169
187
|
});
|
170
188
|
|
171
189
|
if (hovQueries.length > 0) {
|
172
|
-
|
190
|
+
const clone = rule.clone();
|
173
191
|
clone.selector = hovQueries.join(',');
|
174
192
|
hovMed.append(clone);
|
175
193
|
}
|
176
194
|
|
177
195
|
if (actQueries.length > 0) {
|
178
|
-
|
196
|
+
const clone = rule.clone();
|
179
197
|
clone.selector = actQueries.join(',');
|
180
198
|
actMed.append(clone.clone({
|
181
199
|
selector: clone.selector.replace(/:hover/gi, ':active')
|
@@ -194,7 +212,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
194
212
|
|
195
213
|
function mediaQuery(rule, index) {
|
196
214
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
197
|
-
|
215
|
+
const {
|
198
216
|
hovMed,
|
199
217
|
actMed
|
200
218
|
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
@@ -216,9 +234,9 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
216
234
|
function commaQuery(rule, index) {
|
217
235
|
//console.log("comma" , rule.selector.split('\n'));
|
218
236
|
let newSelector = '';
|
219
|
-
|
237
|
+
const hovQueries = [];
|
220
238
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
221
|
-
|
239
|
+
const subrule = _subrule.trim();
|
222
240
|
|
223
241
|
if (subrule.includes('hover')) {
|
224
242
|
// hoverRules.push({ rule: clone, index });
|
@@ -229,7 +247,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
229
247
|
});
|
230
248
|
|
231
249
|
if (hovQueries.length > 0) {
|
232
|
-
|
250
|
+
const clone = rule.clone();
|
233
251
|
clone.selector = hovQueries.join(',');
|
234
252
|
hoverRules.push({
|
235
253
|
rule: clone,
|
@@ -238,7 +256,9 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
238
256
|
}
|
239
257
|
|
240
258
|
if (handleHoverAndHoverActiveIgnore(index)) {
|
241
|
-
|
259
|
+
if (checkForUsualClass(rootOriginal, rule.selector)) {
|
260
|
+
rule.selector = newSelector.substring(0, newSelector.length - 2).trim();
|
261
|
+
}
|
242
262
|
}
|
243
263
|
|
244
264
|
if (rule.selector === '') {
|
@@ -248,8 +268,8 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
248
268
|
|
249
269
|
|
250
270
|
rootOriginal.walkAtRules(atrule => {
|
251
|
-
const hoverQuery = `${atrule.params} and
|
252
|
-
const activeQuery = `${atrule.params} and
|
271
|
+
const hoverQuery = `${atrule.params} and ${hoverMedQuerySuffix}`;
|
272
|
+
const activeQuery = `${atrule.params} and ${hoverNoneMedQuerySuffix}`;
|
253
273
|
|
254
274
|
if (isHoverPresent(atrule)) {
|
255
275
|
if (!positionsObj[hoverQuery] && !positionsObj[activeQuery]) {
|
@@ -308,13 +328,13 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
308
328
|
// hover
|
309
329
|
const hoverQuery = rootOriginal.append({
|
310
330
|
name: 'media',
|
311
|
-
params:
|
331
|
+
params: `${hoverMedQuerySuffix}`
|
312
332
|
}).last; // Create a media query targetting devices that don't support hover
|
313
333
|
// (ie. devices where we should fall back to :active instead)
|
314
334
|
|
315
335
|
const activeQuery = rootOriginal.append({
|
316
336
|
name: 'media',
|
317
|
-
params:
|
337
|
+
params: `${hoverNoneMedQuerySuffix}`
|
318
338
|
}).last; // Loop through the hover rules and apply them to each of the media
|
319
339
|
// queries
|
320
340
|
// eslint-disable-next-line no-labels
|
@@ -355,11 +375,15 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
355
375
|
hoverRule.rule.remove();
|
356
376
|
}
|
357
377
|
}
|
358
|
-
}
|
378
|
+
} // rootOriginal.walkAtRules(atrule => {
|
379
|
+
// if (
|
380
|
+
// (atrule !== undefined &&
|
381
|
+
// atrule.nodes !== undefined &&
|
382
|
+
// atrule.nodes.length === 0) ||
|
383
|
+
// atrule.nodes === undefined
|
384
|
+
// ) {
|
385
|
+
// atrule.remove();
|
386
|
+
// }
|
387
|
+
// });
|
359
388
|
|
360
|
-
rootOriginal.walkAtRules(atrule => {
|
361
|
-
if (atrule !== undefined && atrule.nodes !== undefined && atrule.nodes.length === 0 || atrule.nodes === undefined) {
|
362
|
-
atrule.remove();
|
363
|
-
}
|
364
|
-
});
|
365
389
|
});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.ErrorHandler = void 0;
|
7
|
+
|
8
|
+
class ErrorHandler {
|
9
|
+
constructor(allowedErrs) {
|
10
|
+
this.errors = [];
|
11
|
+
this.allowedErrs = allowedErrs;
|
12
|
+
}
|
13
|
+
|
14
|
+
addError(errstr) {
|
15
|
+
this.errors.push(`{\n${errstr}\n}\n`);
|
16
|
+
}
|
17
|
+
|
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);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
exports.ErrorHandler = ErrorHandler;
|