(tag: string)
| 31 | ) |
| 32 | |
| 33 | const stabilityResult = (tag: string) => { |
| 34 | const cwd = fs.mkdtempSync(path.join(os.tmpdir(), "jsdocs-stability-")) |
| 35 | try { |
| 36 | fs.mkdirSync(path.join(cwd, "src")) |
| 37 | writeTsconfig(cwd) |
| 38 | fs.writeFileSync( |
| 39 | path.join(cwd, "package.json"), |
| 40 | JSON.stringify({ |
| 41 | name: "@effect/sample", |
| 42 | type: "module", |
| 43 | exports: { ".": "./src/index.ts", "./*": "./src/*.ts" } |
| 44 | }) |
| 45 | ) |
| 46 | fs.writeFileSync( |
| 47 | path.join(cwd, "src/index.ts"), |
| 48 | `/** |
| 49 | * @stability stable |
| 50 | * @since 1.0.0 |
| 51 | */ |
| 52 | export * as Foo from "./Foo.ts"\n` |
| 53 | ) |
| 54 | fs.writeFileSync( |
| 55 | path.join(cwd, "src/Foo.ts"), |
| 56 | `/** |
| 57 | * Creates a value. |
| 58 | * |
| 59 | * ${tag} |
| 60 | * @category constructors |
| 61 | * @since 1.0.0 |
| 62 | */ |
| 63 | export const makeValue = () => 1 |
| 64 | ` |
| 65 | ) |
| 66 | const model = extractJSDocsSync({ |
| 67 | cwd, |
| 68 | tsconfig: "tsconfig.json", |
| 69 | include: ["src/**/*.ts"], |
| 70 | output: ".data/jsdocs.json" |
| 71 | }) |
| 72 | return { |
| 73 | diagnostics: model.files.flatMap((file) => file.diagnostics.map((diagnostic) => diagnostic.code)), |
| 74 | stability: model.apis.find((api) => api.apiFqn === "@effect/sample/Foo.makeValue")?.tags.stability |
| 75 | } |
| 76 | } finally { |
| 77 | fs.rmSync(cwd, { recursive: true, force: true }) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | const missingStabilityDiagnostics = (files: Record<string, string>, moduleStability = "@stability stable") => { |
| 82 | const cwd = fs.mkdtempSync(path.join(os.tmpdir(), "jsdocs-require-stability-")) |
no test coverage detected