marko 6.0.0-next.3.83 → 6.0.0-next.3.84
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/translator/core/html-comment.d.ts +2 -2
- package/dist/translator/core/html-script.d.ts +3 -0
- package/dist/translator/core/html-style.d.ts +3 -0
- package/dist/translator/index.js +1841 -1572
- package/dist/translator/util/get-accessor-char.d.ts +2 -3
- package/dist/translator/util/get-compile-stage.d.ts +9 -0
- package/dist/translator/util/is-only-child-in-parent.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +6 -5
- package/dist/translator/util/references.d.ts +4 -1
- package/dist/translator/util/sections.d.ts +6 -3
- package/dist/translator/util/serialize-reasons.d.ts +22 -0
- package/dist/translator/util/signals.d.ts +4 -1
- package/dist/translator/visitors/tag/custom-tag.d.ts +0 -2
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -2
- package/package.json +1 -1
- package/dist/translator/util/dynamic-sources.d.ts +0 -17
@@ -1,4 +1,3 @@
|
|
1
|
-
import { AccessorPrefix as ProductionAccessorPrefix, AccessorProp as ProductionAccessorProp } from "../../common/accessor";
|
2
1
|
import { AccessorPrefix as DebugAccessorPrefix, AccessorProp as DebugAccessorProp } from "../../common/accessor.debug";
|
3
|
-
export declare function getAccessorPrefix(): typeof DebugAccessorPrefix
|
4
|
-
export declare function getAccessorProp(): typeof DebugAccessorProp
|
2
|
+
export declare function getAccessorPrefix(): typeof DebugAccessorPrefix;
|
3
|
+
export declare function getAccessorProp(): typeof DebugAccessorProp;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare enum CompileStage {
|
2
|
+
parse = "parse",
|
3
|
+
migrate = "migrate",
|
4
|
+
transform = "transform",
|
5
|
+
analyze = "analyze",
|
6
|
+
translate = "translate"
|
7
|
+
}
|
8
|
+
export declare function getCompileStage(): CompileStage;
|
9
|
+
export declare function isTranslate(): boolean;
|
@@ -10,5 +10,5 @@ declare module "@marko/compiler/dist/types" {
|
|
10
10
|
}
|
11
11
|
}
|
12
12
|
export declare function isOnlyChildInParent(tag: t.NodePath<t.MarkoTag>, branchSize?: number): boolean;
|
13
|
-
export declare function
|
13
|
+
export declare function getOptimizedOnlyChildNodeBinding(tag: t.NodePath<t.MarkoTag>, section: Section, branchSize?: number): Binding;
|
14
14
|
export {};
|
@@ -5,17 +5,18 @@ export type Compare<T> = (a: T, b: T) => number;
|
|
5
5
|
export declare class Sorted<T> {
|
6
6
|
compare: Compare<T>;
|
7
7
|
constructor(compare: Compare<T>);
|
8
|
-
add(data: Opt<
|
9
|
-
union(a: Opt<
|
10
|
-
find(data: Opt<
|
11
|
-
findIndex(data: Opt<
|
12
|
-
isSuperset(superset: Opt<
|
8
|
+
add<U extends T>(data: Opt<U>, item: U): OneMany<U>;
|
9
|
+
union<U extends T>(a: Opt<U>, b: Opt<U>): Opt<U>;
|
10
|
+
find<U extends T>(data: Opt<U>, item: U): U | undefined;
|
11
|
+
findIndex<U extends T>(data: Opt<U>, item: U): number;
|
12
|
+
isSuperset<U extends T>(superset: Opt<U>, subset: Opt<U>): boolean;
|
13
13
|
}
|
14
14
|
export declare function push<T>(data: Opt<T>, item: T): Opt<T>;
|
15
15
|
export declare function concat<T>(a: Opt<T>, b: Opt<T>): Opt<T>;
|
16
16
|
export declare function size<T>(data: Opt<T>): number;
|
17
17
|
export declare function filter<T>(data: Opt<T>, cb: (item: T) => boolean): Opt<T>;
|
18
18
|
export declare function forEach<T>(data: Opt<T>, cb: (item: T, index: number) => void): void;
|
19
|
+
export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
|
19
20
|
export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
|
20
21
|
export declare function map<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
21
22
|
export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
|
@@ -20,8 +20,8 @@ export interface Binding {
|
|
20
20
|
loc: t.SourceLocation | null;
|
21
21
|
section: Section;
|
22
22
|
closureSections: Opt<Section>;
|
23
|
-
serialize: boolean;
|
24
23
|
sources: Opt<Binding>;
|
24
|
+
serializeSources: Opt<InputBinding> | true;
|
25
25
|
aliases: Set<Binding>;
|
26
26
|
hoists: Map<Section, Binding>;
|
27
27
|
property: string | undefined;
|
@@ -35,6 +35,9 @@ export interface Binding {
|
|
35
35
|
declared: boolean;
|
36
36
|
nullable: boolean;
|
37
37
|
}
|
38
|
+
export interface InputBinding extends Binding {
|
39
|
+
type: BindingType.input;
|
40
|
+
}
|
38
41
|
export type ReferencedBindings = Opt<Binding>;
|
39
42
|
export type Intersection = Many<Binding>;
|
40
43
|
declare module "@marko/compiler/dist/types" {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
|
-
import { Sorted } from "./optional";
|
3
|
-
import type { Binding, ReferencedBindings } from "./references";
|
2
|
+
import { type OneMany, Sorted } from "./optional";
|
3
|
+
import type { Binding, InputBinding, ReferencedBindings } from "./references";
|
4
4
|
export declare enum ContentType {
|
5
5
|
Comment = 0,
|
6
6
|
Dynamic = 1,
|
@@ -23,6 +23,7 @@ export interface Section {
|
|
23
23
|
referencedHoists: ReferencedBindings;
|
24
24
|
bindings: ReferencedBindings;
|
25
25
|
hoisted: ReferencedBindings;
|
26
|
+
serializeReasons: Map<symbol, true | OneMany<InputBinding>>;
|
26
27
|
isHoistThrough: true | undefined;
|
27
28
|
assignments: ReferencedBindings;
|
28
29
|
upstreamExpression: t.NodeExtra | undefined;
|
@@ -44,6 +45,7 @@ declare module "@marko/compiler/dist/types" {
|
|
44
45
|
section?: Section;
|
45
46
|
}
|
46
47
|
}
|
48
|
+
export declare const kBranchSerializeReason: unique symbol;
|
47
49
|
export declare const sectionUtil: Sorted<Section>;
|
48
50
|
export declare function startSection(path: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
|
49
51
|
export declare function getOrCreateSection(path: t.NodePath<any>): Section;
|
@@ -57,10 +59,11 @@ export declare function forEachSection(fn: (section: Section) => void): void;
|
|
57
59
|
export declare function forEachSectionReverse(fn: (section: Section) => void): void;
|
58
60
|
export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType | null;
|
59
61
|
export declare const isSerializedSection: (section: Section) => boolean;
|
60
|
-
export declare function isSectionWithHoists(section: Section):
|
62
|
+
export declare function isSectionWithHoists(section: Section): boolean;
|
61
63
|
export declare function isImmediateOwner(section: Section, binding: Binding): boolean;
|
62
64
|
export declare function isDirectClosure(section: Section, closure: Binding): boolean;
|
63
65
|
export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
|
66
|
+
export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
|
64
67
|
export declare function getDirectClosures(section: Section): import("./optional").Opt<Binding>;
|
65
68
|
export declare function isSameOrChildSection(section: Section, other: Section): boolean;
|
66
69
|
export declare function getCommonSection(section: Section, other: Section): Section;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
2
|
+
import { AccessorPrefix, AccessorProp } from "../../common/types";
|
3
|
+
import { type Opt } from "./optional";
|
4
|
+
import { type Binding, type InputBinding, type ReferencedBindings } from "./references";
|
5
|
+
import type { Section } from "./sections";
|
6
|
+
export declare function forcePropSerialize(section: Section, extra: t.NodeExtra, prop: AccessorProp | symbol): void;
|
7
|
+
export declare function forceBindingSerialize(section: Section, binding: Binding, prefix?: AccessorPrefix): void;
|
8
|
+
export declare function isPropForceSerialized(section: Section, extra: t.NodeExtra, prop: AccessorProp | symbol): boolean;
|
9
|
+
export declare function isBindingForceSerialized(section: Section, binding: Binding, prefix?: AccessorPrefix): boolean;
|
10
|
+
export declare function addPropSerializeReasonExpr(section: Section, extra: t.NodeExtra, prop: AccessorProp | symbol, expr: undefined | boolean | Opt<t.NodeExtra>): void;
|
11
|
+
export declare function addBindingSerializeReasonExpr(section: Section, binding: Binding, expr: undefined | boolean | Opt<t.NodeExtra>, prefix?: AccessorPrefix): void;
|
12
|
+
export declare function addPropSerializeReasonRef(section: Section, extra: t.NodeExtra, prop: AccessorProp | symbol, ref: undefined | boolean | ReferencedBindings): void;
|
13
|
+
export declare function addBindingSerializeReasonRef(section: Section, binding: Binding, ref: undefined | boolean | ReferencedBindings, prefix?: AccessorPrefix): void;
|
14
|
+
export declare function addPropSerializeReason(section: Section, extra: t.NodeExtra, prop: AccessorProp | symbol, reason: boolean | Opt<InputBinding>): void;
|
15
|
+
export declare function addBindingSerializeReason(section: Section, binding: Binding, reason: boolean | Opt<InputBinding>, prefix?: AccessorPrefix): void;
|
16
|
+
export declare function getPropSerializeReason(section: Section, extra: t.NodeExtra, prop: AccessorProp | symbol): true | import("./optional").OneMany<InputBinding> | undefined;
|
17
|
+
export declare function getBindingSerializeReason(section: Section, binding: Binding, prefix?: AccessorPrefix): true | import("./optional").OneMany<InputBinding> | undefined;
|
18
|
+
export declare function consumeSerializeReasonExprs(section: Section): Map<symbol, Opt<t.NodeExtra>> | undefined;
|
19
|
+
export declare function getSerializeSourcesForExpr(expr: t.NodeExtra): true | Opt<InputBinding>;
|
20
|
+
export declare function getSerializeSourcesForExprs(exprs: Opt<t.NodeExtra>): true | Opt<InputBinding>;
|
21
|
+
export declare function getSerializeSourcesForRef(ref: ReferencedBindings): true | Opt<InputBinding>;
|
22
|
+
export declare function mergeSerializeReasons<T extends true | Opt<InputBinding>>(a: T, b: T): T;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
|
+
import type { AccessorPrefix, AccessorProp } from "../../common/types";
|
2
3
|
import { type Opt } from "./optional";
|
3
4
|
import { type Binding, type ReferencedBindings } from "./references";
|
4
5
|
import { type Section } from "./sections";
|
@@ -34,7 +35,9 @@ export type Signal = {
|
|
34
35
|
type closureSignalBuilder = (closure: Binding, render: t.Expression) => t.Expression;
|
35
36
|
export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, builder: closureSignalBuilder): void;
|
36
37
|
export declare function serializeSectionIfNeeded(section: Section, reason: undefined | boolean | Opt<Binding>): void;
|
37
|
-
export declare function
|
38
|
+
export declare function setBindingSerializedValue(section: Section, binding: Binding, expression: t.Expression, prefix?: AccessorPrefix): void;
|
39
|
+
export declare function setPropSerializedValue(section: Section, extra: t.NodeExtra, prop: AccessorProp, expression: t.Expression): void;
|
40
|
+
export declare function setSerializedValue(section: Section, key: string, expression: t.Expression): void;
|
38
41
|
export declare const getHTMLSectionStatements: (section: Section) => t.Statement[];
|
39
42
|
export declare function getHoistFunctionIdentifier(hoistedBinding: Binding): t.Identifier;
|
40
43
|
export declare function getSignal(section: Section, referencedBindings: ReferencedBindings, name?: string): Signal;
|
@@ -2,12 +2,10 @@ import { types as t } from "@marko/compiler";
|
|
2
2
|
import { type Binding } from "../../util/references";
|
3
3
|
declare const kChildScopeBinding: unique symbol;
|
4
4
|
declare const kChildOffsetScopeBinding: unique symbol;
|
5
|
-
declare const kChildAttrExprs: unique symbol;
|
6
5
|
declare module "@marko/compiler/dist/types" {
|
7
6
|
interface MarkoTagExtra {
|
8
7
|
[kChildScopeBinding]?: Binding;
|
9
8
|
[kChildOffsetScopeBinding]?: Binding;
|
10
|
-
[kChildAttrExprs]?: Set<t.NodeExtra>;
|
11
9
|
}
|
12
10
|
}
|
13
11
|
declare const _default: {
|
@@ -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 kSkipMark: 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
|
+
[kSkipMark]?: true;
|
10
10
|
[kGetterId]?: string;
|
11
11
|
}
|
12
12
|
}
|
package/package.json
CHANGED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { types as t } from "@marko/compiler";
|
2
|
-
import type { Opt } from "./optional";
|
3
|
-
import { type Binding } from "./references";
|
4
|
-
import { type Section } from "./sections";
|
5
|
-
export declare function getDynamicSourcesForBinding(binding: Binding): true | import("./optional").OneMany<Binding> | undefined;
|
6
|
-
export declare function getDynamicSourcesForExtra(extra: t.NodeExtra): true | Binding | import("./optional").Many<Binding> | undefined;
|
7
|
-
export declare function getDynamicSourcesForExtras(extras: Iterable<t.NodeExtra>): true | Opt<Binding>;
|
8
|
-
export declare function getDynamicSourcesForSection(section: Section): {
|
9
|
-
referenced: true | Binding | import("./optional").Many<Binding> | undefined;
|
10
|
-
closures: true | Binding | import("./optional").Many<Binding> | undefined;
|
11
|
-
all: true | Opt<Binding>;
|
12
|
-
} | undefined;
|
13
|
-
export declare function getDynamicSourcesForSections(sections: (Section | undefined)[]): {
|
14
|
-
referenced: true | Binding | import("./optional").Many<Binding> | undefined;
|
15
|
-
closures: true | Binding | import("./optional").Many<Binding> | undefined;
|
16
|
-
all: true | Opt<Binding>;
|
17
|
-
} | undefined;
|