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