Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror-json-schema - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

dist/constants.d.ts

6

CHANGELOG.md
# codemirror-json-schema
## 0.3.0
### Minor Changes
- d4cfe11: improve autocompletion with support for allOf, anyOf, oneOf
## 0.2.3

@@ -4,0 +10,0 @@

25

dist/json-completion.d.ts
import { CompletionContext, CompletionResult } from "@codemirror/autocomplete";
import { JSONSchema7 } from "json-schema";
export declare const TOKENS: {
STRING: string;
NUMBER: string;
TRUE: string;
FALSE: string;
NULL: string;
OBJECT: string;
ARRAY: string;
PROPERTY: string;
PROPERTY_NAME: string;
JSON_TEXT: string;
INVALID: string;
};
export declare const VALUE_TYPES: string[];
import { JsonError } from "json-schema-library";
export declare class JSONCompletion {

@@ -33,17 +20,9 @@ private schema;

private collectTypes;
private getArrayNodeChildren;
private findNodeIndexInArrayNode;
private getSchemas;
private getSchemasForNodes;
isJsonError(d: JSONSchema7 | JsonError): d is JsonError;
private expandSchemaProperty;
private getReferenceSchema;
private getWord;
private getChildrenNodes;
private getChildValueNode;
private isValueNode;
private isPropertyNameNode;
private getLabelForValue;
private getValueFromLabel;
private extendedRegExp;
private stripSurrondingQuotes;
}

