@grexx/grexxlinter 0.2.1196 → 0.2.1222
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/cli.js +20 -8
- package/lsp.js +31 -10
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -14609,7 +14609,7 @@ function createSchemaRegistry(schemas) {
|
|
|
14609
14609
|
if (!frag) return schema;
|
|
14610
14610
|
let cur = schema;
|
|
14611
14611
|
for (const raw of frag.split("/").filter(Boolean)) {
|
|
14612
|
-
const key2 = raw.
|
|
14612
|
+
const key2 = raw.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
14613
14613
|
if (cur == null || typeof cur !== "object") return null;
|
|
14614
14614
|
cur = cur[key2];
|
|
14615
14615
|
}
|
|
@@ -14663,7 +14663,7 @@ function normalizeSettings(partial) {
|
|
|
14663
14663
|
return {
|
|
14664
14664
|
...DEFAULT_LINTER_SETTINGS,
|
|
14665
14665
|
...partial,
|
|
14666
|
-
rules: { ...DEFAULT_LINTER_SETTINGS.rules, ...partial?.rules
|
|
14666
|
+
rules: { ...DEFAULT_LINTER_SETTINGS.rules, ...partial?.rules }
|
|
14667
14667
|
};
|
|
14668
14668
|
}
|
|
14669
14669
|
function severityFor(rule, settings) {
|
|
@@ -14837,7 +14837,7 @@ var META_KEYWORDS = /* @__PURE__ */ new Set(["if", "then", "else", "allOf", "any
|
|
|
14837
14837
|
function lastSegment(pointer) {
|
|
14838
14838
|
if (!pointer) return null;
|
|
14839
14839
|
const seg = pointer.split("/").pop();
|
|
14840
|
-
return seg ? seg.
|
|
14840
|
+
return seg ? seg.replaceAll("~1", "/").replaceAll("~0", "~") : null;
|
|
14841
14841
|
}
|
|
14842
14842
|
function humanize(err) {
|
|
14843
14843
|
const p = err.params;
|
|
@@ -14932,7 +14932,7 @@ function schemaAtPointer(rootSchema, pointer, resolve2) {
|
|
|
14932
14932
|
if (Array.isArray(items)) items = items[Number(raw)] ?? items[0];
|
|
14933
14933
|
schema = deref(items, resolve2, docRoot);
|
|
14934
14934
|
} else {
|
|
14935
|
-
const key2 = raw.
|
|
14935
|
+
const key2 = raw.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
14936
14936
|
schema = deref(propSchema(schema, key2), resolve2, docRoot);
|
|
14937
14937
|
}
|
|
14938
14938
|
}
|
|
@@ -14965,14 +14965,14 @@ function valueAtPointer(root, pointer) {
|
|
|
14965
14965
|
if (!pointer) return root;
|
|
14966
14966
|
let cur = root;
|
|
14967
14967
|
for (const raw of pointer.split("/").slice(1)) {
|
|
14968
|
-
const key2 = raw.
|
|
14968
|
+
const key2 = raw.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
14969
14969
|
if (cur == null || typeof cur !== "object") return void 0;
|
|
14970
14970
|
cur = cur[key2];
|
|
14971
14971
|
}
|
|
14972
14972
|
return cur;
|
|
14973
14973
|
}
|
|
14974
14974
|
function normToken(s) {
|
|
14975
|
-
return s.toLowerCase().
|
|
14975
|
+
return s.toLowerCase().replaceAll(/[-_\s]/g, "");
|
|
14976
14976
|
}
|
|
14977
14977
|
function caseOnlyMatch(actual, allowed) {
|
|
14978
14978
|
if (typeof actual !== "string") return null;
|
|
@@ -15113,11 +15113,18 @@ function summarize(results) {
|
|
|
15113
15113
|
function isLintableYaml(text) {
|
|
15114
15114
|
return text.includes("_type");
|
|
15115
15115
|
}
|
|
15116
|
+
function toJSOrError(doc) {
|
|
15117
|
+
try {
|
|
15118
|
+
return { value: doc.toJS() };
|
|
15119
|
+
} catch (e) {
|
|
15120
|
+
return { error: e.message };
|
|
15121
|
+
}
|
|
15122
|
+
}
|
|
15116
15123
|
|
|
15117
15124
|
// src/cli.ts
|
|
15118
15125
|
var PARALLEL_THRESHOLD = 200;
|
|
15119
15126
|
var MAX_WORKERS = 8;
|
|
15120
|
-
var VERSION = true ? "0.2.
|
|
15127
|
+
var VERSION = true ? "0.2.1222" : "0.0.0-dev";
|
|
15121
15128
|
function isNewer(latest, current) {
|
|
15122
15129
|
const a = latest.split(".").map(Number);
|
|
15123
15130
|
const b = current.split(".").map(Number);
|
|
@@ -15275,7 +15282,12 @@ function lintFiles(files, ctx, settings) {
|
|
|
15275
15282
|
out.push(parseErr(file, doc.errors[0].message));
|
|
15276
15283
|
continue;
|
|
15277
15284
|
}
|
|
15278
|
-
const
|
|
15285
|
+
const resolved = toJSOrError(doc);
|
|
15286
|
+
if (resolved.error !== void 0) {
|
|
15287
|
+
out.push(parseErr(file, resolved.error));
|
|
15288
|
+
continue;
|
|
15289
|
+
}
|
|
15290
|
+
const input = { value: resolved.value, file };
|
|
15279
15291
|
const result = lintDocument({ registry: ctx.registry, coverage: ctx.coverage, settings }, input);
|
|
15280
15292
|
const refs = referenceFindings(input.value, file, caseRefs, settings);
|
|
15281
15293
|
if (refs.length) {
|
package/lsp.js
CHANGED
|
@@ -16081,7 +16081,7 @@ var require_public_api = __commonJS({
|
|
|
16081
16081
|
const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter() || null;
|
|
16082
16082
|
return { lineCounter: lineCounter$1, prettyErrors };
|
|
16083
16083
|
}
|
|
16084
|
-
function
|
|
16084
|
+
function parseAllDocuments3(source, options = {}) {
|
|
16085
16085
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
16086
16086
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
16087
16087
|
const composer$1 = new composer.Composer(options);
|
|
@@ -16156,7 +16156,7 @@ var require_public_api = __commonJS({
|
|
|
16156
16156
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
16157
16157
|
}
|
|
16158
16158
|
exports.parse = parse;
|
|
16159
|
-
exports.parseAllDocuments =
|
|
16159
|
+
exports.parseAllDocuments = parseAllDocuments3;
|
|
16160
16160
|
exports.parseDocument = parseDocument;
|
|
16161
16161
|
exports.stringify = stringify;
|
|
16162
16162
|
}
|
|
@@ -23678,7 +23678,7 @@ function createSchemaRegistry(schemas) {
|
|
|
23678
23678
|
if (!frag) return schema;
|
|
23679
23679
|
let cur = schema;
|
|
23680
23680
|
for (const raw of frag.split("/").filter(Boolean)) {
|
|
23681
|
-
const key2 = raw.
|
|
23681
|
+
const key2 = raw.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
23682
23682
|
if (cur == null || typeof cur !== "object") return null;
|
|
23683
23683
|
cur = cur[key2];
|
|
23684
23684
|
}
|
|
@@ -23719,7 +23719,7 @@ function normalizeSettings(partial) {
|
|
|
23719
23719
|
return {
|
|
23720
23720
|
...DEFAULT_LINTER_SETTINGS,
|
|
23721
23721
|
...partial,
|
|
23722
|
-
rules: { ...DEFAULT_LINTER_SETTINGS.rules, ...partial?.rules
|
|
23722
|
+
rules: { ...DEFAULT_LINTER_SETTINGS.rules, ...partial?.rules }
|
|
23723
23723
|
};
|
|
23724
23724
|
}
|
|
23725
23725
|
function severityFor(rule, settings2) {
|
|
@@ -23795,7 +23795,7 @@ var META_KEYWORDS = /* @__PURE__ */ new Set(["if", "then", "else", "allOf", "any
|
|
|
23795
23795
|
function lastSegment(pointer) {
|
|
23796
23796
|
if (!pointer) return null;
|
|
23797
23797
|
const seg = pointer.split("/").pop();
|
|
23798
|
-
return seg ? seg.
|
|
23798
|
+
return seg ? seg.replaceAll("~1", "/").replaceAll("~0", "~") : null;
|
|
23799
23799
|
}
|
|
23800
23800
|
function humanize(err) {
|
|
23801
23801
|
const p = err.params;
|
|
@@ -23890,7 +23890,7 @@ function schemaAtPointer(rootSchema, pointer, resolve2) {
|
|
|
23890
23890
|
if (Array.isArray(items)) items = items[Number(raw)] ?? items[0];
|
|
23891
23891
|
schema = deref(items, resolve2, docRoot);
|
|
23892
23892
|
} else {
|
|
23893
|
-
const key2 = raw.
|
|
23893
|
+
const key2 = raw.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
23894
23894
|
schema = deref(propSchema(schema, key2), resolve2, docRoot);
|
|
23895
23895
|
}
|
|
23896
23896
|
}
|
|
@@ -23923,14 +23923,14 @@ function valueAtPointer(root, pointer) {
|
|
|
23923
23923
|
if (!pointer) return root;
|
|
23924
23924
|
let cur = root;
|
|
23925
23925
|
for (const raw of pointer.split("/").slice(1)) {
|
|
23926
|
-
const key2 = raw.
|
|
23926
|
+
const key2 = raw.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
23927
23927
|
if (cur == null || typeof cur !== "object") return void 0;
|
|
23928
23928
|
cur = cur[key2];
|
|
23929
23929
|
}
|
|
23930
23930
|
return cur;
|
|
23931
23931
|
}
|
|
23932
23932
|
function normToken(s) {
|
|
23933
|
-
return s.toLowerCase().
|
|
23933
|
+
return s.toLowerCase().replaceAll(/[-_\s]/g, "");
|
|
23934
23934
|
}
|
|
23935
23935
|
function caseOnlyMatch(actual, allowed) {
|
|
23936
23936
|
if (typeof actual !== "string") return null;
|
|
@@ -24061,7 +24061,7 @@ function parseWithPositions(src) {
|
|
|
24061
24061
|
}
|
|
24062
24062
|
var ZERO_RANGE = { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };
|
|
24063
24063
|
function unescapePointerSegment(seg) {
|
|
24064
|
-
return seg.
|
|
24064
|
+
return seg.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
24065
24065
|
}
|
|
24066
24066
|
function offsetsToRange(lc, range) {
|
|
24067
24067
|
if (!range) return ZERO_RANGE;
|
|
@@ -24090,6 +24090,16 @@ function rangeForError(lc, pos) {
|
|
|
24090
24090
|
return offsetsToRange(lc, [pos[0], pos[1], pos[1]]);
|
|
24091
24091
|
}
|
|
24092
24092
|
|
|
24093
|
+
// src/yaml.ts
|
|
24094
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
24095
|
+
function toJSOrError(doc) {
|
|
24096
|
+
try {
|
|
24097
|
+
return { value: doc.toJS() };
|
|
24098
|
+
} catch (e) {
|
|
24099
|
+
return { error: e.message };
|
|
24100
|
+
}
|
|
24101
|
+
}
|
|
24102
|
+
|
|
24093
24103
|
// src/lsp.ts
|
|
24094
24104
|
function log(msg) {
|
|
24095
24105
|
process.stderr.write(`[grexxlint-lsp] ${msg}
|
|
@@ -24150,7 +24160,18 @@ function computeDiagnostics(doc) {
|
|
|
24150
24160
|
}
|
|
24151
24161
|
continue;
|
|
24152
24162
|
}
|
|
24153
|
-
const
|
|
24163
|
+
const resolved = toJSOrError(parsed);
|
|
24164
|
+
if (resolved.error !== void 0) {
|
|
24165
|
+
diagnostics.push({
|
|
24166
|
+
severity: import_node.DiagnosticSeverity.Error,
|
|
24167
|
+
source: "grexxlint",
|
|
24168
|
+
code: "parse-error",
|
|
24169
|
+
range: rangeForError(lineCounter, void 0),
|
|
24170
|
+
message: resolved.error
|
|
24171
|
+
});
|
|
24172
|
+
continue;
|
|
24173
|
+
}
|
|
24174
|
+
const result = lintDocument({ ...ctx, settings }, { value: resolved.value, file: doc.uri });
|
|
24154
24175
|
if (result.skipped) continue;
|
|
24155
24176
|
for (const m of result.messages) {
|
|
24156
24177
|
diagnostics.push({
|