@zohodesk/react-cli 1.1.16-exp.3 → 1.1.16-exp.5

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/bin/cli.js CHANGED
@@ -300,6 +300,8 @@ switch (option) {
300
300
  'src',
301
301
  '-d',
302
302
  'lib',
303
+ '--extensions',
304
+ '.js,.ts',
303
305
  `--presets=${require.resolve('../lib/babel/cmjs-plugins-presets.js')}`,
304
306
  '--copy-files'
305
307
  ].concat(args),
@@ -316,6 +318,8 @@ switch (option) {
316
318
  'src',
317
319
  '--out-dir',
318
320
  'es',
321
+ '--extensions',
322
+ '.js,.ts',
319
323
  `--presets=${require.resolve('../lib/babel/es-plugins-presets.js')}`,
320
324
  '--copy-files'
321
325
  ].concat(args),
@@ -15,7 +15,7 @@ let {
15
15
  let isProd = mode.toLowerCase() === 'prod';
16
16
 
17
17
  var _default = () => ({
18
- presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react')],
18
+ presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')],
19
19
  plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
20
20
  __DOCS__: false
21
21
  } : {}]]
@@ -25,7 +25,7 @@ var _default = () => ({
25
25
  }
26
26
  } : {
27
27
  modules: false
28
- }], require.resolve('@babel/preset-react')],
28
+ }], require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')],
29
29
  plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
30
30
  __DOCS__: false
31
31
  } : {}], require.resolve('@babel/plugin-syntax-dynamic-import')]
@@ -103,10 +103,6 @@ module.exports = isSSTest => ({
103
103
  interpolate: 'require'
104
104
  }
105
105
  }
106
- }, {
107
- test: /\.ts$/,
108
- use: 'ts-loader',
109
- include: _path.default.join(appPath, folder)
110
106
  }, {
111
107
  test: /\.mjs$/,
112
108
  include: /node_modules/,
@@ -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,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 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
- 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
- return installedI18nChunks[chunkId];
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; // this.createChangeLanguageFunction(mainTemplate);
288
-
259
+ } = compilation;
289
260
  this.addDownloadLogicOfI18nInMainTemplate(mainTemplate);
290
261
  });
291
262
  }
@@ -734,7 +734,6 @@ var _default = {
734
734
  fileName: null,
735
735
  options: null,
736
736
  excludeKeys: null
737
- },
738
- externals: null
737
+ }
739
738
  };
740
739
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.16-exp.3",
3
+ "version": "1.1.16-exp.5",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",