pkgbld 1.23.0 → 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 +24 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -159,6 +159,7 @@ const packageJsonFieldsOrder = new Set([
159
159
  'browser',
160
160
  'unpkg',
161
161
  'module',
162
+ 'svelte',
162
163
  'exports',
163
164
  'imports',
164
165
  'types',
@@ -729,6 +730,7 @@ function processPackage(pkg, config, plugins) {
729
730
  if (allowCjs) {
730
731
  pkg.exports[id].require = `./${config.dir}/${patternToName(config.commonjsPattern, basename)}`;
731
732
  }
733
+ pkg.exports[id] = orderFields(pkg.exports[id]);
732
734
  if (basename !== 'index') {
733
735
  if (!pkg.files.includes(basename)) {
734
736
  pkg.files.push(basename);
@@ -747,12 +749,33 @@ function processPackage(pkg, config, plugins) {
747
749
  function patternToName(pattern, input) {
748
750
  return pattern.replace('[name]', input);
749
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
+ }
750
773
 
751
774
  async function writeJson(path, json) {
752
775
  await fs.writeFile(path, toFormattedJson(json));
753
776
  }
754
777
 
755
- var version = "1.23.0";
778
+ var version = "1.23.1";
756
779
  var name = "pkgbld";
757
780
  var license = "MIT";
758
781
  var author = "Konstantin Shutkin";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.23.0",
2
+ "version": "1.23.1",
3
3
  "name": "pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",
@@ -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.1.0"
53
+ "options": "0.2.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "typescript": "^5.2.2"