@openpkg-ts/sdk 0.52.1 → 0.53.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/README.md +0 -16
- package/dist/browser.d.ts +29 -64
- package/dist/browser.js +1 -9
- package/dist/index.d.ts +76 -125
- package/dist/index.js +165 -118
- package/dist/shared/{chunk-zrx9s0n4.js → chunk-7287tqkx.js} +1 -78
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KIND_ORDER,
|
|
3
3
|
QueryBuilder,
|
|
4
|
-
analyzeSpec,
|
|
5
4
|
buildSignatureString,
|
|
6
5
|
filterExports,
|
|
7
6
|
findExport,
|
|
8
|
-
findMissingParamDocs,
|
|
9
7
|
formatBadges,
|
|
10
8
|
formatConditionalType,
|
|
11
9
|
formatMappedType,
|
|
@@ -13,13 +11,11 @@ import {
|
|
|
13
11
|
formatReturnType,
|
|
14
12
|
formatSchema,
|
|
15
13
|
formatTypeParameters,
|
|
16
|
-
getDeprecationMessage,
|
|
17
14
|
getMemberBadges,
|
|
18
15
|
getMethods,
|
|
19
16
|
getProperties,
|
|
20
17
|
groupByKind,
|
|
21
18
|
groupByVisibility,
|
|
22
|
-
hasDeprecatedTag,
|
|
23
19
|
isMethod,
|
|
24
20
|
isProperty,
|
|
25
21
|
query,
|
|
@@ -29,7 +25,7 @@ import {
|
|
|
29
25
|
toPagefindRecords,
|
|
30
26
|
toSearchIndex,
|
|
31
27
|
toSearchIndexJSON
|
|
32
|
-
} from "./shared/chunk-
|
|
28
|
+
} from "./shared/chunk-7287tqkx.js";
|
|
33
29
|
|
|
34
30
|
// src/primitives/diff.ts
|
|
35
31
|
import {
|
|
@@ -75,10 +71,9 @@ function mergeConfig(fileConfig, cliOptions) {
|
|
|
75
71
|
}
|
|
76
72
|
const externals = {
|
|
77
73
|
include: cliOptions.externals?.include ?? fileConfig.externals?.include,
|
|
78
|
-
exclude: cliOptions.externals?.exclude ?? fileConfig.externals?.exclude
|
|
79
|
-
depth: cliOptions.externals?.depth ?? fileConfig.externals?.depth
|
|
74
|
+
exclude: cliOptions.externals?.exclude ?? fileConfig.externals?.exclude
|
|
80
75
|
};
|
|
81
|
-
const hasExternals = externals.include || externals.exclude
|
|
76
|
+
const hasExternals = externals.include || externals.exclude;
|
|
82
77
|
return {
|
|
83
78
|
...hasExternals ? { externals } : {},
|
|
84
79
|
followExternal: cliOptions.followExternal ?? fileConfig.followExternal,
|
|
@@ -1266,6 +1261,7 @@ import { spawn, spawnSync } from "node:child_process";
|
|
|
1266
1261
|
import * as fs3 from "node:fs";
|
|
1267
1262
|
import * as os from "node:os";
|
|
1268
1263
|
import * as path2 from "node:path";
|
|
1264
|
+
import picomatch from "picomatch";
|
|
1269
1265
|
var SKIP_DIRS = new Set(["node_modules", "dist", ".git", "target", "coverage", ".next", "out"]);
|
|
1270
1266
|
var CONV = ["src/index.ts", "src/index.tsx", "src/index.mts", "index.ts", "index.tsx"];
|
|
1271
1267
|
var ENTRY_EXT = /\.(c|m)?[tj]sx?$/;
|
|
@@ -1276,6 +1272,17 @@ function isRemoteInput(input) {
|
|
|
1276
1272
|
function isEntryFilePath(input) {
|
|
1277
1273
|
return ENTRY_EXT.test(input) || /\.d\.(ts|mts|cts)$/.test(input);
|
|
1278
1274
|
}
|
|
1275
|
+
function isPathLikeInput(input) {
|
|
1276
|
+
if (!input)
|
|
1277
|
+
return false;
|
|
1278
|
+
if (path2.isAbsolute(input))
|
|
1279
|
+
return true;
|
|
1280
|
+
if (input.startsWith("./") || input.startsWith("../"))
|
|
1281
|
+
return true;
|
|
1282
|
+
if (input.includes("/") || input.includes("\\"))
|
|
1283
|
+
return true;
|
|
1284
|
+
return isEntryFilePath(input);
|
|
1285
|
+
}
|
|
1279
1286
|
function parseGithubRepo(input) {
|
|
1280
1287
|
const trimmed = input.trim().replace(/\.git$/, "");
|
|
1281
1288
|
const https = trimmed.match(/github\.com[/:]([^/]+)\/([^/#?]+)/i);
|
|
@@ -1341,6 +1348,17 @@ function existsDir(p) {
|
|
|
1341
1348
|
return false;
|
|
1342
1349
|
}
|
|
1343
1350
|
}
|
|
1351
|
+
function isDirentDir(parent, entry) {
|
|
1352
|
+
if (entry.isDirectory())
|
|
1353
|
+
return true;
|
|
1354
|
+
if (!entry.isSymbolicLink())
|
|
1355
|
+
return false;
|
|
1356
|
+
try {
|
|
1357
|
+
return fs3.statSync(path2.join(parent, entry.name)).isDirectory();
|
|
1358
|
+
} catch {
|
|
1359
|
+
return false;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1344
1362
|
function readJson(file) {
|
|
1345
1363
|
try {
|
|
1346
1364
|
return JSON.parse(fs3.readFileSync(file, "utf-8"));
|
|
@@ -1370,53 +1388,45 @@ function parsePnpmWorkspace(yaml) {
|
|
|
1370
1388
|
}
|
|
1371
1389
|
return globs;
|
|
1372
1390
|
}
|
|
1373
|
-
function
|
|
1374
|
-
const
|
|
1375
|
-
const
|
|
1376
|
-
const
|
|
1377
|
-
if (
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1391
|
+
function expandWorkspaceGlobs(root, globs) {
|
|
1392
|
+
const include = [];
|
|
1393
|
+
const exclude = [];
|
|
1394
|
+
for (const g of globs) {
|
|
1395
|
+
if (g.startsWith("!"))
|
|
1396
|
+
exclude.push(g.slice(1));
|
|
1397
|
+
else
|
|
1398
|
+
include.push(g);
|
|
1399
|
+
}
|
|
1400
|
+
if (!include.length)
|
|
1401
|
+
return [];
|
|
1402
|
+
const dirs = [];
|
|
1403
|
+
const walk = (dir, depth) => {
|
|
1404
|
+
if (dirs.length >= MAX_PACKAGES || depth > 12)
|
|
1386
1405
|
return;
|
|
1387
|
-
if (
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
|
-
for (const ent of entries) {
|
|
1396
|
-
if (!ent.isDirectory() || SKIP_DIRS.has(ent.name))
|
|
1397
|
-
continue;
|
|
1398
|
-
walk(path2.join(dir, ent.name), i);
|
|
1399
|
-
}
|
|
1406
|
+
if (existsFile(path2.join(dir, "package.json")))
|
|
1407
|
+
dirs.push(dir);
|
|
1408
|
+
let entries = [];
|
|
1409
|
+
try {
|
|
1410
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
1411
|
+
} catch {
|
|
1400
1412
|
return;
|
|
1401
1413
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
}
|
|
1409
|
-
for (const ent of entries) {
|
|
1410
|
-
if (!ent.isDirectory() || SKIP_DIRS.has(ent.name))
|
|
1411
|
-
continue;
|
|
1412
|
-
walk(path2.join(dir, ent.name), i + 1);
|
|
1413
|
-
}
|
|
1414
|
-
return;
|
|
1414
|
+
for (const ent of entries) {
|
|
1415
|
+
if (SKIP_DIRS.has(ent.name) || ent.name.startsWith("."))
|
|
1416
|
+
continue;
|
|
1417
|
+
if (!isDirentDir(dir, ent))
|
|
1418
|
+
continue;
|
|
1419
|
+
walk(path2.join(dir, ent.name), depth + 1);
|
|
1415
1420
|
}
|
|
1416
|
-
walk(path2.join(dir, part), i + 1);
|
|
1417
1421
|
};
|
|
1418
1422
|
walk(root, 0);
|
|
1419
|
-
|
|
1423
|
+
const isMatch = picomatch(include, { ignore: exclude, dot: false, nocase: false });
|
|
1424
|
+
return dirs.filter((dir) => {
|
|
1425
|
+
const rel = path2.relative(root, dir).split(path2.sep).join("/");
|
|
1426
|
+
if (!rel || rel === ".")
|
|
1427
|
+
return include.includes(".");
|
|
1428
|
+
return isMatch(rel);
|
|
1429
|
+
});
|
|
1420
1430
|
}
|
|
1421
1431
|
function workspaceGlobs(dir) {
|
|
1422
1432
|
const pnpm = path2.join(dir, "pnpm-workspace.yaml");
|
|
@@ -1486,10 +1496,8 @@ function catalogPackages(start) {
|
|
|
1486
1496
|
};
|
|
1487
1497
|
const globs = workspaceGlobs(root);
|
|
1488
1498
|
if (globs?.length) {
|
|
1489
|
-
for (const
|
|
1490
|
-
|
|
1491
|
-
add(dir2);
|
|
1492
|
-
}
|
|
1499
|
+
for (const dir2 of expandWorkspaceGlobs(root, globs))
|
|
1500
|
+
add(dir2);
|
|
1493
1501
|
}
|
|
1494
1502
|
let dir = abs;
|
|
1495
1503
|
for (let i = 0;i < 8; i++) {
|
|
@@ -1541,9 +1549,9 @@ function collectCandidates(pkgDir, pkg) {
|
|
|
1541
1549
|
add(pkg.types, "types");
|
|
1542
1550
|
if (typeof pkg.typings === "string")
|
|
1543
1551
|
add(pkg.typings, "typings");
|
|
1544
|
-
if (pkg.exports
|
|
1552
|
+
if (pkg.exports != null) {
|
|
1545
1553
|
const exp = pkg.exports;
|
|
1546
|
-
const root = "." in exp ? exp["."] : exp;
|
|
1554
|
+
const root = typeof exp === "object" && exp !== null && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
1547
1555
|
const paths = [];
|
|
1548
1556
|
collectFromExports(root, paths);
|
|
1549
1557
|
for (const p of paths)
|
|
@@ -1617,7 +1625,7 @@ function isExtractable(pkg) {
|
|
|
1617
1625
|
return false;
|
|
1618
1626
|
if (isIgnoredPath(pkg.dir))
|
|
1619
1627
|
return false;
|
|
1620
|
-
return
|
|
1628
|
+
return pickEntry(pkg.dir) !== null;
|
|
1621
1629
|
}
|
|
1622
1630
|
function intentScore(pkg, intent) {
|
|
1623
1631
|
const q = intent.toLowerCase().trim();
|
|
@@ -1821,10 +1829,16 @@ async function resolveTarget(options = {}) {
|
|
|
1821
1829
|
}
|
|
1822
1830
|
}
|
|
1823
1831
|
if (isRemoteInput(raw)) {
|
|
1832
|
+
const owned = !options.clone;
|
|
1824
1833
|
try {
|
|
1825
1834
|
const cloned = await (options.clone ?? cloneRemote)(raw);
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1835
|
+
const result = await resolveLocal(cloned, cloned, ctx);
|
|
1836
|
+
if (!owned)
|
|
1837
|
+
return result;
|
|
1838
|
+
return {
|
|
1839
|
+
...result,
|
|
1840
|
+
cleanup: () => fs3.rmSync(cloned, { recursive: true, force: true })
|
|
1841
|
+
};
|
|
1828
1842
|
} catch (err) {
|
|
1829
1843
|
return {
|
|
1830
1844
|
kind: "empty",
|
|
@@ -1836,6 +1850,9 @@ async function resolveTarget(options = {}) {
|
|
|
1836
1850
|
if (existsFile(abs) && isEntryFilePath(abs)) {
|
|
1837
1851
|
return { kind: "explicit", entryFile: abs, entryPointSource: "explicit" };
|
|
1838
1852
|
}
|
|
1853
|
+
if (!existsFile(abs) && !existsDir(abs) && isPathLikeInput(options.input?.trim() || raw)) {
|
|
1854
|
+
return { kind: "empty", reason: `input does not exist: ${options.input?.trim() || raw}` };
|
|
1855
|
+
}
|
|
1839
1856
|
const startDir = existsDir(abs) ? abs : cwd;
|
|
1840
1857
|
return resolveLocal(abs, startDir, ctx);
|
|
1841
1858
|
}
|
|
@@ -2344,6 +2361,42 @@ function resolveWorkspaceEntry(pkgDir) {
|
|
|
2344
2361
|
} catch {}
|
|
2345
2362
|
return candidates.find((c) => fs4.existsSync(c));
|
|
2346
2363
|
}
|
|
2364
|
+
function isDirentDir2(parent, entry) {
|
|
2365
|
+
if (entry.isDirectory())
|
|
2366
|
+
return true;
|
|
2367
|
+
if (!entry.isSymbolicLink())
|
|
2368
|
+
return false;
|
|
2369
|
+
try {
|
|
2370
|
+
return fs4.statSync(path4.join(parent, entry.name)).isDirectory();
|
|
2371
|
+
} catch {
|
|
2372
|
+
return false;
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
function extensionOf(file) {
|
|
2376
|
+
if (file.endsWith(".d.mts"))
|
|
2377
|
+
return ts2.Extension.Dmts;
|
|
2378
|
+
if (file.endsWith(".d.cts"))
|
|
2379
|
+
return ts2.Extension.Dcts;
|
|
2380
|
+
if (file.endsWith(".d.ts"))
|
|
2381
|
+
return ts2.Extension.Dts;
|
|
2382
|
+
if (file.endsWith(".mts"))
|
|
2383
|
+
return ts2.Extension.Mts;
|
|
2384
|
+
if (file.endsWith(".cts"))
|
|
2385
|
+
return ts2.Extension.Cts;
|
|
2386
|
+
if (file.endsWith(".tsx"))
|
|
2387
|
+
return ts2.Extension.Tsx;
|
|
2388
|
+
if (file.endsWith(".ts"))
|
|
2389
|
+
return ts2.Extension.Ts;
|
|
2390
|
+
if (file.endsWith(".mjs"))
|
|
2391
|
+
return ts2.Extension.Mjs;
|
|
2392
|
+
if (file.endsWith(".cjs"))
|
|
2393
|
+
return ts2.Extension.Cjs;
|
|
2394
|
+
if (file.endsWith(".jsx"))
|
|
2395
|
+
return ts2.Extension.Jsx;
|
|
2396
|
+
if (file.endsWith(".js"))
|
|
2397
|
+
return ts2.Extension.Js;
|
|
2398
|
+
return ts2.Extension.Ts;
|
|
2399
|
+
}
|
|
2347
2400
|
function resolveProjectReferences(configPath, parsedConfig) {
|
|
2348
2401
|
const additionalFiles = [];
|
|
2349
2402
|
if (!parsedConfig.projectReferences?.length) {
|
|
@@ -2427,7 +2480,7 @@ function buildWorkspaceMap(baseDir) {
|
|
|
2427
2480
|
continue;
|
|
2428
2481
|
const entries = fs4.readdirSync(globDir, { withFileTypes: true });
|
|
2429
2482
|
for (const entry of entries) {
|
|
2430
|
-
if (!entry
|
|
2483
|
+
if (!isDirentDir2(globDir, entry))
|
|
2431
2484
|
continue;
|
|
2432
2485
|
const pkgDir = path4.join(globDir, entry.name);
|
|
2433
2486
|
const pkgJsonPath = path4.join(pkgDir, "package.json");
|
|
@@ -2452,7 +2505,7 @@ function discoverAmbientTypePackages(baseDir) {
|
|
|
2452
2505
|
try {
|
|
2453
2506
|
if (fs4.existsSync(typesDir) && fs4.statSync(typesDir).isDirectory()) {
|
|
2454
2507
|
for (const entry of fs4.readdirSync(typesDir, { withFileTypes: true })) {
|
|
2455
|
-
if (
|
|
2508
|
+
if (entry.name.startsWith(".") || !isDirentDir2(typesDir, entry))
|
|
2456
2509
|
continue;
|
|
2457
2510
|
if (seen.has(entry.name))
|
|
2458
2511
|
continue;
|
|
@@ -2518,24 +2571,23 @@ function createProgram(options) {
|
|
|
2518
2571
|
const compilerHost = ts2.createCompilerHost(compilerOptions, true);
|
|
2519
2572
|
let inMemorySource;
|
|
2520
2573
|
if (workspaceMap) {
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
const
|
|
2525
|
-
if (
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
return result[0];
|
|
2574
|
+
compilerHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options2, containingSourceFile) => moduleLiterals.map((literal) => {
|
|
2575
|
+
const pkgDir = workspaceMap.packages.get(literal.text);
|
|
2576
|
+
if (pkgDir) {
|
|
2577
|
+
const entryPath = resolveWorkspaceEntry(pkgDir);
|
|
2578
|
+
if (entryPath) {
|
|
2579
|
+
return {
|
|
2580
|
+
resolvedModule: {
|
|
2581
|
+
resolvedFileName: entryPath,
|
|
2582
|
+
isExternalLibraryImport: false,
|
|
2583
|
+
extension: extensionOf(entryPath)
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2534
2586
|
}
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
};
|
|
2587
|
+
}
|
|
2588
|
+
const mode = ts2.getModeForUsageLocation(containingSourceFile, literal, options2);
|
|
2589
|
+
return ts2.resolveModuleName(literal.text, containingFile, options2, compilerHost, undefined, redirectedReference, mode);
|
|
2590
|
+
});
|
|
2539
2591
|
}
|
|
2540
2592
|
if (content !== undefined) {
|
|
2541
2593
|
inMemorySource = ts2.createSourceFile(entryFile, content, ts2.ScriptTarget.Latest, true, getScriptKind(entryFile));
|
|
@@ -4165,9 +4217,7 @@ function createContext(program, sourceFile, options = {}) {
|
|
|
4165
4217
|
program,
|
|
4166
4218
|
sourceFile,
|
|
4167
4219
|
maxTypeDepth: options.maxTypeDepth ?? 5,
|
|
4168
|
-
maxExternalTypeDepth: options.maxExternalTypeDepth ?? 2,
|
|
4169
4220
|
currentDepth: 0,
|
|
4170
|
-
resolveExternalTypes: options.resolveExternalTypes ?? true,
|
|
4171
4221
|
typeRegistry: new TypeRegistry,
|
|
4172
4222
|
exportedIds: new Set,
|
|
4173
4223
|
visitedTypes: new Set,
|
|
@@ -6799,17 +6849,17 @@ async function extractStandardSchemasFromProject(entryFile, baseDir, options = {
|
|
|
6799
6849
|
// src/builder/external-resolver.ts
|
|
6800
6850
|
import * as fs6 from "node:fs";
|
|
6801
6851
|
import * as path8 from "node:path";
|
|
6802
|
-
import
|
|
6852
|
+
import picomatch2 from "picomatch";
|
|
6803
6853
|
import ts16 from "typescript";
|
|
6804
6854
|
function matchesExternalPattern(packageName, include, exclude) {
|
|
6805
6855
|
if (!include?.length)
|
|
6806
6856
|
return false;
|
|
6807
6857
|
const matchOptions = { bash: true };
|
|
6808
|
-
const isIncluded = include.some((p) =>
|
|
6858
|
+
const isIncluded = include.some((p) => picomatch2.isMatch(packageName, p, matchOptions));
|
|
6809
6859
|
if (!isIncluded)
|
|
6810
6860
|
return false;
|
|
6811
6861
|
if (exclude?.length) {
|
|
6812
|
-
const isExcluded = exclude.some((p) =>
|
|
6862
|
+
const isExcluded = exclude.some((p) => picomatch2.isMatch(packageName, p, matchOptions));
|
|
6813
6863
|
if (isExcluded)
|
|
6814
6864
|
return false;
|
|
6815
6865
|
}
|
|
@@ -7232,9 +7282,6 @@ function collectReferencedExternals(exportedSymbols, checker, workspacePackages)
|
|
|
7232
7282
|
visited.add(type);
|
|
7233
7283
|
const symbol = type.aliasSymbol ?? type.getSymbol();
|
|
7234
7284
|
consider(symbol);
|
|
7235
|
-
const match = symbol?.declarations?.[0]?.getSourceFile().fileName.match(NODE_MODULES_PKG2);
|
|
7236
|
-
if (match && !workspacePackages.has(match[1]))
|
|
7237
|
-
return;
|
|
7238
7285
|
for (const arg of type.aliasTypeArguments ?? [])
|
|
7239
7286
|
visit(arg, depth + 1);
|
|
7240
7287
|
const typeRef = type;
|
|
@@ -7246,11 +7293,33 @@ function collectReferencedExternals(exportedSymbols, checker, workspacePackages)
|
|
|
7246
7293
|
for (const t of type.types)
|
|
7247
7294
|
visit(t, depth + 1);
|
|
7248
7295
|
}
|
|
7296
|
+
const fileName = symbol?.declarations?.[0]?.getSourceFile().fileName;
|
|
7297
|
+
if (fileName) {
|
|
7298
|
+
if (isLibFile(fileName))
|
|
7299
|
+
return;
|
|
7300
|
+
const match = fileName.match(NODE_MODULES_PKG2);
|
|
7301
|
+
if (match && !workspacePackages.has(match[1]))
|
|
7302
|
+
return;
|
|
7303
|
+
}
|
|
7304
|
+
if (!(type.flags & ts18.TypeFlags.Object || type.isClassOrInterface()))
|
|
7305
|
+
return;
|
|
7306
|
+
if (type.isClassOrInterface()) {
|
|
7307
|
+
for (const base of checker.getBaseTypes(type) ?? [])
|
|
7308
|
+
visit(base, depth + 1);
|
|
7309
|
+
}
|
|
7310
|
+
for (const prop of type.getProperties()) {
|
|
7311
|
+
if (prop.getName().startsWith("__@"))
|
|
7312
|
+
continue;
|
|
7313
|
+
visit(checker.getTypeOfSymbol(prop), depth + 1);
|
|
7314
|
+
}
|
|
7249
7315
|
for (const sig of [...type.getCallSignatures(), ...type.getConstructSignatures()]) {
|
|
7250
7316
|
for (const param of sig.getParameters())
|
|
7251
7317
|
visit(checker.getTypeOfSymbol(param), depth + 1);
|
|
7252
7318
|
visit(sig.getReturnType(), depth + 1);
|
|
7253
7319
|
}
|
|
7320
|
+
for (const info of checker.getIndexInfosOfType(type)) {
|
|
7321
|
+
visit(info.type, depth + 1);
|
|
7322
|
+
}
|
|
7254
7323
|
};
|
|
7255
7324
|
for (const symbol of exportedSymbols) {
|
|
7256
7325
|
visit(checker.getTypeOfSymbol(symbol), 0);
|
|
@@ -7635,27 +7704,6 @@ function collectForgottenExports(exports, types, program, sourceFile, exportedId
|
|
|
7635
7704
|
|
|
7636
7705
|
// src/builder/spec-builder.ts
|
|
7637
7706
|
var YIELD_BATCH_SIZE = 5;
|
|
7638
|
-
function computeDegradedStats(exports) {
|
|
7639
|
-
let exportsWithoutDescription = 0;
|
|
7640
|
-
let paramsWithoutDocs = 0;
|
|
7641
|
-
let missingExamples = 0;
|
|
7642
|
-
for (const exp of exports) {
|
|
7643
|
-
if (!exp.description)
|
|
7644
|
-
exportsWithoutDescription++;
|
|
7645
|
-
if (!exp.examples || exp.examples.length === 0)
|
|
7646
|
-
missingExamples++;
|
|
7647
|
-
const signatures = exp.signatures;
|
|
7648
|
-
if (signatures) {
|
|
7649
|
-
for (const sig of signatures) {
|
|
7650
|
-
for (const param of sig.parameters ?? []) {
|
|
7651
|
-
if (!param.description)
|
|
7652
|
-
paramsWithoutDocs++;
|
|
7653
|
-
}
|
|
7654
|
-
}
|
|
7655
|
-
}
|
|
7656
|
-
}
|
|
7657
|
-
return { exportsWithoutDescription, paramsWithoutDocs, missingExamples };
|
|
7658
|
-
}
|
|
7659
7707
|
function matchesPattern(name, pattern) {
|
|
7660
7708
|
if (!pattern.includes("*"))
|
|
7661
7709
|
return name === pattern;
|
|
@@ -7683,8 +7731,6 @@ async function extract(options) {
|
|
|
7683
7731
|
baseDir,
|
|
7684
7732
|
content,
|
|
7685
7733
|
maxTypeDepth,
|
|
7686
|
-
maxExternalTypeDepth,
|
|
7687
|
-
resolveExternalTypes,
|
|
7688
7734
|
includeSchema,
|
|
7689
7735
|
only,
|
|
7690
7736
|
ignore,
|
|
@@ -7751,7 +7797,15 @@ async function extract(options) {
|
|
|
7751
7797
|
}
|
|
7752
7798
|
let followExternal = options.followExternal;
|
|
7753
7799
|
let evaluate = options.evaluate;
|
|
7754
|
-
|
|
7800
|
+
if (followExternal === "auto" && !evaluate && options.decisions !== "jev") {
|
|
7801
|
+
diagnostics.push({
|
|
7802
|
+
message: "followExternal auto requires decisions: 'jev' (or an injected evaluate)",
|
|
7803
|
+
severity: "error",
|
|
7804
|
+
code: "JEV_UNAVAILABLE"
|
|
7805
|
+
});
|
|
7806
|
+
followExternal = undefined;
|
|
7807
|
+
}
|
|
7808
|
+
const wantsJev = options.decisions === "jev";
|
|
7755
7809
|
if (wantsJev && !evaluate) {
|
|
7756
7810
|
if (process.env.AI_GATEWAY_API_KEY) {
|
|
7757
7811
|
try {
|
|
@@ -7781,8 +7835,6 @@ async function extract(options) {
|
|
|
7781
7835
|
}
|
|
7782
7836
|
const ctx = createContext(program, sourceFile, {
|
|
7783
7837
|
maxTypeDepth,
|
|
7784
|
-
maxExternalTypeDepth,
|
|
7785
|
-
resolveExternalTypes,
|
|
7786
7838
|
includePrivate,
|
|
7787
7839
|
maxProperties,
|
|
7788
7840
|
onTruncation,
|
|
@@ -8014,7 +8066,6 @@ async function extract(options) {
|
|
|
8014
8066
|
}
|
|
8015
8067
|
};
|
|
8016
8068
|
const internalForgotten = forgottenExports.filter((f) => !f.isExternal);
|
|
8017
|
-
const degradedMode = isDtsSource ? { reason: "dts-source", stats: computeDegradedStats(normalizedExports) } : undefined;
|
|
8018
8069
|
if (verification.failed > 0) {
|
|
8019
8070
|
const failedNames = verification.details.failed.map((f) => f.name).join(", ");
|
|
8020
8071
|
diagnostics.push({
|
|
@@ -8032,8 +8083,7 @@ async function extract(options) {
|
|
|
8032
8083
|
diagnostics,
|
|
8033
8084
|
verification,
|
|
8034
8085
|
...internalForgotten.length > 0 ? { forgottenExports: internalForgotten } : {},
|
|
8035
|
-
...runtimeMetadata ? { runtimeSchemas: runtimeMetadata } : {}
|
|
8036
|
-
...degradedMode ? { degradedMode } : {}
|
|
8086
|
+
...runtimeMetadata ? { runtimeSchemas: runtimeMetadata } : {}
|
|
8037
8087
|
};
|
|
8038
8088
|
} finally {
|
|
8039
8089
|
clearTypeDefinitionCache();
|
|
@@ -8878,13 +8928,13 @@ export {
|
|
|
8878
8928
|
isPureRefSchema,
|
|
8879
8929
|
isProperty,
|
|
8880
8930
|
isPrimitiveName,
|
|
8931
|
+
isPathLikeInput,
|
|
8881
8932
|
isMethod,
|
|
8882
8933
|
isExported,
|
|
8883
8934
|
isEntryFilePath,
|
|
8884
8935
|
isBuiltinSymbol,
|
|
8885
8936
|
isBuiltinGeneric,
|
|
8886
8937
|
isAnonymous,
|
|
8887
|
-
hasDeprecatedTag,
|
|
8888
8938
|
groupByVisibility,
|
|
8889
8939
|
getValidationErrors,
|
|
8890
8940
|
getTypeOrigin,
|
|
@@ -8898,7 +8948,6 @@ export {
|
|
|
8898
8948
|
getJSDocComment,
|
|
8899
8949
|
getExportKind,
|
|
8900
8950
|
getExport,
|
|
8901
|
-
getDeprecationMessage,
|
|
8902
8951
|
getAvailableVersions,
|
|
8903
8952
|
toMarkdown as generateDocs,
|
|
8904
8953
|
formatTypeParameters,
|
|
@@ -8909,7 +8958,6 @@ export {
|
|
|
8909
8958
|
formatConditionalType,
|
|
8910
8959
|
formatBadges,
|
|
8911
8960
|
findWorkspaceRoot,
|
|
8912
|
-
findMissingParamDocs,
|
|
8913
8961
|
findDiscriminatorProperty,
|
|
8914
8962
|
findAdapter,
|
|
8915
8963
|
filterSpec,
|
|
@@ -8944,7 +8992,6 @@ export {
|
|
|
8944
8992
|
assertSpec,
|
|
8945
8993
|
asStandardSchema,
|
|
8946
8994
|
arktypeAdapter,
|
|
8947
|
-
analyzeSpec,
|
|
8948
8995
|
TypeRegistry,
|
|
8949
8996
|
STRING_PROTOTYPE_METHODS,
|
|
8950
8997
|
QueryBuilder,
|
|
@@ -1,80 +1,3 @@
|
|
|
1
|
-
// src/core/diagnostics.ts
|
|
2
|
-
function hasDeprecatedTag(exp) {
|
|
3
|
-
if (exp.deprecated === true)
|
|
4
|
-
return true;
|
|
5
|
-
return exp.tags?.some((t) => t.name === "deprecated" || t.name === "@deprecated") ?? false;
|
|
6
|
-
}
|
|
7
|
-
function getDeprecationMessage(exp) {
|
|
8
|
-
const tag = exp.tags?.find((t) => t.name === "deprecated" || t.name === "@deprecated");
|
|
9
|
-
if (tag?.text.trim()) {
|
|
10
|
-
return tag.text.trim();
|
|
11
|
-
}
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
function findMissingParamDocs(exp) {
|
|
15
|
-
const missing = [];
|
|
16
|
-
for (const sig of exp.signatures ?? []) {
|
|
17
|
-
for (const param of sig.parameters ?? []) {
|
|
18
|
-
if (!param.description?.trim()) {
|
|
19
|
-
missing.push(param.name);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return missing;
|
|
24
|
-
}
|
|
25
|
-
function checkMemberDescriptions(exp, members) {
|
|
26
|
-
const items = [];
|
|
27
|
-
for (const member of members) {
|
|
28
|
-
if (!member.description?.trim() && member.name) {
|
|
29
|
-
items.push({
|
|
30
|
-
exportId: exp.id,
|
|
31
|
-
exportName: exp.name,
|
|
32
|
-
issue: "member missing description",
|
|
33
|
-
member: member.name
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return items;
|
|
38
|
-
}
|
|
39
|
-
function analyzeSpec(spec) {
|
|
40
|
-
const missingDescriptions = [];
|
|
41
|
-
const deprecatedNoReason = [];
|
|
42
|
-
const missingParamDocs = [];
|
|
43
|
-
for (const exp of spec.exports) {
|
|
44
|
-
if (!exp.description?.trim()) {
|
|
45
|
-
missingDescriptions.push({
|
|
46
|
-
exportId: exp.id,
|
|
47
|
-
exportName: exp.name,
|
|
48
|
-
issue: "missing description"
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (exp.members) {
|
|
52
|
-
missingDescriptions.push(...checkMemberDescriptions(exp, exp.members));
|
|
53
|
-
}
|
|
54
|
-
if (hasDeprecatedTag(exp) && !getDeprecationMessage(exp)) {
|
|
55
|
-
deprecatedNoReason.push({
|
|
56
|
-
exportId: exp.id,
|
|
57
|
-
exportName: exp.name,
|
|
58
|
-
issue: "deprecated without reason"
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const missingParams = findMissingParamDocs(exp);
|
|
62
|
-
for (const param of missingParams) {
|
|
63
|
-
missingParamDocs.push({
|
|
64
|
-
exportId: exp.id,
|
|
65
|
-
exportName: exp.name,
|
|
66
|
-
issue: "param missing description",
|
|
67
|
-
param
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
missingDescriptions,
|
|
73
|
-
deprecatedNoReason,
|
|
74
|
-
missingParamDocs
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
1
|
// src/core/format.ts
|
|
79
2
|
function getMemberBadges(member) {
|
|
80
3
|
const badges = [];
|
|
@@ -592,4 +515,4 @@ function query(spec) {
|
|
|
592
515
|
return new QueryBuilder(spec);
|
|
593
516
|
}
|
|
594
517
|
|
|
595
|
-
export {
|
|
518
|
+
export { getMemberBadges, formatBadges, formatSchema, formatTypeParameters, formatParameters, formatReturnType, buildSignatureString, resolveTypeRef, isMethod, isProperty, getMethods, getProperties, groupByVisibility, sortByName, KIND_ORDER, groupByKind, formatConditionalType, formatMappedType, findExport, filterExports, toSearchIndex, toPagefindRecords, toAlgoliaRecords, toSearchIndexJSON, QueryBuilder, query };
|