marko 6.4.10 → 6.4.12
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/dist/common/accessor.d.ts +0 -3
- package/dist/common/accessor.debug.d.ts +0 -3
- package/dist/common/attr-tag.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +3 -1
- package/dist/common/types.d.ts +4 -3
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/compat.feat.js +143 -0
- package/dist/debug/dom/compat.feat.mjs +141 -0
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-DNB5yq3U.js → dom-CtXOr4Nm.js} +257 -230
- package/dist/debug/{dom-C1V5vpFs.mjs → dom-DaHYZpf2.mjs} +238 -229
- package/dist/debug/dom.js +8 -134
- package/dist/debug/dom.mjs +5 -126
- package/dist/debug/html/compat.feat.js +222 -0
- package/dist/debug/html/compat.feat.mjs +220 -0
- package/dist/debug/html-DMo6pc_h.mjs +3931 -0
- package/dist/debug/html-DfZjMkhx.js +4513 -0
- package/dist/debug/html.js +83 -4239
- package/dist/debug/html.mjs +1 -4152
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
- package/dist/dom/compat.feat.js +101 -0
- package/dist/dom/compat.feat.mjs +100 -0
- package/dist/dom/control-flow.d.ts +4 -5
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dom.d.ts +2 -1
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/load.d.ts +3 -4
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +1 -2
- package/dist/dom/resume.d.ts +3 -1
- package/dist/dom/signals.d.ts +5 -7
- package/dist/{dom-C2-Flitp.js → dom-BB-Te-3z.js} +222 -239
- package/dist/{dom-DsHYWMCR.mjs → dom-BO-0hzLZ.mjs} +124 -146
- package/dist/dom.d.ts +1 -2
- package/dist/dom.js +17 -95
- package/dist/dom.mjs +6 -79
- package/dist/html/assets.d.ts +3 -4
- package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
- package/dist/html/compat.feat.js +165 -0
- package/dist/html/compat.feat.mjs +164 -0
- package/dist/html/dynamic-tag.d.ts +1 -2
- package/dist/html/for.d.ts +0 -1
- package/dist/html/writer.d.ts +4 -3
- package/dist/html-DMDc0zKs.mjs +2404 -0
- package/dist/html-DrHsybFm.js +2880 -0
- package/dist/html.d.ts +1 -2
- package/dist/html.js +2 -2578
- package/dist/html.mjs +3 -2573
- package/dist/translator/index.d.ts +0 -1
- package/dist/translator/index.js +4889 -4733
- package/dist/translator/interop/out-global.d.ts +5 -0
- package/dist/translator/util/assert.d.ts +6 -0
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/entry-builder.d.ts +1 -1
- package/dist/translator/util/finalize-references.d.ts +2 -1
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +10 -1
- package/dist/translator/util/optional.d.ts +0 -1
- package/dist/translator/util/reasons.d.ts +0 -1
- package/dist/translator/util/references.d.ts +12 -5
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +11 -2
- package/dist/translator/util/signals.d.ts +2 -1
- package/dist/translator/util/style-interpolation.d.ts +1 -1
- package/dist/translator/util/tag-facts.d.ts +2 -0
- package/dist/translator/util/tag-name-type.d.ts +1 -0
- package/dist/translator/util/translate-attrs.d.ts +1 -4
- package/dist/translator/util/visitors.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/program/index.d.ts +2 -6
- package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
- package/index.d.ts +2 -7
- package/package.json +4 -4
- package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
- package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
|
@@ -14,7 +14,10 @@ export declare function assertIdentifierVar(tag: t.NodePath<t.MarkoTag>): void;
|
|
|
14
14
|
export declare function assertNoTagVarMutation(tag: t.NodePath<t.MarkoTag>): void;
|
|
15
15
|
export declare function assertHasBody(tag: t.NodePath<t.MarkoTag>): void;
|
|
16
16
|
export declare function assertNoBodyContent(tag: t.NodePath<t.MarkoTag>): void;
|
|
17
|
+
export declare function assertNoNativeAttrTags(tag: t.NodePath<t.MarkoTag>): void;
|
|
18
|
+
export declare function assertNotContentAttrTag(tag: t.NodePath<t.MarkoTag>): void;
|
|
17
19
|
export declare function buildAttrsError(tag: t.NodePath<t.MarkoTag>, attrs: t.MarkoTag["attributes"], msg: string): Error;
|
|
20
|
+
export declare function buildAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoTag["attributes"][number], msg: string): Error;
|
|
18
21
|
export declare function buildAttrNameError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute, msg: string): Error;
|
|
19
22
|
export declare function buildDuplicateAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute): Error;
|
|
20
23
|
/** The loop a `<for>` tag's attributes run, which it requires. */
|
|
@@ -23,3 +26,6 @@ export declare function assertForType(tag: t.NodePath<t.MarkoTag>): ForType;
|
|
|
23
26
|
export declare function getForAttrs(type: ForType): string[];
|
|
24
27
|
/** Throws for a param that a loop of `type` never supplies. */
|
|
25
28
|
export declare function assertForParams(tag: t.NodePath<t.MarkoTag>, type: ForType): void;
|
|
29
|
+
export declare function coreTagLink(tag: t.NodePath<t.MarkoTag>): string;
|
|
30
|
+
export declare function isValueAttr(attr: t.MarkoTag["attributes"][number]): attr is t.MarkoAttribute;
|
|
31
|
+
export declare function isValueChangeAttr(attr: t.MarkoTag["attributes"][number]): attr is t.MarkoAttribute;
|
|
@@ -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 isSingleNodeContent(content: Section["content"]
|
|
10
|
+
export declare function isSingleNodeContent(content: Section["content"]): 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;
|
|
@@ -34,7 +34,7 @@ export type Reach = 0 | 1 | 2;
|
|
|
34
34
|
type EntryFile = t.BabelFile & {
|
|
35
35
|
[kState]?: EntryState;
|
|
36
36
|
};
|
|
37
|
-
type VisitChild = (id: string, reach?: Reach) => void;
|
|
37
|
+
export type VisitChild = (id: string, reach?: Reach) => void;
|
|
38
38
|
declare const kState: unique symbol;
|
|
39
39
|
declare const builder: {
|
|
40
40
|
build(entryFile: EntryFile, exportInit?: boolean): t.Statement[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type Binding, type Intersection } from "./bindings";
|
|
2
|
+
import { type Binding, type Intersection, type ReferencedBindings } from "./bindings";
|
|
3
3
|
import { type Section } from "./sections";
|
|
4
4
|
export declare function finalizeReferences(): Map<Section, Intersection[]>;
|
|
5
5
|
export declare function allocateIds(intersectionsBySection: Map<Section, Intersection[]>): void;
|
|
6
|
+
export declare function getLastOwnSourceReturn(bindings: ReferencedBindings, section: Section): Binding | undefined;
|
|
6
7
|
export declare function readsValuesOnResume(expr: t.NodeExtra): boolean;
|
|
7
8
|
export declare function hasEmittedAssignment(binding: Binding): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Binding } from "./bindings";
|
|
2
|
-
import {
|
|
2
|
+
import type { Section } from "./sections";
|
|
3
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,10 @@ declare const kParamsTree: unique symbol;
|
|
|
8
8
|
declare const kKnownExprs: unique symbol;
|
|
9
9
|
declare const kPassesInput: unique symbol;
|
|
10
10
|
declare module "@marko/compiler/dist/types" {
|
|
11
|
+
interface MarkoSpreadAttributeExtra {
|
|
12
|
+
/** The binding it spreads, which its known child reads prop by prop. */
|
|
13
|
+
knownSpread?: Binding;
|
|
14
|
+
}
|
|
11
15
|
interface MarkoTagExtra {
|
|
12
16
|
/** The dom binding a known tag holds its child's scope in. */
|
|
13
17
|
childScopeBinding?: Binding;
|
|
@@ -27,9 +31,14 @@ export interface KnownTagExtra extends t.MarkoTagExtra {
|
|
|
27
31
|
export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, childSection: Section, childParamsTree?: ParamsTree): void;
|
|
28
32
|
export declare function analyzeRecursiveTags(): void;
|
|
29
33
|
export declare function knownTagTranslateHTML(tag: t.NodePath<t.MarkoTag>, tagIdentifier: t.Expression): void;
|
|
30
|
-
export declare function knownTagTranslateDOM(tag: t.NodePath<t.MarkoTag>, getBindingIdentifier:
|
|
34
|
+
export declare function knownTagTranslateDOM(tag: t.NodePath<t.MarkoTag>, getBindingIdentifier: TranslateDOMInfo["getBindingIdentifier"], callSetup: ((section: Section, childBinding: Binding) => void) | undefined): void;
|
|
31
35
|
export declare function getCallSiteSources(param: ParamBinding): Sources | undefined;
|
|
32
36
|
export declare function addTagVarBindings(section: Section): void;
|
|
33
37
|
export declare function addKnownTagReasons(section: Section): void;
|
|
34
38
|
export declare function callsOtherTemplateSetup(section: Section): boolean;
|
|
39
|
+
type TranslateDOMInfo = {
|
|
40
|
+
tagSection: Section;
|
|
41
|
+
getBindingIdentifier: (binding: Binding, preferredName?: string, directContent?: boolean) => t.Identifier;
|
|
42
|
+
childScopeBinding: Binding;
|
|
43
|
+
};
|
|
35
44
|
export {};
|
|
@@ -38,7 +38,6 @@ export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item
|
|
|
38
38
|
export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
|
|
39
39
|
export declare function reduceWhile<T, R>(data: Opt<T>, cb: (acc: R, item: T) => R | undefined, initial: R): R | undefined;
|
|
40
40
|
export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
|
41
|
-
export declare function toSet<T>(data: Opt<T>): Set<T>;
|
|
42
41
|
export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
|
|
43
42
|
export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
|
|
44
43
|
export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
|
|
@@ -28,7 +28,6 @@ export interface KnownExprs {
|
|
|
28
28
|
export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: Opt<ParamBinding>): Opt<t.NodeExtra>;
|
|
29
29
|
export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: boolean | Opt<ParamBinding>): Opt<t.NodeExtra> | true;
|
|
30
30
|
export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamBinding): Opt<t.NodeExtra>;
|
|
31
|
-
export declare function getKnownExprsAt(exprs: KnownExprs, binding: Binding): KnownExprs;
|
|
32
31
|
export declare function applyReasonExprs(section: Section): void;
|
|
33
32
|
export declare function mergeSlotReasons(section: Section): void;
|
|
34
33
|
export declare function getNodeReasons(section: Section): Reasons | undefined;
|
|
@@ -7,7 +7,7 @@ interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
|
|
|
7
7
|
}
|
|
8
8
|
export interface Read {
|
|
9
9
|
binding: Binding;
|
|
10
|
-
extra:
|
|
10
|
+
extra: ReadExtra;
|
|
11
11
|
inOwnBody: boolean;
|
|
12
12
|
getter: Getter | undefined;
|
|
13
13
|
comparedTo: t.Node | undefined;
|
|
@@ -53,8 +53,9 @@ declare module "@marko/compiler/dist/types" {
|
|
|
53
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
|
-
/** Its value has no side effect to evaluate, so an unread one can go
|
|
57
|
-
* expression's from `evaluate`, a tag's from its
|
|
56
|
+
/** Its value has no side effect to evaluate, so an unread one can go and
|
|
57
|
+
* a read one can move: an expression's from `evaluate`, a tag's from its
|
|
58
|
+
* value attributes. */
|
|
58
59
|
pure?: boolean;
|
|
59
60
|
/** The tag-root `KnownExprs` of the call site that linked this expression
|
|
60
61
|
* to a derives template's binding, for dereferencing its reasons. */
|
|
@@ -107,7 +108,7 @@ declare module "@marko/compiler/dist/types" {
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
export declare function isTagVarUsed(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
110
|
-
export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding):
|
|
111
|
+
export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): void;
|
|
111
112
|
export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, aliased?: Binding["aliasOf"]): Binding | undefined;
|
|
112
113
|
export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
|
|
113
114
|
export declare function isReferenceHoisted(bindingPath: t.NodePath, reference: t.NodePath): boolean;
|
|
@@ -123,23 +124,28 @@ export declare const getReadsByExpression: () => Map<ReferencedExtra, Opt<Read>>
|
|
|
123
124
|
export declare const getFunctionReadsByExpression: () => Map<ReferencedExtra, Map<ReferencedFunctionExtra, OneMany<Read>>>;
|
|
124
125
|
export declare const getReferenceFinalizers: () => (() => void)[];
|
|
125
126
|
export declare function onFinalizeReferences(finalize: () => void): void;
|
|
126
|
-
export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
|
|
127
|
+
export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, exprRoot: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
|
|
127
128
|
export declare function dropNodes(node: t.Node | t.Node[]): void;
|
|
128
129
|
export declare function dropExpr(exprExtra: ReferencedExtra): void;
|
|
129
130
|
export declare function dropContent(body: t.MarkoTagBody): void;
|
|
130
131
|
export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
|
|
132
|
+
export declare function getChildTagReferenceNodes(tag: t.MarkoTag, referenceNodes: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
|
|
131
133
|
export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean): ResolvedRead;
|
|
132
134
|
export declare function createResolvedGetterRead(binding: Binding, properties: Opt<string>, getter: Getter): ResolvedRead;
|
|
133
135
|
export interface ReferencedExtra extends t.NodeExtra {
|
|
134
136
|
section: Section;
|
|
135
137
|
}
|
|
136
138
|
export declare function isReferencedExtra(extra: t.NodeExtra | undefined): extra is ReferencedExtra;
|
|
139
|
+
export interface ReadExtra extends t.NodeExtra {
|
|
140
|
+
exprRoot: t.NodeExtra;
|
|
141
|
+
}
|
|
137
142
|
export interface AssignedBindingExtra extends ReferencedExtra {
|
|
138
143
|
assignment: Binding;
|
|
139
144
|
exprRoot: t.NodeExtra;
|
|
140
145
|
/** The outermost function holding it; none when that escapes into a call. */
|
|
141
146
|
fnRoot: ReferencedFunctionExtra | undefined;
|
|
142
147
|
}
|
|
148
|
+
export declare function hasResumableWriter(source: Binding): boolean;
|
|
143
149
|
export declare function hasResumableAssignment(binding: Binding): boolean;
|
|
144
150
|
export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined): extra is AssignedBindingExtra;
|
|
145
151
|
export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
|
|
@@ -152,6 +158,7 @@ export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): ext
|
|
|
152
158
|
export declare function getReferencedBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
|
|
153
159
|
export declare function getBindingsDerivedFrom(binding: Binding): ReferencedBindings;
|
|
154
160
|
export declare function getValueReferences(exprs: Opt<t.NodeExtra>): ReferencedBindings;
|
|
161
|
+
export declare function isPureExpr(expr: t.NodeExtra): boolean;
|
|
155
162
|
export declare function getLazyBindings(extra: t.NodeExtra | undefined): ReferencedBindings;
|
|
156
163
|
export declare function getReferencedBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
|
|
157
164
|
export declare function getConstantBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
|
|
@@ -12,4 +12,5 @@ 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
14
|
export declare function absentArg(value: 0 | 1): t.NumericLiteral;
|
|
15
|
+
export declare function trimFalsyArgs<A extends t.Node>(args: (A | Falsy)[]): A[];
|
|
15
16
|
export declare function getCompatRuntimeFile(): string;
|
|
@@ -59,7 +59,12 @@ export interface Section {
|
|
|
59
59
|
/** The attribute tag `<for>` params this content reads, held as its own
|
|
60
60
|
* bindings that the loop binds as it creates it. */
|
|
61
61
|
localClosures: ReferencedBindings;
|
|
62
|
+
/** The closures it reads from enclosing sections, each notifying it through
|
|
63
|
+
* its signal, which its setup subscribes to. */
|
|
62
64
|
referencedClosures: ReferencedBindings;
|
|
65
|
+
/** The loop keys it reads from enclosing sections, in place through its owner
|
|
66
|
+
* chain: a key never changes, so it is no closure. */
|
|
67
|
+
referencedConstants: ReferencedBindings;
|
|
63
68
|
bindings: ReferencedBindings;
|
|
64
69
|
hoisted: ReferencedBindings;
|
|
65
70
|
/** The closures its `<for>` rows read only by comparing them to the row's
|
|
@@ -109,7 +114,9 @@ export interface Section {
|
|
|
109
114
|
kind: "for" | "await" | "try";
|
|
110
115
|
tag: ControlFlowTagExtra;
|
|
111
116
|
} | undefined;
|
|
112
|
-
|
|
117
|
+
/** What renders at its edges, `null` for nothing; set once its body is
|
|
118
|
+
* analyzed (`settleContent`). */
|
|
119
|
+
content: undefined | null | {
|
|
113
120
|
startType: ContentType;
|
|
114
121
|
endType: ContentType;
|
|
115
122
|
singleChild: boolean;
|
|
@@ -151,11 +158,11 @@ export declare function forEachSection(fn: (section: Section) => void): void;
|
|
|
151
158
|
export declare function getDynamicTagContentClosures(section: Section): import("./optional").SortedOpt<Binding>;
|
|
152
159
|
export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
|
|
153
160
|
export declare function forEachSectionReverse(fn: (section: Section) => void): void;
|
|
161
|
+
export declare function settleContent(body: t.NodePath<t.Program | t.MarkoTagBody>): void;
|
|
154
162
|
export declare function getContentInfo(path: t.NodePath<t.Program | t.MarkoTagBody>): Section["content"];
|
|
155
163
|
export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge: "startType" | "endType"): ContentType.Value | null;
|
|
156
164
|
export declare function isKnownChild(section: Section): boolean;
|
|
157
165
|
export declare const getSectionTextBefore: (key: Section) => boolean | undefined;
|
|
158
|
-
export declare function mayEndWithText(section: Section): boolean;
|
|
159
166
|
export declare function mayMergeWithText(path: t.NodePath, before: boolean): boolean | undefined;
|
|
160
167
|
export declare function getRendererReason(section: Section): false | Sources;
|
|
161
168
|
export declare function isOptionalBranch(section: Section): section is Section & {
|
|
@@ -165,11 +172,13 @@ export declare function isInParentSection(binding: Binding, section: Section): b
|
|
|
165
172
|
export declare function isDirectClosure(section: Section, closure: Binding): boolean;
|
|
166
173
|
export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
|
|
167
174
|
export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
|
|
175
|
+
export declare function getForClosureIndex(closure: Binding, closureSection?: Section): number;
|
|
168
176
|
export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
|
|
169
177
|
export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
|
|
170
178
|
export declare function getCommonSection(section: Section, other: Section): Section;
|
|
171
179
|
export declare function ensureSectionReasonGroups(section: Section): void;
|
|
172
180
|
export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
181
|
+
export declare function findParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
173
182
|
export declare function forEachParamGroup(params: Sources["param"], fn: (section: Section, group: ParamReasonGroup) => void): void;
|
|
174
183
|
export declare function reduceParamGroups<R>(params: Sources["param"], fn: (acc: R, section: Section, group: ParamReasonGroup) => R, initial: R): R;
|
|
175
184
|
export declare function setReadsOwner(from: Section, to: Section): void;
|
|
@@ -35,7 +35,8 @@ export interface Signal {
|
|
|
35
35
|
type closureSignalBuilder = (closure: Binding, render: t.Expression) => t.Expression;
|
|
36
36
|
export declare const getSignals: (section: Section) => Map<unknown, Signal>;
|
|
37
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;
|
|
38
|
+
export declare function buildClosureHop(section: Section, closure: Binding, render: t.Expression): t.CallExpression;
|
|
39
|
+
export declare function getLoopRenderOrder(bodySection: Section): t.NumericLiteral | t.StringLiteral | undefined;
|
|
39
40
|
export declare function setSectionOwnerResumedByMarker(section: Section): void;
|
|
40
41
|
export declare function getContentClosureValues(bodySection: Section): {
|
|
41
42
|
scope: t.Identifier;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
export declare const htmlStyleTagAlternateMsg = " For a native html
|
|
2
|
+
export declare const htmlStyleTagAlternateMsg = " For a native html `<style>` tag use the [`html-style` core tag](https://markojs.com/docs/reference/core-tag#html-script--html-style) instead.";
|
|
3
3
|
export declare function checkStyleInterpolations(tag: t.NodePath<t.MarkoTag>): void;
|
|
@@ -16,6 +16,8 @@ export interface TagFacts {
|
|
|
16
16
|
/** Its insertion mode drops an unknown element but keeps its children, so a
|
|
17
17
|
* wrapper around content inside it is discarded. */
|
|
18
18
|
discardsWrapperChildren?: true;
|
|
19
|
+
/** Its `content` attribute is an html attribute, not content it renders. */
|
|
20
|
+
htmlContentAttr?: true;
|
|
19
21
|
}
|
|
20
22
|
export declare const controllableElements: Map<string, {
|
|
21
23
|
attrs: string[];
|
|
@@ -27,6 +27,7 @@ declare module "@marko/compiler/dist/types" {
|
|
|
27
27
|
}
|
|
28
28
|
type TagNameType = TagNameType.Value;
|
|
29
29
|
export { TagNameType };
|
|
30
|
+
export declare function getTagNameBinding(tag: t.NodePath<t.MarkoTag>): t.Binding | undefined;
|
|
30
31
|
export default function analyzeTagNameType(tag: t.NodePath<t.MarkoTag>): TagNameType.Value;
|
|
31
32
|
/** A native element by its name alone: the tag lookup's verdict on a string, or
|
|
32
33
|
* a template literal without expressions. Loads no template, so pre-analyze may ask. */
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type Binding } from "./bindings";
|
|
3
2
|
import { type AttrTagMeta, type AttrTagLookup } from "./nested-attribute-tags";
|
|
4
|
-
import { type SortedOpt } from "./optional";
|
|
5
3
|
import { type ParamsTree } from "./params-tree";
|
|
6
4
|
type ContentKey = "renderBody" | "content";
|
|
7
|
-
export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true,
|
|
5
|
+
export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, statements?: t.Statement[], contentKey?: ContentKey): {
|
|
8
6
|
properties: (t.ObjectMethod | t.ObjectProperty | t.SpreadElement)[];
|
|
9
7
|
statements: t.Statement[];
|
|
10
8
|
};
|
|
@@ -17,5 +15,4 @@ export declare function appendAttrTag(prev: t.Expression | undefined | false, pr
|
|
|
17
15
|
/** Unwraps a lone spread to the spread argument itself, so the result may alias
|
|
18
16
|
* a caller binding; anything the runtime writes to needs its own object. */
|
|
19
17
|
export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression;
|
|
20
|
-
export declare function getSingleKnownSpread(paramsTree: ParamsTree | true, attributes: (t.MarkoAttribute | t.MarkoSpreadAttribute)[]): Binding | undefined;
|
|
21
18
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import type { Plugin } from "@marko/compiler/babel-utils";
|
|
3
|
-
export type VisitorType = "
|
|
3
|
+
export type VisitorType = "transform" | "analyze" | "translate";
|
|
4
4
|
export type TemplateVisitor<T extends t.Node> = Partial<Record<VisitorType, t.VisitNode<unknown, T>>>;
|
|
5
5
|
export declare function extractVisitors<Visitors extends Partial<Record<keyof t.Visitor, TemplateVisitor<any>>>>(visitors: Visitors): Record<VisitorType, t.Visitor<unknown>>;
|
|
6
6
|
export declare function translateByTarget<T extends t.Node>({ html, dom, }: {
|
|
@@ -11,9 +11,11 @@ export declare function buildGroupMask(groups: {
|
|
|
11
11
|
export declare function getScopeReasonStatement(section: Section): t.Statement;
|
|
12
12
|
export declare function getWriteReason(binding: Binding): Sources | undefined;
|
|
13
13
|
export declare function getBranchWriteReason(section: Section): Sources | undefined;
|
|
14
|
+
export declare function isBranchAlwaysMarked(section: Section): boolean;
|
|
14
15
|
export declare function getWriteGuard(section: Section, reason: undefined | Reason, omitUnconditional: boolean): t.Expression | undefined;
|
|
15
16
|
export declare function getWriteGuardForAny(section: Section, reasons: undefined | Reasons, omitUnconditional: boolean): t.Expression | undefined;
|
|
16
17
|
export declare function getExprIfWritten(section: Section, reason: undefined | Reason, expr: t.Expression): t.Expression | undefined;
|
|
17
18
|
export declare function isEverWritten(section: Section, reason: undefined | Reason): boolean;
|
|
18
19
|
export declare function isWrittenForCall(section: Section, reason: undefined | Reason, call: t.MarkoTagExtra, callSection: Section): boolean;
|
|
19
20
|
export declare function getWriteBit(section: Section, reason: undefined | Reason): number | undefined;
|
|
21
|
+
export declare function andGuard(guard: t.Expression | undefined | false, expr: t.Expression): t.Expression;
|
|
@@ -18,18 +18,14 @@ declare module "@marko/compiler/dist/types" {
|
|
|
18
18
|
/** The signal of each of the template's param bindings, a property of
|
|
19
19
|
* one included. */
|
|
20
20
|
params: Map<Binding, string>;
|
|
21
|
-
/** The `_dynamic_tag_content` signal of each binding only
|
|
22
|
-
* dynamic tag
|
|
21
|
+
/** The `_dynamic_tag_content` signal of each binding read only as the
|
|
22
|
+
* whole name of a name-only dynamic tag. */
|
|
23
23
|
directContent: Map<Binding, string>;
|
|
24
24
|
};
|
|
25
25
|
styleFile?: string;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
declare const _default: {
|
|
29
|
-
migrate: {
|
|
30
|
-
enter(this: unknown, program: t.NodePath<t.Program>): void;
|
|
31
|
-
exit(this: unknown, program: t.NodePath<t.Program>): void;
|
|
32
|
-
};
|
|
33
29
|
transform: {
|
|
34
30
|
exit: typeof preAnalyze;
|
|
35
31
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
declare const kAbortId: unique symbol;
|
|
3
|
+
declare const kAbortCleanupOnly: unique symbol;
|
|
3
4
|
declare module "@marko/compiler/dist/types" {
|
|
4
5
|
interface NodeExtra {
|
|
5
6
|
/** `$signal` abort id for this expression root, allocated in analyze
|
|
6
7
|
* (see below) so every translate reads the same id. */
|
|
7
8
|
[kAbortId]?: number;
|
|
9
|
+
/** Its every `$signal` only sets `onabort`, so it needs no controller. */
|
|
10
|
+
[kAbortCleanupOnly]?: boolean;
|
|
8
11
|
}
|
|
9
12
|
}
|
|
10
13
|
declare const _default: {
|
|
11
|
-
migrate(this: unknown, identifier: t.NodePath<t.Identifier>): void;
|
|
12
14
|
analyze(this: unknown, identifier: t.NodePath<t.Identifier>): void;
|
|
13
15
|
translate(this: unknown, identifier: t.NodePath<t.Identifier>): void;
|
|
14
16
|
};
|
package/index.d.ts
CHANGED
|
@@ -137,9 +137,7 @@ declare global {
|
|
|
137
137
|
? Name extends keyof NativeTags
|
|
138
138
|
? NativeTags[Name]["input"]
|
|
139
139
|
: Record<string, unknown>
|
|
140
|
-
: Name extends
|
|
141
|
-
| Template<infer Input, any>
|
|
142
|
-
| { _(): () => (input: infer Input) => any }
|
|
140
|
+
: Name extends Template<infer Input, any>
|
|
143
141
|
? Input
|
|
144
142
|
: Name extends Body<infer Args, any>
|
|
145
143
|
? Args extends {
|
|
@@ -159,10 +157,7 @@ declare global {
|
|
|
159
157
|
? Name extends keyof NativeTags
|
|
160
158
|
? NativeTags[Name]["return"]
|
|
161
159
|
: () => Element
|
|
162
|
-
: Name extends
|
|
163
|
-
| { _(): () => (input: any) => { return: infer Return } }
|
|
164
|
-
| Template<any, infer Return>
|
|
165
|
-
| Body<any, infer Return>
|
|
160
|
+
: Name extends Template<any, infer Return> | Body<any, infer Return>
|
|
166
161
|
? Return
|
|
167
162
|
: never;
|
|
168
163
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.12",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@marko/compiler": "^5.42.
|
|
54
|
+
"@marko/compiler": "^5.42.18",
|
|
55
55
|
"csstype": "^3.2.3",
|
|
56
56
|
"fastest-levenshtein": "^1.0.16",
|
|
57
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.12",
|
|
61
|
+
"marko": "5.39.51"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22.12.0"
|