pkgbld 1.22.1 → 1.23.1

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 +31 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -159,10 +159,12 @@ const packageJsonFieldsOrder = new Set([
159
159
  'browser',
160
160
  'unpkg',
161
161
  'module',
162
+ 'svelte',
162
163
  'exports',
163
164
  'imports',
164
165
  'types',
165
166
  'typings',
167
+ 'typesVersions',
166
168
  'files',
167
169
  'packageManager',
168
170
  'sideEffects',
@@ -721,12 +723,14 @@ function processPackage(pkg, config, plugins) {
721
723
  if (typeof pkg.exports[id] !== 'object') {
722
724
  pkg.exports[id] = {};
723
725
  }
726
+ pkg.exports[id].types = `./${config.dir}/${patternToName('[name].d.ts', basename)}`;
727
+ if (allowEsm) {
728
+ pkg.exports[id].import = `./${config.dir}/${patternToName(config.esPattern, basename)}`;
729
+ }
724
730
  if (allowCjs) {
725
731
  pkg.exports[id].require = `./${config.dir}/${patternToName(config.commonjsPattern, basename)}`;
726
732
  }
727
- if (allowEsm) {
728
- pkg.exports[id].default = `./${config.dir}/${patternToName(config.esPattern, basename)}`;
729
- }
733
+ pkg.exports[id] = orderFields(pkg.exports[id]);
730
734
  if (basename !== 'index') {
731
735
  if (!pkg.files.includes(basename)) {
732
736
  pkg.files.push(basename);
@@ -745,18 +749,39 @@ function processPackage(pkg, config, plugins) {
745
749
  function patternToName(pattern, input) {
746
750
  return pattern.replace('[name]', input);
747
751
  }
752
+ const fieldsOrder = new Set([
753
+ 'types',
754
+ 'import',
755
+ 'require',
756
+ 'svelte',
757
+ 'default'
758
+ ]);
759
+ function orderFields(exports) {
760
+ const ordered = {};
761
+ for (const key of fieldsOrder) {
762
+ if (key in exports) {
763
+ ordered[key] = exports[key];
764
+ }
765
+ }
766
+ for (const key in exports) {
767
+ if (!fieldsOrder.has(key)) {
768
+ ordered[key] = exports[key];
769
+ }
770
+ }
771
+ return ordered;
772
+ }
748
773
 
749
774
  async function writeJson(path, json) {
750
775
  await fs.writeFile(path, toFormattedJson(json));
751
776
  }
752
777
 
753
- var version = "1.22.1";
778
+ var version = "1.23.1";
754
779
  var name = "pkgbld";
755
780
  var license = "MIT";
756
781
  var author = "Konstantin Shutkin";
757
782
  var bin = "./dist/index.js";
758
783
  var main = "./dist/index.js";
759
- var typings = "./dist/index.d.ts";
784
+ var types = "./dist/index.d.ts";
760
785
  var files = [
761
786
  "dist"
762
787
  ];
@@ -817,7 +842,7 @@ var pkgbldPkg = {
817
842
  author: author,
818
843
  bin: bin,
819
844
  main: main,
820
- typings: typings,
845
+ types: types,
821
846
  files: files,
822
847
  engines: engines,
823
848
  repository: repository,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "1.22.1",
2
+ "version": "1.23.1",
3
3
  "name": "pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",
6
6
  "bin": "./dist/index.js",
7
7
  "main": "./dist/index.js",
8
- "typings": "./dist/index.d.ts",
8
+ "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist"
11
11
  ],
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@types/lodash": "^4.14.199",
52
52
  "@total-typescript/ts-reset": "^0.5.1",
53
- "options": "0.0.1"
53
+ "options": "0.2.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "typescript": "^5.2.2"