marko 6.4.8 → 6.4.9

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 (87) hide show
  1. package/dist/common/constants/closure-signal-prop.d.ts +1 -1
  2. package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
  3. package/dist/debug/dom/catch.feat.js +1 -1
  4. package/dist/debug/dom/catch.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +1 -1
  14. package/dist/debug/dom/controllable.feat.mjs +1 -1
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-D8znnhpf.js → dom-QkYva5Qx.js} +35 -61
  24. package/dist/debug/{dom-CFCBDift.mjs → dom-VKjkbuuo.mjs} +36 -50
  25. package/dist/debug/dom.js +4 -4
  26. package/dist/debug/dom.mjs +4 -4
  27. package/dist/debug/html.js +20 -13
  28. package/dist/debug/html.mjs +18 -11
  29. package/dist/dom/catch.feat.js +3 -3
  30. package/dist/dom/catch.feat.mjs +1 -1
  31. package/dist/dom/compat.d.ts +1 -1
  32. package/dist/dom/control-flow.d.ts +1 -1
  33. package/dist/dom/controllable-input.feat.js +1 -1
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +1 -1
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +1 -1
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +1 -1
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.feat.js +1 -1
  42. package/dist/dom/controllable.feat.mjs +1 -1
  43. package/dist/dom/dom.d.ts +2 -3
  44. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  45. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  46. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  47. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  48. package/dist/dom/lazy.feat.js +1 -1
  49. package/dist/dom/lazy.feat.mjs +1 -1
  50. package/dist/dom/placeholder.feat.js +3 -3
  51. package/dist/dom/placeholder.feat.mjs +1 -1
  52. package/dist/dom/resume.d.ts +1 -1
  53. package/dist/dom/scope.d.ts +1 -1
  54. package/dist/dom/signals.d.ts +1 -1
  55. package/dist/{dom-CVAevsbz.mjs → dom-DtKQb840.mjs} +19 -33
  56. package/dist/{dom-Bpkm72vV.js → dom-IujlfJ6b.js} +82 -106
  57. package/dist/dom.js +31 -31
  58. package/dist/dom.mjs +4 -4
  59. package/dist/html/serializer.d.ts +1 -1
  60. package/dist/html/writer.d.ts +3 -3
  61. package/dist/html.d.ts +1 -1
  62. package/dist/html.js +21 -15
  63. package/dist/html.mjs +21 -15
  64. package/dist/translator/core/show.d.ts +3 -4
  65. package/dist/translator/index.js +998 -967
  66. package/dist/translator/util/bindings.d.ts +6 -5
  67. package/dist/translator/util/branch-tag.d.ts +1 -1
  68. package/dist/translator/util/constants/slot-kind.d.ts +1 -1
  69. package/dist/translator/util/module-registrations.d.ts +1 -1
  70. package/dist/translator/util/optional.d.ts +1 -0
  71. package/dist/translator/util/params-tree.d.ts +3 -3
  72. package/dist/translator/util/reasons.d.ts +2 -2
  73. package/dist/translator/util/references.d.ts +13 -10
  74. package/dist/translator/util/replace-with-statements.d.ts +4 -0
  75. package/dist/translator/util/runtime.d.ts +1 -0
  76. package/dist/translator/util/scope-accessor.d.ts +1 -1
  77. package/dist/translator/util/sections.d.ts +38 -14
  78. package/dist/translator/util/signals.d.ts +3 -11
  79. package/dist/translator/util/slots.d.ts +1 -1
  80. package/dist/translator/util/solve-reasons.d.ts +5 -0
  81. package/dist/translator/util/static-text.d.ts +1 -0
  82. package/dist/translator/util/structure.d.ts +3 -2
  83. package/dist/translator/util/tag-import.d.ts +0 -2
  84. package/dist/translator/util/write-guard.d.ts +2 -0
  85. package/dist/translator/visitors/placeholder.d.ts +4 -4
  86. package/package.json +3 -3
  87. package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
@@ -84,7 +84,8 @@ export interface Binding {
84
84
  /** In a template's or `<define>`'s params tree, which known call sites set
85
85
  * directly. */
86
86
  exposed: boolean;
87
- /** Read on invocation from its own scope slot, so its signal stores it. */
87
+ /** Owns a scope slot read on invocation, through it or a direct alias, so
88
+ * its signal stores it. */
88
89
  hasLazyReads: boolean;
89
90
  }
