-
-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(language-core): add compileSFCScript plugin hook
close #3200
- Loading branch information
1 parent
3fea063
commit 2548ebf
Showing
4 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { VueLanguagePlugin } from '../types'; | ||
|
||
const plugin: VueLanguagePlugin = ({ modules }) => { | ||
|
||
return { | ||
|
||
version: 2, | ||
|
||
compileSFCScript(lang, script) { | ||
if (lang === 'js' || lang === 'ts' || lang === 'jsx' || lang === 'tsx') { | ||
const ts = modules.typescript; | ||
return ts.createSourceFile('test.' + lang, script, 99 satisfies typeof ts.ScriptTarget.Latest); | ||
} | ||
}, | ||
}; | ||
}; | ||
|
||
export default plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters