marko 6.4.5 → 6.4.7

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 (145) hide show
  1. package/cheatsheet.md +2 -1
  2. package/dist/common/errors.d.ts +3 -1
  3. package/dist/common/helpers.d.ts +7 -7
  4. package/dist/debug/dom/catch.feat.js +4 -4
  5. package/dist/debug/dom/catch.feat.mjs +4 -4
  6. package/dist/debug/dom/controllable-input.feat.js +1 -1
  7. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-open.feat.js +1 -1
  9. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-select.feat.js +1 -1
  11. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable.feat.js +5 -5
  15. package/dist/debug/dom/controllable.feat.mjs +5 -5
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
  20. package/dist/debug/dom/lazy.feat.js +1 -1
  21. package/dist/debug/dom/lazy.feat.mjs +1 -1
  22. package/dist/debug/dom/placeholder.feat.js +1 -1
  23. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  24. package/dist/debug/{dom-BeY1nGUb.mjs → dom-CFCBDift.mjs} +133 -135
  25. package/dist/debug/{dom-CUxvM4i9.js → dom-D8znnhpf.js} +148 -150
  26. package/dist/debug/dom.js +21 -22
  27. package/dist/debug/dom.mjs +22 -22
  28. package/dist/debug/html.js +736 -664
  29. package/dist/debug/html.mjs +736 -665
  30. package/dist/dom/catch.feat.js +5 -5
  31. package/dist/dom/catch.feat.mjs +4 -4
  32. package/dist/dom/control-flow.d.ts +3 -3
  33. package/dist/dom/controllable-input.feat.js +2 -2
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +2 -2
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +2 -2
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +2 -2
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.d.ts +4 -4
  42. package/dist/dom/controllable.feat.js +2 -2
  43. package/dist/dom/controllable.feat.mjs +2 -2
  44. package/dist/dom/dom.d.ts +5 -5
  45. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  46. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  47. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  48. package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
  49. package/dist/dom/lazy.feat.js +1 -1
  50. package/dist/dom/lazy.feat.mjs +1 -1
  51. package/dist/dom/placeholder.feat.js +2 -2
  52. package/dist/dom/placeholder.feat.mjs +1 -1
  53. package/dist/dom/renderer.d.ts +1 -3
  54. package/dist/dom/resume.d.ts +2 -3
  55. package/dist/dom/signals.d.ts +6 -8
  56. package/dist/{dom-Diu8MpmL.js → dom-Bpkm72vV.js} +157 -166
  57. package/dist/{dom-DefWmvQB.mjs → dom-CVAevsbz.mjs} +103 -107
  58. package/dist/dom.d.ts +1 -1
  59. package/dist/dom.js +37 -37
  60. package/dist/dom.mjs +22 -22
  61. package/dist/html/assets.d.ts +2 -2
  62. package/dist/html/compat.d.ts +2 -1
  63. package/dist/html/control-flow.d.ts +20 -0
  64. package/dist/html/inlined-runtimes.d.ts +2 -2
  65. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  66. package/dist/html/serializer.d.ts +63 -16
  67. package/dist/html/template.d.ts +1 -1
  68. package/dist/html/writer.d.ts +47 -35
  69. package/dist/html.d.ts +3 -2
  70. package/dist/html.js +531 -484
  71. package/dist/html.mjs +531 -484
  72. package/dist/translator/core/for.d.ts +0 -4
  73. package/dist/translator/core/return.d.ts +0 -3
  74. package/dist/translator/core/style.d.ts +2 -2
  75. package/dist/translator/index.js +8093 -8021
  76. package/dist/translator/util/analyze-errors.d.ts +2 -1
  77. package/dist/translator/util/assert.d.ts +15 -1
  78. package/dist/translator/util/bindings.d.ts +24 -12
  79. package/dist/translator/util/body-to-text.d.ts +9 -0
  80. package/dist/translator/util/branch-tag.d.ts +10 -3
  81. package/dist/translator/util/build-string-expression.d.ts +4 -0
  82. package/dist/translator/util/content-derives.d.ts +7 -0
  83. package/dist/translator/util/cyclic-memo.d.ts +6 -2
  84. package/dist/translator/util/entry-builder.d.ts +6 -3
  85. package/dist/translator/util/finalize-references.d.ts +6 -3
  86. package/dist/translator/util/for-selector.d.ts +1 -1
  87. package/dist/translator/util/generate-uid.d.ts +4 -2
  88. package/dist/translator/util/get-root.d.ts +3 -3
  89. package/dist/translator/util/get-tag-name.d.ts +1 -1
  90. package/dist/translator/util/known-tag.d.ts +14 -9
  91. package/dist/translator/util/module-read.d.ts +0 -3
  92. package/dist/translator/util/module-registrations.d.ts +44 -0
  93. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  94. package/dist/translator/util/optional.d.ts +7 -2
  95. package/dist/translator/util/params-tree.d.ts +18 -0
  96. package/dist/translator/util/reasons.d.ts +13 -8
  97. package/dist/translator/util/references.d.ts +23 -27
  98. package/dist/translator/util/runtime.d.ts +0 -12
  99. package/dist/translator/util/scope-accessor.d.ts +0 -1
  100. package/dist/translator/util/scope-read.d.ts +3 -0
  101. package/dist/translator/util/section-renderer.d.ts +4 -0
  102. package/dist/translator/util/sections.d.ts +21 -21
  103. package/dist/translator/util/setup-work.d.ts +2 -1
  104. package/dist/translator/util/signals.d.ts +16 -14
  105. package/dist/translator/util/simplify-fn.d.ts +1 -0
  106. package/dist/translator/util/slots.d.ts +4 -4
  107. package/dist/translator/util/solve-reasons.d.ts +1 -3
  108. package/dist/translator/util/sources.d.ts +2 -1
  109. package/dist/translator/util/state.d.ts +4 -2
  110. package/dist/translator/util/statement-tag.d.ts +2 -0
  111. package/dist/translator/util/static-text.d.ts +2 -1
  112. package/dist/translator/util/structure.d.ts +0 -10
  113. package/dist/translator/util/tag-facts.d.ts +8 -1
  114. package/dist/translator/util/tag-import.d.ts +20 -0
  115. package/dist/translator/util/tag-name-type.d.ts +9 -2
  116. package/dist/translator/util/to-only-or-block.d.ts +3 -0
  117. package/dist/translator/util/to-property-name.d.ts +2 -0
  118. package/dist/translator/util/translate-attrs.d.ts +7 -5
  119. package/dist/translator/util/translate-var.d.ts +2 -0
  120. package/dist/translator/util/traverse.d.ts +1 -2
  121. package/dist/translator/util/visitors.d.ts +4 -1
  122. package/dist/translator/util/with-previous-location.d.ts +1 -1
  123. package/dist/translator/util/write-guard.d.ts +2 -2
  124. package/dist/translator/util/writer.d.ts +1 -2
  125. package/dist/translator/visitors/export-declaration.d.ts +2 -3
  126. package/dist/translator/visitors/function.d.ts +0 -35
  127. package/dist/translator/visitors/import-declaration.d.ts +1 -15
  128. package/dist/translator/visitors/placeholder.d.ts +2 -1
  129. package/dist/translator/visitors/program/html.d.ts +0 -1
  130. package/dist/translator/visitors/program/index.d.ts +4 -5
  131. package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
  132. package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
  133. package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
  134. package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
  135. package/package.json +4 -4
  136. package/dist/translator/util/binding-has-prop.d.ts +0 -8
  137. package/dist/translator/util/binding-prop-tree.d.ts +0 -18
  138. package/dist/translator/util/body-to-text-literal.d.ts +0 -9
  139. package/dist/translator/util/import-reference.d.ts +0 -3
  140. package/dist/translator/util/normalize-string-expression.d.ts +0 -4
  141. package/dist/translator/util/plugin-hooks.d.ts +0 -4
  142. package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
  143. package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
  144. package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
  145. package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
