@sanity/pkg-utils 5.0.4 → 5.0.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/build.cjs.map +1 -1
- package/dist/_chunks-cjs/index.cjs +3 -3
- package/dist/_chunks-cjs/index.cjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/node/resolveBuildTasks.ts +3 -3
- package/src/node/tasks/dts/createApiExtractorConfig.ts +1 -1
- package/src/node/tasks/dts/doExtract.ts +3 -3
- package/src/node/tasks/dts/dtsTask.ts +4 -4
- package/src/node/tasks/dts/extractTypes.ts +3 -3
- package/src/node/tasks/rollup/resolveRollupConfig.ts +7 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.6",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/core": "^7.24.0",
|
|
64
64
|
"@babel/types": "^7.24.0",
|
|
65
|
-
"@microsoft/api-extractor": "^7.
|
|
65
|
+
"@microsoft/api-extractor": "^7.43.0",
|
|
66
66
|
"@microsoft/tsdoc-config": "^0.16.2",
|
|
67
67
|
"@rollup/plugin-alias": "^5.1.0",
|
|
68
68
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"zod": "^3.22.4"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@commitlint/cli": "^19.2.
|
|
103
|
+
"@commitlint/cli": "^19.2.1",
|
|
104
104
|
"@commitlint/config-conventional": "^19.1.0",
|
|
105
105
|
"@types/babel__core": "^7.20.5",
|
|
106
106
|
"@types/cpx": "^1.5.5",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"@types/rimraf": "^3.0.2",
|
|
113
113
|
"@types/treeify": "^1.0.3",
|
|
114
114
|
"@types/uuid": "^9.0.8",
|
|
115
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
116
|
-
"@typescript-eslint/parser": "^7.
|
|
115
|
+
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
|
116
|
+
"@typescript-eslint/parser": "^7.3.1",
|
|
117
117
|
"browserslist-to-esbuild": "2.1.1",
|
|
118
118
|
"commitizen": "^4.3.0",
|
|
119
119
|
"cpx": "^1.5.0",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"typescript": "^5.4.2",
|
|
134
134
|
"vitest": "^1.4.0",
|
|
135
135
|
"vitest-github-actions-reporter": "^0.11.1",
|
|
136
|
-
"@sanity/pkg-utils": "5.0.
|
|
136
|
+
"@sanity/pkg-utils": "5.0.6"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
139
|
"typescript": "^4.7 || ^5"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import path from 'path'
|
|
3
3
|
|
|
4
|
-
import {BuildContext, PkgExport, PkgFormat, PkgRuntime} from './core'
|
|
5
|
-
import {BuildTask, DtsTask, RollupTask, RollupTaskEntry} from './tasks'
|
|
4
|
+
import type {BuildContext, PkgExport, PkgFormat, PkgRuntime} from './core'
|
|
5
|
+
import type {BuildTask, DtsTask, RollupTask, RollupTaskEntry} from './tasks'
|
|
6
6
|
|
|
7
7
|
/** @internal */
|
|
8
8
|
export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
|
|
@@ -146,7 +146,7 @@ export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
|
|
|
146
146
|
if (relativeTargetPath) {
|
|
147
147
|
fs.writeFileSync(
|
|
148
148
|
path.resolve(cwd, `${exp._path}.js`),
|
|
149
|
-
[
|
|
149
|
+
['// AUTO-GENERATED – DO NOT EDIT', `export * from '${relativeTargetPath}'`, ''].join(
|
|
150
150
|
'\n',
|
|
151
151
|
),
|
|
152
152
|
)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {ExtractorMessage} from '@microsoft/api-extractor'
|
|
1
|
+
import type {ExtractorMessage} from '@microsoft/api-extractor'
|
|
2
2
|
import path from 'path'
|
|
3
3
|
import rimraf from 'rimraf'
|
|
4
4
|
|
|
5
|
-
import {BuildContext} from '../../core'
|
|
5
|
+
import type {BuildContext} from '../../core'
|
|
6
6
|
import {buildTypes} from './buildTypes'
|
|
7
7
|
import {DtsError} from './DtsError'
|
|
8
8
|
import {extractTypes} from './extractTypes'
|
|
9
|
-
import {DtsResult, DtsTask, DtsWatchTask} from './types'
|
|
9
|
+
import type {DtsResult, DtsTask, DtsWatchTask} from './types'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* - Build type definitions to a temporary directory using TypeScript compiler.
|
|
@@ -2,17 +2,17 @@ import chalk from 'chalk'
|
|
|
2
2
|
import {Observable} from 'rxjs'
|
|
3
3
|
|
|
4
4
|
import {printExtractMessages} from '../../printExtractMessages'
|
|
5
|
-
import {TaskHandler} from '../types'
|
|
5
|
+
import type {TaskHandler} from '../types'
|
|
6
6
|
import {doExtract} from './doExtract'
|
|
7
7
|
import {DtsError} from './DtsError'
|
|
8
|
-
import {DtsResult, DtsTask} from './types'
|
|
8
|
+
import type {DtsResult, DtsTask} from './types'
|
|
9
9
|
|
|
10
10
|
/** @internal */
|
|
11
11
|
export const dtsTask: TaskHandler<DtsTask, DtsResult> = {
|
|
12
12
|
name: (_ctx, task) =>
|
|
13
13
|
[
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
'Build type definitions...',
|
|
15
|
+
' entries:',
|
|
16
16
|
...task.entries.map((entry) =>
|
|
17
17
|
[
|
|
18
18
|
` - ${chalk.cyan(entry.importId)}: `,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Extractor,
|
|
3
3
|
ExtractorConfig,
|
|
4
|
-
ExtractorMessage,
|
|
5
|
-
ExtractorResult,
|
|
4
|
+
type ExtractorMessage,
|
|
5
|
+
type ExtractorResult,
|
|
6
6
|
} from '@microsoft/api-extractor'
|
|
7
7
|
import fs from 'fs/promises'
|
|
8
8
|
import {mkdirp} from 'mkdirp'
|
|
9
9
|
import path from 'path'
|
|
10
10
|
import prettier from 'prettier'
|
|
11
11
|
|
|
12
|
-
import {BuildFile, PkgConfigOptions} from '../../core'
|
|
12
|
+
import type {BuildFile, PkgConfigOptions} from '../../core'
|
|
13
13
|
import {createApiExtractorConfig} from './createApiExtractorConfig'
|
|
14
14
|
import {createTSDocConfig} from './createTSDocConfig'
|
|
15
15
|
import {extractModuleBlocksFromTypes} from './extractModuleBlocks'
|
|
@@ -6,11 +6,11 @@ import {nodeResolve} from '@rollup/plugin-node-resolve'
|
|
|
6
6
|
import replace from '@rollup/plugin-replace'
|
|
7
7
|
import terser from '@rollup/plugin-terser'
|
|
8
8
|
import path from 'path'
|
|
9
|
-
import {InputOptions, OutputOptions, Plugin} from 'rollup'
|
|
9
|
+
import type {InputOptions, OutputOptions, Plugin} from 'rollup'
|
|
10
10
|
import esbuild from 'rollup-plugin-esbuild'
|
|
11
11
|
|
|
12
|
-
import {BuildContext, resolveConfigProperty} from '../../core'
|
|
13
|
-
import {RollupTask, RollupWatchTask} from '../types'
|
|
12
|
+
import {type BuildContext, resolveConfigProperty} from '../../core'
|
|
13
|
+
import type {RollupTask, RollupWatchTask} from '../types'
|
|
14
14
|
|
|
15
15
|
export interface RollupConfig {
|
|
16
16
|
inputOptions: InputOptions
|
|
@@ -58,7 +58,7 @@ export function resolveRollupConfig(
|
|
|
58
58
|
? {...replacements}
|
|
59
59
|
: {
|
|
60
60
|
'process.env.PKG_FILE_PATH': (arg) => {
|
|
61
|
-
const sourcePath =
|
|
61
|
+
const sourcePath = `./${path.relative(cwd, arg)}`
|
|
62
62
|
const entry = entries.find((e) => e.source === sourcePath)
|
|
63
63
|
|
|
64
64
|
if (!entry) {
|
|
@@ -195,12 +195,13 @@ export function resolveRollupConfig(
|
|
|
195
195
|
chunkFileNames: () => {
|
|
196
196
|
const parts = outputExt.split('.')
|
|
197
197
|
const prefix = config?.rollup?.hashChunkFileNames ? '[name]-[hash]' : '[name]'
|
|
198
|
+
const folder = config?.rollup?.hashChunkFileNames ? '_chunks' : '_chunks-[format]'
|
|
198
199
|
|
|
199
200
|
if (parts.length === 3) {
|
|
200
|
-
return
|
|
201
|
+
return `${folder}/${prefix}.${parts[2]}`
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
return
|
|
204
|
+
return `${folder}/${prefix}${outputExt}`
|
|
204
205
|
},
|
|
205
206
|
compact: minify,
|
|
206
207
|
dir: outDir,
|