marko 6.3.50 → 6.3.52

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.
Files changed (67) hide show
  1. package/dist/debug/dom/catch.feat.js +1 -1
  2. package/dist/debug/dom/catch.feat.mjs +1 -1
  3. package/dist/debug/dom/controllable-input.feat.js +1 -1
  4. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-open.feat.js +1 -1
  6. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-select.feat.js +1 -1
  8. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable.feat.js +1 -1
  12. package/dist/debug/dom/controllable.feat.mjs +1 -1
  13. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  14. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  15. package/dist/debug/dom/placeholder.feat.js +2 -2
  16. package/dist/debug/dom/placeholder.feat.mjs +2 -2
  17. package/dist/debug/{dom-BAGeiafn.js → dom-BJKb8-wr.js} +22 -27
  18. package/dist/debug/{dom-C55iHvof.mjs → dom-Dq_Yu7MS.mjs} +19 -18
  19. package/dist/debug/dom.js +10 -10
  20. package/dist/debug/dom.mjs +10 -10
  21. package/dist/debug/html.js +56 -40
  22. package/dist/debug/html.mjs +56 -40
  23. package/dist/dom/catch.feat.js +3 -3
  24. package/dist/dom/catch.feat.mjs +1 -1
  25. package/dist/dom/controllable-input.feat.js +1 -1
  26. package/dist/dom/controllable-input.feat.mjs +1 -1
  27. package/dist/dom/controllable-open.feat.js +1 -1
  28. package/dist/dom/controllable-open.feat.mjs +1 -1
  29. package/dist/dom/controllable-select.feat.js +1 -1
  30. package/dist/dom/controllable-select.feat.mjs +1 -1
  31. package/dist/dom/controllable-textarea.feat.js +1 -1
  32. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  33. package/dist/dom/controllable.feat.js +1 -1
  34. package/dist/dom/controllable.feat.mjs +1 -1
  35. package/dist/dom/dynamic-tag-var.feat.js +3 -2
  36. package/dist/dom/dynamic-tag-var.feat.mjs +4 -3
  37. package/dist/dom/placeholder.feat.js +3 -3
  38. package/dist/dom/placeholder.feat.mjs +2 -2
  39. package/dist/dom/resume.d.ts +1 -2
  40. package/dist/{dom-BNmfm4st.js → dom-CzGPOsST.js} +62 -71
  41. package/dist/{dom-BsAS26Ze.mjs → dom-CzfddxCE.mjs} +15 -19
  42. package/dist/dom.d.ts +1 -1
  43. package/dist/dom.js +30 -30
  44. package/dist/dom.mjs +10 -10
  45. package/dist/html/template.d.ts +3 -1
  46. package/dist/html/writer.d.ts +6 -1
  47. package/dist/html.js +40 -25
  48. package/dist/html.mjs +40 -25
  49. package/dist/translator/core/await.d.ts +0 -7
  50. package/dist/translator/core/try.d.ts +0 -7
  51. package/dist/translator/index.d.ts +1 -1
  52. package/dist/translator/index.js +1893 -1658
  53. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  54. package/dist/translator/util/cyclic-memo.d.ts +4 -0
  55. package/dist/translator/util/evaluate.d.ts +2 -0
  56. package/dist/translator/util/optional.d.ts +21 -7
  57. package/dist/translator/util/references.d.ts +53 -21
  58. package/dist/translator/util/runtime.d.ts +3 -1
  59. package/dist/translator/util/sections.d.ts +10 -11
  60. package/dist/translator/util/serialize-guard.d.ts +10 -0
  61. package/dist/translator/util/serialize-reasons.d.ts +10 -11
  62. package/dist/translator/util/set-tag-sections-downstream.d.ts +3 -2
  63. package/dist/translator/util/tag-name-type.d.ts +8 -3
  64. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -2
  65. package/index.d.ts +0 -5
  66. package/package.json +3 -3
  67. package/tags-html.d.ts +2 -0
