@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.
Files changed (221) hide show
  1. package/lib/babel/babel-option-utils/babel-preset-react-option.js +0 -3
  2. package/lib/babel/cmjs-plugins-presets.js +1 -8
  3. package/lib/babel/es-plugins-presets.js +1 -8
  4. package/lib/common/buildEs.js +1 -0
  5. package/lib/common/getEntries.js +2 -13
  6. package/lib/common/getPublicPathConfig.js +0 -6
  7. package/lib/common/index.js +1 -6
  8. package/lib/common/runPreProcess.js +6 -15
  9. package/lib/common/splitChunks.js +2 -21
  10. package/lib/common/sslcertUpdater.js +7 -18
  11. package/lib/common/templateParameters.js +0 -2
  12. package/lib/common/testPattern.js +10 -21
  13. package/lib/common/valueReplacer.js +1 -16
  14. package/lib/configs/jest.config.js +1 -10
  15. package/lib/configs/libAlias.js +8 -14
  16. package/lib/configs/resolvers.js +4 -14
  17. package/lib/configs/webpack.component.umd.config.js +1 -6
  18. package/lib/configs/webpack.css.umd.config.js +6 -14
  19. package/lib/configs/webpack.dev.config.js +1 -14
  20. package/lib/configs/webpack.docs.config.js +1 -9
  21. package/lib/configs/webpack.impact.config.js +1 -8
  22. package/lib/configs/webpack.prod.config.js +4 -17
  23. package/lib/constants.js +9 -18
  24. package/lib/deprecationLogger.js +0 -7
  25. package/lib/hooks/docsProptypeHook.js +4 -8
  26. package/lib/jest/commitedFilesResult.js +4 -46
  27. package/lib/jest/coverageCollector.js +1 -12
  28. package/lib/jest/jsonMaker.js +0 -6
  29. package/lib/jest/preProcessors/cssPreprocessor.js +1 -9
  30. package/lib/jest/preProcessors/jsPreprocessor.js +1 -6
  31. package/lib/jest/preProcessors/otherFilesPreprocessor.js +1 -4
  32. package/lib/jest/result.js +1 -23
  33. package/lib/jest/run.js +7 -18
  34. package/lib/jest/setup.js +8 -60
  35. package/lib/loaderUtils/configsAssetsLoaders.js +2 -12
  36. package/lib/loaderUtils/getCSSLoaders.js +10 -22
  37. package/lib/loaderUtils/getDevJsLoaders.js +4 -13
  38. package/lib/loaderUtils/index.js +1 -4
  39. package/lib/loaderUtils/tests/windowsModification.test.js +0 -1
  40. package/lib/loaderUtils/windowsModification.js +2 -3
  41. package/lib/loaders/__test__/markdownLoader.spec.js +0 -1
  42. package/lib/loaders/composeLoader.js +13 -37
  43. package/lib/loaders/docsLoader.js +1 -12
  44. package/lib/loaders/docsPropsLoader.js +4 -8
  45. package/lib/loaders/enhancedReactLiveConverter.js +2 -23
  46. package/lib/loaders/fileBountryLoader.js +1 -3
  47. package/lib/loaders/fileLoader.js +12 -23
  48. package/lib/loaders/markdownLoader.js +14 -19
  49. package/lib/loaders/reactLiveConvertor.js +5 -15
  50. package/lib/loaders/scriptInstrumentLoader.js +7 -16
  51. package/lib/loaders/selectorMappingLoader.js +7 -26
  52. package/lib/loaders/workerLoader.js +9 -24
  53. package/lib/logger.js +0 -4
  54. package/lib/middlewares/HMRMiddleware.js +13 -27
  55. package/lib/middlewares/SSTMiddleware.js +1 -5
  56. package/lib/pluginUtils/configHtmlWebpackPlugins.js +1 -24
  57. package/lib/pluginUtils/getDevPlugins.js +9 -42
  58. package/lib/pluginUtils/getDocsPlugins.js +3 -13
  59. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -6
  60. package/lib/pluginUtils/getLibraryPlugins.js +2 -8
  61. package/lib/pluginUtils/getProdPlugins.js +8 -47
  62. package/lib/pluginUtils/getServerPlugins.js +2 -8
  63. package/lib/pluginUtils/getUMDCSSPlugins.js +2 -10
  64. package/lib/pluginUtils/getUMDComponentPlugins.js +2 -10
  65. package/lib/pluginUtils/index.js +1 -9
  66. package/lib/plugins/CdnChangePlugin.js +2 -18
  67. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  68. package/lib/plugins/CssOrderControlPlugin.js +3 -6
  69. package/lib/plugins/CustomAttributePlugin.js +14 -19
  70. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +3 -23
  71. package/lib/plugins/EFCPlugin.js +20 -34
  72. package/lib/plugins/EFCTemplatePlugin.js +19 -30
  73. package/lib/plugins/EfcResourceCleanupPlugin.js +0 -3
  74. package/lib/plugins/EventsHandlingPlugin.js +2 -4
  75. package/lib/plugins/I18NInjectIntoIndexPlugin.js +11 -37
  76. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +10 -15
  77. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +12 -25
  79. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +55 -133
  80. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +12 -23
  81. package/lib/plugins/I18nSplitPlugin/index.js +13 -24
  82. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +64 -58
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +10 -29
  85. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +8 -19
  86. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  88. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +1 -8
  89. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  90. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -20
  91. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +0 -1
  92. package/lib/plugins/ManifestPlugin.js +1 -18
  93. package/lib/plugins/MinifyPlugin.js +1 -10
  94. package/lib/plugins/ModuleStatsPlugin.js +1 -24
  95. package/lib/plugins/OptimizeJSPlugin.js +2 -10
  96. package/lib/plugins/PublicPathCallbackPlugin.js +1 -12
  97. package/lib/plugins/PublicPathChangePlugin.js +6 -39
  98. package/lib/plugins/ReportGeneratePlugin.js +5 -32
  99. package/lib/plugins/RequireVariablePublicPlugin.js +1 -8
  100. package/lib/plugins/ResourceHintsPlugin.js +4 -13
  101. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  102. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +10 -17
  103. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  104. package/lib/plugins/ScriptInstrumentPlugin.js +1 -8
  105. package/lib/plugins/SelectorPlugin.js +6 -32
  106. package/lib/plugins/ServiceWorkerPlugin.js +5 -22
  107. package/lib/plugins/ShadowDOMSupportPlugin.js +4 -41
  108. package/lib/plugins/SourceMapHookPlugin.js +2 -12
  109. package/lib/plugins/StatsPlugin.js +0 -14
  110. package/lib/plugins/TPHashMappingPlugin.js +3 -18
  111. package/lib/plugins/UnusedFilesFindPlugin.js +4 -39
  112. package/lib/plugins/VariableConversionCollector.js +15 -42
  113. package/lib/plugins/index.js +1 -20
  114. package/lib/plugins/libraryImpactPlugin.js +1 -33
  115. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +306 -0
  116. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +363 -0
  117. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +694 -0
  118. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +1258 -0
  119. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +542 -0
  120. package/lib/plugins/newi18nsplitplugin/18nplugin.js +974 -0
  121. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +131 -0
  122. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +59 -0
  123. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +262 -0
  124. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +166 -0
  125. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +111 -0
  126. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +163 -0
  127. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +88 -0
  128. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +101 -0
  129. package/lib/plugins/newi18nsplitplugin/constants.js +162 -0
  130. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +78 -0
  131. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +22 -0
  132. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +18 -0
  133. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +580 -0
  134. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +54 -0
  135. package/lib/plugins/utils/classHandling.js +0 -6
  136. package/lib/plugins/utils/fileHandling.js +6 -15
  137. package/lib/plugins/utils/tests/fileHandling.test.js +0 -4
  138. package/lib/plugins/variableConvertorUtils.js +14 -29
  139. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  140. package/lib/postcss-plugins/EmptyPlugin.js +3 -4
  141. package/lib/postcss-plugins/ExcludePlugin.js +1 -5
  142. package/lib/postcss-plugins/IncludePlugin.js +1 -5
  143. package/lib/postcss-plugins/RTLSplitPlugin.js +14 -27
  144. package/lib/postcss-plugins/SelectorReplace.js +1 -16
  145. package/lib/postcss-plugins/ValueReplacer.js +7 -6
  146. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  147. package/lib/postcss-plugins/__test__/selectorReplace.test.js +6 -3
  148. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +2 -5
  149. package/lib/postcss-plugins/hoverActivePlugin.js +31 -67
  150. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -7
  151. package/lib/postcss-plugins/variableModificationPlugin/index.js +28 -49
  152. package/lib/schemas/index.js +3 -9
  153. package/lib/servers/clusterHubServer.js +1 -11
  154. package/lib/servers/devBuild.js +14 -26
  155. package/lib/servers/docsServer.js +1 -3
  156. package/lib/servers/docsServerCore.js +1 -22
  157. package/lib/servers/getCliPath.js +0 -9
  158. package/lib/servers/helpServer.js +1 -6
  159. package/lib/servers/httpsOptions.js +2 -8
  160. package/lib/servers/impactServer.js +3 -35
  161. package/lib/servers/mockserver.js +1 -10
  162. package/lib/servers/nowatchserver.js +12 -37
  163. package/lib/servers/requireLocalOrGlobal.js +6 -17
  164. package/lib/servers/scrServer.js +14 -21
  165. package/lib/servers/server.js +6 -36
  166. package/lib/servers/ssServer.js +1 -17
  167. package/lib/templates/CoverageScriptTemplate.js +0 -14
  168. package/lib/templates/WMSTemplate.js +7 -13
  169. package/lib/templates/linterConstant.js +2 -4
  170. package/lib/utils/babelPresets.js +3 -7
  171. package/lib/utils/clean.js +3 -9
  172. package/lib/utils/copy.js +1 -7
  173. package/lib/utils/copyTimezones.js +1 -9
  174. package/lib/utils/createEventStream.js +1 -6
  175. package/lib/utils/cssClassNameGenerate.js +10 -30
  176. package/lib/utils/cssURLReplacer.js +1 -22
  177. package/lib/utils/dependencyPostPublish.js +1 -10
  178. package/lib/utils/deprecationSupport.js +7 -32
  179. package/lib/utils/fileUtils.js +1 -28
  180. package/lib/utils/folderIterator.js +2 -13
  181. package/lib/utils/getComponents.js +0 -21
  182. package/lib/utils/getCurrentBranch.js +0 -5
  183. package/lib/utils/getDependenciesImpactList.js +1 -22
  184. package/lib/utils/getFileType.js +2 -10
  185. package/lib/utils/getHash.js +1 -8
  186. package/lib/utils/getIp.js +0 -2
  187. package/lib/utils/getOptions.js +16 -53
  188. package/lib/utils/getServerURL.js +1 -10
  189. package/lib/utils/index.js +4 -51
  190. package/lib/utils/init.js +0 -1
  191. package/lib/utils/initPreCommitHook.js +7 -30
  192. package/lib/utils/jsonHelper.js +3 -22
  193. package/lib/utils/libraryImpactConfig.js +2 -5
  194. package/lib/utils/lint/addScripts.js +2 -5
  195. package/lib/utils/lint/checkExistingConfig.js +3 -12
  196. package/lib/utils/lint/copyConfigs.js +0 -3
  197. package/lib/utils/lint/index.js +0 -9
  198. package/lib/utils/lint/lintScripts.js +0 -1
  199. package/lib/utils/lint/lintSetup.js +3 -4
  200. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  201. package/lib/utils/lint/question.js +0 -7
  202. package/lib/utils/lintReporter.js +0 -20
  203. package/lib/utils/log.js +0 -1
  204. package/lib/utils/mailSender.js +1 -8
  205. package/lib/utils/object-manipulation.js +1 -17
  206. package/lib/utils/pullOrigin.js +0 -4
  207. package/lib/utils/reinstallDependencies.js +1 -29
  208. package/lib/utils/removeAttributes.js +1 -8
  209. package/lib/utils/repoClone.js +3 -28
  210. package/lib/utils/request.js +0 -12
  211. package/lib/utils/rtl.js +5 -17
  212. package/lib/utils/selectorReplacer.js +10 -16
  213. package/lib/utils/setEnvVariables.js +0 -2
  214. package/lib/utils/ssTestHack.js +1 -11
  215. package/lib/utils/switchBranch.js +0 -5
  216. package/lib/utils/typeCheck.js +0 -1
  217. package/lib/utils/urlConcat.js +0 -4
  218. package/lib/utils/useExitCleanup.js +9 -10
  219. package/lib/utils/variableConverter.js +22 -31
  220. package/{npm-shrinkwrap.json → package-lock.json} +2098 -1999
  221. package/package.json +1 -1