@@ -1,3 +1,4 @@
1
1
  import type { types as t } from "@marko/compiler";
2
+ declare const hasAnalyzeErrors: () => boolean;
3
+ export { hasAnalyzeErrors };
2
4
  export declare function reportAnalyzeError(path: t.NodePath<t.Node>, error: unknown): void;
3
- export declare function hasAnalyzeErrors(): boolean;
@@ -1,4 +1,18 @@
1
- import type { types as t } from "@marko/compiler";
1
+ import { types as t } from "@marko/compiler";
2
+ import { type ForType } from "./branch-tag";
2
3
  export declare function assertNoSpreadAttrs(tag: t.NodePath<t.MarkoTag>): void;
4
+ export declare function assertOnlyValueAttr(tag: t.NodePath<t.MarkoTag>, required: true, change?: boolean, hint?: (attr: t.MarkoAttribute) => string | undefined): t.MarkoAttribute;
5
+ export declare function assertOnlyValueAttr(tag: t.NodePath<t.MarkoTag>, required?: boolean, change?: boolean, hint?: (attr: t.MarkoAttribute) => string | undefined): t.MarkoAttribute | undefined;
6
+ export declare function assertHasVar(tag: t.NodePath<t.MarkoTag>, hint?: string | ((tag: t.NodePath<t.MarkoTag>) => string)): void;
7
+ export declare function assertIdentifierVar(tag: t.NodePath<t.MarkoTag>): void;
3
8
  export declare function assertNoTagVarMutation(tag: t.NodePath<t.MarkoTag>): void;
9
+ export declare function assertHasBody(tag: t.NodePath<t.MarkoTag>): void;
4
10
  export declare function assertNoBodyContent(tag: t.NodePath<t.MarkoTag>): void;
11
+ export declare function buildAttrsError(tag: t.NodePath<t.MarkoTag>, attrs: t.MarkoTag["attributes"], msg: string): Error;
12
+ export declare function buildAttrNameError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute, msg: string): Error;
13
+ /** The loop a `<for>` tag's attributes run, which it requires. */
14
+ export declare function assertForType(tag: t.NodePath<t.MarkoTag>): ForType;
15
+ /** The attributes a loop of `type` takes, besides `by=`. */
16
+ export declare function getForAttrs(type: ForType): string[];
17
+ /** Throws for a param that a loop of `type` never supplies. */
18
+ export declare function assertForParams(tag: t.NodePath<t.MarkoTag>, type: ForType): void;
@@ -2,6 +2,7 @@ import { types as t } from "@marko/compiler";
2
2
  import { ReservedId } from "../../common/types";
3
3
  import * as BindingType from "./constants/binding-type";
4
4
  import { type Opt, type SortedMany, type SortedOpt, Sorted } from "./optional";
5
+ import { type KnownExprs } from "./reasons";
5
6
  import { type AssignedBindingExtra, type Read, type ReferencedExtra } from "./references";
6
7
  import { type Section } from "./sections";
7
8
  import { type Sources } from "./sources";
