@sanity/pkg-utils 6.8.4 → 6.8.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": "6.8.4",
3
+ "version": "6.8.7",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -105,7 +105,7 @@
105
105
  "rxjs": "^7.8.1",
106
106
  "treeify": "^1.1.0",
107
107
  "uuid": "^9.0.1",
108
- "zod": "3.23.3",
108
+ "zod": "3.23.4",
109
109
  "zod-validation-error": "3.2.0"
110
110
  },
111
111
  "devDependencies": {
@@ -142,9 +142,9 @@
142
142
  "semver": "^7.6.0",
143
143
  "ts-node": "^10.9.2",
144
144
  "typescript": "5.4.5",
145
- "vitest": "^1.5.0",
145
+ "vitest": "^1.5.2",
146
146
  "vitest-github-actions-reporter": "^0.11.1",
147
- "@sanity/pkg-utils": "6.8.4"
147
+ "@sanity/pkg-utils": "6.8.7"
148
148
  },
149
149
  "peerDependencies": {
150
150
  "typescript": "5.4.x"
@@ -174,7 +174,7 @@ export function parseExports(options: {
174
174
  }
175
175
  } else if (isRecord(exportEntry) && 'svelte' in exportEntry) {
176
176
  // @TODO should we report a warning or a debug message here about a detected svelte export that is ignored?
177
- } else if (isRecord(exportEntry)) {
177
+ } else if (isPkgExport(exportEntry)) {
178
178
  const exp = {
179
179
  _exported: true,
180
180
  _path: exportPath,
@@ -240,7 +240,7 @@ export function parseExports(options: {
240
240
  }
241
241
 
242
242
  _exports.push(exp)
243
- } else {
243
+ } else if (!isRecord(exportEntry)) {
244
244
  errors.push('package.json: exports must be an object')
245
245
  }
246
246
  }
@@ -253,3 +253,7 @@ export function parseExports(options: {
253
253
 
254
254
  return _exports
255
255
  }
256
+
257
+ function isPkgExport(value: unknown): value is PkgExport {
258
+ return isRecord(value) && 'source' in value && typeof value['source'] === 'string'
259
+ }
@@ -15,7 +15,7 @@ export interface PackageJSON {
15
15
  string,
16
16
  | `./${string}.json`
17
17
  | {
18
- source: string
18
+ source?: string
19
19
  types?: string
20
20
  browser?: {
21
21
  source: string
@@ -22,7 +22,7 @@ const pkgSchema = z.object({
22
22
  z.custom<`./${string}.json`>((val) => /^\.\/.*\.json$/.test(val as string)),
23
23
  z.object({
24
24
  types: z.optional(z.string()),
25
- source: z.string(),
25
+ source: z.optional(z.string()),
26
26
  browser: z.optional(
27
27
  z.object({
28
28
  source: z.string(),