@zohodesk/client_build_tool 0.0.11-exp.16.0 → 0.0.11-exp.17.0

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 (220) hide show
  1. package/README.md +102 -0
  2. package/README_backup.md +102 -0
  3. package/lib/allCommandsConfigs.js +7 -2
  4. package/lib/commands/build/commandExecutor.js +5 -1
  5. package/lib/commands/build/config.js +3 -2
  6. package/lib/commands/build/optionsProcessor.js +5 -2
  7. package/lib/commands/build/preProcessor.js +2 -0
  8. package/lib/commands/buildEs/commandExecutor.js +5 -0
  9. package/lib/commands/buildEs/config.js +3 -2
  10. package/lib/commands/buildEs/preProcessor.js +2 -0
  11. package/lib/commands/buildLib/commandExecutor.js +5 -0
  12. package/lib/commands/buildLib/config.js +3 -2
  13. package/lib/commands/buildLib/preProcessor.js +2 -0
  14. package/lib/commands/mockserver/commandExecutor.js +9 -2
  15. package/lib/commands/mockserver/config.js +3 -2
  16. package/lib/commands/pre_process/commandExecutor.js +2 -0
  17. package/lib/commands/pre_process/config.js +3 -2
  18. package/lib/commands/start/commandExecutor.js +2 -0
  19. package/lib/commands/start/config.js +3 -2
  20. package/lib/commands/start/optionsProcessor.js +4 -2
  21. package/lib/commands/start/preProcessor.js +2 -0
  22. package/lib/commands/template/commandExecutor.js +7 -0
  23. package/lib/commands/template/config.js +3 -2
  24. package/lib/commands/version/commandExecutor.js +3 -0
  25. package/lib/commands/version/config.js +3 -2
  26. package/lib/commandsRouter.js +21 -5
  27. package/lib/index.js +2 -0
  28. package/lib/logger.js +5 -0
  29. package/lib/schemas/applyValuesToSchema/index.js +8 -0
  30. package/lib/schemas/applyValuesToSchema/isObject.js +1 -0
  31. package/lib/schemas/applyValuesToSchema/isValid.js +2 -0
  32. package/lib/schemas/cliArgsToObject.js +6 -2
  33. package/lib/schemas/defaultConfigValues.js +17 -4
  34. package/lib/schemas/defaultConfigValuesOnly.js +33 -4
  35. package/lib/schemas/deprecatedOptionsHandler.js +16 -7
  36. package/lib/schemas/getNpmVersion.js +5 -0
  37. package/lib/schemas/giveDefaultValue.js +3 -0
  38. package/lib/schemas/npmConfigToObject.js +5 -2
  39. package/lib/schemas/readOptions.js +30 -10
  40. package/lib/schemas/readOptionsForConfigFile.js +12 -2
  41. package/lib/shared/babel/addDefaultPlugins.js +2 -0
  42. package/lib/shared/babel/babelWebConfig.js +10 -1
  43. package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +4 -0
  44. package/lib/shared/babel/getBabelPlugin.js +7 -2
  45. package/lib/shared/babel/runBabelForJSFile.js +4 -1
  46. package/lib/shared/babel/runBabelForTsFile.js +5 -1
  47. package/lib/shared/bundler/webpack/common/decidePublicPath.js +5 -0
  48. package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
  49. package/lib/shared/bundler/webpack/common/modeUtils.js +5 -0
  50. package/lib/shared/bundler/webpack/common/nameTemplates.js +18 -11
  51. package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +3 -2
  52. package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -0
  53. package/lib/shared/bundler/webpack/cssLoaders.js +2 -0
  54. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +20 -1
  55. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +25 -20
  56. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +9 -4
  57. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +23 -3
  58. package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +19 -8
  59. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +61 -37
  60. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +33 -15
  61. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +108 -60
  62. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +26 -20
  63. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +26 -5
  64. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +16 -13
  65. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +53 -19
  66. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +17 -2
  67. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +13 -0
  68. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +21 -11
  69. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +4 -0
  70. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +14 -4
  71. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +13 -3
  72. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +12 -3
  73. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +7 -2
  74. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +2 -0
  75. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +3 -2
  76. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +4 -2
  77. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +13 -8
  78. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +14 -2
  79. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +1 -0
  80. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +3 -1
  81. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +4 -0
  82. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +25 -5
  83. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +10 -3
  84. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +6 -1
  85. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +6 -1
  86. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +6 -0
  87. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +1 -0
  88. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +7 -0
  89. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +1 -0
  90. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +17 -13
  91. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +15 -6
  92. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +13 -4
  93. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +6 -4
  94. package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +10 -0
  95. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +3 -0
  96. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +20 -4
  97. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +12 -10
  98. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +3 -2
  99. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +20 -7
  100. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +1 -0
  101. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +10 -7
  102. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +6 -1
  103. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +16 -1
  104. package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +11 -4
  105. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +10 -3
  106. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +62 -27
  107. package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +15 -3
  108. package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +1 -0
  109. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +12 -2
  110. package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +7 -2
  111. package/lib/shared/bundler/webpack/defaultVendorPatternList.js +6 -2
  112. package/lib/shared/bundler/webpack/devtoolConfig.js +1 -0
  113. package/lib/shared/bundler/webpack/entryConfig.js +4 -0
  114. package/lib/shared/bundler/webpack/externals.js +1 -0
  115. package/lib/shared/bundler/webpack/getCSSLoaders.js +6 -1
  116. package/lib/shared/bundler/webpack/getFilenameFromModule.js +5 -1
  117. package/lib/shared/bundler/webpack/jsLoaders.js +10 -6
  118. package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +2 -0
  119. package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +3 -2
  120. package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +12 -3
  121. package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +1 -0
  122. package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +10 -2
  123. package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +2 -0
  124. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +12 -0
  125. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +15 -1
  126. package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +4 -1
  127. package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +16 -8
  128. package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +29 -22
  129. package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
  130. package/lib/shared/bundler/webpack/loaders/workerLoader.js +19 -8
  131. package/lib/shared/bundler/webpack/optimizationConfig.js +13 -5
  132. package/lib/shared/bundler/webpack/outputConfig.js +9 -1
  133. package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +9 -5
  134. package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +5 -0
  135. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +9 -4
  136. package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +8 -3
  137. package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +16 -1
  138. package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +4 -0
  139. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +16 -0
  140. package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +5 -0
  141. package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +5 -0
  142. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +8 -2
  143. package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +9 -5
  144. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +25 -19
  145. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +26 -12
  146. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +9 -3
  147. package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +2 -0
  148. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +7 -0
  149. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +7 -3
  150. package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +5 -1
  151. package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +4 -1
  152. package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +4 -0
  153. package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +8 -3
  154. package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +6 -1
  155. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +8 -3
  156. package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +4 -0
  157. package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +8 -1
  158. package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +6 -1
  159. package/lib/shared/bundler/webpack/plugins.js +24 -1
  160. package/lib/shared/bundler/webpack/resolvers.js +17 -3
  161. package/lib/shared/bundler/webpack/splitChunksConfig.js +15 -2
  162. package/lib/shared/bundler/webpack/statsConfig.js +5 -2
  163. package/lib/shared/bundler/webpack/tsLoaders.js +4 -2
  164. package/lib/shared/bundler/webpack/utils/index.js +12 -1
  165. package/lib/shared/bundler/webpack/utils/object-manipulation.js +16 -2
  166. package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +7 -0
  167. package/lib/shared/bundler/webpack/webpackBuild.js +8 -1
  168. package/lib/shared/bundler/webpack/webpackConfig.js +17 -0
  169. package/lib/shared/commands-utils/doBasicRequirementCheck.js +3 -0
  170. package/lib/shared/commands-utils/getCliPath.js +9 -5
  171. package/lib/shared/commands-utils/index.js +3 -0
  172. package/lib/shared/commands-utils/log.js +2 -0
  173. package/lib/shared/commands-utils/readArgsFormCommandLine.js +1 -0
  174. package/lib/shared/commands-utils/readOptionFormCommandLine.js +1 -0
  175. package/lib/shared/commands-utils/spawnSyncIO.js +13 -5
  176. package/lib/shared/constants.js +29 -9
  177. package/lib/shared/fileUtils/copyFile.js +8 -1
  178. package/lib/shared/fileUtils/directoryIterator.js +4 -0
  179. package/lib/shared/fileUtils/watchRun.js +24 -3
  180. package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +6 -1
  181. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +3 -2
  182. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +13 -6
  183. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +26 -6
  184. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +9 -6
  185. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +3 -0
  186. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +7 -2
  187. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +2 -0
  188. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +9 -4
  189. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +10 -0
  190. package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +29 -16
  191. package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +17 -0
  192. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +9 -4
  193. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +63 -27
  194. package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +13 -5
  195. package/lib/shared/postcss/getAllowedPostCssPlugins.js +3 -0
  196. package/lib/shared/postcss/getSpecificPostCssPlugin.js +17 -7
  197. package/lib/shared/postcss/runPostCssForCssFile.js +9 -1
  198. package/lib/shared/pre_process/runPreProcess.js +11 -0
  199. package/lib/shared/server/configWebpackDevMiddleware.js +8 -1
  200. package/lib/shared/server/corsHandling.js +6 -2
  201. package/lib/shared/server/getIp.js +7 -1
  202. package/lib/shared/server/getServerURL.js +6 -0
  203. package/lib/shared/server/httpsOptions.js +11 -0
  204. package/lib/shared/server/initExpressApp.js +4 -1
  205. package/lib/shared/server/initialHTMLHandling.js +16 -7
  206. package/lib/shared/server/mockApiHandler.js +16 -8
  207. package/lib/shared/server/mockServer.js +7 -0
  208. package/lib/shared/server/serveContextFiles.js +5 -1
  209. package/lib/shared/server/serverBywebpackDevMiddleware.js +9 -4
  210. package/lib/shared/server/startHttpServer.js +3 -0
  211. package/lib/shared/server/startHttpsServer.js +9 -1
  212. package/lib/shared/server/unwanted/addHttp2Server.js +7 -2
  213. package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +8 -1
  214. package/lib/shared/server/unwanted/mockApiSupport.js +2 -0
  215. package/lib/shared/server/unwanted/websocketMockSetup.js +7 -1
  216. package/lib/shared/server/urlConcat.js +8 -3
  217. package/lib/shared/utils/requireLocalOrGlobal.js +25 -10
  218. package/lib/shared/utils/versionPrint.js +6 -1
  219. package/npm-shrinkwrap.json +2 -2
  220. package/package.json +1 -1