@@ -29,11 +30,12 @@ export interface Binding {
29
30
  /** The expressions its value is computed from, `false` for none; unset when
30
31
  * analysis cannot see them, which makes it its own source. */
31
32
  derivedFrom: Opt<t.NodeExtra> | false;
32
- /** Complete only once `finalizeReferences` runs at program analyze exit. */
33
- /** Its reads, by the expression each is in; pruning hands an expression's reads
34
- * to the nearest ancestor it also reads, which they then resolve to. */
33
+ /** Its reads by expression, complete once `finalizeReferences` runs: pruning
34
+ * hands an expression's reads to the nearest ancestor it also reads. */
35
35
  reads: Map<ReferencedExtra, Opt<Read>>;
36
36
  aliases: Set<Binding>;
37
+ /** The sections reading it through a hoist: its own or its ancestors, so
38
+ * the first is the outermost. */
37
39
  hoists: SortedOpt<Section>;
38
40
  getters: Map<Getter["hoisted"], boolean>;
39
41
  property: string | undefined;
@@ -51,9 +53,16 @@ export interface Binding {
51
53
  /** For an array rest, the source index it starts at: `rest[0]` of
52
54
  * `[a, ...rest]` is the source's `[1]`. */
53
55
  restOffset: number | undefined;
54
- /** For a tag variable a child's `<return>` writes, the node binding of the
55
- * tag rendering that child. */
56
- returnedBy: Binding | undefined;
56
+ /** For a tag variable a `<return>` writes, the call's scope binding and, for
57
+ * a known tag, its body and the expressions it passes. */
58
+ returnedBy: {
59
+ scope: Binding;
60
+ section?: Section;
61
+ exprs?: KnownExprs;
62
+ } | undefined;
63
+ /** For the node a control flow tag renders at, the bodies it renders there:
64
+ * an `<if>` chain's in order, a loop's, an `<await>`'s, a `<try>`'s. */
65
+ branchBodies: Opt<Section>;
57
66
  /** Scope ids it holds right after its own, up to its highest `ReservedId`:
58
67
  * a controllable `<let>`'s change handler, or a tag's scope offset. */
59
68
  reserveSize: number;
@@ -75,7 +84,7 @@ export interface Binding {
75
84
  /** In a template's or `<define>`'s params tree, which known call sites set
76
85
  * directly. */
77
86
  exposed: boolean;
78
- /** Read on invocation from its own scope slot, which must persist. */
87
+ /** Read on invocation from its own scope slot, so its signal stores it. */
79
88
  hasLazyReads: boolean;
80
89
  }
81
90
  /** A param of a template or of a tag body, which its caller supplies. */
@@ -102,26 +111,28 @@ export interface Getter {
102
111
  export declare const getBindings: () => Set<Binding>;
103
112
  export declare function createBinding(name: string, type: Binding["type"], refSection: Section, aliased?: Binding["aliasOf"], property?: string, excludeProperties?: SortedOpt<string>, loc?: t.SourceLocation | null, refDeclared?: boolean, restOffset?: number): Binding;
104
113
  export declare function reserveId(binding: Binding, offset: ReservedId): void;
105
- export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
114
+ export declare function ensurePropertyAlias(binding: Binding, property: string): Binding;
106
115
  export declare function addAssignedProperty(binding: Binding, property: string | undefined): void;
107
116
  export declare function getAssignedObject(binding: Binding): Binding | undefined;
108
- export declare function getPropertyAlias(binding: Binding | undefined, properties: Opt<string>): Binding | undefined;
117
+ export declare function getPropertyAlias(binding: Binding, properties: Opt<string>): Binding | undefined;
118
+ export declare function getDeepestPropertyAlias(binding: Binding, properties: Opt<string>): Binding;
109
119
  export declare function compareReferences(a: ReferencedBindings, b: ReferencedBindings): number;
110
120
  /**
111
121
  * reference group priority is sorted by number of references,
112
122
  * then if needed by reference order.
113
123
  */
114
124
  export declare function compareIntersections(a: Intersection, b: Intersection): number;
115
- export declare function getAliasRoot(binding: Binding): Binding | undefined;
125
+ export declare function getAliasRoot(binding: Binding): Binding;
116
126
  export declare const bindingUtil: Sorted<Binding>;
117
127
  export declare const propsUtil: Sorted<string>;
118
128
  export declare function getCanonicalBinding(binding: Binding): Binding;
119
129
  export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
120
- export declare function someAliased<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
130
+ export declare function someUpToAliasRoot<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
121
131
  export declare function getNearestDeclared(binding: Binding): Binding | undefined;
132
+ export declare function getDeclaredAlias(binding: Binding): false | Binding | undefined;
122
133
  export declare function isDirectAlias(binding: Binding): boolean;
123
134
  export declare function isRest(binding: Binding): boolean;
124
- export declare function getDebugScopeAccess(binding: Binding): {
135
+ export declare function getDebugAccess(binding: Binding, toParam: boolean, formatProperty: (property: string) => string): {
125
136
  root: Binding;
126
137
  access: string;
127
138
  };
@@ -130,6 +141,7 @@ export declare function getDebugName(binding: Binding): string;
130
141
  export declare function getDebugNames(refs: ReferencedBindings): string;
131
142
  export declare function getDebugNamesAsIdentifier(refs: ReferencedBindings): string;
132
143
  export declare function isInvokeOnlyBinding(binding: Binding): boolean;
144
+ export declare function isOwnBinding(binding: Binding): boolean;
133
145
  export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
134
146
  export declare function getPropertyPath(binding: Binding, ancestor: Binding): Opt<string>;
135
147
  export declare function isIndexProperty(property: string): boolean;
@@ -0,0 +1,9 @@
1
+ import { types as t } from "@marko/compiler";
2
+ declare module "@marko/compiler/dist/types" {
3
+ interface MarkoPlaceholderExtra {
4
+ needsTextCoercion?: true;
5
+ }
6
+ }
7
+ export declare function bodyToText(body: t.MarkoTagBody, decodeEntities?: boolean): t.ArrayExpression | t.ArrowFunctionExpression | t.AssignmentExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MarkoParseError | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.ObjectExpression | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression;
8
+ export declare function bodyToUncoercedText(body: t.MarkoTagBody): t.ArrayExpression | t.ArrowFunctionExpression | t.AssignmentExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MarkoParseError | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.ObjectExpression | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression;
9
+ export declare function injectTextCoercion(expr: t.Expression): void;
@@ -3,8 +3,15 @@ import { type Binding } from "./bindings";
3
3
  import { type Reasons } from "./reasons";
4
4
  import { type Section } from "./sections";
5
5
  export declare function initBranchSection(bodySection: Section, branchExpr: Section["branchExpr"], branch: NonNullable<Section["branch"]>): void;
6
- export declare function resumeOwnerByMarkerWhenStatic(bodySection: Section, nodeBinding: Binding): void;
7
- export declare function getBranchResumeArgs(tagSection: Section, nodeBinding: Binding, branchReasons: Reasons, onlyChildParentTagName: string | false | undefined, singleNode: boolean): (t.Expression | undefined)[];
8
- export declare function getBranchEndArgs(tagSection: Section, nodeBinding: Binding, onlyChildParentTagName: string | false | undefined, singleNode: boolean | undefined): (t.Expression | undefined)[];
6
+ export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Section, nodeBinding: Binding): void;
7
+ export declare function getBranchResumeArgs(tag: t.NodePath<t.MarkoTag>, branchReasons: Reasons, singleNode: boolean): (t.Expression | undefined)[];
8
+ export declare function buildBranchEndArgs(tagSection: Section, nodeBinding: Binding, onlyChildParentTagName: string | false | undefined, singleNode: boolean | undefined): (t.Expression | undefined)[];
9
9
  export declare function isEndTagWrittenByBranch(nodeBinding: Binding | undefined): boolean;
10
10
  export declare function isSingleNodeBranch(bodySection: Section | undefined): boolean;
11
+ export type ForType = "in" | "of" | "to" | "until";
12
+ export declare function buildForRuntimeCall(type: ForType, attrs: Record<string, t.Expression>, params: t.ArrowFunctionExpression["params"], statements: t.Statement[]): t.ExpressionStatement;
13
+ export declare function getForType(tag: t.MarkoTag): ForType | undefined;
14
+ export declare function forTypeToRuntime(type: ForType): "forIn" | "forOf" | "forTo" | "forUntil";
15
+ export declare function forTypeToBranchRuntime(type: ForType): "_for_in" | "_for_of" | "_for_to" | "_for_until";
16
+ export declare function forTypeToUnkeyedBranchRuntime(type: ForType): "_for_of_unkeyed" | "_for_to_unkeyed" | "_for_until_unkeyed";
17
+ export declare function getBaseArgsInForTag(type: ForType, attrs: Record<string, t.Expression>): t.Expression[];
@@ -0,0 +1,4 @@
1
+ import { types as t } from "@marko/compiler";
2
+ export default function buildStringExpression(parts: (string | t.Expression)[], useIife?: boolean): t.Expression | undefined;
3
+ export declare function appendLiteral(arr: unknown[], str: string): void;
4
+ export declare function toTemplateElement(value: string, tail?: boolean): t.TemplateElement;
@@ -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 "./reasons";
5
+ import { type Section } from "./sections";
6
+ export declare function setTagContentDerives(tag: t.NodePath<t.MarkoTag>, binding: Opt<Binding>, exprs?: KnownExprs): void;
7
+ export declare function finalizeContentDerives(section: Section): void;
@@ -1,4 +1,8 @@
1
1
  import { type Opt } from "./optional";
2
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;
3
+ export declare function createAnalysisMemo<K extends object, R>(compute: (key: K) => R, cycleAnswer: R): readonly [(key: K) => R, () => void];
4
+ export declare function createPassMemo<K extends object, R>(compute: (key: K) => R, cycleAnswer: R): (key: K) => R;
5
+ export declare function resetPassMemos(): void;
6
+ type MemoPath = Opt<string> | true;
7
+ export declare function createPassPathMemo<K extends object, R>(compute: (key: K, path: MemoPath) => R, cycleAnswer: R): (key: K, path: MemoPath) => R;
8
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  declare module "@marko/compiler/dist/types" {
3
3
  interface ProgramExtra {
4
- needsCompat?: boolean;
5
4
  isInteractive?: boolean;
6
5
  hasClientStatement?: boolean;
7
6
  page?: boolean;
@@ -9,13 +8,13 @@ declare module "@marko/compiler/dist/types" {
9
8
  }
10
9
  interface EntryState {
11
10
  init: boolean;
12
- load: boolean;
11
+ hasClientStatement: boolean;
13
12
  /** Whether a reached template lazily imports another. */
14
13
  lazy: boolean;
15
14
  /** Depth of enclosing templates whose modules the bundle already loads:
16
15
  * below a root everything arrives through its imports, and a lazy subtree
17
16
  * is loaded by its own load entry. */
18
- bundled: number;
17
+ bundledDepth: number;
19
18
  /** Depth of enclosing lazy imports, whose load entries bring their assets. */
20
19
  lazyDepth: number;
21
20
  roots: string[];
@@ -42,3 +41,7 @@ declare const builder: {
42
41
  visit(file: t.BabelFile, entryFile: EntryFile, visitChild?: VisitChild): void;
43
42
  };
44
43
  export default builder;
44
+ export declare function assertVisited<S>(entryFile: t.BabelFile, state: S | undefined): asserts state is S;
45
+ export declare function createVisited(entryFile: t.BabelFile): Map<string, Reach>;
46
+ export declare function resolveRelativeToEntry(entryFile: t.BabelFile, file: t.BabelFile, req: string): string;
47
+ export declare function markReached(visited: Map<string, Reach>, resolved: string, reach: Reach): boolean;
@@ -1,4 +1,7 @@
1
- import { type Binding, type ReferencedBindings } from "./bindings";
2
- export declare function finalizeReferences(): void;
3
- export declare function getValueInputs(binding: Binding): ReferencedBindings;
1
+ import { types as t } from "@marko/compiler";
2
+ import { type Binding, type Intersection } from "./bindings";
3
+ import { type Section } from "./sections";
4
+ export declare function finalizeReferences(): Map<Section, Intersection[]>;
5
+ export declare function allocateIds(intersectionsBySection: Map<Section, Intersection[]>): void;
6
+ export declare function readsValuesOnResume(expr: t.NodeExtra): boolean;
4
7
  export declare function hasEmittedAssignment(binding: Binding): boolean;
@@ -1,5 +1,5 @@
1
1
  import { type Binding } from "./bindings";
2
2
  import { type Section } from "./sections";
3
- export declare function getForSelectorKey(bodySection: Section, closure: Binding): Binding | undefined;
3
+ export declare function isForSelectorClosure(bodySection: Section, closure: Binding): boolean;
4
4
  export declare function isForSelectorValue(binding: Binding): boolean;
5
5
  export declare function detectForSelector(bodySection: Section, keyBinding: Binding): void;
@@ -8,6 +8,8 @@ declare module "@marko/compiler/dist/types" {
8
8
  }
9
9
  export declare function generateUid(name?: string): string;
10
10
  export declare function generateUidIdentifier(name?: string): t.Identifier;
11
- export declare function getSharedUid(name: string, section?: Section): string;
12
- export declare function usedSharedUid(name: string): boolean;
11
+ export declare function declareConstBefore(tag: t.NodePath<t.MarkoTag>, name: string, expr: t.Expression): t.Identifier;
12
+ export declare function ensureSharedUid(name: string, section?: Section): string;
13
+ export declare function getUnusedParamIdentifier(): t.Identifier;
14
+ export declare function hasSharedUid(name: string): boolean;
13
15
  export {};
@@ -1,8 +1,8 @@
1
1
  import type { types as t } from "@marko/compiler";
2
- export type MarkoExprRootPath = t.NodePath<t.MarkoTag | t.MarkoTagBody | t.MarkoAttribute | t.MarkoSpreadAttribute | t.MarkoScriptlet | t.MarkoPlaceholder | t.ExportNamedDeclaration | t.ExportDefaultDeclaration>;
3
- export declare function getMarkoRoot(path: t.NodePath<t.Node>): MarkoExprRootPath | null;
2
+ export type MarkoRootPath = t.NodePath<t.MarkoTag | t.MarkoTagBody | t.MarkoAttribute | t.MarkoSpreadAttribute | t.MarkoScriptlet | t.MarkoPlaceholder | t.ExportNamedDeclaration | t.ExportDefaultDeclaration>;
3
+ export declare function getMarkoRoot(path: t.NodePath<t.Node>): MarkoRootPath | null;
4
4
  export declare function getExprRoot(path: t.NodePath<t.Node>): t.NodePath<t.Node>;
5
5
  export declare function getFnRoot(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionDeclaration | t.FunctionExpression | t.ObjectMember> | undefined;
6
6
  export declare function getFnParent(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionDeclaration | t.FunctionExpression | t.ObjectMember> | undefined;
7
7
  export declare function getDeclarationRoot(path: t.NodePath<t.Node>): t.NodePath<t.FunctionDeclaration | t.VariableDeclaration> | undefined;
8
- export declare function isMarko(path: t.NodePath<any>): path is MarkoExprRootPath;
8
+ export declare function isMarkoRoot(path: t.NodePath<any>): path is MarkoRootPath;
@@ -1,3 +1,3 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  export declare function getTagName<T extends t.MarkoTag>(tag: t.NodePath<T>): T["name"] extends t.StringLiteral ? string : string | undefined;
3
- export declare function getStaticTagName(node: t.MarkoTag): string;
3
+ export declare function getTagNameHint(node: t.MarkoTag): string;
@@ -1,23 +1,28 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type BindingPropTree } from "./binding-prop-tree";
3
- import { type Binding } from "./bindings";
4
- import { type KnownExprs } from "./references";
2
+ import { type Binding, type ParamBinding } from "./bindings";
3
+ import { type ParamsTree } from "./params-tree";
4
+ import { type KnownExprs } from "./reasons";
5
5
  import { type Section } from "./sections";
6
- declare const kContentSection: unique symbol;
7
- declare const kPropTree: unique symbol;
6
+ import { type Sources } from "./sources";
7
+ declare const kChildSection: unique symbol;
8
+ declare const kParamsTree: unique symbol;
8
9
  declare const kKnownExprs: unique symbol;
9
10
  declare module "@marko/compiler/dist/types" {
10
11
  interface MarkoTagExtra {
11
- [kContentSection]?: Section;
12
+ /** The dom binding a known tag holds its child's scope in. */
13
+ childScopeBinding?: Binding;
14
+ [kChildSection]?: Section;
12
15
  /** The child's params tree the call site was analyzed against. */
13
- [kPropTree]?: BindingPropTree;
16
+ [kParamsTree]?: ParamsTree;
14
17
  [kKnownExprs]?: KnownExprs;
15
18
  }
16
19
  }
17
- export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, contentSection: Section, childParamsTree?: BindingPropTree): void;
20
+ export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, childSection: Section, childParamsTree?: ParamsTree): void;
18
21
  export declare function analyzeRecursiveTags(): void;
19
22
  export declare function knownTagTranslateHTML(tag: t.NodePath<t.MarkoTag>, tagIdentifier: t.Expression): void;
20
23
  export declare function knownTagTranslateDOM(tag: t.NodePath<t.MarkoTag>, getBindingIdentifier: (binding: Binding, preferredName?: string, directContent?: boolean) => t.Identifier, callSetup: ((section: Section, childBinding: Binding) => void) | undefined): void;
21
- export declare function finalizeKnownTags(section: Section): void;
24
+ export declare function getCallSiteSources(param: ParamBinding): Sources | undefined;
25
+ export declare function addTagVarBindings(section: Section): void;
26
+ export declare function addKnownTagReasons(section: Section): void;
22
27
  export declare function callsOtherTemplateSetup(section: Section): boolean;
23
28
  export {};
@@ -12,9 +12,6 @@ export interface ModuleRead {
12
12
  /** The import's source; none for a `<style/name>` tag's own stylesheet module. */
13
13
  request: string | undefined;
14
14
  }
15
- /** The module read an expression is, resolved on first use: translate replaces
16
- * a `<style/name>` tag. */
17
- export declare function getModuleRead(path: t.NodePath, expr: t.Expression): ModuleRead | undefined;
18
15
  /** A module read of a stylesheet module, whose reads are class name strings. */
19
16
  export declare function getStyleImportRead(path: t.NodePath, expr: t.Expression): string[] | undefined;
20
17
  export declare function toModuleReadExpression([name, ...members]: string[]): t.Identifier | t.MemberExpression;
@@ -1,7 +1,51 @@
1
1
  import { types as t } from "@marko/compiler";
2
+ import { type MarkoRootPath } from "./get-root";
3
+ import { type RegisteredFnExtra } from "./references";
4
+ declare const kRegisteredExports: unique symbol;
5
+ declare module "@marko/compiler/dist/types" {
6
+ interface ProgramExtra {
7
+ [kRegisteredExports]?: Map<string, RegisteredExport>;
8
+ }
9
+ interface ImportDeclarationExtra {
10
+ /** Each local binding the template registers -> the export it imports. */
11
+ registeredImports?: Map<string, RegisteredExport>;
12
+ }
13
+ }
14
+ /**
15
+ * An export registered under an id: the template that declares it, and the
16
+ * canonical name it is exported under.
17
+ */
18
+ export interface RegisteredExport {
19
+ registerId: string;
20
+ exportName: string;
21
+ filename: string;
22
+ }
23
+ export declare function trackFunction(fn: t.NodePath<t.Function>, fnExtra: RegisteredFnExtra, markoRoot: MarkoRootPath): void;
24
+ export declare function canIgnoreRegister(markoRoot: MarkoRootPath, exprRoot: t.NodePath<t.Node>): boolean;
25
+ export declare function addFunctionReasons(): void;
26
+ export declare function finalizeRegistrations(): void;
27
+ /**
28
+ * Tracks a template imported as a default export. The server writes a template
29
+ * only as a binding's value, so the importing template registers it when one may.
30
+ */
31
+ export declare function trackImportedTemplate(importDecl: t.NodePath<t.ImportDeclaration>, local: string, templateFile: t.BabelFile): void;
32
+ /**
33
+ * Tracks an export imported from another template that registers under an id,
34
+ * if it does. The importing template registers it (under that id) when client
35
+ * code reads its own references.
36
+ */
37
+ export declare function trackImport(importDecl: t.NodePath<t.ImportDeclaration>, local: string, registered: RegisteredExport | undefined, fnRoots?: Set<t.NodeExtra>): void;
38
+ /**
39
+ * Finds the id reserved for an export, following `export ... from` hops. Each
40
+ * template only records the exports it declares, so this resolves on demand:
41
+ * a template in an import cycle is read while it is still analyzing, and would
42
+ * hand out an incomplete map if the ids were pushed ahead of time.
43
+ */
44
+ export declare function resolveRegisteredExport(file: t.BabelFile, exportName: string, seen?: Set<string>): RegisteredExport | undefined;
2
45
  /**
3
46
  * Writes the registrations for module scoped functions: the ones this template
4
47
  * exports and registers itself, and the ones it imports from a template that
5
48
  * reserved a register id without registering it; and for templates it imports.
6
49
  */
7
50
  export declare function writeModuleRegistrations(program: t.NodePath<t.Program>): void;
51
+ export {};
@@ -9,7 +9,7 @@ export type AttrTagLookup = Record<string, AttrTagMeta>;
9
9
  type AttrTagNames = string[];
10
10
  declare module "@marko/compiler/dist/types" {
11
11
  interface MarkoTagExtra {
12
- attributeTags?: AttrTagLookup;
12
+ attrTagLookup?: AttrTagLookup;
13
13
  attributeTagGroup?: AttrTagLookup[string]["group"];
14
14
  }
15
15
  }
@@ -14,10 +14,13 @@ export declare class Sorted<T> {
14
14
  add<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): SortedOneMany<U>;
15
15
  union<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): SortedOpt<U>;
16
16
  filter<U extends NonNullable<T>>(data: SortedOpt<U>, cb: (item: U) => boolean): SortedOpt<U>;
17
+ leadingRun<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, bound: K): SortedOpt<U>;
18
+ range<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, bound: K): SortedOpt<U>;
19
+ forEachRun<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, fn: (key: K, run: SortedOneMany<U>) => void): void;
20
+ reduceRuns<U extends NonNullable<T>, K, R>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, fn: (acc: R, key: K, run: SortedOneMany<U>) => R, initial: R): R;
17
21
  find<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): U | undefined;
