@zohodesk/client_build_tool 0.0.11-exp.15.4 → 0.0.11-exp.16.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 (224) hide show
  1. package/README.md +102 -0
  2. package/README_backup.md +100 -0
  3. package/docs/DYNAMIC_TEMPLATE_EXAMPLE.md +129 -0
  4. package/docs/I18N_SINGLE_FILE_MODE.md +126 -0
  5. package/example-single-file-config.js +59 -0
  6. package/lib/allCommandsConfigs.js +2 -7
  7. package/lib/commands/build/commandExecutor.js +1 -5
  8. package/lib/commands/build/config.js +2 -3
  9. package/lib/commands/build/optionsProcessor.js +2 -5
  10. package/lib/commands/build/preProcessor.js +0 -2
  11. package/lib/commands/buildEs/commandExecutor.js +0 -5
  12. package/lib/commands/buildEs/config.js +2 -3
  13. package/lib/commands/buildEs/preProcessor.js +0 -2
  14. package/lib/commands/buildLib/commandExecutor.js +0 -5
  15. package/lib/commands/buildLib/config.js +2 -3
  16. package/lib/commands/buildLib/preProcessor.js +0 -2
  17. package/lib/commands/mockserver/commandExecutor.js +2 -9
  18. package/lib/commands/mockserver/config.js +2 -3
  19. package/lib/commands/pre_process/commandExecutor.js +0 -2
  20. package/lib/commands/pre_process/config.js +2 -3
  21. package/lib/commands/start/commandExecutor.js +0 -2
  22. package/lib/commands/start/config.js +2 -3
  23. package/lib/commands/start/optionsProcessor.js +2 -4
  24. package/lib/commands/start/preProcessor.js +0 -2
  25. package/lib/commands/template/commandExecutor.js +0 -7
  26. package/lib/commands/template/config.js +2 -3
  27. package/lib/commands/version/commandExecutor.js +0 -3
  28. package/lib/commands/version/config.js +2 -3
  29. package/lib/commandsRouter.js +5 -21
  30. package/lib/index.js +0 -2
  31. package/lib/logger.js +0 -5
  32. package/lib/schemas/applyValuesToSchema/index.js +0 -8
  33. package/lib/schemas/applyValuesToSchema/isObject.js +0 -1
  34. package/lib/schemas/applyValuesToSchema/isValid.js +0 -2
  35. package/lib/schemas/cliArgsToObject.js +2 -6
  36. package/lib/schemas/defaultConfigValues.js +21 -12
  37. package/lib/schemas/defaultConfigValuesOnly.js +4 -7
  38. package/lib/schemas/deprecatedOptionsHandler.js +7 -16
  39. package/lib/schemas/getNpmVersion.js +0 -5
  40. package/lib/schemas/giveDefaultValue.js +0 -3
  41. package/lib/schemas/npmConfigToObject.js +2 -5
  42. package/lib/schemas/readOptions.js +10 -30
  43. package/lib/schemas/readOptionsForConfigFile.js +2 -12
  44. package/lib/shared/babel/addDefaultPlugins.js +0 -2
  45. package/lib/shared/babel/babelWebConfig.js +1 -10
  46. package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -4
  47. package/lib/shared/babel/getBabelPlugin.js +2 -7
  48. package/lib/shared/babel/runBabelForJSFile.js +1 -4
  49. package/lib/shared/babel/runBabelForTsFile.js +1 -5
  50. package/lib/shared/bundler/webpack/common/decidePublicPath.js +0 -5
  51. package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
  52. package/lib/shared/bundler/webpack/common/modeUtils.js +0 -5
  53. package/lib/shared/bundler/webpack/common/nameTemplates.js +11 -18
  54. package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +2 -3
  55. package/lib/shared/bundler/webpack/configCustomLoaders.js +0 -1
  56. package/lib/shared/bundler/webpack/cssLoaders.js +0 -2
  57. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +1 -20
  58. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +20 -25
  59. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +4 -9
  60. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +3 -23
  61. package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +8 -19
  62. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +2 -6
  63. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +81 -0
  64. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +135 -60
  65. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +20 -26
  66. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +5 -26
  67. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +13 -16
  68. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +19 -53
  69. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +2 -17
  70. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -13
  71. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +11 -21
  72. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -4
  73. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +4 -14
  74. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +3 -13
  75. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +3 -12
  76. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +2 -7
  77. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -2
  78. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +2 -3
  79. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +2 -4
  80. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +8 -13
  81. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -14
  82. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -1
  83. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +1 -3
  84. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -4
  85. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +5 -25
  86. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +3 -10
  87. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +1 -6
  88. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +1 -6
  89. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -6
  90. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -1
  91. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -7
  92. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -1
  93. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +13 -17
  94. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +6 -15
  95. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +4 -13
  96. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +4 -6
  97. package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -10
  98. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -3
  99. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +4 -20
  100. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +10 -12
  101. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +2 -3
  102. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +7 -20
  103. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -1
  104. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +7 -10
  105. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +1 -6
  106. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +1 -16
  107. package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +4 -11
  108. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +3 -10
  109. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +27 -62
  110. package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +3 -15
  111. package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -1
  112. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +2 -12
  113. package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +2 -7
  114. package/lib/shared/bundler/webpack/defaultVendorPatternList.js +2 -6
  115. package/lib/shared/bundler/webpack/devtoolConfig.js +0 -1
  116. package/lib/shared/bundler/webpack/entryConfig.js +0 -4
  117. package/lib/shared/bundler/webpack/externals.js +0 -1
  118. package/lib/shared/bundler/webpack/getCSSLoaders.js +1 -6
  119. package/lib/shared/bundler/webpack/getFilenameFromModule.js +1 -5
  120. package/lib/shared/bundler/webpack/jsLoaders.js +6 -10
  121. package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -2
  122. package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +2 -3
  123. package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +3 -12
  124. package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -1
  125. package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +2 -10
  126. package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -2
  127. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -12
  128. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +1 -15
  129. package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +1 -4
  130. package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +8 -16
  131. package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +22 -29
  132. package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
  133. package/lib/shared/bundler/webpack/loaders/workerLoader.js +8 -19
  134. package/lib/shared/bundler/webpack/optimizationConfig.js +5 -13
  135. package/lib/shared/bundler/webpack/outputConfig.js +1 -9
  136. package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +5 -9
  137. package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -5
  138. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +4 -9
  139. package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +3 -8
  140. package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +1 -16
  141. package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -4
  142. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -16
  143. package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -5
  144. package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -5
  145. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +2 -8
  146. package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +5 -9
  147. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +19 -25
  148. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +92 -0
  149. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +3 -9
  150. package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -2
  151. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -7
  152. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +3 -7
  153. package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +1 -5
  154. package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +1 -4
  155. package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -4
  156. package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +3 -8
  157. package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +1 -6
  158. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +3 -8
  159. package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -4
  160. package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +1 -8
  161. package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +1 -6
  162. package/lib/shared/bundler/webpack/plugins.js +3 -30
  163. package/lib/shared/bundler/webpack/resolvers.js +3 -17
  164. package/lib/shared/bundler/webpack/splitChunksConfig.js +2 -15
  165. package/lib/shared/bundler/webpack/statsConfig.js +2 -5
  166. package/lib/shared/bundler/webpack/tsLoaders.js +2 -4
  167. package/lib/shared/bundler/webpack/utils/index.js +1 -12
  168. package/lib/shared/bundler/webpack/utils/object-manipulation.js +2 -16
  169. package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -7
  170. package/lib/shared/bundler/webpack/webpackBuild.js +1 -8
  171. package/lib/shared/bundler/webpack/webpackConfig.js +0 -17
  172. package/lib/shared/commands-utils/doBasicRequirementCheck.js +0 -3
  173. package/lib/shared/commands-utils/getCliPath.js +5 -9
  174. package/lib/shared/commands-utils/index.js +0 -3
  175. package/lib/shared/commands-utils/log.js +0 -2
  176. package/lib/shared/commands-utils/readArgsFormCommandLine.js +0 -1
  177. package/lib/shared/commands-utils/readOptionFormCommandLine.js +0 -1
  178. package/lib/shared/commands-utils/spawnSyncIO.js +5 -13
  179. package/lib/shared/constants.js +9 -29
  180. package/lib/shared/fileUtils/copyFile.js +1 -8
  181. package/lib/shared/fileUtils/directoryIterator.js +0 -4
  182. package/lib/shared/fileUtils/watchRun.js +3 -24
  183. package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +1 -6
  184. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +2 -3
  185. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +6 -13
  186. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +6 -26
  187. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +6 -9
  188. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -3
  189. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +2 -7
  190. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -2
  191. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +4 -9
  192. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -10
  193. package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +16 -29
  194. package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -17
  195. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +4 -9
  196. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +27 -63
  197. package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +5 -13
  198. package/lib/shared/postcss/getAllowedPostCssPlugins.js +0 -3
  199. package/lib/shared/postcss/getSpecificPostCssPlugin.js +7 -17
  200. package/lib/shared/postcss/runPostCssForCssFile.js +1 -9
  201. package/lib/shared/pre_process/runPreProcess.js +0 -11
  202. package/lib/shared/server/configWebpackDevMiddleware.js +1 -8
  203. package/lib/shared/server/corsHandling.js +2 -6
  204. package/lib/shared/server/getIp.js +1 -7
  205. package/lib/shared/server/getServerURL.js +0 -6
  206. package/lib/shared/server/httpsOptions.js +0 -11
  207. package/lib/shared/server/initExpressApp.js +1 -4
  208. package/lib/shared/server/initialHTMLHandling.js +7 -16
  209. package/lib/shared/server/mockApiHandler.js +8 -16
  210. package/lib/shared/server/mockServer.js +0 -7
  211. package/lib/shared/server/serveContextFiles.js +1 -5
  212. package/lib/shared/server/serverBywebpackDevMiddleware.js +4 -9
  213. package/lib/shared/server/startHttpServer.js +0 -3
  214. package/lib/shared/server/startHttpsServer.js +1 -9
  215. package/lib/shared/server/unwanted/addHttp2Server.js +2 -7
  216. package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +1 -8
  217. package/lib/shared/server/unwanted/mockApiSupport.js +0 -2
  218. package/lib/shared/server/unwanted/websocketMockSetup.js +1 -7
  219. package/lib/shared/server/urlConcat.js +3 -8
  220. package/lib/shared/utils/requireLocalOrGlobal.js +10 -25
  221. package/lib/shared/utils/versionPrint.js +1 -6
  222. package/npm-shrinkwrap.json +2 -2
  223. package/package.json +1 -1
  224. package/packages/client_build_tool/test-i18n-config.js +22 -0
