import { Value } from '../value.mts'; import { type PlainCompletion } from '../completion.mts'; import { type PlainEvaluator, type ValueEvaluator } from '../evaluator.mts'; import { kInternal } from '../utils/internal.mts'; import { AbstractModuleRecord, CyclicModuleRecord, ObjectValue, type ValueCompletion, type ModuleRecordHostDefined, type ParseScriptHostDefined, type ScriptRecord, ManagedRealm, SourceTextModuleRecord, type ModuleRequestRecord, Realm, type EpochNanoseconds, type ArrayBufferObject } from '../index.mts'; import type { ParseNode } from '../parser/ParseNode.mts'; import type { PromiseObject } from '../intrinsics/Promise.mts'; import type { FinalizationRegistryObject } from '../intrinsics/FinalizationRegistry.mts'; import type { ShadowRealmObject } from '../intrinsics/ShadowRealm.mts'; import { ExecutionContext } from '../execution-context/ExecutionContext.mts'; import type { Agent } from '../execution-context/Agent.mts'; import { type FunctionObject } from '#self'; export interface Engine262Feature { name: string; flag: string; url: string; enableInPlayground?: boolean; } export declare const FEATURES: [{ readonly name: 'Decorators'; readonly flag: 'decorators'; readonly url: 'https://github.com/tc39/proposal-decorators'; readonly enableInPlayground: true; }, { readonly name: 'Skip bugfix for field initializers in decorator'; readonly flag: 'decorators.no-bugfix.1'; readonly url: ''; }, { readonly name: 'Temporal'; readonly flag: 'temporal'; readonly url: 'https://github.com/tc39/proposal-temporal'; readonly enableInPlayground: true; }, { readonly name: 'Iterator#join'; readonly flag: 'iterator.join'; readonly url: 'https://github.com/tc39/proposal-iterator-join'; readonly enableInPlayground: true; }, { readonly name: 'Promise.allKeyed'; readonly flag: 'promise.allkeyed'; readonly url: 'https://github.com/tc39/proposal-await-dictionary'; readonly enableInPlayground: true; }, { readonly name: 'FinalizationRegistry#cleanupSome'; readonly flag: 'cleanup-some'; readonly url: 'https://github.com/tc39/proposal-cleanup-some'; readonly enableInPlayground: true; }, { readonly name: 'RegExp Buffer Boundaries'; readonly flag: 'regexp-buffer-boundaries'; readonly url: 'https://github.com/tc39/proposal-regexp-buffer-boundaries'; readonly enableInPlayground: true; }, { readonly name: 'Deferred Re-exports'; readonly flag: 'export-defer'; readonly url: 'https://github.com/tc39/proposal-deferred-reexports'; readonly enableInPlayground: true; }]; export type Feature = (typeof FEATURES)[number]['flag']; export declare class ExecutionContextStack extends Array { constructor(length?: number); pop(ctx: ExecutionContext): void; } /** https://tc39.es/ecma262/#sec-host-promise-rejection-tracker */ export type HostPromiseRejectionTracker = (promise: PromiseObject, operation: 'reject' | 'handle') => void; export interface HostHooks { /** https://tc39.es/ecma262/#sec-hostensurecancompilestrings */ HostEnsureCanCompileStrings?(calleeRealm: Realm, parameterStrings: readonly string[], bodyString: string, direct: boolean): PlainEvaluator | PlainCompletion; /** https://tc39.es/proposal-shadowrealm/#sec-hostinitializeshadowrealm */ HostInitializeShadowRealm?(realmRec: Realm, innerContext: ExecutionContext, O: ShadowRealmObject): PlainEvaluator | PlainCompletion; /** https://tc39.es/ecma262/#sec-hostgetmodulesourcemodulerecord */ HostGetModuleSourceModuleRecord?(specifier: ObjectValue): AbstractModuleRecord | 'not-a-source'; /** https://tc39.es/ecma262/#sec-#sec-HostLoadImportedModule */ HostLoadImportedModule?(referrer: CyclicModuleRecord | ScriptRecord | Realm, moduleRequest: ModuleRequestRecord, hostDefined: ModuleRecordHostDefined | undefined, payload: HostLoadImportedModulePayloadOpaque): void; /** https://tc39.es/ecma262/#sec-host-promise-rejection-tracker */ HostPromiseRejectionTrackers?: Set; /** https://tc39.es/ecma262/#sec-hostresizearraybuffer */ HostResizeArrayBuffer?(buffer: ArrayBufferObject, newByteLength: number): 'handled' | 'unhandled'; /** https://tc39.es/proposal-temporal/#sec-hostsystemutcepochnanoseconds */ HostSystemUTCEpochNanoseconds?(global: ObjectValue): EpochNanoseconds; } export interface DebuggerPauseReason { readonly reason: 'debugCommand' | 'other'; readonly hitBreakpoints?: readonly string[]; } export interface AgentHostDefined { resizableArrayBufferMaxByteLength?: number; hostHooks?: HostHooks; hasSourceTextAvailable?(f: FunctionObject): void; ensureCanCompileStrings?(callerRealm: Realm, calleeRealm: Realm): PlainCompletion; cleanupFinalizationRegistry?(FinalizationRegistry: FinalizationRegistryObject): PlainCompletion; features?: readonly string[]; supportedImportAttributes?: readonly string[]; onDebugger?(reason?: DebuggerPauseReason): void; onRealmCreated?(realm: ManagedRealm): void; onScriptParsed?(script: ScriptRecord | SourceTextModuleRecord | DynamicParsedCodeRecord, scriptId: string): void; onNodeEvaluation?(node: ParseNode, realm: Realm): void; /** Promise rejection is standardized, but uncaught exception is not. */ uncaughtExceptionTrackers?: Set<(error: Value) => void>; errorStackAttachNativeStack?: boolean; } export interface ResumeEvaluateOptions { noBreakpoint?: boolean; pauseAt?: 'step-over' | 'step-in' | 'step-out'; debuggerStatementCompletion?: ValueCompletion; } export declare class DynamicParsedCodeRecord { Realm: Realm; constructor(Realm: Realm, sourceText: string | ParseNode.Script | ParseNode.Expression); HostDefined: { scriptId: string | undefined; specifier: undefined; isInspectorEval: boolean; }; ECMAScriptCode: { sourceText: string; } | ParseNode.Script | ParseNode.Expression; } export declare let surroundingAgent: Agent; export declare function setSurroundingAgent(a: Agent): void; export interface ExecutionContextHostDefined { readonly [kInternal]?: ParseScriptHostDefined[typeof kInternal]; scriptId?: string; } /** https://tc39.es/ecma262/#sec-runtime-semantics-scriptevaluation */ export declare function ScriptEvaluation(scriptRecord: ScriptRecord): ValueEvaluator; export declare function HostEnsureCanCompileStrings(calleeRealm: Realm, parameterStrings: readonly string[], bodyString: string, direct: boolean): PlainEvaluator; export declare function HostPromiseRejectionTracker(promise: PromiseObject, operation: 'reject' | 'handle'): void; export declare function HostHasSourceTextAvailable(func: FunctionObject): void | import("../value.mts").BooleanValue; export declare function HostGetSupportedImportAttributes(): readonly string[]; /** https://tc39.es/ecma262/#sec-hostgetmodulesourcemodulerecord */ export declare function HostGetModuleSourceModuleRecord(specifier: ObjectValue): AbstractModuleRecord | 'not-a-source'; export declare function HostLoadImportedModule(referrer: CyclicModuleRecord | ScriptRecord | Realm, moduleRequest: ModuleRequestRecord, hostDefined: ModuleRecordHostDefined | undefined, payload: HostLoadImportedModulePayloadOpaque): void; export type HostLoadImportedModulePayloadOpaque = { HostLoadImportedModulePayloadOpaque?: never; }; /** https://tc39.es/ecma262/#sec-hostgetimportmetaproperties */ export declare function HostGetImportMetaProperties(moduleRecord: AbstractModuleRecord): readonly { readonly Key: import("../value.mts").PropertyKeyValue; readonly Value: Value; }[]; /** https://tc39.es/ecma262/#sec-hostfinalizeimportmeta */ export declare function HostFinalizeImportMeta(importMeta: ObjectValue, moduleRecord: AbstractModuleRecord): void | import("../value.mts").UndefinedValue; export type GCMarker = (value: unknown) => void; export interface Markable { mark(marker: GCMarker): void; } //# sourceMappingURL=engine.d.mts.map