nanos-lint 3.2.0 → 3.2.1
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/action.yml +1 -1
- package/dist/{cli-CeNxOiST.js → cli-I16SeKRK.js} +25 -2
- package/dist/cli-I16SeKRK.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/dist/cli-CeNxOiST.js.map +0 -1
package/action.yml
CHANGED
|
@@ -6368,6 +6368,13 @@ async function validateArchiveMembers(archivePath) {
|
|
|
6368
6368
|
* user-supplied `LUALS_BIN` may legitimately be a small wrapper script.
|
|
6369
6369
|
*/
|
|
6370
6370
|
const MIN_DOWNLOADED_BINARY_SIZE_BYTES = 1e5;
|
|
6371
|
+
/** Propagates blocked LuaLS execution or cache access without triggering repair. */
|
|
6372
|
+
function rethrowLuaLSPermissionError(err, targetPath, operation = "access") {
|
|
6373
|
+
if (err instanceof LuaLSError && (err.code === "ERR_LUALS_EXECUTION_DENIED" || err.code === "ERR_LUALS_CACHE_PERMISSION")) throw err;
|
|
6374
|
+
const code = err?.code;
|
|
6375
|
+
if (code !== "EPERM" && code !== "EACCES") return;
|
|
6376
|
+
throw new LuaLSError(`Cannot ${operation} LuaLS ${operation === "execute" ? "binary" : "cache path"} '${targetPath}': ${code}: ${err instanceof Error ? err.message : String(err)}`, operation === "execute" ? "ERR_LUALS_EXECUTION_DENIED" : "ERR_LUALS_CACHE_PERMISSION", operation === "execute" ? "Run nanos-lint in an environment that permits LuaLS execution and check the binary's execute permissions and sandbox policy. The existing cache has been preserved." : "Allow access to the LuaLS cache directory or use a writable cache directory.", { cause: err });
|
|
6377
|
+
}
|
|
6371
6378
|
/**
|
|
6372
6379
|
* Runs `binaryPath --version` and checks that it reports a LuaLS version.
|
|
6373
6380
|
* Shared by every binary validation path; the size heuristic stays separate
|
|
@@ -6382,6 +6389,7 @@ function reportsLuaLSVersion(binaryPath) {
|
|
|
6382
6389
|
});
|
|
6383
6390
|
return /^\d+\.\d+\.\d+/.test(output.trim());
|
|
6384
6391
|
} catch (err) {
|
|
6392
|
+
rethrowLuaLSPermissionError(err, binaryPath, "execute");
|
|
6385
6393
|
logger.debug(`[luals] Binary validation check failed for ${binaryPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6386
6394
|
return false;
|
|
6387
6395
|
}
|
|
@@ -6397,6 +6405,7 @@ function isBinaryValid(binaryPath) {
|
|
|
6397
6405
|
if (!stats.isFile() || stats.size < 1e5) return false;
|
|
6398
6406
|
return reportsLuaLSVersion(binaryPath);
|
|
6399
6407
|
} catch (err) {
|
|
6408
|
+
rethrowLuaLSPermissionError(err, binaryPath);
|
|
6400
6409
|
logger.debug(`[luals] Binary validation check failed for ${binaryPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6401
6410
|
return false;
|
|
6402
6411
|
}
|
|
@@ -6410,6 +6419,7 @@ function isBinaryRunnable(binaryPath) {
|
|
|
6410
6419
|
try {
|
|
6411
6420
|
if (!fs.statSync(binaryPath).isFile()) return false;
|
|
6412
6421
|
} catch (err) {
|
|
6422
|
+
rethrowLuaLSPermissionError(err, binaryPath);
|
|
6413
6423
|
logger.debug(`[luals] Binary validation check failed for ${binaryPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6414
6424
|
return false;
|
|
6415
6425
|
}
|
|
@@ -6434,6 +6444,7 @@ function assertValidLuaLSBinary(binaryPath, source) {
|
|
|
6434
6444
|
try {
|
|
6435
6445
|
stats = fs.statSync(binaryPath);
|
|
6436
6446
|
} catch (err) {
|
|
6447
|
+
rethrowLuaLSPermissionError(err, binaryPath);
|
|
6437
6448
|
throw new LuaLSError(`${source} points to '${binaryPath}', which does not exist or cannot be read: ${err instanceof Error ? err.message : String(err)}`, "ERR_LUALS_BIN_INVALID", `Set ${source} to the full path of a lua-language-server executable, or leave it unset so nanos-lint resolves LuaLS automatically.`, { cause: err });
|
|
6438
6449
|
}
|
|
6439
6450
|
if (!stats.isFile()) throw new LuaLSError(`${source} points to '${binaryPath}', which is not a regular file (a directory or special file was found).`, "ERR_LUALS_BIN_INVALID", `Point ${source} at the lua-language-server executable itself, or leave it unset so nanos-lint resolves LuaLS automatically.`);
|
|
@@ -6550,11 +6561,13 @@ function listCachedLuaLSVersions(baseCacheDir = getBaseLuaLSCacheDir()) {
|
|
|
6550
6561
|
if (fs.existsSync(marker) && fs.existsSync(bin)) try {
|
|
6551
6562
|
if (fs.readFileSync(marker, "utf-8").trim() === version && isBinaryValid(bin)) versions.push(version);
|
|
6552
6563
|
} catch (err) {
|
|
6564
|
+
rethrowLuaLSPermissionError(err, bin);
|
|
6553
6565
|
logger.debug(`[luals] Error validating cached version ${version}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6554
6566
|
}
|
|
6555
6567
|
}
|
|
6556
6568
|
return versions;
|
|
6557
6569
|
} catch (err) {
|
|
6570
|
+
rethrowLuaLSPermissionError(err, baseCacheDir);
|
|
6558
6571
|
logger.debug(`[luals] Failed to list cached LuaLS versions: ${err instanceof Error ? err.message : String(err)}`);
|
|
6559
6572
|
return [];
|
|
6560
6573
|
}
|
|
@@ -6604,6 +6617,7 @@ function findExistingLuaLSDir(version, baseCacheDir = getBaseLuaLSCacheDir()) {
|
|
|
6604
6617
|
if (fs.existsSync(primaryMarker)) try {
|
|
6605
6618
|
if (fs.readFileSync(primaryMarker, "utf-8").trim() === version && isBinaryValid(primaryBin)) return primaryCache;
|
|
6606
6619
|
} catch (err) {
|
|
6620
|
+
rethrowLuaLSPermissionError(err, primaryMarker);
|
|
6607
6621
|
logger.debug(`[luals] Error checking primary LuaLS cache marker at ${primaryMarker}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6608
6622
|
}
|
|
6609
6623
|
const pkgRoot = getPackageRoot();
|
|
@@ -6664,6 +6678,7 @@ function isCompleteLuaLSInstall(binaryPath, completeMarker, version) {
|
|
|
6664
6678
|
try {
|
|
6665
6679
|
return fs.readFileSync(completeMarker, "utf-8").trim() === version && isBinaryValid(binaryPath);
|
|
6666
6680
|
} catch (err) {
|
|
6681
|
+
rethrowLuaLSPermissionError(err, completeMarker);
|
|
6667
6682
|
logger.debug(`[luals] Failed to read complete marker at ${completeMarker}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6668
6683
|
return false;
|
|
6669
6684
|
}
|
|
@@ -6694,6 +6709,7 @@ async function downloadAndPromoteLuaLS(resolvedVersion, info, destDir, binaryPat
|
|
|
6694
6709
|
if (options?.reuseExisting !== false && fs.existsSync(binaryPath) && fs.existsSync(completeMarker)) try {
|
|
6695
6710
|
if (fs.readFileSync(completeMarker, "utf-8").trim() === resolvedVersion && isBinaryValid(binaryPath)) return binaryPath;
|
|
6696
6711
|
} catch (err) {
|
|
6712
|
+
rethrowLuaLSPermissionError(err, completeMarker);
|
|
6697
6713
|
logger.debug(`[luals] Failed to read complete marker at ${completeMarker}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6698
6714
|
}
|
|
6699
6715
|
try {
|
|
@@ -6702,6 +6718,7 @@ async function downloadAndPromoteLuaLS(resolvedVersion, info, destDir, binaryPat
|
|
|
6702
6718
|
force: true
|
|
6703
6719
|
});
|
|
6704
6720
|
} catch (err) {
|
|
6721
|
+
rethrowLuaLSPermissionError(err, destDir);
|
|
6705
6722
|
logger.warn(`[luals] Failed to remove stale or invalid cache dir ${destDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
6706
6723
|
}
|
|
6707
6724
|
}
|
|
@@ -7310,6 +7327,7 @@ async function resolveLuaLSBinary(version = DEFAULT_LUALS_VERSION, options) {
|
|
|
7310
7327
|
if (options?.reuseExisting !== false) return cachedPath;
|
|
7311
7328
|
}
|
|
7312
7329
|
} catch (err) {
|
|
7330
|
+
rethrowLuaLSPermissionError(err, completeMarker);
|
|
7313
7331
|
logger.debug(`[luals] Failed to read complete marker at ${completeMarker}: ${err instanceof Error ? err.message : String(err)}`);
|
|
7314
7332
|
}
|
|
7315
7333
|
if (!isValid) {
|
|
@@ -7322,6 +7340,7 @@ async function resolveLuaLSBinary(version = DEFAULT_LUALS_VERSION, options) {
|
|
|
7322
7340
|
force: true
|
|
7323
7341
|
});
|
|
7324
7342
|
} catch (err) {
|
|
7343
|
+
rethrowLuaLSPermissionError(err, cachedDir);
|
|
7325
7344
|
logger.warn(`[luals] Failed to remove corrupted cache directory ${cachedDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
7326
7345
|
}
|
|
7327
7346
|
}
|
|
@@ -7331,11 +7350,13 @@ async function resolveLuaLSBinary(version = DEFAULT_LUALS_VERSION, options) {
|
|
|
7331
7350
|
const found = stdout.trim().split(/\r?\n/)[0];
|
|
7332
7351
|
if (found && fs.existsSync(found) && isBinaryValid(found)) return found;
|
|
7333
7352
|
} catch (err) {
|
|
7353
|
+
rethrowLuaLSPermissionError(err, "lua-language-server", "execute");
|
|
7334
7354
|
logger.debug(`[luals] LuaLS binary not found in PATH: ${err instanceof Error ? err.message : String(err)}`);
|
|
7335
7355
|
}
|
|
7336
7356
|
try {
|
|
7337
7357
|
return await downloadAndExtractLuaLS(resolvedVersion, getCacheDir(resolvedVersion, baseCacheDir), options);
|
|
7338
7358
|
} catch (err) {
|
|
7359
|
+
rethrowLuaLSPermissionError(err, cachedDir);
|
|
7339
7360
|
if (wasCorrupted) {
|
|
7340
7361
|
const isOffline = isOfflineError(err);
|
|
7341
7362
|
const reason = isOffline ? "while offline" : err instanceof Error ? err.message : String(err);
|
|
@@ -7397,12 +7418,14 @@ async function resolveLuaLSBinary(version = DEFAULT_LUALS_VERSION, options) {
|
|
|
7397
7418
|
const found = stdout.trim().split(/\r?\n/)[0];
|
|
7398
7419
|
if (found && fs.existsSync(found) && isBinaryValid(found)) return found;
|
|
7399
7420
|
} catch (err) {
|
|
7421
|
+
rethrowLuaLSPermissionError(err, "lua-language-server", "execute");
|
|
7400
7422
|
logger.debug(`[luals] LuaLS binary not found in PATH: ${err instanceof Error ? err.message : String(err)}`);
|
|
7401
7423
|
}
|
|
7402
7424
|
let downloadedBinary;
|
|
7403
7425
|
try {
|
|
7404
7426
|
downloadedBinary = await downloadAndExtractLuaLS(targetVersion, targetCacheDir, options);
|
|
7405
7427
|
} catch (err) {
|
|
7428
|
+
rethrowLuaLSPermissionError(err, targetCacheDir);
|
|
7406
7429
|
if (wasCorrupted) {
|
|
7407
7430
|
const isOffline = isOfflineError(err);
|
|
7408
7431
|
const reason = isOffline ? "while offline" : err instanceof Error ? err.message : String(err);
|
|
@@ -11706,6 +11729,6 @@ if (isDirectExecution()) runCLI().then((code) => {
|
|
|
11706
11729
|
process.exit(1);
|
|
11707
11730
|
});
|
|
11708
11731
|
//#endregion
|
|
11709
|
-
export { DOWNLOAD_TIMEOUT_MS as $,
|
|
11732
|
+
export { DOWNLOAD_TIMEOUT_MS as $, buildWorkspaceConfig as $t, formatProblemSummary as A, parseLogLevel as An, getPlatformInfo as At, resolvePackageDependencies as B, splitAnnotationsByRealm as Bt, getCachedAnnotationsFilePath as C, fileUriToPath as Cn, isBinaryRunnable as Ct, updateLastCheckedDate as D, Logger as Dn, parseTarTvSize as Dt, readAnnotationsMetadata as E, LOG_LEVEL_PRIORITY as En, isZipArchive as Et, shouldEnableColor as F, resolveLuaLSVersion as Ft, computeUnrequestedExclusions as G, createSpinner as Gt, runLuaLSCheck as H, PROGRESS_THROTTLE_MS as Ht, collectRealmFiles as I, sanitizeLuaLSVersion as It, findProjectRoot as J, isProgressInteractive as Jt, filterReportByTargetPaths as K, formatTransferSummary as Kt, planRealmCheck as L, ALLOWED_DOWNLOAD_DOMAINS as Lt, formatSeverityBadge as M, FALLBACK_LUALS_VERSION as Mt, getColors as N, fetchLatestLuaLSVersionFromGitHub as Nt, formatGitHubAnnotations as O, isValidLogLevel as On, rethrowLuaLSPermissionError as Ot, pluralize as P, resolveLatestLuaLSVersion as Pt, resolveCheckTargets as Q, VALID_LUALS_DIAGNOSTIC_CODES as Qt, runRealmAwareCheck as R, isAllowedDownloadUrl as Rt, getAnnotationsMetadataFilePath as S, systemPaths as Sn, inspectZipMembers as St, isAnnotationsValid as T, LOG_LEVELS as Tn, isGzipArchive as Tt, countCheckedFiles as U, SPINNER_FRAMES as Ut, resolveLuaLSBinary as V, PROGRESS_MILESTONES as Vt, listCheckedFiles as W, createProgressBar as Wt, isFilesystemRoot as X, setProgressMode as Xt, getCanonicalPath as Y, restoreTerminal as Yt, matchesTargetPaths as Z, DEFAULT_REALM_MAPPINGS as Zt, MAX_ANNOTATIONS_SIZE_BYTES as _, LuaLSError as _n, MAX_DECOMPRESSED_SIZE_BYTES as _t, formatCacheStatusPretty as a, loadConfigFile as an, LUALS_METADATA_FILENAME as at, MIN_ANNOTATIONS_SIZE_BYTES as b, formatBytes as bn, escapePowerShellSingleQuote as bt, DOCGEN_BRANCH as c, parseJsonc as cn, getBaseLuaLSCacheDir as ct, RAW_ANNOTATIONS_URL as d, stripJsonComments as dn, getLuaLSMetadataPath as dt, getDefaultAnnotationsPath as en, MAX_ARCHIVE_SIZE_BYTES as et, downloadAndCacheAnnotations as f, stripTrailingSlashes as fn, listCachedLuaLSVersionDirs as ft, ANNOTATIONS_FILENAME as g, ConfigError as gn, MAX_ARCHIVE_MEMBER_COUNT as gt, getRawAnnotationsUrl as h, CacheError as hn, writeLuaLSMetadata as ht, runCLI as i, initWorkspace as in, trackDownloadProgress as it, formatReport as j, DEFAULT_LUALS_VERSION as jt, formatPretty as k, logger as kn, validateArchiveMembers as kt, DOCGEN_REPO as l, resolveRealmMappings as ln, getCacheDir as lt, fetchRawAnnotationsContent as m, AnnotationsError as mn, readLuaLSMetadata as mt, createProgram as n, getDefinitionsDir as nn, downloadAndExtractLuaLS as nt, getCacheStatus as o, loadUserConfig as on, cleanupOldCachedLuaLSVersions as ot, fetchLatestCommitId as p, writeTempConfig as pn, listCachedLuaLSVersions as pt, findCommonAncestorDirectory as q, getProgressMode as qt, isDirectExecution as r, getPackageRoot as rn, limitDownloadStream as rt, resolveAnnotations as s, mergeConfigs as sn, findExistingLuaLSDir as st, collectIgnorePatterns as t, getDefaultTemplatePath as tn, computeFileSha256 as tt, GITHUB_COMMITS_API as u, resolveWorkspaceConfig as un, getIsoWeek as ut, MAX_COMMIT_JSON_SIZE_BYTES as v, NanosLintError as vn, MIN_DOWNLOADED_BINARY_SIZE_BYTES as vt, getTodayDateString as w, DEFAULT_LOG_LEVEL as wn, isBinaryValid as wt, getAnnotationsCacheDir as x, getDirectorySize as xn, getTarBinary as xt, METADATA_FILENAME as y, cleanCache as yn, assertValidLuaLSBinary as yt, collectDeps as z, deriveRealmAnnotationFiles as zt };
|
|
11710
11733
|
|
|
11711
|
-
//# sourceMappingURL=cli-
|
|
11734
|
+
//# sourceMappingURL=cli-I16SeKRK.js.map
|