@@ -4,84 +4,64 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getOptions = exports.args = void 0;
7
-
8
7
  var _applyValuesToSchema = require("./applyValuesToSchema");
9
-
10
8
  var _cliArgsToObject = require("./cliArgsToObject");
11
-
12
9
  var _defaultConfigValues = _interopRequireDefault(require("./defaultConfigValues"));
13
-
14
10
  var _deprecatedOptionsHandler = require("./deprecatedOptionsHandler");
15
-
16
11
  var _getNpmVersion = require("./getNpmVersion");
17
-
18
12
  var _npmConfigToObject = require("./npmConfigToObject");
19
-
20
13
  var _readOptionsForConfigFile = require("./readOptionsForConfigFile");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- const args = process.argv.slice(2);
25
- exports.args = args;
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const args = exports.args = process.argv.slice(2);
26
16
  const processEnv = (0, _npmConfigToObject.npmConfigToObject)();
27
17
  const cliArgsObject = (0, _cliArgsToObject.cliArgsToObject)(args);
28
-
29
18
  if (cliArgsObject.app_domain && cliArgsObject.app_domain == 'kubernetes') {
30
19
  cliArgsObject.k8s = true;
31
20
  }
32
-
33
21
  if (cliArgsObject.app_domain) {
34
22
  cliArgsObject.domain = cliArgsObject.app_domain;
35
23
  }
