innetjs 2.2.9 → 2.2.10

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_INNETJS_PACKAGE_VERSION":"2.2.9"};
4
+ const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.10"};
5
5
  try {
6
6
  if (process) {
7
7
  process.env = Object.assign({}, process.env);
@@ -1,5 +1,5 @@
1
1
  (function() {
2
- const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.9"};
2
+ const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.10"};
3
3
  try {
4
4
  if (process) {
5
5
  process.env = Object.assign({}, process.env);
package/bin/innet CHANGED
@@ -25,11 +25,11 @@ var path$1 = require('node:path');
25
25
  var prompt = require('prompts');
26
26
  var rollup = require('rollup');
27
27
  var filesize = require('rollup-plugin-filesize');
28
- var injectEnv = require('rollup-plugin-inject-process-env');
29
28
  var jsx = require('rollup-plugin-innet-jsx');
30
29
  var externals = require('rollup-plugin-node-externals');
31
30
  var polyfill = require('rollup-plugin-polyfill-node');
32
31
  var rollupPluginPreserveShebangs = require('rollup-plugin-preserve-shebangs');
32
+ var env = require('rollup-plugin-process-env');
33
33
  var styles = require('rollup-plugin-styles');
34
34
  var rollupPluginTerser = require('rollup-plugin-terser');
35
35
  var typescript = require('rollup-plugin-typescript2');
@@ -59,16 +59,16 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
59
59
  var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
60
60
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
61
61
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
62
- var injectEnv__default = /*#__PURE__*/_interopDefaultLegacy(injectEnv);
63
62
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
64
63
  var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
65
64
  var polyfill__default = /*#__PURE__*/_interopDefaultLegacy(polyfill);
65
+ var env__default = /*#__PURE__*/_interopDefaultLegacy(env);
66
66
  var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
67
67
  var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript);
68
68
  var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
69
69
 
70
70
  (function() {
71
- const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.9"};
71
+ const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.10"};
72
72
  try {
73
73
  if (process) {
74
74
  process.env = Object.assign({}, process.env);
@@ -305,11 +305,9 @@ class InnetJS {
305
305
  json__default["default"](),
306
306
  typescript__default["default"](),
307
307
  jsx__default["default"](),
308
- eslint__default["default"]({
309
- include: lintInclude,
310
- }),
311
308
  ],
312
309
  };
310
+ this.withLint(inputOptions);
313
311
  const outputOptions = {
314
312
  dir: this.buildFolder,
315
313
  sourcemap: this.sourcemap,
@@ -335,7 +333,7 @@ class InnetJS {
335
333
  }), string({
336
334
  include: '**/*.*',
337
335
  exclude: stringExcludeDom,
338
- }), injectEnv__default["default"](innetEnv));
336
+ }), env__default["default"](innetEnv, { include: input }));
339
337
  outputOptions.format = 'es';
340
338
  outputOptions.plugins = [
341
339
  rollupPluginTerser.terser(),
@@ -397,11 +395,9 @@ class InnetJS {
397
395
  },
398
396
  }),
399
397
  jsx__default["default"](),
400
- eslint__default["default"]({
401
- include: lintInclude,
402
- }),
403
398
  ],
404
399
  };
400
+ this.withLint(options);
405
401
  if (node) {
406
402
  // @ts-expect-error
407
403
  options.output.format = 'cjs';
@@ -435,7 +431,7 @@ class InnetJS {
435
431
  }), string({
436
432
  include: '**/*.*',
437
433
  exclude: stringExcludeDom,
438
- }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), injectEnv__default["default"](innetEnv));
434
+ }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), env__default["default"](innetEnv, { include: input }));
439
435
  }
440
436
  const watcher = rollup__default["default"].watch(options);