18
22
  has<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): boolean;
19
23
  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
24
  intersects<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): boolean;
22
25
  difference<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): SortedOpt<U>;
23
26
  isSuperset<U extends NonNullable<T>>(superset: SortedOpt<U>, subset: SortedOpt<U>): boolean;
@@ -29,10 +32,11 @@ export declare function filter<T>(data: Opt<T>, cb: (item: T) => boolean): Opt<T
29
32
  export declare function forEach<T>(data: Opt<T>, cb: (item: T, index: number) => void): void;
30
33
  export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
31
34
  export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
32
- export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
35
+ export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => unknown): boolean;
33
36
  export declare function every<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
34
37
  export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item: T, index: number) => R | undefined): R | undefined;
35
38
  export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
39
+ export declare function reduceWhile<T, R>(data: Opt<T>, cb: (acc: R, item: T) => R | undefined, initial: R): R | undefined;
36
40
  export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
37
41
  export declare function toSet<T>(data: Opt<T>): Set<T>;
38
42
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
@@ -41,5 +45,6 @@ export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item:
41
45
  export declare function addSorted<T, U extends T[]>(compare: Compare<T>, data: U, item: T): U;
42
46
  export declare function at<T>(data: Opt<T>, index: number): T | undefined;
43
47
  export declare function first<T>(data: OneMany<T>): T;
48
+ export declare function last<T>(data: OneMany<T>): T;
44
49
  export declare function rest<T>(data: OneMany<T>): Opt<T>;
45
50
  export {};
@@ -0,0 +1,18 @@
1
+ import { type Binding } from "./bindings";
2
+ export type ParamsTree = {
3
+ binding: Binding;
4
+ props: {
5
+ [prop: string]: ParamsTree;
6
+ } | undefined;
7
+ rest: ParamsTree | undefined;
8
+ };
9
+ declare module "@marko/compiler/dist/types" {
10
+ interface NodeExtra {
11
+ nameOnly?: true;
12
+ }
13
+ }
14
+ export declare function exposeParamsTree(binding: Binding, bodyAnalyzed?: boolean): ParamsTree;
15
+ export declare function getSettledParamsTree(paramsTree: ParamsTree | undefined): ParamsTree | undefined;
16
+ export declare function getParamsTreeAt(paramsTree: ParamsTree | true, name: string): ParamsTree | true | undefined;
17
+ export declare function getAllKnownPropNames(paramsTree: ParamsTree): string[];
18
+ export declare function hasAllKnownProps(paramsTree: ParamsTree): boolean | undefined;
@@ -1,16 +1,16 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type ReferencedBindings } from "./bindings";
3
- import { type Opt, Sorted, type SortedOneMany } from "./optional";
4
- import { type KnownExprs } from "./references";
2
+ import { type Binding, type ParamBinding, type ReferencedBindings } from "./bindings";
3
+ import { type Opt, type SortedOneMany } from "./optional";
5
4
  import { type ParamReasonGroups, type Section } from "./sections";
