marko 6.3.51 → 6.3.53

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 (73) 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-script.feat.js +5 -0
  14. package/dist/debug/dom/dynamic-tag-script.feat.mjs +4 -0
  15. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -4
  16. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -4
  17. package/dist/debug/dom/placeholder.feat.js +2 -2
  18. package/dist/debug/dom/placeholder.feat.mjs +2 -2
  19. package/dist/debug/{dom-BAGeiafn.js → dom-CBLlE8L-.js} +46 -34
  20. package/dist/debug/{dom-C55iHvof.mjs → dom-DQCODUa1.mjs} +29 -23
  21. package/dist/debug/dom.js +11 -11
  22. package/dist/debug/dom.mjs +10 -10
  23. package/dist/debug/html.js +57 -41
  24. package/dist/debug/html.mjs +57 -41
  25. package/dist/dom/catch.feat.js +1 -1
  26. package/dist/dom/catch.feat.mjs +1 -1
  27. package/dist/dom/control-flow.d.ts +1 -3
  28. package/dist/dom/controllable-input.feat.js +1 -1
  29. package/dist/dom/controllable-input.feat.mjs +1 -1
  30. package/dist/dom/controllable-open.feat.js +1 -1
  31. package/dist/dom/controllable-open.feat.mjs +1 -1
  32. package/dist/dom/controllable-select.feat.js +1 -1
  33. package/dist/dom/controllable-select.feat.mjs +1 -1
  34. package/dist/dom/controllable-textarea.feat.js +1 -1
  35. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  36. package/dist/dom/controllable.feat.js +1 -1
  37. package/dist/dom/controllable.feat.mjs +1 -1
  38. package/dist/dom/dynamic-tag-script.feat.d.ts +1 -0
  39. package/dist/dom/dynamic-tag-script.feat.js +4 -0
  40. package/dist/dom/dynamic-tag-script.feat.mjs +4 -0
  41. package/dist/dom/dynamic-tag-var.feat.js +2 -2
  42. package/dist/dom/dynamic-tag-var.feat.mjs +3 -3
  43. package/dist/dom/placeholder.feat.js +2 -2
  44. package/dist/dom/placeholder.feat.mjs +2 -2
  45. package/dist/dom/resume.d.ts +2 -2
  46. package/dist/{dom-BNmfm4st.js → dom-vuB05Hnj.js} +37 -30
  47. package/dist/{dom-BsAS26Ze.mjs → dom-z4IMlmeO.mjs} +21 -19
  48. package/dist/dom.d.ts +2 -2
  49. package/dist/dom.js +15 -15
  50. package/dist/dom.mjs +10 -10
  51. package/dist/html/template.d.ts +3 -1
  52. package/dist/html/writer.d.ts +6 -1
  53. package/dist/html.js +41 -26
  54. package/dist/html.mjs +41 -26
  55. package/dist/translator/core/await.d.ts +0 -7
  56. package/dist/translator/core/try.d.ts +0 -7
  57. package/dist/translator/index.d.ts +1 -1
  58. package/dist/translator/index.js +830 -596
  59. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  60. package/dist/translator/util/cyclic-memo.d.ts +4 -0
  61. package/dist/translator/util/evaluate.d.ts +2 -0
  62. package/dist/translator/util/optional.d.ts +21 -7
  63. package/dist/translator/util/references.d.ts +58 -23
  64. package/dist/translator/util/runtime.d.ts +3 -1
  65. package/dist/translator/util/sections.d.ts +8 -11
  66. package/dist/translator/util/serialize-guard.d.ts +4 -0
  67. package/dist/translator/util/serialize-reasons.d.ts +10 -11
  68. package/dist/translator/util/set-tag-sections-downstream.d.ts +3 -2
  69. package/dist/translator/util/tag-name-type.d.ts +8 -3
  70. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -2
  71. package/index.d.ts +0 -5
  72. package/package.json +4 -4
  73. 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,14 @@ 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>;
107
+ /** The initial value of the binding it feeds, which keeps it rather than
108
+ * following it, so the binding derives no sources from it. */
109
+ initialValue?: true;
96
110
  /** The tag-root `KnownExprs` of the call site that linked this expression
97
111
  * to a downstream template's binding, for dereferencing its reasons. */
98
112
  downstreamExprs?: KnownExprs;
