@grexx/grexxlinter 0.2.1146 → 0.2.1201

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.
Files changed (3) hide show
  1. package/cli.js +19 -3
  2. package/lsp.js +29 -4
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -14577,7 +14577,11 @@ function createSchemaRegistry(schemas) {
14577
14577
  const m = /^https:\/\/grexx\.net\/studio-next\/schemas\/([^/]+)\.schema\.json$/.exec(id);
14578
14578
  if (m) casetypes.push(m[1]);
14579
14579
  }
14580
- casetypes.sort();
14580
+ casetypes.sort((a, b) => {
14581
+ if (a < b) return -1;
14582
+ if (a > b) return 1;
14583
+ return 0;
14584
+ });
14581
14585
  const cache = /* @__PURE__ */ new Map();
14582
14586
  function validatorFor(casetype) {
14583
14587
  if (cache.has(casetype)) return cache.get(casetype) ?? null;
@@ -15109,11 +15113,18 @@ function summarize(results) {
15109
15113
  function isLintableYaml(text) {
15110
15114
  return text.includes("_type");
15111
15115
  }
15116
+ function toJSOrError(doc) {
15117
+ try {
15118
+ return { value: doc.toJS() };
15119
+ } catch (e) {
15120
+ return { error: e.message };
15121
+ }
15122
+ }
15112
15123
 
15113
15124
  // src/cli.ts
15114
15125
  var PARALLEL_THRESHOLD = 200;
15115
15126
  var MAX_WORKERS = 8;
15116
- var VERSION = true ? "0.2.1146" : "0.0.0-dev";
15127
+ var VERSION = true ? "0.2.1201" : "0.0.0-dev";
15117
15128
  function isNewer(latest, current) {
15118
15129
  const a = latest.split(".").map(Number);
15119
15130
  const b = current.split(".").map(Number);
@@ -15271,7 +15282,12 @@ function lintFiles(files, ctx, settings) {
15271
15282
  out.push(parseErr(file, doc.errors[0].message));
15272
15283
  continue;
15273
15284
  }
15274
- const input = { value: doc.toJS(), file };
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 };
15275
15291
  const result = lintDocument({ registry: ctx.registry, coverage: ctx.coverage, settings }, input);
15276
15292
  const refs = referenceFindings(input.value, file, caseRefs, settings);
15277
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 parseAllDocuments2(source, options = {}) {
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 = parseAllDocuments2;
16159
+ exports.parseAllDocuments = parseAllDocuments3;
16160
16160
  exports.parseDocument = parseDocument;
16161
16161
  exports.stringify = stringify;
16162
16162
  }
@@ -23646,7 +23646,11 @@ function createSchemaRegistry(schemas) {
23646
23646
  const m = /^https:\/\/grexx\.net\/studio-next\/schemas\/([^/]+)\.schema\.json$/.exec(id);
23647
23647
  if (m) casetypes.push(m[1]);
23648
23648
  }
23649
- casetypes.sort();
23649
+ casetypes.sort((a, b) => {
23650
+ if (a < b) return -1;
23651
+ if (a > b) return 1;
23652
+ return 0;
23653
+ });
23650
23654
  const cache = /* @__PURE__ */ new Map();
23651
23655
  function validatorFor(casetype) {
23652
23656
  if (cache.has(casetype)) return cache.get(casetype) ?? null;
@@ -24086,6 +24090,16 @@ function rangeForError(lc, pos) {
24086
24090
  return offsetsToRange(lc, [pos[0], pos[1], pos[1]]);
24087
24091
  }
24088
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
+
24089
24103
  // src/lsp.ts
24090
24104
  function log(msg) {
24091
24105
  process.stderr.write(`[grexxlint-lsp] ${msg}
@@ -24146,7 +24160,18 @@ function computeDiagnostics(doc) {
24146
24160
  }
24147
24161
  continue;
24148
24162
  }
24149
- const result = lintDocument({ ...ctx, settings }, { value: parsed.toJS(), file: doc.uri });
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 });
24150
24175
  if (result.skipped) continue;
24151
24176
  for (const m of result.messages) {
24152
24177
  diagnostics.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grexx/grexxlinter",
3
- "version": "0.2.1146",
3
+ "version": "0.2.1201",
4
4
  "description": "Lint Grexx Studio casetype YAML against the studio JSON Schemas.",
5
5
  "type": "module",
6
6
  "bin": {