6
5
  import { type Slot } from "./slots";
7
6
  import { type Sources } from "./sources";
8
7
  export type Reasons = SortedOneMany<Sources>;
9
- export declare const sourcesUtil: Sorted<Sources>;
10
8
  export type Reason = Sources;
11
9
  export declare function addReason(slot: Slot, reason: undefined | false | Reason): void;
10
+ export declare function addAlwaysReason(binding: Binding): void;
12
11
  export declare function addReasonExprs(slot: Slot, expr: Opt<t.NodeExtra>): void;
13
12
  export declare function addOwnerReason(from: Section, to: Section, reason: undefined | false | Reason): void;
13
+ export declare function mapBodyParams(section: Section, reason: undefined | Reason, seen?: Set<ParamBinding>): Reason | undefined;
14
14
  export declare function isConditionalReason(reason: undefined | Reason): reason is Sources & {
15
15
  state: undefined;
16
16
  always: undefined;
@@ -22,11 +22,16 @@ export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra> | boolean): S
22
22
  export declare function getSourcesForRef(ref: ReferencedBindings): Sources | undefined;
23
23
  export declare function getSourcesForDerived({ binding, exprs, properties, }: NonNullable<Section["derives"]>): Sources | undefined;
24
24
  export declare function mapParamReason(program: Section, reason: Sources, exprs: KnownExprs | undefined, ownParams: boolean): Reason | undefined;
