type AnyNode = { type: string; start: number; end: number; } & Record; /** Why a reducer could not be reduced to a parameter list. `undefined` = it could. */ export type UnresolvedReason = 'rest-parameter' | 'arguments' | 'reassigned' | 'not-a-function' | 'unresolved-import' | 'not-found' | 'computed' | 'foreign-source' /** Two DISTINCT registered files hold byte-identical text, so the text no longer * identifies the module an offset indexes. See `register`. */ | 'ambiguous-source'; export type ResolvedReducer = { /** Declared positional arity, or `null` when genuinely undecidable. */ arity: number | null; /** Source text of the resolved function, for shape analysis (inline-`mk`). */ src: string | null; reason?: UnresolvedReason; }; /** * Declared positional arity of a function node, or `null` when undecidable. * * A DEFAULT does not change positional arity (`(c, f = undefined, s, r)` is 4) and a * DESTRUCTURED parameter still occupies one position — both were previously rejected by * a regex that only accepted plain identifiers. A REST parameter genuinely is undecidable * (the declared arity is unbounded), as is a body that reads `arguments`. */ export declare function functionArity(fn: AnyNode): { arity: number | null; reason?: UnresolvedReason; }; export type ReducerResolver = { /** * Resolve the reducer expression at `offset` (its source text is `exprSrc`). * Returns `null` when the expression is not a name at all (an inline function — * the caller already has its source and needs nothing from us). * * `src` is the module text `offset` indexes. An offset is only meaningful against the * source it came from, so the caller must say which one it has; see `resolve`'s * implementation for what happens when it is not this resolver's. */ resolve(exprSrc: string, offset: number, src: string): ResolvedReducer | null; /** * Announce a module whose text the evaluator may later hand to `resolve` as `src` — * an imported `rules()` factory is evaluated with `code: mod.src`, so its `node(…, * build)` offsets index THAT file, not the entry file. * * Registering it makes those offsets answerable against the module's own scope tree. * Without it `resolve` can only decline (`foreign-source`), which fails open to full * capture — correct, but it charges every such node all five facilities. * * Returns whether the file could be analysed; an unreadable or unparseable module * simply stays unregistered and keeps declining. */ register(file: string): boolean; }; export declare function createReducerResolver(entryFile: string, body: unknown[], src: string): ReducerResolver; export {}; //# sourceMappingURL=reducer-resolver.d.ts.map