node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var json$1 = require('@lezer/json');
var language = require('@codemirror/language');
/**
Calls
[`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
on the document and, if that throws an error, reports it as a
single diagnostic.
*/
const jsonParseLinter = () => (view) => {
try {
JSON.parse(view.state.doc.toString());
}
catch (e) {
if (!(e instanceof SyntaxError))
throw e;
const pos = getErrorPosition(e, view.state.doc);
return [{
from: pos,
message: e.message,
severity: 'error',
to: pos
}];
}
return [];
};
function getErrorPosition(error, doc) {
let m;
if (m = error.message.match(/at position (\d+)/))
return Math.min(+m[1], doc.length);
if (m = error.message.match(/at line (\d+) column (\d+)/))
return Math.min(doc.line(+m[1]).from + (+m[2]) - 1, doc.length);
return 0;
}
/**
A language provider that provides JSON parsing.
*/
const jsonLanguage = language.LRLanguage.define({
name: "json",
parser: json$1.parser.configure({
props: [
language.indentNodeProp.add({
Object: language.continuedIndent({ except: /^\s*\}/ }),
Array: language.continuedIndent({ except: /^\s*\]/ })
}),
language.foldNodeProp.add({
"Object Array": language.foldInside
})
]
}),
languageData: {
closeBrackets: { brackets: ["[", "{", '"'] },
indentOnInput: /^\s*[\}\]]$/
}
});
/**
JSON language support.
*/
function json() {
return new language.LanguageSupport(jsonLanguage);
}
exports.json = json;
exports.jsonLanguage = jsonLanguage;
exports.jsonParseLinter = jsonParseLinter;

View File

@@ -0,0 +1,22 @@
import { LRLanguage, LanguageSupport } from '@codemirror/language';
import { Diagnostic } from '@codemirror/lint';
import { EditorView } from '@codemirror/view';
/**
Calls
[`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
on the document and, if that throws an error, reports it as a
single diagnostic.
*/
declare const jsonParseLinter: () => (view: EditorView) => Diagnostic[];
/**
A language provider that provides JSON parsing.
*/
declare const jsonLanguage: LRLanguage;
/**
JSON language support.
*/
declare function json(): LanguageSupport;
export { json, jsonLanguage, jsonParseLinter };

View File

@@ -0,0 +1,64 @@
import { parser } from '@lezer/json';
import { LRLanguage, indentNodeProp, continuedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
/**
Calls
[`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
on the document and, if that throws an error, reports it as a
single diagnostic.
*/
const jsonParseLinter = () => (view) => {
try {
JSON.parse(view.state.doc.toString());
}
catch (e) {
if (!(e instanceof SyntaxError))
throw e;
const pos = getErrorPosition(e, view.state.doc);
return [{
from: pos,
message: e.message,
severity: 'error',
to: pos
}];
}
return [];
};
function getErrorPosition(error, doc) {
let m;
if (m = error.message.match(/at position (\d+)/))
return Math.min(+m[1], doc.length);
if (m = error.message.match(/at line (\d+) column (\d+)/))
return Math.min(doc.line(+m[1]).from + (+m[2]) - 1, doc.length);
return 0;
}
/**
A language provider that provides JSON parsing.
*/
const jsonLanguage = /*@__PURE__*/LRLanguage.define({
name: "json",
parser: /*@__PURE__*/parser.configure({
props: [
/*@__PURE__*/indentNodeProp.add({
Object: /*@__PURE__*/continuedIndent({ except: /^\s*\}/ }),
Array: /*@__PURE__*/continuedIndent({ except: /^\s*\]/ })
}),
/*@__PURE__*/foldNodeProp.add({
"Object Array": foldInside
})
]
}),
languageData: {
closeBrackets: { brackets: ["[", "{", '"'] },
indentOnInput: /^\s*[\}\]]$/
}
});
/**
JSON language support.
*/
function json() {
return new LanguageSupport(jsonLanguage);
}
export { json, jsonLanguage, jsonParseLinter };