Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

fix(compiler): when useStorage returns a Uint8Array, decode it to text (fixes #33) #34

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/runtime/server/nitro/useCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ export async function useCompiler(
verbose = false,
) {
const vueEmailOptions = useRuntimeConfig().public.vueEmail as ModuleOptions
const source = await useStorage(storageKey).getItem(filename)
let source = await useStorage(storageKey).getItem(filename)
if (source instanceof Uint8Array)
source = new TextDecoder().decode(source)
const keys = await useStorage(storageKey).getKeys()
const components: {
name: string
source: string
}[] = []
for (const key of keys) {
const value = await useStorage(storageKey).getItem(key)
let value = await useStorage(storageKey).getItem(key)
if (value instanceof Uint8Array)
value = new TextDecoder().decode(value)

if (value && key.endsWith('.vue')) {
components.push({
Expand Down
Loading