@alint-js/plugin-js 0.0.29 → 0.0.31

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/dist/index.d.mts CHANGED
@@ -85,7 +85,7 @@ interface SourceText {
85
85
  text: string;
86
86
  }
87
87
  //#endregion
88
- //#region ../core/dist/types-CMLoj9J9.d.mts
88
+ //#region ../core/dist/types-CR_Grd6q.d.mts
89
89
  //#region src/config/types.d.ts
90
90
  type ModelSize = 'large' | 'medium' | 'small';
91
91
  interface RunnerCacheConfig {
@@ -96,7 +96,6 @@ interface RunnerConfig {
96
96
  /** Retries after the initial attempt for replay-safe agent failures. @default 2 */
97
97
  agentRetries?: number;
98
98
  cache?: boolean | RunnerCacheConfig;
99
- fileConcurrency?: number;
100
99
  ruleConcurrency?: number;
101
100
  stats?: boolean | RunnerStatsConfig;
102
101
  timeoutMs?: number;
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import { n as strictJsonSchema } from "./index-DoHiaFQM-9scNuUlY.mjs";
2
2
  import { t as __exportAll } from "./esm-F2YJn-T8.mjs";
3
- import { setTimeout } from "node:timers/promises";
4
3
  //#region ../plugin/dist/index.mjs
5
4
  function definePlugin(plugin) {
6
5
  return plugin;
@@ -53,21 +52,6 @@ Do not report:
53
52
 
54
53
  Return warnings only. If uncertain, use medium or low confidence instead of forcing a finding.
55
54
  `.trim();
56
- //#endregion
57
- //#region ../../node_modules/.pnpm/@moeru+std@0.1.0-beta.20/node_modules/@moeru/std/dist/error/index.js
58
- const isError = (err) => {
59
- if ("isError" in Error && Error.isError(new DOMException())) return Error.isError(err);
60
- if (err === null || typeof err !== "object" && typeof err !== "function") return false;
61
- if (err instanceof Error) return true;
62
- const tag = Object.prototype.toString.call(err);
63
- return tag === "[object DOMException]" || tag === "[object Error]";
64
- };
65
- const isErrorLike = (err) => {
66
- if (isError(err)) return true;
67
- if (err == null || typeof err !== "object" && typeof err !== "function") return false;
68
- return "message" in err && typeof err.message === "string" && "name" in err && typeof err.name === "string";
69
- };
70
- const errorMessageFrom = (err) => isErrorLike(err) ? err.message : err == null ? void 0 : String(err);
71
55
  const DEFAULT_CONFIG = {
72
56
  lang: void 0,
73
57
  message: void 0,
@@ -507,6 +491,43 @@ function pipe(...pipe$1) {
507
491
  };
508
492
  }
509
493
  //#endregion
494
+ //#region ../../node_modules/.pnpm/@moeru+std@0.1.0-beta.20/node_modules/@moeru/std/dist/error/index.js
495
+ const isError = (err) => {
496
+ if ("isError" in Error && Error.isError(new DOMException())) return Error.isError(err);
497
+ if (err === null || typeof err !== "object" && typeof err !== "function") return false;
498
+ if (err instanceof Error) return true;
499
+ const tag = Object.prototype.toString.call(err);
500
+ return tag === "[object DOMException]" || tag === "[object Error]";
501
+ };
502
+ const isErrorLike = (err) => {
503
+ if (isError(err)) return true;
504
+ if (err == null || typeof err !== "object" && typeof err !== "function") return false;
505
+ return "message" in err && typeof err.message === "string" && "name" in err && typeof err.name === "string";
506
+ };
507
+ const errorMessageFrom = (err) => isErrorLike(err) ? err.message : err == null ? void 0 : String(err);
508
+ //#endregion
509
+ //#region ../../node_modules/.pnpm/@moeru+std@0.1.0-beta.20/node_modules/@moeru/std/dist/sleep/index.js
510
+ const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
511
+ const sleepWithAbort = async (ms, signal) => {
512
+ if (!signal) return sleep(ms);
513
+ return new Promise((resolve, reject) => {
514
+ if (signal.aborted) {
515
+ reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
516
+ return;
517
+ }
518
+ const timer = setTimeout(() => {
519
+ signal.removeEventListener("abort", onAbort);
520
+ resolve();
521
+ }, ms);
522
+ signal.addEventListener("abort", onAbort, { once: true });
523
+ function onAbort() {
524
+ clearTimeout(timer);
525
+ signal?.removeEventListener("abort", onAbort);
526
+ reject(signal?.reason ?? new DOMException("Aborted", "AbortError"));
527
+ }
528
+ });
529
+ };
530
+ //#endregion
510
531
  //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.7.1_valibot@1.4.2_typescript@6.0.3_/node_modules/@valibot/to-json-schema/dist/index.mjs
511
532
  var dist_exports = /* @__PURE__ */ __exportAll({
512
533
  addGlobalDefs: () => addGlobalDefs,
@@ -1556,6 +1577,7 @@ async function generateStructured(options) {
1556
1577
  options.signal?.throwIfAborted();
1557
1578
  let response;
1558
1579
  try {
1580
+ options.signal?.throwIfAborted();
1559
1581
  response = await generateText({
1560
1582
  abortSignal: options.signal,
1561
1583
  baseURL: options.model.provider.endpoint,
@@ -1576,7 +1598,7 @@ async function generateStructured(options) {
1576
1598
  previousError = isRetriableHttpError(error) ? void 0 : callError;
1577
1599
  options.logger?.debug(`${options.operation} attempt ${attempt} failed while calling the model: ${callError}`);
1578
1600
  if (!isRetriableCallError(error) || attempt === maxAttempts) throw error;
1579
- await setTimeout(retryDelay(attempt), void 0, { signal: options.signal });
1601
+ await sleepWithAbort(retryDelay(attempt), options.signal);
1580
1602
  continue;
1581
1603
  }
1582
1604
  recordAttemptUsage(options, response);
@@ -1585,7 +1607,7 @@ async function generateStructured(options) {
1585
1607
  previousError = result.error;
1586
1608
  options.logger?.debug(`${options.operation} attempt ${attempt} returned an invalid structured result: ${previousError}`);
1587
1609
  if (!result.retriable || attempt === maxAttempts) throw new InvalidStructuredOutputError(`Invalid structured model response: ${previousError}`);
1588
- await setTimeout(retryDelay(attempt), void 0, { signal: options.signal });
1610
+ await sleepWithAbort(retryDelay(attempt), options.signal);
1589
1611
  }
1590
1612
  throw new InvalidStructuredOutputError("Model did not return a valid structured result");
1591
1613
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/plugin-js",
3
3
  "type": "module",
4
- "version": "0.0.29",
4
+ "version": "0.0.31",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -16,8 +16,8 @@
16
16
  "@valibot/to-json-schema": "^1.7.1",
17
17
  "apeira": "^0.0.7",
18
18
  "valibot": "^1.4.2",
19
- "@alint-js/core": "0.0.29",
20
- "@alint-js/plugin": "0.0.29"
19
+ "@alint-js/core": "0.0.31",
20
+ "@alint-js/plugin": "0.0.31"
21
21
  },
22
22
  "scripts": {
23
23
  "build": "tsdown",