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.5.1-canary to 0.5.1-canary.0

cjs/state.d.ts

2

cjs/bundled.d.ts

@@ -6,2 +6,2 @@ import { JSONSchema7 } from "json-schema";

*/
export declare function jsonSchema(schema: JSONSchema7): import("@codemirror/state").Extension[];
export declare function jsonSchema(schema?: JSONSchema7): import("@codemirror/state").Extension[];

@@ -6,5 +6,6 @@ "use strict";

const view_1 = require("@codemirror/view");
const json_completion_1 = require("./json-completion");
const json_validation_1 = require("./json-validation");
const json_hover_1 = require("./json-hover");
const json_completion_js_1 = require("./json-completion.js");
const json_validation_js_1 = require("./json-validation.js");
const json_hover_js_1 = require("./json-hover.js");
const state_js_1 = require("./state.js");
const lint_1 = require("@codemirror/lint");

@@ -19,9 +20,12 @@ /**

(0, lint_1.linter)((0, lang_json_1.jsonParseLinter)()),
(0, lint_1.linter)((0, json_validation_1.jsonSchemaLinter)(schema)),
(0, lint_1.linter)((0, json_validation_js_1.jsonSchemaLinter)(), {
needsRefresh: json_validation_js_1.handleRefresh,
}),
lang_json_1.jsonLanguage.data.of({
autocomplete: (0, json_completion_1.jsonCompletion)(schema),
autocomplete: (0, json_completion_js_1.jsonCompletion)(),
}),
(0, view_1.hoverTooltip)((0, json_hover_1.jsonSchemaHover)(schema)),
(0, view_1.hoverTooltip)((0, json_hover_js_1.jsonSchemaHover)()),
(0, state_js_1.stateExtensions)(schema),
];
}
exports.jsonSchema = jsonSchema;

@@ -1,7 +0,8 @@

export { jsonCompletion } from "./json-completion";
export { jsonSchemaLinter, type JSONValidationOptions, } from "./json-validation";
export { jsonSchemaHover, type HoverOptions, type FoundCursorData, type CursorData, } from "./json-hover";
export { jsonSchema } from "./bundled";
export type { JSONPointersMap, JSONPointerData, JSONPartialPointerData, } from "./types";
export * from "./utils/parseJSONDocument";
export * from "./utils/jsonPointers";
export { jsonCompletion } from "./json-completion.js";
export { jsonSchemaLinter, type JSONValidationOptions, } from "./json-validation.js";
export { jsonSchemaHover, type HoverOptions, type FoundCursorData, type CursorData, } from "./json-hover.js";
export { jsonSchema } from "./bundled.js";
export type { JSONPointersMap, JSONPointerData, JSONPartialPointerData, } from "./types.js";
export * from "./utils/parseJSONDocument.js";
export * from "./utils/jsonPointers.js";
export * from "./state.js";

@@ -18,11 +18,12 @@ "use strict";

exports.jsonSchema = exports.jsonSchemaHover = exports.jsonSchemaLinter = exports.jsonCompletion = void 0;
var json_completion_1 = require("./json-completion");
Object.defineProperty(exports, "jsonCompletion", { enumerable: true, get: function () { return json_completion_1.jsonCompletion; } });
var json_validation_1 = require("./json-validation");
Object.defineProperty(exports, "jsonSchemaLinter", { enumerable: true, get: function () { return json_validation_1.jsonSchemaLinter; } });
var json_hover_1 = require("./json-hover");
Object.defineProperty(exports, "jsonSchemaHover", { enumerable: true, get: function () { return json_hover_1.jsonSchemaHover; } });
var bundled_1 = require("./bundled");
Object.defineProperty(exports, "jsonSchema", { enumerable: true, get: function () { return bundled_1.jsonSchema; } });
__exportStar(require("./utils/parseJSONDocument"), exports);
__exportStar(require("./utils/jsonPointers"), exports);
var json_completion_js_1 = require("./json-completion.js");
Object.defineProperty(exports, "jsonCompletion", { enumerable: true, get: function () { return json_completion_js_1.jsonCompletion; } });
var json_validation_js_1 = require("./json-validation.js");
Object.defineProperty(exports, "jsonSchemaLinter", { enumerable: true, get: function () { return json_validation_js_1.jsonSchemaLinter; } });
var json_hover_js_1 = require("./json-hover.js");
Object.defineProperty(exports, "jsonSchemaHover", { enumerable: true, get: function () { return json_hover_js_1.jsonSchemaHover; } });
var bundled_js_1 = require("./bundled.js");
Object.defineProperty(exports, "jsonSchema", { enumerable: true, get: function () { return bundled_js_1.jsonSchema; } });
__exportStar(require("./utils/parseJSONDocument.js"), exports);
__exportStar(require("./utils/jsonPointers.js"), exports);
__exportStar(require("./state.js"), exports);
import { CompletionContext, CompletionResult } from "@codemirror/autocomplete";
import { JSONSchema7 } from "json-schema";
import { JsonError } from "json-schema-library";
type JSONCompletionOptions = {

@@ -8,6 +6,6 @@ mode?: "json" | "json5";

export declare class JSONCompletion {
private opts;
private schema;
private opts;
constructor(schema: JSONSchema7, opts: JSONCompletionOptions);
doComplete(ctx: CompletionContext): CompletionResult;
constructor(opts: JSONCompletionOptions);
doComplete(ctx: CompletionContext): CompletionResult | never[];
private applySnippetCompletion;

@@ -27,3 +25,2 @@ private getPropertyCompletions;

private getSchemas;
isJsonError(d: JSONSchema7 | JsonError): d is JsonError;
private expandSchemaProperty;

@@ -39,3 +36,3 @@ private getReferenceSchema;

*/
export declare function jsonCompletion(schema: JSONSchema7, opts?: JSONCompletionOptions): (ctx: CompletionContext) => CompletionResult;
export declare function jsonCompletion(opts?: JSONCompletionOptions): (ctx: CompletionContext) => CompletionResult | never[];
/**

@@ -45,3 +42,3 @@ * provides a JSON schema enabled autocomplete extension for codemirror and json5

*/
export declare function json5Completion(schema: JSONSchema7, opts?: Omit<JSONCompletionOptions, "mode">): (ctx: CompletionContext) => CompletionResult;
export declare function json5Completion(opts?: Omit<JSONCompletionOptions, "mode">): (ctx: CompletionContext) => CompletionResult | never[];
export {};
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -9,8 +6,8 @@ exports.json5Completion = exports.jsonCompletion = exports.JSONCompletion = void 0;

const language_1 = require("@codemirror/language");
const debug_1 = require("./utils/debug");
const node_1 = require("./utils/node");
const debug_js_1 = require("./utils/debug.js");
const node_js_1 = require("./utils/node.js");
const state_js_1 = require("./state.js");
const json_schema_library_1 = require("json-schema-library");
const jsonPointers_1 = require("./utils/jsonPointers");
const constants_1 = require("./constants");
const getSchema_1 = __importDefault(require("./utils/schema-lib/getSchema"));
const jsonPointers_js_1 = require("./utils/jsonPointers.js");
const constants_js_1 = require("./constants.js");
function json5PropertyInsertSnippet(rawWord, value) {

@@ -41,8 +38,14 @@ if (rawWord.startsWith('"')) {

class JSONCompletion {
constructor(schema, opts) {
this.schema = schema;
constructor(opts) {
this.opts = opts;
this.schema = null;
}
doComplete(ctx) {
var _a, _b;
this.schema = (0, state_js_1.getJSONSchema)(ctx.state);
if (!this.schema) {
// todo: should we even do anything without schema
// without taking over the existing mode responsibilties?
return [];
}
const result = {

@@ -55,15 +58,15 @@ from: ctx.pos,

const text = ctx.state.doc.sliceString(0);
let node = (0, node_1.getNodeAtPosition)(ctx.state, ctx.pos);
let node = (0, node_js_1.getNodeAtPosition)(ctx.state, ctx.pos);
// position node word prefix (without quotes) for matching
const prefix = ctx.state.sliceDoc(node.from, ctx.pos).replace(/^("|')/, "");
debug_1.debug.log("xxx", "node", node, "prefix", prefix, "ctx", ctx);
debug_js_1.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 (!((0, node_1.isPrimitiveValueNode)(node) || (0, node_1.isPropertyNameNode)(node)) &&
if (!((0, node_js_1.isPrimitiveValueNode)(node) || (0, node_js_1.isPropertyNameNode)(node)) &&
!ctx.explicit) {
return result;
}
const currentWord = (0, node_1.getWord)(ctx.state.doc, node);
const rawWord = (0, node_1.getWord)(ctx.state.doc, node, false);
const currentWord = (0, node_js_1.getWord)(ctx.state.doc, node);
const rawWord = (0, node_js_1.getWord)(ctx.state.doc, node, false);
// Calculate overwrite range
if (node && ((0, node_1.isPrimitiveValueNode)(node) || (0, node_1.isPropertyNameNode)(node))) {
if (node && ((0, node_js_1.isPrimitiveValueNode)(node) || (0, node_js_1.isPropertyNameNode)(node))) {
result.from = node.from;

@@ -75,5 +78,5 @@ result.to = node.to;

const overwriteStart = ctx.pos - currentWord.length;
debug_1.debug.log("xxx", "overwriteStart after", overwriteStart, "ctx.pos", ctx.pos, "word", word, "currentWord", currentWord, "=>", text[overwriteStart - 1], "..", text[overwriteStart], "..", text);
debug_js_1.debug.log("xxx", "overwriteStart after", overwriteStart, "ctx.pos", ctx.pos, "word", word, "currentWord", currentWord, "=>", text[overwriteStart - 1], "..", text[overwriteStart], "..", text);
result.from =
node.name === constants_1.TOKENS.INVALID ? (_a = word === null || word === void 0 ? void 0 : word.from) !== null && _a !== void 0 ? _a : ctx.pos : overwriteStart;
node.name === constants_js_1.TOKENS.INVALID ? (_a = word === null || word === void 0 ? void 0 : word.from) !== null && _a !== void 0 ? _a : ctx.pos : overwriteStart;
result.to = ctx.pos;

@@ -83,16 +86,16 @@ }

let addValue = true;
if ((0, node_1.isPropertyNameNode)(node)) {
if ((0, node_js_1.isPropertyNameNode)(node)) {
const parent = node.parent;
if (parent) {
// get value node from parent
const valueNode = (0, node_1.getChildValueNode)(parent);
const valueNode = (0, node_js_1.getChildValueNode)(parent);
addValue =
!valueNode ||
(valueNode.name === constants_1.TOKENS.INVALID &&
(valueNode.name === constants_js_1.TOKENS.INVALID &&
valueNode.from - valueNode.to === 0);
debug_1.debug.log("xxx", "addValue", addValue, (0, node_1.getChildValueNode)(parent), node);
debug_js_1.debug.log("xxx", "addValue", addValue, (0, node_js_1.getChildValueNode)(parent), node);
// find object node
node =
(_b = [parent, parent.parent].find((p) => {
if ((p === null || p === void 0 ? void 0 : p.name) === constants_1.TOKENS.OBJECT) {
if ((p === null || p === void 0 ? void 0 : p.name) === constants_js_1.TOKENS.OBJECT) {
return true;

@@ -104,7 +107,7 @@ }

}
debug_1.debug.log("xxx", node, currentWord, ctx);
debug_js_1.debug.log("xxx", node, currentWord, ctx);
// proposals for properties
if (node &&
(node.name === constants_1.TOKENS.OBJECT || node.name === constants_1.TOKENS.JSON_TEXT) &&
(0, node_1.isPropertyNameNode)((0, node_1.getNodeAtPosition)(ctx.state, ctx.pos))) {
(node.name === constants_js_1.TOKENS.OBJECT || node.name === constants_js_1.TOKENS.JSON_TEXT) &&
(0, node_js_1.isPropertyNameNode)((0, node_js_1.getNodeAtPosition)(ctx.state, ctx.pos))) {
// don't suggest keys when the cursor is just before the opening curly brace

@@ -124,4 +127,4 @@ if (node.from === ctx.pos) {

// handle filtering
result.options = Array.from(collector.completions.values()).filter((v) => (0, node_1.stripSurroundingQuotes)(v.label).startsWith(prefix));
debug_1.debug.log("xxx", "result", result, "prefix", prefix, "collector.completions", collector.completions, "reservedKeys", collector.reservedKeys);
result.options = Array.from(collector.completions.values()).filter((v) => (0, node_js_1.stripSurroundingQuotes)(v.label).startsWith(prefix));
debug_js_1.debug.log("xxx", "result", result, "prefix", prefix, "collector.completions", collector.completions, "reservedKeys", collector.reservedKeys);
return result;

@@ -136,7 +139,7 @@ }

// don't suggest properties that are already present
const properties = node.getChildren(constants_1.TOKENS.PROPERTY);
debug_1.debug.log("xxx", "getPropertyCompletions", node, ctx, properties);
const properties = node.getChildren(constants_js_1.TOKENS.PROPERTY);
debug_js_1.debug.log("xxx", "getPropertyCompletions", node, ctx, properties);
properties.forEach((p) => {
const key = (0, node_1.getWord)(ctx.state.doc, p.getChild(constants_1.TOKENS.PROPERTY_NAME));
collector.reserve((0, node_1.stripSurroundingQuotes)(key));
const key = (0, node_js_1.getWord)(ctx.state.doc, p.getChild(constants_js_1.TOKENS.PROPERTY_NAME));
collector.reserve((0, node_js_1.stripSurroundingQuotes)(key));
});

@@ -292,3 +295,3 @@ // TODO: Handle separatorAfter

if (!value || nValueProposals > 1) {
debug_1.debug.log("xxx", "value", value, "nValueProposals", nValueProposals, propertySchema);
debug_js_1.debug.log("xxx", "value", value, "nValueProposals", nValueProposals, propertySchema);
value = "#{}";

@@ -334,4 +337,4 @@ }

let parentKey = undefined;
debug_1.debug.log("xxx", "getValueCompletions", node, ctx);
if (node && (0, node_1.isPrimitiveValueNode)(node)) {
debug_js_1.debug.log("xxx", "getValueCompletions", node, ctx);
if (node && (0, node_js_1.isPrimitiveValueNode)(node)) {
valueNode = node;

@@ -344,11 +347,11 @@ node = node.parent;

}
if (node.name === constants_1.TOKENS.PROPERTY) {
const keyNode = node.getChild(constants_1.TOKENS.PROPERTY_NAME);
if (node.name === constants_js_1.TOKENS.PROPERTY) {
const keyNode = node.getChild(constants_js_1.TOKENS.PROPERTY_NAME);
if (keyNode) {
parentKey = (0, node_1.getWord)(ctx.state.doc, keyNode);
parentKey = (0, node_js_1.getWord)(ctx.state.doc, keyNode);
node = node.parent;
}
}
debug_1.debug.log("xxx", "node", node, "parentKey", parentKey);
if (node && (parentKey !== undefined || node.name === constants_1.TOKENS.ARRAY)) {
debug_js_1.debug.log("xxx", "node", node, "parentKey", parentKey);
if (node && (parentKey !== undefined || node.name === constants_js_1.TOKENS.ARRAY)) {
// Get matching schemas

@@ -360,3 +363,3 @@ const schemas = this.getSchemas(schema, ctx);

}
if (node.name === constants_1.TOKENS.ARRAY && s.items) {
if (node.name === constants_js_1.TOKENS.ARRAY && s.items) {
let c = collector;

@@ -377,3 +380,3 @@ if (s.uniqueItems) {

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

@@ -528,5 +531,9 @@ arrayIndex = foundIdx;

getSchemas(schema, ctx) {
var _a;
const draft = new json_schema_library_1.Draft07(this.schema);
let pointer = (0, jsonPointers_1.jsonPointerForPosition)(ctx.state, ctx.pos);
let subSchema = (0, getSchema_1.default)(draft, pointer);
let pointer = (0, jsonPointers_js_1.jsonPointerForPosition)(ctx.state, ctx.pos);
let subSchema = draft.getSchema({ pointer });
if ((0, json_schema_library_1.isJsonError)(subSchema)) {
subSchema = (_a = subSchema.data) === null || _a === void 0 ? void 0 : _a.schema;
}
// if we don't have a schema for the current pointer, try the parent pointer

@@ -538,5 +545,5 @@ if (!subSchema ||

pointer = pointer.replace(/\/[^/]*$/, "/");
subSchema = (0, getSchema_1.default)(draft, pointer);
subSchema = draft.getSchema({ pointer });
}
debug_1.debug.log("xxx", "pointer..", JSON.stringify(pointer));
debug_js_1.debug.log("xxx", "pointer..", JSON.stringify(pointer));
// For some reason, it returns undefined schema for the root pointer

@@ -547,4 +554,4 @@ if (!pointer || pointer === "/") {

// const subSchema = new Draft07(this.schema).getSchema(pointer);
debug_1.debug.log("xxx", "subSchema..", subSchema);
if (this.isJsonError(subSchema)) {
debug_js_1.debug.log("xxx", "subSchema..", subSchema);
if (!subSchema) {
return [];

@@ -572,5 +579,2 @@ }

}
isJsonError(d) {
return d.type === "error";
}
expandSchemaProperty(property, schema) {

@@ -636,4 +640,4 @@ if (typeof property === "object" && property.$ref) {

*/
function jsonCompletion(schema, opts = {}) {
const completion = new JSONCompletion(schema, opts);
function jsonCompletion(opts = {}) {
const completion = new JSONCompletion(opts);
return function jsonDoCompletion(ctx) {

@@ -648,4 +652,4 @@ return completion.doComplete(ctx);

*/
function json5Completion(schema, opts = {}) {
const completion = new JSONCompletion(schema, Object.assign(Object.assign({}, opts), { mode: "json5" }));
function json5Completion(opts = {}) {
const completion = new JSONCompletion(Object.assign(Object.assign({}, opts), { mode: "json5" }));
return function jsonDoCompletion(ctx) {

@@ -652,0 +656,0 @@ return completion.doComplete(ctx);

import { type EditorView, Tooltip } from "@codemirror/view";
import { type Draft, JsonSchema } from "json-schema-library";
import type { JSONSchema7 } from "json-schema";
import { Side } from "./types";
import { Side } from "./types.js";
export type CursorData = {

@@ -33,7 +32,7 @@ schema?: JsonSchema;

*/
export declare function jsonSchemaHover(schema: JSONSchema7, options?: HoverOptions): (view: EditorView, pos: number, side: Side) => Promise<Tooltip | null>;
export declare function jsonSchemaHover(options?: HoverOptions): (view: EditorView, pos: number, side: Side) => Promise<Tooltip | null>;
export declare class JSONHover {
private opts?;
private schema;
constructor(schema: JSONSchema7, opts?: HoverOptions | undefined);
constructor(opts?: HoverOptions | undefined);
getDataForCursor(view: EditorView, pos: number, side: Side): CursorData | null;

@@ -40,0 +39,0 @@ private formatMessage;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JSONHover = exports.jsonSchemaHover = void 0;
const json_schema_library_1 = require("json-schema-library");
const jsonPointers_1 = require("./utils/jsonPointers");
const formatting_1 = require("./utils/formatting");
const getSchema_1 = __importDefault(require("./utils/schema-lib/getSchema"));
const debug_1 = require("./utils/debug");
const dom_1 = require("./utils/dom");
const jsonPointers_js_1 = require("./utils/jsonPointers.js");
const formatting_js_1 = require("./utils/formatting.js");
const debug_js_1 = require("./utils/debug.js");
const dom_js_1 = require("./utils/dom.js");
const state_js_1 = require("./state.js");
/**

@@ -17,4 +14,4 @@ * provides a JSON schema enabled tooltip extension for codemirror

*/
function jsonSchemaHover(schema, options) {
const hover = new JSONHover(schema, options);
function jsonSchemaHover(options) {
const hover = new JSONHover(options);
return async function jsonDoHover(view, pos, side) {

@@ -26,3 +23,3 @@ return hover.doHover(view, pos, side);

function formatComplexType(schema, type, draft) {
return `${type}: ${(0, formatting_1.joinWithOr)(schema[type].map((s) => {
return `${type}: ${(0, formatting_js_1.joinWithOr)(schema[type].map((s) => {
var _a;

@@ -33,9 +30,16 @@ return (_a = s.type) !== null && _a !== void 0 ? _a : draft.resolveRef(s).type;

class JSONHover {
constructor(schema, opts) {
constructor(opts) {
this.opts = opts;
this.schema = new json_schema_library_1.Draft04(schema);
this.schema = null;
this.opts = Object.assign({ parser: JSON.parse }, this.opts);
}
getDataForCursor(view, pos, side) {
const pointer = (0, jsonPointers_1.jsonPointerForPosition)(view.state, pos, side);
const schema = (0, state_js_1.getJSONSchema)(view.state);
if (!schema) {
// todo: should we even do anything without schema
// without taking over the existing mode responsibilties?
return null;
}
this.schema = new json_schema_library_1.Draft04(schema);
const pointer = (0, jsonPointers_js_1.jsonPointerForPosition)(view.state, pos, side);
let data = undefined;

@@ -51,9 +55,14 @@ // TODO: use the AST tree to return the right hand, data so that we don't have to parse the doc

// if the data is valid, we can infer a type for complex types
let subSchema = (0, getSchema_1.default)(this.schema, pointer, data);
if (subSchema.type === "error" && data !== undefined) {
// if the data is invalid, we won't get the type - try again without the data
subSchema = (0, getSchema_1.default)(this.schema, pointer, undefined);
if (subSchema.type === "error") {
return { pointer };
let subSchema = this.schema.getSchema({
pointer,
data,
withSchemaWarning: true,
});
if ((0, json_schema_library_1.isJsonError)(subSchema)) {
if (subSchema === null || subSchema === void 0 ? void 0 : subSchema.data.schema["$ref"]) {
subSchema = this.schema.resolveRef(subSchema);
}
else {
subSchema = subSchema === null || subSchema === void 0 ? void 0 : subSchema.data.schema;
}
}

@@ -65,15 +74,23 @@ return { schema: subSchema, pointer };

if (message) {
return (0, dom_1.el)("div", { class: "cm6-json-schema-hover" }, [
(0, dom_1.el)("div", {
return (0, dom_js_1.el)("div", { class: "cm6-json-schema-hover" }, [
(0, dom_js_1.el)("div", {
class: "cm6-json-schema-hover--description",
text: message,
}),
(0, dom_1.el)("div", { class: "cm6-json-schema-hover--code-wrapper" }, [
(0, dom_1.el)("code", { class: "cm6-json-schema-hover--code", text: typeInfo }),
(0, dom_js_1.el)("div", { class: "cm6-json-schema-hover--code-wrapper" }, [
typeInfo.includes("<code>")
? (0, dom_js_1.el)("div", {
class: "cm6-json-schema-hover--code",
inner: typeInfo,
})
: (0, dom_js_1.el)("code", {
class: "cm6-json-schema-hover--code",
text: typeInfo,
}),
]),
]);
}
return (0, dom_1.el)("div", { class: "cm6-json-schema-hover" }, [
(0, dom_1.el)("div", { class: "cm6-json-schema-hover--code-wrapper" }, [
(0, dom_1.el)("code", { class: "cm6-json-schema-hover--code", text: typeInfo }),
return (0, dom_js_1.el)("div", { class: "cm6-json-schema-hover" }, [
(0, dom_js_1.el)("div", { class: "cm6-json-schema-hover--code-wrapper" }, [
(0, dom_js_1.el)("code", { class: "cm6-json-schema-hover--code", text: typeInfo }),
]),

@@ -97,5 +114,14 @@ ]);

typeInfo = Array.isArray(schema.type)
? (0, formatting_1.joinWithOr)(schema.type)
? (0, formatting_js_1.joinWithOr)(schema.type)
: schema.type;
}
if (schema.enum) {
typeInfo = `<code>enum</code>: ${(0, formatting_js_1.joinWithOr)(schema.enum)}`;
}
if (schema.format) {
typeInfo += ` <code>format</code>: ${schema.format}`;
}
if (schema.pattern) {
typeInfo += ` <code>pattern</code>: ${schema.pattern}`;
}
if (schema.description) {

@@ -135,3 +161,3 @@ message = schema.description;

catch (err) {
debug_1.debug.log(err);
debug_js_1.debug.log(err);
return null;

@@ -138,0 +164,0 @@ }

@@ -1,6 +0,5 @@

import type { EditorView } from "@codemirror/view";
import type { Diagnostic } from "@codemirror/lint";
import type { JSONSchema7 } from "json-schema";
import type { EditorView, ViewUpdate } from "@codemirror/view";
import { type Diagnostic } from "@codemirror/lint";
import { type JsonError } from "json-schema-library";
import { parseJSONDocumentState } from "./utils/parseJSONDocument";
import { parseJSONDocumentState } from "./utils/parseJSONDocument.js";
export type JSONValidationOptions = {

@@ -10,2 +9,3 @@ formatError?: (error: JsonError) => string;

};
export declare const handleRefresh: (vu: ViewUpdate) => boolean;
/**

@@ -15,7 +15,7 @@ * Helper for simpler class instantiaton

*/
export declare function jsonSchemaLinter(schema: JSONSchema7, options?: JSONValidationOptions): (view: EditorView) => Diagnostic[];
export declare function jsonSchemaLinter(options?: JSONValidationOptions): (view: EditorView) => Diagnostic[];
export declare class JSONValidation {
private schema;
private options;
constructor(schema: JSONSchema7, options?: JSONValidationOptions);
constructor(options?: JSONValidationOptions);
private get schemaTitle();

@@ -22,0 +22,0 @@ private rewriteError;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JSONValidation = exports.jsonSchemaLinter = void 0;
exports.JSONValidation = exports.jsonSchemaLinter = exports.handleRefresh = void 0;
const json_schema_library_1 = require("json-schema-library");
const formatting_1 = require("./utils/formatting");
const parseJSONDocument_1 = require("./utils/parseJSONDocument");
const state_js_1 = require("./state.js");
const formatting_js_1 = require("./utils/formatting.js");
const parseJSONDocument_js_1 = require("./utils/parseJSONDocument.js");
const dom_js_1 = require("./utils/dom.js");
// return an object path that matches with the json-source-map pointer

@@ -21,2 +23,6 @@ const getErrorPath = (error) => {

};
const handleRefresh = (vu) => {
return (vu.startState.field(state_js_1.schemaStateField) !== vu.state.field(state_js_1.schemaStateField));
};
exports.handleRefresh = handleRefresh;
/**

@@ -26,5 +32,5 @@ * Helper for simpler class instantiaton

*/
function jsonSchemaLinter(schema, options) {
const validation = new JSONValidation(schema, options);
return function jsonDoValidation(view) {
function jsonSchemaLinter(options) {
const validation = new JSONValidation(options);
return (view) => {
return validation.doValidation(view);

@@ -35,18 +41,27 @@ };

class JSONValidation {
constructor(schema, options) {
constructor(options) {
this.schema = null;
// rewrite the error message to be more human readable
this.rewriteError = (error) => {
var _a, _b, _c, _d, _e, _f;
if (error.code === "one-of-error") {
return `Expected one of ${(0, formatting_1.joinWithOr)((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.errors, (data) => data.data.expected)}`;
var _a, _b, _c, _d, _e;
const errorData = error === null || error === void 0 ? void 0 : error.data;
const errors = errorData === null || errorData === void 0 ? void 0 : errorData.errors;
if (error.code === "one-of-error" && (errors === null || errors === void 0 ? void 0 : errors.length)) {
return `Expected one of ${(0, formatting_js_1.joinWithOr)(errors, (data) => data.data.expected)}`;
}
if (error.code === "type-error") {
return `Expected \`${((_b = error === null || error === void 0 ? void 0 : error.data) === null || _b === void 0 ? void 0 : _b.expected) && Array.isArray((_c = error === null || error === void 0 ? void 0 : error.data) === null || _c === void 0 ? void 0 : _c.expected)
? (0, formatting_1.joinWithOr)((_d = error === null || error === void 0 ? void 0 : error.data) === null || _d === void 0 ? void 0 : _d.expected)
: (_e = error === null || error === void 0 ? void 0 : error.data) === null || _e === void 0 ? void 0 : _e.expected}\` but received \`${(_f = error === null || error === void 0 ? void 0 : error.data) === null || _f === void 0 ? void 0 : _f.received}\``;
return `Expected <code>${((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.expected) && Array.isArray((_b = error === null || error === void 0 ? void 0 : error.data) === null || _b === void 0 ? void 0 : _b.expected)
? (0, formatting_js_1.joinWithOr)((_c = error === null || error === void 0 ? void 0 : error.data) === null || _c === void 0 ? void 0 : _c.expected)
: (_d = error === null || error === void 0 ? void 0 : error.data) === null || _d === void 0 ? void 0 : _d.expected}</code> but received <code>${(_e = error === null || error === void 0 ? void 0 : error.data) === null || _e === void 0 ? void 0 : _e.received}</code>`;
}
const message = error.message.replaceAll("#/", "").replaceAll("/", ".");
const message = error.message
// don't mention root object
.replaceAll("in `#` ", "")
.replaceAll("/", ".")
.replaceAll("#.", "")
// replace backticks with <code> tags
.replaceAll(/`([^`]*)`/gm, "<code>$1</code>");
return message;
};
this.options = Object.assign({ jsonParser: parseJSONDocument_1.parseJSONDocumentState }, options);
this.options = Object.assign({ jsonParser: parseJSONDocument_js_1.parseJSONDocumentState }, options);
// TODO: support other versions of json schema.

@@ -57,10 +72,14 @@ // most standard schemas are draft 4 for some reason, probably

// ajv did not support draft 4, so I used json-schema-library
this.schema = new json_schema_library_1.Draft04(schema);
}
get schemaTitle() {
var _a;
return (_a = this.schema.getSchema().title) !== null && _a !== void 0 ? _a : "json-schema";
var _a, _b, _c;
return (_c = (_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.getSchema()) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : "json-schema";
}
// validate using view as the linter extension signature requires
doValidation(view) {
const schema = (0, state_js_1.getJSONSchema)(view.state);
if (!schema) {
return [];
}
this.schema = new json_schema_library_1.Draft04(schema);
if (!this.schema)

@@ -87,8 +106,12 @@ return [];

const isPropertyError = error.name === "NoAdditionalPropertiesError";
const errorString = this.rewriteError(error);
acc.push({
from: isPropertyError ? pointer.keyFrom : pointer.valueFrom,
to: isPropertyError ? pointer.keyTo : pointer.valueTo,
// TODO: create a domnode and replace `` with <code></code>
// renderMessage: () => error.message,
message: this.rewriteError(error),
message: errorString,
renderMessage: () => {
const dom = (0, dom_js_1.el)("div", {});
dom.innerHTML = errorString;
return dom;
},
severity: "error",

@@ -95,0 +118,0 @@ source: this.schemaTitle,

@@ -6,2 +6,2 @@ import { JSONSchema7 } from "json-schema";

*/
export declare function json5Schema(schema: JSONSchema7): import("@codemirror/state").Extension[];
export declare function json5Schema(schema?: JSONSchema7): import("@codemirror/state").Extension[];

@@ -6,6 +6,8 @@ "use strict";

const view_1 = require("@codemirror/view");
const json_completion_1 = require("./json-completion");
const json5_validation_1 = require("./json5-validation");
const json5_hover_1 = require("./json5-hover");
const json_completion_js_1 = require("./json-completion.js");
const json5_validation_js_1 = require("./json5-validation.js");
const json5_hover_js_1 = require("./json5-hover.js");
const lint_1 = require("@codemirror/lint");
const state_js_1 = require("./state.js");
const json_validation_js_1 = require("./json-validation.js");
/**

@@ -19,9 +21,12 @@ * Full featured cm6 extension for json5, including `codemirror-json5`

(0, lint_1.linter)((0, codemirror_json5_1.json5ParseLinter)()),
(0, lint_1.linter)((0, json5_validation_1.json5SchemaLinter)(schema)),
(0, lint_1.linter)((0, json5_validation_js_1.json5SchemaLinter)(), {
needsRefresh: json_validation_js_1.handleRefresh,
}),
codemirror_json5_1.json5Language.data.of({
autocomplete: (0, json_completion_1.json5Completion)(schema),
autocomplete: (0, json_completion_js_1.json5Completion)(),
}),
(0, view_1.hoverTooltip)((0, json5_hover_1.json5SchemaHover)(schema)),
(0, view_1.hoverTooltip)((0, json5_hover_js_1.json5SchemaHover)()),
(0, state_js_1.stateExtensions)(schema),
];
}
exports.json5Schema = json5Schema;
import { type EditorView } from "@codemirror/view";
import { type HoverOptions } from "./json-hover";
import { type JSONSchema7 } from "json-schema";
import { Side } from "./types";
import { type HoverOptions } from "./json-hover.js";
import { Side } from "./types.js";
export type JSON5HoverOptions = Exclude<HoverOptions, "mode">;

@@ -10,2 +9,2 @@ /**

*/
export declare function json5SchemaHover(schema: JSONSchema7, options?: JSON5HoverOptions): (view: EditorView, pos: number, side: Side) => Promise<import("@codemirror/view").Tooltip | null>;
export declare function json5SchemaHover(options?: JSON5HoverOptions): (view: EditorView, pos: number, side: Side) => Promise<import("@codemirror/view").Tooltip | null>;

@@ -7,3 +7,3 @@ "use strict";

exports.json5SchemaHover = void 0;
const json_hover_1 = require("./json-hover");
const json_hover_js_1 = require("./json-hover.js");
const json5_1 = __importDefault(require("json5"));

@@ -14,4 +14,4 @@ /**

*/
function json5SchemaHover(schema, options) {
const hover = new json_hover_1.JSONHover(schema, Object.assign(Object.assign({}, options), { parser: json5_1.default.parse }));
function json5SchemaHover(options) {
const hover = new json_hover_js_1.JSONHover(Object.assign(Object.assign({}, options), { parser: json5_1.default.parse }));
return async function jsonDoHover(view, pos, side) {

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

import { EditorView } from "@codemirror/view";
import { type JSONValidationOptions } from "./json-validation";
import type { JSONSchema7 } from "json-schema";
import { type JSONValidationOptions } from "./json-validation.js";
/**

@@ -8,2 +7,2 @@ * Instantiates a JSONValidation instance with the JSON5 mode

*/
export declare function json5SchemaLinter(schema: JSONSchema7, options?: JSONValidationOptions): (view: EditorView) => import("@codemirror/lint").Diagnostic[];
export declare function json5SchemaLinter(options?: JSONValidationOptions): (view: EditorView) => import("@codemirror/lint").Diagnostic[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.json5SchemaLinter = void 0;
const json_validation_1 = require("./json-validation");
const parseJSON5Document_1 = require("./utils/parseJSON5Document");
const json_validation_js_1 = require("./json-validation.js");
const parseJSON5Document_js_1 = require("./utils/parseJSON5Document.js");
/**

@@ -10,5 +10,5 @@ * Instantiates a JSONValidation instance with the JSON5 mode

*/
function json5SchemaLinter(schema, options) {
const validation = new json_validation_1.JSONValidation(schema, Object.assign({ jsonParser: parseJSON5Document_1.parseJSON5DocumentState }, options));
return function json5DoLint(view) {
function json5SchemaLinter(options) {
const validation = new json_validation_js_1.JSONValidation(Object.assign({ jsonParser: parseJSON5Document_js_1.parseJSON5DocumentState }, options));
return (view) => {
return validation.doValidation(view);

@@ -15,0 +15,0 @@ };

@@ -1,8 +0,8 @@

export { json5SchemaLinter } from "./json5-validation";
export { json5SchemaHover } from "./json5-hover";
export { json5Completion } from "./json-completion";
export { json5SchemaLinter } from "./json5-validation.js";
export { json5SchemaHover } from "./json5-hover.js";
export { json5Completion } from "./json-completion.js";
/**
* @group Bundled Codemirror Extensions
*/
export { json5Schema } from "./json5-bundled";
export * from "./utils/parseJSON5Document";
export { json5Schema } from "./json5-bundled.js";
export * from "./utils/parseJSON5Document.js";

@@ -19,13 +19,13 @@ "use strict";

// json5
var json5_validation_1 = require("./json5-validation");
Object.defineProperty(exports, "json5SchemaLinter", { enumerable: true, get: function () { return json5_validation_1.json5SchemaLinter; } });
var json5_hover_1 = require("./json5-hover");
Object.defineProperty(exports, "json5SchemaHover", { enumerable: true, get: function () { return json5_hover_1.json5SchemaHover; } });
var json_completion_1 = require("./json-completion");
Object.defineProperty(exports, "json5Completion", { enumerable: true, get: function () { return json_completion_1.json5Completion; } });
var json5_validation_js_1 = require("./json5-validation.js");
Object.defineProperty(exports, "json5SchemaLinter", { enumerable: true, get: function () { return json5_validation_js_1.json5SchemaLinter; } });
var json5_hover_js_1 = require("./json5-hover.js");
Object.defineProperty(exports, "json5SchemaHover", { enumerable: true, get: function () { return json5_hover_js_1.json5SchemaHover; } });
var json_completion_js_1 = require("./json-completion.js");
Object.defineProperty(exports, "json5Completion", { enumerable: true, get: function () { return json_completion_js_1.json5Completion; } });
/**
* @group Bundled Codemirror Extensions
*/
var json5_bundled_1 = require("./json5-bundled");
Object.defineProperty(exports, "json5Schema", { enumerable: true, get: function () { return json5_bundled_1.json5Schema; } });
__exportStar(require("./utils/parseJSON5Document"), exports);
var json5_bundled_js_1 = require("./json5-bundled.js");
Object.defineProperty(exports, "json5Schema", { enumerable: true, get: function () { return json5_bundled_js_1.json5Schema; } });
__exportStar(require("./utils/parseJSON5Document.js"), exports);

@@ -1,3 +0,3 @@

type Attributes = "class" | "text" | "id" | "role" | "aria-label";
type Attributes = "class" | "text" | "id" | "role" | "aria-label" | "inner";
export declare function el(tagName: string, attributes: Partial<Record<Attributes, string>>, children?: HTMLElement[]): HTMLElement;
export {};

@@ -18,2 +18,6 @@ "use strict";

}
if (k === "inner") {
e.innerHTML = v;
return;
}
e.setAttribute(k, v);

@@ -20,0 +24,0 @@ });

@@ -9,3 +9,3 @@ "use strict";

let data = arr.map((err, i) => {
const result = `\`` + (getPath ? JSON.stringify(getPath(err)) : err) + `\``;
const result = `<code>` + (getPath ? getPath(err) : err) + `</code>`;
if (i === arr.length - 1)

@@ -12,0 +12,0 @@ return "or " + result;

import { EditorState, Text } from "@codemirror/state";
import { SyntaxNode } from "@lezer/common";
import { JSONPointersMap, Side } from "../types";
import { JSONPointersMap, Side } from "../types.js";
export type JSONMode = "json4" | "json5";

@@ -5,0 +5,0 @@ export declare function getJsonPointerAt(docText: Text, node: SyntaxNode): string;

@@ -5,4 +5,4 @@ "use strict";

const language_1 = require("@codemirror/language");
const constants_1 = require("../constants");
const node_1 = require("./node");
const constants_js_1 = require("../constants.js");
const node_js_1 = require("./node.js");
// adapted from https://discuss.codemirror.net/t/json-pointer-at-cursor-seeking-implementation-critique/4793/3

@@ -14,12 +14,12 @@ // this could be useful for other things later!

switch (n.parent.name) {
case constants_1.TOKENS.PROPERTY: {
const name = n.parent.getChild(constants_1.TOKENS.PROPERTY_NAME);
case constants_js_1.TOKENS.PROPERTY: {
const name = n.parent.getChild(constants_js_1.TOKENS.PROPERTY_NAME);
if (name) {
path.unshift((0, node_1.getWord)(docText, name).replace(/[/~]/g, (v) => v === "~" ? "~0" : "~1"));
path.unshift((0, node_js_1.getWord)(docText, name).replace(/[/~]/g, (v) => v === "~" ? "~0" : "~1"));
}
break;
}
case constants_1.TOKENS.ARRAY: {
if ((0, node_1.isValueNode)(n)) {
const index = (0, node_1.findNodeIndexInArrayNode)(n.parent, n);
case constants_js_1.TOKENS.ARRAY: {
if ((0, node_js_1.isValueNode)(n)) {
const index = (0, node_js_1.findNodeIndexInArrayNode)(n.parent, n);
path.unshift(`${index}`);

@@ -26,0 +26,0 @@ }

import { SyntaxNode } from "@lezer/common";
import { EditorState, Text } from "@codemirror/state";
import { Side } from "../types";
import { Side } from "../types.js";
export declare const getNodeAtPosition: (state: EditorState, pos: number, side?: Side) => SyntaxNode;

@@ -5,0 +5,0 @@ export declare const stripSurroundingQuotes: (str: string) => string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findNodeIndexInArrayNode = exports.getChildValueNode = exports.isPropertyNameNode = exports.isValueNode = exports.isPrimitiveValueNode = exports.isInvalidValueNode = exports.getWord = exports.stripSurroundingQuotes = exports.getNodeAtPosition = void 0;
const constants_1 = require("../constants");
const constants_js_1 = require("../constants.js");
const language_1 = require("@codemirror/language");

@@ -21,13 +21,13 @@ const getNodeAtPosition = (state, pos, side = -1) => {

var _a, _b;
return (node.name === constants_1.TOKENS.INVALID &&
(((_a = node.prevSibling) === null || _a === void 0 ? void 0 : _a.name) === constants_1.TOKENS.PROPERTY_NAME ||
((_b = node.prevSibling) === null || _b === void 0 ? void 0 : _b.name) === constants_1.TOKENS.PROPERTY_COLON));
return (node.name === constants_js_1.TOKENS.INVALID &&
(((_a = node.prevSibling) === null || _a === void 0 ? void 0 : _a.name) === constants_js_1.TOKENS.PROPERTY_NAME ||
((_b = node.prevSibling) === null || _b === void 0 ? void 0 : _b.name) === constants_js_1.TOKENS.PROPERTY_COLON));
};
exports.isInvalidValueNode = isInvalidValueNode;
const isPrimitiveValueNode = (node) => {
return constants_1.PRIMITIVE_TYPES.includes(node.name) || (0, exports.isInvalidValueNode)(node);
return constants_js_1.PRIMITIVE_TYPES.includes(node.name) || (0, exports.isInvalidValueNode)(node);
};
exports.isPrimitiveValueNode = isPrimitiveValueNode;
const isValueNode = (node) => {
return ([...constants_1.PRIMITIVE_TYPES, ...constants_1.COMPLEX_TYPES].includes(node.name) ||
return ([...constants_js_1.PRIMITIVE_TYPES, ...constants_js_1.COMPLEX_TYPES].includes(node.name) ||
(0, exports.isInvalidValueNode)(node));

@@ -38,5 +38,5 @@ };

var _a, _b;
return (node.name === constants_1.TOKENS.PROPERTY_NAME ||
(node.name === constants_1.TOKENS.INVALID &&
(((_a = node.prevSibling) === null || _a === void 0 ? void 0 : _a.name) === constants_1.TOKENS.PROPERTY ||
return (node.name === constants_js_1.TOKENS.PROPERTY_NAME ||
(node.name === constants_js_1.TOKENS.INVALID &&
(((_a = node.prevSibling) === null || _a === void 0 ? void 0 : _a.name) === constants_js_1.TOKENS.PROPERTY ||
((_b = node.prevSibling) === null || _b === void 0 ? void 0 : _b.name) === "{")));

@@ -61,3 +61,3 @@ };

const getArrayNodeChildren = (node) => {
return getChildrenNodes(node).filter((n) => constants_1.PRIMITIVE_TYPES.includes(n.name) || constants_1.COMPLEX_TYPES.includes(n.name));
return getChildrenNodes(node).filter((n) => constants_js_1.PRIMITIVE_TYPES.includes(n.name) || constants_js_1.COMPLEX_TYPES.includes(n.name));
};

@@ -64,0 +64,0 @@ const findNodeIndexInArrayNode = (arrayNode, valueNode) => {

@@ -11,3 +11,3 @@ /**

data: any;
pointers: import("..").JSONPointersMap;
pointers: import("../types.js").JSONPointersMap;
};

@@ -20,3 +20,3 @@ /**

data: any;
pointers: import("..").JSONPointersMap;
pointers: import("../types.js").JSONPointersMap;
};

@@ -13,3 +13,3 @@ "use strict";

const state_1 = require("@codemirror/state");
const jsonPointers_1 = require("./jsonPointers");
const jsonPointers_js_1 = require("./jsonPointers.js");
/**

@@ -26,3 +26,3 @@ * Return parsed data and json5 pointers for a given codemirror EditorState

catch (_a) { }
const pointers = (0, jsonPointers_1.getJsonPointers)(state, "json5");
const pointers = (0, jsonPointers_js_1.getJsonPointers)(state, "json5");
return { data, pointers };

@@ -29,0 +29,0 @@ }

@@ -8,3 +8,3 @@ import { EditorState } from "@codemirror/state";

data: any;
pointers: import("..").JSONPointersMap;
pointers: import("../types.js").JSONPointersMap;
};

@@ -17,3 +17,3 @@ /**

data: any;
pointers: import("..").JSONPointersMap;
pointers: import("../types.js").JSONPointersMap;
};

@@ -6,3 +6,3 @@ "use strict";

const state_1 = require("@codemirror/state");
const jsonPointers_1 = require("./jsonPointers");
const jsonPointers_js_1 = require("./jsonPointers.js");
/**

@@ -19,3 +19,3 @@ * Return parsed data and json pointers for a given codemirror EditorState

catch (_a) { }
const pointers = (0, jsonPointers_1.getJsonPointers)(state, "json4");
const pointers = (0, jsonPointers_js_1.getJsonPointers)(state, "json4");
return { data, pointers };

@@ -22,0 +22,0 @@ }

@@ -6,2 +6,2 @@ import { JSONSchema7 } from "json-schema";

*/
export declare function json5Schema(schema?: JSONSchema7): any[];
export declare function json5Schema(schema?: JSONSchema7): import("@codemirror/state").Extension[];
export const debug = {
log: (...args) => {
if (process.env.NODE_ENV !== "development") {
if ("production" !== "development") {
return;

@@ -5,0 +5,0 @@ }

import { SyntaxNode } from "@lezer/common";
import { EditorState, Text } from "@codemirror/state";
import { Side } from "../types.js";
export declare const getNodeAtPosition: (state: EditorState, pos: number, side?: Side) => any;
export declare const getNodeAtPosition: (state: EditorState, pos: number, side?: Side) => SyntaxNode;
export declare const stripSurroundingQuotes: (str: string) => string;

@@ -11,3 +11,3 @@ export declare const getWord: (doc: Text, node: SyntaxNode | null, stripQuotes?: boolean) => string;

export declare const isPropertyNameNode: (node: SyntaxNode) => boolean;
export declare const getChildValueNode: (node: SyntaxNode) => any;
export declare const getChildValueNode: (node: SyntaxNode) => SyntaxNode | undefined;
export declare const findNodeIndexInArrayNode: (arrayNode: SyntaxNode, valueNode: SyntaxNode) => number;
{
"name": "codemirror-json-schema",
"license": "MIT",
"version": "0.5.1-canary",
"version": "0.5.1-canary.0",
"description": "Codemirror 6 extensions that provide full JSONSchema support for `@codemirror/lang-json` and `codemirror-json5`",

@@ -76,13 +76,13 @@ "contributors": [

"@codemirror/autocomplete": "^6.8.1",
"@codemirror/basic-setup": "^0.20.0",
"@codemirror/commands": "^6.2.4",
"@codemirror/theme-one-dark": "^6.1.2",
"@evilmartians/lefthook": "^1.4.6",
"@vitest/coverage-v8": "^0.34.6",
"codemirror": "^6.0.1",
"@codemirror/language": "^6.8.0",
"@codemirror/lint": "^6.4.0",
"@codemirror/state": "^6.2.1",
"@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.14.1",
"@codemirror/basic-setup": "^0.20.0",
"@evilmartians/lefthook": "^1.4.6",
"@lezer/common": "^1.0.3",
"@vitest/coverage-v8": "^0.34.6",
"codemirror": "^6.0.1",
"codemirror-json5": "^1.0.3",

@@ -89,0 +89,0 @@ "happy-dom": "^10.3.2",

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