marko 6.0.162 → 6.0.164

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 (38) hide show
  1. package/dist/common/helpers.d.ts +0 -1
  2. package/dist/common/types.d.ts +0 -1
  3. package/dist/debug/dom.js +1 -1
  4. package/dist/debug/dom.mjs +1 -1
  5. package/dist/debug/html.js +9 -2
  6. package/dist/debug/html.mjs +8 -2
  7. package/dist/dom/dom.d.ts +0 -3
  8. package/dist/dom.js +1 -1
  9. package/dist/dom.mjs +1 -1
  10. package/dist/html/attrs.d.ts +0 -2
  11. package/dist/html/content.d.ts +1 -0
  12. package/dist/html/for.d.ts +4 -3
  13. package/dist/html/template.d.ts +0 -1
  14. package/dist/html/writer.d.ts +0 -2
  15. package/dist/html.d.ts +1 -1
  16. package/dist/html.js +8 -2
  17. package/dist/html.mjs +7 -2
  18. package/dist/translator/core/for.d.ts +2 -57
  19. package/dist/translator/core/if.d.ts +70 -27
  20. package/dist/translator/core/index.d.ts +70 -84
  21. package/dist/translator/index.d.ts +70 -84
  22. package/dist/translator/index.js +250 -248
  23. package/dist/translator/util/generate-uid.d.ts +0 -1
  24. package/dist/translator/util/get-compile-stage.d.ts +0 -8
  25. package/dist/translator/util/get-root.d.ts +2 -2
  26. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  27. package/dist/translator/util/references.d.ts +0 -2
  28. package/dist/translator/util/resolve-relative-to-entry.d.ts +2 -0
  29. package/dist/translator/util/runtime.d.ts +2 -1
  30. package/dist/translator/util/scope-read.d.ts +1 -2
  31. package/dist/translator/util/sections.d.ts +0 -1
  32. package/dist/translator/util/serialize-reasons.d.ts +0 -3
  33. package/dist/translator/util/signals.d.ts +0 -2
  34. package/dist/translator/util/state.d.ts +1 -1
  35. package/dist/translator/visitors/program/index.d.ts +0 -11
  36. package/dist/translator/visitors/program/pre-analyze.d.ts +0 -1
  37. package/package.json +1 -1
  38. /package/dist/translator/util/{get-defined-binding-expression.d.ts → get-declared-binding-expression.d.ts} +0 -0
@@ -4,4 +4,3 @@ export declare function generateUid(name?: string): string;
4
4
  export declare function generateUidIdentifier(name?: string): t.Identifier;
5
5
  export declare function getSharedUid(name: string, section?: Section): string;
6
6
  export declare function usedSharedUid(name: string): boolean;
7
- export declare function getSharedUidIdentifier(name: string): t.Identifier;
@@ -1,9 +1 @@
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
1
  export declare function isTranslate(): boolean;
@@ -2,7 +2,7 @@ import type { types as t } from "@marko/compiler";
2
2
  export type MarkoExprRootPath = t.NodePath<t.MarkoTag | t.MarkoTagBody | t.MarkoAttribute | t.MarkoSpreadAttribute | t.MarkoScriptlet | t.MarkoPlaceholder | t.ExportNamedDeclaration | t.ExportDefaultDeclaration>;
3
3
  export declare function getMarkoRoot(path: t.NodePath<t.Node>): MarkoExprRootPath | null;
4
4
  export declare function getExprRoot(path: t.NodePath<t.Node>): t.NodePath<t.Node>;
