marko 6.4.16 → 6.5.1
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 +12 -1
- package/dist/debug/dom/catch.feat.js +2 -2
- package/dist/debug/dom/catch.feat.mjs +2 -2
- package/dist/debug/dom/compat.feat.js +1 -1
- package/dist/debug/dom/compat.feat.mjs +1 -1
- 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-DlBA4dCe.mjs → dom-4AzxJQHb.mjs} +16 -16
- package/dist/debug/{dom-BLoTKI2r.js → dom-Uu_OCdvg.js} +21 -21
- package/dist/debug/dom.js +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html/compat.feat.js +1 -1
- package/dist/debug/html/compat.feat.mjs +1 -1
- package/dist/debug/{html-DM7X2D_b.mjs → html-Bfl3MJP9.mjs} +27 -24
- package/dist/debug/{html-Du0z056z.js → html-shBfuhlc.js} +27 -24
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +2 -2
- package/dist/dom/compat.feat.js +1 -1
- package/dist/dom/compat.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +8 -8
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +1 -1
- 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/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/{dom-BRtFOIF-.js → dom-BdJeggv5.js} +14 -14
- package/dist/{dom-Cqajrs_w.mjs → dom-DJrZXgdr.mjs} +13 -13
- package/dist/dom.js +2 -2
- package/dist/dom.mjs +1 -1
- package/dist/html/compat.feat.js +1 -1
- package/dist/html/compat.feat.mjs +1 -1
- package/dist/html/writer.d.ts +0 -1
- package/dist/{html-C3dQGQ2x.mjs → html-BD-y50wS.mjs} +25 -22
- package/dist/{html-4A3vJpIT.js → html-aFBpTKdf.js} +25 -22
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/translator/core/define.d.ts +6 -0
- package/dist/translator/core/if.d.ts +1 -1
- package/dist/translator/core/show.d.ts +3 -4
- package/dist/translator/index.js +3880 -3971
- package/dist/translator/util/assert.d.ts +0 -8
- package/dist/translator/util/bindings.d.ts +15 -8
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/cyclic-memo.d.ts +0 -1
- package/dist/translator/util/entry-builder.d.ts +2 -3
- package/dist/translator/util/finalize-references.d.ts +0 -1
- package/dist/translator/util/for-selector.d.ts +0 -1
- package/dist/translator/util/get-root.d.ts +3 -1
- package/dist/translator/util/module-registrations.d.ts +1 -0
- package/dist/translator/util/nested-attribute-tags.d.ts +4 -5
- package/dist/translator/util/optional.d.ts +7 -6
- package/dist/translator/util/params-tree.d.ts +1 -1
- package/dist/translator/util/reasons.d.ts +1 -2
- package/dist/translator/util/references.d.ts +6 -5
- package/dist/translator/util/sections.d.ts +8 -2
- package/dist/translator/util/signals.d.ts +1 -1
- package/dist/translator/util/slots.d.ts +1 -2
- package/dist/translator/util/solve-reasons.d.ts +2 -2
- package/dist/translator/util/state.d.ts +2 -2
- package/dist/translator/util/structure.d.ts +1 -0
- package/dist/translator/util/to-property-name.d.ts +0 -2
- package/dist/translator/util/visitors.d.ts +2 -2
- package/dist/translator/util/writer.d.ts +2 -2
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -0
- package/index.d.ts +11 -0
- package/package.json +4 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import { type ForType } from "./branch-tag";
|
|
3
2
|
export declare function assertNoSpreadAttrs(tag: t.NodePath<t.MarkoTag>): void;
|
|
4
3
|
export declare function assertOnlyValueAttr(tag: t.NodePath<t.MarkoTag>, required: true, change?: boolean, hint?: (attr: t.MarkoAttribute) => string | undefined): {
|
|
5
4
|
valueAttr: t.MarkoAttribute;
|
|
@@ -20,12 +19,5 @@ export declare function buildAttrsError(tag: t.NodePath<t.MarkoTag>, attrs: t.Ma
|
|
|
20
19
|
export declare function buildAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoTag["attributes"][number], msg: string): Error;
|
|
21
20
|
export declare function buildAttrNameError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute, msg: string): Error;
|
|
22
21
|
export declare function buildDuplicateAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute): Error;
|
|
23
|
-
/** The loop a `<for>` tag's attributes run, which it requires. */
|
|
24
|
-
export declare function assertForType(tag: t.NodePath<t.MarkoTag>): ForType;
|
|
25
|
-
/** The attributes a loop of `type` takes, besides `by=`. */
|
|
26
|
-
export declare function getForAttrs(type: ForType): string[];
|
|
27
|
-
/** Throws for a param that a loop of `type` never supplies. */
|
|
28
|
-
export declare function assertForParams(tag: t.NodePath<t.MarkoTag>, type: ForType): void;
|
|
29
22
|
export declare function coreTagLink(tag: t.NodePath<t.MarkoTag>): string;
|
|
30
23
|
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;
|
|
@@ -32,19 +32,24 @@ export interface Binding {
|
|
|
32
32
|
derivedFrom: Opt<t.NodeExtra> | false;
|
|
33
33
|
/** Its reads by expression, complete once `finalizeReferences` runs: pruning
|
|
34
34
|
* hands an expression's reads to the nearest ancestor it also reads. */
|
|
35
|
-
reads: Map<ReferencedExtra, Opt<Read
|
|
36
|
-
|
|
35
|
+
reads: Map<ReferencedExtra, Opt<Read>> | undefined;
|
|
36
|
+
/** Unset while empty, as are `reads`, `getters` and `propertyAliases`. */
|
|
37
|
+
aliases: Set<Binding> | undefined;
|
|
37
38
|
/** The sections reading it through a hoist: its own or its ancestors, so
|
|
38
39
|
* the first is the outermost. */
|
|
39
40
|
hoists: SortedOpt<Section>;
|
|
40
|
-
getters: Map<Getter["hoisted"], boolean
|
|
41
|
+
getters: Map<Getter["hoisted"], boolean> | undefined;
|
|
41
42
|
property: string | undefined;
|
|
42
|
-
propertyAliases: Map<string, Binding
|
|
43
|
+
propertyAliases: Map<string, Binding> | undefined;
|
|
43
44
|
excludeProperties: SortedOpt<string>;
|
|
44
45
|
/** Its properties code assigns in place (`obj.x = 1`), all of them for a
|
|
45
46
|
* computed one. */
|
|
46
47
|
assignedProperties: SortedOpt<string> | true;
|
|
48
|
+
/** The binding it names part or all of, always a canonical one. */
|
|
47
49
|
aliasOf: Binding | undefined;
|
|
50
|
+
/** The binding whose slot holds its value: the one a direct alias aliases,
|
|
51
|
+
* else itself; fixed once made. */
|
|
52
|
+
canonical: Binding;
|
|
48
53
|
/** The value these `<for>` params iterate, by `of` or `in`. */
|
|
49
54
|
iterates: {
|
|
50
55
|
expr: t.NodeExtra;
|
|
@@ -126,13 +131,15 @@ export declare function compareIntersections(a: Intersection, b: Intersection):
|
|
|
126
131
|
export declare function getAliasRoot(binding: Binding): Binding;
|
|
127
132
|
export declare const bindingUtil: Sorted<Binding>;
|
|
128
133
|
export declare const propertiesUtil: Sorted<string>;
|
|
129
|
-
export declare function
|
|
130
|
-
export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
|
|
134
|
+
export declare function someAlias(binding: Binding, test: (binding: Binding) => boolean): boolean;
|
|
131
135
|
export declare function someUpToAliasRoot<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
|
|
132
136
|
export declare function getNearestDeclared(binding: Binding): Binding | undefined;
|
|
133
137
|
export declare function getDeclaredAlias(binding: Binding): false | Binding | undefined;
|
|
134
|
-
export
|
|
135
|
-
|
|
138
|
+
export type Alias = Binding & {
|
|
139
|
+
aliasOf: Binding;
|
|
140
|
+
};
|
|
141
|
+
export declare function isDirectAlias(binding: Binding): binding is Alias;
|
|
142
|
+
export declare function isRest(binding: Binding): binding is Alias;
|
|
136
143
|
export declare function getDebugAccess(binding: Binding, toParam: boolean, formatProperty: (property: string) => string): {
|
|
137
144
|
root: Binding;
|
|
138
145
|
access: string;
|
|
@@ -3,7 +3,7 @@ import { type Binding } from "./bindings";
|
|
|
3
3
|
import { type Reasons } from "./reasons";
|
|
4
4
|
import { type Section } from "./sections";
|
|
5
5
|
export declare function initBranchSection(bodySection: Section, branchExpr: Section["branchExpr"], branch: NonNullable<Section["branch"]>): void;
|
|
6
|
-
export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Section
|
|
6
|
+
export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Section): void;
|
|
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;
|
|
@@ -5,6 +5,5 @@ export declare function createPassMemo<K extends object, R>(compute: (key: K) =>
|
|
|
5
5
|
export declare function resetPassMemos(): void;
|
|
6
6
|
type MemoPath = Opt<string> | true;
|
|
7
7
|
type PathKey<K> = [K, MemoPath];
|
|
8
|
-
export declare function createPassPathMemo<K extends object, R>(compute: (key: K, path: MemoPath) => R, cycleAnswer: R): (key: K, path: MemoPath) => R;
|
|
9
8
|
export declare function createPathKeys<K extends object>(): (key: K, path: MemoPath) => PathKey<K>;
|
|
10
9
|
export {};
|
|
@@ -34,7 +34,7 @@ export type Reach = 0 | 1 | 2;
|
|
|
34
34
|
type EntryFile = t.BabelFile & {
|
|
35
35
|
[kState]?: EntryState;
|
|
36
36
|
};
|
|
37
|
-
export type VisitChild = (
|
|
37
|
+
export type VisitChild = (file: t.BabelFile, reach?: Reach) => void;
|
|
38
38
|
declare const kState: unique symbol;
|
|
39
39
|
declare const builder: {
|
|
40
40
|
build(entryFile: EntryFile, exportInit?: boolean): t.Statement[];
|
|
@@ -43,5 +43,4 @@ declare const builder: {
|
|
|
43
43
|
export default builder;
|
|
44
44
|
export declare function assertVisited<S>(entryFile: t.BabelFile, state: S | undefined): asserts state is S;
|
|
45
45
|
export declare function createVisited(entryFile: t.BabelFile): Map<string, Reach>;
|
|
46
|
-
export declare function
|
|
47
|
-
export declare function markReached(visited: Map<string, Reach>, resolved: string, reach: Reach): boolean;
|
|
46
|
+
export declare function markReached(entryFile: t.BabelFile, visited: Map<string, Reach>, file: t.BabelFile, reach: Reach): boolean;
|
|
@@ -5,4 +5,3 @@ export declare function finalizeReferences(): Map<Section, Intersection[]>;
|
|
|
5
5
|
export declare function allocateIds(intersectionsBySection: Map<Section, Intersection[]>): void;
|
|
6
6
|
export declare function getLastOwnSourceReturn(bindings: ReferencedBindings, section: Section): Binding | undefined;
|
|
7
7
|
export declare function readsValuesOnResume(expr: t.NodeExtra): boolean;
|
|
8
|
-
export declare function hasEmittedAssignment(binding: Binding): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Binding } from "./bindings";
|
|
2
2
|
import type { Section } from "./sections";
|
|
3
3
|
export declare function isForSelectorClosure(bodySection: Section, closure: Binding): boolean;
|
|
4
|
-
export declare function isForSelectorValue(binding: Binding): boolean;
|
|
5
4
|
export declare function detectForSelector(bodySection: Section, keyBinding: Binding): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { types as t } from "@marko/compiler";
|
|
2
2
|
export type MarkoRootPath = t.NodePath<t.MarkoTag | t.MarkoTagBody | t.MarkoAttribute | t.MarkoSpreadAttribute | t.MarkoScriptlet | t.MarkoPlaceholder | t.ExportNamedDeclaration | t.ExportDefaultDeclaration>;
|
|
3
3
|
export declare function getMarkoRoot(path: t.NodePath<t.Node>): MarkoRootPath | null;
|
|
4
|
-
export declare function getExprRoot(path: t.NodePath<t.Node>): t.NodePath<t.Node
|
|
4
|
+
export declare function getExprRoot(path: t.NodePath<t.Node>): t.NodePath<t.Node> & {
|
|
5
|
+
parentPath: MarkoRootPath;
|
|
6
|
+
};
|
|
5
7
|
export declare function getFnRoot(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionDeclaration | t.FunctionExpression | t.ObjectMember> | undefined;
|
|
6
8
|
export declare function getFnParent(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionDeclaration | t.FunctionExpression | t.ObjectMember> | undefined;
|
|
7
9
|
export declare function getDeclarationRoot(path: t.NodePath<t.Node>): t.NodePath<t.FunctionDeclaration | t.VariableDeclaration> | undefined;
|
|
@@ -20,6 +20,7 @@ export interface RegisteredExport {
|
|
|
20
20
|
exportName: string;
|
|
21
21
|
filename: string;
|
|
22
22
|
}
|
|
23
|
+
export declare const getReferencesByFn: () => Map<RegisteredFnExtra, Set<t.NodeExtra>>;
|
|
23
24
|
export declare function trackFunction(fn: t.NodePath<t.Function>, fnExtra: RegisteredFnExtra, markoRoot: MarkoRootPath): void;
|
|
24
25
|
export declare function canIgnoreRegister(markoRoot: MarkoRootPath, exprRoot: t.NodePath<t.Node>): boolean;
|
|
25
26
|
export declare function addFunctionReasons(): void;
|
|
@@ -3,17 +3,16 @@ export interface AttrTagMeta {
|
|
|
3
3
|
name: string;
|
|
4
4
|
dynamic: boolean;
|
|
5
5
|
repeated: boolean;
|
|
6
|
-
group:
|
|
6
|
+
group: AttrTagGroup;
|
|
7
7
|
}
|
|
8
8
|
export type AttrTagLookup = Record<string, AttrTagMeta>;
|
|
9
|
-
type
|
|
9
|
+
export type AttrTagGroup = string[];
|
|
10
10
|
declare module "@marko/compiler/dist/types" {
|
|
11
11
|
interface MarkoTagExtra {
|
|
12
12
|
attrTagLookup?: AttrTagLookup;
|
|
13
|
-
attributeTagGroup?:
|
|
13
|
+
attributeTagGroup?: AttrTagGroup;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
export declare function getAttrTagIdentifier(meta:
|
|
16
|
+
export declare function getAttrTagIdentifier(meta: AttrTagMeta): t.Identifier;
|
|
17
17
|
export declare function getAttrTagPaths(tag: t.NodePath<t.MarkoTag>): ReturnType<typeof tag.get<"attributeTags">>;
|
|
18
18
|
export declare function analyzeAttributeTags(tag: t.NodePath<t.MarkoTag>): AttrTagLookup | undefined;
|
|
19
|
-
export {};
|
|
@@ -14,11 +14,10 @@ export declare class Sorted<T> {
|
|
|
14
14
|
add<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): SortedOneMany<U>;
|
|
15
15
|
union<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): SortedOpt<U>;
|
|
16
16
|
filter<U extends NonNullable<T>>(data: SortedOpt<U>, cb: (item: U) => boolean): SortedOpt<U>;
|
|
17
|
+
filter<U extends NonNullable<T>, C>(data: SortedOpt<U>, cb: (item: U, context: C) => boolean, context: C): SortedOpt<U>;
|
|
17
18
|
leadingRun<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, bound: K): SortedOpt<U>;
|
|
18
|
-
range<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, bound: K): SortedOpt<U>;
|
|
19
19
|
forEachRun<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, fn: (key: K, run: SortedOneMany<U>) => void): void;
|
|
20
20
|
reduceRuns<U extends NonNullable<T>, K, R>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, fn: (acc: R, key: K, run: SortedOneMany<U>) => R, initial: R): R;
|
|
21
|
-
find<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): U | undefined;
|
|
22
21
|
has<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): boolean;
|
|
23
22
|
findIndex<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): number;
|
|
24
23
|
intersects<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): boolean;
|
|
@@ -29,17 +28,19 @@ export declare function push<T>(data: Opt<T>, item: T): OneMany<T>;
|
|
|
29
28
|
export declare function concat<T>(a: Opt<T>, b: Opt<T>): Opt<T>;
|
|
30
29
|
export declare function size<T>(data: Opt<T>): number;
|
|
31
30
|
export declare function filter<T>(data: Opt<T>, cb: (item: T) => boolean): Opt<T>;
|
|
32
|
-
export declare function forEach<T>(data: Opt<T>, cb: (item: T
|
|
31
|
+
export declare function forEach<T>(data: Opt<T>, cb: (item: T) => void): void;
|
|
32
|
+
export declare function forEach<T, C>(data: Opt<T>, cb: (item: T, context: C) => void, context: C): void;
|
|
33
33
|
export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
|
|
34
34
|
export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
|
|
35
|
-
export declare function some<T>(data: Opt<T>, cb: (item: T
|
|
36
|
-
export declare function
|
|
35
|
+
export declare function some<T>(data: Opt<T>, cb: (item: T) => unknown): boolean;
|
|
36
|
+
export declare function some<T, C>(data: Opt<T>, cb: (item: T, context: C) => unknown, context: C): boolean;
|
|
37
|
+
export declare function every<T>(data: Opt<T>, cb: (item: T) => boolean): boolean;
|
|
38
|
+
export declare function every<T, C>(data: Opt<T>, cb: (item: T, context: C) => boolean, context: C): boolean;
|
|
37
39
|
export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item: T, index: number) => R | undefined): R | undefined;
|
|
38
40
|
export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
|
|
39
41
|
export declare function reduceWhile<T, R>(data: Opt<T>, cb: (acc: R, item: T) => R | undefined, initial: R): R | undefined;
|
|
40
42
|
export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
|
41
43
|
export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
|
|
42
|
-
export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
|
|
43
44
|
export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
|
|
44
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;
|
|
@@ -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 getAllKnownPropertyNames(paramsTree: ParamsTree): string
|
|
17
|
+
export declare function getAllKnownPropertyNames(paramsTree: ParamsTree): Set<string>;
|
|
18
18
|
export declare function hasAllKnownProperties(paramsTree: ParamsTree): boolean | undefined;
|
|
@@ -17,7 +17,7 @@ export declare function isGuardedReason(reason: undefined | Reason): reason is S
|
|
|
17
17
|
};
|
|
18
18
|
export declare function isStateReason(reason: undefined | Reason): reason is Sources;
|
|
19
19
|
export declare function getSourcesForExpr(expr: t.NodeExtra): Sources | undefined;
|
|
20
|
-
export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra>
|
|
20
|
+
export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra>): Sources | undefined;
|
|
21
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;
|
|
@@ -29,7 +29,6 @@ export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: Opt<Para
|
|
|
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
31
|
export declare function applyReasonExprs(section: Section): void;
|
|
32
|
-
export declare function mergeSlotReasons(section: Section): void;
|
|
33
32
|
export declare function getNodeReasons(section: Section): Reasons | undefined;
|
|
34
33
|
export declare function getReasonsVersion(): number;
|
|
35
34
|
export declare function setParamReasonGroups(section: Section, groups: ParamReasonGroups): void;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Binding, BindingType, type Getter, type ReferencedBindings } from "./bindings";
|
|
3
|
-
import { type
|
|
3
|
+
import { type Opt, type SortedOpt } from "./optional";
|
|
4
4
|
import { type KnownExprs, type Reason } from "./reasons";
|
|
5
5
|
import { type Section } from "./sections";
|
|
6
|
-
interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
|
|
6
|
+
export interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
|
|
7
7
|
}
|
|
8
8
|
export interface Read {
|
|
9
9
|
binding: Binding;
|
|
10
|
+
/** The binding holding it in `reads`: `binding`, or the nearest ancestor its
|
|
11
|
+
* expression also reads once pruning hands the read up. */
|
|
12
|
+
holder: Binding;
|
|
10
13
|
extra: ReadExtra;
|
|
11
14
|
inOwnBody: boolean;
|
|
12
15
|
getter: Getter | undefined;
|
|
@@ -121,7 +124,6 @@ export declare function mergeReferenceGroup(section: Section, nodes: (t.Node | u
|
|
|
121
124
|
export declare function setDerivedFrom(binding: Binding, expr: boolean | Opt<t.NodeExtra>, exprs?: KnownExprs): void;
|
|
122
125
|
export declare const getAssignments: () => AssignedBindingExtra[];
|
|
123
126
|
export declare const getReadsByExpression: () => Map<ReferencedExtra, Opt<Read>>;
|
|
124
|
-
export declare const getFunctionReadsByExpression: () => Map<ReferencedExtra, Map<ReferencedFunctionExtra, OneMany<Read>>>;
|
|
125
127
|
export declare const getReferenceFinalizers: () => (() => void)[];
|
|
126
128
|
export declare function onFinalizeReferences(finalize: () => void): void;
|
|
127
129
|
export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, exprRoot: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
|
|
@@ -130,8 +132,7 @@ export declare function dropExpr(exprExtra: ReferencedExtra): void;
|
|
|
130
132
|
export declare function dropContent(body: t.MarkoTagBody): void;
|
|
131
133
|
export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
|
|
132
134
|
export declare function getChildTagReferenceNodes(tag: t.MarkoTag, referenceNodes: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
|
|
133
|
-
export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean): ResolvedRead;
|
|
134
|
-
export declare function createResolvedGetterRead(binding: Binding, properties: Opt<string>, getter: Getter): ResolvedRead;
|
|
135
|
+
export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean, getter?: Getter): ResolvedRead;
|
|
135
136
|
export interface ReferencedExtra extends t.NodeExtra {
|
|
136
137
|
section: Section;
|
|
137
138
|
}
|
|
@@ -56,6 +56,9 @@ export interface Section {
|
|
|
56
56
|
children: Section[];
|
|
57
57
|
program: Section;
|
|
58
58
|
params: undefined | ParamBinding;
|
|
59
|
+
/** How many params its tag supplies as it renders it: a `<for>` row's, an
|
|
60
|
+
* `<await>`'s value, a `<try>`'s caught error. */
|
|
61
|
+
suppliedParams: number | undefined;
|
|
59
62
|
/** The attribute tag `<for>` params this content reads, held as its own
|
|
60
63
|
* bindings that the loop binds as it creates it. */
|
|
61
64
|
localClosures: ReferencedBindings;
|
|
@@ -104,6 +107,9 @@ export interface Section {
|
|
|
104
107
|
/** Whether analysis found work keyed by setup in the section, or in a
|
|
105
108
|
* `<define>` body or template it calls in place. */
|
|
106
109
|
hasSetupWork: boolean;
|
|
110
|
+
/** A tag variable in it holds a child's `<return>`, whose scope offset its
|
|
111
|
+
* renders may wait for. */
|
|
112
|
+
hasReturnedVar: boolean;
|
|
107
113
|
/** Its tag, which renders it in place into branch scopes at the tag's node
|
|
108
114
|
* binding; an `<if>` chain's at `index`, the renderer index it renders as. */
|
|
109
115
|
branch: {
|
|
@@ -164,7 +170,7 @@ export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge:
|
|
|
164
170
|
export declare function isKnownChild(section: Section): boolean;
|
|
165
171
|
export declare const getSectionTextBefore: (key: Section) => boolean | undefined;
|
|
166
172
|
export declare function mayMergeWithText(path: t.NodePath, before: boolean): boolean | undefined;
|
|
167
|
-
export declare function getRendererReason(section: Section):
|
|
173
|
+
export declare function getRendererReason(section: Section): Sources | undefined;
|
|
168
174
|
export declare function isOptionalBranch(section: Section): section is Section & {
|
|
169
175
|
branch: NonNullable<Section["branch"]>;
|
|
170
176
|
};
|
|
@@ -177,7 +183,7 @@ export declare function getForClosureIndex(closure: Binding, closureSection?: Se
|
|
|
177
183
|
export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
|
|
178
184
|
export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
|
|
179
185
|
export declare function getCommonSection(section: Section, other: Section): Section;
|
|
180
|
-
export declare function
|
|
186
|
+
export declare function ensureReasonGroups(section: Section, reason: Section["reason"]): void;
|
|
181
187
|
export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
182
188
|
export declare function findParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
183
189
|
export declare function forEachParamGroup(params: Sources["param"], fn: (section: Section, group: ParamReasonGroup) => void): void;
|
|
@@ -53,7 +53,6 @@ export declare function getSignal(section: Section, referencedBindings: Referenc
|
|
|
53
53
|
export declare function initValue(binding: Binding, isLet?: boolean): Signal;
|
|
54
54
|
export declare function signalHasWork(signal: Signal): boolean;
|
|
55
55
|
export declare function buildSignalFn(signal: Signal): t.Expression;
|
|
56
|
-
export declare function getSignalValueIdentifier(signal: Signal): t.Identifier;
|
|
57
56
|
export declare function trimEmptyArgs(args: (t.Expression | undefined | false)[]): t.Expression[];
|
|
58
57
|
export declare function addStatement(type: "render" | "effect", targetSection: Section, expr: t.NodeExtra | undefined, statement: t.Statement | t.Statement[] | t.Expression, isPure?: boolean): void;
|
|
59
58
|
export declare function addTagStatement(tag: t.NodePath<t.MarkoTag>, statement: t.Statement): void;
|
|
@@ -65,3 +64,4 @@ export declare function addHTMLEffectCall(section: Section, expr?: t.NodeExtra):
|
|
|
65
64
|
export declare function writeHTMLResumeStatements(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>): void;
|
|
66
65
|
export declare function getSetup(section: Section): Signal | undefined;
|
|
67
66
|
export declare function replaceRegisteredFunctionNode(node: t.Node): t.CallExpression | t.ClassPrivateProperty | t.ClassProperty | t.Identifier | t.ObjectProperty | t.VariableDeclaration | undefined;
|
|
67
|
+
export declare function pushLocalProperty(binding: Binding, properties: t.ObjectExpression["properties"]): void;
|
|
@@ -21,8 +21,7 @@ interface BaseSlot {
|
|
|
21
21
|
/** The sources whose changes lead client code to read it after resume,
|
|
22
22
|
* unset while nothing does. */
|
|
23
23
|
reason: Reason | undefined;
|
|
24
|
-
/** The expressions it holds or renders
|
|
25
|
-
* passes the group), whose sources its reason takes. */
|
|
24
|
+
/** The expressions it holds or renders, whose sources its reason takes. */
|
|
26
25
|
reasonExprs: Opt<t.NodeExtra>;
|
|
27
26
|
}
|
|
28
27
|
export interface BindingSlot extends BaseSlot {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Binding, type Intersection } from "./bindings";
|
|
3
3
|
import { type Opt } from "./optional";
|
|
4
|
-
import { type Reason } from "./reasons";
|
|
4
|
+
import { type KnownExprs, type Reason } from "./reasons";
|
|
5
5
|
import { type Section } from "./sections";
|
|
6
6
|
export declare function solveReasons(intersectionsBySection: Map<Section, Intersection[]>): void;
|
|
7
|
-
export declare function getReasonForBinding(binding: Binding, properties
|
|
7
|
+
export declare function getReasonForBinding(binding: Binding, properties: Opt<string>, exprs: KnownExprs | undefined): 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
10
|
export declare function getContentSites({ binding, properties, }: NonNullable<Section["derives"]>): ContentSites;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Section } from "./sections";
|
|
2
2
|
export declare function createOutputState<T>(init: () => T): readonly [() => T, (value: T) => void];
|
|
3
3
|
export declare function createAnalysisState<T>(init: () => T): readonly [() => T, (value: T) => void];
|
|
4
|
-
export declare function createOutputSectionState<T = unknown>(init?: (
|
|
5
|
-
export declare function createAnalysisSectionState<T = unknown>(init?: (
|
|
4
|
+
export declare function createOutputSectionState<T = unknown>(init?: (section: Section) => T): readonly [(section: Section) => T, (section: Section, value: T) => void];
|
|
5
|
+
export declare function createAnalysisSectionState<T = unknown>(init?: (section: Section) => T): readonly [(section: Section) => T, (section: Section, value: T) => void];
|
|
@@ -11,6 +11,7 @@ export declare function writeTextTo(path: t.NodePath<any>, value: string): void;
|
|
|
11
11
|
export declare function node(path: t.NodePath<t.MarkoTag>, binding?: Binding): StructureNode | undefined;
|
|
12
12
|
export declare function text(path: t.NodePath<t.MarkoPlaceholder>, binding: Binding, marker: boolean | undefined): void;
|
|
13
13
|
export declare function marker(path: t.NodePath<t.MarkoTag>, binding: Binding): void;
|
|
14
|
+
export declare function markerNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
|
|
14
15
|
export declare function controlFlowNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
|
|
15
16
|
interface SectionMeta {
|
|
16
17
|
walks: t.Expression | undefined;
|
|
@@ -6,6 +6,4 @@ export declare function isValidPropertyIdentifier(name: string): boolean;
|
|
|
6
6
|
export declare function toPropertyName(name: string): t.Identifier | t.NumericLiteral | t.StringLiteral;
|
|
7
7
|
export declare function toObjectProperty(name: string, value: t.Expression): t.ObjectProperty;
|
|
8
8
|
export declare function toMemberExpression(object: t.Expression, key: string): t.MemberExpression;
|
|
9
|
-
export declare function toMemberExpression(object: t.Expression, key: string, optional: false | undefined): t.MemberExpression;
|
|
10
|
-
export declare function toMemberExpression(object: t.Expression, key: string, optional: true): t.OptionalMemberExpression;
|
|
11
9
|
export declare function toMemberExpression(object: t.Expression, key: string, optional?: boolean): t.MemberExpression | t.OptionalMemberExpression;
|
|
@@ -10,5 +10,5 @@ export declare function translateByTarget<T extends t.Node>({ html, dom, }: {
|
|
|
10
10
|
readonly enter: (path: t.NodePath<T>) => void;
|
|
11
11
|
readonly exit: (path: t.NodePath<T>) => void;
|
|
12
12
|
};
|
|
13
|
-
export declare function enterHook<T extends t.Node>(modulePlugin: Plugin
|
|
14
|
-
export declare function exitHook<T extends t.Node>(modulePlugin: Plugin
|
|
13
|
+
export declare function enterHook<T extends t.Node>(modulePlugin: Plugin, path: t.NodePath<T>): void;
|
|
14
|
+
export declare function exitHook<T extends t.Node>(modulePlugin: Plugin, path: t.NodePath<T>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
import {
|
|
3
|
-
type Write = string | t.Expression
|
|
2
|
+
import type { Binding } from "./bindings";
|
|
3
|
+
type Write = string | t.Expression;
|
|
4
4
|
export declare function writeTo(path: t.NodePath<any>, trailer?: boolean): (strs: TemplateStringsArray, ...exprs: Write[]) => void;
|
|
5
5
|
export declare function flushBefore(path: t.NodePath<any>): void;
|
|
6
6
|
export declare function flushInto(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>): t.NodePath<t.MarkoTagBody | t.Program>;
|
|
@@ -21,6 +21,8 @@ interface NativeAttrs {
|
|
|
21
21
|
spread: number[] | undefined;
|
|
22
22
|
/** Writes the page's nonce on a `<script>` or `<style>` that sets none itself. */
|
|
23
23
|
injectsNonce: boolean;
|
|
24
|
+
/** With nothing else filling the element, the spread's `content` renders it. */
|
|
25
|
+
spreadContent: boolean;
|
|
24
26
|
}
|
|
25
27
|
interface Controllable {
|
|
26
28
|
state: "checked" | "checkedValue" | "value" | "open";
|
package/index.d.ts
CHANGED
|
@@ -116,6 +116,17 @@ declare global {
|
|
|
116
116
|
/** @marko-overload-end */
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* A template typed by its signature as a tag (eg `<T>(input: Input<T>) => Return<T>`),
|
|
121
|
+
* from which a tag using a generic template infers its type arguments.
|
|
122
|
+
*/
|
|
123
|
+
export interface TemplateOf<
|
|
124
|
+
Signature extends (input: any) => any,
|
|
125
|
+
> extends Template<Parameters<Signature>[0], ReturnType<Signature>> {
|
|
126
|
+
/** Types only: its signature as a tag, never one to call. */
|
|
127
|
+
readonly _: Signature;
|
|
128
|
+
}
|
|
129
|
+
|
|
119
130
|
export type AttrTag<T> = T & {
|
|
120
131
|
[Symbol.iterator](): Iterator<T>;
|
|
121
132
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1",
|
|
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.43.
|
|
54
|
+
"@marko/compiler": "^5.43.5",
|
|
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.
|
|
61
|
-
"marko": "5.
|
|
60
|
+
"@marko/runtime-tags": "npm:marko@6.5.1",
|
|
61
|
+
"marko": "5.42.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22.12.0"
|