@sanity/pkg-utils 6.8.4 → 6.8.6
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/dist/_chunks-cjs/consoleSpy.cjs +7 -4
- package/dist/_chunks-cjs/consoleSpy.cjs.map +1 -1
- package/dist/_chunks-cjs/logger.cjs +1 -1
- package/dist/_chunks-cjs/logger.cjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/node/core/pkg/parseExports.ts +6 -2
- package/src/node/core/pkg/types.ts +1 -1
- package/src/node/core/pkg/validatePkg.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.6",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -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.
|
|
145
|
+
"vitest": "^1.5.1",
|
|
146
146
|
"vitest-github-actions-reporter": "^0.11.1",
|
|
147
|
-
"@sanity/pkg-utils": "6.8.
|
|
147
|
+
"@sanity/pkg-utils": "6.8.6"
|
|
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 (
|
|
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
|
+
}
|
|
@@ -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(),
|