@@ -101,9 +115,12 @@ declare module "@marko/compiler/dist/types" {
101
115
  assignmentTo?: Binding;
102
116
  read?: ExtraRead;
103
117
  pruned?: true;
118
+ /** The expression this node sits in: dropped or merged as one. */
119
+ exprRoot?: NodeExtra;
104
120
  isEffect?: true;
105
- /** The expression is a dynamic tag's input (attrs, args, attr tags). */
106
- dynamicTagInput?: true;
121
+ /** A value here may reach the client as written (a change handler, a
122
+ * native spread, a dynamic tag's input), so a function in it registers. */
123
+ forceRegister?: true;
107
124
  invokeOnly?: true;
108
125
  lazyBindings?: ReferencedBindings;
109
126
  /** `$global` bindings this expression reads: the root means an opaque
@@ -117,7 +134,7 @@ declare module "@marko/compiler/dist/types" {
117
134
  interface FunctionExtra {
118
135
  referencesScope?: boolean;
119
136
  referencedBindingsInFunction?: ReferencedBindings;
120
- referencedLocalBindingsInFunction?: Opt<Binding>;
137
+ referencedLocalBindingsInFunction?: SortedOpt<Binding>;
121
138
  constantBindingsInFunction?: ReferencedBindings;
122
139
  name?: string;
123
140
  registerId?: string;
@@ -131,8 +148,9 @@ declare module "@marko/compiler/dist/types" {
131
148
  interface FunctionExpressionExtra extends FunctionExtra {
132
149
  }
133
150
  }
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;
151
+ 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
152
  export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
153
+ export declare function getPropertyAlias(binding: Binding | undefined, properties: Opt<string>): Binding | undefined;
136
154
  export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): Binding | undefined;
137
155
  export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, upstreamAlias?: Binding["upstreamAlias"]): Binding | undefined;
138
156
  export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
@@ -144,13 +162,22 @@ export declare function mergeReferences<T extends t.Node>(section: Section, targ
144
162
  export declare function compareReferences(a: ReferencedBindings, b: ReferencedBindings): number;
145
163
  export declare function finalizeReferences(): void;
146
164
  export declare function dropReferencedBindings(expr: ReferencedExtra, drop: ReferencedBindings): boolean;
147
- export declare const intersectionMeta: WeakMap<Intersection, {
165
+ /**
166
+ * Every member computed from one local source in the same pass, or the
167
+ * intersection's own render id and scope offset.
168
+ */
169
+ type IntersectionMeta = {
170
+ source: Binding;
171
+ id?: undefined;
172
+ scopeOffset?: undefined;
173
+ } | {
174
+ source: undefined;
148
175
  id: number;
149
176
  scopeOffset: Binding | undefined;
150
- }>;
151
- export declare const collapsedIntersectionSource: WeakMap<Intersection, Binding>;
177
+ };
178
+ export declare const intersectionMeta: WeakMap<Intersection, IntersectionMeta>;
152
179
  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;
180
+ export declare function createSources(state: Sources["state"], param: Sources["param"], global?: Sources["global"], forced?: Sources["forced"]): Sources;
154
181
  export declare function compareSources(a: Sources, b: Sources): number;
155
182
  export declare function mergeSources(a: undefined | Sources, b: undefined | Sources): Sources | undefined;
156
183
  export declare const bindingUtil: Sorted<Binding>;
@@ -159,7 +186,11 @@ export declare function onFinalizeReferences(finalize: () => void): void;
159
186
  export declare function getExpressionReads(exprExtra: ReferencedExtra): Opt<Read>;
160
187
  export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
161
188
  export declare function dropNodes(node: t.Node | t.Node[]): void;
189
+ export declare function untrackNode(node: t.Node): void;
162
190
  export declare function getCanonicalBinding(binding: Binding): Binding;
191
+ export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
192
+ export declare function someUpstream<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
193
+ export declare function isDirectAlias(binding: Binding): boolean;
163
194
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[]): t.Node[];
164
195
  export declare function getScopeAccessorLiteral(binding: Binding, encoded?: boolean, includeId?: boolean): t.NumericLiteral | t.StringLiteral;
165
196
  export declare function getScopeAccessor(binding: Binding, encoded?: boolean, includeId?: boolean): string;