36
-
37
24
  if (cliArgsObject.app_port) {
38
25
  cliArgsObject.port = cliArgsObject.app_port;
39
26
  }
40
-
41
27
  if (cliArgsObject.app_host) {
42
28
  cliArgsObject.host = cliArgsObject.app_host;
43
29
  }
44
-
45
30
  if (processEnv.app_domain && processEnv.app_domain == 'kubernetes') {
46
31
  cliArgsObject.k8s = true;
47
32
  }
48
-
49
33
  if (processEnv.app_domain) {
50
34
  cliArgsObject.domain = processEnv.app_domain;
51
35
  }
52
-
53
36
  if (processEnv.app_port) {
54
37
  cliArgsObject.port = processEnv.app_port;
55
38
  }
56
-
57
39
  if (processEnv.app_host) {
58
40
  cliArgsObject.host = processEnv.app_host;
59
41
  }
60
-
61
42
  Object.assign(processEnv, cliArgsObject);
62
43
  let reactCLIOptions = null;
63
-
64
44
  const getOptions = () => {
65
45
  if (reactCLIOptions) {
66
46
  return reactCLIOptions;
67
47
  }
68
-
69
48
  const appPath = process.cwd();
70
- const userSchemas = (0, _readOptionsForConfigFile.readOptionsForPackageJson)(appPath); // NOTE: Only config File option will with cli option config_file
71
-
49
+ const userSchemas = (0, _readOptionsForConfigFile.readOptionsForPackageJson)(appPath);
50
+ // NOTE: Only config File option will with cli option config_file
72
51
  const configFileSchemas = (0, _readOptionsForConfigFile.readOptionsForConfigFile)(appPath, cliArgsObject.config_file || 'cbt.config.js');
73
52
  const options = (0, _applyValuesToSchema.applyValuesToSchema)(_defaultConfigValues.default, configFileSchemas || userSchemas || {}, processEnv);
74
- (0, _deprecatedOptionsHandler.deprecatedOptionsHandler)(options); // for future may be for npm 8 edge cases
53
+ (0, _deprecatedOptionsHandler.deprecatedOptionsHandler)(options);
75
54
 
55
+ // for future may be for npm 8 edge cases
76
56
  options.npmVersion = (0, _getNpmVersion.getNpmVersion)();
77
57
  options.cwd = appPath;
78
58
  options.packageVersion = process.env.npm_package_version;
79
- options.extraArgs = process.argv.slice(3); // eslint-disable-next-line prefer-destructuring
80
-
59
+ options.extraArgs = process.argv.slice(3);
60
+ // eslint-disable-next-line prefer-destructuring
81
61
  options.commandOption = process.argv[2];
82
- reactCLIOptions = options; // console.log({ options });
62
+ reactCLIOptions = options;
83
63
 
64
+ // console.log({ options });
84
65
  return options;
85
66
  };
