fix(release): keep node bundles readable for the worker image

The browser worker image lowers `yield*` only as a whole statement and
rewrites `for await` loops by their source layout, so compressed node-side
entries either fail that lowering or lower to unparseable code. Only the
browser bundles keep compression, which removes about a third of their text.

The bundle-purity assertion now matches the module-loader call regardless of
the quote style compression picks, and the release-pack fixture exercises
the installed package's new documentation requirement.
This commit is contained in:
turtle1999 committed 2026-10-08 20:20:54 +08:00
1 parent a9fc7f9945
commit 8890ac3705
7 files changed
+27 -24

No files matched your search

+3 -2
View File
@@ -76,8 +76,9 @@ describe('client bundle dynamic imports', () => {
})
const chunks = builds.flatMap(bundle => bundle.chunks).filter(chunk => chunk.type === 'chunk')
const output = chunks.find(chunk => chunk.fileName === 'client.js')?.code
expect(output).toContain('require.async("./client.terminal.js")')
expect(output).not.toContain('Promise.resolve().then(() => require("./client.terminal.js"))')
// The compressor rewrites string literals, so the quotes are not part of the contract.
expect(output).toMatch(/require\.async\((["'`])\.\/client\.terminal\.js\1\)/)
expect(output).not.toMatch(/Promise\.resolve\(\)\.then\(\(\)\s*=>\s*require\((["'`])\.\/client\.terminal\.js\1\)\)/)
} finally {
for (const bundle of builds) await bundle[Symbol.asyncDispose]()
}
+6 -4
View File
@@ -307,16 +307,18 @@ describe('release pack CLI', () => {
it('validates every parallel tarball before recording the publish order', async () => {
const root = fixture()
packageFixture(root, 'packages/util/alpha', '@deepseek-ai/alpha')
packageFixture(root, 'packages/util/zebra', '@deepseek-ai/zebra', { files: ['lib/index.js', 'lib/client.js.map'] })
write(join(root, 'packages/util/zebra/lib/client.js.map'), '{"version":3}\n')
packageFixture(root, 'apps/cli', '@deepseek-ai/dsh', { files: ['lib/index.js', 'src/bin.ts'] })
packageFixture(root, 'packages/subagent/subagent-claude-code', '@deepseek-ai/dsh-subagent-claude-code')
packageFixture(root, 'packages/subagent/subagent-codex', '@deepseek-ai/dsh-subagent-codex')
write(join(root, 'apps/cli/src/bin.ts'), 'export const bin = 1\n')
write(join(root, 'apps/web/dist/index.html'), '<main></main>')
writeClientBuildRecord(root, officialClientBuildEnvironment(root, { DSH_CLIENT_COMMIT_HASH: commit }))
const result = await runPack(root, ['--family', 'dsh', '--concurrency', '8'])
expect(result.status).not.toBe(0)
expect(result.stderr).toContain('@deepseek-ai/zebra publishes JavaScript map package/lib/client.js.map')
expect(readdirSync(join(root, 'packed')).filter(name => name.endsWith('.tgz'))).toHaveLength(2)
expect(result.stderr).toContain('@deepseek-ai/dsh packed no documentation')
expect(readdirSync(join(root, 'packed')).filter(name => name.endsWith('.tgz'))).toHaveLength(4)
expect(existsSync(join(root, 'packed', PUBLISH_ORDER_FILE))).toBe(false)
})