@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.
Files changed (222) hide show
  1. package/README.md +18 -0
  2. package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
  3. package/lib/babel/cmjs-plugins-presets.js +13 -2
  4. package/lib/babel/es-plugins-presets.js +14 -3
  5. package/lib/common/buildEs.js +0 -1
  6. package/lib/common/getEntries.js +13 -2
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +6 -1
  9. package/lib/common/runPreProcess.js +15 -6
  10. package/lib/common/splitChunks.js +21 -2
  11. package/lib/common/sslcertUpdater.js +18 -7
  12. package/lib/common/templateParameters.js +2 -0
  13. package/lib/common/testPattern.js +21 -10
  14. package/lib/common/valueReplacer.js +16 -1
  15. package/lib/configs/jest.config.js +11 -2
  16. package/lib/configs/libAlias.js +16 -10
  17. package/lib/configs/resolvers.js +16 -6
  18. package/lib/configs/webpack.component.umd.config.js +6 -1
  19. package/lib/configs/webpack.css.umd.config.js +14 -6
  20. package/lib/configs/webpack.dev.config.js +14 -1
  21. package/lib/configs/webpack.docs.config.js +9 -1
  22. package/lib/configs/webpack.impact.config.js +8 -1
  23. package/lib/configs/webpack.prod.config.js +17 -4
  24. package/lib/constants.js +18 -9
  25. package/lib/deprecationLogger.js +7 -0
  26. package/lib/hooks/docsProptypeHook.js +8 -4
  27. package/lib/jest/commitedFilesResult.js +46 -4
  28. package/lib/jest/coverageCollector.js +12 -1
  29. package/lib/jest/jsonMaker.js +6 -0
  30. package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
  31. package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
  32. package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
  33. package/lib/jest/result.js +23 -1
  34. package/lib/jest/run.js +18 -7
  35. package/lib/jest/setup.js +60 -8
  36. package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
  37. package/lib/loaderUtils/getCSSLoaders.js +22 -10
  38. package/lib/loaderUtils/getDevJsLoaders.js +13 -4
  39. package/lib/loaderUtils/index.js +4 -1
  40. package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
  41. package/lib/loaderUtils/windowsModification.js +3 -2
  42. package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
  43. package/lib/loaders/composeLoader.js +37 -13
  44. package/lib/loaders/docsLoader.js +12 -1
  45. package/lib/loaders/docsPropsLoader.js +8 -4
  46. package/lib/loaders/enhancedReactLiveConverter.js +23 -2
  47. package/lib/loaders/fileBountryLoader.js +3 -1
  48. package/lib/loaders/fileLoader.js +23 -12
  49. package/lib/loaders/markdownLoader.js +19 -14
  50. package/lib/loaders/reactLiveConvertor.js +15 -5
  51. package/lib/loaders/scriptInstrumentLoader.js +16 -7
  52. package/lib/loaders/selectorMappingLoader.js +26 -7
  53. package/lib/loaders/workerLoader.js +24 -9
  54. package/lib/logger.js +4 -0
  55. package/lib/middlewares/HMRMiddleware.js +27 -13
  56. package/lib/middlewares/SSTMiddleware.js +5 -1
  57. package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
  58. package/lib/pluginUtils/getDevPlugins.js +42 -9
  59. package/lib/pluginUtils/getDocsPlugins.js +13 -3
  60. package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
  61. package/lib/pluginUtils/getLibraryPlugins.js +8 -2
  62. package/lib/pluginUtils/getProdPlugins.js +47 -8
  63. package/lib/pluginUtils/getServerPlugins.js +8 -2
  64. package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
  65. package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
  66. package/lib/pluginUtils/index.js +9 -1
  67. package/lib/plugins/CdnChangePlugin.js +18 -2
  68. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  69. package/lib/plugins/CssOrderControlPlugin.js +6 -3
  70. package/lib/plugins/CustomAttributePlugin.js +19 -14
  71. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
  72. package/lib/plugins/EFCPlugin.js +34 -20
  73. package/lib/plugins/EFCTemplatePlugin.js +30 -19
  74. package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
  75. package/lib/plugins/EventsHandlingPlugin.js +4 -2
  76. package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
  77. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  79. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
  80. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
  81. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
  82. package/lib/plugins/I18nSplitPlugin/index.js +24 -13
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +8 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
  89. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
  90. package/lib/plugins/ManifestPlugin.js +18 -1
  91. package/lib/plugins/MinifyPlugin.js +10 -1
  92. package/lib/plugins/ModuleStatsPlugin.js +24 -1
  93. package/lib/plugins/OptimizeJSPlugin.js +10 -2
  94. package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
  95. package/lib/plugins/PublicPathChangePlugin.js +39 -6
  96. package/lib/plugins/ReportGeneratePlugin.js +32 -5
  97. package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
  98. package/lib/plugins/ResourceHintsPlugin.js +13 -4
  99. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  100. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
  101. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  102. package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
  103. package/lib/plugins/SelectorPlugin.js +32 -6
  104. package/lib/plugins/ServiceWorkerPlugin.js +22 -5
  105. package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
  106. package/lib/plugins/SourceMapHookPlugin.js +12 -2
  107. package/lib/plugins/StatsPlugin.js +14 -0
  108. package/lib/plugins/TPHashMappingPlugin.js +18 -3
  109. package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
  110. package/lib/plugins/VariableConversionCollector.js +42 -15
  111. package/lib/plugins/index.js +20 -1
  112. package/lib/plugins/libraryImpactPlugin.js +33 -1
  113. package/lib/plugins/utils/classHandling.js +6 -0
  114. package/lib/plugins/utils/fileHandling.js +15 -6
  115. package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
  116. package/lib/plugins/variableConvertorUtils.js +29 -14
  117. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  118. package/lib/postcss-plugins/EmptyPlugin.js +4 -3
  119. package/lib/postcss-plugins/ExcludePlugin.js +5 -1
  120. package/lib/postcss-plugins/IncludePlugin.js +5 -1
  121. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  122. package/lib/postcss-plugins/SelectorReplace.js +16 -1
  123. package/lib/postcss-plugins/ValueReplacer.js +6 -7
  124. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  125. package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
  126. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
  127. package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
  128. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
  129. package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
  130. package/lib/schemas/index.js +10 -3
  131. package/lib/servers/clusterHubServer.js +11 -1
  132. package/lib/servers/devBuild.js +26 -14
  133. package/lib/servers/docsServer.js +3 -1
  134. package/lib/servers/docsServerCore.js +22 -1
  135. package/lib/servers/getCliPath.js +9 -0
  136. package/lib/servers/helpServer.js +6 -1
  137. package/lib/servers/httpsOptions.js +8 -2
  138. package/lib/servers/impactServer.js +35 -3
  139. package/lib/servers/mockserver.js +10 -1
  140. package/lib/servers/nowatchserver.js +37 -12
  141. package/lib/servers/requireLocalOrGlobal.js +17 -6
  142. package/lib/servers/scrServer.js +21 -14
  143. package/lib/servers/server.js +36 -6
  144. package/lib/servers/ssServer.js +17 -1
  145. package/lib/templates/CoverageScriptTemplate.js +14 -0
  146. package/lib/templates/WMSTemplate.js +13 -7
  147. package/lib/templates/linterConstant.js +4 -2
  148. package/lib/utils/babelPresets.js +7 -3
  149. package/lib/utils/clean.js +9 -3
  150. package/lib/utils/copy.js +7 -1
  151. package/lib/utils/copyTimezones.js +9 -1
  152. package/lib/utils/createEventStream.js +6 -1
  153. package/lib/utils/cssClassNameGenerate.js +30 -10
  154. package/lib/utils/cssURLReplacer.js +22 -1
  155. package/lib/utils/dependencyPostPublish.js +10 -1
  156. package/lib/utils/deprecationSupport.js +32 -7
  157. package/lib/utils/fileUtils.js +28 -1
  158. package/lib/utils/folderIterator.js +13 -2
  159. package/lib/utils/getComponents.js +21 -0
  160. package/lib/utils/getCurrentBranch.js +5 -0
  161. package/lib/utils/getDependenciesImpactList.js +22 -1
  162. package/lib/utils/getFileType.js +10 -2
  163. package/lib/utils/getHash.js +8 -1
  164. package/lib/utils/getIp.js +2 -0
  165. package/lib/utils/getOptions.js +53 -16
  166. package/lib/utils/getServerURL.js +10 -1
  167. package/lib/utils/index.js +51 -4
  168. package/lib/utils/init.js +1 -0
  169. package/lib/utils/initPreCommitHook.js +30 -7
  170. package/lib/utils/jsonHelper.js +22 -3
  171. package/lib/utils/libraryImpactConfig.js +5 -2
  172. package/lib/utils/lint/addScripts.js +5 -2
  173. package/lib/utils/lint/checkExistingConfig.js +12 -3
  174. package/lib/utils/lint/copyConfigs.js +3 -0
  175. package/lib/utils/lint/index.js +9 -0
  176. package/lib/utils/lint/lintScripts.js +1 -0
  177. package/lib/utils/lint/lintSetup.js +4 -3
  178. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  179. package/lib/utils/lint/question.js +7 -0
  180. package/lib/utils/lintReporter.js +20 -0
  181. package/lib/utils/log.js +1 -0
  182. package/lib/utils/mailSender.js +8 -1
  183. package/lib/utils/object-manipulation.js +17 -1
  184. package/lib/utils/pullOrigin.js +4 -0
  185. package/lib/utils/reinstallDependencies.js +29 -1
  186. package/lib/utils/removeAttributes.js +8 -1
  187. package/lib/utils/repoClone.js +28 -3
  188. package/lib/utils/request.js +12 -0
  189. package/lib/utils/rtl.js +17 -5
  190. package/lib/utils/selectorReplacer.js +16 -10
  191. package/lib/utils/setEnvVariables.js +2 -0
  192. package/lib/utils/ssTestHack.js +11 -1
  193. package/lib/utils/switchBranch.js +5 -0
  194. package/lib/utils/typeCheck.js +1 -0
  195. package/lib/utils/urlConcat.js +4 -0
  196. package/lib/utils/useExitCleanup.js +10 -9
  197. package/lib/utils/variableConverter.js +31 -22
  198. package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
  199. package/package.json +3 -2
  200. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
  201. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
  202. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
  203. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
  204. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
  205. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
  206. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
  207. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
  208. package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
  209. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
  210. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
  211. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
  212. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
  213. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
  214. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
  215. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
  216. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
  217. package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
  218. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
  219. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
  220. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
  221. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
  222. 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
  });
@@ -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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getTypeOf = getTypeOf;
7
+
7
8
  function getTypeOf(value) {
8
9
  return Object.prototype.toString.call(value).split(/\s/)[1].replace(/\]/, '').toLowerCase();
9
10
  }
@@ -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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
- // console.log(cssOptions, appOptions);
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
- // const unassigned = {};
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
- // Convert code
75
- const convertedCode = (0, _variableConvertorUtils.variableConverter)(rootOriginal, variables, settingsObject).toString();
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
  // });