From 76cb9c2a39d477a64824a985ade40507e3bbade1 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 13 Feb 2026 21:34:48 -0800 Subject: feat(vanilla): add testing infrastructure and tests (NK-wjnczv) --- .../node_modules/vitest/dist/module-evaluator.d.ts | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 vanilla/node_modules/vitest/dist/module-evaluator.d.ts (limited to 'vanilla/node_modules/vitest/dist/module-evaluator.d.ts') diff --git a/vanilla/node_modules/vitest/dist/module-evaluator.d.ts b/vanilla/node_modules/vitest/dist/module-evaluator.d.ts new file mode 100644 index 0000000..c87577d --- /dev/null +++ b/vanilla/node_modules/vitest/dist/module-evaluator.d.ts @@ -0,0 +1,124 @@ +import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode } from 'vite/module-runner'; +import { V as VitestEvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js'; +import vm from 'node:vm'; +import { R as RuntimeRPC } from './chunks/rpc.d.RH3apGEf.js'; +import '@vitest/runner'; +import '@vitest/snapshot'; +import './chunks/traces.d.402V_yFI.js'; + +type ModuleExecutionInfo = Map; +interface ModuleExecutionInfoEntry { + startOffset: number; + /** The duration that was spent executing the module. */ + duration: number; + /** The time that was spent executing the module itself and externalized imports. */ + selfTime: number; + external?: boolean; + importer?: string; +} + +declare class FileMap { + private fsCache; + private fsBufferCache; + readFileAsync(path: string): Promise; + readFile(path: string): string; + readBuffer(path: string): Buffer; +} + +interface ModuleEvaluateOptions { + timeout?: vm.RunningScriptOptions["timeout"] | undefined; + breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined; +} +type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: { + assert: object; +}) => VMModule | Promise; +type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored"; +declare class VMModule { + dependencySpecifiers: readonly string[]; + error: any; + identifier: string; + context: vm.Context; + namespace: object; + status: ModuleStatus; + evaluate(options?: ModuleEvaluateOptions): Promise; + link(linker: ModuleLinker): Promise; +} + +interface ExternalModulesExecutorOptions { + context: vm.Context; + fileMap: FileMap; + packageCache: Map; + transform: RuntimeRPC["transform"]; + interopDefault?: boolean; + viteClientModule: Record; +} +declare class ExternalModulesExecutor { + #private; + private options; + private cjs; + private esm; + private vite; + private context; + private fs; + private resolvers; + constructor(options: ExternalModulesExecutorOptions); + import(identifier: string): Promise; + require(identifier: string): any; + createRequire(identifier: string): NodeJS.Require; + importModuleDynamically: (specifier: string, referencer: VMModule) => Promise; + resolveModule: (specifier: string, referencer: string) => Promise; + resolve(specifier: string, parent: string): string; + private getModuleInformation; + private createModule; + private get isNetworkSupported(); +} + +declare module "vite/module-runner" { + interface EvaluatedModuleNode { + /** + * @internal + */ + mockedExports?: Record; + } +} + +interface VitestVmOptions { + context: vm.Context; + externalModulesExecutor: ExternalModulesExecutor; +} + +interface VitestModuleEvaluatorOptions { + evaluatedModules?: VitestEvaluatedModules; + interopDefault?: boolean | undefined; + moduleExecutionInfo?: ModuleExecutionInfo; + getCurrentTestFilepath?: () => string | undefined; + compiledFunctionArgumentsNames?: string[]; + compiledFunctionArgumentsValues?: unknown[]; +} +declare class VitestModuleEvaluator implements ModuleEvaluator { + private options; + stubs: Record; + env: ModuleRunnerImportMeta["env"]; + private vm; + private compiledFunctionArgumentsNames?; + private compiledFunctionArgumentsValues; + private primitives; + private debug; + private _otel; + private _evaluatedModules?; + constructor(vmOptions?: VitestVmOptions | undefined, options?: VitestModuleEvaluatorOptions); + private convertIdToImportUrl; + runExternalModule(id: string): Promise; + runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly): Promise; + private _runInlinedModule; + private createRequire; + private shouldInterop; +} +declare function createImportMetaEnvProxy(): ModuleRunnerImportMeta["env"]; +declare function getDefaultRequestStubs(context?: vm.Context): Record; +declare function isPrimitive(v: any): boolean; +declare function wrapId(id: string): string; +declare function unwrapId(id: string): string; + +export { VitestModuleEvaluator, createImportMetaEnvProxy, getDefaultRequestStubs, isPrimitive, unwrapId, wrapId }; +export type { VitestModuleEvaluatorOptions }; -- cgit v1.2.3