marko 6.0.8 → 6.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/debug/dom.js +59 -47
- package/dist/debug/dom.mjs +59 -47
- package/dist/debug/html.js +98 -70
- package/dist/debug/html.mjs +98 -70
- package/dist/dom/resume.d.ts +2 -0
- package/dist/dom.js +38 -32
- package/dist/dom.mjs +38 -32
- package/dist/html/writer.d.ts +8 -8
- package/dist/html.js +64 -28
- package/dist/html.mjs +64 -28
- package/dist/translator/index.js +1294 -1170
- package/dist/translator/util/is-only-child-in-parent.d.ts +2 -2
- package/dist/translator/util/optional.d.ts +1 -0
- package/dist/translator/util/references.d.ts +16 -5
- package/dist/translator/util/serialize-reasons.d.ts +10 -12
- package/dist/translator/util/with-comment.d.ts +2 -0
- package/dist/translator/visitors/program/html.d.ts +4 -3
- package/dist/translator/visitors/program/index.d.ts +9 -5
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -2
- package/package.json +1 -1
@@ -5,10 +5,10 @@ declare const kOnlyChildInParent: unique symbol;
|
|
5
5
|
declare const kNodeRef: unique symbol;
|
6
6
|
declare module "@marko/compiler/dist/types" {
|
7
7
|
interface NodeExtra {
|
8
|
-
[kOnlyChildInParent]?:
|
8
|
+
[kOnlyChildInParent]?: false | string;
|
9
9
|
[kNodeRef]?: Binding;
|
10
10
|
}
|
11
11
|
}
|
12
|
-
export declare function
|
12
|
+
export declare function getOnlyChildParentTagName(tag: t.NodePath<t.MarkoTag>, branchSize?: number): string | false;
|
13
13
|
export declare function getOptimizedOnlyChildNodeBinding(tag: t.NodePath<t.MarkoTag>, section: Section, branchSize?: number): Binding;
|
14
14
|
export {};
|
@@ -19,6 +19,7 @@ export declare function forEach<T>(data: Opt<T>, cb: (item: T, index: number) =>
|
|
19
19
|
export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
|
20
20
|
export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
|
21
21
|
export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
22
|
+
export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
|
22
23
|
export declare function filterMap<T, R>(data: Opt<T>, cb: (item: T) => undefined | R): Opt<R>;
|
23
24
|
export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
|
24
25
|
export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
2
|
import { type Many, type OneMany, type Opt, Sorted } from "./optional";
|
3
3
|
import { type Section } from "./sections";
|
4
|
-
import { type SerializeReason } from "./serialize-reasons";
|
5
4
|
declare const kIsInvoked: unique symbol;
|
6
5
|
export declare const kBranchSerializeReason: unique symbol;
|
7
6
|
export type Aliases = undefined | Binding | {
|
@@ -15,6 +14,10 @@ export declare enum BindingType {
|
|
15
14
|
derived = 4,
|
16
15
|
hoist = 5
|
17
16
|
}
|
17
|
+
export interface Sources {
|
18
|
+
state: Opt<Binding>;
|
19
|
+
input: Opt<InputBinding>;
|
20
|
+
}
|
18
21
|
export interface Binding {
|
19
22
|
id: number;
|
20
23
|
name: string;
|
@@ -23,8 +26,7 @@ export interface Binding {
|
|
23
26
|
section: Section;
|
24
27
|
closureSections: Opt<Section>;
|
25
28
|
assignmentSections: Opt<Section>;
|
26
|
-
sources:
|
27
|
-
serializeSources: undefined | SerializeReason;
|
29
|
+
sources: undefined | Sources;
|
28
30
|
aliases: Set<Binding>;
|
29
31
|
hoists: Map<Section, Binding>;
|
30
32
|
property: string | undefined;
|
@@ -72,13 +74,16 @@ export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody |
|
|
72
74
|
export declare function trackHoistedReference(referencePath: t.NodePath<t.Identifier>, binding: Binding): void;
|
73
75
|
export declare function setReferencesScope(path: t.NodePath<any>): void;
|
74
76
|
export declare function mergeReferences<T extends t.Node>(section: Section, target: T, nodes: (t.Node | undefined)[]): NonNullable<T["extra"]>;
|
75
|
-
export declare function
|
77
|
+
export declare function compareReferences(a: OneMany<Binding>, b: OneMany<Binding>): number;
|
76
78
|
export declare function finalizeReferences(): void;
|
77
79
|
export declare const intersectionMeta: WeakMap<Intersection, {
|
78
80
|
id: number;
|
79
81
|
scopeOffset: Binding | undefined;
|
80
82
|
}>;
|
81
|
-
export declare function setBindingValueExpr(binding: Binding, valueExpr:
|
83
|
+
export declare function setBindingValueExpr(binding: Binding, valueExpr: boolean | Opt<t.NodeExtra>): void;
|
84
|
+
export declare function createSources(state: Sources["state"], input: Sources["input"]): Sources;
|
85
|
+
export declare function compareSources(a: Sources, b: Sources): number;
|
86
|
+
export declare function mergeSources(a: undefined | Sources, b: undefined | Sources): Sources | undefined;
|
82
87
|
export declare const bindingUtil: Sorted<Binding>;
|
83
88
|
export declare function addReadToExpression(path: t.NodePath, binding: Binding, node?: t.Identifier | t.MemberExpression): ReferencedExtra;
|
84
89
|
export declare function dropReferences(node: t.Node | t.Node[]): void;
|
@@ -86,6 +91,12 @@ export declare function getCanonicalBinding(binding?: Binding): Binding | undefi
|
|
86
91
|
export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[]): t.Node[];
|
87
92
|
export declare function getScopeAccessorLiteral(binding: Binding, includeId?: boolean): t.StringLiteral | t.NumericLiteral;
|
88
93
|
export declare function getScopeAccessor(binding: Binding, includeId?: boolean): string;
|
94
|
+
export declare function getDebugScopeAccess(binding: Binding): {
|
95
|
+
root: Binding;
|
96
|
+
access: string;
|
97
|
+
};
|
98
|
+
export declare function getDebugName(binding: Binding): string;
|
99
|
+
export declare function getInputDebugName(binding: InputBinding): string;
|
89
100
|
export declare function getSectionInstancesAccessor(section: Section): string;
|
90
101
|
export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral | t.NumericLiteral | undefined;
|
91
102
|
export declare function getReadReplacement(node: t.Identifier | t.MemberExpression): t.Node | undefined;
|
@@ -1,14 +1,10 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
2
|
import { AccessorPrefix, AccessorProp } from "../../common/types";
|
3
|
-
import { type
|
4
|
-
import { type Binding, type
|
3
|
+
import { type Opt } from "./optional";
|
4
|
+
import { type Binding, type ReferencedBindings, type Sources } from "./references";
|
5
5
|
import type { Section } from "./sections";
|
6
|
-
export type
|
7
|
-
export type
|
8
|
-
DynamicSerializeReason,
|
9
|
-
...DynamicSerializeReason[]
|
10
|
-
];
|
11
|
-
export type SerializeReason = true | DynamicSerializeReason;
|
6
|
+
export type SerializeReasons = true | [Sources, ...Sources[]];
|
7
|
+
export type SerializeReason = true | Sources;
|
12
8
|
export type SerializeKey = symbol & {
|
13
9
|
__serialize_key__: 1;
|
14
10
|
};
|
@@ -28,7 +24,9 @@ export declare function getSectionSerializeReason(section: Section, prop?: Acces
|
|
28
24
|
export declare function getBindingSerializeReason(section: Section, binding: Binding, prefix?: AccessorPrefix | symbol): SerializeReason | undefined;
|
29
25
|
export declare function applySerializeReasonExprs(section: Section): void;
|
30
26
|
export declare function finalizeSectionSerializeReasons(section: Section): void;
|
31
|
-
export declare function getSerializeSourcesForExpr(expr: t.NodeExtra):
|
32
|
-
export declare function getSerializeSourcesForExprs(exprs: Opt<t.NodeExtra>):
|
33
|
-
export declare function getSerializeSourcesForRef(ref: ReferencedBindings):
|
34
|
-
export declare function mergeSerializeReasons
|
27
|
+
export declare function getSerializeSourcesForExpr(expr: t.NodeExtra): Sources | undefined;
|
28
|
+
export declare function getSerializeSourcesForExprs(exprs: Opt<t.NodeExtra>): Sources | undefined;
|
29
|
+
export declare function getSerializeSourcesForRef(ref: ReferencedBindings): Sources | undefined;
|
30
|
+
export declare function mergeSerializeReasons(a: SerializeReason, b: undefined | SerializeReason): SerializeReason;
|
31
|
+
export declare function mergeSerializeReasons(a: undefined | SerializeReason, b: SerializeReason): SerializeReason;
|
32
|
+
export declare function mergeSerializeReasons(a: undefined | SerializeReason, b: undefined | SerializeReason): SerializeReason | undefined;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
|
-
import type {
|
2
|
+
import type { SerializeReason, SerializeReasons } from "../../util/serialize-reasons";
|
3
3
|
export declare function getTemplateContentName(): string;
|
4
|
-
export declare function
|
5
|
-
export declare function
|
4
|
+
export declare function getSerializeGuard(reason: undefined | SerializeReason, optional: boolean): t.CallExpression | t.NumericLiteral | undefined;
|
5
|
+
export declare function getSerializeGuardForAny(reasons: undefined | SerializeReasons, optional: boolean): t.Expression | undefined;
|
6
|
+
export declare function getExprIfSerialized<T extends undefined | SerializeReason, U extends t.Expression>(reason: T, expr: U): T extends {} ? U : undefined;
|
6
7
|
declare const _default: {
|
7
8
|
translate: {
|
8
9
|
exit(this: unknown, program: t.NodePath<t.Program>): void;
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
|
-
import { type Binding } from "../../util/references";
|
3
|
-
|
2
|
+
import { type Binding, type Sources } from "../../util/references";
|
3
|
+
export type InputSerializeReason = NonNullable<Sources["input"]>;
|
4
|
+
export type InputSerializeReasons = [
|
5
|
+
InputSerializeReason,
|
6
|
+
...InputSerializeReason[]
|
7
|
+
];
|
4
8
|
export declare let cleanIdentifier: t.Identifier;
|
5
9
|
export declare let scopeIdentifier: t.Identifier;
|
6
10
|
export declare function isScopeIdentifier(node: t.Node): node is t.Identifier;
|
@@ -14,8 +18,8 @@ export type TemplateExport = {
|
|
14
18
|
export type TemplateExports = TemplateExport["props"];
|
15
19
|
declare module "@marko/compiler/dist/types" {
|
16
20
|
interface ProgramExtra {
|
17
|
-
inputSerializeReasons?:
|
18
|
-
returnSerializeReason?:
|
21
|
+
inputSerializeReasons?: InputSerializeReasons;
|
22
|
+
returnSerializeReason?: InputSerializeReason | true;
|
19
23
|
returnValueExpr?: t.NodeExtra;
|
20
24
|
domExports?: {
|
21
25
|
template: string;
|
@@ -40,4 +44,4 @@ declare const _default: {
|
|
40
44
|
};
|
41
45
|
};
|
42
46
|
export default _default;
|
43
|
-
export declare function resolveSerializeReasonId(inputSerializeReasons:
|
47
|
+
export declare function resolveSerializeReasonId(inputSerializeReasons: InputSerializeReasons, reason: InputSerializeReason): number;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
2
|
import { type Binding } from "../../util/references";
|
3
3
|
export declare const kNativeTagBinding: unique symbol;
|
4
|
-
export declare const
|
4
|
+
export declare const kSkipEndTag: unique symbol;
|
5
5
|
declare const kGetterId: unique symbol;
|
6
6
|
declare module "@marko/compiler/dist/types" {
|
7
7
|
interface NodeExtra {
|
8
8
|
[kNativeTagBinding]?: Binding;
|
9
|
-
[
|
9
|
+
[kSkipEndTag]?: true;
|
10
10
|
[kGetterId]?: string;
|
11
11
|
}
|
12
12
|
}
|