441
437
  watcher.on('event', (e) => tslib.__awaiter(this, void 0, void 0, function* () {
@@ -519,74 +515,75 @@ class InnetJS {
519
515
  const { releaseFolder, cssModules } = this;
520
516
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
521
517
  const pkg = yield this.getPackage();
522
- function build(format) {
518
+ const build = (format) => tslib.__awaiter(this, void 0, void 0, function* () {
523
519
  var _a, _b;
524
- return tslib.__awaiter(this, void 0, void 0, function* () {
525
- const ext = format === 'es'
526
- ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
527
- : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
528
- const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
529
- if (!input.length) {
530
- throw Error('index file is not detected');
531
- }
532
- const options = {
533
- input,
534
- preserveEntrySignatures: 'strict',
535
- output: {
536
- dir: releaseFolder,
537
- entryFileNames: `[name]${ext}`,
538
- format,
539
- preserveModules: true,
540
- },
541
- plugins: [
542
- json__default["default"](),
543
- typescript__default["default"]({
544
- rollupCommonJSResolveHack: false,
545
- clean: true,
546
- }),
547
- jsx__default["default"](),
548
- eslint__default["default"]({
549
- include: lintInclude,
550
- }),
551
- injectEnv__default["default"](innetEnv, {
552
- include: input,
553
- }),
554
- ],
555
- };
556
- if (node) {
557
- options.external = [...Object.keys(pkg.dependencies), 'tslib'];
558
- options.plugins = [
559
- ...options.plugins,
560
- externals__default["default"](),
561
- string({
562
- include: '**/*.*',
563
- exclude: stringExcludeNode,
564
- }),
565
- ];
566
- }
567
- else {
568
- options.plugins = [
569
- ...options.plugins,
570
- string({
571
- include: '**/*.*',
572
- exclude: stringExcludeDom,
573
- }),
574
- polyfill__default["default"](),
575
- image__default["default"](),
576
- styles__default["default"]({
577
- mode: 'inject',
578
- url: true,
579
- plugins: [autoprefixer__default["default"]()],
580
- modules: cssModules,
581
- minimize: true,
582
- }),
583
- ];
584
- }
585
- const bundle = yield rollup__default["default"].rollup(options);
586
- yield bundle.write(options.output);
587
- yield bundle.close();
588
- });
589
- }
520
+ const ext = format === 'es'
521
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
522
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
523
+ const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
524
+ if (!input.length) {
525
+ throw Error('index file is not detected');
526
+ }
527
+ const options = {
528
+ input,
529
+ external: [...Object.keys(pkg.dependencies), 'tslib'],
530
+ preserveEntrySignatures: 'strict',
531
+ output: {
532
+ dir: releaseFolder,
533
+ entryFileNames: `[name]${ext}`,
534
+ format,
535
+ preserveModules: true,
536
+ exports: 'auto',
537
+ },
538
+ plugins: [
539
+ json__default["default"](),
540
+ typescript__default["default"]({
541
+ clean: true,
542
+ useTsconfigDeclarationDir: true,
543
+ tsconfigOverride: {
544
+ compilerOptions: {
545
+ declarationDir: releaseFolder,
546
+ sourceMap: false,
547
+ },
548
+ },
549
+ }),
550
+ jsx__default["default"](),
551
+ env__default["default"](innetEnv, { include: input }),
552
+ ],
553
+ };
554
+ this.withLint(options);
555
+ if (node) {
556
+ options.plugins = [
557
+ ...options.plugins,
558
+ externals__default["default"](),
559
+ string({
560
+ include: '**/*.*',
561
+ exclude: stringExcludeNode,
562
+ }),
563
+ ];
564
+ }
565
+ else {
566
+ options.plugins = [
567
+ ...options.plugins,
568
+ string({
569
+ include: '**/*.*',
570
+ exclude: stringExcludeDom,
571
+ }),
572
+ polyfill__default["default"](),
573
+ image__default["default"](),
574
+ styles__default["default"]({
575
+ mode: 'inject',
576
+ url: true,
577
+ plugins: [autoprefixer__default["default"]()],
578
+ modules: cssModules,
579
+ minimize: true,
580
+ }),
581
+ ];
582
+ }
583
+ const bundle = yield rollup__default["default"].rollup(options);
584
+ yield bundle.write(options.output);
585
+ yield bundle.close();
586
+ });
590
587
  yield logger__default["default"].start('Build cjs bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
591
588
  yield build('cjs');
592
589
  }));
@@ -604,7 +601,7 @@ class InnetJS {
604
601
  const { bin } = pkg;
605
602
  for (const name in bin) {
606
603
  const value = bin[name];
607
- const input = glob__default["default"].sync(`src/${value}.{${scriptExtensions.join(',')}}`);
604
+ const input = glob__default["default"].sync(`src/${value}.{${indexExt}}`);
608
605
  const file = path__default["default"].join(this.releaseFolder, value);
609
606
  const options = {
610
607
  input,
@@ -626,11 +623,10 @@ class InnetJS {
626
623
  }),
627
624
  externals__default["default"](),
628
625
  jsx__default["default"](),
629
- injectEnv__default["default"](innetEnv, {
630
- include: input,
631
- }),
626
+ env__default["default"](innetEnv, { include: input }),
632
627
  ],
633
628
  };
629
+ this.withLint(options);
634
630
  const bundle = yield rollup__default["default"].rollup(options);
635
631
  yield bundle.write(options.output);
636
632
  yield bundle.close();
@@ -660,6 +656,16 @@ class InnetJS {
660
656
  }
661
657
  });
