Skip to content

Search the guides, deployment pages, and API reference.

@pitlane/assets

Framework-neutral asset resolution: construct a resolver from the manifest a build integration supplies, and read browser-entry URLs, preloads, stylesheets, and import maps from it.

See

Asset resolution guide

Interfaces

  • AssetEnvironment. Every source module observed in one environment's graph, keyed by portable source key.
  • AssetMetadata. The JavaScript and CSS one source module requires in one environment.
  • AssetResolver. Resolves portable source keys, such as app/entry.browser.ts or file:app/counter.tsx#Counter, to the URLs a build or development server produced for them.
  • BuildAssetsManifest. The manifest a production build produces.
  • DevAssetsManifest. The manifest a development server supplies, refreshed as the graph changes.
  • ImportMap. An import map as the HTML standard defines it: specifier mappings, optional scoped mappings, and optional integrity metadata.
  • RenderImportMapOptions. Options for renderImportMap.
  • ScriptEntry. What a browser needs to load one script entry: its URL, the URLs worth modulepreload hints, and the import map its imports resolve through.

Type Aliases

  • AssetsManifest. Everything createAssetResolver accepts. { mode: "unavailable" } is what @pitlane/assets/manifest exports when no build integration replaced it.

Functions

  • createAssetResolver. Constructs the resolver for a manifest, usually the default export of @pitlane/assets/manifest. Construct it once, in a module of the app's own.
  • renderImportMap. Serializes an import map into an inline <script type="importmap"> element for server-rendered HTML, or "" when the map has no mappings.