25
- export declare function mergeReasons(a: Reason, b: undefined | Reason): Reason;
26
- export declare function mergeReasons(a: undefined | Reason, b: Reason): Reason;
27
- export declare function mergeReasons(a: undefined | Reason, b: undefined | Reason): Reason | undefined;
25
+ export interface KnownExprs {
26
+ known?: Record<string, KnownExprs>;
27
+ value?: t.NodeExtra;
28
+ }
29
+ export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: Opt<ParamBinding>): Opt<t.NodeExtra>;
30
+ export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: boolean | Opt<ParamBinding>): Opt<t.NodeExtra> | true;
31
+ export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamBinding): Opt<t.NodeExtra>;
32
+ export declare function getKnownExprsAt(exprs: KnownExprs, binding: Binding): KnownExprs;
28
33
  export declare function applyReasonExprs(section: Section): void;
29
- export declare function finalizeReason(section: Section): void;
34
+ export declare function mergeSlotReasons(section: Section): void;
30
35
  export declare function getNodeReasons(section: Section): Sources | import("./optional").SortedMany<Sources> | undefined;
31
36
  export declare function getReasonsVersion(): number;
32
37
  export declare function setParamReasonGroups(section: Section, groups: ParamReasonGroups): void;
@@ -1,41 +1,42 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding, BindingType, type Getter, type ParamBinding, type ReferencedBindings } from "./bindings";
2
+ import { type Binding, BindingType, type Getter, type ReferencedBindings } from "./bindings";
3
3
  import { type OneMany, type Opt, type SortedOpt } from "./optional";
4
- import { type Reason } from "./reasons";
4
+ import { type KnownExprs, type Reason } from "./reasons";
5
5
  import { type Section } from "./sections";
6
6
  interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
7
7
  }
8
8
  export interface Read {
9
9
  binding: Binding;
10
10
  extra: t.NodeExtra;
11
- ownVar: boolean;
11
+ inOwnBody: boolean;
12
12
  getter: Getter | undefined;
13
13
  comparedTo: t.Node | undefined;
14
14
  deferred: boolean;
15
15
  /** The outermost function holding it; none when that escapes into a call. */
16
16
  fnRoot: ReferencedFunctionExtra | undefined;
17
17
  }
