nanos-lint 2.6.1 → 2.7.0

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/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as runCLI, n as createProgram, r as isDirectExecution, t as collectIgnorePatterns } from "./cli-5LLXRlN7.js";
1
+ import { i as runCLI, n as createProgram, r as isDirectExecution, t as collectIgnorePatterns } from "./cli-sEO_MZ-K.js";
2
2
  export { collectIgnorePatterns, createProgram, isDirectExecution, runCLI };
package/dist/index.d.ts CHANGED
@@ -157,7 +157,13 @@ export declare function sanitizeLuaLSVersion(raw: string): string | null;
157
157
  */
158
158
  export declare function escapePowerShellSingleQuote(str: string): string;
159
159
  /**
160
- * Resolves the latest available LuaLS release tag from the GitHub API.
160
+ * Fetches the latest available LuaLS release tag from the GitHub API.
161
+ * Returns null if the request fails, times out, or receives an invalid tag.
162
+ */
163
+ export declare function fetchLatestLuaLSVersionFromGitHub(): Promise<string | null>;
164
+ /**
165
+ * Resolves the latest available LuaLS release tag from the GitHub API,
166
+ * falling back to FALLBACK_LUALS_VERSION if offline or unreachable.
161
167
  */
162
168
  export declare function resolveLatestLuaLSVersion(): Promise<string>;
163
169
  /**
@@ -173,14 +179,50 @@ export interface PlatformInfo {
173
179
  binaryRelativePath: string;
174
180
  }
175
181
  export declare function getPlatformInfo(version?: string): PlatformInfo;
176
- export declare function getCacheDir(version?: string): string;
182
+ export declare function getBaseLuaLSCacheDir(): string;
183
+ /**
184
+ * Cache directory of a LuaLS version. `baseCacheDir` defaults to the system
185
+ * cache and can be overridden to keep a caller isolated from it.
186
+ */
187
+ export declare function getCacheDir(version?: string, baseCacheDir?: string): string;
177
188
  /**
178
189
  * Returns the legacy cache directory used in nanos-lint <= 2.2.1.
179
190
  */
180
191
  export declare function getLegacyCacheDir(version?: string): string;
192
+ export declare const LUALS_METADATA_FILENAME = "metadata.json";
193
+ export interface LuaLSMetadata {
194
+ lastCheckedWeek: string;
195
+ latestVersion: string;
196
+ lastCheckedDate?: string;
197
+ }
198
+ /**
199
+ * Calculates the ISO 8601 week string for a given date in the format 'YYYY-Www' (e.g. '2026-W39').
200
+ */
201
+ export declare function getIsoWeek(d?: Date): string;
202
+ export declare function getLuaLSMetadataPath(baseCacheDir?: string): string;
203
+ export declare function readLuaLSMetadata(baseCacheDir?: string): LuaLSMetadata | null;
204
+ export declare function writeLuaLSMetadata(metadata: LuaLSMetadata, baseCacheDir?: string): void;
205
+ /**
206
+ * Lists all cached LuaLS versions in baseCacheDir that have a valid .complete marker
207
+ * and a functional executable binary.
208
+ */
209
+ export declare function listCachedLuaLSVersions(baseCacheDir?: string): string[];
210
+ /**
211
+ * Removes older cached LuaLS version directories, preserving keepVersion,
212
+ * hidden/temporary directories, and metadata files.
213
+ */
214
+ export declare function cleanupOldCachedLuaLSVersions(keepVersion: string, baseCacheDir?: string): string[];
181
215
  export interface DownloadOptions {
182
216
  quiet?: boolean;
217
+ reuseExisting?: boolean;
218
+ /** Base directory searched for an installed copy when reusing. Defaults to the system cache. */
219
+ cacheDir?: string;
183
220
  }
221
+ /**
222
+ * Locates an existing, valid LuaLS directory for the specified version in the
223
+ * primary cache (`baseCacheDir`), the legacy cache, or the package root.
224
+ */
225
+ export declare function findExistingLuaLSDir(version: string, baseCacheDir?: string): string | null;
184
226
  /**
185
227
  * Verifies that a LuaLS binary exists, has non-trivial size, and is executable.
186
228
  */
@@ -188,6 +230,10 @@ export declare function isBinaryValid(binaryPath: string): boolean;
188
230
  export declare function downloadAndExtractLuaLS(version?: string, targetDir?: string, options?: DownloadOptions): Promise<string>;
