@kb-labs/cli-commands 2.5.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.
- package/dist/{discover-8_R7njIS.d.ts → discover-BY7VE2Hf.d.ts} +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +163 -4
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +13 -3
- package/dist/registry/index.js.map +1 -1
- package/package.json +22 -22
package/dist/registry/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { d as CommandManifest, A as AvailabilityCheck, R as RegisteredCommand, D as DiscoveryResult } from '../discover-BY7VE2Hf.js';
|
|
2
|
+
export { b as CacheFile, c as CommandLookupResult, e as CommandModule, f as CommandType, F as FlagDefinition, G as GlobalFlags, g as PackageCacheEntry, P as ProductGroup, _ as __test, h as discoverManifests, i as discoverManifestsByNamespace, j as findCommand, k as findCommandWithType, r as registry, l as resetInProcCache } from '../discover-BY7VE2Hf.js';
|
|
3
3
|
import { ILogger } from '@kb-labs/core-platform';
|
|
4
4
|
import '@kb-labs/plugin-contracts';
|
|
5
5
|
|
package/dist/registry/index.js
CHANGED
|
@@ -248,6 +248,7 @@ function ensureManifestLoader(manifest) {
|
|
|
248
248
|
var __test = {
|
|
249
249
|
ensureManifestLoader,
|
|
250
250
|
createManifestV3Loader
|
|
251
|
+
// resetInProcCache is exported directly (not via __test) since it's part of the public API
|
|
251
252
|
};
|
|
252
253
|
function createUnavailableManifest(pkgName, error) {
|
|
253
254
|
const rawMsg = (error?.message || String(error) || "").toString();
|
|
@@ -273,6 +274,7 @@ function createUnavailableManifest(pkgName, error) {
|
|
|
273
274
|
throw new Error(`Cannot load ${pkgName} CLI manifest. ${rawMsg}`);
|
|
274
275
|
}
|
|
275
276
|
};
|
|
277
|
+
manifest._synthetic = true;
|
|
276
278
|
return manifest;
|
|
277
279
|
}
|
|
278
280
|
var PACKAGE_JSON = "package.json";
|
|
@@ -280,6 +282,9 @@ var MANIFEST_LOAD_TIMEOUT = 1500;
|
|
|
280
282
|
var IN_PROC_CACHE_TTL_MS = 6e4;
|
|
281
283
|
var DISK_CACHE_TTL_MS = 5 * 6e4;
|
|
282
284
|
var inProcDiscoveryCache = null;
|
|
285
|
+
function resetInProcCache() {
|
|
286
|
+
inProcDiscoveryCache = null;
|
|
287
|
+
}
|
|
283
288
|
async function computeManifestHash(manifestPath) {
|
|
284
289
|
try {
|
|
285
290
|
const content = await promises.readFile(manifestPath, "utf8");
|
|
@@ -622,7 +627,7 @@ async function discoverNodeModules(cwd) {
|
|
|
622
627
|
const packageInfos = [];
|
|
623
628
|
const scanPromises = [];
|
|
624
629
|
for (const entry of entries) {
|
|
625
|
-
if (!entry.isDirectory()) {
|
|
630
|
+
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
626
631
|
continue;
|
|
627
632
|
}
|
|
628
633
|
const scanEntry = async () => {
|
|
@@ -632,7 +637,7 @@ async function discoverNodeModules(cwd) {
|
|
|
632
637
|
const scopeDir = path2.join(nmDir, entry.name);
|
|
633
638
|
try {
|
|
634
639
|
const scopedDirs = await promises.readdir(scopeDir, { withFileTypes: true });
|
|
635
|
-
for (const scopedEntry of scopedDirs.filter((d) => d.isDirectory())) {
|
|
640
|
+
for (const scopedEntry of scopedDirs.filter((d) => d.isDirectory() || d.isSymbolicLink())) {
|
|
636
641
|
pkgRoot = path2.join(scopeDir, scopedEntry.name);
|
|
637
642
|
pkg = await readPackageJson(path2.join(pkgRoot, PACKAGE_JSON));
|
|
638
643
|
if (!pkg) {
|
|
@@ -862,6 +867,11 @@ async function saveCache(cwd, results) {
|
|
|
862
867
|
const now = Date.now();
|
|
863
868
|
const stateHasher = createHash("sha256");
|
|
864
869
|
for (const result of results) {
|
|
870
|
+
const allSynthetic = result.manifests.length > 0 && result.manifests.every((m) => m._synthetic === true);
|
|
871
|
+
if (allSynthetic) {
|
|
872
|
+
log("debug", `[plugins][cache] Skipping synthetic unavailable manifest for ${result.packageName}`);
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
865
875
|
try {
|
|
866
876
|
const manifestHash = await computeManifestHash(result.manifestPath);
|
|
867
877
|
const pkgJsonPath = path2.join(result.pkgRoot.split("/").join(path2.sep), PACKAGE_JSON);
|
|
@@ -1707,6 +1717,6 @@ function findCommandWithType(nameOrPath) {
|
|
|
1707
1717
|
return registry.getWithType(nameOrPath);
|
|
1708
1718
|
}
|
|
1709
1719
|
|
|
1710
|
-
export { __test, checkRequires, discoverManifests, discoverManifestsByNamespace, disposeAllPlugins, findCommand, findCommandWithType, preflightManifests, registerManifests, registry, runCommand };
|
|
1720
|
+
export { __test, checkRequires, discoverManifests, discoverManifestsByNamespace, disposeAllPlugins, findCommand, findCommandWithType, preflightManifests, registerManifests, registry, resetInProcCache, runCommand };
|
|
1711
1721
|
//# sourceMappingURL=index.js.map
|
|
1712
1722
|
//# sourceMappingURL=index.js.map
|