Skip to content

Commit

Permalink
feat: add support for Marko 3
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Oct 24, 2019
1 parent 436d8b5 commit 8c7f5e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"license": "MIT",
"main": "dist/index.js",
"peerDependencies": {
"marko": "^4"
"marko": "^3 || ^4"
},
"repository": {
"type": "git",
Expand Down
17 changes: 9 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ export = {
.digest("hex");
},
process(src, filename, config) {
return compiler[config.browser ? "compileForBrowser" : "compile"](
src,
filename,
{
requireTemplates: true,
sourceOnly: true
}
);
return compiler[
config.browser &&
compiler.compileForBrowser /** Only Marko 4 supports compileForBrowser, otherwise use compile */
? "compileForBrowser"
: "compile"
](src, filename, {
requireTemplates: true,
sourceOnly: true
});
},
canInstrument: false
} as Transformer;

0 comments on commit 8c7f5e6

Please sign in to comment.