Skip to content

Commit

Permalink
feat: support svelte v5
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Nov 17, 2024
1 parent 0140af1 commit ba212bb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions composables/parser/svelte.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { svelteTemplate } from './template'
import type { LanguageOption, Parser } from './index'
import type { compile, CompileOptions } from 'svelte/compiler'
import type * as Svelte from 'svelte/compiler'

// @unocss-include

const svelteCompiler: Parser<typeof compile, CompileOptions> = {
const svelteCompiler: Parser<typeof Svelte, Svelte.CompileOptions> = {
id: 'svelte-compiler',
label: 'svelte/compiler',
icon: 'i-vscode-icons:file-type-svelte',
Expand All @@ -16,11 +16,10 @@ const svelteCompiler: Parser<typeof compile, CompileOptions> = {
editorLanguage: 'json',
},
pkgName: 'svelte',
getModuleUrl: (pkg) => `https://esm.sh/${pkg}/src/compiler/compile/index.js`,
init: (url) => importUrl(url).then((mod) => mod.default),
getModuleUrl: (pkg) => `https://esm.sh/${pkg}/src/compiler/index.js`,
version: fetchVersion,
parse(code, options) {
return this(code, options)?.ast
return this.compile(code, options)?.ast
},
getAstLocation,
}
Expand Down

0 comments on commit ba212bb

Please sign in to comment.