Skip to content

Commit

Permalink
fix: improve Marko 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Nov 17, 2022
1 parent f91541a commit 91fc4ab
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"code-generator": "./translate"
}
16 changes: 14 additions & 2 deletions src/components/gql-query/components/component-def/translate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const { types: t } = require("@marko/compiler");
function translateMarko4(_el, { builder }) {
return builder.vars({
componentDef: builder.identifier("__component"),
});
}

module.exports = (path) => {
function translateMarko5(path, t) {
path.replaceWith(
t.variableDeclaration("var", [
t.variableDeclarator(
Expand All @@ -9,4 +13,12 @@ module.exports = (path) => {
),
])
);
}

module.exports = function translate(a, b) {
if (a.hub) {
return translateMarko5(a, b);
}

return translateMarko4(a, b);
};

0 comments on commit 91fc4ab

Please sign in to comment.