@zohodesk/react-cli 0.0.1-exp.175.1 → 0.0.1-exp.176.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. package/README.md +35 -40
  2. package/docs/SelectorWeight.md +6 -0
  3. package/docs/VariableConversion.md +33 -1
  4. package/lib/babel/cmjs-plugins-presets.js +4 -0
  5. package/lib/babel/es-plugins-presets.js +4 -0
  6. package/lib/common/getEntries.js +10 -0
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +5 -0
  9. package/lib/common/splitChunks.js +13 -2
  10. package/lib/common/sslcertUpdater.js +17 -6
  11. package/lib/common/templateParameters.js +2 -0
  12. package/lib/common/testPattern.js +21 -10
  13. package/lib/common/valueReplacer.js +15 -0
  14. package/lib/configs/jest.config.js +9 -0
  15. package/lib/configs/libAlias.js +2 -4
  16. package/lib/configs/webpack.component.umd.config.js +5 -0
  17. package/lib/configs/webpack.css.umd.config.js +13 -5
  18. package/lib/configs/webpack.dev.config.js +36 -2
  19. package/lib/configs/webpack.docs.config.js +21 -1
  20. package/lib/configs/webpack.impact.config.js +19 -1
  21. package/lib/configs/webpack.prod.config.js +37 -3
  22. package/lib/hooks/docsProptypeHook.js +7 -3
  23. package/lib/jest/commitedFilesResult.js +45 -3
  24. package/lib/jest/coverageCollector.js +11 -0
  25. package/lib/jest/jsonMaker.js +6 -0
  26. package/lib/jest/preProcessors/cssPreprocessor.js +8 -0
  27. package/lib/jest/preProcessors/jsPreprocessor.js +2 -0
  28. package/lib/jest/preProcessors/otherFilesPreprocessor.js +3 -0
  29. package/lib/jest/result.js +22 -0
  30. package/lib/jest/run.js +17 -6
  31. package/lib/jest/setup.js +57 -5
  32. package/lib/loaderUtils/configsAssetsLoaders.js +11 -1
  33. package/lib/loaderUtils/getCSSLoaders.js +35 -20
  34. package/lib/loaderUtils/getDevJsLoaders.js +8 -0
  35. package/lib/loaderUtils/index.js +3 -0
  36. package/lib/loaderUtils/windowsModification.js +11 -0
  37. package/lib/loaders/docsLoader.js +7 -0
  38. package/lib/loaders/docsPropsLoader.js +7 -3
  39. package/lib/loaders/fileBountryLoader.js +2 -0
  40. package/lib/loaders/fileLoader.js +22 -11
  41. package/lib/loaders/scriptInstrumentLoader.js +13 -5
  42. package/lib/loaders/selectorMappingLoader.js +25 -7
  43. package/lib/loaders/workerLoader.js +20 -4
  44. package/lib/middlewares/HMRMiddleware.js +26 -13
  45. package/lib/middlewares/SSTMiddleware.js +3 -0
  46. package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -3
  47. package/lib/pluginUtils/getDevPlugins.js +63 -17
  48. package/lib/pluginUtils/getDocsPlugins.js +10 -1
  49. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -4
  50. package/lib/pluginUtils/getLibraryPlugins.js +5 -0
  51. package/lib/pluginUtils/getProdPlugins.js +72 -23
  52. package/lib/pluginUtils/getServerPlugins.js +5 -0
  53. package/lib/pluginUtils/getUMDCSSPlugins.js +7 -0
  54. package/lib/pluginUtils/getUMDComponentPlugins.js +7 -0
  55. package/lib/pluginUtils/index.js +8 -0
  56. package/lib/plugins/CdnChangePlugin.js +14 -0
  57. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  58. package/lib/plugins/EFCPlugin.js +34 -23
  59. package/lib/plugins/EFCTemplatePlugin.js +32 -23
  60. package/lib/plugins/I18NInjectIntoIndexPlugin.js +34 -8
  61. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +17 -12
  62. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  63. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +39 -8
  64. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +29 -14
  65. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +22 -13
  66. package/lib/plugins/I18nSplitPlugin/index.js +23 -13
  67. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  68. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  69. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  70. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +6 -0
  71. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  72. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -2
  73. package/lib/plugins/ManifestPlugin.js +17 -0
  74. package/lib/plugins/ModuleStatsPlugin.js +23 -0
  75. package/lib/plugins/OptimizeJSPlugin.js +7 -0
  76. package/lib/plugins/PublicPathCallbackPlugin.js +10 -0
  77. package/lib/plugins/PublicPathChangePlugin.js +36 -4
  78. package/lib/plugins/ReportGeneratePlugin.js +30 -4
  79. package/lib/plugins/RequireVariablePublicPlugin.js +6 -0
  80. package/lib/plugins/ResourceHintsPlugin.js +10 -3
  81. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  82. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +16 -9
  83. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  84. package/lib/plugins/ScriptInstrumentPlugin.js +7 -0
  85. package/lib/plugins/SelectorPlugin.js +97 -0
  86. package/lib/plugins/ServiceWorkerPlugin.js +20 -4
  87. package/lib/plugins/ShadowDOMSupportPlugin.js +40 -3
  88. package/lib/plugins/SourceMapHookPlugin.js +9 -0
  89. package/lib/plugins/TPHashMappingPlugin.js +15 -1
  90. package/lib/plugins/UglifyCSSPlugin.js +9 -0
  91. package/lib/plugins/UnusedFilesFindPlugin.js +35 -2
  92. package/lib/plugins/VariableConversionCollector.js +252 -0
  93. package/lib/plugins/composeCommonPlugin.js +30 -0
  94. package/lib/plugins/index.js +19 -0
  95. package/lib/plugins/libraryImpactPlugin.js +32 -0
  96. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  97. package/lib/postcss-plugins/ExcludePlugin.js +4 -0
  98. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  99. package/lib/postcss-plugins/ValueReplacer.js +6 -9
  100. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  101. package/lib/postcss-plugins/hoverActivePlugin.js +66 -30
  102. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +40 -13
  103. package/lib/postcss-plugins/variableModificationPlugin/index.js +215 -141
  104. package/lib/postcss-plugins/variableModifier.js +20 -13
  105. package/lib/schemas/index.js +23 -4
  106. package/lib/servers/clusterHubServer.js +10 -0
  107. package/lib/servers/devBuild.js +24 -13
  108. package/lib/servers/docsServer.js +2 -0
  109. package/lib/servers/docsServerCore.js +21 -0
  110. package/lib/servers/getCliPath.js +9 -0
  111. package/lib/servers/helpServer.js +5 -0
  112. package/lib/servers/httpsOptions.js +4 -0
  113. package/lib/servers/impactServer.js +34 -2
  114. package/lib/servers/mockserver.js +9 -0
  115. package/lib/servers/nowatchserver.js +34 -12
  116. package/lib/servers/scrServer.js +20 -13
  117. package/lib/servers/server.js +35 -7
  118. package/lib/servers/ssServer.js +16 -0
  119. package/lib/templates/CoverageScriptTemplate.js +14 -0
  120. package/lib/templates/WMSTemplate.js +12 -6
  121. package/lib/utils/babelPresets.js +2 -0
  122. package/lib/utils/clean.js +8 -2
  123. package/lib/utils/copy.js +6 -0
  124. package/lib/utils/copyTimezones.js +8 -0
  125. package/lib/utils/createEventStream.js +4 -0
  126. package/lib/utils/cssClassNameGenerate.js +19 -3
  127. package/lib/utils/cssURLReplacer.js +50 -38
  128. package/lib/utils/dependencyPostPublish.js +9 -0
  129. package/lib/utils/fileUtils.js +26 -0
  130. package/lib/utils/folderIterator.js +10 -0
  131. package/lib/utils/getComponents.js +21 -0
  132. package/lib/utils/getCurrentBranch.js +5 -0
  133. package/lib/utils/getDependenciesImpactList.js +21 -0
  134. package/lib/utils/getFileType.js +49 -0
  135. package/lib/utils/getHash.js +7 -0
  136. package/lib/utils/getIp.js +2 -0
  137. package/lib/utils/getOptions.js +39 -14
  138. package/lib/utils/getServerURL.js +7 -0
  139. package/lib/utils/index.js +47 -2
  140. package/lib/utils/init.js +1 -0
  141. package/lib/utils/initPreCommitHook.js +29 -6
  142. package/lib/utils/jsonHelper.js +19 -2
  143. package/lib/utils/libraryImpactConfig.js +2 -0
  144. package/lib/utils/lint/addScripts.js +5 -2
  145. package/lib/utils/lint/checkExistingConfig.js +12 -3
  146. package/lib/utils/lint/copyConfigs.js +3 -0
  147. package/lib/utils/lint/index.js +9 -0
  148. package/lib/utils/lint/lintScripts.js +1 -0
  149. package/lib/utils/lint/lintSetup.js +4 -3
  150. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  151. package/lib/utils/lint/question.js +7 -0
  152. package/lib/utils/lintReporter.js +20 -0
  153. package/lib/utils/mailSender.js +7 -0
  154. package/lib/utils/pullOrigin.js +4 -0
  155. package/lib/utils/reinstallDependencies.js +28 -0
  156. package/lib/utils/removeAttributes.js +7 -0
  157. package/lib/utils/repoClone.js +27 -2
  158. package/lib/utils/request.js +12 -0
  159. package/lib/utils/rtl.js +16 -4
  160. package/lib/utils/setEnvVariables.js +2 -0
  161. package/lib/utils/ssTestHack.js +10 -0
  162. package/lib/utils/switchBranch.js +4 -0
  163. package/lib/utils/urlConcat.js +4 -0
  164. package/lib/utils/useExitCleanup.js +10 -9
  165. package/package.json +10 -9
