Skip to content

Commit 8ad1bdd

Browse files
committed
feat: add JSON5 support for conv function
conversion function can now use JSON5.parse(...) to e.g. support hex numbers, comments, etc.
1 parent d52c130 commit 8ad1bdd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/webview/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@testing-library/react": "^13.4.0",
1414
"@testing-library/user-event": "^14.4.3",
1515
"dompurify": "^2.4.0",
16+
"json5": "2.2.3",
1617
"json-stable-stringify": "^1.0.1",
1718
"marked": "^3.0.8",
1819
"react": "^18.2.0",

src/webview/src/util.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
// copyright (c) 2020 - 2023, Matthias Behr
22
// util.js
3-
import jp from 'jsonpath'
3+
import jp from 'jsonpath'
4+
5+
// provide JSON5.parse for conversion functions:
6+
import JSON5 from 'json5'
7+
8+
// eslint-disable-next-line no-undef
9+
if (!globalThis.JSON5) {
10+
// eslint-disable-next-line no-undef
11+
globalThis.JSON5 = JSON5;
12+
}
413

514
// const vscode = window.acquireVsCodeApi();
615
let vscode = undefined;

src/webview/yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -6562,6 +6562,11 @@ json-stable-stringify@^1.0.1:
65626562
dependencies:
65636563
jsonify "~0.0.0"
65646564

6565+
6566+
version "2.2.3"
6567+
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
6568+
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
6569+
65656570
json5@^1.0.1:
65666571
version "1.0.1"
65676572
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"

0 commit comments

Comments
 (0)