aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-13 21:34:48 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-13 21:34:48 -0800
commit76cb9c2a39d477a64824a985ade40507e3bbade1 (patch)
tree41e997aa9c6f538d3a136af61dae9424db2005a9 /vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts
parent819a39a21ac992b1393244a4c283bbb125208c69 (diff)
downloadneko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.gz
neko-76cb9c2a39d477a64824a985ade40507e3bbade1.tar.bz2
neko-76cb9c2a39d477a64824a985ade40507e3bbade1.zip
feat(vanilla): add testing infrastructure and tests (NK-wjnczv)
Diffstat (limited to 'vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts')
-rw-r--r--vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts96
1 files changed, 96 insertions, 0 deletions
diff --git a/vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts b/vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts
new file mode 100644
index 0000000..67b5593
--- /dev/null
+++ b/vanilla/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts
@@ -0,0 +1,96 @@
+import { HotPayload } from "#types/hmrPayload";
+
+//#region src/shared/invokeMethods.d.ts
+interface FetchFunctionOptions {
+ cached?: boolean;
+ startOffset?: number;
+}
+type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
+interface CachedFetchResult {
+ /**
+ * If module cached in the runner, we can just confirm
+ * it wasn't invalidated on the server side.
+ */
+ cache: true;
+}
+interface ExternalFetchResult {
+ /**
+ * The path to the externalized module starting with file://,
+ * by default this will be imported via a dynamic "import"
+ * instead of being transformed by vite and loaded with vite runner
+ */
+ externalize: string;
+ /**
+ * Type of the module. Will be used to determine if import statement is correct.
+ * For example, if Vite needs to throw an error if variable is not actually exported
+ */
+ type: "module" | "commonjs" | "builtin" | "network";
+}
+interface ViteFetchResult {
+ /**
+ * Code that will be evaluated by vite runner
+ * by default this will be wrapped in an async function
+ */
+ code: string;
+ /**
+ * File path of the module on disk.
+ * This will be resolved as import.meta.url/filename
+ * Will be equal to `null` for virtual modules
+ */
+ file: string | null;
+ /**
+ * Module ID in the server module graph.
+ */
+ id: string;
+ /**
+ * Module URL used in the import.
+ */
+ url: string;
+ /**
+ * Invalidate module on the client side.
+ */
+ invalidate: boolean;
+}
+type InvokeMethods = {
+ fetchModule: (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
+ getBuiltins: () => Promise<Array<{
+ type: "string";
+ value: string;
+ } | {
+ type: "RegExp";
+ source: string;
+ flags: string;
+ }>>;
+};
+//#endregion
+//#region src/shared/moduleRunnerTransport.d.ts
+type ModuleRunnerTransportHandlers = {
+ onMessage: (data: HotPayload) => void;
+ onDisconnection: () => void;
+};
+/**
+* "send and connect" or "invoke" must be implemented
+*/
+interface ModuleRunnerTransport {
+ connect?(handlers: ModuleRunnerTransportHandlers): Promise<void> | void;
+ disconnect?(): Promise<void> | void;
+ send?(data: HotPayload): Promise<void> | void;
+ invoke?(data: HotPayload): Promise<{
+ result: any;
+ } | {
+ error: any;
+ }>;
+ timeout?: number;
+}
+interface NormalizedModuleRunnerTransport {
+ connect?(onMessage?: (data: HotPayload) => void): Promise<void> | void;
+ disconnect?(): Promise<void> | void;
+ send(data: HotPayload): Promise<void>;
+ invoke<T extends keyof InvokeMethods>(name: T, data: Parameters<InvokeMethods[T]>): Promise<ReturnType<Awaited<InvokeMethods[T]>>>;
+}
+declare const createWebSocketModuleRunnerTransport: (options: {
+ createConnection: () => WebSocket;
+ pingInterval?: number;
+}) => Required<Pick<ModuleRunnerTransport, "connect" | "disconnect" | "send">>;
+//#endregion
+export { ExternalFetchResult as a, ViteFetchResult as c, createWebSocketModuleRunnerTransport as i, ModuleRunnerTransportHandlers as n, FetchFunctionOptions as o, NormalizedModuleRunnerTransport as r, FetchResult as s, ModuleRunnerTransport as t }; \ No newline at end of file