86
-
87
67
  exports.getOptions = getOptions;
@@ -5,38 +5,28 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.readOptionsForConfigFile = readOptionsForConfigFile;
7
7
  exports.readOptionsForPackageJson = readOptionsForPackageJson;
8
-
9
8
  var _fs = require("fs");
10
-
11
9
  var _path = _interopRequireDefault(require("path"));
12
-
13
10
  var _constants = require("../shared/constants");
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
12
  // import { CONFIG_ROOT } from "../constants";
13
+
18
14
  function readOptionsForPackageJson(appPath) {
19
15
  const packagePath = _path.default.join(appPath, 'package.json');
20
-
21
16
  if ((0, _fs.existsSync)(packagePath)) {
22
17
  // eslint-disable-next-line import/no-dynamic-require, global-require
23
18
  return require(packagePath)[_constants.BASE_CONFIG_KEY] || {};
24
19
  }
25
-
26
20
  return {};
27
21
  }
28
-
29
22
  function readOptionsForConfigFile(appPath, configFile) {
30
23
  if (!configFile) {
31
24
  return null;
32
25
  }
33
-
34
26
  const packagePath = _path.default.join(appPath, configFile);
35
-
36
27
  if ((0, _fs.existsSync)(packagePath)) {
37
28
  // eslint-disable-next-line import/no-dynamic-require, global-require
38
29
  return require(packagePath).config;
39
30
  }
40
-
41
31
  return null;
42
32
  }
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addDefaultPlugins = addDefaultPlugins;
7
-
8
7
  function addDefaultPlugins(plugin, pluginName) {
9
8
  if (plugin.enable) {
10
9
  return [require.resolve(pluginName), plugin.options];
11
10
  }
12
-
13
11
  ;
14
12
  return null;
15
13
  }
