declare let _$_: { new (): {}; } & typeof globalThis; declare class $ extends _$_ { } declare namespace $ { export type $ = typeof $$; export class $$ extends $ { static $: $; } namespace $$ { type $$ = $; } export {}; } declare namespace $ { const $mol_ambient_ref: unique symbol; /** @deprecated use $ instead */ type $mol_ambient_context = $; function $mol_ambient(this: $ | void, overrides: Partial<$>): $; } declare namespace $ { /** * Proxy that delegates all to lazy returned target. * * $mol_delegate( Array.prototype , ()=> fetch_array() ) */ function $mol_delegate(proto: Value, target: () => Value): Value; } declare namespace $ { const $mol_owning_map: WeakMap; function $mol_owning_allow(having: Having): having is Having & { destructor(): void; }; function $mol_owning_get(having: Having, Owner?: { new (): Owner; }): Owner | null; function $mol_owning_check(owner: Owner, having: Having): having is Having & { destructor(): void; }; function $mol_owning_catch(owner: Owner, having: Having): boolean; } declare namespace $ { function $mol_fail(error: any): never; } declare namespace $ { function $mol_fail_hidden(error: any): never; } declare namespace $ { type $mol_type_writable = { -readonly [P in keyof T]: T[P]; }; } declare namespace $ { function $mol_func_name(this: $, func: Function): string; function $mol_func_name_from(target: Target, source: Function): Target; } declare namespace $ { const $mol_key_handle: unique symbol; const $mol_key_store: WeakMap; } declare namespace $ { class $mol_object2 { static $: $; [Symbol.toStringTag]: string; [$mol_ambient_ref]: $; get $(): $; set $(next: $); static create(this: new (init?: (instance: any) => void) => Instance, init?: (instance: $mol_type_writable) => void): Instance; static [Symbol.toPrimitive](): any; static toString(): any; static toJSON(): any; static [$mol_key_handle](): any; destructor(): void; static destructor(): void; [Symbol.dispose](): void; toString(): string; } } declare namespace $ { /** Position in any resource. */ class $mol_span extends $mol_object2 { readonly uri: string; readonly source: string; readonly row: number; readonly col: number; readonly length: number; constructor(uri: string, source: string, row: number, col: number, length: number); /** Span for begin of unknown resource */ static unknown: $mol_span; /** Makes new span for begin of resource. */ static begin(uri: string, source?: string): $mol_span; /** Makes new span for end of resource. */ static end(uri: string, source: string): $mol_span; /** Makes new span for entire resource. */ static entire(uri: string, source: string): $mol_span; toString(): string; toJSON(): { uri: string; row: number; col: number; length: number; }; /** Makes new error for this span. */ error(message: string, Class?: ErrorConstructor): Error; /** Makes new span for same uri. */ span(row: number, col: number, length: number): $mol_span; /** Makes new span after end of this. */ after(length?: number): $mol_span; /** Makes new span between begin and end. */ slice(begin: number, end?: number): $mol_span; } } declare namespace $ { /** Syntax error with cordinates and source line snippet. */ class $mol_error_syntax extends SyntaxError { reason: string; line: string; span: $mol_span; constructor(reason: string, line: string, span: $mol_span); } } declare namespace $ { /** Parses tree format from string. */ function $mol_tree2_from_string(this: $, str: string, uri?: string): $mol_tree2; } declare namespace $ { /** Serializes tree to string in tree format. */ function $mol_tree2_to_string(this: $, tree: $mol_tree2): string; } declare namespace $ { function $mol_maybe(value: Value | null | undefined): Value[]; } declare namespace $ { /** Path by types in tree. */ type $mol_tree2_path = Array; /** Hask tool for processing node. */ type $mol_tree2_hack = (input: $mol_tree2, belt: $mol_tree2_belt, context: Context) => readonly $mol_tree2[]; /** Collection of hask tools for processing tree. */ type $mol_tree2_belt = Record>; /** * Abstract Syntax Tree with human readable serialization. * Avoid direct instantiation. Use static factories instead. * @see https://github.com/nin-jin/tree.d */ class $mol_tree2 extends Object { /** Type of structural node, `value` should be empty */ readonly type: string; /** Content of data node, `type` should be empty */ readonly value: string; /** Child nodes */ readonly kids: readonly $mol_tree2[]; /** Position in most far source resource */ readonly span: $mol_span; constructor( /** Type of structural node, `value` should be empty */ type: string, /** Content of data node, `type` should be empty */ value: string, /** Child nodes */ kids: readonly $mol_tree2[], /** Position in most far source resource */ span: $mol_span); /** Makes collection node. */ static list(kids: readonly $mol_tree2[], span?: $mol_span): $mol_tree2; /** Makes new derived collection node. */ list(kids: readonly $mol_tree2[]): $mol_tree2; /** Makes data node for any string. */ static data(value: string, kids?: readonly $mol_tree2[], span?: $mol_span): $mol_tree2; /** Makes new derived data node. */ data(value: string, kids?: readonly $mol_tree2[]): $mol_tree2; /** Makes struct node. */ static struct(type: string, kids?: readonly $mol_tree2[], span?: $mol_span): $mol_tree2; /** Makes new derived structural node. */ struct(type: string, kids?: readonly $mol_tree2[]): $mol_tree2; /** Makes new derived node with different kids id defined. */ clone(kids: readonly $mol_tree2[], span?: $mol_span): $mol_tree2; /** Returns multiline text content. */ text(): string; /** Parses tree format. */ /** @deprecated Use $mol_tree2_from_string */ static fromString(str: string, uri?: string): $mol_tree2; /** Serializes to tree format. */ toString(): string; /** Makes new tree with node overrided by path. */ insert(value: $mol_tree2 | null, ...path: $mol_tree2_path): $mol_tree2; /** Makes new tree with node overrided by path. */ update(value: readonly $mol_tree2[], ...path: $mol_tree2_path): readonly $mol_tree2[]; /** Query nodes by path. */ select(...path: $mol_tree2_path): $mol_tree2; /** Filter kids by path or value. */ filter(path: string[], value?: string): $mol_tree2; hack_self(belt: $mol_tree2_belt, context?: Context): readonly $mol_tree2[]; /** Transform tree through context with transformers */ hack(belt: $mol_tree2_belt, context?: Context): $mol_tree2[]; /** Makes Error with node coordinates. */ error(message: string, Class?: ErrorConstructor): Error; } class $mol_tree2_empty extends $mol_tree2 { constructor(); } } declare namespace $ { function $mol_array_chunks(array: readonly Item[], rule: number | ((item: Item, index: number) => boolean)): Item[][]; } declare namespace $ { function $mol_tree2_from_json(json: any, span?: $mol_span): $mol_tree2; } declare namespace $ { function $mol_tree2_js_is_number(type: string): boolean | RegExpMatchArray; } declare namespace $ { function $mol_tree2_js_to_text(this: $, js: $mol_tree2): $mol_tree2; } declare namespace $ { function $mol_tree2_span_imprint(tree: $mol_tree2): $mol_tree2; } declare namespace $ { function $mol_tree2_span_reuse(tree: $mol_tree2): $mol_tree2; } declare namespace $ { function $mol_tree2_text_to_string(this: $, text: $mol_tree2): string; } declare namespace $ { function $mol_vlq_encode(val: number): string; } declare namespace $ { type $mol_sourcemap_segment = [number] | [number, number, number, number] | [number, number, number, number, number]; type $mol_sourcemap_line = $mol_sourcemap_segment[]; type $mol_sourcemap_mappings = $mol_sourcemap_line[]; interface $mol_sourcemap_raw { version: number; sources: string[]; names?: string[]; sourceRoot?: string; sourcesContent?: (string | null)[]; mappings: string | $mol_sourcemap_line[]; file?: string; } } declare namespace $ { function $mol_tree2_text_to_sourcemap(this: $, tree: $mol_tree2): $mol_sourcemap_raw; } declare namespace $ { function $mol_sourcemap_url(this: $, uri: string, type?: "js" | "css"): string; } declare namespace $ { function $mol_sourcemap_dataurl_decode(this: $, data: string): $mol_sourcemap_raw | undefined; function $mol_sourcemap_dataurl_encode(this: $, map: $mol_sourcemap_raw, type?: "js" | "css"): string; } declare namespace $ { function $mol_tree2_text_to_string_mapped(this: $, text: $mol_tree2, type: 'js' | 'css'): string; function $mol_tree2_text_to_string_mapped_js(this: $, text: $mol_tree2): string; function $mol_tree2_text_to_string_mapped_css(this: $, text: $mol_tree2): string; } declare namespace $ { function $mol_guard_defined(value: T): value is NonNullable; } declare namespace $ { function $mol_tree2_text_to_sourcemap_vis(this: $, text: $mol_tree2): string; } declare namespace $ { /** Makes JSON from json.tree. */ function $mol_tree2_to_json(this: $, tree: $mol_tree2): unknown; } declare namespace $ { function $mol_tree2_to_stream(tree: $mol_tree2, output: { write(chunk: string): boolean; once?(event: 'drain', cb: () => void): void; }, prefix?: string): Promise; } declare namespace $ { function $mol_tree2_xml_from_dom(dom: Node): $mol_tree2; } declare namespace $ { function $mol_html_encode(text: string): string; } declare namespace $ { function $mol_tree2_xml_to_text(xml: $mol_tree2): $mol_tree2; } export = $; //# sourceMappingURL=node.d.ts.map