@sanity/pkg-utils 5.1.6 → 5.1.8
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.
|
|
3
|
+
"version": "5.1.8",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"pretty-bytes": "^5.6.0",
|
|
92
92
|
"prompts": "^2.4.2",
|
|
93
93
|
"rimraf": "^4.4.1",
|
|
94
|
-
"rollup": "^4.
|
|
94
|
+
"rollup": "^4.14.0",
|
|
95
95
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
96
96
|
"rxjs": "^7.8.1",
|
|
97
97
|
"treeify": "^1.1.0",
|
|
@@ -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.
|
|
135
|
+
"@sanity/pkg-utils": "5.1.8"
|
|
136
136
|
},
|
|
137
137
|
"peerDependencies": {
|
|
138
138
|
"typescript": "5.4.2"
|
package/src/global.ts
CHANGED
|
@@ -7,7 +7,8 @@ export function validateExports(
|
|
|
7
7
|
options: {pkg: PackageJSON},
|
|
8
8
|
): string[] {
|
|
9
9
|
const {pkg} = options
|
|
10
|
-
const
|
|
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: "${
|
|
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: "${
|
|
25
|
+
`package.json with \`type: "${type}"\` - \`exports["${exp._path}"].import\` must end with "${ext.esm}"`,
|
|
25
26
|
)
|
|
26
27
|
}
|
|
27
28
|
}
|