@doccov/sdk 0.13.0 → 0.15.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/index.d.ts +3 -10
- package/dist/index.js +83 -71
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1378,9 +1378,7 @@ interface DocCovOptions {
|
|
|
1378
1378
|
/** Working directory for cache operations (default: process.cwd()) */
|
|
1379
1379
|
cwd?: string;
|
|
1380
1380
|
}
|
|
1381
|
-
|
|
1382
|
-
type OpenPkgOptions = DocCovOptions;
|
|
1383
|
-
declare function extractPackageSpec(entryFile: string, packageDir?: string, content?: string, options?: OpenPkgOptions): Promise<OpenPkgSpec>;
|
|
1381
|
+
declare function extractPackageSpec(entryFile: string, packageDir?: string, content?: string, options?: DocCovOptions): Promise<OpenPkgSpec>;
|
|
1384
1382
|
interface FilterOptions {
|
|
1385
1383
|
include?: string[];
|
|
1386
1384
|
exclude?: string[];
|
|
@@ -2029,8 +2027,6 @@ declare class DocCov {
|
|
|
2029
2027
|
}
|
|
2030
2028
|
declare function analyze(code: string, options?: AnalyzeOptions): Promise<OpenPkgSpec>;
|
|
2031
2029
|
declare function analyzeFile(filePath: string, options?: AnalyzeOptions): Promise<OpenPkgSpec>;
|
|
2032
|
-
/** @deprecated Use DocCov instead */
|
|
2033
|
-
declare const OpenPkg9: typeof DocCov;
|
|
2034
2030
|
import { SpecExport as SpecExport6 } from "@openpkg-ts/spec";
|
|
2035
2031
|
import { SpecExportKind as SpecExportKind2 } from "@openpkg-ts/spec";
|
|
2036
2032
|
/**
|
|
@@ -2299,10 +2295,6 @@ interface BuildPlanExecutionResult {
|
|
|
2299
2295
|
error?: string;
|
|
2300
2296
|
}
|
|
2301
2297
|
/**
|
|
2302
|
-
* GitHub context fetcher for AI-powered build plan generation.
|
|
2303
|
-
* Fetches project context via GitHub API without cloning the repository.
|
|
2304
|
-
*/
|
|
2305
|
-
/**
|
|
2306
2298
|
* Repository metadata from GitHub API.
|
|
2307
2299
|
*/
|
|
2308
2300
|
interface GitHubRepoMetadata {
|
|
@@ -2363,6 +2355,7 @@ interface GitHubProjectContext {
|
|
|
2363
2355
|
}
|
|
2364
2356
|
/**
|
|
2365
2357
|
* Parse GitHub URL into owner and repo.
|
|
2358
|
+
* Uses the richer parseGitHubUrl from github/index.ts, returning null on error.
|
|
2366
2359
|
*/
|
|
2367
2360
|
declare function parseGitHubUrl2(url: string): {
|
|
2368
2361
|
owner: string;
|
|
@@ -2384,4 +2377,4 @@ declare function typecheckExample(example: string, packagePath: string, options?
|
|
|
2384
2377
|
* Type-check multiple examples
|
|
2385
2378
|
*/
|
|
2386
2379
|
declare function typecheckExamples(examples: string[], packagePath: string, options?: TypecheckOptions): TypecheckResult;
|
|
2387
|
-
export { validateSpecCache, validateExamples, typecheckExamples, typecheckExample, shouldValidate, serializeJSDoc, saveSpecCache, saveReport, safeParseJson, runExamplesWithPackage, runExamples, runExample, resolveTarget, readPackageJson, parseGitHubUrl2 as parseScanGitHubUrl, parseMarkdownFiles, parseMarkdownFile, parseListFlag, parseJSDocToPatch, parseGitHubUrl, parseExamplesFlag, parseAssertions, mergeFixes, mergeFilters, mergeConfig, loadSpecCache, loadCachedReport, listWorkspacePackages, isFixableDrift, isExecutableLang, isCachedReportValid, installDependencies, hashString, hashFiles, hashFile, hasNonAssertionComments, hasDocsImpact, hasDocsForExport, groupDriftsByCategory, getUndocumentedExports, getSpecCachePath, getRunCommand, getRulesForKind, getRule, getReportPath, getPrimaryBuildScript, getInstallCommand, getDriftSummary, getDocumentedExports, getDocsImpactSummary, getDiffReportPath, getDefaultConfig, getCoverageRules, generateReportFromEnriched, generateReport, generateFixesForExport, generateFix, formatPackageList, formatDriftSummaryLine, findRemovedReferences, findPackageByName, findJSDocLocation, findExportReferences, findDeprecatedReferences, fetchSpecFromGitHub, fetchSpec, fetchGitHubContext, extractSpecSummary, extractPackageSpec, extractImports, extractFunctionCalls, evaluateQuality, evaluateExportQuality, ensureSpecCoverage, enrichSpec, diffSpecWithDocs, diffHashes, detectPackageManager, detectMonorepo, detectExampleRuntimeErrors, detectExampleAssertionFailures, detectEntryPoint, detectBuildInfo, defineConfig, createSourceFile, createNodeCommandRunner, computeExportDrift, computeDrift, clearSpecCache, categorizeDrifts, categorizeDrift, calculateAggregateCoverage, buildRawUrl, buildExportRegistry, buildDisplayUrl, buildCloneUrl, blockReferencesExport, applyPatchToJSDoc, applyEdits, analyzeProject2 as analyzeProject, analyzeFile, analyzeDocsImpact, analyze, WorkspacePackage, WorkspaceConfig, VALIDATION_INFO, TypecheckValidationResult, TypecheckResult, TypecheckOptions, SummaryDriftIssue, SpecSummary, SpecDiffWithDocs, SpecCacheConfig, SpecCache, SandboxFileSystem, STYLE_RULES, SPEC_CACHE_FILE, RuntimeDrift, RunValidationResult, RunExamplesWithPackageResult, RunExamplesWithPackageOptions, RunExampleOptions, RuleContext, ResolvedTarget, ResolvedFilters, ResolveTargetOptions, REPORT_VERSION, REPORT_EXTENSIONS, QualityViolation, QualitySeverity2 as QualitySeverity, QualityRulesConfig, QualityRule, QualityResult, QualityConfig, ProjectInfo, PresenceResult, ParsedGitHubUrl, PackageManagerInfo, PackageManager, PackageJson, PackageExports, OpenPkgSpec,
|
|
2380
|
+
export { validateSpecCache, validateExamples, typecheckExamples, typecheckExample, shouldValidate, serializeJSDoc, saveSpecCache, saveReport, safeParseJson, runExamplesWithPackage, runExamples, runExample, resolveTarget, readPackageJson, parseGitHubUrl2 as parseScanGitHubUrl, parseMarkdownFiles, parseMarkdownFile, parseListFlag, parseJSDocToPatch, parseGitHubUrl, parseExamplesFlag, parseAssertions, mergeFixes, mergeFilters, mergeConfig, loadSpecCache, loadCachedReport, listWorkspacePackages, isFixableDrift, isExecutableLang, isCachedReportValid, installDependencies, hashString, hashFiles, hashFile, hasNonAssertionComments, hasDocsImpact, hasDocsForExport, groupDriftsByCategory, getUndocumentedExports, getSpecCachePath, getRunCommand, getRulesForKind, getRule, getReportPath, getPrimaryBuildScript, getInstallCommand, getDriftSummary, getDocumentedExports, getDocsImpactSummary, getDiffReportPath, getDefaultConfig, getCoverageRules, generateReportFromEnriched, generateReport, generateFixesForExport, generateFix, formatPackageList, formatDriftSummaryLine, findRemovedReferences, findPackageByName, findJSDocLocation, findExportReferences, findDeprecatedReferences, fetchSpecFromGitHub, fetchSpec, fetchGitHubContext, extractSpecSummary, extractPackageSpec, extractImports, extractFunctionCalls, evaluateQuality, evaluateExportQuality, ensureSpecCoverage, enrichSpec, diffSpecWithDocs, diffHashes, detectPackageManager, detectMonorepo, detectExampleRuntimeErrors, detectExampleAssertionFailures, detectEntryPoint, detectBuildInfo, defineConfig, createSourceFile, createNodeCommandRunner, computeExportDrift, computeDrift, clearSpecCache, categorizeDrifts, categorizeDrift, calculateAggregateCoverage, buildRawUrl, buildExportRegistry, buildDisplayUrl, buildCloneUrl, blockReferencesExport, applyPatchToJSDoc, applyEdits, analyzeProject2 as analyzeProject, analyzeFile, analyzeDocsImpact, analyze, WorkspacePackage, WorkspaceConfig, VALIDATION_INFO, TypecheckValidationResult, TypecheckResult, TypecheckOptions, SummaryDriftIssue, SpecSummary, SpecDiffWithDocs, SpecCacheConfig, SpecCache, SandboxFileSystem, STYLE_RULES, SPEC_CACHE_FILE, RuntimeDrift, RunValidationResult, RunExamplesWithPackageResult, RunExamplesWithPackageOptions, RunExampleOptions, RuleContext, ResolvedTarget, ResolvedFilters, ResolveTargetOptions, REPORT_VERSION, REPORT_EXTENSIONS, QualityViolation, QualitySeverity2 as QualitySeverity, QualityRulesConfig, QualityRule, QualityResult, QualityConfig, ProjectInfo, PresenceResult, ParsedGitHubUrl, PackageManagerInfo, PackageManager, PackageJson, PackageExports, OpenPkgSpec, NodeFileSystem, MonorepoType, MonorepoInfo, MemberChange, MarkdownDocFile, MarkdownCodeBlock, LLMAssertion, JSDocTag, JSDocReturn, JSDocPatch, JSDocParam, JSDocEdit, InstallResult, InstallOptions, GitHubRepoMetadata, GitHubProjectContext, FixType, FixSuggestion, FilterSource, FilterOptions, FileSystem, ExportReference, ExportDriftResult, ExportCoverageData, ExampleValidationTypeError, ExampleValidationResult, ExampleValidationOptions, ExampleValidationMode, ExampleValidation, ExampleTypeError, ExampleRunResult, EntryPointSource, EntryPointInfo, EnrichedOpenPkg, EnrichedExport, EnrichedDocsMetadata, EnrichOptions, DriftSummary, DriftResult, DriftReportSummary, DriftReport, DocsImpactResult, DocsImpactReference, DocsImpact, DocsConfig, DocsChangeType, DocCovReport, DocCovOptions, DocCovConfig, DocCov, DiffWithDocsOptions, Diagnostic2 as Diagnostic, DetectedPackageManager, DEFAULT_REPORT_PATH, DEFAULT_REPORT_DIR, CoverageSummary, CommandRunner, CommandResult, CheckConfig, CategorizedDrift, CacheValidationResult, CacheContext, CORE_RULES, CACHE_VERSION, BuildPlanTarget, BuildPlanStepResult, BuildPlanStep, BuildPlanExecutionResult, BuildPlanEnvironment, BuildPlan, BuildInfo, BuildHints, BUILTIN_RULES, ApplyEditsResult, AnalyzeProjectOptions, AnalyzeOptions, AnalysisResult, AggregateQualityResult, ALL_VALIDATIONS };
|
package/dist/index.js
CHANGED
|
@@ -3501,7 +3501,6 @@ function normalizeDocCovOptions(options = {}) {
|
|
|
3501
3501
|
cwd: options.cwd ?? process.cwd()
|
|
3502
3502
|
};
|
|
3503
3503
|
}
|
|
3504
|
-
var normalizeOpenPkgOptions = normalizeDocCovOptions;
|
|
3505
3504
|
|
|
3506
3505
|
// src/analysis/program.ts
|
|
3507
3506
|
import * as path7 from "node:path";
|
|
@@ -3559,7 +3558,7 @@ function createAnalysisContext({
|
|
|
3559
3558
|
options
|
|
3560
3559
|
}) {
|
|
3561
3560
|
const baseDir = packageDir ?? path8.dirname(entryFile);
|
|
3562
|
-
const normalizedOptions =
|
|
3561
|
+
const normalizedOptions = normalizeDocCovOptions(options);
|
|
3563
3562
|
const programResult = createProgram({ entryFile, baseDir, content });
|
|
3564
3563
|
if (!programResult.sourceFile) {
|
|
3565
3564
|
throw new Error(`Could not load ${entryFile}`);
|
|
@@ -3611,39 +3610,7 @@ function extractParameterDecorators(param) {
|
|
|
3611
3610
|
return extractDecorators(param);
|
|
3612
3611
|
}
|
|
3613
3612
|
|
|
3614
|
-
// src/utils/
|
|
3615
|
-
var MAX_TYPE_DEPTH = DEFAULT_MAX_TYPE_DEPTH;
|
|
3616
|
-
function safeTypeToString(typeChecker, type) {
|
|
3617
|
-
try {
|
|
3618
|
-
return typeChecker.typeToString(type);
|
|
3619
|
-
} catch {
|
|
3620
|
-
return "unknown";
|
|
3621
|
-
}
|
|
3622
|
-
}
|
|
3623
|
-
var BUILTIN_TYPE_SCHEMAS = {
|
|
3624
|
-
Date: { type: "string", format: "date-time" },
|
|
3625
|
-
RegExp: { type: "object", description: "RegExp" },
|
|
3626
|
-
Error: { type: "object" },
|
|
3627
|
-
Promise: { type: "object" },
|
|
3628
|
-
Map: { type: "object" },
|
|
3629
|
-
Set: { type: "object" },
|
|
3630
|
-
WeakMap: { type: "object" },
|
|
3631
|
-
WeakSet: { type: "object" },
|
|
3632
|
-
Function: { type: "object" },
|
|
3633
|
-
ArrayBuffer: { type: "string", format: "binary" },
|
|
3634
|
-
ArrayBufferLike: { type: "string", format: "binary" },
|
|
3635
|
-
DataView: { type: "string", format: "binary" },
|
|
3636
|
-
Uint8Array: { type: "string", format: "byte" },
|
|
3637
|
-
Uint16Array: { type: "string", format: "byte" },
|
|
3638
|
-
Uint32Array: { type: "string", format: "byte" },
|
|
3639
|
-
Int8Array: { type: "string", format: "byte" },
|
|
3640
|
-
Int16Array: { type: "string", format: "byte" },
|
|
3641
|
-
Int32Array: { type: "string", format: "byte" },
|
|
3642
|
-
Float32Array: { type: "string", format: "byte" },
|
|
3643
|
-
Float64Array: { type: "string", format: "byte" },
|
|
3644
|
-
BigInt64Array: { type: "string", format: "byte" },
|
|
3645
|
-
BigUint64Array: { type: "string", format: "byte" }
|
|
3646
|
-
};
|
|
3613
|
+
// src/utils/typebox-handler.ts
|
|
3647
3614
|
var TYPEBOX_PRIMITIVE_MAP = {
|
|
3648
3615
|
TString: { type: "string" },
|
|
3649
3616
|
TNumber: { type: "number" },
|
|
@@ -3677,7 +3644,31 @@ function unwrapTypeBoxOptional(type) {
|
|
|
3677
3644
|
const hadMarker = filtered.length < intersectionType.types.length;
|
|
3678
3645
|
return { innerTypes: filtered, isOptional: hadMarker };
|
|
3679
3646
|
}
|
|
3680
|
-
function
|
|
3647
|
+
function getPropertyType(prop, parentType, typeChecker) {
|
|
3648
|
+
if (prop.valueDeclaration) {
|
|
3649
|
+
return typeChecker.getTypeOfSymbolAtLocation(prop, prop.valueDeclaration);
|
|
3650
|
+
}
|
|
3651
|
+
const propType = typeChecker.getTypeOfPropertyOfType(parentType, prop.getName());
|
|
3652
|
+
if (propType) {
|
|
3653
|
+
return propType;
|
|
3654
|
+
}
|
|
3655
|
+
const decl = prop.declarations?.[0];
|
|
3656
|
+
if (decl) {
|
|
3657
|
+
return typeChecker.getTypeOfSymbolAtLocation(prop, decl);
|
|
3658
|
+
}
|
|
3659
|
+
return typeChecker.getAnyType();
|
|
3660
|
+
}
|
|
3661
|
+
var _formatTypeReference = null;
|
|
3662
|
+
function setFormatTypeReference(fn) {
|
|
3663
|
+
_formatTypeReference = fn;
|
|
3664
|
+
}
|
|
3665
|
+
function formatTypeReferenceInternal(type, typeChecker, typeRefs, referencedTypes, visited, depth, maxDepth, typeIds) {
|
|
3666
|
+
if (_formatTypeReference) {
|
|
3667
|
+
return _formatTypeReference(type, typeChecker, typeRefs, referencedTypes, visited, depth, maxDepth, typeIds);
|
|
3668
|
+
}
|
|
3669
|
+
return { type: "object" };
|
|
3670
|
+
}
|
|
3671
|
+
function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visited, depth = 0, maxDepth = DEFAULT_MAX_TYPE_DEPTH, typeIds) {
|
|
3681
3672
|
if (depth > maxDepth) {
|
|
3682
3673
|
return { type: "unknown" };
|
|
3683
3674
|
}
|
|
@@ -3716,7 +3707,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3716
3707
|
const nested = formatTypeBoxSchema(propType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds);
|
|
3717
3708
|
properties[propName] = nested ?? { type: "object" };
|
|
3718
3709
|
} else {
|
|
3719
|
-
properties[propName] =
|
|
3710
|
+
properties[propName] = formatTypeReferenceInternal(propType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds);
|
|
3720
3711
|
}
|
|
3721
3712
|
const { isOptional } = unwrapTypeBoxOptional(propType);
|
|
3722
3713
|
if (propSymbolName !== "TOptional" && !isOptional) {
|
|
@@ -3744,7 +3735,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3744
3735
|
type: "object"
|
|
3745
3736
|
};
|
|
3746
3737
|
} else {
|
|
3747
|
-
items =
|
|
3738
|
+
items = formatTypeReferenceInternal(itemType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds);
|
|
3748
3739
|
}
|
|
3749
3740
|
return { type: "array", items };
|
|
3750
3741
|
}
|
|
@@ -3765,7 +3756,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3765
3756
|
type: "object"
|
|
3766
3757
|
});
|
|
3767
3758
|
} else {
|
|
3768
|
-
members.push(
|
|
3759
|
+
members.push(formatTypeReferenceInternal(memberType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds));
|
|
3769
3760
|
}
|
|
3770
3761
|
}
|
|
3771
3762
|
} else if (tupleType.typeArguments) {
|
|
@@ -3779,7 +3770,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3779
3770
|
type: "object"
|
|
3780
3771
|
});
|
|
3781
3772
|
} else {
|
|
3782
|
-
members.push(
|
|
3773
|
+
members.push(formatTypeReferenceInternal(memberType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds));
|
|
3783
3774
|
}
|
|
3784
3775
|
}
|
|
3785
3776
|
}
|
|
@@ -3802,7 +3793,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3802
3793
|
type: "object"
|
|
3803
3794
|
});
|
|
3804
3795
|
} else {
|
|
3805
|
-
members.push(
|
|
3796
|
+
members.push(formatTypeReferenceInternal(memberType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds));
|
|
3806
3797
|
}
|
|
3807
3798
|
}
|
|
3808
3799
|
}
|
|
@@ -3822,7 +3813,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3822
3813
|
type: "object"
|
|
3823
3814
|
};
|
|
3824
3815
|
}
|
|
3825
|
-
return
|
|
3816
|
+
return formatTypeReferenceInternal(innerType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds);
|
|
3826
3817
|
}
|
|
3827
3818
|
case "TLiteral": {
|
|
3828
3819
|
if (!typeArgs || typeArgs.length === 0) {
|
|
@@ -3852,7 +3843,7 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3852
3843
|
} else if (valueSymbolName && isTypeBoxSchemaType(valueSymbolName)) {
|
|
3853
3844
|
additionalProperties = formatTypeBoxSchema(valueType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds) ?? true;
|
|
3854
3845
|
} else {
|
|
3855
|
-
additionalProperties =
|
|
3846
|
+
additionalProperties = formatTypeReferenceInternal(valueType, typeChecker, typeRefs, referencedTypes, visited, depth + 1, maxDepth, typeIds);
|
|
3856
3847
|
}
|
|
3857
3848
|
return { type: "object", additionalProperties };
|
|
3858
3849
|
}
|
|
@@ -3872,6 +3863,32 @@ function formatTypeBoxSchema(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
3872
3863
|
return null;
|
|
3873
3864
|
}
|
|
3874
3865
|
}
|
|
3866
|
+
|
|
3867
|
+
// src/utils/schema-builder.ts
|
|
3868
|
+
var BUILTIN_TYPE_SCHEMAS = {
|
|
3869
|
+
Date: { type: "string", format: "date-time" },
|
|
3870
|
+
RegExp: { type: "object", description: "RegExp" },
|
|
3871
|
+
Error: { type: "object" },
|
|
3872
|
+
Promise: { type: "object" },
|
|
3873
|
+
Map: { type: "object" },
|
|
3874
|
+
Set: { type: "object" },
|
|
3875
|
+
WeakMap: { type: "object" },
|
|
3876
|
+
WeakSet: { type: "object" },
|
|
3877
|
+
Function: { type: "object" },
|
|
3878
|
+
ArrayBuffer: { type: "string", format: "binary" },
|
|
3879
|
+
ArrayBufferLike: { type: "string", format: "binary" },
|
|
3880
|
+
DataView: { type: "string", format: "binary" },
|
|
3881
|
+
Uint8Array: { type: "string", format: "byte" },
|
|
3882
|
+
Uint16Array: { type: "string", format: "byte" },
|
|
3883
|
+
Uint32Array: { type: "string", format: "byte" },
|
|
3884
|
+
Int8Array: { type: "string", format: "byte" },
|
|
3885
|
+
Int16Array: { type: "string", format: "byte" },
|
|
3886
|
+
Int32Array: { type: "string", format: "byte" },
|
|
3887
|
+
Float32Array: { type: "string", format: "byte" },
|
|
3888
|
+
Float64Array: { type: "string", format: "byte" },
|
|
3889
|
+
BigInt64Array: { type: "string", format: "byte" },
|
|
3890
|
+
BigUint64Array: { type: "string", format: "byte" }
|
|
3891
|
+
};
|
|
3875
3892
|
function isObjectLiteralType(type) {
|
|
3876
3893
|
if (!(type.getFlags() & ts2.TypeFlags.Object)) {
|
|
3877
3894
|
return false;
|
|
@@ -3894,20 +3911,6 @@ function withDescription(schema, description) {
|
|
|
3894
3911
|
description
|
|
3895
3912
|
};
|
|
3896
3913
|
}
|
|
3897
|
-
function getPropertyType(prop, parentType, typeChecker) {
|
|
3898
|
-
if (prop.valueDeclaration) {
|
|
3899
|
-
return typeChecker.getTypeOfSymbolAtLocation(prop, prop.valueDeclaration);
|
|
3900
|
-
}
|
|
3901
|
-
const propType = typeChecker.getTypeOfPropertyOfType(parentType, prop.getName());
|
|
3902
|
-
if (propType) {
|
|
3903
|
-
return propType;
|
|
3904
|
-
}
|
|
3905
|
-
const decl = prop.declarations?.[0];
|
|
3906
|
-
if (decl) {
|
|
3907
|
-
return typeChecker.getTypeOfSymbolAtLocation(prop, decl);
|
|
3908
|
-
}
|
|
3909
|
-
return typeChecker.getAnyType();
|
|
3910
|
-
}
|
|
3911
3914
|
function propertiesToSchema(properties, description) {
|
|
3912
3915
|
const schema = {
|
|
3913
3916
|
type: "object",
|
|
@@ -3944,6 +3947,10 @@ function propertiesToSchema(properties, description) {
|
|
|
3944
3947
|
}
|
|
3945
3948
|
return schema;
|
|
3946
3949
|
}
|
|
3950
|
+
var _formatTypeReference2 = null;
|
|
3951
|
+
function setSchemaBuilderFormatTypeReference(fn) {
|
|
3952
|
+
_formatTypeReference2 = fn;
|
|
3953
|
+
}
|
|
3947
3954
|
function buildSchemaFromTypeNode(node, typeChecker, typeRefs, referencedTypes, functionDoc, parentParamName) {
|
|
3948
3955
|
if (ts2.isParenthesizedTypeNode(node)) {
|
|
3949
3956
|
return buildSchemaFromTypeNode(node.type, typeChecker, typeRefs, referencedTypes, functionDoc ?? null, parentParamName);
|
|
@@ -3973,7 +3980,7 @@ function buildSchemaFromTypeNode(node, typeChecker, typeRefs, referencedTypes, f
|
|
|
3973
3980
|
let schema2 = "any";
|
|
3974
3981
|
if (member.type) {
|
|
3975
3982
|
const memberType = typeChecker.getTypeFromTypeNode(member.type);
|
|
3976
|
-
const formatted =
|
|
3983
|
+
const formatted = _formatTypeReference2 ? _formatTypeReference2(memberType, typeChecker, typeRefs, referencedTypes) : { type: "any" };
|
|
3977
3984
|
if (typeof formatted === "string") {
|
|
3978
3985
|
if (formatted === "any") {
|
|
3979
3986
|
schema2 = buildSchemaFromTypeNode(member.type, typeChecker, typeRefs, referencedTypes, functionDoc, parentParamName);
|
|
@@ -4154,7 +4161,16 @@ function deduplicateSchemas(schemas) {
|
|
|
4154
4161
|
}
|
|
4155
4162
|
return result;
|
|
4156
4163
|
}
|
|
4157
|
-
|
|
4164
|
+
|
|
4165
|
+
// src/utils/type-formatter.ts
|
|
4166
|
+
function safeTypeToString(typeChecker, type) {
|
|
4167
|
+
try {
|
|
4168
|
+
return typeChecker.typeToString(type);
|
|
4169
|
+
} catch {
|
|
4170
|
+
return "unknown";
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
function formatTypeReference(type, typeChecker, typeRefs, referencedTypes, visitedAliases, depth = 0, maxDepth = DEFAULT_MAX_TYPE_DEPTH, visitedTypeIds) {
|
|
4158
4174
|
if (depth > maxDepth) {
|
|
4159
4175
|
return { type: "unknown" };
|
|
4160
4176
|
}
|
|
@@ -4351,6 +4367,9 @@ function formatTypeReference(type, typeChecker, typeRefs, referencedTypes, visit
|
|
|
4351
4367
|
}
|
|
4352
4368
|
}
|
|
4353
4369
|
}
|
|
4370
|
+
setFormatTypeReference(formatTypeReference);
|
|
4371
|
+
setSchemaBuilderFormatTypeReference(formatTypeReference);
|
|
4372
|
+
// src/utils/parameter-utils.ts
|
|
4354
4373
|
function structureParameter(param, paramDecl, paramType, typeChecker, typeRefs, functionDoc, paramDoc, referencedTypes) {
|
|
4355
4374
|
const paramName = param.getName();
|
|
4356
4375
|
const isDestructured = paramName === "__0" || ts2.isObjectBindingPattern(paramDecl.name) || ts2.isArrayBindingPattern(paramDecl.name);
|
|
@@ -8430,7 +8449,6 @@ async function analyze(code, options = {}) {
|
|
|
8430
8449
|
async function analyzeFile(filePath, options = {}) {
|
|
8431
8450
|
return new DocCov().analyzeFile(filePath, options);
|
|
8432
8451
|
}
|
|
8433
|
-
var OpenPkg = DocCov;
|
|
8434
8452
|
function resolvePackageDir(entryFile) {
|
|
8435
8453
|
const fallbackDir = path11.dirname(entryFile);
|
|
8436
8454
|
let currentDir = fallbackDir;
|
|
@@ -8544,17 +8562,12 @@ function extractSpecSummary(spec) {
|
|
|
8544
8562
|
}
|
|
8545
8563
|
// src/scan/github-context.ts
|
|
8546
8564
|
function parseGitHubUrl2(url) {
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
const match = url.match(pattern);
|
|
8553
|
-
if (match) {
|
|
8554
|
-
return { owner: match[1], repo: match[2].replace(/\.git$/, "") };
|
|
8555
|
-
}
|
|
8565
|
+
try {
|
|
8566
|
+
const { owner, repo } = parseGitHubUrl(url);
|
|
8567
|
+
return { owner, repo };
|
|
8568
|
+
} catch {
|
|
8569
|
+
return null;
|
|
8556
8570
|
}
|
|
8557
|
-
return null;
|
|
8558
8571
|
}
|
|
8559
8572
|
async function fetchRawFile(owner, repo, ref, path13) {
|
|
8560
8573
|
const url = `https://raw.githubusercontent.com/${owner}/${repo}/${ref}/${path13}`;
|
|
@@ -8851,7 +8864,6 @@ export {
|
|
|
8851
8864
|
SPEC_CACHE_FILE,
|
|
8852
8865
|
REPORT_VERSION,
|
|
8853
8866
|
REPORT_EXTENSIONS,
|
|
8854
|
-
OpenPkg,
|
|
8855
8867
|
NodeFileSystem,
|
|
8856
8868
|
DocCov,
|
|
8857
8869
|
DEFAULT_REPORT_PATH,
|