Skip to content

Commit

Permalink
feat: hermes-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed May 16, 2024
1 parent fbab20f commit 687a5d5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions composables/language/javascript/hermes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Parser } from '..'

export const hermes: Parser<any, any> = {
id: 'hermes',
label: 'Hermes',
icon: 'https://github.com/facebook/hermes/raw/main/doc/img/logo.svg',
link: 'https://github.com/facebook/hermes',
options: {
configurable: true,
defaultValue: {},
editorLanguage: 'json',
},
pkgName: 'hermes-parser',
init: (pkg) =>
importUrl(`https://esm.sh/${pkg}`, true).then((mod) => mod.default),
version: fetchVersion,
parse(code, options) {
return this.parse(code, { ...options })
},
editorLanguage: 'javascript',
getAstLocation: getAstLocation('ranges'),
}
3 changes: 2 additions & 1 deletion composables/language/javascript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { acorn } from './acorn'
import { espree, tsEslint } from './eslint'
import { typescript } from './typescript'
import { flow } from './flow'
import { hermes } from './hermes'
import type { LanguageOption } from '..'

export const javascript: LanguageOption = {
label: 'JavaScript',
// @unocss-include
icon: 'i-vscode-icons:file-type-js-official',
parsers: [babel, swc, oxc, acorn, typescript, espree, tsEslint, flow],
parsers: [babel, swc, oxc, acorn, typescript, espree, tsEslint, flow, hermes],
}

0 comments on commit 687a5d5

Please sign in to comment.