feat(http-recorder): sync recorder v0.3 (#35619)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user