marko 6.4.5 → 6.4.7

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 (145) hide show
  1. package/cheatsheet.md +2 -1
  2. package/dist/common/errors.d.ts +3 -1
  3. package/dist/common/helpers.d.ts +7 -7
  4. package/dist/debug/dom/catch.feat.js +4 -4
  5. package/dist/debug/dom/catch.feat.mjs +4 -4
  6. package/dist/debug/dom/controllable-input.feat.js +1 -1
  7. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-open.feat.js +1 -1
  9. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-select.feat.js +1 -1
  11. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable.feat.js +5 -5
  15. package/dist/debug/dom/controllable.feat.mjs +5 -5
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
  20. package/dist/debug/dom/lazy.feat.js +1 -1
  21. package/dist/debug/dom/lazy.feat.mjs +1 -1
  22. package/dist/debug/dom/placeholder.feat.js +1 -1
  23. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  24. package/dist/debug/{dom-BeY1nGUb.mjs → dom-CFCBDift.mjs} +133 -135
  25. package/dist/debug/{dom-CUxvM4i9.js → dom-D8znnhpf.js} +148 -150
  26. package/dist/debug/dom.js +21 -22
  27. package/dist/debug/dom.mjs +22 -22
  28. package/dist/debug/html.js +736 -664
  29. package/dist/debug/html.mjs +736 -665
  30. package/dist/dom/catch.feat.js +5 -5
  31. package/dist/dom/catch.feat.mjs +4 -4
  32. package/dist/dom/control-flow.d.ts +3 -3
  33. package/dist/dom/controllable-input.feat.js +2 -2
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +2 -2
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +2 -2
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +2 -2
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.d.ts +4 -4
  42. package/dist/dom/controllable.feat.js +2 -2
  43. package/dist/dom/controllable.feat.mjs +2 -2
  44. package/dist/dom/dom.d.ts +5 -5
  45. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  46. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  47. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  48. package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
  49. package/dist/dom/lazy.feat.js +1 -1
  50. package/dist/dom/lazy.feat.mjs +1 -1
  51. package/dist/dom/placeholder.feat.js +2 -2
  52. package/dist/dom/placeholder.feat.mjs +1 -1
  53. package/dist/dom/renderer.d.ts +1 -3
  54. package/dist/dom/resume.d.ts +2 -3
  55. package/dist/dom/signals.d.ts +6 -8
  56. package/dist/{dom-Diu8MpmL.js → dom-Bpkm72vV.js} +157 -166
  57. package/dist/{dom-DefWmvQB.mjs → dom-CVAevsbz.mjs} +103 -107
  58. package/dist/dom.d.ts +1 -1
  59. package/dist/dom.js +37 -37
  60. package/dist/dom.mjs +22 -22
  61. package/dist/html/assets.d.ts +2 -2
  62. package/dist/html/compat.d.ts +2 -1
  63. package/dist/html/control-flow.d.ts +20 -0
  64. package/dist/html/inlined-runtimes.d.ts +2 -2
  65. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  66. package/dist/html/serializer.d.ts +63 -16
  67. package/dist/html/template.d.ts +1 -1
  68. package/dist/html/writer.d.ts +47 -35
  69. package/dist/html.d.ts +3 -2
  70. package/dist/html.js +531 -484
  71. package/dist/html.mjs +531 -484
  72. package/dist/translator/core/for.d.ts +0 -4
  73. package/dist/translator/core/return.d.ts +0 -3
  74. package/dist/translator/core/style.d.ts +2 -2
  75. package/dist/translator/index.js +8093 -8021
  76. package/dist/translator/util/analyze-errors.d.ts +2 -1
  77. package/dist/translator/util/assert.d.ts +15 -1
  78. package/dist/translator/util/bindings.d.ts +24 -12
  79. package/dist/translator/util/body-to-text.d.ts +9 -0
  80. package/dist/translator/util/branch-tag.d.ts +10 -3
  81. package/dist/translator/util/build-string-expression.d.ts +4 -0
  82. package/dist/translator/util/content-derives.d.ts +7 -0
  83. package/dist/translator/util/cyclic-memo.d.ts +6 -2
  84. package/dist/translator/util/entry-builder.d.ts +6 -3
  85. package/dist/translator/util/finalize-references.d.ts +6 -3
  86. package/dist/translator/util/for-selector.d.ts +1 -1
  87. package/dist/translator/util/generate-uid.d.ts +4 -2
  88. package/dist/translator/util/get-root.d.ts +3 -3
  89. package/dist/translator/util/get-tag-name.d.ts +1 -1
  90. package/dist/translator/util/known-tag.d.ts +14 -9
  91. package/dist/translator/util/module-read.d.ts +0 -3
  92. package/dist/translator/util/module-registrations.d.ts +44 -0
  93. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  94. package/dist/translator/util/optional.d.ts +7 -2
  95. package/dist/translator/util/params-tree.d.ts +18 -0
  96. package/dist/translator/util/reasons.d.ts +13 -8
  97. package/dist/translator/util/references.d.ts +23 -27
  98. package/dist/translator/util/runtime.d.ts +0 -12
  99. package/dist/translator/util/scope-accessor.d.ts +0 -1
  100. package/dist/translator/util/scope-read.d.ts +3 -0
  101. package/dist/translator/util/section-renderer.d.ts +4 -0
  102. package/dist/translator/util/sections.d.ts +21 -21
  103. package/dist/translator/util/setup-work.d.ts +2 -1
  104. package/dist/translator/util/signals.d.ts +16 -14
  105. package/dist/translator/util/simplify-fn.d.ts +1 -0
  106. package/dist/translator/util/slots.d.ts +4 -4
  107. package/dist/translator/util/solve-reasons.d.ts +1 -3
  108. package/dist/translator/util/sources.d.ts +2 -1
  109. package/dist/translator/util/state.d.ts +4 -2
  110. package/dist/translator/util/statement-tag.d.ts +2 -0
  111. package/dist/translator/util/static-text.d.ts +2 -1
  112. package/dist/translator/util/structure.d.ts +0 -10
  113. package/dist/translator/util/tag-facts.d.ts +8 -1
  114. package/dist/translator/util/tag-import.d.ts +20 -0
  115. package/dist/translator/util/tag-name-type.d.ts +9 -2
  116. package/dist/translator/util/to-only-or-block.d.ts +3 -0
  117. package/dist/translator/util/to-property-name.d.ts +2 -0
  118. package/dist/translator/util/translate-attrs.d.ts +7 -5
  119. package/dist/translator/util/translate-var.d.ts +2 -0
  120. package/dist/translator/util/traverse.d.ts +1 -2
  121. package/dist/translator/util/visitors.d.ts +4 -1
  122. package/dist/translator/util/with-previous-location.d.ts +1 -1
  123. package/dist/translator/util/write-guard.d.ts +2 -2
  124. package/dist/translator/util/writer.d.ts +1 -2
  125. package/dist/translator/visitors/export-declaration.d.ts +2 -3
  126. package/dist/translator/visitors/function.d.ts +0 -35
  127. package/dist/translator/visitors/import-declaration.d.ts +1 -15
  128. package/dist/translator/visitors/placeholder.d.ts +2 -1
  129. package/dist/translator/visitors/program/html.d.ts +0 -1
  130. package/dist/translator/visitors/program/index.d.ts +4 -5
  131. package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
  132. package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
  133. package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
  134. package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
  135. package/package.json +4 -4
  136. package/dist/translator/util/binding-has-prop.d.ts +0 -8
  137. package/dist/translator/util/binding-prop-tree.d.ts +0 -18
  138. package/dist/translator/util/body-to-text-literal.d.ts +0 -9
  139. package/dist/translator/util/import-reference.d.ts +0 -3
  140. package/dist/translator/util/normalize-string-expression.d.ts +0 -4
  141. package/dist/translator/util/plugin-hooks.d.ts +0 -4
  142. package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
  143. package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
  144. package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
  145. package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
