nanos-lint 2.4.0 → 2.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"cli-r8LDolDk.d.ts","names":[],"sources":["../node_modules/commander/typings/index.d.ts","../src/cli.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;KAWK,aAAa,aAAa,oCAC3B,eACC,WAAW;cAEH,uBAAuB;EAClC;EACA;EACA;EACA;;;;;;;EAQA,YAAY,kBAAkB,cAAc;;UAY7B;;;EAGf;;EAEA;;cAGW;EACX;EACA;EACA;EACA;EACA;EACA,YAAY,GAAG,eAAe,UAAU,MAAM;EAC9C;;;;;;EAOA,YAAY,aAAa;;;;EAKzB;;;;EAKA,QAAQ,gBAAgB;;;;EAKxB,UAAU,GAAG,KAAK,eAAe,UAAU,MAAM;;;;EAKjD,QAAQ;;;;EAKR;;;;EAKA;;cAGW;EACX;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,GAAG,eAAe,UAAU,MAAM;EAC9C;EACA;EACA;EAEA,YAAY,eAAe;;;;EAK3B,QAAQ,gBAAgB;;;;;;;;;;;EAYxB,OAAO;;;;;;;;;;;EAYP,UAAU;;;;;;;;;;;EAYV,QAAQ,cAAc;;;;;;;EAQtB,IAAI;;;;EAKJ,UAAU,GAAG,KAAK,eAAe,UAAU,MAAM;;;;EAKjD,oBAAoB;;;;EAKpB,SAAS;;;;EAKT,QAAQ;;;;EAKR;;;;;EAMA;;;;EAKA,UAAU;;;;;;EAOV;;cAGW;;EAEX;EACA;EACA;EACA;EACA;EAEA;;;;;;;EAQA,eAAe;IACb;IACA;IACA;;;EAIF,eAAe,KAAK;;EAEpB,sBAAsB,KAAK;;EAE3B,WAAW,QAAQ;;EAEnB,kBAAkB,QAAQ;;EAE1B,aAAa,UAAU;;EAEvB,oBAAoB,UAAU;;EAG9B,aAAa,KAAK;;EA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AuBnB,MAAM,0BAA0B,eAAe;;;;;;;;;;;;;;;;;;;;EAqB/C,WACE,0BACA,eAAe,eACd;;;;;;;EAQH;;;;;;;EAQA;;;;;;;;;;;;;EAcA,aAAa,iBAAiB;;;;EAK9B,KAAK,UAAU,iBAAiB;;;;EAKhC,gBAAgB,UAAU,iBAAiB;;;;;;EAQ3C,YAAY;;EAEZ,YAAY,aAAa,iBAAiB;;;;EAI1C;;;;;;EAQA,QAAQ;;;;EAIR;;;;;;;;EASA,MAAM;;;;EAIN;;;;;;;;EASA,QAAQ;;;;EAIR;;;;;;EAOA,MAAM;;;;EAIN;;;;;;EAOA,KAAK;;;;EAIL;;;;;;;;;;;;;;EAeA,iBAAiB;;;;;;;;;;;;;EAcjB,cAAc;;;;EAId;;;;;;EAOA,UAAU;;;;EAIV;;;;;;;;;;;;;EAcA,cAAc;;;;EAId;;;;;;;;;;;;;EAcA,aAAa;;;;EAIb;;;;;;;EAQA,WAAW,UAAU;;EAErB,WAAW,KAAK;;;;EAKhB,gBAAgB,UAAU;;;;;;EAO1B,WAAW,0BAA0B;;;;;EAMrC,cAAc,QAAQ;;;;;;EAOtB,KAAK,UAAU;;EAEf,KAAK,KAAK;;;;;;;EAQV,YAAY,UAAU,qBAAqB;EAC3C,YACE,UAAU,qBACV,OAAO,SAAS;;;;EAMlB,GAAG,wBAAwB,cAAc;;UAG1B;EACf;EACA;;EAEA;;UAEe,iCAAiC;EAChD;;UAGe;EACf;EACA;;;;iBC5jCc,sBAAsB,aAAa;UAoBlC;EACf,eAAe;;iBAGD,cAAc,UAAU,uBAAuB;iBA8KzC,OAAO,kBAAyC;iBAwBtD,kBACd,wBACA"}
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-kmHD4epr.js";
1
+ import { i as runCLI, n as createProgram, r as isDirectExecution, t as collectIgnorePatterns } from "./cli-5LLXRlN7.js";
2
2
  export { collectIgnorePatterns, createProgram, isDirectExecution, runCLI };