@@ -5,39 +5,53 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.route = route;
7
7
  exports.runCommand = runCommand;
8
+
8
9
  var _fs = require("fs");
10
+
9
11
  var _path = require("path");
12
+
10
13
  var _allCommandsConfigs = _interopRequireDefault(require("./allCommandsConfigs"));
14
+
11
15
  var _logger = require("./logger");
16
+
12
17
  var _readOptions = require("./schemas/readOptions");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
14
21
  function runCommand(commandName, options) {
15
22
  // eslint-disable-next-line no-use-before-define
16
23
  const commandConfig = findCommandConfig(commandName);
24
+
17
25
  if (!commandConfig) {
18
26
  return;
19
27
  }
28
+
20
29
  const {
21
30
  dirname
22
31
  } = commandConfig;
32
+
23
33
  function runRespectiveFile(name, data) {
24
34
  const commandExecutorPath = (0, _path.join)(dirname, `${name}.js`);
35
+
25
36
  if ((0, _fs.existsSync)(commandExecutorPath)) {
26
37
  // eslint-disable-next-line import/no-dynamic-require, global-require
27
38
  const commandExecutor = require(commandExecutorPath);
39
+
28
40
  return (commandExecutor[name] || commandExecutor.default)(data);
29
41
  }
42
+
30
43
  (0, _logger.verboseLogger)('file not found', commandExecutorPath);
31
44
  return null;
32
45
  }
46
+
33
47
  const processedOption = runRespectiveFile('optionsProcessor', options) || options;
34
- runRespectiveFile('deprecationHandler', processedOption);
35
- // runRespectiveFile("errorHandler", () => {
48
+ runRespectiveFile('deprecationHandler', processedOption); // runRespectiveFile("errorHandler", () => {
49
+
36
50
  runRespectiveFile('preProcessor', processedOption);
37
51
  runRespectiveFile('commandExecutor', processedOption);
38
- runRespectiveFile('postProcessor', processedOption);
39
- // });
52
+ runRespectiveFile('postProcessor', processedOption); // });
40
53
  }
