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

Commit

Permalink
fix(compiler): when useStorage returns a Uint8Array, decode it to t…
Browse files Browse the repository at this point in the history
…ext (fixes #33) (#34)

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

* chore: lint
  • Loading branch information
L422Y authored Mar 1, 2024
1 parent 8f8ffc5 commit acf7373
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit acf7373

Please sign in to comment.