662
658
  }
659
+ withLint(options) {
660
+ if (this._lintUsage === undefined) {
661
+ this._lintUsage = fs__default["default"].existsSync(path__default["default"].join(this.projectFolder, '.eslintrc'));
662
+ }
663
+ if (this._lintUsage) {
664
+ options.plugins.push(eslint__default["default"]({
665
+ include: lintInclude,
666
+ }));
667
+ }
668
+ }
663
669
  increaseVersion(release) {
664
670
  return tslib.__awaiter(this, void 0, void 0, function* () {
665
671
  const pkg = yield this.getPackage();
package/constants.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
-
7
5
  const lintInclude = [
8
6
  '**/*.ts',
9
7
  '**/*.tsx',
package/constants.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
-
3
1
  const lintInclude = [
4
2
  '**/*.ts',
5
3
  '**/*.tsx',
package/extract.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
5
  var unzipper = require('unzipper');
7
6
 
8
7
  const Writer = require('fstream').Writer;
package/extract.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
1
  import { Parse } from 'unzipper';
3
2
 
4
3
  const Writer = require('fstream').Writer;
package/helpers.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
5
  var tslib = require('tslib');
7
6
  var logger = require('@cantinc/logger');
8
7
  var chalk = require('chalk');
package/helpers.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
1
  import { __awaiter } from 'tslib';
3
2
  import logger from '@cantinc/logger';
4
3
  import chalk from 'chalk';
package/index.d.ts CHANGED
@@ -60,6 +60,8 @@ export declare class InnetJS {
60
60
  }): Promise<void>;
61
61
  run(file: any): Promise<void>;
62
62
  release({ node, index, pub }?: ReleaseOptions): Promise<void>;
63
+ private _lintUsage;
64
+ withLint(options: rollup.RollupOptions): void;
63
65
  increaseVersion(release: string): Promise<void>;
64
66
  getPackage(): Promise<Record<string, any>>;
65
67
  createClient(key: any, cert: any, pkg: any, index: string): rollup.Plugin;
package/index.js CHANGED
@@ -26,11 +26,11 @@ var path = require('node:path');
26
26
  var prompt = require('prompts');
27
27
  var rollup = require('rollup');
28
28
  var filesize = require('rollup-plugin-filesize');
29
- var injectEnv = require('rollup-plugin-inject-process-env');
30
29
  var jsx = require('rollup-plugin-innet-jsx');
31
30
  var externals = require('rollup-plugin-node-externals');
32
31
  var polyfill = require('rollup-plugin-polyfill-node');
33
32
  var rollupPluginPreserveShebangs = require('rollup-plugin-preserve-shebangs');
33
+ var env = require('rollup-plugin-process-env');
34
34
  var styles = require('rollup-plugin-styles');
35
35
  var rollupPluginTerser = require('rollup-plugin-terser');
36
36
  var typescript = require('rollup-plugin-typescript2');
@@ -63,10 +63,10 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
63
63
  var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
64
64
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
65
65
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
66
- var injectEnv__default = /*#__PURE__*/_interopDefaultLegacy(injectEnv);
67
66
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
68
67
  var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
69
68
  var polyfill__default = /*#__PURE__*/_interopDefaultLegacy(polyfill);
69
+ var env__default = /*#__PURE__*/_interopDefaultLegacy(env);
70
70
  var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
71
71
  var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript);
72
72
  var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
@@ -183,11 +183,9 @@ class InnetJS {
183
183
  json__default["default"](),
184
184
  typescript__default["default"](),
185
185
  jsx__default["default"](),
186
- eslint__default["default"]({
187
- include: constants.lintInclude,
188
- }),
189
186
  ],
190
187
  };
188
+ this.withLint(inputOptions);
191
189
  const outputOptions = {
192
190
  dir: this.buildFolder,
193
191
  sourcemap: this.sourcemap,
@@ -213,7 +211,7 @@ class InnetJS {
213
211
  }), string({
214
212
  include: '**/*.*',
215
213
  exclude: constants.stringExcludeDom,
216
- }), injectEnv__default["default"](innetEnv));
214
+ }), env__default["default"](innetEnv, { include: input }));
217
215
  outputOptions.format = 'es';
