New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@glimmer/runtime

Package Overview
Dependencies
Maintainers
15
Versions
299
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/runtime - npm Package Compare versions

Comparing version 0.92.4 to 0.93.0

814

dist/dev/index.d.ts

@@ -1,3 +0,2 @@

import { RichIteratorResult, Bounds, Cursor, Nullable, SimpleElement, SimpleNode, InternalComponentCapabilities, InternalComponentManager, CapturedArguments, CurriedType, Owner, GlimmerTreeChanges, SimpleDocument, SimpleComment, SimpleText, AttrNamespace, ElementNamespace, GlimmerTreeConstruction, ComponentInstanceWithCreate, Environment, EnvironmentOptions, ModifierInstance, RuntimeArtifacts, RuntimeContext, RuntimeResolver, Transaction, TransactionSymbol, CapturedRenderNode, DebugRenderTree, RenderNode, Arguments, CompilableProgram, CompileTimeCompilationContext, ComponentDefinitionState, DynamicScope, ElementBuilder, RenderResult, TemplateIterator, Dict, PartialScope, Scope, ScopeBlock, ScopeSlot, CompilableTemplate, Destroyable, ResolutionTimeConstants, RuntimeConstants, RuntimeProgram, UpdatingOpcode, RuntimeHeap, RuntimeOp, ExceptionHandler, LiveBlock, UpdatableBlock, CursorStackSymbol, ElementOperations, Maybe, SimpleDocumentFragment, AttributeCursor, AttributeOperation, BlockArguments, BlockValue, CapturedBlockArguments, CapturedNamedArguments, CapturedPositionalArguments, NamedArguments, PositionalArguments, VMArguments } from '@glimmer/interfaces';
import { VM as PublicVM } from "@glimmer/interfaces";
import { RichIteratorResult, Bounds, Cursor, Nullable, SimpleElement, SimpleNode, InternalComponentCapabilities, InternalComponentManager, CapturedArguments, CurriedType, Owner, GlimmerTreeChanges, SimpleDocument, SimpleComment, SimpleText, AttrNamespace, ElementNamespace, GlimmerTreeConstruction, ClassicResolver, ComponentInstanceWithCreate, Environment, EnvironmentOptions, ModifierInstance, RuntimeArtifacts, RuntimeOptions, Transaction, TransactionSymbol, CapturedRenderNode, DebugRenderTree, RenderNode, Arguments, CompilableProgram, ComponentDefinitionState, DynamicScope, EvaluationContext, RenderResult, TemplateIterator, TreeBuilder, Dict, Scope, ScopeBlock, ScopeSlot, CompilableTemplate, DebugVmSnapshot, DebugVmTrace, Destroyable, Program, ProgramConstants, UpdatingOpcode, RuntimeOp, BlockArguments, BlockValue, CapturedBlockArguments, CapturedNamedArguments, CapturedPositionalArguments, NamedArguments, PositionalArguments, VMArguments, AppendingBlock, ExceptionHandler, ResettableBlock, ElementOperations, Maybe, SimpleDocumentFragment, AttributeCursor, AttributeOperation } from '@glimmer/interfaces';
import { UpdatingVM as IUpdatingVM } from "@glimmer/interfaces";

@@ -7,3 +6,3 @@ import { Reference, OpaqueIterationItem, OpaqueIterator } from "@glimmer/reference";

import { MachineRegister, Register, SyscallRegister } from "@glimmer/vm";
import { Stack as Stack$0 } from "@glimmer/util";
import { Stack } from "@glimmer/util";
declare class CursorImpl implements Cursor {

@@ -167,2 +166,3 @@ element: SimpleElement;

isInteractive: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
isArgumentCaptureError: ((error: any) => boolean) | undefined;

@@ -196,3 +196,3 @@ debugRenderTree: DebugRenderTree$0<object> | undefined;

}
declare function runtimeContext(options: EnvironmentOptions, delegate: EnvironmentDelegate, artifacts: RuntimeArtifacts, resolver: RuntimeResolver): RuntimeContext;
declare function runtimeOptions(options: EnvironmentOptions, delegate: EnvironmentDelegate, artifacts: RuntimeArtifacts, resolver: Nullable<ClassicResolver>): RuntimeOptions;
declare function inTransaction(env: Environment, block: () => void): void;

@@ -438,4 +438,4 @@ /**

declare function renderSync(env: Environment, iterator: TemplateIterator): RenderResult;
declare function renderMain(runtime: RuntimeContext, context: CompileTimeCompilationContext, owner: Owner, self: Reference, treeBuilder: ElementBuilder, layout: CompilableProgram, dynamicScope?: DynamicScope): TemplateIterator;
declare function renderComponent(runtime: RuntimeContext, treeBuilder: ElementBuilder, context: CompileTimeCompilationContext, owner: Owner, definition: ComponentDefinitionState, args?: Record<string, unknown>, dynamicScope?: DynamicScope): TemplateIterator;
declare function renderMain(context: EvaluationContext, owner: Owner, self: Reference, tree: TreeBuilder, layout: CompilableProgram, dynamicScope?: DynamicScope): TemplateIterator;
declare function renderComponent(context: EvaluationContext, tree: TreeBuilder, owner: Owner, definition: ComponentDefinitionState, args?: Record<string, unknown>, dynamicScope?: DynamicScope): TemplateIterator;
declare class DynamicScopeImpl implements DynamicScope {

@@ -448,22 +448,29 @@ private bucket;

}
declare class PartialScopeImpl implements PartialScope {
// the 0th slot is `self`
readonly slots: Array<ScopeSlot>;
interface ScopeOptions {
/** @default {UNDEFINED_REFERENCE} */
self: Reference<unknown>;
/** @default {0} */
size?: number | undefined;
}
declare class ScopeImpl implements Scope {
static root(owner: Owner, { self, size }: ScopeOptions): Scope;
static sized(owner: Owner, size?: number): Scope;
readonly owner: Owner;
private slots;
private callerScope;
// named arguments and blocks passed to a layout that uses eval
private evalScope;
// locals in scope when the partial was invoked
private partialMap;
static root(self: Reference<unknown>, size: number, owner: Owner): PartialScope;
static sized(size: number, owner: Owner): Scope;
constructor(slots: Array<ScopeSlot>, owner: Owner, callerScope: Scope | null, evalScope: Dict<ScopeSlot> | null, partialMap: Dict<Reference<unknown>> | null);
constructor(owner: Owner,
// the 0th slot is `self`
slots: Array<ScopeSlot>,
// a single program can mix owners via curried components, and the state lives on root scopes
callerScope: Nullable<Scope>);
init({ self }: {
self: Reference<unknown>;
}): this;
/**
* @debug
*/
snapshot(): ScopeSlot[];
getSelf(): Reference<unknown>;
getSymbol(symbol: number): Reference<unknown>;
getBlock(symbol: number): Nullable<ScopeBlock>;
getEvalScope(): Nullable<Dict<ScopeSlot>>;
getPartialMap(): Nullable<Dict<Reference<unknown>>>;
bind(symbol: number, value: ScopeSlot): void;

@@ -473,4 +480,2 @@ bindSelf(self: Reference<unknown>): void;

bindBlock(symbol: number, value: Nullable<ScopeBlock>): void;
bindEvalScope(map: Nullable<Dict<ScopeSlot>>): void;
bindPartialMap(map: Dict<Reference<unknown>>): void;
bindCallerScope(scope: Nullable<Scope>): void;

@@ -485,12 +490,14 @@ getCallerScope(): Nullable<Scope>;

}
interface LowLevelRegisters {
[MachineRegister.pc]: number;
[MachineRegister.ra]: number;
[MachineRegister.sp]: number;
[MachineRegister.fp]: number;
}
interface Stack {
type LowLevelRegisters = [
$pc: number,
$ra: number,
$sp: number,
$fp: number
];
interface VmStack {
readonly registers: LowLevelRegisters;
push(value: unknown): void;
get(position: number): number;
pop<T>(): T;
snapshot?(): unknown[];
}

@@ -502,9 +509,8 @@ interface Externs {

declare class LowLevelVM {
stack: Stack;
heap: RuntimeHeap;
program: RuntimeProgram;
externs: Externs;
stack: VmStack;
externs: Externs | undefined;
currentOpSize: number;
readonly registers: LowLevelRegisters;
currentOpSize: number;
constructor(stack: Stack, heap: RuntimeHeap, program: RuntimeProgram, externs: Externs, registers: LowLevelRegisters);
readonly context: EvaluationContext;
constructor(stack: VmStack, context: EvaluationContext, externs: Externs | undefined, registers: LowLevelRegisters);
fetchRegister(register: MachineRegister): number;

@@ -531,19 +537,9 @@ loadRegister(register: MachineRegister, value: number): void;

evaluateInner(opcode: RuntimeOp, vm: VM): void;
evaluateMachine(opcode: RuntimeOp): void;
evaluateMachine(opcode: RuntimeOp, vm: VM): void;
evaluateSyscall(opcode: RuntimeOp, vm: VM): void;
}
// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.
declare const INNER_VM: unique symbol;
declare const DESTROYABLE_STACK: unique symbol;
declare const STACKS: unique symbol;
declare const REGISTERS: unique symbol;
declare const HEAP: unique symbol;
declare const CONSTANTS: unique symbol;
declare const ARGS$0: unique symbol;
interface EvaluationStack {
[REGISTERS]: LowLevelRegisters;
readonly registers: LowLevelRegisters;
push(value: unknown): void;
dup(position?: MachineRegister): void;
dup(position?: number): void;
copy(from: number, to: number): void;

@@ -557,4 +553,87 @@ pop<T>(n?: number): T;

reset(): void;
toArray(): unknown[];
snapshot?(): unknown[];
}
/*
The calling convention is:
* 0-N block arguments at the bottom
* 0-N positional arguments next (left-to-right)
* 0-N named arguments next
*/
declare class VMArgumentsImpl implements VMArguments {
private stack;
positional: PositionalArgumentsImpl;
named: NamedArgumentsImpl;
blocks: BlockArgumentsImpl;
constructor();
empty(stack: EvaluationStack): this;
setup(stack: EvaluationStack, names: readonly string[], blockNames: readonly string[], positionalCount: number, atNames: boolean): void;
get base(): number;
get length(): number;
at(pos: number): Reference;
realloc(offset: number): void;
capture(): CapturedArguments;
clear(): void;
}
declare class PositionalArgumentsImpl implements PositionalArguments {
base: number;
length: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private stack;
private _references;
constructor();
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number): void;
at(position: number): Reference;
capture(): CapturedPositionalArguments;
prepend(other: Reference[]): void;
private get references();
}
declare class NamedArgumentsImpl implements NamedArguments {
base: number;
length: number;
private stack;
private _references;
private _names;
private _atNames;
constructor();
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[], atNames: boolean): void;
get names(): readonly string[];
get atNames(): readonly string[];
has(name: string): boolean;
get(name: string, atNames?: boolean): Reference;
capture(): CapturedNamedArguments;
merge(other: Record<string, Reference>): void;
private get references();
private toSyntheticName;
private toAtName;
}
declare class BlockArgumentsImpl implements BlockArguments {
private stack;
private internalValues;
private _symbolNames;
internalTag: Nullable<Tag>;
names: readonly string[];
length: number;
base: number;
constructor();
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[]): void;
get values(): readonly BlockValue[];
has(name: string): boolean;
get(name: string): Nullable<ScopeBlock>;
capture(): CapturedBlockArguments;
get symbolNames(): readonly string[];
}
declare function createCapturedArgs(named: Dict<Reference>, positional: Reference[]): CapturedArguments;
declare function reifyNamed(named: CapturedNamedArguments): Dict<unknown>;
declare function reifyPositional(positional: CapturedPositionalArguments): unknown[];
declare function reifyArgs(args: CapturedArguments): {
named: Dict<unknown>;
positional: unknown[];
};
declare const EMPTY_NAMED: CapturedNamedArguments;
declare const EMPTY_POSITIONAL: CapturedPositionalArguments;
declare const EMPTY_ARGS: CapturedArguments;
declare function dynamicAttribute(element: SimpleElement, attr: string, namespace: Nullable<AttrNamespace>, isTrusting?: boolean): DynamicAttribute;

