Skip to content

Commit ba4e16b

Browse files
committed
fix: Switch YAML library for ESM compatibility
1 parent 93401cc commit ba4e16b

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

package-lock.json

Lines changed: 11 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,16 @@
129129
"vscode:prepublish": "npm run build"
130130
},
131131
"config": {
132-
"esbuild": "./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --external:yaml --platform=node --target=node22.15 --format=esm --sourcemap"
132+
"esbuild": "./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --platform=node --target=node22.15 --format=esm --sourcemap"
133133
},
134134
"dependencies": {
135135
"deepmerge": "^4.3.1",
136-
"semver": "^7.7.2",
137-
"yaml": "^2.8.0"
136+
"js-yaml": "^4.1.0",
137+
"semver": "^7.7.2"
138138
},
139139
"devDependencies": {
140140
"@eslint/js": "^9.31.0",
141+
"@types/js-yaml": "^4.0.9",
141142
"@types/json-schema": "^7.0.15",
142143
"@types/node": "^24.0.14",
143144
"@types/vscode": "^1.102.0",

src/lib/load-schemas.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import path from 'node:path'
22

3+
import YAML from 'js-yaml'
34
import { JSONSchema7 } from 'json-schema'
45
import { RelativePattern, Uri, workspace } from 'vscode'
5-
import YAML from 'yaml'
66

77
import { EXCLUDE_GLOB, SCHEMA_GLOB } from '../constants.ts'
88
import type { Schema } from '../types.ts'
@@ -18,7 +18,7 @@ async function convertSchema(uri: Uri): Promise<Schema> {
1818
}
1919

2020
if (extension === 'yaml') {
21-
content = YAML.parse(file.toString())
21+
content = YAML.load(file.toString()) as JSONSchema7
2222
}
2323
} catch {
2424
content = {}

0 commit comments

Comments
 (0)