218
216
  outputOptions.plugins = [
219
217
  rollupPluginTerser.terser(),
@@ -275,11 +273,9 @@ class InnetJS {
275
273
  },
276
274
  }),
277
275
  jsx__default["default"](),
278
- eslint__default["default"]({
279
- include: constants.lintInclude,
280
- }),
281
276
  ],
282
277
  };
278
+ this.withLint(options);
283
279
  if (node) {
284
280
  // @ts-expect-error
285
281
  options.output.format = 'cjs';
@@ -313,7 +309,7 @@ class InnetJS {
313
309
  }), string({
314
310
  include: '**/*.*',
315
311
  exclude: constants.stringExcludeDom,
316
- }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), injectEnv__default["default"](innetEnv));
312
+ }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), env__default["default"](innetEnv, { include: input }));
317
313
  }
318
314
  const watcher = rollup__default["default"].watch(options);
319
315
  watcher.on('event', (e) => tslib.__awaiter(this, void 0, void 0, function* () {
@@ -397,74 +393,75 @@ class InnetJS {
397
393
  const { releaseFolder, cssModules } = this;
398
394
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
399
395
  const pkg = yield this.getPackage();
400
- function build(format) {
396
+ const build = (format) => tslib.__awaiter(this, void 0, void 0, function* () {
401
397
  var _a, _b;
402
- return tslib.__awaiter(this, void 0, void 0, function* () {
403
- const ext = format === 'es'
404
- ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
405
- : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
406
- const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
407
- if (!input.length) {
408
- throw Error('index file is not detected');
409
- }
410
- const options = {
411
- input,
412
- preserveEntrySignatures: 'strict',
413
- output: {
414
- dir: releaseFolder,
415
- entryFileNames: `[name]${ext}`,
416
- format,
417
- preserveModules: true,
418
- },
419
- plugins: [
420
- json__default["default"](),
421
- typescript__default["default"]({
422
- rollupCommonJSResolveHack: false,
423
- clean: true,
424
- }),
425
- jsx__default["default"](),
426
- eslint__default["default"]({
427
- include: constants.lintInclude,
428
- }),
429
- injectEnv__default["default"](innetEnv, {
430
- include: input,
431
- }),
432
- ],
433
- };
434
- if (node) {
435
- options.external = [...Object.keys(pkg.dependencies), 'tslib'];
436
- options.plugins = [
437
- ...options.plugins,
438
- externals__default["default"](),
439
- string({
440
- include: '**/*.*',
441
- exclude: constants.stringExcludeNode,
442
- }),
443
- ];
444
- }
445
- else {
446
- options.plugins = [
447
- ...options.plugins,
448
- string({
449
- include: '**/*.*',
450
- exclude: constants.stringExcludeDom,
451
- }),
452
- polyfill__default["default"](),
453
- image__default["default"](),
454
- styles__default["default"]({
455
- mode: 'inject',
456
- url: true,
457
- plugins: [autoprefixer__default["default"]()],
458
- modules: cssModules,
459
- minimize: true,
460
- }),
461
- ];
462
- }
463
- const bundle = yield rollup__default["default"].rollup(options);
464
- yield bundle.write(options.output);
465
- yield bundle.close();
466
- });
467
- }
398
+ const ext = format === 'es'
399
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
400
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
401
+ const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
402
+ if (!input.length) {
403
+ throw Error('index file is not detected');
404
+ }
405
+ const options = {
406
+ input,
407
+ external: [...Object.keys(pkg.dependencies), 'tslib'],
408
+ preserveEntrySignatures: 'strict',
409
+ output: {
410
+ dir: releaseFolder,
411
+ entryFileNames: `[name]${ext}`,
412
+ format,
413
+ preserveModules: true,
414
+ exports: 'auto',
415
+ },
416
+ plugins: [
417
+ json__default["default"](),
418
+ typescript__default["default"]({
419
+ clean: true,
420
+ useTsconfigDeclarationDir: true,
421
+ tsconfigOverride: {
422
+ compilerOptions: {
423
+ declarationDir: releaseFolder,
424
+ sourceMap: false,
425
+ },
426
+ },
427
+ }),
428
+ jsx__default["default"](),
429
+ env__default["default"](innetEnv, { include: input }),
430
+ ],
431
+ };
432
+ this.withLint(options);
433
+ if (node) {
434
+ options.plugins = [
435
+ ...options.plugins,
436
+ externals__default["default"](),
437
+ string({
438
+ include: '**/*.*',
439
+ exclude: constants.stringExcludeNode,
440
+ }),
441
+ ];
442
+ }
443
+ else {
444
+ options.plugins = [
445
+ ...options.plugins,
446
+ string({
447
+ include: '**/*.*',
448
+ exclude: constants.stringExcludeDom,
449
+ }),
450
+ polyfill__default["default"](),
451
+ image__default["default"](),
452
+ styles__default["default"]({
453
+ mode: 'inject',
454
+ url: true,
455
+ plugins: [autoprefixer__default["default"]()],
456
+ modules: cssModules,
457
+ minimize: true,
458
+ }),
459
+ ];
460
+ }
461
+ const bundle = yield rollup__default["default"].rollup(options);
462
+ yield bundle.write(options.output);
463
+ yield bundle.close();
464
+ });
468
465
  yield logger__default["default"].start('Build cjs bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
469
466
  yield build('cjs');
470
467
  }));
@@ -482,7 +479,7 @@ class InnetJS {
482
479
  const { bin } = pkg;
483
480
  for (const name in bin) {
484
481
  const value = bin[name];
485
- const input = glob__default["default"].sync(`src/${value}.{${scriptExtensions.join(',')}}`);
482
+ const input = glob__default["default"].sync(`src/${value}.{${indexExt}}`);
486
483
  const file = path__default["default"].join(this.releaseFolder, value);
487
484
  const options = {
488
485
  input,
@@ -504,11 +501,10 @@ class InnetJS {
504
501
  }),
505
502
  externals__default["default"](),
506
503
  jsx__default["default"](),
507
- injectEnv__default["default"](innetEnv, {
508
- include: input,
509
- }),
504
+ env__default["default"](innetEnv, { include: input }),
510
505
  ],
511
506
  };
507
+ this.withLint(options);
512
508
  const bundle = yield rollup__default["default"].rollup(options);
513
509
  yield bundle.write(options.output);
514
510
  yield bundle.close();
@@ -538,6 +534,16 @@ class InnetJS {
538
534
  }
539
535
  });
