Something went wrong. Try again.
write Deno web servers with Vite
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950/** * utility functions for the server environment. * * @example * ```ts * // server.ts * import { fetchAsset } from '@mary/dromi/server'; * * export default { * fetch(request) { * // ...your routes * * return fetchAsset(request); * }, * } satisfies Deno.ServeDefaultExport; * ``` * * @module */
import type { ClientEntry } from './runtime/manifest.ts';
export type { ClientEntry };
// this is a stub
/** * resolves a client script input to its URLs for server-rendered HTML. * * inputs come from `environments.client.build.rolldownOptions.input`; HTML inputs are excluded. * * @param name input key, or filename without its extension for string and array inputs * @returns script and stylesheet URLs; see {@link ClientEntry} * @throws when no client entry has that name, or when called outside a server entrypoint run by the plugin */export const resolveClientEntry = (_name: string): ClientEntry => { throw new Error(`resolveClientEntry() can only be used in a server entrypoint run by dromi`);};
/** * fetches a static asset. * * @param request request to serve; its origin is ignored * @returns asset response, configured fallback, or 404 if neither exists * @throws when called outside a server entrypoint run by the plugin */export const fetchAsset = (_request: Request): Promise<Response> => { throw new Error(`fetchAsset() can only be used in a server entrypoint run by dromi`);};