fix(types): align file buffers for convex deploy
This commit is contained in:
parent
e638154f64
commit
caa94f0ba6
@ -66,7 +66,7 @@ describe('expandFiles', () => {
|
||||
'SKILL.md': strToU8('hello'),
|
||||
'docs/readme.txt': strToU8('doc'),
|
||||
})
|
||||
const zipFile = new File([zip], 'pack.zip', { type: 'application/zip' })
|
||||
const zipFile = new File([zip.buffer], 'pack.zip', { type: 'application/zip' })
|
||||
const result = await expandFiles([zipFile])
|
||||
expect(result.map((file) => file.name)).toEqual(['SKILL.md', 'docs/readme.txt'])
|
||||
})
|
||||
@ -77,14 +77,14 @@ describe('expandFiles', () => {
|
||||
{ name: 'notes.txt', content: 'yo' },
|
||||
])
|
||||
const tgz = gzipSync(tar)
|
||||
const tgzFile = new File([tgz], 'bundle.tgz', { type: 'application/gzip' })
|
||||
const tgzFile = new File([tgz.buffer], 'bundle.tgz', { type: 'application/gzip' })
|
||||
const result = await expandFiles([tgzFile])
|
||||
expect(result.map((file) => file.name)).toEqual(['SKILL.md', 'notes.txt'])
|
||||
})
|
||||
|
||||
it('expands .gz single files', async () => {
|
||||
const gz = gzipSync(strToU8('content'))
|
||||
const gzFile = new File([gz], 'skill.md.gz', { type: 'application/gzip' })
|
||||
const gzFile = new File([gz.buffer], 'skill.md.gz', { type: 'application/gzip' })
|
||||
const result = await expandFiles([gzFile])
|
||||
expect(result.map((file) => file.name)).toEqual(['skill.md'])
|
||||
})
|
||||
|
||||
@ -26,7 +26,7 @@ export async function expandFiles(selected: File[]) {
|
||||
for (const [path, data] of Object.entries(entries)) {
|
||||
if (!path || path.endsWith('/')) continue
|
||||
expanded.push(
|
||||
new File([data], normalizePath(path), {
|
||||
new File([data.buffer], normalizePath(path), {
|
||||
type: guessContentType(path),
|
||||
}),
|
||||
)
|
||||
@ -37,7 +37,7 @@ export async function expandFiles(selected: File[]) {
|
||||
const unpacked = gunzipSync(new Uint8Array(await readArrayBuffer(file)))
|
||||
for (const entry of untar(unpacked)) {
|
||||
expanded.push(
|
||||
new File([entry.data], normalizePath(entry.path), {
|
||||
new File([entry.data.buffer], normalizePath(entry.path), {
|
||||
type: guessContentType(entry.path),
|
||||
}),
|
||||
)
|
||||
@ -47,7 +47,7 @@ export async function expandFiles(selected: File[]) {
|
||||
if (lower.endsWith('.gz')) {
|
||||
const unpacked = gunzipSync(new Uint8Array(await readArrayBuffer(file)))
|
||||
const name = file.name.replace(/\.gz$/i, '')
|
||||
expanded.push(new File([unpacked], name, { type: guessContentType(name) }))
|
||||
expanded.push(new File([unpacked.buffer], name, { type: guessContentType(name) }))
|
||||
continue
|
||||
}
|
||||
expanded.push(file)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"jsx": "react-jsx",
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"types": ["vite/client"],
|
||||
"types": ["vite/client", "vitest/globals"],
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user