innetjs 3.0.2-alpha.4 → 3.0.2-alpha.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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  ;(function () {
4
- const env = {"__INNETJS__PACKAGE_VERSION":"3.0.2-alpha.4"};
4
+ const env = {"__INNETJS__PACKAGE_VERSION":"3.0.2-alpha.6"};
5
5
  if (typeof process === 'undefined') {
6
6
  globalThis.process = { env: env };
7
7
  } else if (process.env) {
@@ -1,5 +1,5 @@
1
1
  ;(function () {
2
- const env = {"__INNETJS__PACKAGE_VERSION":"3.0.2-alpha.4"};
2
+ const env = {"__INNETJS__PACKAGE_VERSION":"3.0.2-alpha.6"};
3
3
  if (typeof process === 'undefined') {
4
4
  globalThis.process = { env: env };
5
5
  } else if (process.env) {
package/bin/innet CHANGED
@@ -531,22 +531,27 @@ class InnetJS {
531
531
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
532
532
  const pkg = yield this.getPackage();
533
533
  const build = (format) => tslib.__awaiter(this, void 0, void 0, function* () {
534
- var _a, _b, _c;
535
- const ext = format === 'iife'
536
- ? ((_a = (pkg.browser || pkg.unpkg || pkg.jsdelivr)) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.min.js'
537
- : format === 'es'
538
- ? ((_b = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.mjs'
539
- : ((_c = pkg.main) === null || _c === void 0 ? void 0 : _c.replace('index', '')) || '.js';
534
+ var _a, _b;
535
+ const ext = format === 'es'
536
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
537
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
540
538
  const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
541
539
  if (!input.length) {
542
540
  throw Error('index file is not detected');
543
541
  }
544
- const options = {
545
- input,
546
- external: ['tslib'],
547
- treeshake: false,
548
- output: {
542
+ const output = format === 'iife'
543
+ ? {
544
+ file: path__default["default"].join(releaseFolder, pkg.browser || 'index.min.js'),
545
+ inlineDynamicImports: true,
546
+ name: pkg.browserName || pkg.name
547
+ .split('-')
548
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
549
+ .join(''),
550
+ }
551
+ : {
549
552
  dir: releaseFolder,
553
+ preserveModules: true,
554
+ exports: 'named',
550
555
  entryFileNames: ({ name, facadeModuleId }) => {
551
556
  if (REG_TJSX.test(facadeModuleId)) {
552
557
  return `${name}${ext}`;
@@ -554,11 +559,12 @@ class InnetJS {
554
559
  const match = facadeModuleId.match(REG_EXT);
555
560
  return match ? `${name}${match[0]}${ext}` : `${name}${ext}`;
556
561
  },
557
- format,
558
- preserveModules: format !== 'iife',
559
- inlineDynamicImports: format === 'iife',
560
- exports: 'named',
561
- },
562
+ };
563
+ const options = {
564
+ input,
565
+ external: ['tslib'],
566
+ treeshake: false,
567
+ output: Object.assign(Object.assign({}, output), { format }),
562
568
  plugins: [
563
569
  json__default["default"](),
564
570
  ts__default["default"]({
@@ -585,6 +591,9 @@ class InnetJS {
585
591
  external__default["default"](),
586
592
  ],
587
593
  };
594
+ if (format === 'iife') {
595
+ options.plugins.push(rollupPluginTerser.terser());
596
+ }
588
597
  this.withLint(options);
589
598
  this.withEnv(options, true);
590
599
  const bundle = yield rollup__default["default"].rollup(options);
@@ -598,7 +607,7 @@ class InnetJS {
598
607
  yield build('es');
599
608
  }));
600
609
  if (min) {
601
- yield logger__default["default"].start('Build es6 bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
610
+ yield logger__default["default"].start('Build min bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
602
611
  yield build('iife');
603
612
  }));
604
613
  }
@@ -804,7 +813,7 @@ class InnetJS {
804
813
  }
805
814
 
806
815
  (function () {
807
- const env = {"__INNETJS__PACKAGE_VERSION":"3.0.2-alpha.4"};
816
+ const env = {"__INNETJS__PACKAGE_VERSION":"3.0.2-alpha.6"};
808
817
  if (typeof process === 'undefined') {
809
818
  globalThis.process = { env: env };
810
819
  } else if (process.env) {
package/index.js CHANGED
@@ -459,22 +459,27 @@ class InnetJS {
459
459
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
460
460
  const pkg = yield this.getPackage();
461
461
  const build = (format) => tslib.__awaiter(this, void 0, void 0, function* () {
462
- var _a, _b, _c;
463
- const ext = format === 'iife'
464
- ? ((_a = (pkg.browser || pkg.unpkg || pkg.jsdelivr)) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.min.js'
465
- : format === 'es'
466
- ? ((_b = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.mjs'
467
- : ((_c = pkg.main) === null || _c === void 0 ? void 0 : _c.replace('index', '')) || '.js';
462
+ var _a, _b;
463
+ const ext = format === 'es'
464
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
465
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
468
466
  const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
469
467
  if (!input.length) {
470
468
  throw Error('index file is not detected');
471
469
  }
472
- const options = {
473
- input,
474
- external: ['tslib'],
475
- treeshake: false,
476
- output: {
470
+ const output = format === 'iife'
471
+ ? {
472
+ file: path__default["default"].join(releaseFolder, pkg.browser || 'index.min.js'),
473
+ inlineDynamicImports: true,
474
+ name: pkg.browserName || pkg.name
475
+ .split('-')
476
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
477
+ .join(''),
478
+ }
479
+ : {
477
480
  dir: releaseFolder,
481
+ preserveModules: true,
482
+ exports: 'named',
478
483
  entryFileNames: ({ name, facadeModuleId }) => {
479
484
  if (REG_TJSX.test(facadeModuleId)) {
480
485
  return `${name}${ext}`;
@@ -482,11 +487,12 @@ class InnetJS {
482
487
  const match = facadeModuleId.match(REG_EXT);
483
488
  return match ? `${name}${match[0]}${ext}` : `${name}${ext}`;
484
489
  },
485
- format,
486
- preserveModules: format !== 'iife',
487
- inlineDynamicImports: format === 'iife',
488
- exports: 'named',
489
- },
490
+ };
491
+ const options = {
492
+ input,
493
+ external: ['tslib'],
494
+ treeshake: false,
495
+ output: Object.assign(Object.assign({}, output), { format }),
490
496
  plugins: [
491
497
  json__default["default"](),
492
498
  ts__default["default"]({
@@ -513,6 +519,9 @@ class InnetJS {
513
519
  external__default["default"](),
514
520
  ],
515
521
  };
522
+ if (format === 'iife') {
523
+ options.plugins.push(rollupPluginTerser.terser());
524
+ }
516
525
  this.withLint(options);
517
526
  this.withEnv(options, true);
518
527
  const bundle = yield rollup__default["default"].rollup(options);
@@ -526,7 +535,7 @@ class InnetJS {
526
535
  yield build('es');
527
536
  }));
528
537
  if (min) {
529
- yield logger__default["default"].start('Build es6 bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
538
+ yield logger__default["default"].start('Build min bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
530
539
  yield build('iife');
531
540
  }));
532
541
  }
package/index.mjs CHANGED
@@ -422,22 +422,27 @@ class InnetJS {
422
422
  yield logger.start('Remove previous release', () => fs.remove(releaseFolder));
423
423
  const pkg = yield this.getPackage();
424
424
  const build = (format) => __awaiter(this, void 0, void 0, function* () {
425
- var _a, _b, _c;
426
- const ext = format === 'iife'
427
- ? ((_a = (pkg.browser || pkg.unpkg || pkg.jsdelivr)) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.min.js'
428
- : format === 'es'
429
- ? ((_b = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.mjs'
430
- : ((_c = pkg.main) === null || _c === void 0 ? void 0 : _c.replace('index', '')) || '.js';
425
+ var _a, _b;
426
+ const ext = format === 'es'
427
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
428
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
431
429
  const input = glob.sync(`src/${index}.{${indexExt}}`);
432
430
  if (!input.length) {
433
431
  throw Error('index file is not detected');
434
432
  }
435
- const options = {
436
- input,
437
- external: ['tslib'],
438
- treeshake: false,
439
- output: {
433
+ const output = format === 'iife'
434
+ ? {
435
+ file: path.join(releaseFolder, pkg.browser || 'index.min.js'),
436
+ inlineDynamicImports: true,
437
+ name: pkg.browserName || pkg.name
438
+ .split('-')
439
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
440
+ .join(''),
441
+ }
442
+ : {
440
443
  dir: releaseFolder,
444
+ preserveModules: true,
445
+ exports: 'named',
441
446
  entryFileNames: ({ name, facadeModuleId }) => {
442
447
  if (REG_TJSX.test(facadeModuleId)) {
443
448
  return `${name}${ext}`;
@@ -445,11 +450,12 @@ class InnetJS {
445
450
  const match = facadeModuleId.match(REG_EXT);
446
451
  return match ? `${name}${match[0]}${ext}` : `${name}${ext}`;
447
452
  },
448
- format,
449
- preserveModules: format !== 'iife',
450
- inlineDynamicImports: format === 'iife',
451
- exports: 'named',
452
- },
453
+ };
454
+ const options = {
455
+ input,
456
+ external: ['tslib'],
457
+ treeshake: false,
458
+ output: Object.assign(Object.assign({}, output), { format }),
453
459
  plugins: [
454
460
  json(),
455
461
  ts({
@@ -476,6 +482,9 @@ class InnetJS {
476
482
  external(),
477
483
  ],
478
484
  };
485
+ if (format === 'iife') {
486
+ options.plugins.push(terser());
487
+ }
479
488
  this.withLint(options);
480
489
  this.withEnv(options, true);
481
490
  const bundle = yield rollup.rollup(options);
@@ -489,7 +498,7 @@ class InnetJS {
489
498
  yield build('es');
490
499
  }));
491
500
  if (min) {
492
- yield logger.start('Build es6 bundle', () => __awaiter(this, void 0, void 0, function* () {
501
+ yield logger.start('Build min bundle', () => __awaiter(this, void 0, void 0, function* () {
493
502
  yield build('iife');
494
503
  }));
495
504
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "3.0.2-alpha.4",
3
+ "version": "3.0.2-alpha.6",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",