marko 6.4.4 → 6.4.6
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/errors.d.ts +2 -1
- package/dist/common/helpers.d.ts +7 -7
- package/dist/debug/dom/catch.feat.js +3 -3
- package/dist/debug/dom/catch.feat.mjs +3 -3
- 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 +5 -5
- package/dist/debug/dom/controllable.feat.mjs +5 -5
- 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-CUxvM4i9.js → dom-CNgQ6lj9.js} +52 -52
- package/dist/debug/{dom-BeY1nGUb.mjs → dom-o9jQjchF.mjs} +43 -43
- package/dist/debug/dom.js +4 -4
- package/dist/debug/dom.mjs +4 -4
- package/dist/debug/html.js +721 -654
- package/dist/debug/html.mjs +721 -654
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +3 -3
- package/dist/dom/control-flow.d.ts +2 -2
- 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.d.ts +4 -4
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +2 -2
- package/dist/dom/dom.d.ts +5 -5
- 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 +2 -2
- 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/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/signals.d.ts +4 -1
- package/dist/{dom-Diu8MpmL.js → dom-60R4bRWD.js} +40 -40
- package/dist/{dom-DefWmvQB.mjs → dom-Ci2W4l1P.mjs} +33 -33
- package/dist/dom.js +6 -6
- package/dist/dom.mjs +4 -4
- package/dist/html/assets.d.ts +1 -1
- package/dist/html/compat.d.ts +2 -1
- package/dist/html/control-flow.d.ts +20 -0
- package/dist/html/serializer.d.ts +63 -16
- package/dist/html/writer.d.ts +47 -35
- package/dist/html.d.ts +2 -1
- package/dist/html.js +517 -466
- package/dist/html.mjs +517 -466
- package/dist/translator/core/for.d.ts +0 -4
- package/dist/translator/core/return.d.ts +0 -3
- package/dist/translator/core/style.d.ts +2 -2
- package/dist/translator/index.js +8104 -8108
- package/dist/translator/util/analyze-errors.d.ts +2 -1
- package/dist/translator/util/assert.d.ts +8 -1
- package/dist/translator/util/bindings.d.ts +13 -9
- package/dist/translator/util/body-to-text.d.ts +9 -0
- package/dist/translator/util/branch-tag.d.ts +10 -3
- package/dist/translator/util/build-string-expression.d.ts +4 -0
- package/dist/translator/util/content-derives.d.ts +7 -0
- package/dist/translator/util/entry-builder.d.ts +16 -5
- package/dist/translator/util/finalize-references.d.ts +3 -2
- package/dist/translator/util/generate-uid.d.ts +3 -2
- package/dist/translator/util/get-root.d.ts +3 -3
- package/dist/translator/util/get-tag-name.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +10 -8
- package/dist/translator/util/module-read.d.ts +0 -3
- package/dist/translator/util/module-registrations.d.ts +44 -0
- package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +6 -1
- package/dist/translator/util/params-tree.d.ts +18 -0
- package/dist/translator/util/reasons.d.ts +10 -8
- package/dist/translator/util/references.d.ts +23 -28
- package/dist/translator/util/runtime.d.ts +0 -12
- package/dist/translator/util/scope-accessor.d.ts +0 -1
- package/dist/translator/util/scope-read.d.ts +3 -0
- package/dist/translator/util/section-renderer.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +16 -16
- package/dist/translator/util/setup-work.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +22 -11
- package/dist/translator/util/simplify-fn.d.ts +1 -0
- package/dist/translator/util/slots.d.ts +2 -2
- package/dist/translator/util/solve-reasons.d.ts +1 -3
- package/dist/translator/util/sources.d.ts +2 -1
- package/dist/translator/util/statement-tag.d.ts +2 -0
- package/dist/translator/util/static-text.d.ts +2 -1
- package/dist/translator/util/structure.d.ts +0 -10
- package/dist/translator/util/tag-facts.d.ts +8 -1
- package/dist/translator/util/tag-import.d.ts +20 -0
- package/dist/translator/util/tag-name-type.d.ts +9 -2
- package/dist/translator/util/to-only-or-block.d.ts +3 -0
- package/dist/translator/util/to-property-name.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +7 -5
- package/dist/translator/util/translate-var.d.ts +2 -0
- package/dist/translator/util/traverse.d.ts +1 -2
- package/dist/translator/util/visitors.d.ts +4 -1
- package/dist/translator/util/with-previous-location.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +6 -2
- package/dist/translator/util/writer.d.ts +1 -2
- package/dist/translator/visitors/export-declaration.d.ts +2 -3
- package/dist/translator/visitors/function.d.ts +0 -35
- package/dist/translator/visitors/import-declaration.d.ts +0 -16
- package/dist/translator/visitors/placeholder.d.ts +2 -1
- package/dist/translator/visitors/program/html.d.ts +0 -1
- package/dist/translator/visitors/program/index.d.ts +4 -5
- package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
- package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
- package/package.json +4 -4
- package/dist/translator/util/binding-has-prop.d.ts +0 -8
- package/dist/translator/util/binding-prop-tree.d.ts +0 -18
- package/dist/translator/util/body-to-text-literal.d.ts +0 -9
- package/dist/translator/util/import-reference.d.ts +0 -3
- package/dist/translator/util/normalize-string-expression.d.ts +0 -4
- package/dist/translator/util/plugin-hooks.d.ts +0 -4
- package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
- package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
- package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
- package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
|
@@ -4,8 +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 OneMany, type Opt, Sorted, type SortedOpt } from "./optional";
|
|
7
|
-
import { type Reason } from "./reasons";
|
|
8
|
-
import { type KnownExprs } from "./references";
|
|
7
|
+
import { type KnownExprs, type Reason } from "./reasons";
|
|
9
8
|
import { type Slot } from "./slots";
|
|
10
9
|
import { type Sources } from "./sources";
|
|
11
10
|
export type ParamReasonGroup = NonNullable<Sources["param"]>;
|
|
@@ -77,8 +76,8 @@ export interface Section {
|
|
|
77
76
|
/** For a `<define>` body or a template rendering itself, the sections whose
|
|
78
77
|
* direct calls render it. */
|
|
79
78
|
callSections: SortedOpt<Section>;
|
|
80
|
-
/** The content's rendering tag (its extra), and each child binding
|
|
81
|
-
* content
|
|
79
|
+
/** The content's rendering tag (its extra), and each child binding that
|
|
80
|
+
* derives from the content, at `properties`. */
|
|
82
81
|
derives: {
|
|
83
82
|
tag: t.MarkoTagExtra;
|
|
84
83
|
binding: OneMany<Binding>;
|
|
@@ -86,7 +85,7 @@ export interface Section {
|
|
|
86
85
|
exprs: KnownExprs | undefined;
|
|
87
86
|
} | undefined;
|
|
88
87
|
/** Content a known child never reads, which no output renders. */
|
|
89
|
-
|
|
88
|
+
dropped: boolean;
|
|
90
89
|
hasAbortSignal: boolean;
|
|
91
90
|
/** Count of distinct `$signal` expression roots; analyze allocates each
|
|
92
91
|
* root's abort id from this so translates read, never re-derive. */
|
|
@@ -120,31 +119,32 @@ declare module "@marko/compiler/dist/types" {
|
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
export declare const sectionUtil: Sorted<Section>;
|
|
123
|
-
export declare function
|
|
124
|
-
export declare function
|
|
122
|
+
export declare function ensureBodySection(path: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
|
|
123
|
+
export declare function ensureSection(path: t.NodePath<any>): Section;
|
|
125
124
|
export declare function getSectionForBody(body: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
|
|
126
|
-
export declare function
|
|
125
|
+
export declare function removeDroppedContent(tag: t.NodePath<t.MarkoTag>): void;
|
|
127
126
|
export declare function getSection(path: t.NodePath): Section;
|
|
128
127
|
export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
|
|
129
128
|
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;
|
|
130
129
|
export declare function forEachSection(fn: (section: Section) => void): void;
|
|
131
|
-
export declare function
|
|
130
|
+
export declare function getDynamicTagContentClosures(section: Section): ReferencedBindings;
|
|
132
131
|
export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
|
|
133
132
|
export declare function forEachSectionReverse(fn: (section: Section) => void): void;
|
|
134
|
-
export declare function getNodeContentType(path: t.NodePath<t.Statement>,
|
|
135
|
-
export declare function getRendererReason(section: Section):
|
|
136
|
-
export declare function
|
|
133
|
+
export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge: "startType" | "endType"): ContentType.Value | null;
|
|
134
|
+
export declare function getRendererReason(section: Section): false | Sources;
|
|
135
|
+
export declare function isOptionalBranch(section: Section): section is Section & {
|
|
137
136
|
branch: NonNullable<Section["branch"]>;
|
|
138
137
|
};
|
|
139
|
-
export declare function
|
|
138
|
+
export declare function isInParentSection(binding: Binding, section: Section): boolean;
|
|
140
139
|
export declare function isDirectClosure(section: Section, closure: Binding): boolean;
|
|
141
140
|
export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
|
|
142
141
|
export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
|
|
143
142
|
export declare function getDirectClosures(section: Section): SortedOpt<Binding>;
|
|
144
|
-
export declare function
|
|
143
|
+
export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
|
|
145
144
|
export declare function getCommonSection(section: Section, other: Section): Section;
|
|
146
|
-
export declare function
|
|
145
|
+
export declare function ensureSectionReasonGroups(section: Section): void;
|
|
147
146
|
export declare function ensureReasonGroups(reason: Section["reason"]): void;
|
|
148
147
|
export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
149
|
-
export declare function
|
|
148
|
+
export declare function forEachParamGroup(params: Sources["param"], fn: (section: Section, group: ParamReasonGroup) => void): void;
|
|
149
|
+
export declare function reduceParamGroups<R>(params: Sources["param"], fn: (acc: R, section: Section, group: ParamReasonGroup) => R, initial: R): R;
|
|
150
150
|
export declare function setReadsOwner(from: Section, to: Section): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Section } from "./sections";
|
|
3
|
-
export declare function addSetupExpr(section: Section, node
|
|
3
|
+
export declare function addSetupExpr(section: Section, node: t.Node): void;
|
|
4
|
+
export declare function addSetupWork(section: Section): void;
|
|
4
5
|
export declare function finalizeSetupWork(): void;
|
|
@@ -15,15 +15,15 @@ export interface Signal {
|
|
|
15
15
|
/** None for a signal that runs on the scope alone. */
|
|
16
16
|
value: t.Expression | undefined;
|
|
17
17
|
}>;
|
|
18
|
-
|
|
18
|
+
intersections: Opt<Signal>;
|
|
19
19
|
/** Signals this one forwards into: they must declare first when the
|
|
20
20
|
* forward simplifies to a bare, eagerly evaluated reference. */
|
|
21
21
|
forwards: Opt<Signal>;
|
|
22
22
|
render: t.Statement[];
|
|
23
23
|
effect: t.Statement[];
|
|
24
24
|
hasHTMLEffect: boolean;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
storesValue: boolean;
|
|
26
|
+
forceStore: boolean;
|
|
27
27
|
inline: {
|
|
28
28
|
value: t.Expression | undefined;
|
|
29
29
|
} | undefined;
|
|
@@ -33,31 +33,42 @@ 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
|
+
};
|
|
36
44
|
export declare const getSignals: (section: Section) => Map<unknown, Signal>;
|
|
37
|
-
export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>,
|
|
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;
|
|
38
47
|
export declare function setSectionOwnerResumedByMarker(section: Section): void;
|
|
39
48
|
export declare function getContentClosureValues(bodySection: Section): {
|
|
40
49
|
scope: t.Identifier;
|
|
41
50
|
levels: t.Expression[];
|
|
42
51
|
} | undefined;
|
|
43
|
-
export declare function
|
|
52
|
+
export declare function writeSlot(slot: PlaceSlot | undefined, expression: t.Expression): string | undefined;
|
|
44
53
|
export declare function setSectionDebugVar(section: Section, accessor: string, name: string, loc: t.SourceLocation | null | undefined): void;
|
|
45
54
|
export declare function addWriteScopeBuilder(section: Section, builder: (writeCall: t.Expression) => t.Expression): void;
|
|
46
55
|
export declare const getHTMLSectionStatements: (section: Section) => t.Statement[];
|
|
56
|
+
declare const setReturnValueIdentifier: (section: Section, value: t.Identifier | undefined) => void;
|
|
57
|
+
export { setReturnValueIdentifier };
|
|
47
58
|
export declare function getBindingGetterIdentifier(binding: Binding, getterSection: Getter["hoisted"]): t.Identifier;
|
|
48
59
|
export declare function getSignal(section: Section, referencedBindings: ReferencedBindings, name?: string): Signal;
|
|
49
60
|
export declare function initValue(binding: Binding, isLet?: boolean): Signal;
|
|
50
|
-
export declare function
|
|
51
|
-
export declare function
|
|
61
|
+
export declare function signalHasWork(signal: Signal): boolean;
|
|
62
|
+
export declare function buildSignalFn(signal: Signal): t.Expression;
|
|
52
63
|
export declare function getSignalValueIdentifier(signal: Signal): t.Identifier;
|
|
53
|
-
export declare function
|
|
54
|
-
export declare function addStatement(type: "render" | "effect", targetSection: Section, referencedBindings: ReferencedBindings, statement: t.Statement | t.Statement[], isPure?: boolean): void;
|
|
64
|
+
export declare function trimEmptyArgs(args: (t.Expression | undefined | false)[]): t.Expression[];
|
|
65
|
+
export declare function addStatement(type: "render" | "effect", targetSection: Section, referencedBindings: ReferencedBindings, statement: t.Statement | t.Statement[] | t.Expression, isPure?: boolean): void;
|
|
66
|
+
export declare function addTagStatement(tag: t.NodePath<t.MarkoTag>, statement: t.Statement): void;
|
|
55
67
|
export declare function addValue(targetSection: Section, referencedBindings: ReferencedBindings, signal: Signal, value?: t.Expression): void;
|
|
56
68
|
export declare function getResumeRegisterId(section: Section, referencedBindings: string | ReferencedBindings, type?: string): string;
|
|
57
69
|
export declare function writeSignals(section: Section): Set<Signal>;
|
|
58
70
|
export declare function writeRegisteredFns(): void;
|
|
59
71
|
export declare function addHTMLEffectCall(section: Section, referencedBindings?: ReferencedBindings): void;
|
|
60
|
-
export declare function writeHTMLResumeStatements(path: t.NodePath<t.
|
|
72
|
+
export declare function writeHTMLResumeStatements(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>): void;
|
|
61
73
|
export declare function getSetup(section: Section): Signal | undefined;
|
|
62
74
|
export declare function replaceRegisteredFunctionNode(node: t.Node): t.CallExpression | t.ClassPrivateProperty | t.ClassProperty | t.Identifier | t.ObjectProperty | t.VariableDeclaration | undefined;
|
|
63
|
-
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
+
export declare function replaceMethodNode(node: t.ClassMethod | t.ClassPrivateMethod | t.ObjectMethod, replacement: t.Expression): t.ClassPrivateProperty | t.ClassProperty | t.ObjectProperty;
|
|
2
3
|
/**
|
|
3
4
|
* Given any arbitrary function type will normalize method like functions into expressions.
|
|
4
5
|
*/
|
|
@@ -37,14 +37,14 @@ export interface SectionSlot extends BaseSlot {
|
|
|
37
37
|
owner: Section;
|
|
38
38
|
group: undefined;
|
|
39
39
|
}
|
|
40
|
-
export declare function
|
|
40
|
+
export declare function ensureSlot(binding: Binding, kind?: BindingSlotKind, section?: Section, group?: ParamReasonGroup): Slot;
|
|
41
41
|
export declare function findSlot(binding: Binding): (BindingSlot & {
|
|
42
42
|
kind: typeof SlotKind.Value;
|
|
43
43
|
}) | undefined;
|
|
44
44
|
export declare function findSlot<K extends BindingSlotKind>(binding: Binding, kind: K, section?: Section, group?: ParamReasonGroup): (BindingSlot & {
|
|
45
45
|
kind: K;
|
|
46
46
|
}) | undefined;
|
|
47
|
-
export declare function
|
|
47
|
+
export declare function ensureSectionSlot(owner: Section, kind: SectionSlotKind, section?: Section): Slot;
|
|
48
48
|
export declare function findSectionSlot<K extends SectionSlotKind>(owner: Section, kind: K, section?: Section): (SectionSlot & {
|
|
49
49
|
kind: K;
|
|
50
50
|
}) | undefined;
|
|
@@ -5,7 +5,5 @@ import { type Reason } from "./reasons";
|
|
|
5
5
|
import { type Section } from "./sections";
|
|
6
6
|
export declare function solveReasons(intersectionsBySection: Map<Section, Intersection[]>): void;
|
|
7
7
|
export declare function getReasonForBinding(binding: Binding, properties?: Opt<string> | true): undefined | Reason;
|
|
8
|
-
export declare function getValueReason(extra: t.NodeExtra): undefined | Reason;
|
|
9
8
|
export declare function getReasonForExpr(extra: t.NodeExtra): undefined | Reason;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function addAlwaysRead(binding: Binding): void;
|
|
9
|
+
export declare function landsRetained(extra: t.NodeExtra): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Binding, type ParamBinding } from "./bindings";
|
|
2
|
-
import { type SortedOpt } from "./optional";
|
|
2
|
+
import { Sorted, type SortedOpt } from "./optional";
|
|
3
3
|
export interface Sources {
|
|
4
4
|
state: SortedOpt<Binding>;
|
|
5
5
|
param: SortedOpt<ParamBinding>;
|
|
@@ -13,6 +13,7 @@ export declare const globalSources: Sources;
|
|
|
13
13
|
export declare function sharesSources(a: Binding, b: Binding): boolean;
|
|
14
14
|
export declare function createSources(state: Sources["state"], param: Sources["param"], global?: Sources["global"], always?: Sources["always"]): Sources;
|
|
15
15
|
export declare function withSources(sources: Sources, state: Sources["state"], param: Sources["param"]): Sources | undefined;
|
|
16
|
+
export declare const sourcesUtil: Sorted<Sources>;
|
|
16
17
|
export declare function compareSources(a: Sources, b: Sources): number;
|
|
17
18
|
export declare function mergeSources(a: Sources, b: undefined | Sources): Sources;
|
|
18
19
|
export declare function mergeSources(a: undefined | Sources, b: Sources): Sources;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
1
2
|
import { type Tag } from "@marko/compiler/babel-utils";
|
|
3
|
+
export declare function parseSingleStatement(tag: t.NodePath<t.MarkoTag>, msg: string): t.Statement;
|
|
2
4
|
export declare function createStatementTag(keyword: "client" | "server" | "static"): Tag;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
export declare function isStaticText(node?: t.Node): boolean | undefined;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function followsStaticText(path: t.NodePath): boolean | undefined;
|
|
4
|
+
export declare function getStaticPlaceholderText(placeholder: t.MarkoPlaceholder): string | undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Binding } from "./bindings";
|
|
3
|
-
import * as Step from "./constants/step";
|
|
4
3
|
import { type Section, type StructureNode, type StructureRef } from "./sections";
|
|
5
4
|
export declare function enter(path: t.NodePath<any>): void;
|
|
6
5
|
export declare function exit(path: t.NodePath<any>): void;
|
|
@@ -12,21 +11,12 @@ export declare function writeTextTo(path: t.NodePath<any>, value: string): void;
|
|
|
12
11
|
export declare function node(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding?: Binding): StructureNode | undefined;
|
|
13
12
|
export declare function marker(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding: Binding): void;
|
|
14
13
|
export declare function controlFlowNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
|
|
15
|
-
type ResolvedPart = string | t.Expression;
|
|
16
|
-
interface ResolvedStructure {
|
|
17
|
-
writes: ResolvedPart[];
|
|
18
|
-
walks: ResolvedPart[];
|
|
19
|
-
walkComment: string[];
|
|
20
|
-
steps: Step.Value[];
|
|
21
|
-
}
|
|
22
|
-
export declare function resolveStructure(section: Section): ResolvedStructure;
|
|
23
14
|
interface SectionMeta {
|
|
24
15
|
walks: t.Expression | undefined;
|
|
25
16
|
writes: t.Expression | undefined;
|
|
26
17
|
}
|
|
27
18
|
export declare const getSectionMeta: (section: Section) => SectionMeta;
|
|
28
19
|
export declare function writeStructureExports(program: t.NodePath<t.Program>): void;
|
|
29
|
-
export declare function getSectionMetaIdentifiers(section: Section): SectionMeta;
|
|
30
20
|
/** `_content` strips trailing exit codes before it walks, so a renderer that
|
|
31
21
|
* reaches the runtime through it never needs them on the wire. */
|
|
32
22
|
export declare function trimTrailingExits(walks: t.Expression | undefined): t.ArrayExpression | t.ArrowFunctionExpression | t.AssignmentExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MarkoParseError | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.ObjectExpression | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import * as ContentType from "./constants/content-type";
|
|
3
|
+
import type { DOMRuntimeFeature, DOMRuntimeHelpers } from "./runtime";
|
|
3
4
|
export interface TagFacts {
|
|
4
5
|
/** What renders at its edges, `null` for nothing. */
|
|
5
6
|
content: ContentType.Value | null | ((tag: t.MarkoTag) => ContentType.Value | null);
|
|
@@ -16,6 +17,12 @@ export interface TagFacts {
|
|
|
16
17
|
* wrapper around content inside it is discarded. */
|
|
17
18
|
discardsWrapperChildren?: true;
|
|
18
19
|
}
|
|
20
|
+
export declare const controllableElements: Map<string, {
|
|
21
|
+
attrs: string[];
|
|
22
|
+
spreadHelper: DOMRuntimeHelpers;
|
|
23
|
+
feature: DOMRuntimeFeature;
|
|
24
|
+
}>;
|
|
19
25
|
export declare function getTagFacts(tag: t.NodePath<t.MarkoTag>): TagFacts;
|
|
20
26
|
export declare function getTagContentType(tag: t.NodePath<t.MarkoTag>): ContentType.Value | null;
|
|
21
|
-
export declare function
|
|
27
|
+
export declare function isInTextBody(child: t.NodePath<t.MarkoPlaceholder | t.MarkoText>): boolean;
|
|
28
|
+
export declare function isControllableAttr(name: string): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import type { LoadTrigger } from "../../html/assets";
|
|
3
|
+
declare module "@marko/compiler/dist/types" {
|
|
4
|
+
interface ImportDeclarationExtra {
|
|
5
|
+
tagImport?: string;
|
|
6
|
+
loadImport?: LoadImportConfig;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export type LoadImportConfig = {
|
|
10
|
+
render: true;
|
|
11
|
+
triggers?: never;
|
|
12
|
+
} | {
|
|
13
|
+
render: false;
|
|
14
|
+
triggers: LoadTrigger[];
|
|
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
|
+
export declare function trackTagImport(tagImport: string): void;
|
|
19
|
+
export declare function getImportFacts(importDecl: t.NodePath<t.ImportDeclaration>): t.ImportDeclarationExtra & t.NodeExtra;
|
|
20
|
+
export declare function getLoadAttr(importDecl: t.NodePath<t.ImportDeclaration>): t.NodePath<t.ImportAttribute> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type LoadImportConfig } from "../visitors/import-declaration";
|
|
3
2
|
import * as TagNameType from "./constants/tag-name-type";
|
|
3
|
+
import { type LoadImportConfig } from "./tag-import";
|
|
4
4
|
declare const kTagNameDynamic: unique symbol;
|
|
5
5
|
declare module "@marko/compiler/dist/types" {
|
|
6
6
|
interface ProgramExtra {
|
|
@@ -27,4 +27,11 @@ declare module "@marko/compiler/dist/types" {
|
|
|
27
27
|
}
|
|
28
28
|
type TagNameType = TagNameType.Value;
|
|
29
29
|
export { TagNameType };
|
|
30
|
-
export default function analyzeTagNameType(tag: t.NodePath<t.MarkoTag
|
|
30
|
+
export default function analyzeTagNameType(tag: t.NodePath<t.MarkoTag>): TagNameType.Value;
|
|
31
|
+
export declare function getTagRelativePath(tag: t.NodePath<t.MarkoTag>): string;
|
|
32
|
+
/**
|
|
33
|
+
* A known wrong tag that resolves to nothing, eg `interface P { id: number }`,
|
|
34
|
+
* whose body lands in attribute position before tag resolution would run.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isUnresolvedKnownWrongTag(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
37
|
+
export declare function tagNotFoundError(tag: t.NodePath<t.MarkoTag>): Error;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
export declare function getMemberExpressionPropString(expr: t.MemberExpression | t.OptionalMemberExpression): string | undefined;
|
|
3
|
+
export declare function getLiteralName(node: t.Identifier | t.StringLiteral): string;
|
|
4
|
+
export declare function getLiteralName(node: t.Node): string | undefined;
|
|
3
5
|
export declare function isValidPropertyIdentifier(name: string): boolean;
|
|
4
6
|
export declare function toPropertyName(name: string): t.Identifier | t.NumericLiteral | t.StringLiteral;
|
|
5
7
|
export declare function toObjectProperty(name: string, value: t.Expression): t.ObjectProperty;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type BindingPropTree } from "./binding-prop-tree";
|
|
3
2
|
import { type Binding } from "./bindings";
|
|
4
|
-
import { type AttrTagLookup } from "./nested-attribute-tags";
|
|
3
|
+
import { type AttrTagMeta, type AttrTagLookup } from "./nested-attribute-tags";
|
|
5
4
|
import { type SortedOpt } from "./optional";
|
|
5
|
+
import { type ParamsTree } from "./params-tree";
|
|
6
6
|
type ContentKey = "renderBody" | "content";
|
|
7
|
-
export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>,
|
|
7
|
+
export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, skip?: SortedOpt<string>, statements?: t.Statement[], contentKey?: ContentKey): {
|
|
8
8
|
properties: (t.ObjectMethod | t.ObjectProperty | t.SpreadElement)[];
|
|
9
9
|
statements: t.Statement[];
|
|
10
10
|
};
|
|
11
11
|
export declare function getTranslatedBodyContentProperty(props: t.ObjectExpression["properties"]): (t.ObjectProperty & {
|
|
12
12
|
value: t.Expression;
|
|
13
13
|
}) | undefined;
|
|
14
|
-
export declare function addDynamicAttrTagStatements(attrTags: t.NodePath<t.MarkoTag["attributeTags"][number]>[], index: number, attrTagLookup: AttrTagLookup, statements: t.Statement[],
|
|
14
|
+
export declare function addDynamicAttrTagStatements(attrTags: t.NodePath<t.MarkoTag["attributeTags"][number]>[], index: number, attrTagLookup: AttrTagLookup, statements: t.Statement[], paramsTree: ParamsTree | true, contentKey?: ContentKey): number;
|
|
15
|
+
export declare function addAttrTag(properties: t.ObjectExpression["properties"], { name, repeated }: AttrTagMeta, props: t.ObjectExpression): void;
|
|
16
|
+
export declare function appendAttrTag(prev: t.Expression | undefined | false, props: t.ObjectExpression): t.CallExpression;
|
|
15
17
|
/** Unwraps a lone spread to the spread argument itself, so the result may alias
|
|
16
18
|
* a caller binding; anything the runtime writes to needs its own object. */
|
|
17
19
|
export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression;
|
|
18
|
-
export declare function getSingleKnownSpread(attributes: (t.MarkoAttribute | t.MarkoSpreadAttribute)[]): Binding | undefined;
|
|
20
|
+
export declare function getSingleKnownSpread(paramsTree: ParamsTree | true, attributes: (t.MarkoAttribute | t.MarkoSpreadAttribute)[]): Binding | undefined;
|
|
19
21
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Binding } from "./bindings";
|
|
3
3
|
export default function translateVar(tag: t.NodePath<t.MarkoTag>, initialValue: t.Expression, kind?: "let" | "const", statements?: t.Statement[]): void;
|
|
4
|
+
export declare function isTagVarAssigned(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
5
|
+
export declare function buildVarChange(target: t.Expression, value: t.Expression, varBinding: Binding): t.CallExpression;
|
|
4
6
|
export declare function getRestPattern(rest: Binding, id: t.Identifier, from: Binding, shorthand: boolean): t.ArrayPattern | t.ObjectPattern;
|
|
5
7
|
export declare function withRestFallback(rest: Binding, from: Binding, value: t.Expression): t.Expression;
|
|
@@ -4,9 +4,8 @@ type VisitValue = null | void | t.Node | t.Node[];
|
|
|
4
4
|
type VisitKeys<T> = (string | number) & (T extends T ? {
|
|
5
5
|
[K in keyof T]: T[K] extends VisitValue ? K : never;
|
|
6
6
|
}[keyof T] : never);
|
|
7
|
-
export declare function traverseReplace<T, K extends VisitKeys<T>, S>(container: T, key: K,
|
|
7
|
+
export declare function traverseReplace<T, K extends VisitKeys<T>, S>(container: T, key: K, exit: (node: t.Node, state?: S) => t.Node | void, state?: S): void;
|
|
8
8
|
export declare function traverseContains(node: undefined | null | t.Node | t.Node[], check: (node: t.Node) => void | boolean | typeof skip): boolean;
|
|
9
|
-
export declare function traverseFind(node: undefined | null | t.Node | t.Node[], check: (node: t.Node) => void | boolean | typeof skip): t.Node | undefined;
|
|
10
9
|
export declare function traverseFindAwait(node: undefined | null | t.Node | t.Node[]): t.Node | undefined;
|
|
11
10
|
export declare function traverse(visit: (node: t.Node, parent?: t.Node, grandParent?: t.Node) => void | typeof skip, node: undefined | t.Node | t.Node[], parent?: t.Node, grandParent?: t.Node): void;
|
|
12
11
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import type { Plugin } from "@marko/compiler/babel-utils";
|
|
2
3
|
export type VisitorType = "migrate" | "transform" | "analyze" | "translate";
|
|
3
4
|
export type TemplateVisitor<T extends t.Node> = Partial<Record<VisitorType, t.VisitNode<unknown, T>>>;
|
|
4
5
|
export declare function extractVisitors<Visitors extends Partial<Record<keyof t.Visitor, TemplateVisitor<any>>>>(visitors: Visitors): Record<VisitorType, t.Visitor<unknown>>;
|
|
@@ -9,3 +10,5 @@ export declare function translateByTarget<T extends t.Node>({ html, dom, }: {
|
|
|
9
10
|
readonly enter: (path: t.NodePath<T>) => void;
|
|
10
11
|
readonly exit: (path: t.NodePath<T>) => void;
|
|
11
12
|
};
|
|
13
|
+
export declare function enterHook<T extends t.Node>(modulePlugin: Plugin | void, path: t.NodePath<T>): void;
|
|
14
|
+
export declare function exitHook<T extends t.Node>(modulePlugin: Plugin | void, path: t.NodePath<T>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { types as t } from "@marko/compiler";
|
|
2
|
-
export
|
|
2
|
+
export declare function withPreviousLocation<T extends t.Node>(newNode: T, originalNode: t.Node): T;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type Binding } from "./bindings";
|
|
2
3
|
import { type Reason, type Reasons } from "./reasons";
|
|
3
4
|
import { type Section } from "./sections";
|
|
5
|
+
import { type Sources } from "./sources";
|
|
4
6
|
export declare function isSameReason(a: Reason | undefined, b: Reason | undefined): boolean;
|
|
5
7
|
export declare function buildGroupMask(groups: {
|
|
6
8
|
value: number | t.Expression | undefined;
|
|
7
9
|
names: string;
|
|
8
10
|
}[]): t.Expression | undefined;
|
|
9
11
|
export declare function getScopeReasonStatement(section: Section): t.Statement;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
+
export declare function getWriteReason(binding: Binding): Sources | undefined;
|
|
13
|
+
export declare function getBranchWriteReason(section: Section): Sources | undefined;
|
|
14
|
+
export declare function getWriteGuard(section: Section, reason: undefined | Reason, omitUnconditional: boolean): t.Expression | undefined;
|
|
15
|
+
export declare function getWriteGuardForAny(section: Section, reasons: undefined | Reasons, omitUnconditional: boolean): t.Expression | undefined;
|
|
12
16
|
export declare function getExprIfWritten<T extends undefined | Reason, R extends (T extends {} ? t.Expression : undefined)>(section: Section, reason: T, expr: t.Expression): R;
|
|
@@ -3,8 +3,7 @@ import { type Binding } from "./bindings";
|
|
|
3
3
|
import type { Reason } from "./reasons";
|
|
4
4
|
type Write = string | t.Expression | (() => undefined | string | t.Expression);
|
|
5
5
|
export declare function writeTo(path: t.NodePath<any>, trailer?: boolean): (strs: TemplateStringsArray, ...exprs: Write[]) => void;
|
|
6
|
-
export declare function consumeHTML(path: t.NodePath<any>): t.ExpressionStatement | undefined;
|
|
7
6
|
export declare function flushBefore(path: t.NodePath<any>): void;
|
|
8
|
-
export declare function flushInto(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>):
|
|
7
|
+
export declare function flushInto(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>): t.NodePath<t.MarkoTagBody | t.Program>;
|
|
9
8
|
export declare function markNode(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, nodeBinding: Binding, reason: undefined | false | Reason, deferred?: boolean): void;
|
|
10
9
|
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
declare const kTagImport: unique symbol;
|
|
3
2
|
declare module "@marko/compiler/dist/types" {
|
|
4
3
|
interface ExportNamedDeclarationExtra {
|
|
5
|
-
|
|
4
|
+
tagImport?: string;
|
|
6
5
|
}
|
|
7
6
|
interface ExportAllDeclarationExtra {
|
|
8
|
-
|
|
7
|
+
tagImport?: string;
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
declare const _default: {
|
|
@@ -1,40 +1,5 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
declare const kRegisteredExports: unique symbol;
|
|
3
|
-
declare module "@marko/compiler/dist/types" {
|
|
4
|
-
interface ProgramExtra {
|
|
5
|
-
[kRegisteredExports]?: Map<string, RegisteredExport>;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* An export registered under an id: the template that declares it, and the
|
|
10
|
-
* canonical name it is exported under.
|
|
11
|
-
*/
|
|
12
|
-
export interface RegisteredExport {
|
|
13
|
-
registerId: string;
|
|
14
|
-
exportName: string;
|
|
15
|
-
filename: string;
|
|
16
|
-
}
|
|
17
2
|
declare const _default: {
|
|
18
3
|
analyze(this: unknown, fn: t.NodePath<t.Function>): void;
|
|
19
4
|
};
|
|
20
5
|
export default _default;
|
|
21
|
-
export declare function resolveFunctionReason(): void;
|
|
22
|
-
export declare function finalizeFunctionRegistry(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Tracks a template imported as a default export. The server writes a template
|
|
25
|
-
* only as a binding's value, so the importing template registers it when one may.
|
|
26
|
-
*/
|
|
27
|
-
export declare function trackImportedTemplate(importDecl: t.NodePath<t.ImportDeclaration>, local: string, templateFile: t.BabelFile): void;
|
|
28
|
-
/**
|
|
29
|
-
* Tracks an export imported from another template that registers under an id,
|
|
30
|
-
* if it does. The importing template registers it (under that id) when client
|
|
31
|
-
* code reads its own references.
|
|
32
|
-
*/
|
|
33
|
-
export declare function trackImport(importDecl: t.NodePath<t.ImportDeclaration>, local: string, registered: RegisteredExport | undefined, fnRoots?: Set<t.NodeExtra>): void;
|
|
34
|
-
/**
|
|
35
|
-
* Finds the id reserved for an export, following `export ... from` hops. Each
|
|
36
|
-
* template only records the exports it declares, so this resolves on demand:
|
|
37
|
-
* a template in an import cycle is read while it is still analyzing, and would
|
|
38
|
-
* hand out an incomplete map if the ids were pushed ahead of time.
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolveRegisteredExport(file: t.BabelFile, exportName: string, seen?: Set<string>): RegisteredExport | undefined;
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import type { LoadTrigger } from "../../html/assets";
|
|
3
|
-
import { type RegisteredExport } from "./function";
|
|
4
2
|
declare module "@marko/compiler/dist/types" {
|
|
5
3
|
interface ProgramExtra {
|
|
6
4
|
/** Absolute filenames of templates this one imports with `load`. */
|
|
7
5
|
loadImports?: Set<string>;
|
|
8
6
|
}
|
|
9
|
-
interface ImportDeclarationExtra {
|
|
10
|
-
tagImport?: string;
|
|
11
|
-
loadImport?: LoadImportConfig;
|
|
12
|
-
/** Each local binding the template registers -> the export it imports. */
|
|
13
|
-
registeredImports?: Map<string, RegisteredExport>;
|
|
14
|
-
}
|
|
15
7
|
}
|
|
16
|
-
export type LoadImportConfig = {
|
|
17
|
-
render: true;
|
|
18
|
-
triggers?: never;
|
|
19
|
-
} | {
|
|
20
|
-
render: false;
|
|
21
|
-
triggers: LoadTrigger[];
|
|
22
|
-
};
|
|
23
8
|
declare const _default: {
|
|
24
9
|
analyze(this: unknown, importDecl: t.NodePath<t.ImportDeclaration>): void;
|
|
25
10
|
translate: {
|
|
@@ -27,4 +12,3 @@ declare const _default: {
|
|
|
27
12
|
};
|
|
28
13
|
};
|
|
29
14
|
export default _default;
|
|
30
|
-
export declare function getImportFacts(importDecl: t.NodePath<t.ImportDeclaration>): t.ImportDeclarationExtra & t.NodeExtra;
|
|
@@ -13,7 +13,8 @@ declare const _default: {
|
|
|
13
13
|
exit(this: unknown, placeholder: t.NodePath<t.MarkoPlaceholder>): void;
|
|
14
14
|
};
|
|
15
15
|
translate: {
|
|
16
|
-
exit
|
|
16
|
+
exit: typeof translateExit;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
export default _default;
|
|
20
|
+
declare function translateExit(placeholder: t.NodePath<t.MarkoPlaceholder>): void;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type BindingPropTree } from "../../util/binding-prop-tree";
|
|
3
2
|
import { type Binding } from "../../util/bindings";
|
|
3
|
+
import { type ParamsTree } from "../../util/params-tree";
|
|
4
4
|
import { preAnalyze } from "./pre-analyze";
|
|
5
|
-
export declare let scopeIdentifier: t.Identifier;
|
|
6
|
-
export declare let localsIdentifier: t.Identifier;
|
|
7
5
|
declare module "@marko/compiler/dist/types" {
|
|
8
6
|
interface ProgramExtra {
|
|
9
7
|
/** Client code reads something of its own after resume (a section, or a
|
|
@@ -11,7 +9,7 @@ declare module "@marko/compiler/dist/types" {
|
|
|
11
9
|
hasResumes?: boolean;
|
|
12
10
|
/** What the template reads of its params (its input is the first), the
|
|
13
11
|
* contract its callers keep. */
|
|
14
|
-
paramsTree?:
|
|
12
|
+
paramsTree?: ParamsTree;
|
|
15
13
|
/** The names every compile of the template exports its parts under. */
|
|
16
14
|
exportNames?: {
|
|
17
15
|
template: string;
|
|
@@ -20,7 +18,8 @@ declare module "@marko/compiler/dist/types" {
|
|
|
20
18
|
/** The signal of each of the template's param bindings, a property of
|
|
21
19
|
* one included. */
|
|
22
20
|
params: Map<Binding, string>;
|
|
23
|
-
/**
|
|
21
|
+
/** The `_dynamic_tag_content` signal of each binding only a name-only
|
|
22
|
+
* dynamic tag reads. */
|
|
24
23
|
directContent: Map<Binding, string>;
|
|
25
24
|
};
|
|
26
25
|
styleFile?: string;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type Binding } from "../../util/bindings";
|
|
3
|
-
declare const kLoadTagBinding: unique symbol;
|
|
4
|
-
declare module "@marko/compiler/dist/types" {
|
|
5
|
-
interface MarkoTagExtra {
|
|
6
|
-
[kLoadTagBinding]?: Binding;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
2
|
declare const _default: {
|
|
10
3
|
analyze: {
|
|
11
4
|
enter(this: unknown, tag: t.NodePath<t.MarkoTag>): void;
|
|
@@ -16,10 +9,3 @@ declare const _default: {
|
|
|
16
9
|
};
|
|
17
10
|
};
|
|
18
11
|
export default _default;
|
|
19
|
-
export declare function getTagRelativePath(tag: t.NodePath<t.MarkoTag>): string;
|
|
20
|
-
/**
|
|
21
|
-
* A known wrong tag that resolves to nothing, eg `interface P { id: number }`,
|
|
22
|
-
* whose body lands in attribute position before tag resolution would run.
|
|
23
|
-
*/
|
|
24
|
-
export declare function isUnresolvedKnownWrongTag(tag: t.NodePath<t.MarkoTag>): boolean;
|
|
25
|
-
export declare function tagNotFoundError(tag: t.NodePath<t.MarkoTag>): Error;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type DOMRuntimeFeature } from "../../util/runtime";
|
|
3
2
|
import { type StructureNode } from "../../util/sections";
|
|
4
3
|
declare const kNodeOp: unique symbol;
|
|
5
4
|
declare const kNativeAttrs: unique symbol;
|
|
@@ -20,12 +19,12 @@ interface NativeAttrs {
|
|
|
20
19
|
controllable: Controllable | undefined;
|
|
21
20
|
/** Attributes written as one object with the spreads, in write order. */
|
|
22
21
|
spread: number[] | undefined;
|
|
23
|
-
/**
|
|
24
|
-
|
|
22
|
+
/** Writes the page's nonce on a `<script>` or `<style>` that sets none itself. */
|
|
23
|
+
injectsNonce: boolean;
|
|
25
24
|
}
|
|
26
25
|
interface Controllable {
|
|
27
26
|
state: "checked" | "checkedValue" | "value" | "open";
|
|
28
|
-
|
|
27
|
+
stateIsAttr: boolean;
|
|
29
28
|
valueMode?: "attribute" | "dynamic";
|
|
30
29
|
attrs: (number | undefined)[];
|
|
31
30
|
}
|
|
@@ -40,11 +39,3 @@ declare const _default: {
|
|
|
40
39
|
};
|
|
41
40
|
};
|
|
42
41
|
export default _default;
|
|
43
|
-
/** How a spread claims its controlled attrs during render; nothing for the many
|
|
44
|
-
* tags that control nothing, and nothing when a static attr owns the
|
|
45
|
-
* controllable, since then the spread must leave the slots it wrote alone. */
|
|
46
|
-
export declare function controllableClaimFor(tagName: string | undefined): "_controllable_input" | "_controllable_open" | "_controllable_select" | "_controllable_textarea" | undefined;
|
|
47
|
-
/** The resume-pass feature for a tag: `_attrs_script` resolves the control
|
|
48
|
-
* kind at run time, and a run-time tag name can be any of them. */
|
|
49
|
-
export declare function controllableFeatureFor(tagName: string | undefined): "controllable" | "controllable-input" | "controllable-open" | "controllable-select" | "controllable-textarea" | undefined;
|
|
50
|
-
export declare function enableControllable(feature: DOMRuntimeFeature | undefined): void;
|