vitest-prosemirror 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/vitest-prosemirror.d.ts +34 -0
- package/dist/vitest-prosemirror.js +170 -0
- package/dist/vitest-prosemirror.js.map +1 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2024-2024 Marek Dědič <developer@dedic.eu>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# vitest-prosemirror
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/vitest-prosemirror)
|
|
4
|
+
[](https://github.com/marekdedic/vitest-prosemirror/actions)
|
|
5
|
+
[](https://coveralls.io/github/marekdedic/vitest-prosemirror)
|
|
6
|
+
[](https://www.npmjs.com/package/vitest-prosemirror)
|
|
7
|
+
[](https://github.com/marekdedic/vitest-prosemirror/blob/master/LICENSE)
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
A plugin for Vitest that enables you to write tests using the ProseMirror editor
|
|
12
|
+
|
|
13
|
+
## How to install
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
$ npm install --save-dev vitest-prosemirror
|
|
17
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Node as Node_2 } from 'prosemirror-model';
|
|
2
|
+
import { Plugin as Plugin_2 } from 'prosemirror-state';
|
|
3
|
+
import { Schema } from 'prosemirror-model';
|
|
4
|
+
import { Selection as Selection_2 } from 'prosemirror-state';
|
|
5
|
+
|
|
6
|
+
declare interface Options {
|
|
7
|
+
plugins: Array<Plugin_2>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export declare class ProseMirrorTester {
|
|
11
|
+
get doc(): Node_2;
|
|
12
|
+
get schema(): Schema;
|
|
13
|
+
private readonly view;
|
|
14
|
+
constructor(documentRoot: Node_2, options?: Partial<Options>);
|
|
15
|
+
insertText(text: string): void;
|
|
16
|
+
selectText(selection: TesterSelection): void;
|
|
17
|
+
shortcut(text: string): void;
|
|
18
|
+
private getSelection;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare type TesterSelection = "all" | "end" | "start" | {
|
|
22
|
+
from: number;
|
|
23
|
+
to: number;
|
|
24
|
+
} | Selection_2 | number;
|
|
25
|
+
|
|
26
|
+
export { }
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
declare module "vitest" {
|
|
30
|
+
interface Assertion<T = any> extends CustomMatchers<T> {
|
|
31
|
+
}
|
|
32
|
+
interface AsymmetricMatchersContaining extends CustomMatchers {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { expect } from "vitest";
|
|
2
|
+
import stringifyObject from "stringify-object";
|
|
3
|
+
import { EditorState, AllSelection, TextSelection } from "prosemirror-state";
|
|
4
|
+
import { EditorView } from "prosemirror-view";
|
|
5
|
+
import { Keyboard } from "test-keyboard";
|
|
6
|
+
function getMarks(marks, origContent) {
|
|
7
|
+
let content = `'${origContent}'`;
|
|
8
|
+
for (const mark of [...marks].reverse()) {
|
|
9
|
+
const hasAttrs = Object.keys(mark.attrs).length > 0;
|
|
10
|
+
const items = [content];
|
|
11
|
+
if (hasAttrs) {
|
|
12
|
+
items.unshift(
|
|
13
|
+
stringifyObject(mark.attrs, {
|
|
14
|
+
indent: " ",
|
|
15
|
+
inlineCharacterLimit: 1e3
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
content = `${mark.type.name}(${items.join(", ")})`;
|
|
20
|
+
}
|
|
21
|
+
return content;
|
|
22
|
+
}
|
|
23
|
+
const renamedTypes = {
|
|
24
|
+
hardBreak: "br",
|
|
25
|
+
heading: "h",
|
|
26
|
+
horizontalRule: "hr",
|
|
27
|
+
paragraph: "p"
|
|
28
|
+
};
|
|
29
|
+
function stringifyProseMirrorNode(node, indentation = "") {
|
|
30
|
+
var _a;
|
|
31
|
+
const nextIndentation = `${indentation} `;
|
|
32
|
+
if (node.type.name === "text") {
|
|
33
|
+
return `${indentation}${getMarks(node.marks, node.text ?? "")}`;
|
|
34
|
+
}
|
|
35
|
+
const type = renamedTypes[node.type.name] ?? node.type.name;
|
|
36
|
+
const content = [];
|
|
37
|
+
const hasAttrs = Object.keys(node.attrs).length > 0;
|
|
38
|
+
if (hasAttrs) {
|
|
39
|
+
content.push(
|
|
40
|
+
stringifyObject(node.attrs, { indent: " ", inlineCharacterLimit: 1e3 })
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
node.content.forEach((item) => {
|
|
44
|
+
content.push(stringifyProseMirrorNode(item, nextIndentation));
|
|
45
|
+
});
|
|
46
|
+
if (!hasAttrs && content.length === 1 && ((_a = node.content.firstChild) == null ? void 0 : _a.type.name) === "text") {
|
|
47
|
+
return `${indentation}${type}(${stringifyProseMirrorNode(node.content.firstChild, "")})`;
|
|
48
|
+
}
|
|
49
|
+
const joiner = `,
|
|
50
|
+
`;
|
|
51
|
+
const prefix = hasAttrs ? `
|
|
52
|
+
${nextIndentation}` : content.length > 0 ? "\n" : "";
|
|
53
|
+
const postfix = content.length > 0 ? `
|
|
54
|
+
${indentation}` : "";
|
|
55
|
+
return `${indentation}${type}(${prefix}${content.join(joiner)}${postfix})`;
|
|
56
|
+
}
|
|
57
|
+
class ProseMirrorTester {
|
|
58
|
+
get doc() {
|
|
59
|
+
return this.view.state.doc;
|
|
60
|
+
}
|
|
61
|
+
get schema() {
|
|
62
|
+
return this.view.state.schema;
|
|
63
|
+
}
|
|
64
|
+
constructor(documentRoot, options = {}) {
|
|
65
|
+
if (typeof document === "undefined") {
|
|
66
|
+
throw new Error("TODO");
|
|
67
|
+
}
|
|
68
|
+
const element = document.createElement("div");
|
|
69
|
+
document.body.append(element);
|
|
70
|
+
const state = EditorState.create({
|
|
71
|
+
doc: documentRoot,
|
|
72
|
+
plugins: options.plugins ?? []
|
|
73
|
+
});
|
|
74
|
+
this.view = new EditorView(element, {
|
|
75
|
+
state
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
insertText(text) {
|
|
79
|
+
const keys = Keyboard.create({
|
|
80
|
+
target: this.view.dom
|
|
81
|
+
}).start();
|
|
82
|
+
let pos = this.view.state.selection.from;
|
|
83
|
+
for (const character of text) {
|
|
84
|
+
keys.char({ text: character, typing: true });
|
|
85
|
+
if (this.view.someProp(
|
|
86
|
+
"handleTextInput",
|
|
87
|
+
(f) => f(this.view, pos, pos, character)
|
|
88
|
+
) === void 0) {
|
|
89
|
+
this.view.dispatch(this.view.state.tr.insertText(character, pos, pos));
|
|
90
|
+
}
|
|
91
|
+
pos = this.view.state.selection.anchor;
|
|
92
|
+
}
|
|
93
|
+
keys.end();
|
|
94
|
+
}
|
|
95
|
+
selectText(selection) {
|
|
96
|
+
this.view.dispatch(
|
|
97
|
+
this.view.state.tr.setSelection(this.getSelection(selection))
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
shortcut(text) {
|
|
101
|
+
Keyboard.create({
|
|
102
|
+
batch: true,
|
|
103
|
+
target: this.view.dom
|
|
104
|
+
}).start().mod({ text }).forEach(({ event }) => {
|
|
105
|
+
this.view.dispatchEvent(event);
|
|
106
|
+
}).end();
|
|
107
|
+
}
|
|
108
|
+
getSelection(selection) {
|
|
109
|
+
if (selection === "all") {
|
|
110
|
+
return new AllSelection(this.doc);
|
|
111
|
+
}
|
|
112
|
+
if (typeof selection === "object" && "$anchor" in selection && "$head" in selection) {
|
|
113
|
+
return selection;
|
|
114
|
+
}
|
|
115
|
+
if (typeof selection === "object" && "from" in selection && "to" in selection) {
|
|
116
|
+
return TextSelection.between(
|
|
117
|
+
this.doc.resolve(selection.from),
|
|
118
|
+
this.doc.resolve(selection.to)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
let pos = 0;
|
|
122
|
+
if (selection === "start") {
|
|
123
|
+
pos = 0;
|
|
124
|
+
} else if (selection === "end") {
|
|
125
|
+
pos = this.doc.nodeSize - 2;
|
|
126
|
+
} else {
|
|
127
|
+
pos = selection;
|
|
128
|
+
}
|
|
129
|
+
return TextSelection.near(this.doc.resolve(pos));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
expect.extend({
|
|
133
|
+
toEqualProseMirrorNode(received, expected) {
|
|
134
|
+
const receivedDoc = `
|
|
135
|
+
${stringifyProseMirrorNode(received)}
|
|
136
|
+
`;
|
|
137
|
+
const expectedDoc = `
|
|
138
|
+
${stringifyProseMirrorNode(expected)}
|
|
139
|
+
`;
|
|
140
|
+
const pass = this.equals(receivedDoc, expectedDoc);
|
|
141
|
+
const message = pass ? () => `${this.utils.matcherHint(".not.toEqualProsemirrorNode")}
|
|
142
|
+
|
|
143
|
+
Expected value of document to not equal:
|
|
144
|
+
${this.utils.printExpected(expectedDoc)}
|
|
145
|
+
Actual:
|
|
146
|
+
${this.utils.printReceived(receivedDoc)}` : () => {
|
|
147
|
+
const diffString = this.utils.diff(expectedDoc, receivedDoc, {
|
|
148
|
+
expand: this.expand ?? false
|
|
149
|
+
});
|
|
150
|
+
return `${this.utils.matcherHint(".toEqualProsemirrorNode")}
|
|
151
|
+
|
|
152
|
+
Expected value of document to equal:
|
|
153
|
+
${this.utils.printExpected(expectedDoc)}
|
|
154
|
+
Actual:
|
|
155
|
+
${this.utils.printReceived(receivedDoc)}${diffString !== void 0 ? `
|
|
156
|
+
|
|
157
|
+
Difference:
|
|
158
|
+
|
|
159
|
+
${diffString}` : ""}`;
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
message,
|
|
163
|
+
pass
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
export {
|
|
168
|
+
ProseMirrorTester
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=vitest-prosemirror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest-prosemirror.js","sources":["../src/stringifyProseMirrorNode.ts","../src/ProseMirrorTester.ts","../src/index.ts"],"sourcesContent":["import type { Mark, Node } from \"prosemirror-model\";\n\nimport stringifyObject from \"stringify-object\";\n\nfunction getMarks(marks: ReadonlyArray<Mark>, origContent: string): string {\n let content = `'${origContent}'`;\n\n for (const mark of [...marks].reverse()) {\n const hasAttrs = Object.keys(mark.attrs).length > 0;\n const items: Array<string> = [content];\n\n if (hasAttrs) {\n items.unshift(\n stringifyObject(mark.attrs, {\n indent: \" \",\n inlineCharacterLimit: 1000,\n }),\n );\n }\n\n content = `${mark.type.name}(${items.join(\", \")})`;\n }\n\n return content;\n}\n\nconst renamedTypes: Record<string, string> = {\n hardBreak: \"br\",\n heading: \"h\",\n horizontalRule: \"hr\",\n paragraph: \"p\",\n};\n\nexport function stringifyProseMirrorNode(node: Node, indentation = \"\"): string {\n const nextIndentation = `${indentation} `;\n\n if (node.type.name === \"text\") {\n return `${indentation}${getMarks(node.marks, node.text ?? \"\")}`;\n }\n\n const type = renamedTypes[node.type.name] ?? node.type.name;\n const content: Array<string> = [];\n const hasAttrs = Object.keys(node.attrs).length > 0;\n\n if (hasAttrs) {\n content.push(\n stringifyObject(node.attrs, { indent: \" \", inlineCharacterLimit: 1000 }),\n );\n }\n\n node.content.forEach((item) => {\n content.push(stringifyProseMirrorNode(item, nextIndentation));\n });\n\n if (\n !hasAttrs &&\n content.length === 1 &&\n node.content.firstChild?.type.name === \"text\"\n ) {\n return `${indentation}${type}(${stringifyProseMirrorNode(node.content.firstChild, \"\")})`;\n }\n\n const joiner = `,\\n`;\n const prefix = hasAttrs\n ? `\\n${nextIndentation}`\n : content.length > 0\n ? \"\\n\"\n : \"\";\n const postfix = content.length > 0 ? `\\n${indentation}` : \"\";\n\n return `${indentation}${type}(${prefix}${content.join(joiner)}${postfix})`;\n}\n","import type { Node, Schema } from \"prosemirror-model\";\n\nimport {\n AllSelection,\n EditorState,\n type Plugin,\n type Selection,\n TextSelection,\n} from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\nimport { Keyboard } from \"test-keyboard\";\n\ninterface Options {\n plugins: Array<Plugin>;\n}\n\ntype TesterSelection =\n | \"all\"\n | \"end\"\n | \"start\"\n | { from: number; to: number }\n | Selection\n | number;\n\nexport class ProseMirrorTester {\n public get doc(): Node {\n return this.view.state.doc;\n }\n\n public get schema(): Schema {\n return this.view.state.schema;\n }\n\n private readonly view: EditorView;\n\n public constructor(documentRoot: Node, options: Partial<Options> = {}) {\n if (typeof document === \"undefined\") {\n throw new Error(\"TODO\");\n }\n\n const element = document.createElement(\"div\");\n document.body.append(element);\n\n const state = EditorState.create({\n doc: documentRoot,\n plugins: options.plugins ?? [],\n });\n this.view = new EditorView(element, {\n state,\n });\n }\n\n public insertText(text: string): void {\n const keys = Keyboard.create({\n target: this.view.dom,\n }).start();\n\n let pos = this.view.state.selection.from;\n for (const character of text) {\n keys.char({ text: character, typing: true });\n\n if (\n this.view.someProp(\"handleTextInput\", (f) =>\n f(this.view, pos, pos, character),\n ) === undefined\n ) {\n this.view.dispatch(this.view.state.tr.insertText(character, pos, pos));\n }\n pos = this.view.state.selection.anchor;\n }\n keys.end();\n }\n\n public selectText(selection: TesterSelection): void {\n this.view.dispatch(\n this.view.state.tr.setSelection(this.getSelection(selection)),\n );\n }\n\n public shortcut(text: string): void {\n Keyboard.create({\n batch: true,\n target: this.view.dom,\n })\n .start()\n .mod({ text })\n .forEach(({ event }) => {\n this.view.dispatchEvent(event);\n })\n .end();\n }\n\n private getSelection(selection: TesterSelection): Selection {\n if (selection === \"all\") {\n return new AllSelection(this.doc);\n }\n\n if (\n typeof selection === \"object\" &&\n \"$anchor\" in selection &&\n \"$head\" in selection\n ) {\n return selection;\n }\n\n if (\n typeof selection === \"object\" &&\n \"from\" in selection &&\n \"to\" in selection\n ) {\n return TextSelection.between(\n this.doc.resolve(selection.from),\n this.doc.resolve(selection.to),\n );\n }\n\n let pos = 0;\n if (selection === \"start\") {\n pos = 0;\n } else if (selection === \"end\") {\n pos = this.doc.nodeSize - 2;\n } else {\n pos = selection;\n }\n\n return TextSelection.near(this.doc.resolve(pos));\n }\n}\n","import type { Node } from \"prosemirror-model\";\n\nimport { expect } from \"vitest\";\n\nimport { stringifyProseMirrorNode } from \"./stringifyProseMirrorNode\";\n\nexport { ProseMirrorTester } from \"./ProseMirrorTester\";\n\ninterface CustomMatchers<R = unknown> {\n toEqualProseMirrorNode(expected: Node): R;\n}\n\n/* eslint-disable @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any -- These are overridest for vitest matchers */\n\ndeclare module \"vitest\" {\n interface Assertion<T = any> extends CustomMatchers<T> {}\n interface AsymmetricMatchersContaining extends CustomMatchers {}\n}\n\n/* eslint-enable */\n\nexpect.extend({\n toEqualProseMirrorNode(received: Node, expected: Node) {\n const receivedDoc = `\\n${stringifyProseMirrorNode(received)}\\n`;\n const expectedDoc = `\\n${stringifyProseMirrorNode(expected)}\\n`;\n const pass = this.equals(receivedDoc, expectedDoc);\n const message = pass\n ? (): string =>\n `${this.utils.matcherHint(\".not.toEqualProsemirrorNode\")}\\n\\n` +\n `Expected value of document to not equal:\\n ${this.utils.printExpected(expectedDoc)}\\n` +\n `Actual:\\n ${this.utils.printReceived(receivedDoc)}`\n : (): string => {\n const diffString = this.utils.diff(expectedDoc, receivedDoc, {\n expand: this.expand ?? false,\n });\n return `${this.utils.matcherHint(\".toEqualProsemirrorNode\")}\\n\\nExpected value of document to equal:\\n${this.utils.printExpected(expectedDoc)}\\nActual:\\n${this.utils.printReceived(receivedDoc)}${diffString !== undefined ? `\\n\\nDifference:\\n\\n${diffString}` : \"\"}`;\n };\n return {\n message,\n pass,\n };\n },\n});\n"],"names":[],"mappings":";;;;;AAIA,SAAS,SAAS,OAA4B,aAA6B;AACrE,MAAA,UAAU,IAAI,WAAW;AAE7B,aAAW,QAAQ,CAAC,GAAG,KAAK,EAAE,WAAW;AACvC,UAAM,WAAW,OAAO,KAAK,KAAK,KAAK,EAAE,SAAS;AAC5C,UAAA,QAAuB,CAAC,OAAO;AAErC,QAAI,UAAU;AACN,YAAA;AAAA,QACJ,gBAAgB,KAAK,OAAO;AAAA,UAC1B,QAAQ;AAAA,UACR,sBAAsB;AAAA,QACvB,CAAA;AAAA,MACH;AAAA,IAAA;AAGQ,cAAA,GAAG,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,CAAC;AAAA,EAAA;AAG1C,SAAA;AACT;AAEA,MAAM,eAAuC;AAAA,EAC3C,WAAW;AAAA,EACX,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,WAAW;AACb;AAEgB,SAAA,yBAAyB,MAAY,cAAc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;AACG,WAAA;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAEJ,CAAC;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vitest-prosemirror",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A plugin for Vitest that enables you to write tests using the ProseMirror editor",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vitest",
|
|
7
|
+
"prosemirror",
|
|
8
|
+
"testing"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/marekdedic/vitest-prosemirror",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/marekdedic/vitest-prosemirror/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Marek Dědič",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"module": "dist/vitest-prosemirror.js",
|
|
18
|
+
"types": "dist/vitest-prosemirror.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/vitest-prosemirror.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/marekdedic/vitest-prosemirror.git"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "rimraf dist/*",
|
|
35
|
+
"prebuild": "npm run clean",
|
|
36
|
+
"build": "vite build",
|
|
37
|
+
"lint": "eslint --color 'src/**/*.ts' 'tests/**/*.ts' '*.config.{js,ts}'",
|
|
38
|
+
"test": "vitest",
|
|
39
|
+
"test-coverage": "vitest run --coverage"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"vitest": "^2.1.9 || ^3.0.7"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"vitest": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"prosemirror-model": "^1.24.1",
|
|
51
|
+
"prosemirror-state": "^1.4.3",
|
|
52
|
+
"prosemirror-view": "^1.38.0",
|
|
53
|
+
"stringify-object": "^5.0.0",
|
|
54
|
+
"test-keyboard": "^2.0.7"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
58
|
+
"@eslint/js": "^9.9.1",
|
|
59
|
+
"@microsoft/api-extractor": "^7.47.2",
|
|
60
|
+
"@types/stringify-object": "^4.0.5",
|
|
61
|
+
"@vitest/coverage-v8": "^3.0.7",
|
|
62
|
+
"@vitest/eslint-plugin": "^1.1.36",
|
|
63
|
+
"eslint": "^9.9.0",
|
|
64
|
+
"eslint-config-prettier": "^10.0.1",
|
|
65
|
+
"eslint-plugin-perfectionist": "^4.1.2",
|
|
66
|
+
"eslint-plugin-prefer-arrow-functions": "^3.4.0 <3.7",
|
|
67
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
68
|
+
"jsdom": "^26.0.0",
|
|
69
|
+
"prettier": "^3.3.0",
|
|
70
|
+
"prosemirror-schema-basic": "^1.2.3",
|
|
71
|
+
"rimraf": "^6.0.1",
|
|
72
|
+
"typescript": "^5.3.3",
|
|
73
|
+
"typescript-eslint": "^8.2.0",
|
|
74
|
+
"vite": "^6.0.2",
|
|
75
|
+
"vite-plugin-dts": "^4.5.1"
|
|
76
|
+
}
|
|
77
|
+
}
|