@@ -1,4 +1,4 @@
1
- import type { Opt } from "./optional";
1
+ import { type Opt } from "./optional";
2
2
  import type { Binding } from "./references";
3
3
  import type { Section } from "./sections";
4
4
  export declare function isSectionRendererElided(section: Section): boolean;
@@ -0,0 +1,4 @@
1
+ import { type Opt } from "./optional";
2
+ export declare function createCyclicMemo<K extends object, R>(compute: (key: K) => R, cycleAnswer: R): (key: K) => R;
3
+ export type MemoPath = Opt<string> | true;
4
+ export declare function createCyclicPathMemo<K extends object, R>(compute: (key: K, path: MemoPath) => R, cycleAnswer: R): (key: K, path: MemoPath) => R;
@@ -4,6 +4,8 @@ declare module "@marko/compiler/dist/types" {
4
4
  confident?: boolean;
5
5
  computed?: unknown;
6
6
  nullable?: boolean;
7
+ /** Evaluating it has no side effects, so an unread value can go. */
8
+ pure?: boolean;
7
9
  }
8
10
  }
9
11
  export default function evaluate<T extends t.Expression>(value: T): T["extra"] & {
@@ -2,16 +2,23 @@ export type Many<T> = [T, T, ...T[]];
2
2
  export type OneMany<T> = T | Many<T>;
3
3
  export type Opt<T> = undefined | OneMany<T>;
4
4
  export type Compare<T> = (a: T, b: T) => number;
5
+ declare const kSorted: unique symbol;
6
+ export type SortedMany<T> = Many<T> & {
7
+ readonly [kSorted]: true;
8
+ };
9
+ export type SortedOneMany<T> = T | SortedMany<T>;
10
+ export type SortedOpt<T> = undefined | SortedOneMany<T>;
5
11
  export declare class Sorted<T> {
6
12
  compare: Compare<T>;
7
13
  constructor(compare: Compare<T>);
8
- add<U extends NonNullable<T>>(data: Opt<U>, item: U): OneMany<U>;
9
- union<U extends NonNullable<T>>(a: Opt<U>, b: Opt<U>): Opt<U>;
10
- find<U extends NonNullable<T>>(data: Opt<U>, item: U): U | undefined;
11
- has<U extends NonNullable<T>>(data: Opt<U>, item: U): boolean;
12
- findIndex<U extends NonNullable<T>>(data: Opt<U>, item: U): number;
13
- groupBy<U extends NonNullable<T>, K>(data: Opt<U>, cb: (item: U) => K): Map<K, OneMany<U>>;
14
- isSuperset<U extends NonNullable<T>>(superset: Opt<U>, subset: Opt<U>): boolean;
14
+ add<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): SortedOneMany<U>;
15
+ union<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): SortedOpt<U>;
16
+ filter<U extends NonNullable<T>>(data: SortedOpt<U>, cb: (item: U) => boolean): SortedOpt<U>;
17
+ find<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): U | undefined;
18
+ has<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): boolean;
19
+ findIndex<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): number;
20
+ groupBy<U extends NonNullable<T>, K>(data: SortedOpt<U>, cb: (item: U) => K): Map<K, SortedOneMany<U>>;
21
+ isSuperset<U extends NonNullable<T>>(superset: SortedOpt<U>, subset: SortedOpt<U>): boolean;
15
22
  }
16
23
  export declare function push<T>(data: Opt<T>, item: T): OneMany<T>;
17
24
  export declare function concat<T>(a: Opt<T>, b: Opt<T>): Opt<T>;
@@ -24,8 +31,15 @@ export declare function includes<T>(data: Opt<T>, item: T): boolean;
24
31
  export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
25
32
  export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
26
33
  export declare function every<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
34
+ export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item: T, index: number) => R | undefined): R | undefined;
35
+ export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
27
36
  export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
28
37
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
29
38
  export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
30
39
  export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
31
40
  export declare function addSorted<T, U extends T[]>(compare: Compare<T>, data: U, item: T): U;
