next
Version:
The React Framework
27 lines (26 loc) • 1 kB
TypeScript
/// <reference types="node" />
import type { Context } from 'vm';
import '../../node-polyfill-web-streams';
import type { WasmBinding } from '../../../build/webpack/loaders/next-middleware-wasm-loader';
/**
* For a given path a context, this function checks if there is any module
* context that contains the path with an older content and, if that's the
* case, removes the context from the cache.
*/
export declare function clearModuleContext(path: string, content: Buffer | string): void;
/**
* For a given module name this function will create a context for the
* runtime. It returns a function where we can provide a module path and
* run in within the context. It may or may not use a cache depending on
* the parameters.
*/
export declare function getModuleContext(options: {
module: string;
onWarning: (warn: Error) => void;
useCache: boolean;
env: string[];
wasm: WasmBinding[];
}): Promise<{
context: Context;
runInContext: (paramPath: string) => void;
}>;