@zohodesk/client_build_tool 0.0.11-exp.30.0 → 0.0.11-exp.31.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/lib/schemas/defaultConfigValues.js +2 -1
- package/lib/schemas/defaultConfigValuesOnly.js +2 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +27 -6
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +6 -2
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +5 -1
- package/package.json +1 -1
|
@@ -199,7 +199,8 @@ var _default = {
|
|
|
199
199
|
emitFiles: true,
|
|
200
200
|
injectI18nUrlInIndex: true,
|
|
201
201
|
customGroups: null,
|
|
202
|
-
chunkToGroupMapping: {}
|
|
202
|
+
chunkToGroupMapping: {},
|
|
203
|
+
groupPublicPathRuntimeExpression: 'window.__SMAP_PATH__'
|
|
203
204
|
},
|
|
204
205
|
publicFolders: {
|
|
205
206
|
dev: ['...'],
|
|
@@ -116,7 +116,8 @@ var _default = {
|
|
|
116
116
|
emitFiles: true,
|
|
117
117
|
injectI18nUrlInIndex: true,
|
|
118
118
|
customGroups: null,
|
|
119
|
-
chunkToGroupMapping: {}
|
|
119
|
+
chunkToGroupMapping: {},
|
|
120
|
+
groupPublicPathRuntimeExpression: 'window.__SMAP_PATH__'
|
|
120
121
|
},
|
|
121
122
|
publicFolders: {
|
|
122
123
|
dev: ['...'],
|
package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js
CHANGED
|
@@ -19,7 +19,9 @@ class I18nGroupRuntimeModule extends _webpack.RuntimeModule {
|
|
|
19
19
|
customGroups,
|
|
20
20
|
chunkIdToGroupMapping,
|
|
21
21
|
localeVarName,
|
|
22
|
-
groupAssetUrls
|
|
22
|
+
groupAssetUrls,
|
|
23
|
+
publicPathPrefix,
|
|
24
|
+
publicPathRuntimeExpression
|
|
23
25
|
} = this.options;
|
|
24
26
|
const chunkIdToGroup = chunkIdToGroupMapping || {};
|
|
25
27
|
return `
|
|
@@ -30,12 +32,22 @@ class I18nGroupRuntimeModule extends _webpack.RuntimeModule {
|
|
|
30
32
|
var groupAssetUrls = ${JSON.stringify(groupAssetUrls || {})};
|
|
31
33
|
var cachedI18nBase;
|
|
32
34
|
var scriptCache = null;
|
|
35
|
+
var runtimePublicPathPrefixResolver = ${publicPathRuntimeExpression ? `function(){ try { return ${publicPathRuntimeExpression}; } catch (err) { return undefined; } }` : 'function(){ return undefined; }'};
|
|
36
|
+
var runtimePublicPathPrefix = runtimePublicPathPrefixResolver();
|
|
37
|
+
if (runtimePublicPathPrefix === undefined || runtimePublicPathPrefix === null || runtimePublicPathPrefix === '') {
|
|
38
|
+
runtimePublicPathPrefix = ${JSON.stringify(publicPathPrefix || '')};
|
|
39
|
+
}
|
|
40
|
+
if (typeof runtimePublicPathPrefix !== 'string') {
|
|
41
|
+
runtimePublicPathPrefix = runtimePublicPathPrefix != null ? String(runtimePublicPathPrefix) : '';
|
|
42
|
+
}
|
|
33
43
|
|
|
34
44
|
function ensureTrailingSlash(path) {
|
|
35
45
|
if (!path) return '';
|
|
36
46
|
return path.charAt(path.length - 1) === '/' ? path : path + '/';
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
runtimePublicPathPrefix = ensureTrailingSlash(runtimePublicPathPrefix);
|
|
50
|
+
|
|
39
51
|
function resolveI18nBase() {
|
|
40
52
|
if (cachedI18nBase !== undefined) {
|
|
41
53
|
return cachedI18nBase;
|
|
@@ -47,12 +59,21 @@ class I18nGroupRuntimeModule extends _webpack.RuntimeModule {
|
|
|
47
59
|
}
|
|
48
60
|
|
|
49
61
|
function buildI18nUrl(relativePath) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
if (!relativePath) {
|
|
63
|
+
return runtimePublicPathPrefix || resolveI18nBase();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var normalizedPath = relativePath;
|
|
67
|
+
if (normalizedPath.charAt(0) === '/') {
|
|
68
|
+
normalizedPath = normalizedPath.slice(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (runtimePublicPathPrefix) {
|
|
72
|
+
return runtimePublicPathPrefix + normalizedPath;
|
|
54
73
|
}
|
|
55
|
-
|
|
74
|
+
|
|
75
|
+
var base = resolveI18nBase();
|
|
76
|
+
return base + normalizedPath;
|
|
56
77
|
}
|
|
57
78
|
|
|
58
79
|
function loadI18nGroup(groupName, loadReason) {
|
package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js
CHANGED
|
@@ -53,7 +53,9 @@ class I18nNumericIndexPlugin {
|
|
|
53
53
|
outputFolder: options.outputFolder || 'i18n-chunk',
|
|
54
54
|
manifestPath: options.manifestPath || null,
|
|
55
55
|
emitFiles: options.emitFiles !== undefined ? options.emitFiles : true,
|
|
56
|
-
chunkToGroupMapping: options.chunkToGroupMapping || {}
|
|
56
|
+
chunkToGroupMapping: options.chunkToGroupMapping || {},
|
|
57
|
+
groupPublicPathPrefix: options.groupPublicPathPrefix || '',
|
|
58
|
+
groupPublicPathRuntimeExpression: options.groupPublicPathRuntimeExpression || ''
|
|
57
59
|
};
|
|
58
60
|
this.numericMap = {};
|
|
59
61
|
this.customGroups = {};
|
|
@@ -85,7 +87,9 @@ class I18nNumericIndexPlugin {
|
|
|
85
87
|
localeVarName: this.options.localeVarName,
|
|
86
88
|
jsonpFunc: this.options.jsonpFunc,
|
|
87
89
|
groupAssetUrls: this.groupAssetUrls,
|
|
88
|
-
includeContentHash: this.options.includeContentHash
|
|
90
|
+
includeContentHash: this.options.includeContentHash,
|
|
91
|
+
publicPathPrefix: this.options.groupPublicPathPrefix,
|
|
92
|
+
publicPathRuntimeExpression: this.options.groupPublicPathRuntimeExpression
|
|
89
93
|
}));
|
|
90
94
|
}
|
|
91
95
|
});
|
|
@@ -21,6 +21,8 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const i18nOpts = options.i18nIndexing;
|
|
24
|
+
const groupPublicPathPrefix = i18nOpts.groupPublicPathPrefix || '';
|
|
25
|
+
const groupPublicPathRuntimeExpression = i18nOpts.groupPublicPathRuntimeExpression !== undefined ? i18nOpts.groupPublicPathRuntimeExpression : 'window.__SMAP_PATH__';
|
|
24
26
|
|
|
25
27
|
try {
|
|
26
28
|
const result = (0, _i18nOptionsValidator.validateI18nIndexingOptions)(i18nOpts);
|
|
@@ -80,7 +82,9 @@ function configI18nNumericIndexPlugin(options) {
|
|
|
80
82
|
manifestPath: i18nOpts.manifestPath || null,
|
|
81
83
|
customGroups: i18nOpts.customGroups || null,
|
|
82
84
|
chunkToGroupMapping: i18nOpts.chunkToGroupMapping || {},
|
|
83
|
-
emitFiles
|
|
85
|
+
emitFiles,
|
|
86
|
+
groupPublicPathPrefix,
|
|
87
|
+
groupPublicPathRuntimeExpression
|
|
84
88
|
};
|
|
85
89
|
const htmlInjectorOptions = { ...sharedOptions,
|
|
86
90
|
htmlTemplateLabel: i18nOpts.htmlTemplateLabel,
|