41
+ export declare function addUnique<T>(data: Opt<T>, item: T): OneMany<T>;
42
+ export declare function at<T>(data: Opt<T>, index: number): T | undefined;
43
+ export declare function first<T>(data: OneMany<T>): T;
44
+ export declare function rest<T>(data: OneMany<T>): Opt<T>;
45
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import type { AccessorPrefix } from "../../common/accessor.debug";
3
3
  import * as BindingType from "./constants/binding-type";
4
- import { type Many, type Opt, Sorted } from "./optional";
4
+ import { type Many, type Opt, type SortedMany, type SortedOpt, Sorted } from "./optional";
5
5
  import { type Section } from "./sections";
6
6
  import { type SerializeKey, type SerializeReason } from "./serialize-reasons";
7
7
  import { type Signal } from "./signals";
@@ -12,10 +12,13 @@ export type Aliases = undefined | Binding | {
12
12
  type BindingType = BindingType.Value;
13
13
  export { BindingType };
14
14
  export interface Sources {
15
- state: Opt<Binding>;
16
- param: Opt<InputBinding | ParamBinding>;
15
+ state: SortedOpt<Binding>;
16
+ param: SortedOpt<InputBinding | ParamBinding>;
17
17
  global: true | undefined;
18
+ /** Serialized unconditionally; the sources still say what it reads. */
19
+ forced: true | undefined;
18
20
  }
21
+ export declare const FORCED: Sources;
19
22
  export declare const globalSources: Sources;
20
23
  export interface Binding {
21
24
  id: number;
@@ -25,18 +28,23 @@ export interface Binding {
25
28
  type: BindingType;
26
29
  loc: t.SourceLocation | null;
27
30
  section: Section;
28
- closureSections: Opt<Section>;
29
- assignmentSections: Opt<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;
30
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;
31
39
  reads: Set<ReferencedExtra>;
32
40
  aliases: Set<Binding>;
33
- hoists: Opt<Section>;
41
+ hoists: SortedOpt<Section>;
34
42
  getters: Map<Getter["hoisted"], boolean>;
35
43
  property: string | undefined;
36
44
  propertyAliases: Map<string, Binding>;
37
- excludeProperties: Opt<string>;
45
+ excludeProperties: SortedOpt<string>;
38
46
  noSerialize: boolean;
39
- noSerializeProperties: Opt<string>;
47
+ noSerializeProperties: SortedOpt<string>;
40
48
  upstreamAlias: Binding | undefined;
41
49
  restOffset: number | undefined;
42
50
  scopeOffset: Binding | undefined;
@@ -59,8 +67,8 @@ export interface InputBinding extends Binding {
59
67
  export interface ParamBinding extends Binding {
60
68
  type: typeof BindingType.param;
61
69
  }
62
- export type ReferencedBindings = Opt<Binding>;
63
- export type Intersection = Many<Binding>;
70
+ export type ReferencedBindings = SortedOpt<Binding>;
71
+ export type Intersection = SortedMany<Binding>;
64
72
  interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
65
73
  }
66
74
  export interface Getter {
@@ -91,8 +99,11 @@ declare module "@marko/compiler/dist/types" {
91
99
  }
92
100
  interface NodeExtra {
93
101
  section?: Section;
102
+ /** The dom node binding of a tag rendering a branch or body (a dynamic
103
+ * tag, `<try>`, `<await>`). */
104
+ nodeBinding?: Binding;
94
105
  referencedBindings?: ReferencedBindings;
95
- downstream?: Opt<Binding>;
106
+ downstream?: SortedOpt<Binding>;
96
107
  /** The tag-root `KnownExprs` of the call site that linked this expression
97
108
  * to a downstream template's binding, for dereferencing its reasons. */
98
109
  downstreamExprs?: KnownExprs;
@@ -101,6 +112,8 @@ declare module "@marko/compiler/dist/types" {
101
112
  assignmentTo?: Binding;
102
113
  read?: ExtraRead;
103
114
  pruned?: true;
115
+ /** The expression this node sits in: dropped or merged as one. */
116
+ exprRoot?: NodeExtra;
104
117
  isEffect?: true;
105
118
  /** The expression is a dynamic tag's input (attrs, args, attr tags). */
106
119
  dynamicTagInput?: true;
@@ -117,7 +130,7 @@ declare module "@marko/compiler/dist/types" {
117
130
  interface FunctionExtra {
118
131
  referencesScope?: boolean;
119
132
  referencedBindingsInFunction?: ReferencedBindings;
120
- referencedLocalBindingsInFunction?: Opt<Binding>;
133
+ referencedLocalBindingsInFunction?: SortedOpt<Binding>;
121
134
  constantBindingsInFunction?: ReferencedBindings;
122
135
  name?: string;
123
136
  registerId?: string;
@@ -131,8 +144,9 @@ declare module "@marko/compiler/dist/types" {
131
144
  interface FunctionExpressionExtra extends FunctionExtra {
132
145
  }
133
146
  }
134
- export declare function createBinding(name: string, type: Binding["type"], refSection: Section, upstreamAlias?: Binding["upstreamAlias"], property?: string, excludeProperties?: Opt<string>, loc?: t.SourceLocation | null, refDeclared?: boolean): Binding;
147
+ export declare function createBinding(name: string, type: Binding["type"], refSection: Section, upstreamAlias?: Binding["upstreamAlias"], property?: string, excludeProperties?: SortedOpt<string>, loc?: t.SourceLocation | null, refDeclared?: boolean): Binding;
135
148
  export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
149
+ export declare function getPropertyAlias(binding: Binding | undefined, properties: Opt<string>): Binding | undefined;
136
150
  export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): Binding | undefined;
137
151
  export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, upstreamAlias?: Binding["upstreamAlias"]): Binding | undefined;
138
152
  export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
@@ -144,13 +158,23 @@ export declare function mergeReferences<T extends t.Node>(section: Section, targ
144
158
  export declare function compareReferences(a: ReferencedBindings, b: ReferencedBindings): number;
145
159
  export declare function finalizeReferences(): void;
146
160
  export declare function dropReferencedBindings(expr: ReferencedExtra, drop: ReferencedBindings): boolean;
147
- export declare const intersectionMeta: WeakMap<Intersection, {
161
+ /**
162
+ * Every member computed from one local source in the same pass, or the
163
+ * intersection's own render id and scope offset.
164
+ */
165
+ type IntersectionMeta = {
166
+ source: Binding;
167
+ id?: undefined;
168
+ scopeOffset?: undefined;
169
+ } | {
170
+ source: undefined;
148
171
  id: number;
149
172
  scopeOffset: Binding | undefined;
150
- }>;
151
- export declare const collapsedIntersectionSource: WeakMap<Intersection, Binding>;
173
+ };
174
+ export declare const intersectionMeta: WeakMap<Intersection, IntersectionMeta>;
152
175
  export declare function setBindingDownstream(binding: Binding, expr: boolean | Opt<t.NodeExtra>, exprs?: KnownExprs): void;
153
- export declare function createSources(state: Sources["state"], param: Sources["param"], global?: Sources["global"]): Sources;
176
+ export declare function setBindingValueExprs(binding: Binding, expr: boolean | Opt<t.NodeExtra>): void;
177
+ export declare function createSources(state: Sources["state"], param: Sources["param"], global?: Sources["global"], forced?: Sources["forced"]): Sources;
154
178
  export declare function compareSources(a: Sources, b: Sources): number;
155
179
  export declare function mergeSources(a: undefined | Sources, b: undefined | Sources): Sources | undefined;
156
180
  export declare const bindingUtil: Sorted<Binding>;
@@ -159,7 +183,11 @@ export declare function onFinalizeReferences(finalize: () => void): void;
159
183
  export declare function getExpressionReads(exprExtra: ReferencedExtra): Opt<Read>;
160
184
  export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
161
185
  export declare function dropNodes(node: t.Node | t.Node[]): void;
186
+ export declare function untrackNode(node: t.Node): void;
162
187
  export declare function getCanonicalBinding(binding: Binding): Binding;
188
+ export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
189
+ export declare function someUpstream<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
190
+ export declare function isDirectAlias(binding: Binding): boolean;
163
191
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[]): t.Node[];
164
192
  export declare function getScopeAccessorLiteral(binding: Binding, encoded?: boolean, includeId?: boolean): t.NumericLiteral | t.StringLiteral;
165
193
  export declare function getScopeAccessor(binding: Binding, encoded?: boolean, includeId?: boolean): string;
@@ -178,7 +206,7 @@ export declare function getSectionInstancesAccessorLiteral(section: Section): t.
178
206
  export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression, signal?: Signal): t.Expression | undefined;
179
207
  export declare function isInvokeOnlyBinding(binding: Binding): boolean;
180
208
  export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
181
- export declare function pruneBinding(binding: Binding): boolean;
209
+ export declare function pruneBinding(binding: Binding, settled?: true): boolean;
182
210
  export declare function createRead(binding: Binding, props: Opt<string>, ownVar?: boolean): ExtraRead;
183
211
  export declare function createGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ExtraRead;
184
212
  export interface ReferencedExtra extends t.NodeExtra {
@@ -187,8 +215,11 @@ export interface ReferencedExtra extends t.NodeExtra {
187
215
  export declare function isReferencedExtra(extra: t.NodeExtra | undefined): extra is ReferencedExtra;
188
216
  export interface AssignedBindingExtra extends ReferencedExtra {
189
217
  assignment: Binding;
190
- assignmentFunction: ReferencedFunctionExtra;
218
+ exprRoot: t.NodeExtra;
219
+ /** The outermost function holding it; none when that escapes into a call. */
220
+ fnRoot: ReferencedFunctionExtra | undefined;
191
221
  }
222
+ export declare function hasResumableWriter(binding: Binding): boolean;
192
223
  export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined): extra is AssignedBindingExtra;
193
224
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
194
225
  name: string;
@@ -197,8 +228,9 @@ export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
197
228
  }
198
229
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
199
230
  export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
200
- export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra, register?: boolean): undefined | SerializeReason;
201
- export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true, register?: boolean): undefined | SerializeReason;
231
+ export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra): undefined | SerializeReason;
232
+ export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true): undefined | SerializeReason;
233
+ export declare function getRegisterReasonForExtra(extra: t.NodeExtra): undefined | SerializeReason;
202
234
  export interface KnownExprs {
203
235
  known?: Record<string, KnownExprs>;
204
236
  value?: t.NodeExtra;
@@ -4,8 +4,10 @@ import { _attr, _attr_class, _attr_style, _escape, _escape_comment, _escape_scri
4
4
  export type DOMRuntimeHelpers = keyof typeof import("../../dom");
5
5
  export type HTMLRuntimeHelpers = keyof typeof import("../../html");
6
6
  export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.Identifier;
7
+ export declare function registerRuntimeValue(id: string, value: t.Expression): t.AssignmentExpression;
7
8
  export declare function callRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers, ...args: Array<Parameters<typeof t.callExpression>[1][number] | Falsy>): t.CallExpression;
8
- export type DOMRuntimeFeature = "catch" | "controllable" | "controllable-input" | "controllable-open" | "controllable-select" | "controllable-textarea" | "dynamic-tag-var" | "placeholder";
9
+ export declare const domRuntimeFeatures: readonly ["catch", "controllable", "controllable-input", "controllable-open", "controllable-select", "controllable-textarea", "dynamic-tag-var", "placeholder"];
10
+ export type DOMRuntimeFeature = (typeof domRuntimeFeatures)[number];
9
11
  export declare function importRuntimeFeature(feature: DOMRuntimeFeature): void;
10
12
  export declare function getHTMLRuntime(): {
11
13
  _escape: typeof _escape;
@@ -67,14 +67,10 @@ export interface Section {
67
67
  /** Reasons any of the section's dom nodes resumes, as the analyzed reasons
68
68
  * (not merged) so each one's guard stays buildable. */
69
69
  domSerializeReasons: undefined | SerializeReasons;
70
- /** Pending serialize exprs, resolved into the reasons (and provenance)
71
- * once references finalize. */
70
+ /** Pending serialize exprs, resolved into the reasons once references
71
+ * finalize. */
72
72
  serializeExprs: Opt<t.NodeExtra>;
73
73
  propSerializeExprs: Map<SerializeKey, OneMany<t.NodeExtra>> | undefined;
74
- /** Whose values feed each serialization decision — survives force-`true`
75
- * and counts function-body reads; complete after reference finalize. */
76
- serializeProvenance: Sources | undefined;
77
- propSerializeProvenance: Map<SerializeKey, Sources> | undefined;
78
74
  /** Interned per-prop reason keys for string/symbol props. */
79
75
  serializePropKeys: Map<string | symbol, SerializeKey> | undefined;
80
76
  paramReasonGroups: ParamSerializeReasonGroups | undefined;
@@ -82,11 +78,11 @@ export interface Section {
82
78
  returnSerializeReason: SerializeReason | undefined;
83
79
  isHoistThrough: true | undefined;
84
80
  upstreamExpression: t.NodeExtra | undefined;
85
- /** The content's rendering tag (its extra), and the child binding the
81
+ /** The content's rendering tag (its extra), and each child binding the
86
82
  * content feeds when the child can serialize it. */
87
83
  downstream: {
88
84
  tag: t.MarkoTagExtra;
89
- binding: Binding | undefined;
85
+ binding: Opt<Binding>;
90
86
  properties: Opt<string>;
91
87
  exprs: KnownExprs | undefined;
92
88
  } | undefined;
@@ -122,17 +118,20 @@ export declare const getSectionParentIsOwner: (section: Section) => boolean, set
122
118
  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;
123
119
  export declare function forEachSection(fn: (section: Section) => void): void;
124
120
  export declare function getChildSections(section: Section): Section[];
121
+ export declare function ancestorSections(from: Section, to: Section): Generator<Section, void, unknown>;
125
122
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
126
123
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType.Value | null;
127
- export declare function getSectionRegisterReasons(section: Section): false | SerializeReason;
124
+ export declare function getSectionRegisterReasons(section: Section): boolean | Sources;
125
+ export declare function isSectionRegisterDynamic(section: Section, registerReason: true | SerializeReason): boolean;
126
+ export declare function isSectionRegisterEager(section: Section): boolean;
128
127
  export declare function isImmediateOwner(section: Section, binding: Binding): boolean;
129
128
  export declare function isDirectClosure(section: Section, closure: Binding): boolean;
130
129
  export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
131
130
  export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
132
- export declare function getDirectClosures(section: Section): Opt<Binding>;
131
+ export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
133
132
  export declare function isSameOrChildSection(section: Section, other: Section): boolean;
134
133
  export declare function getCommonSection(section: Section, other: Section): Section;
135
134
  export declare function finalizeParamSerializeReasonGroups(section: Section): void;
136
135
  export declare function ensureReasonGroups(reason: Section["serializeReason"]): void;
137
136
  export declare function getParamReasonGroupIndex(section: Section, reason: ParamSerializeReasonGroup["reason"]): number;
138
- export declare function groupParamsBySection(params: Sources["param"]): Map<Section, OneMany<InputBinding | ParamBinding>>;
137
+ export declare function groupParamsBySection(params: Sources["param"]): Map<Section, import("./optional").SortedOneMany<InputBinding | ParamBinding>>;
@@ -1,7 +1,17 @@
1
1
  import { types as t } from "@marko/compiler";
2
+ import { type Sources } from "./references";
2
3
  import { type Section } from "./sections";
3
4
  import { type SerializeReason, type SerializeReasons } from "./serialize-reasons";
5
+ type DynamicSerializeReason = Sources & {
6
+ state: undefined;
7
+ };
8
+ export declare function buildGroupMask(groups: {
9
+ value: number | t.Expression | undefined;
10
+ names: string;
11
+ }[]): t.Expression | undefined;
4
12
  export declare function getScopeReasonDeclaration(section: Section): t.VariableDeclaration;
5
13
  export declare function getSerializeGuard(section: Section, reason: undefined | SerializeReason, optional: boolean): t.Expression | undefined;
6
14
  export declare function getSerializeGuardForAny(section: Section, reasons: undefined | SerializeReasons, optional: boolean): t.Expression | undefined;
7
15
  export declare function getExprIfSerialized<T extends undefined | SerializeReason, R extends (T extends {} ? t.Expression : undefined)>(section: Section, reason: T, expr: t.Expression): R;
16
+ export declare function isDynamicSerializeGuard(section: Section, reason: undefined | SerializeReason): reason is DynamicSerializeReason;
17
+ export {};
@@ -1,33 +1,32 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { AccessorPrefix, AccessorProp } from "../../common/types";
3
- import { type OneMany, type Opt, Sorted } from "./optional";
3
+ import { type Opt, Sorted, type SortedOneMany } from "./optional";
4
4
  import { type Binding, type KnownExprs, type ReferencedBindings, type Sources } from "./references";
5
- import type { Section } from "./sections";
6
- export type SerializeReasons = true | OneMany<Sources>;
5
+ import { type Section } from "./sections";
6
+ export type SerializeReasons = SortedOneMany<Sources>;
7
7
  export declare const sourcesUtil: Sorted<Sources>;
8
- export type SerializeReason = true | Sources;
8
+ export type SerializeReason = Sources;
9
9
  export type SerializeKey = symbol & {
10
10
  __serialize_key__: 1;
11
11
  };
12
12
  export declare function isSameReason(a: SerializeReason | undefined, b: SerializeReason | undefined): boolean;
13
13
  export declare function isForceSerialized(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): boolean;
14
14
  export declare function addSerializeReason(section: Section, reason: undefined | false | SerializeReason, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
15
- export declare function addSerializeExpr(section: Section, expr: boolean | Opt<t.NodeExtra>, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
16
- export declare function addOwnerSerializeReason(from: Section, to: Section, reason: undefined | boolean | SerializeReason): void;
15
+ export declare function addSerializeExpr(section: Section, expr: Opt<t.NodeExtra>, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
16
+ export declare function addOwnerSerializeReason(from: Section, to: Section, reason: undefined | false | SerializeReason): void;
17
17
  export declare function isReasonDynamic(reason: undefined | SerializeReason): reason is Sources & {
18
18
  state: undefined;
19
+ forced: undefined;
19
20
  };
20
21
  export declare function isStaticSerializeReason(reason: undefined | SerializeReason): reason is SerializeReason;
21
22
  export declare function isStateSerializeReason(reason: undefined | SerializeReason): reason is Sources;
22
- export declare function getSerializeReason(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): SerializeReason | undefined;
23
+ export declare function getSerializeReason(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): Sources | undefined;
23
24
  export declare function getSerializeSourcesForExpr(expr: t.NodeExtra): Sources | undefined;
24
- export declare function getSerializeSourcesForExprs(exprs: Opt<t.NodeExtra> | boolean): true | Sources | undefined;
25
+ export declare function getSerializeSourcesForExprs(exprs: Opt<t.NodeExtra> | boolean): Sources | undefined;
25
26
  export declare function getSerializeSourcesForRef(ref: ReferencedBindings): Sources | undefined;
26
- export declare function mapCrossProgramReason(program: Section, reason: Sources, exprs: KnownExprs | undefined): SerializeReason | undefined;
27
- export declare function mapDownstreamReason(program: Section, reason: Sources, exprs: KnownExprs): SerializeReason | undefined;
27
+ export declare function mapParamReason(program: Section, reason: Sources, exprs: KnownExprs | undefined, ownParams: boolean): SerializeReason | undefined;
28
28
  export declare function mergeSerializeReasons(a: SerializeReason, b: undefined | SerializeReason): SerializeReason;
29
29
  export declare function mergeSerializeReasons(a: undefined | SerializeReason, b: SerializeReason): SerializeReason;
30
30
  export declare function mergeSerializeReasons(a: undefined | SerializeReason, b: undefined | SerializeReason): SerializeReason | undefined;
31
31
  export declare function applySerializeExprs(section: Section): void;
32
32
  export declare function finalizeSerializeReason(section: Section): void;
33
- export declare function getSerializeProvenance(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): Sources | undefined;
@@ -1,5 +1,6 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import type { Binding, KnownExprs } from "./references";
2
+ import { type Opt } from "./optional";
3
+ import { type Binding, type KnownExprs } from "./references";
3
4
  import { type Section } from "./sections";
4
- export declare function setTagDownstream(tag: t.NodePath<t.MarkoTag>, binding: undefined | Binding, exprs?: KnownExprs): void;
5
+ export declare function setTagDownstream(tag: t.NodePath<t.MarkoTag>, binding: Opt<Binding>, exprs?: KnownExprs): void;
5
6
  export declare function finalizeTagDownstreams(section: Section): void;
@@ -7,13 +7,18 @@ declare module "@marko/compiler/dist/types" {
7
7
  /** Set by the Class API translator when Tags content resumes below here. */
8
8
  hydratesTags?: boolean;
9
9
  }
10
- interface MarkoTagExtra {
10
+ interface NodeExtra {
11
11
  tagNameType?: TagNameType;
12
12
  tagNameNullable?: boolean;
13
- tagNameDynamic?: boolean;
14
13
  tagNameImported?: string;
15
- tagNameUnresolved?: boolean;
14
+ /** Every template the name may resolve to, when it can resolve to
15
+ * nothing else and none is still analyzing. */
16
+ tagNameTemplates?: t.ProgramExtra[];
16
17
  tagNameLoad?: LoadImportConfig;
18
+ }
19
+ interface MarkoTagExtra {
20
+ tagNameDynamic?: boolean;
21
+ tagNameUnresolved?: boolean;
17
22
  featureType?: ProgramExtra["featureType"];
18
23
  }
19
24
  }
@@ -2,7 +2,6 @@ import { types as t } from "@marko/compiler";
2
2
  import { type Binding } from "../../util/references";
3
3
  import { type Section } from "../../util/sections";
4
4
  import * as ClassHydration from "./constants/class-hydration";
5
- declare const kDOMBinding: unique symbol;
6
5
  declare const kChildOffsetScopeBinding: unique symbol;
7
6
  type ClassHydration = ClassHydration.Value;
8
7
  declare module "@marko/compiler" {
@@ -13,7 +12,6 @@ declare module "@marko/compiler" {
13
12
  }
14
13
  declare module "@marko/compiler/dist/types" {
15
14
  interface MarkoTagExtra {
16
- [kDOMBinding]?: Binding;
17
15
  [kChildOffsetScopeBinding]?: Binding;
18
16
  defineBodySection?: Section;
19
17
  }
package/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  import "./tags-html";
2
2
 
3
- declare module "*.marko" {
4
- const template: Marko.Template;
5
- export default template;
6
- }
7
-
8
3
  declare global {
9
4
  namespace NodeJS {
10
5
  interface ReadableStream {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.3.50",
3
+ "version": "6.3.52",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -57,8 +57,8 @@
57
57
  "magic-string": "^0.30.21"
58
58
  },
59
59
  "devDependencies": {
60
- "@marko/runtime-tags": "npm:marko@6.3.50",
61
- "marko": "5.39.40"
60
+ "@marko/runtime-tags": "npm:marko@6.3.52",
61
+ "marko": "5.39.41"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"
package/tags-html.d.ts CHANGED
@@ -225,6 +225,8 @@ declare global {
225
225
  }
226
226
 
227
227
  namespace CSS {
228
+ // Augment this with a project's CSS custom properties to use them in a
229
+ // `style` object; a `--${string}` index signature would not catch typos.
228
230
  export interface Properties extends csstype.PropertiesHyphen {}
229
231
  }
230
232