@zohodesk/react-cli 1.0.2-exp.4 → 1.0.3-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -180
- package/.prettierrc +6 -6
- package/Changelog.md +1019 -1019
- package/README.md +1189 -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 +13 -18
- package/lib/pluginUtils/getProdPlugins.js +12 -16
- 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 -98
- 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 +14 -43
- package/lib/utils/resultSchema.json +73 -73
- package/npm-shrinkwrap.json +14407 -0
- package/npm8.md +9 -9
- package/package.json +121 -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 -107
- package/lib/plugins/utils/tests/fileHandling.test.js +0 -30
- package/lib/postcss-plugins/EmptyPlugin.js +0 -8
@@ -1,145 +1,145 @@
|
|
1
|
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
-
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
-
|
4
|
-
(function(mod) {
|
5
|
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
-
mod(require("../../lib/codemirror"));
|
7
|
-
else if (typeof define == "function" && define.amd) // AMD
|
8
|
-
define(["../../lib/codemirror"], mod);
|
9
|
-
else // Plain browser env
|
10
|
-
mod(CodeMirror);
|
11
|
-
})(function(CodeMirror) {
|
12
|
-
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
|
13
|
-
(document.documentMode == null || document.documentMode < 8);
|
14
|
-
|
15
|
-
var Pos = CodeMirror.Pos;
|
16
|
-
|
17
|
-
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
18
|
-
|
19
|
-
function findMatchingBracket(cm, where, config) {
|
20
|
-
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
21
|
-
var afterCursor = config && config.afterCursor
|
22
|
-
if (afterCursor == null)
|
23
|
-
afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
|
24
|
-
|
25
|
-
// A cursor is defined as between two characters, but in in vim command mode
|
26
|
-
// (i.e. not insert mode), the cursor is visually represented as a
|
27
|
-
// highlighted box on top of the 2nd character. Otherwise, we allow matches
|
28
|
-
// from before or after the cursor.
|
29
|
-
var match = (!afterCursor && pos >= 0 && matching[line.text.charAt(pos)]) ||
|
30
|
-
matching[line.text.charAt(++pos)];
|
31
|
-
if (!match) return null;
|
32
|
-
var dir = match.charAt(1) == ">" ? 1 : -1;
|
33
|
-
if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
|
34
|
-
var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
|
35
|
-
|
36
|
-
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
|
37
|
-
if (found == null) return null;
|
38
|
-
return {from: Pos(where.line, pos), to: found && found.pos,
|
39
|
-
match: found && found.ch == match.charAt(0), forward: dir > 0};
|
40
|
-
}
|
41
|
-
|
42
|
-
// bracketRegex is used to specify which type of bracket to scan
|
43
|
-
// should be a regexp, e.g. /[[\]]/
|
44
|
-
//
|
45
|
-
// Note: If "where" is on an open bracket, then this bracket is ignored.
|
46
|
-
//
|
47
|
-
// Returns false when no bracket was found, null when it reached
|
48
|
-
// maxScanLines and gave up
|
49
|
-
function scanForBracket(cm, where, dir, style, config) {
|
50
|
-
var maxScanLen = (config && config.maxScanLineLength) || 10000;
|
51
|
-
var maxScanLines = (config && config.maxScanLines) || 1000;
|
52
|
-
|
53
|
-
var stack = [];
|
54
|
-
var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
|
55
|
-
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
56
|
-
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
57
|
-
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
58
|
-
var line = cm.getLine(lineNo);
|
59
|
-
if (!line) continue;
|
60
|
-
var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
|
61
|
-
if (line.length > maxScanLen) continue;
|
62
|
-
if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
|
63
|
-
for (; pos != end; pos += dir) {
|
64
|
-
var ch = line.charAt(pos);
|
65
|
-
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
66
|
-
var match = matching[ch];
|
67
|
-
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
68
|
-
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
69
|
-
else stack.pop();
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
|
74
|
-
}
|
75
|
-
|
76
|
-
function matchBrackets(cm, autoclear, config) {
|
77
|
-
// Disable brace matching in long lines, since it'll cause hugely slow updates
|
78
|
-
var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
|
79
|
-
var marks = [], ranges = cm.listSelections();
|
80
|
-
for (var i = 0; i < ranges.length; i++) {
|
81
|
-
var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
|
82
|
-
if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
|
83
|
-
var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
84
|
-
marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
|
85
|
-
if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
|
86
|
-
marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
if (marks.length) {
|
91
|
-
// Kludge to work around the IE bug from issue #1193, where text
|
92
|
-
// input stops going to the textare whever this fires.
|
93
|
-
if (ie_lt8 && cm.state.focused) cm.focus();
|
94
|
-
|
95
|
-
var clear = function() {
|
96
|
-
cm.operation(function() {
|
97
|
-
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
98
|
-
});
|
99
|
-
};
|
100
|
-
if (autoclear) setTimeout(clear, 800);
|
101
|
-
else return clear;
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
function doMatchBrackets(cm) {
|
106
|
-
cm.operation(function() {
|
107
|
-
if (cm.state.matchBrackets.currentlyHighlighted) {
|
108
|
-
cm.state.matchBrackets.currentlyHighlighted();
|
109
|
-
cm.state.matchBrackets.currentlyHighlighted = null;
|
110
|
-
}
|
111
|
-
cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
|
112
|
-
});
|
113
|
-
}
|
114
|
-
|
115
|
-
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
|
116
|
-
if (old && old != CodeMirror.Init) {
|
117
|
-
cm.off("cursorActivity", doMatchBrackets);
|
118
|
-
if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
|
119
|
-
cm.state.matchBrackets.currentlyHighlighted();
|
120
|
-
cm.state.matchBrackets.currentlyHighlighted = null;
|
121
|
-
}
|
122
|
-
}
|
123
|
-
if (val) {
|
124
|
-
cm.state.matchBrackets = typeof val == "object" ? val : {};
|
125
|
-
cm.on("cursorActivity", doMatchBrackets);
|
126
|
-
}
|
127
|
-
});
|
128
|
-
|
129
|
-
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
130
|
-
CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
|
131
|
-
// Backwards-compatibility kludge
|
132
|
-
if (oldConfig || typeof config == "boolean") {
|
133
|
-
if (!oldConfig) {
|
134
|
-
config = config ? {strict: true} : null
|
135
|
-
} else {
|
136
|
-
oldConfig.strict = config
|
137
|
-
config = oldConfig
|
138
|
-
}
|
139
|
-
}
|
140
|
-
return findMatchingBracket(this, pos, config)
|
141
|
-
});
|
142
|
-
CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
|
143
|
-
return scanForBracket(this, pos, dir, style, config);
|
144
|
-
});
|
145
|
-
});
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
|
13
|
+
(document.documentMode == null || document.documentMode < 8);
|
14
|
+
|
15
|
+
var Pos = CodeMirror.Pos;
|
16
|
+
|
17
|
+
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
18
|
+
|
19
|
+
function findMatchingBracket(cm, where, config) {
|
20
|
+
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
21
|
+
var afterCursor = config && config.afterCursor
|
22
|
+
if (afterCursor == null)
|
23
|
+
afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
|
24
|
+
|
25
|
+
// A cursor is defined as between two characters, but in in vim command mode
|
26
|
+
// (i.e. not insert mode), the cursor is visually represented as a
|
27
|
+
// highlighted box on top of the 2nd character. Otherwise, we allow matches
|
28
|
+
// from before or after the cursor.
|
29
|
+
var match = (!afterCursor && pos >= 0 && matching[line.text.charAt(pos)]) ||
|
30
|
+
matching[line.text.charAt(++pos)];
|
31
|
+
if (!match) return null;
|
32
|
+
var dir = match.charAt(1) == ">" ? 1 : -1;
|
33
|
+
if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
|
34
|
+
var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
|
35
|
+
|
36
|
+
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
|
37
|
+
if (found == null) return null;
|
38
|
+
return {from: Pos(where.line, pos), to: found && found.pos,
|
39
|
+
match: found && found.ch == match.charAt(0), forward: dir > 0};
|
40
|
+
}
|
41
|
+
|
42
|
+
// bracketRegex is used to specify which type of bracket to scan
|
43
|
+
// should be a regexp, e.g. /[[\]]/
|
44
|
+
//
|
45
|
+
// Note: If "where" is on an open bracket, then this bracket is ignored.
|
46
|
+
//
|
47
|
+
// Returns false when no bracket was found, null when it reached
|
48
|
+
// maxScanLines and gave up
|
49
|
+
function scanForBracket(cm, where, dir, style, config) {
|
50
|
+
var maxScanLen = (config && config.maxScanLineLength) || 10000;
|
51
|
+
var maxScanLines = (config && config.maxScanLines) || 1000;
|
52
|
+
|
53
|
+
var stack = [];
|
54
|
+
var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
|
55
|
+
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
56
|
+
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
57
|
+
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
58
|
+
var line = cm.getLine(lineNo);
|
59
|
+
if (!line) continue;
|
60
|
+
var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
|
61
|
+
if (line.length > maxScanLen) continue;
|
62
|
+
if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
|
63
|
+
for (; pos != end; pos += dir) {
|
64
|
+
var ch = line.charAt(pos);
|
65
|
+
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
66
|
+
var match = matching[ch];
|
67
|
+
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
68
|
+
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
69
|
+
else stack.pop();
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
|
74
|
+
}
|
75
|
+
|
76
|
+
function matchBrackets(cm, autoclear, config) {
|
77
|
+
// Disable brace matching in long lines, since it'll cause hugely slow updates
|
78
|
+
var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
|
79
|
+
var marks = [], ranges = cm.listSelections();
|
80
|
+
for (var i = 0; i < ranges.length; i++) {
|
81
|
+
var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
|
82
|
+
if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
|
83
|
+
var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
84
|
+
marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
|
85
|
+
if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
|
86
|
+
marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
if (marks.length) {
|
91
|
+
// Kludge to work around the IE bug from issue #1193, where text
|
92
|
+
// input stops going to the textare whever this fires.
|
93
|
+
if (ie_lt8 && cm.state.focused) cm.focus();
|
94
|
+
|
95
|
+
var clear = function() {
|
96
|
+
cm.operation(function() {
|
97
|
+
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
98
|
+
});
|
99
|
+
};
|
100
|
+
if (autoclear) setTimeout(clear, 800);
|
101
|
+
else return clear;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
function doMatchBrackets(cm) {
|
106
|
+
cm.operation(function() {
|
107
|
+
if (cm.state.matchBrackets.currentlyHighlighted) {
|
108
|
+
cm.state.matchBrackets.currentlyHighlighted();
|
109
|
+
cm.state.matchBrackets.currentlyHighlighted = null;
|
110
|
+
}
|
111
|
+
cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
|
112
|
+
});
|
113
|
+
}
|
114
|
+
|
115
|
+
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
|
116
|
+
if (old && old != CodeMirror.Init) {
|
117
|
+
cm.off("cursorActivity", doMatchBrackets);
|
118
|
+
if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
|
119
|
+
cm.state.matchBrackets.currentlyHighlighted();
|
120
|
+
cm.state.matchBrackets.currentlyHighlighted = null;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
if (val) {
|
124
|
+
cm.state.matchBrackets = typeof val == "object" ? val : {};
|
125
|
+
cm.on("cursorActivity", doMatchBrackets);
|
126
|
+
}
|
127
|
+
});
|
128
|
+
|
129
|
+
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
130
|
+
CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
|
131
|
+
// Backwards-compatibility kludge
|
132
|
+
if (oldConfig || typeof config == "boolean") {
|
133
|
+
if (!oldConfig) {
|
134
|
+
config = config ? {strict: true} : null
|
135
|
+
} else {
|
136
|
+
oldConfig.strict = config
|
137
|
+
config = oldConfig
|
138
|
+
}
|
139
|
+
}
|
140
|
+
return findMatchingBracket(this, pos, config)
|
141
|
+
});
|
142
|
+
CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
|
143
|
+
return scanForBracket(this, pos, dir, style, config);
|
144
|
+
});
|
145
|
+
});
|
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const {
|
4
|
-
windowsModificationFile
|
5
|
-
} = require('../windowsModification');
|
6
|
-
|
7
|
-
const tests = ['D:\\MyWork\\React Build\\desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'D:/MyWork/React Build/desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'src\\components\\Accessibility\\Accessibility.module.css', 'src/components/Accessibility/Accessibility.module.css', 'Accessibility.module.css', ''];
|
8
|
-
tests.forEach(test => {
|
9
|
-
console.log(windowsModificationFile(test));
|
10
|
-
});
|
@@ -1,175 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _path = _interopRequireDefault(require("path"));
|
4
|
-
|
5
|
-
var _postcss = _interopRequireDefault(require("postcss"));
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
-
|
9
|
-
const supportedProps = ['margin-top', 'margin-bottom', 'margin-left', 'margin-right', // 'margin',
|
10
|
-
'padding-top', 'padding-bottom', 'padding-left', 'padding-right', // 'padding',
|
11
|
-
'top', 'bottom', 'left', 'right', 'height', 'width', 'min-height', 'min-width', 'max-height', 'max-width'];
|
12
|
-
const renameProps = {
|
13
|
-
'margin-top': {
|
14
|
-
pos: 'mt',
|
15
|
-
neg: 'mt_'
|
16
|
-
},
|
17
|
-
'margin-bottom': {
|
18
|
-
pos: 'mb',
|
19
|
-
neg: 'mb_'
|
20
|
-
},
|
21
|
-
'margin-left': {
|
22
|
-
pos: 'ml',
|
23
|
-
neg: 'ml_'
|
24
|
-
},
|
25
|
-
'margin-right': {
|
26
|
-
pos: 'mr',
|
27
|
-
neg: 'mr_'
|
28
|
-
},
|
29
|
-
margin: {
|
30
|
-
pos: 'm',
|
31
|
-
neg: 'm_'
|
32
|
-
},
|
33
|
-
'padding-top': {
|
34
|
-
pos: 'pt',
|
35
|
-
neg: 'pt_'
|
36
|
-
},
|
37
|
-
'padding-bottom': {
|
38
|
-
pos: 'pb',
|
39
|
-
neg: 'pb_'
|
40
|
-
},
|
41
|
-
'padding-left': {
|
42
|
-
pos: 'pl',
|
43
|
-
neg: 'pl_'
|
44
|
-
},
|
45
|
-
'padding-right': {
|
46
|
-
pos: 'pr',
|
47
|
-
neg: 'pr_'
|
48
|
-
},
|
49
|
-
padding: {
|
50
|
-
pos: 'p',
|
51
|
-
neg: 'p_'
|
52
|
-
},
|
53
|
-
top: {
|
54
|
-
pos: 'post',
|
55
|
-
neg: 'post_'
|
56
|
-
},
|
57
|
-
bottom: {
|
58
|
-
pos: 'posb',
|
59
|
-
neg: 'posb_'
|
60
|
-
},
|
61
|
-
left: {
|
62
|
-
pos: 'posl',
|
63
|
-
neg: 'posl_'
|
64
|
-
},
|
65
|
-
right: {
|
66
|
-
pos: 'posr',
|
67
|
-
neg: 'posr_'
|
68
|
-
},
|
69
|
-
height: {
|
70
|
-
pos: 'h',
|
71
|
-
neg: 'h_'
|
72
|
-
},
|
73
|
-
width: {
|
74
|
-
pos: 'w',
|
75
|
-
neg: 'w_'
|
76
|
-
},
|
77
|
-
'min-height': {
|
78
|
-
pos: 'minh',
|
79
|
-
neg: 'minh_'
|
80
|
-
},
|
81
|
-
'min-width': {
|
82
|
-
pos: 'minw',
|
83
|
-
neg: 'minw_'
|
84
|
-
},
|
85
|
-
'max-height': {
|
86
|
-
pos: 'maxh',
|
87
|
-
neg: 'maxh_'
|
88
|
-
},
|
89
|
-
'max-width': {
|
90
|
-
pos: 'maxw',
|
91
|
-
neg: 'maxw_'
|
92
|
-
}
|
93
|
-
};
|
94
|
-
|
95
|
-
function objToClassName(prop, data) {
|
96
|
-
return renameProps[prop] ? data < 0 ? renameProps[prop].neg ? `${renameProps[prop].neg}${data * -1}` : `undef${data * -1}` : renameProps[prop].pos ? `${renameProps[prop].pos}${data}` : `undef${data}` : `undef${data}`;
|
97
|
-
}
|
98
|
-
|
99
|
-
const commonFilePath = {
|
100
|
-
'margin-left': 'src/common/css/margin.css',
|
101
|
-
'margin-right': 'src/common/css/margin.css',
|
102
|
-
'margin-top': 'src/common/css/margin.css',
|
103
|
-
'margin-bottom': 'src/common/css/margin.css',
|
104
|
-
'padding-left': 'src/common/css/padding.css',
|
105
|
-
'padding-right': 'src/common/css/padding.css',
|
106
|
-
'padding-top': 'src/common/css/padding.css',
|
107
|
-
'padding-bottom': 'src/common/css/padding.css',
|
108
|
-
top: 'src/common/css/position.css',
|
109
|
-
bottom: 'src/common/css/position.css',
|
110
|
-
left: 'src/common/css/position.css',
|
111
|
-
right: 'src/common/css/position.css',
|
112
|
-
height: 'src/common/css/height.css',
|
113
|
-
width: 'src/common/css/width.css',
|
114
|
-
'min-height': 'src/common/css/height.css',
|
115
|
-
'min-width': 'src/common/css/width.css',
|
116
|
-
'max-height': 'src/common/css/height.css',
|
117
|
-
'max-width': 'src/common/css/width.css'
|
118
|
-
};
|
119
|
-
const preNames = {
|
120
|
-
height: 'zd-height-',
|
121
|
-
'max-height': 'zd-height-',
|
122
|
-
'min-height': 'zd-height-',
|
123
|
-
width: 'zd-width-',
|
124
|
-
'max-width': 'zd-width-',
|
125
|
-
'min-width': 'zd-width-',
|
126
|
-
top: 'zd-position-',
|
127
|
-
bottom: 'zd-position-',
|
128
|
-
left: 'zd-position-',
|
129
|
-
right: 'zd-position-',
|
130
|
-
'padding-top': 'zd-padding-',
|
131
|
-
'padding-bottom': 'zd-padding-',
|
132
|
-
'padding-left': 'zd-padding-',
|
133
|
-
'padding-right': 'zd-padding-',
|
134
|
-
'margin-top': 'zd-margin-',
|
135
|
-
'margin-bottom': 'zd-margin-',
|
136
|
-
'margin-left': 'zd-margin-',
|
137
|
-
'margin-right': 'zd-margin-'
|
138
|
-
};
|
139
|
-
|
140
|
-
function allowParent(rule) {
|
141
|
-
return rule.parent.type === 'root' || rule.parent.type === 'atrule' && rule.parent.name === 'media';
|
142
|
-
}
|
143
|
-
|
144
|
-
module.exports = function (source) {
|
145
|
-
const {
|
146
|
-
rootContext,
|
147
|
-
resourcePath,
|
148
|
-
query
|
149
|
-
} = this;
|
150
|
-
|
151
|
-
let root = _postcss.default.parse(source);
|
152
|
-
|
153
|
-
root.walkRules(rule => {
|
154
|
-
rule.walkDecls(decl => {
|
155
|
-
if (!allowParent(rule)) {
|
156
|
-
return;
|
157
|
-
}
|
158
|
-
|
159
|
-
if (supportedProps.includes(decl.prop) && /px$/gi.test(decl.value) && !/^--/gi.test(decl.prop) && commonFilePath[decl.prop] && !decl.value.includes('calc') && !/[,\s+]+|(\w+)\.|:|(\d+)%/gi.test(rule.selector)) {
|
160
|
-
let composeString = `from "${_path.default.relative(_path.default.parse(resourcePath).dir, // resourcePath
|
161
|
-
commonFilePath[decl.prop]).replace(/\\/gi, '/')}"`; // n++ < 10 && console.log(composeString);
|
162
|
-
|
163
|
-
if (!composeString.includes('src')) {
|
164
|
-
const cls = objToClassName(decl.prop, parseInt(decl.value));
|
165
|
-
composeString = `${cls} ${composeString}`;
|
166
|
-
decl.value = composeString;
|
167
|
-
decl.prop = 'composes'; // n < 10 && console.log(rule.selector, decl.prop, decl.value);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
});
|
171
|
-
});
|
172
|
-
const output = root.toString(); // console.log(output);
|
173
|
-
|
174
|
-
return output;
|
175
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.hasPrevNodeIgnore = hasPrevNodeIgnore;
|
7
|
-
exports.isAtRule = isAtRule;
|
8
|
-
exports.isInsideMediaQuery = isInsideMediaQuery;
|
9
|
-
|
10
|
-
function hasPrevNodeIgnore(index, prevNode, ignoreComment) {
|
11
|
-
return index !== 0 && prevNode && prevNode.type && prevNode.type === 'comment' && prevNode.text.toLowerCase() === ignoreComment;
|
12
|
-
}
|
13
|
-
|
14
|
-
function isAtRule(rule) {
|
15
|
-
return rule.parent && rule.parent.type === 'atrule';
|
16
|
-
}
|
17
|
-
|
18
|
-
function isInsideMediaQuery(rule) {
|
19
|
-
return isAtRule(rule) && rule.parent && rule.parent.name === 'media' ? true : false;
|
20
|
-
}
|
@@ -1,107 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.isFileNameMatchingPattern = isFileNameMatchingPattern;
|
7
|
-
exports.isFileNameMatchingPluginPattern = isFileNameMatchingPluginPattern;
|
8
|
-
|
9
|
-
var _windowsModification = require("../../loaderUtils/windowsModification");
|
10
|
-
|
11
|
-
var _ignore = _interopRequireDefault(require("ignore"));
|
12
|
-
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
-
|
15
|
-
const path = require('path');
|
16
|
-
|
17
|
-
let aliasNames = {
|
18
|
-
valueReplacer: 'postcss-value-replacer',
|
19
|
-
selectorReplace: 'postcss-selector-replace-new',
|
20
|
-
hasRTL: 'postcss-rtl',
|
21
|
-
combinerMediaQuery: 'postcss-combine-media-query',
|
22
|
-
hoverActive: 'postcss-mobile-hover',
|
23
|
-
cssVariableReplacement: 'postcss-variable-report',
|
24
|
-
composeMinification: 'postcss-compose-plugin'
|
25
|
-
};
|
26
|
-
/*
|
27
|
-
|
28
|
-
unique scenario
|
29
|
-
|
30
|
-
*/
|
31
|
-
// export function filterFileCssUniqueness(filename, filterObj) {
|
32
|
-
// let rootDir = 'supportapp';
|
33
|
-
// let include = false;
|
34
|
-
// const regex = `^(.+?)${rootDir}?\\\\`;
|
35
|
-
// const newFilename = windowsModificationFile(filename).replace(
|
36
|
-
// new RegExp(regex, 'gi'),
|
37
|
-
// ''
|
38
|
-
// );
|
39
|
-
// Object.keys(filterObj).forEach(key => {
|
40
|
-
// const ig = ignore().add(filterObj[key]);
|
41
|
-
// if (ig.ignores(newFilename)) {
|
42
|
-
// include = true;
|
43
|
-
// }
|
44
|
-
// });
|
45
|
-
// return include;
|
46
|
-
// }
|
47
|
-
|
48
|
-
function isFileNameMatchingPattern({
|
49
|
-
filename,
|
50
|
-
filterObject,
|
51
|
-
plugins,
|
52
|
-
rootDir
|
53
|
-
}) {
|
54
|
-
const finalPlugins = []; // console.log(rootDir);
|
55
|
-
// const regex = `^(.+?)${rootDir}?\\\\`;
|
56
|
-
|
57
|
-
const newFilename = path.relative(rootDir, filename); //windowsModificationFile(filename).replace(
|
58
|
-
// new RegExp(regex, 'gi'),
|
59
|
-
// ''
|
60
|
-
// );
|
61
|
-
// path.relative('supportapp', 'd:\')
|
62
|
-
|
63
|
-
Object.keys(filterObject).forEach(key => {
|
64
|
-
plugins.forEach(x => {
|
65
|
-
// console.log(key, x.postcssPlugin);
|
66
|
-
if (aliasNames[key] === x.postcssPlugin) {
|
67
|
-
const ig = (0, _ignore.default)({
|
68
|
-
allowRelativePaths: true
|
69
|
-
}).add(filterObject[key]);
|
70
|
-
|
71
|
-
if (ig.ignores(newFilename)) {
|
72
|
-
// console.log(newFilename);
|
73
|
-
finalPlugins.push(x);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
});
|
77
|
-
}); // console.log(filename);
|
78
|
-
// console.log(finalPlugins);
|
79
|
-
// console.log('----------------------------------------------------------------------')
|
80
|
-
|
81
|
-
return finalPlugins; // console.log(filename, filterObject);
|
82
|
-
}
|
83
|
-
|
84
|
-
function isFileNameMatchingPluginPattern({
|
85
|
-
filename,
|
86
|
-
filterArr,
|
87
|
-
rootDir
|
88
|
-
}) {
|
89
|
-
let include = true; // console.log(rootDir);
|
90
|
-
// const regex = `^(.+?)${rootDir}?\\\\`;
|
91
|
-
// console.log(plugin);
|
92
|
-
|
93
|
-
const newFilename = path.relative(rootDir, filename); // const newFilename = windowsModificationFile(filename).replace(
|
94
|
-
// new RegExp(regex, 'gi'),
|
95
|
-
// ''
|
96
|
-
// );
|
97
|
-
|
98
|
-
const ig = (0, _ignore.default)({
|
99
|
-
allowRelativePaths: true
|
100
|
-
}).add(filterArr);
|
101
|
-
|
102
|
-
if (!ig.ignores(newFilename)) {
|
103
|
-
include = false;
|
104
|
-
}
|
105
|
-
|
106
|
-
return include;
|
107
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const ignore = require('ignore');
|
4
|
-
|
5
|
-
const ignoreArr1 = ['src', '!src\\components', 'src\\Accessibility'];
|
6
|
-
const ignoreArr2 = ['src\\', '!node_modules\\'];
|
7
|
-
const ignoreArr3 = ['*'];
|
8
|
-
|
9
|
-
const {
|
10
|
-
windowsModificationFile
|
11
|
-
} = require('../../../../lib/loaderUtils/windowsModification');
|
12
|
-
|
13
|
-
const files = ['D:\\MyWork\\React Build\\desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'D:\\MyWork\\React Build\\desk_client_app\\jsapps\\supportapp\\src\\components\\Avatar\\Avatar.module.css', 'D:/MyWork/React Build/desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'D:/MyWork/React Build/desk_client_app/jsapps/supportapp/src/components/Accessibility/AccessibilityNavigation.module.css', 'desk_client_app\\jsapps\\supportapp\\src\\components\\Test.module.css', 'desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'src\\components\\Accessibility\\Accessibility.module.css', 'src/components/Accessibility/Accessibility.module.css', 'Accessibility.module.css', ''];
|
14
|
-
const ignore1 = ignore().add(ignoreArr1);
|
15
|
-
const ignore2 = ignore().add(ignoreArr2);
|
16
|
-
const ignore3 = ignore().add(ignoreArr3);
|
17
|
-
files.forEach(file => {
|
18
|
-
// console.log(file);
|
19
|
-
const rootDir = 'supportapp';
|
20
|
-
const regex = `^(.+?)${rootDir}?\\\\`;
|
21
|
-
const newFilename = windowsModificationFile(file).replace(new RegExp(regex, 'gi'), '');
|
22
|
-
console.log(newFilename);
|
23
|
-
|
24
|
-
if (newFilename.trim() !== '') {
|
25
|
-
console.log(ignore1.ignores(newFilename));
|
26
|
-
console.log(ignore2.ignores(newFilename));
|
27
|
-
console.log(ignore3.ignores(newFilename));
|
28
|
-
console.log('--------------------------------------------------------------------');
|
29
|
-
}
|
30
|
-
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _postcss = _interopRequireDefault(require("postcss"));
|
4
|
-
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
-
|
7
|
-
module.exports = _postcss.default.plugin('postcss-empty', () => (root, result) => {// console.log(root.source.input.from, result);
|
8
|
-
});
|