@doccov/sdk 0.28.2 → 0.28.3
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 +6 -2
- package/dist/index.js +7 -3
- package/dist/types/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -835,6 +835,10 @@ interface CheckConfig {
|
|
|
835
835
|
examples?: ExampleValidationMode | ExampleValidationMode[] | string;
|
|
836
836
|
/** Minimum health score required (0-100). Unified metric combining coverage + accuracy. */
|
|
837
837
|
minHealth?: number;
|
|
838
|
+
/** @deprecated Use minHealth instead */
|
|
839
|
+
minCoverage?: number;
|
|
840
|
+
/** @deprecated Use minHealth instead */
|
|
841
|
+
maxDrift?: number;
|
|
838
842
|
/** API surface configuration */
|
|
839
843
|
apiSurface?: ApiSurfaceConfig;
|
|
840
844
|
}
|
|
@@ -2576,7 +2580,7 @@ interface SpecSummary {
|
|
|
2576
2580
|
* ```
|
|
2577
2581
|
*/
|
|
2578
2582
|
declare function extractSpecSummary(openpkg: OpenPkg8, doccov: DocCovSpec4): SpecSummary;
|
|
2579
|
-
import { OpenPkg as
|
|
2583
|
+
import { OpenPkg as OpenPkg_evravixewx } from "@openpkg-ts/spec";
|
|
2580
2584
|
/**
|
|
2581
2585
|
* Build Plan types for AI-powered repository scanning.
|
|
2582
2586
|
*/
|
|
@@ -2673,7 +2677,7 @@ interface BuildPlanExecutionResult {
|
|
|
2673
2677
|
/** Whether all required steps succeeded */
|
|
2674
2678
|
success: boolean;
|
|
2675
2679
|
/** Generated OpenPkg spec (if successful) */
|
|
2676
|
-
spec?:
|
|
2680
|
+
spec?: OpenPkg_evravixewx;
|
|
2677
2681
|
/** Results for each step */
|
|
2678
2682
|
stepResults: BuildPlanStepResult[];
|
|
2679
2683
|
/** Total execution time in milliseconds */
|
package/dist/index.js
CHANGED
|
@@ -15307,10 +15307,14 @@ function findTsConfig(packagePath) {
|
|
|
15307
15307
|
}
|
|
15308
15308
|
return;
|
|
15309
15309
|
}
|
|
15310
|
+
function hasPackageImport(code, packageName) {
|
|
15311
|
+
const importRegex = new RegExp(`import\\s+.*from\\s+['"]${packageName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}['"]`);
|
|
15312
|
+
return importRegex.test(code);
|
|
15313
|
+
}
|
|
15310
15314
|
function createVirtualSource(example, packageName, exportNames) {
|
|
15311
15315
|
const cleanCode = stripCodeBlockMarkers(example);
|
|
15312
15316
|
const lines = [];
|
|
15313
|
-
if (packageName && exportNames && exportNames.length > 0) {
|
|
15317
|
+
if (packageName && exportNames && exportNames.length > 0 && !hasPackageImport(cleanCode, packageName)) {
|
|
15314
15318
|
lines.push(`import { ${exportNames.join(", ")} } from '${packageName}';`);
|
|
15315
15319
|
lines.push("");
|
|
15316
15320
|
}
|
|
@@ -15349,8 +15353,8 @@ function typecheckExample(example, packagePath, options = {}) {
|
|
|
15349
15353
|
const compilerOptions = getCompilerOptions(tsconfigPath);
|
|
15350
15354
|
const virtualSource = createVirtualSource(cleanCode, packageName, exportNames);
|
|
15351
15355
|
const virtualFileName = path9.join(packagePath, "__doccov_example__.ts");
|
|
15352
|
-
const
|
|
15353
|
-
const lineOffset =
|
|
15356
|
+
const addedImport = packageName !== undefined && exportNames && exportNames.length > 0 && !hasPackageImport(cleanCode, packageName);
|
|
15357
|
+
const lineOffset = addedImport ? 2 : 0;
|
|
15354
15358
|
const sourceFile = ts2.createSourceFile(virtualFileName, virtualSource, ts2.ScriptTarget.ES2022, true);
|
|
15355
15359
|
const defaultHost = ts2.createCompilerHost(compilerOptions);
|
|
15356
15360
|
const customHost = {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ interface CheckConfig {
|
|
|
48
48
|
examples?: ExampleValidationMode | ExampleValidationMode[] | string;
|
|
49
49
|
/** Minimum health score required (0-100). Unified metric combining coverage + accuracy. */
|
|
50
50
|
minHealth?: number;
|
|
51
|
+
/** @deprecated Use minHealth instead */
|
|
52
|
+
minCoverage?: number;
|
|
53
|
+
/** @deprecated Use minHealth instead */
|
|
54
|
+
maxDrift?: number;
|
|
51
55
|
/** API surface configuration */
|
|
52
56
|
apiSurface?: ApiSurfaceConfig;
|
|
53
57
|
}
|