@bhsd/lezer-json 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.js +4 -7
- package/package.json +19 -11
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @bhsd/lezer-json
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@bhsd/lezer-json)
|
|
4
|
+
[](https://github.com/bhsd-harry/lezer-json/actions/workflows/codeql.yml)
|
|
5
|
+
[](https://app.codacy.com/gh/bhsd-harry/lezer-json/dashboard)
|
|
6
|
+
|
|
3
7
|
This is a fork of [@lezer/json](https://www.npmjs.com/package/@lezer/json) and [@codemirror/lang-json](https://www.npmjs.com/package/@codemirror/lang-json) that adds a dialect for [JSONC](https://jsonc.org/) to provide support for comments and trailing commas.
|
|
4
8
|
|
|
5
9
|
## Installation
|
package/dist/index.js
CHANGED
|
@@ -23,13 +23,10 @@ export const jsonLanguage = LRLanguage.define({
|
|
|
23
23
|
export const jsoncLanguage = LRLanguage.define({
|
|
24
24
|
name: 'jsonc',
|
|
25
25
|
parser: parser.configure({ props, dialect: 'jsonc' }),
|
|
26
|
-
languageData: {
|
|
27
|
-
...languageData,
|
|
28
|
-
commentTokens: {
|
|
26
|
+
languageData: Object.assign(Object.assign({}, languageData), { commentTokens: {
|
|
29
27
|
line: '//',
|
|
30
28
|
block: { open: '/*', close: '*/' },
|
|
31
|
-
},
|
|
32
|
-
},
|
|
29
|
+
} }),
|
|
33
30
|
});
|
|
34
31
|
/**
|
|
35
32
|
* Get language support for JSON or JSONC.
|
|
@@ -39,6 +36,6 @@ export const json = (dialect) => new LanguageSupport(dialect === 'jsonc' ? jsonc
|
|
|
39
36
|
const getLintSource = (lint) => ({ state: { doc } }) => lint(doc.toString())
|
|
40
37
|
.map(({ message, from, to = from, severity }) => ({ message, severity, from, to }));
|
|
41
38
|
/** Lint source for JSON */
|
|
42
|
-
export const jsonLinter = /*
|
|
39
|
+
export const jsonLinter = /* #__PURE__ */ getLintSource(lintJSON);
|
|
43
40
|
/** Lint source for JSONC */
|
|
44
|
-
export const jsoncLinter = /*
|
|
41
|
+
export const jsoncLinter = /* #__PURE__ */ getLintSource(lintJSONC);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bhsd/lezer-json",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Lezer-based JSON/JSONC grammar",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemirror",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"browser": "dist/index.js",
|
|
25
|
-
"main": "dist/index.js",
|
|
26
|
-
"types": "dist/index.d.ts",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"repository": {
|
|
@@ -34,23 +34,31 @@
|
|
|
34
34
|
"ls": "npm i --package-lock-only && npm ls --package-lock-only --all --omit=dev",
|
|
35
35
|
"prepublishOnly": "npm run build",
|
|
36
36
|
"build:parser": "lezer-generator src/json.grammar -o src/parser.js",
|
|
37
|
-
"build:core": "tsc && cp src/parser.js dist/",
|
|
37
|
+
"build:core": "tsc && cp src/parser.js dist/ && eslint --no-config-lookup -c eslint.dist.js dist/*.js",
|
|
38
38
|
"build": "npm run build:parser && npm run build:core",
|
|
39
39
|
"lint:ts": "tsc --noEmit && eslint --cache .",
|
|
40
40
|
"lint:md": "markdownlint-cli2 '**/*.md'",
|
|
41
41
|
"lint": "npm run lint:ts && npm run lint:md"
|
|
42
42
|
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@codemirror/language": "^6.0.0",
|
|
45
|
+
"@codemirror/lint": "^6.0.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@codemirror/lint": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
43
52
|
"dependencies": {
|
|
44
|
-
"@bhsd/common": "^
|
|
45
|
-
"@codemirror/language": "^6.12.3",
|
|
46
|
-
"@codemirror/lint": "^6.9.5"
|
|
53
|
+
"@bhsd/common": "^4.0.1"
|
|
47
54
|
},
|
|
48
55
|
"devDependencies": {
|
|
49
|
-
"@bhsd/code-standard": "^
|
|
56
|
+
"@bhsd/code-standard": "^3.3.0",
|
|
57
|
+
"@codemirror/language": "^6.12.4",
|
|
58
|
+
"@codemirror/lint": "^6.9.7",
|
|
50
59
|
"@lezer/generator": "^1.8.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"markdownlint-cli2": "^0.22.1",
|
|
60
|
+
"eslint": "^10.7.0",
|
|
61
|
+
"markdownlint-cli2": "^0.23.1",
|
|
54
62
|
"typescript": "^6.0.3"
|
|
55
63
|
}
|
|
56
64
|
}
|