Skip to content

Commit

Permalink
feat!: use toml-eslint-parser to support toml 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Aug 27, 2024
1 parent 52be2cb commit 0ada728
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@volar/typescript": "^2.4.0",
"toml": "^3.0.0"
"toml-eslint-parser": "^0.10.0"
},
"peerDependencies": {
"typescript": "^5.0.2"
Expand Down
15 changes: 9 additions & 6 deletions pnpm-lock.yaml

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

5 changes: 3 additions & 2 deletions src/dtsContent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import toml from 'toml'
import { parseTOML, getStaticTOMLValue } from 'toml-eslint-parser'
import { Logger } from './logger'
import { readFileSync } from 'fs'

Expand All @@ -11,7 +11,8 @@ export const getDtsContent = (

let dts
try {
const data = toml.parse(text)
const parsed = parseTOML(text)
const data = getStaticTOMLValue(parsed)

dts = `
declare const data = ${JSON.stringify(data)}${useAsConst ? ' as const' : ''}
Expand Down

0 comments on commit 0ada728

Please sign in to comment.