@sanity/pkg-utils 6.10.4 → 6.10.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/check.cjs +11 -3
- package/dist/_chunks-cjs/check.cjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/node/check.ts +37 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "6.10.
|
|
3
|
+
"version": "6.10.6",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"browserslist": "extends @sanity/browserslist-config",
|
|
68
68
|
"prettier": "@sanity/prettier-config",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@babel/core": "^7.24.
|
|
70
|
+
"@babel/core": "^7.24.9",
|
|
71
71
|
"@babel/preset-typescript": "^7.24.7",
|
|
72
|
-
"@babel/types": "^7.24.
|
|
73
|
-
"@microsoft/api-extractor": "7.47.
|
|
72
|
+
"@babel/types": "^7.24.9",
|
|
73
|
+
"@microsoft/api-extractor": "7.47.2",
|
|
74
74
|
"@microsoft/tsdoc-config": "0.17.0",
|
|
75
75
|
"@optimize-lodash/rollup-plugin": "4.0.4",
|
|
76
76
|
"@rollup/plugin-alias": "^5.1.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"esbuild-register": "^3.5.0",
|
|
91
91
|
"find-config": "^1.0.0",
|
|
92
92
|
"get-latest-version": "^5.1.0",
|
|
93
|
-
"git-url-parse": "^14.
|
|
93
|
+
"git-url-parse": "^14.1.0",
|
|
94
94
|
"globby": "^11.1.0",
|
|
95
95
|
"jsonc-parser": "^3.3.1",
|
|
96
96
|
"mkdirp": "^3.0.1",
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
"@types/semver": "^7.5.8",
|
|
126
126
|
"@types/treeify": "^1.0.3",
|
|
127
127
|
"@types/uuid": "^10.0.0",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "^7.16.
|
|
129
|
-
"@typescript-eslint/parser": "^7.16.
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
|
129
|
+
"@typescript-eslint/parser": "^7.16.1",
|
|
130
130
|
"browserslist-to-esbuild": "2.1.1",
|
|
131
131
|
"commitizen": "^4.3.0",
|
|
132
132
|
"cpx": "^1.5.0",
|
|
@@ -134,19 +134,19 @@
|
|
|
134
134
|
"eslint": "^8.57.0",
|
|
135
135
|
"eslint-config-prettier": "^9.1.0",
|
|
136
136
|
"eslint-plugin-import": "^2.29.1",
|
|
137
|
-
"eslint-plugin-prettier": "^5.1
|
|
137
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
138
138
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
139
139
|
"husky": "^8.0.3",
|
|
140
140
|
"lint-staged": "^15.0.2",
|
|
141
|
-
"npm-run-all2": "^6.2.
|
|
141
|
+
"npm-run-all2": "^6.2.2",
|
|
142
142
|
"outdent": "^0.8.0",
|
|
143
143
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
144
144
|
"semver": "^7.6.0",
|
|
145
145
|
"ts-node": "^10.9.2",
|
|
146
146
|
"typescript": "5.5.3",
|
|
147
|
-
"vitest": "^2.0.
|
|
147
|
+
"vitest": "^2.0.3",
|
|
148
148
|
"vitest-github-actions-reporter": "^0.11.1",
|
|
149
|
-
"@sanity/pkg-utils": "6.10.
|
|
149
|
+
"@sanity/pkg-utils": "6.10.6"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
152
|
"typescript": "5.4.x || 5.5.x"
|
package/src/node/check.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
|
|
3
|
-
import esbuild, {type BuildFailure} from 'esbuild'
|
|
3
|
+
import esbuild, {type BuildFailure, type Message} from 'esbuild'
|
|
4
4
|
|
|
5
5
|
import {createConsoleSpy} from './consoleSpy'
|
|
6
6
|
import {loadConfig, loadPkgWithReporting} from './core'
|
|
@@ -130,10 +130,20 @@ async function checkExports(
|
|
|
130
130
|
logger.log()
|
|
131
131
|
}
|
|
132
132
|
} catch (err) {
|
|
133
|
-
|
|
133
|
+
if (isEsbuildFailure(err)) {
|
|
134
|
+
const {errors} = err
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
for (const msg of errors) {
|
|
137
|
+
printEsbuildMessage(logger.error, msg)
|
|
138
|
+
|
|
139
|
+
logger.log()
|
|
140
|
+
}
|
|
141
|
+
} else if (err instanceof Error) {
|
|
142
|
+
logger.error(err.stack || err.message)
|
|
143
|
+
|
|
144
|
+
logger.log()
|
|
145
|
+
} else {
|
|
146
|
+
logger.error(`${err}`)
|
|
137
147
|
|
|
138
148
|
logger.log()
|
|
139
149
|
}
|
|
@@ -155,3 +165,26 @@ function printEsbuildMessage(log: (...args: unknown[]) => void, msg: esbuild.Mes
|
|
|
155
165
|
log(msg.detail || msg.text)
|
|
156
166
|
}
|
|
157
167
|
}
|
|
168
|
+
|
|
169
|
+
function isEsbuildFailure(err: unknown): err is BuildFailure {
|
|
170
|
+
return (
|
|
171
|
+
err instanceof Error &&
|
|
172
|
+
'errors' in err &&
|
|
173
|
+
Array.isArray(err.errors) &&
|
|
174
|
+
err.errors.every(isEsbuildMessage) &&
|
|
175
|
+
'warnings' in err &&
|
|
176
|
+
Array.isArray(err.warnings) &&
|
|
177
|
+
err.warnings.every(isEsbuildMessage)
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function isEsbuildMessage(msg: unknown): msg is Message {
|
|
182
|
+
return (
|
|
183
|
+
typeof msg === 'object' &&
|
|
184
|
+
msg !== null &&
|
|
185
|
+
'text' in msg &&
|
|
186
|
+
typeof msg.text === 'string' &&
|
|
187
|
+
'location' in msg &&
|
|
188
|
+
(msg.location === null || typeof msg.location === 'object')
|
|
189
|
+
)
|
|
190
|
+
}
|