@zohodesk/react-cli 1.1.14-exp.4 → 1.1.14-exp.6
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 +13 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +13 -42
- package/lib/schemas/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -44,6 +44,19 @@ Now to run app
|
|
44
44
|
|
45
45
|
# Change Logs
|
46
46
|
|
47
|
+
# 1.1.14-exp.1 (20-9-2023)
|
48
|
+
|
49
|
+
**Feature:-**
|
50
|
+
|
51
|
+
- externals was added to Prevent bundling of certain imported packages and instead retrieve these external dependencies at runtime.
|
52
|
+
- to use externals, we use the following pattern in `app > externals` :
|
53
|
+
|
54
|
+
For example
|
55
|
+
```
|
56
|
+
externals: {
|
57
|
+
<key> : <value>
|
58
|
+
}
|
59
|
+
```
|
47
60
|
# 1.1.14 (11-9-2023)
|
48
61
|
|
49
62
|
**Feature:-**
|
@@ -184,15 +184,15 @@ class I18nDownlodLogic {
|
|
184
184
|
|
185
185
|
const buf = [];
|
186
186
|
/*
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
187
|
+
if (REGEXP_HASH.test(filenameTemplate)) {
|
188
|
+
buf.push(
|
189
|
+
`var hash = ${mainTemplate.renderCurrentHashCode(hash)};`
|
190
|
+
);
|
191
|
+
}
|
192
|
+
if (REGEXP_CHUNKHASH.test(filenameTemplate)) {
|
193
|
+
buf.push(`var chunkHashes = ${JSON.stringify(chunkMaps.hash)};`);
|
194
|
+
}
|
195
|
+
*/
|
196
196
|
|
197
197
|
if ((0, _hashUtils.hasContentHash)(filenameTemplate)) {
|
198
198
|
const hashLength = getContentHashMaxLength(filenameTemplate);
|
@@ -205,19 +205,12 @@ class I18nDownlodLogic {
|
|
205
205
|
|
206
206
|
const publicPath = this.publicPath ? JSON.stringify(this.publicPath) : `${mainTemplate.requireFn}.p`;
|
207
207
|
return _webpack.Template.asString([source, `
|
208
|
-
function
|
208
|
+
(function() {
|
209
209
|
// ${pluginName} I18N loading
|
210
210
|
var i18nChunks = ${JSON.stringify(chunkMap)};
|
211
211
|
var locale = ${localeVarName};
|
212
212
|
// ${pluginName} I18N hasehes
|
213
213
|
${hashUtils}
|
214
|
-
if(chunkName) {
|
215
|
-
chunkId = chunkName;
|
216
|
-
}
|
217
|
-
if (language) {
|
218
|
-
window.userLangCode = language;
|
219
|
-
locale = language;
|
220
|
-
}
|
221
214
|
if(installedI18nChunks[chunkId]) {
|
222
215
|
promises.push(installedI18nChunks[chunkId]);
|
223
216
|
} else if(installedI18nChunks[chunkId] !== 0 && i18nChunks[chunkId]) {
|
@@ -252,31 +245,10 @@ function downloadScriptTagForI18nDynamicChunks(chunkName = '', language = '') {
|
|
252
245
|
}` : ''}
|
253
246
|
document.body.appendChild(scriptTag);
|
254
247
|
}).then(function() {
|
255
|
-
installedI18nChunks[chunkId] = 0;
|
248
|
+
installedI18nChunks[chunkId] = 0;
|
256
249
|
}));
|
257
250
|
}
|
258
|
-
|
259
|
-
};
|
260
|
-
downloadScriptTagForI18nDynamicChunks();
|
261
|
-
${mainTemplate.requireFn}.changeLanguage = function changeLanguage(language) {
|
262
|
-
window.change(language);
|
263
|
-
return new Promise((resolve, reject) => {
|
264
|
-
const chunkPromises = Object.keys(installedI18nChunks).map(chunks => {
|
265
|
-
if (chunks !== './runtime~main' && installedI18nChunks[chunks] == 0) {
|
266
|
-
installedI18nChunks[chunks] = null;
|
267
|
-
return downloadScriptTagForI18nDynamicChunks(chunks, language);
|
268
|
-
}
|
269
|
-
});
|
270
|
-
|
271
|
-
Promise.all(chunkPromises)
|
272
|
-
.then(() => {
|
273
|
-
resolve();
|
274
|
-
})
|
275
|
-
.catch(error => {
|
276
|
-
reject(error);
|
277
|
-
});
|
278
|
-
});
|
279
|
-
};`]);
|
251
|
+
})()`]);
|
280
252
|
});
|
281
253
|
}
|
282
254
|
|
@@ -284,8 +256,7 @@ ${mainTemplate.requireFn}.changeLanguage = function changeLanguage(language) {
|
|
284
256
|
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
285
257
|
const {
|
286
258
|
mainTemplate
|
287
|
-
} = compilation;
|
288
|
-
|
259
|
+
} = compilation;
|
289
260
|
this.addDownloadLogicOfI18nInMainTemplate(mainTemplate);
|
290
261
|
});
|
291
262
|
}
|
package/lib/schemas/index.js
CHANGED
@@ -125,6 +125,7 @@ var _default = {
|
|
125
125
|
cssDirStatement: null
|
126
126
|
},
|
127
127
|
app: {
|
128
|
+
externals: null,
|
128
129
|
moduleResolvePath: {
|
129
130
|
value: '@zohodesk/client_packages_group',
|
130
131
|
cli: 'module_resolve_path'
|
@@ -732,7 +733,6 @@ var _default = {
|
|
732
733
|
fileName: null,
|
733
734
|
options: null,
|
734
735
|
excludeKeys: null
|
735
|
-
}
|
736
|
-
externals: null
|
736
|
+
}
|
737
737
|
};
|
738
738
|
exports.default = _default;
|