fix(picker): ship the dialog worker as the constrained ./worker artifact

The workspace files constraint keys worker bundles on the ./worker export
(lib/worker.cjs, the workflow-workerthread shape); the descriptive source
entry stays win32-dialog-worker.ts and tsdown renames the bundle.
This commit is contained in:
Huanqi Cao
2026-08-03 00:41:47 +08:00
parent 8e0880e303
commit fed3149ac4
3 changed files with 9 additions and 3 deletions

View File

@@ -19,14 +19,18 @@
"types": "./lib/types/client/index.d.ts", "types": "./lib/types/client/index.d.ts",
"default": "./lib/client.js" "default": "./lib/client.js"
}, },
"./worker": {
"types": "./lib/types/win32-dialog-worker.d.ts",
"default": "./lib/worker.cjs"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js", "lib/invariant.js",
"lib/worker.cjs",
"lib/client.js", "lib/client.js",
"lib/win32-dialog-worker.cjs",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"

View File

@@ -20,7 +20,7 @@ import type { Win32DialogWorkerData } from './win32-dialog-worker.ts'
export function spawnDialogWorker(data: Win32DialogWorkerData): Worker { export function spawnDialogWorker(data: Win32DialogWorkerData): Worker {
/* v8 ignore next 3 -- the built-output arm: tests always run unbuilt (src/) */ /* v8 ignore next 3 -- the built-output arm: tests always run unbuilt (src/) */
if (!import.meta.url.endsWith('.ts')) { if (!import.meta.url.endsWith('.ts')) {
return new Worker(fileURLToPath(new URL('./win32-dialog-worker.cjs', import.meta.url)), { workerData: data }) return new Worker(fileURLToPath(new URL('./worker.cjs', import.meta.url)), { workerData: data })
} }
const workerEntry = new URL('./win32-dialog-worker.ts', import.meta.url) const workerEntry = new URL('./win32-dialog-worker.ts', import.meta.url)
const bootstrap = [ const bootstrap = [

View File

@@ -6,7 +6,9 @@ import { clientBundle } from '../../client/tsdown.client.ts'
export default [ export default [
...clientBundle('@deepseek-ai/dsh-host-directory-picker-native', ['lib/types/index.js', 'lib/types/invariant.js']), ...clientBundle('@deepseek-ai/dsh-host-directory-picker-native', ['lib/types/index.js', 'lib/types/invariant.js']),
{ {
entry: ['lib/types/win32-dialog-worker.js'], // The artifact is lib/worker.cjs (the ./worker export the workspace
// constraint keys on), bundled from the descriptive source entry.
entry: { worker: 'lib/types/win32-dialog-worker.js' },
outDir: 'lib', outDir: 'lib',
format: ['cjs'] as ['cjs'], format: ['cjs'] as ['cjs'],
platform: 'node' as const, platform: 'node' as const,