5
- export declare function getFnRoot(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionExpression | t.ObjectMember> | undefined;
6
- export declare function getFnParent(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionExpression | t.ObjectMember> | undefined;
5
+ export declare function getFnRoot(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionDeclaration | t.FunctionExpression | t.ObjectMember> | undefined;
6
+ export declare function getFnParent(path: t.NodePath<t.Node>): t.NodePath<t.ArrowFunctionExpression | t.FunctionDeclaration | t.FunctionExpression | t.ObjectMember> | undefined;
7
7
  export declare function getDeclarationRoot(path: t.NodePath<t.Node>): t.NodePath<t.FunctionDeclaration | t.VariableDeclaration> | undefined;
8
8
  export declare function isMarko(path: t.NodePath<any>): path is MarkoExprRootPath;
@@ -6,7 +6,6 @@ export interface AttrTagMeta {
6
6
  group: AttrTagNames;
7
7
  }
8
8
  export type AttrTagLookup = Record<string, AttrTagMeta>;
9
- export type AttrTagGroup = AttrTagLookup[string]["group"];
10
9
  type AttrTagNames = string[];
11
10
  declare module "@marko/compiler/dist/types" {
12
11
  interface MarkoTagExtra {
@@ -15,5 +14,6 @@ declare module "@marko/compiler/dist/types" {
15
14
  }
16
15
  }
17
16
  export declare function getAttrTagIdentifier(meta: AttrTagLookup[string]): t.Identifier;
17
+ export declare function getAttrTagPaths(tag: t.NodePath<t.MarkoTag>): ReturnType<typeof tag.get<"attributeTags">>;
18
18
  export declare function analyzeAttributeTags(tag: t.NodePath<t.MarkoTag>): AttrTagLookup | undefined;
19
19
  export {};
@@ -138,7 +138,6 @@ export declare function getDebugScopeAccess(binding: Binding): {
138
138
  export declare function getDebugName(binding: Binding): string;
139
139
  export declare function getDebugNames(refs: ReferencedBindings): string;
140
140
  export declare function getDebugNamesAsIdentifier(refs: ReferencedBindings): string;
141
- export declare function getDebugNameAsIdentifier(binding: Binding): string;
142
141
  export declare function getSectionInstancesAccessor(section: Section): string;
143
142
  export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral | t.NumericLiteral | undefined;
144
143
  export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression, signal?: Signal): t.Expression | undefined;
@@ -146,7 +145,6 @@ export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
146
145
  export declare function pruneBinding(binding: Binding): boolean;
147
146
  export declare function createRead(binding: Binding, props: Opt<string>, ownVar?: boolean): ExtraRead;
148
147
  export declare function createGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ExtraRead;
149
- export declare function getObjectPropertyKeyString(expr: t.ObjectProperty | t.ObjectMethod): string | undefined;
150
148
  export interface ReferencedExtra extends t.NodeExtra {
151
149
  section: Section;
152
150
  }
@@ -0,0 +1,2 @@
1
+ import type { types as t } from "@marko/compiler";
2
+ export declare function resolveRelativeToEntry(entryFile: t.BabelFile, file: t.BabelFile, req: string): string;
@@ -1,12 +1,13 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import type { Falsy } from "../../common/types";
3
- import { _attr, _attr_class, _attr_style, _escape, _escape_script, _escape_style, _unescaped } from "../../html";
3
+ import { _attr, _attr_class, _attr_style, _escape, _escape_comment, _escape_script, _escape_style, _unescaped } from "../../html";
4
4
  export type DOMRuntimeHelpers = keyof typeof import("../../dom");
5
5
  export type HTMLRuntimeHelpers = keyof typeof import("../../html");
6
6
  export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.MemberExpression;
7
7
  export declare function callRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers, ...args: Array<Parameters<typeof t.callExpression>[1][number] | Falsy>): t.CallExpression;
8
8
  export declare function getHTMLRuntime(): {
9
9
  _escape: typeof _escape;
10
+ _escape_comment: typeof _escape_comment;
10
11
  _unescaped: typeof _unescaped;
11
12
  _attr: typeof _attr;
12
13
  _attr_class: typeof _attr_class;
@@ -1,6 +1,5 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding, type ReferencedBindings } from "./references";
2
+ import { type Binding } from "./references";
3
3
  import type { Section } from "./sections";
4
- export declare function createScopeReadPattern(section: Section, referencedBindings: ReferencedBindings): t.ObjectPattern;
5
4
  export declare function getScopeExpression(section: Section, targetSection: Section): t.Identifier | t.MemberExpression;
6
5
  export declare function createScopeReadExpression(reference: Binding, section?: Section): t.MemberExpression;
@@ -72,7 +72,6 @@ export declare function getSection(path: t.NodePath): Section;
72
72
  export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
73
73
  export declare const getSectionParentIsOwner: (section: Section) => boolean, setSectionParentIsOwner: (section: Section, value: boolean) => void;
74
74
  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;
75
- export declare const getScopeIdentifier: (section: Section, ignoreDefault?: boolean) => t.Identifier;
76
75
  export declare function forEachSection(fn: (section: Section) => void): void;
77
76
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
78
77
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType | null;
@@ -5,9 +5,6 @@ import { type Binding, type InputBinding, type ParamBinding, type ReferencedBind
5
5
  import type { Section } from "./sections";
6
6
  export type SerializeReasons = true | [Sources, ...Sources[]];
7
7
  export type SerializeReason = true | Sources;
8
- export type SerializeKey = symbol & {
9
- __serialize_key__: 1;
10
- };
11
8
  export declare function isSameReason(a: SerializeReason | undefined, b: SerializeReason | undefined): boolean;
12
9
  export declare function isForceSerialized(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): boolean;
13
10
  export declare function addSerializeReason(section: Section, reason: undefined | false | SerializeReason, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
@@ -39,12 +39,10 @@ export declare function initValue(binding: Binding, isLet?: boolean): Signal;
39
39
  export declare function signalHasStatements(signal: Signal): boolean;
40
40
  export declare function getSignalFn(signal: Signal): t.Expression;
41
41
  export declare function getSignalValueIdentifier(signal: Signal): t.Identifier;
42
- export declare function subscribe(references: ReferencedBindings, subscriber: Signal): void;
43
42
  export declare function replaceNullishAndEmptyFunctionsWith0(args: (t.Expression | undefined | false)[]): t.Expression[];
44
43
  export declare function addStatement(type: "render" | "effect", targetSection: Section, referencedBindings: ReferencedBindings, statement: t.Statement | t.Statement[], usedReferences?: ReferencedBindings[] | false, isPure?: boolean): void;
45
44
  export declare function addValue(targetSection: Section, referencedBindings: ReferencedBindings, signal: Signal, value: t.Expression): void;
46
45
  export declare function getResumeRegisterId(section: Section, referencedBindings: string | ReferencedBindings, type?: string): string;
47
- export declare function getRegisterUID(section: Section, name: string): string;
48
46
  export declare function writeSignals(section: Section): Set<Signal>;
49
47
  export declare function writeRegisteredFns(): void;
50
48
  export declare function addHTMLEffectCall(section: Section, referencedBindings?: ReferencedBindings): void;
@@ -1,3 +1,3 @@
1
1
  import type { Section } from "./sections";
2
- export declare const createProgramState: <T>(init: () => T) => readonly [() => T, (value: T) => void];
2
+ export declare function createProgramState<T>(init: () => T): readonly [() => T, (value: T) => void];
3
3
  export declare function createSectionState<T = unknown>(key: string, init?: ((section: Section) => T) | (() => T)): readonly [(section: Section) => T, (section: Section, value: T) => void];
@@ -1,19 +1,8 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type BindingPropTree } from "../../util/binding-prop-tree";
3
- import { type Sources } from "../../util/references";
4
3
  import { preAnalyze } from "./pre-analyze";
5
- export type ParamSerializeReason = NonNullable<Sources["param"]>;
6
- export interface ParamSerializeReasonGroup {
7
- id: symbol;
8
- reason: ParamSerializeReason;
9
- }
10
- export type ParamSerializeReasonGroups = [
11
- ParamSerializeReasonGroup,
12
- ...ParamSerializeReasonGroup[]
13
- ];
14
4
  export declare let scopeIdentifier: t.Identifier;
15
5
  export declare function isScopeIdentifier(node: t.Node): node is t.Identifier;
16
- export type TemplateExports = BindingPropTree["props"];
17
6
  declare module "@marko/compiler/dist/types" {
18
7
  interface ProgramExtra {
19
8
  domExports?: {
@@ -1,3 +1,2 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  export declare function preAnalyze(program: t.NodePath<t.Program>): void;
3
- export declare function getAssignmentInsertions(node: t.Node, insertions?: t.MarkoTag[] | undefined): t.MarkoTag[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.162",
3
+ "version": "6.0.164",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",