feat(http-recorder): sync recorder v0.3 (#35619)

This commit is contained in:
Kit Langton 2026-07-08 11:41:59 -04:00 committed by GitHub
commit 3dd29094f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 2697 additions and 2207 deletions

View file

@ -15,10 +15,6 @@ export const pack = async () => {
}
for (const [key, value] of Object.entries(pkg.exports)) {
if (key === "./internal") {
delete pkg.exports[key]
continue
}
if (typeof value !== "string") continue
const file = value.replace("./src/", "./dist/").replace(/\.ts$/, "")
pkg.exports[key] = { import: `${file}.js`, types: `${file}.d.ts` }
@ -32,4 +28,14 @@ export const pack = async () => {
}
}
export const withPackedArchive = async <A>(use: (archive: string) => Promise<A>) => {
const archive = await pack()
try {
return await use(archive)
} finally {
const file = Bun.file(archive)
if (await file.exists()) await file.delete()
}
}
if (import.meta.main) await pack()