From fed3149ac4a9937ceff105be75945be81828b366 Mon Sep 17 00:00:00 2001 From: Huanqi Cao Date: Mon, 3 Aug 2026 00:41:47 +0800 Subject: [PATCH] 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. --- packages/host/directory-picker-native/package.json | 6 +++++- .../host/directory-picker-native/src/win32-dialog-host.ts | 2 +- packages/host/directory-picker-native/tsdown.config.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/host/directory-picker-native/package.json b/packages/host/directory-picker-native/package.json index 49033cdcf4..72e1d1be45 100644 --- a/packages/host/directory-picker-native/package.json +++ b/packages/host/directory-picker-native/package.json @@ -19,14 +19,18 @@ "types": "./lib/types/client/index.d.ts", "default": "./lib/client.js" }, + "./worker": { + "types": "./lib/types/win32-dialog-worker.d.ts", + "default": "./lib/worker.cjs" + }, "./src/*": "./src/*", "./package.json": "./package.json" }, "files": [ "lib/index.js", "lib/invariant.js", + "lib/worker.cjs", "lib/client.js", - "lib/win32-dialog-worker.cjs", "lib/types/**/*.d.ts", "lib/types/**/*.d.ts.map", "src" diff --git a/packages/host/directory-picker-native/src/win32-dialog-host.ts b/packages/host/directory-picker-native/src/win32-dialog-host.ts index cfaf07cc46..781cbc4b24 100644 --- a/packages/host/directory-picker-native/src/win32-dialog-host.ts +++ b/packages/host/directory-picker-native/src/win32-dialog-host.ts @@ -20,7 +20,7 @@ import type { Win32DialogWorkerData } from './win32-dialog-worker.ts' export function spawnDialogWorker(data: Win32DialogWorkerData): Worker { /* v8 ignore next 3 -- the built-output arm: tests always run unbuilt (src/) */ 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 bootstrap = [ diff --git a/packages/host/directory-picker-native/tsdown.config.ts b/packages/host/directory-picker-native/tsdown.config.ts index 3ab92526e4..529fb7b2ac 100644 --- a/packages/host/directory-picker-native/tsdown.config.ts +++ b/packages/host/directory-picker-native/tsdown.config.ts @@ -6,7 +6,9 @@ import { clientBundle } from '../../client/tsdown.client.ts' export default [ ...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', format: ['cjs'] as ['cjs'], platform: 'node' as const,