90
91
  /** A param of a template or of a tag body, which its caller supplies. */
@@ -124,7 +125,7 @@ export declare function compareReferences(a: ReferencedBindings, b: ReferencedBi
124
125
  export declare function compareIntersections(a: Intersection, b: Intersection): number;
125
126
  export declare function getAliasRoot(binding: Binding): Binding;
126
127
  export declare const bindingUtil: Sorted<Binding>;
127
- export declare const propsUtil: Sorted<string>;
128
+ export declare const propertiesUtil: Sorted<string>;
128
129
  export declare function getCanonicalBinding(binding: Binding): Binding;
129
130
  export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
130
131
  export declare function someUpToAliasRoot<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
@@ -138,10 +139,10 @@ export declare function getDebugAccess(binding: Binding, toParam: boolean, forma
138
139
  };
139
140
  export declare function isTemplateParam(binding: Binding): boolean;
140
141
  export declare function getDebugName(binding: Binding): string;
141
- export declare function getDebugNames(refs: ReferencedBindings): string;
142
- export declare function getDebugNamesAsIdentifier(refs: ReferencedBindings): string;
142
+ export declare function getDebugNames(bindings: ReferencedBindings): string;
143
+ export declare function getDebugNamesAsIdentifier(bindings: ReferencedBindings): string;
143
144
  export declare function isInvokeOnlyBinding(binding: Binding): boolean;
144
145
  export declare function isOwnBinding(binding: Binding): boolean;
145
- export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
146
+ export declare function hasNonConstantPropertyAlias(binding: Binding): boolean;
146
147
  export declare function getPropertyPath(binding: Binding, ancestor: Binding): Opt<string>;
147
148
  export declare function isIndexProperty(property: string): boolean;
@@ -7,7 +7,7 @@ export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Sectio
7
7
  export declare function getBranchResumeArgs(tag: t.NodePath<t.MarkoTag>, branchReasons: Reasons, singleNode: boolean): (t.Expression | undefined)[];
8
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
- export declare function isSingleNodeBranch(bodySection: Section | undefined): boolean;
10
+ export declare function isSingleNodeContent(content: Section["content"] | undefined): boolean;
11
11
  export type ForType = "in" | "of" | "to" | "until";
12
12
  export declare function buildForRuntimeCall(type: ForType, attrs: Record<string, t.Expression>, params: t.ArrowFunctionExpression["params"], statements: t.Statement[]): t.ExpressionStatement;
13
13
  export declare function getForType(tag: t.MarkoTag): ForType | undefined;
@@ -8,7 +8,7 @@ export declare const Scope = 6;
8
8
  export declare const Owner = 7;
9
9
  export declare const ReturnChangeHandler = 8;
10
10
  export declare const Branch = 9;
11
- export declare const Instances = 10;
11
+ export declare const Scopes = 10;
12
12
  type Self = typeof import("./slot-kind");
13
13
  export type Value = Self[keyof Self];
14
14
  export {};
@@ -16,7 +16,7 @@ declare module "@marko/compiler/dist/types" {
16
16
  * canonical name it is exported under.
17
17
  */
18
18
  export interface RegisteredExport {
19
- registerId: string;
19
+ registryId: string;
20
20
  exportName: string;
21
21
  filename: string;
22
22
  }
@@ -42,6 +42,7 @@ export declare function toSet<T>(data: Opt<T>): Set<T>;
42
42
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
43
43
  export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
44
44
  export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
45
+ export declare function searchSorted<T>(compare: Compare<T>, data: T[], item: T): number;
45
46
  export declare function addSorted<T, U extends T[]>(compare: Compare<T>, data: U, item: T): U;
46
47
  export declare function at<T>(data: Opt<T>, index: number): T | undefined;
47
48
  export declare function first<T>(data: OneMany<T>): T;
@@ -1,7 +1,7 @@
1
1
  import { type Binding } from "./bindings";
2
2
  export type ParamsTree = {
3
3
  binding: Binding;
4
- props: {
4
+ properties: {
5
5
  [prop: string]: ParamsTree;
6
6
  } | undefined;
7
7
  rest: ParamsTree | undefined;
@@ -14,5 +14,5 @@ declare module "@marko/compiler/dist/types" {
14
14
  export declare function exposeParamsTree(binding: Binding, bodyAnalyzed?: boolean): ParamsTree;
15
15
  export declare function getSettledParamsTree(paramsTree: ParamsTree | undefined): ParamsTree | undefined;
16
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;
17
+ export declare function getAllKnownPropertyNames(paramsTree: ParamsTree): string[];
18
+ export declare function hasAllKnownProperties(paramsTree: ParamsTree): boolean | undefined;
@@ -18,7 +18,7 @@ export declare function isGuardedReason(reason: undefined | Reason): reason is S
18
18
  export declare function isStateReason(reason: undefined | Reason): reason is Sources;
19
19
  export declare function getSourcesForExpr(expr: t.NodeExtra): Sources | undefined;
20
20
  export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra> | boolean): Sources | undefined;
21
- export declare function getSourcesForRef(ref: ReferencedBindings): Sources | undefined;
21
+ export declare function getSourcesForReferencedBindings(bindings: ReferencedBindings): Sources | undefined;
22
22
  export declare function getSourcesForDerived({ binding, exprs, properties, }: NonNullable<Section["derives"]>): Sources | undefined;
23
23
  export declare function mapParamReason(program: Section, reason: Sources, exprs: KnownExprs | undefined, ownParams: boolean): Reason | undefined;
24
24
  export interface KnownExprs {
@@ -31,6 +31,6 @@ export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamB
31
31
  export declare function getKnownExprsAt(exprs: KnownExprs, binding: Binding): KnownExprs;
32
32
  export declare function applyReasonExprs(section: Section): void;
33
33
  export declare function mergeSlotReasons(section: Section): void;
34
- export declare function getNodeReasons(section: Section): Sources | import("./optional").SortedMany<Sources> | undefined;
34
+ export declare function getNodeReasons(section: Section): Reasons | undefined;
35
35
  export declare function getReasonsVersion(): number;
36
36
  export declare function setParamReasonGroups(section: Section, groups: ParamReasonGroups): void;
@@ -17,7 +17,7 @@ export interface Read {
17
17
  }
18
18
  export interface ResolvedRead {
19
19
  binding: Binding;
20
- props: Opt<string>;
20
+ properties: Opt<string>;
21
21
  inOwnBody: boolean;
22
22
  getter: Getter | undefined;
23
23
  /** Set for same-section local reads: the function root that owns the read. */
@@ -63,8 +63,9 @@ declare module "@marko/compiler/dist/types" {
63
63
  assignment?: Binding;
64
64
  assignmentTo?: Binding;
65
65
  read?: ResolvedRead;
66
- /** An expression root that is a dynamic tag's name, not one of its inputs. */
67
- tagName?: true;
66
+ /** For an expression root that is a dynamic tag's name, not one of its
67
+ * inputs: that tag. */
68
+ tagName?: t.MarkoTagExtra;
68
69
  dropped?: true;
69
70
  /** The expression this node sits in: dropped or merged as one. */
70
71
  exprRoot?: NodeExtra;
@@ -86,15 +87,17 @@ declare module "@marko/compiler/dist/types" {
86
87
  merged?: NodeExtra;
87
88
  }
88
89
  interface FunctionExtra {
90
+ /** Its body uses its scope when invoked, so a registered one is given it;
91
+ * complete once references finalize. */
89
92
  referencesScope?: boolean;
90
93
  [kReferencedBindingsInFunction]?: ReferencedBindings;
91
94
  referencedLocalBindingsInFunction?: SortedOpt<Binding>;
92
95
  [kConstantBindingsInFunction]?: ReferencedBindings;
93
96
  name?: string;
94
- registerId?: string;
97
+ registryId?: string;
95
98
  /** When client code reads the function itself, which registers it. */
96
99
  reason?: Reason;
97
- exportRegisterId?: string;
100
+ exportRegistryId?: string;
98
101
  }
99
102
  interface ArrowFunctionExpressionExtra extends FunctionExtra {
100
103
  }
@@ -122,11 +125,11 @@ export declare const getReferenceFinalizers: () => (() => void)[];
122
125
  export declare function onFinalizeReferences(finalize: () => void): void;
123
126
  export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
124
127
  export declare function dropNodes(node: t.Node | t.Node[]): void;
125
- export declare function dropExtra(exprExtra: ReferencedExtra): void;
128
+ export declare function dropExpr(exprExtra: ReferencedExtra): void;
126
129
  export declare function dropContent(body: t.MarkoTagBody): void;
127
130
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
128
- export declare function createResolvedRead(binding: Binding, props: Opt<string>, inOwnBody?: boolean): ResolvedRead;
129
- export declare function createResolvedGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ResolvedRead;
131
+ export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean): ResolvedRead;
132
+ export declare function createResolvedGetterRead(binding: Binding, properties: Opt<string>, getter: Getter): ResolvedRead;
130
133
  export interface ReferencedExtra extends t.NodeExtra {
131
134
  section: Section;
132
135
  }
@@ -142,7 +145,7 @@ export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined):
142
145
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
143
146
  exprRoot: t.NodeExtra;
144
147
  name: string;
145
- registerId: string;
148
+ registryId: string;
146
149
  reason: Reason;
147
150
  }
148
151
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
@@ -154,5 +157,5 @@ export declare function getReferencedBindingsInFunction(extra: t.FunctionExtra):
154
157
  export declare function getConstantBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
155
158
  export declare function setResolvedFunctionReads(extra: t.FunctionExtra, referencedBindings: ReferencedBindings, constantBindings: ReferencedBindings): void;
156
159
  export declare function setResolvedReads(extra: ReferencedExtra, referencedBindings: ReferencedBindings, lazyBindings: ReferencedBindings): void;
157
- export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
160
+ export declare function getCanonicalExpr<T extends t.NodeExtra>(extra: T): T;
158
161
  export {};
@@ -0,0 +1,4 @@
1
+ import { types as t } from "@marko/compiler";
2
+ export declare function replaceWithStatements(path: t.NodePath, statements?: t.Statement[]): void;
3
+ export declare function insertStatementBefore(path: t.NodePath, statement: t.Statement): void;
4
+ export declare function writeBodyStatements(body: t.Program | t.MarkoTagBody): void;
@@ -11,4 +11,5 @@ export type DOMRuntimeFeature = (typeof domRuntimeFeatures)[number];
11
11
  export declare function importRuntimeFeature(feature: DOMRuntimeFeature): void;
12
12
  export declare function getRuntimeFeatureImport(feature: DOMRuntimeFeature): t.ImportDeclaration;
13
13
  export declare function getRuntimePath(output: string): string;
14
+ export declare function absentArg(value: 0 | 1): t.NumericLiteral;
14
15
  export declare function getCompatRuntimeFile(): string;
@@ -10,4 +10,4 @@ export declare function getScopeAccessor(binding: Binding, encoded?: boolean, in
10
10
  export declare function getLocalsScopeAccessor(binding: Binding): string;
11
11
  export declare function getPrefixedScopeAccessor(binding: Binding, prefix: AccessorPrefix): string;
12
12
  export declare function getClosureAccessorLiteral(binding: Binding): t.NumericLiteral | t.StringLiteral;
13
- export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral;
13
+ export declare function getSectionScopesAccessorLiteral(section: Section): t.StringLiteral;
@@ -4,7 +4,7 @@ import * as ContentType from "./constants/content-type";
4
4
  import type * as Step from "./constants/step";
5
5
  import * as StructureKind from "./constants/structure-kind";
6
6
  import type { KnownTagExtra } from "./known-tag";
7
- import { type OneMany, type Opt, Sorted, type SortedOpt } from "./optional";
7
+ import { type OneMany, type Opt, Sorted } from "./optional";
8
8
  import { type KnownExprs, type Reason } from "./reasons";
9
9
  import { type Slot } from "./slots";
10
10
  import { type Sources } from "./sources";
@@ -31,7 +31,11 @@ export interface StructureText {
31
31
  export interface StructureNode {
32
32
  kind: typeof StructureKind.Node;
33
33
  binding: Binding | undefined;
34
- marker: boolean;
34
+ /** `undefined` for a text node at its section's edge: a marker where the
35
+ * section is a known child (`isKnownChild`), known once calls are analyzed. */
36
+ marker: boolean | undefined;
37
+ /** A placeholder's text node, written as a space where it is no marker. */
38
+ text?: true;
35
39
  }
36
40
  export interface StructureChild {
37
41
  kind: typeof StructureKind.Child;
@@ -63,8 +67,9 @@ export interface Section {
63
67
  selector: Set<Binding> | undefined;
64
68
  /** The canonical intersections its work waits on, once ids allocate. */
65
69
  intersections: Map<Intersection, IntersectionMeta> | undefined;
66
- /** The slots of its scope, its own and its bindings'. */
67
- slots: SortedOpt<Slot>;
70
+ /** The slots of its scope, its own and its bindings', which `slots.ts` keeps
71
+ * sorted. */
72
+ slots: Slot[];
68
73
  /** When client code reads anything in its scope: its slots' reasons merged. */
69
74
  reason: undefined | Reason;
70
75
  paramReasonGroups: ParamReasonGroups | undefined;
@@ -73,7 +78,7 @@ export interface Section {
73
78
  branchExpr: t.NodeExtra | undefined;
74
79
  /** For a `<define>` body or a template rendering itself, the known tags whose
75
80
  * direct calls render it (each in its child scope binding's section). */
76
- calls: Opt<KnownTagExtra>;
81
+ renderedBy: Opt<KnownTagExtra>;
77
82
  /** The known tags rendering in it, in analyze order. */
78
83
  knownTags: KnownTagExtra[] | undefined;
79
84
  /** The content's rendering tag (its extra), and each child binding that
@@ -95,14 +100,14 @@ export interface Section {
95
100
  * `<define>` body or template it calls in place. */
96
101
  hasSetupWork: boolean;
97
102
  /** Its tag, which renders it in place into branch scopes at the tag's node
98
- * binding, and whether its branch expression's value can leave it unrendered. */
103
+ * binding; an `<if>` chain's at `index`, the renderer index it renders as. */
99
104
  branch: {
100
- nodeBinding: Binding;
101
- optional: boolean;
102
- /** An `<if>` branch's place in its chain, the renderer index it renders as. */
103
- index?: number;
104
- /** An `<await>` body, made with its owner: its promise settles into it. */
105
- await?: true;
105
+ kind: "if";
106
+ tag: ControlFlowTagExtra;
107
+ index: number;
108
+ } | {
109
+ kind: "for" | "await" | "try";
110
+ tag: ControlFlowTagExtra;
106
111
  } | undefined;
107
112
  content: null | {
108
113
  startType: ContentType;
@@ -111,6 +116,10 @@ export interface Section {
111
116
  };
112
117
  structure: StructureOp[] | null;
113
118
  }
119
+ /** A control flow tag's extra once analyzed: its branches render at its node. */
120
+ export interface ControlFlowTagExtra extends t.MarkoTagExtra {
121
+ nodeBinding: Binding;
122
+ }
114
123
  declare module "@marko/compiler/dist/types" {
115
124
  interface ProgramExtra {
116
125
  section?: Section;
@@ -119,6 +128,16 @@ declare module "@marko/compiler/dist/types" {
119
128
  interface MarkoTagBodyExtra {
120
129
  section?: Section;
121
130
  }
131
+ interface MarkoTagExtra {
132
+ /** For a tag rendering content in its place or through a template, whether
133
+ * text may merge into it from before; `undefined` at its section's edge. */
134
+ textBefore?: boolean;
135
+ }
136
+ interface MarkoPlaceholderExtra {
137
+ /** Whether text may merge into its text node from before; `undefined` at its
138
+ * section's edge. */
139
+ textBefore?: boolean;
140
+ }
122
141
  }
123
142
  export declare const sectionUtil: Sorted<Section>;
124
143
  export declare function ensureBodySection(path: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
@@ -129,10 +148,15 @@ export declare function getSection(path: t.NodePath): Section;
129
148
  export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
130
149
  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;
131
150
  export declare function forEachSection(fn: (section: Section) => void): void;
132
- export declare function getDynamicTagContentClosures(section: Section): SortedOpt<Binding>;
151
+ export declare function getDynamicTagContentClosures(section: Section): import("./optional").SortedOpt<Binding>;
133
152
  export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
134
153
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
154
+ export declare function getContentInfo(path: t.NodePath<t.Program | t.MarkoTagBody>): Section["content"];
135
155
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge: "startType" | "endType"): ContentType.Value | null;
156
+ export declare function isKnownChild(section: Section): boolean;
157
+ export declare const getSectionTextBefore: (key: Section) => boolean | undefined;
158
+ export declare function mayEndWithText(section: Section): boolean;
159
+ export declare function mayMergeWithText(path: t.NodePath, before: boolean): boolean | undefined;
136
160
  export declare function getRendererReason(section: Section): false | Sources;
137
161
  export declare function isOptionalBranch(section: Section): section is Section & {
138
162
  branch: NonNullable<Section["branch"]>;
@@ -141,7 +165,7 @@ export declare function isInParentSection(binding: Binding, section: Section): b
141
165
  export declare function isDirectClosure(section: Section, closure: Binding): boolean;
142
166
  export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
143
167
  export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
144
- export declare function getDirectClosures(section: Section): SortedOpt<Binding>;
168
+ export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
145
169
  export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
146
170
  export declare function getCommonSection(section: Section, other: Section): Section;
147
171
  export declare function ensureSectionReasonGroups(section: Section): void;
@@ -33,17 +33,9 @@ export interface Signal {
33
33
  buildAssignment: ((valueSection: Section, value: t.Expression) => t.Expression | undefined) | undefined;
34
34
  }
35
35
  type closureSignalBuilder = (closure: Binding, render: t.Expression) => t.Expression;
36
- export type ClosureHop = {
37
- kind: "if";
38
- nodeBinding: Binding;
39
- index: number;
40
- } | {
41
- kind: "for";
42
- nodeBinding: Binding;
43
- };
44
36
  export declare const getSignals: (section: Section) => Map<unknown, Signal>;
45
- export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, hop: ClosureHop, build?: closureSignalBuilder): void;
46
- export declare function buildClosureHop(hop: ClosureHop, render: t.Expression): t.CallExpression;
37
+ export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, build?: closureSignalBuilder): void;
38
+ export declare function buildClosureHop(section: Section, render: t.Expression): t.CallExpression;
47
39
  export declare function setSectionOwnerResumedByMarker(section: Section): void;
48
40
  export declare function getContentClosureValues(bodySection: Section): {
49
41
  scope: t.Identifier;
@@ -65,7 +57,7 @@ export declare function trimEmptyArgs(args: (t.Expression | undefined | false)[]
65
57
  export declare function addStatement(type: "render" | "effect", targetSection: Section, expr: t.NodeExtra | undefined, statement: t.Statement | t.Statement[] | t.Expression, isPure?: boolean): void;
66
58
  export declare function addTagStatement(tag: t.NodePath<t.MarkoTag>, statement: t.Statement): void;
67
59
  export declare function addValue(targetSection: Section, expr: t.NodeExtra | undefined, signal: Signal, value?: t.Expression): void;
68
- export declare function getResumeRegisterId(section: Section, referencedBindings: string | ReferencedBindings, type?: string): string;
60
+ export declare function getResumeRegistryId(section: Section, referencedBindings: string | ReferencedBindings, type?: string): string;
69
61
  export declare function writeSignals(section: Section): Set<Signal>;
70
62
  export declare function writeRegisteredFns(): void;
71
63
  export declare function addHTMLEffectCall(section: Section, expr?: t.NodeExtra): void;
@@ -8,7 +8,7 @@ type SlotKind = SlotKind.Value;
8
8
  export { SlotKind };
9
9
  export type BindingSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.BranchExpr | typeof SlotKind.ParamGroup;
10
10
  export type SectionSlotKind = Exclude<SlotKind, BindingSlotKind>;
11
- export type PlaceSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.Owner | typeof SlotKind.ReturnChangeHandler | typeof SlotKind.Instances;
11
+ export type PlaceSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.Owner | typeof SlotKind.ReturnChangeHandler | typeof SlotKind.Scopes;
12
12
  /** A place in a scope that client code may read after resume, or a fact about
13
13
  * one a guard decides on (a condition changing, a branch or group resuming). */
14
14
  export type Slot = BindingSlot | SectionSlot;
@@ -7,4 +7,9 @@ export declare function solveReasons(intersectionsBySection: Map<Section, Inters
7
7
  export declare function getReasonForBinding(binding: Binding, properties?: Opt<string> | true): undefined | Reason;
8
8
  export declare function getReasonForExpr(extra: t.NodeExtra): undefined | Reason;
9
9
  export declare function bindingLandsRetained(binding: Binding, properties: Opt<string>): boolean;
10
+ export declare function getContentSites({ binding, properties, }: NonNullable<Section["derives"]>): {
11
+ unseen: boolean;
12
+ sites: Opt<t.MarkoTagExtra>;
13
+ deepSites: Opt<t.MarkoTagExtra>;
14
+ };
10
15
  export declare function landsRetained(extra: t.NodeExtra): boolean;
@@ -1,4 +1,5 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  export declare function isStaticText(node?: t.Node): boolean | undefined;
3
3
  export declare function followsStaticText(path: t.NodePath): boolean | undefined;
4
+ export declare function getPlaceholderContentType(placeholder: t.MarkoPlaceholder): 2 | 4 | null;
4
5
  export declare function getStaticPlaceholderText(placeholder: t.MarkoPlaceholder): string | undefined;
@@ -8,8 +8,9 @@ export declare function child(tag: t.NodePath<t.MarkoTag>, name: string, rendere
8
8
  export declare function writeTo(path: t.NodePath<any>): (strs: TemplateStringsArray, ...exprs: string[]) => void;
9
9
  export declare function writeModuleReadTo(path: t.NodePath<any>, read: string[]): void;
10
10
  export declare function writeTextTo(path: t.NodePath<any>, value: string): void;
11
- export declare function node(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding?: Binding): StructureNode | undefined;
12
- export declare function marker(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding: Binding): void;
11
+ export declare function node(path: t.NodePath<t.MarkoTag>, binding?: Binding): StructureNode | undefined;
12
+ export declare function text(path: t.NodePath<t.MarkoPlaceholder>, binding: Binding, marker: boolean | undefined): void;
13
+ export declare function marker(path: t.NodePath<t.MarkoTag>, binding: Binding): void;
13
14
  export declare function controlFlowNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
14
15
  interface SectionMeta {
15
16
  walks: t.Expression | undefined;
@@ -13,8 +13,6 @@ export type LoadImportConfig = {
13
13
  render: false;
14
14
  triggers: LoadTrigger[];
15
15
  };
16
- export declare function importOrSelfReferenceName(file: t.BabelFile, request: string, name: string, nameHint?: string): t.Identifier;
17
- export declare function isCircularRequest(file: t.BabelFile, request: string): boolean;
18
16
  export declare function trackTagImport(tagImport: string): void;
19
17
  export declare function getImportFacts(importDecl: t.NodePath<t.ImportDeclaration>): t.ImportDeclarationExtra & t.NodeExtra;
20
18
  export declare function getLoadAttr(importDecl: t.NodePath<t.ImportDeclaration>): t.NodePath<t.ImportAttribute> | undefined;
@@ -15,3 +15,5 @@ export declare function getWriteGuard(section: Section, reason: undefined | Reas
15
15
  export declare function getWriteGuardForAny(section: Section, reasons: undefined | Reasons, omitUnconditional: boolean): t.Expression | undefined;
16
16
  export declare function getExprIfWritten(section: Section, reason: undefined | Reason, expr: t.Expression): t.Expression | undefined;
17
17
  export declare function isEverWritten(section: Section, reason: undefined | Reason): boolean;
18
+ export declare function isWrittenForCall(section: Section, reason: undefined | Reason, call: t.MarkoTagExtra, callSection: Section): boolean;
19
+ export declare function getWriteBit(section: Section, reason: undefined | Reason): number | undefined;
@@ -1,10 +1,10 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import * as SiblingText from "./constants/sibling-text";
3
- declare const kSiblingText: unique symbol;
4
- type SiblingText = SiblingText.Value;
2
+ declare const kTextAfter: unique symbol;
5
3
  declare module "@marko/compiler/dist/types" {
6
4
  interface MarkoPlaceholderExtra {
7
- [kSiblingText]?: SiblingText;
5
+ /** Whether text may merge into its text node from after; `undefined` at its
6
+ * section's edge. */
7
+ [kTextAfter]?: boolean;
8
8
  }
9
9
  }
10
10
  declare const _default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.8",
3
+ "version": "6.4.9",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -51,13 +51,13 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@marko/compiler": "^5.42.14",
54
+ "@marko/compiler": "^5.42.15",
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.4.8",
60
+ "@marko/runtime-tags": "npm:marko@6.4.9",
61
61
  "marko": "5.39.48"
62
62
  },
63
63
  "engines": {
@@ -1,6 +0,0 @@
1
- export declare const None = 0;
2
- export declare const Before = 1;
3
- export declare const After = 2;
4
- type Self = typeof import("./sibling-text");
5
- export type Value = Self[keyof Self];
6
- export {};