@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.
- package/README.md +102 -0
- package/README_backup.md +102 -0
- package/lib/allCommandsConfigs.js +7 -2
- package/lib/commands/build/commandExecutor.js +5 -1
- package/lib/commands/build/config.js +3 -2
- package/lib/commands/build/optionsProcessor.js +5 -2
- package/lib/commands/build/preProcessor.js +2 -0
- package/lib/commands/buildEs/commandExecutor.js +5 -0
- package/lib/commands/buildEs/config.js +3 -2
- package/lib/commands/buildEs/preProcessor.js +2 -0
- package/lib/commands/buildLib/commandExecutor.js +5 -0
- package/lib/commands/buildLib/config.js +3 -2
- package/lib/commands/buildLib/preProcessor.js +2 -0
- package/lib/commands/mockserver/commandExecutor.js +9 -2
- package/lib/commands/mockserver/config.js +3 -2
- package/lib/commands/pre_process/commandExecutor.js +2 -0
- package/lib/commands/pre_process/config.js +3 -2
- package/lib/commands/start/commandExecutor.js +2 -0
- package/lib/commands/start/config.js +3 -2
- package/lib/commands/start/optionsProcessor.js +4 -2
- package/lib/commands/start/preProcessor.js +2 -0
- package/lib/commands/template/commandExecutor.js +7 -0
- package/lib/commands/template/config.js +3 -2
- package/lib/commands/version/commandExecutor.js +3 -0
- package/lib/commands/version/config.js +3 -2
- package/lib/commandsRouter.js +21 -5
- package/lib/index.js +2 -0
- package/lib/logger.js +5 -0
- package/lib/schemas/applyValuesToSchema/index.js +8 -0
- package/lib/schemas/applyValuesToSchema/isObject.js +1 -0
- package/lib/schemas/applyValuesToSchema/isValid.js +2 -0
- package/lib/schemas/cliArgsToObject.js +6 -2
- package/lib/schemas/defaultConfigValues.js +17 -4
- package/lib/schemas/defaultConfigValuesOnly.js +33 -4
- package/lib/schemas/deprecatedOptionsHandler.js +16 -7
- package/lib/schemas/getNpmVersion.js +5 -0
- package/lib/schemas/giveDefaultValue.js +3 -0
- package/lib/schemas/npmConfigToObject.js +5 -2
- package/lib/schemas/readOptions.js +30 -10
- package/lib/schemas/readOptionsForConfigFile.js +12 -2
- package/lib/shared/babel/addDefaultPlugins.js +2 -0
- package/lib/shared/babel/babelWebConfig.js +10 -1
- package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +4 -0
- package/lib/shared/babel/getBabelPlugin.js +7 -2
- package/lib/shared/babel/runBabelForJSFile.js +4 -1
- package/lib/shared/babel/runBabelForTsFile.js +5 -1
- package/lib/shared/bundler/webpack/common/decidePublicPath.js +5 -0
- package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
- package/lib/shared/bundler/webpack/common/modeUtils.js +5 -0
- package/lib/shared/bundler/webpack/common/nameTemplates.js +18 -11
- package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +3 -2
- package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -0
- package/lib/shared/bundler/webpack/cssLoaders.js +2 -0
- package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +20 -1
- package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +25 -20
- package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +9 -4
- package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +23 -3
- package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +19 -8
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +61 -37
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +33 -15
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +108 -60
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +26 -20
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +26 -5
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +16 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +53 -19
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +17 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +13 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +21 -11
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +4 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +14 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +13 -3
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +12 -3
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +7 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +2 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +3 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +4 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +13 -8
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +14 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +1 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +3 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +4 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +25 -5
- package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +10 -3
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +6 -1
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +6 -1
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +6 -0
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +1 -0
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +7 -0
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +1 -0
- package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +17 -13
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +15 -6
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +13 -4
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +6 -4
- package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +10 -0
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +3 -0
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +20 -4
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +12 -10
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +3 -2
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +20 -7
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +1 -0
- package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +10 -7
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +6 -1
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +16 -1
- package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +11 -4
- package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +10 -3
- package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +62 -27
- package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +15 -3
- package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +1 -0
- package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +12 -2
- package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +7 -2
- package/lib/shared/bundler/webpack/defaultVendorPatternList.js +6 -2
- package/lib/shared/bundler/webpack/devtoolConfig.js +1 -0
- package/lib/shared/bundler/webpack/entryConfig.js +4 -0
- package/lib/shared/bundler/webpack/externals.js +1 -0
- package/lib/shared/bundler/webpack/getCSSLoaders.js +6 -1
- package/lib/shared/bundler/webpack/getFilenameFromModule.js +5 -1
- package/lib/shared/bundler/webpack/jsLoaders.js +10 -6
- package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +2 -0
- package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +3 -2
- package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +12 -3
- package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +1 -0
- package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +10 -2
- package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +2 -0
- package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +12 -0
- package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +15 -1
- package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +4 -1
- package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +16 -8
- package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +29 -22
- package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
- package/lib/shared/bundler/webpack/loaders/workerLoader.js +19 -8
- package/lib/shared/bundler/webpack/optimizationConfig.js +13 -5
- package/lib/shared/bundler/webpack/outputConfig.js +9 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +9 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +5 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +9 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +8 -3
- package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +16 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +4 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +16 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +5 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +5 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +8 -2
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +9 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +25 -19
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +26 -12
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +9 -3
- package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +2 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +7 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +7 -3
- package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +5 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +4 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +4 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +8 -3
- package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +6 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +8 -3
- package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +4 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +8 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +6 -1
- package/lib/shared/bundler/webpack/plugins.js +24 -1
- package/lib/shared/bundler/webpack/resolvers.js +17 -3
- package/lib/shared/bundler/webpack/splitChunksConfig.js +15 -2
- package/lib/shared/bundler/webpack/statsConfig.js +5 -2
- package/lib/shared/bundler/webpack/tsLoaders.js +4 -2
- package/lib/shared/bundler/webpack/utils/index.js +12 -1
- package/lib/shared/bundler/webpack/utils/object-manipulation.js +16 -2
- package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +7 -0
- package/lib/shared/bundler/webpack/webpackBuild.js +8 -1
- package/lib/shared/bundler/webpack/webpackConfig.js +17 -0
- package/lib/shared/commands-utils/doBasicRequirementCheck.js +3 -0
- package/lib/shared/commands-utils/getCliPath.js +9 -5
- package/lib/shared/commands-utils/index.js +3 -0
- package/lib/shared/commands-utils/log.js +2 -0
- package/lib/shared/commands-utils/readArgsFormCommandLine.js +1 -0
- package/lib/shared/commands-utils/readOptionFormCommandLine.js +1 -0
- package/lib/shared/commands-utils/spawnSyncIO.js +13 -5
- package/lib/shared/constants.js +29 -9
- package/lib/shared/fileUtils/copyFile.js +8 -1
- package/lib/shared/fileUtils/directoryIterator.js +4 -0
- package/lib/shared/fileUtils/watchRun.js +24 -3
- package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +6 -1
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +3 -2
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +13 -6
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +26 -6
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +9 -6
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +3 -0
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +7 -2
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +2 -0
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +9 -4
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +10 -0
- package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +29 -16
- package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +17 -0
- package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +9 -4
- package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +63 -27
- package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +13 -5
- package/lib/shared/postcss/getAllowedPostCssPlugins.js +3 -0
- package/lib/shared/postcss/getSpecificPostCssPlugin.js +17 -7
- package/lib/shared/postcss/runPostCssForCssFile.js +9 -1
- package/lib/shared/pre_process/runPreProcess.js +11 -0
- package/lib/shared/server/configWebpackDevMiddleware.js +8 -1
- package/lib/shared/server/corsHandling.js +6 -2
- package/lib/shared/server/getIp.js +7 -1
- package/lib/shared/server/getServerURL.js +6 -0
- package/lib/shared/server/httpsOptions.js +11 -0
- package/lib/shared/server/initExpressApp.js +4 -1
- package/lib/shared/server/initialHTMLHandling.js +16 -7
- package/lib/shared/server/mockApiHandler.js +16 -8
- package/lib/shared/server/mockServer.js +7 -0
- package/lib/shared/server/serveContextFiles.js +5 -1
- package/lib/shared/server/serverBywebpackDevMiddleware.js +9 -4
- package/lib/shared/server/startHttpServer.js +3 -0
- package/lib/shared/server/startHttpsServer.js +9 -1
- package/lib/shared/server/unwanted/addHttp2Server.js +7 -2
- package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +8 -1
- package/lib/shared/server/unwanted/mockApiSupport.js +2 -0
- package/lib/shared/server/unwanted/websocketMockSetup.js +7 -1
- package/lib/shared/server/urlConcat.js +8 -3
- package/lib/shared/utils/requireLocalOrGlobal.js +25 -10
- package/lib/shared/utils/versionPrint.js +6 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configProgressPlugin = configProgressPlugin;
|
|
7
|
+
|
|
7
8
|
var _webpack = _interopRequireDefault(require("webpack"));
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
9
12
|
// eslint-disable-next-line no-unused-vars
|
|
10
13
|
function configProgressPlugin(options) {
|
|
11
14
|
if (!options.printProgress) {
|
|
12
15
|
return null;
|
|
13
16
|
}
|
|
17
|
+
|
|
14
18
|
return new _webpack.default.ProgressPlugin({
|
|
15
19
|
handler: (percentage, message, ...args) => {
|
|
16
20
|
// eslint-disable-next-line no-console
|
|
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configResourceHintsPlugin = configResourceHintsPlugin;
|
|
7
|
+
|
|
7
8
|
var _ResourceHintsPlugin = _interopRequireDefault(require("../custom_plugins/ResourceHintsPlugin"));
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
9
12
|
function configResourceHintsPlugin(options) {
|
|
10
13
|
const {
|
|
11
14
|
publicPath,
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configRtlCssPlugin = configRtlCssPlugin;
|
|
7
|
+
|
|
7
8
|
var _RtlCssPlugin = require("../custom_plugins/RtlSplitPlugin/RtlCssPlugin");
|
|
9
|
+
|
|
8
10
|
function configRtlCssPlugin(options) {
|
|
9
11
|
const {
|
|
10
12
|
enableRTLSplit,
|
|
@@ -12,9 +14,11 @@ function configRtlCssPlugin(options) {
|
|
|
12
14
|
disableMinifySelector,
|
|
13
15
|
dirVarName
|
|
14
16
|
} = options.css.plugins.rtlSplit;
|
|
17
|
+
|
|
15
18
|
if (!enableRTLSplit) {
|
|
16
19
|
return null;
|
|
17
20
|
}
|
|
21
|
+
|
|
18
22
|
return new _RtlCssPlugin.RtlCssPlugin({
|
|
19
23
|
templateLabel,
|
|
20
24
|
disableMinifySelector,
|
|
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configRuntimeResourceCleanup = configRuntimeResourceCleanup;
|
|
7
|
+
|
|
7
8
|
var _modeUtils = require("../common/modeUtils");
|
|
9
|
+
|
|
8
10
|
var _RuntimeResourceCleanup = _interopRequireDefault(require("../custom_plugins/RuntimeResourceCleanup"));
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function configRuntimeResourceCleanup(options) {
|
|
11
15
|
const chunkLoadingGlobal = (0, _modeUtils.getGlobalCacheStorageName)(options);
|
|
12
16
|
const {
|
|
@@ -16,11 +20,12 @@ function configRuntimeResourceCleanup(options) {
|
|
|
16
20
|
const {
|
|
17
21
|
customAttributes = {}
|
|
18
22
|
} = options;
|
|
23
|
+
|
|
19
24
|
if (efcEnabled && runtimeResourceCleanupEnabled) {
|
|
20
|
-
return new _RuntimeResourceCleanup.default({
|
|
21
|
-
...customAttributes,
|
|
25
|
+
return new _RuntimeResourceCleanup.default({ ...customAttributes,
|
|
22
26
|
chunkLoadingGlobal
|
|
23
27
|
});
|
|
24
28
|
}
|
|
29
|
+
|
|
25
30
|
return null;
|
|
26
31
|
}
|
|
@@ -4,15 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configSelectorWeightPlugin = configSelectorWeightPlugin;
|
|
7
|
+
|
|
7
8
|
var _SelectorWeightPlugin = _interopRequireDefault(require("../custom_plugins/SelectorWeightPlugin"));
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
9
12
|
function configSelectorWeightPlugin(options) {
|
|
10
13
|
const {
|
|
11
14
|
selectorWeight
|
|
12
15
|
} = options.css.plugins;
|
|
16
|
+
|
|
13
17
|
if (!selectorWeight.enable) {
|
|
14
18
|
return null;
|
|
15
19
|
}
|
|
20
|
+
|
|
16
21
|
return new _SelectorWeightPlugin.default({
|
|
17
22
|
selectorWeightConfig: selectorWeight.configFile,
|
|
18
23
|
defaultSelector: selectorWeight.defaultSelector,
|
|
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configServiceWorkerPlugin = configServiceWorkerPlugin;
|
|
7
|
+
|
|
7
8
|
var _nameTemplates = require("../common/nameTemplates");
|
|
9
|
+
|
|
8
10
|
var _ServiceWorkerPlugin = _interopRequireDefault(require("../custom_plugins/ServiceWorkerPlugin"));
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function configServiceWorkerPlugin(options) {
|
|
11
15
|
const {
|
|
12
16
|
serviceWorker
|
|
@@ -20,12 +24,13 @@ function configServiceWorkerPlugin(options) {
|
|
|
20
24
|
const {
|
|
21
25
|
enableRTLSplit
|
|
22
26
|
} = options.css.plugins.rtlSplit;
|
|
27
|
+
|
|
23
28
|
if (!serviceWorker.enable) {
|
|
24
29
|
return null;
|
|
25
30
|
}
|
|
31
|
+
|
|
26
32
|
const i18nFileNameTemplate = (0, _nameTemplates.nameTemplates)('i18njs', options);
|
|
27
|
-
return new _ServiceWorkerPlugin.default({
|
|
28
|
-
...serviceWorker,
|
|
33
|
+
return new _ServiceWorkerPlugin.default({ ...serviceWorker,
|
|
29
34
|
publicPath,
|
|
30
35
|
i18nFileNameTemplate,
|
|
31
36
|
chunkSplitEnable,
|
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configSourceMapPlugin = configSourceMapPlugin;
|
|
7
|
+
|
|
7
8
|
var _SourceMapPlugin = require("../custom_plugins/SourceMapPlugin");
|
|
9
|
+
|
|
8
10
|
function configSourceMapPlugin(options) {
|
|
9
11
|
const {
|
|
10
12
|
createSeparateSMap
|
|
11
13
|
} = options;
|
|
14
|
+
|
|
12
15
|
if (createSeparateSMap === false) {
|
|
13
16
|
return null;
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
return new _SourceMapPlugin.SourceMapPlugin();
|
|
16
20
|
}
|
|
@@ -4,22 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configTPHashMappingPlugin = configTPHashMappingPlugin;
|
|
7
|
+
|
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
8
10
|
var _TPHashMappingPlugin = require("../custom_plugins/TPHashMappingPlugin");
|
|
11
|
+
|
|
9
12
|
var _modeUtils = require("../common/modeUtils");
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
11
16
|
function configTPHashMappingPlugin(options) {
|
|
12
17
|
const {
|
|
13
18
|
fileHashMappingToVariable,
|
|
14
19
|
context,
|
|
15
20
|
mode
|
|
16
21
|
} = options;
|
|
22
|
+
|
|
17
23
|
if ((0, _modeUtils.isProductionMode)(mode) && fileHashMappingToVariable) {
|
|
18
24
|
return new _TPHashMappingPlugin.TPHashMappingPlugin({
|
|
19
25
|
fileMappings: fileHashMappingToVariable,
|
|
20
26
|
tpFolder: `${_path.default.join(process.cwd(), context)}`
|
|
21
27
|
});
|
|
22
28
|
}
|
|
29
|
+
|
|
23
30
|
;
|
|
24
31
|
return null;
|
|
25
32
|
}
|
|
@@ -4,15 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configVariableConversionPlugin = configVariableConversionPlugin;
|
|
7
|
+
|
|
7
8
|
var _VariableConversionCollector = _interopRequireDefault(require("../custom_plugins/VariableConversionCollector"));
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
9
12
|
function configVariableConversionPlugin(options) {
|
|
10
13
|
const {
|
|
11
14
|
cssVariableReplacement
|
|
12
15
|
} = options.css.plugins;
|
|
16
|
+
|
|
13
17
|
if (cssVariableReplacement.enable === false) {
|
|
14
18
|
return false;
|
|
15
19
|
}
|
|
20
|
+
|
|
16
21
|
return new _VariableConversionCollector.default({
|
|
17
22
|
configFile: cssVariableReplacement.configFile,
|
|
18
23
|
patterns: cssVariableReplacement.patterns
|
|
@@ -4,31 +4,54 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.plugins = plugins;
|
|
7
|
+
|
|
7
8
|
var _configHtmlWebpackPlugin = require("./pluginConfigs/configHtmlWebpackPlugin");
|
|
9
|
+
|
|
8
10
|
var _configEnvVariables = require("./pluginConfigs/configEnvVariables");
|
|
11
|
+
|
|
9
12
|
var _configI18nSplitPlugin = require("./pluginConfigs/configI18nSplitPlugin");
|
|
13
|
+
|
|
10
14
|
var _configI18nNumericIndexPlugin = require("./pluginConfigs/configI18nNumericIndexPlugin");
|
|
15
|
+
|
|
11
16
|
var _configMiniCSSExtractPlugin = require("./pluginConfigs/configMiniCSSExtractPlugin");
|
|
17
|
+
|
|
12
18
|
var _configRtlCssPlugin = require("./pluginConfigs/configRtlCssPlugin");
|
|
19
|
+
|
|
13
20
|
var _configIgnorePlugin = require("./pluginConfigs/configIgnorePlugin");
|
|
21
|
+
|
|
14
22
|
var _configCdnChangePlugin = require("./pluginConfigs/configCdnChangePlugin");
|
|
23
|
+
|
|
15
24
|
var _configServiceWorkerPlugin = require("./pluginConfigs/configServiceWorkerPlugin");
|
|
25
|
+
|
|
16
26
|
var _configProgressPlugin = require("./pluginConfigs/configProgressPlugin");
|
|
27
|
+
|
|
17
28
|
var _configBundleAnalyzer = require("./pluginConfigs/configBundleAnalyzer");
|
|
29
|
+
|
|
18
30
|
var _configSelectorWeightPlugin = require("./pluginConfigs/configSelectorWeightPlugin");
|
|
31
|
+
|
|
19
32
|
var _configVariableConversionPlugin = require("./pluginConfigs/configVariableConversionPlugin");
|
|
33
|
+
|
|
20
34
|
var _configEFCTemplatePlugin = require("./pluginConfigs/configEFCTemplatePlugin");
|
|
35
|
+
|
|
21
36
|
var _configResourceHintsPlugin = require("./pluginConfigs/configResourceHintsPlugin");
|
|
37
|
+
|
|
22
38
|
var _configManifestJsonPlugin = require("./pluginConfigs/configManifestJsonPlugin");
|
|
39
|
+
|
|
23
40
|
var _configCopyPublicFolders = require("./pluginConfigs/configCopyPublicFolders");
|
|
41
|
+
|
|
24
42
|
var _configSourceMapPlugin = require("./pluginConfigs/configSourceMapPlugin");
|
|
43
|
+
|
|
25
44
|
var _configTPHashMappingPlugin = require("./pluginConfigs/configTPHashMappingPlugin");
|
|
45
|
+
|
|
26
46
|
var _configCustomAttributesPlugin = require("./pluginConfigs/configCustomAttributesPlugin");
|
|
47
|
+
|
|
27
48
|
var _configBundleIntegrityReport = require("./pluginConfigs/configBundleIntegrityReport");
|
|
49
|
+
|
|
28
50
|
var _configRuntimeResourceCleanup = require("./pluginConfigs/configRuntimeResourceCleanup");
|
|
51
|
+
|
|
29
52
|
var _configCustomScriptLoadingStrategyPlugin = require("./pluginConfigs/configCustomScriptLoadingStrategyPlugin");
|
|
30
|
-
// import { IgnorePlugin } from 'webpack';
|
|
31
53
|
|
|
54
|
+
// import { IgnorePlugin } from 'webpack';
|
|
32
55
|
function plugins(options) {
|
|
33
56
|
const {
|
|
34
57
|
webpackPlugins
|
|
@@ -5,38 +5,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.loaderResolver = loaderResolver;
|
|
7
7
|
exports.moduleResolver = moduleResolver;
|
|
8
|
+
|
|
8
9
|
var _client_packages_group = require("@zohodesk/client_packages_group");
|
|
10
|
+
|
|
9
11
|
var _constants = require("../../constants");
|
|
12
|
+
|
|
10
13
|
var _libAlias = require("./common/libAlias");
|
|
14
|
+
|
|
11
15
|
var _requireLocalOrGlobal = require("../../utils/requireLocalOrGlobal");
|
|
16
|
+
|
|
12
17
|
var _logger = require("../../../logger");
|
|
13
|
-
/* eslint-disable no-use-before-define */
|
|
14
18
|
|
|
19
|
+
/* eslint-disable no-use-before-define */
|
|
15
20
|
const defaultPackageGroupNpm = '@zohodesk/client_packages_group';
|
|
21
|
+
|
|
16
22
|
function decideNodeModulesPath(moduleResolvePath) {
|
|
17
23
|
if (typeof moduleResolvePath === 'string' && moduleResolvePath) {
|
|
18
24
|
const resolverPkg = (0, _requireLocalOrGlobal.requireAllPossible)(moduleResolvePath);
|
|
25
|
+
|
|
19
26
|
if (resolverPkg.local) {
|
|
20
27
|
(0, _logger.verboseLogger)(`Local '${moduleResolvePath}' package taken as Module Resolver`);
|
|
21
28
|
return resolverPkg.local.nodeModulesPath;
|
|
22
29
|
}
|
|
30
|
+
|
|
23
31
|
if (resolverPkg.global) {
|
|
24
32
|
(0, _logger.messageLogger)(`Global '${moduleResolvePath}' package taken as Module Resolver`);
|
|
25
33
|
return resolverPkg.global.nodeModulesPath;
|
|
26
34
|
}
|
|
35
|
+
|
|
27
36
|
(0, _logger.errorLogger)(`
|
|
28
37
|
You have given 'resolve.moduleResolvePath' as "${moduleResolvePath}".
|
|
29
38
|
But it seems that file path have some problem;`);
|
|
30
39
|
process.exit(0);
|
|
31
40
|
}
|
|
41
|
+
|
|
32
42
|
const globalResolverPkg = (0, _requireLocalOrGlobal.requireGlobal)(defaultPackageGroupNpm);
|
|
43
|
+
|
|
33
44
|
if (globalResolverPkg) {
|
|
34
45
|
(0, _logger.messageLogger)(`Global '${defaultPackageGroupNpm}' package taken as Module Resolver`);
|
|
35
46
|
return globalResolverPkg.nodeModulesPath;
|
|
36
47
|
}
|
|
48
|
+
|
|
37
49
|
(0, _logger.verboseLogger)(`CBT default '${defaultPackageGroupNpm}' package taken as Module Resolver`);
|
|
38
50
|
return _client_packages_group.nodeModulesPath;
|
|
39
51
|
}
|
|
52
|
+
|
|
40
53
|
function moduleResolver(options) {
|
|
41
54
|
const {
|
|
42
55
|
preferLocalFirst,
|
|
@@ -47,13 +60,13 @@ function moduleResolver(options) {
|
|
|
47
60
|
const nodeModulesPath = decideNodeModulesPath(moduleResolvePath);
|
|
48
61
|
return {
|
|
49
62
|
modules: useAppNodeModulesAsPreferred(preferLocalFirst, [nodeModulesPath, _constants.cliNodeModulesPath].filter(Boolean)),
|
|
50
|
-
alias: {
|
|
51
|
-
...(defaultAlias ? _libAlias.libAlias : {}),
|
|
63
|
+
alias: { ...(defaultAlias ? _libAlias.libAlias : {}),
|
|
52
64
|
...(alias || {})
|
|
53
65
|
},
|
|
54
66
|
extensions: ['.ts', '.js', '.json', '.tsx']
|
|
55
67
|
};
|
|
56
68
|
}
|
|
69
|
+
|
|
57
70
|
function loaderResolver(options) {
|
|
58
71
|
const {
|
|
59
72
|
preferLocalFirst
|
|
@@ -62,6 +75,7 @@ function loaderResolver(options) {
|
|
|
62
75
|
modules: useAppNodeModulesAsPreferred(preferLocalFirst, [_constants.cliNodeModulesPath])
|
|
63
76
|
};
|
|
64
77
|
}
|
|
78
|
+
|
|
65
79
|
function useAppNodeModulesAsPreferred(preferLocalFirst = false, paths = []) {
|
|
66
80
|
const filteredPaths = paths.filter(Boolean);
|
|
67
81
|
return preferLocalFirst ? ['node_modules', ...filteredPaths, _constants.appNodeModules] : [...filteredPaths, 'node_modules', _constants.appNodeModules];
|
|
@@ -4,24 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.splitChunksConfig = splitChunksConfig;
|
|
7
|
+
|
|
7
8
|
var _defaultVendorPatternList = require("./defaultVendorPatternList");
|
|
9
|
+
|
|
8
10
|
var _getFilenameFromModule = require("./getFilenameFromModule");
|
|
11
|
+
|
|
9
12
|
var _checkIsPatternsMatchFilename = require("./loaderConfigs/checkIsPatternsMatchFilename");
|
|
13
|
+
|
|
10
14
|
function splitChunksConfig(options) {
|
|
11
15
|
const {
|
|
12
16
|
vendorPatterns,
|
|
13
17
|
customChunks,
|
|
14
18
|
customChunksBaseConfig
|
|
15
19
|
} = options;
|
|
20
|
+
|
|
16
21
|
const isVendor = function isVendor(webpackModule) {
|
|
17
22
|
const userRequest = (0, _getFilenameFromModule.getFilenameFromModule)(webpackModule);
|
|
18
23
|
const patterns = [..._defaultVendorPatternList.defaultVendorPatternList, ...vendorPatterns];
|
|
19
24
|
return (0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(patterns, userRequest);
|
|
20
25
|
};
|
|
26
|
+
|
|
21
27
|
const isReact = webpackModule => {
|
|
22
28
|
const userRequest = (0, _getFilenameFromModule.getFilenameFromModule)(webpackModule);
|
|
23
29
|
return (0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(_defaultVendorPatternList.reactBundleIncludeList, userRequest);
|
|
24
30
|
};
|
|
31
|
+
|
|
25
32
|
const defaultChunks = {
|
|
26
33
|
'react.vendor': {
|
|
27
34
|
name: 'react.vendor',
|
|
@@ -41,8 +48,8 @@ function splitChunksConfig(options) {
|
|
|
41
48
|
};
|
|
42
49
|
const customChunksConfig = {};
|
|
43
50
|
customChunks.reverse().forEach((cacheGroupObj, index) => {
|
|
44
|
-
const cacheGroupName = cacheGroupObj.cacheGroupName || cacheGroupObj.name;
|
|
45
|
-
|
|
51
|
+
const cacheGroupName = cacheGroupObj.cacheGroupName || cacheGroupObj.name; // eslint-disable-next-line no-use-before-define
|
|
52
|
+
|
|
46
53
|
const obj = getCacheGroup(cacheGroupObj, index);
|
|
47
54
|
customChunksConfig[cacheGroupName] = obj;
|
|
48
55
|
});
|
|
@@ -58,6 +65,7 @@ function splitChunksConfig(options) {
|
|
|
58
65
|
};
|
|
59
66
|
return splitChunksConfig;
|
|
60
67
|
}
|
|
68
|
+
|
|
61
69
|
function getCacheGroup(obj, index) {
|
|
62
70
|
let {
|
|
63
71
|
minChunks,
|
|
@@ -87,17 +95,22 @@ function getCacheGroup(obj, index) {
|
|
|
87
95
|
priority,
|
|
88
96
|
enforce
|
|
89
97
|
};
|
|
98
|
+
|
|
90
99
|
if (minSize !== undefined) {
|
|
91
100
|
cacheGroup.minSize = minSize;
|
|
92
101
|
}
|
|
102
|
+
|
|
93
103
|
if (maxSize !== undefined) {
|
|
94
104
|
cacheGroup.maxSize = maxSize;
|
|
95
105
|
}
|
|
106
|
+
|
|
96
107
|
if (reuseExistingChunk !== undefined) {
|
|
97
108
|
cacheGroup.reuseExistingChunk = reuseExistingChunk;
|
|
98
109
|
}
|
|
110
|
+
|
|
99
111
|
if (automaticNameDelimiter !== undefined) {
|
|
100
112
|
cacheGroup.automaticNameDelimiter = automaticNameDelimiter;
|
|
101
113
|
}
|
|
114
|
+
|
|
102
115
|
return cacheGroup;
|
|
103
116
|
}
|
|
@@ -4,24 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.statsConfig = statsConfig;
|
|
7
|
+
|
|
7
8
|
// eslint-disable-next-line no-unused-vars
|
|
8
9
|
function statsConfig(options) {
|
|
9
10
|
let {
|
|
10
11
|
statsLogConfig
|
|
11
12
|
} = options;
|
|
12
13
|
statsLogConfig = statsLogConfig || {};
|
|
14
|
+
|
|
13
15
|
if (typeof statsLogConfig === 'string') {
|
|
14
16
|
return statsLogConfig;
|
|
15
17
|
}
|
|
18
|
+
|
|
16
19
|
return {
|
|
17
20
|
preset: 'minimal',
|
|
18
21
|
warnings: false,
|
|
19
22
|
children: false,
|
|
20
23
|
colors: true,
|
|
21
24
|
errorDetails: true,
|
|
22
|
-
...statsLogConfig
|
|
23
|
-
// excludeAssets: /i18n/,
|
|
25
|
+
...statsLogConfig // excludeAssets: /i18n/,
|
|
24
26
|
// excludeAssets: /./,
|
|
25
27
|
// warningsFilter: /\[mini-css-extract-plugin\]/
|
|
28
|
+
|
|
26
29
|
};
|
|
27
30
|
}
|
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.tsLoaders = tsLoaders;
|
|
7
|
+
|
|
7
8
|
var _babelLoaderConfig = require("./loaderConfigs/babelLoaderConfig");
|
|
9
|
+
|
|
8
10
|
function tsLoaders(options) {
|
|
9
11
|
return [{
|
|
10
12
|
test: /\.tsx$/,
|
|
11
13
|
exclude: /node_modules/,
|
|
12
|
-
use: [(0, _babelLoaderConfig.babelLoaderConfig)(options)]
|
|
13
|
-
|
|
14
|
+
use: [(0, _babelLoaderConfig.babelLoaderConfig)(options)] // include: path.join(appPath, folder)
|
|
15
|
+
|
|
14
16
|
}];
|
|
15
17
|
}
|
|
@@ -5,16 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getTypeOf = getTypeOf;
|
|
7
7
|
exports.isJsFile = exports.isDirRelatedCss = exports.isCssFile = exports.isCss = void 0;
|
|
8
|
+
|
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
10
13
|
const isCss = filename => _path.default.extname(filename) === '.css';
|
|
14
|
+
|
|
11
15
|
exports.isCss = isCss;
|
|
16
|
+
|
|
12
17
|
const isDirRelatedCss = filename => filename.includes('[dir]');
|
|
18
|
+
|
|
13
19
|
exports.isDirRelatedCss = isDirRelatedCss;
|
|
20
|
+
|
|
14
21
|
const isJsFile = file => /\.js$/.test(file);
|
|
22
|
+
|
|
15
23
|
exports.isJsFile = isJsFile;
|
|
24
|
+
|
|
16
25
|
const isCssFile = file => /\.css$/.test(file);
|
|
26
|
+
|
|
17
27
|
exports.isCssFile = isCssFile;
|
|
28
|
+
|
|
18
29
|
function getTypeOf(value) {
|
|
19
30
|
return Object.prototype.toString.call(value).split(/\s/)[1].replace(/\]/, '').toLowerCase();
|
|
20
31
|
}
|
|
@@ -5,62 +5,75 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.convertObjectToStringGen = convertObjectToStringGen;
|
|
7
7
|
exports.removeKeysFromObject = removeKeysFromObject;
|
|
8
|
-
/* eslint-disable no-restricted-syntax */
|
|
9
8
|
|
|
9
|
+
/* eslint-disable no-restricted-syntax */
|
|
10
10
|
function objectPathMatcher(currentKey, objHierarchy = [], keysToBeRemoved = []) {
|
|
11
11
|
const objPathKey = objHierarchy.length > 0 ? `${objHierarchy.join('.')}.${currentKey}` : currentKey;
|
|
12
12
|
return keysToBeRemoved.some(key => {
|
|
13
13
|
const isWildPath = /^\*/.test(key);
|
|
14
|
+
|
|
14
15
|
if (isWildPath) {
|
|
15
16
|
const newKey = key.replace(/\*\.?/, '');
|
|
16
17
|
return objPathKey.includes(newKey);
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
return key === objPathKey;
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
|
-
|
|
22
23
|
/*
|
|
23
24
|
1) *.keyTobeRemoved -> means match every object path, this key will be removed
|
|
24
25
|
2) keyToBeremoved -> means root object key
|
|
25
26
|
3) nestedPath.keyToBeRemoved -> means only that nested path key
|
|
26
27
|
4) don't need to account for array iteration, just object key path is enough in the key to be removed.
|
|
27
28
|
*/
|
|
29
|
+
|
|
30
|
+
|
|
28
31
|
function removeKeysFromObject(obj, keysToBeRemoved, prevKeys = []) {
|
|
29
32
|
if (Array.isArray(obj)) {
|
|
30
33
|
return obj.map(item => removeKeysFromObject(item, keysToBeRemoved, prevKeys));
|
|
31
34
|
}
|
|
35
|
+
|
|
32
36
|
if (obj && typeof obj === 'object') {
|
|
33
37
|
const filteredKeyObject = {};
|
|
34
38
|
const ObjectKeys = Object.keys(obj);
|
|
39
|
+
|
|
35
40
|
for (const objectKey of ObjectKeys) {
|
|
36
41
|
const isKeyToBeRemoved = objectPathMatcher(objectKey, prevKeys, keysToBeRemoved);
|
|
42
|
+
|
|
37
43
|
if (!isKeyToBeRemoved) {
|
|
38
44
|
filteredKeyObject[objectKey] = removeKeysFromObject(obj[objectKey], keysToBeRemoved, [...prevKeys, objectKey]);
|
|
39
45
|
}
|
|
40
46
|
}
|
|
47
|
+
|
|
41
48
|
return filteredKeyObject;
|
|
42
49
|
}
|
|
50
|
+
|
|
43
51
|
return obj;
|
|
44
52
|
}
|
|
53
|
+
|
|
45
54
|
function* convertObjectToStringGen(obj) {
|
|
46
55
|
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || obj === null) {
|
|
47
56
|
yield JSON.stringify(obj);
|
|
48
57
|
} else if (Array.isArray(obj)) {
|
|
49
58
|
yield '[';
|
|
50
59
|
let isFirst = true;
|
|
60
|
+
|
|
51
61
|
for (let item of obj) {
|
|
52
62
|
if (item === undefined) {
|
|
53
63
|
item = null;
|
|
54
64
|
}
|
|
65
|
+
|
|
55
66
|
yield `${isFirst ? '' : ','}`;
|
|
56
67
|
yield* convertObjectToStringGen(item);
|
|
57
68
|
isFirst = false;
|
|
58
69
|
}
|
|
70
|
+
|
|
59
71
|
yield ']';
|
|
60
72
|
} else {
|
|
61
73
|
yield '{';
|
|
62
74
|
let isFirst = true;
|
|
63
75
|
const entries = Object.entries(obj);
|
|
76
|
+
|
|
64
77
|
for (const [itemKey, itemValue] of entries) {
|
|
65
78
|
if (itemValue !== undefined) {
|
|
66
79
|
yield `${isFirst ? '' : ','}${JSON.stringify(itemKey)}: `;
|
|
@@ -68,6 +81,7 @@ function* convertObjectToStringGen(obj) {
|
|
|
68
81
|
isFirst = false;
|
|
69
82
|
}
|
|
70
83
|
}
|
|
84
|
+
|
|
71
85
|
yield '}';
|
|
72
86
|
}
|
|
73
87
|
}
|
|
@@ -5,21 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getArrayWithDefault = getArrayWithDefault;
|
|
7
7
|
exports.updateArrayWithDefault = updateArrayWithDefault;
|
|
8
|
+
|
|
8
9
|
function updateArrayWithDefault(array, defaultoptions = []) {
|
|
9
10
|
const index = array.indexOf('...');
|
|
11
|
+
|
|
10
12
|
if (index === -1) {
|
|
11
13
|
return array;
|
|
12
14
|
}
|
|
15
|
+
|
|
13
16
|
const newArray = [...array];
|
|
14
17
|
newArray.splice(index, 1, ...defaultoptions);
|
|
15
18
|
return newArray;
|
|
16
19
|
}
|
|
20
|
+
|
|
17
21
|
const isEqualVal = (a, b) => a === b;
|
|
22
|
+
|
|
18
23
|
function getArrayWithDefault(array, defaultoptions = [], isEqual = isEqualVal) {
|
|
19
24
|
const index = array.indexOf('...');
|
|
25
|
+
|
|
20
26
|
if (index === -1) {
|
|
21
27
|
return array;
|
|
22
28
|
}
|
|
29
|
+
|
|
23
30
|
const filteredDefaultOptions = defaultoptions.filter(v => !array.some(v1 => isEqual(v, v1)));
|
|
24
31
|
const newArray = [...array];
|
|
25
32
|
newArray.splice(index, 1, ...filteredDefaultOptions);
|
|
@@ -4,17 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = webpackBuild;
|
|
7
|
+
|
|
7
8
|
var _webpack = require("webpack");
|
|
9
|
+
|
|
8
10
|
var _statsConfig = require("./statsConfig");
|
|
11
|
+
|
|
9
12
|
var _webpackConfig = _interopRequireDefault(require("./webpackConfig"));
|
|
13
|
+
|
|
10
14
|
var _logger = require("../../../logger");
|
|
11
|
-
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
12
18
|
function webpackBuild(options) {
|
|
13
19
|
const config = (0, _webpackConfig.default)(options);
|
|
14
20
|
(0, _webpack.webpack)(config, (err, stats) => {
|
|
15
21
|
if (err || stats.hasErrors()) {
|
|
16
22
|
(0, _logger.errorLogger)('err', err);
|
|
17
23
|
}
|
|
24
|
+
|
|
18
25
|
(0, _logger.messageLogger)(stats.toString((0, _statsConfig.statsConfig)(options)));
|
|
19
26
|
});
|
|
20
27
|
}
|