innetjs 2.2.16 → 2.2.18

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/innet CHANGED
@@ -24,6 +24,7 @@ var linesAndColumns = require('lines-and-columns');
24
24
  var path$1 = require('node:path');
25
25
  var prompt = require('prompts');
26
26
  var rollup = require('rollup');
27
+ var external = require('rollup-plugin-external-node-modules');
27
28
  var filesize = require('rollup-plugin-filesize');
28
29
  var jsx = require('rollup-plugin-innet-jsx');
29
30
  var externals = require('rollup-plugin-node-externals');
@@ -58,6 +59,7 @@ var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
58
59
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
59
60
  var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
60
61
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
62
+ var external__default = /*#__PURE__*/_interopDefaultLegacy(external);
61
63
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
62
64
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
63
65
  var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
@@ -189,6 +191,8 @@ const execAsync = node_util.promisify(exec);
189
191
  const copyFiles = node_util.promisify(fs__default["default"].copy);
190
192
  updateDotenv();
191
193
  const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
194
+ const REG_TJSX = /\.[tj]sx?$/;
195
+ const REG_EXT = /\.([^.]+)$/;
192
196
  const scriptExtensions = ['ts', 'js', 'tsx', 'jsx'];
193
197
  const indexExt = scriptExtensions.join(',');
194
198
  class InnetJS {
@@ -497,7 +501,7 @@ class InnetJS {
497
501
  }));
498
502
  });
499
503
  }
