marko 6.4.0 → 6.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cheatsheet.md +2 -2
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/reserved-id.d.ts +5 -0
- package/dist/common/errors.d.ts +2 -1
- package/dist/common/opt.d.ts +1 -0
- package/dist/common/types.d.ts +3 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-BRO5aArp.js → dom-BLbR0hEx.js} +62 -16
- package/dist/debug/{dom-Btj2QJhk.mjs → dom-Cii0IA92.mjs} +51 -17
- package/dist/debug/dom.js +7 -4
- package/dist/debug/dom.mjs +6 -5
- package/dist/debug/html.js +551 -292
- package/dist/debug/html.mjs +548 -290
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dom.d.ts +1 -0
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/signals.d.ts +3 -2
- package/dist/{dom-BSsI9OPC.js → dom-B8UEYzOz.js} +112 -84
- package/dist/{dom-B-v8Gw6T.mjs → dom-BPjLe6YU.mjs} +23 -5
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +34 -33
- package/dist/dom.mjs +6 -5
- package/dist/html/assets.d.ts +12 -6
- package/dist/html/attrs.d.ts +3 -2
- package/dist/html/compat.d.ts +10 -2
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/inlined-runtimes.d.ts +1 -1
- package/dist/html/inlined-runtimes.debug.d.ts +1 -1
- package/dist/html/serializer.d.ts +2 -1
- package/dist/html/writer.d.ts +42 -22
- package/dist/html.d.ts +2 -2
- package/dist/html.js +400 -208
- package/dist/html.mjs +399 -207
- package/dist/translator/core/html-comment.d.ts +0 -7
- package/dist/translator/core/let.d.ts +0 -5
- package/dist/translator/core/show.d.ts +2 -5
- package/dist/translator/core/style.d.ts +6 -8
- package/dist/translator/index.d.ts +9 -0
- package/dist/translator/index.js +8429 -8100
- package/dist/translator/util/binding-has-prop.d.ts +1 -1
- package/dist/translator/util/binding-prop-tree.d.ts +4 -4
- package/dist/translator/util/bindings.d.ts +135 -0
- package/dist/translator/util/body-to-text-literal.d.ts +1 -2
- package/dist/translator/util/branch-tag.d.ts +7 -7
- package/dist/translator/util/constants/binding-type.d.ts +5 -6
- package/dist/translator/util/constants/slot-kind.d.ts +14 -0
- package/dist/translator/util/constants/structure-kind.d.ts +2 -1
- package/dist/translator/util/evaluate.d.ts +11 -10
- package/dist/translator/util/finalize-references.d.ts +4 -0
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +3 -1
- package/dist/translator/util/get-declared-binding-expression.d.ts +2 -2
- package/dist/translator/util/is-core-tag.d.ts +0 -3
- package/dist/translator/util/is-only-child-in-parent.d.ts +2 -7
- package/dist/translator/util/known-tag.d.ts +10 -8
- package/dist/translator/util/module-read.d.ts +21 -0
- package/dist/translator/util/read-replacement.d.ts +3 -0
- package/dist/translator/util/reasons.d.ts +32 -0
- package/dist/translator/util/references.d.ts +68 -166
- package/dist/translator/util/runtime.d.ts +2 -0
- package/dist/translator/util/scope-accessor.d.ts +14 -0
- package/dist/translator/util/scope-read.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +52 -48
- package/dist/translator/util/set-tag-derived-from.d.ts +7 -0
- package/dist/translator/util/setup-work.d.ts +1 -2
- package/dist/translator/util/signals.d.ts +3 -5
- package/dist/translator/util/slots.d.ts +50 -0
- package/dist/translator/util/solve-reasons.d.ts +10 -0
- package/dist/translator/util/sources.d.ts +21 -0
- package/dist/translator/util/structure.d.ts +6 -2
- package/dist/translator/util/tag-facts.d.ts +21 -0
- package/dist/translator/util/tag-name-type.d.ts +4 -1
- package/dist/translator/util/translate-attrs.d.ts +2 -0
- package/dist/translator/util/translate-var.d.ts +3 -0
- package/dist/translator/util/write-guard.d.ts +12 -0
- package/dist/translator/util/writer.d.ts +3 -3
- package/dist/translator/visitors/export-declaration.d.ts +9 -0
- package/dist/translator/visitors/function.d.ts +5 -4
- package/dist/translator/visitors/import-declaration.d.ts +2 -2
- package/dist/translator/visitors/placeholder.d.ts +0 -3
- package/dist/translator/visitors/program/index.d.ts +13 -3
- package/dist/translator/visitors/referenced-identifier.d.ts +2 -1
- package/dist/translator/visitors/tag/custom-tag.d.ts +1 -1
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -3
- package/dist/translator/visitors/tag/index.d.ts +2 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +26 -12
- package/package.json +3 -3
- package/dist/translator/util/insertion-context.d.ts +0 -1
- package/dist/translator/util/is-non-html-text.d.ts +0 -3
- package/dist/translator/util/serialize-guard.d.ts +0 -11
- package/dist/translator/util/serialize-reasons.d.ts +0 -37
- package/dist/translator/util/set-tag-sections-downstream.d.ts +0 -6
|
@@ -1,103 +1,20 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type
|
|
3
|
-
import
|
|
4
|
-
import { type
|
|
2
|
+
import { type Binding, BindingType, type Getter, type ParamBinding, type ReferencedBindings } from "./bindings";
|
|
3
|
+
import { type OneMany, type Opt, type SortedOpt } from "./optional";
|
|
4
|
+
import { type Reason } from "./reasons";
|
|
5
5
|
import { type Section } from "./sections";
|
|
6
|
-
import { type SerializeKey, type SerializeReason } from "./serialize-reasons";
|
|
7
|
-
import { type Signal } from "./signals";
|
|
8
|
-
export declare const kBranchSerializeReason: unique symbol;
|
|
9
|
-
export type Aliases = undefined | Binding | {
|
|
10
|
-
[property: string]: Aliases;
|
|
11
|
-
};
|
|
12
|
-
type BindingType = BindingType.Value;
|
|
13
|
-
export { BindingType };
|
|
14
|
-
export interface Sources {
|
|
15
|
-
state: SortedOpt<Binding>;
|
|
16
|
-
param: SortedOpt<InputBinding | ParamBinding>;
|
|
17
|
-
global: true | undefined;
|
|
18
|
-
/** Serialized unconditionally; the sources still say what it reads. */
|
|
19
|
-
forced: true | undefined;
|
|
20
|
-
}
|
|
21
|
-
export declare const FORCED: Sources;
|
|
22
|
-
export declare const globalSources: Sources;
|
|
23
|
-
export interface Binding {
|
|
24
|
-
id: number;
|
|
25
|
-
uid: number;
|
|
26
|
-
name: string;
|
|
27
|
-
originalName: string | undefined;
|
|
28
|
-
type: BindingType;
|
|
29
|
-
loc: t.SourceLocation | null;
|
|
30
|
-
section: Section;
|
|
31
|
-
closureSections: SortedOpt<Section>;
|
|
32
|
-
/** The identifier of each emitted assignment to it (set in finalize). */
|
|
33
|
-
assignments: Opt<AssignedBindingExtra>;
|
|
34
|
-
/** Emitted code the graph stopped tracking still names it. */
|
|
35
|
-
untracked?: true;
|
|
36
|
-
sources: undefined | Sources;
|
|
37
|
-
/** The intersection whose work computes it, or the nearest one upstream. Set on alias roots only. */
|
|
38
|
-
upstreamIntersection: Intersection | undefined;
|
|
39
|
-
/** Complete only once `finalizeReferences` runs at program analyze exit. */
|
|
40
|
-
reads: Set<ReferencedExtra>;
|
|
41
|
-
aliases: Set<Binding>;
|
|
42
|
-
hoists: SortedOpt<Section>;
|
|
43
|
-
getters: Map<Getter["hoisted"], boolean>;
|
|
44
|
-
property: string | undefined;
|
|
45
|
-
propertyAliases: Map<string, Binding>;
|
|
46
|
-
excludeProperties: SortedOpt<string>;
|
|
47
|
-
upstreamAlias: Binding | undefined;
|
|
48
|
-
/** The value these `<for>` params iterate, by `of` or `in`. */
|
|
49
|
-
iterates: {
|
|
50
|
-
expr: t.NodeExtra;
|
|
51
|
-
type: "of" | "in";
|
|
52
|
-
} | undefined;
|
|
53
|
-
restOffset: number | undefined;
|
|
54
|
-
scopeOffset: Binding | undefined;
|
|
55
|
-
scopeAccessor: string | undefined;
|
|
56
|
-
export: string | undefined;
|
|
57
|
-
directContentExport: string | undefined;
|
|
58
|
-
/** A name declared for this value, or all of it but its `excludeProperties`
|
|
59
|
-
* (a rest element), even once pruned. */
|
|
60
|
-
declaredAlias: Binding | undefined;
|
|
61
|
-
/** The attribute tag `<for>` param a local closure holds in its section. */
|
|
62
|
-
upstreamLocal: Binding | undefined;
|
|
63
|
-
/** An attribute tag `<for>` param's local closure in each content the loop
|
|
64
|
-
* creates that reads it. */
|
|
65
|
-
localClosures: Map<Section, Binding> | undefined;
|
|
66
|
-
declared: boolean;
|
|
67
|
-
nullable: boolean;
|
|
68
|
-
/** Settled only once `finalizeReferences` runs at program analyze exit. */
|
|
69
|
-
pruned: boolean | undefined;
|
|
70
|
-
exposed: boolean;
|
|
71
|
-
forcePersist: boolean;
|
|
72
|
-
/** Binding-side counterpart of `Section.serializePropKeys`, keyed by
|
|
73
|
-
* accessor prefix (`undefined` is the plain binding key). */
|
|
74
|
-
serializePropKeys: Map<AccessorPrefix | symbol | undefined, SerializeKey> | undefined;
|
|
75
|
-
reserveSize: number;
|
|
76
|
-
}
|
|
77
|
-
export interface InputBinding extends Binding {
|
|
78
|
-
type: typeof BindingType.input;
|
|
79
|
-
}
|
|
80
|
-
export interface ParamBinding extends Binding {
|
|
81
|
-
type: typeof BindingType.param;
|
|
82
|
-
}
|
|
83
|
-
export type ReferencedBindings = SortedOpt<Binding>;
|
|
84
|
-
export type Intersection = SortedMany<Binding>;
|
|
85
6
|
interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
|
|
86
7
|
}
|
|
87
|
-
export interface
|
|
88
|
-
hoisted: Section | false;
|
|
89
|
-
invoked: boolean;
|
|
90
|
-
}
|
|
91
|
-
interface Read {
|
|
8
|
+
export interface Read {
|
|
92
9
|
binding: Binding;
|
|
93
10
|
extra: t.NodeExtra;
|
|
94
11
|
ownVar: boolean;
|
|
95
12
|
getter: Getter | undefined;
|
|
96
13
|
comparedTo: t.Node | undefined;
|
|
97
14
|
deferred: boolean;
|
|
98
|
-
|
|
15
|
+
inFunction: boolean;
|
|
99
16
|
}
|
|
100
|
-
interface ExtraRead {
|
|
17
|
+
export interface ExtraRead {
|
|
101
18
|
binding: Binding;
|
|
102
19
|
props: Opt<string>;
|
|
103
20
|
ownVar: boolean;
|
|
@@ -105,25 +22,42 @@ interface ExtraRead {
|
|
|
105
22
|
/** Set for same-section local reads: the function root that owns the read. */
|
|
106
23
|
localFn?: ReferencedFunctionExtra;
|
|
107
24
|
}
|
|
25
|
+
declare const kReferencedBindings: unique symbol;
|
|
26
|
+
declare const kLazyBindings: unique symbol;
|
|
27
|
+
declare const kGlobalBindings: unique symbol;
|
|
28
|
+
declare const kReferencedBindingsInFunction: unique symbol;
|
|
29
|
+
declare const kConstantBindingsInFunction: unique symbol;
|
|
108
30
|
declare module "@marko/compiler/dist/types" {
|
|
109
31
|
interface ProgramExtra {
|
|
110
|
-
/**
|
|
111
|
-
* for it. */
|
|
32
|
+
/** An expression reads `$global`, so HTML output declares a const for it. */
|
|
112
33
|
hasGlobalRead?: true;
|
|
113
34
|
}
|
|
35
|
+
interface MarkoTagExtra {
|
|
36
|
+
/** The dom binding the tag is addressed by: its node, marker or child
|
|
37
|
+
* scope; an only child control flow tag shares its parent's. */
|
|
38
|
+
nodeBinding?: Binding;
|
|
39
|
+
}
|
|
40
|
+
interface MarkoPlaceholderExtra {
|
|
41
|
+
/** The dom binding the placeholder's text node is held in. */
|
|
42
|
+
nodeBinding?: Binding;
|
|
43
|
+
}
|
|
114
44
|
interface NodeExtra {
|
|
115
45
|
section?: Section;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
46
|
+
[kReferencedBindings]?: ReferencedBindings;
|
|
47
|
+
[kLazyBindings]?: ReferencedBindings;
|
|
48
|
+
[kGlobalBindings]?: ReferencedBindings;
|
|
49
|
+
/** The bindings it feeds, in the order it feeds them: a call site's
|
|
50
|
+
* values feed the child template's, so no one template's order sorts them. */
|
|
51
|
+
derives?: Opt<Binding>;
|
|
121
52
|
/** The initial value of the binding it feeds, which keeps it rather than
|
|
122
53
|
* following it, so the binding derives no sources from it. */
|
|
123
54
|
initialValue?: true;
|
|
55
|
+
/** Its value has no side effect to evaluate, so an unread one can go: an
|
|
56
|
+
* expression's from `evaluate`, a tag's from its value attributes. */
|
|
57
|
+
pure?: boolean;
|
|
124
58
|
/** The tag-root `KnownExprs` of the call site that linked this expression
|
|
125
|
-
* to a
|
|
126
|
-
|
|
59
|
+
* to a derives template's binding, for dereferencing its reasons. */
|
|
60
|
+
callSiteExprs?: KnownExprs;
|
|
127
61
|
binding?: Binding;
|
|
128
62
|
assignment?: Binding;
|
|
129
63
|
assignmentTo?: Binding;
|
|
@@ -132,27 +66,31 @@ declare module "@marko/compiler/dist/types" {
|
|
|
132
66
|
/** The expression this node sits in: dropped or merged as one. */
|
|
133
67
|
exprRoot?: NodeExtra;
|
|
134
68
|
isEffect?: true;
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
|
|
69
|
+
/** Retained past render (a change handler, a native spread, a dynamic tag's
|
|
70
|
+
* input), so client code may read a value here as it is, a function too. */
|
|
71
|
+
retained?: true;
|
|
72
|
+
/** Consumed where it is written (a handler its tag attaches, an
|
|
73
|
+
* effect's callback, a key function), so it reaches no client as is. */
|
|
74
|
+
consumed?: true;
|
|
75
|
+
/** Any function it holds is only ever invoked, never read as a value, so
|
|
76
|
+
* the reads inside resolve when it runs. */
|
|
138
77
|
invokeOnly?: true;
|
|
139
|
-
lazyBindings?: ReferencedBindings;
|
|
140
|
-
/** `$global` bindings this expression reads: the root means an opaque
|
|
141
|
-
* (dynamic/aliased) read, a property alias names the key. */
|
|
142
|
-
globalBindings?: ReferencedBindings;
|
|
143
78
|
/** The bindings this expression reads only by spreading them as is. */
|
|
144
79
|
spreadFrom?: SortedOpt<Binding>;
|
|
145
|
-
|
|
80
|
+
/** A `content` it spreads is rendered (as the element's body, or as a
|
|
81
|
+
* `<meta>`'s attribute), so its effect never reads it. */
|
|
82
|
+
rendersContent?: true;
|
|
146
83
|
merged?: NodeExtra;
|
|
147
84
|
}
|
|
148
85
|
interface FunctionExtra {
|
|
149
86
|
referencesScope?: boolean;
|
|
150
|
-
|
|
87
|
+
[kReferencedBindingsInFunction]?: ReferencedBindings;
|
|
151
88
|
referencedLocalBindingsInFunction?: SortedOpt<Binding>;
|
|
152
|
-
|
|
89
|
+
[kConstantBindingsInFunction]?: ReferencedBindings;
|
|
153
90
|
name?: string;
|
|
154
91
|
registerId?: string;
|
|
155
|
-
|
|
92
|
+
/** When client code reads the function itself, which registers it. */
|
|
93
|
+
reason?: Reason;
|
|
156
94
|
exportRegisterId?: string;
|
|
157
95
|
}
|
|
158
96
|
interface ArrowFunctionExpressionExtra extends FunctionExtra {
|
|
@@ -162,69 +100,28 @@ declare module "@marko/compiler/dist/types" {
|
|
|
162
100
|
interface FunctionExpressionExtra extends FunctionExtra {
|
|
163
101
|
}
|
|
164
102
|
}
|
|
165
|
-
export declare function
|
|
166
|
-
export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
|
|
167
|
-
export declare function getPropertyAlias(binding: Binding | undefined, properties: Opt<string>): Binding | undefined;
|
|
168
|
-
export declare function isTagVarRead(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
103
|
+
export declare function isTagVarUsed(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
169
104
|
export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): Binding | undefined;
|
|
170
|
-
export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType,
|
|
105
|
+
export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, aliased?: Binding["aliasOf"]): Binding | undefined;
|
|
171
106
|
export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
|
|
172
107
|
export declare function isReferenceInOwnBody(bindingPath: t.NodePath, reference: t.NodePath): boolean;
|
|
173
108
|
export declare function isReferenceHoisted(bindingPath: t.NodePath, reference: t.NodePath): boolean;
|
|
109
|
+
export declare function assertReferencedInRender(ref: t.NodePath, name: string, markoRoot?: import("./get-root").MarkoExprRootPath | null): void;
|
|
174
110
|
export declare function setReferencesScope(path: t.NodePath<any>): void;
|
|
175
111
|
export declare function trackGlobalReference(path: t.NodePath<t.Identifier>): void;
|
|
176
112
|
export declare function mergeReferences<T extends t.Node>(section: Section, target: T, nodes: (t.Node | undefined)[]): NonNullable<T["extra"]> & ReferencedExtra;
|
|
177
|
-
export declare function
|
|
178
|
-
export declare function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
type IntersectionMeta = {
|
|
184
|
-
source: Binding;
|
|
185
|
-
id?: undefined;
|
|
186
|
-
scopeOffset?: undefined;
|
|
187
|
-
} | {
|
|
188
|
-
source: undefined;
|
|
189
|
-
id: number;
|
|
190
|
-
scopeOffset: Binding | undefined;
|
|
191
|
-
};
|
|
192
|
-
export declare const intersectionMeta: WeakMap<Intersection, IntersectionMeta>;
|
|
193
|
-
export declare function setBindingDownstream(binding: Binding, expr: boolean | Opt<t.NodeExtra>, exprs?: KnownExprs): void;
|
|
194
|
-
export declare function createSources(state: Sources["state"], param: Sources["param"], global?: Sources["global"], forced?: Sources["forced"]): Sources;
|
|
195
|
-
export declare function compareSources(a: Sources, b: Sources): number;
|
|
196
|
-
export declare function mergeSources(a: undefined | Sources, b: undefined | Sources): Sources | undefined;
|
|
197
|
-
export declare const bindingUtil: Sorted<Binding>;
|
|
198
|
-
export declare const propsUtil: Sorted<string>;
|
|
113
|
+
export declare function mergeReferenceGroup(section: Section, nodes: (t.Node | undefined)[]): ReferencedExtra;
|
|
114
|
+
export declare function setDerivedFrom(binding: Binding, expr: boolean | Opt<t.NodeExtra>, exprs?: KnownExprs): void;
|
|
115
|
+
export declare const getAssignments: () => AssignedBindingExtra[];
|
|
116
|
+
export declare const getReadsByExpression: () => Map<ReferencedExtra, Opt<Read>>;
|
|
117
|
+
export declare const getFunctionReadsByExpression: () => Map<ReferencedExtra, Map<ReferencedFunctionExtra, OneMany<Read>>>;
|
|
118
|
+
export declare const getReferenceFinalizers: () => (() => void)[];
|
|
199
119
|
export declare function onFinalizeReferences(finalize: () => void): void;
|
|
200
|
-
export declare function getExpressionReads(exprExtra: ReferencedExtra): Opt<Read>;
|
|
201
120
|
export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
|
|
202
121
|
export declare function dropNodes(node: t.Node | t.Node[]): void;
|
|
203
|
-
export declare function
|
|
122
|
+
export declare function dropExtra(exprExtra: ReferencedExtra): void;
|
|
204
123
|
export declare function dropContent(body: t.MarkoTagBody): void;
|
|
205
|
-
export declare function getCanonicalBinding(binding: Binding): Binding;
|
|
206
|
-
export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
|
|
207
|
-
export declare function someUpstream<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
|
|
208
|
-
export declare function isDirectAlias(binding: Binding): boolean;
|
|
209
124
|
export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
|
|
210
|
-
export declare function getScopeAccessorLiteral(binding: Binding, encoded?: boolean, includeId?: boolean): t.NumericLiteral | t.StringLiteral;
|
|
211
|
-
export declare function getScopeAccessor(binding: Binding, encoded?: boolean, includeId?: boolean): string;
|
|
212
|
-
export declare function getLocalsScopeAccessor(binding: Binding): string;
|
|
213
|
-
export declare function getPrefixedScopeAccessor(binding: Binding, prefix: AccessorPrefix): string;
|
|
214
|
-
export declare function getClosureAccessorLiteral(binding: Binding): t.NumericLiteral | t.StringLiteral;
|
|
215
|
-
export declare function getDebugScopeAccess(binding: Binding): {
|
|
216
|
-
root: Binding;
|
|
217
|
-
access: string;
|
|
218
|
-
};
|
|
219
|
-
export declare function getDebugName(binding: Binding): string;
|
|
220
|
-
export declare function getDebugNames(refs: ReferencedBindings): string;
|
|
221
|
-
export declare function getDebugNamesAsIdentifier(refs: ReferencedBindings): string;
|
|
222
|
-
export declare function getSectionInstancesAccessor(section: Section): string;
|
|
223
|
-
export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral;
|
|
224
|
-
export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression, signal?: Signal): t.Expression | undefined;
|
|
225
|
-
export declare function isInvokeOnlyBinding(binding: Binding): boolean;
|
|
226
|
-
export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
|
|
227
|
-
export declare function pruneBinding(binding: Binding, settled?: true): boolean;
|
|
228
125
|
export declare function createRead(binding: Binding, props: Opt<string>, ownVar?: boolean): ExtraRead;
|
|
229
126
|
export declare function createGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ExtraRead;
|
|
230
127
|
export interface ReferencedExtra extends t.NodeExtra {
|
|
@@ -242,16 +139,21 @@ export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined):
|
|
|
242
139
|
export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
|
|
243
140
|
name: string;
|
|
244
141
|
registerId: string;
|
|
245
|
-
|
|
142
|
+
reason: Reason;
|
|
246
143
|
}
|
|
247
144
|
export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
|
|
145
|
+
export declare function getReferencedBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
|
|
146
|
+
export declare function getLazyBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
|
|
147
|
+
export declare function getGlobalBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
|
|
148
|
+
export declare function getReferencedBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
|
|
149
|
+
export declare function getConstantBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
|
|
150
|
+
export declare function setResolvedFunctionReads(extra: t.FunctionExtra, referencedBindings: ReferencedBindings, constantBindings: ReferencedBindings): void;
|
|
151
|
+
export declare function setResolvedReads(extra: ReferencedExtra, referencedBindings: ReferencedBindings, lazyBindings: ReferencedBindings, globalBindings: ReferencedBindings): void;
|
|
248
152
|
export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
|
|
249
|
-
export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra): undefined | SerializeReason;
|
|
250
|
-
export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true): undefined | SerializeReason;
|
|
251
|
-
export declare function getRegisterReasonForExtra(extra: t.NodeExtra): undefined | SerializeReason;
|
|
252
153
|
export interface KnownExprs {
|
|
253
154
|
known?: Record<string, KnownExprs>;
|
|
254
155
|
value?: t.NodeExtra;
|
|
255
156
|
}
|
|
256
|
-
export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: boolean | Opt<
|
|
257
|
-
export declare function mapParamBindingToExpr(exprs: KnownExprs, binding:
|
|
157
|
+
export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: boolean | Opt<ParamBinding>): true | import("./optional").Many<t.NodeExtra> | t.NodeExtra | undefined;
|
|
158
|
+
export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamBinding): Opt<t.NodeExtra>;
|
|
159
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import type { Falsy } from "../../common/types";
|
|
3
3
|
import { _attr, _attr_class, _attr_style, _escape, _escape_script, _escape_style, _unescaped } from "../../html";
|
|
4
|
+
import { escapeDoubleQuotedAttrValue } from "../../html/attrs";
|
|
4
5
|
export type DOMRuntimeHelpers = keyof typeof import("../../dom");
|
|
5
6
|
export type HTMLRuntimeHelpers = keyof typeof import("../../html");
|
|
6
7
|
export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.Identifier;
|
|
@@ -19,6 +20,7 @@ export declare function getHTMLRuntime(): {
|
|
|
19
20
|
_attr_style: typeof _attr_style;
|
|
20
21
|
_escape_script: typeof _escape_script;
|
|
21
22
|
_escape_style: typeof _escape_style;
|
|
23
|
+
escapeDoubleQuotedAttrValue: typeof escapeDoubleQuotedAttrValue;
|
|
22
24
|
};
|
|
23
25
|
export declare function getRuntimePath(output: string): string;
|
|
24
26
|
export declare function getCompatRuntimeFile(): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type AccessorPrefix } from "../../common/accessor.debug";
|
|
3
|
+
import { type Binding } from "./bindings";
|
|
4
|
+
import { type Section } from "./sections";
|
|
5
|
+
import { type PlaceSlot } from "./slots";
|
|
6
|
+
export declare function getSlotAccessor(slot: PlaceSlot): string;
|
|
7
|
+
export declare function getScopeOffsetAccessorLiteral(nodeBinding: Binding, encoded?: boolean): t.NumericLiteral | t.StringLiteral;
|
|
8
|
+
export declare function getScopeAccessorLiteral(binding: Binding, encoded?: boolean, includeId?: boolean): t.NumericLiteral | t.StringLiteral;
|
|
9
|
+
export declare function getScopeAccessor(binding: Binding, encoded?: boolean, includeId?: boolean): string;
|
|
10
|
+
export declare function getLocalsScopeAccessor(binding: Binding): string;
|
|
11
|
+
export declare function getPrefixedScopeAccessor(binding: Binding, prefix: AccessorPrefix): string;
|
|
12
|
+
export declare function getClosureAccessorLiteral(binding: Binding): t.NumericLiteral | t.StringLiteral;
|
|
13
|
+
export declare function getSectionInstancesAccessor(section: Section): string;
|
|
14
|
+
export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type Binding } from "./
|
|
2
|
+
import { type Binding } from "./bindings";
|
|
3
3
|
import type { Section } from "./sections";
|
|
4
4
|
export declare function getScopeExpression(section: Section, targetSection: Section): t.Identifier | t.MemberExpression;
|
|
5
5
|
export declare function createScopeReadExpression(reference: Binding, section?: Section): t.MemberExpression;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import type
|
|
3
|
-
import type { WalkCode } from "../../common/types";
|
|
2
|
+
import { type Binding, type Intersection, type IntersectionMeta, type ParamBinding, type ReferencedBindings } from "./bindings";
|
|
4
3
|
import * as ContentType from "./constants/content-type";
|
|
5
4
|
import type * as Step from "./constants/step";
|
|
6
5
|
import * as StructureKind from "./constants/structure-kind";
|
|
7
6
|
import { type OneMany, type Opt, Sorted, type SortedOpt } from "./optional";
|
|
8
|
-
import { type
|
|
9
|
-
import { type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type ParamSerializeReasonGroups = [
|
|
15
|
-
ParamSerializeReasonGroup,
|
|
16
|
-
...ParamSerializeReasonGroup[]
|
|
17
|
-
];
|
|
7
|
+
import { type Reason } from "./reasons";
|
|
8
|
+
import { type KnownExprs } from "./references";
|
|
9
|
+
import { type Slot } from "./slots";
|
|
10
|
+
import { type Sources } from "./sources";
|
|
11
|
+
export type ParamReasonGroup = NonNullable<Sources["param"]>;
|
|
12
|
+
export type ParamReasonGroups = [ParamReasonGroup, ...ParamReasonGroup[]];
|
|
18
13
|
type ContentType = ContentType.Value;
|
|
19
14
|
export { ContentType, StructureKind };
|
|
20
15
|
export type StructureRef = StructureSectionRef | StructureExportRef;
|
|
@@ -28,63 +23,63 @@ export interface StructureExportRef {
|
|
|
28
23
|
path: string;
|
|
29
24
|
hint: string;
|
|
30
25
|
}
|
|
31
|
-
export type StructureOp = string | Step.Value | StructureText |
|
|
26
|
+
export type StructureOp = string | Step.Value | StructureText | StructureNode | StructureChild | StructureModuleRead;
|
|
32
27
|
export interface StructureText {
|
|
33
28
|
kind: typeof StructureKind.Text;
|
|
34
29
|
value: string;
|
|
35
30
|
}
|
|
36
|
-
export interface
|
|
37
|
-
kind: typeof StructureKind.
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
export interface StructureNode {
|
|
32
|
+
kind: typeof StructureKind.Node;
|
|
33
|
+
binding: Binding | undefined;
|
|
34
|
+
marker: boolean;
|
|
40
35
|
}
|
|
41
36
|
export interface StructureChild {
|
|
42
37
|
kind: typeof StructureKind.Child;
|
|
43
38
|
name: string;
|
|
44
|
-
|
|
39
|
+
binding: Binding;
|
|
45
40
|
renderer?: StructureRef;
|
|
46
41
|
}
|
|
42
|
+
export interface StructureModuleRead {
|
|
43
|
+
kind: typeof StructureKind.ModuleRead;
|
|
44
|
+
read: string[];
|
|
45
|
+
}
|
|
47
46
|
export interface Section {
|
|
48
47
|
id: number;
|
|
49
48
|
name: string;
|
|
50
49
|
loc: t.SourceLocation | undefined;
|
|
51
50
|
depth: number;
|
|
52
51
|
parent: Section | undefined;
|
|
52
|
+
children: Section[];
|
|
53
53
|
program: Section;
|
|
54
|
-
|
|
55
|
-
binding: Binding;
|
|
56
|
-
prefix: AccessorPrefix;
|
|
57
|
-
} | undefined;
|
|
58
|
-
params: undefined | ParamBinding | InputBinding;
|
|
54
|
+
params: undefined | ParamBinding;
|
|
59
55
|
/** The attribute tag `<for>` params this content reads, held as its own
|
|
60
56
|
* bindings that the loop binds as it creates it. */
|
|
61
57
|
localClosures: ReferencedBindings;
|
|
62
58
|
referencedClosures: ReferencedBindings;
|
|
63
|
-
referencedHoists: ReferencedBindings;
|
|
64
59
|
bindings: ReferencedBindings;
|
|
65
60
|
hoisted: ReferencedBindings;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
/** The closures its `<for>` rows read only by comparing them to the row's
|
|
62
|
+
* key, which a row selector updates. */
|
|
63
|
+
selector: {
|
|
64
|
+
key: Binding;
|
|
65
|
+
closures: Set<Binding>;
|
|
66
|
+
} | undefined;
|
|
67
|
+
/** The canonical intersections its work waits on, once ids allocate. */
|
|
68
|
+
intersections: Map<Intersection, IntersectionMeta> | undefined;
|
|
69
|
+
/** The slots of its scope, its own and its bindings'. */
|
|
70
|
+
slots: SortedOpt<Slot>;
|
|
71
|
+
/** When client code reads anything in its scope: its slots' reasons merged. */
|
|
72
|
+
reason: undefined | Reason;
|
|
73
|
+
paramReasonGroups: ParamReasonGroups | undefined;
|
|
78
74
|
returnValueExpr: t.NodeExtra | undefined;
|
|
79
|
-
returnSerializeReason: SerializeReason | undefined;
|
|
80
75
|
isHoistThrough: true | undefined;
|
|
81
|
-
|
|
76
|
+
branchExpr: t.NodeExtra | undefined;
|
|
82
77
|
/** For a `<define>` body or a template rendering itself, the sections whose
|
|
83
78
|
* direct calls render it. */
|
|
84
79
|
callSections: SortedOpt<Section>;
|
|
85
80
|
/** The content's rendering tag (its extra), and each child binding the
|
|
86
81
|
* content feeds, at `properties`. */
|
|
87
|
-
|
|
82
|
+
derives: {
|
|
88
83
|
tag: t.MarkoTagExtra;
|
|
89
84
|
binding: OneMany<Binding>;
|
|
90
85
|
properties: Opt<string>;
|
|
@@ -94,13 +89,20 @@ export interface Section {
|
|
|
94
89
|
pruned: boolean;
|
|
95
90
|
hasAbortSignal: boolean;
|
|
96
91
|
/** Count of distinct `$signal` expression roots; analyze allocates each
|
|
97
|
-
* root's
|
|
92
|
+
* root's abort id from this so translates read, never re-derive. */
|
|
98
93
|
abortSignalExprs: number;
|
|
99
94
|
readsOwner: boolean;
|
|
100
95
|
/** Whether analysis found work keyed by setup in the section, or in a
|
|
101
96
|
* `<define>` body or template it calls in place. */
|
|
102
97
|
hasSetupWork: boolean;
|
|
103
|
-
|
|
98
|
+
/** Its tag, which renders it in place into branch scopes at the tag's node
|
|
99
|
+
* binding, and whether its branch expression's value can leave it unrendered. */
|
|
100
|
+
branch: {
|
|
101
|
+
nodeBinding: Binding;
|
|
102
|
+
optional: boolean;
|
|
103
|
+
/** An `<if>` branch's place in its chain, the renderer index it renders as. */
|
|
104
|
+
index?: number;
|
|
105
|
+
} | undefined;
|
|
104
106
|
content: null | {
|
|
105
107
|
startType: ContentType;
|
|
106
108
|
endType: ContentType;
|
|
@@ -124,15 +126,16 @@ export declare function getSectionForBody(body: t.NodePath<t.MarkoTagBody | t.Pr
|
|
|
124
126
|
export declare function removePrunedContent(tag: t.NodePath<t.MarkoTag>): void;
|
|
125
127
|
export declare function getSection(path: t.NodePath): Section;
|
|
126
128
|
export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
|
|
127
|
-
export declare const getSectionParentIsOwner: (section: Section) => boolean, setSectionParentIsOwner: (section: Section, value: boolean) => void;
|
|
128
129
|
export declare const getBranchRendererArgs: (section: Section) => [template?: t.Expression | undefined, walks?: t.Expression | undefined, setup?: t.Expression | undefined, params?: t.Expression | undefined], setBranchRendererArgs: (section: Section, value: [template?: t.Expression | undefined, walks?: t.Expression | undefined, setup?: t.Expression | undefined, params?: t.Expression | undefined]) => void;
|
|
129
130
|
export declare function forEachSection(fn: (section: Section) => void): void;
|
|
130
|
-
export declare function getChildSections(section: Section): Section[];
|
|
131
131
|
export declare function getContentClosures(section: Section): ReferencedBindings;
|
|
132
132
|
export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
|
|
133
133
|
export declare function forEachSectionReverse(fn: (section: Section) => void): void;
|
|
134
134
|
export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType.Value | null;
|
|
135
|
-
export declare function
|
|
135
|
+
export declare function getRendererReason(section: Section): boolean | Sources;
|
|
136
|
+
export declare function isResumedBranch(section: Section): section is Section & {
|
|
137
|
+
branch: NonNullable<Section["branch"]>;
|
|
138
|
+
};
|
|
136
139
|
export declare function isImmediateOwner(section: Section, binding: Binding): boolean;
|
|
137
140
|
export declare function isDirectClosure(section: Section, closure: Binding): boolean;
|
|
138
141
|
export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
|
|
@@ -140,7 +143,8 @@ export declare function getDynamicClosureIndex(closure: Binding, closureSection:
|
|
|
140
143
|
export declare function getDirectClosures(section: Section): SortedOpt<Binding>;
|
|
141
144
|
export declare function isSameOrChildSection(section: Section, other: Section): boolean;
|
|
142
145
|
export declare function getCommonSection(section: Section, other: Section): Section;
|
|
143
|
-
export declare function
|
|
144
|
-
export declare function ensureReasonGroups(reason: Section["
|
|
145
|
-
export declare function getParamReasonGroupIndex(section: Section,
|
|
146
|
-
export declare function groupParamsBySection(params: Sources["param"]): Map<Section, import("./optional").SortedOneMany<
|
|
146
|
+
export declare function finalizeParamReasonGroups(section: Section): void;
|
|
147
|
+
export declare function ensureReasonGroups(reason: Section["reason"]): void;
|
|
148
|
+
export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
149
|
+
export declare function groupParamsBySection(params: Sources["param"]): Map<Section, import("./optional").SortedOneMany<ParamBinding>>;
|
|
150
|
+
export declare function setReadsOwner(from: Section, to: Section): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type Binding } from "./bindings";
|
|
3
|
+
import { type Opt } from "./optional";
|
|
4
|
+
import { type KnownExprs } from "./references";
|
|
5
|
+
import { type Section } from "./sections";
|
|
6
|
+
export declare function setTagDerivedFrom(tag: t.NodePath<t.MarkoTag>, binding: Opt<Binding>, exprs?: KnownExprs): void;
|
|
7
|
+
export declare function finalizeTagDerivations(section: Section): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Section } from "./sections";
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function addSetupExpr(section: Section, node: t.Node | undefined): void;
|
|
3
|
+
export declare function addSetupExpr(section: Section, node?: t.Node): void;
|
|
5
4
|
export declare function finalizeSetupWork(): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type
|
|
2
|
+
import { type Binding, type Getter, type ReferencedBindings } from "./bindings";
|
|
3
3
|
import { type Opt } from "./optional";
|
|
4
|
-
import { type Binding, type Getter, type ReferencedBindings } from "./references";
|
|
5
4
|
import { type Section } from "./sections";
|
|
5
|
+
import { type PlaceSlot } from "./slots";
|
|
6
6
|
export interface Signal {
|
|
7
7
|
identifier: t.Identifier;
|
|
8
8
|
referencedBindings: ReferencedBindings;
|
|
@@ -40,10 +40,8 @@ export declare function getContentClosureValues(bodySection: Section): {
|
|
|
40
40
|
scope: t.Identifier;
|
|
41
41
|
levels: t.Expression[];
|
|
42
42
|
} | undefined;
|
|
43
|
-
export declare function
|
|
44
|
-
export declare function setBindingSerializedValue(section: Section, binding: Binding, expression: t.Expression, prefix?: AccessorPrefix): void;
|
|
43
|
+
export declare function setScopeProperty(found: PlaceSlot | undefined, expression: t.Expression): string | undefined;
|
|
45
44
|
export declare function setSectionDebugVar(section: Section, accessor: string, name: string, loc: t.SourceLocation | null | undefined): void;
|
|
46
|
-
export declare function setSerializedValue(section: Section, key: string, expression: t.Expression): void;
|
|
47
45
|
export declare function addWriteScopeBuilder(section: Section, builder: (writeCall: t.Expression) => t.Expression): void;
|
|
48
46
|
export declare const getHTMLSectionStatements: (section: Section) => t.Statement[];
|
|
49
47
|
export declare function getBindingGetterIdentifier(binding: Binding, getterSection: Getter["hoisted"]): t.Identifier;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type Binding } from "./bindings";
|
|
3
|
+
import * as SlotKind from "./constants/slot-kind";
|
|
4
|
+
import { type Opt } from "./optional";
|
|
5
|
+
import { type Reason } from "./reasons";
|
|
6
|
+
import { type ParamReasonGroup, type Section } from "./sections";
|
|
7
|
+
type SlotKind = SlotKind.Value;
|
|
8
|
+
export { SlotKind };
|
|
9
|
+
export type BindingSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.BranchExpr | typeof SlotKind.ParamGroup;
|
|
10
|
+
export type SectionSlotKind = Exclude<SlotKind, BindingSlotKind>;
|
|
11
|
+
export type PlaceSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.Owner | typeof SlotKind.ReturnChangeHandler | typeof SlotKind.Instances;
|
|
12
|
+
/** A place in a scope that client code may read after resume, or a fact about
|
|
13
|
+
* one a guard decides on (a condition changing, a branch or group resuming). */
|
|
14
|
+
export type Slot = BindingSlot | SectionSlot;
|
|
15
|
+
export type PlaceSlot = Slot & {
|
|
16
|
+
kind: PlaceSlotKind;
|
|
17
|
+
};
|
|
18
|
+
interface BaseSlot {
|
|
19
|
+
/** The scope it is in. */
|
|
20
|
+
section: Section;
|
|
21
|
+
/** The sources whose changes lead client code to read it after resume,
|
|
22
|
+
* unset while nothing does. */
|
|
23
|
+
reason: Reason | undefined;
|
|
24
|
+
/** The expressions it holds or renders, whose sources its reason takes once
|
|
25
|
+
* references finalize. */
|
|
26
|
+
reasonExprs: Opt<t.NodeExtra>;
|
|
27
|
+
}
|
|
28
|
+
export interface BindingSlot extends BaseSlot {
|
|
29
|
+
kind: BindingSlotKind;
|
|
30
|
+
/** A canonical binding. */
|
|
31
|
+
owner: Binding;
|
|
32
|
+
/** The group it guards, for a param group. */
|
|
33
|
+
group: ParamReasonGroup | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface SectionSlot extends BaseSlot {
|
|
36
|
+
kind: SectionSlotKind;
|
|
37
|
+
owner: Section;
|
|
38
|
+
group: undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare function getSlot(binding: Binding, kind?: BindingSlotKind, section?: Section, group?: ParamReasonGroup): Slot;
|
|
41
|
+
export declare function findSlot(binding: Binding): (BindingSlot & {
|
|
42
|
+
kind: typeof SlotKind.Value;
|
|
43
|
+
}) | undefined;
|
|
44
|
+
export declare function findSlot<K extends BindingSlotKind>(binding: Binding, kind: K, section?: Section, group?: ParamReasonGroup): (BindingSlot & {
|
|
45
|
+
kind: K;
|
|
46
|
+
}) | undefined;
|
|
47
|
+
export declare function getSectionSlot(owner: Section, kind: SectionSlotKind, section?: Section): Slot;
|
|
48
|
+
export declare function findSectionSlot<K extends SectionSlotKind>(owner: Section, kind: K, section?: Section): (SectionSlot & {
|
|
49
|
+
kind: K;
|
|
50
|
+
}) | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type Binding, type Intersection } from "./bindings";
|
|
3
|
+
import { type Opt } from "./optional";
|
|
4
|
+
import { type Reason } from "./reasons";
|
|
5
|
+
import { type Section } from "./sections";
|
|
6
|
+
export declare function solveReasons(intersectionsBySection: Map<Section, Intersection[]>): void;
|
|
7
|
+
export declare function getReasonForBinding(binding: Binding, properties?: Opt<string> | true): undefined | Reason;
|
|
8
|
+
export declare function getValueReason(extra: t.NodeExtra): undefined | Reason;
|
|
9
|
+
export declare function readsValuesOnResume(expr: t.NodeExtra): boolean;
|
|
10
|
+
export declare function addAlwaysRead(binding: Binding): void;
|