marko 6.0.131 → 6.0.132

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.
@@ -0,0 +1,3 @@
1
+ import type { Opt } from "./optional";
2
+ import type { Binding } from "./references";
3
+ export declare function bindingHasProperty(binding: Binding, properties: Opt<string>): boolean;
@@ -6,6 +6,7 @@ export type BindingPropTree = {
6
6
  } | undefined;
7
7
  rest: BindingPropTree | undefined;
8
8
  };
9
- export declare function getBindingPropTree(binding: Binding): BindingPropTree;
10
- export declare function getBindingPropTreeProp(propTree: BindingPropTree, name: string): BindingPropTree | undefined;
11
- export declare function getAllBindingPropTreePropKeys(propTree: BindingPropTree): string[];
9
+ export declare function getBindingPropTree(binding: Binding): BindingPropTree | undefined;
10
+ export declare function getKnownFromPropTree(propTree: BindingPropTree | true, name: string): BindingPropTree | true | undefined;
11
+ export declare function getAllKnownPropNames(propTree: BindingPropTree): string[];
12
+ export declare function hasAllKnownProps(propTree: BindingPropTree): boolean | undefined;
@@ -1,10 +1,11 @@
1
1
  import { types as t } from "@marko/compiler";
2
- export type AttrTagLookup = Record<string, {
2
+ export interface AttrTagMeta {
3
3
  name: string;
4
4
  dynamic: boolean;
5
5
  repeated: boolean;
6
6
  group: AttrTagNames;
7
- }>;
7
+ }
8
+ export type AttrTagLookup = Record<string, AttrTagMeta>;
8
9
  export type AttrTagGroup = AttrTagLookup[string]["group"];
9
10
  type AttrTagNames = string[];
10
11
  declare module "@marko/compiler/dist/types" {
@@ -31,18 +31,19 @@ export interface Binding {
31
31
  closureSections: Opt<Section>;
32
32
  assignmentSections: Opt<Section>;
33
33
  sources: undefined | Sources;
34
+ reads: Set<ReferencedExtra>;
34
35
  aliases: Set<Binding>;
35
36
  hoists: Map<Section, Binding>;
36
37
  property: string | undefined;
37
38
  propertyAliases: Map<string, Binding>;
38
39
  excludeProperties: Opt<string>;
39
40
  upstreamAlias: Binding | undefined;
40
- downstreamExpressions: Set<ReferencedExtra>;
41
41
  scopeOffset: Binding | undefined;
42
42
  scopeAccessor: string | undefined;
43
43
  export: string | undefined;
44
44
  declared: boolean;
45
45
  nullable: boolean;
46
+ pruned: boolean | undefined;
46
47
  }
47
48
  export interface InputBinding extends Binding {
48
49
  type: BindingType.input;
@@ -110,9 +111,8 @@ export declare function compareSources(a: Sources, b: Sources): number;
110
111
  export declare function mergeSources(a: undefined | Sources, b: undefined | Sources): Sources | undefined;
111
112
  export declare const bindingUtil: Sorted<Binding>;
112
113
  export declare const propsUtil: Sorted<string>;
113
- export declare function addRead(exprExtra: ReferencedExtra, readExtra: t.NodeExtra | undefined, binding: Binding, section: Section): Read;
114
- export declare function dropRead(exprExtra: ReferencedExtra): void;
115
- export declare function dropReferences(node: t.Node | t.Node[]): void;
114
+ export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra | undefined, binding: Binding, section: Section): Read;
115
+ export declare function dropNodes(node: t.Node | t.Node[]): void;
116
116
  export declare function getCanonicalBinding(binding: Binding): Binding;
117
117
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[]): t.Node[];
118
118
  export declare function getScopeAccessorLiteral(binding: Binding, encoded?: boolean, includeId?: boolean): t.StringLiteral | t.NumericLiteral;
@@ -127,6 +127,7 @@ export declare function getSectionInstancesAccessor(section: Section): string;
127
127
  export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral | t.NumericLiteral | undefined;
128
128
  export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression, signal?: Signal): t.Expression | undefined;
129
129
  export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
130
+ export declare function pruneBinding(binding: Binding): boolean;
130
131
  export declare function createRead(binding: Binding, props: Opt<string>): {
131
132
  binding: Binding;
132
133
  props: Opt<string>;
@@ -149,5 +150,5 @@ export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
149
150
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
150
151
  export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
151
152
  export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra): undefined | SerializeReason;
152
- export declare function getAllSerializeReasonsForBinding(binding: Binding): undefined | SerializeReason;
153
+ export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true): undefined | SerializeReason;
153
154
  export {};
@@ -1,6 +1,6 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import type { AccessorPrefix } from "../../common/accessor.debug";
3
- import { Sorted } from "./optional";
3
+ import { type Opt, Sorted } from "./optional";
4
4
  import { type Binding, type InputBinding, type ParamBinding, type ReferencedBindings, type Sources } from "./references";
5
5
  import { type SerializeReason } from "./serialize-reasons";
6
6
  export interface ParamSerializeReasonGroup {
@@ -42,7 +42,10 @@ export interface Section {
42
42
  returnSerializeReason: SerializeReason | undefined;
43
43
  isHoistThrough: true | undefined;
44
44
  upstreamExpression: t.NodeExtra | undefined;
45
- downstreamBinding: Binding | undefined | false;
45
+ downstreamBinding: {
46
+ binding: Binding;
47
+ properties: Opt<string>;
48
+ } | undefined;
46
49
  hasAbortSignal: boolean;
47
50
  isBranch: boolean;
48
51
  content: null | {
@@ -78,7 +81,7 @@ export declare function isImmediateOwner(section: Section, binding: Binding): bo
78
81
  export declare function isDirectClosure(section: Section, closure: Binding): boolean;
79
82
  export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
80
83
  export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
81
- export declare function getDirectClosures(section: Section): import("./optional").Opt<Binding>;
84
+ export declare function getDirectClosures(section: Section): Opt<Binding>;
82
85
  export declare function isSameOrChildSection(section: Section, other: Section): boolean;
83
86
  export declare function getCommonSection(section: Section, other: Section): Section;
84
87
  export declare function finalizeParamSerializeReasonGroups(section: Section): void;
@@ -1,5 +1,5 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import type { Binding } from "./references";
3
3
  import { type Section } from "./sections";
4
- export declare function setTagDownstream(tag: t.NodePath<t.MarkoTag>, binding: undefined | false | Binding): void;
4
+ export declare function setTagDownstream(tag: t.NodePath<t.MarkoTag>, binding: undefined | Binding): void;
5
5
  export declare function finalizeTagDownstreams(section: Section): void;
@@ -1,15 +1,14 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type TemplateExports } from "../visitors/program";
3
- import type { BindingPropTree } from "./binding-prop-tree";
2
+ import { type BindingPropTree } from "./binding-prop-tree";
4
3
  import { type AttrTagLookup } from "./nested-attribute-tags";
5
4
  type ContentKey = "renderBody" | "content";
6
- export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, propTree?: BindingPropTree, skip?: Set<string>, statements?: t.Statement[], contentKey?: ContentKey): {
5
+ export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, propTree?: BindingPropTree | true, skip?: Set<string>, statements?: t.Statement[], contentKey?: ContentKey): {
7
6
  properties: (t.ObjectMethod | t.ObjectProperty | t.SpreadElement)[];
8
7
  statements: t.Statement[];
9
8
  };
10
9
  export declare function getTranslatedBodyContentProperty(props: t.ObjectExpression["properties"]): (t.ObjectProperty & {
11
10
  value: t.Expression;
12
11
  }) | undefined;
13
- export declare function addDynamicAttrTagStatements(attrTags: t.NodePath<t.MarkoTag["attributeTags"][number]>[], index: number, attrTagLookup: AttrTagLookup, statements: t.Statement[], templateExports: TemplateExports, contentKey?: ContentKey): number;
12
+ export declare function addDynamicAttrTagStatements(attrTags: t.NodePath<t.MarkoTag["attributeTags"][number]>[], index: number, attrTagLookup: AttrTagLookup, statements: t.Statement[], propTree: BindingPropTree | true, contentKey?: ContentKey): number;
14
13
  export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression;
15
14
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.131",
3
+ "version": "6.0.132",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -1,2 +0,0 @@
1
- import type { Binding } from "./references";
2
- export declare function bindingHasDownstreamExpressions(binding: Binding): boolean;