@sanity/pkg-utils 5.1.6 → 5.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "5.1.6",
3
+ "version": "5.1.7",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -132,7 +132,7 @@
132
132
  "typescript": "5.4.2",
133
133
  "vitest": "^1.4.0",
134
134
  "vitest-github-actions-reporter": "^0.11.1",
135
- "@sanity/pkg-utils": "5.1.6"
135
+ "@sanity/pkg-utils": "5.1.7"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "typescript": "5.4.2"
package/src/global.ts CHANGED
@@ -3,4 +3,4 @@ declare global {
3
3
  var __DEV__: boolean
4
4
  }
5
5
 
6
- export {}
6
+ export type {}
@@ -7,7 +7,8 @@ export function validateExports(
7
7
  options: {pkg: PackageJSON},
8
8
  ): string[] {
9
9
  const {pkg} = options
10
- const ext = extMap[pkg.type || 'commonjs']
10
+ const type = pkg.type || 'commonjs'
11
+ const ext = extMap[type]
11
12
 
12
13
  const errors: string[] = []
13
14
 
@@ -15,13 +16,13 @@ export function validateExports(
15
16
  for (const exp of _exports) {
16
17
  if (exp.require && !exp.require.endsWith(ext.commonjs)) {
17
18
  errors.push(
18
- `package.json with \`type: "${pkg.type}"\` - \`exports["${exp._path}"].require\` must end with "${ext.commonjs}"`,
19
+ `package.json with \`type: "${type}"\` - \`exports["${exp._path}"].require\` must end with "${ext.commonjs}"`,
19
20
  )
20
21
  }
21
22
 
22
23
  if (exp.import && !exp.import.endsWith(ext.esm)) {
23
24
  errors.push(
24
- `package.json with \`type: "${pkg.type}"\` - \`exports["${exp._path}"].import\` must end with "${ext.esm}"`,
25
+ `package.json with \`type: "${type}"\` - \`exports["${exp._path}"].import\` must end with "${ext.esm}"`,
25
26
  )
26
27
  }
27
28
  }