marko 6.4.11 → 6.4.12

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 (89) hide show
  1. package/dist/common/attr-tag.d.ts +1 -0
  2. package/dist/common/errors.d.ts +2 -0
  3. package/dist/common/helpers.d.ts +2 -0
  4. package/dist/debug/dom/catch.feat.js +1 -1
  5. package/dist/debug/dom/catch.feat.mjs +1 -1
  6. package/dist/debug/dom/compat.feat.js +143 -0
  7. package/dist/debug/dom/compat.feat.mjs +141 -0
  8. package/dist/debug/dom/controllable-input.feat.js +1 -1
  9. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-open.feat.js +1 -1
  11. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-select.feat.js +1 -1
  13. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  16. package/dist/debug/dom/controllable.feat.js +1 -1
  17. package/dist/debug/dom/controllable.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  19. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  20. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  21. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  22. package/dist/debug/dom/lazy.feat.js +1 -1
  23. package/dist/debug/dom/lazy.feat.mjs +1 -1
  24. package/dist/debug/dom/placeholder.feat.js +1 -1
  25. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  26. package/dist/debug/{dom-mQ5mPBTF.js → dom-CtXOr4Nm.js} +68 -31
  27. package/dist/debug/{dom-DjUZd-9y.mjs → dom-DaHYZpf2.mjs} +51 -26
  28. package/dist/debug/dom.js +4 -127
  29. package/dist/debug/dom.mjs +2 -119
  30. package/dist/debug/html/compat.feat.js +222 -0
  31. package/dist/debug/html/compat.feat.mjs +220 -0
  32. package/dist/debug/html-DMo6pc_h.mjs +3931 -0
  33. package/dist/debug/html-DfZjMkhx.js +4513 -0
  34. package/dist/debug/html.js +83 -4220
  35. package/dist/debug/html.mjs +1 -4133
  36. package/dist/dom/catch.feat.js +4 -4
  37. package/dist/dom/catch.feat.mjs +1 -1
  38. package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
  39. package/dist/dom/compat.feat.js +101 -0
  40. package/dist/dom/compat.feat.mjs +100 -0
  41. package/dist/dom/control-flow.d.ts +0 -1
  42. package/dist/dom/controllable-input.feat.js +2 -2
  43. package/dist/dom/controllable-input.feat.mjs +1 -1
  44. package/dist/dom/controllable-open.feat.js +2 -2
  45. package/dist/dom/controllable-open.feat.mjs +1 -1
  46. package/dist/dom/controllable-select.feat.js +2 -2
  47. package/dist/dom/controllable-select.feat.mjs +1 -1
  48. package/dist/dom/controllable-textarea.feat.js +2 -2
  49. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  50. package/dist/dom/controllable.feat.js +2 -2
  51. package/dist/dom/controllable.feat.mjs +1 -1
  52. package/dist/dom/dom.d.ts +2 -1
  53. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  54. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  55. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  56. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  57. package/dist/dom/lazy.feat.js +1 -1
  58. package/dist/dom/lazy.feat.mjs +1 -1
  59. package/dist/dom/placeholder.feat.js +3 -3
  60. package/dist/dom/placeholder.feat.mjs +1 -1
  61. package/dist/dom/resume.d.ts +3 -1
  62. package/dist/{dom-B8j2453O.js → dom-BB-Te-3z.js} +125 -130
  63. package/dist/{dom-HEWdZCCb.mjs → dom-BO-0hzLZ.mjs} +13 -18
  64. package/dist/dom.d.ts +0 -1
  65. package/dist/dom.js +21 -95
  66. package/dist/dom.mjs +3 -72
  67. package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
  68. package/dist/html/compat.feat.js +165 -0
  69. package/dist/html/compat.feat.mjs +164 -0
  70. package/dist/html/dynamic-tag.d.ts +1 -2
  71. package/dist/html/writer.d.ts +2 -1
  72. package/dist/html-DMDc0zKs.mjs +2404 -0
  73. package/dist/html-DrHsybFm.js +2880 -0
  74. package/dist/html.d.ts +0 -1
  75. package/dist/html.js +2 -2566
  76. package/dist/html.mjs +3 -2561
  77. package/dist/translator/index.js +297 -285
  78. package/dist/translator/util/assert.d.ts +2 -0
  79. package/dist/translator/util/branch-tag.d.ts +1 -1
  80. package/dist/translator/util/known-tag.d.ts +4 -1
  81. package/dist/translator/util/optional.d.ts +0 -1
  82. package/dist/translator/util/reasons.d.ts +0 -1
  83. package/dist/translator/util/references.d.ts +1 -0
  84. package/dist/translator/util/sections.d.ts +5 -1
  85. package/dist/translator/util/tag-facts.d.ts +2 -0
  86. package/dist/translator/util/translate-attrs.d.ts +1 -4
  87. package/dist/translator/visitors/program/index.d.ts +2 -2
  88. package/index.d.ts +2 -7
  89. package/package.json +4 -4
