// @ts-nocheck import { promises as fs } from 'node:fs'; import { dirname, isAbsolute, join, relative } from 'node:path'; import { compile } from 'svelte/compiler'; const convertMessage = ({ message, start, end, filename, frame }) => ({ text: message, location: start && end && { file: filename, line: start.line, column: start.column, length: start.line === end.line ? end.column - start.column : 0, lineText: frame, }, }); const handleLoad = async (args, generate, { isDev }) => { const { path } = args; const source = await fs.readFile(path, 'utf8'); const filename = relative(process.cwd(), path); try { let compileOptions = { dev: isDev, css: false, generate, hydratable: true }; let { js, warnings } = compile(source, { ...compileOptions, filename }); let contents = js.code + `\n//# sourceMappingURL=` + js.map.toUrl(); return { loader: 'js', contents, resolveDir: dirname(path), warnings: warnings.map((w) => convertMessage(w)), }; } catch (e) { return { errors: [convertMessage(e)] }; } }; export default function sveltePlugin({ isDev = false }) { return { name: 'svelte-esbuild', setup(build) { build.onResolve({ filter: /\.svelte$/ }, (args) => { let path = args.path.replace(/\.(?:client|server)/, ''); path = isAbsolute(path) ? path : join(args.resolveDir, path); if (/\.client\.svelte$/.test(args.path)) { return { path, namespace: 'svelte:client', }; } if (/\.server\.svelte$/.test(args.path)) { return { path, namespace: 'svelte:server', }; } }); build.onLoad({ filter: /.*/, namespace: 'svelte:client' }, (args) => handleLoad(args, 'dom', { isDev }) ); build.onLoad({ filter: /.*/, namespace: 'svelte:server' }, (args) => handleLoad(args, 'ssr', { isDev }) ); }, }; } ue='chore/db-remote-server-destroy'>chore/db-remote-server-destroy Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/dynamic-route.test.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-04-10attempt to fix the 'no commits' bug in changesetGravatar Fred K. Schott 1-1/+1
2022-04-10revert releaseGravatar Fred K. Schott 76-225/+329
2022-04-10Update astro changelogGravatar Fred K. Schott 1-29/+0
2022-04-11[ci] formatGravatar FredKSchott 3-34/+34
2022-04-10[ci] release (#3060)Gravatar github-actions[bot] 76-363/+288
2022-04-10update changesetGravatar Fred K. Schott 1-1/+0
2022-04-10update changesetGravatar Fred K. Schott 1-1/+1
2022-04-10update lockfile (#3059)Gravatar Fred K. Schott 29-914/+698
2022-04-10correct changesetsGravatar Fred K. Schott 3-3/+11
2022-04-10chore: webapi test now use chai (#3048)Gravatar Juan Martín Seery 16-814/+539
2022-04-10update test names containing spacesGravatar Fred K. Schott 26-17/+17
2022-04-11[ci] formatGravatar FredKSchott 2-8/+7
2022-04-10Fix SSR static build public file copying. fixes #3016 (#3037)Gravatar Steve Lee 8-5/+48
2022-04-10fix our weird beta release issues (#3031)Gravatar Fred K. Schott 4-6/+116
2022-04-10update tailwind integration readmeGravatar Fred K. Schott 2-9/+38
2022-04-10Fixed MD Lint issues (#3038)Gravatar Rafid Muhymin Wafi 1-12/+11