540
536
  }
537
+ withLint(options) {
538
+ if (this._lintUsage === undefined) {
539
+ this._lintUsage = fs__default["default"].existsSync(path__default["default"].join(this.projectFolder, '.eslintrc'));
540
+ }
541
+ if (this._lintUsage) {
542
+ options.plugins.push(eslint__default["default"]({
543
+ include: constants.lintInclude,
544
+ }));
545
+ }
546
+ }
541
547
  increaseVersion(release) {
542
548
  return tslib.__awaiter(this, void 0, void 0, function* () {
543
549
  const pkg = yield this.getPackage();
package/index.mjs CHANGED
@@ -22,17 +22,17 @@ import path from 'node:path';
22
22
  import prompt from 'prompts';
23
23
  import rollup from 'rollup';
24
24
  import filesize from 'rollup-plugin-filesize';
25
- import injectEnv from 'rollup-plugin-inject-process-env';
26
25
  import jsx from 'rollup-plugin-innet-jsx';
27
26
  import externals from 'rollup-plugin-node-externals';
28
27
  import polyfill from 'rollup-plugin-polyfill-node';
29
28
  import { preserveShebangs } from 'rollup-plugin-preserve-shebangs';
29
+ import env from 'rollup-plugin-process-env';
30
30
  import styles from 'rollup-plugin-styles';
31
31
  import { terser } from 'rollup-plugin-terser';
32
32
  import typescript from 'rollup-plugin-typescript2';
33
33
  import tmp from 'tmp';
34
34
  import { promisify } from 'node:util';
35
- import { lintInclude, stringExcludeNode, stringExcludeDom } from './constants.mjs';
35
+ import { stringExcludeNode, stringExcludeDom, lintInclude } from './constants.mjs';
36
36
  import { Extract } from './extract.mjs';
37
37
  import { reporter, convertIndexFile, getFile } from './helpers.mjs';
38
38
  import { updateDotenv } from './updateDotenv.mjs';
@@ -149,11 +149,9 @@ class InnetJS {
149
149
  json(),
150
150
  typescript(),
151
151
  jsx(),
152
- eslint({
153
- include: lintInclude,
154
- }),
155
152
  ],
156
153
  };
154
+ this.withLint(inputOptions);
157
155
  const outputOptions = {
158
156
  dir: this.buildFolder,
159
157
  sourcemap: this.sourcemap,
@@ -179,7 +177,7 @@ class InnetJS {
179
177
  }), string({
180
178
  include: '**/*.*',
181
179
  exclude: stringExcludeDom,
182
- }), injectEnv(innetEnv));
180
+ }), env(innetEnv, { include: input }));
183
181
  outputOptions.format = 'es';
