Skip to content

Commit

Permalink
fix: ensure paraglide demo works when typescript is selected (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 authored Oct 15, 2024
1 parent 0e37e63 commit 55b2512
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-bulldogs-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: ensure `lang="ts"` is added in `paraglide` demo
6 changes: 2 additions & 4 deletions packages/adders/paraglide/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ export default defineAdder({
const { ast, generateCode } = parseScript(content);

const vitePluginName = 'paraglide';
imports.addNamed(ast, '@inlang/paraglide-sveltekit/vite', {
paraglide: vitePluginName
});
imports.addNamed(ast, '@inlang/paraglide-sveltekit/vite', { paraglide: vitePluginName });

const { value: rootObject } = exports.defaultExport(
ast,
Expand Down Expand Up @@ -239,7 +237,7 @@ export default defineAdder({
name: ({ kit }) => `${kit?.routesDirectory}/+page.svelte`,
condition: ({ options }) => options.demo,
content({ content, options, typescript }) {
const { script, template, generateCode } = parseSvelte(content);
const { script, template, generateCode } = parseSvelte(content, { typescript });

imports.addDefault(script.ast, '$lib/paraglide/messages.js', '* as m');
imports.addNamed(script.ast, '$app/navigation', { goto: 'goto' });
Expand Down

0 comments on commit 55b2512

Please sign in to comment.