@bhsd/lezer-json 2.1.1 → 2.1.3

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 CHANGED
@@ -4,7 +4,10 @@
4
4
  [![CodeQL](https://github.com/bhsd-harry/lezer-json/actions/workflows/codeql.yml/badge.svg)](https://github.com/bhsd-harry/lezer-json/actions/workflows/codeql.yml)
5
5
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/5f155a10407b4f449430725db3b1bb47)](https://app.codacy.com/gh/bhsd-harry/lezer-json/dashboard)
6
6
 
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.
7
+ This is a fork of [@lezer/json](https://www.npmjs.com/package/@lezer/json) and
8
+ [@codemirror/lang-json](https://www.npmjs.com/package/@codemirror/lang-json)
9
+ that adds a dialect for [JSONC](https://jsonc.org/) to provide support for
10
+ comments and trailing commas.
8
11
 
9
12
  ## Installation
10
13
 
@@ -26,7 +29,8 @@ const jsonLanguageSupport: LanguageSupport = json(),
26
29
 
27
30
  ## Language
28
31
 
29
- You can also import the [LR language](https://codemirror.net/docs/ref/#language.LRLanguage) for JSON or JSONC alone.
32
+ You can also import the [LR language](https://codemirror.net/docs/ref/#language.LRLanguage)
33
+ for JSON or JSONC alone.
30
34
 
31
35
  ```ts
32
36
  import {jsonLanguage, jsoncLanguage} from '@bhsd/lezer-json';
@@ -34,7 +38,8 @@ import {jsonLanguage, jsoncLanguage} from '@bhsd/lezer-json';
34
38
 
35
39
  ## Lint Source
36
40
 
37
- This package also provides [lint sources](https://codemirror.net/docs/ref/#lint.LintSource) for JSON or JSONC syntax checking.
41
+ This package also provides [lint sources](https://codemirror.net/docs/ref/#lint.LintSource)
42
+ for JSON or JSONC syntax checking.
38
43
 
39
44
  ```ts
40
45
  import {linter} from '@codemirror/lint';
package/dist/index.js CHANGED
@@ -14,20 +14,23 @@ const props = [
14
14
  indentOnInput: /^\s*[}\]]$/u,
15
15
  };
16
16
  /** LR language for JSON. */
17
- export const jsonLanguage = LRLanguage.define({
17
+ export const jsonLanguage = /* #__PURE__ */ (() => LRLanguage.define({
18
18
  name: 'json',
19
19
  parser: parser.configure({ props }),
20
20
  languageData,
21
- });
21
+ }))();
22
22
  /** LR language for JSONC. */
23
- export const jsoncLanguage = LRLanguage.define({
23
+ export const jsoncLanguage = /* #__PURE__ */ (() => LRLanguage.define({
24
24
  name: 'jsonc',
25
25
  parser: parser.configure({ props, dialect: 'jsonc' }),
26
- languageData: Object.assign(Object.assign({}, languageData), { commentTokens: {
26
+ languageData: {
27
+ ...languageData,
28
+ commentTokens: {
27
29
  line: '//',
28
30
  block: { open: '/*', close: '*/' },
29
- } }),
30
- });
31
+ },
32
+ },
33
+ }))();
31
34
  /**
32
35
  * Get language support for JSON or JSONC.
33
36
  * @param dialect The dialect to use, either omitted or `'jsonc'` for JSON with comments.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/lezer-json",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Lezer-based JSON/JSONC grammar",
5
5
  "keywords": [
6
6
  "codemirror",
@@ -50,15 +50,15 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@bhsd/common": "^4.0.1"
53
+ "@bhsd/common": "^4.1.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@bhsd/code-standard": "^3.3.0",
56
+ "@bhsd/code-standard": "^4.2.0",
57
57
  "@codemirror/language": "^6.12.4",
58
58
  "@codemirror/lint": "^6.9.7",
59
59
  "@lezer/generator": "^1.8.0",
60
- "eslint": "^10.7.0",
61
- "markdownlint-cli2": "^0.23.1",
60
+ "eslint": "^10.10.0",
61
+ "markdownlint-cli2": "^0.23.2",
62
62
  "typescript": "^6.0.3"
63
63
  }
64
64
  }