@@ -178,7 +209,7 @@ export declare function getSectionInstancesAccessorLiteral(section: Section): t.
178
209
  export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression, signal?: Signal): t.Expression | undefined;
179
210
  export declare function isInvokeOnlyBinding(binding: Binding): boolean;
180
211
  export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
181
- export declare function pruneBinding(binding: Binding): boolean;
212
+ export declare function pruneBinding(binding: Binding, settled?: true): boolean;
182
213
  export declare function createRead(binding: Binding, props: Opt<string>, ownVar?: boolean): ExtraRead;
183
214
  export declare function createGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ExtraRead;
184
215
  export interface ReferencedExtra extends t.NodeExtra {
@@ -187,8 +218,11 @@ export interface ReferencedExtra extends t.NodeExtra {
187
218
  export declare function isReferencedExtra(extra: t.NodeExtra | undefined): extra is ReferencedExtra;
188
219
  export interface AssignedBindingExtra extends ReferencedExtra {
189
220
  assignment: Binding;
190
- assignmentFunction: ReferencedFunctionExtra;
221
+ exprRoot: t.NodeExtra;
222
+ /** The outermost function holding it; none when that escapes into a call. */
223
+ fnRoot: ReferencedFunctionExtra | undefined;
191
224
  }
225
+ export declare function hasResumableWriter(binding: Binding): boolean;
192
226
  export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined): extra is AssignedBindingExtra;
193
227
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
194
228
  name: string;
@@ -197,8 +231,9 @@ export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
197
231
  }
198
232
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
199
233
  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;
234
+ export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra): undefined | SerializeReason;
235
+ export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true): undefined | SerializeReason;
236
+ export declare function getRegisterReasonForExtra(extra: t.NodeExtra): undefined | SerializeReason;
202
237
  export interface KnownExprs {
203
238
  known?: Record<string, KnownExprs>;
204
239
  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-script", "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,18 @@ 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;
128
125
  export declare function isImmediateOwner(section: Section, binding: Binding): boolean;
129
126
  export declare function isDirectClosure(section: Section, closure: Binding): boolean;
130
127
  export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
131
128
  export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
132
- export declare function getDirectClosures(section: Section): Opt<Binding>;
129
+ export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
133
130
  export declare function isSameOrChildSection(section: Section, other: Section): boolean;
134
131
  export declare function getCommonSection(section: Section, other: Section): Section;
135
132
  export declare function finalizeParamSerializeReasonGroups(section: Section): void;
136
133
  export declare function ensureReasonGroups(reason: Section["serializeReason"]): void;
137
134
  export declare function getParamReasonGroupIndex(section: Section, reason: ParamSerializeReasonGroup["reason"]): number;
138
- export declare function groupParamsBySection(params: Sources["param"]): Map<Section, OneMany<InputBinding | ParamBinding>>;
135
+ export declare function groupParamsBySection(params: Sources["param"]): Map<Section, import("./optional").SortedOneMany<InputBinding | ParamBinding>>;
@@ -1,6 +1,10 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Section } from "./sections";
3
3
  import { type SerializeReason, type SerializeReasons } from "./serialize-reasons";
4
+ export declare function buildGroupMask(groups: {
5
+ value: number | t.Expression | undefined;
6
+ names: string;
7
+ }[]): t.Expression | undefined;
4
8
  export declare function getScopeReasonDeclaration(section: Section): t.VariableDeclaration;
5
9
  export declare function getSerializeGuard(section: Section, reason: undefined | SerializeReason, optional: boolean): t.Expression | undefined;
6
10
  export declare function getSerializeGuardForAny(section: Section, reasons: undefined | SerializeReasons, optional: boolean): t.Expression | undefined;
@@ -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.51",
3
+ "version": "6.3.53",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -51,14 +51,14 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@marko/compiler": "^5.42.5",
54
+ "@marko/compiler": "^5.42.6",
55
55
  "csstype": "^3.2.3",
56
56
  "fastest-levenshtein": "^1.0.16",
57
57
  "magic-string": "^0.30.21"
58
58
  },
59
59
  "devDependencies": {
60
- "@marko/runtime-tags": "npm:marko@6.3.51",
61
- "marko": "5.39.40"
60
+ "@marko/runtime-tags": "npm:marko@6.3.53",
61
+ "marko": "5.39.42"
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