54
+
41
55
  function route(commandName) {
42
56
  try {
43
57
  const options = (0, _readOptions.getOptions)();
@@ -46,6 +60,7 @@ function route(commandName) {
46
60
  (0, _logger.errorLogger)(error);
47
61
  }
48
62
  }
63
+
49
64
  function findCommandConfig(option) {
50
65
  // eslint-disable-next-line no-restricted-syntax
51
66
  for (const commandConfig of _allCommandsConfigs.default) {
@@ -53,6 +68,7 @@ function findCommandConfig(option) {
53
68
  return commandConfig;
54
69
  }
55
70
  }
71
+
56
72
  (0, _logger.warnLogger)('Un known command', option, 'please check the document');
57
73
  return null;
58
74
  }
package/lib/index.js CHANGED
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.run = run;
7
+
7
8
  var _commandsRouter = require("./commandsRouter");
9
+
8
10
  function run(commandName, options) {
9
11
  return (0, _commandsRouter.runCommand)(commandName, options);
10
12
  }
package/lib/logger.js CHANGED
@@ -8,22 +8,27 @@ exports.errorLogger = errorLogger;
8
8
  exports.messageLogger = messageLogger;
9
9
  exports.verboseLogger = verboseLogger;
10
10
  exports.warnLogger = warnLogger;
11
+
11
12
  /* eslint-disable no-console */
12
13
  function verboseLogger(...args) {
13
14
  // TODO: need to be remove when publish happens
14
15
  process.env.VERBOSE === 'true' && console.log('\x1b[33m [verbose] \x1b[0m', ...args);
15
16
  }
17
+
16
18
  function warnLogger(...args) {
17
19
  console.warn(...args);
18
20
  }
21
+
19
22
  function messageLogger(...args) {
20
23
  console.log(...args);
21
24
  }
25
+
22
26
  function debugLogger(...args) {
23
27
  // TODO: need to be remove when publish happens
24
28
  console.trace();
25
29
  console.log(...args);
26
30
  }
31
+
27
32
  function errorLogger(...args) {
28
33
  console.error(...args);
29
34
  }
@@ -4,21 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.applyValuesToSchema = applyValuesToSchema;
7
+
7
8
  var _isObject = require("./isObject");
9
+
8
10
  var _isValid = require("./isValid");
11
+
9
12
  function applyValuesToSchema(schemas, customOptions, processEnv) {
10
13
  const output = {};
14
+
11
15
  function decideValue(schema, key, customOptions) {
12
16
  const specificSchema = schema[key];
13
17
  const correspondingValue = customOptions && customOptions[key];
18
+
14
19
  if ((0, _isObject.isObject)(specificSchema)) {
15
20
  if (typeof specificSchema.cli === 'string') {
16
21
  return processEnv[specificSchema.cli] ?? (0, _isValid.isValid)(correspondingValue, specificSchema.value);
17
22
  }
23
+
18
24
  return applyValuesToSchema(specificSchema, correspondingValue, processEnv);
19
25
  }
26
+
20
27
  return (0, _isValid.isValid)(correspondingValue, specificSchema);
21
28
  }
29
+
22
30
  Object.keys(schemas).forEach(key => {
23
31
  output[key] = decideValue(schemas, key, customOptions);
24
32
  });
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isObject = isObject;
7
+
7
8
  function isObject(obj) {
8
9
  return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
9
10
  }
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isValid = isValid;
7
+
7
8
  function isValid(correspondingValue, specificSchema) {
8
9
  if (typeof correspondingValue === 'number' && Number.isNaN(correspondingValue)) {
9
10
  return specificSchema;
10
11
  }
12
+
11
13
  return correspondingValue ?? specificSchema;
12
14
  }
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cliArgsToObject = cliArgsToObject;
7
+
7
8
  var _giveDefaultValue = require("./giveDefaultValue");
9
+
8
10
  /**
9
11
  * experimental argument parsing logic
10
12
  * @param {Array} cliArgs is when we use cli the options or args
@@ -19,14 +21,16 @@ function cliArgsToObject(cliArgs) {
19
21
  const processEnv = {};
20
22
  cliArgs.forEach(option => {
21
23
  if (/^--./.test(option)) {
22
- const equIndex = option.indexOf('=');
23
- // equIndex = equIndex === -1 ? option.length : equIndex;
24
+ const equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
25
+
24
26
  let key = option.slice(2, equIndex);
25
27
  let value = (0, _giveDefaultValue.giveDefaultValue)(option.slice(equIndex + 1));
28
+
26
29
  if (equIndex === -1) {
27
30
  key = option.slice(2);
28
31
  value = true;
29
32
  }
33
+
30
34
  key = key.replace(/-|:/g, '_');
31
35
  processEnv[key] = value;
32
36
  }
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _os = require("os");
9
+
8
10
  // NOTE: Don't use 'config_file' as cli option it was reserved
9
- var _default = exports.default = {
11
+ var _default = {
10
12
  context: {
11
13
  value: 'app',
12
14
  cli: 'context'
@@ -157,8 +159,8 @@ var _default = exports.default = {
157
159
  rtl: {
158
160
  enable: false,
159
161
  patterns: []
160
- }
161
- // postcss - plugins end
162
+ } // postcss - plugins end
163
+
162
164
  },
163
165
  customPlugins: ['...']
164
166
  },
@@ -195,6 +197,16 @@ var _default = exports.default = {
195
197
  generateManifest: false,
196
198
  manifestPath: null,
197
199
  // Custom manifest path
200
+ emitFiles: {
201
+ value: true,
202
+ cli: 'i18n_emit_files'
203
+ },
204
+ // Control i18n file emission
205
+ injectI18nUrlInIndex: {
206
+ value: true,
207
+ cli: 'i18n_inject_html'
208
+ },
209
+ // Control HTML injection
198
210
  loaderOptions: {
199
211
  includePaths: [],
200
212
  excludePaths: ['node_modules', 'tests']
@@ -376,4 +388,5 @@ var _default = exports.default = {
376
388
  enable: false,
377
389
  options: null
378
390
  }
379
- };
391
+ };
392
+ exports.default = _default;
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _os = require("os");
9
+
8
10
  // NOTE: Don't use 'config_file' as cli option it was reserved
9
- var _default = exports.default = {
11
+ var _default = {
10
12
  context: 'app',
11
13
  devtool: 'hidden-cheap-source-map',
12
14
  enableFileNameHashing: false,
@@ -80,8 +82,8 @@ var _default = exports.default = {
80
82
  rtl: {
81
83
  enable: false,
82
84
  patterns: []
83
- }
84
- // postcss - plugins end
85
+ } // postcss - plugins end
86
+
85
87
  },
86
88
  customPlugins: []
87
89
  },
@@ -94,6 +96,32 @@ var _default = exports.default = {
94
96
  jsResource: null,
95
97
  propertiesFolder: null
96
98
  },
99
+ i18nIndexing: {
100
+ enable: false,
101
+ outputFolder: 'i18n-chunk',
102
+ jsResourcePath: './deskapp/properties/JSResources.properties',
103
+ propertiesFolderPath: './deskapp/properties',
104
+ numericMapPath: './deskapp/properties/i18n-numeric-map.json',
105
+ numericFilenameTemplate: '[locale]/numeric.i18n.js',
106
+ dynamicFilenameTemplate: '[locale]/dynamic.i18n.js',
107
+ singleFileTemplate: '[locale].js',
108
+ jsonpFunc: 'window.loadI18nChunk',
109
+ htmlTemplateLabel: '{{--user-locale}}',
110
+ localeVarName: 'window.userLangCode',
111
+ singleFile: false,
112
+ includeContentHash: false,
113
+ generateManifest: false,
114
+ manifestPath: null,
115
+ emitFiles: true,
116
+ // Control i18n file emission
117
+ injectI18nUrlInIndex: true,
118
+ // Control HTML injection
119
+ loaderOptions: {
120
+ includePaths: [],
121
+ excludePaths: ['node_modules', 'tests']
122
+ },
123
+ customGroups: null
124
+ },
97
125
  publicFolders: {
98
126
  dev: ['...'],
99
127
  prod: ['...']
@@ -181,4 +209,5 @@ var _default = exports.default = {
181
209
  options: null,
182
210
  excludeKeys: null
183
211
  }
184
- };
212
+ };
213
+ exports.default = _default;
@@ -4,54 +4,63 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.deprecatedOptionsHandler = deprecatedOptionsHandler;
7
+
7
8
  var _logger = require("../logger");
9
+
8
10
  function nestedSelect(obj, key) {
9
11
  let temp = obj;
10
12
  const keys = key.split('.');
13
+
11
14
  for (let i = 0; i < keys.length && temp; i++) {
12
15
  const element = keys[i];
13
16
  temp = temp[element];
14
17
  }
18
+
15
19
  return temp;
16
20
  }
21
+
17
22
  function nestedUpdate(obj, key, value) {
18
23
  let temp = obj;
19
24
  const keys = key.split('.');
20
25
  let i = 0;
26
+
21
27
  for (; i < keys.length - 1 && temp; i++) {
22
28
  const element = keys[i];
23
29
  temp = temp[element];
24
30
  }
31
+
25
32
  if (temp) {
26
33
  temp[keys[i]] = value;
27
34
  }
28
35
  }
36
+
29
37
  function deprecatedOptionsHandler(options) {
30
38
  function checkAndUpdateAndPrintWaring(oldKey, newkey) {
31
39
  const oldVal = nestedSelect(options, oldKey);
32
- const newVal = nestedSelect(options, newkey);
33
-
34
- // console.log({ oldVal, newVal });
40
+ const newVal = nestedSelect(options, newkey); // console.log({ oldVal, newVal });
35
41
 
36
42
  if (oldVal !== undefined && newVal === undefined) {
37
43
  nestedUpdate(options, newkey, newVal);
38
44
  (0, _logger.warnLogger)(`"${oldKey}" deprecated use "${newkey}" instead`);
39
45
  }
40
- }
46
+ } // return;
41
47
 
42
- // return;
43
- checkAndUpdateAndPrintWaring('app.context', 'context');
44
- // TODO handle deprecations here
48
+
49
+ checkAndUpdateAndPrintWaring('app.context', 'context'); // TODO handle deprecations here
45
50
  // we will finish this logic later when options are confirmed
51
+
46
52
  if (nestedSelect(options, 'app.hasRTL') === true) {
47
53
  nestedUpdate(options, 'app.plugins.hasRTL', true);
48
54
  }
55
+
49
56
  if (nestedSelect(options, 'docs.hasRTL') === true) {
50
57
  nestedUpdate(options, 'docs.plugins.hasRTL', true);
51
58
  }
59
+
52
60
  if (nestedSelect(options, 'app.rtlExclude.length') > 0) {
53
61
  nestedUpdate(options, 'app.exclude.rtl', nestedSelect(options, 'app.rtlExclude'));
54
62
  }
63
+
55
64
  if (nestedSelect(options, 'docs.rtlExclude.length') > 0) {
56
65
  nestedUpdate(options, 'docs.exclude.rtl', nestedSelect(options, 'docs.rtlExclude'));
57
66
  }
@@ -4,14 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getNpmVersion = getNpmVersion;
7
+
7
8
  var _child_process = require("child_process");
9
+
8
10
  var _logger = require("../logger");
11
+
9
12
  function getNpmVersion() {
10
13
  let vers = '6';
14
+
11
15
  try {
12
16
  [vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
13
17
  } catch (error) {
14
18
  (0, _logger.messageLogger)(error);
15
19
  }
20
+
16
21
  return vers;
17
22
  }
@@ -4,12 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.giveDefaultValue = giveDefaultValue;
7
+
7
8
  function giveDefaultValue(value) {
8
9
  if (value === true || value === 'true') {
9
10
  return true;
10
11
  }
12
+
11
13
  if (value === false || value === 'false' || value === '') {
12
14
  return false;
13
15
  }
16
+
14
17
  return value;
15
18
  }
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.npmConfigToObject = npmConfigToObject;
7
+
7
8
  var _logger = require("../logger");
8
- const NPM_CONFIG_PREFIX = 'npm_config_';
9
- // TODO: we have to do option parse logic little better
9
+
10
+ const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
10
11
  // if user use react-cli strictly without using npm scripts options won't work,
11
12
  // So we have to write our own option parse logic or some other library
12
13
  // console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
@@ -23,9 +24,11 @@ function npmConfigToObject() {
23
24
  });
24
25
  keysWithColon.forEach(key => {
25
26
  const nKey = key.replace(/:/g, '_');
27
+
26
28
  if (processEnv[nKey]) {
27
29
  (0, _logger.warnLogger)('there is some options conflict', key, nKey);
28
30
  }
31
+
29
32
  processEnv[nKey] = processEnv[key];
30
33
  });
31
34
  return processEnv;
@@ -4,64 +4,84 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getOptions = exports.args = void 0;
7
+
7
8
  var _applyValuesToSchema = require("./applyValuesToSchema");
9
+
8
10
  var _cliArgsToObject = require("./cliArgsToObject");
11
+
9
12
  var _defaultConfigValues = _interopRequireDefault(require("./defaultConfigValues"));
13
+
10
14
  var _deprecatedOptionsHandler = require("./deprecatedOptionsHandler");
15
+
11
16
  var _getNpmVersion = require("./getNpmVersion");
17
+
12
18
  var _npmConfigToObject = require("./npmConfigToObject");
19
+
13
20
  var _readOptionsForConfigFile = require("./readOptionsForConfigFile");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- const args = exports.args = process.argv.slice(2);
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ const args = process.argv.slice(2);
25
+ exports.args = args;
16
26
  const processEnv = (0, _npmConfigToObject.npmConfigToObject)();
17
27
  const cliArgsObject = (0, _cliArgsToObject.cliArgsToObject)(args);
28
+
18
29
  if (cliArgsObject.app_domain && cliArgsObject.app_domain == 'kubernetes') {
19
30
  cliArgsObject.k8s = true;
20
31
  }
32
+
21
33
  if (cliArgsObject.app_domain) {
22
34
  cliArgsObject.domain = cliArgsObject.app_domain;
23
35
  }
36
+
24
37
  if (cliArgsObject.app_port) {
25
38
  cliArgsObject.port = cliArgsObject.app_port;
26
39
  }
40
+
27
41
  if (cliArgsObject.app_host) {
28
42
  cliArgsObject.host = cliArgsObject.app_host;
29
43
  }
44
+
30
45
  if (processEnv.app_domain && processEnv.app_domain == 'kubernetes') {
31
46
  cliArgsObject.k8s = true;
32
47
  }
48
+
33
49
  if (processEnv.app_domain) {
34
50
  cliArgsObject.domain = processEnv.app_domain;
35
51
  }
52
+
36
53
  if (processEnv.app_port) {
37
54
  cliArgsObject.port = processEnv.app_port;
38
55
  }
56
+
39
57
  if (processEnv.app_host) {
40
58
  cliArgsObject.host = processEnv.app_host;
41
59
  }
60
+
42
61
  Object.assign(processEnv, cliArgsObject);
43
62
  let reactCLIOptions = null;
63
+
44
64
  const getOptions = () => {
45
65
  if (reactCLIOptions) {
46
66
  return reactCLIOptions;
47
67
  }
68
+
48
69
  const appPath = process.cwd();
49
- const userSchemas = (0, _readOptionsForConfigFile.readOptionsForPackageJson)(appPath);
50
- // NOTE: Only config File option will with cli option config_file
70
+ const userSchemas = (0, _readOptionsForConfigFile.readOptionsForPackageJson)(appPath); // NOTE: Only config File option will with cli option config_file
71
+
51
72
  const configFileSchemas = (0, _readOptionsForConfigFile.readOptionsForConfigFile)(appPath, cliArgsObject.config_file || 'cbt.config.js');
52
73
  const options = (0, _applyValuesToSchema.applyValuesToSchema)(_defaultConfigValues.default, configFileSchemas || userSchemas || {}, processEnv);
53
- (0, _deprecatedOptionsHandler.deprecatedOptionsHandler)(options);
74
+ (0, _deprecatedOptionsHandler.deprecatedOptionsHandler)(options); // for future may be for npm 8 edge cases
54
75
 
55
- // for future may be for npm 8 edge cases
56
76
  options.npmVersion = (0, _getNpmVersion.getNpmVersion)();
57
77
  options.cwd = appPath;
58
78
  options.packageVersion = process.env.npm_package_version;
59
- options.extraArgs = process.argv.slice(3);
60
- // eslint-disable-next-line prefer-destructuring
79
+ options.extraArgs = process.argv.slice(3); // eslint-disable-next-line prefer-destructuring
80
+
61
81
  options.commandOption = process.argv[2];
62
- reactCLIOptions = options;
82
+ reactCLIOptions = options; // console.log({ options });
63
83
 
64
- // console.log({ options });
65
84
  return options;
66
85
  };
86
+
67
87
  exports.getOptions = getOptions;
@@ -5,28 +5,38 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.readOptionsForConfigFile = readOptionsForConfigFile;
7
7
  exports.readOptionsForPackageJson = readOptionsForPackageJson;
8
+
8
9
  var _fs = require("fs");
10
+
9
11
  var _path = _interopRequireDefault(require("path"));
12
+
10
13
  var _constants = require("../shared/constants");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- // import { CONFIG_ROOT } from "../constants";
13
14
 
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ // import { CONFIG_ROOT } from "../constants";
14
18
  function readOptionsForPackageJson(appPath) {
15
19
  const packagePath = _path.default.join(appPath, 'package.json');
20
+
16
21
  if ((0, _fs.existsSync)(packagePath)) {
17
22
  // eslint-disable-next-line import/no-dynamic-require, global-require
18
23
  return require(packagePath)[_constants.BASE_CONFIG_KEY] || {};
19
24
  }
25
+
20
26
  return {};
21
27
  }
28
+
22
29
  function readOptionsForConfigFile(appPath, configFile) {
23
30
  if (!configFile) {
24
31
  return null;
25
32
  }
33
+
26
34
  const packagePath = _path.default.join(appPath, configFile);
35
+
27
36
  if ((0, _fs.existsSync)(packagePath)) {
28
37
  // eslint-disable-next-line import/no-dynamic-require, global-require
29
38
  return require(packagePath).config;
30
39
  }
40
+
31
41
  return null;
32
42
  }
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addDefaultPlugins = addDefaultPlugins;
7
+
7
8
  function addDefaultPlugins(plugin, pluginName) {
8
9
  if (plugin.enable) {
9
10
  return [require.resolve(pluginName), plugin.options];
10
11
  }
12
+
11
13
  ;
12
14
  return null;
13
15
  }
@@ -4,15 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.babelWebConfig = babelWebConfig;
7
+
7
8
  var _helperCompilationTargets = _interopRequireDefault(require("@babel/helper-compilation-targets"));
9
+
8
10
  var _logger = require("../../logger");
11
+
9
12
  var _getBabelPlugin = require("./getBabelPlugin");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
11
16
  /* eslint-disable no-use-before-define */
12
17
  const supportedBrowserVersions = ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions'];
18
+
13
19
  function customBabelPlugins(babelPlugins) {
14
20
  return babelPlugins.map(p => p).filter(Boolean);
15
21
  }
22
+
16
23
  function babelWebConfig(options, mode) {
17
24
  const {
18
25
  plugins: babelPlugins,
@@ -26,10 +33,12 @@ function babelWebConfig(options, mode) {
26
33
  plugins: customBabelPlugins(babelPlugins).concat((0, _getBabelPlugin.getBabelPlugin)(options)).filter(Boolean)
27
34
  };
28
35
  }
36
+
29
37
  function getBabelPresetEnvConfig(browserList, mode) {
30
38
  if (mode === 'lib') {
31
39
  return require.resolve('@babel/preset-env');
32
40
  }
41
+
33
42
  const browsers = browserList || supportedBrowserVersions;
34
43
  (0, _logger.verboseLogger)('getTargets', (0, _helperCompilationTargets.default)({
35
44
  browsers
@@ -4,16 +4,20 @@ module.exports = () => ({
4
4
  visitor: {
5
5
  Program(path, state) {
6
6
  let properties = state.opts.properties || [];
7
+
7
8
  if (properties.length === 0) {
8
9
  properties = properties.concat(state.opts.attributeNames);
9
10
  }
11
+
10
12
  path.traverse({
11
13
  JSXIdentifier(path2) {
12
14
  if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
13
15
  path2.parentPath.remove();
14
16
  }
15
17
  }
18
+
16
19
  });
17
20
  }
21
+
18
22
  }
19
23
  });