@zohodesk/client_build_tool 0.0.11-exp.18 → 0.0.11-exp.18.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/CHANGELOG.md +28 -0
- package/README.md +130 -0
- package/README_backup.md +102 -0
- 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/lib/schemas/defaultConfigValues.js +46 -1
- package/lib/schemas/defaultConfigValuesOnly.js +31 -4
- package/lib/shared/babel/getBabelPlugin.js +3 -4
- package/lib/shared/babel/runBabelForTsFile.js +1 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +139 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +98 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +399 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +141 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +19 -1
- package/lib/shared/bundler/webpack/jsLoaders.js +24 -1
- package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +90 -0
- package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +146 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +42 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +92 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +112 -0
- package/lib/shared/bundler/webpack/plugins.js +3 -1
- package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +1 -1
- package/lib/shared/server/mockApiHandler.js +7 -0
- package/lib/shared/server/urlConcat.js +4 -3
- package/npm-shrinkwrap.json +8225 -32
- package/package.json +6 -5
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configI18nNumericIndexPlugin = configI18nNumericIndexPlugin;
|
|
7
|
+
|
|
8
|
+
var _I18nNumericIndexPlugin = _interopRequireDefault(require("../custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin"));
|
|
9
|
+
|
|
10
|
+
var _I18nNumericIndexHtmlInjectorPlugin = require("../custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin");
|
|
11
|
+
|
|
12
|
+
var _readI18nValues = require("../custom_plugins/I18nSplitPlugin/readI18nValues");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function configI18nNumericIndexPlugin(options) {
|
|
17
|
+
if (!(options.i18nIndexing && options.i18nIndexing.enable)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const i18nOpts = options.i18nIndexing;
|
|
22
|
+
const isDevelopment = options.isDevelopment || false; // Get isDevelopment from options
|
|
23
|
+
// If we are only doing numeric ID replacement (no files to emit and no HTML injection, and no custom groups),
|
|
24
|
+
// we can skip creating plugin instances to save build time.
|
|
25
|
+
|
|
26
|
+
const emitFiles = i18nOpts.emitFiles !== undefined ? i18nOpts.emitFiles : true;
|
|
27
|
+
const injectHtml = i18nOpts.injectI18nUrlInIndex !== undefined ? i18nOpts.injectI18nUrlInIndex : true;
|
|
28
|
+
const hasCustomGroups = !!(i18nOpts.customGroups && Object.keys(i18nOpts.customGroups || {}).length);
|
|
29
|
+
|
|
30
|
+
if (!emitFiles && !injectHtml && !hasCustomGroups) {
|
|
31
|
+
return [];
|
|
32
|
+
} // Validate required options
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const requiredOptions = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath', 'jsonpFunc', 'htmlTemplateLabel', 'localeVarName'];
|
|
36
|
+
const missingOptions = requiredOptions.filter(opt => !i18nOpts[opt]);
|
|
37
|
+
|
|
38
|
+
if (missingOptions.length > 0) {
|
|
39
|
+
console.warn(`[I18nNumericIndexPlugin] Missing required options: ${missingOptions.join(', ')}`);
|
|
40
|
+
return null;
|
|
41
|
+
} // Read i18n values
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
locales,
|
|
46
|
+
allI18nObject
|
|
47
|
+
} = (0, _readI18nValues.readI18nValues)({
|
|
48
|
+
jsResource: i18nOpts.jsResourcePath,
|
|
49
|
+
propertiesFolder: i18nOpts.propertiesFolderPath,
|
|
50
|
+
disableDefault: false
|
|
51
|
+
}); // Ensure templates have [locale] placeholder
|
|
52
|
+
|
|
53
|
+
const numericTemplate = i18nOpts.numericFilenameTemplate || '[locale]/numeric.i18n.js';
|
|
54
|
+
const dynamicTemplate = i18nOpts.dynamicFilenameTemplate || '[locale]/dynamic.i18n.js';
|
|
55
|
+
|
|
56
|
+
if (!numericTemplate.includes('[locale]')) {
|
|
57
|
+
console.warn('[I18nNumericIndexPlugin] numericFilenameTemplate must include [locale] placeholder');
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!dynamicTemplate.includes('[locale]')) {
|
|
62
|
+
console.warn('[I18nNumericIndexPlugin] dynamicFilenameTemplate must include [locale] placeholder');
|
|
63
|
+
return null;
|
|
64
|
+
} // Resolve singleFileTemplate if it's a function
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
let resolvedSingleFileTemplate = i18nOpts.singleFileTemplate || '[locale].js';
|
|
68
|
+
|
|
69
|
+
if (typeof i18nOpts.singleFileTemplate === 'function') {
|
|
70
|
+
resolvedSingleFileTemplate = i18nOpts.singleFileTemplate(isDevelopment);
|
|
71
|
+
} // Plugin options
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
const numericIndexPluginOptions = {
|
|
75
|
+
enable: i18nOpts.enable,
|
|
76
|
+
outputFolder: i18nOpts.outputFolder || 'i18n-chunk',
|
|
77
|
+
jsResourcePath: i18nOpts.jsResourcePath,
|
|
78
|
+
propertiesFolderPath: i18nOpts.propertiesFolderPath,
|
|
79
|
+
numericMapPath: i18nOpts.numericMapPath,
|
|
80
|
+
locales,
|
|
81
|
+
allI18nObject,
|
|
82
|
+
numericFilenameTemplate: numericTemplate,
|
|
83
|
+
dynamicFilenameTemplate: dynamicTemplate,
|
|
84
|
+
singleFileTemplate: resolvedSingleFileTemplate,
|
|
85
|
+
jsonpFunc: i18nOpts.jsonpFunc,
|
|
86
|
+
localeVarName: i18nOpts.localeVarName,
|
|
87
|
+
singleFile: i18nOpts.singleFile || false,
|
|
88
|
+
restrictToBaseKeys: i18nOpts.restrictToBaseKeys || false,
|
|
89
|
+
includeContentHash: i18nOpts.includeContentHash || false,
|
|
90
|
+
generateManifest: i18nOpts.generateManifest || false,
|
|
91
|
+
manifestPath: i18nOpts.manifestPath || null,
|
|
92
|
+
customGroups: i18nOpts.customGroups || null,
|
|
93
|
+
emitFiles: i18nOpts.emitFiles !== undefined ? i18nOpts.emitFiles : true,
|
|
94
|
+
isDevelopment: isDevelopment
|
|
95
|
+
}; // HTML injector options
|
|
96
|
+
|
|
97
|
+
const htmlInjectorOptions = {
|
|
98
|
+
outputFolder: i18nOpts.outputFolder || 'i18n-chunk',
|
|
99
|
+
numericFilenameTemplate: numericTemplate,
|
|
100
|
+
dynamicFilenameTemplate: dynamicTemplate,
|
|
101
|
+
singleFileTemplate: resolvedSingleFileTemplate,
|
|
102
|
+
htmlTemplateLabel: i18nOpts.htmlTemplateLabel,
|
|
103
|
+
singleFile: i18nOpts.singleFile || false,
|
|
104
|
+
i18nAssetsPublicPathPrefix: '',
|
|
105
|
+
injectI18nUrlInIndex: i18nOpts.injectI18nUrlInIndex !== undefined ? i18nOpts.injectI18nUrlInIndex : true,
|
|
106
|
+
// Control HTML injection
|
|
107
|
+
isDevelopment: isDevelopment
|
|
108
|
+
};
|
|
109
|
+
const i18nNumericPluginInstance = new _I18nNumericIndexPlugin.default(numericIndexPluginOptions);
|
|
110
|
+
const htmlInjectorPluginInstance = new _I18nNumericIndexHtmlInjectorPlugin.I18nNumericIndexHtmlInjectorPlugin(htmlInjectorOptions);
|
|
111
|
+
return [i18nNumericPluginInstance, htmlInjectorPluginInstance];
|
|
112
|
+
}
|
|
@@ -11,6 +11,8 @@ var _configEnvVariables = require("./pluginConfigs/configEnvVariables");
|
|
|
11
11
|
|
|
12
12
|
var _configI18nSplitPlugin = require("./pluginConfigs/configI18nSplitPlugin");
|
|
13
13
|
|
|
14
|
+
var _configI18nNumericIndexPlugin = require("./pluginConfigs/configI18nNumericIndexPlugin");
|
|
15
|
+
|
|
14
16
|
var _configMiniCSSExtractPlugin = require("./pluginConfigs/configMiniCSSExtractPlugin");
|
|
15
17
|
|
|
16
18
|
var _configRtlCssPlugin = require("./pluginConfigs/configRtlCssPlugin");
|
|
@@ -54,5 +56,5 @@ function plugins(options) {
|
|
|
54
56
|
const {
|
|
55
57
|
webpackPlugins
|
|
56
58
|
} = options;
|
|
57
|
-
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCustomScriptLoadingStrategyPlugin.configCustomScriptLoadingStrategyPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), (0, _configBundleIntegrityReport.configBundleIntegrityReport)(options), (0, _configRuntimeResourceCleanup.configRuntimeResourceCleanup)(options), ...webpackPlugins].filter(Boolean);
|
|
59
|
+
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), ...((0, _configI18nNumericIndexPlugin.configI18nNumericIndexPlugin)(options) || []), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCustomScriptLoadingStrategyPlugin.configCustomScriptLoadingStrategyPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), (0, _configBundleIntegrityReport.configBundleIntegrityReport)(options), (0, _configRuntimeResourceCleanup.configRuntimeResourceCleanup)(options), ...webpackPlugins].filter(Boolean);
|
|
58
60
|
}
|
|
@@ -259,7 +259,7 @@ var _default = ({
|
|
|
259
259
|
if (range) {
|
|
260
260
|
// console.log('multiple :', decl.value)
|
|
261
261
|
let newVal = '';
|
|
262
|
-
decl.value.split(' ').forEach(singleVal => {
|
|
262
|
+
decl.value.split(' ').filter(Boolean).forEach(singleVal => {
|
|
263
263
|
newVal += `${singleConvertor(singleVal, settings.replacements.px, {
|
|
264
264
|
decl,
|
|
265
265
|
filename,
|
|
@@ -44,6 +44,13 @@ function handleMockApi(mockEntryFile, app) {
|
|
|
44
44
|
const entryFilePath = (0, _constants.joinWithAppPath)(mockEntryFile); // eslint-disable-next-line no-use-before-define
|
|
45
45
|
|
|
46
46
|
const mockFunc = safeRequire(entryFilePath);
|
|
47
|
+
|
|
48
|
+
if (typeof mockFunc === 'function') {
|
|
49
|
+
// eslint-disable-next-line no-use-before-define
|
|
50
|
+
mockFunc(app);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
47
54
|
mockFunc?.mockApi?.(app);
|
|
48
55
|
} // function handleMockApi(params) {
|
|
49
56
|
// }
|
|
@@ -17,10 +17,11 @@ function urlConcat(url, path) {
|
|
|
17
17
|
const slashRemovedPath = removeFrontSlash(path);
|
|
18
18
|
|
|
19
19
|
if (slashRemovedUrl === '') {
|
|
20
|
-
return path
|
|
21
|
-
}
|
|
20
|
+
return `${path}/`;
|
|
21
|
+
} //return `${slashRemovedUrl}/${slashRemovedPath}`;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
return `${[slashRemovedUrl, slashRemovedPath].filter(a => a).join('/')}/`;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
function removeLastSlash(url) {
|