nanos-lint 2.4.0 → 2.5.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-kmHD4epr.js";
1
+ import { i as runCLI, n as createProgram, r as isDirectExecution, t as collectIgnorePatterns } from "./cli-BVXk8XmH.js";
2
2
  export { collectIgnorePatterns, createProgram, isDirectExecution, runCLI };
package/dist/index.d.ts CHANGED
@@ -86,6 +86,15 @@ export declare function getDefaultTemplatePath(): string;
86
86
  export declare function stripJsonComments(text: string): string;
87
87
  export declare function parseJsonc<T = unknown>(text: string): T;
88
88
  export declare function loadConfigFile(filePath: string): LuaRCConfig;
89
+ /**
90
+ * Removes trailing `/` characters from a path-like string.
91
+ *
92
+ * Implemented with a scan instead of a `\/+$` regular expression: on inputs made
93
+ * of many slashes that do not end in a slash, a backtracking engine retries the
94
+ * repetition at every offset, which is quadratic in the input length
95
+ * (CodeQL: js/polynomial-redos).
96
+ */
97
+ export declare function stripTrailingSlashes(value: string): string;
89
98
  export interface MergeConfigOptions {
90
99
  cliIgnore?: string[];
91
100
  }
@@ -117,6 +126,20 @@ export declare function initWorkspace(workspacePath: string, options?: InitWorks
117
126
  //#region src/luals.d.ts
118
127
  export declare const FALLBACK_LUALS_VERSION = "3.19.1";
119
128
  export declare const DEFAULT_LUALS_VERSION = "latest";
129
+ /**
130
+ * Validates a LuaLS version/tag and rebuilds it from the allow-list above.
131
+ *
132
+ * Version strings originate from untrusted sources: the GitHub releases API
133
+ * response and user supplied `--luals-version` arguments. They are interpolated
134
+ * into cache directory paths, download URLs, and the path of the binary that is
135
+ * eventually executed, so they must be constrained to a single safe path
136
+ * segment. Rebuilding the value character by character guarantees the returned
137
+ * string only ever contains allow-listed characters (CodeQL: js/command-line-injection).
138
+ *
139
+ * @returns the normalized version (a single leading `v` is dropped), or `null`
140
+ * when the input cannot be used as a version tag.
141
+ */
142
+ export declare function sanitizeLuaLSVersion(raw: string): string | null;
120
143
  /**
121
144
  * Escapes single quotes for safe PowerShell single-quoted string interpolation.
122
145
  */
@@ -127,6 +150,8 @@ export declare function escapePowerShellSingleQuote(str: string): string;
127
150
  export declare function resolveLatestLuaLSVersion(): Promise<string>;
128
151
  /**
129
152
  * Resolves a version string ("latest" -> actual tag).
153
+ *
154
+ * @throws when an explicitly requested version is not a valid tag.
130
155
  */
131
156
  export declare function resolveLuaLSVersion(version?: string): Promise<string>;
132
157
  export interface PlatformInfo {
@@ -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"],"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;;;;;;;;;wBAgBlC,qBAAqB;iBAQpB;EACf;;;;;;;wBAQc,aACd,MAAM,aACN,WAAU,aACV,yBACA,UAAU,qBACT;iBAsGc;EACf;;;;;;wBAOc,uBACd,uBACA,2BACA,UAAU;EACP;EAAoB;;iBA6ER;EACf;;;;;wBAMc,cAAc,uBAAuB,UAAU;;;qBCxRlD;qBACA;;;;;;;;;;;;;;wBA0BG,qBAAqB;;;;wBAkCrB,4BAA4B;;;;wBAOtB,6BAA6B;;;;;;wBAgC7B,oBAAoB,mBAAmB;iBAa5C;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;;;;;;;wBCrjBtC;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"}
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 { A as loadConfigFile, C as resolveLuaLSVersion, D as getDefinitionsDir, E as getDefaultTemplatePath, F as stripTrailingSlashes, I as fileUriToPath, M as parseJsonc, N as resolveWorkspaceConfig, O as getPackageRoot, P as stripJsonComments, S as resolveLuaLSBinary, T as sanitizeLuaLSVersion, _ 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 mergeConfigs, k as initWorkspace, 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-BVXk8XmH.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, sanitizeLuaLSVersion, shouldEnableColor, stripJsonComments, stripTrailingSlashes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanos-lint",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Linter and type-checker for nanos world Lua scripts powered by LuaLS",
5
5
  "keywords": [
6
6
  "nanos-world",