@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,14 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configBundleIntegrityReport = configBundleIntegrityReport;
|
|
7
|
+
|
|
7
8
|
var _modeUtils = require("../common/modeUtils");
|
|
9
|
+
|
|
8
10
|
var _BundleIntegrityReport = require("../custom_plugins/BundleIntegrityReport");
|
|
11
|
+
|
|
9
12
|
function configBundleIntegrityReport(options) {
|
|
10
13
|
const webpackMode = (0, _modeUtils.getWebpackMode)(options);
|
|
11
14
|
const isProduction = (0, _modeUtils.isProductionMode)(webpackMode);
|
|
12
15
|
const {
|
|
13
16
|
enable: statsEnable
|
|
14
17
|
} = options.stats;
|
|
18
|
+
|
|
15
19
|
if (isProduction && statsEnable) {
|
|
16
20
|
return new _BundleIntegrityReport.BundleIntegrityReport({
|
|
17
21
|
fileName: options.stats.fileName || 'bundle-report-integrity.json',
|
|
@@ -27,5 +31,6 @@ function configBundleIntegrityReport(options) {
|
|
|
27
31
|
}
|
|
28
32
|
});
|
|
29
33
|
}
|
|
34
|
+
|
|
30
35
|
return null;
|
|
31
36
|
}
|
|
@@ -4,19 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configCSSMinifierPlugin = configCSSMinifierPlugin;
|
|
7
|
+
|
|
7
8
|
var _cssMinimizerWebpackPlugin = _interopRequireDefault(require("css-minimizer-webpack-plugin"));
|
|
9
|
+
|
|
8
10
|
var _modeUtils = require("../common/modeUtils");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
// import UglifyCSSPlugin from '../custom_plugins/UglifyCSSPlugin';
|
|
11
11
|
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// import UglifyCSSPlugin from '../custom_plugins/UglifyCSSPlugin';
|
|
12
15
|
// eslint-disable-next-line no-unused-vars
|
|
13
16
|
function configCSSMinifierPlugin(options) {
|
|
14
17
|
const excludeList = options.optimization.cssExcludePath;
|
|
18
|
+
|
|
15
19
|
if ((0, _modeUtils.isNotProduction)(options)) {
|
|
16
20
|
return null;
|
|
17
|
-
}
|
|
18
|
-
// return null;
|
|
21
|
+
} // return null;
|
|
19
22
|
// return new UglifyCSSPlugin();
|
|
23
|
+
|
|
24
|
+
|
|
20
25
|
return excludeList !== '' ? new _cssMinimizerWebpackPlugin.default({
|
|
21
26
|
exclude: excludeList
|
|
22
27
|
}) : new _cssMinimizerWebpackPlugin.default();
|
|
@@ -4,19 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configCdnChangePlugin = configCdnChangePlugin;
|
|
7
|
+
|
|
7
8
|
var _modeUtils = require("../common/modeUtils");
|
|
9
|
+
|
|
8
10
|
var _CdnChangePlugin = _interopRequireDefault(require("../custom_plugins/CdnChangePlugin"));
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function configCdnChangePlugin(options) {
|
|
11
15
|
const {
|
|
12
16
|
cdnMapping,
|
|
13
17
|
mode
|
|
14
18
|
} = options;
|
|
19
|
+
|
|
15
20
|
if (!cdnMapping.isCdnEnabled || (0, _modeUtils.isDevelopmentMode)(mode)) {
|
|
16
21
|
return null;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
return new _CdnChangePlugin.default({ ...cdnMapping,
|
|
20
25
|
createSeparateSMap: options.createSeparateSMap
|
|
21
26
|
});
|
|
22
27
|
}
|
|
@@ -4,12 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configCopyPublicFolders = configCopyPublicFolders;
|
|
7
|
+
|
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
8
10
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
|
11
|
+
|
|
9
12
|
var _fs = require("fs");
|
|
13
|
+
|
|
10
14
|
var _updateArrayWithDefault = require("../utils/updateArrayWithDefault");
|
|
15
|
+
|
|
11
16
|
var _constants = require("../../../constants");
|
|
12
|
-
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
13
20
|
const defaultPublicFolders = [{
|
|
14
21
|
// source must be relative path not absolute path
|
|
15
22
|
source: 'public',
|
|
@@ -17,12 +24,15 @@ const defaultPublicFolders = [{
|
|
|
17
24
|
target: 'public',
|
|
18
25
|
toType: 'dir'
|
|
19
26
|
}];
|
|
27
|
+
|
|
20
28
|
function folderPatterns(publicFolders) {
|
|
21
29
|
return publicFolders.map(conf => {
|
|
22
30
|
const publicFolderActualPath = (0, _constants.joinWithAppPath)(conf.source);
|
|
31
|
+
|
|
23
32
|
if (!conf.source || !conf.target || _path.default.isAbsolute(conf.source) || !(0, _fs.existsSync)(publicFolderActualPath)) {
|
|
24
33
|
return null;
|
|
25
34
|
}
|
|
35
|
+
|
|
26
36
|
return {
|
|
27
37
|
from: publicFolderActualPath,
|
|
28
38
|
to: conf.target,
|
|
@@ -30,19 +40,24 @@ function folderPatterns(publicFolders) {
|
|
|
30
40
|
};
|
|
31
41
|
}).filter(Boolean);
|
|
32
42
|
}
|
|
43
|
+
|
|
33
44
|
function configCopyPublicFolders(options) {
|
|
34
45
|
let {
|
|
35
46
|
publicFolders,
|
|
36
47
|
mode = 'dev'
|
|
37
48
|
} = options;
|
|
38
49
|
publicFolders = (0, _updateArrayWithDefault.updateArrayWithDefault)(publicFolders[mode], defaultPublicFolders);
|
|
50
|
+
|
|
39
51
|
if (publicFolders.length === 0) {
|
|
40
52
|
return null;
|
|
41
53
|
}
|
|
54
|
+
|
|
42
55
|
const patterns = folderPatterns(publicFolders);
|
|
56
|
+
|
|
43
57
|
if (patterns.length === 0) {
|
|
44
58
|
return null;
|
|
45
59
|
}
|
|
60
|
+
|
|
46
61
|
return new _copyWebpackPlugin.default({
|
|
47
62
|
patterns
|
|
48
63
|
});
|
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configCustomAttributesPlugin = configCustomAttributesPlugin;
|
|
7
|
+
|
|
7
8
|
var _custom_attribute_plugin = require("../custom_plugins/custom_attribute_plugin");
|
|
9
|
+
|
|
8
10
|
function configCustomAttributesPlugin(options) {
|
|
9
11
|
const {
|
|
10
12
|
customAttributes
|
|
11
13
|
} = options;
|
|
14
|
+
|
|
12
15
|
if (customAttributes.enable) {
|
|
13
16
|
return new _custom_attribute_plugin.CustomAttributesPlugin(customAttributes);
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
return null;
|
|
16
20
|
}
|
|
@@ -4,49 +4,65 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configCustomScriptLoadingStrategyPlugin = configCustomScriptLoadingStrategyPlugin;
|
|
7
|
+
|
|
7
8
|
var _CustomScriptLoadingPlugin = require("../custom_plugins/CustomScriptLoadingPlugin");
|
|
9
|
+
|
|
8
10
|
var _utils = require("../utils");
|
|
11
|
+
|
|
9
12
|
const defaultScriptLoadingStrategy = 'defer';
|
|
10
13
|
const allowedScriptLoadingStrategies = ['blocking', 'defer', 'async', 'module'];
|
|
14
|
+
|
|
11
15
|
function isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey) {
|
|
12
16
|
return allowedScriptLoadingStrategies.includes(scriptLoadingStategey);
|
|
13
17
|
}
|
|
18
|
+
|
|
14
19
|
function getScriptLoadingStrategyForStringType(scriptLoadingStategey) {
|
|
15
20
|
if (isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey)) {
|
|
16
21
|
return scriptLoadingStategey;
|
|
17
22
|
}
|
|
23
|
+
|
|
18
24
|
return defaultScriptLoadingStrategy;
|
|
19
25
|
}
|
|
26
|
+
|
|
20
27
|
function getScriptLoadingStrategyForObject(scriptLoadingStategey) {
|
|
21
28
|
if (Object.keys(scriptLoadingStategey).length === 0) {
|
|
22
29
|
return defaultScriptLoadingStrategy;
|
|
23
30
|
}
|
|
31
|
+
|
|
24
32
|
const isAllowedScriptLoadingStrategy = Object.keys(scriptLoadingStategey).every(key => isAllowedScriptLoadingStrategyUsed(key));
|
|
33
|
+
|
|
25
34
|
if (isAllowedScriptLoadingStrategy) {
|
|
26
35
|
return Object.assign({}, scriptLoadingStategey);
|
|
27
36
|
}
|
|
37
|
+
|
|
28
38
|
console.warn('un supported script loading strategy used', scriptLoadingStategey);
|
|
29
39
|
return defaultScriptLoadingStrategy;
|
|
30
40
|
}
|
|
41
|
+
|
|
31
42
|
function getScriptLoadingStrategy(scriptLoadingStategey) {
|
|
32
43
|
if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'string') {
|
|
33
44
|
return {
|
|
34
45
|
[getScriptLoadingStrategyForStringType(scriptLoadingStategey)]: [/.*/]
|
|
35
46
|
};
|
|
36
47
|
}
|
|
48
|
+
|
|
37
49
|
if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'object') {
|
|
38
50
|
return getScriptLoadingStrategyForObject(scriptLoadingStategey);
|
|
39
51
|
}
|
|
52
|
+
|
|
40
53
|
return {
|
|
41
54
|
[defaultScriptLoadingStrategy]: [/.*/]
|
|
42
55
|
};
|
|
43
56
|
}
|
|
57
|
+
|
|
44
58
|
function configCustomScriptLoadingStrategyPlugin(options) {
|
|
45
59
|
const {
|
|
46
60
|
customScriptLoadingStrategey
|
|
47
61
|
} = options;
|
|
62
|
+
|
|
48
63
|
if (customScriptLoadingStrategey) {
|
|
49
64
|
const currentScriptLoadingStrategy = getScriptLoadingStrategy(customScriptLoadingStrategey.options);
|
|
65
|
+
|
|
50
66
|
if ((0, _utils.getTypeOf)(currentScriptLoadingStrategy) === 'object') {
|
|
51
67
|
return new _CustomScriptLoadingPlugin.CustomScriptLoadingStrategyPlugin({
|
|
52
68
|
scriptLoadingStategey: currentScriptLoadingStrategy
|
|
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configEFCTemplatePlugin = configEFCTemplatePlugin;
|
|
7
|
+
|
|
7
8
|
var _nameTemplates = require("../common/nameTemplates");
|
|
9
|
+
|
|
8
10
|
var _EFCTemplatePlugin = require("../custom_plugins/EFCTemplatePlugin");
|
|
11
|
+
|
|
9
12
|
function configEFCTemplatePlugin(options) {
|
|
10
13
|
const {
|
|
11
14
|
publicPath
|
|
@@ -24,9 +27,11 @@ function configEFCTemplatePlugin(options) {
|
|
|
24
27
|
version,
|
|
25
28
|
templateFilePath
|
|
26
29
|
} = options.efc;
|
|
30
|
+
|
|
27
31
|
if (!hasEFC || !createSDkFile) {
|
|
28
32
|
return false;
|
|
29
33
|
}
|
|
34
|
+
|
|
30
35
|
const i18nFileNameTemplate = (0, _nameTemplates.nameTemplates)('i18njs', options);
|
|
31
36
|
return new _EFCTemplatePlugin.EFCTemplatePlugin({
|
|
32
37
|
entryPointName,
|
|
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configEnvVariables = configEnvVariables;
|
|
7
|
+
|
|
7
8
|
var _webpack = require("webpack");
|
|
9
|
+
|
|
8
10
|
var _modeUtils = require("../common/modeUtils");
|
|
11
|
+
|
|
9
12
|
function getDevEnvs(NODE_ENV) {
|
|
10
13
|
return {
|
|
11
14
|
__CLIENT__: true,
|
|
@@ -20,6 +23,7 @@ function getDevEnvs(NODE_ENV) {
|
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
25
|
}
|
|
26
|
+
|
|
23
27
|
function getProdEnvs(isDevelopment) {
|
|
24
28
|
return {
|
|
25
29
|
__CLIENT__: true,
|
|
@@ -33,6 +37,7 @@ function getProdEnvs(isDevelopment) {
|
|
|
33
37
|
}
|
|
34
38
|
};
|
|
35
39
|
}
|
|
40
|
+
|
|
36
41
|
function configEnvVariables(options) {
|
|
37
42
|
// const mode = getWebpackMode(options);
|
|
38
43
|
const {
|
|
@@ -4,10 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configHtmlWebpackPlugin = configHtmlWebpackPlugin;
|
|
7
|
+
|
|
7
8
|
var _constants = require("../../../constants");
|
|
9
|
+
|
|
8
10
|
var _nameTemplates = require("../common/nameTemplates");
|
|
11
|
+
|
|
9
12
|
var _modeUtils = require("../common/modeUtils");
|
|
13
|
+
|
|
10
14
|
var _InitialHtmlPlugin = require("../custom_plugins/InitialHtmlPlugin");
|
|
15
|
+
|
|
11
16
|
function configHtmlWebpackPlugin(options) {
|
|
12
17
|
const {
|
|
13
18
|
htmlTemplate,
|
|
@@ -18,8 +23,7 @@ function configHtmlWebpackPlugin(options) {
|
|
|
18
23
|
templateFile
|
|
19
24
|
} = htmlTemplate;
|
|
20
25
|
const appInitialHTMLTemplatePath = (0, _constants.joinWithAppPath)(templateFile);
|
|
21
|
-
const minifyHtmlOptions = (0, _modeUtils.isProductionMode)(mode) ?
|
|
22
|
-
// eslint-disable-next-line no-use-before-define
|
|
26
|
+
const minifyHtmlOptions = (0, _modeUtils.isProductionMode)(mode) ? // eslint-disable-next-line no-use-before-define
|
|
23
27
|
getHTMLMinifyOptions(htmlTemplate) : false;
|
|
24
28
|
return new _InitialHtmlPlugin.InitialHtmlPlugin({
|
|
25
29
|
mainChunkName: 'main',
|
|
@@ -30,6 +34,7 @@ function configHtmlWebpackPlugin(options) {
|
|
|
30
34
|
scriptLoading: 'defer'
|
|
31
35
|
});
|
|
32
36
|
}
|
|
37
|
+
|
|
33
38
|
const defaultHTMLMiniFyOption = {
|
|
34
39
|
collapseWhitespace: true,
|
|
35
40
|
minifyCSS: true,
|
|
@@ -41,6 +46,7 @@ const defaultHTMLMiniFyOption = {
|
|
|
41
46
|
removeStyleLinkTypeAttributes: true,
|
|
42
47
|
useShortDoctype: true
|
|
43
48
|
};
|
|
49
|
+
|
|
44
50
|
function getHTMLMinifyOptions(htmlTemplate) {
|
|
45
51
|
const {
|
|
46
52
|
minify
|
|
@@ -4,22 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = configI18nIndexingPlugin;
|
|
7
|
+
|
|
7
8
|
var _I18nNumericIndexPlugin = _interopRequireDefault(require("../custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin"));
|
|
9
|
+
|
|
8
10
|
var _resourceBasedPublicPath = require("../common/resourceBasedPublicPath");
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function configI18nIndexingPlugin(config) {
|
|
11
15
|
const {
|
|
12
16
|
i18nIndexing,
|
|
13
17
|
cdnMapping
|
|
14
18
|
} = config;
|
|
19
|
+
|
|
15
20
|
if (!i18nIndexing || !i18nIndexing.enable) {
|
|
16
21
|
return null;
|
|
17
|
-
}
|
|
22
|
+
} // Get the public path for i18n resources
|
|
23
|
+
|
|
18
24
|
|
|
19
|
-
// Get the
|
|
20
|
-
const i18nPublicPath = (0, _resourceBasedPublicPath.resourceBasedPublicPath)('i18n', config);
|
|
25
|
+
const i18nPublicPath = (0, _resourceBasedPublicPath.resourceBasedPublicPath)('i18n', config); // Get the CDN template for i18n resources if CDN is enabled
|
|
21
26
|
|
|
22
|
-
// Get the CDN template for i18n resources if CDN is enabled
|
|
23
27
|
const i18nCdnTemplate = cdnMapping && cdnMapping.isCdnEnabled ? cdnMapping.i18nTemplate || cdnMapping.jsTemplate : '';
|
|
24
28
|
const options = {
|
|
25
29
|
jsResourcePath: i18nIndexing.jsResourcePath,
|
|
@@ -4,13 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = configI18nNumericHtmlInjector;
|
|
7
|
+
|
|
7
8
|
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
9
12
|
const pluginName = 'I18nNumericHtmlInjectorPlugin';
|
|
13
|
+
|
|
10
14
|
class I18nNumericHtmlInjectorPlugin {
|
|
11
15
|
constructor(options) {
|
|
12
16
|
this.options = options;
|
|
13
17
|
}
|
|
18
|
+
|
|
14
19
|
apply(compiler) {
|
|
15
20
|
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
16
21
|
// Hook into HtmlWebpackPlugin to inject i18n script tags
|
|
@@ -25,55 +30,56 @@ class I18nNumericHtmlInjectorPlugin {
|
|
|
25
30
|
i18nCdnTemplate,
|
|
26
31
|
customGroups
|
|
27
32
|
} = this.options;
|
|
28
|
-
const newI18nAssets = [];
|
|
33
|
+
const newI18nAssets = []; // Add numeric i18n chunk
|
|
29
34
|
|
|
30
|
-
// Add numeric i18n chunk
|
|
31
35
|
if (numericFilenameTemplate) {
|
|
32
|
-
const numericFilename = numericFilenameTemplate.replace(/\[locale\]/g, htmlTemplateLabel).replace(/%5Blocale%5D/g, htmlTemplateLabel);
|
|
33
|
-
|
|
36
|
+
const numericFilename = numericFilenameTemplate.replace(/\[locale\]/g, htmlTemplateLabel).replace(/%5Blocale%5D/g, htmlTemplateLabel); // Don't add CDN template - HtmlWebpackPlugin handles it
|
|
37
|
+
|
|
34
38
|
newI18nAssets.push(numericFilename);
|
|
35
|
-
}
|
|
39
|
+
} // Add dynamic i18n chunk
|
|
40
|
+
|
|
36
41
|
|
|
37
|
-
// Add dynamic i18n chunk
|
|
38
42
|
if (dynamicFilenameTemplate) {
|
|
39
|
-
const dynamicFilename = dynamicFilenameTemplate.replace(/\[locale\]/g, htmlTemplateLabel).replace(/%5Blocale%5D/g, htmlTemplateLabel);
|
|
40
|
-
|
|
43
|
+
const dynamicFilename = dynamicFilenameTemplate.replace(/\[locale\]/g, htmlTemplateLabel).replace(/%5Blocale%5D/g, htmlTemplateLabel); // Don't add CDN template - HtmlWebpackPlugin handles it
|
|
44
|
+
|
|
41
45
|
newI18nAssets.push(dynamicFilename);
|
|
42
|
-
}
|
|
46
|
+
} // Add custom group chunks if they should be in initial HTML
|
|
47
|
+
|
|
43
48
|
|
|
44
|
-
// Add custom group chunks if they should be in initial HTML
|
|
45
49
|
if (customGroups) {
|
|
46
50
|
Object.entries(customGroups).forEach(([groupName, groupConfig]) => {
|
|
47
51
|
// Only add to initial HTML if preload is true
|
|
48
52
|
if (groupConfig.preload && groupConfig.filenameTemplate) {
|
|
49
|
-
const groupFilename = groupConfig.filenameTemplate.replace(/\[locale\]/g, htmlTemplateLabel).replace(/%5Blocale%5D/g, htmlTemplateLabel);
|
|
50
|
-
|
|
53
|
+
const groupFilename = groupConfig.filenameTemplate.replace(/\[locale\]/g, htmlTemplateLabel).replace(/%5Blocale%5D/g, htmlTemplateLabel); // Don't add CDN template - HtmlWebpackPlugin handles it
|
|
54
|
+
|
|
51
55
|
newI18nAssets.push(groupFilename);
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
|
-
}
|
|
58
|
+
} // Prepend i18n assets to ensure they load before main bundle
|
|
59
|
+
|
|
55
60
|
|
|
56
|
-
// Prepend i18n assets to ensure they load before main bundle
|
|
57
61
|
if (newI18nAssets.length > 0) {
|
|
58
62
|
assets.js = [...newI18nAssets, ...assets.js];
|
|
59
63
|
}
|
|
64
|
+
|
|
60
65
|
return hookData;
|
|
61
66
|
});
|
|
62
67
|
});
|
|
63
68
|
}
|
|
69
|
+
|
|
64
70
|
}
|
|
71
|
+
|
|
65
72
|
function configI18nNumericHtmlInjector(config) {
|
|
66
73
|
const {
|
|
67
74
|
i18nIndexing,
|
|
68
75
|
cdnMapping
|
|
69
|
-
} = config;
|
|
76
|
+
} = config; // Only create this plugin if i18nIndexing is enabled
|
|
70
77
|
|
|
71
|
-
// Only create this plugin if i18nIndexing is enabled
|
|
72
78
|
if (!i18nIndexing || !i18nIndexing.enable) {
|
|
73
79
|
return null;
|
|
74
|
-
}
|
|
80
|
+
} // Get the CDN template for i18n resources if CDN is enabled
|
|
81
|
+
|
|
75
82
|
|
|
76
|
-
// Get the CDN template for i18n resources if CDN is enabled
|
|
77
83
|
const i18nCdnTemplate = cdnMapping && cdnMapping.isCdnEnabled ? cdnMapping.i18nTemplate || cdnMapping.jsTemplate : '';
|
|
78
84
|
const options = {
|
|
79
85
|
numericFilenameTemplate: i18nIndexing.numericFilenameTemplate || 'i18n-chunk/[locale]/numeric.i18n.js',
|
|
@@ -4,27 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configI18nNumericIndexPlugin = configI18nNumericIndexPlugin;
|
|
7
|
+
|
|
7
8
|
var _I18nNumericIndexPlugin = _interopRequireDefault(require("../custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin"));
|
|
9
|
+
|
|
8
10
|
var _I18nNumericIndexHtmlInjectorPlugin = require("../custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin");
|
|
11
|
+
|
|
9
12
|
var _readI18nValues = require("../custom_plugins/I18nSplitPlugin/readI18nValues");
|
|
13
|
+
|
|
10
14
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
12
18
|
function configI18nNumericIndexPlugin(options) {
|
|
13
19
|
if (!(options.i18nIndexing && options.i18nIndexing.enable)) {
|
|
14
20
|
return null;
|
|
15
21
|
}
|
|
22
|
+
|
|
16
23
|
const i18nOpts = options.i18nIndexing;
|
|
17
24
|
const isDevelopment = options.isDevelopment || false; // Get isDevelopment from options
|
|
18
|
-
|
|
19
25
|
// Validate required options
|
|
26
|
+
|
|
20
27
|
const requiredOptions = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath', 'jsonpFunc', 'htmlTemplateLabel', 'localeVarName'];
|
|
21
28
|
const missingOptions = requiredOptions.filter(opt => !i18nOpts[opt]);
|
|
29
|
+
|
|
22
30
|
if (missingOptions.length > 0) {
|
|
23
31
|
console.warn(`[I18nNumericIndexPlugin] Missing required options: ${missingOptions.join(', ')}`);
|
|
24
32
|
return null;
|
|
25
|
-
}
|
|
33
|
+
} // Read i18n values
|
|
34
|
+
|
|
26
35
|
|
|
27
|
-
// Read i18n values
|
|
28
36
|
const {
|
|
29
37
|
locales,
|
|
30
38
|
allI18nObject
|
|
@@ -32,27 +40,29 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
32
40
|
jsResource: i18nOpts.jsResourcePath,
|
|
33
41
|
propertiesFolder: i18nOpts.propertiesFolderPath,
|
|
34
42
|
disableDefault: false
|
|
35
|
-
});
|
|
43
|
+
}); // Ensure templates have [locale] placeholder
|
|
36
44
|
|
|
37
|
-
// Ensure templates have [locale] placeholder
|
|
38
45
|
const numericTemplate = i18nOpts.numericFilenameTemplate || '[locale]/numeric.i18n.js';
|
|
39
46
|
const dynamicTemplate = i18nOpts.dynamicFilenameTemplate || '[locale]/dynamic.i18n.js';
|
|
47
|
+
|
|
40
48
|
if (!numericTemplate.includes('[locale]')) {
|
|
41
49
|
console.warn('[I18nNumericIndexPlugin] numericFilenameTemplate must include [locale] placeholder');
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
52
|
+
|
|
44
53
|
if (!dynamicTemplate.includes('[locale]')) {
|
|
45
54
|
console.warn('[I18nNumericIndexPlugin] dynamicFilenameTemplate must include [locale] placeholder');
|
|
46
55
|
return null;
|
|
47
|
-
}
|
|
56
|
+
} // Resolve singleFileTemplate if it's a function
|
|
57
|
+
|
|
48
58
|
|
|
49
|
-
// Resolve singleFileTemplate if it's a function
|
|
50
59
|
let resolvedSingleFileTemplate = i18nOpts.singleFileTemplate || '[locale].js';
|
|
60
|
+
|
|
51
61
|
if (typeof i18nOpts.singleFileTemplate === 'function') {
|
|
52
62
|
resolvedSingleFileTemplate = i18nOpts.singleFileTemplate(isDevelopment);
|
|
53
|
-
}
|
|
63
|
+
} // Plugin options
|
|
64
|
+
|
|
54
65
|
|
|
55
|
-
// Plugin options
|
|
56
66
|
const numericIndexPluginOptions = {
|
|
57
67
|
enable: i18nOpts.enable,
|
|
58
68
|
outputFolder: i18nOpts.outputFolder || 'i18n-chunk',
|
|
@@ -71,10 +81,12 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
71
81
|
generateManifest: i18nOpts.generateManifest || false,
|
|
72
82
|
manifestPath: i18nOpts.manifestPath || null,
|
|
73
83
|
customGroups: i18nOpts.customGroups || null,
|
|
84
|
+
emitFiles: i18nOpts.emitFiles !== undefined ? i18nOpts.emitFiles : true,
|
|
85
|
+
// Control file emission
|
|
74
86
|
isDevelopment: isDevelopment // Pass through for reference
|
|
75
|
-
};
|
|
76
87
|
|
|
77
|
-
// HTML injector options
|
|
88
|
+
}; // HTML injector options
|
|
89
|
+
|
|
78
90
|
const htmlInjectorOptions = {
|
|
79
91
|
outputFolder: i18nOpts.outputFolder || 'i18n-chunk',
|
|
80
92
|
numericFilenameTemplate: numericTemplate,
|
|
@@ -84,6 +96,8 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
84
96
|
singleFile: i18nOpts.singleFile || false,
|
|
85
97
|
i18nAssetsPublicPathPrefix: '',
|
|
86
98
|
// HtmlWebpackPlugin handles publicPath
|
|
99
|
+
injectI18nUrlInIndex: i18nOpts.injectI18nUrlInIndex !== undefined ? i18nOpts.injectI18nUrlInIndex : true,
|
|
100
|
+
// Control HTML injection
|
|
87
101
|
isDevelopment: isDevelopment
|
|
88
102
|
};
|
|
89
103
|
const i18nNumericPluginInstance = new _I18nNumericIndexPlugin.default(numericIndexPluginOptions);
|
|
@@ -4,19 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configI18nSplitPlugin = configI18nSplitPlugin;
|
|
7
|
+
|
|
7
8
|
var _nameTemplates = require("../common/nameTemplates");
|
|
9
|
+
|
|
8
10
|
var _I18nSplitPlugin = _interopRequireDefault(require("../custom_plugins/I18nSplitPlugin"));
|
|
11
|
+
|
|
9
12
|
var _resourceBasedPublicPath = require("../common/resourceBasedPublicPath");
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
11
16
|
function configI18nSplitPlugin(options) {
|
|
12
17
|
const {
|
|
13
18
|
i18nChunkSplit
|
|
14
19
|
} = options;
|
|
20
|
+
|
|
15
21
|
if (!i18nChunkSplit.chunkSplitEnable) {
|
|
16
22
|
return null;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
// const i18nPublicPathAsExpression = publicPathAsExpression('i18n', options);
|
|
24
|
+
|
|
25
|
+
const i18nPublicPath = (0, _resourceBasedPublicPath.resourceBasedPublicPath)('i18n', options); // const i18nPublicPathAsExpression = publicPathAsExpression('i18n', options);
|
|
20
26
|
|
|
21
27
|
return new _I18nSplitPlugin.default({
|
|
22
28
|
mainChunkName: 'main',
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configIgnorePlugin = configIgnorePlugin;
|
|
7
|
+
|
|
7
8
|
var _webpack = require("webpack");
|
|
9
|
+
|
|
8
10
|
// eslint-disable-next-line no-unused-vars
|
|
9
11
|
function configIgnorePlugin(options) {
|
|
10
12
|
return new _webpack.IgnorePlugin({
|
|
@@ -4,21 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configManifestJsonPlugin = configManifestJsonPlugin;
|
|
7
|
+
|
|
7
8
|
var _ManifestJsonPlugin = require("../custom_plugins/ManifestJsonPlugin");
|
|
9
|
+
|
|
8
10
|
function configManifestJsonPlugin(options) {
|
|
9
11
|
const {
|
|
10
12
|
enable,
|
|
11
13
|
i18nManifestJson,
|
|
12
14
|
licenseManifest
|
|
13
15
|
} = options.manifestJson;
|
|
16
|
+
|
|
14
17
|
if (!enable) {
|
|
15
18
|
return null;
|
|
16
19
|
}
|
|
20
|
+
|
|
17
21
|
const params = [{
|
|
18
22
|
outputJsonFileName: 'manifest.json',
|
|
19
23
|
test: f => !/\.i18n\.js$|\.LICENSE\.txt$|\.map$/.test(f),
|
|
20
24
|
needInitialEntries: true
|
|
21
25
|
}];
|
|
26
|
+
|
|
22
27
|
if (i18nManifestJson) {
|
|
23
28
|
params.push({
|
|
24
29
|
outputJsonFileName: 'i18nManifest.json',
|
|
@@ -26,6 +31,7 @@ function configManifestJsonPlugin(options) {
|
|
|
26
31
|
needInitialEntries: false
|
|
27
32
|
});
|
|
28
33
|
}
|
|
34
|
+
|
|
29
35
|
if (licenseManifest) {
|
|
30
36
|
params.push({
|
|
31
37
|
outputJsonFileName: 'licenseManifest.json',
|
|
@@ -33,5 +39,6 @@ function configManifestJsonPlugin(options) {
|
|
|
33
39
|
needInitialEntries: false
|
|
34
40
|
});
|
|
35
41
|
}
|
|
42
|
+
|
|
36
43
|
return new _ManifestJsonPlugin.AddFileToManifestJson(params);
|
|
37
44
|
}
|
|
@@ -4,15 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configMiniCSSExtractPlugin = configMiniCSSExtractPlugin;
|
|
7
|
+
|
|
7
8
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
9
|
+
|
|
8
10
|
var _nameTemplates = require("../common/nameTemplates");
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
function configMiniCSSExtractPlugin(options) {
|
|
11
15
|
const {
|
|
12
16
|
enableRTLSplit
|
|
13
17
|
} = options.css.plugins.rtlSplit;
|
|
14
|
-
const cssLTRFileNameTempalte = enableRTLSplit ? (0, _nameTemplates.nameTemplates)('cssdir', options) : (0, _nameTemplates.nameTemplates)('css', options);
|
|
15
|
-
|
|
18
|
+
const cssLTRFileNameTempalte = enableRTLSplit ? (0, _nameTemplates.nameTemplates)('cssdir', options) : (0, _nameTemplates.nameTemplates)('css', options); // eslint-disable-next-line no-undef
|
|
19
|
+
|
|
16
20
|
return new _miniCssExtractPlugin.default({
|
|
17
21
|
filename: cssLTRFileNameTempalte,
|
|
18
22
|
chunkFilename: cssLTRFileNameTempalte
|