pkgbld 1.16.2 → 1.16.3

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -475,6 +475,13 @@ function processPackage(pkg, config, plugins) {
475
475
  pkg.exports['.'] = {};
476
476
  }
477
477
  pkg.exports['./package.json'] = './package.json';
478
+ if (allowEsm && !allowCjs && typeof pkg.type !== 'string') {
479
+ pkg.type = 'module';
480
+ }
481
+ if (typeof pkg.typings === 'string') {
482
+ delete pkg.typings;
483
+ }
484
+ pkg.types = `./${config.dir}/index.d.ts`;
478
485
  if (allowUmd && typeof pkg.umd === 'string') {
479
486
  pkg.umd = `./${config.dir}/index.umd.js`;
480
487
  if (!config.umdInputs.includes('index')) {
@@ -506,13 +513,16 @@ function processPackage(pkg, config, plugins) {
506
513
  if (allowCjs && typeof pkg.main !== 'string') {
507
514
  pkg.main = `./${config.dir}/index.cjs`;
508
515
  }
516
+ if (allowEsm && !allowCjs && typeof pkg.main !== 'string') {
517
+ pkg.main = `./${config.dir}/index.mjs`;
518
+ }
509
519
  if (allowCjs && pkg.main !== pkg.exports['.'].require) {
510
520
  pkg.exports['.'].require = pkg.main;
511
521
  }
512
- if (allowEsm && typeof pkg.module !== 'string') {
522
+ if (allowCjs && allowEsm && typeof pkg.module !== 'string') {
513
523
  pkg.module = `./${config.dir}/index.mjs`;
514
524
  }
515
- if (allowEsm && pkg.module !== pkg.exports['.']?.default) {
525
+ if (pkg.module !== pkg.exports['.']?.default) {
516
526
  pkg.exports['.'].default = pkg.module;
517
527
  }
518
528
  if (allowUmd && config.umdInputs.includes('index')) {
@@ -542,7 +552,7 @@ function processPackage(pkg, config, plugins) {
542
552
  config.formats.push('umd');
543
553
  }
544
554
  for (const plugin of plugins) {
545
- plugin.processPackageJson && plugin.processPackageJson(pkg, inputs, logger$1);
555
+ plugin.processPackageJson?.(pkg, inputs, logger$1);
546
556
  }
547
557
  return inputs;
548
558
  }
@@ -551,7 +561,7 @@ async function writeJson(path, json) {
551
561
  await fs.writeFile(path, JSON.stringify(json, null, 2) + '\n');
552
562
  }
553
563
 
554
- var version = "1.16.2";
564
+ var version = "1.16.3";
555
565
  var license = "MIT";
556
566
  var name = "pkgbld";
557
567
  var author = {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.16.2",
2
+ "version": "1.16.3",
3
3
  "license": "MIT",
4
4
  "name": "pkgbld",
5
5
  "author": {