New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@milkdown/exception

Package Overview
Dependencies
Maintainers
0
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@milkdown/exception - npm Package Compare versions

Comparing version

to
7.6.4

195

lib/index.es.js

@@ -1,105 +0,134 @@

var n = /* @__PURE__ */ ((e) => (e.docTypeError = "docTypeError", e.contextNotFound = "contextNotFound", e.timerNotFound = "timerNotFound", e.ctxCallOutOfScope = "ctxCallOutOfScope", e.createNodeInParserFail = "createNodeInParserFail", e.stackOverFlow = "stackOverFlow", e.parserMatchError = "parserMatchError", e.serializerMatchError = "serializerMatchError", e.getAtomFromSchemaFail = "getAtomFromSchemaFail", e.expectDomTypeError = "expectDomTypeError", e.callCommandBeforeEditorView = "callCommandBeforeEditorView", e.missingRootElement = "missingRootElement", e.missingNodeInSchema = "missingNodeInSchema", e.missingMarkInSchema = "missingMarkInSchema", e.ctxNotBind = "ctxNotBind", e.missingYjsDoc = "missingYjsDoc", e))(n || {});
class t extends Error {
constructor(o, a) {
super(a), this.name = "MilkdownError", this.code = o;
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2["docTypeError"] = "docTypeError";
ErrorCode2["contextNotFound"] = "contextNotFound";
ErrorCode2["timerNotFound"] = "timerNotFound";
ErrorCode2["ctxCallOutOfScope"] = "ctxCallOutOfScope";
ErrorCode2["createNodeInParserFail"] = "createNodeInParserFail";
ErrorCode2["stackOverFlow"] = "stackOverFlow";
ErrorCode2["parserMatchError"] = "parserMatchError";
ErrorCode2["serializerMatchError"] = "serializerMatchError";
ErrorCode2["getAtomFromSchemaFail"] = "getAtomFromSchemaFail";
ErrorCode2["expectDomTypeError"] = "expectDomTypeError";
ErrorCode2["callCommandBeforeEditorView"] = "callCommandBeforeEditorView";
ErrorCode2["missingRootElement"] = "missingRootElement";
ErrorCode2["missingNodeInSchema"] = "missingNodeInSchema";
ErrorCode2["missingMarkInSchema"] = "missingMarkInSchema";
ErrorCode2["ctxNotBind"] = "ctxNotBind";
ErrorCode2["missingYjsDoc"] = "missingYjsDoc";
return ErrorCode2;
})(ErrorCode || {});
class MilkdownError extends Error {
constructor(code, message) {
super(message);
this.name = "MilkdownError";
this.code = code;
}
}
const u = (e, o) => typeof o == "function" ? "[Function]" : o, i = (e) => JSON.stringify(e, u);
function l(e) {
return new t(
n.docTypeError,
`Doc type error, unsupported type: ${i(e)}`
const functionReplacer = (_, value) => typeof value === "function" ? "[Function]" : value;
const stringify = (x) => JSON.stringify(x, functionReplacer);
function docTypeError(type) {
return new MilkdownError(
ErrorCode.docTypeError,
`Doc type error, unsupported type: ${stringify(type)}`
);
}
function d(e) {
return new t(
n.contextNotFound,
`Context "${e}" not found, do you forget to inject it?`
function contextNotFound(name) {
return new MilkdownError(
ErrorCode.contextNotFound,
`Context "${name}" not found, do you forget to inject it?`
);
}
function f(e) {
return new t(
n.timerNotFound,
`Timer "${e}" not found, do you forget to record it?`
function timerNotFound(name) {
return new MilkdownError(
ErrorCode.timerNotFound,
`Timer "${name}" not found, do you forget to record it?`
);
}
function p() {
return new t(
n.ctxCallOutOfScope,
function ctxCallOutOfScope() {
return new MilkdownError(
ErrorCode.ctxCallOutOfScope,
"Should not call a context out of the plugin."
);
}
function g(...e) {
const o = e.reduce((a, c) => {
if (!c) return a;
const s = (r) => Array.isArray(r) ? r.map((m) => s(m)).join(", ") : r.toJSON ? i(
r.toJSON()
) : r.spec ? i(r.spec) : r.toString();
return `${a}, ${s(c)}`;
function createNodeInParserFail(...args) {
const message = args.reduce((msg, arg) => {
if (!arg) return msg;
const serialize = (x) => {
if (Array.isArray(x))
return x.map((y) => serialize(y)).join(", ");
if (x.toJSON)
return stringify(
x.toJSON()
);
if (x.spec)
return stringify(x.spec);
return x.toString();
};
return `${msg}, ${serialize(arg)}`;
}, "Create prosemirror node from remark failed in parser");
return new t(n.createNodeInParserFail, o);
return new MilkdownError(ErrorCode.createNodeInParserFail, message);
}
function h() {
return new t(
n.stackOverFlow,
function stackOverFlow() {
return new MilkdownError(
ErrorCode.stackOverFlow,
"Stack over flow, cannot pop on an empty stack."
);
}
function w(e) {
return new t(
n.parserMatchError,
`Cannot match target parser for node: ${i(e)}.`
function parserMatchError(node) {
return new MilkdownError(
ErrorCode.parserMatchError,
`Cannot match target parser for node: ${stringify(node)}.`
);
}
function F(e) {
return new t(
n.serializerMatchError,
`Cannot match target serializer for node: ${i(e)}.`
function serializerMatchError(node) {
return new MilkdownError(
ErrorCode.serializerMatchError,
`Cannot match target serializer for node: ${stringify(node)}.`
);
}
function N(e, o) {
return new t(
n.getAtomFromSchemaFail,
`Cannot get ${e}: ${o} from schema.`
function getAtomFromSchemaFail(type, name) {
return new MilkdownError(
ErrorCode.getAtomFromSchemaFail,
`Cannot get ${type}: ${name} from schema.`
);
}
function S(e) {
return new t(
n.expectDomTypeError,
`Expect to be a dom, but get: ${i(e)}.`
function expectDomTypeError(node) {
return new MilkdownError(
ErrorCode.expectDomTypeError,
`Expect to be a dom, but get: ${stringify(node)}.`
);
}
function y() {
return new t(
n.callCommandBeforeEditorView,
function callCommandBeforeEditorView() {
return new MilkdownError(
ErrorCode.callCommandBeforeEditorView,
"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized"
);
}
function k() {
return new t(
n.missingRootElement,
function missingRootElement() {
return new MilkdownError(
ErrorCode.missingRootElement,
"Missing root element, milkdown cannot find root element of the editor."
);
}
function M(e) {
return new t(
n.missingNodeInSchema,
`Missing node in schema, milkdown cannot find "${e}" in schema.`
function missingNodeInSchema(name) {
return new MilkdownError(
ErrorCode.missingNodeInSchema,
`Missing node in schema, milkdown cannot find "${name}" in schema.`
);
}
function x(e) {
return new t(
n.missingMarkInSchema,
`Missing mark in schema, milkdown cannot find "${e}" in schema.`
function missingMarkInSchema(name) {
return new MilkdownError(
ErrorCode.missingMarkInSchema,
`Missing mark in schema, milkdown cannot find "${name}" in schema.`
);
}
function O() {
return new t(
n.ctxNotBind,
function ctxNotBind() {
return new MilkdownError(
ErrorCode.ctxNotBind,
"Context not bind, please make sure the plugin has been initialized."
);
}
function E() {
return new t(
n.missingYjsDoc,
function missingYjsDoc() {
return new MilkdownError(
ErrorCode.missingYjsDoc,
"Missing yjs doc, please make sure you have bind one."

@@ -109,19 +138,19 @@ );

export {
y as callCommandBeforeEditorView,
d as contextNotFound,
g as createNodeInParserFail,
p as ctxCallOutOfScope,
O as ctxNotBind,
l as docTypeError,
S as expectDomTypeError,
N as getAtomFromSchemaFail,
x as missingMarkInSchema,
M as missingNodeInSchema,
k as missingRootElement,
E as missingYjsDoc,
w as parserMatchError,
F as serializerMatchError,
h as stackOverFlow,
f as timerNotFound
callCommandBeforeEditorView,
contextNotFound,
createNodeInParserFail,
ctxCallOutOfScope,
ctxNotBind,
docTypeError,
expectDomTypeError,
getAtomFromSchemaFail,
missingMarkInSchema,
missingNodeInSchema,
missingRootElement,
missingYjsDoc,
parserMatchError,
serializerMatchError,
stackOverFlow,
timerNotFound
};
//# sourceMappingURL=index.es.js.map
{
"name": "@milkdown/exception",
"type": "module",
"version": "7.6.3",
"version": "7.6.4",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is not supported yet