@shadow-js/dusk/vite
The 93 exports of @shadow-js/dusk/vite: 33 functions, 2 classes, 48 interfaces, 6 types and 4 consts.
Everything @shadow-js/dusk/vite exports, from the TSDoc of its entry point.
Functions#
applyServerEnv: Puts variables from the env files intoprocess.env, for server code that readsprocess.env.NAME(the same way production does, where the platform sets them).bakeServerConfig: The server part of a validated configuration, as plain JSON.checkEnvFiles: Refuses a name that is declared in a public file and also in a server file: its value would be public or not depending on which file wins, so the build fails instead.clientEntrySource: The generated client entry: starts the app on the server's markup.compileGlob: Compiles a glob to a predicate.computeAssets: Computes what the server puts in the page for each route: the entry, the stylesheets every page needs, and per route the chunks and stylesheets of its lazily loaded UI that the entry does not already bring.createDuskManifest: Builds the contents ofdusk-manifest.json.defineConfig: Typed identity fordusk.config.ts: `export default defineConfig({ ...defineFonts: The stylesheet, the variables and the preloads of the given families.discoverProject: Looks for the conventional files.dusk: The Vite plugins of a Dusk app, in the order they must run: 1.findForbiddenEnvReads: Findsimport.meta.env.NAMEreads of names the browser does not get.fnId: Stable id of a server function: the first 128 bits ofsha256(NFC(relative path) + "#" + export name)in base64url (22 characters).fontPreloadsFor: The tags to preload on one route: those of every rule whose pattern matches the path, without a tag thatpreloads(the ones every page loads) already has and without repeats.formatFontReport: The report as a table of text, one line per file, with the totals.imageVariants: TheimageVariants()Vite plugin.importProtection: The import protection plugin.loadBuiltServer: Loads the built server entry: its handler, and theprerenderRoutesit exports (the route functions, loaded lazily).loadDuskConfigFile: Loadsdusk.config.(ts\|mts\|js\|mjs)from the project root with Vite's config loader, and validates it.loadServerEnv: Reads the env files of a mode for server code:.env.public,.env,.env.localand their mode variants, layered as described in readEnvFiles.mergeBuildOptions: The precedence of build options: a `dusk({ ...prerenderFile: The file a path is written to, insideclientDir:/isindex.html,/aboutisabout/index.html.prerenderTargets: Which paths to prerender from literal settings: routes withexport const prerender = trueand a static path,export const prerender = ["/a", "/b"], routes withexport const ssr = false(their shell), and the paths given inroutes.publicEnvNames: The names a browser may read among the given names: the prefixed ones and the ones declared in.env.public, sorted.publicPrefixes: Prefixes the user configured, validated: a prefix that is empty or very short would expose almost every variable.pwa: Thepwa()Vite plugin.readEnvFiles: Reads the env files of a mode from a folder.resolvePrerenderTargets: Every page to prerender: the literal settings of prerenderTargets, the paths that the route functions produce, andentries.routeMiddlewareSource: Builds the middleware source of a scan.serverEntrySource: The server entry: imports the route tree, the app and the user's handler options, registers the API routes lazily and the server functions (lazily in the dev server, from static imports in a build), and exportshandler(also as default).subsetFonts: Cuts the local font files of some families into slices by Unicode range, and returns the families with the slices as their files.transformServerFns: Finds the server functions of a module and, for theclientandservertargets, rewrites it.validateDuskConfig: Validates the file's default export.
Classes#
PrerenderError: Why a prerender failed.ServerFnError: A problem in a server function, with the position in the file and a code frame.
Interfaces#
BakedServerConfig: The server part of the configuration.BuildReport: What the last production build did, for the command line's summary.BuildStep: One phase of a production build and how long it took.BuiltAssets: The asset section the handler's manifest takes.BuiltServer: A built server entry, loaded: its handler and the loaders of its route functions.DefineFontsOptions: Options of defineFonts.DefineGoogleFontsInput: The input with Google Fonts: the families to fetch, and local families next to them.DuskBuildBudgets: Size budgets of the production build, in gzip bytes.DuskBuildConfig: Build-time settings (not part of the server bundle).DuskConfig: The whole configuration.DuskCoreApi: What the core plugin exposes to tests and tools.DuskCorePlugin: The core plugin: a Vite plugin with anapi.DuskDraftModeConfig: Draft (preview) mode settings.DuskI18nConfig: Locales of the app (i18nindusk.config.ts).DuskI18nRoutingConfig:i18n.routingofdusk.config.ts: declaring it turns on automatic locale routing (a locale middleware, the redirects,<html lang dir>, thehreflanglinks and the client sync).DuskImageConfig: Image settings: the remote hosts the optimizer may fetch, and the widths, formats and qualities it serves.DuskManifest: The JSON filedusk-manifest.json.DuskOptions: Options of dusk.DuskSecurityConfig: Security settings of the file.EnvFiles: The env files of one mode, read for the build and for server code.FontDefinition: A font family: its files, its CSS variable, and its fallback metrics.FontFile: One font file, relative to the public directory.FontReport: What the build produced for fonts: every file with its size, and the totals.FontReportFile: One font file in the report.FontRoutePreloads: The preload tags that belong to the routes matching a pattern.FontsOutput: What defineFonts produces.FontSubset: One slice to make: a name for the file, and theunicode-rangeit covers.GoogleFont: A Google Fonts family and the faces to take from it.GoogleFontsOptions: Options that control the Google step of defineFonts.ImageVariantsOptions: Options of imageVariants.ImportProtectionOptions: Glob lists of the import protection.LoadedDuskConfig: A loaded and validated configuration file.PrerenderFailureEvent: A page that did not render.PrerenderOptions: What to prerender at build time.PrerenderRouteLoader: Theprerenderexport of a route that is a function, loaded from the server bundle.PrerenderSuccess: A page that was written.PrerenderTarget: // ---- prerender --------------------------------------------------------------------------------- /** A path to render at build time.ProjectLayout: Files of the project that Dusk looks for by name.PwaOfflinePage: The page the worker shows when a navigation fails and no app shell answers it.PwaOptions: Options of pwa.PwaRuntimeRule: One runtime caching rule: which requests it covers and how they are answered.RouteMiddlewareSource: The middleware manifest source of an app.ServerFnInfo: A server function found in a module.ServerFnRecord: A server function and the file that defines it.ServerFnTransformOptions: Options of transformServerFns.ServerFnTransformResult: Outcome of transformServerFns.SubsetFontsOptions: Options of subsetFonts.ViteManifestChunk: One entry of Vite's.vite/manifest.json.
Types#
BuildStepName: The phases of a production build, in the order they run.CacheStrategy: How a runtime rule answers a request.DuskEnvShape: Env declarations as written in the file: the same plain shapedefineEnvtakes.ServerFnIssueCode: Diagnostics of the transform.SubsetFontFn: The function that cuts a font down to the characters of a string, in the shape ofsubset-font: the font file, the text whose glyphs stay, and the options.ViteManifest: Vite's client manifest.
Constants#
CLIENT_ENTRY_ID: Id of the generated client entry.FONT_SUBSETS: The Unicode ranges of the usual scripts, the same slices Google Fonts serves, asunicode-rangevalues.PUBLIC_ENV_PREFIX: Prefix of the variables the browser may read.SERVER_ENTRY_ID: Id of the server entry module (what a user of the plugin imports or builds).