@@ -1,9 +1,7 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type BindingPropTree } from "../../util/binding-prop-tree";
3
2
  import { type Binding } from "../../util/bindings";
3
+ import { type ParamsTree } from "../../util/params-tree";
4
4
  import { preAnalyze } from "./pre-analyze";
5
- export declare let scopeIdentifier: t.Identifier;
6
- export declare let localsIdentifier: t.Identifier;
7
5
  declare module "@marko/compiler/dist/types" {
8
6
  interface ProgramExtra {
9
7
  /** Client code reads something of its own after resume (a section, or a
@@ -11,7 +9,7 @@ declare module "@marko/compiler/dist/types" {
11
9
  hasResumes?: boolean;
12
10
  /** What the template reads of its params (its input is the first), the
13
11
  * contract its callers keep. */
14
- paramsTree?: BindingPropTree;
12
+ paramsTree?: ParamsTree;
15
13
  /** The names every compile of the template exports its parts under. */
16
14
  exportNames?: {
17
15
  template: string;
@@ -20,7 +18,8 @@ declare module "@marko/compiler/dist/types" {
20
18
  /** The signal of each of the template's param bindings, a property of
21
19
  * one included. */
22
20
  params: Map<Binding, string>;
23
- /** Each content passthrough's `_dynamic_tag_content` signal. */
21
+ /** The `_dynamic_tag_content` signal of each binding only a name-only
22
+ * dynamic tag reads. */
24
23
  directContent: Map<Binding, string>;
25
24
  };
26
25
  styleFile?: string;
@@ -6,3 +6,5 @@ declare module "@marko/compiler/dist/types" {
6
6
  }
7
7
  }
8
8
  export declare function preAnalyze(program: t.NodePath<t.Program>): void;
9
+ /** A `<const>` tag declaring `id` as `expr`. */
10
+ export declare function toConstTag(id: t.LVal, expr: t.Expression): t.MarkoTag;
@@ -1,11 +1,4 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding } from "../../util/bindings";
3
- declare const kLoadTagBinding: unique symbol;
4
- declare module "@marko/compiler/dist/types" {
5
- interface MarkoTagExtra {
6
- [kLoadTagBinding]?: Binding;
7
- }
8
- }
9
2
  declare const _default: {
10
3
  analyze: {
11
4
  enter(this: unknown, tag: t.NodePath<t.MarkoTag>): void;
@@ -16,10 +9,3 @@ declare const _default: {
16
9
  };
17
10
  };
18
11
  export default _default;
19
- export declare function getTagRelativePath(tag: t.NodePath<t.MarkoTag>): string;
20
- /**
21
- * A known wrong tag that resolves to nothing, eg `interface P { id: number }`,
22
- * whose body lands in attribute position before tag resolution would run.
23
- */
24
- export declare function isUnresolvedKnownWrongTag(tag: t.NodePath<t.MarkoTag>): boolean;
25
- export declare function tagNotFoundError(tag: t.NodePath<t.MarkoTag>): Error;
@@ -1,6 +1,7 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Section } from "../../util/sections";
3
3
  import * as ClassHydration from "./constants/class-hydration";
4
+ export declare const needsCompat: () => boolean, setNeedsCompat: (value: boolean) => void;
4
5
  type ClassHydration = ClassHydration.Value;
5
6
  declare module "@marko/compiler" {
6
7
  interface MarkoMeta {
@@ -1,5 +1,4 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type DOMRuntimeFeature } from "../../util/runtime";
3
2
  import { type StructureNode } from "../../util/sections";
4
3
  declare const kNodeOp: unique symbol;
5
4
  declare const kNativeAttrs: unique symbol;
@@ -20,12 +19,12 @@ interface NativeAttrs {
20
19
  controllable: Controllable | undefined;
21
20
  /** Attributes written as one object with the spreads, in write order. */
22
21
  spread: number[] | undefined;
23
- /** No attribute sets the nonce the page requires of it. */
24
- nonceUnset: boolean;
22
+ /** Writes the page's nonce on a `<script>` or `<style>` that sets none itself. */
23
+ injectsNonce: boolean;
25
24
  }
26
25
  interface Controllable {
27
26
  state: "checked" | "checkedValue" | "value" | "open";
28
- special: boolean;
27
+ stateIsAttr: boolean;
29
28
  valueMode?: "attribute" | "dynamic";
30
29
  attrs: (number | undefined)[];
31
30
  }
@@ -40,11 +39,3 @@ declare const _default: {
40
39
  };
41
40
  };
42
41
  export default _default;
43
- /** How a spread claims its controlled attrs during render; nothing for the many
44
- * tags that control nothing, and nothing when a static attr owns the
45
- * controllable, since then the spread must leave the slots it wrote alone. */
46
- export declare function controllableClaimFor(tagName: string | undefined): "_controllable_input" | "_controllable_open" | "_controllable_select" | "_controllable_textarea" | undefined;
47
- /** The resume-pass feature for a tag: `_attrs_script` resolves the control
48
- * kind at run time, and a run-time tag name can be any of them. */
49
- export declare function controllableFeatureFor(tagName: string | undefined): "controllable" | "controllable-input" | "controllable-open" | "controllable-select" | "controllable-textarea" | undefined;
50
- export declare function enableControllable(feature: DOMRuntimeFeature | undefined): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.5",
3
+ "version": "6.4.7",
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.11",
54
+ "@marko/compiler": "^5.42.13",
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.4.5",
61
- "marko": "5.39.46"
60
+ "@marko/runtime-tags": "npm:marko@6.4.7",
61
+ "marko": "5.39.47"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"
@@ -1,8 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- import { type Binding } from "./bindings";
3
- import { type Opt } from "./optional";
4
- import type { Section } from "./sections";
5
- export declare function getSectionRendererIdentifier(section: Section): t.Identifier | undefined;
6
- export declare function isSectionRendererElided(section: Section): boolean;
7
- export declare function bindingHasProperty(binding: Binding, properties: Opt<string>): boolean;
8
- export declare function getPropertyPathAlias(binding: Binding, properties: Opt<string>): Binding;
@@ -1,18 +0,0 @@
1
- import { type Binding } from "./bindings";
2
- export type BindingPropTree = {
3
- binding: Binding;
4
- props: {
5
- [prop: string]: BindingPropTree;
6
- } | undefined;
7
- rest: BindingPropTree | undefined;
8
- };
9
- declare module "@marko/compiler/dist/types" {
10
- interface NodeExtra {
11
- directContent?: true;
12
- }
13
- }
14
- export declare function getBindingPropTree(binding: Binding, bodyAnalyzed?: boolean): BindingPropTree;
15
- export declare function getSettledPropTree(propTree: BindingPropTree | undefined): BindingPropTree | undefined;
16
- export declare function getKnownFromPropTree(propTree: BindingPropTree | true, name: string): BindingPropTree | true | undefined;
17
- export declare function getAllKnownPropNames(propTree: BindingPropTree): string[];
18
- export declare function hasAllKnownProps(propTree: BindingPropTree): boolean | undefined;
@@ -1,9 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- declare module "@marko/compiler/dist/types" {
3
- interface MarkoPlaceholderExtra {
4
- rawText?: true;
5
- }
6
- }
7
- 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;
8
- 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;
9
- export declare function injectTextCoercion(expr: t.Expression): void;
@@ -1,3 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- export declare function importOrSelfReferenceName(file: t.BabelFile, request: string, name: string, nameHint?: string): t.Identifier;
3
- export declare function isCircularRequest(file: t.BabelFile, request: string): boolean;
@@ -1,4 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- export default function normalizeStringExpression(parts: (string | t.Expression)[], useIife?: boolean): t.Expression | undefined;
3
- export declare function appendLiteral(arr: unknown[], str: string): void;
4
- export declare function escapeTemplateRaw(raw: string): string;
@@ -1,4 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- import type { Plugin } from "@marko/compiler/babel-utils";
3
- export declare function enter<T extends t.Node>(modulePlugin: Plugin | void, path: t.NodePath<T>): boolean;
4
- export declare function exit<T extends t.Node>(modulePlugin: Plugin | void, path: t.NodePath<T>): boolean;
@@ -1,2 +0,0 @@
1
- import type { types as t } from "@marko/compiler";
2
- export declare function resolveRelativeToEntry(entryFile: t.BabelFile, file: t.BabelFile, req: string): string;
@@ -1,7 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- import { type Binding } from "./bindings";
3
- import { type Opt } from "./optional";
4
- import { type KnownExprs } from "./references";
5
- import { type Section } from "./sections";
6
- export declare function setTagDerivedFrom(tag: t.NodePath<t.MarkoTag>, binding: Opt<Binding>, exprs?: KnownExprs): void;
7
- export declare function finalizeTagDerivations(section: Section): void;
@@ -1,2 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- export declare function toFirstExpressionOrBlock(stmts: t.Statement[]): t.BlockStatement | t.Expression;
@@ -1,2 +0,0 @@
1
- import { types as t } from "@marko/compiler";
2
- export default function toFirstStatementOrBlock(body: t.BlockStatement | t.Statement[]): t.Statement;