184
182
  outputOptions.plugins = [
185
183
  terser(),
@@ -241,11 +239,9 @@ class InnetJS {
241
239
  },
242
240
  }),
243
241
  jsx(),
244
- eslint({
245
- include: lintInclude,
246
- }),
247
242
  ],
248
243
  };
244
+ this.withLint(options);
249
245
  if (node) {
250
246
  // @ts-expect-error
251
247
  options.output.format = 'cjs';
@@ -279,7 +275,7 @@ class InnetJS {
279
275
  }), string({
280
276
  include: '**/*.*',
281
277
  exclude: stringExcludeDom,
282
- }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), injectEnv(innetEnv));
278
+ }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), env(innetEnv, { include: input }));
283
279
  }
284
280
  const watcher = rollup.watch(options);
285
281
  watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
@@ -363,74 +359,75 @@ class InnetJS {
363
359
  const { releaseFolder, cssModules } = this;
364
360
  yield logger.start('Remove previous release', () => fs.remove(releaseFolder));
365
361
  const pkg = yield this.getPackage();
366
- function build(format) {
362
+ const build = (format) => __awaiter(this, void 0, void 0, function* () {
367
363
  var _a, _b;
368
- return __awaiter(this, void 0, void 0, function* () {
369
- const ext = format === 'es'
370
- ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
371
- : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
372
- const input = glob.sync(`src/${index}.{${indexExt}}`);
373
- if (!input.length) {
374
- throw Error('index file is not detected');
375
- }
376
- const options = {
377
- input,
378
- preserveEntrySignatures: 'strict',
379
- output: {
380
- dir: releaseFolder,
381
- entryFileNames: `[name]${ext}`,
382
- format,
383
- preserveModules: true,
384
- },
385
- plugins: [
386
- json(),
387
- typescript({
388
- rollupCommonJSResolveHack: false,
389
- clean: true,
390
- }),
391
- jsx(),
392
- eslint({
393
- include: lintInclude,
394
- }),
395
- injectEnv(innetEnv, {
396
- include: input,
397
- }),
398
- ],
399
- };
400
- if (node) {
401
- options.external = [...Object.keys(pkg.dependencies), 'tslib'];
402
- options.plugins = [
403
- ...options.plugins,
404
- externals(),
405
- string({
406
- include: '**/*.*',
407
- exclude: stringExcludeNode,
408
- }),
409
- ];
410
- }
411
- else {
412
- options.plugins = [
413
- ...options.plugins,
414
- string({
415
- include: '**/*.*',
416
- exclude: stringExcludeDom,
417
- }),
418
- polyfill(),
419
- image(),
420
- styles({
421
- mode: 'inject',
422
- url: true,
423
- plugins: [autoprefixer()],
424
- modules: cssModules,
425
- minimize: true,
426
- }),
427
- ];
428
- }
429
- const bundle = yield rollup.rollup(options);
430
- yield bundle.write(options.output);
431
- yield bundle.close();
432
- });
433
- }
364
+ const ext = format === 'es'
365
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
366
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
367
+ const input = glob.sync(`src/${index}.{${indexExt}}`);
368
+ if (!input.length) {
369
+ throw Error('index file is not detected');
370
+ }
371
+ const options = {
372
+ input,
373
+ external: [...Object.keys(pkg.dependencies), 'tslib'],
374
+ preserveEntrySignatures: 'strict',
375
+ output: {
376
+ dir: releaseFolder,
377
+ entryFileNames: `[name]${ext}`,
378
+ format,
379
+ preserveModules: true,
380
+ exports: 'auto',
381
+ },
382
+ plugins: [
383
+ json(),
384
+ typescript({
385
+ clean: true,
386
+ useTsconfigDeclarationDir: true,
387
+ tsconfigOverride: {
388
+ compilerOptions: {
389
+ declarationDir: releaseFolder,
390
+ sourceMap: false,
391
+ },
392
+ },
393
+ }),
394
+ jsx(),
395
+ env(innetEnv, { include: input }),
396
+ ],
397
+ };
398
+ this.withLint(options);
399
+ if (node) {
400
+ options.plugins = [
401
+ ...options.plugins,
402
+ externals(),
403
+ string({
404
+ include: '**/*.*',
405
+ exclude: stringExcludeNode,
406
+ }),
407
+ ];
408
+ }
409
+ else {
410
+ options.plugins = [
411
+ ...options.plugins,
412
+ string({
413
+ include: '**/*.*',
414
+ exclude: stringExcludeDom,
415
+ }),
416
+ polyfill(),
417
+ image(),
418
+ styles({
419
+ mode: 'inject',
420
+ url: true,
421
+ plugins: [autoprefixer()],
422
+ modules: cssModules,
423
+ minimize: true,
424
+ }),
425
+ ];
426
+ }
427
+ const bundle = yield rollup.rollup(options);
428
+ yield bundle.write(options.output);
429
+ yield bundle.close();
430
+ });
434
431
  yield logger.start('Build cjs bundle', () => __awaiter(this, void 0, void 0, function* () {
435
432
  yield build('cjs');
436
433
  }));
@@ -448,7 +445,7 @@ class InnetJS {
448
445
  const { bin } = pkg;
449
446
  for (const name in bin) {
450
447
  const value = bin[name];
451
- const input = glob.sync(`src/${value}.{${scriptExtensions.join(',')}}`);
448
+ const input = glob.sync(`src/${value}.{${indexExt}}`);
452
449
  const file = path.join(this.releaseFolder, value);
453
450
  const options = {
454
451
  input,
@@ -470,11 +467,10 @@ class InnetJS {
470
467
  }),
471
468
  externals(),
472
469
  jsx(),
473
- injectEnv(innetEnv, {
474
- include: input,
475
- }),
470
+ env(innetEnv, { include: input }),
476
471
  ],
477
472
  };
473
+ this.withLint(options);
478
474
  const bundle = yield rollup.rollup(options);
479
475
  yield bundle.write(options.output);
480
476
  yield bundle.close();
@@ -504,6 +500,16 @@ class InnetJS {
504
500
  }
505
501
  });
