/** * Custom module system for evaluating code in a sandboxed VM context. * Copied from @linaria/babel-preset v3.0.0-beta.19, adapted to use `debug` package * and local imports instead of @linaria/* packages. * * This serves 2 purposes: * - Avoid leakage from evaluated code to module cache in current context, e.g. `babel-register` * - Allow us to invalidate the module cache without affecting other stuff, necessary for rebuilds * * We also use it to transpile the code with Babel by default. * We also store source maps for it to provide correct error stacktraces. */ import type { EvalRule } from './types.mjs'; export type TransformResolver = (id: string, options: { filename: string; paths: readonly string[]; }) => { path: string; builtin: boolean; }; export declare class Module { readonly id: string; readonly filename: string; readonly paths: readonly string[]; rules: EvalRule[]; imports: Map | null; dependencies: string[] | null; transform: ((code: string, filename: string) => string) | null; static readonly extensions: Set; exports: unknown; private readonly resolveFilename; private debug; private debuggerDepth; constructor(filename: string, rules: EvalRule[], resolveFilename: TransformResolver, debuggerDepth?: number); require: ((id: string) => unknown) & { ensure: () => void; cache: Record; resolve: (id: string) => string; }; evaluate(text: string, only?: string[] | null, useEvalCache?: boolean): void; static invalidate: () => void; static invalidateEvalCache: () => void; static _nodeModulePaths: (filename: string) => string[]; }