@@ -4,22 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.babelWebConfig = babelWebConfig;
7
-
8
7
  var _helperCompilationTargets = _interopRequireDefault(require("@babel/helper-compilation-targets"));
9
-
10
8
  var _logger = require("../../logger");
11
-
12
9
  var _getBabelPlugin = require("./getBabelPlugin");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
11
  /* eslint-disable no-use-before-define */
17
12
  const supportedBrowserVersions = ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions'];
18
-
19
13
  function customBabelPlugins(babelPlugins) {
20
14
  return babelPlugins.map(p => p).filter(Boolean);
21
15
  }
22
-
23
16
  function babelWebConfig(options, mode) {
24
17
  const {
25
18
  plugins: babelPlugins,
@@ -33,12 +26,10 @@ function babelWebConfig(options, mode) {
33
26
  plugins: customBabelPlugins(babelPlugins).concat((0, _getBabelPlugin.getBabelPlugin)(options)).filter(Boolean)
34
27
  };
35
28
  }
36
-
37
29
  function getBabelPresetEnvConfig(browserList, mode) {
38
30
  if (mode === 'lib') {
39
31
  return require.resolve('@babel/preset-env');
40
32
  }
41
-
42
33
  const browsers = browserList || supportedBrowserVersions;
43
34
  (0, _logger.verboseLogger)('getTargets', (0, _helperCompilationTargets.default)({
44
35
  browsers
@@ -4,20 +4,16 @@ module.exports = () => ({
4
4
  visitor: {
5
5
  Program(path, state) {
6
6
  let properties = state.opts.properties || [];
7
-
8
7
  if (properties.length === 0) {
9
8
  properties = properties.concat(state.opts.attributeNames);
10
9
  }
11
-
12
10
  path.traverse({
13
11
  JSXIdentifier(path2) {
14
12
  if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
15
13
  path2.parentPath.remove();
16
14
  }
17
15
  }
18
-
19
16
  });
20
17
  }
21
-
22
18
  }
23
19
  });
@@ -4,33 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getBabelPlugin = getBabelPlugin;
7
-
8
7
  var _modeUtils = require("../bundler/webpack/common/modeUtils");
9
-
10
8
  var _addDefaultPlugins = require("./addDefaultPlugins");
11
-
12
9
  const babelPluginMapping = {
13
10
  removeAttribute: './babel_plugins/removeAttributesPlugin',
14
11
  removePropTypes: 'babel-plugin-transform-react-remove-prop-types',
15
12
  devConsoleExclude: 'babel-plugin-transform-remove-console'
16
13
  };
17
14
  const babelPluginOrder = ['removeAttribute', 'removePropTypes', 'devConsoleExclude'];
18
-
19
15
  function getBabelPlugin(options) {
20
16
  const {
21
17
  mode
22
- } = options; // let customPlugins = [];
18
+ } = options;
23
19
 
20
+ // let customPlugins = [];
24
21
  let customPlugins = [];
25
22
  const {
26
23
  babelCustomizations
27
24
  } = options;
28
-
29
25
  if ((0, _modeUtils.isProductionMode)(mode)) {
30
26
  const configCreator = _addDefaultPlugins.addDefaultPlugins;
31
27
  const plugins = babelPluginOrder.map(p => configCreator(babelCustomizations[p], babelPluginMapping[p]));
32
28
  customPlugins = plugins;
33
29
  }
34
-
35
30
  return customPlugins.filter(Boolean);
36
31
  }
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.runBabelForJSFile = runBabelForJSFile;
7
-
8
7
  var _core = require("@babel/core");
9
-
10
8
  var _babelWebConfig = require("./babelWebConfig");
11
-
12
9
  var _copyFile = require("../fileUtils/copyFile");
13
-
14
10
  function runBabelForJSFile({
15
11
  filename,
16
12
  outputFile,
@@ -18,6 +14,7 @@ function runBabelForJSFile({
18
14
  mode = 'es'
19
15
  }) {
20
16
  // const jsSourceCode = readFileSync(filename).toString();
17
+
21
18
  const babelConfig = (0, _babelWebConfig.babelWebConfig)(options, mode);
22
19
  const result = (0, _core.transformFileSync)(filename, babelConfig);
23
20
  (0, _copyFile.writeFile)(outputFile, result.code);
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.runBabelForTSFile = runBabelForTSFile;
7
-
8
7
  var _core = require("@babel/core");
9
-
10
8
  var _babelWebConfig = require("./babelWebConfig");
11
-
12
9
  var _copyFile = require("../fileUtils/copyFile");
13
-
14
10
  function runBabelForTSFile({
15
11
  filename,
16
12
  outputFile,
@@ -20,9 +16,9 @@ function runBabelForTSFile({
20
16
  const {
21
17
  enable
22
18
  } = options.typeScript;
23
-
24
19
  if (enable) {
25
20
  // const jsSourceCode = readFileSync(filename).toString();
21
+
26
22
  const babelConfig = (0, _babelWebConfig.babelWebConfig)(options, mode);
27
23
  const result = (0, _core.transformFileSync)(filename, babelConfig);
28
24
  (0, _copyFile.writeFile)(outputFile.replace('.tsx', '.js').replace('.ts', '.js'), result.code);
@@ -5,17 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.decidePublicPath = decidePublicPath;
7
7
  exports.modifiedServerOptions = modifiedServerOptions;
8
-
9
8
  var _getServerURL = require("../../../server/getServerURL");
10
-
11
9
  var _httpsOptions = require("../../../server/httpsOptions");
12
-
13
10
  var _urlConcat = require("../../../server/urlConcat");
14
-
15
11
  function decidePublicPath(serverExtras) {
16
12
  return serverExtras.isHttps ? serverExtras.httpsUrl : serverExtras.httpUrl;
17
13
  }
18
-
19
14
  function modifiedServerOptions(options) {
20
15
  const {
21
16
  server,
@@ -9,7 +9,8 @@ exports.libAlias = void 0;
9
9
  // FIXME: But there is a posiblity when these package does not have lib,
10
10
  // app will work because of alias, But may be jest won't work because of not alais
11
11
  // So need to think about use alais in jest
12
- const libAlias = {
12
+
13
+ const libAlias = exports.libAlias = {
13
14
  '@zohodesk/components/lib': '@zohodesk/components/es',
14
15
  // '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
15
16
  '@zohodesk/dot/lib': '@zohodesk/dot/es',
@@ -27,5 +28,4 @@ const libAlias = {
27
28
  '@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
28
29
  '@zohodesk/variables/lib': '@zohodesk/variables/es',
29
30
  '@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
30
- };
31
- exports.libAlias = libAlias;
31
+ };
@@ -8,29 +8,24 @@ exports.getWebpackMode = getWebpackMode;
8
8
  exports.isDevelopmentMode = isDevelopmentMode;
9
9
  exports.isNotProduction = isNotProduction;
10
10
  exports.isProductionMode = isProductionMode;
11
-
12
11
  function isProductionMode(mode) {
13
12
  return mode === 'prod' || mode === 'production';
14
13
  }
15
-
16
14
  function isDevelopmentMode(mode) {
17
15
  return mode === 'dev' || mode === 'development';
18
16
  }
19
-
20
17
  function getWebpackMode(options) {
21
18
  const {
22
19
  mode
23
20
  } = options;
24
21
  return isProductionMode(mode) ? 'production' : 'development';
25
22
  }
26
-
27
23
  function getGlobalCacheStorageName(options) {
28
24
  const {
29
25
  context
30
26
  } = options;
31
27
  return `${context}Jsonp`;
32
28
  }
33
-
34
29
  function isNotProduction(options) {
35
30
  const {
36
31
  mode
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isI18nFile = void 0;
7
7
  exports.nameTemplates = nameTemplates;
8
-
9
8
  var _modeUtils = require("./modeUtils");
10
-
11
9
  // nameTemplate.js
12
10
  // NOTE: these below code can be done in js,
11
+
13
12
  // we did copy paste in order to avoid unnecessary confusion
14
13
  // NOTE: array[0] is dev mode file templates and array[1] is prod mode file templates
14
+
15
15
  const defaultTemplates = {
16
16
  html: ['index.html', 'index.[contenthash].html'],
17
17
  js: ['js/[name].js', 'js/[name].[contenthash]_.js'],
18
18
  chunkjs: ['js-chunk/[name].js', 'js-chunks/[name].[contenthash]_.js'],
19
19
  i18njs: ['i18n-chunk/[locale]/[name].i18n.js', 'i18n-chunk/[locale]/[name].[chunkhash:20]_.i18n.js'],
20
- i18nchunkjs: ['i18n-chunk/[locale]/[name].i18n.js', // 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js'
20
+ i18nchunkjs: ['i18n-chunk/[locale]/[name].i18n.js',
21
+ // 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js'
21
22
  'i18n-chunk/[locale]/[name].[contenthash]_.i18n.js'],
22
23
  i18nmanifest: ['i18n-manifest.json', 'i18n-manifest.json'],
23
24
  workerjs: ['js/[name].js', 'js/[name].[contenthash].js'],
24
25
  css: ['css/[name].css', 'css/[name].[contenthash]_.css'],
25
-
26
26
  /**
27
27
  * NOTE: when you change (cssdir) this line it will have affect on Below files will be affected
28
28
  * custom_plugins/RtlSplitPlugin/*
@@ -36,12 +36,10 @@ const defaultTemplates = {
36
36
  audio: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
37
37
  video: ['videos/[name][ext]', 'videos/[name].[contenthash][ext]']
38
38
  };
39
-
40
39
  function createNameTemplate(name, useHash) {
41
40
  // const ext = `${useHash ? '.[hash:20]' : ''}[ext]`;
42
41
  return useHash ? name[1] : name[0];
43
42
  }
44
-
45
43
  const defaultDevModeContentHashAllowedTypes = {
46
44
  image: true,
47
45
  font: true,
@@ -49,7 +47,6 @@ const defaultDevModeContentHashAllowedTypes = {
49
47
  audio: true,
50
48
  video: true
51
49
  };
52
-
53
50
  function nameTemplates(type, options) {
54
51
  const {
55
52
  enableFileNameHashing,
@@ -61,16 +58,15 @@ function nameTemplates(type, options) {
61
58
  devModeContentHashAllowedTypes
62
59
  } = options;
63
60
  devModeContentHashAllowedTypes = devModeContentHashAllowedTypes || defaultDevModeContentHashAllowedTypes;
64
- const templates = { ...defaultTemplates,
61
+ const templates = {
62
+ ...defaultTemplates,
65
63
  ...nameTemplateCustomization
66
64
  };
67
65
  const templateName = templates[type];
68
-
69
66
  if (!templateName) {
70
67
  throw Error(`specified type not valid Type: ${type}`);
71
- } // eslint-disable-next-line no-use-before-define
72
-
73
-
68
+ }
69
+ // eslint-disable-next-line no-use-before-define
74
70
  const useHash = checkCanWeAllowHash({
75
71
  enableFileNameHashing,
76
72
  devLikeHash: devLikeHash || (0, _modeUtils.isDevelopmentMode)(mode),
@@ -79,7 +75,6 @@ function nameTemplates(type, options) {
79
75
  });
80
76
  return createNameTemplate(templateName, useHash);
81
77
  }
82
-
83
78
  function checkCanWeAllowHash({
84
79
  enableFileNameHashing,
85
80
  devLikeHash,
@@ -89,17 +84,15 @@ function checkCanWeAllowHash({
89
84
  if (!enableFileNameHashing) {
90
85
  return false;
91
86
  }
92
-
93
87
  if (devLikeHash) {
94
88
  return devModeContentHashAllowedTypes[type];
95
89
  }
96
-
97
90
  return true;
98
- } // export function cssDirNameTemplate(dir, options) {
91
+ }
92
+
93
+ // export function cssDirNameTemplate(dir, options) {
99
94
  // return nameTemplates('cssdir', options).replace(/\[dir\]/g, dir);
100
95
  // }
101
96
 
102
-
103
97
  const isI18nFile = url => url.endsWith('.i18n.js');
104
-
105
98
  exports.isI18nFile = isI18nFile;
@@ -5,17 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.publicPathAsExpression = publicPathAsExpression;
7
7
  exports.resourceBasedPublicPath = resourceBasedPublicPath;
8
-
9
8
  // const publicPaths = {
9
+
10
10
  // };
11
+
11
12
  function resourceBasedPublicPath(resoruceType, options) {
12
13
  return options.publicPath;
13
14
  }
14
-
15
15
  function publicPathAsExpression(resoruceType, options) {
16
16
  if (resoruceType === 'i18n') {
17
17
  return options.i18nChunkSplit.localeVarName;
18
18
  }
19
-
20
19
  return JSON.stringify(options.publicPath);
21
20
  }
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.configCustomLoaders = configCustomLoaders;
7
-
8
7
  function configCustomLoaders(options) {
9
8
  return options.customLoaders || [];
10
9
  }
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cssLoaders = cssLoaders;
7
-
8
7
  var _getCSSLoaders = require("./getCSSLoaders");
9
-
10
8
  function cssLoaders(options) {
11
9
  return [{
12
10
  test: /\.css$/,
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BundleIntegrityReport = void 0;
7
-
8
7
  var _fs = _interopRequireDefault(require("fs"));
9
-
10
8
  var _path = _interopRequireDefault(require("path"));
11
-
12
9
  var _stream = require("stream");
13
-
14
10
  var _objectManipulation = require("../../utils/object-manipulation");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
12
  const pluginName = 'BundleIntegrityReportPlugin';
19
-
20
13
  class BundleIntegrityReport {
21
14
  constructor({
22
15
  options,
@@ -27,7 +20,6 @@ class BundleIntegrityReport {
27
20
  this.statsFileName = fileName;
28
21
  this.statsOptions = options;
29
22
  }
30
-
31
23
  apply(compiler) {
32
24
  compiler.hooks.done.tapAsync(pluginName, (stats, callback) => {
33
25
  if (stats.hasErrors()) {
@@ -39,7 +31,6 @@ class BundleIntegrityReport {
39
31
  }));
40
32
  return callback(new Error('Build failed due to compilation errors.'));
41
33
  }
42
-
43
34
  const statsJson = (0, _objectManipulation.removeKeysFromObject)(stats.toJson(this.statsOptions), this.excludeKeysInStat);
44
35
  this.emitStats(statsJson).on('end', () => {
45
36
  callback();
@@ -48,30 +39,24 @@ class BundleIntegrityReport {
48
39
  });
49
40
  });
50
41
  }
51
-
52
42
  writeStatsFileInAStream(statsObj) {
53
43
  const {
54
44
  outputPath
55
45
  } = statsObj;
56
-
57
46
  const ouputFileName = _path.default.join(outputPath, this.statsFileName);
58
-
59
47
  return this.createReadStream(statsObj).pipe(_fs.default.createWriteStream(ouputFileName));
60
48
  }
61
-
62
49
  createReadStream(statsObj) {
63
50
  const excludeKeys = this.excludeKeysInStat;
64
51
  return new _stream.Readable({
65
52
  read() {
66
53
  let isDone = false;
67
54
  const objToStringGen = (0, _objectManipulation.convertObjectToStringGen)(statsObj, excludeKeys);
68
-
69
55
  while (!isDone) {
70
56
  const {
71
57
  done,
72
58
  value
73
59
  } = objToStringGen.next();
74
-
75
60
  if (done) {
76
61
  isDone = true;
77
62
  this.push(null);
@@ -80,14 +65,10 @@ class BundleIntegrityReport {
80
65
  }
81
66
  }
82
67
  }
83
-
84
68
  });
85
69
  }
86
-
87
70
  emitStats(statsJson) {
88
71
  return this.writeStatsFileInAStream(statsJson);
89
72
  }
90
-
91
73
  }
92
-
93
74
  exports.BundleIntegrityReport = BundleIntegrityReport;