@zohodesk/react-cli 1.1.14-exp.3 → 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 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
- 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
- */
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,18 +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 downloadScriptTagForI18nDynamicChunks(chunkName = '', language = '') {
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
- locale = language;
219
- }
220
214
  if(installedI18nChunks[chunkId]) {
221
215
  promises.push(installedI18nChunks[chunkId]);
222
216
  } else if(installedI18nChunks[chunkId] !== 0 && i18nChunks[chunkId]) {
@@ -251,20 +245,10 @@ function downloadScriptTagForI18nDynamicChunks(chunkName = '', language = '') {
251
245
  }` : ''}
252
246
  document.body.appendChild(scriptTag);
253
247
  }).then(function() {
254
- installedI18nChunks[chunkId] = 0;
248
+ installedI18nChunks[chunkId] = 0;
255
249
  }));
256
250
  }
257
- };
258
- downloadScriptTagForI18nDynamicChunks();
259
- ${mainTemplate.requireFn}.changeLanguage = function changeLanguage(language) {
260
- window.updateLanguage(language);
261
- window.userLangCode=language;
262
- Object.keys(installedI18nChunks).map(chunks => {
263
- if (chunks !== './runtime~main' && installedI18nChunks[chunks] == 0) {
264
- installedI18nChunks[chunks] = null;
265
- downloadScriptTagForI18nDynamicChunks(chunks, language);
266
- }
267
- });}`]);
251
+ })()`]);
268
252
  });
269
253
  }
270
254
 
@@ -272,8 +256,7 @@ downloadScriptTagForI18nDynamicChunks();
272
256
  compiler.hooks.thisCompilation.tap(pluginName, compilation => {
273
257
  const {
274
258
  mainTemplate
275
- } = compilation; // this.createChangeLanguageFunction(mainTemplate);
276
-
259
+ } = compilation;
277
260
  this.addDownloadLogicOfI18nInMainTemplate(mainTemplate);
278
261
  });
279
262
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.14-exp.3",
3
+ "version": "1.1.14-exp.6",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",