@@ -14,6 +14,8 @@ export declare function assertIdentifierVar(tag: t.NodePath<t.MarkoTag>): void;
14
14
  export declare function assertNoTagVarMutation(tag: t.NodePath<t.MarkoTag>): void;
15
15
  export declare function assertHasBody(tag: t.NodePath<t.MarkoTag>): void;
16
16
  export declare function assertNoBodyContent(tag: t.NodePath<t.MarkoTag>): void;
17
+ export declare function assertNoNativeAttrTags(tag: t.NodePath<t.MarkoTag>): void;
18
+ export declare function assertNotContentAttrTag(tag: t.NodePath<t.MarkoTag>): void;
17
19
  export declare function buildAttrsError(tag: t.NodePath<t.MarkoTag>, attrs: t.MarkoTag["attributes"], msg: string): Error;
18
20
  export declare function buildAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoTag["attributes"][number], msg: string): Error;
19
21
  export declare function buildAttrNameError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute, msg: string): Error;
@@ -7,7 +7,7 @@ export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Sectio
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;
10
- export declare function isSingleNodeContent(content: Section["content"] | undefined): boolean;
10
+ export declare function isSingleNodeContent(content: Section["content"]): boolean;
11
11
  export type ForType = "in" | "of" | "to" | "until";
12
12
  export declare function buildForRuntimeCall(type: ForType, attrs: Record<string, t.Expression>, params: t.ArrowFunctionExpression["params"], statements: t.Statement[]): t.ExpressionStatement;
13
13
  export declare function getForType(tag: t.MarkoTag): ForType | undefined;
@@ -8,6 +8,10 @@ declare const kParamsTree: unique symbol;
8
8
  declare const kKnownExprs: unique symbol;
9
9
  declare const kPassesInput: unique symbol;
