Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/language-tools-parse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/language-tools": major
---

The parser now lives in (and is re-exported from) the new `@marko/parse` package. Breaking changes for consumers of the parser API: `NodeType` values are now strings rather than numbers, `program.body` now includes comment and static statement nodes in document order (`Node.ChildNode` includes `Comment`, and `program.body` is typed as `Node.RootBodyNode[]`), `Comment` nodes carry a `commentType`, and `Static` nodes carry `target`/`name`. Additions: `parse` accepts an options argument with a `getTagType` hook, the parse result exposes `errors` and a flat `comments` list, and the full `htmljs-parser` surface is re-exported.
5 changes: 5 additions & 0 deletions .changeset/parse-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/parse": major
---

New package: the Marko CST parser previously embedded in `@marko/language-tools`, extracted so it can be shared by other tooling. Node types are strings, syntax errors and comments are exposed on the parse result, comments and static statements are part of `program.body`, and a `getTagType` option allows overriding how tag bodies parse.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export { type Component };
};
})(),
});
// ^?
return Marko._.voidReturn;
},
[Symbol.iterator]: Marko._.any,
Expand All @@ -48,25 +49,23 @@ export { type Component };
Marko._.attrTagNames(__marko_internal_tag_2, (input) => {
input["@menuitem"];
});
Marko._.renderTemplate(__marko_internal_tag_2)()()(
// ^?
{
["menuitem"]: {
[Marko._.contentFor(__marko_internal_tag_2)]: ({ foo }) => {
Marko._.renderNativeTag("div")()()({
[Marko._.content]: (() => {
foo;
return () => {
return Marko._.voidReturn;
};
})(),
});
return Marko._.voidReturn;
},
[Symbol.iterator]: Marko._.any,
Marko._.renderTemplate(__marko_internal_tag_2)()()({
["menuitem"]: {
[Marko._.contentFor(__marko_internal_tag_2)]: ({ foo }) => {
Marko._.renderNativeTag("div")()()({
[Marko._.content]: (() => {
foo;
return () => {
return Marko._.voidReturn;
};
})(),
});
// ^?
return Marko._.voidReturn;
},
[Symbol.iterator]: Marko._.any,
},
);
});
Marko._.noop({ component, state, out, input, $global, $signal });
return;
})();
Expand Down Expand Up @@ -107,4 +106,3 @@ export default new (class Template extends Marko._.Template<{
Marko._.Relate<__marko_internal_input, Marko.Directives & Input>,
) => Marko._.ReturnWithScope<__marko_internal_input, void>;
}> {})();
// ^?
Loading