package/dist/index.d.ts CHANGED
@@ -78,6 +78,11 @@ export declare function fileUriToPath(uri: string): string;
78
78
  * Finds the package root directory across both development (src/) and production (dist/) environments.
79
79
  */
80
80
  export declare function getPackageRoot(): string;
81
+ export declare function getDefaultAnnotationsPath(): string;
82
+ /**
83
+ * @deprecated Use getDefaultAnnotationsPath() instead.
84
+ * Returns the directory containing the resolved annotations.lua file.
85
+ */
81
86
  export declare function getDefinitionsDir(): string;
82
87
  export declare function getDefaultTemplatePath(): string;
83
88
  /**
@@ -86,17 +91,32 @@ export declare function getDefaultTemplatePath(): string;
86
91
  export declare function stripJsonComments(text: string): string;
87
92
  export declare function parseJsonc<T = unknown>(text: string): T;
88
93
  export declare function loadConfigFile(filePath: string): LuaRCConfig;
94
+ /**
95
+ * Removes trailing `/` characters from a path-like string.
96
+ *
97
+ * Implemented with a scan instead of a `\/+$` regular expression: on inputs made
98
+ * of many slashes that do not end in a slash, a backtracking engine retries the
99
+ * repetition at every offset, which is quadratic in the input length
100
+ * (CodeQL: js/polynomial-redos).
101
+ */
102
+ export declare function stripTrailingSlashes(value: string): string;
89
103
  export interface MergeConfigOptions {
90
104
  cliIgnore?: string[];
91
105
  }
92
106
  /**
93
107
  * Merges a base nanos configuration with a workspace override configuration.
94
- * Guarantees that the nanos definitions directory is included in workspace.library,
108
+ * Guarantees that nanos API annotations are included in workspace.library,
95
109
  * and standardizes paths for LuaLS.
110
+ *
111
+ * @param base Base configuration template
112
+ * @param override Workspace override configuration
113
+ * @param definitionsPath Path to annotations.lua file or directory containing it
114
+ * @param options Additional merge options
96
115
  */
97
- export declare function mergeConfigs(base: LuaRCConfig, override?: LuaRCConfig, definitionsDir?: string, options?: MergeConfigOptions): LuaRCConfig;
116
+ export declare function mergeConfigs(base: LuaRCConfig, override?: LuaRCConfig, definitionsPath?: string, options?: MergeConfigOptions): LuaRCConfig;
98
117
  export interface ResolveWorkspaceConfigOptions {
99
118
  ignore?: string[];
119
+ annotationsPath?: string;
100
120
  }
101
121
  /**
102
122
  * Discovers any existing workspace configuration and returns the path to an active
@@ -108,6 +128,7 @@ export declare function resolveWorkspaceConfig(workspacePath: string, customConf
108
128
  };
109
129
  export interface InitWorkspaceOptions {
110
130
  force?: boolean;
131
+ annotationsPath?: string;
111
132
  }
112
133
  /**
113
134
  * Initializes a new .luarc.json in a workspace.
@@ -117,6 +138,20 @@ export declare function initWorkspace(workspacePath: string, options?: InitWorks
117
138
  //#region src/luals.d.ts
118
139
  export declare const FALLBACK_LUALS_VERSION = "3.19.1";
119
140
  export declare const DEFAULT_LUALS_VERSION = "latest";
141
+ /**
142
+ * Validates a LuaLS version/tag and rebuilds it from the allow-list above.
143
+ *
144
+ * Version strings originate from untrusted sources: the GitHub releases API
145
+ * response and user supplied `--luals-version` arguments. They are interpolated
146
+ * into cache directory paths, download URLs, and the path of the binary that is
147
+ * eventually executed, so they must be constrained to a single safe path
148
+ * segment. Rebuilding the value character by character guarantees the returned
149
+ * string only ever contains allow-listed characters (CodeQL: js/command-line-injection).
150
+ *
151
+ * @returns the normalized version (a single leading `v` is dropped), or `null`
152
+ * when the input cannot be used as a version tag.
153
+ */
154
+ export declare function sanitizeLuaLSVersion(raw: string): string | null;
120
155
  /**
121
156
  * Escapes single quotes for safe PowerShell single-quoted string interpolation.
122
157
  */