506
502
  }
503
+ withLint(options) {
504
+ if (this._lintUsage === undefined) {
505
+ this._lintUsage = fs.existsSync(path.join(this.projectFolder, '.eslintrc'));
506
+ }
507
+ if (this._lintUsage) {
508
+ options.plugins.push(eslint({
509
+ include: lintInclude,
510
+ }));
511
+ }
512
+ }
507
513
  increaseVersion(release) {
508
514
  return __awaiter(this, void 0, void 0, function* () {
509
515
  const pkg = yield this.getPackage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
@@ -72,7 +72,7 @@
72
72
  "prompts": "^2.4.2",
73
73
  "rollup": "^2.79.1",
74
74
  "rollup-plugin-filesize": "^9.1.2",
75
- "rollup-plugin-inject-process-env": "^1.3.1",
75
+ "rollup-plugin-process-env": "^1.0.0",
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",
package/updateDotenv.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
-
7
5
  function updateDotenv() {
8
6
  const { INNETJS_INNETJS_PACKAGE_VERSION } = process.env;
9
7
  delete process.env.INNETJS_INNETJS_PACKAGE_VERSION;
package/updateDotenv.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
-
3
1
  function updateDotenv() {
4
2
  const { INNETJS_INNETJS_PACKAGE_VERSION } = process.env;
5
3
  delete process.env.INNETJS_INNETJS_PACKAGE_VERSION;