@@ -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"));
11
+
9
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,8 +4,11 @@ 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 _default = (type = 'git', branchName) => new Promise(resolve => {
10
13
  if (type === 'git') {
11
14
  (0, _utils.log)((0, _utils.getCurrentBranch)(type, process.cwd()), 'Before the branch switch');
@@ -21,4 +24,5 @@ var _default = (type = 'git', branchName) => new Promise(resolve => {
21
24
  (0, _utils.pullOrigin)(type, branchName).then(resolve);
22
25
  }
23
26
  });
27
+
24
28
  exports.default = _default;
@@ -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
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "0.0.1-exp.175.1",
3
+ "version": "0.0.1-exp.176.11",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -9,6 +9,7 @@
9
9
  "start": "babel src -d lib -w --copy-files",
10
10
  "build": "babel src -d lib --copy-files",
11
11
  "prepare": "npm run clean && npm run build",
12
+ "prepublish": "npm prune now",
12
13
  "lint": "eslint src ./bin/cli.js",
13
14
  "postpublish": "node postpublish.js",
14
15
  "expublish": "npm publish --tag experimental-version"
@@ -28,14 +29,14 @@
28
29
  },
29
30
  "homepage": "https://git.csez.zohocorpin.com/zohodesk/react-cli/blob/2.0.0/README.md",
30
31
  "dependencies": {
31
- "@babel/cli": "7.20.7",
32
- "@babel/core": "7.20.7",
33
- "@babel/plugin-proposal-object-rest-spread": "7.20.7",
32
+ "@babel/cli": "7.10.5",
33
+ "@babel/core": "7.11.1",
34
+ "@babel/plugin-proposal-object-rest-spread": "7.11.0",
34
35
  "@babel/plugin-syntax-dynamic-import": "7.8.3",
35
- "@babel/plugin-transform-runtime": "7.19.6",
36
- "@babel/preset-env": "7.20.2",
37
- "@babel/preset-react": "7.18.6",
38
- "@babel/runtime": "7.20.7",
36
+ "@babel/plugin-transform-runtime": "7.11.0",
37
+ "@babel/preset-env": "7.11.0",
38
+ "@babel/preset-react": "7.10.4",
39
+ "@babel/runtime": "7.11.2",
39
40
  "@zohodesk/datetimejs": "1.0.0-beta.8",
40
41
  "@zohodesk/eslint-plugin-react-performance": "1.0.3",
41
42
  "@zohodesk/eslint-plugin-zsecurity": "0.0.1-beta.4",
@@ -45,7 +46,7 @@
45
46
  "@zohodesk/screenshot-test": "0.0.1-beta.20",
46
47
  "babel-eslint": "10.1.0",
47
48
  "babel-jest": "26.3.0",
48
- "babel-loader": "9.1.0",
49
+ "babel-loader": "8.1.0",
49
50
  "babel-plugin-lodash": "3.3.4",
50
51
  "babel-plugin-transform-define": "2.0.0",
51
52
  "babel-plugin-transform-dynamic-import": "2.1.0",