@zohodesk/react-cli 1.1.29-exp.2 → 1.1.29-exp.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +13 -2
- package/lib/babel/es-plugins-presets.js +14 -3
- package/lib/common/buildEs.js +0 -1
- package/lib/common/getEntries.js +13 -2
- package/lib/common/getPublicPathConfig.js +6 -0
- package/lib/common/index.js +6 -1
- package/lib/common/runPreProcess.js +15 -6
- package/lib/common/splitChunks.js +21 -2
- package/lib/common/sslcertUpdater.js +18 -7
- package/lib/common/templateParameters.js +2 -0
- package/lib/common/testPattern.js +21 -10
- package/lib/common/valueReplacer.js +16 -1
- package/lib/configs/jest.config.js +11 -2
- package/lib/configs/libAlias.js +16 -10
- package/lib/configs/resolvers.js +16 -6
- package/lib/configs/webpack.component.umd.config.js +6 -1
- package/lib/configs/webpack.css.umd.config.js +14 -6
- package/lib/configs/webpack.dev.config.js +14 -1
- package/lib/configs/webpack.docs.config.js +9 -1
- package/lib/configs/webpack.impact.config.js +8 -1
- package/lib/configs/webpack.prod.config.js +17 -4
- package/lib/constants.js +18 -9
- package/lib/deprecationLogger.js +7 -0
- package/lib/hooks/docsProptypeHook.js +8 -4
- package/lib/jest/commitedFilesResult.js +46 -4
- package/lib/jest/coverageCollector.js +12 -1
- package/lib/jest/jsonMaker.js +6 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
- package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
- package/lib/jest/result.js +23 -1
- package/lib/jest/run.js +18 -7
- package/lib/jest/setup.js +60 -8
- package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
- package/lib/loaderUtils/getCSSLoaders.js +22 -10
- package/lib/loaderUtils/getDevJsLoaders.js +13 -4
- package/lib/loaderUtils/index.js +4 -1
- package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
- package/lib/loaderUtils/windowsModification.js +3 -2
- package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
- package/lib/loaders/composeLoader.js +37 -13
- package/lib/loaders/docsLoader.js +12 -1
- package/lib/loaders/docsPropsLoader.js +8 -4
- package/lib/loaders/enhancedReactLiveConverter.js +23 -2
- package/lib/loaders/fileBountryLoader.js +3 -1
- package/lib/loaders/fileLoader.js +23 -12
- package/lib/loaders/markdownLoader.js +19 -14
- package/lib/loaders/reactLiveConvertor.js +15 -5
- package/lib/loaders/scriptInstrumentLoader.js +16 -7
- package/lib/loaders/selectorMappingLoader.js +26 -7
- package/lib/loaders/workerLoader.js +24 -9
- package/lib/logger.js +4 -0
- package/lib/middlewares/HMRMiddleware.js +27 -13
- package/lib/middlewares/SSTMiddleware.js +5 -1
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
- package/lib/pluginUtils/getDevPlugins.js +42 -9
- package/lib/pluginUtils/getDocsPlugins.js +13 -3
- package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
- package/lib/pluginUtils/getLibraryPlugins.js +8 -2
- package/lib/pluginUtils/getProdPlugins.js +47 -8
- package/lib/pluginUtils/getServerPlugins.js +8 -2
- package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
- package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
- package/lib/pluginUtils/index.js +9 -1
- package/lib/plugins/CdnChangePlugin.js +18 -2
- package/lib/plugins/CleanupStatsPlugin.js +5 -0
- package/lib/plugins/CssOrderControlPlugin.js +6 -3
- package/lib/plugins/CustomAttributePlugin.js +19 -14
- package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
- package/lib/plugins/EFCPlugin.js +34 -20
- package/lib/plugins/EFCTemplatePlugin.js +30 -19
- package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
- package/lib/plugins/EventsHandlingPlugin.js +4 -2
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
- package/lib/plugins/I18nSplitPlugin/index.js +24 -13
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +8 -1
- package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
- package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
- package/lib/plugins/ManifestPlugin.js +18 -1
- package/lib/plugins/MinifyPlugin.js +10 -1
- package/lib/plugins/ModuleStatsPlugin.js +24 -1
- package/lib/plugins/OptimizeJSPlugin.js +10 -2
- package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
- package/lib/plugins/PublicPathChangePlugin.js +39 -6
- package/lib/plugins/ReportGeneratePlugin.js +32 -5
- package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
- package/lib/plugins/ResourceHintsPlugin.js +13 -4
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
- package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
- package/lib/plugins/SelectorPlugin.js +32 -6
- package/lib/plugins/ServiceWorkerPlugin.js +22 -5
- package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
- package/lib/plugins/SourceMapHookPlugin.js +12 -2
- package/lib/plugins/StatsPlugin.js +14 -0
- package/lib/plugins/TPHashMappingPlugin.js +18 -3
- package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
- package/lib/plugins/VariableConversionCollector.js +42 -15
- package/lib/plugins/index.js +20 -1
- package/lib/plugins/libraryImpactPlugin.js +33 -1
- package/lib/plugins/utils/classHandling.js +6 -0
- package/lib/plugins/utils/fileHandling.js +15 -6
- package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
- package/lib/plugins/variableConvertorUtils.js +29 -14
- package/lib/plugins/webpackwatchrunplugin.js +5 -0
- package/lib/postcss-plugins/EmptyPlugin.js +4 -3
- package/lib/postcss-plugins/ExcludePlugin.js +5 -1
- package/lib/postcss-plugins/IncludePlugin.js +5 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
- package/lib/postcss-plugins/SelectorReplace.js +16 -1
- package/lib/postcss-plugins/ValueReplacer.js +6 -7
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
- package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
- package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
- package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
- package/lib/schemas/index.js +10 -3
- package/lib/servers/clusterHubServer.js +11 -1
- package/lib/servers/devBuild.js +26 -14
- package/lib/servers/docsServer.js +3 -1
- package/lib/servers/docsServerCore.js +22 -1
- package/lib/servers/getCliPath.js +9 -0
- package/lib/servers/helpServer.js +6 -1
- package/lib/servers/httpsOptions.js +8 -2
- package/lib/servers/impactServer.js +35 -3
- package/lib/servers/mockserver.js +10 -1
- package/lib/servers/nowatchserver.js +37 -12
- package/lib/servers/requireLocalOrGlobal.js +17 -6
- package/lib/servers/scrServer.js +21 -14
- package/lib/servers/server.js +36 -6
- package/lib/servers/ssServer.js +17 -1
- package/lib/templates/CoverageScriptTemplate.js +14 -0
- package/lib/templates/WMSTemplate.js +13 -7
- package/lib/templates/linterConstant.js +4 -2
- package/lib/utils/babelPresets.js +7 -3
- package/lib/utils/clean.js +9 -3
- package/lib/utils/copy.js +7 -1
- package/lib/utils/copyTimezones.js +9 -1
- package/lib/utils/createEventStream.js +6 -1
- package/lib/utils/cssClassNameGenerate.js +30 -10
- package/lib/utils/cssURLReplacer.js +22 -1
- package/lib/utils/dependencyPostPublish.js +10 -1
- package/lib/utils/deprecationSupport.js +32 -7
- package/lib/utils/fileUtils.js +28 -1
- package/lib/utils/folderIterator.js +13 -2
- package/lib/utils/getComponents.js +21 -0
- package/lib/utils/getCurrentBranch.js +5 -0
- package/lib/utils/getDependenciesImpactList.js +22 -1
- package/lib/utils/getFileType.js +10 -2
- package/lib/utils/getHash.js +8 -1
- package/lib/utils/getIp.js +2 -0
- package/lib/utils/getOptions.js +53 -16
- package/lib/utils/getServerURL.js +10 -1
- package/lib/utils/index.js +51 -4
- package/lib/utils/init.js +1 -0
- package/lib/utils/initPreCommitHook.js +30 -7
- package/lib/utils/jsonHelper.js +22 -3
- package/lib/utils/libraryImpactConfig.js +5 -2
- package/lib/utils/lint/addScripts.js +5 -2
- package/lib/utils/lint/checkExistingConfig.js +12 -3
- package/lib/utils/lint/copyConfigs.js +3 -0
- package/lib/utils/lint/index.js +9 -0
- package/lib/utils/lint/lintScripts.js +1 -0
- package/lib/utils/lint/lintSetup.js +4 -3
- package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
- package/lib/utils/lint/question.js +7 -0
- package/lib/utils/lintReporter.js +20 -0
- package/lib/utils/log.js +1 -0
- package/lib/utils/mailSender.js +8 -1
- package/lib/utils/object-manipulation.js +17 -1
- package/lib/utils/pullOrigin.js +4 -0
- package/lib/utils/reinstallDependencies.js +29 -1
- package/lib/utils/removeAttributes.js +8 -1
- package/lib/utils/repoClone.js +28 -3
- package/lib/utils/request.js +12 -0
- package/lib/utils/rtl.js +17 -5
- package/lib/utils/selectorReplacer.js +16 -10
- package/lib/utils/setEnvVariables.js +2 -0
- package/lib/utils/ssTestHack.js +11 -1
- package/lib/utils/switchBranch.js +5 -0
- package/lib/utils/typeCheck.js +1 -0
- package/lib/utils/urlConcat.js +4 -0
- package/lib/utils/useExitCleanup.js +10 -9
- package/lib/utils/variableConverter.js +31 -22
- package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
- package/package.json +3 -2
- package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
- package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
- package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
- package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
- package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
- package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
- package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
- package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
- package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
- package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
- package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
- package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
- package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
- package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
- package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
- package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
- package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
- package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
- package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
- package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
- package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
- package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
- package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +0 -54
@@ -1,11 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _child_process = require("child_process");
|
4
|
+
|
4
5
|
let args = process.argv.slice(2);
|
5
6
|
args.forEach(arg => {
|
6
7
|
if (arg.startsWith('-')) {
|
7
8
|
//eslint-disable-next-line
|
8
9
|
arg = arg.substring(2);
|
9
10
|
}
|
11
|
+
|
10
12
|
(0, _child_process.execSync)(`npm config set ${arg}`);
|
11
13
|
});
|
package/lib/utils/ssTestHack.js
CHANGED
@@ -4,14 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
|
8
10
|
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
function iterateDir(srcPath, callback) {
|
11
15
|
function iterate(srcPath) {
|
12
16
|
if (_fs.default.existsSync(srcPath)) {
|
13
17
|
_fs.default.readdirSync(srcPath).forEach(fileOrDir => {
|
14
18
|
let fromPath = _path.default.join(srcPath, fileOrDir);
|
19
|
+
|
15
20
|
if (_fs.default.statSync(fromPath).isDirectory()) {
|
16
21
|
iterate(fromPath);
|
17
22
|
} else {
|
@@ -20,19 +25,24 @@ function iterateDir(srcPath, callback) {
|
|
20
25
|
});
|
21
26
|
}
|
22
27
|
}
|
28
|
+
|
23
29
|
iterate(srcPath);
|
24
30
|
}
|
31
|
+
|
25
32
|
var _default = () => {
|
26
33
|
let dependencyFolders = [_path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'components', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'dot', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'icons', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'svg', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'variables', 'lib')];
|
27
34
|
let pattern = /if.*\(false\)/g;
|
28
35
|
dependencyFolders.forEach(componentsFolder => {
|
29
36
|
iterateDir(componentsFolder, filepath => {
|
30
37
|
let src = _fs.default.readFileSync(filepath).toString();
|
38
|
+
|
31
39
|
if (pattern.test(src)) {
|
32
40
|
src = src.replace(pattern, 'if (true)');
|
41
|
+
|
33
42
|
_fs.default.writeFileSync(filepath, src);
|
34
43
|
}
|
35
44
|
});
|
36
45
|
});
|
37
46
|
};
|
47
|
+
|
38
48
|
exports.default = _default;
|
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _child_process = require("child_process");
|
9
|
+
|
8
10
|
var _utils = require("../utils");
|
11
|
+
|
9
12
|
var _log = require("./log");
|
13
|
+
|
10
14
|
var _default = (type = 'git', branchName) => new Promise(resolve => {
|
11
15
|
if (type === 'git') {
|
12
16
|
(0, _log.log)((0, _utils.getCurrentBranch)(type, process.cwd()), 'Before the branch switch');
|
@@ -22,4 +26,5 @@ var _default = (type = 'git', branchName) => new Promise(resolve => {
|
|
22
26
|
(0, _utils.pullOrigin)(type, branchName).then(resolve);
|
23
27
|
}
|
24
28
|
});
|
29
|
+
|
25
30
|
exports.default = _default;
|
package/lib/utils/typeCheck.js
CHANGED
package/lib/utils/urlConcat.js
CHANGED
@@ -4,15 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.urlConcat = urlConcat;
|
7
|
+
|
7
8
|
function urlConcat(p1 = '', p2 = '') {
|
8
9
|
if (p1[p1.length - 1] === '/') {
|
9
10
|
if (p2[0] === '/') {
|
10
11
|
return p1 + p2.slice(1);
|
11
12
|
}
|
13
|
+
|
12
14
|
return p1 + p2;
|
13
15
|
}
|
16
|
+
|
14
17
|
if (p2[0] === '/') {
|
15
18
|
return p1 + p2;
|
16
19
|
}
|
20
|
+
|
17
21
|
return `${p1}/${p2}`;
|
18
22
|
}
|
@@ -5,50 +5,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useExitCleanup = useExitCleanup;
|
7
7
|
//so the program will not close instantly
|
8
|
-
|
9
8
|
let listeners = [];
|
10
9
|
let hasCalled = false;
|
10
|
+
|
11
11
|
function useExitCleanup(listener) {
|
12
12
|
if (!hasCalled) {
|
13
13
|
process.stdin.resume();
|
14
14
|
hasCalled = true;
|
15
15
|
}
|
16
|
+
|
16
17
|
listeners.push(listeners);
|
17
18
|
return () => {
|
18
19
|
listeners = listeners.filter(l => l !== listener);
|
19
20
|
};
|
20
21
|
}
|
22
|
+
|
21
23
|
function exitHandler(options, exitCode) {
|
22
24
|
if (options.cleanup) {
|
23
25
|
console.log('clean');
|
24
26
|
}
|
27
|
+
|
25
28
|
if (exitCode || exitCode === 0) {
|
26
29
|
console.log(exitCode);
|
27
30
|
}
|
31
|
+
|
28
32
|
if (options.exit) {
|
29
33
|
process.exit();
|
30
34
|
}
|
31
|
-
}
|
35
|
+
} //do something when app is closing
|
36
|
+
|
32
37
|
|
33
|
-
//do something when app is closing
|
34
38
|
process.on('exit', exitHandler.bind(null, {
|
35
39
|
cleanup: true
|
36
|
-
}));
|
40
|
+
})); //catches ctrl+c event
|
37
41
|
|
38
|
-
//catches ctrl+c event
|
39
42
|
process.on('SIGINT', exitHandler.bind(null, {
|
40
43
|
exit: true
|
41
|
-
}));
|
44
|
+
})); // catches "kill pid" (for example: nodemon restart)
|
42
45
|
|
43
|
-
// catches "kill pid" (for example: nodemon restart)
|
44
46
|
process.on('SIGUSR1', exitHandler.bind(null, {
|
45
47
|
exit: true
|
46
48
|
}));
|
47
49
|
process.on('SIGUSR2', exitHandler.bind(null, {
|
48
50
|
exit: true
|
49
|
-
}));
|
51
|
+
})); //catches uncaught exceptions
|
50
52
|
|
51
|
-
//catches uncaught exceptions
|
52
53
|
process.on('uncaughtException', exitHandler.bind(null, {
|
53
54
|
exit: true
|
54
55
|
}));
|
@@ -1,58 +1,67 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _fileHandling = require("../plugins/utils/fileHandling");
|
4
|
+
|
4
5
|
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
6
|
+
|
5
7
|
var _folderIterator = _interopRequireDefault(require("./folderIterator"));
|
8
|
+
|
6
9
|
var _variableConvertorUtils = require("../plugins/variableConvertorUtils");
|
7
|
-
|
10
|
+
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
|
8
13
|
const postcss = require('postcss');
|
14
|
+
|
9
15
|
const path = require('path');
|
16
|
+
|
10
17
|
const fs = require('fs');
|
18
|
+
|
11
19
|
const ignore = require('ignore');
|
20
|
+
|
12
21
|
const postcssVariableConvertor = require('../postcss-plugins/variableModificationPlugin/index').plugin;
|
22
|
+
|
13
23
|
const cwd = process.cwd();
|
14
24
|
const src = path.join(cwd, process.argv[2]);
|
15
25
|
const dist = path.join(cwd, process.argv[3]);
|
16
26
|
const options = (0, _getOptions.default)();
|
27
|
+
|
17
28
|
function watchHandler(fromPath, toPath) {
|
18
|
-
const css = fs.readFileSync(fromPath, 'utf-8');
|
29
|
+
const css = fs.readFileSync(fromPath, 'utf-8'); // console.log(css);
|
19
30
|
|
20
|
-
// console.log(css);
|
21
31
|
const {
|
22
32
|
css: cssOptions
|
23
|
-
} = options;
|
24
|
-
|
33
|
+
} = options; // console.log(cssOptions, appOptions);
|
34
|
+
|
25
35
|
const {
|
26
36
|
cssVariableReplacementConfig: cssVariableConfigFilePath,
|
27
37
|
patterns: filterArr
|
28
38
|
} = cssOptions;
|
29
39
|
const rootOriginal = postcss.parse(css);
|
30
|
-
const variables = {};
|
31
|
-
|
40
|
+
const variables = {}; // const unassigned = {};
|
41
|
+
|
32
42
|
const rawdata = fs.readFileSync(cssVariableConfigFilePath).toString();
|
33
43
|
const cssVariableOptions = JSON.parse(rawdata);
|
34
44
|
const {
|
35
|
-
settings: settingsObject
|
36
|
-
// errorLog: errorLogStatus,
|
45
|
+
settings: settingsObject // errorLog: errorLogStatus,
|
37
46
|
// errorInConsole: errorConsoleStatus,
|
38
47
|
// errorsAllowed,
|
39
48
|
// strictMode
|
40
|
-
} = cssVariableOptions;
|
41
49
|
|
42
|
-
//Variable Webpack Object Generation
|
50
|
+
} = cssVariableOptions; //Variable Webpack Object Generation
|
51
|
+
|
43
52
|
rootOriginal.walkRules(rule => {
|
44
53
|
rule.walkDecls(decl => {
|
45
54
|
decl.value.split(' ').forEach(val => {
|
46
55
|
if (val && val.includes('--') && !new RegExp(_variableConvertorUtils.ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
|
47
56
|
const extractedValue = (0, _variableConvertorUtils.extractVariableName)(val);
|
57
|
+
|
48
58
|
if (!variables[extractedValue]) {
|
49
59
|
variables[extractedValue] = decl.prop;
|
50
60
|
}
|
51
61
|
}
|
52
62
|
});
|
53
63
|
});
|
54
|
-
});
|
55
|
-
// if (
|
64
|
+
}); // if (
|
56
65
|
// !isFileNameMatchingPluginPattern({
|
57
66
|
// filename: fromPath,
|
58
67
|
// filterArr
|
@@ -60,9 +69,11 @@ function watchHandler(fromPath, toPath) {
|
|
60
69
|
// ) {
|
61
70
|
// return;
|
62
71
|
// }
|
72
|
+
|
63
73
|
const ig = ignore({
|
64
74
|
allowRelativePaths: true
|
65
75
|
}).add(filterArr);
|
76
|
+
|
66
77
|
if (ig.ignores(fromPath)) {
|
67
78
|
// console.log(fromPath);
|
68
79
|
// console.log(ig.ignores(fromPath));
|
@@ -70,25 +81,23 @@ function watchHandler(fromPath, toPath) {
|
|
70
81
|
// '----------------------------------------------------------------'
|
71
82
|
// );
|
72
83
|
return;
|
73
|
-
}
|
74
|
-
|
75
|
-
|
84
|
+
} // Convert code
|
85
|
+
|
86
|
+
|
87
|
+
const convertedCode = (0, _variableConvertorUtils.variableConverter)(rootOriginal, variables, settingsObject).toString(); // run postcss plugin for css code input
|
76
88
|
|
77
|
-
// run postcss plugin for css code input
|
78
89
|
postcss([postcssVariableConvertor(cssVariableConfigFilePath)]).process(convertedCode, {
|
79
90
|
from: undefined
|
80
91
|
}).then(result => {
|
81
92
|
//write new css file data in file
|
82
93
|
fs.writeFileSync(toPath, result.css);
|
83
|
-
});
|
84
|
-
// console.log(variableOptions);
|
94
|
+
}); // console.log(variableOptions);
|
85
95
|
}
|
96
|
+
|
86
97
|
(0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
|
87
98
|
// console.log(fromPath, toPath);
|
88
99
|
watchHandler(fromPath, toPath);
|
89
|
-
});
|
90
|
-
|
91
|
-
// if (canWacth) {
|
100
|
+
}); // if (canWacth) {
|
92
101
|
// useExitCleanup(() => {
|
93
102
|
// fs.unwatchFile(src, watchHandler);
|
94
103
|
// });
|