@grexx/grexxlinter 0.2.1196 → 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 +14 -2
  2. package/lsp.js +24 -3
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -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.1196" : "0.0.0-dev";
15127
+ var VERSION = true ? "0.2.1201" : "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 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 };
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 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
  }
@@ -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 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 });
24154
24175
  if (result.skipped) continue;
24155
24176
  for (const m of result.messages) {
24156
24177
  diagnostics.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grexx/grexxlinter",
3
- "version": "0.2.1196",
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": {