@bhsd/lezer-json 2.0.0 → 2.1.0

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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/dist/index.js +4 -7
  3. package/package.json +18 -10
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @bhsd/lezer-json
2
2
 
3
+ [![npm version](https://badge.fury.io/js/@bhsd%2Flezer-json.svg)](https://www.npmjs.com/package/@bhsd/lezer-json)
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
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/5f155a10407b4f449430725db3b1bb47)](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 = /* @__PURE__ */ getLintSource(lintJSON);
39
+ export const jsonLinter = /* #__PURE__ */ getLintSource(lintJSON);
43
40
  /** Lint source for JSONC */
44
- export const jsoncLinter = /* @__PURE__ */ getLintSource(lintJSONC);
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.0.0",
3
+ "version": "2.1.0",
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": {
@@ -36,20 +36,28 @@
36
36
  "build:parser": "lezer-generator src/json.grammar -o src/parser.js",
37
37
  "build:core": "tsc && cp src/parser.js dist/",
38
38
  "build": "npm run build:parser && npm run build:core",
39
- "lint:ts": "tsc --noEmit && eslint --cache .",
39
+ "lint:ts": "tsc --noEmit && eslint --cache . && eslint --no-config-lookup -c eslint.dist.mjs dist/*.js",
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": "^2.2.1",
45
- "@codemirror/language": "^6.12.3",
46
- "@codemirror/lint": "^6.9.5"
53
+ "@bhsd/common": "^2.2.1"
47
54
  },
48
55
  "devDependencies": {
49
- "@bhsd/code-standard": "^2.4.2",
56
+ "@bhsd/code-standard": "^2.6.2",
57
+ "@codemirror/language": "^6.12.3",
58
+ "@codemirror/lint": "^6.9.6",
50
59
  "@lezer/generator": "^1.8.0",
51
- "@typescript-eslint/parser": "^8.59.2",
52
- "eslint": "^10.3.0",
60
+ "eslint": "^10.4.1",
53
61
  "markdownlint-cli2": "^0.22.1",
54
62
  "typescript": "^6.0.3"
55
63
  }