- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import { parse } from "svelte/compiler";
|
|
import { convertSvelteRoot } from "./converts/index.js";
|
|
import { ParseError } from "../errors.js";
|
|
import { svelteVersion } from "./svelte-version.js";
|
|
/**
|
|
* Parse for template
|
|
*/
|
|
export function parseTemplate(code, ctx, parserOptions) {
|
|
try {
|
|
const options = {
|
|
filename: parserOptions.filePath,
|
|
...(svelteVersion.gte(5) ? { modern: true } : {}),
|
|
};
|
|
const svelteAst = parse(code, options);
|
|
const ast = convertSvelteRoot(svelteAst, ctx);
|
|
return {
|
|
ast,
|
|
svelteAst,
|
|
};
|
|
}
|
|
catch (e) {
|
|
if (typeof e.pos === "number") {
|
|
const err = new ParseError(e.message, e.pos, ctx);
|
|
err.svelteCompilerError = e;
|
|
throw err;
|
|
}
|
|
if (Array.isArray(e.position) && typeof e.position[0] === "number") {
|
|
const err = new ParseError(e.message, e.position[0], ctx);
|
|
err.svelteCompilerError = e;
|
|
throw err;
|
|
}
|
|
throw e;
|
|
}
|
|
}
|