@zohodesk/client_build_tool 0.0.11-exp.16 → 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.
- package/README.md +0 -204
- package/README_backup.md +0 -204
- package/docs/DYNAMIC_TEMPLATE_EXAMPLE.md +129 -0
- package/docs/I18N_NUMERIC_INDEXING_PLUGIN.md +225 -0
- package/docs/I18N_SINGLE_FILE_MODE.md +126 -0
- package/docs/client_build_tool_source_doc.md +390 -0
- package/example-single-file-config.js +59 -0
- package/lib/allCommandsConfigs.js +2 -7
- package/lib/commands/build/commandExecutor.js +1 -5
- package/lib/commands/build/config.js +2 -3
- package/lib/commands/build/optionsProcessor.js +2 -5
- package/lib/commands/build/preProcessor.js +0 -2
- package/lib/commands/buildEs/commandExecutor.js +0 -5
- package/lib/commands/buildEs/config.js +2 -3
- package/lib/commands/buildEs/preProcessor.js +0 -2
- package/lib/commands/buildLib/commandExecutor.js +0 -5
- package/lib/commands/buildLib/config.js +2 -3
- package/lib/commands/buildLib/preProcessor.js +0 -2
- package/lib/commands/mockserver/commandExecutor.js +2 -9
- package/lib/commands/mockserver/config.js +2 -3
- package/lib/commands/pre_process/commandExecutor.js +0 -2
- package/lib/commands/pre_process/config.js +2 -3
- package/lib/commands/start/commandExecutor.js +0 -2
- package/lib/commands/start/config.js +2 -3
- package/lib/commands/start/optionsProcessor.js +2 -4
- package/lib/commands/start/preProcessor.js +0 -2
- package/lib/commands/template/commandExecutor.js +0 -7
- package/lib/commands/template/config.js +2 -3
- package/lib/commands/version/commandExecutor.js +0 -3
- package/lib/commands/version/config.js +2 -3
- package/lib/commandsRouter.js +5 -21
- package/lib/index.js +0 -2
- package/lib/logger.js +0 -5
- package/lib/schemas/applyValuesToSchema/index.js +0 -8
- package/lib/schemas/applyValuesToSchema/isObject.js +0 -1
- package/lib/schemas/applyValuesToSchema/isValid.js +0 -2
- package/lib/schemas/cliArgsToObject.js +2 -6
- package/lib/schemas/defaultConfigValues.js +31 -7
- package/lib/schemas/defaultConfigValuesOnly.js +4 -7
- package/lib/schemas/deprecatedOptionsHandler.js +7 -16
- package/lib/schemas/getNpmVersion.js +0 -5
- package/lib/schemas/giveDefaultValue.js +0 -3
- package/lib/schemas/npmConfigToObject.js +2 -5
- package/lib/schemas/readOptions.js +10 -30
- package/lib/schemas/readOptionsForConfigFile.js +2 -12
- package/lib/shared/babel/addDefaultPlugins.js +0 -2
- package/lib/shared/babel/babelWebConfig.js +1 -10
- package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -4
- package/lib/shared/babel/getBabelPlugin.js +2 -7
- package/lib/shared/babel/runBabelForJSFile.js +1 -4
- package/lib/shared/babel/runBabelForTsFile.js +1 -5
- package/lib/shared/bundler/webpack/common/decidePublicPath.js +0 -5
- package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
- package/lib/shared/bundler/webpack/common/modeUtils.js +0 -5
- package/lib/shared/bundler/webpack/common/nameTemplates.js +11 -18
- package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +2 -3
- package/lib/shared/bundler/webpack/configCustomLoaders.js +0 -1
- package/lib/shared/bundler/webpack/cssLoaders.js +0 -2
- package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +1 -20
- package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +20 -25
- package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +4 -9
- package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +3 -23
- package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +8 -19
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +120 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +81 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +328 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +135 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +5 -26
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +13 -16
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +19 -53
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +2 -17
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +11 -21
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +4 -14
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +3 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +3 -12
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +2 -7
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +2 -3
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +2 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +8 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -14
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +1 -3
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -22
- package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +3 -10
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +1 -6
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +1 -6
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -6
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -7
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +13 -17
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +6 -15
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +4 -13
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +4 -6
- package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -10
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -3
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +4 -20
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +10 -12
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +2 -3
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +7 -20
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +7 -10
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +1 -6
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +1 -16
- package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +4 -11
- package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +3 -10
- package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +27 -62
- package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +3 -15
- package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +2 -12
- package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +2 -7
- package/lib/shared/bundler/webpack/defaultVendorPatternList.js +2 -6
- package/lib/shared/bundler/webpack/devtoolConfig.js +0 -1
- package/lib/shared/bundler/webpack/entryConfig.js +0 -4
- package/lib/shared/bundler/webpack/externals.js +0 -1
- package/lib/shared/bundler/webpack/getCSSLoaders.js +1 -6
- package/lib/shared/bundler/webpack/getFilenameFromModule.js +1 -5
- package/lib/shared/bundler/webpack/jsLoaders.js +23 -4
- package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -2
- package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +2 -3
- package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +3 -12
- package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -1
- package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +2 -10
- package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -2
- package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -12
- package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +1 -15
- package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +1 -4
- package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +72 -0
- package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +113 -0
- package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
- package/lib/shared/bundler/webpack/loaders/workerLoader.js +8 -19
- package/lib/shared/bundler/webpack/optimizationConfig.js +5 -13
- package/lib/shared/bundler/webpack/outputConfig.js +1 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +5 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +4 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +3 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +1 -16
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -16
- package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +2 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +38 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +86 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +92 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +3 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -2
- package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -7
- package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +3 -7
- package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +1 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +1 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +3 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +1 -6
- package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +3 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +1 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +1 -6
- package/lib/shared/bundler/webpack/plugins.js +3 -24
- package/lib/shared/bundler/webpack/resolvers.js +3 -17
- package/lib/shared/bundler/webpack/splitChunksConfig.js +2 -15
- package/lib/shared/bundler/webpack/statsConfig.js +2 -5
- package/lib/shared/bundler/webpack/tsLoaders.js +2 -4
- package/lib/shared/bundler/webpack/utils/index.js +1 -12
- package/lib/shared/bundler/webpack/utils/object-manipulation.js +2 -16
- package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -7
- package/lib/shared/bundler/webpack/webpackBuild.js +1 -8
- package/lib/shared/bundler/webpack/webpackConfig.js +0 -17
- package/lib/shared/commands-utils/doBasicRequirementCheck.js +0 -3
- package/lib/shared/commands-utils/getCliPath.js +5 -9
- package/lib/shared/commands-utils/index.js +0 -3
- package/lib/shared/commands-utils/log.js +0 -2
- package/lib/shared/commands-utils/readArgsFormCommandLine.js +0 -1
- package/lib/shared/commands-utils/readOptionFormCommandLine.js +0 -1
- package/lib/shared/commands-utils/spawnSyncIO.js +5 -13
- package/lib/shared/constants.js +9 -29
- package/lib/shared/fileUtils/copyFile.js +1 -8
- package/lib/shared/fileUtils/directoryIterator.js +0 -4
- package/lib/shared/fileUtils/watchRun.js +3 -24
- package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +1 -6
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +2 -3
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +6 -13
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +6 -26
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +6 -9
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -3
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +2 -7
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -2
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +4 -9
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -10
- package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +16 -29
- package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -17
- package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +4 -9
- package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +28 -64
- package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +5 -13
- package/lib/shared/postcss/getAllowedPostCssPlugins.js +0 -3
- package/lib/shared/postcss/getSpecificPostCssPlugin.js +7 -17
- package/lib/shared/postcss/runPostCssForCssFile.js +1 -9
- package/lib/shared/pre_process/runPreProcess.js +0 -11
- package/lib/shared/server/configWebpackDevMiddleware.js +1 -8
- package/lib/shared/server/corsHandling.js +2 -6
- package/lib/shared/server/getIp.js +1 -7
- package/lib/shared/server/getServerURL.js +0 -6
- package/lib/shared/server/httpsOptions.js +0 -11
- package/lib/shared/server/initExpressApp.js +1 -4
- package/lib/shared/server/initialHTMLHandling.js +7 -16
- package/lib/shared/server/mockApiHandler.js +8 -16
- package/lib/shared/server/mockServer.js +0 -7
- package/lib/shared/server/serveContextFiles.js +1 -5
- package/lib/shared/server/serverBywebpackDevMiddleware.js +4 -9
- package/lib/shared/server/startHttpServer.js +0 -3
- package/lib/shared/server/startHttpsServer.js +1 -9
- package/lib/shared/server/unwanted/addHttp2Server.js +2 -7
- package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +1 -8
- package/lib/shared/server/unwanted/mockApiSupport.js +0 -2
- package/lib/shared/server/unwanted/websocketMockSetup.js +1 -7
- package/lib/shared/server/urlConcat.js +3 -8
- package/lib/shared/utils/requireLocalOrGlobal.js +10 -25
- package/lib/shared/utils/versionPrint.js +1 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/client_build_tool/test-i18n-config.js +22 -0
|
@@ -4,30 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configPostCssLoader = configPostCssLoader;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _filterPluginsAllowedForSpecficFile = require("../../../postcss/filterPluginsAllowedForSpecficFile");
|
|
11
|
-
|
|
12
9
|
var _getAllowedPostCssPlugins = require("../../../postcss/getAllowedPostCssPlugins");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../../constants");
|
|
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
|
// import EmptyPlugin from '../custom_postcss_plugins/EmptyPlugin';
|
|
13
|
+
|
|
19
14
|
function configPostCssLoader(options) {
|
|
20
15
|
const pluginsOptions = options.css.plugins;
|
|
21
16
|
const enabledPlugins = (0, _filterPluginsAllowedForSpecficFile.getEnabledPlugins)(pluginsOptions);
|
|
22
17
|
const getAllowedPostCssPlugins = (0, _getAllowedPostCssPlugins.postcssPluginGetter)(options);
|
|
23
|
-
|
|
24
18
|
function configPostCssPlugins(params) {
|
|
25
19
|
const filename = _path.default.relative(_constants.appPath, params.resourcePath);
|
|
26
|
-
|
|
27
20
|
const allowedPostCssPlugins = getAllowedPostCssPlugins(filename);
|
|
28
21
|
return allowedPostCssPlugins;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
return enabledPlugins.length && {
|
|
32
24
|
loader: 'postcss-loader',
|
|
33
25
|
options: {
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configWebWorkerLoader = configWebWorkerLoader;
|
|
7
|
-
|
|
8
7
|
var _nameTemplates = require("../common/nameTemplates");
|
|
9
|
-
|
|
10
8
|
function configWebWorkerLoader(options) {
|
|
11
9
|
return {
|
|
12
10
|
test: /\.worker.js$/,
|
|
@@ -8,15 +8,12 @@ exports.configFontLoader = configFontLoader;
|
|
|
8
8
|
exports.configImageLoader = configImageLoader;
|
|
9
9
|
exports.configSVGLoader = configSVGLoader;
|
|
10
10
|
exports.configVideoLoader = configVideoLoader;
|
|
11
|
-
|
|
12
11
|
var _nameTemplates = require("../common/nameTemplates");
|
|
13
|
-
|
|
14
12
|
const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
|
|
15
13
|
const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
|
|
16
14
|
const SVGExtRegex = /\.svg$/;
|
|
17
15
|
const AudioExtRegex = /\.ogg|\.mp3$/;
|
|
18
16
|
const VideoExtRegex = /\.mp4|\.webm$/;
|
|
19
|
-
|
|
20
17
|
function createAssetLoader({
|
|
21
18
|
test,
|
|
22
19
|
nameTemplate,
|
|
@@ -26,27 +23,22 @@ function createAssetLoader({
|
|
|
26
23
|
test,
|
|
27
24
|
type: 'asset'
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
if (limit) {
|
|
31
27
|
conf.parser = {
|
|
32
28
|
dataUrlCondition: {
|
|
33
29
|
maxSize: limit // 4 * 1024 // 4kb
|
|
34
|
-
|
|
35
30
|
}
|
|
36
31
|
};
|
|
37
32
|
} else {
|
|
38
33
|
conf.type = 'asset/resource';
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
if (nameTemplate) {
|
|
42
36
|
conf.generator = {
|
|
43
37
|
filename: nameTemplate
|
|
44
38
|
};
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
return conf;
|
|
48
41
|
}
|
|
49
|
-
|
|
50
42
|
function configImageLoader(options) {
|
|
51
43
|
return createAssetLoader({
|
|
52
44
|
test: ImageExtRegex,
|
|
@@ -54,7 +46,6 @@ function configImageLoader(options) {
|
|
|
54
46
|
limit: 1000
|
|
55
47
|
});
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
function configFontLoader(options) {
|
|
59
50
|
return createAssetLoader({
|
|
60
51
|
test: FontExtRegex,
|
|
@@ -62,7 +53,6 @@ function configFontLoader(options) {
|
|
|
62
53
|
limit: 1000
|
|
63
54
|
});
|
|
64
55
|
}
|
|
65
|
-
|
|
66
56
|
function configSVGLoader(options) {
|
|
67
57
|
return createAssetLoader({
|
|
68
58
|
test: SVGExtRegex,
|
|
@@ -70,14 +60,12 @@ function configSVGLoader(options) {
|
|
|
70
60
|
limit: 1000
|
|
71
61
|
});
|
|
72
62
|
}
|
|
73
|
-
|
|
74
63
|
function configAudioLoader(options) {
|
|
75
64
|
return createAssetLoader({
|
|
76
65
|
test: AudioExtRegex,
|
|
77
66
|
nameTemplate: (0, _nameTemplates.nameTemplates)('audio', options)
|
|
78
67
|
});
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
function configVideoLoader(options) {
|
|
82
70
|
return createAssetLoader({
|
|
83
71
|
test: VideoExtRegex,
|
|
@@ -5,21 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.getHash = getHash;
|
|
8
|
-
|
|
9
8
|
var _crypto = require("crypto");
|
|
10
|
-
|
|
11
9
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
|
|
13
10
|
var _checkIsPatternsMatchFilename = require("./checkIsPatternsMatchFilename");
|
|
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
|
function getHash(str, length) {
|
|
18
13
|
return (0, _crypto.createHash)('md5').update(str).digest('hex').slice(0, length);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
const defaultSelectorBlob = '[prefix]-[filename]-[local]';
|
|
22
|
-
|
|
23
16
|
function getSuitableBlob(customizations = [], filename) {
|
|
24
17
|
const custom = customizations.find(({
|
|
25
18
|
enable,
|
|
@@ -27,7 +20,6 @@ function getSuitableBlob(customizations = [], filename) {
|
|
|
27
20
|
}) => enable && (0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(patterns, filename));
|
|
28
21
|
return custom && custom.blob || defaultSelectorBlob;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
var _default = options => {
|
|
32
24
|
const {
|
|
33
25
|
classNameOptions
|
|
@@ -46,20 +38,14 @@ var _default = options => {
|
|
|
46
38
|
rootContext,
|
|
47
39
|
resourcePath
|
|
48
40
|
} = context;
|
|
49
|
-
|
|
50
41
|
const relativePath = _path.default.relative(rootContext, resourcePath);
|
|
51
|
-
|
|
52
42
|
const fileNameWithoutExt = _path.default.parse(relativePath).name;
|
|
53
|
-
|
|
54
43
|
let cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
|
|
55
|
-
|
|
56
44
|
if (cleanFileName.endsWith('.module')) {
|
|
57
45
|
cleanFileName = cleanFileName.slice(0, -7);
|
|
58
46
|
}
|
|
59
|
-
|
|
60
47
|
const suitableBlob = getSuitableBlob(customizations, resourcePath);
|
|
61
48
|
return suitableBlob.replaceAll('[local]', localName).replaceAll('[prefix]', classNamePrefix).replaceAll('[filename]', cleanFileName).replaceAll('[hash]', getHash(`${relativePath}-${localName}`, 10));
|
|
62
49
|
};
|
|
63
50
|
};
|
|
64
|
-
|
|
65
51
|
exports.default = _default;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCssLoaderOptions = getCssLoaderOptions;
|
|
7
|
-
|
|
8
7
|
var _cssClassNameGenerate = _interopRequireDefault(require("./cssClassNameGenerate"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
9
|
function getCssLoaderOptions(options) {
|
|
13
10
|
const cssLoaderOptions = {
|
|
14
11
|
importLoaders: 1,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
getPropertiesAsJSON
|
|
5
|
+
} = require('../custom_plugins/I18nSplitPlugin/utils/propertiesUtils');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Load i18n data from JSResources file once for all chunks
|
|
9
|
+
*/
|
|
10
|
+
function loadJSResourcesOnce(options) {
|
|
11
|
+
let jsResourcePath;
|
|
12
|
+
|
|
13
|
+
// Determine the JSResource path based on configuration
|
|
14
|
+
if (options.i18nIndexing && options.i18nIndexing.enable) {
|
|
15
|
+
jsResourcePath = options.i18nIndexing.jsResourcePath;
|
|
16
|
+
} else if (options.i18nChunkSplit && options.i18nChunkSplit.chunkSplitEnable && options.i18nChunkSplit.useNumericIndexing) {
|
|
17
|
+
jsResourcePath = options.i18nChunkSplit.jsResource;
|
|
18
|
+
} else {
|
|
19
|
+
throw new Error('i18nIdReplaceLoader requires either i18nIndexing to be enabled or i18nChunkSplit with useNumericIndexing');
|
|
20
|
+
}
|
|
21
|
+
if (!jsResourcePath) {
|
|
22
|
+
throw new Error('Missing required jsResourcePath in i18n options');
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const i18nData = getPropertiesAsJSON(jsResourcePath);
|
|
26
|
+
if (Object.keys(i18nData).length === 0) {
|
|
27
|
+
console.warn(`[i18nIdReplaceLoaderConfig] Warning: No i18n data found in JSResource file: ${jsResourcePath}`);
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
return i18nData;
|
|
31
|
+
} catch (err) {
|
|
32
|
+
throw new Error(`Error reading JSResource file ${jsResourcePath}: ${err.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Configure the i18n ID replace loader
|
|
38
|
+
*/
|
|
39
|
+
function i18nIdReplaceLoaderConfig(options, webpackContext) {
|
|
40
|
+
let numericMapPath;
|
|
41
|
+
|
|
42
|
+
// Determine the numeric map path based on configuration
|
|
43
|
+
if (options.i18nIndexing && options.i18nIndexing.enable) {
|
|
44
|
+
numericMapPath = options.i18nIndexing.numericMapPath;
|
|
45
|
+
} else if (options.i18nChunkSplit && options.i18nChunkSplit.chunkSplitEnable && options.i18nChunkSplit.useNumericIndexing) {
|
|
46
|
+
numericMapPath = options.i18nChunkSplit.numericMapPath;
|
|
47
|
+
} else {
|
|
48
|
+
throw new Error('i18nIdReplaceLoader requires either i18nIndexing to be enabled or i18nChunkSplit with useNumericIndexing');
|
|
49
|
+
}
|
|
50
|
+
if (!numericMapPath) {
|
|
51
|
+
throw new Error('numericMapPath is required in i18nIndexing or i18nChunkSplit config');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Load all i18n data for key detection
|
|
55
|
+
const allI18nData = loadJSResourcesOnce(options);
|
|
56
|
+
const i18nKeyReplaceLoaderPath = require.resolve('../loaders/i18nIdReplaceLoader.js');
|
|
57
|
+
const loaderOptions = {
|
|
58
|
+
allI18nData: allI18nData,
|
|
59
|
+
sourceMaps: false,
|
|
60
|
+
numericMapPath: numericMapPath,
|
|
61
|
+
devMode: options.i18nIndexing?.devMode || false,
|
|
62
|
+
includePaths: options.i18nIndexing?.loaderOptions?.includePaths || [],
|
|
63
|
+
excludePaths: options.i18nIndexing?.loaderOptions?.excludePaths || ['node_modules', 'tests']
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
loader: i18nKeyReplaceLoaderPath,
|
|
67
|
+
options: loaderOptions
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
module.exports = {
|
|
71
|
+
i18nIdReplaceLoaderConfig
|
|
72
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const parser = require('@babel/parser');
|
|
6
|
+
const traverse = require('@babel/traverse').default;
|
|
7
|
+
const generator = require('@babel/generator').default;
|
|
8
|
+
const t = require('@babel/types');
|
|
9
|
+
const {
|
|
10
|
+
getOptions
|
|
11
|
+
} = require('loader-utils');
|
|
12
|
+
module.exports = function i18nIdReplaceLoader(source, map) {
|
|
13
|
+
const resourcePath = this.resourcePath;
|
|
14
|
+
this.cacheable && this.cacheable();
|
|
15
|
+
const options = getOptions(this) || {};
|
|
16
|
+
const callback = this.async();
|
|
17
|
+
|
|
18
|
+
// Skip files in excluded paths
|
|
19
|
+
if (options.excludePaths) {
|
|
20
|
+
const shouldExclude = options.excludePaths.some(excludePath => resourcePath.includes(excludePath));
|
|
21
|
+
if (shouldExclude) {
|
|
22
|
+
return callback(null, source, map);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Only process files in included paths if specified
|
|
27
|
+
if (options.includePaths && options.includePaths.length > 0) {
|
|
28
|
+
const shouldInclude = options.includePaths.some(includePath => resourcePath.includes(includePath));
|
|
29
|
+
if (!shouldInclude) {
|
|
30
|
+
return callback(null, source, map);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Validate i18n data exists
|
|
35
|
+
if (!options.allI18nData || Object.keys(options.allI18nData).length === 0) {
|
|
36
|
+
return callback(new Error(`i18nIdReplaceLoader: 'allI18nData' option is missing or empty`));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Load numeric ID mapping
|
|
40
|
+
let numericIdMap = null;
|
|
41
|
+
if (options.numericMapPath) {
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(options.numericMapPath)) {
|
|
44
|
+
const fileContent = fs.readFileSync(options.numericMapPath, 'utf-8');
|
|
45
|
+
const parsedData = JSON.parse(fileContent);
|
|
46
|
+
|
|
47
|
+
// Handle both wrapped and flat formats
|
|
48
|
+
if (parsedData) {
|
|
49
|
+
if (parsedData.originalKeyToNumericId) {
|
|
50
|
+
// New format with wrapper
|
|
51
|
+
numericIdMap = parsedData.originalKeyToNumericId;
|
|
52
|
+
} else if (typeof parsedData === 'object') {
|
|
53
|
+
// Flat format - use directly
|
|
54
|
+
numericIdMap = parsedData;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
// Silently continue without numeric mapping
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// If no numeric map available, return source as-is
|
|
64
|
+
if (!numericIdMap) {
|
|
65
|
+
return callback(null, source, map);
|
|
66
|
+
}
|
|
67
|
+
const isDevMode = options.devMode || process.env.NODE_ENV === 'development';
|
|
68
|
+
try {
|
|
69
|
+
// Parse the JavaScript/TypeScript source code
|
|
70
|
+
const ast = parser.parse(source, {
|
|
71
|
+
sourceType: 'module',
|
|
72
|
+
plugins: ['jsx', 'typescript', 'classProperties', 'optionalChaining', 'nullishCoalescingOperator'],
|
|
73
|
+
sourceFilename: resourcePath
|
|
74
|
+
});
|
|
75
|
+
let hasTransformations = false;
|
|
76
|
+
|
|
77
|
+
// Traverse AST and replace i18n keys with numeric IDs
|
|
78
|
+
traverse(ast, {
|
|
79
|
+
StringLiteral(path) {
|
|
80
|
+
const {
|
|
81
|
+
node
|
|
82
|
+
} = path;
|
|
83
|
+
|
|
84
|
+
// Check if this string is an i18n key
|
|
85
|
+
if (!options.allI18nData.hasOwnProperty(node.value)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Replace with numeric ID if available
|
|
90
|
+
if (numericIdMap.hasOwnProperty(node.value)) {
|
|
91
|
+
const numericId = String(numericIdMap[node.value]);
|
|
92
|
+
path.replaceWith(t.stringLiteral(numericId));
|
|
93
|
+
hasTransformations = true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Generate code if transformations were made
|
|
99
|
+
if (hasTransformations) {
|
|
100
|
+
const output = generator(ast, {
|
|
101
|
+
sourceMaps: !!options.sourceMaps,
|
|
102
|
+
sourceFileName: resourcePath,
|
|
103
|
+
retainLines: false,
|
|
104
|
+
comments: true
|
|
105
|
+
}, source);
|
|
106
|
+
callback(null, output.code, output.map);
|
|
107
|
+
} else {
|
|
108
|
+
callback(null, source, map);
|
|
109
|
+
}
|
|
110
|
+
} catch (err) {
|
|
111
|
+
callback(err);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
module.exports = function miniCssFallBackLoader(source) {
|
|
4
|
-
const replacedStr = source.replace('export default ', 'module.exports = ');
|
|
5
|
-
|
|
4
|
+
const replacedStr = source.replace('export default ', 'module.exports = ');
|
|
5
|
+
// console.log('src/loaders/docsLoader.js', replacedStr);
|
|
6
6
|
return replacedStr;
|
|
7
7
|
};
|
|
@@ -5,15 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = loader;
|
|
7
7
|
exports.pitch = pitch;
|
|
8
|
-
|
|
9
8
|
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
|
|
11
9
|
var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntryPlugin"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
11
|
// import { getOptions } from 'loader-utils';
|
|
16
12
|
// import validateOptions from 'schema-utils';
|
|
13
|
+
|
|
17
14
|
const schema = {
|
|
18
15
|
'type': 'object',
|
|
19
16
|
'properties': {
|
|
@@ -41,25 +38,24 @@ const schema = {
|
|
|
41
38
|
}
|
|
42
39
|
},
|
|
43
40
|
'additionalProperties': false
|
|
44
|
-
};
|
|
41
|
+
};
|
|
45
42
|
|
|
43
|
+
// eslint-disable-next-line
|
|
46
44
|
function loader() {}
|
|
47
|
-
|
|
48
45
|
function getDefaultFilename(filename) {
|
|
49
46
|
if (typeof filename === 'function') {
|
|
50
47
|
return filename;
|
|
51
48
|
}
|
|
52
|
-
|
|
53
49
|
return filename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
|
|
54
50
|
}
|
|
55
|
-
|
|
56
51
|
function getDefaultChunkFilename(chunkFilename) {
|
|
57
52
|
return chunkFilename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
|
|
58
53
|
}
|
|
59
|
-
|
|
60
54
|
function pitch(request) {
|
|
61
55
|
this.cacheable(false);
|
|
62
|
-
const options = this.getOptions();
|
|
56
|
+
const options = this.getOptions();
|
|
57
|
+
// console.log(this.getOptions());
|
|
58
|
+
|
|
63
59
|
// validateOptions(schema, options, {
|
|
64
60
|
// name: 'Worker Loader',
|
|
65
61
|
// baseDataPath: 'options'
|
|
@@ -77,6 +73,7 @@ function pitch(request) {
|
|
|
77
73
|
globalObject: 'self'
|
|
78
74
|
};
|
|
79
75
|
workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
|
|
76
|
+
|
|
80
77
|
/*
|
|
81
78
|
new WebWorkerTemplatePlugin().apply(workerContext.compiler);
|
|
82
79
|
|
|
@@ -92,25 +89,19 @@ function pitch(request) {
|
|
|
92
89
|
const cb = this.async();
|
|
93
90
|
workerContext.compiler.runAsChild((errorArg, entries, compilation) => {
|
|
94
91
|
let error = errorArg;
|
|
95
|
-
|
|
96
92
|
if (!error && compilation.errors && compilation.errors.length) {
|
|
97
93
|
// eslint-disable-next-line
|
|
98
94
|
error = compilation.errors[0];
|
|
99
95
|
}
|
|
100
|
-
|
|
101
96
|
const entry = entries && entries[0] && entries[0].files.values().next().value;
|
|
102
|
-
|
|
103
97
|
if (!error && !entry) {
|
|
104
98
|
error = Error(`WorkerPlugin: no entry for ${request}`);
|
|
105
99
|
}
|
|
106
|
-
|
|
107
100
|
if (error) {
|
|
108
101
|
return cb(error);
|
|
109
102
|
}
|
|
110
|
-
|
|
111
103
|
function workerCode() {
|
|
112
104
|
let blob;
|
|
113
|
-
|
|
114
105
|
try {
|
|
115
106
|
blob = new Blob([`importScripts('${this.workerUrl}');`], {
|
|
116
107
|
'type': 'application/javascript'
|
|
@@ -118,13 +109,11 @@ function pitch(request) {
|
|
|
118
109
|
} catch (e1) {
|
|
119
110
|
throw new Error(e1);
|
|
120
111
|
}
|
|
121
|
-
|
|
122
112
|
let url = window.URL || window.webkitURL;
|
|
123
113
|
let blobUrl = url.createObjectURL(blob);
|
|
124
114
|
let worker = new Worker(blobUrl);
|
|
125
115
|
return worker;
|
|
126
116
|
}
|
|
127
|
-
|
|
128
117
|
return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
|
|
129
118
|
workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
|
130
119
|
getInstance: ${workerCode} \n
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.optimizationConfig = optimizationConfig;
|
|
7
|
-
|
|
8
7
|
var _terserWebpackPlugin = _interopRequireDefault(require("terser-webpack-plugin"));
|
|
9
|
-
|
|
10
8
|
var _nameTemplates = require("./common/nameTemplates");
|
|
11
|
-
|
|
12
9
|
var _hashUtils = require("./custom_plugins/I18nSplitPlugin/utils/hashUtils");
|
|
13
|
-
|
|
14
10
|
var _configCSSMinifierPlugin = require("./pluginConfigs/configCSSMinifierPlugin");
|
|
15
|
-
|
|
16
11
|
var _splitChunksConfig = require("./splitChunksConfig");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
13
|
function optimizationConfig(options) {
|
|
21
14
|
const {
|
|
22
15
|
changeRuntimeChunkChar
|
|
@@ -31,22 +24,21 @@ function optimizationConfig(options) {
|
|
|
31
24
|
* other wise we don't need multiple runtime files based locale
|
|
32
25
|
* that's why we added chunkSplitEnable && chunkFilenameHasContentHash logic
|
|
33
26
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
const suffix =
|
|
28
|
+
// chunkSplitEnable ? '_[locale]' : '';
|
|
36
29
|
chunkSplitEnable && chunkFilenameHasContentHash ? '_[locale]' : '';
|
|
37
30
|
const char = changeRuntimeChunkChar;
|
|
38
31
|
const excludeList = options.optimization.jsExcludePath;
|
|
39
32
|
return {
|
|
40
33
|
splitChunks: (0, _splitChunksConfig.splitChunksConfig)(options),
|
|
41
|
-
minimizer: [
|
|
34
|
+
minimizer: [
|
|
35
|
+
// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
|
|
42
36
|
// '...',
|
|
43
37
|
excludeList !== '' ? new _terserWebpackPlugin.default({
|
|
44
38
|
exclude: excludeList,
|
|
45
39
|
extractComments: false // Do not extract comments to .LICENSE.txt files
|
|
46
|
-
|
|
47
40
|
}) : new _terserWebpackPlugin.default({
|
|
48
41
|
extractComments: false // Do not extract comments to .LICENSE.txt files
|
|
49
|
-
|
|
50
42
|
}), (0, _configCSSMinifierPlugin.configCSSMinifierPlugin)(options)].filter(Boolean),
|
|
51
43
|
moduleIds: 'named',
|
|
52
44
|
runtimeChunk: {
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.outputConfig = outputConfig;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _constants = require("../../constants");
|
|
11
|
-
|
|
12
9
|
var _nameTemplates = require("./common/nameTemplates");
|
|
13
|
-
|
|
14
10
|
var _modeUtils = require("./common/modeUtils");
|
|
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
|
function outputConfig(options) {
|
|
19
13
|
const {
|
|
20
14
|
output,
|
|
@@ -29,10 +23,8 @@ function outputConfig(options) {
|
|
|
29
23
|
// clean: true,
|
|
30
24
|
path: _path.default.resolve(_constants.appPath, output)
|
|
31
25
|
};
|
|
32
|
-
|
|
33
26
|
if (htmlTemplate.crossorigin) {
|
|
34
27
|
outputO.crossOriginLoading = 'anonymous';
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
return outputO;
|
|
38
30
|
}
|
|
@@ -4,29 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configBundleAnalyzer = configBundleAnalyzer;
|
|
7
|
-
|
|
8
7
|
var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
|
9
|
-
|
|
10
8
|
var _modeUtils = require("../common/modeUtils");
|
|
11
|
-
|
|
12
9
|
/* eslint-disable no-use-before-define */
|
|
10
|
+
|
|
13
11
|
function configBundleAnalyzer(options) {
|
|
14
12
|
const mode = (0, _modeUtils.getWebpackMode)(options);
|
|
15
|
-
|
|
16
13
|
if ((0, _modeUtils.isProductionMode)(mode) && options.bundleAnalyze) {
|
|
17
14
|
const bundleAnalyzerOptions = getBundleAnalyzerOptions(options);
|
|
18
15
|
return new _webpackBundleAnalyzer.BundleAnalyzerPlugin(bundleAnalyzerOptions);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
18
|
+
}
|
|
24
19
|
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
25
21
|
function getBundleAnalyzerOptions(options) {
|
|
26
22
|
return {
|
|
27
23
|
analyzerMode: 'static',
|
|
28
24
|
// generateStatsFile: false,
|
|
29
|
-
openAnalyzer: false
|
|
25
|
+
openAnalyzer: false
|
|
26
|
+
// statsOptions: {
|
|
30
27
|
// source: false,
|
|
31
28
|
// normal: true,
|
|
32
29
|
// chunks: false,
|
|
@@ -35,6 +32,5 @@ function getBundleAnalyzerOptions(options) {
|
|
|
35
32
|
// assets: true,
|
|
36
33
|
// assetsSort: 'name'
|
|
37
34
|
// }
|
|
38
|
-
|
|
39
35
|
};
|
|
40
36
|
}
|
|
@@ -4,18 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configBundleIntegrityReport = configBundleIntegrityReport;
|
|
7
|
-
|
|
8
7
|
var _modeUtils = require("../common/modeUtils");
|
|
9
|
-
|
|
10
8
|
var _BundleIntegrityReport = require("../custom_plugins/BundleIntegrityReport");
|
|
11
|
-
|
|
12
9
|
function configBundleIntegrityReport(options) {
|
|
13
10
|
const webpackMode = (0, _modeUtils.getWebpackMode)(options);
|
|
14
11
|
const isProduction = (0, _modeUtils.isProductionMode)(webpackMode);
|
|
15
12
|
const {
|
|
16
13
|
enable: statsEnable
|
|
17
14
|
} = options.stats;
|
|
18
|
-
|
|
19
15
|
if (isProduction && statsEnable) {
|
|
20
16
|
return new _BundleIntegrityReport.BundleIntegrityReport({
|
|
21
17
|
fileName: options.stats.fileName || 'bundle-report-integrity.json',
|
|
@@ -31,6 +27,5 @@ function configBundleIntegrityReport(options) {
|
|
|
31
27
|
}
|
|
32
28
|
});
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
return null;
|
|
36
31
|
}
|
|
@@ -4,24 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.configCSSMinifierPlugin = configCSSMinifierPlugin;
|
|
7
|
-
|
|
8
7
|
var _cssMinimizerWebpackPlugin = _interopRequireDefault(require("css-minimizer-webpack-plugin"));
|
|
9
|
-
|
|
10
8
|
var _modeUtils = require("../common/modeUtils");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
10
|
// import UglifyCSSPlugin from '../custom_plugins/UglifyCSSPlugin';
|
|
11
|
+
|
|
15
12
|
// eslint-disable-next-line no-unused-vars
|
|
16
13
|
function configCSSMinifierPlugin(options) {
|
|
17
14
|
const excludeList = options.optimization.cssExcludePath;
|
|
18
|
-
|
|
19
15
|
if ((0, _modeUtils.isNotProduction)(options)) {
|
|
20
16
|
return null;
|
|
21
|
-
}
|
|
17
|
+
}
|
|
18
|
+
// return null;
|
|
22
19
|
// return new UglifyCSSPlugin();
|
|
23
|
-
|
|
24
|
-
|
|
25
20
|
return excludeList !== '' ? new _cssMinimizerWebpackPlugin.default({
|
|
26
21
|
exclude: excludeList
|
|
27
22
|
}) : new _cssMinimizerWebpackPlugin.default();
|