Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import { GenerateConfig } from '../types';

export default async function (config: GenerateConfig) {
const ts = `
import type { LayoutLoad } from './$types';

export const load: LayoutLoad = async () => {
return {};
};
`.trim();

const tsSatisfies = `
import type { LayoutLoad } from './$types';

export const load = (async () => {
return {};
}) satisfies LayoutLoad;
`.trim();

const js = `
/** @type {import('./$types').LayoutLoad} */
return `
export async function load() {
return {};
}
`.trim();

return config.type === 'js' ? js : config.type === 'ts' ? ts : tsSatisfies;
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import { GenerateConfig } from '../types';

export default async function (config: GenerateConfig) {
const ts = `
import type { LayoutServerLoad } from './$types';

export const load: LayoutServerLoad = async () => {
return {};
};
`.trim();

const tsSatisfies = `
import type { LayoutServerLoad } from './$types';

export const load = (async () => {
return {};
}) satisfies LayoutServerLoad;
`.trim();

const js = `
/** @type {import('./$types').LayoutServerLoad} */
return `
export async function load() {
return {};
}
`.trim();

return config.type === 'js' ? js : config.type === 'ts' ? ts : tsSatisfies;
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import { GenerateConfig } from '../types';

export default async function (config: GenerateConfig) {
const ts = `
import type { PageLoad } from './$types';

export const load: PageLoad = async () => {
return {};
};
`.trim();

const tsSatisfies = `
import type { PageLoad } from './$types';

export const load = (async () => {
return {};
}) satisfies PageLoad;
`.trim();

const js = `
/** @type {import('./$types').PageLoad} */
return `
export async function load() {
return {};
};
`.trim();

return config.type === 'js' ? js : config.type === 'ts' ? ts : tsSatisfies;
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import { GenerateConfig } from '../types';

export default async function (config: GenerateConfig) {
const ts = `
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async () => {
return {};
};
`.trim();

const tsSatisfies = `
import type { PageServerLoad } from './$types';

export const load = (async () => {
return {};
}) satisfies PageServerLoad;
`.trim();

const js = `
/** @type {import('./$types').PageServerLoad} */
return `
export async function load() {
return {};
};
`.trim();

return config.type === 'js' ? js : config.type === 'ts' ? ts : tsSatisfies;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import { GenerateConfig } from '../types';

export default async function generate(config: GenerateConfig) {
const ts = `
import type { RequestHandler } from './$types';

export const GET: RequestHandler = async () => {
return new Response();
};
`.trim();

const js = `
/** @type {import('./$types').RequestHandler} */
return `
export async function GET() {
return new Response();
};
`.trim();

return config.type === 'js' ? js : ts;
}