histoire
Version:
A fast story book powered by Vite
19 lines • 1.06 kB
TypeScript
/**
* Emits the Vitest preview environment bootstrap: the globals a Vitest browser
* runner expects (`__vitest_worker__`, `__vitest_browser_runner__`) and the
* `ModuleMocker` wiring — server interceptor + the dev-server mock RPC in dev,
* MSW interceptor with the static mock runtime in build mode.
*
* When Vitest is unavailable the emitted `ensureVitestPreviewEnvironment` is a
* no-op, so the rest of the runtime can call it unconditionally. That branch
* emits NO body at all: the mocker classes and static-mock helpers it would
* reference (`ModuleMocker`, `createMockInstance`, `createStaticPreviewMockRpc`…)
* are only imported by the preamble when `hasVitestPreview` is true, so keeping
* the body behind a runtime flag would leave the emitted module referencing
* identifiers it never imported.
*
* @param hasVitestPreview True when the mocker modules resolved and were
* imported by the preamble.
*/
export declare function previewVitestEnvironment(hasVitestPreview: boolean): string;
//# sourceMappingURL=vitest-environment.d.ts.map