marko 6.4.8 → 6.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cheatsheet.md +1 -1
- package/dist/common/constants/closure-signal-prop.d.ts +1 -1
- package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
- package/dist/debug/dom/catch.feat.js +2 -3
- package/dist/debug/dom/catch.feat.mjs +2 -3
- package/dist/debug/dom/controllable-input.feat.js +2 -3
- package/dist/debug/dom/controllable-input.feat.mjs +2 -3
- package/dist/debug/dom/controllable-open.feat.js +2 -3
- package/dist/debug/dom/controllable-open.feat.mjs +2 -3
- package/dist/debug/dom/controllable-select.feat.js +2 -3
- package/dist/debug/dom/controllable-select.feat.mjs +2 -3
- package/dist/debug/dom/controllable-textarea.feat.js +2 -3
- package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
- package/dist/debug/dom/controllable.feat.js +2 -3
- package/dist/debug/dom/controllable.feat.mjs +2 -3
- package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
- package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
- package/dist/debug/dom/lazy.feat.js +2 -3
- package/dist/debug/dom/lazy.feat.mjs +2 -3
- package/dist/debug/dom/placeholder.feat.js +2 -3
- package/dist/debug/dom/placeholder.feat.mjs +2 -3
- package/dist/debug/{dom-CFCBDift.mjs → dom-C1V5vpFs.mjs} +60 -98
- package/dist/debug/{dom-D8znnhpf.js → dom-DNB5yq3U.js} +59 -109
- package/dist/debug/dom.js +9 -14
- package/dist/debug/dom.mjs +9 -14
- package/dist/debug/html.js +39 -51
- package/dist/debug/html.mjs +37 -49
- package/dist/dom/catch.feat.js +4 -5
- package/dist/dom/catch.feat.mjs +2 -3
- package/dist/dom/compat.d.ts +1 -1
- package/dist/dom/control-flow.d.ts +1 -1
- package/dist/dom/controllable-input.feat.js +1 -2
- package/dist/dom/controllable-input.feat.mjs +1 -2
- package/dist/dom/controllable-open.feat.js +2 -3
- package/dist/dom/controllable-open.feat.mjs +2 -3
- package/dist/dom/controllable-select.feat.js +2 -3
- package/dist/dom/controllable-select.feat.mjs +2 -3
- package/dist/dom/controllable-textarea.feat.js +2 -3
- package/dist/dom/controllable-textarea.feat.mjs +2 -3
- package/dist/dom/controllable.feat.js +1 -2
- package/dist/dom/controllable.feat.mjs +1 -2
- package/dist/dom/dom.d.ts +2 -3
- package/dist/dom/dynamic-tag-script.feat.js +3 -4
- package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
- package/dist/dom/dynamic-tag-var.feat.js +3 -4
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
- package/dist/dom/lazy.feat.js +2 -3
- package/dist/dom/lazy.feat.mjs +2 -3
- package/dist/dom/placeholder.feat.js +4 -5
- package/dist/dom/placeholder.feat.mjs +2 -3
- package/dist/dom/resume.d.ts +1 -1
- package/dist/dom/scope.d.ts +1 -1
- package/dist/dom/signals.d.ts +1 -1
- package/dist/{dom-Bpkm72vV.js → dom-C2-Flitp.js} +122 -166
- package/dist/{dom-CVAevsbz.mjs → dom-DsHYWMCR.mjs} +59 -94
- package/dist/dom.js +36 -40
- package/dist/dom.mjs +9 -14
- package/dist/html/serializer.d.ts +1 -1
- package/dist/html/writer.d.ts +3 -3
- package/dist/html.d.ts +1 -1
- package/dist/html.js +60 -74
- package/dist/html.mjs +60 -75
- package/dist/translator/core/show.d.ts +3 -4
- package/dist/translator/index.js +1193 -1295
- package/dist/translator/util/assert.d.ts +9 -2
- package/dist/translator/util/bindings.d.ts +6 -5
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/constants/slot-kind.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +3 -0
- package/dist/translator/util/module-registrations.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +1 -0
- package/dist/translator/util/params-tree.d.ts +3 -3
- package/dist/translator/util/reasons.d.ts +2 -2
- package/dist/translator/util/references.d.ts +13 -10
- package/dist/translator/util/replace-with-statements.d.ts +4 -0
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/scope-accessor.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +38 -14
- package/dist/translator/util/signals.d.ts +3 -11
- package/dist/translator/util/slots.d.ts +1 -1
- package/dist/translator/util/solve-reasons.d.ts +5 -0
- package/dist/translator/util/sources.d.ts +1 -1
- package/dist/translator/util/static-text.d.ts +1 -0
- package/dist/translator/util/structure.d.ts +3 -2
- package/dist/translator/util/tag-import.d.ts +0 -2
- package/dist/translator/util/tag-name-type.d.ts +3 -0
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/placeholder.d.ts +4 -4
- package/package.json +6 -6
- package/tags/lifecycle.d.marko +2 -0
- package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import { type ForType } from "./branch-tag";
|
|
3
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):
|
|
5
|
-
|
|
4
|
+
export declare function assertOnlyValueAttr(tag: t.NodePath<t.MarkoTag>, required: true, change?: boolean, hint?: (attr: t.MarkoAttribute) => string | undefined): {
|
|
5
|
+
valueAttr: t.MarkoAttribute;
|
|
6
|
+
valueChangeAttr: t.MarkoAttribute | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare function assertOnlyValueAttr(tag: t.NodePath<t.MarkoTag>, required?: boolean, change?: boolean, hint?: (attr: t.MarkoAttribute) => string | undefined): {
|
|
9
|
+
valueAttr: t.MarkoAttribute | undefined;
|
|
10
|
+
valueChangeAttr: t.MarkoAttribute | undefined;
|
|
11
|
+
};
|
|
6
12
|
export declare function assertHasVar(tag: t.NodePath<t.MarkoTag>, hint?: string | ((tag: t.NodePath<t.MarkoTag>) => string)): void;
|
|
7
13
|
export declare function assertIdentifierVar(tag: t.NodePath<t.MarkoTag>): void;
|
|
8
14
|
export declare function assertNoTagVarMutation(tag: t.NodePath<t.MarkoTag>): void;
|
|
@@ -10,6 +16,7 @@ export declare function assertHasBody(tag: t.NodePath<t.MarkoTag>): void;
|
|
|
10
16
|
export declare function assertNoBodyContent(tag: t.NodePath<t.MarkoTag>): void;
|
|
11
17
|
export declare function buildAttrsError(tag: t.NodePath<t.MarkoTag>, attrs: t.MarkoTag["attributes"], msg: string): Error;
|
|
12
18
|
export declare function buildAttrNameError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute, msg: string): Error;
|
|
19
|
+
export declare function buildDuplicateAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute): Error;
|
|
13
20
|
/** The loop a `<for>` tag's attributes run, which it requires. */
|
|
14
21
|
export declare function assertForType(tag: t.NodePath<t.MarkoTag>): ForType;
|
|
15
22
|
/** The attributes a loop of `type` takes, besides `by=`. */
|
|
@@ -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
|
-
/**
|
|
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
|
|
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(
|
|
142
|
-
export declare function getDebugNamesAsIdentifier(
|
|
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(
|
|
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
|
|
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
|
|
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 {};
|
|
@@ -6,6 +6,7 @@ import { type Section } from "./sections";
|
|
|
6
6
|
import { type Sources } from "./sources";
|
|
7
7
|
declare const kParamsTree: unique symbol;
|
|
8
8
|
declare const kKnownExprs: unique symbol;
|
|
9
|
+
declare const kPassesInput: unique symbol;
|
|
9
10
|
declare module "@marko/compiler/dist/types" {
|
|
10
11
|
interface MarkoTagExtra {
|
|
11
12
|
/** The dom binding a known tag holds its child's scope in. */
|
|
@@ -15,6 +16,8 @@ declare module "@marko/compiler/dist/types" {
|
|
|
15
16
|
/** The child's params tree the call site was analyzed against. */
|
|
16
17
|
[kParamsTree]?: ParamsTree;
|
|
17
18
|
[kKnownExprs]?: KnownExprs;
|
|
19
|
+
/** The call passes its input after its arguments, as written in source. */
|
|
20
|
+
[kPassesInput]?: boolean;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
export interface KnownTagExtra extends t.MarkoTagExtra {
|
|
@@ -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
|
-
|
|
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
|
|
18
|
-
export declare function
|
|
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
|
|
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):
|
|
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
|
-
|
|
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
|
-
/**
|
|
67
|
-
|
|
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
|
-
|
|
97
|
+
registryId?: string;
|
|
95
98
|
/** When client code reads the function itself, which registers it. */
|
|
96
99
|
reason?: Reason;
|
|
97
|
-
|
|
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
|
|
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,
|
|
129
|
-
export declare function createResolvedGetterRead(binding: Binding,
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
103
|
+
* binding; an `<if>` chain's at `index`, the renderer index it renders as. */
|
|
99
104
|
branch: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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>,
|
|
46
|
-
export declare function buildClosureHop(
|
|
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
|
|
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.
|
|
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;
|
|
@@ -18,5 +18,5 @@ export declare function compareSources(a: Sources, b: Sources): number;
|
|
|
18
18
|
export declare function mergeSources(a: Sources, b: undefined | Sources): Sources;
|
|
19
19
|
export declare function mergeSources(a: undefined | Sources, b: Sources): Sources;
|
|
20
20
|
export declare function mergeSources(a: undefined | Sources, b: undefined | Sources): Sources | undefined;
|
|
21
|
-
export declare function isInParams(binding: Binding, params: Sources["param"]): boolean;
|
|
22
21
|
export declare function isSupersetSources(a: Binding, b: Binding): boolean;
|
|
22
|
+
export declare function isCoveredParam(binding: Binding | undefined, params: Sources["param"]): 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
|
|
12
|
-
export declare function
|
|
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;
|
|
@@ -28,6 +28,9 @@ declare module "@marko/compiler/dist/types" {
|
|
|
28
28
|
type TagNameType = TagNameType.Value;
|
|
29
29
|
export { TagNameType };
|
|
30
30
|
export default function analyzeTagNameType(tag: t.NodePath<t.MarkoTag>): TagNameType.Value;
|
|
31
|
+
/** A native element by its name alone: the tag lookup's verdict on a string, or
|
|
32
|
+
* a template literal without expressions. Loads no template, so pre-analyze may ask. */
|
|
33
|
+
export declare function isStaticNativeTag(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
31
34
|
export declare function getTagRelativePath(tag: t.NodePath<t.MarkoTag>): string;
|
|
32
35
|
/**
|
|
33
36
|
* A known wrong tag that resolves to nothing, eg `interface P { id: number }`,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "6.4.10",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@marko/compiler": "^5.42.
|
|
54
|
+
"@marko/compiler": "^5.42.16",
|
|
55
55
|
"csstype": "^3.2.3",
|
|
56
56
|
"fastest-levenshtein": "^1.0.16",
|
|
57
|
-
"magic-string": "^
|
|
57
|
+
"magic-string": "^1.4.5"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@marko/runtime-tags": "npm:marko@6.4.
|
|
61
|
-
"marko": "5.39.
|
|
60
|
+
"@marko/runtime-tags": "npm:marko@6.4.10",
|
|
61
|
+
"marko": "5.39.49"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=22"
|
|
64
|
+
"node": ">=22.12.0"
|
|
65
65
|
},
|
|
66
66
|
"exports:override": {
|
|
67
67
|
".": {
|
package/tags/lifecycle.d.marko
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** File for types only, not actual implementation **/
|
|
2
2
|
|
|
3
|
+
/* `R` is inferred from what `onMount` returns, so a return value read from `this`
|
|
4
|
+
is circular; such a tag passes its type explicitly (`<lifecycle<{ … }>>`). */
|
|
3
5
|
export type Input<
|
|
4
6
|
T extends object,
|
|
5
7
|
R extends object = {},
|