@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1
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 -179
- package/.prettierrc +6 -6
- package/README.md +1028 -951
- package/bin/cli.js +483 -483
- package/cert/Tsicsezwild-22-23.crt +37 -37
- package/cert/Tsicsezwild-22-23.key +27 -27
- package/docs/CustomChunks.md +26 -26
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +678 -0
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/babel/cmjs-plugins-presets.js +0 -4
- package/lib/babel/es-plugins-presets.js +0 -4
- package/lib/common/getEntries.js +0 -10
- package/lib/common/getPublicPathConfig.js +0 -6
- package/lib/common/index.js +0 -5
- package/lib/common/splitChunks.js +2 -13
- package/lib/common/sslcertUpdater.js +6 -17
- package/lib/common/templateParameters.js +0 -2
- package/lib/common/testPattern.js +10 -21
- package/lib/common/valueReplacer.js +0 -15
- package/lib/configs/jest.config.js +8 -21
- package/lib/configs/libAlias.js +11 -2
- package/lib/configs/webpack.component.umd.config.js +0 -5
- package/lib/configs/webpack.css.umd.config.js +5 -13
- package/lib/configs/webpack.dev.config.js +13 -24
- package/lib/configs/webpack.docs.config.js +6 -12
- package/lib/configs/webpack.impact.config.js +6 -10
- package/lib/configs/webpack.prod.config.js +15 -26
- package/lib/hooks/docsProptypeHook.js +3 -7
- package/lib/jest/commitedFilesResult.js +3 -45
- package/lib/jest/coverageCollector.js +0 -11
- package/lib/jest/jsonMaker.js +0 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
- package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
- package/lib/jest/result.js +0 -22
- package/lib/jest/run.js +6 -17
- package/lib/jest/setup.js +5 -57
- package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
- package/lib/loaderUtils/getCSSLoaders.js +41 -28
- package/lib/loaderUtils/getDevJsLoaders.js +0 -8
- package/lib/loaderUtils/index.js +0 -3
- package/lib/loaders/docsLoader.js +0 -7
- package/lib/loaders/docsPropsLoader.js +3 -7
- package/lib/loaders/fileBountryLoader.js +0 -2
- package/lib/loaders/fileLoader.js +11 -22
- package/lib/loaders/scriptInstrumentLoader.js +5 -13
- package/lib/loaders/selectorMappingLoader.js +7 -25
- package/lib/loaders/workerLoader.js +13 -29
- package/lib/middlewares/HMRMiddleware.js +13 -26
- package/lib/middlewares/SSTMiddleware.js +0 -3
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
- package/lib/pluginUtils/getDevPlugins.js +20 -64
- package/lib/pluginUtils/getDocsPlugins.js +1 -10
- package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
- package/lib/pluginUtils/getLibraryPlugins.js +0 -5
- package/lib/pluginUtils/getProdPlugins.js +32 -78
- package/lib/pluginUtils/getServerPlugins.js +0 -5
- package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
- package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
- package/lib/pluginUtils/index.js +0 -8
- package/lib/plugins/CdnChangePlugin.js +0 -14
- package/lib/plugins/CleanupStatsPlugin.js +0 -5
- package/lib/plugins/EFCPlugin.js +23 -34
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +23 -32
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +70 -80
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
- package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
- package/lib/plugins/ManifestPlugin.js +0 -17
- package/lib/plugins/ModuleStatsPlugin.js +0 -23
- package/lib/plugins/OptimizeJSPlugin.js +0 -7
- package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
- package/lib/plugins/PublicPathChangePlugin.js +4 -36
- package/lib/plugins/ReportGeneratePlugin.js +4 -30
- package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
- package/lib/plugins/ResourceHintsPlugin.js +20 -27
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
- package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
- package/lib/plugins/ServiceWorkerPlugin.js +13 -29
- package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
- package/lib/plugins/SourceMapHookPlugin.js +0 -9
- package/lib/plugins/TPHashMappingPlugin.js +5 -19
- package/lib/plugins/UglifyCSSPlugin.js +0 -9
- package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
- package/lib/plugins/index.js +0 -19
- package/lib/plugins/libraryImpactPlugin.js +0 -32
- package/lib/plugins/webpackwatchrunplugin.js +0 -5
- package/lib/postcss-plugins/ExcludePlugin.js +0 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
- package/lib/postcss-plugins/ValueReplacer.js +9 -6
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
- package/lib/postcss-plugins/variableModifier.js +14 -20
- package/lib/schemas/index.js +28 -13
- package/lib/servers/clusterHubServer.js +0 -10
- package/lib/servers/devBuild.js +13 -24
- package/lib/servers/docsServer.js +0 -2
- package/lib/servers/docsServerCore.js +0 -21
- package/lib/servers/getCliPath.js +1 -10
- package/lib/servers/helpServer.js +0 -5
- package/lib/servers/httpsOptions.js +0 -4
- package/lib/servers/impactServer.js +2 -34
- package/lib/servers/mockserver.js +0 -9
- package/lib/servers/nowatchserver.js +12 -34
- package/lib/servers/scrServer.js +13 -20
- package/lib/servers/server.js +7 -35
- package/lib/servers/ssServer.js +0 -16
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +0 -14
- package/lib/templates/WMSTemplate.js +6 -12
- package/lib/utils/babelPresets.js +0 -2
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +2 -8
- package/lib/utils/copy.js +0 -6
- package/lib/utils/copyTimezones.js +0 -8
- package/lib/utils/createEventStream.js +0 -4
- package/lib/utils/cssClassNameGenerate.js +3 -19
- package/lib/utils/cssURLReplacer.js +0 -25
- package/lib/utils/dependencyPostPublish.js +0 -9
- package/lib/utils/fileUtils.js +0 -26
- package/lib/utils/folderIterator.js +0 -10
- package/lib/utils/getComponents.js +0 -21
- package/lib/utils/getCurrentBranch.js +0 -5
- package/lib/utils/getDependenciesImpactList.js +0 -21
- package/lib/utils/getHash.js +0 -7
- package/lib/utils/getIp.js +0 -2
- package/lib/utils/getOptions.js +38 -35
- package/lib/utils/getServerURL.js +0 -7
- package/lib/utils/index.js +2 -47
- package/lib/utils/init.js +0 -1
- package/lib/utils/initPreCommitHook.js +6 -29
- package/lib/utils/jsonHelper.js +2 -19
- package/lib/utils/libraryImpactConfig.js +0 -2
- package/lib/utils/lint/addScripts.js +2 -5
- package/lib/utils/lint/checkExistingConfig.js +3 -12
- package/lib/utils/lint/copyConfigs.js +0 -3
- package/lib/utils/lint/index.js +0 -9
- package/lib/utils/lint/lintScripts.js +0 -1
- package/lib/utils/lint/lintSetup.js +3 -4
- package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
- package/lib/utils/lint/question.js +0 -7
- package/lib/utils/lintReporter.js +0 -20
- package/lib/utils/mailSender.js +0 -7
- package/lib/utils/pullOrigin.js +0 -4
- package/lib/utils/reinstallDependencies.js +0 -28
- package/lib/utils/removeAttributes.js +0 -7
- package/lib/utils/repoClone.js +2 -27
- package/lib/utils/request.js +0 -12
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +4 -16
- package/lib/utils/setEnvVariables.js +0 -2
- package/lib/utils/ssTestHack.js +0 -10
- package/lib/utils/switchBranch.js +0 -4
- package/lib/utils/urlConcat.js +0 -4
- package/lib/utils/useExitCleanup.js +9 -10
- package/npm8.md +9 -9
- package/package.json +146 -148
- package/postpublish.js +6 -6
- 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 -1493
- 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
|
@@ -4,30 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
9
|
var _utils = require("../utils");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
let excludeDocsJSON = '{}';
|
|
17
|
-
|
|
18
12
|
if (_fs.default.existsSync('./__testUtils__/conf/excludeDocs.json')) {
|
|
19
13
|
excludeDocsJSON = _fs.default.readFileSync('./__testUtils__/conf/excludeDocs.json').toString();
|
|
20
|
-
|
|
21
14
|
if (excludeDocsJSON.indexOf('\\') !== -1) {
|
|
22
15
|
excludeDocsJSON = excludeDocsJSON.replace(/\\/g, '\\\\');
|
|
23
16
|
}
|
|
24
17
|
}
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
let excludeDocsArray = JSON.parse(excludeDocsJSON);
|
|
19
|
+
// if (Object.keys(excludeDocsArray).length > 0) {
|
|
27
20
|
// }
|
|
28
21
|
|
|
29
22
|
let getRegex = regexString => regexString.map(str => new RegExp(str));
|
|
30
|
-
|
|
31
23
|
class UnusedFilesFindPlugin {
|
|
32
24
|
constructor(options = {}) {
|
|
33
25
|
this.usedFilesExcludes = getRegex(options.usedFilesExcludes);
|
|
@@ -37,38 +29,28 @@ class UnusedFilesFindPlugin {
|
|
|
37
29
|
this.sstest = options.ssTest || false;
|
|
38
30
|
this.outputFileName = options.outputFileName;
|
|
39
31
|
this.docsFilename = options.docsFilename || 'Undocsfiles.json';
|
|
40
|
-
|
|
41
32
|
if (!this.origin) {
|
|
42
33
|
throw new Error('You must provide origin point of the app');
|
|
43
34
|
}
|
|
44
35
|
}
|
|
45
|
-
|
|
46
36
|
isIgnoredUsedFile(file) {
|
|
47
37
|
let result;
|
|
48
|
-
|
|
49
38
|
for (let i = 0; i < this.usedFilesExcludes.length; i++) {
|
|
50
39
|
let exclude = this.usedFilesExcludes[i];
|
|
51
40
|
result = exclude.test(file);
|
|
52
|
-
|
|
53
41
|
if (result) {
|
|
54
42
|
break;
|
|
55
43
|
}
|
|
56
44
|
}
|
|
57
|
-
|
|
58
45
|
return result;
|
|
59
46
|
}
|
|
60
|
-
|
|
61
47
|
unDocumentedFiles(outputPath) {
|
|
62
48
|
let status = _fs.default.existsSync(_path.default.join(outputPath, this.outputFileName));
|
|
63
|
-
|
|
64
49
|
let unDocsCompObj = {};
|
|
65
|
-
|
|
66
50
|
if (status) {
|
|
67
51
|
let data = _fs.default.readFileSync(_path.default.join(outputPath, this.outputFileName)).toString();
|
|
68
|
-
|
|
69
52
|
let walkSync = (dir, filelist = [], undocList = []) => {
|
|
70
53
|
let files = _fs.default.readdirSync(dir);
|
|
71
|
-
|
|
72
54
|
files.forEach(file => {
|
|
73
55
|
if (_fs.default.statSync(`${dir}/${file}`).isDirectory()) {
|
|
74
56
|
filelist = walkSync(`${dir}/${file}`, filelist, undocList); //eslint-disable-line
|
|
@@ -91,7 +73,6 @@ class UnusedFilesFindPlugin {
|
|
|
91
73
|
unDocsCompObj.withoutDocs = undocList;
|
|
92
74
|
return filelist;
|
|
93
75
|
};
|
|
94
|
-
|
|
95
76
|
unDocsCompObj.noEnteredComp = walkSync(_path.default.join(process.cwd(), 'src', 'components'), [], []);
|
|
96
77
|
(0, _utils.writeFile)(_path.default.join(outputPath, this.docsFilename), JSON.stringify(unDocsCompObj));
|
|
97
78
|
Object.keys(unDocsCompObj).forEach(key => {
|
|
@@ -108,27 +89,20 @@ class UnusedFilesFindPlugin {
|
|
|
108
89
|
});
|
|
109
90
|
}
|
|
110
91
|
}
|
|
111
|
-
|
|
112
92
|
isIgnoredAllFile(file) {
|
|
113
93
|
let result;
|
|
114
|
-
|
|
115
94
|
for (let i = 0; i < this.appFilesExcludes.length; i++) {
|
|
116
95
|
let exclude = this.appFilesExcludes[i];
|
|
117
96
|
result = exclude.test(file);
|
|
118
|
-
|
|
119
97
|
if (result) {
|
|
120
98
|
break;
|
|
121
99
|
}
|
|
122
100
|
}
|
|
123
|
-
|
|
124
101
|
return result;
|
|
125
102
|
}
|
|
126
|
-
|
|
127
103
|
getAllFiles(rootPath) {
|
|
128
104
|
let allFiles = [];
|
|
129
|
-
|
|
130
105
|
let files = _fs.default.readdirSync(rootPath).map(file => _path.default.join(rootPath, file));
|
|
131
|
-
|
|
132
106
|
files.forEach(file => {
|
|
133
107
|
if (_fs.default.statSync(file).isDirectory()) {
|
|
134
108
|
allFiles = allFiles.concat(this.getAllFiles(file));
|
|
@@ -140,7 +114,6 @@ class UnusedFilesFindPlugin {
|
|
|
140
114
|
});
|
|
141
115
|
return allFiles;
|
|
142
116
|
}
|
|
143
|
-
|
|
144
117
|
apply(compiler) {
|
|
145
118
|
compiler.hooks.afterEmit.tap('UnusedFilesShowPlugin', compilation => {
|
|
146
119
|
let {
|
|
@@ -150,7 +123,6 @@ class UnusedFilesFindPlugin {
|
|
|
150
123
|
if (!this.isIgnoredUsedFile(usedFile)) {
|
|
151
124
|
files[usedFile] = true;
|
|
152
125
|
}
|
|
153
|
-
|
|
154
126
|
return files;
|
|
155
127
|
}, {});
|
|
156
128
|
let allFiles = this.getAllFiles(this.origin);
|
|
@@ -160,7 +132,6 @@ class UnusedFilesFindPlugin {
|
|
|
160
132
|
unusedFiles.push(file);
|
|
161
133
|
}
|
|
162
134
|
});
|
|
163
|
-
|
|
164
135
|
if (!unusedFiles.length) {
|
|
165
136
|
(0, _utils.log)('There is no unused files');
|
|
166
137
|
} else {
|
|
@@ -174,18 +145,14 @@ class UnusedFilesFindPlugin {
|
|
|
174
145
|
});
|
|
175
146
|
}
|
|
176
147
|
}
|
|
177
|
-
|
|
178
148
|
if (this.delete) {
|
|
179
149
|
unusedFiles.forEach(file => {
|
|
180
150
|
_fs.default.unlinkSync(file);
|
|
181
|
-
|
|
182
151
|
(0, _utils.log)(`Deleted - ${file}`);
|
|
183
152
|
});
|
|
184
153
|
}
|
|
185
154
|
});
|
|
186
155
|
}
|
|
187
|
-
|
|
188
156
|
}
|
|
189
|
-
|
|
190
157
|
var _default = UnusedFilesFindPlugin;
|
|
191
158
|
exports.default = _default;
|
package/lib/plugins/index.js
CHANGED
|
@@ -111,41 +111,22 @@ Object.defineProperty(exports, "UnusedFilesFindPlugin", {
|
|
|
111
111
|
return _UnusedFilesFindPlugin.default;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
|
|
115
114
|
var _ModuleStatsPlugin = _interopRequireDefault(require("./ModuleStatsPlugin"));
|
|
116
|
-
|
|
117
115
|
var _SourceMapHookPlugin = _interopRequireDefault(require("./SourceMapHookPlugin"));
|
|
118
|
-
|
|
119
116
|
var _UnusedFilesFindPlugin = _interopRequireDefault(require("./UnusedFilesFindPlugin"));
|
|
120
|
-
|
|
121
117
|
var _ScriptInstrumentPlugin = _interopRequireDefault(require("./ScriptInstrumentPlugin"));
|
|
122
|
-
|
|
123
118
|
var _PublicPathChangePlugin = _interopRequireDefault(require("./PublicPathChangePlugin"));
|
|
124
|
-
|
|
125
119
|
var _OptimizeJSPlugin = _interopRequireDefault(require("./OptimizeJSPlugin"));
|
|
126
|
-
|
|
127
120
|
var _ResourceHintsPlugin = _interopRequireDefault(require("./ResourceHintsPlugin"));
|
|
128
|
-
|
|
129
121
|
var _UglifyCSSPlugin = _interopRequireDefault(require("./UglifyCSSPlugin"));
|
|
130
|
-
|
|
131
122
|
var _ManifestPlugin = _interopRequireDefault(require("./ManifestPlugin"));
|
|
132
|
-
|
|
133
123
|
var _CleanupStatsPlugin = _interopRequireDefault(require("./CleanupStatsPlugin"));
|
|
134
|
-
|
|
135
124
|
var _EFCPlugin = _interopRequireDefault(require("./EFCPlugin"));
|
|
136
|
-
|
|
137
125
|
var _PublicPathCallbackPlugin = _interopRequireDefault(require("./PublicPathCallbackPlugin"));
|
|
138
|
-
|
|
139
126
|
var _I18NInjectIntoIndexPlugin = _interopRequireDefault(require("./I18NInjectIntoIndexPlugin"));
|
|
140
|
-
|
|
141
127
|
var _ReportGeneratePlugin = _interopRequireDefault(require("./ReportGeneratePlugin"));
|
|
142
|
-
|
|
143
128
|
var _ShadowDOMSupportPlugin = _interopRequireDefault(require("./ShadowDOMSupportPlugin"));
|
|
144
|
-
|
|
145
129
|
var _ServiceWorkerPlugin = _interopRequireDefault(require("./ServiceWorkerPlugin"));
|
|
146
|
-
|
|
147
130
|
var _TPHashMappingPlugin = _interopRequireDefault(require("./TPHashMappingPlugin"));
|
|
148
|
-
|
|
149
131
|
var _CdnChangePlugin = _interopRequireDefault(require("./CdnChangePlugin"));
|
|
150
|
-
|
|
151
132
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
9
|
var _webpackSources = require("webpack-sources");
|
|
13
|
-
|
|
14
10
|
var _jsonHelper = require("../utils/jsonHelper");
|
|
15
|
-
|
|
16
11
|
var _utils = require("../utils");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
let resultFileName = `${process.cwd()}/result.json`;
|
|
21
14
|
let options = (0, _utils.getOptions)();
|
|
22
15
|
let {
|
|
@@ -31,27 +24,21 @@ let {
|
|
|
31
24
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.compareBranch', referBranch);
|
|
32
25
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.TestBranch', currentBranch);
|
|
33
26
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.isExecuted', true);
|
|
34
|
-
|
|
35
27
|
let isValidModule = name => {
|
|
36
28
|
if (name.includes('node_modules') && (name.includes(`@zohodesk${_path.default.sep}components`) || name.includes(`@zohodesk${_path.default.sep}dot`) || name.includes(`@zohodesk${_path.default.sep}icons`) || name.includes(`@zohodesk${_path.default.sep}svg`)) && !name.endsWith('docs.js')) {
|
|
37
29
|
return true;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
return !name.includes('index.js') && !name.endsWith('.css') && !name.endsWith('.png') && !name.includes('node_modules') && name.includes('src');
|
|
41
32
|
};
|
|
42
|
-
|
|
43
33
|
let getModuleName = modulePath => {
|
|
44
34
|
let [name] = _path.default.parse(modulePath).name.split('.');
|
|
45
|
-
|
|
46
35
|
if (modulePath.includes(`@zohodesk${_path.default.sep}components`)) {
|
|
47
36
|
name = `@zohodesk/components/${name}`;
|
|
48
37
|
} else if (modulePath.includes(`@zohodesk${_path.default.sep}dot`)) {
|
|
49
38
|
name = `@zohodesk/dot/${name}`;
|
|
50
39
|
}
|
|
51
|
-
|
|
52
40
|
return name;
|
|
53
41
|
};
|
|
54
|
-
|
|
55
42
|
class LibraryImpactPlugin {
|
|
56
43
|
constructor(options = {}) {
|
|
57
44
|
this.options = options;
|
|
@@ -60,12 +47,10 @@ class LibraryImpactPlugin {
|
|
|
60
47
|
this.bottomHtml = '</div> <script type="text/javascript"> const details = document.querySelectorAll("details"); details.forEach((targetDetail) => { targetDetail.addEventListener("click", () => { // Close all the details that are not targetDetail. details.forEach((detail) => { if (detail !== targetDetail) { detail.removeAttribute("open"); } }); }); }); </script></body></html>';
|
|
61
48
|
this.resultJson = {};
|
|
62
49
|
}
|
|
63
|
-
|
|
64
50
|
apply(compiler) {
|
|
65
51
|
let loggedInfo = false;
|
|
66
52
|
compiler.hooks.beforeCompile.tap('LibraryImpactPlugin', () => {
|
|
67
53
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.startTime', Date.now());
|
|
68
|
-
|
|
69
54
|
if (!loggedInfo) {
|
|
70
55
|
(0, _utils.log)('\x1b[33m%s\x1b[0m', '************************************************************ \n ');
|
|
71
56
|
(0, _utils.log)('\x1b[5m\x1b[44m%s\x1b[0m', 'Finding Impacted Source Files Please Wait ...');
|
|
@@ -78,13 +63,11 @@ class LibraryImpactPlugin {
|
|
|
78
63
|
let {
|
|
79
64
|
modules
|
|
80
65
|
} = stats;
|
|
81
|
-
|
|
82
66
|
for (let module of modules) {
|
|
83
67
|
let {
|
|
84
68
|
name,
|
|
85
69
|
reasons
|
|
86
70
|
} = module;
|
|
87
|
-
|
|
88
71
|
if (isValidModule(name)) {
|
|
89
72
|
let references = new Set();
|
|
90
73
|
let referencedby = new Set();
|
|
@@ -93,7 +76,6 @@ class LibraryImpactPlugin {
|
|
|
93
76
|
compilation.modules.forEach(module => {
|
|
94
77
|
module.reasons.forEach(reason => {
|
|
95
78
|
let exportedValue = reason.dependency;
|
|
96
|
-
|
|
97
79
|
if (exportedValue.type === 'harmony export imported specifier') {
|
|
98
80
|
if (exportedValue.module.userRequest.includes(name.replace('.', ''))) {
|
|
99
81
|
docsName = exportedValue.name;
|
|
@@ -102,35 +84,29 @@ class LibraryImpactPlugin {
|
|
|
102
84
|
});
|
|
103
85
|
});
|
|
104
86
|
let currentModuleName = name;
|
|
105
|
-
|
|
106
87
|
if (Array.isArray(reasons)) {
|
|
107
88
|
for (let reason of reasons) {
|
|
108
89
|
let {
|
|
109
90
|
moduleName
|
|
110
91
|
} = reason;
|
|
111
|
-
|
|
112
92
|
if (isValidModule(moduleName)) {
|
|
113
93
|
let reasonedModuleName = moduleName;
|
|
114
94
|
referencedby.add(reasonedModuleName);
|
|
115
95
|
}
|
|
116
96
|
}
|
|
117
97
|
}
|
|
118
|
-
|
|
119
98
|
for (let subModule of modules) {
|
|
120
99
|
let {
|
|
121
100
|
name: subModuleName,
|
|
122
101
|
reasons
|
|
123
102
|
} = subModule;
|
|
124
|
-
|
|
125
103
|
if (isValidModule(subModuleName)) {
|
|
126
104
|
let currentModuleName = subModuleName;
|
|
127
|
-
|
|
128
105
|
if (Array.isArray(reasons)) {
|
|
129
106
|
for (let reason of reasons) {
|
|
130
107
|
let {
|
|
131
108
|
moduleName: reasonedModuleName
|
|
132
109
|
} = reason;
|
|
133
|
-
|
|
134
110
|
if (name === reasonedModuleName) {
|
|
135
111
|
references.add(currentModuleName);
|
|
136
112
|
}
|
|
@@ -138,7 +114,6 @@ class LibraryImpactPlugin {
|
|
|
138
114
|
}
|
|
139
115
|
}
|
|
140
116
|
}
|
|
141
|
-
|
|
142
117
|
results[currentModuleName] = {
|
|
143
118
|
name: currentModuleName,
|
|
144
119
|
references: Array.from(references),
|
|
@@ -148,11 +123,9 @@ class LibraryImpactPlugin {
|
|
|
148
123
|
};
|
|
149
124
|
}
|
|
150
125
|
}
|
|
151
|
-
|
|
152
126
|
(0, _utils.getDependenciesImpactList)(currentBranch, referBranch, tokenGit, serviceName).then(impactedList => {
|
|
153
127
|
this.resultJson = (0, _utils.getLibraryConflict)(JSON.stringify(results), impactedList, changesOnly);
|
|
154
128
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.result', this.resultJson);
|
|
155
|
-
|
|
156
129
|
if (this.resultJson.result.status) {
|
|
157
130
|
(0, _utils.log)(this.resultJson.response);
|
|
158
131
|
this.resultJson.response.forEach(fileObject => {
|
|
@@ -167,15 +140,12 @@ class LibraryImpactPlugin {
|
|
|
167
140
|
(0, _utils.log)(this.resultJson.result.message);
|
|
168
141
|
this.topHtml = this.topHtml + '<div style="font-size: xxx-large; text-align: center; padding-top: 50px;"> ' + this.resultJson.result.message + '</div>';
|
|
169
142
|
}
|
|
170
|
-
|
|
171
143
|
if (!_fs.default.existsSync('./coverageTest')) {
|
|
172
144
|
_fs.default.mkdirSync('./coverageTest');
|
|
173
|
-
|
|
174
145
|
_fs.default.writeFileSync('./coverageTest/impactLibrary.html', this.topHtml + this.bottomHtml, 'utf8');
|
|
175
146
|
} else {
|
|
176
147
|
_fs.default.writeFileSync('./coverageTest/impactLibrary.html', this.topHtml + this.bottomHtml, 'utf8');
|
|
177
148
|
}
|
|
178
|
-
|
|
179
149
|
(0, _jsonHelper.jsonHelper)(resultFileName, 'tests.libraryImpactOnSource.endTime', Date.now());
|
|
180
150
|
});
|
|
181
151
|
});
|
|
@@ -184,7 +154,5 @@ class LibraryImpactPlugin {
|
|
|
184
154
|
(0, _utils.log)('Compilation finished!!!');
|
|
185
155
|
});
|
|
186
156
|
}
|
|
187
|
-
|
|
188
157
|
}
|
|
189
|
-
|
|
190
158
|
exports.default = LibraryImpactPlugin;
|
|
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../utils");
|
|
9
|
-
|
|
10
8
|
class WebpackWatchRunPlugin {
|
|
11
9
|
apply(compiler) {
|
|
12
10
|
compiler.hooks.watchRun.tap('WatchRun', comp => {
|
|
13
11
|
const changedTimes = comp.watchFileSystem.watcher.mtimes;
|
|
14
12
|
const changedFiles = Object.keys(changedTimes).map(file => `\n ${file}`).join('');
|
|
15
|
-
|
|
16
13
|
if (changedFiles.length) {
|
|
17
14
|
(0, _utils.log)('====================================');
|
|
18
15
|
(0, _utils.log)('NEW BUILD FILES CHANGED:', changedFiles);
|
|
@@ -20,7 +17,5 @@ class WebpackWatchRunPlugin {
|
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
exports.default = WebpackWatchRunPlugin;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
4
|
-
|
|
5
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
5
|
module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
|
|
8
6
|
const {
|
|
9
7
|
plugins
|
|
@@ -11,10 +9,8 @@ module.exports = _postcss.default.plugin('postcss-exclude-files', opts => {
|
|
|
11
9
|
return (root, result) => {
|
|
12
10
|
const inputFile = root.source.input.file;
|
|
13
11
|
let isIgnoredFile = opts.ignore.some(file => inputFile.indexOf(file) !== -1);
|
|
14
|
-
|
|
15
12
|
if (!isIgnoredFile) {
|
|
16
13
|
const handler = response => response.messages.forEach(msg => result.messages.push(msg));
|
|
17
|
-
|
|
18
14
|
return (0, _postcss.default)(plugins).process(root, {
|
|
19
15
|
from: undefined
|
|
20
16
|
}).then(handler);
|
|
@@ -5,32 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.separateRtlAndLtr = separateRtlAndLtr;
|
|
7
7
|
exports.separateSingleDir = separateSingleDir;
|
|
8
|
-
|
|
9
8
|
var postcss = _interopRequireWildcard(require("postcss"));
|
|
10
|
-
|
|
11
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
|
|
13
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
|
|
15
11
|
const oppositeDir = {
|
|
16
12
|
ltr: 'rtl',
|
|
17
13
|
rtl: 'ltr'
|
|
18
14
|
};
|
|
19
|
-
|
|
20
15
|
function compareSelector(selector1, selector2) {
|
|
21
16
|
// console.log({ selector1, selector2 }, selector1 === selector2);
|
|
22
17
|
return selector1 === selector2;
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
const directionRegexs = {
|
|
26
20
|
ltr: /\[dir=ltr\]/,
|
|
27
21
|
rtl: /\[dir=rtl\]/
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
const getRegex = dir => directionRegexs[dir];
|
|
31
|
-
|
|
32
24
|
const getOppositeRegex = dir => getRegex(oppositeDir[dir]);
|
|
33
|
-
|
|
34
25
|
function selectorMinifySameDir(selector, direction) {
|
|
35
26
|
// NOTE: if this rule is same dir as current need
|
|
36
27
|
// then we can just remove that [dir=ltr] or [dir=rtl]
|
|
@@ -38,18 +29,16 @@ function selectorMinifySameDir(selector, direction) {
|
|
|
38
29
|
const regex = getRegex(direction);
|
|
39
30
|
return selector.replace(regex, '').trim();
|
|
40
31
|
}
|
|
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
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
32
|
|
|
33
|
+
/**
|
|
34
|
+
* this funtion will remove given rule,
|
|
35
|
+
* if given selector and it's previous sibiling rule selector are same
|
|
36
|
+
* current rule properties will move to previous sibiling rule.
|
|
37
|
+
* @param {Rule} rule current rule
|
|
38
|
+
*/
|
|
49
39
|
function mergeIfSameSelector(rule) {
|
|
50
40
|
// NOTE: to merge dublicate selector rules
|
|
51
41
|
const prev = rule.prev();
|
|
52
|
-
|
|
53
42
|
if (prev && compareSelector(prev.selector, rule.selector)) {
|
|
54
43
|
rule.each(decl => {
|
|
55
44
|
prev.append(decl);
|
|
@@ -57,27 +46,25 @@ function mergeIfSameSelector(rule) {
|
|
|
57
46
|
rule.remove();
|
|
58
47
|
}
|
|
59
48
|
}
|
|
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
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
49
|
|
|
50
|
+
/**
|
|
51
|
+
* this funtion will remove given rule,
|
|
52
|
+
* if given selector and it's previous sibiling rule selector are same
|
|
53
|
+
* current rule properties will move to previous sibiling rule.
|
|
54
|
+
* @param {Rule} rule current rule
|
|
55
|
+
*/
|
|
68
56
|
function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
69
57
|
// console.log({ rule, type: rule.type });
|
|
70
|
-
const selectors = rule.selector.split(/\s*,\s*/);
|
|
58
|
+
const selectors = rule.selector.split(/\s*,\s*/);
|
|
59
|
+
|
|
60
|
+
// NOTE: if we use opposite dir selector as custom override reason,
|
|
71
61
|
// and compain normal selector with it, In this case
|
|
72
62
|
// we just a have to remove that selector only not full rule
|
|
73
|
-
|
|
74
63
|
const oppositeDirRegex = getOppositeRegex(direction);
|
|
75
64
|
let remainingSelectors = selectors.filter(selector => !oppositeDirRegex.test(selector));
|
|
76
|
-
|
|
77
65
|
if (!rootOptions.disableMiniFiySelector) {
|
|
78
66
|
remainingSelectors = remainingSelectors.map(selector => selectorMinifySameDir(selector, direction));
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
if (remainingSelectors.length) {
|
|
82
69
|
rule.selector = remainingSelectors.join(', ');
|
|
83
70
|
} else {
|
|
@@ -85,17 +72,14 @@ function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
|
85
72
|
rule.remove();
|
|
86
73
|
}
|
|
87
74
|
}
|
|
88
|
-
|
|
89
75
|
function removeIfOppsiteDirKeyframe(rule, direction) {
|
|
90
76
|
let name = rule.params;
|
|
91
77
|
let keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
|
|
92
|
-
|
|
93
78
|
if (keyFrameDirName === oppositeDir[direction]) {
|
|
94
79
|
// console.log({ m: 'removed', keyFrameName: rule.params });
|
|
95
80
|
rule.remove();
|
|
96
81
|
}
|
|
97
82
|
}
|
|
98
|
-
|
|
99
83
|
function separateSingleDir(root, direction, rootOptions) {
|
|
100
84
|
root.walkRules(rule => {
|
|
101
85
|
removeIfOppsiteDirRule(rule, direction, rootOptions);
|
|
@@ -106,15 +90,14 @@ function separateSingleDir(root, direction, rootOptions) {
|
|
|
106
90
|
});
|
|
107
91
|
return root;
|
|
108
92
|
}
|
|
109
|
-
|
|
110
93
|
function separateRtlAndLtr(css, rootOptions) {
|
|
111
94
|
// let processor = postcss([]).process(css);
|
|
112
|
-
let root = postcss.parse(css);
|
|
95
|
+
let root = postcss.parse(css);
|
|
96
|
+
// let { root } = processor;
|
|
113
97
|
// console.log(processor, root);
|
|
114
98
|
// NOTE: I did first rtl then ltr , Because for ltr I use original root ref
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
99
|
+
const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions);
|
|
100
|
+
// console.log('############################');
|
|
118
101
|
const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
|
|
119
102
|
return {
|
|
120
103
|
ltrRoot,
|
|
@@ -122,8 +105,11 @@ function separateRtlAndLtr(css, rootOptions) {
|
|
|
122
105
|
ltr: ltrRoot.toString(),
|
|
123
106
|
rtl: rtlRoot.toString()
|
|
124
107
|
};
|
|
125
|
-
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// NOTE: to test in https://astexplorer.net/
|
|
126
111
|
// you can test with sample input https://astexplorer.net/#/gist/a892a509eb585099355ef53ef094f836/1ca70d5f7af3b88ca4910296e12f118e9712c874
|
|
112
|
+
|
|
127
113
|
// export default postcss.plugin('postcss-rtl-remove', (options = {}) =>
|
|
128
114
|
// // Work with options here
|
|
129
115
|
// root => {
|
|
@@ -132,6 +118,7 @@ function separateRtlAndLtr(css, rootOptions) {
|
|
|
132
118
|
// // root.append(postcss.comment({ text: 'comment' }));
|
|
133
119
|
// root.append(postcss.comment({ text: 'this is spliting part ' }));
|
|
134
120
|
// root.append(rtlRoot);
|
|
121
|
+
|
|
135
122
|
// //console.log({root, roots:root+""}, root+"")
|
|
136
123
|
// // Transform CSS AST here
|
|
137
124
|
// }
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
4
|
-
|
|
5
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
5
|
// module.exports = postcss.plugin('postcss-value-replacer', opts => {
|
|
8
6
|
// const { plugins } = opts;
|
|
9
7
|
// return (root, result) => {
|
|
@@ -19,7 +17,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
17
|
// };
|
|
20
18
|
// });
|
|
21
19
|
// export default
|
|
22
|
-
module.exports = _postcss.default.plugin('postcss-value-replacer', (valueReplacer = {}) =>
|
|
20
|
+
module.exports = _postcss.default.plugin('postcss-value-replacer', (valueReplacer = {}) =>
|
|
21
|
+
// Work with options here
|
|
23
22
|
root => {
|
|
24
23
|
root.walkDecls(decl => {
|
|
25
24
|
valueReplacer.forEach(obj => {
|
|
@@ -27,11 +26,15 @@ root => {
|
|
|
27
26
|
let ks = Object.keys(obj.values).sort((a, b) => b.length - a.length);
|
|
28
27
|
ks.forEach(k => {
|
|
29
28
|
decl.value = decl.value.replace(k, obj.values[k]);
|
|
30
|
-
});
|
|
29
|
+
});
|
|
30
|
+
//decl.value = obj.values[decl.value];
|
|
31
31
|
}
|
|
32
|
-
});
|
|
32
|
+
});
|
|
33
|
+
//console.log({root, roots:root+""}, root+"")
|
|
33
34
|
// Transform CSS AST here
|
|
34
|
-
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// root.walkDecls(decl => {
|
|
35
38
|
// valueReplacer.forEach(obj => {
|
|
36
39
|
// if (
|
|
37
40
|
// obj.props.indexOf(decl.prop) !== -1 &&
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
|
-
|
|
5
4
|
const postcss = require('postcss');
|
|
6
|
-
|
|
7
5
|
function expectRunPostCss(inputFile, outputfile, cb) {
|
|
8
6
|
const inputStr = fs.readFileSync(inputFile, 'utf-8');
|
|
9
7
|
postcss(plugins).process(inputStr, {
|
|
@@ -14,7 +12,6 @@ function expectRunPostCss(inputFile, outputfile, cb) {
|
|
|
14
12
|
cb();
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
describe('To Check Hover active postcss Plugin ', () => {
|
|
19
16
|
test('should handle normal rule hover', cb => {
|
|
20
17
|
expectRunPostCss('test1Input.css', 'test1Output.css', cb);
|
|
@@ -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
|
}
|