@sanity/pkg-utils 6.10.0 → 6.10.2-canary.0
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 +4 -1
- package/dist/_chunks-cjs/consoleSpy.cjs.map +1 -1
- package/dist/_chunks-cjs/index.cjs +2 -2
- package/dist/_chunks-cjs/index.cjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/node/core/config/types.ts +8 -1
- package/src/node/core/contexts/buildContext.ts +1 -0
- package/src/node/resolveBuildContext.ts +9 -0
- package/src/node/tasks/dts/doExtract.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "6.10.0",
|
|
3
|
+
"version": "6.10.2-canary.0",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -86,13 +86,13 @@
|
|
|
86
86
|
"cac": "^6.7.14",
|
|
87
87
|
"chalk": "^4.1.2",
|
|
88
88
|
"chokidar": "^3.6.0",
|
|
89
|
-
"esbuild": "^0.
|
|
89
|
+
"esbuild": "^0.23.0",
|
|
90
90
|
"esbuild-register": "^3.5.0",
|
|
91
91
|
"find-config": "^1.0.0",
|
|
92
92
|
"get-latest-version": "^5.1.0",
|
|
93
93
|
"git-url-parse": "^14.0.0",
|
|
94
94
|
"globby": "^11.1.0",
|
|
95
|
-
"jsonc-parser": "^3.
|
|
95
|
+
"jsonc-parser": "^3.3.1",
|
|
96
96
|
"mkdirp": "^3.0.1",
|
|
97
97
|
"outdent": "^0.8.0",
|
|
98
98
|
"parse-git-config": "^3.0.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
107
107
|
"rxjs": "^7.8.1",
|
|
108
108
|
"treeify": "^1.1.0",
|
|
109
|
-
"uuid": "^
|
|
109
|
+
"uuid": "^10.0.0",
|
|
110
110
|
"zod": "3.23.8",
|
|
111
111
|
"zod-validation-error": "3.3.0"
|
|
112
112
|
},
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"@types/rimraf": "^3.0.2",
|
|
125
125
|
"@types/semver": "^7.5.8",
|
|
126
126
|
"@types/treeify": "^1.0.3",
|
|
127
|
-
"@types/uuid": "^
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
129
|
-
"@typescript-eslint/parser": "^7.
|
|
127
|
+
"@types/uuid": "^10.0.0",
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
129
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
130
130
|
"browserslist-to-esbuild": "2.1.1",
|
|
131
131
|
"commitizen": "^4.3.0",
|
|
132
132
|
"cpx": "^1.5.0",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"eslint-config-prettier": "^9.1.0",
|
|
136
136
|
"eslint-plugin-import": "^2.29.1",
|
|
137
137
|
"eslint-plugin-prettier": "^5.1.3",
|
|
138
|
-
"eslint-plugin-simple-import-sort": "^12.1.
|
|
138
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
139
139
|
"husky": "^8.0.3",
|
|
140
140
|
"lint-staged": "^15.0.2",
|
|
141
141
|
"npm-run-all2": "^6.2.0",
|
|
@@ -143,13 +143,13 @@
|
|
|
143
143
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
144
144
|
"semver": "^7.6.0",
|
|
145
145
|
"ts-node": "^10.9.2",
|
|
146
|
-
"typescript": "5.
|
|
146
|
+
"typescript": "5.5.3",
|
|
147
147
|
"vitest": "^1.6.0",
|
|
148
148
|
"vitest-github-actions-reporter": "^0.11.1",
|
|
149
|
-
"@sanity/pkg-utils": "6.10.0"
|
|
149
|
+
"@sanity/pkg-utils": "6.10.2-canary.0"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
|
-
"typescript": "5.4.x"
|
|
152
|
+
"typescript": "5.4.x || 5.5.x"
|
|
153
153
|
},
|
|
154
154
|
"engines": {
|
|
155
155
|
"node": ">=18.17.0"
|
|
@@ -179,7 +179,14 @@ export interface PkgConfigOptions {
|
|
|
179
179
|
dist?: string
|
|
180
180
|
exports?: PkgConfigProperty<PkgExports>
|
|
181
181
|
extract?: {
|
|
182
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Packages in `external` are automatically added to the `bundledPackages` config.
|
|
184
|
+
* You can exclude a package from being bundled by using a callback:
|
|
185
|
+
* ```
|
|
186
|
+
* bundledPackages: (prev) => prev.filter(package => package !== 'sanity')
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
bundledPackages?: PkgConfigProperty<string[]>
|
|
183
190
|
customTags?: TSDocCustomTag[]
|
|
184
191
|
rules?: {
|
|
185
192
|
'ae-forgotten-export'?: PkgRuleLevel
|
|
@@ -116,6 +116,14 @@ export async function resolveBuildContext(options: {
|
|
|
116
116
|
config && Array.isArray(config.external)
|
|
117
117
|
? [...parsedExternal, ...config.external]
|
|
118
118
|
: resolveConfigProperty(config?.external, parsedExternal)
|
|
119
|
+
// Merge bundledPackages with dev deps, replace if it's a function
|
|
120
|
+
const bundledDependencies = [
|
|
121
|
+
...(pkg.devDependencies ? Object.keys(pkg.devDependencies) : []),
|
|
122
|
+
].filter((_) => !parsedExternal.includes(_) && _ !== pkg.name)
|
|
123
|
+
const bundledPackages =
|
|
124
|
+
config && Array.isArray(config.extract?.bundledPackages)
|
|
125
|
+
? [...bundledDependencies, ...config.extract.bundledPackages]
|
|
126
|
+
: resolveConfigProperty(config?.extract?.bundledPackages, bundledDependencies)
|
|
119
127
|
|
|
120
128
|
const outputPaths = Object.values(exports)
|
|
121
129
|
.flatMap((exportEntry) => {
|
|
@@ -170,6 +178,7 @@ export async function resolveBuildContext(options: {
|
|
|
170
178
|
emitDeclarationOnly,
|
|
171
179
|
exports,
|
|
172
180
|
external,
|
|
181
|
+
bundledPackages,
|
|
173
182
|
files: [],
|
|
174
183
|
logger,
|
|
175
184
|
pkg,
|
|
@@ -18,7 +18,7 @@ export async function doExtract(
|
|
|
18
18
|
ctx: BuildContext,
|
|
19
19
|
task: DtsTask | DtsWatchTask,
|
|
20
20
|
): Promise<DtsResult> {
|
|
21
|
-
const {config, cwd, files, logger, strict, ts} = ctx
|
|
21
|
+
const {config, cwd, files, logger, strict, ts, bundledPackages} = ctx
|
|
22
22
|
|
|
23
23
|
if (!ts.config || !ts.configPath) {
|
|
24
24
|
return {type: 'dts', messages: [], results: []}
|
|
@@ -48,7 +48,7 @@ export async function doExtract(
|
|
|
48
48
|
const targetPaths = entry.targetPaths.map((targetPath) => path.resolve(cwd, targetPath))
|
|
49
49
|
const filePaths = targetPaths.map((targetPath) => path.relative(outDir, targetPath))
|
|
50
50
|
const result = await extractTypes({
|
|
51
|
-
bundledPackages:
|
|
51
|
+
bundledPackages: bundledPackages || [],
|
|
52
52
|
customTags: config?.extract?.customTags,
|
|
53
53
|
cwd,
|
|
54
54
|
distPath: outDir,
|