mirror of
https://github.com/marko-js/marko.git
synced 2026-02-01 16:07:13 +00:00
fix: strip types from inline component class
This commit is contained in:
parent
3ad4ebc86b
commit
04d6fad6d5
7
.changeset/perfect-buckets-call.md
Normal file
7
.changeset/perfect-buckets-call.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
"@marko/compiler": patch
|
||||
"marko": patch
|
||||
"@marko/translator-default": patch
|
||||
---
|
||||
|
||||
Fix issue where types were not being stripped from the inline Marko component class.
|
||||
@ -118,6 +118,12 @@ export default (api, markoOpts) => {
|
||||
visitor:
|
||||
markoOpts.stripTypes && isMarkoOutput(markoOpts.output)
|
||||
? {
|
||||
MarkoClass(path) {
|
||||
// We replace the MarkoClass with a regular class declaration so babel can strip it's types.
|
||||
path.replaceWith(
|
||||
t.classDeclaration(t.identifier(""), null, path.node.body)
|
||||
);
|
||||
},
|
||||
ExportNamedDeclaration: {
|
||||
exit(path) {
|
||||
// The babel typescript plugin will add an empty export declaration
|
||||
@ -159,8 +165,9 @@ export function getMarkoFile(code, fileOpts, markoOpts) {
|
||||
let mtime = Infinity;
|
||||
try {
|
||||
mtime = markoOpts.fileSystem.statSync(watchFile).mtime;
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch {}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
if (mtime > cached.time) {
|
||||
// Some dependency changed, invalidate the cache.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user