189
231
  export interface ResolveLuaLSOptions {
190
232
  quiet?: boolean;
233
+ /** Cache base directory (version directories, metadata, temp extraction). Defaults to the system cache. */
234
+ cacheDir?: string;
235
+ /** Set to `false` to always fetch the archive instead of reusing an installed copy. */
236
+ reuseExisting?: boolean;
191
237
  }
192
238
  export declare function resolveLuaLSBinary(version?: string, options?: ResolveLuaLSOptions): Promise<string>;
193
239
  export declare function runLuaLSCheck(targetPath: string, configPath: string, options: CheckOptions): Promise<CheckResult>;
@@ -340,5 +386,27 @@ export interface ResolveAnnotationsOptions {
340
386
  */
341
387
  export declare function resolveAnnotations(options?: ResolveAnnotationsOptions): Promise<string>;
342
388
  //#endregion
389
+ //#region src/logger.d.ts
390
+ export type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
391
+ export declare const LOG_LEVELS: ReadonlyArray<LogLevel>;
392
+ export declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
393
+ export declare const DEFAULT_LOG_LEVEL: LogLevel;
394
+ export declare function isValidLogLevel(level: string): level is LogLevel;
395
+ export declare function parseLogLevel(raw?: string | null): LogLevel;
396
+ export declare class Logger {
397
+ private level;
398
+ constructor(initialLevel?: LogLevel);
399
+ setLevel(level: LogLevel): void;
400
+ getLevel(): LogLevel;
401
+ isEnabledFor(level: LogLevel): boolean;
402
+ /** Whether command results should be written; only `silent` disables them. */
403
+ isOutputEnabled(): boolean;
404
+ error(...args: unknown[]): void;
405
+ warn(...args: unknown[]): void;
406
+ info(...args: unknown[]): void;
407
+ debug(...args: unknown[]): void;
408
+ }
409
+ export declare const logger: Logger;
410
+ //#endregion
343
411
  export { CreateProgramOptions, collectIgnorePatterns, createProgram, isDirectExecution, runCLI };
344
412
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/config.ts","../src/luals.ts","../src/reporter.ts","../node_modules/env-paths/index.d.ts","../src/paths.ts","../src/annotations.ts"],"x_google_ignoreList":[4],"mappings":";;YAEY;YACA;iBAEK;EACf;IACE;IACA;;EAEF;IACE;IACA;;;iBAIa;EACf,OAAO;EACP,UAAU;EACV;EACA;EACA;;YAGU,mBAAmB,eAAe;iBAE7B;EACf;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;;iB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;;;;;wBAMG,WAAW;;;qBCPd;qBACA;qBACA;qBAEA;iBAGI;EACf;EACA;EACA;;iBAGe;EACf;EACA;EACA,MAAM;;qBAGK;qBACA;wBAEG,mBAAmB,IAAG;EAAsB;EAAiB,SAAS;;wBAWtE;wBAIA;wBAIA;wBAIA,wBAAwB,oBAA8C;wBAiBhE,uBAAuB;wBAsBvB,8BAA8B;;;;wBAkCpC,sBACd,kBACA,oBACC;;;;;wBAgCmB,4BACpB,kBACA,mBACA;EAAY;IACX;iBAiHc;EACf;EACA;EACA;;;;;;;;;;wBAWoB,mBAAmB,UAAS,4BAAiC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/config.ts","../src/luals.ts","../src/reporter.ts","../node_modules/env-paths/index.d.ts","../src/paths.ts","../src/annotations.ts","../src/logger.ts"],"x_google_ignoreList":[4],"mappings":";;YAGY;YACA;iBAEK;EACf;IACE;IACA;;EAEF;IACE;IACA;;;iBAIa;EACf,OAAO;EACP,UAAU;EACV;EACA;EACA;;YAGU,mBAAmB,eAAe;iBAE7B;EACf;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;;iBAGE;EACf;EACA;IACE;IACA;KACC;;EAEH;IACE;IACA;IACA;KACC;;EAEH;IACE;KACC;;EAEH;IACE;IACA;IACA;IACA,WAAW;IACX,mBAAmB;KAClB;;GAEF;;;;;;wBAOa,cAAc;;;;;;wBCnEd;wBAWA;;;;;wBAmBA;wBAIA;;;;wBAQA,kBAAkB;wBAKlB,WAAW,aAAa,eAAe;wBAavC,eAAe,mBAAmB;;;;;;;;;wBAgBlC,qBAAqB;iBAQpB;EACf;;;;;;;;;;;;wBAac,aACd,MAAM,aACN,WAAU,aACV,0BACA,UAAU,qBACT;iBAqHc;EACf;EACA;;;;;;wBAOc,uBACd,uBACA,2BACA,UAAU;EACP;EAAoB;;iBA6ER;EACf;EACA;;;;;wBAMc,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hE,uBAAuB;wBAsBvB,8BAA8B;;;;wBAkCpC,sBACd,kBACA,oBACC;;;;;wBAgCmB,4BACpB,kBACA,mBACA;EAAY;IACX;iBAiHc;EACf;EACA;EACA;;;;;;;;;;wBAWoB,mBAAmB,UAAS,4BAAiC;;;YCnSvE;qBAEC,YAAY,cAAc;qBAQ1B,oBAAoB,OAAO;qBAQ3B,mBAAmB;wBAEhB,gBAAgB,gBAAgB,SAAS;wBAIzC,cAAc,sBAAsB;qBAMvC;UACH;EAEI,YAAA,eAAe;EAYpB,SAAS,OAAO;EAMhB,YAAY;EAIZ,aAAa,OAAO;;EAKpB;EAIA,SAAS;EAMT,QAAQ;EAMR,QAAQ;EAMR,SAAS;;qBAOL,QAAM"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as stripTrailingSlashes, A as FALLBACK_LUALS_VERSION, B as resolveLuaLSVersion, C as formatProblemSummary, D as pluralize, E as getColors, F as getLegacyCacheDir, G as getDefinitionsDir, H as sanitizeLuaLSVersion, I as getPlatformInfo, J as loadConfigFile, K as getPackageRoot, L as isBinaryValid, M as downloadAndExtractLuaLS, N as escapePowerShellSingleQuote, O as shouldEnableColor, P as getCacheDir, Q as stripJsonComments, R as resolveLatestLuaLSVersion, S as formatPretty, T as formatSeverityBadge, U as getDefaultAnnotationsPath, V as runLuaLSCheck, W as getDefaultTemplatePath, X as parseJsonc, Y as mergeConfigs, Z as resolveWorkspaceConfig, _ as getTodayDateString, a as ANNOTATIONS_FILENAME, b as updateLastCheckedDate, c as GITHUB_COMMITS_API, d as downloadAndCacheAnnotations, et as cleanCache, f as fetchLatestCommitId, g as getCachedAnnotationsFilePath, h as getAnnotationsMetadataFilePath, i as runCLI, j as countCheckedFiles, k as DEFAULT_LUALS_VERSION, l as METADATA_FILENAME, m as getAnnotationsCacheDir, n as createProgram, nt as fileUriToPath, o as DOCGEN_BRANCH, p as fetchRawAnnotationsContent, q as initWorkspace, r as isDirectExecution, s as DOCGEN_REPO, t as collectIgnorePatterns, tt as systemPaths, u as RAW_ANNOTATIONS_URL, v as readAnnotationsMetadata, w as formatReport, x as formatGitHubAnnotations, y as resolveAnnotations, z as resolveLuaLSBinary } from "./cli-5LLXRlN7.js";
2
- export { ANNOTATIONS_FILENAME, DEFAULT_LUALS_VERSION, DOCGEN_BRANCH, DOCGEN_REPO, FALLBACK_LUALS_VERSION, GITHUB_COMMITS_API, METADATA_FILENAME, RAW_ANNOTATIONS_URL, cleanCache, collectIgnorePatterns, countCheckedFiles, createProgram, downloadAndCacheAnnotations, downloadAndExtractLuaLS, escapePowerShellSingleQuote, fetchLatestCommitId, fetchRawAnnotationsContent, fileUriToPath, formatGitHubAnnotations, formatPretty, formatProblemSummary, formatReport, formatSeverityBadge, getAnnotationsCacheDir, getAnnotationsMetadataFilePath, getCacheDir, getCachedAnnotationsFilePath, getColors, getDefaultAnnotationsPath, getDefaultTemplatePath, getDefinitionsDir, getLegacyCacheDir, getPackageRoot, getPlatformInfo, getTodayDateString, initWorkspace, isBinaryValid, isDirectExecution, loadConfigFile, mergeConfigs, parseJsonc, pluralize, readAnnotationsMetadata, resolveAnnotations, resolveLatestLuaLSVersion, resolveLuaLSBinary, resolveLuaLSVersion, resolveWorkspaceConfig, runCLI, runLuaLSCheck, sanitizeLuaLSVersion, shouldEnableColor, stripJsonComments, stripTrailingSlashes, systemPaths, updateLastCheckedDate };
1
+ import { $ as getDefaultAnnotationsPath, A as FALLBACK_LUALS_VERSION, B as getIsoWeek, C as formatProblemSummary, D as pluralize, E as getColors, F as escapePowerShellSingleQuote, G as listCachedLuaLSVersions, H as getLuaLSMetadataPath, I as fetchLatestLuaLSVersionFromGitHub, J as resolveLuaLSBinary, K as readLuaLSMetadata, L as findExistingLuaLSDir, M as cleanupOldCachedLuaLSVersions, N as countCheckedFiles, O as shouldEnableColor, P as downloadAndExtractLuaLS, Q as writeLuaLSMetadata, R as getBaseLuaLSCacheDir, S as formatPretty, T as formatSeverityBadge, U as getPlatformInfo, V as getLegacyCacheDir, W as isBinaryValid, X as runLuaLSCheck, Y as resolveLuaLSVersion, Z as sanitizeLuaLSVersion, _ as getTodayDateString, _t as isValidLogLevel, a as ANNOTATIONS_FILENAME, at as mergeConfigs, b as updateLastCheckedDate, c as GITHUB_COMMITS_API, ct as stripJsonComments, d as downloadAndCacheAnnotations, dt as systemPaths, et as getDefaultTemplatePath, f as fetchLatestCommitId, ft as fileUriToPath, g as getCachedAnnotationsFilePath, gt as Logger, h as getAnnotationsMetadataFilePath, ht as LOG_LEVEL_PRIORITY, i as runCLI, it as loadConfigFile, j as LUALS_METADATA_FILENAME, k as DEFAULT_LUALS_VERSION, l as METADATA_FILENAME, lt as stripTrailingSlashes, m as getAnnotationsCacheDir, mt as LOG_LEVELS, n as createProgram, nt as getPackageRoot, o as DOCGEN_BRANCH, ot as parseJsonc, p as fetchRawAnnotationsContent, pt as DEFAULT_LOG_LEVEL, q as resolveLatestLuaLSVersion, r as isDirectExecution, rt as initWorkspace, s as DOCGEN_REPO, st as resolveWorkspaceConfig, t as collectIgnorePatterns, tt as getDefinitionsDir, u as RAW_ANNOTATIONS_URL, ut as cleanCache, v as readAnnotationsMetadata, vt as logger, w as formatReport, x as formatGitHubAnnotations, y as resolveAnnotations, yt as parseLogLevel, z as getCacheDir } from "./cli-sEO_MZ-K.js";
2
+ export { ANNOTATIONS_FILENAME, DEFAULT_LOG_LEVEL, DEFAULT_LUALS_VERSION, DOCGEN_BRANCH, DOCGEN_REPO, FALLBACK_LUALS_VERSION, GITHUB_COMMITS_API, LOG_LEVELS, LOG_LEVEL_PRIORITY, LUALS_METADATA_FILENAME, Logger, METADATA_FILENAME, RAW_ANNOTATIONS_URL, cleanCache, cleanupOldCachedLuaLSVersions, collectIgnorePatterns, countCheckedFiles, createProgram, downloadAndCacheAnnotations, downloadAndExtractLuaLS, escapePowerShellSingleQuote, fetchLatestCommitId, fetchLatestLuaLSVersionFromGitHub, fetchRawAnnotationsContent, fileUriToPath, findExistingLuaLSDir, formatGitHubAnnotations, formatPretty, formatProblemSummary, formatReport, formatSeverityBadge, getAnnotationsCacheDir, getAnnotationsMetadataFilePath, getBaseLuaLSCacheDir, getCacheDir, getCachedAnnotationsFilePath, getColors, getDefaultAnnotationsPath, getDefaultTemplatePath, getDefinitionsDir, getIsoWeek, getLegacyCacheDir, getLuaLSMetadataPath, getPackageRoot, getPlatformInfo, getTodayDateString, initWorkspace, isBinaryValid, isDirectExecution, isValidLogLevel, listCachedLuaLSVersions, loadConfigFile, logger, mergeConfigs, parseJsonc, parseLogLevel, pluralize, readAnnotationsMetadata, readLuaLSMetadata, resolveAnnotations, resolveLatestLuaLSVersion, resolveLuaLSBinary, resolveLuaLSVersion, resolveWorkspaceConfig, runCLI, runLuaLSCheck, sanitizeLuaLSVersion, shouldEnableColor, stripJsonComments, stripTrailingSlashes, systemPaths, updateLastCheckedDate, writeLuaLSMetadata };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanos-lint",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "Linter and type-checker for nanos world Lua scripts powered by LuaLS",
5
5
  "keywords": [
6
6
  "nanos-world",