@zohodesk/client_build_tool 0.0.11-exp.13 → 0.0.11-exp.15
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/lib/schemas/defaultConfigValues.js +2 -1
- package/lib/schemas/defaultConfigValuesOnly.js +2 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +14 -2
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +19 -9
- package/package.json +1 -1
|
@@ -110,7 +110,8 @@ var _default = {
|
|
|
110
110
|
localeVarName: 'window.userLangCode',
|
|
111
111
|
singleFile: false,
|
|
112
112
|
includeContentHash: false,
|
|
113
|
-
generateManifest: false
|
|
113
|
+
generateManifest: false,
|
|
114
|
+
manifestPath: null
|
|
114
115
|
},
|
|
115
116
|
publicFolders: ['...', {
|
|
116
117
|
source: './deskapp/tp/',
|
package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js
CHANGED
|
@@ -28,7 +28,8 @@ class I18nNumericIndexPlugin {
|
|
|
28
28
|
singleFile: options.singleFile || false,
|
|
29
29
|
singleFileTemplate: options.singleFileTemplate,
|
|
30
30
|
includeContentHash: options.includeContentHash || false,
|
|
31
|
-
generateManifest: options.generateManifest || false
|
|
31
|
+
generateManifest: options.generateManifest || false,
|
|
32
|
+
manifestPath: options.manifestPath || 'i18n/manifest.json'
|
|
32
33
|
};
|
|
33
34
|
this.numericMap = null;
|
|
34
35
|
this.i18nData = null;
|
|
@@ -157,7 +158,18 @@ class I18nNumericIndexPlugin {
|
|
|
157
158
|
});
|
|
158
159
|
|
|
159
160
|
if (this.options.generateManifest && Object.keys(this.manifest).length > 0) {
|
|
160
|
-
|
|
161
|
+
// Determine manifest path
|
|
162
|
+
let manifestPath;
|
|
163
|
+
|
|
164
|
+
if (this.options.manifestPath) {
|
|
165
|
+
// Use explicitly configured path
|
|
166
|
+
manifestPath = this.options.manifestPath;
|
|
167
|
+
} else {
|
|
168
|
+
// Default to same directory as i18n files with manifest.json name
|
|
169
|
+
const template = this.options.singleFileTemplate || this.options.numericFilenameTemplate;
|
|
170
|
+
manifestPath = path.dirname(template) + '/manifest.json';
|
|
171
|
+
}
|
|
172
|
+
|
|
161
173
|
const manifestContent = JSON.stringify(this.manifest, null, 2);
|
|
162
174
|
compilation.emitAsset(manifestPath, new RawSource(manifestContent));
|
|
163
175
|
}
|
|
@@ -16,8 +16,11 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const i18nOpts = options.i18nIndexing;
|
|
20
|
-
|
|
19
|
+
const i18nOpts = options.i18nIndexing; // Check for required options based on singleFile mode
|
|
20
|
+
|
|
21
|
+
const baseRequiredOptions = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath', 'jsonpFunc', 'htmlTemplateLabel', 'localeVarName']; // Add template requirements based on mode
|
|
22
|
+
|
|
23
|
+
const requiredOptions = i18nOpts.singleFile ? [...baseRequiredOptions, 'singleFileTemplate'] : [...baseRequiredOptions, 'numericFilenameTemplate', 'dynamicFilenameTemplate'];
|
|
21
24
|
const missingOptions = requiredOptions.filter(opt => !i18nOpts[opt]);
|
|
22
25
|
|
|
23
26
|
if (missingOptions.length > 0) {
|
|
@@ -31,14 +34,20 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
31
34
|
jsResource: i18nOpts.jsResourcePath,
|
|
32
35
|
propertiesFolder: i18nOpts.propertiesFolderPath,
|
|
33
36
|
disableDefault: false
|
|
34
|
-
});
|
|
37
|
+
}); // Validate template patterns based on mode
|
|
35
38
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
if (i18nOpts.singleFile) {
|
|
40
|
+
if (i18nOpts.singleFileTemplate && !i18nOpts.singleFileTemplate.includes('[locale]')) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (!i18nOpts.numericFilenameTemplate?.includes('[locale]')) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
if (!i18nOpts.dynamicFilenameTemplate?.includes('[locale]')) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
52
|
|
|
44
53
|
const i18nAssetsPublicPathPrefix = '';
|
|
@@ -60,7 +69,8 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
60
69
|
jsonpFunc: i18nOpts.jsonpFunc,
|
|
61
70
|
singleFile: i18nOpts.singleFile || false,
|
|
62
71
|
includeContentHash: finalIncludeContentHash,
|
|
63
|
-
generateManifest: i18nOpts.generateManifest || false
|
|
72
|
+
generateManifest: i18nOpts.generateManifest || false,
|
|
73
|
+
manifestPath: i18nOpts.manifestPath
|
|
64
74
|
};
|
|
65
75
|
const htmlInjectorOptions = {
|
|
66
76
|
numericFilenameTemplate: i18nOpts.numericFilenameTemplate,
|