18
- export interface ExtraRead {
18
+ export interface ResolvedRead {
19
19
  binding: Binding;
20
20
  props: Opt<string>;
21
- ownVar: boolean;
21
+ inOwnBody: boolean;
22
22
  getter: Getter | undefined;
23
23
  /** Set for same-section local reads: the function root that owns the read. */
24
24
  localFn?: ReferencedFunctionExtra;
25
25
  }
26
26
  declare const kReferencedBindings: unique symbol;
27
27
  declare const kLazyBindings: unique symbol;
28
- declare const kGlobalBindings: unique symbol;
29
28
  declare const kReferencedBindingsInFunction: unique symbol;
30
29
  declare const kConstantBindingsInFunction: unique symbol;
31
30
  declare module "@marko/compiler/dist/types" {
32
31
  interface ProgramExtra {
33
32
  /** An expression reads `$global`, so HTML output declares a const for it. */
34
33
  hasGlobalRead?: true;
34
+ /** The template's `$global`: a signal-inert root binding, made on its first read. */
35
+ globalBinding?: Binding;
35
36
  }
36
37
  interface MarkoTagExtra {
37
- /** The dom binding the tag is addressed by: its node, marker or child
38
- * scope; an only child control flow tag shares its parent's. */
38
+ /** The dom binding the tag is addressed by: its node or marker; an only
39
+ * child control flow tag shares its parent's. */
39
40
  nodeBinding?: Binding;
40
41
  }
41
42
  interface MarkoPlaceholderExtra {
@@ -46,11 +47,10 @@ declare module "@marko/compiler/dist/types" {
46
47
  section?: Section;
47
48
  [kReferencedBindings]?: ReferencedBindings;
48
49
  [kLazyBindings]?: ReferencedBindings;
49
- [kGlobalBindings]?: ReferencedBindings;
50
- /** The bindings it feeds, in the order it feeds them: a call site's
51
- * values feed the child template's, so no one template's order sorts them. */
50
+ /** The bindings it derives, in the order it derives them: call sites
51
+ * derive a child template's, so no one template's order sorts them. */
52
52
  derives?: Opt<Binding>;
53
- /** The initial value of the binding it feeds, which keeps it rather than
53
+ /** The initial value of the binding it derives, which keeps it rather than
54
54
  * following it, so the binding derives no sources from it. */
55
55
  initialValue?: true;
56
56
  /** Its value has no side effect to evaluate, so an unread one can go: an
@@ -62,8 +62,8 @@ declare module "@marko/compiler/dist/types" {
62
62
  binding?: Binding;
63
63
  assignment?: Binding;
64
64
  assignmentTo?: Binding;
65
- read?: ExtraRead;
66
- pruned?: true;
65
+ read?: ResolvedRead;
66
+ dropped?: true;
67
67
  /** The expression this node sits in: dropped or merged as one. */
68
68
  exprRoot?: NodeExtra;
69
69
  isEffect?: true;
@@ -105,12 +105,12 @@ export declare function isTagVarUsed(tag: t.NodePath<t.MarkoTag>): boolean;
105
105
  export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): Binding | undefined;
106
106
  export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, aliased?: Binding["aliasOf"]): Binding | undefined;
107
107
  export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
108
- export declare function isReferenceInOwnBody(bindingPath: t.NodePath, reference: t.NodePath): boolean;
109
108
  export declare function isReferenceHoisted(bindingPath: t.NodePath, reference: t.NodePath): boolean;
110
- export declare function assertReferencedInRender(ref: t.NodePath, name: string, markoRoot?: import("./get-root").MarkoExprRootPath | null): void;
109
+ export declare function assertReferencedInRender(ref: t.NodePath, name: string, markoRoot?: import("./get-root").MarkoRootPath | null): void;
111
110
  export declare function setReferencesScope(path: t.NodePath<any>): void;
112
111
  export declare function trackGlobalReference(path: t.NodePath<t.Identifier>): void;
113
112
  export declare function mergeReferences<T extends t.Node>(section: Section, target: T, nodes: (t.Node | undefined)[]): NonNullable<T["extra"]> & ReferencedExtra;
113
+ export declare function mergeTagReferences(section: Section, tag: t.MarkoTag): t.MarkoTagExtra & t.NodeExtra & ReferencedExtra;
114
114
  export declare function mergeReferenceGroup(section: Section, nodes: (t.Node | undefined)[]): ReferencedExtra;
115
115
  export declare function setDerivedFrom(binding: Binding, expr: boolean | Opt<t.NodeExtra>, exprs?: KnownExprs): void;
116
116
  export declare const getAssignments: () => AssignedBindingExtra[];
@@ -123,8 +123,8 @@ export declare function dropNodes(node: t.Node | t.Node[]): void;
123
123
  export declare function dropExtra(exprExtra: ReferencedExtra): void;
124
124
  export declare function dropContent(body: t.MarkoTagBody): void;
125
125
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
126
- export declare function createRead(binding: Binding, props: Opt<string>, ownVar?: boolean): ExtraRead;
127
- export declare function createGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ExtraRead;
126
+ export declare function createResolvedRead(binding: Binding, props: Opt<string>, inOwnBody?: boolean): ResolvedRead;
127
+ export declare function createResolvedGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ResolvedRead;
128
128
  export interface ReferencedExtra extends t.NodeExtra {
129
129
  section: Section;
130
130
  }
@@ -135,26 +135,22 @@ export interface AssignedBindingExtra extends ReferencedExtra {
135
135
  /** The outermost function holding it; none when that escapes into a call. */
136
136
  fnRoot: ReferencedFunctionExtra | undefined;
137
137
  }
138
- export declare function hasResumableWriter(binding: Binding): boolean;
138
+ export declare function hasResumableAssignment(binding: Binding): boolean;
139
139
  export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined): extra is AssignedBindingExtra;
140
140
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
141
+ exprRoot: t.NodeExtra;
141
142
  name: string;
142
143
  registerId: string;
143
144
  reason: Reason;
144
145
  }
145
146
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
146
147
  export declare function getReferencedBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
148
+ export declare function getBindingsDerivedFrom(binding: Binding): ReferencedBindings;
149
+ export declare function getValueReferences(exprs: Opt<t.NodeExtra>): ReferencedBindings;
147
150
  export declare function getLazyBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
148
- export declare function getGlobalBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
149
151
  export declare function getReferencedBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
150
152
  export declare function getConstantBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
151
153
  export declare function setResolvedFunctionReads(extra: t.FunctionExtra, referencedBindings: ReferencedBindings, constantBindings: ReferencedBindings): void;
152
- export declare function setResolvedReads(extra: ReferencedExtra, referencedBindings: ReferencedBindings, lazyBindings: ReferencedBindings, globalBindings: ReferencedBindings): void;
154
+ export declare function setResolvedReads(extra: ReferencedExtra, referencedBindings: ReferencedBindings, lazyBindings: ReferencedBindings): void;
153
155
  export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
154
- export interface KnownExprs {
155
- known?: Record<string, KnownExprs>;
156
- value?: t.NodeExtra;
157
- }
158
- export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: boolean | Opt<ParamBinding>): true | import("./optional").Many<t.NodeExtra> | t.NodeExtra | undefined;
159
- export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamBinding): Opt<t.NodeExtra>;
160
156
  export {};