@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.loaderResolver = loaderResolver;
7
7
  exports.moduleResolver = moduleResolver;
8
-
9
8
  var _constants = require("../constants");
10
-
11
9
  var _logger = require("../logger");
12
-
13
10
  var _requireLocalOrGlobal = require("../servers/requireLocalOrGlobal");
14
-
15
11
  var _libAlias = require("./libAlias");
16
-
17
12
  var _client_packages_group = require("@zohodesk/client_packages_group");
18
-
19
13
  function moduleResolver(options) {
20
14
  const {
21
15
  moduleResolvePath,
@@ -23,32 +17,28 @@ function moduleResolver(options) {
23
17
  } = options.app;
24
18
  const customAlias = options.alias;
25
19
  let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
26
-
27
20
  if (!required) {
28
21
  required = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk/client_packages_group');
29
-
30
22
  if (required) {
31
23
  (0, _logger.messageLogger)('global `@zohodesk/client_packages_group` package taken as client_packages_group');
32
24
  }
33
25
  }
34
-
35
26
  const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
36
27
  const totalAlias = disableES5Transpile ? Object.assign({}, _libAlias.libAlias, (0, _libAlias.aliasPathCreation)(customAlias)) : (0, _libAlias.aliasPathCreation)(customAlias);
37
28
  return {
38
29
  extensions: ['.js', '.jsx', '.ts', '.tsx'],
39
30
  modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
40
- alias: totalAlias // alias: { ...libAlias, ...clientDependenies }
41
-
31
+ alias: totalAlias
32
+ // alias: { ...libAlias, ...clientDependenies }
42
33
  };
43
34
  }
44
-
45
35
  function loaderResolver(options) {
46
36
  // const unstableDepsInverse = false;
47
37
  const {
48
38
  unstableDepsInverse
49
39
  } = options;
50
40
  return {
51
- modules: unstableDepsInverse ? ['node_modules', _constants.cliNodeModulesPath] : [_constants.cliNodeModulesPath, 'node_modules'] // alias: libAlias
52
-
41
+ modules: unstableDepsInverse ? ['node_modules', _constants.cliNodeModulesPath] : [_constants.cliNodeModulesPath, 'node_modules']
42
+ // alias: libAlias
53
43
  };
54
44
  }
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
6
-
7
5
  var _utils = require("../utils");
8
-
9
6
  var _pluginUtils = require("../pluginUtils");
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
  let options = (0, _utils.getOptions)();
14
9
  let {
15
10
  umd: {
@@ -1,17 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
6
-
7
5
  var _utils = require("../utils");
8
-
9
6
  var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
10
-
11
7
  var _pluginUtils = require("../pluginUtils");
12
-
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
9
  let options = (0, _utils.getOptions)();
16
10
  let {
17
11
  umd: {
@@ -67,13 +61,11 @@ module.exports = {
67
61
  }
68
62
  }],
69
63
  include: _path.default.join(appPath, 'src')
70
- }
71
- /*,
72
- {
73
- test: /\.css$/,
74
- use: [MiniCssExtractPlugin.loader, 'css-loader']
75
- }*/
76
- , {
64
+ } /*,
65
+ {
66
+ test: /\.css$/,
67
+ use: [MiniCssExtractPlugin.loader, 'css-loader']
68
+ }*/, {
77
69
  test: /(\.module)?\.css$/,
78
70
  use: [{
79
71
  loader: _miniCssExtractPlugin.default.loader,
@@ -1,21 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _utils = require("../utils");
6
-
7
5
  var _common = require("../common");
8
-
9
6
  var _pluginUtils = require("../pluginUtils");
10
-
11
7
  var _loaderUtils = require("../loaderUtils");
12
-
13
8
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
-
15
9
  var _resolvers = require("./resolvers");
16
-
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
11
  const options = (0, _utils.getOptions)();
20
12
  const {
21
13
  app: {
@@ -62,11 +54,9 @@ const output = {
62
54
  jsonpFunction: `${context}Jsonp`
63
55
  };
64
56
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
65
-
66
57
  if (crossorigin) {
67
58
  output.crossOriginLoading = 'anonymous';
68
59
  }
69
-
70
60
  module.exports = {
71
61
  entry: (0, _common.getEntries)(options, 'dev'),
72
62
  devtool: sourcemap,
@@ -94,13 +84,10 @@ module.exports = {
94
84
  use: (0, _loaderUtils.getDevJsLoaders)(options),
95
85
  include: module => {
96
86
  const srcPath = _path.default.join(appPath, folder);
97
-
98
87
  const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
99
-
100
88
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
101
89
  return true;
102
90
  }
103
-
104
91
  return false;
105
92
  }
106
93
  }, enableMjsLoader ? {
@@ -1,19 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _utils = require("../utils");
6
-
7
5
  var _pluginUtils = require("../pluginUtils");
8
-
9
6
  var _loaderUtils = require("../loaderUtils");
10
-
11
7
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
12
-
13
8
  var _resolvers = require("./resolvers");
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
10
  const options = (0, _utils.getOptions)();
18
11
  const {
19
12
  docs: {
@@ -39,7 +32,6 @@ const {
39
32
  } = options;
40
33
  const appPath = process.cwd();
41
34
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
42
-
43
35
  module.exports = isSSTest => ({
44
36
  entry: {
45
37
  main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
@@ -1,19 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _utils = require("../utils");
6
-
7
5
  var _loaderUtils = require("../loaderUtils");
8
-
9
6
  var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/getLibraryImactPlugins"));
10
-
11
7
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
12
-
13
8
  var _resolvers = require("./resolvers");
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
10
  const options = (0, _utils.getOptions)();
18
11
  const {
19
12
  docs: {
@@ -1,24 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _utils = require("../utils");
6
-
7
5
  var _common = require("../common");
8
-
9
6
  var _pluginUtils = require("../pluginUtils");
10
-
11
7
  var _loaderUtils = require("../loaderUtils");
12
-
13
8
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
-
15
9
  var _resolvers = require("./resolvers");
16
-
17
10
  var _babelPresetReactOption = _interopRequireDefault(require("../babel/babel-option-utils/babel-preset-react-option"));
18
-
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
12
  // import TerserPlugin from 'terser-webpack-plugin';
13
+
22
14
  const options = (0, _utils.getOptions)();
23
15
  const {
24
16
  app: {
@@ -67,11 +59,9 @@ const output = {
67
59
  jsonpFunction: `${context}Jsonp`,
68
60
  sourceMapFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js.map' : 'js/[name]_.js.map'
69
61
  };
70
-
71
62
  if (crossorigin) {
72
63
  output.crossOriginLoading = 'anonymous';
73
64
  }
74
-
75
65
  if (isDevelopment) {
76
66
  const {
77
67
  disableContextURL
@@ -80,7 +70,6 @@ if (isDevelopment) {
80
70
  const serverUrl = (0, _utils.getServerURL)(server, 'https');
81
71
  output.publicPath = `${[serverUrl, contextURL].filter(a => a).join('/')}/`;
82
72
  }
83
-
84
73
  const shouldRemovePropTypes = !isDevelopment && removePropTypes;
85
74
  module.exports = {
86
75
  entry: (0, _common.getEntries)(options, 'production'),
@@ -134,7 +123,8 @@ module.exports = {
134
123
  }], (0, _babelPresetReactOption.default)({
135
124
  disableES5Transpile
136
125
  }), enableTypeScript ? require.resolve('@babel/preset-typescript') : null].filter(Boolean),
137
- plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve(
126
+ plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'),
127
+ // require.resolve(
138
128
  // '@babel/plugin-proposal-object-rest-spread'
139
129
  // ), REMOVING IT, BECAUSE WE ALREADY SUPPORT SPREAD SYNTAX FROM LIBRARIES.
140
130
  shouldRemovePropTypes ? [require.resolve('babel-plugin-transform-react-remove-prop-types'), removePropTypes] : false, devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
@@ -151,13 +141,10 @@ module.exports = {
151
141
  // include: path.join(appPath, folder)
152
142
  include: module => {
153
143
  const srcPath = _path.default.join(appPath, folder);
154
-
155
144
  const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
156
-
157
145
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
158
146
  return true;
159
147
  }
160
-
161
148
  return false;
162
149
  }
163
150
  }, seperateCssModules ? {
package/lib/constants.js CHANGED
@@ -4,28 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cliRootPath = exports.cliNodeModulesPath = exports.appPath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const BASE_CONFIG_KEY = exports.BASE_CONFIG_KEY = 'react-cli';
10
+ const cliRootPath = exports.cliRootPath = _path.default.resolve(__dirname, '..');
11
+ const CONFIG_ROOT = exports.CONFIG_ROOT = 'react-cli';
12
+ const cliNodeModulesPath = exports.cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules');
9
13
 
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const BASE_CONFIG_KEY = 'react-cli';
13
- exports.BASE_CONFIG_KEY = BASE_CONFIG_KEY;
14
-
15
- const cliRootPath = _path.default.resolve(__dirname, '..');
14
+ // export const babelrcPath = join(cliRootPath, '.babelrc');
16
15
 
17
- exports.cliRootPath = cliRootPath;
18
- const CONFIG_ROOT = 'react-cli';
19
- exports.CONFIG_ROOT = CONFIG_ROOT;
16
+ const appPath = exports.appPath = process.cwd();
20
17
 
21
- const cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules'); // export const babelrcPath = join(cliRootPath, '.babelrc');
22
-
23
-
24
- exports.cliNodeModulesPath = cliNodeModulesPath;
25
- const appPath = process.cwd(); // export const appInitialHTMLTemplatePath = path.join(
18
+ // export const appInitialHTMLTemplatePath = path.join(
26
19
  // process.cwd(),
27
20
  // 'src',
28
21
  // 'index.html'
29
- // );
30
-
31
- exports.appPath = appPath;
22
+ // );
@@ -6,32 +6,25 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.deprecateMessage = deprecateMessage;
7
7
  exports.deprecateOption = deprecateOption;
8
8
  exports.deprecationLoggerEnd = deprecationLoggerEnd;
9
-
10
9
  var _logger = require("./logger");
11
-
12
10
  function deprecateMessage(message) {
13
11
  // eslint-disable-next-line no-use-before-define
14
12
  deprecationLoggerStart();
15
13
  (0, _logger.messageLogger)('\x1b[36m%s\x1b[0m', message);
16
14
  }
17
-
18
15
  function printLine() {
19
16
  deprecateMessage('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n ');
20
17
  }
21
-
22
18
  let isFirstDeprecation = false;
23
-
24
19
  function deprecateOption(previousObjPath = '', newObjPath = '', message = '') {
25
20
  deprecateMessage(`Please move "${previousObjPath.split('.').join(' > ')}" to "${newObjPath.split('.').join(' > ')}" following option ${message}`);
26
21
  }
27
-
28
22
  function deprecationLoggerStart() {
29
23
  if (!isFirstDeprecation) {
30
24
  isFirstDeprecation = true;
31
25
  printLine();
32
26
  }
33
27
  }
34
-
35
28
  function deprecationLoggerEnd() {
36
29
  if (isFirstDeprecation) {
37
30
  isFirstDeprecation = false;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _propTypes = _interopRequireDefault(require("prop-types"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
5
  _propTypes.default.array.hookType = 'array';
8
6
  _propTypes.default.bool.hookType = 'bool';
9
7
  _propTypes.default.func.hookType = 'func';
@@ -22,7 +20,6 @@ _propTypes.default.string.isRequired.hookType = 'string';
22
20
  _propTypes.default.symbol.isRequired.hookType = 'symbol';
23
21
  _propTypes.default.element.isRequired.hookType = 'element';
24
22
  _propTypes.default.node.isRequired.hookType = 'element';
25
-
26
23
  function proxy(fn, type) {
27
24
  let oneOf = fn;
28
25
  return (...args) => {
@@ -30,16 +27,15 @@ function proxy(fn, type) {
30
27
  let type1 = Array.isArray(args) && Array.isArray(args[0]) ? `${type}[${args[0].map(data => typeof data === 'function' ? data.hookType //arrayOf shape complex type not mention
31
28
  : JSON.stringify(data))}]` : type;
32
29
  a.hookType = type1;
33
-
34
30
  if (a.isRequired) {
35
31
  a.isRequired.hookType = type1;
36
32
  }
37
-
38
33
  return a;
39
34
  };
40
35
  }
41
-
42
36
  _propTypes.default.oneOf = proxy(_propTypes.default.oneOf, 'enum');
43
37
  _propTypes.default.oneOfType = proxy(_propTypes.default.oneOfType, 'union');
44
38
  _propTypes.default.arrayOf = proxy(_propTypes.default.arrayOf, 'arrayOf');
45
- _propTypes.default.shape = proxy(_propTypes.default.shape, 'shape'); // export default PropTypes;
39
+ _propTypes.default.shape = proxy(_propTypes.default.shape, 'shape');
40
+
41
+ // export default PropTypes;
@@ -1,25 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
-
5
4
  var _utils = require("../utils");
6
-
7
5
  var _jsonMaker = _interopRequireDefault(require("./jsonMaker"));
8
-
9
6
  var _jsonHelper = require("../utils/jsonHelper");
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
  let result = inp => {
14
9
  inp.endTime = Date.now();
15
10
  let testPathPattern = process.argv[process.argv.length - 1];
16
-
17
11
  if (testPathPattern.indexOf('--') !== -1) {
18
12
  testPathPattern = '';
19
13
  } else {
20
14
  testPathPattern = _fs.default.realpathSync(process.cwd());
21
15
  }
22
-
23
16
  let testPathRegex = new RegExp(testPathPattern);
24
17
  let {
25
18
  testResults
@@ -27,18 +20,14 @@ let result = inp => {
27
20
  let testFilesArr = [];
28
21
  let testCaseFiles = [];
29
22
  let jsonData;
30
-
31
23
  if (_fs.default.existsSync('./coverageTest/result.json')) {
32
24
  jsonData = JSON.parse(_fs.default.readFileSync('./coverageTest/result.json', 'utf8'));
33
25
  }
34
-
35
26
  testResults.forEach(testResult => {
36
27
  let filePath = testResult.testFilePath;
37
-
38
28
  if (!testPathRegex.test(filePath)) {
39
29
  return;
40
30
  }
41
-
42
31
  filePath = filePath.replace('.spec', '');
43
32
  filePath = filePath.replace('/__tests__', '');
44
33
  filePath = filePath.replace('/__test__', '');
@@ -48,31 +37,24 @@ let result = inp => {
48
37
  fileJson.sourcePath = filePath;
49
38
  fileJson.data = testResult;
50
39
  testFilesArr.push(fileJson);
51
-
52
40
  if (jsonData.FILES.includes(relatPath) || jsonData.FILES.includes(testResult.testFilePath.replace(process.cwd(), ''))) {
53
41
  jsonData.FILES.includes(relatPath) ? testCaseFiles.push(relatPath) : jsonData.FILES.includes(testResult.testFilePath.replace(process.cwd(), '')) ? testCaseFiles.push(testResult.testFilePath.replace(process.cwd(), '')) : '';
54
42
  }
55
43
  });
56
44
  let coverageSummary = {};
57
-
58
45
  if (_fs.default.existsSync('./commitCoverage/coverage-summary.json')) {
59
46
  coverageSummary = _fs.default.readFileSync('./commitCoverage/coverage-summary.json').toString();
60
-
61
47
  if (coverageSummary.indexOf('\\') !== -1) {
62
48
  coverageSummary = coverageSummary.replace(/\\/g, '\\\\');
63
49
  }
64
50
  }
65
-
66
51
  let excludeTestArray = '{}';
67
-
68
52
  if (_fs.default.existsSync('./__testUtils__/conf/excludeTest.json')) {
69
53
  excludeTestArray = _fs.default.readFileSync('./__testUtils__/conf/excludeTest.json').toString();
70
-
71
54
  if (excludeTestArray.indexOf('\\') !== -1) {
72
55
  excludeTestArray = excludeTestArray.replace(/\\/g, '\\\\');
73
56
  }
74
57
  }
75
-
76
58
  let coverageJson = JSON.parse(coverageSummary);
77
59
  let linesPercent = 0;
78
60
  let functionPercent = 0;
@@ -81,7 +63,6 @@ let result = inp => {
81
63
  let fileList = '<h4>Changed files in last code check-in</h4><ul>';
82
64
  let i = 0;
83
65
  let excludeTestJSON = JSON.parse(excludeTestArray);
84
-
85
66
  if (Object.keys(excludeTestArray).length > 0) {
86
67
  jsonData.FILES = jsonData.FILES.filter(function (value) {
87
68
  if (!excludeTestJSON.test.exclude.includes(value)) {
@@ -90,18 +71,14 @@ let result = inp => {
90
71
  return value;
91
72
  }
92
73
  });
93
-
94
74
  if (excludeDir.length > 0) {
95
75
  return null;
96
76
  }
97
-
98
77
  return value;
99
78
  }
100
-
101
79
  return null;
102
80
  });
103
81
  }
104
-
105
82
  for (i; i < jsonData.FILES.length; i++) {
106
83
  let coverageData;
107
84
  let curSourceFile = jsonData.FILES[i];
@@ -112,41 +89,32 @@ let result = inp => {
112
89
  coverageData = coverageJson[coverageFile];
113
90
  }
114
91
  });
115
-
116
92
  if (!coverageData) {
117
93
  (0, _utils.log)(`Can't able to find source for ${testFilesArr[i].testPath}\n Please check the file name and the path is correct for test file`);
118
94
  continue;
119
95
  }
120
-
121
96
  linesPercent += coverageData.lines.pct;
122
97
  functionPercent += coverageData.functions.pct;
123
98
  statementPerment += coverageData.statements.pct;
124
99
  branchesPercent += coverageData.branches.pct;
125
100
  }
126
-
127
101
  fileList = `${fileList}</ul>`;
128
-
129
102
  if (!jsonData.FILES.length) {
130
103
  fileList = '<div></div>';
131
104
  }
132
-
133
105
  let uncoveredList = '<h4>Uncovered files :- </h4><ul>';
134
106
  let fileCoverage = 0;
135
-
136
107
  if (jsonData.FILES.length > 0) {
137
108
  fileCoverage = testCaseFiles.length / jsonData.FILES.length * 100;
138
109
  }
139
-
140
110
  fileCoverage = fileCoverage.toFixed(2);
141
111
  fileCoverage = Number(fileCoverage);
142
-
143
112
  if (Number.isNaN(fileCoverage)) {
144
113
  (0, _utils.log)('This build does\'t have any JS changes!');
145
114
  fileCoverage = 0;
146
115
  } else {
147
116
  (0, _utils.log)(`FileCoverage ${fileCoverage}%`);
148
117
  }
149
-
150
118
  let totalLinesPercent = linesPercent / (i * 100) * 100;
151
119
  let totalFunctionPercent = functionPercent / (i * 100) * 100;
152
120
  let totalStatementPercent = statementPerment / (i * 100) * 100;
@@ -154,7 +122,6 @@ let result = inp => {
154
122
  let totalPercentage = totalLinesPercent + totalFunctionPercent + totalStatementPercent + totalBranchesPercent;
155
123
  let coverage = (totalPercentage / 4).toFixed(2);
156
124
  coverage = Number(coverage);
157
-
158
125
  if (Number.isNaN(coverage)) {
159
126
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'can\'t get coverage for this test');
160
127
  coverage = 0;
@@ -162,16 +129,13 @@ let result = inp => {
162
129
  } else {
163
130
  (0, _jsonMaker.default)(inp, coverage, true, 'modifiedFileUnitCase', fileCoverage);
164
131
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.isBuildVerified', coverage > 60);
165
- (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'Test coverage value generated'); // jsonHelper(
132
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'Test coverage value generated');
133
+ // jsonHelper(
166
134
  // `${process.cwd()}/result.json`,
167
135
  // 'testInfo.isBuildVerified',
168
136
  // coverage > 60
169
137
  // );
170
-
171
- (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true
172
- /*coverage > 60*/
173
- );
174
-
138
+ (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true /*coverage > 60*/);
175
139
  if (coverage < 60) {
176
140
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'testInfo.failures', [{
177
141
  type: 'modifiedUnitcases',
@@ -181,21 +145,15 @@ let result = inp => {
181
145
  } else {
182
146
  uncoveredList = uncoveredList + 'You can proceed this build </ul>';
183
147
  }
184
-
185
148
  (0, _utils.log)(`COVERAGE ${coverage}%`);
186
149
  }
187
-
188
150
  let html = `<html><head><style>.red{font-weight:bold;color:red;}.green{font-weight:bold;color:green;}</style></head><body><br/>CODE COVERAGE <span class="${coverage < 60 ? 'red' : 'green'}">${coverage}%</span> <br/> less than 60% consider failure<br/><br/> FILE COVERAGE:<span class="${fileCoverage < 60 ? 'red' : 'green'}">${fileCoverage}%</span> <br/> less than 60% consider failure${fileList}${uncoveredList}</body></html>`;
189
-
190
151
  if (!_fs.default.existsSync('./coverageTest')) {
191
152
  _fs.default.mkdirSync('./coverageTest');
192
-
193
153
  _fs.default.writeFileSync('./coverageTest/index.html', html, 'utf8');
194
154
  } else {
195
155
  _fs.default.writeFileSync('./coverageTest/index.html', html, 'utf8');
196
156
  }
197
-
198
157
  return inp;
199
158
  };
200
-
201
159
  module.exports = result;
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _utils = require("../utils");
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
5
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
6
  function jsFileFilter(listOfObject) {
10
7
  let fileNameList = [];
11
8
  let curListName = process.cwd().split(_path.default.sep);
12
9
  let currentDirName = curListName[curListName.length - 1];
13
10
  listOfObject.forEach(fileObj => {
14
11
  let fileName = fileObj.FILEPATH;
15
-
16
12
  if (fileName.includes(currentDirName)) {
17
13
  fileName = fileName.split(currentDirName + '/')[1]; //eslint-disable-line
18
-
19
14
  if (fileName.includes('.js') && !fileName.includes('.json') && !fileName.includes('.docs.js') && !fileName.includes('.spec.js')) {
20
15
  fileNameList.push(fileName);
21
16
  }
@@ -23,7 +18,6 @@ function jsFileFilter(listOfObject) {
23
18
  });
24
19
  return fileNameList;
25
20
  }
26
-
27
21
  function coverage(devBranch, compareWith, serviceName, domain) {
28
22
  return new Promise(resolve => {
29
23
  (0, _utils.request)({
@@ -32,25 +26,21 @@ function coverage(devBranch, compareWith, serviceName, domain) {
32
26
  body
33
27
  }) => {
34
28
  let res = JSON.parse(body);
35
-
36
29
  if (Object.keys(res).length > 0) {
37
30
  if (Object.prototype.hasOwnProperty.call(res, 'STATUS')) {
38
31
  if (res.STATUS) {
39
32
  let listOfFiles = [];
40
-
41
33
  if (Object.keys(res.DIFF_FILES).length > 0) {
42
34
  if (Object.prototype.hasOwnProperty.call(res.DIFF_FILES, 'ADDED')) {
43
35
  if (res.DIFF_FILES.ADDED.length > 0) {
44
36
  listOfFiles = listOfFiles.concat(jsFileFilter(res.DIFF_FILES.ADDED));
45
37
  }
46
38
  }
47
-
48
39
  if (Object.prototype.hasOwnProperty.call(res.DIFF_FILES, 'UPDATED')) {
49
40
  if (res.DIFF_FILES.UPDATED.length > 0) {
50
41
  listOfFiles = listOfFiles.concat(jsFileFilter(res.DIFF_FILES.UPDATED));
51
42
  }
52
43
  }
53
-
54
44
  if (listOfFiles.length > 0) {
55
45
  resolve({
56
46
  STATUS: true,
@@ -102,5 +92,4 @@ function coverage(devBranch, compareWith, serviceName, domain) {
102
92
  });
103
93
  });
104
94
  }
105
-
106
95
  module.exports = coverage;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _jsonHelper = require("../utils/jsonHelper");
9
-
10
8
  var _default = (resultObj, coverage, status = true, type = 'unitcase', filecoverage = 0) => {
11
9
  let pathArray = [];
12
10
  let resultJson = {};
@@ -34,21 +32,17 @@ var _default = (resultObj, coverage, status = true, type = 'unitcase', filecover
34
32
  } else if (testCase.status === 'passed') {
35
33
  fileObj.CaseList.passedCaseList.push(testCase.title);
36
34
  }
37
-
38
35
  return testCase;
39
36
  });
40
37
  fileDetailList.push(fileObj);
41
38
  return testFile;
42
39
  });
43
-
44
40
  if (type !== 'unitcase') {
45
41
  Array.prototype.push.apply(pathArray, ['tests', 'modifiedFileUnitCase']);
46
42
  } else {
47
43
  Array.prototype.push.apply(pathArray, ['tests', 'unitCase']);
48
44
  }
49
-
50
45
  resultJson.fileDetails = fileDetailList;
51
46
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, pathArray, resultJson);
52
47
  };
53
-
54
48
  exports.default = _default;