@@ -564,17 +643,27 @@ declare abstract class DynamicAttribute implements AttributeOperation {

constructor(attribute: AttributeCursor);
abstract set(dom: ElementBuilder, value: unknown, env: Environment): void;
abstract set(dom: TreeBuilder, value: unknown, env: Environment): void;
abstract update(value: unknown, env: Environment): void;
}
declare class SimpleDynamicAttribute extends DynamicAttribute {
set(dom: ElementBuilder, value: unknown, _env: Environment): void;
set(dom: TreeBuilder, value: unknown, _env: Environment): void;
update(value: unknown, _env: Environment): void;
}
interface FirstNode {
debug?: {
first: () => Nullable<SimpleNode>;
};
firstNode(): SimpleNode;
}
interface LastNode {
debug?: {
last: () => Nullable<SimpleNode>;
};
lastNode(): SimpleNode;
}
declare const CURSOR_STACK: CursorStackSymbol;
declare class NewElementBuilder implements ElementBuilder {
declare class NewTreeBuilder implements TreeBuilder {
debug?: () => {
blocks: AppendingBlock[];
constructing: Nullable<SimpleElement>;
cursors: Cursor[];
};
dom: GlimmerTreeConstruction;

@@ -585,20 +674,20 @@ updateOperations: GlimmerTreeChanges;

private env;
[CURSOR_STACK]: Stack$0<Cursor>;
readonly cursors: Stack<Cursor>;
private modifierStack;
private blockStack;
static forInitialRender(env: Environment, cursor: CursorImpl): NewElementBuilder;
static resume(env: Environment, block: UpdatableBlock): NewElementBuilder;
static forInitialRender(env: Environment, cursor: CursorImpl): NewTreeBuilder;
static resume(env: Environment, block: ResettableBlock): NewTreeBuilder;
constructor(env: Environment, parentNode: SimpleElement, nextSibling: Nullable<SimpleNode>);
protected initialize(): this;
debugBlocks(): LiveBlock[];
debugBlocks(): AppendingBlock[];
get element(): SimpleElement;
get nextSibling(): Nullable<SimpleNode>;
get hasBlocks(): boolean;
protected block(): LiveBlock;
protected block(): AppendingBlock;
popElement(): void;
pushSimpleBlock(): LiveBlock;
pushUpdatableBlock(): UpdatableBlockImpl;
pushBlockList(list: LiveBlock[]): LiveBlockList;
protected pushLiveBlock<T extends LiveBlock>(block: T, isRemote?: boolean): T;
popBlock(): LiveBlock;
pushAppendingBlock(): AppendingBlock;
pushResettableBlock(): ResettableBlockImpl;
pushBlockList(list: AppendingBlock[]): AppendingBlockList;
protected pushBlock<T extends AppendingBlock>(block: T, isRemote?: boolean): T;
popBlock(): AppendingBlock;
__openBlock(): void;

@@ -612,5 +701,5 @@ __closeBlock(): void;

closeElement(): Nullable<ModifierInstance[]>;
pushRemoteElement(element: SimpleElement, guid: string, insertBefore: Maybe<SimpleNode>): RemoteLiveBlock;
__pushRemoteElement(element: SimpleElement, _guid: string, insertBefore: Maybe<SimpleNode>): RemoteLiveBlock;
popRemoteElement(): RemoteLiveBlock;
pushRemoteElement(element: SimpleElement, guid: string, insertBefore: Maybe<SimpleNode>): RemoteBlock;
__pushRemoteElement(element: SimpleElement, _guid: string, insertBefore: Maybe<SimpleNode>): RemoteBlock;
popRemoteElement(): RemoteBlock;
protected pushElement(element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;

@@ -641,4 +730,8 @@ private pushModifiers;

}
declare class SimpleLiveBlock implements LiveBlock {
declare class AppendingBlockImpl implements AppendingBlock {
private parent;
debug?: {
first: () => Nullable<SimpleNode>;
last: () => Nullable<SimpleNode>;
};
protected first: Nullable<FirstNode>;

@@ -655,15 +748,16 @@ protected last: Nullable<LastNode>;

didAppendBounds(bounds: Bounds): void;
finalize(stack: ElementBuilder): void;
finalize(stack: TreeBuilder): void;
}
declare class RemoteLiveBlock extends SimpleLiveBlock {
declare class RemoteBlock extends AppendingBlockImpl {
constructor(parent: SimpleElement);
}
declare class UpdatableBlockImpl extends SimpleLiveBlock implements UpdatableBlock {
declare class ResettableBlockImpl extends AppendingBlockImpl implements ResettableBlock {
constructor(parent: SimpleElement);
reset(): Nullable<SimpleNode>;
}
// FIXME: All the noops in here indicate a modelling problem
declare class LiveBlockList implements LiveBlock {
declare class AppendingBlockList implements AppendingBlock {
private readonly parent;
boundList: LiveBlock[];
constructor(parent: SimpleElement, boundList: LiveBlock[]);
boundList: AppendingBlock[];
constructor(parent: SimpleElement, boundList: AppendingBlock[]);
parentElement(): SimpleElement;

@@ -676,5 +770,5 @@ firstNode(): SimpleNode;

didAppendBounds(_bounds: Bounds): void;
finalize(_stack: ElementBuilder): void;
finalize(_stack: TreeBuilder): void;
}
declare function clientBuilder(env: Environment, cursor: CursorImpl): ElementBuilder;
declare function clientBuilder(env: Environment, cursor: CursorImpl): TreeBuilder;
declare class UpdatingVM implements IUpdatingVM {

@@ -695,17 +789,8 @@ env: Environment;

}
interface VMState {
readonly pc: number;
readonly scope: Scope;
readonly dynamicScope: DynamicScope;
readonly stack: unknown[];
}
interface ResumableVMState {
resume(runtime: RuntimeContext, builder: ElementBuilder): InternalVM;
}
declare abstract class BlockOpcode implements UpdatingOpcode, Bounds {
protected state: ResumableVMState;
protected runtime: RuntimeContext;
protected state: Closure;
protected context: EvaluationContext;
children: UpdatingOpcode[];
protected readonly bounds: LiveBlock;
constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: LiveBlock, children: UpdatingOpcode[]);
protected readonly bounds: AppendingBlock;
constructor(state: Closure, context: EvaluationContext, bounds: AppendingBlock, children: UpdatingOpcode[]);
parentElement(): import("@glimmer/interfaces").SimpleElement;

@@ -718,3 +803,3 @@ firstNode(): import("@glimmer/interfaces").SimpleNode;

type: string;
protected bounds: UpdatableBlock; // Hides property on base class
protected bounds: ResettableBlock; // Shadows property on base class
evaluate(vm: UpdatingVM): void;

@@ -729,236 +814,324 @@ handleException(): void;

index: number;
constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: UpdatableBlock, key: unknown, memo: Reference, value: Reference);
updateReferences(item: OpaqueIterationItem): void;
constructor(state: Closure, context: EvaluationContext, bounds: ResettableBlock, key: unknown, memo: Reference, value: Reference);
shouldRemove(): boolean;
reset(): void;
}
declare class ListBlockOpcode extends BlockOpcode {
private iterableRef;
type: string;
children: ListItemOpcode[];
private opcodeMap;
private marker;
private lastIterator;
protected readonly bounds: LiveBlockList;
constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: LiveBlockList, children: ListItemOpcode[], iterableRef: Reference<OpaqueIterator>);
initializeChild(opcode: ListItemOpcode): void;
evaluate(vm: UpdatingVM): void;
private sync;
private retainItem;
private insertItem;
private moveItem;
private deleteItem;
}
/*
The calling convention is:
* 0-N block arguments at the bottom
* 0-N positional arguments next (left-to-right)
* 0-N named arguments next
*/
declare class VMArgumentsImpl implements VMArguments {
private stack;
positional: PositionalArgumentsImpl;
named: NamedArgumentsImpl;
blocks: BlockArgumentsImpl;
empty(stack: EvaluationStack): this;
setup(stack: EvaluationStack, names: readonly string[], blockNames: readonly string[], positionalCount: number, atNames: boolean): void;
get base(): number;
get length(): number;
at(pos: number): Reference;
realloc(offset: number): void;
capture(): CapturedArguments;
clear(): void;
}
declare class PositionalArgumentsImpl implements PositionalArguments {
base: number;
length: number;
private stack;
private _references;
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number): void;
at(position: number): Reference;
capture(): CapturedPositionalArguments;
prepend(other: Reference[]): void;
private get references();
}
declare class NamedArgumentsImpl implements NamedArguments {
base: number;
length: number;
private stack;
private _references;
private _names;
private _atNames;
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[], atNames: boolean): void;
get names(): readonly string[];
get atNames(): readonly string[];
has(name: string): boolean;
get(name: string, atNames?: boolean): Reference;
capture(): CapturedNamedArguments;
merge(other: Record<string, Reference>): void;
private get references();
private toSyntheticName;
private toAtName;
}
declare class BlockArgumentsImpl implements BlockArguments {
private stack;
private internalValues;
private _symbolNames;
internalTag: Nullable<Tag>;
names: readonly string[];
length: number;
base: number;
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[]): void;
get values(): readonly BlockValue[];
has(name: string): boolean;
get(name: string): Nullable<ScopeBlock>;
capture(): CapturedBlockArguments;
get symbolNames(): readonly string[];
}
declare function createCapturedArgs(named: Dict<Reference>, positional: Reference[]): CapturedArguments;
declare function reifyNamed(named: CapturedNamedArguments): Dict<unknown>;
declare function reifyPositional(positional: CapturedPositionalArguments): unknown[];
declare function reifyArgs(args: CapturedArguments): {
named: Dict<unknown>;
positional: unknown[];
};
declare const EMPTY_NAMED: CapturedNamedArguments;
declare const EMPTY_POSITIONAL: CapturedPositionalArguments;
declare const EMPTY_ARGS: CapturedArguments;
/**
* This interface is used by internal opcodes, and is more stable than
* the implementation of the Append VM itself.
*/
interface InternalVM {
readonly [CONSTANTS]: RuntimeConstants & ResolutionTimeConstants;
readonly [ARGS$0]: VMArgumentsImpl;
readonly env: Environment;
readonly stack: EvaluationStack;
readonly runtime: RuntimeContext;
readonly context: CompileTimeCompilationContext;
loadValue(register: MachineRegister, value: number): void;
loadValue(register: Register, value: unknown): void;
loadValue(register: Register | MachineRegister, value: unknown): void;
fetchValue(register: MachineRegister.ra | MachineRegister.pc): number;
// TODO: Something better than a type assertion?
fetchValue<T>(register: Register): T;
fetchValue(register: Register): unknown;
load(register: Register): void;
fetch(register: Register): void;
compile(block: CompilableTemplate): number;
scope(): Scope;
elements(): ElementBuilder;
getOwner(): Owner;
getSelf(): Reference;
updateWith(opcode: UpdatingOpcode): void;
associateDestroyable(d: Destroyable): void;
beginCacheGroup(name?: string): void;
commitCacheGroup(): void;
/// Iteration ///
enterList(iterableRef: Reference<OpaqueIterator>, offset: number): void;
exitList(): void;
enterItem(item: OpaqueIterationItem): ListItemOpcode;
registerItem(item: ListItemOpcode): void;
pushRootScope(size: number, owner: Owner): PartialScope;
pushChildScope(): void;
popScope(): void;
pushScope(scope: Scope): void;
dynamicScope(): DynamicScope;
bindDynamicScope(names: string[]): void;
pushDynamicScope(): void;
popDynamicScope(): void;
enter(args: number): void;
exit(): void;
goto(pc: number): void;
call(handle: number): void;
pushFrame(): void;
referenceForSymbol(symbol: number): Reference;
execute(initialize?: (vm: this) => void): RenderResult;
pushUpdating(list?: UpdatingOpcode[]): void;
next(): RichIteratorResult<null, RenderResult>;
}
declare class VM implements PublicVM, InternalVM {
readonly runtime: RuntimeContext;
private readonly elementStack;
readonly context: CompileTimeCompilationContext;
private readonly [STACKS];
private readonly [HEAP];
private readonly destructor;
private readonly [DESTROYABLE_STACK];
readonly [CONSTANTS]: RuntimeConstants & ResolutionTimeConstants;
readonly [ARGS$0]: VMArgumentsImpl;
readonly [INNER_VM]: LowLevelVM;
declare class VM {
#private;
readonly args: VMArgumentsImpl;
readonly lowlevel: LowLevelVM;
readonly debug?: () => DebugVmSnapshot;
readonly trace?: () => DebugVmTrace;
get stack(): EvaluationStack;
/* Registers */
get pc(): number;
s0: unknown;
s1: unknown;
t0: unknown;
t1: unknown;
v0: unknown;
// Fetch a value from a register onto the stack
/**
* Fetch a value from a syscall register onto the stack.
*
* ## Opcodes
*
* - Append: `Fetch`
*
* ## State changes
*
* [!] push Eval Stack <- $register
*/
fetch(register: SyscallRegister): void;
// Load a value from the stack into a register
/**
* Load a value from the stack into a syscall register.
*
* ## Opcodes
*
* - Append: `Load`
*
* ## State changes
*
* [!] pop Eval Stack -> `value`
* [$] $register <- `value`
*/
load(register: SyscallRegister): void;
// Fetch a value from a register
/**
* Load a value into a syscall register.
*
* ## State changes
*
* [$] $register <- `value`
*
* @utility
*/
loadValue<T>(register: SyscallRegister, value: T): void;
/**
* Fetch a value from a register (machine or syscall).
*
* ## State changes
*
* [ ] get $register
*
* @utility
*/
fetchValue(register: MachineRegister): number;
fetchValue<T>(register: Register): T;
// Load a value into a register
loadValue<T>(register: Register | MachineRegister, value: T): void;
/**
* Migrated to Inner
*/
// Start a new frame and save $ra and $fp on the stack
pushFrame(): void;
// Restore $ra, $sp and $fp
popFrame(): void;
// Jump to an address in `program`
goto(offset: number): void;
// Save $pc into $ra, then jump to a new address in `program` (jal in MIPS)
call(handle: number): void;
// Put a specific `program` address in $ra
returnTo(offset: number): void;
call(handle: number | null): void;
// Return to the `program` address stored in $ra
return(): void;
readonly context: EvaluationContext;
constructor({ scope, dynamicScope, stack, pc }: ClosureState, context: EvaluationContext, tree: TreeBuilder);
static initial(context: EvaluationContext, options: InitialVmState): VM;
compile(block: CompilableTemplate): number;
get constants(): ProgramConstants;
get program(): Program;
get env(): Environment;
private captureClosure;
capture(args: number, pc?: number): Closure;
/**
* End of migrated.
* ## Opcodes
*
* - Append: `BeginComponentTransaction`
*
* ## State Changes
*
* [ ] create `guard` (`JumpIfNotModifiedOpcode`)
* [ ] create `tracker` (`BeginTrackFrameOpcode`)
* [!] push Updating Stack <- `guard`
* [!] push Updating Stack <- `tracker`
* [!] push Cache Stack <- `guard`
* [!] push Tracking Stack
*/
constructor(runtime: RuntimeContext, { pc, scope, dynamicScope, stack }: VMState, elementStack: ElementBuilder, context: CompileTimeCompilationContext);
static initial(runtime: RuntimeContext, context: CompileTimeCompilationContext, { handle, self, dynamicScope, treeBuilder, numSymbols, owner }: InitOptions): InternalVM;
static empty(runtime: RuntimeContext, { handle, treeBuilder, dynamicScope, owner }: MinimalInitOptions, context: CompileTimeCompilationContext): InternalVM;
private resume;
compile(block: CompilableTemplate): number;
get program(): RuntimeProgram;
get env(): Environment;
captureState(args: number, pc?: number): VMState;
capture(args: number, pc?: number): ResumableVMState;
beginCacheGroup(name?: string): void;
/**
* ## Opcodes
*
* - Append: `CommitComponentTransaction`
*
* ## State Changes
*
* Create a new `EndTrackFrameOpcode` (`end`)
*
* [!] pop CacheStack -> `guard`
* [!] pop Tracking Stack -> `tag`
* [ ] create `end` (`EndTrackFrameOpcode`) with `guard`
* [-] consume `tag`
*/
commitCacheGroup(): void;
/**
* ## Opcodes
*
* - Append: `Enter`
*
* ## State changes
*
* [!] push Element Stack as `block`
* [ ] create `try` (`TryOpcode`) with `block`, capturing `args` from the Eval Stack
*
* Did Enter (`try`):
* [-] associate destroyable `try`
* [!] push Destroyable Stack <- `try`
* [!] push Updating List <- `try`
* [!] push Updating Stack <- `try.children`
*/
enter(args: number): void;
/**
* ## Opcodes
*
* - Append: `Iterate`
* - Update: `ListBlock`
*
* ## State changes
*
* Create a new ref for the iterator item (`value`).
* Create a new ref for the iterator key (`key`).
*
* [ ] create `valueRef` (`Reference`) from `value`
* [ ] create `keyRef` (`Reference`) from `key`
* [!] push Eval Stack <- `valueRef`
* [!] push Eval Stack <- `keyRef`
* [!] push Element Stack <- `UpdatableBlock` as `block`
* [ ] capture `closure` with *2* items from the Eval Stack
* [ ] create `iteration` (`ListItemOpcode`) with `closure`, `block`, `key`, `keyRef` and `valueRef`
*
* Did Enter (`iteration`):
* [-] associate destroyable `iteration`
* [!] push Destroyable Stack <- `iteration`
* [!] push Updating List <- `iteration`
* [!] push Updating Stack <- `iteration.children`
*/
enterItem({ key, value, memo }: OpaqueIterationItem): ListItemOpcode;
registerItem(opcode: ListItemOpcode): void;
/**
* ## Opcodes
*
* - Append: `EnterList`
*
* ## State changes
*
* [ ] capture `closure` with *0* items from the Eval Stack, and `$pc` from `offset`
* [ ] create `updating` (empty `Array`)
* [!] push Element Stack <- `list` (`BlockList`) with `updating`
* [ ] create `list` (`ListBlockOpcode`) with `closure`, `list`, `updating` and `iterableRef`
* [!] push List Stack <- `list`
*
* Did Enter (`list`):
* [-] associate destroyable `list`
* [!] push Destroyable Stack <- `list`
* [!] push Updating List <- `list`
* [!] push Updating Stack <- `list.children`
*/
enterList(iterableRef: Reference<OpaqueIterator>, offset: number): void;
/**
* ## Opcodes
*
* - Append: `Enter`
* - Append: `Iterate`
* - Append: `EnterList`
* - Update: `ListBlock`
*
* ## State changes
*
* [-] associate destroyable `opcode`
* [!] push Destroyable Stack <- `opcode`
* [!] push Updating List <- `opcode`
* [!] push Updating Stack <- `opcode.children`
*
*/
private didEnter;
/**
* ## Opcodes
*
* - Append: `Exit`
* - Append: `ExitList`
*
* ## State changes
*
* [!] pop Destroyable Stack
* [!] pop Element Stack
* [!] pop Updating Stack
*/
exit(): void;
/**
* ## Opcodes
*
* - Append: `ExitList`
*
* ## State changes
*
* Pop List:
* [!] pop Destroyable Stack
* [!] pop Element Stack
* [!] pop Updating Stack
*
* [!] pop List Stack
*/
exitList(): void;
/**
* ## Opcodes
*
* - Append: `RootScope`
* - Append: `VirtualRootScope`
*
* ## State changes
*
* [!] push Scope Stack
*/
pushRootScope(size: number, owner: Owner): Scope;
/**
* ## Opcodes
*
* - Append: `ChildScope`
*
* ## State changes
*
* [!] push Scope Stack <- `child` of current Scope
*/
pushChildScope(): void;
/**
* ## Opcodes
*
* - Append: `Yield`
*
* ## State changes
*
* [!] push Scope Stack <- `scope`
*/
pushScope(scope: Scope): void;
/**
* ## Opcodes
*
* - Append: `PopScope`
*
* ## State changes
*
* [!] pop Scope Stack
*/
popScope(): void;
/**
* ## Opcodes
*
* - Append: `PushDynamicScope`
*
* ## State changes:
*
* [!] push Dynamic Scope Stack <- child of current Dynamic Scope
*/
pushDynamicScope(): DynamicScope;
/**
* ## Opcodes
*
* - Append: `BindDynamicScope`
*
* ## State changes:
*
* [!] pop Dynamic Scope Stack `names.length` times
*/
bindDynamicScope(names: string[]): void;
/**
* ## State changes
*
* - [!] push Updating Stack
*
* @utility
*/
pushUpdating(list?: UpdatingOpcode[]): void;
/**
* ## State changes
*
* [!] pop Updating Stack
*
* @utility
*/
popUpdating(): UpdatingOpcode[];
/**
* ## State changes
*
* [!] push Updating List
*
* @utility
*/
updateWith(opcode: UpdatingOpcode): void;
listBlock(): ListBlockOpcode;
private listBlock;
/**
* ## State changes
*
* [-] associate destroyable `child`
*
* @utility
*/
associateDestroyable(child: Destroyable): void;
tryUpdating(): Nullable<UpdatingOpcode[]>;
updating(): UpdatingOpcode[];
elements(): ElementBuilder;
private updating;
/**
* Get Tree Builder
*/
tree(): TreeBuilder;
/**
* Get current Scope
*/
scope(): Scope;
/**
* Get current Dynamic Scope
*/
dynamicScope(): DynamicScope;
pushChildScope(): void;
pushDynamicScope(): DynamicScope;
pushRootScope(size: number, owner: Owner): PartialScope;
pushScope(scope: Scope): void;
popScope(): void;
popDynamicScope(): void;
/// SCOPE HELPERS
getOwner(): Owner;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getSelf(): Reference<any>;

@@ -970,14 +1143,55 @@ referenceForSymbol(symbol: number): Reference;

next(): RichIteratorResult<null, RenderResult>;
bindDynamicScope(names: string[]): void;
}
interface MinimalInitOptions {
interface InitialVmState {
/**
* The address of the compiled template. This is converted into a
* pc when the VM is created.
*/
handle: number;
treeBuilder: ElementBuilder;
/**
* Optionally, specify the root scope for the VM. If not specified,
* the VM will use a root scope with no `this` reference and no
* symbols.
*/
scope?: ScopeOptions;
/**
*
*/
tree: TreeBuilder;
dynamicScope: DynamicScope;
owner: Owner;
}
interface InitOptions extends MinimalInitOptions {
self: Reference;
numSymbols: number;
interface ClosureState {
/**
* The program counter that subsequent evaluations should start from.
*/
readonly pc: number;
/**
* The current value of the VM's scope (which changes whenever a component is invoked or a block
* with block params is entered).
*/
readonly scope: Scope;
/**
* The current value of the VM's dynamic scope
*/
readonly dynamicScope: DynamicScope;
/**
* A number of stack elements captured during the initial evaluation, and which should be restored
* to the stack when the block is re-evaluated.
*/
readonly stack: unknown[];
}
/**
* A closure captures the state of the VM for a particular block of code that is necessary to
* re-invoke the block in the future.
*
* In practice, this allows us to clear the previous render and "replay" the block's execution,
* rendering content in the same position as the first render.
*/
declare class Closure {
private state;
private context;
constructor(state: ClosureState, context: EvaluationContext);
evaluate(tree: TreeBuilder): VM;
}
declare const SERIALIZATION_FIRST_NODE_STRING = "%+b:0%";

@@ -992,5 +1206,5 @@ declare function isSerializationFirstNode(node: SimpleNode): boolean;

}
declare class RehydrateBuilder extends NewElementBuilder implements ElementBuilder {
declare class RehydrateTree extends NewTreeBuilder implements TreeBuilder {
private unmatchedAttributes;
[CURSOR_STACK]: Stack$0<RehydratingCursor>; // Hides property on base class
cursors: Stack<RehydratingCursor>; // Hides property on base class
blockDepth: number;

@@ -1005,3 +1219,3 @@ startingBlockOffset: number;

pushElement(/** called from parent constructor before we initialize this */
this: RehydrateBuilder | (NewElementBuilder & Partial<Pick<RehydrateBuilder, "blockDepth" | "candidate">>), element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;
this: RehydrateTree | (NewTreeBuilder & Partial<Pick<RehydrateTree, "blockDepth" | "candidate">>), element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;
// clears until the end of the current container

@@ -1024,10 +1238,10 @@ // either the current open block or higher

getMarker(element: HTMLElement, guid: string): Nullable<SimpleNode>;
__pushRemoteElement(element: SimpleElement, cursorId: string, insertBefore: Maybe<SimpleNode>): RemoteLiveBlock;
__pushRemoteElement(element: SimpleElement, cursorId: string, insertBefore: Maybe<SimpleNode>): RemoteBlock;
didAppendBounds(bounds: Bounds): Bounds;
}
declare function rehydrationBuilder(env: Environment, cursor: CursorImpl): ElementBuilder;
declare function rehydrationBuilder(env: Environment, cursor: CursorImpl): TreeBuilder;
type IteratorResult<T> = RichIteratorResult<null, T>;
export { clear, ConcreteBounds, CursorImpl, DebugCallback, resetDebuggerCallback, setDebuggerCallback, TEMPLATE_ONLY_COMPONENT_MANAGER, TemplateOnlyComponentDefinition as TemplateOnlyComponent, templateOnlyComponent, TemplateOnlyComponentManager, CurriedValue, curry, DOMChanges, DOMTreeConstruction, DOMChangesImpl as IDOMChanges, isWhitespace, normalizeProperty, EnvironmentDelegate, EnvironmentImpl, inTransaction, runtimeContext, array, concat, fn, get, hash, invokeHelper, on, renderComponent, renderMain, renderSync, DynamicScopeImpl, PartialScopeImpl, InternalVM, VM as LowLevelVM, UpdatingVM, createCapturedArgs, EMPTY_ARGS, EMPTY_NAMED, EMPTY_POSITIONAL, reifyArgs, reifyNamed, reifyPositional, DynamicAttribute, dynamicAttribute, SimpleDynamicAttribute, clientBuilder, NewElementBuilder, RemoteLiveBlock, UpdatableBlockImpl, isSerializationFirstNode, RehydrateBuilder, rehydrationBuilder, SERIALIZATION_FIRST_NODE_STRING, IteratorResult };
export { clear, ConcreteBounds, CursorImpl, DebugCallback, resetDebuggerCallback, setDebuggerCallback, TEMPLATE_ONLY_COMPONENT_MANAGER, TemplateOnlyComponentDefinition as TemplateOnlyComponent, templateOnlyComponent, TemplateOnlyComponentManager, CurriedValue, curry, DOMChanges, DOMTreeConstruction, DOMChangesImpl as IDOMChanges, isWhitespace, normalizeProperty, EnvironmentDelegate, EnvironmentImpl, inTransaction, runtimeOptions, array, concat, fn, get, hash, invokeHelper, on, renderComponent, renderMain, renderSync, DynamicScopeImpl, ScopeImpl, UpdatingVM, VM, createCapturedArgs, EMPTY_ARGS, EMPTY_NAMED, EMPTY_POSITIONAL, reifyArgs, reifyNamed, reifyPositional, DynamicAttribute, dynamicAttribute, SimpleDynamicAttribute, clientBuilder, NewTreeBuilder, RemoteBlock, ResettableBlockImpl, LowLevelVM, isSerializationFirstNode, RehydrateTree, rehydrationBuilder, SERIALIZATION_FIRST_NODE_STRING, IteratorResult };
export type { SafeString };
export { destroy, isDestroyed, isDestroying, registerDestructor } from "@glimmer/destroyable";
//# sourceMappingURL=index.d.ts.map

@@ -1,3 +0,2 @@

import { RichIteratorResult, Bounds, Cursor, Nullable, SimpleElement, SimpleNode, InternalComponentCapabilities, InternalComponentManager, CapturedArguments, CurriedType, Owner, GlimmerTreeChanges, SimpleDocument, SimpleComment, SimpleText, AttrNamespace, ElementNamespace, GlimmerTreeConstruction, ComponentInstanceWithCreate, Environment, EnvironmentOptions, ModifierInstance, RuntimeArtifacts, RuntimeContext, RuntimeResolver, Transaction, TransactionSymbol, CapturedRenderNode, DebugRenderTree, RenderNode, Arguments, CompilableProgram, CompileTimeCompilationContext, ComponentDefinitionState, DynamicScope, ElementBuilder, RenderResult, TemplateIterator, Dict, PartialScope, Scope, ScopeBlock, ScopeSlot, CompilableTemplate, Destroyable, ResolutionTimeConstants, RuntimeConstants, RuntimeProgram, UpdatingOpcode, RuntimeHeap, RuntimeOp, ExceptionHandler, LiveBlock, UpdatableBlock, CursorStackSymbol, ElementOperations, Maybe, SimpleDocumentFragment, AttributeCursor, AttributeOperation, BlockArguments, BlockValue, CapturedBlockArguments, CapturedNamedArguments, CapturedPositionalArguments, NamedArguments, PositionalArguments, VMArguments } from '@glimmer/interfaces';
import { VM as PublicVM } from "@glimmer/interfaces";
import { RichIteratorResult, Bounds, Cursor, Nullable, SimpleElement, SimpleNode, InternalComponentCapabilities, InternalComponentManager, CapturedArguments, CurriedType, Owner, GlimmerTreeChanges, SimpleDocument, SimpleComment, SimpleText, AttrNamespace, ElementNamespace, GlimmerTreeConstruction, ClassicResolver, ComponentInstanceWithCreate, Environment, EnvironmentOptions, ModifierInstance, RuntimeArtifacts, RuntimeOptions, Transaction, TransactionSymbol, CapturedRenderNode, DebugRenderTree, RenderNode, Arguments, CompilableProgram, ComponentDefinitionState, DynamicScope, EvaluationContext, RenderResult, TemplateIterator, TreeBuilder, Dict, Scope, ScopeBlock, ScopeSlot, CompilableTemplate, DebugVmSnapshot, DebugVmTrace, Destroyable, Program, ProgramConstants, UpdatingOpcode, RuntimeOp, BlockArguments, BlockValue, CapturedBlockArguments, CapturedNamedArguments, CapturedPositionalArguments, NamedArguments, PositionalArguments, VMArguments, AppendingBlock, ExceptionHandler, ResettableBlock, ElementOperations, Maybe, SimpleDocumentFragment, AttributeCursor, AttributeOperation } from '@glimmer/interfaces';
import { UpdatingVM as IUpdatingVM } from "@glimmer/interfaces";

@@ -7,3 +6,3 @@ import { Reference, OpaqueIterationItem, OpaqueIterator } from "@glimmer/reference";

import { MachineRegister, Register, SyscallRegister } from "@glimmer/vm";
import { Stack as Stack$0 } from "@glimmer/util";
import { Stack } from "@glimmer/util";
declare class CursorImpl implements Cursor {

@@ -167,2 +166,3 @@ element: SimpleElement;

isInteractive: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
isArgumentCaptureError: ((error: any) => boolean) | undefined;

@@ -196,3 +196,3 @@ debugRenderTree: DebugRenderTree$0<object> | undefined;

}
declare function runtimeContext(options: EnvironmentOptions, delegate: EnvironmentDelegate, artifacts: RuntimeArtifacts, resolver: RuntimeResolver): RuntimeContext;
declare function runtimeOptions(options: EnvironmentOptions, delegate: EnvironmentDelegate, artifacts: RuntimeArtifacts, resolver: Nullable<ClassicResolver>): RuntimeOptions;
declare function inTransaction(env: Environment, block: () => void): void;

@@ -438,4 +438,4 @@ /**

declare function renderSync(env: Environment, iterator: TemplateIterator): RenderResult;
declare function renderMain(runtime: RuntimeContext, context: CompileTimeCompilationContext, owner: Owner, self: Reference, treeBuilder: ElementBuilder, layout: CompilableProgram, dynamicScope?: DynamicScope): TemplateIterator;
declare function renderComponent(runtime: RuntimeContext, treeBuilder: ElementBuilder, context: CompileTimeCompilationContext, owner: Owner, definition: ComponentDefinitionState, args?: Record<string, unknown>, dynamicScope?: DynamicScope): TemplateIterator;
declare function renderMain(context: EvaluationContext, owner: Owner, self: Reference, tree: TreeBuilder, layout: CompilableProgram, dynamicScope?: DynamicScope): TemplateIterator;
declare function renderComponent(context: EvaluationContext, tree: TreeBuilder, owner: Owner, definition: ComponentDefinitionState, args?: Record<string, unknown>, dynamicScope?: DynamicScope): TemplateIterator;
declare class DynamicScopeImpl implements DynamicScope {

@@ -448,22 +448,29 @@ private bucket;

}
declare class PartialScopeImpl implements PartialScope {
// the 0th slot is `self`
readonly slots: Array<ScopeSlot>;
interface ScopeOptions {
/** @default {UNDEFINED_REFERENCE} */
self: Reference<unknown>;
/** @default {0} */
size?: number | undefined;
}
declare class ScopeImpl implements Scope {
static root(owner: Owner, { self, size }: ScopeOptions): Scope;
static sized(owner: Owner, size?: number): Scope;
readonly owner: Owner;
private slots;
private callerScope;
// named arguments and blocks passed to a layout that uses eval
private evalScope;
// locals in scope when the partial was invoked
private partialMap;
static root(self: Reference<unknown>, size: number, owner: Owner): PartialScope;
static sized(size: number, owner: Owner): Scope;
constructor(slots: Array<ScopeSlot>, owner: Owner, callerScope: Scope | null, evalScope: Dict<ScopeSlot> | null, partialMap: Dict<Reference<unknown>> | null);
constructor(owner: Owner,
// the 0th slot is `self`
slots: Array<ScopeSlot>,
// a single program can mix owners via curried components, and the state lives on root scopes
callerScope: Nullable<Scope>);
init({ self }: {
self: Reference<unknown>;
}): this;
/**
* @debug
*/
snapshot(): ScopeSlot[];
getSelf(): Reference<unknown>;
getSymbol(symbol: number): Reference<unknown>;
getBlock(symbol: number): Nullable<ScopeBlock>;
getEvalScope(): Nullable<Dict<ScopeSlot>>;
getPartialMap(): Nullable<Dict<Reference<unknown>>>;
bind(symbol: number, value: ScopeSlot): void;

@@ -473,4 +480,2 @@ bindSelf(self: Reference<unknown>): void;

bindBlock(symbol: number, value: Nullable<ScopeBlock>): void;
bindEvalScope(map: Nullable<Dict<ScopeSlot>>): void;
bindPartialMap(map: Dict<Reference<unknown>>): void;
bindCallerScope(scope: Nullable<Scope>): void;

@@ -485,12 +490,14 @@ getCallerScope(): Nullable<Scope>;

}
interface LowLevelRegisters {
[MachineRegister.pc]: number;
[MachineRegister.ra]: number;
[MachineRegister.sp]: number;
[MachineRegister.fp]: number;
}
interface Stack {
type LowLevelRegisters = [
$pc: number,
$ra: number,
$sp: number,
$fp: number
];
interface VmStack {
readonly registers: LowLevelRegisters;
push(value: unknown): void;
get(position: number): number;
pop<T>(): T;
snapshot?(): unknown[];
}

@@ -502,9 +509,8 @@ interface Externs {

declare class LowLevelVM {
stack: Stack;
heap: RuntimeHeap;
program: RuntimeProgram;
externs: Externs;
stack: VmStack;
externs: Externs | undefined;
currentOpSize: number;
readonly registers: LowLevelRegisters;
currentOpSize: number;
constructor(stack: Stack, heap: RuntimeHeap, program: RuntimeProgram, externs: Externs, registers: LowLevelRegisters);
readonly context: EvaluationContext;
constructor(stack: VmStack, context: EvaluationContext, externs: Externs | undefined, registers: LowLevelRegisters);
fetchRegister(register: MachineRegister): number;

@@ -531,19 +537,9 @@ loadRegister(register: MachineRegister, value: number): void;

evaluateInner(opcode: RuntimeOp, vm: VM): void;
evaluateMachine(opcode: RuntimeOp): void;
evaluateMachine(opcode: RuntimeOp, vm: VM): void;
evaluateSyscall(opcode: RuntimeOp, vm: VM): void;
}
// These symbols represent "friend" properties that are used inside of
// the VM in other classes, but are not intended to be a part of
// Glimmer's API.
declare const INNER_VM: unique symbol;
declare const DESTROYABLE_STACK: unique symbol;
declare const STACKS: unique symbol;
declare const REGISTERS: unique symbol;
declare const HEAP: unique symbol;
declare const CONSTANTS: unique symbol;
declare const ARGS$0: unique symbol;
interface EvaluationStack {
[REGISTERS]: LowLevelRegisters;
readonly registers: LowLevelRegisters;
push(value: unknown): void;
dup(position?: MachineRegister): void;
dup(position?: number): void;
copy(from: number, to: number): void;

@@ -557,4 +553,87 @@ pop<T>(n?: number): T;

reset(): void;
toArray(): unknown[];
snapshot?(): unknown[];
}
/*
The calling convention is:
* 0-N block arguments at the bottom
* 0-N positional arguments next (left-to-right)
* 0-N named arguments next
*/
declare class VMArgumentsImpl implements VMArguments {
private stack;
positional: PositionalArgumentsImpl;
named: NamedArgumentsImpl;
blocks: BlockArgumentsImpl;
constructor();
empty(stack: EvaluationStack): this;
setup(stack: EvaluationStack, names: readonly string[], blockNames: readonly string[], positionalCount: number, atNames: boolean): void;
get base(): number;
get length(): number;
at(pos: number): Reference;
realloc(offset: number): void;
capture(): CapturedArguments;
clear(): void;
}
declare class PositionalArgumentsImpl implements PositionalArguments {
base: number;
length: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private stack;
private _references;
constructor();
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number): void;
at(position: number): Reference;
capture(): CapturedPositionalArguments;
prepend(other: Reference[]): void;
private get references();
}
declare class NamedArgumentsImpl implements NamedArguments {
base: number;
length: number;
private stack;
private _references;
private _names;
private _atNames;
constructor();
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[], atNames: boolean): void;
get names(): readonly string[];
get atNames(): readonly string[];
has(name: string): boolean;
get(name: string, atNames?: boolean): Reference;
capture(): CapturedNamedArguments;
merge(other: Record<string, Reference>): void;
private get references();
private toSyntheticName;
private toAtName;
}
declare class BlockArgumentsImpl implements BlockArguments {
private stack;
private internalValues;
private _symbolNames;
internalTag: Nullable<Tag>;
names: readonly string[];
length: number;
base: number;
constructor();
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[]): void;
get values(): readonly BlockValue[];
has(name: string): boolean;
get(name: string): Nullable<ScopeBlock>;
capture(): CapturedBlockArguments;
get symbolNames(): readonly string[];
}
declare function createCapturedArgs(named: Dict<Reference>, positional: Reference[]): CapturedArguments;
declare function reifyNamed(named: CapturedNamedArguments): Dict<unknown>;
declare function reifyPositional(positional: CapturedPositionalArguments): unknown[];
declare function reifyArgs(args: CapturedArguments): {
named: Dict<unknown>;
positional: unknown[];
};
declare const EMPTY_NAMED: CapturedNamedArguments;
declare const EMPTY_POSITIONAL: CapturedPositionalArguments;
declare const EMPTY_ARGS: CapturedArguments;
declare function dynamicAttribute(element: SimpleElement, attr: string, namespace: Nullable<AttrNamespace>, isTrusting?: boolean): DynamicAttribute;

@@ -564,17 +643,27 @@ declare abstract class DynamicAttribute implements AttributeOperation {

constructor(attribute: AttributeCursor);
abstract set(dom: ElementBuilder, value: unknown, env: Environment): void;
abstract set(dom: TreeBuilder, value: unknown, env: Environment): void;
abstract update(value: unknown, env: Environment): void;
}
declare class SimpleDynamicAttribute extends DynamicAttribute {
set(dom: ElementBuilder, value: unknown, _env: Environment): void;
set(dom: TreeBuilder, value: unknown, _env: Environment): void;
update(value: unknown, _env: Environment): void;
}
interface FirstNode {
debug?: {
first: () => Nullable<SimpleNode>;
};
firstNode(): SimpleNode;
}
interface LastNode {
debug?: {
last: () => Nullable<SimpleNode>;
};
lastNode(): SimpleNode;
}
declare const CURSOR_STACK: CursorStackSymbol;
declare class NewElementBuilder implements ElementBuilder {
declare class NewTreeBuilder implements TreeBuilder {
debug?: () => {
blocks: AppendingBlock[];
constructing: Nullable<SimpleElement>;
cursors: Cursor[];
};
dom: GlimmerTreeConstruction;

@@ -585,20 +674,20 @@ updateOperations: GlimmerTreeChanges;

private env;
[CURSOR_STACK]: Stack$0<Cursor>;
readonly cursors: Stack<Cursor>;
private modifierStack;
private blockStack;
static forInitialRender(env: Environment, cursor: CursorImpl): NewElementBuilder;
static resume(env: Environment, block: UpdatableBlock): NewElementBuilder;
static forInitialRender(env: Environment, cursor: CursorImpl): NewTreeBuilder;
static resume(env: Environment, block: ResettableBlock): NewTreeBuilder;
constructor(env: Environment, parentNode: SimpleElement, nextSibling: Nullable<SimpleNode>);
protected initialize(): this;
debugBlocks(): LiveBlock[];
debugBlocks(): AppendingBlock[];
get element(): SimpleElement;
get nextSibling(): Nullable<SimpleNode>;
get hasBlocks(): boolean;
protected block(): LiveBlock;
protected block(): AppendingBlock;
popElement(): void;
pushSimpleBlock(): LiveBlock;
pushUpdatableBlock(): UpdatableBlockImpl;
pushBlockList(list: LiveBlock[]): LiveBlockList;
protected pushLiveBlock<T extends LiveBlock>(block: T, isRemote?: boolean): T;
popBlock(): LiveBlock;
pushAppendingBlock(): AppendingBlock;
pushResettableBlock(): ResettableBlockImpl;
pushBlockList(list: AppendingBlock[]): AppendingBlockList;
protected pushBlock<T extends AppendingBlock>(block: T, isRemote?: boolean): T;
popBlock(): AppendingBlock;
__openBlock(): void;

@@ -612,5 +701,5 @@ __closeBlock(): void;

closeElement(): Nullable<ModifierInstance[]>;
pushRemoteElement(element: SimpleElement, guid: string, insertBefore: Maybe<SimpleNode>): RemoteLiveBlock;
__pushRemoteElement(element: SimpleElement, _guid: string, insertBefore: Maybe<SimpleNode>): RemoteLiveBlock;
popRemoteElement(): RemoteLiveBlock;
pushRemoteElement(element: SimpleElement, guid: string, insertBefore: Maybe<SimpleNode>): RemoteBlock;
__pushRemoteElement(element: SimpleElement, _guid: string, insertBefore: Maybe<SimpleNode>): RemoteBlock;
popRemoteElement(): RemoteBlock;
protected pushElement(element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;

@@ -641,4 +730,8 @@ private pushModifiers;

}
declare class SimpleLiveBlock implements LiveBlock {
declare class AppendingBlockImpl implements AppendingBlock {
private parent;
debug?: {
first: () => Nullable<SimpleNode>;
last: () => Nullable<SimpleNode>;
};
protected first: Nullable<FirstNode>;

@@ -655,15 +748,16 @@ protected last: Nullable<LastNode>;

didAppendBounds(bounds: Bounds): void;
finalize(stack: ElementBuilder): void;
finalize(stack: TreeBuilder): void;
}
declare class RemoteLiveBlock extends SimpleLiveBlock {
declare class RemoteBlock extends AppendingBlockImpl {
constructor(parent: SimpleElement);
}
declare class UpdatableBlockImpl extends SimpleLiveBlock implements UpdatableBlock {
declare class ResettableBlockImpl extends AppendingBlockImpl implements ResettableBlock {
constructor(parent: SimpleElement);
reset(): Nullable<SimpleNode>;
}
// FIXME: All the noops in here indicate a modelling problem
declare class LiveBlockList implements LiveBlock {
declare class AppendingBlockList implements AppendingBlock {
private readonly parent;
boundList: LiveBlock[];
constructor(parent: SimpleElement, boundList: LiveBlock[]);
boundList: AppendingBlock[];
constructor(parent: SimpleElement, boundList: AppendingBlock[]);
parentElement(): SimpleElement;

@@ -676,5 +770,5 @@ firstNode(): SimpleNode;

didAppendBounds(_bounds: Bounds): void;
finalize(_stack: ElementBuilder): void;
finalize(_stack: TreeBuilder): void;
}
declare function clientBuilder(env: Environment, cursor: CursorImpl): ElementBuilder;
declare function clientBuilder(env: Environment, cursor: CursorImpl): TreeBuilder;
declare class UpdatingVM implements IUpdatingVM {

@@ -695,17 +789,8 @@ env: Environment;

}
interface VMState {
readonly pc: number;
readonly scope: Scope;
readonly dynamicScope: DynamicScope;
readonly stack: unknown[];
}
interface ResumableVMState {
resume(runtime: RuntimeContext, builder: ElementBuilder): InternalVM;
}
declare abstract class BlockOpcode implements UpdatingOpcode, Bounds {
protected state: ResumableVMState;
protected runtime: RuntimeContext;
protected state: Closure;
protected context: EvaluationContext;
children: UpdatingOpcode[];
protected readonly bounds: LiveBlock;
constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: LiveBlock, children: UpdatingOpcode[]);
protected readonly bounds: AppendingBlock;
constructor(state: Closure, context: EvaluationContext, bounds: AppendingBlock, children: UpdatingOpcode[]);
parentElement(): import("@glimmer/interfaces").SimpleElement;

@@ -718,3 +803,3 @@ firstNode(): import("@glimmer/interfaces").SimpleNode;

type: string;
protected bounds: UpdatableBlock; // Hides property on base class
protected bounds: ResettableBlock; // Shadows property on base class
evaluate(vm: UpdatingVM): void;

@@ -729,236 +814,324 @@ handleException(): void;

index: number;
constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: UpdatableBlock, key: unknown, memo: Reference, value: Reference);
updateReferences(item: OpaqueIterationItem): void;
constructor(state: Closure, context: EvaluationContext, bounds: ResettableBlock, key: unknown, memo: Reference, value: Reference);
shouldRemove(): boolean;
reset(): void;
}
declare class ListBlockOpcode extends BlockOpcode {
private iterableRef;
type: string;
children: ListItemOpcode[];
private opcodeMap;
private marker;
private lastIterator;
protected readonly bounds: LiveBlockList;
constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: LiveBlockList, children: ListItemOpcode[], iterableRef: Reference<OpaqueIterator>);
initializeChild(opcode: ListItemOpcode): void;
evaluate(vm: UpdatingVM): void;
private sync;
private retainItem;
private insertItem;
private moveItem;
private deleteItem;
}
/*
The calling convention is:
* 0-N block arguments at the bottom
* 0-N positional arguments next (left-to-right)
* 0-N named arguments next
*/
declare class VMArgumentsImpl implements VMArguments {
private stack;
positional: PositionalArgumentsImpl;
named: NamedArgumentsImpl;
blocks: BlockArgumentsImpl;
empty(stack: EvaluationStack): this;
setup(stack: EvaluationStack, names: readonly string[], blockNames: readonly string[], positionalCount: number, atNames: boolean): void;
get base(): number;
get length(): number;
at(pos: number): Reference;
realloc(offset: number): void;
capture(): CapturedArguments;
clear(): void;
}
declare class PositionalArgumentsImpl implements PositionalArguments {
base: number;
length: number;
private stack;
private _references;
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number): void;
at(position: number): Reference;
capture(): CapturedPositionalArguments;
prepend(other: Reference[]): void;
private get references();
}
declare class NamedArgumentsImpl implements NamedArguments {
base: number;
length: number;
private stack;
private _references;
private _names;
private _atNames;
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[], atNames: boolean): void;
get names(): readonly string[];
get atNames(): readonly string[];
has(name: string): boolean;
get(name: string, atNames?: boolean): Reference;
capture(): CapturedNamedArguments;
merge(other: Record<string, Reference>): void;
private get references();
private toSyntheticName;
private toAtName;
}
declare class BlockArgumentsImpl implements BlockArguments {
private stack;
private internalValues;
private _symbolNames;
internalTag: Nullable<Tag>;
names: readonly string[];
length: number;
base: number;
empty(stack: EvaluationStack, base: number): void;
setup(stack: EvaluationStack, base: number, length: number, names: readonly string[]): void;
get values(): readonly BlockValue[];
has(name: string): boolean;
get(name: string): Nullable<ScopeBlock>;
capture(): CapturedBlockArguments;
get symbolNames(): readonly string[];
}
declare function createCapturedArgs(named: Dict<Reference>, positional: Reference[]): CapturedArguments;
declare function reifyNamed(named: CapturedNamedArguments): Dict<unknown>;
declare function reifyPositional(positional: CapturedPositionalArguments): unknown[];
declare function reifyArgs(args: CapturedArguments): {
named: Dict<unknown>;
positional: unknown[];
};
declare const EMPTY_NAMED: CapturedNamedArguments;
declare const EMPTY_POSITIONAL: CapturedPositionalArguments;
declare const EMPTY_ARGS: CapturedArguments;
/**
* This interface is used by internal opcodes, and is more stable than
* the implementation of the Append VM itself.
*/
interface InternalVM {
readonly [CONSTANTS]: RuntimeConstants & ResolutionTimeConstants;
readonly [ARGS$0]: VMArgumentsImpl;
readonly env: Environment;
readonly stack: EvaluationStack;
readonly runtime: RuntimeContext;
readonly context: CompileTimeCompilationContext;
loadValue(register: MachineRegister, value: number): void;
loadValue(register: Register, value: unknown): void;
loadValue(register: Register | MachineRegister, value: unknown): void;
fetchValue(register: MachineRegister.ra | MachineRegister.pc): number;
// TODO: Something better than a type assertion?
fetchValue<T>(register: Register): T;
fetchValue(register: Register): unknown;
load(register: Register): void;
fetch(register: Register): void;
compile(block: CompilableTemplate): number;
scope(): Scope;
elements(): ElementBuilder;
getOwner(): Owner;
getSelf(): Reference;
updateWith(opcode: UpdatingOpcode): void;
associateDestroyable(d: Destroyable): void;
beginCacheGroup(name?: string): void;
commitCacheGroup(): void;
/// Iteration ///
enterList(iterableRef: Reference<OpaqueIterator>, offset: number): void;
exitList(): void;
enterItem(item: OpaqueIterationItem): ListItemOpcode;
registerItem(item: ListItemOpcode): void;
pushRootScope(size: number, owner: Owner): PartialScope;
pushChildScope(): void;
popScope(): void;
pushScope(scope: Scope): void;
dynamicScope(): DynamicScope;
bindDynamicScope(names: string[]): void;
pushDynamicScope(): void;
popDynamicScope(): void;
enter(args: number): void;
exit(): void;
goto(pc: number): void;
call(handle: number): void;
pushFrame(): void;
referenceForSymbol(symbol: number): Reference;
execute(initialize?: (vm: this) => void): RenderResult;
pushUpdating(list?: UpdatingOpcode[]): void;
next(): RichIteratorResult<null, RenderResult>;
}
declare class VM implements PublicVM, InternalVM {
readonly runtime: RuntimeContext;
private readonly elementStack;
readonly context: CompileTimeCompilationContext;
private readonly [STACKS];
private readonly [HEAP];
private readonly destructor;
private readonly [DESTROYABLE_STACK];
readonly [CONSTANTS]: RuntimeConstants & ResolutionTimeConstants;
readonly [ARGS$0]: VMArgumentsImpl;
readonly [INNER_VM]: LowLevelVM;
declare class VM {
#private;
readonly args: VMArgumentsImpl;
readonly lowlevel: LowLevelVM;
readonly debug?: () => DebugVmSnapshot;
readonly trace?: () => DebugVmTrace;
get stack(): EvaluationStack;
/* Registers */
get pc(): number;
s0: unknown;
s1: unknown;
t0: unknown;
t1: unknown;
v0: unknown;
// Fetch a value from a register onto the stack
/**
* Fetch a value from a syscall register onto the stack.
*
* ## Opcodes
*
* - Append: `Fetch`
*
* ## State changes
*
* [!] push Eval Stack <- $register
*/
fetch(register: SyscallRegister): void;
// Load a value from the stack into a register
/**
* Load a value from the stack into a syscall register.
*
* ## Opcodes
*
* - Append: `Load`
*
* ## State changes
*
* [!] pop Eval Stack -> `value`
* [$] $register <- `value`
*/
load(register: SyscallRegister): void;
// Fetch a value from a register
/**
* Load a value into a syscall register.
*
* ## State changes
*
* [$] $register <- `value`
*
* @utility
*/
loadValue<T>(register: SyscallRegister, value: T): void;
/**
* Fetch a value from a register (machine or syscall).
*
* ## State changes
*
* [ ] get $register
*
* @utility
*/
fetchValue(register: MachineRegister): number;
fetchValue<T>(register: Register): T;
// Load a value into a register
loadValue<T>(register: Register | MachineRegister, value: T): void;
/**
* Migrated to Inner
*/
// Start a new frame and save $ra and $fp on the stack
pushFrame(): void;
// Restore $ra, $sp and $fp
popFrame(): void;
// Jump to an address in `program`
goto(offset: number): void;
// Save $pc into $ra, then jump to a new address in `program` (jal in MIPS)
call(handle: number): void;
// Put a specific `program` address in $ra
returnTo(offset: number): void;
call(handle: number | null): void;
// Return to the `program` address stored in $ra
return(): void;
readonly context: EvaluationContext;
constructor({ scope, dynamicScope, stack, pc }: ClosureState, context: EvaluationContext, tree: TreeBuilder);
static initial(context: EvaluationContext, options: InitialVmState): VM;
compile(block: CompilableTemplate): number;
get constants(): ProgramConstants;
get program(): Program;
get env(): Environment;
private captureClosure;
capture(args: number, pc?: number): Closure;
/**
* End of migrated.
* ## Opcodes
*
* - Append: `BeginComponentTransaction`
*
* ## State Changes
*
* [ ] create `guard` (`JumpIfNotModifiedOpcode`)
* [ ] create `tracker` (`BeginTrackFrameOpcode`)
* [!] push Updating Stack <- `guard`
* [!] push Updating Stack <- `tracker`
* [!] push Cache Stack <- `guard`
* [!] push Tracking Stack
*/
constructor(runtime: RuntimeContext, { pc, scope, dynamicScope, stack }: VMState, elementStack: ElementBuilder, context: CompileTimeCompilationContext);
static initial(runtime: RuntimeContext, context: CompileTimeCompilationContext, { handle, self, dynamicScope, treeBuilder, numSymbols, owner }: InitOptions): InternalVM;
static empty(runtime: RuntimeContext, { handle, treeBuilder, dynamicScope, owner }: MinimalInitOptions, context: CompileTimeCompilationContext): InternalVM;
private resume;
compile(block: CompilableTemplate): number;
get program(): RuntimeProgram;
get env(): Environment;
captureState(args: number, pc?: number): VMState;
capture(args: number, pc?: number): ResumableVMState;
beginCacheGroup(name?: string): void;
/**
* ## Opcodes
*
* - Append: `CommitComponentTransaction`
*
* ## State Changes
*
* Create a new `EndTrackFrameOpcode` (`end`)
*
* [!] pop CacheStack -> `guard`
* [!] pop Tracking Stack -> `tag`
* [ ] create `end` (`EndTrackFrameOpcode`) with `guard`
* [-] consume `tag`
*/
commitCacheGroup(): void;
/**
* ## Opcodes
*
* - Append: `Enter`
*
* ## State changes
*
* [!] push Element Stack as `block`
* [ ] create `try` (`TryOpcode`) with `block`, capturing `args` from the Eval Stack
*
* Did Enter (`try`):
* [-] associate destroyable `try`
* [!] push Destroyable Stack <- `try`
* [!] push Updating List <- `try`
* [!] push Updating Stack <- `try.children`
*/
enter(args: number): void;
/**
* ## Opcodes
*
* - Append: `Iterate`
* - Update: `ListBlock`
*
* ## State changes
*
* Create a new ref for the iterator item (`value`).
* Create a new ref for the iterator key (`key`).
*
* [ ] create `valueRef` (`Reference`) from `value`
* [ ] create `keyRef` (`Reference`) from `key`
* [!] push Eval Stack <- `valueRef`
* [!] push Eval Stack <- `keyRef`
* [!] push Element Stack <- `UpdatableBlock` as `block`
* [ ] capture `closure` with *2* items from the Eval Stack
* [ ] create `iteration` (`ListItemOpcode`) with `closure`, `block`, `key`, `keyRef` and `valueRef`
*
* Did Enter (`iteration`):
* [-] associate destroyable `iteration`
* [!] push Destroyable Stack <- `iteration`
* [!] push Updating List <- `iteration`
* [!] push Updating Stack <- `iteration.children`
*/
enterItem({ key, value, memo }: OpaqueIterationItem): ListItemOpcode;
registerItem(opcode: ListItemOpcode): void;
/**
* ## Opcodes
*
* - Append: `EnterList`
*
* ## State changes
*
* [ ] capture `closure` with *0* items from the Eval Stack, and `$pc` from `offset`
* [ ] create `updating` (empty `Array`)
* [!] push Element Stack <- `list` (`BlockList`) with `updating`
* [ ] create `list` (`ListBlockOpcode`) with `closure`, `list`, `updating` and `iterableRef`
* [!] push List Stack <- `list`
*
* Did Enter (`list`):
* [-] associate destroyable `list`
* [!] push Destroyable Stack <- `list`
* [!] push Updating List <- `list`
* [!] push Updating Stack <- `list.children`
*/
enterList(iterableRef: Reference<OpaqueIterator>, offset: number): void;
/**
* ## Opcodes
*
* - Append: `Enter`
* - Append: `Iterate`
* - Append: `EnterList`
* - Update: `ListBlock`
*
* ## State changes
*
* [-] associate destroyable `opcode`
* [!] push Destroyable Stack <- `opcode`
* [!] push Updating List <- `opcode`
* [!] push Updating Stack <- `opcode.children`
*
*/
private didEnter;
/**
* ## Opcodes
*
* - Append: `Exit`
* - Append: `ExitList`
*
* ## State changes
*
* [!] pop Destroyable Stack
* [!] pop Element Stack
* [!] pop Updating Stack
*/
exit(): void;
/**
* ## Opcodes
*
* - Append: `ExitList`
*
* ## State changes
*
* Pop List:
* [!] pop Destroyable Stack
* [!] pop Element Stack
* [!] pop Updating Stack
*
* [!] pop List Stack
*/
exitList(): void;
/**
* ## Opcodes
*
* - Append: `RootScope`
* - Append: `VirtualRootScope`
*
* ## State changes
*
* [!] push Scope Stack
*/
pushRootScope(size: number, owner: Owner): Scope;
/**
* ## Opcodes
*
* - Append: `ChildScope`
*
* ## State changes
*
* [!] push Scope Stack <- `child` of current Scope
*/
pushChildScope(): void;
/**
* ## Opcodes
*
* - Append: `Yield`
*
* ## State changes
*
* [!] push Scope Stack <- `scope`
*/
pushScope(scope: Scope): void;
/**
* ## Opcodes
*
* - Append: `PopScope`
*
* ## State changes
*
* [!] pop Scope Stack
*/
popScope(): void;
/**
* ## Opcodes
*
* - Append: `PushDynamicScope`
*
* ## State changes:
*
* [!] push Dynamic Scope Stack <- child of current Dynamic Scope
*/
pushDynamicScope(): DynamicScope;
/**
* ## Opcodes
*
* - Append: `BindDynamicScope`
*
* ## State changes:
*
* [!] pop Dynamic Scope Stack `names.length` times
*/
bindDynamicScope(names: string[]): void;
/**
* ## State changes
*
* - [!] push Updating Stack
*
* @utility
*/
pushUpdating(list?: UpdatingOpcode[]): void;
/**
* ## State changes
*
* [!] pop Updating Stack
*
* @utility
*/
popUpdating(): UpdatingOpcode[];
/**
* ## State changes
*
* [!] push Updating List
*
* @utility
*/
updateWith(opcode: UpdatingOpcode): void;
listBlock(): ListBlockOpcode;
private listBlock;
/**
* ## State changes
*
* [-] associate destroyable `child`
*
* @utility
*/
associateDestroyable(child: Destroyable): void;
tryUpdating(): Nullable<UpdatingOpcode[]>;
updating(): UpdatingOpcode[];
elements(): ElementBuilder;
private updating;
/**
* Get Tree Builder
*/
tree(): TreeBuilder;
/**
* Get current Scope
*/
scope(): Scope;
/**
* Get current Dynamic Scope
*/
dynamicScope(): DynamicScope;
pushChildScope(): void;
pushDynamicScope(): DynamicScope;
pushRootScope(size: number, owner: Owner): PartialScope;
pushScope(scope: Scope): void;
popScope(): void;
popDynamicScope(): void;
/// SCOPE HELPERS
getOwner(): Owner;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getSelf(): Reference<any>;

@@ -970,14 +1143,55 @@ referenceForSymbol(symbol: number): Reference;

next(): RichIteratorResult<null, RenderResult>;
bindDynamicScope(names: string[]): void;
}
interface MinimalInitOptions {
interface InitialVmState {
/**
* The address of the compiled template. This is converted into a
* pc when the VM is created.
*/
handle: number;
treeBuilder: ElementBuilder;
/**
* Optionally, specify the root scope for the VM. If not specified,
* the VM will use a root scope with no `this` reference and no
* symbols.
*/
scope?: ScopeOptions;
/**
*
*/
tree: TreeBuilder;
dynamicScope: DynamicScope;
owner: Owner;
}
interface InitOptions extends MinimalInitOptions {
self: Reference;
numSymbols: number;
interface ClosureState {
/**
* The program counter that subsequent evaluations should start from.
*/
readonly pc: number;
/**
* The current value of the VM's scope (which changes whenever a component is invoked or a block
* with block params is entered).
*/
readonly scope: Scope;
/**
* The current value of the VM's dynamic scope
*/
readonly dynamicScope: DynamicScope;
/**
* A number of stack elements captured during the initial evaluation, and which should be restored
* to the stack when the block is re-evaluated.
*/
readonly stack: unknown[];
}
/**
* A closure captures the state of the VM for a particular block of code that is necessary to
* re-invoke the block in the future.
*
* In practice, this allows us to clear the previous render and "replay" the block's execution,
* rendering content in the same position as the first render.
*/
declare class Closure {
private state;
private context;
constructor(state: ClosureState, context: EvaluationContext);
evaluate(tree: TreeBuilder): VM;
}
declare const SERIALIZATION_FIRST_NODE_STRING = "%+b:0%";

@@ -992,5 +1206,5 @@ declare function isSerializationFirstNode(node: SimpleNode): boolean;

}
declare class RehydrateBuilder extends NewElementBuilder implements ElementBuilder {
declare class RehydrateTree extends NewTreeBuilder implements TreeBuilder {
private unmatchedAttributes;
[CURSOR_STACK]: Stack$0<RehydratingCursor>; // Hides property on base class
cursors: Stack<RehydratingCursor>; // Hides property on base class
blockDepth: number;

@@ -1005,3 +1219,3 @@ startingBlockOffset: number;

pushElement(/** called from parent constructor before we initialize this */
this: RehydrateBuilder | (NewElementBuilder & Partial<Pick<RehydrateBuilder, "blockDepth" | "candidate">>), element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;
this: RehydrateTree | (NewTreeBuilder & Partial<Pick<RehydrateTree, "blockDepth" | "candidate">>), element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;
// clears until the end of the current container

@@ -1024,10 +1238,10 @@ // either the current open block or higher

getMarker(element: HTMLElement, guid: string): Nullable<SimpleNode>;
__pushRemoteElement(element: SimpleElement, cursorId: string, insertBefore: Maybe<SimpleNode>): RemoteLiveBlock;
__pushRemoteElement(element: SimpleElement, cursorId: string, insertBefore: Maybe<SimpleNode>): RemoteBlock;
didAppendBounds(bounds: Bounds): Bounds;
}
declare function rehydrationBuilder(env: Environment, cursor: CursorImpl): ElementBuilder;
declare function rehydrationBuilder(env: Environment, cursor: CursorImpl): TreeBuilder;
type IteratorResult<T> = RichIteratorResult<null, T>;
export { clear, ConcreteBounds, CursorImpl, DebugCallback, resetDebuggerCallback, setDebuggerCallback, TEMPLATE_ONLY_COMPONENT_MANAGER, TemplateOnlyComponentDefinition as TemplateOnlyComponent, templateOnlyComponent, TemplateOnlyComponentManager, CurriedValue, curry, DOMChanges, DOMTreeConstruction, DOMChangesImpl as IDOMChanges, isWhitespace, normalizeProperty, EnvironmentDelegate, EnvironmentImpl, inTransaction, runtimeContext, array, concat, fn, get, hash, invokeHelper, on, renderComponent, renderMain, renderSync, DynamicScopeImpl, PartialScopeImpl, InternalVM, VM as LowLevelVM, UpdatingVM, createCapturedArgs, EMPTY_ARGS, EMPTY_NAMED, EMPTY_POSITIONAL, reifyArgs, reifyNamed, reifyPositional, DynamicAttribute, dynamicAttribute, SimpleDynamicAttribute, clientBuilder, NewElementBuilder, RemoteLiveBlock, UpdatableBlockImpl, isSerializationFirstNode, RehydrateBuilder, rehydrationBuilder, SERIALIZATION_FIRST_NODE_STRING, IteratorResult };
export { clear, ConcreteBounds, CursorImpl, DebugCallback, resetDebuggerCallback, setDebuggerCallback, TEMPLATE_ONLY_COMPONENT_MANAGER, TemplateOnlyComponentDefinition as TemplateOnlyComponent, templateOnlyComponent, TemplateOnlyComponentManager, CurriedValue, curry, DOMChanges, DOMTreeConstruction, DOMChangesImpl as IDOMChanges, isWhitespace, normalizeProperty, EnvironmentDelegate, EnvironmentImpl, inTransaction, runtimeOptions, array, concat, fn, get, hash, invokeHelper, on, renderComponent, renderMain, renderSync, DynamicScopeImpl, ScopeImpl, UpdatingVM, VM, createCapturedArgs, EMPTY_ARGS, EMPTY_NAMED, EMPTY_POSITIONAL, reifyArgs, reifyNamed, reifyPositional, DynamicAttribute, dynamicAttribute, SimpleDynamicAttribute, clientBuilder, NewTreeBuilder, RemoteBlock, ResettableBlockImpl, LowLevelVM, isSerializationFirstNode, RehydrateTree, rehydrationBuilder, SERIALIZATION_FIRST_NODE_STRING, IteratorResult };
export type { SafeString };
export { destroy, isDestroyed, isDestroying, registerDestructor } from "@glimmer/destroyable";
//# sourceMappingURL=index.d.ts.map
{
"name": "@glimmer/runtime",
"version": "0.92.4",
"version": "0.93.0",
"license": "MIT",

@@ -8,4 +8,22 @@ "description": "Minimal runtime needed to render Glimmer templates",

"type": "module",
"main": null,
"types": "dist/dev/index.d.ts",
"exports": {
".": {
"require": {
"development": {
"types": "./dist/dev/index.d.cts",
"default": "./dist/dev/index.cjs"
}
},
"default": {
"development": {
"types": "./dist/dev/index.d.ts",
"default": "./dist/dev/index.js"
},
"default": {
"types": "./dist/prod/index.d.ts",
"default": "./dist/prod/index.js"
}
}
}
},
"publishConfig": {

@@ -19,13 +37,13 @@ "access": "public"

"@glimmer/env": "0.1.7",
"@glimmer/destroyable": "0.92.3",
"@glimmer/global-context": "0.92.3",
"@glimmer/manager": "0.92.4",
"@glimmer/owner": "0.92.3",
"@glimmer/program": "0.92.4",
"@glimmer/reference": "0.92.3",
"@glimmer/interfaces": "0.92.3",
"@glimmer/validator": "0.92.3",
"@glimmer/wire-format": "0.92.3",
"@glimmer/util": "0.92.3",
"@glimmer/vm": "0.92.3"
"@glimmer/destroyable": "0.93.0",
"@glimmer/global-context": "0.92.4",
"@glimmer/manager": "0.93.0",
"@glimmer/interfaces": "0.93.0",
"@glimmer/owner": "0.92.4",
"@glimmer/program": "0.93.0",
"@glimmer/reference": "0.93.0",
"@glimmer/util": "0.93.0",
"@glimmer/validator": "0.93.0",
"@glimmer/vm": "0.93.0",
"@glimmer/wire-format": "0.93.0"
},

@@ -39,5 +57,7 @@ "devDependencies": {

"@glimmer-workspace/build-support": "1.0.0",
"@glimmer/constants": "0.92.3",
"@glimmer/debug": "0.92.4",
"@glimmer/debug-util": "0.92.3",
"@glimmer/local-debug-flags": "0.92.0",
"@glimmer/debug": "0.92.4",
"@glimmer/opcode-compiler": "0.92.4"
"@glimmer/opcode-compiler": "0.93.0"
},

@@ -49,13 +69,3 @@ "scripts": {

"test:types": "tsc --noEmit -p ../tsconfig.json"
},
"exports": {
".": {
"types": "./dist/dev/index.d.ts",
"development": {
"import": "./dist/dev/index.js"
},
"import": "./dist/prod/index.js"
}
},
"module": "dist/dev/index.js"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc