marko 6.3.48 → 6.3.50

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.
Files changed (58) hide show
  1. package/dist/common/constants/resume-symbol.d.ts +1 -0
  2. package/dist/debug/dom/catch.feat.js +1 -1
  3. package/dist/debug/dom/catch.feat.mjs +1 -1
  4. package/dist/debug/dom/controllable-input.feat.js +1 -1
  5. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  6. package/dist/debug/dom/controllable-open.feat.js +1 -1
  7. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-select.feat.js +1 -1
  9. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable.feat.js +1 -1
  13. package/dist/debug/dom/controllable.feat.mjs +1 -1
  14. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  15. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  16. package/dist/debug/dom/placeholder.feat.js +1 -1
  17. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  18. package/dist/debug/{dom-CA_HiiES.js → dom-BAGeiafn.js} +25 -17
  19. package/dist/debug/{dom-DBMLPLeE.mjs → dom-C55iHvof.mjs} +25 -17
  20. package/dist/debug/dom.js +1 -1
  21. package/dist/debug/dom.mjs +1 -1
  22. package/dist/debug/html.js +76 -37
  23. package/dist/debug/html.mjs +76 -37
  24. package/dist/dom/catch.feat.js +1 -1
  25. package/dist/dom/catch.feat.mjs +1 -1
  26. package/dist/dom/controllable-input.feat.js +1 -1
  27. package/dist/dom/controllable-input.feat.mjs +1 -1
  28. package/dist/dom/controllable-open.feat.js +1 -1
  29. package/dist/dom/controllable-open.feat.mjs +1 -1
  30. package/dist/dom/controllable-select.feat.js +1 -1
  31. package/dist/dom/controllable-select.feat.mjs +1 -1
  32. package/dist/dom/controllable-textarea.feat.js +1 -1
  33. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  34. package/dist/dom/controllable.feat.js +1 -1
  35. package/dist/dom/controllable.feat.mjs +1 -1
  36. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  37. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  38. package/dist/dom/placeholder.feat.js +1 -1
  39. package/dist/dom/placeholder.feat.mjs +1 -1
  40. package/dist/{dom-BfydlrCq.js → dom-BNmfm4st.js} +15 -15
  41. package/dist/{dom-UwNQ-AXt.mjs → dom-BsAS26Ze.mjs} +15 -15
  42. package/dist/dom.js +1 -1
  43. package/dist/dom.mjs +1 -1
  44. package/dist/html/inlined-runtimes.d.ts +2 -2
  45. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  46. package/dist/html/writer.d.ts +3 -1
  47. package/dist/html.js +46 -36
  48. package/dist/html.mjs +46 -36
  49. package/dist/translator/index.js +195 -161
  50. package/dist/translator/util/asset-imports.d.ts +1 -1
  51. package/dist/translator/util/body-to-text-literal.d.ts +1 -1
  52. package/dist/translator/util/get-compile-stage.d.ts +2 -0
  53. package/dist/translator/util/optional.d.ts +1 -0
  54. package/dist/translator/util/references.d.ts +8 -3
  55. package/dist/translator/util/sections.d.ts +24 -6
  56. package/dist/translator/util/serialize-reasons.d.ts +6 -2
  57. package/dist/translator/visitors/program/pre-analyze.d.ts +6 -0
  58. package/package.json +4 -4
@@ -9,5 +9,5 @@ declare module "@marko/compiler" {
9
9
  assetImports?: Set<string>;
10
10
  }
11
11
  }
12
- export declare function addAssetImport(file: t.BabelFile, request: string): void;
12
+ export declare function addAssetImport(request: string): void;
13
13
  export declare function isClientAssetImport(file: t.BabelFile, request: string): boolean;
@@ -5,6 +5,6 @@ declare module "@marko/compiler/dist/types" {
5
5
  [kRawText]?: true;
6
6
  }
7
7
  }
8
- export declare function bodyToTextLiteral(body: t.MarkoTagBody): 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;
8
+ export declare function bodyToTextLiteral(body: t.MarkoTagBody, decodeEntities?: boolean): 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;
9
9
  export declare function bodyToRawTextLiteral(body: t.MarkoTagBody): 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;
10
10
  export declare function injectTextCoercion(expr: t.Expression): void;
@@ -1 +1,3 @@
1
+ import type { types as t } from "@marko/compiler";
1
2
  export declare function isTranslate(): boolean;
3
+ export declare function isAnalyzing(file: t.BabelFile): boolean;
@@ -23,6 +23,7 @@ export declare function toIter<T>(data: Opt<T>): Iterable<T>;
23
23
  export declare function includes<T>(data: Opt<T>, item: T): boolean;
24
24
  export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
25
25
  export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
26
+ export declare function every<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
26
27
  export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
27
28
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
28
29
  export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
@@ -3,7 +3,7 @@ import type { AccessorPrefix } from "../../common/accessor.debug";
3
3
  import * as BindingType from "./constants/binding-type";
4
4
  import { type Many, type Opt, Sorted } from "./optional";
5
5
  import { type Section } from "./sections";
6
- import { type SerializeReason } from "./serialize-reasons";
6
+ import { type SerializeKey, type SerializeReason } from "./serialize-reasons";
7
7
  import { type Signal } from "./signals";
8
8
  export declare const kBranchSerializeReason: unique symbol;
9
9
  export type Aliases = undefined | Binding | {
@@ -48,6 +48,9 @@ export interface Binding {
48
48
  pruned: boolean | undefined;
49
49
  exposed: boolean;
50
50
  forcePersist: boolean;
51
+ /** Binding-side counterpart of `Section.serializePropKeys`, keyed by
52
+ * accessor prefix (`undefined` is the plain binding key). */
53
+ serializePropKeys: Map<AccessorPrefix | symbol | undefined, SerializeKey> | undefined;
51
54
  reserveSize: number;
52
55
  }
53
56
  export interface InputBinding extends Binding {
@@ -99,6 +102,8 @@ declare module "@marko/compiler/dist/types" {
99
102
  read?: ExtraRead;
100
103
  pruned?: true;
101
104
  isEffect?: true;
105
+ /** The expression is a dynamic tag's input (attrs, args, attr tags). */
106
+ dynamicTagInput?: true;
102
107
  invokeOnly?: true;
103
108
  lazyBindings?: ReferencedBindings;
104
109
  /** `$global` bindings this expression reads: the root means an opaque
@@ -192,8 +197,8 @@ export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
192
197
  }
193
198
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
194
199
  export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
195
- export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra): undefined | SerializeReason;
196
- export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true): undefined | SerializeReason;
200
+ export declare function getAllSerializeReasonsForExtra(extra: t.NodeExtra, register?: boolean): undefined | SerializeReason;
201
+ export declare function getAllSerializeReasonsForBinding(binding: Binding, properties?: Opt<string> | true, register?: boolean): undefined | SerializeReason;
197
202
  export interface KnownExprs {
198
203
  known?: Record<string, KnownExprs>;
199
204
  value?: t.NodeExtra;
@@ -4,9 +4,9 @@ import type { WalkCode } from "../../common/types";
4
4
  import * as ContentType from "./constants/content-type";
5
5
  import type * as Step from "./constants/step";
6
6
  import * as StructureKind from "./constants/structure-kind";
7
- import { type Opt, Sorted } from "./optional";
7
+ import { type OneMany, type Opt, Sorted } from "./optional";
8
8
  import { type Binding, type InputBinding, type KnownExprs, type ParamBinding, type ReferencedBindings, type Sources } from "./references";
9
- import { type SerializeReason } from "./serialize-reasons";
9
+ import { type SerializeKey, type SerializeReason, type SerializeReasons } from "./serialize-reasons";
10
10
  export interface ParamSerializeReasonGroup {
11
11
  id: symbol;
12
12
  reason: NonNullable<Sources["param"]>;
@@ -64,16 +64,32 @@ export interface Section {
64
64
  hoistedTo: ReferencedBindings;
65
65
  serializeReason: undefined | SerializeReason;
66
66
  serializeReasons: Map<symbol, SerializeReason>;
67
+ /** Reasons any of the section's dom nodes resumes, as the analyzed reasons
68
+ * (not merged) so each one's guard stays buildable. */
69
+ domSerializeReasons: undefined | SerializeReasons;
70
+ /** Pending serialize exprs, resolved into the reasons (and provenance)
71
+ * once references finalize. */
72
+ serializeExprs: Opt<t.NodeExtra>;
73
+ propSerializeExprs: Map<SerializeKey, OneMany<t.NodeExtra>> | undefined;
74
+ /** Whose values feed each serialization decision — survives force-`true`
75
+ * and counts function-body reads; complete after reference finalize. */
76
+ serializeProvenance: Sources | undefined;
77
+ propSerializeProvenance: Map<SerializeKey, Sources> | undefined;
78
+ /** Interned per-prop reason keys for string/symbol props. */
79
+ serializePropKeys: Map<string | symbol, SerializeKey> | undefined;
67
80
  paramReasonGroups: ParamSerializeReasonGroups | undefined;
68
81
  returnValueExpr: t.NodeExtra | undefined;
69
82
  returnSerializeReason: SerializeReason | undefined;
70
83
  isHoistThrough: true | undefined;
71
84
  upstreamExpression: t.NodeExtra | undefined;
72
- downstreamBinding: {
73
- binding: Binding;
85
+ /** The content's rendering tag (its extra), and the child binding the
86
+ * content feeds when the child can serialize it. */
87
+ downstream: {
88
+ tag: t.MarkoTagExtra;
89
+ binding: Binding | undefined;
74
90
  properties: Opt<string>;
75
91
  exprs: KnownExprs | undefined;
76
- } | false | undefined;
92
+ } | undefined;
77
93
  hasAbortSignal: boolean;
78
94
  /** Count of distinct `$signal` expression roots; analyze allocates each
79
95
  * root's `abortId` from this so translates read, never re-derive. */
@@ -105,6 +121,7 @@ export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
105
121
  export declare const getSectionParentIsOwner: (section: Section) => boolean, setSectionParentIsOwner: (section: Section, value: boolean) => void;
106
122
  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;
107
123
  export declare function forEachSection(fn: (section: Section) => void): void;
124
+ export declare function getChildSections(section: Section): Section[];
108
125
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
109
126
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType.Value | null;
110
127
  export declare function getSectionRegisterReasons(section: Section): false | SerializeReason;
@@ -116,5 +133,6 @@ export declare function getDirectClosures(section: Section): Opt<Binding>;
116
133
  export declare function isSameOrChildSection(section: Section, other: Section): boolean;
117
134
  export declare function getCommonSection(section: Section, other: Section): Section;
118
135
  export declare function finalizeParamSerializeReasonGroups(section: Section): void;
136
+ export declare function ensureReasonGroups(reason: Section["serializeReason"]): void;
119
137
  export declare function getParamReasonGroupIndex(section: Section, reason: ParamSerializeReasonGroup["reason"]): number;
120
- export declare function groupParamsBySection(params: Sources["param"]): Map<Section, import("./optional").OneMany<InputBinding | ParamBinding>>;
138
+ export declare function groupParamsBySection(params: Sources["param"]): Map<Section, OneMany<InputBinding | ParamBinding>>;
@@ -1,10 +1,14 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { AccessorPrefix, AccessorProp } from "../../common/types";
3
- import { type Opt } from "./optional";
3
+ import { type OneMany, type Opt, Sorted } from "./optional";
4
4
  import { type Binding, type KnownExprs, type ReferencedBindings, type Sources } from "./references";
5
5
  import type { Section } from "./sections";
6
- export type SerializeReasons = true | [Sources, ...Sources[]];
6
+ export type SerializeReasons = true | OneMany<Sources>;
7
+ export declare const sourcesUtil: Sorted<Sources>;
7
8
  export type SerializeReason = true | Sources;
9
+ export type SerializeKey = symbol & {
10
+ __serialize_key__: 1;
11
+ };
8
12
  export declare function isSameReason(a: SerializeReason | undefined, b: SerializeReason | undefined): boolean;
9
13
  export declare function isForceSerialized(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): boolean;
10
14
  export declare function addSerializeReason(section: Section, reason: undefined | false | SerializeReason, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
@@ -1,2 +1,8 @@
1
1
  import { types as t } from "@marko/compiler";
2
+ import { type TagDefinition } from "@marko/compiler/babel-utils";
3
+ declare module "@marko/compiler/dist/types" {
4
+ interface MarkoTag {
5
+ tagDef?: TagDefinition | null;
6
+ }
7
+ }
2
8
  export declare function preAnalyze(program: t.NodePath<t.Program>): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.3.48",
3
+ "version": "6.3.50",
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.42.3",
54
+ "@marko/compiler": "^5.42.5",
55
55
  "csstype": "^3.2.3",
56
56
  "fastest-levenshtein": "^1.0.16",
57
57
  "magic-string": "^0.30.21"
58
58
  },
59
59
  "devDependencies": {
60
- "@marko/runtime-tags": "npm:marko@6.3.48",
61
- "marko": "5.39.38"
60
+ "@marko/runtime-tags": "npm:marko@6.3.50",
61
+ "marko": "5.39.40"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"