500
- release({ node = false, index = 'index', pub } = {}) {
504
+ release({ index = 'index', pub } = {}) {
501
505
  return tslib.__awaiter(this, void 0, void 0, function* () {
502
506
  const { releaseFolder, cssModules } = this;
503
507
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
@@ -513,59 +517,50 @@ class InnetJS {
513
517
  }
514
518
  const options = {
515
519
  input,
516
- external: [...Object.keys(pkg.dependencies), 'tslib'],
517
- preserveEntrySignatures: 'strict',
520
+ external: ['tslib'],
521
+ treeshake: false,
518
522
  output: {
519
523
  dir: releaseFolder,
520
- entryFileNames: `[name]${ext}`,
524
+ entryFileNames: ({ name, facadeModuleId }) => {
525
+ if (REG_TJSX.test(facadeModuleId)) {
526
+ return `${name}${ext}`;
527
+ }
528
+ const match = facadeModuleId.match(REG_EXT);
529
+ return match ? `${name}${match[0]}${ext}` : `${name}${ext}`;
530
+ },
521
531
  format,
522
532
  preserveModules: true,
523
- exports: 'auto',
533
+ exports: 'named',
524
534
  },
525
535
  plugins: [
526
536
  json__default["default"](),
527
537
  typescript__default["default"]({
528
538
  clean: true,
529
- useTsconfigDeclarationDir: true,
530
539
  tsconfigOverride: {
531
540
  compilerOptions: {
532
- declarationDir: releaseFolder,
533
541
  sourceMap: false,
534
542
  },
535
543
  },
536
544
  }),
537
545
  jsx__default["default"](),
538
- ],
539
- };
540
- this.withLint(options);
541
- if (node) {
542
- options.plugins = [
543
- ...options.plugins,
546
+ external__default["default"](),
544
547
  externals__default["default"](),
545
- string({
546
- include: '**/*.*',
547
- exclude: stringExcludeNode,
548
- }),
549
- ];
550
- }
551
- else {
552
- options.plugins = [
553
- ...options.plugins,
554
548
  string({
555
549
  include: '**/*.*',
556
550
  exclude: stringExcludeDom,
557
551
  }),
558
- polyfill__default["default"](),
559
552
  image__default["default"](),
560
553
  styles__default["default"]({
561
- mode: 'inject',
562
- url: true,
554
+ mode: this.cssInJs ? 'inject' : 'extract',
563
555
  plugins: [autoprefixer__default["default"]()],
564
556
  modules: cssModules,
565
557
  minimize: true,
558
+ autoModules: true,
566
559
  }),
567
- ];
568
- }
560
+ pluginNodeResolve.nodeResolve(),
561
+ ],
562
+ };
563
+ this.withLint(options);
569
564
  this.withEnv(options);
570
565
  const bundle = yield rollup__default["default"].rollup(options);
571
566
  yield bundle.write(options.output);
@@ -765,7 +760,7 @@ class InnetJS {
765
760
  }
766
761
 
767
762
  (function () {
768
- const env = {"__INNETJS__PACKAGE_VERSION":"2.2.16"};
763
+ const env = {"__INNETJS__PACKAGE_VERSION":"2.2.18"};
769
764
  if (typeof process === 'undefined') {
770
765
  globalThis.process = { env: env };
771
766
  } else if (process.env) {
@@ -837,13 +832,12 @@ commander.program
837
832
  commander.program
838
833
  .command('release')
839
834
  .description('Release new version of your library')
840
- .option('-n, --node', 'Release for node.js')
841
835
  .option('-i, --index <index>', 'Root index file name', 'index')
842
836
  .option('-p, --public', 'Public the package')
843
837
  .addOption(releaseOption)
844
838
  .addOption(errorOption)
845
- .action(({ error, node, index, public: pub }) => {
846
- innetJS.release({ node, index, pub }).catch(e => {
839
+ .action(({ error, index, public: pub }) => {
840
+ innetJS.release({ index, pub }).catch(e => {
847
841
  if (error) {
848
842
  console.error(e);
849
843
  process.exit(1);
package/index.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare class InnetJS {
61
61
  index?: string;
62
62
  }): Promise<void>;
63
63
  run(file: any): Promise<void>;
64
- release({ node, index, pub }?: ReleaseOptions): Promise<void>;
64
+ release({ index, pub }?: ReleaseOptions): Promise<void>;
65
65
  private _lintUsage;
66
66
  withLint(options: rollup.RollupOptions): void;
67
67
  withEnv(options: rollup.RollupOptions): void;
package/index.js CHANGED
@@ -24,6 +24,7 @@ var linesAndColumns = require('lines-and-columns');
24
24
  var path = require('node:path');
25
25
  var prompt = require('prompts');
26
26
  var rollup = require('rollup');
27
+ var external = require('rollup-plugin-external-node-modules');
27
28
  var filesize = require('rollup-plugin-filesize');
28
29
  var jsx = require('rollup-plugin-innet-jsx');
29
30
  var externals = require('rollup-plugin-node-externals');
@@ -61,6 +62,7 @@ var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
61
62
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
62
63
  var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
63
64
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
65
+ var external__default = /*#__PURE__*/_interopDefaultLegacy(external);
64
66
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
65
67
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
66
68
  var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
@@ -71,7 +73,7 @@ var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript);
71
73
  var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
72
74
 
73
75
  (function () {
74
- const env = {"__INNETJS__PACKAGE_VERSION":"2.2.16"};
76
+ const env = {"__INNETJS__PACKAGE_VERSION":"2.2.18"};
75
77
  if (typeof process === 'undefined') {
76
78
  globalThis.process = { env: env };
77
79
  } else if (process.env) {
@@ -88,6 +90,8 @@ const execAsync = node_util.promisify(exec);
88
90
  const copyFiles = node_util.promisify(fs__default["default"].copy);
89
91
  updateDotenv.updateDotenv();
90
92
  const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
93
+ const REG_TJSX = /\.[tj]sx?$/;
94
+ const REG_EXT = /\.([^.]+)$/;
91
95
  const scriptExtensions = ['ts', 'js', 'tsx', 'jsx'];
92
96
  const indexExt = scriptExtensions.join(',');
93
97
  class InnetJS {
@@ -396,7 +400,7 @@ class InnetJS {
396
400
  }));
397
401
  });
398
402
  }
399
- release({ node = false, index = 'index', pub } = {}) {
403
+ release({ index = 'index', pub } = {}) {
400
404
  return tslib.__awaiter(this, void 0, void 0, function* () {
401
405
  const { releaseFolder, cssModules } = this;
402
406
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
@@ -412,59 +416,50 @@ class InnetJS {
412
416
  }
413
417
  const options = {
414
418
  input,
415
- external: [...Object.keys(pkg.dependencies), 'tslib'],
416
- preserveEntrySignatures: 'strict',
419
+ external: ['tslib'],
420
+ treeshake: false,
417
421
  output: {
418
422
  dir: releaseFolder,
419
- entryFileNames: `[name]${ext}`,
423
+ entryFileNames: ({ name, facadeModuleId }) => {
424
+ if (REG_TJSX.test(facadeModuleId)) {
425
+ return `${name}${ext}`;
426
+ }
427
+ const match = facadeModuleId.match(REG_EXT);
428
+ return match ? `${name}${match[0]}${ext}` : `${name}${ext}`;
429
+ },
420
430
  format,
421
431
  preserveModules: true,
422
- exports: 'auto',
432
+ exports: 'named',
423
433
  },
424
434
  plugins: [
425
435
  json__default["default"](),
426
436
  typescript__default["default"]({
427
437
  clean: true,
428
- useTsconfigDeclarationDir: true,
429
438
  tsconfigOverride: {
430
439
  compilerOptions: {
431
- declarationDir: releaseFolder,
432
440
  sourceMap: false,
433
441
  },
434
442
  },
435
443
  }),
436
444
  jsx__default["default"](),
437
- ],
438
- };
439
- this.withLint(options);
440
- if (node) {
441
- options.plugins = [
442
- ...options.plugins,
445
+ external__default["default"](),
443
446
  externals__default["default"](),
444
- string({
445
- include: '**/*.*',
446
- exclude: constants.stringExcludeNode,
447
- }),
448
- ];
449
- }
450
- else {
451
- options.plugins = [
452
- ...options.plugins,
453
447
  string({
454
448
  include: '**/*.*',
455
449
  exclude: constants.stringExcludeDom,
456
450
  }),
457
- polyfill__default["default"](),
458
451
  image__default["default"](),
459
452
  styles__default["default"]({
460
- mode: 'inject',
461
- url: true,
453
+ mode: this.cssInJs ? 'inject' : 'extract',
462
454
  plugins: [autoprefixer__default["default"]()],
463
455
  modules: cssModules,
464
456
  minimize: true,
457
+ autoModules: true,
465
458
  }),
466
- ];
467
- }
459
+ pluginNodeResolve.nodeResolve(),
460
+ ],
461
+ };
462
+ this.withLint(options);
468
463
  this.withEnv(options);
469
464
  const bundle = yield rollup__default["default"].rollup(options);
470
465
  yield bundle.write(options.output);
package/index.mjs CHANGED
@@ -20,6 +20,7 @@ import { LinesAndColumns } from 'lines-and-columns';
20
20
  import path from 'node:path';
21
21
  import prompt from 'prompts';
22
22
  import rollup from 'rollup';
23
+ import external from 'rollup-plugin-external-node-modules';
23
24
  import filesize from 'rollup-plugin-filesize';
24
25
  import jsx from 'rollup-plugin-innet-jsx';
25
26
  import externals from 'rollup-plugin-node-externals';
@@ -37,7 +38,7 @@ import { reporter, convertIndexFile, getFile } from './helpers.mjs';
37
38
  import { updateDotenv } from './updateDotenv.mjs';
38
39
 
39
40
  (function () {
40
- const env = {"__INNETJS__PACKAGE_VERSION":"2.2.16"};
41
+ const env = {"__INNETJS__PACKAGE_VERSION":"2.2.18"};
41
42
  if (typeof process === 'undefined') {
42
43
  globalThis.process = { env: env };
43
44
  } else if (process.env) {
@@ -54,6 +55,8 @@ const execAsync = promisify(exec);
54
55
  const copyFiles = promisify(fs.copy);
55
56
  updateDotenv();
56
57
  const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
58
+ const REG_TJSX = /\.[tj]sx?$/;
59
+ const REG_EXT = /\.([^.]+)$/;
57
60
  const scriptExtensions = ['ts', 'js', 'tsx', 'jsx'];
58
61
  const indexExt = scriptExtensions.join(',');
59
62
  class InnetJS {
@@ -362,7 +365,7 @@ class InnetJS {
362
365
  }));
363
366
  });
364
367
  }
365
- release({ node = false, index = 'index', pub } = {}) {
368
+ release({ index = 'index', pub } = {}) {
366
369
  return __awaiter(this, void 0, void 0, function* () {
367
370
  const { releaseFolder, cssModules } = this;
368
371
  yield logger.start('Remove previous release', () => fs.remove(releaseFolder));
@@ -378,59 +381,50 @@ class InnetJS {
378
381
  }
379
382
  const options = {
380
383
  input,
381
- external: [...Object.keys(pkg.dependencies), 'tslib'],
382
- preserveEntrySignatures: 'strict',
384
+ external: ['tslib'],
385
+ treeshake: false,
383
386
  output: {
384
387
  dir: releaseFolder,
385
- entryFileNames: `[name]${ext}`,
388
+ entryFileNames: ({ name, facadeModuleId }) => {
389
+ if (REG_TJSX.test(facadeModuleId)) {
390
+ return `${name}${ext}`;
391
+ }
392
+ const match = facadeModuleId.match(REG_EXT);
393
+ return match ? `${name}${match[0]}${ext}` : `${name}${ext}`;
394
+ },
386
395
  format,
387
396
  preserveModules: true,
388
- exports: 'auto',
397
+ exports: 'named',
389
398
  },
390
399
  plugins: [
391
400
  json(),
392
401
  typescript({
393
402
  clean: true,
394
- useTsconfigDeclarationDir: true,
395
403
  tsconfigOverride: {
396
404
  compilerOptions: {
397
- declarationDir: releaseFolder,
398
405
  sourceMap: false,
399
406
  },
400
407
  },
401
408
  }),
402
409
  jsx(),
403
- ],
404
- };
405
- this.withLint(options);
406
- if (node) {
407
- options.plugins = [
408
- ...options.plugins,
410
+ external(),
409
411
  externals(),
410
- string({
411
- include: '**/*.*',
412
- exclude: stringExcludeNode,
413
- }),
414
- ];
415
- }
416
- else {
417
- options.plugins = [
418
- ...options.plugins,
419
412
  string({
420
413
  include: '**/*.*',
421
414
  exclude: stringExcludeDom,
422
415
  }),
423
- polyfill(),
424
416
  image(),
425
417
  styles({
426
- mode: 'inject',
427
- url: true,
418
+ mode: this.cssInJs ? 'inject' : 'extract',
428
419
  plugins: [autoprefixer()],
429
420
  modules: cssModules,
430
421
  minimize: true,
422
+ autoModules: true,
431
423
  }),
432
- ];
433
- }
424
+ nodeResolve(),
425
+ ],
426
+ };
427
+ this.withLint(options);
434
428
  this.withEnv(options);
435
429
  const bundle = yield rollup.rollup(options);
436
430
  yield bundle.write(options.output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "2.2.16",
3
+ "version": "2.2.18",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
@@ -71,17 +71,18 @@
71
71
  "postcss": "^8.4.18",
72
72
  "prompts": "^2.4.2",
73
73
  "rollup": "^2.79.1",
74
+ "rollup-plugin-external-node-modules": "^1.0.0",
74
75
  "rollup-plugin-filesize": "^9.1.2",
75
- "rollup-plugin-process-env": "^1.0.4",
76
76
  "rollup-plugin-innet-jsx": "^1.3.2",
77
77
  "rollup-plugin-livereload": "^2.0.5",
78
78
  "rollup-plugin-node-externals": "^5.0.2",
79
79
  "rollup-plugin-polyfill-node": "^0.11.0",
80
80
  "rollup-plugin-preserve-shebangs": "^0.2.0",
81
+ "rollup-plugin-process-env": "^1.0.4",
81
82
  "rollup-plugin-string": "^3.0.0",
82
83
  "rollup-plugin-styles": "^4.0.0",
83
84
  "rollup-plugin-terser": "^7.0.2",
84
- "rollup-plugin-typescript2": "^0.33.0",
85
+ "rollup-plugin-typescript2": "^0.34.1",
85
86
  "sass": "^1.55.0",
86
87
  "tmp": "^0.2.1",
87
88
  "typescript": "^4.8.4",