@@ -127,6 +162,8 @@ export declare function escapePowerShellSingleQuote(str: string): string;
127
162
  export declare function resolveLatestLuaLSVersion(): Promise<string>;
128
163
  /**
129
164
  * Resolves a version string ("latest" -> actual tag).
165
+ *
166
+ * @throws when an explicitly requested version is not a valid tag.
130
167
  */
131
168
  export declare function resolveLuaLSVersion(version?: string): Promise<string>;
132
169
  export interface PlatformInfo {
@@ -137,6 +174,10 @@ export interface PlatformInfo {
137
174
  }
138
175
  export declare function getPlatformInfo(version?: string): PlatformInfo;
139
176
  export declare function getCacheDir(version?: string): string;
177
+ /**
178
+ * Returns the legacy cache directory used in nanos-lint <= 2.2.1.
179
+ */
180
+ export declare function getLegacyCacheDir(version?: string): string;
140
181
  export interface DownloadOptions {
141
182
  quiet?: boolean;
142
183
  }
@@ -180,5 +221,124 @@ export declare function formatPretty(result: CheckResult, cwd?: string, useColor
180
221
  export declare function formatGitHubAnnotations(result: CheckResult, cwd?: string): string;
181
222
  export declare function formatReport(result: CheckResult, format?: "pretty" | "json" | "github", cwd?: string, useColor?: boolean): string;
182
223
  //#endregion
224
+ //#region node_modules/env-paths/index.d.ts
225
+ type Paths = {
226
+ /**
227
+ Directory for data files.
228
+
229
+ Example locations (with the default `nodejs` suffix):
230
+
231
+ - macOS: `~/Library/Application Support/MyApp-nodejs`
232
+ - Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
233
+ - Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
234
+ */
235
+ readonly data: string;
236
+ /**
237
+ Directory for config files.
238
+
239
+ Example locations (with the default `nodejs` suffix):
240
+
241
+ - macOS: `~/Library/Preferences/MyApp-nodejs`
242
+ - Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
243
+ - Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
244
+ */
245
+ readonly config: string;
246
+ /**
247
+ Directory for non-essential data files.
248
+
249
+ Example locations (with the default `nodejs` suffix):
250
+
251
+ - macOS: `~/Library/Caches/MyApp-nodejs`
252
+ - Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
253
+ - Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
254
+ */
255
+ readonly cache: string;
256
+ /**
257
+ Directory for log files.
258
+
259
+ Example locations (with the default `nodejs` suffix):
260
+
261
+ - macOS: `~/Library/Logs/MyApp-nodejs`
262
+ - Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
263
+ - Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
264
+ */
265
+ readonly log: string;
266
+ /**
267
+ Directory for temporary files.
268
+
269
+ Example locations (with the default `nodejs` suffix):
270
+
271
+ - macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
272
+ - Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
273
+ - Linux: `/tmp/USERNAME/MyApp-nodejs`
274
+ */
275
+ readonly temp: string;
276
+ };
277
+ //#endregion
278
+ //#region src/paths.d.ts
279
+ /**
280
+ * System paths resolved for nanos-lint using cross-platform conventions
281
+ * provided by env-paths (XDG on Linux, %LOCALAPPDATA%/%APPDATA% on Windows, ~/Library on macOS).
282
+ */
283
+ export declare const systemPaths: Paths;
284
+ /**
285
+ * Clears the nanos-lint cache directory.
286
+ * Returns the path of the cleared cache directory, or null if it did not exist.
287
+ */
288
+ export declare function cleanCache(targetDir?: string): string | null;
289
+ //#endregion
290
+ //#region src/annotations.d.ts
291
+ export declare const DOCGEN_REPO = "nanos-world/vscode-extension";
292
+ export declare const DOCGEN_BRANCH = "docgen-output";
293
+ export declare const RAW_ANNOTATIONS_URL = "https://raw.githubusercontent.com/nanos-world/vscode-extension/refs/heads/docgen-output/annotations.lua";
294
+ export declare const GITHUB_COMMITS_API = "https://api.github.com/repos/nanos-world/vscode-extension/commits/docgen-output";
295
+ export interface AnnotationsDate {
296
+ year: number;
297
+ month: number;
298
+ day: number;
299
+ }
300
+ export interface AnnotationsMetadata {
301
+ commitId: string;
302
+ lastChecked: string;
303
+ date: AnnotationsDate;
304
+ }
305
+ export declare const ANNOTATIONS_FILENAME = "annotations.lua";
306
+ export declare const METADATA_FILENAME = "metadata.json";
307
+ export declare function getTodayDateString(d?: Date): {
308
+ dateStr: string;
309
+ dateObj: AnnotationsDate;
310
+ };
311
+ export declare function getAnnotationsCacheDir(): string;
312
+ export declare function getCachedAnnotationsFilePath(): string;
313
+ export declare function getAnnotationsMetadataFilePath(): string;
314
+ export declare function readAnnotationsMetadata(cacheDir?: string): AnnotationsMetadata | null;
315
+ export declare function fetchLatestCommitId(): Promise<string | null>;
316
+ export declare function fetchRawAnnotationsContent(): Promise<string>;
317
+ /**
318
+ * Updates the metadata lastChecked date atomically without modifying annotations.lua.
319
+ */
320
+ export declare function updateLastCheckedDate(commitId: string, cacheDir?: string): AnnotationsMetadata;
321
+ /**
322
+ * Downloads annotations.lua, writes it and the new metadata in a chained atomic transaction.
323
+ * If any step fails, the previous cache state is reverted.
324
+ */
325
+ export declare function downloadAndCacheAnnotations(commitId: string, cacheDir?: string, options?: {
326
+ quiet?: boolean;
327
+ }): Promise<string>;
328
+ export interface ResolveAnnotationsOptions {
329
+ customPath?: string;
330
+ cacheDir?: string;
331
+ quiet?: boolean;
332
+ }
333
+ /**
334
+ * Resolves the nanos world annotations.lua definitions file path.
335
+ * Resolution precedence:
336
+ * 1. CLI option (`customPath`)
337
+ * 2. Environment variable (`NANOS_ANNOTATIONS_PATH` or `NANOS_ANNOTATIONS`)
338
+ * 3. Bundled inside package root (`annotations.lua`)
339
+ * 4. User cache (checked once per day from upstream GitHub)
340
+ */
341
+ export declare function resolveAnnotations(options?: ResolveAnnotationsOptions): Promise<string>;
342
+ //#endregion
183
343
  export { CreateProgramOptions, collectIgnorePatterns, createProgram, isDirectExecution, runCLI };
184
344
  //# 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"],"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;;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;wBAKA;;;;wBAQA,kBAAkB;wBAKlB,WAAW,aAAa,eAAe;wBAavC,eAAe,mBAAmB;iBAQjC;EACf;;;;;;;wBAQc,aACd,MAAM,aACN,WAAU,aACV,yBACA,UAAU,qBACT;iBAsGc;EACf;;;;;;wBAOc,uBACd,uBACA,2BACA,UAAU;EACP;EAAoB;;iBA2ER;EACf;;;;;wBAMc,cAAc,uBAAuB,UAAU;;;qBCtQlD;qBACA;;;;wBAKG,4BAA4B;;;;wBAOtB,6BAA6B;;;;wBA4B7B,oBAAoB,mBAAmB;iBAO5C;EACf;EACA;EACA;EACA;;wBAGc,gBAAgB,mBAA2C;wBAiD3D,YAAY;iBASX;EACf;;;;;wBAMc,cAAc;wBAoBR,wBACpB,kBACA,oBACA,UAAU,kBACT;iBAqKc;EACf;;wBAGoB,mBACpB,kBACA,UAAU,sBACT;wBA0DmB,cACpB,oBACA,oBACA,SAAS,eACR,QAAQ;;;;wBA+HK,kBAAkB,oBAAoB;;;;;;;wBCpftC;wBAUA,UAAU;;;;;;;;;;;;wBA6BV,oBACd,kBACA;wBAgBc,UAAU,eAAe,kBAAkB;wBAI3C,qBACd,uBACA,gBACA,kBACA;wBAqBc,aACd,QAAQ,aACR,cACA;wBAiFc,wBAAwB,QAAQ,aAAa;wBAsC7C,aACd,QAAQ,aACR,uCACA,cACA"}
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.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,kBAAkB;wBAI3C,qBACd,uBACA,gBACA,kBACA;wBAqBc,aACd,QAAQ,aACR,cACA;wBAiFc,wBAAwB,QAAQ,aAAa;wBAsC7C,aACd,QAAQ,aACR,uCACA,cACA;;;KCzNU;;;;;;;;;;WAUF;;;;;;;;;;WAWA;;;;;;;;;;WAWA;;;;;;;;;;WAWA;;;;;;;;;;WAWA;;;;;;;;qBC1DG,aAAA;;;;;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"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as mergeConfigs, C as resolveLuaLSVersion, D as getPackageRoot, E as getDefinitionsDir, M as resolveWorkspaceConfig, N as stripJsonComments, O as initWorkspace, P as fileUriToPath, S as resolveLuaLSBinary, T as getDefaultTemplatePath, _ as escapePowerShellSingleQuote, a as formatGitHubAnnotations, b as isBinaryValid, c as formatReport, d as pluralize, f as shouldEnableColor, g as downloadAndExtractLuaLS, h as countCheckedFiles, i as runCLI, j as parseJsonc, k as loadConfigFile, l as formatSeverityBadge, m as FALLBACK_LUALS_VERSION, n as createProgram, o as formatPretty, p as DEFAULT_LUALS_VERSION, r as isDirectExecution, s as formatProblemSummary, t as collectIgnorePatterns, u as getColors, v as getCacheDir, w as runLuaLSCheck, x as resolveLatestLuaLSVersion, y as getPlatformInfo } from "./cli-kmHD4epr.js";
2
- export { DEFAULT_LUALS_VERSION, FALLBACK_LUALS_VERSION, collectIgnorePatterns, countCheckedFiles, createProgram, downloadAndExtractLuaLS, escapePowerShellSingleQuote, fileUriToPath, formatGitHubAnnotations, formatPretty, formatProblemSummary, formatReport, formatSeverityBadge, getCacheDir, getColors, getDefaultTemplatePath, getDefinitionsDir, getPackageRoot, getPlatformInfo, initWorkspace, isBinaryValid, isDirectExecution, loadConfigFile, mergeConfigs, parseJsonc, pluralize, resolveLatestLuaLSVersion, resolveLuaLSBinary, resolveLuaLSVersion, resolveWorkspaceConfig, runCLI, runLuaLSCheck, shouldEnableColor, stripJsonComments };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanos-lint",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Linter and type-checker for nanos world Lua scripts powered by LuaLS",
5
5
  "keywords": [
6
6
  "nanos-world",
@@ -30,7 +30,6 @@
30
30
  "files": [
31
31
  "bin",
32
32
  "dist",
33
- "vendor/nanos-world-vscode-extension/annotations.lua",
34
33
  "templates",
35
34
  "action.yml",
36
35
  "README.md",
@@ -42,14 +41,18 @@
42
41
  "lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --max-warnings=0",
43
42
  "lint:fix": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix --max-warnings=0",
44
43
  "test": "vitest run",
45
- "test:watch": "vitest"
44
+ "test:watch": "vitest",
45
+ "test:coverage": "vitest run --coverage",
46
+ "prepare": "node -e \"try { require('node:child_process').execSync('git config core.hooksPath .githooks'); } catch {}\""
46
47
  },
47
48
  "devDependencies": {
48
49
  "@eslint/js": "^10.0.1",
49
50
  "@types/node": "^26.6.2",
50
51
  "@typescript-eslint/eslint-plugin": "^8.70.1",
51
52
  "@typescript-eslint/parser": "^8.70.1",
53
+ "@vitest/coverage-v8": "^5.0.1",
52
54
  "commander": "^15.0.0",
55
+ "env-paths": "^4.0.0",
53
56
  "eslint": "^10.11.0",
54
57
  "jsonc-parser": "^3.3.1",
55
58
  "tsdown": "^0.23.0",