@sanity/pkg-utils 5.1.1-canary.0 → 5.1.1
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 +10 -9
- package/dist/_chunks-cjs/build.cjs.map +1 -1
- package/dist/_chunks-cjs/index.cjs +1 -1
- package/dist/_chunks-cjs/index.cjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/package.json +20 -26
- package/src/node/resolveBuildTasks.ts +14 -13
- package/src/node/tasks/dts/extractTypes.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "5.1.1
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -46,24 +46,6 @@
|
|
|
46
46
|
"!dist/stats.html",
|
|
47
47
|
"src"
|
|
48
48
|
],
|
|
49
|
-
"scripts": {
|
|
50
|
-
"build": "run-s clean build:pkg check:pkg",
|
|
51
|
-
"build:pkg": "node -r esbuild-register scripts/build",
|
|
52
|
-
"check:pkg": "node -r esbuild-register scripts/check",
|
|
53
|
-
"check:types": "tsc --build",
|
|
54
|
-
"clean": "rimraf dist test/env/__tmp__",
|
|
55
|
-
"commit": "cz",
|
|
56
|
-
"extract": "sanity-tsdoc etl --outDir etc/api/@sanity/pkg-utils --tsconfig tsconfig.dist.json",
|
|
57
|
-
"format": "prettier --write --cache --ignore-unknown . && eslint . --ext .cjs,.js,.ts,.tsx --fix --quiet",
|
|
58
|
-
"lint": "eslint . --ext .cjs,.js,.ts,.tsx",
|
|
59
|
-
"playground:build": "pnpm --filter './playground/**' build",
|
|
60
|
-
"playground:clean": "pnpm --filter './playground/**' --silent clean",
|
|
61
|
-
"prepublishOnly": "pnpm run build",
|
|
62
|
-
"test": "run-s playground:clean test:clean vitest:run",
|
|
63
|
-
"test:clean": "rimraf test/env/__tmp__",
|
|
64
|
-
"vitest:run": "vitest run",
|
|
65
|
-
"watch": "node -r esbuild-register scripts/watch"
|
|
66
|
-
},
|
|
67
49
|
"commitlint": {
|
|
68
50
|
"extends": [
|
|
69
51
|
"@commitlint/config-conventional"
|
|
@@ -119,7 +101,6 @@
|
|
|
119
101
|
"devDependencies": {
|
|
120
102
|
"@commitlint/cli": "^19.2.1",
|
|
121
103
|
"@commitlint/config-conventional": "^19.1.0",
|
|
122
|
-
"@sanity/pkg-utils": "workspace:*",
|
|
123
104
|
"@types/babel__core": "^7.20.5",
|
|
124
105
|
"@types/cpx": "^1.5.5",
|
|
125
106
|
"@types/find-config": "^1.0.4",
|
|
@@ -150,7 +131,8 @@
|
|
|
150
131
|
"ts-node": "^10.9.2",
|
|
151
132
|
"typescript": "5.4.2",
|
|
152
133
|
"vitest": "^1.4.0",
|
|
153
|
-
"vitest-github-actions-reporter": "^0.11.1"
|
|
134
|
+
"vitest-github-actions-reporter": "^0.11.1",
|
|
135
|
+
"@sanity/pkg-utils": "5.1.1"
|
|
154
136
|
},
|
|
155
137
|
"peerDependencies": {
|
|
156
138
|
"typescript": "5.4.2"
|
|
@@ -162,9 +144,21 @@
|
|
|
162
144
|
"publishConfig": {
|
|
163
145
|
"access": "public"
|
|
164
146
|
},
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
|
|
168
|
-
|
|
147
|
+
"scripts": {
|
|
148
|
+
"build": "run-s clean build:pkg check:pkg",
|
|
149
|
+
"build:pkg": "node -r esbuild-register scripts/build",
|
|
150
|
+
"check:pkg": "node -r esbuild-register scripts/check",
|
|
151
|
+
"check:types": "tsc --build",
|
|
152
|
+
"clean": "rimraf dist test/env/__tmp__",
|
|
153
|
+
"commit": "cz",
|
|
154
|
+
"extract": "sanity-tsdoc etl --outDir etc/api/@sanity/pkg-utils --tsconfig tsconfig.dist.json",
|
|
155
|
+
"format": "prettier --write --cache --ignore-unknown . && eslint . --ext .cjs,.js,.ts,.tsx --fix --quiet",
|
|
156
|
+
"lint": "eslint . --ext .cjs,.js,.ts,.tsx",
|
|
157
|
+
"playground:build": "pnpm --filter './playground/**' build",
|
|
158
|
+
"playground:clean": "pnpm --filter './playground/**' --silent clean",
|
|
159
|
+
"test": "run-s playground:clean test:clean vitest:run",
|
|
160
|
+
"test:clean": "rimraf test/env/__tmp__",
|
|
161
|
+
"vitest:run": "vitest run",
|
|
162
|
+
"watch": "node -r esbuild-register scripts/watch"
|
|
169
163
|
}
|
|
170
|
-
}
|
|
164
|
+
}
|
|
@@ -75,18 +75,20 @@ export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
|
|
|
75
75
|
|
|
76
76
|
// Handle dts tasks for bundles
|
|
77
77
|
for (const bundle of bundles) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
if (bundle.source?.endsWith('.ts')) {
|
|
79
|
+
// importId needs to be how the bundle is used, like `@sanity/pkg-utils/dist/cli`
|
|
80
|
+
// exportPath needs to be the path to the bundle, like `./dist/cli`
|
|
81
|
+
// targetPaths is then: [./dist/cli.d.ts, ./dist/cli.d.cts]
|
|
82
|
+
const exportPath = (bundle.import || bundle.require)!.replace(/\.[mc]?js$/, '')
|
|
83
|
+
const importId = path.join(pkg.name, exportPath)
|
|
84
|
+
|
|
85
|
+
dtsTask.entries.push({
|
|
86
|
+
importId,
|
|
87
|
+
exportPath,
|
|
88
|
+
sourcePath: bundle.source,
|
|
89
|
+
targetPaths: getTargetPaths(pkg.type, bundle),
|
|
90
|
+
})
|
|
91
|
+
}
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
// Add dts task
|
|
@@ -147,7 +149,6 @@ export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
|
|
|
147
149
|
})
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
// @TODO also handle bundles
|
|
151
152
|
for (const bundle of bundles) {
|
|
152
153
|
const idx = bundles.indexOf(bundle)
|
|
153
154
|
|