10
10
  declare module "@marko/compiler/dist/types" {
11
+ interface MarkoSpreadAttributeExtra {
12
+ /** The binding it spreads, which its known child reads prop by prop. */
13
+ knownSpread?: Binding;
14
+ }
11
15
  interface MarkoTagExtra {
12
16
  /** The dom binding a known tag holds its child's scope in. */
13
17
  childScopeBinding?: Binding;
@@ -34,7 +38,6 @@ export declare function addKnownTagReasons(section: Section): void;
34
38
  export declare function callsOtherTemplateSetup(section: Section): boolean;
35
39
  type TranslateDOMInfo = {
36
40
  tagSection: Section;
37
- knownExprs: KnownExprs;
38
41
  getBindingIdentifier: (binding: Binding, preferredName?: string, directContent?: boolean) => t.Identifier;
39
42
  childScopeBinding: Binding;
40
43
  };
@@ -38,7 +38,6 @@ export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item
38
38
  export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
39
39
  export declare function reduceWhile<T, R>(data: Opt<T>, cb: (acc: R, item: T) => R | undefined, initial: R): R | undefined;
40
40
  export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
41
- export declare function toSet<T>(data: Opt<T>): Set<T>;
42
41
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
43
42
  export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
44
43
  export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
@@ -28,7 +28,6 @@ export interface KnownExprs {
28
28
  export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: Opt<ParamBinding>): Opt<t.NodeExtra>;
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
- export declare function getKnownExprsAt(exprs: KnownExprs, binding: Binding): KnownExprs;
32
31
  export declare function applyReasonExprs(section: Section): void;
33
32
  export declare function mergeSlotReasons(section: Section): void;
34
33
  export declare function getNodeReasons(section: Section): Reasons | undefined;
@@ -145,6 +145,7 @@ export interface AssignedBindingExtra extends ReferencedExtra {
145
145
  /** The outermost function holding it; none when that escapes into a call. */
146
146
  fnRoot: ReferencedFunctionExtra | undefined;
147
147
  }
148
+ export declare function hasResumableWriter(source: Binding): boolean;
148
149
  export declare function hasResumableAssignment(binding: Binding): boolean;
149
150
  export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined): extra is AssignedBindingExtra;
150
151
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
@@ -114,7 +114,9 @@ export interface Section {
114
114
  kind: "for" | "await" | "try";
115
115
  tag: ControlFlowTagExtra;
116
116
  } | undefined;
117
- content: null | {
117
+ /** What renders at its edges, `null` for nothing; set once its body is
118
+ * analyzed (`settleContent`). */
119
+ content: undefined | null | {
118
120
  startType: ContentType;
119
121
  endType: ContentType;
120
122
  singleChild: boolean;
@@ -156,6 +158,7 @@ export declare function forEachSection(fn: (section: Section) => void): void;
156
158
  export declare function getDynamicTagContentClosures(section: Section): import("./optional").SortedOpt<Binding>;
157
159
  export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
158
160
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
161
+ export declare function settleContent(body: t.NodePath<t.Program | t.MarkoTagBody>): void;
159
162
  export declare function getContentInfo(path: t.NodePath<t.Program | t.MarkoTagBody>): Section["content"];
160
163
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge: "startType" | "endType"): ContentType.Value | null;
161
164
  export declare function isKnownChild(section: Section): boolean;
@@ -175,6 +178,7 @@ export declare function isSameOrAncestorSection(section: Section, other: Section
175
178
  export declare function getCommonSection(section: Section, other: Section): Section;
176
179
  export declare function ensureSectionReasonGroups(section: Section): void;
177
180
  export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
181
+ export declare function findParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
178
182
  export declare function forEachParamGroup(params: Sources["param"], fn: (section: Section, group: ParamReasonGroup) => void): void;
179
183
  export declare function reduceParamGroups<R>(params: Sources["param"], fn: (acc: R, section: Section, group: ParamReasonGroup) => R, initial: R): R;
180
184
  export declare function setReadsOwner(from: Section, to: Section): void;
@@ -16,6 +16,8 @@ export interface TagFacts {
16
16
  /** Its insertion mode drops an unknown element but keeps its children, so a
17
17
  * wrapper around content inside it is discarded. */
18
18
  discardsWrapperChildren?: true;
19
+ /** Its `content` attribute is an html attribute, not content it renders. */
20
+ htmlContentAttr?: true;
19
21
  }
20
22
  export declare const controllableElements: Map<string, {
21
23
  attrs: string[];
@@ -1,10 +1,8 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding } from "./bindings";
3
2
  import { type AttrTagMeta, type AttrTagLookup } from "./nested-attribute-tags";
4
- import { type SortedOpt } from "./optional";
5
3
  import { type ParamsTree } from "./params-tree";
6
4
  type ContentKey = "renderBody" | "content";
7
- export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, skip?: SortedOpt<string>, statements?: t.Statement[], contentKey?: ContentKey): {
5
+ export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, statements?: t.Statement[], contentKey?: ContentKey): {
8
6
  properties: (t.ObjectMethod | t.ObjectProperty | t.SpreadElement)[];
9
7
  statements: t.Statement[];
10
8
  };
@@ -17,5 +15,4 @@ export declare function appendAttrTag(prev: t.Expression | undefined | false, pr
17
15
  /** Unwraps a lone spread to the spread argument itself, so the result may alias
18
16
  * a caller binding; anything the runtime writes to needs its own object. */
19
17
  export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression;
20
- export declare function getSingleKnownSpread(paramsTree: ParamsTree | true, attributes: (t.MarkoAttribute | t.MarkoSpreadAttribute)[]): Binding | undefined;
21
18
  export {};
@@ -18,8 +18,8 @@ declare module "@marko/compiler/dist/types" {
18
18
  /** The signal of each of the template's param bindings, a property of
19
19
  * one included. */
20
20
  params: Map<Binding, string>;
21
- /** The `_dynamic_tag_content` signal of each binding only a name-only
22
- * dynamic tag reads. */
21
+ /** The `_dynamic_tag_content` signal of each binding read only as the
22
+ * whole name of a name-only dynamic tag. */
23
23
  directContent: Map<Binding, string>;
24
24
  };
25
25
  styleFile?: string;
package/index.d.ts CHANGED
@@ -137,9 +137,7 @@ declare global {
137
137
  ? Name extends keyof NativeTags
138
138
  ? NativeTags[Name]["input"]
139
139
  : Record<string, unknown>
140
- : Name extends
141
- | Template<infer Input, any>
142
- | { _(): () => (input: infer Input) => any }
140
+ : Name extends Template<infer Input, any>
143
141
  ? Input
144
142
  : Name extends Body<infer Args, any>
145
143
  ? Args extends {
@@ -159,10 +157,7 @@ declare global {
159
157
  ? Name extends keyof NativeTags
160
158
  ? NativeTags[Name]["return"]
161
159
  : () => Element
162
- : Name extends
163
- | { _(): () => (input: any) => { return: infer Return } }
164
- | Template<any, infer Return>
165
- | Body<any, infer Return>
160
+ : Name extends Template<any, infer Return> | Body<any, infer Return>
166
161
  ? Return
167
162
  : never;
168
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.11",
3
+ "version": "6.4.12",
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.17",
54
+ "@marko/compiler": "^5.42.18",
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.4.11",
61
- "marko": "5.39.50"
60
+ "@marko/runtime-tags": "npm:marko@6.4.12",
61
+ "marko": "5.39.51"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22.12.0"