@@ -50,0 +29,0 @@ /**

import { syntaxTree } from "@codemirror/language";
import { debug } from "./utils/debug";
export const TOKENS = {
STRING: "String",
NUMBER: "Number",
TRUE: "True",
FALSE: "False",
NULL: "Null",
OBJECT: "Object",
ARRAY: "Array",
PROPERTY: "Property",
PROPERTY_NAME: "PropertyName",
JSON_TEXT: "JsonText",
INVALID: "⚠",
};
export const VALUE_TYPES = [
TOKENS.STRING,
TOKENS.NUMBER,
TOKENS.TRUE,
TOKENS.FALSE,
TOKENS.NULL,
];
const COMPLEX_TYPES = [TOKENS.OBJECT, TOKENS.ARRAY];
import { findNodeIndexInArrayNode, getChildValueNode, getWord, isPropertyNameNode, isPrimitiveValueNode, stripSurrondingQuotes, } from "./utils/node";
import { Draft07 } from "json-schema-library";
import { jsonPointerForPosition } from "./utils/jsonPointers";
import { TOKENS } from "./constants";
import getSchema from "./utils/schema-lib/getSchema";
class CompletionCollector {

@@ -55,10 +39,11 @@ constructor() {

const prefix = ctx.state.sliceDoc(node.from, ctx.pos).replace(/^("|')/, "");
debug.log("xxx", "node", node, "prefix", prefix, "ctx", ctx);
// Only show completions if we are filling out a word or right after the starting quote, or if explicitly requested
if (!(this.isValueNode(node) || this.isPropertyNameNode(node)) &&
if (!(isPrimitiveValueNode(node) || isPropertyNameNode(node)) &&
!ctx.explicit) {
return result;
}
const currentWord = this.getWord(ctx.state.doc, node);
const currentWord = getWord(ctx.state.doc, node);
// Calculate overwrite range
if (node && (this.isValueNode(node) || this.isPropertyNameNode(node))) {
if (node && (isPrimitiveValueNode(node) || isPropertyNameNode(node))) {
result.from = node.from;

@@ -81,7 +66,12 @@ result.to = node.to;

let addValue = true;
if (this.isPropertyNameNode(node)) {
if (isPropertyNameNode(node)) {
const parent = node.parent;
if (parent) {
// get value node from parent
addValue = !this.getChildValueNode(parent);
const valueNode = getChildValueNode(parent);
addValue =
!valueNode ||
(valueNode.name === TOKENS.INVALID &&
valueNode.from - valueNode.to === 0);
debug.log("xxx", "addValue", addValue, getChildValueNode(parent), node);
// find object node

@@ -111,5 +101,5 @@ node =

// value proposals with schema
this.getValueCompletions(this.schema, ctx, node, types, collector);
this.getValueCompletions(this.schema, ctx, types, collector);
// handle filtering
result.options = Array.from(collector.completions.values()).filter((v) => this.stripSurrondingQuotes(v.label).startsWith(prefix));
result.options = Array.from(collector.completions.values()).filter((v) => stripSurrondingQuotes(v.label).startsWith(prefix));
debug.log("xxx", "result", result, "prefix", prefix, "collector.completions", collector.completions, "reservedKeys", collector.reservedKeys);

@@ -122,15 +112,19 @@ return result;

properties.forEach((p) => {
const key = this.getWord(ctx.state.doc, p.getChild(TOKENS.PROPERTY_NAME));
collector.reserve(this.stripSurrondingQuotes(key));
const key = getWord(ctx.state.doc, p.getChild(TOKENS.PROPERTY_NAME));
collector.reserve(stripSurrondingQuotes(key));
});
// TODO: Handle separatorAfter
// Get matching schemas
const schemas = this.getSchemas(schema, ctx);
const schemas = this.getSchemas(schema, ctx, true);
schemas.forEach((s) => {
if (typeof s !== "object") {
return;
}
const properties = s.properties;
if (properties) {
Object.entries(properties).forEach(([key, value]) => {
var _a, _b;
if (typeof value === "object") {
const description = value.description || "";
const type = value.type || "";
const description = (_a = value.description) !== null && _a !== void 0 ? _a : "";
const type = (_b = value.type) !== null && _b !== void 0 ? _b : "";
const typeStr = Array.isArray(type) ? type.toString() : type;

@@ -297,6 +291,7 @@ const completion = {

}
getValueCompletions(schema, ctx, node, types, collector) {
getValueCompletions(schema, ctx, types, collector) {
let node = syntaxTree(ctx.state).resolveInner(ctx.pos, -1);
let valueNode = null;
let parentKey = undefined;
if (node && this.isValueNode(node)) {
if (node && isPrimitiveValueNode(node)) {
valueNode = node;

@@ -312,6 +307,7 @@ node = node.parent;

if (keyNode) {
parentKey = this.getWord(ctx.state.doc, keyNode);
parentKey = getWord(ctx.state.doc, keyNode);
node = node.parent;
}
}
debug.log("xxx", "node", node, "parentKey", parentKey);
if (node && (parentKey !== undefined || node.name === TOKENS.ARRAY)) {

@@ -321,4 +317,5 @@ // Get matching schemas

for (const s of schemas) {
// TODO: Adding this temporarily while figuring out the parentKey !== undefined case
this.addSchemaValueCompletions(s, types, collector);
if (typeof s !== "object") {
return;
}
if (node.name === TOKENS.ARRAY && s.items) {

@@ -340,3 +337,3 @@ let c = collector;

// get index of next node in array
const foundIdx = this.findNodeIndexInArrayNode(node, valueNode);
const foundIdx = findNodeIndexInArrayNode(node, valueNode);
if (foundIdx >= 0) {

@@ -355,3 +352,2 @@ arrayIndex = foundIdx;

}
// TODO: Look into this -- doesn't work as expected. Need to somehow hold the parent schema and use that to get the property schema (required to also check additionalProperties)
if (parentKey !== undefined) {

@@ -492,69 +488,42 @@ let propertyMatched = false;

}
getArrayNodeChildren(node) {
return this.getChildrenNodes(node).filter((n) => VALUE_TYPES.includes(n.name) || COMPLEX_TYPES.includes(n.name));
}
findNodeIndexInArrayNode(arrayNode, valueNode) {
return this.getArrayNodeChildren(arrayNode).findIndex((nd) => nd.from === valueNode.from && nd.to === valueNode.to);
}
getSchemas(schema, ctx) {
let node = syntaxTree(ctx.state).resolveInner(ctx.pos, -1);
if (!node) {
getSchemas(schema, ctx, forValue = false) {
const originalPointer = jsonPointerForPosition(ctx.state, ctx.pos);
// since we are providing completion for property names, we need to get the parent schema. so strip the last part of the pointer
const pointer = forValue
? originalPointer
: originalPointer.replace(/\/[^/]*$/, "/");
debug.log("xxx", "pointer..", JSON.stringify(pointer), "originalPointer", JSON.stringify(originalPointer));
// For some reason, it returns undefined schema for the root pointer
if (!pointer || pointer === "/") {
return [schema];
}
const draft = new Draft07(this.schema);
// const subSchema = new Draft07(this.schema).getSchema(pointer);
const subSchema = getSchema(draft, pointer);
debug.log("xxx", "subSchema..", subSchema);
if (this.isJsonError(subSchema)) {
return [];
}
const nodes = [node];
while (node.parent) {
nodes.push(node.parent);
node = node.parent;
if (Array.isArray(subSchema.allOf)) {
return [
subSchema,
...subSchema.allOf.map((s) => this.expandSchemaProperty(s, schema)),
];
}
debug.log("xxxn", "nodes", nodes.map((n) => n.name), nodes);
const reverseNodes = [...nodes].reverse();
return this.getSchemasForNodes(reverseNodes, schema, ctx);
if (Array.isArray(subSchema.oneOf)) {
return [
subSchema,
...subSchema.oneOf.map((s) => this.expandSchemaProperty(s, schema)),
];
}
if (Array.isArray(subSchema.anyOf)) {
return [
subSchema,
...subSchema.anyOf.map((s) => this.expandSchemaProperty(s, schema)),
];
}
return [subSchema];
}
getSchemasForNodes(
// nodes are from the root to the current node
nodes, schema, ctx) {
let curSchema = schema;
nodes.forEach((n, idx) => {
var _a;
switch (n.name) {
case TOKENS.JSON_TEXT:
curSchema = schema;
return;
case TOKENS.ARRAY: {
if (typeof curSchema === "object") {
const nextNodey = nodes[idx + 1];
let arrayIndex = 0;
if (nextNodey) {
// get index of next node in array
const foundIdx = this.getArrayNodeChildren(n).findIndex((nd) => nd.from === nextNodey.from && nd.to === nextNodey.to);
if (foundIdx >= 0) {
arrayIndex = foundIdx;
}
}
const itemSchema = Array.isArray(curSchema.items)
? curSchema.items[arrayIndex]
: curSchema.items;
if (itemSchema) {
curSchema = itemSchema;
}
}
return;
}
case TOKENS.PROPERTY: {
const propertyNameNode = n.getChild(TOKENS.PROPERTY_NAME);
if (propertyNameNode) {
const propertyName = this.getWord(ctx.state.doc, propertyNameNode);
if (typeof curSchema === "object") {
const propertySchema = (_a = curSchema.properties) === null || _a === void 0 ? void 0 : _a[propertyName];
if (propertySchema) {
curSchema = this.expandSchemaProperty(propertySchema, schema);
}
}
}
return;
}
}
});
debug.log("xxxn", "curSchema", curSchema);
return [curSchema];
isJsonError(d) {
return d.type === "error";
}

@@ -589,32 +558,2 @@ expandSchemaProperty(property, schema) {

}
getWord(doc, node, stripQuotes = true) {
const word = node ? doc.sliceString(node.from, node.to) : "";
return stripQuotes ? this.stripSurrondingQuotes(word) : word;
}
getChildrenNodes(node) {
const children = [];
let child = node.firstChild;
while (child) {
if (child) {
children.push(child);
}
child = child === null || child === void 0 ? void 0 : child.nextSibling;
}
return children;
}
getChildValueNode(node) {
return this.getChildrenNodes(node).find((n) => this.isValueNode(n));
}
isValueNode(node) {
var _a;
return (VALUE_TYPES.includes(node.name) ||
(node.name === TOKENS.INVALID &&
((_a = node.prevSibling) === null || _a === void 0 ? void 0 : _a.name) === TOKENS.PROPERTY_NAME));
}
isPropertyNameNode(node) {
var _a;
return (node.name === TOKENS.PROPERTY_NAME ||
(node.name === TOKENS.INVALID &&
((_a = node.prevSibling) === null || _a === void 0 ? void 0 : _a.name) === TOKENS.PROPERTY));
}
getLabelForValue(value) {

@@ -646,5 +585,2 @@ return JSON.stringify(value);

}
stripSurrondingQuotes(str) {
return str.replace(/^"(.*)"$/, "$1").replace(/^'(.*)'$/, "$1");
}
}

@@ -651,0 +587,0 @@ /**

import { type EditorView, Tooltip } from "@codemirror/view";
import { type Draft, JsonSchema } from "json-schema-library";
import type { JSONSchema7 } from "json-schema";
import { JSONMode } from "./utils/jsonPointers";
import { Side } from "./types";

@@ -16,3 +15,2 @@ export type CursorData = {

export type HoverOptions = {
mode?: JSONMode;
/**

@@ -19,0 +17,0 @@ * Generate the text to display in the hover tooltip

@@ -30,4 +30,3 @@ import { Draft04 } from "json-schema-library";

getDataForCursor(view, pos, side) {
var _a;
const pointer = jsonPointerForPosition(view.state, pos, side, (_a = this.opts) === null || _a === void 0 ? void 0 : _a.mode);
const pointer = jsonPointerForPosition(view.state, pos, side);
let data = undefined;

@@ -38,3 +37,3 @@ // TODO: use the AST tree to return the right hand, data so that we don't have to parse the doc

}
catch (_b) { }
catch (_a) { }
if (!pointer) {

@@ -41,0 +40,0 @@ return null;

@@ -8,3 +8,3 @@ import { JSONHover } from "./json-hover";

export function json5SchemaHover(schema, options) {
const hover = new JSONHover(schema, Object.assign(Object.assign({}, options), { mode: "json5", parser: json5.parse }));
const hover = new JSONHover(schema, Object.assign(Object.assign({}, options), { parser: json5.parse }));
return async function jsonDoHover(view, pos, side) {

@@ -11,0 +11,0 @@ return hover.doHover(view, pos, side);

export const debug = {
log: (...args) => {
if ("production" === "production") {
return;
}
console.log(...args);
},
};

@@ -5,16 +5,8 @@ import { EditorState, Text } from "@codemirror/state";

export type JSONMode = "json4" | "json5";
export declare function getJsonPointerAt(docText: Text, node: SyntaxNode): string;
/**
* get a JSON4/5 pointer for a given node in the editor
*
* adapted from https://discuss.codemirror.net/t/json-pointer-at-cursor-seeking-implementation-critique/4793/3
* this could be useful for other things later!
* @group Utilities
* @internal
*/
export declare function getJsonPointerAt(docText: Text, node: SyntaxNode, mode?: JSONMode): string;
/**
* retrieve a JSON pointer for a given position in the editor
* @group Utilities
*/
export declare const jsonPointerForPosition: (state: EditorState, pos: number, side: Side, mode?: JSONMode) => string;
export declare const jsonPointerForPosition: (state: EditorState, pos: number, side?: Side) => string;
/**

@@ -21,0 +13,0 @@ * retrieve a Map of all the json pointers in a document

import { syntaxTree } from "@codemirror/language";
const VAL_NODE_NAME = /^(?:Null|True|False|Object|Array|String|Number)$/;
// borrowed from `codemirror-json5`
// TODO: determine from spec if {"prop'name": example} is valid in json5
// JSON5 parse doesn't support parsing individual strings like JSON.parse does
function json5PropNameParser(s) {
if (s.length < 2)
return s;
let first = s[0];
let last = s[s.length - 1];
if ((first === `'` && last === `'`) || (first === `"` && last === `"`)) {
s = s.slice(1, -1);
}
return s;
}
const propNameParsers = {
json4: JSON.parse,
json5: json5PropNameParser,
};
/**
* get a JSON4/5 pointer for a given node in the editor
*
* adapted from https://discuss.codemirror.net/t/json-pointer-at-cursor-seeking-implementation-critique/4793/3
* this could be useful for other things later!
* @group Utilities
* @internal
*/
export function getJsonPointerAt(docText, node, mode = "json4") {
import { TOKENS } from "../constants";
import { findNodeIndexInArrayNode, getWord, isValueNode } from "./node";
// adapted from https://discuss.codemirror.net/t/json-pointer-at-cursor-seeking-implementation-critique/4793/3
// this could be useful for other things later!
export function getJsonPointerAt(docText, node) {
const path = [];
// retrieve a simple parser for parsing the property name
const parse = propNameParsers[mode];
for (let n = node; n && n.parent; n = n.parent) {
for (let n = node; n === null || n === void 0 ? void 0 : n.parent; n = n.parent) {
switch (n.parent.name) {
case "Property": {
const name = n.parent.getChild("PropertyName");
case TOKENS.PROPERTY: {
const name = n.parent.getChild(TOKENS.PROPERTY_NAME);
if (name) {
path.unshift(parse(docText.sliceString(name.from, name.to)).replace(/[\/~]/g, (v) => (v === "~" ? "~0" : "~1")));
path.unshift(getWord(docText, name).replace(/[/~]/g, (v) => v === "~" ? "~0" : "~1"));
}
break;
}
case "Array": {
if (VAL_NODE_NAME.test(n.name)) {
let index = 0;
for (let s = n.prevSibling; s; s = s.prevSibling) {
if (VAL_NODE_NAME.test(s.name)) {
index++;
}
}
path.unshift("" + index);
case TOKENS.ARRAY: {
if (isValueNode(n)) {
const index = findNodeIndexInArrayNode(n.parent, n);
path.unshift(`${index}`);
}

@@ -62,4 +33,4 @@ break;

*/
export const jsonPointerForPosition = (state, pos, side, mode = "json4") => {
return getJsonPointerAt(state.doc, syntaxTree(state).resolve(pos, side), mode);
export const jsonPointerForPosition = (state, pos, side = -1) => {
return getJsonPointerAt(state.doc, syntaxTree(state).resolve(pos, side));
};

@@ -77,3 +48,3 @@ /**

if (type.name === "PropertyName") {
const pointer = getJsonPointerAt(state.doc, type.node, mode);
const pointer = getJsonPointerAt(state.doc, type.node);
const { from: keyFrom, to: keyTo } = type.node;

@@ -80,0 +51,0 @@ // if there's no value, we can't get the valueFrom/to

@@ -15,3 +15,2 @@ [codemirror-json-schema](../README.md) / index

- [getJsonPointerAt](index.md#getjsonpointerat)
- [getJsonPointers](index.md#getjsonpointers)

@@ -22,2 +21,6 @@ - [jsonPointerForPosition](index.md#jsonpointerforposition)

### Functions
- [getJsonPointerAt](index.md#getjsonpointerat)
### Type Aliases

@@ -66,3 +69,3 @@

[json-completion.ts:820](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-completion.ts#L820)
[json-completion.ts:749](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-completion.ts#L749)

@@ -104,3 +107,3 @@ ---

[json-hover.ts:39](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-hover.ts#L39)
[json-hover.ts:38](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-hover.ts#L38)

@@ -140,33 +143,6 @@ ---

[json-validation.ts:35](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-validation.ts#L35)
[json-validation.ts:35](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-validation.ts#L35)
## Utilities
### getJsonPointerAt
▸ **getJsonPointerAt**(`docText`, `node`, `mode?`): `string`
get a JSON4/5 pointer for a given node in the editor
adapted from https://discuss.codemirror.net/t/json-pointer-at-cursor-seeking-implementation-critique/4793/3
this could be useful for other things later!
#### Parameters
| Name | Type | Default value |
| :-------- | :------------------------------ | :------------ |
| `docText` | `Text` | `undefined` |
| `node` | `SyntaxNode` | `undefined` |
| `mode` | [`JSONMode`](index.md#jsonmode) | `"json4"` |
#### Returns
`string`
#### Defined in
[utils/jsonPointers.ts:37](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/jsonPointers.ts#L37)
---
### getJsonPointers

@@ -191,3 +167,3 @@

[utils/jsonPointers.ts:98](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/jsonPointers.ts#L98)
[utils/jsonPointers.ts:56](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/jsonPointers.ts#L56)

@@ -198,3 +174,3 @@ ---

▸ **jsonPointerForPosition**(`state`, `pos`, `side`, `mode?`): `string`
▸ **jsonPointerForPosition**(`state`, `pos`, `side?`): `string`

@@ -205,8 +181,7 @@ retrieve a JSON pointer for a given position in the editor

| Name | Type | Default value |
| :------ | :------------------------------ | :------------ |
| `state` | `EditorState` | `undefined` |
| `pos` | `number` | `undefined` |
| `side` | `Side` | `undefined` |
| `mode` | [`JSONMode`](index.md#jsonmode) | `"json4"` |
| Name | Type | Default value |
| :------ | :------------ | :------------ |
| `state` | `EditorState` | `undefined` |
| `pos` | `number` | `undefined` |
| `side` | `Side` | `-1` |

@@ -219,3 +194,3 @@ #### Returns

[utils/jsonPointers.ts:81](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/jsonPointers.ts#L81)
[utils/jsonPointers.ts:44](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/jsonPointers.ts#L44)

@@ -247,3 +222,3 @@ ---

[utils/parseJSONDocument.ts:23](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/parseJSONDocument.ts#L23)
[utils/parseJSONDocument.ts:23](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/parseJSONDocument.ts#L23)

@@ -275,4 +250,25 @@ ---

[utils/parseJSONDocument.ts:9](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/parseJSONDocument.ts#L9)
[utils/parseJSONDocument.ts:9](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/parseJSONDocument.ts#L9)
## Functions
### getJsonPointerAt
▸ **getJsonPointerAt**(`docText`, `node`): `string`
#### Parameters
| Name | Type |
| :-------- | :----------- |
| `docText` | `Text` |
| `node` | `SyntaxNode` |
#### Returns
`string`
#### Defined in
[utils/jsonPointers.ts:12](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/jsonPointers.ts#L12)
## Type Aliases

@@ -293,3 +289,3 @@

[json-hover.ts:12](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-hover.ts#L12)
[json-hover.ts:12](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-hover.ts#L12)

@@ -304,3 +300,3 @@ ---

[json-hover.ts:14](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-hover.ts#L14)
[json-hover.ts:14](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-hover.ts#L14)

@@ -319,3 +315,2 @@ ---

| `getHoverTexts?` | (`data`: [`FoundCursorData`](index.md#foundcursordata)) => `HoverTexts` |
| `mode?` | [`JSONMode`](index.md#jsonmode) |
| `parser?` | (`text`: `string`) => `any` |

@@ -325,3 +320,3 @@

[json-hover.ts:18](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-hover.ts#L18)
[json-hover.ts:18](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-hover.ts#L18)

@@ -336,3 +331,3 @@ ---

[utils/jsonPointers.ts:8](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/jsonPointers.ts#L8)
[utils/jsonPointers.ts:8](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/jsonPointers.ts#L8)

@@ -354,3 +349,3 @@ ---

[types.ts:4](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/types.ts#L4)
[types.ts:4](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/types.ts#L4)

@@ -374,3 +369,3 @@ ---

[types.ts:9](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/types.ts#L9)
[types.ts:9](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/types.ts#L9)

@@ -385,3 +380,3 @@ ---

[types.ts:18](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/types.ts#L18)
[types.ts:18](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/types.ts#L18)

@@ -403,2 +398,2 @@ ---

[json-validation.ts:24](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json-validation.ts#L24)
[json-validation.ts:24](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json-validation.ts#L24)

@@ -52,3 +52,3 @@ [codemirror-json-schema](../README.md) / json5

[json5-hover.ts:13](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json5-hover.ts#L13)
[json5-hover.ts:13](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json5-hover.ts#L13)

@@ -88,3 +88,3 @@ ---

[json5-validation.ts:10](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/json5-validation.ts#L10)
[json5-validation.ts:10](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/json5-validation.ts#L10)

@@ -116,3 +116,3 @@ ## Utilities

[utils/parseJSON5Document.ts:28](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/parseJSON5Document.ts#L28)
[utils/parseJSON5Document.ts:28](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/parseJSON5Document.ts#L28)

@@ -144,2 +144,2 @@ ---

[utils/parseJSON5Document.ts:14](https://github.com/acao/codemirror-json-schema/blob/0bbe122/src/utils/parseJSON5Document.ts#L14)
[utils/parseJSON5Document.ts:14](https://github.com/acao/codemirror-json-schema/blob/fcb9042/src/utils/parseJSON5Document.ts#L14)
{
"name": "codemirror-json-schema",
"license": "MIT",
"version": "0.2.3",
"version": "0.3.0",
"description": "A JSONSchema enabled mode for codemirror 6, for both json4 and json5, inspired by monaco-json",

@@ -50,2 +50,3 @@ "contributors": [

"@types/json-schema": "^7.0.12",
"@types/node": "^20.4.2",
"json-schema": "^0.2.3",

@@ -86,10 +87,12 @@ "json-schema-library": "^8.0.0"

"dev": "vite ./dev --port 3000",
"build": "tsc && vite build ./dev --outDir ../public --emptyOutDir && pnpm typedoc",
"build": "pnpm tsc && vite build ./dev --outDir ../public --emptyOutDir && pnpm typedoc",
"test": "vitest --dom",
"test:coverage": "vitest run --dom --coverage",
"tsc": "tsc && pnpm replace:env",
"version-packages": "changeset version && 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/**/*",
"prettier:write": "prettier --ignore-path .gitignore --write"
"prettier:write": "prettier --ignore-path .gitignore --write",
"replace:env": "sh scripts/replace-env.sh"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc