diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..3e775ef --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +auto-install-peers=true diff --git a/README.md b/README.md index fb58295..416c7ed 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,13 @@ Codemirror 6 extensions that provide full [JSON Schema](https://json-schema.org/ ## Features -This is now a full-featured library for both json4 (aka json) and json5 using extensions, so they should compatible with any frontend framework and/or integration library +This is now a full-featured library for json schema for `json`, `json5` and `yaml` as cm6 extensions! -- ✅ validation messages -- ✅ autocompletion with insert text +- ✅ lint validation messages from json schema +- ✅ autocompletion with insert text from json schema - ✅ hover tooltips - ✅ dynamic, per-editor-instance schemas using codemirror `StateField` and linting refresh +- ✅ markdown rendering for `schema.description` and custom `formatHover` and `formatError` configuration ## Resources @@ -29,6 +30,7 @@ Based on whether you want to support json4, json5 or both, you will need to inst ### Breaking Changes: +- 0.7.0 - this version introduces markdown rendering in place of returning html strings, so any usage of `formatHover` and/or `formatError` configuration will be passed to `markdown-it` which doesn't handle html by default. - 0.5.0 - this breaking change only impacts those following the "custom usage" approach, it _does not_ effect users using the high level, "bundled" `jsonSchema()` or `json5Schema()` modes. See the custom usages below to learn how to use the new `stateExtensions` and `handleRefresh` exports. ### json4 @@ -281,11 +283,3 @@ const state = EditorState.create({ `monaco-json` and `monaco-yaml` both provide json schema features for json, cson and yaml, and we want the nascent codemirror 6 to have them as well! Also, json5 is slowly growing in usage, and it needs full language support for the browser! - -## Our Goals - -- working GeoJSON spec linter & completion -- working variables json mode for `cm6-graphql`, ala `monaco-graphql` -- json5 support for `graphiql` as a plugin! -- perhaps use @lezer to make a json5 language service for monaco-editor + json5? -- json5 + json4 json schema features for all! diff --git a/dev/index.html b/dev/index.html index f81ced3..6b63afd 100644 --- a/dev/index.html +++ b/dev/index.html @@ -103,21 +103,30 @@

codemirror-json-schema demo

> docker-compose.yml + + +
-

package.json demo

-
+

+ package.json demo +

+
-

package.json5 demo

+

+ package.json5 demo +

-

package.yaml demo

+

+ package.yaml demo +

diff --git a/dev/index.ts b/dev/index.ts index 5717875..3527f31 100644 --- a/dev/index.ts +++ b/dev/index.ts @@ -6,6 +6,7 @@ import { drawSelection, keymap, highlightActiveLineGutter, + ViewUpdate, } from "@codemirror/view"; // import { basicSetup } from "@codemirror/basic-setup"; import { lintGutter } from "@codemirror/lint"; @@ -41,6 +42,7 @@ import { json5Schema } from "../src/json5"; import { yamlSchema } from "../src/yaml"; const schema = packageJsonSchema as JSONSchema7; +const ls = localStorage; /** * none of these are required for json4 or 5 @@ -74,26 +76,44 @@ const commonExtensions = [ syntaxHighlighting(oneDarkHighlightStyle), ]; +const persistEditorStateOnChange = (key: string) => { + return EditorView.updateListener.of( + debounce((v: ViewUpdate) => { + if (v.docChanged) { + ls.setItem(key, v.state.doc.toString()); + } + }, 300) + ); +}; + /** * json4! */ const state = EditorState.create({ - doc: jsonText, - extensions: [commonExtensions, jsonSchema(schema)], + doc: ls.getItem("json4") ?? jsonText, + extensions: [ + commonExtensions, + jsonSchema(schema), + persistEditorStateOnChange("json4"), + ], }); const editor1 = new EditorView({ state, - parent: document.querySelector("#editor")!, + parent: document.querySelector("#editor-json")!, }); /** * json5! */ const json5State = EditorState.create({ - doc: json5Text, - extensions: [commonExtensions, json5Schema(schema)], + doc: ls.getItem("json5") ?? json5Text, + extensions: [ + commonExtensions, + json5Schema(schema), + persistEditorStateOnChange("json5"), + ], }); const editor2 = new EditorView({ @@ -105,8 +125,12 @@ const editor2 = new EditorView({ * yaml! */ const yamlState = EditorState.create({ - doc: yamlText, - extensions: [commonExtensions, yamlSchema(schema)], + doc: ls.getItem("yaml") ?? yamlText, + extensions: [ + commonExtensions, + yamlSchema(schema), + persistEditorStateOnChange("yaml"), + ], }); const editor3 = new EditorView({ @@ -120,21 +144,54 @@ const handleSchemaChange = (newSchema: JSONSchema7) => { updateSchema(editor3, newSchema); }; -// new EditorState.fi(editor1, editor2); -// Hot Module Replacement -// if (module.hot) { -// module.hot.accept(); -// } +const schemaCache = new Map([["package.json", schema]]); + +const getSchema = async (val: string) => { + const cachedSchema = schemaCache.get(val); + if (cachedSchema) { + handleSchemaChange(cachedSchema); + return; + } + + const data = await ( + await fetch(`https://json.schemastore.org/${val}`) + ).json(); + schemaCache.set(val, data); + handleSchemaChange(data); +}; const schemaSelect = document.getElementById("schema-selection"); +const schemaValue = localStorage.getItem("selectedSchema")!; + +const setFileName = (value) => { + document.querySelectorAll("h2 code span").forEach((el) => { + el.textContent = value; + }); +}; + +if (schemaValue) { + schemaSelect!.value = schemaValue; + await getSchema(schemaValue); + document.querySelectorAll("h2 code span").forEach((el) => { + el.textContent = schemaValue.split(".")[0]; + }); + setFileName(schemaValue.split(".")[0]); +} schemaSelect!.onchange = async (e) => { const val = e.target!.value!; if (!val) { return; } - const data = await ( - await fetch(`https://json.schemastore.org/${val}`) - ).json(); - handleSchemaChange(data); + ls.setItem("selectedSchema", val); + await getSchema(val); + setFileName(val.split(".")[0]); }; + +function debounce(fn: Function, ms: number) { + let timeout: number; + return function (this: any, ...args: any[]) { + clearTimeout(timeout); + timeout = window.setTimeout(() => fn.apply(this, args), ms); + }; +} diff --git a/package.json b/package.json index 3d6bc27..d36b586 100644 --- a/package.json +++ b/package.json @@ -58,17 +58,19 @@ "homepage": "https://codemirror-json-schema.netlify.app/", "dependencies": { "@changesets/changelog-github": "^0.4.8", - "@codemirror/lang-yaml": "^6.0.0", "@sagold/json-pointer": "^5.1.1", + "@shikijs/markdown-it": "^1.1.7", "@types/json-schema": "^7.0.12", "@types/node": "^20.4.2", "json-schema": "^0.4.0", "json-schema-library": "^9.1.2", "markdown-it": "^14.0.0", + "vite-tsconfig-paths": "^4.3.1", "yaml": "^2.3.4" }, "optionalDependencies": { "@codemirror/lang-json": "^6.0.1", + "@codemirror/lang-yaml": "^6.0.0", "codemirror-json5": "^1.0.3", "json5": "^2.2.3" }, @@ -85,10 +87,10 @@ "@codemirror/basic-setup": "^0.20.0", "@codemirror/commands": "^6.2.4", "@codemirror/language": "^6.8.0", - "@codemirror/lint": "^6.4.0", - "@codemirror/state": "^6.2.1", + "@codemirror/lint": "^6.5.0", + "@codemirror/state": "^6.0.0", "@codemirror/theme-one-dark": "^6.1.2", - "@codemirror/view": "^6.14.1", + "@codemirror/view": "^6.0.0", "@evilmartians/lefthook": "^1.4.6", "@lezer/common": "^1.0.3", "@types/markdown-it": "^13.0.7", @@ -100,16 +102,16 @@ "typedoc": "^0.24.8", "typedoc-plugin-markdown": "^3.15.3", "typescript": "^5.1.6", - "vite": "^4.5.0", + "vite": "^5.1.4", "vitest": "0.34.6", "vitest-dom": "^0.1.0" }, "scripts": { "dev": "vite ./dev --port 3000", - "build": "pnpm tsc && tsc --module commonjs --target es2017 --outDir cjs && vite build ./dev --outDir ../public --emptyOutDir", + "build": "pnpm tsc && tsc --module commonjs --target es2017 --moduleResolution Node --outDir cjs && vite build ./dev --outDir ../public --emptyOutDir", "test": "vitest --dom", "test:coverage": "vitest run --dom --coverage ", - "tsc": "tsc && pnpm replace:env", + "tsc": "NODE_OPTIONS=--experimental-specifier-resolution=node tsc && pnpm replace:env", "version-packages": "changeset version && pnpm typedoc && pnpm prettier:write CHANGELOG.md && git add package.json pnpm-lock.yaml CHANGELOG.md", "release": "pnpm build && changeset publish", "typedoc": "typedoc --out docs src/index.ts src/json5.ts && pnpm prettier:write docs/**/*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f57e211..6f4bf8b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,12 +8,12 @@ dependencies: '@changesets/changelog-github': specifier: ^0.4.8 version: 0.4.8 - '@codemirror/lang-yaml': - specifier: ^6.0.0 - version: 6.0.0(@codemirror/view@6.14.1) '@sagold/json-pointer': specifier: ^5.1.1 version: 5.1.1 + '@shikijs/markdown-it': + specifier: ^1.1.7 + version: 1.1.7 '@types/json-schema': specifier: ^7.0.12 version: 7.0.12 @@ -29,6 +29,9 @@ dependencies: markdown-it: specifier: ^14.0.0 version: 14.0.0 + vite-tsconfig-paths: + specifier: ^4.3.1 + version: 4.3.1(typescript@5.1.6)(vite@5.1.4) yaml: specifier: ^2.3.4 version: 2.3.4 @@ -37,6 +40,9 @@ optionalDependencies: '@codemirror/lang-json': specifier: ^6.0.1 version: 6.0.1 + '@codemirror/lang-yaml': + specifier: ^6.0.0 + version: 6.0.0(@codemirror/view@6.24.1) codemirror-json5: specifier: ^1.0.3 version: 1.0.3 @@ -50,7 +56,7 @@ devDependencies: version: 2.26.2 '@codemirror/autocomplete': specifier: ^6.8.1 - version: 6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.1)(@lezer/common@1.0.3) + version: 6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.4.1)(@codemirror/view@6.24.1)(@lezer/common@1.0.3) '@codemirror/basic-setup': specifier: ^0.20.0 version: 0.20.0 @@ -61,17 +67,17 @@ devDependencies: specifier: ^6.8.0 version: 6.8.0 '@codemirror/lint': - specifier: ^6.4.0 - version: 6.4.0 + specifier: ^6.5.0 + version: 6.5.0 '@codemirror/state': - specifier: ^6.2.1 - version: 6.2.1 + specifier: ^6.0.0 + version: 6.4.1 '@codemirror/theme-one-dark': specifier: ^6.1.2 version: 6.1.2 '@codemirror/view': - specifier: ^6.14.1 - version: 6.14.1 + specifier: ^6.0.0 + version: 6.24.1 '@evilmartians/lefthook': specifier: ^1.4.6 version: 1.4.6 @@ -95,13 +101,13 @@ devDependencies: version: 0.24.8(typescript@5.1.6) typedoc-plugin-markdown: specifier: ^3.15.3 - version: 3.15.3(typedoc@0.24.8) + version: 3.17.1(typedoc@0.24.8) typescript: specifier: ^5.1.6 version: 5.1.6 vite: - specifier: ^4.5.0 - version: 4.5.0(@types/node@20.4.2) + specifier: ^5.1.4 + version: 5.1.4(@types/node@20.4.2) vitest: specifier: 0.34.6 version: 0.34.6(happy-dom@10.3.2) @@ -363,7 +369,7 @@ packages: '@lezer/common': 0.16.1 dev: true - /@codemirror/autocomplete@6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.1)(@lezer/common@1.0.3): + /@codemirror/autocomplete@6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.4.1)(@codemirror/view@6.24.1)(@lezer/common@1.0.3): resolution: {integrity: sha512-HpphvDcTdOx+9R3eUw9hZK9JA77jlaBF0kOt2McbyfvY0rX9pnMoO8rkkZc0GzSbzhIY4m5xJ0uHHgjfqHNmXQ==} peerDependencies: '@codemirror/language': ^6.0.0 @@ -372,12 +378,12 @@ packages: '@lezer/common': ^1.0.0 dependencies: '@codemirror/language': 6.8.0 - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 '@lezer/common': 1.0.3 dev: true - /@codemirror/autocomplete@6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.1)(@lezer/common@1.2.1): + /@codemirror/autocomplete@6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.4.1)(@codemirror/view@6.24.1)(@lezer/common@1.2.1): resolution: {integrity: sha512-HpphvDcTdOx+9R3eUw9hZK9JA77jlaBF0kOt2McbyfvY0rX9pnMoO8rkkZc0GzSbzhIY4m5xJ0uHHgjfqHNmXQ==} peerDependencies: '@codemirror/language': ^6.0.0 @@ -386,10 +392,11 @@ packages: '@lezer/common': ^1.0.0 dependencies: '@codemirror/language': 6.8.0 - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 '@lezer/common': 1.2.1 dev: false + optional: true /@codemirror/basic-setup@0.20.0: resolution: {integrity: sha512-W/ERKMLErWkrVLyP5I8Yh8PXl4r+WFNkdYVSzkXYPQv2RMPSkWpr2BgggiSJ8AHF/q3GuApncDD8I4BZz65fyg==} @@ -417,8 +424,8 @@ packages: resolution: {integrity: sha512-42lmDqVH0ttfilLShReLXsDfASKLXzfyC36bzwcqzox9PlHulMcsUOfHXNo2X2aFMVNUoQ7j+d4q5bnfseYoOA==} dependencies: '@codemirror/language': 6.8.0 - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 '@lezer/common': 1.0.3 dev: true @@ -431,17 +438,19 @@ packages: dev: false optional: true - /@codemirror/lang-yaml@6.0.0(@codemirror/view@6.14.1): + /@codemirror/lang-yaml@6.0.0(@codemirror/view@6.24.1): resolution: {integrity: sha512-fVPapdX1oYr5HMC5bou1MHscGnNCvOHuhUW6C+V2gfIeIRcughvVfznV0OuUyHy0AdXoBCjOehjzFcmLRumu2Q==} + requiresBuild: true dependencies: - '@codemirror/autocomplete': 6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.1)(@lezer/common@1.2.1) + '@codemirror/autocomplete': 6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.4.1)(@codemirror/view@6.24.1)(@lezer/common@1.2.1) '@codemirror/language': 6.8.0 - '@codemirror/state': 6.2.1 + '@codemirror/state': 6.4.1 '@lezer/common': 1.2.1 '@lezer/yaml': 1.0.2 transitivePeerDependencies: - '@codemirror/view' dev: false + optional: true /@codemirror/language@0.20.2: resolution: {integrity: sha512-WB3Bnuusw0xhVvhBocieYKwJm04SOk5bPoOEYksVHKHcGHFOaYaw+eZVxR4gIqMMcGzOIUil0FsCmFk8yrhHpw==} @@ -451,14 +460,14 @@ packages: '@lezer/common': 0.16.1 '@lezer/highlight': 0.16.0 '@lezer/lr': 0.16.3 - style-mod: 4.0.3 + style-mod: 4.1.0 dev: true /@codemirror/language@6.8.0: resolution: {integrity: sha512-r1paAyWOZkfY0RaYEZj3Kul+MiQTEbDvYqf8gPGaRvNneHXCmfSaAVFjwRUPlgxS8yflMxw2CTu6uCMp8R8A2g==} dependencies: - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 '@lezer/common': 1.0.3 '@lezer/highlight': 1.1.6 '@lezer/lr': 1.3.9 @@ -472,11 +481,11 @@ packages: crelt: 1.0.6 dev: true - /@codemirror/lint@6.4.0: - resolution: {integrity: sha512-6VZ44Ysh/Zn07xrGkdtNfmHCbGSHZzFBdzWi0pbd7chAQ/iUcpLGX99NYRZTa7Ugqg4kEHCqiHhcZnH0gLIgSg==} + /@codemirror/lint@6.5.0: + resolution: {integrity: sha512-+5YyicIaaAZKU8K43IQi8TBy6mF6giGeWAH7N96Z5LC30Wm5JMjqxOYIE9mxwMG1NbhT2mA3l9hA4uuKUM3E5g==} dependencies: - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 crelt: 1.0.6 dev: true @@ -488,11 +497,11 @@ packages: crelt: 1.0.6 dev: true - /@codemirror/search@6.5.0: - resolution: {integrity: sha512-64/M40YeJPToKvGO6p3fijo2vwUEj4nACEAXElCaYQ50HrXSvRaK+NHEhSh73WFBGdvIdhrV+lL9PdJy2RfCYA==} + /@codemirror/search@6.5.6: + resolution: {integrity: sha512-rpMgcsh7o0GuCDUXKPvww+muLA1pDJaFrpq/CCHtpQJYz8xopu4D1hPcKRoDD0YlF8gZaqTNIRa4VRBWyhyy7Q==} dependencies: - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 crelt: 1.0.6 dev: true @@ -500,15 +509,15 @@ packages: resolution: {integrity: sha512-ms0tlV5A02OK0pFvTtSUGMLkoarzh1F8mr6jy1cD7ucSC2X/VLHtQCxfhdSEGqTYlQF2hoZtmLv+amqhdgbwjQ==} dev: true - /@codemirror/state@6.2.1: - resolution: {integrity: sha512-RupHSZ8+OjNT38zU9fKH2sv+Dnlr8Eb8sl4NOnnqz95mCFTZUaiRP8Xv5MeeaG0px2b8Bnfe7YGwCV3nsBhbuw==} + /@codemirror/state@6.4.1: + resolution: {integrity: sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==} /@codemirror/theme-one-dark@6.1.2: resolution: {integrity: sha512-F+sH0X16j/qFLMAfbciKTxVOwkdAS336b7AXTKOZhy8BR3eH/RelsnLgLFINrpST63mmN2OuwUt0W2ndUgYwUA==} dependencies: '@codemirror/language': 6.8.0 - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 '@lezer/highlight': 1.1.6 dev: true @@ -516,213 +525,199 @@ packages: resolution: {integrity: sha512-pqEPCb9QFTOtHgAH5XU/oVy9UR/Anj6r+tG5CRmkNVcqSKEPmBU05WtN/jxJCFZBXf6HumzWC9ydE4qstO3TxQ==} dependencies: '@codemirror/state': 0.20.1 - style-mod: 4.0.3 + style-mod: 4.1.0 w3c-keyname: 2.2.8 dev: true - /@codemirror/view@6.14.1: - resolution: {integrity: sha512-ofcsI7lRFo4N0rfnd+V3Gh2boQU3DmaaSKhDOvXUWjeOeuupMXer2e/3i9TUFN7aEIntv300EFBWPEiYVm2svg==} + /@codemirror/view@6.24.1: + resolution: {integrity: sha512-sBfP4rniPBRQzNakwuQEqjEuiJDWJyF2kqLLqij4WXRoVwPPJfjx966Eq3F7+OPQxDtMt/Q9MWLoZLWjeveBlg==} dependencies: - '@codemirror/state': 6.2.1 - style-mod: 4.0.3 + '@codemirror/state': 6.4.1 + style-mod: 4.1.0 w3c-keyname: 2.2.8 - /@esbuild/android-arm64@0.18.11: - resolution: {integrity: sha512-snieiq75Z1z5LJX9cduSAjUr7vEI1OdlzFPMw0HH5YI7qQHDd3qs+WZoMrWYDsfRJSq36lIA6mfZBkvL46KoIw==} + /@esbuild/aix-ppc64@0.19.12: + resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + optional: true + + /@esbuild/android-arm64@0.19.12: + resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} engines: {node: '>=12'} cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true - /@esbuild/android-arm@0.18.11: - resolution: {integrity: sha512-q4qlUf5ucwbUJZXF5tEQ8LF7y0Nk4P58hOsGk3ucY0oCwgQqAnqXVbUuahCddVHfrxmpyewRpiTHwVHIETYu7Q==} + /@esbuild/android-arm@0.19.12: + resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} engines: {node: '>=12'} cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true - /@esbuild/android-x64@0.18.11: - resolution: {integrity: sha512-iPuoxQEV34+hTF6FT7om+Qwziv1U519lEOvekXO9zaMMlT9+XneAhKL32DW3H7okrCOBQ44BMihE8dclbZtTuw==} + /@esbuild/android-x64@0.19.12: + resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} engines: {node: '>=12'} cpu: [x64] os: [android] requiresBuild: true - dev: true optional: true - /@esbuild/darwin-arm64@0.18.11: - resolution: {integrity: sha512-Gm0QkI3k402OpfMKyQEEMG0RuW2LQsSmI6OeO4El2ojJMoF5NLYb3qMIjvbG/lbMeLOGiW6ooU8xqc+S0fgz2w==} + /@esbuild/darwin-arm64@0.19.12: + resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true - /@esbuild/darwin-x64@0.18.11: - resolution: {integrity: sha512-N15Vzy0YNHu6cfyDOjiyfJlRJCB/ngKOAvoBf1qybG3eOq0SL2Lutzz9N7DYUbb7Q23XtHPn6lMDF6uWbGv9Fw==} + /@esbuild/darwin-x64@0.19.12: + resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} engines: {node: '>=12'} cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true - /@esbuild/freebsd-arm64@0.18.11: - resolution: {integrity: sha512-atEyuq6a3omEY5qAh5jIORWk8MzFnCpSTUruBgeyN9jZq1K/QI9uke0ATi3MHu4L8c59CnIi4+1jDKMuqmR71A==} + /@esbuild/freebsd-arm64@0.19.12: + resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true optional: true - /@esbuild/freebsd-x64@0.18.11: - resolution: {integrity: sha512-XtuPrEfBj/YYYnAAB7KcorzzpGTvOr/dTtXPGesRfmflqhA4LMF0Gh/n5+a9JBzPuJ+CGk17CA++Hmr1F/gI0Q==} + /@esbuild/freebsd-x64@0.19.12: + resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true - /@esbuild/linux-arm64@0.18.11: - resolution: {integrity: sha512-c6Vh2WS9VFKxKZ2TvJdA7gdy0n6eSy+yunBvv4aqNCEhSWVor1TU43wNRp2YLO9Vng2G+W94aRz+ILDSwAiYog==} + /@esbuild/linux-arm64@0.19.12: + resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} engines: {node: '>=12'} cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-arm@0.18.11: - resolution: {integrity: sha512-Idipz+Taso/toi2ETugShXjQ3S59b6m62KmLHkJlSq/cBejixmIydqrtM2XTvNCywFl3VC7SreSf6NV0i6sRyg==} + /@esbuild/linux-arm@0.19.12: + resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} engines: {node: '>=12'} cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-ia32@0.18.11: - resolution: {integrity: sha512-S3hkIF6KUqRh9n1Q0dSyYcWmcVa9Cg+mSoZEfFuzoYXXsk6196qndrM+ZiHNwpZKi3XOXpShZZ+9dfN5ykqjjw==} + /@esbuild/linux-ia32@0.19.12: + resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} engines: {node: '>=12'} cpu: [ia32] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-loong64@0.18.11: - resolution: {integrity: sha512-MRESANOoObQINBA+RMZW+Z0TJWpibtE7cPFnahzyQHDCA9X9LOmGh68MVimZlM9J8n5Ia8lU773te6O3ILW8kw==} + /@esbuild/linux-loong64@0.19.12: + resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} engines: {node: '>=12'} cpu: [loong64] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-mips64el@0.18.11: - resolution: {integrity: sha512-qVyPIZrXNMOLYegtD1u8EBccCrBVshxMrn5MkuFc3mEVsw7CCQHaqZ4jm9hbn4gWY95XFnb7i4SsT3eflxZsUg==} + /@esbuild/linux-mips64el@0.19.12: + resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-ppc64@0.18.11: - resolution: {integrity: sha512-T3yd8vJXfPirZaUOoA9D2ZjxZX4Gr3QuC3GztBJA6PklLotc/7sXTOuuRkhE9W/5JvJP/K9b99ayPNAD+R+4qQ==} + /@esbuild/linux-ppc64@0.19.12: + resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-riscv64@0.18.11: - resolution: {integrity: sha512-evUoRPWiwuFk++snjH9e2cAjF5VVSTj+Dnf+rkO/Q20tRqv+644279TZlPK8nUGunjPAtQRCj1jQkDAvL6rm2w==} + /@esbuild/linux-riscv64@0.19.12: + resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-s390x@0.18.11: - resolution: {integrity: sha512-/SlRJ15XR6i93gRWquRxYCfhTeC5PdqEapKoLbX63PLCmAkXZHY2uQm2l9bN0oPHBsOw2IswRZctMYS0MijFcg==} + /@esbuild/linux-s390x@0.19.12: + resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} engines: {node: '>=12'} cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/linux-x64@0.18.11: - resolution: {integrity: sha512-xcncej+wF16WEmIwPtCHi0qmx1FweBqgsRtEL1mSHLFR6/mb3GEZfLQnx+pUDfRDEM4DQF8dpXIW7eDOZl1IbA==} + /@esbuild/linux-x64@0.19.12: + resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} engines: {node: '>=12'} cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true - /@esbuild/netbsd-x64@0.18.11: - resolution: {integrity: sha512-aSjMHj/F7BuS1CptSXNg6S3M4F3bLp5wfFPIJM+Km2NfIVfFKhdmfHF9frhiCLIGVzDziggqWll0B+9AUbud/Q==} + /@esbuild/netbsd-x64@0.19.12: + resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] requiresBuild: true - dev: true optional: true - /@esbuild/openbsd-x64@0.18.11: - resolution: {integrity: sha512-tNBq+6XIBZtht0xJGv7IBB5XaSyvYPCm1PxJ33zLQONdZoLVM0bgGqUrXnJyiEguD9LU4AHiu+GCXy/Hm9LsdQ==} + /@esbuild/openbsd-x64@0.19.12: + resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] requiresBuild: true - dev: true optional: true - /@esbuild/sunos-x64@0.18.11: - resolution: {integrity: sha512-kxfbDOrH4dHuAAOhr7D7EqaYf+W45LsAOOhAet99EyuxxQmjbk8M9N4ezHcEiCYPaiW8Dj3K26Z2V17Gt6p3ng==} + /@esbuild/sunos-x64@0.19.12: + resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} engines: {node: '>=12'} cpu: [x64] os: [sunos] requiresBuild: true - dev: true optional: true - /@esbuild/win32-arm64@0.18.11: - resolution: {integrity: sha512-Sh0dDRyk1Xi348idbal7lZyfSkjhJsdFeuC13zqdipsvMetlGiFQNdO+Yfp6f6B4FbyQm7qsk16yaZk25LChzg==} + /@esbuild/win32-arm64@0.19.12: + resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} engines: {node: '>=12'} cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true - /@esbuild/win32-ia32@0.18.11: - resolution: {integrity: sha512-o9JUIKF1j0rqJTFbIoF4bXj6rvrTZYOrfRcGyL0Vm5uJ/j5CkBD/51tpdxe9lXEDouhRgdr/BYzUrDOvrWwJpg==} + /@esbuild/win32-ia32@0.19.12: + resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} engines: {node: '>=12'} cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true - /@esbuild/win32-x64@0.18.11: - resolution: {integrity: sha512-rQI4cjLHd2hGsM1LqgDI7oOCYbQ6IBOVsX9ejuRMSze0GqXUG2ekwiKkiBU1pRGSeCqFFHxTrcEydB2Hyoz9CA==} + /@esbuild/win32-x64@0.19.12: + resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} engines: {node: '>=12'} cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@evilmartians/lefthook@1.4.6: @@ -788,7 +783,9 @@ packages: /@lezer/common@1.2.1: resolution: {integrity: sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==} + requiresBuild: true dev: false + optional: true /@lezer/highlight@0.16.0: resolution: {integrity: sha512-iE5f4flHlJ1g1clOStvXNLbORJoiW4Kytso6ubfYzHnaNo/eo5SKhxs4wv/rtvwZQeZrK3we8S9SyA7OGOoRKQ==} @@ -823,17 +820,21 @@ packages: /@lezer/lr@1.4.0: resolution: {integrity: sha512-Wst46p51km8gH0ZUmeNrtpRYmdlRHUpN1DQd3GFAyKANi8WVz8c2jHYTf1CVScFaCjQw1iO3ZZdqGDxQPRErTg==} + requiresBuild: true dependencies: '@lezer/common': 1.2.1 dev: false + optional: true /@lezer/yaml@1.0.2: resolution: {integrity: sha512-XCkwuxe+eumJ28nA9e1S6XKsXz9W7V/AG+WBiWOtiIuUpKcZ/bHuvN8bLxSDREIcybSRpEd/jvphh4vgm6Ed2g==} + requiresBuild: true dependencies: '@lezer/common': 1.2.1 '@lezer/highlight': 1.1.6 '@lezer/lr': 1.4.0 dev: false + optional: true /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -876,6 +877,97 @@ packages: fastq: 1.15.0 dev: true + /@rollup/rollup-android-arm-eabi@4.12.0: + resolution: {integrity: sha512-+ac02NL/2TCKRrJu2wffk1kZ+RyqxVUlbjSagNgPm94frxtr+XDL12E5Ll1enWskLrtrZ2r8L3wED1orIibV/w==} + cpu: [arm] + os: [android] + requiresBuild: true + optional: true + + /@rollup/rollup-android-arm64@4.12.0: + resolution: {integrity: sha512-OBqcX2BMe6nvjQ0Nyp7cC90cnumt8PXmO7Dp3gfAju/6YwG0Tj74z1vKrfRz7qAv23nBcYM8BCbhrsWqO7PzQQ==} + cpu: [arm64] + os: [android] + requiresBuild: true + optional: true + + /@rollup/rollup-darwin-arm64@4.12.0: + resolution: {integrity: sha512-X64tZd8dRE/QTrBIEs63kaOBG0b5GVEd3ccoLtyf6IdXtHdh8h+I56C2yC3PtC9Ucnv0CpNFJLqKFVgCYe0lOQ==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + optional: true + + /@rollup/rollup-darwin-x64@4.12.0: + resolution: {integrity: sha512-cc71KUZoVbUJmGP2cOuiZ9HSOP14AzBAThn3OU+9LcA1+IUqswJyR1cAJj3Mg55HbjZP6OLAIscbQsQLrpgTOg==} + cpu: [x64] + os: [darwin] + requiresBuild: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.12.0: + resolution: {integrity: sha512-a6w/Y3hyyO6GlpKL2xJ4IOh/7d+APaqLYdMf86xnczU3nurFTaVN9s9jOXQg97BE4nYm/7Ga51rjec5nfRdrvA==} + cpu: [arm] + os: [linux] + requiresBuild: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.12.0: + resolution: {integrity: sha512-0fZBq27b+D7Ar5CQMofVN8sggOVhEtzFUwOwPppQt0k+VR+7UHMZZY4y+64WJ06XOhBTKXtQB/Sv0NwQMXyNAA==} + cpu: [arm64] + os: [linux] + requiresBuild: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.12.0: + resolution: {integrity: sha512-eTvzUS3hhhlgeAv6bfigekzWZjaEX9xP9HhxB0Dvrdbkk5w/b+1Sxct2ZuDxNJKzsRStSq1EaEkVSEe7A7ipgQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.12.0: + resolution: {integrity: sha512-ix+qAB9qmrCRiaO71VFfY8rkiAZJL8zQRXveS27HS+pKdjwUfEhqo2+YF2oI+H/22Xsiski+qqwIBxVewLK7sw==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.12.0: + resolution: {integrity: sha512-TenQhZVOtw/3qKOPa7d+QgkeM6xY0LtwzR8OplmyL5LrgTWIXpTQg2Q2ycBf8jm+SFW2Wt/DTn1gf7nFp3ssVA==} + cpu: [x64] + os: [linux] + requiresBuild: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.12.0: + resolution: {integrity: sha512-LfFdRhNnW0zdMvdCb5FNuWlls2WbbSridJvxOvYWgSBOYZtgBfW9UGNJG//rwMqTX1xQE9BAodvMH9tAusKDUw==} + cpu: [x64] + os: [linux] + requiresBuild: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.12.0: + resolution: {integrity: sha512-JPDxovheWNp6d7AHCgsUlkuCKvtu3RB55iNEkaQcf0ttsDU/JZF+iQnYcQJSk/7PtT4mjjVG8N1kpwnI9SLYaw==} + cpu: [arm64] + os: [win32] + requiresBuild: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.12.0: + resolution: {integrity: sha512-fjtuvMWRGJn1oZacG8IPnzIV6GF2/XG+h71FKn76OYFqySXInJtseAqdprVTDTyqPxQOG9Exak5/E9Z3+EJ8ZA==} + cpu: [ia32] + os: [win32] + requiresBuild: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.12.0: + resolution: {integrity: sha512-ZYmr5mS2wd4Dew/JjT0Fqi2NPB/ZhZ2VvPp7SmvPZb4Y1CG/LRcS6tcRo2cYU7zLK5A7cdbhWnnWmUjoI4qapg==} + cpu: [x64] + os: [win32] + requiresBuild: true + optional: true + /@sagold/json-pointer@5.1.1: resolution: {integrity: sha512-/iskWuyGNu09qy09HYmyLnvzpKryymH9T+vTBi2LdFp1TuKvERDADvPMv2ZkQKsrRklOzivmOz9QXof0dKqvgA==} dev: false @@ -887,6 +979,24 @@ packages: ebnf: 1.9.1 dev: false + /@shikijs/core@1.1.7: + resolution: {integrity: sha512-gTYLUIuD1UbZp/11qozD3fWpUTuMqPSf3svDMMrL0UmlGU7D9dPw/V1FonwAorCUJBltaaESxq90jrSjQyGixg==} + dev: false + + /@shikijs/markdown-it@1.1.7: + resolution: {integrity: sha512-OGfr16nWTGtGx9iBpNtKJm6AWwZAUYlzeqpdgHpNWVoH4cFaPGiciZjHMiGLBO2fIHgQlBbC4RsV2F9nPQD5kQ==} + dependencies: + '@shikijs/transformers': 1.1.7 + markdown-it: 14.0.0 + shiki: 1.1.7 + dev: false + + /@shikijs/transformers@1.1.7: + resolution: {integrity: sha512-lXz011ao4+rvweps/9h3CchBfzb1U5OtP5D51Tqc9lQYdLblWMIxQxH6Ybe1GeGINcEVM4goMyPrI0JvlIp4UQ==} + dependencies: + shiki: 1.1.7 + dev: false + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -901,6 +1011,9 @@ packages: resolution: {integrity: sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==} dev: true + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + /@types/is-ci@3.0.0: resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} dependencies: @@ -1256,8 +1369,8 @@ packages: requiresBuild: true dependencies: '@codemirror/language': 6.8.0 - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 '@lezer/common': 1.0.3 '@lezer/highlight': 1.1.6 json5: 2.2.3 @@ -1268,13 +1381,13 @@ packages: /codemirror@6.0.1(@lezer/common@1.0.3): resolution: {integrity: sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==} dependencies: - '@codemirror/autocomplete': 6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.1)(@lezer/common@1.0.3) + '@codemirror/autocomplete': 6.8.1(@codemirror/language@6.8.0)(@codemirror/state@6.4.1)(@codemirror/view@6.24.1)(@lezer/common@1.0.3) '@codemirror/commands': 6.2.4 '@codemirror/language': 6.8.0 - '@codemirror/lint': 6.4.0 - '@codemirror/search': 6.5.0 - '@codemirror/state': 6.2.1 - '@codemirror/view': 6.14.1 + '@codemirror/lint': 6.5.0 + '@codemirror/search': 6.5.6 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.24.1 transitivePeerDependencies: - '@lezer/common' dev: true @@ -1364,7 +1477,6 @@ packages: optional: true dependencies: ms: 2.1.2 - dev: true /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} @@ -1535,35 +1647,35 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild@0.18.11: - resolution: {integrity: sha512-i8u6mQF0JKJUlGR3OdFLKldJQMMs8OqM9Cc3UCi9XXziJ9WERM5bfkHaEAy0YAvPRMgqSW55W7xYn84XtEFTtA==} + /esbuild@0.19.12: + resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.11 - '@esbuild/android-arm64': 0.18.11 - '@esbuild/android-x64': 0.18.11 - '@esbuild/darwin-arm64': 0.18.11 - '@esbuild/darwin-x64': 0.18.11 - '@esbuild/freebsd-arm64': 0.18.11 - '@esbuild/freebsd-x64': 0.18.11 - '@esbuild/linux-arm': 0.18.11 - '@esbuild/linux-arm64': 0.18.11 - '@esbuild/linux-ia32': 0.18.11 - '@esbuild/linux-loong64': 0.18.11 - '@esbuild/linux-mips64el': 0.18.11 - '@esbuild/linux-ppc64': 0.18.11 - '@esbuild/linux-riscv64': 0.18.11 - '@esbuild/linux-s390x': 0.18.11 - '@esbuild/linux-x64': 0.18.11 - '@esbuild/netbsd-x64': 0.18.11 - '@esbuild/openbsd-x64': 0.18.11 - '@esbuild/sunos-x64': 0.18.11 - '@esbuild/win32-arm64': 0.18.11 - '@esbuild/win32-ia32': 0.18.11 - '@esbuild/win32-x64': 0.18.11 - dev: true + '@esbuild/aix-ppc64': 0.19.12 + '@esbuild/android-arm': 0.19.12 + '@esbuild/android-arm64': 0.19.12 + '@esbuild/android-x64': 0.19.12 + '@esbuild/darwin-arm64': 0.19.12 + '@esbuild/darwin-x64': 0.19.12 + '@esbuild/freebsd-arm64': 0.19.12 + '@esbuild/freebsd-x64': 0.19.12 + '@esbuild/linux-arm': 0.19.12 + '@esbuild/linux-arm64': 0.19.12 + '@esbuild/linux-ia32': 0.19.12 + '@esbuild/linux-loong64': 0.19.12 + '@esbuild/linux-mips64el': 0.19.12 + '@esbuild/linux-ppc64': 0.19.12 + '@esbuild/linux-riscv64': 0.19.12 + '@esbuild/linux-s390x': 0.19.12 + '@esbuild/linux-x64': 0.19.12 + '@esbuild/netbsd-x64': 0.19.12 + '@esbuild/openbsd-x64': 0.19.12 + '@esbuild/sunos-x64': 0.19.12 + '@esbuild/win32-arm64': 0.19.12 + '@esbuild/win32-ia32': 0.19.12 + '@esbuild/win32-x64': 0.19.12 /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -1677,12 +1789,11 @@ packages: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true - dev: true optional: true /function-bind@1.1.1: @@ -1766,6 +1877,10 @@ packages: slash: 3.0.0 dev: true + /globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + dev: false + /gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} dependencies: @@ -2364,13 +2479,11 @@ packages: /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - dev: true - /nanoid@3.3.6: - resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - dev: true /nearley@2.20.1: resolution: {integrity: sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==} @@ -2532,7 +2645,6 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: true /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -2559,14 +2671,13 @@ packages: pathe: 1.1.1 dev: true - /postcss@8.4.31: - resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} + /postcss@8.4.35: + resolution: {integrity: sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: true /preferred-pm@3.0.3: resolution: {integrity: sha512-+wZgbxNES/KlJs9q40F/1sfOd/j7f1O9JaHcW5Dsn3aUUOZg3L2bjpVUcKV2jvtElYfoTuQiNeMfQJ4kwUAhCQ==} @@ -2718,13 +2829,27 @@ packages: engines: {iojs: '>=1.0.0', node: '>=0.10.0'} dev: true - /rollup@3.29.4: - resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} - engines: {node: '>=14.18.0', npm: '>=8.0.0'} + /rollup@4.12.0: + resolution: {integrity: sha512-wz66wn4t1OHIJw3+XU7mJJQV/2NAfw5OAk6G6Hoo3zcvz/XOfQ52Vgi+AN4Uxoxi0KBBwk2g8zPrTDA4btSB/Q==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + dependencies: + '@types/estree': 1.0.5 optionalDependencies: - fsevents: 2.3.2 - dev: true + '@rollup/rollup-android-arm-eabi': 4.12.0 + '@rollup/rollup-android-arm64': 4.12.0 + '@rollup/rollup-darwin-arm64': 4.12.0 + '@rollup/rollup-darwin-x64': 4.12.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.12.0 + '@rollup/rollup-linux-arm64-gnu': 4.12.0 + '@rollup/rollup-linux-arm64-musl': 4.12.0 + '@rollup/rollup-linux-riscv64-gnu': 4.12.0 + '@rollup/rollup-linux-x64-gnu': 4.12.0 + '@rollup/rollup-linux-x64-musl': 4.12.0 + '@rollup/rollup-win32-arm64-msvc': 4.12.0 + '@rollup/rollup-win32-ia32-msvc': 4.12.0 + '@rollup/rollup-win32-x64-msvc': 4.12.0 + fsevents: 2.3.3 /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -2783,8 +2908,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /shiki@0.14.3: - resolution: {integrity: sha512-U3S/a+b0KS+UkTyMjoNojvTgrBHjgp7L6ovhFVZsXmBGnVdQ4K4U9oK0z63w538S91ATngv1vXigHCSWOwnr+g==} + /shiki@0.14.7: + resolution: {integrity: sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==} dependencies: ansi-sequence-parser: 1.1.0 jsonc-parser: 3.2.0 @@ -2792,6 +2917,12 @@ packages: vscode-textmate: 8.0.0 dev: true + /shiki@1.1.7: + resolution: {integrity: sha512-9kUTMjZtcPH3i7vHunA6EraTPpPOITYTdA5uMrvsJRexktqP0s7P3s9HVK80b4pP42FRVe03D7fT3NmJv2yYhw==} + dependencies: + '@shikijs/core': 1.1.7 + dev: false + /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -2836,7 +2967,6 @@ packages: /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} - dev: true /source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} @@ -2959,6 +3089,9 @@ packages: /style-mod@4.0.3: resolution: {integrity: sha512-78Jv8kYJdjbvRwwijtCevYADfsI0lGzYJe4mMFdceO8l75DFFDoqBhR1jVDicDRRaX4//g1u9wKeo+ztc2h1Rw==} + /style-mod@4.1.0: + resolution: {integrity: sha512-Ca5ib8HrFn+f+0n4N4ScTIA9iTOQ7MaGS1ylHcoVqW9J7w2w8PzN6g9gKmTYgGEBH8e120+RCmhpje6jC5uGWA==} + /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -3029,6 +3162,19 @@ packages: engines: {node: '>=8'} dev: true + /tsconfck@3.0.2(typescript@5.1.6): + resolution: {integrity: sha512-6lWtFjwuhS3XI4HsX4Zg0izOI3FU/AI9EGVlPEUMDIhvLPMD4wkiof0WCoDgW7qY+Dy198g4d9miAqUHWHFH6Q==} + engines: {node: ^18 || >=20} + hasBin: true + peerDependencies: + typescript: ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + dependencies: + typescript: 5.1.6 + dev: false + /tty-table@4.2.1: resolution: {integrity: sha512-xz0uKo+KakCQ+Dxj1D/tKn2FSyreSYWzdkL/BYhgN6oMW808g8QRMuh1atAV9fjTPbWBjfbkKQpI/5rEcnAc7g==} engines: {node: '>=8.0.0'} @@ -3101,8 +3247,8 @@ packages: is-typed-array: 1.1.12 dev: true - /typedoc-plugin-markdown@3.15.3(typedoc@0.24.8): - resolution: {integrity: sha512-idntFYu3vfaY3eaD+w9DeRd0PmNGqGuNLKihPU9poxFGnATJYGn9dPtEhn2QrTdishFMg7jPXAhos+2T6YCWRQ==} + /typedoc-plugin-markdown@3.17.1(typedoc@0.24.8): + resolution: {integrity: sha512-QzdU3fj0Kzw2XSdoL15ExLASt2WPqD7FbLeaqwT70+XjKyTshBnUlQA5nNREO1C2P8Uen0CDjsBLMsCQ+zd0lw==} peerDependencies: typedoc: '>=0.24.0' dependencies: @@ -3120,7 +3266,7 @@ packages: lunr: 2.3.9 marked: 4.3.0 minimatch: 9.0.3 - shiki: 0.14.3 + shiki: 0.14.7 typescript: 5.1.6 dev: true @@ -3128,7 +3274,6 @@ packages: resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} engines: {node: '>=14.17'} hasBin: true - dev: true /uc.micro@2.0.0: resolution: {integrity: sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==} @@ -3190,7 +3335,7 @@ packages: mlly: 1.4.0 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.5.0(@types/node@20.4.2) + vite: 5.1.4(@types/node@20.4.2) transitivePeerDependencies: - '@types/node' - less @@ -3202,12 +3347,29 @@ packages: - terser dev: true - /vite@4.5.0(@types/node@20.4.2): - resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} - engines: {node: ^14.18.0 || >=16.0.0} + /vite-tsconfig-paths@4.3.1(typescript@5.1.6)(vite@5.1.4): + resolution: {integrity: sha512-cfgJwcGOsIxXOLU/nELPny2/LUD/lcf1IbfyeKTv2bsupVbTH/xpFtdQlBmIP1GEK2CjjLxYhFfB+QODFAx5aw==} + peerDependencies: + vite: '*' + peerDependenciesMeta: + vite: + optional: true + dependencies: + debug: 4.3.4 + globrex: 0.1.2 + tsconfck: 3.0.2(typescript@5.1.6) + vite: 5.1.4(@types/node@20.4.2) + transitivePeerDependencies: + - supports-color + - typescript + dev: false + + /vite@5.1.4(@types/node@20.4.2): + resolution: {integrity: sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: - '@types/node': '>= 14' + '@types/node': ^18.0.0 || >=20.0.0 less: '*' lightningcss: ^1.21.0 sass: '*' @@ -3231,12 +3393,11 @@ packages: optional: true dependencies: '@types/node': 20.4.2 - esbuild: 0.18.11 - postcss: 8.4.31 - rollup: 3.29.4 + esbuild: 0.19.12 + postcss: 8.4.35 + rollup: 4.12.0 optionalDependencies: - fsevents: 2.3.2 - dev: true + fsevents: 2.3.3 /vitest-dom@0.1.0(vitest@0.34.6): resolution: {integrity: sha512-1KqmbJ+3eiyz5SZilzDXySNnQ32t/XVi1f9zsyv+smI4X+sZEz54zlPwoBXK9XD6XAJdRReGgRxuNu8t6FYhXQ==} @@ -3305,7 +3466,7 @@ packages: strip-literal: 1.0.1 tinybench: 2.5.0 tinypool: 0.7.0 - vite: 4.5.0(@types/node@20.4.2) + vite: 5.1.4(@types/node@20.4.2) vite-node: 0.34.6(@types/node@20.4.2) why-is-node-running: 2.2.2 transitivePeerDependencies: diff --git a/src/__tests__/__fixtures__/schemas.ts b/src/features/__tests__/__fixtures__/schemas.ts similarity index 97% rename from src/__tests__/__fixtures__/schemas.ts rename to src/features/__tests__/__fixtures__/schemas.ts index 4cb2769..50a2ae2 100644 --- a/src/__tests__/__fixtures__/schemas.ts +++ b/src/features/__tests__/__fixtures__/schemas.ts @@ -28,6 +28,9 @@ export const testSchema2 = { required: ["foo"], additionalProperties: false, }, + objectWithRef: { + $ref: "#/definitions/fancyObject", + }, oneOfEg: { description: "an example oneOf", title: "oneOfEg", diff --git a/src/__tests__/__helpers__/completion.ts b/src/features/__tests__/__helpers__/completion.ts similarity index 91% rename from src/__tests__/__helpers__/completion.ts rename to src/features/__tests__/__helpers__/completion.ts index 6a5118e..9c4b0dc 100644 --- a/src/__tests__/__helpers__/completion.ts +++ b/src/features/__tests__/__helpers__/completion.ts @@ -8,11 +8,11 @@ import { CompletionSource, } from "@codemirror/autocomplete"; import { JSONSchema7 } from "json-schema"; -import { testSchema2 } from "../__fixtures__/schemas.js"; +import { testSchema2 } from "../__fixtures__/schemas"; import { EditorView } from "@codemirror/view"; -import { JSONMode } from "../../types.js"; -import { MODES } from "../../constants.js"; -import { getExtensions } from "./index.js"; +import { JSONMode } from "../../../types"; +import { MODES } from "../../../constants"; +import { getExtensions } from "./index"; vitest.mock("@codemirror/autocomplete", async () => { const mod = await vitest.importActual< diff --git a/src/__tests__/__helpers__/index.ts b/src/features/__tests__/__helpers__/index.ts similarity index 55% rename from src/__tests__/__helpers__/index.ts rename to src/features/__tests__/__helpers__/index.ts index 30f1f1a..ec53575 100644 --- a/src/__tests__/__helpers__/index.ts +++ b/src/features/__tests__/__helpers__/index.ts @@ -1,9 +1,9 @@ -import { JSONMode } from "../../types"; -import { MODES } from "../../constants"; +import { JSONMode } from "../../../types"; +import { MODES } from "../../../constants"; import { JSONSchema7 } from "json-schema"; -import { jsonSchema } from "../../bundled"; -import { json5Schema } from "../../json5/bundled"; -import { yamlSchema } from "../../yaml/bundled"; +import { jsonSchema } from "../../../json/bundled"; +import { json5Schema } from "../../../json5/bundled"; +import { yamlSchema } from "../../../yaml/bundled"; export const getExtensions = (mode: JSONMode, schema?: JSONSchema7) => { switch (mode) { diff --git a/src/__tests__/json-completion.spec.ts b/src/features/__tests__/json-completion.spec.ts similarity index 97% rename from src/__tests__/json-completion.spec.ts rename to src/features/__tests__/json-completion.spec.ts index 650a897..5aea0c6 100644 --- a/src/__tests__/json-completion.spec.ts +++ b/src/features/__tests__/json-completion.spec.ts @@ -1,7 +1,7 @@ import { describe, it } from "vitest"; -import { expectCompletion } from "./__helpers__/completion.js"; -import { MODES } from "../constants.js"; +import { expectCompletion } from "./__helpers__/completion"; +import { MODES } from "../../constants"; describe.each([ { @@ -140,6 +140,13 @@ describe.each([ label: "object", template: '"object": {#{}}', }, + { + template: '"objectWithRef": {#{}}', + label: "objectWithRef", + detail: "", + info: "", + type: "property", + }, ], }, // this has regressed for json4 only for some reason @@ -560,6 +567,13 @@ describe.each([ label: "object", template: "object: #{}", }, + { + template: "objectWithRef: #{}", + label: "objectWithRef", + detail: "", + info: "", + type: "property", + }, ], }, { diff --git a/src/__tests__/json-hover.spec.ts b/src/features/__tests__/json-hover.spec.ts similarity index 79% rename from src/__tests__/json-hover.spec.ts rename to src/features/__tests__/json-hover.spec.ts index 04a3328..c952d04 100644 --- a/src/__tests__/json-hover.spec.ts +++ b/src/features/__tests__/json-hover.spec.ts @@ -4,14 +4,14 @@ expect.extend(matchers); import "vitest-dom/extend-expect"; import { JSONSchema7 } from "json-schema"; -import { FoundCursorData, JSONHover } from "../json-hover.js"; +import { FoundCursorData, JSONHover } from "../hover"; import { EditorView } from "@codemirror/view"; -import { testSchema, testSchema2 } from "./__fixtures__/schemas.js"; -import { Draft } from "json-schema-library"; -import { MODES } from "../constants.js"; -import { JSONMode } from "../types.js"; -import { getExtensions } from "./__helpers__/index.js"; +import { testSchema, testSchema2 } from "./__fixtures__/schemas"; +import { Draft, Draft07 } from "json-schema-library"; +import { MODES } from "../../constants"; +import { JSONMode } from "../../types"; +import { getExtensions } from "./__helpers__/index"; const getHoverData = ( jsonString: string, @@ -52,7 +52,10 @@ const getHoverTexts = async ( }); const hover = new JSONHover({ mode }); const data = hover.getDataForCursor(view, pos, 1) as FoundCursorData; - const hoverResult = hover.getHoverTexts(data, schema as Draft); + const hoverResult = hover.getHoverTexts( + data, + new Draft07({ schema: schema ?? testSchema }) + ); return hoverResult; }; @@ -133,6 +136,29 @@ describe("JSONHover#getHoverTexts", () => { typeInfo: "oneOf: `string`, `array`, or `boolean`", }, }, + { + name: "oneOf with refs", + mode: MODES.JSON, + doc: '{ "oneOfObject": }', + pos: 5, + schema: testSchema2, + expected: { + message: null, + typeInfo: + "oneOf: `#/definitions/fancyObject` or `#/definitions/fancyObject2`", + }, + }, + { + name: "single object with ref", + mode: MODES.JSON, + doc: '{ "objectWithRef": }', + pos: 5, + schema: testSchema2, + expected: { + message: null, + typeInfo: "object", + }, + }, ])( "should return hover texts as expected ($name, mode: $mode)", async ({ mode, doc, pos, schema, expected }) => { @@ -157,10 +183,11 @@ describe("JSONHover#doHover", () => { create: expect.any(Function), }, expectedHTMLContents: [ - [ - `
an elegant string
`, - `
string
`, - ].join(""), + `cm6-json-schema-hover--description`, + `

an elegant string

`, + `cm6-json-schema-hover--code-wrapper`, + `cm6-json-schema-hover--code`, + `

string

`, ], }, { @@ -179,7 +206,7 @@ describe("JSONHover#doHover", () => { expectedHTMLContents: [ "cm6-json-schema-hover--code-wrapper", "cm6-json-schema-hover--code", - "string", + "string

", ], }, ])( diff --git a/src/__tests__/json-validation.spec.ts b/src/features/__tests__/json-validation.spec.ts similarity index 96% rename from src/__tests__/json-validation.spec.ts rename to src/features/__tests__/json-validation.spec.ts index ad0e458..33d471d 100644 --- a/src/__tests__/json-validation.spec.ts +++ b/src/features/__tests__/json-validation.spec.ts @@ -1,13 +1,13 @@ import { JSONSchema7 } from "json-schema"; -import { JSONValidation } from "../json-validation"; +import { JSONValidation } from "../validation"; import type { Diagnostic } from "@codemirror/lint"; import { describe, it, expect } from "vitest"; import { EditorView } from "@codemirror/view"; -import { testSchema, testSchema2 } from "./__fixtures__/schemas.js"; -import { JSONMode } from "../types.js"; -import { getExtensions } from "./__helpers__/index.js"; -import { MODES } from "../constants.js"; +import { testSchema, testSchema2 } from "./__fixtures__/schemas"; +import { JSONMode } from "../../types"; +import { getExtensions } from "./__helpers__/index"; +import { MODES } from "../../constants"; const getErrors = ( jsonString: string, diff --git a/src/json-completion.ts b/src/features/completion.ts similarity index 98% rename from src/json-completion.ts rename to src/features/completion.ts index d3f142f..68552d9 100644 --- a/src/json-completion.ts +++ b/src/features/completion.ts @@ -7,7 +7,7 @@ import { import { syntaxTree } from "@codemirror/language"; import { SyntaxNode } from "@lezer/common"; import { JSONSchema7, JSONSchema7Definition } from "json-schema"; -import { debug } from "./utils/debug.js"; +import { debug } from "../utils/debug"; import { findNodeIndexInArrayNode, getChildValueNode, @@ -21,15 +21,16 @@ import { getMatchingChildNode, getChildrenNodes, surroundingDoubleQuotesToSingle, -} from "./utils/node.js"; -import { getJSONSchema } from "./state.js"; +} from "../utils/node"; +import { getJSONSchema } from "./state"; import { Draft07, isJsonError } from "json-schema-library"; import { jsonPointerForPosition, resolveTokenName, -} from "./utils/jsonPointers.js"; -import { MODES, TOKENS } from "./constants.js"; -import { JSONMode } from "./types.js"; +} from "../utils/json-pointers"; +import { MODES, TOKENS } from "../constants"; +import { JSONMode } from "../types"; +import { renderMarkdown } from "../utils/markdown"; class CompletionCollector { completions = new Map(); @@ -293,7 +294,7 @@ export class JSONCompletion { ), type: "property", detail: typeStr, - info: description, + info: renderMarkdown(description), }; collector.add(this.applySnippetCompletion(completion)); } diff --git a/src/json-hover.ts b/src/features/hover.ts similarity index 81% rename from src/json-hover.ts rename to src/features/hover.ts index 7db548c..fe76fb1 100644 --- a/src/json-hover.ts +++ b/src/features/hover.ts @@ -6,14 +6,15 @@ import { isJsonError, } from "json-schema-library"; -import { jsonPointerForPosition } from "./utils/jsonPointers.js"; -import { joinWithOr } from "./utils/formatting.js"; -import { debug } from "./utils/debug.js"; -import { JSONMode, Side } from "./types.js"; -import { el } from "./utils/dom.js"; -import { getJSONSchema } from "./state.js"; -import { MODES } from "./constants.js"; -import { renderMarkdown } from "./utils/markdown.js"; +import { jsonPointerForPosition } from "../utils/json-pointers"; +import { joinWithOr } from "../utils/formatting"; +import { debug } from "../utils/debug"; +import { JSONMode, Side } from "../types"; +import { el } from "../utils/dom"; +import { getJSONSchema } from "./state"; +import { MODES } from "../constants"; +import { renderMarkdown } from "../utils/markdown"; +import { JSONSchema7Type } from "json-schema"; export type CursorData = { schema?: JsonSchema; pointer: string }; @@ -49,14 +50,34 @@ export function jsonSchemaHover(options?: HoverOptions) { }; } +function formatType(data: { type?: JSONSchema7Type; $ref?: string }) { + if (data.type) { + if (data.$ref) { + return `${data.$ref} (${data.type})`; + } + return data.type; + } + if (data.$ref) { + return `${data.$ref}`; + } +} + function formatComplexType( schema: JsonSchema, - type: "oneOf" | "anyOf" | "allOf", + complexType: "oneOf" | "anyOf" | "allOf", draft: Draft ) { - return `${type}: ${joinWithOr( - schema[type].map((s: JsonSchema) => { - return s.type ?? draft.resolveRef(s).type; + return `${complexType}: ${joinWithOr( + schema[complexType].map((s: JsonSchema) => { + try { + const { data } = draft.resolveRef({ data: s, pointer: s.$ref }); + if (data) { + return formatType(data); + } + return formatType(s); + } catch (err) { + return s.type; + } }) )}`; } @@ -118,12 +139,12 @@ export class JSONHover { return el("div", { class: "cm6-json-schema-hover" }, [ el("div", { class: "cm6-json-schema-hover--description", - text: message, + inner: renderMarkdown(message, false), }), el("div", { class: "cm6-json-schema-hover--code-wrapper" }, [ el("div", { class: "cm6-json-schema-hover--code", - inner: renderMarkdown(typeInfo), + inner: renderMarkdown(typeInfo, false), }), ]), ]); @@ -132,7 +153,7 @@ export class JSONHover { el("div", { class: "cm6-json-schema-hover--code-wrapper" }, [ el("code", { class: "cm6-json-schema-hover--code", - inner: renderMarkdown(typeInfo), + inner: renderMarkdown(typeInfo, false), }), ]), ]); @@ -143,6 +164,7 @@ export class JSONHover { let message = null; const { schema } = data; + if (schema.oneOf) { typeInfo = formatComplexType(schema, "oneOf", draft); } @@ -152,11 +174,15 @@ export class JSONHover { if (schema.allOf) { typeInfo = formatComplexType(schema, "allOf", draft); } + if (schema.type) { typeInfo = Array.isArray(schema.type) ? joinWithOr(schema.type) : schema.type; } + if (schema.$ref) { + typeInfo = ` Reference: ${schema.$ref}`; + } if (schema.enum) { typeInfo = `\`enum\`: ${joinWithOr(schema.enum)}`; } @@ -166,6 +192,7 @@ export class JSONHover { if (schema.pattern) { typeInfo += `\`pattern\`: ${schema.pattern}`; } + if (schema.description) { message = schema.description; } diff --git a/src/state.ts b/src/features/state.ts similarity index 100% rename from src/state.ts rename to src/features/state.ts diff --git a/src/json-validation.ts b/src/features/validation.ts similarity index 89% rename from src/json-validation.ts rename to src/features/validation.ts index f8242c6..e2df704 100644 --- a/src/json-validation.ts +++ b/src/features/validation.ts @@ -2,16 +2,16 @@ import type { EditorView, ViewUpdate } from "@codemirror/view"; import { type Diagnostic } from "@codemirror/lint"; import { Draft04, type Draft, type JsonError } from "json-schema-library"; -import { getJSONSchema, schemaStateField } from "./state.js"; -import { joinWithOr } from "./utils/formatting.js"; -import { JSONMode, JSONPointerData } from "./types.js"; -import { parseJSONDocumentState } from "./utils/parseJSONDocument.js"; -import { RequiredPick } from "./types.js"; -import { el } from "./utils/dom.js"; -import { renderMarkdown } from "./utils/markdown.js"; -import { MODES } from "./constants.js"; -import { parseYAMLDocumentState } from "./utils/parse-yaml-document.js"; -import { parseJSON5DocumentState } from "./utils/parseJSON5Document.js"; +import { getJSONSchema, schemaStateField } from "./state"; +import { joinWithOr } from "../utils/formatting"; +import { JSONMode, JSONPointerData } from "../types"; +import { parseJSONDocumentState } from "../utils/parse-json-document"; +import { RequiredPick } from "../types"; +import { el } from "../utils/dom"; +import { renderMarkdown } from "../utils/markdown"; +import { MODES } from "../constants"; +import { parseYAMLDocumentState } from "../utils/parse-yaml-document"; +import { parseJSON5DocumentState } from "../utils/parse-json5-document"; const getDefaultParser = (mode: JSONMode): typeof parseJSONDocumentState => { switch (mode) { @@ -148,7 +148,7 @@ export class JSONValidation { source: this.schemaTitle, renderMessage: () => { const dom = el("div", {}); - dom.innerHTML = errorString; + dom.innerHTML = renderMarkdown(errorString); return dom; }, }); @@ -156,7 +156,7 @@ export class JSONValidation { const errorPath = getErrorPath(error); const pointer = json.pointers.get(errorPath) as JSONPointerData; if ( - error.name === "MaxPropertiesError" ?? + error.name === "MaxPropertiesError" || error.name === "MinPropertiesError" ) { pushRoot(); diff --git a/src/index.ts b/src/index.ts index 4648d9c..958ed09 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,27 +1,27 @@ -export { jsonCompletion } from "./json-completion.js"; +export { jsonCompletion } from "./features/completion"; export { jsonSchemaLinter, type JSONValidationOptions, handleRefresh, -} from "./json-validation.js"; +} from "./features/validation"; export { jsonSchemaHover, type HoverOptions, type FoundCursorData, type CursorData, -} from "./json-hover.js"; +} from "./features/hover"; -export { jsonSchema } from "./bundled.js"; +export { jsonSchema } from "./json/bundled"; export type { JSONPointersMap, JSONPointerData, JSONPartialPointerData, -} from "./types.js"; +} from "./types"; -export * from "./utils/parseJSONDocument.js"; -export * from "./utils/jsonPointers.js"; +export * from "./utils/parse-json-document"; +export * from "./utils/json-pointers"; -export * from "./state.js"; +export * from "./features/state"; diff --git a/src/bundled.ts b/src/json/bundled.ts similarity index 73% rename from src/bundled.ts rename to src/json/bundled.ts index e28bf4d..a1a29fa 100644 --- a/src/bundled.ts +++ b/src/json/bundled.ts @@ -1,10 +1,10 @@ import { JSONSchema7 } from "json-schema"; import { json, jsonLanguage, jsonParseLinter } from "@codemirror/lang-json"; import { hoverTooltip } from "@codemirror/view"; -import { jsonCompletion } from "./json-completion.js"; -import { handleRefresh, jsonSchemaLinter } from "./json-validation.js"; -import { jsonSchemaHover } from "./json-hover.js"; -import { stateExtensions } from "./state.js"; +import { jsonCompletion } from "../features/completion"; +import { handleRefresh, jsonSchemaLinter } from "../features/validation"; +import { jsonSchemaHover } from "../features/hover"; +import { stateExtensions } from "../features/state"; import { linter } from "@codemirror/lint"; diff --git a/src/json5/bundled.ts b/src/json5/bundled.ts index 67bcf44..b68942c 100644 --- a/src/json5/bundled.ts +++ b/src/json5/bundled.ts @@ -1,13 +1,13 @@ import { JSONSchema7 } from "json-schema"; import { json5, json5Language, json5ParseLinter } from "codemirror-json5"; import { hoverTooltip } from "@codemirror/view"; -import { json5Completion } from "./completion.js"; -import { json5SchemaLinter } from "./validation.js"; -import { json5SchemaHover } from "./hover.js"; +import { json5Completion } from "./completion"; +import { json5SchemaLinter } from "./validation"; +import { json5SchemaHover } from "./hover"; import { linter } from "@codemirror/lint"; -import { handleRefresh } from "../json-validation.js"; -import { stateExtensions } from "../state.js"; +import { handleRefresh } from "../features/validation"; +import { stateExtensions } from "../features/state"; /** * Full featured cm6 extension for json5, including `codemirror-json5` diff --git a/src/json5/completion.ts b/src/json5/completion.ts index cd78ec1..6ec40cd 100644 --- a/src/json5/completion.ts +++ b/src/json5/completion.ts @@ -1,6 +1,6 @@ import { CompletionContext } from "@codemirror/autocomplete"; import { MODES } from "../constants"; -import { JSONCompletion, JSONCompletionOptions } from "../json-completion"; +import { JSONCompletion, JSONCompletionOptions } from "../features/completion"; /** * provides a JSON schema enabled autocomplete extension for codemirror and json5 diff --git a/src/json5/hover.ts b/src/json5/hover.ts index 50022d4..80b33bb 100644 --- a/src/json5/hover.ts +++ b/src/json5/hover.ts @@ -1,8 +1,8 @@ import { type EditorView } from "@codemirror/view"; -import { type HoverOptions, JSONHover } from "../json-hover.js"; +import { type HoverOptions, JSONHover } from "../features/hover"; import json5 from "json5"; -import { Side } from "../types.js"; -import { MODES } from "../constants.js"; +import { Side } from "../types"; +import { MODES } from "../constants"; export type JSON5HoverOptions = Exclude; diff --git a/src/json5/index.ts b/src/json5/index.ts index 3a93718..39d3881 100644 --- a/src/json5/index.ts +++ b/src/json5/index.ts @@ -1,11 +1,11 @@ // json5 -export { json5SchemaLinter } from "./validation.js"; -export { json5SchemaHover } from "./hover.js"; -export { json5Completion } from "./completion.js"; +export { json5SchemaLinter } from "./validation"; +export { json5SchemaHover } from "./hover"; +export { json5Completion } from "./completion"; /** * @group Bundled Codemirror Extensions */ -export { json5Schema } from "./bundled.js"; +export { json5Schema } from "./bundled"; -export * from "../utils/parseJSON5Document.js"; +export * from "../utils/parse-json5-document"; diff --git a/src/json5/validation.ts b/src/json5/validation.ts index 1beb742..5250675 100644 --- a/src/json5/validation.ts +++ b/src/json5/validation.ts @@ -2,9 +2,9 @@ import { EditorView } from "@codemirror/view"; import { JSONValidation, type JSONValidationOptions, -} from "../json-validation.js"; -import { parseJSON5DocumentState } from "../utils/parseJSON5Document.js"; -import { MODES } from "../constants.js"; +} from "../features/validation"; +import { parseJSON5DocumentState } from "../utils/parse-json5-document"; +import { MODES } from "../constants"; /** * Instantiates a JSONValidation instance with the JSON5 mode diff --git a/src/utils/__tests__/jsonPointers.spec.ts b/src/utils/__tests__/json-pointers.spec.ts similarity index 98% rename from src/utils/__tests__/jsonPointers.spec.ts rename to src/utils/__tests__/json-pointers.spec.ts index c419149..c942adc 100644 --- a/src/utils/__tests__/jsonPointers.spec.ts +++ b/src/utils/__tests__/json-pointers.spec.ts @@ -1,9 +1,9 @@ import { describe, it, expect } from "vitest"; -import { getJsonPointers, jsonPointerForPosition } from "../jsonPointers.js"; +import { getJsonPointers, jsonPointerForPosition } from "../json-pointers"; import { EditorState } from "@codemirror/state"; -import { MODES } from "../../constants.js"; -import { getExtensions } from "../../__tests__/__helpers__/index.js"; +import { MODES } from "../../constants"; +import { getExtensions } from "../../features/__tests__/__helpers__/index"; describe("jsonPointerForPosition", () => { it.each([ diff --git a/src/utils/__tests__/node.spec.ts b/src/utils/__tests__/node.spec.ts index cd3edd3..2e4cc0d 100644 --- a/src/utils/__tests__/node.spec.ts +++ b/src/utils/__tests__/node.spec.ts @@ -3,7 +3,7 @@ import { JSONMode } from "../../types"; import { MODES } from "../../constants"; import { EditorState } from "@codemirror/state"; import { getNodeAtPosition } from "../node"; -import { getExtensions } from "../../__tests__/__helpers__"; +import { getExtensions } from "../../features/__tests__/__helpers__"; // complex data structure for testing. Keep these in sync. const testJsonData = ` diff --git a/src/utils/__tests__/parseJSONDocument.spec.ts b/src/utils/__tests__/parse-json-document.spec.ts similarity index 87% rename from src/utils/__tests__/parseJSONDocument.spec.ts rename to src/utils/__tests__/parse-json-document.spec.ts index f4f76e4..b4467a2 100644 --- a/src/utils/__tests__/parseJSONDocument.spec.ts +++ b/src/utils/__tests__/parse-json-document.spec.ts @@ -1,7 +1,7 @@ import { it, describe, expect } from "vitest"; -import { parseJSONDocument } from "../parseJSONDocument.js"; -import { parseJSON5Document } from "../parseJSON5Document.js"; +import { parseJSONDocument } from "../parse-json-document"; +import { parseJSON5Document } from "../parse-json5-document"; describe("parseJSONDocument", () => { it("should return a map of all pointers for a json4 document", () => { diff --git a/src/utils/__tests__/parse-yaml-document.spec.ts b/src/utils/__tests__/parse-yaml-document.spec.ts index ba41f50..8114508 100644 --- a/src/utils/__tests__/parse-yaml-document.spec.ts +++ b/src/utils/__tests__/parse-yaml-document.spec.ts @@ -1,7 +1,7 @@ import { it, describe, expect } from "vitest"; import { yaml } from "@codemirror/lang-yaml"; -import { parseYAMLDocumentState } from "../parse-yaml-document.js"; +import { parseYAMLDocumentState } from "../parse-yaml-document"; import { EditorState } from "@codemirror/state"; const testDoc = `--- diff --git a/src/utils/jsonPointers.ts b/src/utils/json-pointers.ts similarity index 96% rename from src/utils/jsonPointers.ts rename to src/utils/json-pointers.ts index ad8703f..155556b 100644 --- a/src/utils/jsonPointers.ts +++ b/src/utils/json-pointers.ts @@ -1,19 +1,19 @@ import { syntaxTree } from "@codemirror/language"; import { EditorState, Text } from "@codemirror/state"; import { SyntaxNode, SyntaxNodeRef } from "@lezer/common"; -import { JSONMode, JSONPointersMap, Side } from "../types.js"; +import { JSONMode, JSONPointersMap, Side } from "../types"; import { JSON5_TOKENS_MAPPING, MODES, TOKENS, YAML_TOKENS_MAPPING, -} from "../constants.js"; +} from "../constants"; import { findNodeIndexInArrayNode, getMatchingChildNode, getWord, isValueNode, -} from "./node.js"; +} from "./node"; export const resolveTokenName = (nodeName: string, mode: JSONMode) => { switch (mode) { diff --git a/src/utils/markdown.ts b/src/utils/markdown.ts index 01ea0a8..e523154 100644 --- a/src/utils/markdown.ts +++ b/src/utils/markdown.ts @@ -1,4 +1,42 @@ -import markdownit from "markdown-it"; -export function renderMarkdown(markdown: string) { - return markdownit().renderInline(markdown); +import md from "markdown-it"; +import shiki from "@shikijs/markdown-it"; + +// const defaultPlugins = [ +// "markdown-it-abbr", +// "markdown-it-deflist", +// "markdown-it-emoji", +// "markdown-it-footnote", +// "markdown-it-ins", +// "markdown-it-mark", +// "markdown-it-sub", +// "markdown-it-sup", +// "markdown-it-task-lists", +// "markdown-it-toc", +// "markdown-it-attrs", +// "markdown-it-katex", +// "markdown-it-external-links", +// "markdown-it-table-of-contents", +// "markdown-it-anchor", +// "markdown-it-implicit-figures", +// "markdown-it-video", +// "markdown-it-highlightjs", +// ]; + +const renderer = md({ + linkify: true, + typographer: true, +}); + +renderer.use( + await shiki({ + themes: { + light: "vitesse-light", + dark: "vitesse-dark", + }, + }) +); + +export function renderMarkdown(markdown: string, inline: boolean = true) { + if (!inline) return renderer.render(markdown); + return renderer.renderInline(markdown); } diff --git a/src/utils/node.ts b/src/utils/node.ts index 4081785..bac093f 100644 --- a/src/utils/node.ts +++ b/src/utils/node.ts @@ -1,9 +1,9 @@ import { SyntaxNode } from "@lezer/common"; -import { COMPLEX_TYPES, TOKENS, PRIMITIVE_TYPES, MODES } from "../constants.js"; +import { COMPLEX_TYPES, TOKENS, PRIMITIVE_TYPES, MODES } from "../constants"; import { EditorState, Text } from "@codemirror/state"; import { syntaxTree } from "@codemirror/language"; -import { JSONMode, Side } from "../types.js"; -import { resolveTokenName } from "./jsonPointers.js"; +import { JSONMode, Side } from "../types"; +import { resolveTokenName } from "./json-pointers"; export const getNodeAtPosition = ( state: EditorState, diff --git a/src/utils/parseJSONDocument.ts b/src/utils/parse-json-document.ts similarity index 89% rename from src/utils/parseJSONDocument.ts rename to src/utils/parse-json-document.ts index 1df0794..966676d 100644 --- a/src/utils/parseJSONDocument.ts +++ b/src/utils/parse-json-document.ts @@ -1,7 +1,7 @@ import { json } from "@codemirror/lang-json"; import { EditorState } from "@codemirror/state"; -import { getJsonPointers } from "./jsonPointers.js"; -import { MODES } from "../constants.js"; +import { getJsonPointers } from "./json-pointers"; +import { MODES } from "../constants"; /** * Return parsed data and json pointers for a given codemirror EditorState diff --git a/src/utils/parseJSON5Document.ts b/src/utils/parse-json5-document.ts similarity index 91% rename from src/utils/parseJSON5Document.ts rename to src/utils/parse-json5-document.ts index 89bd03f..787cd58 100644 --- a/src/utils/parseJSON5Document.ts +++ b/src/utils/parse-json5-document.ts @@ -5,8 +5,8 @@ import { json5 as json5mode } from "codemirror-json5"; import json5 from "json5"; import { EditorState } from "@codemirror/state"; -import { getJsonPointers } from "./jsonPointers.js"; -import { MODES } from "../constants.js"; +import { getJsonPointers } from "./json-pointers"; +import { MODES } from "../constants"; /** * Return parsed data and json5 pointers for a given codemirror EditorState diff --git a/src/utils/parse-yaml-document.ts b/src/utils/parse-yaml-document.ts index e6bc3d7..12f7d99 100644 --- a/src/utils/parse-yaml-document.ts +++ b/src/utils/parse-yaml-document.ts @@ -5,8 +5,8 @@ import { yaml } from "@codemirror/lang-yaml"; import YAML from "yaml"; import { EditorState } from "@codemirror/state"; -import { getJsonPointers } from "./jsonPointers.js"; -import { MODES } from "../constants.js"; +import { getJsonPointers } from "./json-pointers"; +import { MODES } from "../constants"; /** * Return parsed data and YAML pointers for a given codemirror EditorState diff --git a/src/yaml/bundled.ts b/src/yaml/bundled.ts index 558c5c7..a5d0d25 100644 --- a/src/yaml/bundled.ts +++ b/src/yaml/bundled.ts @@ -1,13 +1,13 @@ import { JSONSchema7 } from "json-schema"; import { yaml, yamlLanguage } from "@codemirror/lang-yaml"; import { hoverTooltip } from "@codemirror/view"; -import { handleRefresh } from "../json-validation.js"; -import { stateExtensions } from "../state.js"; +import { handleRefresh } from "../features/validation"; +import { stateExtensions } from "../features/state"; import { linter } from "@codemirror/lint"; -import { yamlSchemaLinter } from "./validation.js"; -import { yamlCompletion } from "./completion.js"; -import { yamlSchemaHover } from "./hover.js"; +import { yamlSchemaLinter } from "./validation"; +import { yamlCompletion } from "./completion"; +import { yamlSchemaHover } from "./hover"; /** * Full featured cm6 extension for json, including `@codemirror/lang-json` diff --git a/src/yaml/completion.ts b/src/yaml/completion.ts index b9ce9eb..dbf5a30 100644 --- a/src/yaml/completion.ts +++ b/src/yaml/completion.ts @@ -1,6 +1,6 @@ import { CompletionContext } from "@codemirror/autocomplete"; import { MODES } from "../constants"; -import { JSONCompletion, JSONCompletionOptions } from "../json-completion"; +import { JSONCompletion, JSONCompletionOptions } from "../features/completion"; /** * provides a JSON schema enabled autocomplete extension for codemirror and yaml diff --git a/src/yaml/hover.ts b/src/yaml/hover.ts index 08a84af..82dd476 100644 --- a/src/yaml/hover.ts +++ b/src/yaml/hover.ts @@ -1,8 +1,8 @@ import { type EditorView } from "@codemirror/view"; -import { type HoverOptions, JSONHover } from "../json-hover.js"; +import { type HoverOptions, JSONHover } from "../features/hover"; import YAML from "yaml"; -import { Side } from "../types.js"; -import { MODES } from "../constants.js"; +import { Side } from "../types"; +import { MODES } from "../constants"; export type YAMLHoverOptions = Exclude; diff --git a/src/yaml/index.ts b/src/yaml/index.ts index 74b1488..2906448 100644 --- a/src/yaml/index.ts +++ b/src/yaml/index.ts @@ -1,11 +1,11 @@ // yaml -export { yamlSchemaLinter } from "./validation.js"; -export { yamlSchemaHover } from "./hover.js"; -export { yamlCompletion } from "./completion.js"; +export { yamlSchemaLinter } from "./validation"; +export { yamlSchemaHover } from "./hover"; +export { yamlCompletion } from "./completion"; /** * @group Bundled Codemirror Extensions */ -export { yamlSchema } from "./bundled.js"; +export { yamlSchema } from "./bundled"; -export * from "../utils/parseJSON5Document.js"; +export * from "../utils/parse-yaml-document"; diff --git a/src/yaml/validation.ts b/src/yaml/validation.ts index f3ba0fa..1d44686 100644 --- a/src/yaml/validation.ts +++ b/src/yaml/validation.ts @@ -2,9 +2,9 @@ import { EditorView } from "@codemirror/view"; import { JSONValidation, type JSONValidationOptions, -} from "../json-validation.js"; -import { parseYAMLDocumentState } from "../utils/parse-yaml-document.js"; -import { MODES } from "../constants.js"; +} from "../features/validation"; +import { parseYAMLDocumentState } from "../utils/parse-yaml-document"; +import { MODES } from "../constants"; /** * Instantiates a JSONValidation instance with the YAML mode diff --git a/tsconfig.json b/tsconfig.json index c79c22b..b47307e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,24 @@ { "compilerOptions": { "target": "es2017", - "module": "ESNext", + "module": "ES2022", "outDir": "dist", "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "Node", + "moduleResolution": "Bundler", "lib": ["ESNext", "DOM"], "declaration": true, "resolveJsonModule": true, "removeComments": false, - "isolatedModules": true + "isolatedModules": true, + "typeRoots": ["./node_modules/@types", "./src/types"], + "paths": { + "@*": ["./src/*"] + }, + "baseUrl": "./" }, "compileOnSave": true, "include": ["src/**/*"], - "exclude": ["node_modules", "**/__tests__/**"] + "exclude": ["**/__tests__/**"] } diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..768f9ce --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "vite"; +import tsconfigPaths from "vite-tsconfig-paths"; + +export default defineConfig({ + plugins: [ + tsconfigPaths({ + ignoreConfigErrors: true, + }), + ], +});