Type an import map configuration for export and reuse, then pass it to createImportMap or writeImportMap. Returns its input unchanged; it exists only for inference and autocomplete.
An importmapify config file: the shape a config file's default export
and defineConfig
take. Every field is optional; the config loader and CLI supply root
and the remaining defaults.
-
hooks: Partial<ImportMapHooks>
Lifecycle hooks the CLI runs around generation. Ignored by writeImportMap and createImportMap.
Resolved paths shared by every generation hook.
-
out: string
Absolute output path the map resolves against.
-
root: string
Absolute project root that gets scanned.
Lifecycle hooks the CLI runs around import map generation, modeled on tsdown's hooks.
-
generate:before: (context: HookContext) => void | Promise<void>
Runs before the filesystem is scanned. Build pattern targets here so they exist when patterns expand.
-
generate:done: (context: HookContext
&
{ readonly map: ImportMapDocument;
}) => void | Promise<void>
Runs after the map is generated and emitted.