@mark1russell7/api-report 0.2.0 → 0.2.2
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/build/cli.js
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/declarations.ts","../src/diff.ts","../src/entries.ts","../src/report.ts","../src/run.ts","../src/workspace.ts"],"mappings":";;;;;;UAOiB;;WAEN;;WAEA;WACA;;;UAIM;;WAEN;WACA;;;UAIM;WACN;WACA;WACA;WACA;;;UAIM;;WAEN,QAAQ;;WAER,UAAU,YAAY;;WAEtB,WAAW;;WAEX;aAAkB;aAAuB;;;WAEzC;aAAuB;aAAuB;aAAuB;;;WAErE,SAAS,YAAY;;WAErB,SAAS;;WAET,YAAY;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/declarations.ts","../src/diff.ts","../src/entries.ts","../src/report.ts","../src/run.ts","../src/workspace.ts"],"mappings":";;;;;;UAOiB;;WAEN;;WAEA;WACA;;;UAIM;;WAEN;WACA;;;UAIM;WACN;WACA;WACA;WACA;;;UAIM;;WAEN,QAAQ;;WAER,UAAU,YAAY;;WAEtB,WAAW;;WAEX;aAAkB;aAAuB;;;WAEzC;aAAuB;aAAuB;aAAuB;;;WAErE,SAAS,YAAY;;WAErB,SAAS;;WAET,YAAY;;;;;;wBAqCP,aAAa;;;;;wBAiJb,kBAAkB,gBAAgB,gBAAkB;;;UClOnD;WACN;WACA;;;wBAOK,UAAU,2BAA2B,2BAA2B;;UAoE/D;;WAEN;;WAEA;;WAEA;;;;;;wBAOK,YAAY,gBAAgB,eAAe,UAAS;;UCrFnD;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,gBAAgB,SAAS;;;;UAKnB;;WAEN;;WAEA;;;UAIM;;WAEN;;WAEA;;WAEA;;WAEA,iBAAiB;;;UAIX;WACN;WACA;;;;;;qBAUE;;qBAGA,SAAU,WAAW;;wBAMlB,kBAAkB,UAAU,WAAW;;;;;wBAYvC,kBAAkB;;wBAQlB,aAAa,iBAAiB;;;;;;wBAc9B,SAAS;;;;;;;wBA0ET,UAAU,UAAU,UAAU,eAAe;;wBAkD7C,OAAO,UAAU,WAAW;;qBC1M/B;;UAGI;;WAEN,WAAW;;WAEX;;;qBAiJE;;;;;;wBAOG,UAAU,qBAAqB,cAAc,kBAAkB,SAAS,UAAS;;UAiEhF;;WAEN;;WAEA;;;wBAIK,cAAc,aAAa,UAAS;;qBC/OvC;;UAGI;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;KAIC;;UAGK,mBAAmB;WACzB,MAAM;;WAEN;;WAEA;;;UAIM;;WAEN;;WAEA;;;;;;WAMA;;WAEA;WACA;;;UAIM;WACN,MAAM;WACN,mBAAmB;;WAEnB;;;;;;;;wBASK,WAAW,eAAe;;wBAsC1B,WAAW,SAAS,aAAa;;wBAuEjC,aAAa,QAAQ,WAAW;;wBAyBhC,gBAAgB,QAAQ;;UAWvB;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBAmBG,OAAO,yBAAyB,IAAI;;;;;;wBCnOpC,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as DEFAULT_TOOL, p as HEADER_LINES, g as PUBLISH_CONFIG_FIELDS, t as REPORT_FILE, n as USAGE, m as apiReport, _ as binsOf, v as byCode, y as declarationPathOf, w as diffLines, b as entriesOf, r as formatResult, c as globFolders, l as globToRegExp, u as packageFolders, h as packageReport, E as parseDeclarations, x as patternMatch, S as publishedManifest, i as readConfig, a as runCli, o as runReports, D as statementsOf, s as summaryMarkdown, C as targetOf, T as unifiedDiff, d as workspaceGlobs } from "./run-
|
|
1
|
+
export { f as DEFAULT_TOOL, p as HEADER_LINES, g as PUBLISH_CONFIG_FIELDS, t as REPORT_FILE, n as USAGE, m as apiReport, _ as binsOf, v as byCode, y as declarationPathOf, w as diffLines, b as entriesOf, r as formatResult, c as globFolders, l as globToRegExp, u as packageFolders, h as packageReport, E as parseDeclarations, x as patternMatch, S as publishedManifest, i as readConfig, a as runCli, o as runReports, D as statementsOf, s as summaryMarkdown, C as targetOf, T as unifiedDiff, d as workspaceGlobs } from "./run-Rmc5sFt0.js";
|
|
@@ -2,6 +2,26 @@ import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSyn
|
|
|
2
2
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
3
|
// src/declarations.ts
|
|
4
4
|
const BLOCK_HEADER = /^(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+class|class|interface|const\s+enum|enum|namespace|module|global)\b/;
|
|
5
|
+
const NAME_START = String.raw`[\p{ID_Start}$_]`;
|
|
6
|
+
const NAME_PART = String.raw`[\p{ID_Continue}$]`;
|
|
7
|
+
const NAME = `${NAME_START}${NAME_PART}*`;
|
|
8
|
+
/** This tag makes a pattern with the flag `u` from raw text. The `\p{...}` classes of a name need that flag. */
|
|
9
|
+
function unicode(strings, ...parts) {
|
|
10
|
+
return new RegExp(String.raw({ raw: strings.raw }, ...parts), "u");
|
|
11
|
+
}
|
|
12
|
+
const SPECIFIER = unicode`^(type\s+)?(${NAME})(?:\s+as\s+(${NAME}|"[^"]*"))?$`;
|
|
13
|
+
const PRIVATE_MEMBER = unicode`^\s+(?:private\s+(?:static\s+)?(?:readonly\s+)?${NAME}\??;|#private;)$`;
|
|
14
|
+
const DEFAULT_IMPORT = unicode`^(${NAME})\s*(?:,|$)`;
|
|
15
|
+
const NAMESPACE_IMPORT = unicode`^\* as (${NAME})$`;
|
|
16
|
+
const IMPORT_REQUIRE = unicode`^(export )?import (type )?(${NAME}) = require\(["']([^"']+)["']\);?$`;
|
|
17
|
+
const IMPORT_ALIAS = unicode`^(export )?import (${NAME}) = ${NAME}(?:\.${NAME})*;?$`;
|
|
18
|
+
const NAMESPACE_EXPORT = unicode`^export (type )?\* as (${NAME}) from ["']([^"']+)["'];?$`;
|
|
19
|
+
const EXPORT_ASSIGNMENT = unicode`^export = (${NAME});?$`;
|
|
20
|
+
const EXPORT_AS_NAMESPACE = unicode`^export as namespace (${NAME});?$`;
|
|
21
|
+
const DEFAULT_NAME = unicode`^export default (${NAME});?$`;
|
|
22
|
+
const NAMELESS_DEFAULT = unicode`^export default (?:declare )?(?:abstract )?(?:class|function\*?)(?!${NAME_PART})\s*((?:${NAME})?)`;
|
|
23
|
+
const DECLARATOR = unicode`^\s*(${NAME})`;
|
|
24
|
+
const DECLARATION = unicode`^(export )?(default )?(?:declare )?(?:abstract )?(?:const (?=enum))?(?:function|class|interface|type|enum|namespace|module) (${NAME})`;
|
|
5
25
|
/**
|
|
6
26
|
* This function splits the text of a declaration file into its top-level statements. It removes the
|
|
7
27
|
* comments, the blank lines and the spaces at the ends of the lines.
|
|
@@ -117,7 +137,7 @@ function splitTopLevel(text) {
|
|
|
117
137
|
/** The names of an export or import list: `a, type b, c as d`. */
|
|
118
138
|
function specifiersOf(list, typeOnly) {
|
|
119
139
|
return list.split(",").map((part) => part.trim()).filter((part) => part !== "").map((part) => {
|
|
120
|
-
const match =
|
|
140
|
+
const match = SPECIFIER.exec(part);
|
|
121
141
|
if (!match?.[2]) throw new Error(`An export list part that the report does not know: ${part}`);
|
|
122
142
|
return {
|
|
123
143
|
imported: match[2],
|
|
@@ -128,7 +148,7 @@ function specifiersOf(list, typeOnly) {
|
|
|
128
148
|
}
|
|
129
149
|
/** This function removes the private members of a class: they are not part of the API. */
|
|
130
150
|
function withoutPrivateMembers(statement) {
|
|
131
|
-
return statement.split("\n").filter((line) =>
|
|
151
|
+
return statement.split("\n").filter((line) => !PRIVATE_MEMBER.test(line)).join("\n");
|
|
132
152
|
}
|
|
133
153
|
/** A capture group of a match that the pattern always sets. */
|
|
134
154
|
const group = (match, index) => match[index] ?? "";
|
|
@@ -162,7 +182,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
162
182
|
const from = group(match, 3);
|
|
163
183
|
info.references.add(from);
|
|
164
184
|
let clause = group(match, 2).trim();
|
|
165
|
-
const defaultName =
|
|
185
|
+
const defaultName = DEFAULT_IMPORT.exec(clause);
|
|
166
186
|
if (defaultName) {
|
|
167
187
|
info.imports.set(group(defaultName, 1), {
|
|
168
188
|
from,
|
|
@@ -171,7 +191,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
171
191
|
});
|
|
172
192
|
clause = clause.slice(defaultName[0].length).trim();
|
|
173
193
|
}
|
|
174
|
-
const namespace =
|
|
194
|
+
const namespace = NAMESPACE_IMPORT.exec(clause);
|
|
175
195
|
if (namespace) info.imports.set(group(namespace, 1), {
|
|
176
196
|
from,
|
|
177
197
|
imported: "*",
|
|
@@ -189,7 +209,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
189
209
|
info.references.add(group(match, 1));
|
|
190
210
|
continue;
|
|
191
211
|
}
|
|
192
|
-
if (match =
|
|
212
|
+
if (match = IMPORT_REQUIRE.exec(flat)) {
|
|
193
213
|
const name = group(match, 3);
|
|
194
214
|
info.references.add(group(match, 4));
|
|
195
215
|
info.imports.set(name, {
|
|
@@ -203,7 +223,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
203
223
|
});
|
|
204
224
|
continue;
|
|
205
225
|
}
|
|
206
|
-
if (match =
|
|
226
|
+
if (match = IMPORT_ALIAS.exec(flat)) {
|
|
207
227
|
const name = group(match, 2);
|
|
208
228
|
addLocal(name, statement);
|
|
209
229
|
if (match[1] !== void 0) info.exported.set(name, {
|
|
@@ -212,7 +232,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
212
232
|
});
|
|
213
233
|
continue;
|
|
214
234
|
}
|
|
215
|
-
if (match =
|
|
235
|
+
if (match = NAMESPACE_EXPORT.exec(flat)) {
|
|
216
236
|
info.references.add(group(match, 3));
|
|
217
237
|
info.namespaces.push({
|
|
218
238
|
name: group(match, 2),
|
|
@@ -245,7 +265,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
245
265
|
});
|
|
246
266
|
continue;
|
|
247
267
|
}
|
|
248
|
-
if (match =
|
|
268
|
+
if (match = EXPORT_ASSIGNMENT.exec(flat)) {
|
|
249
269
|
info.exported.set("export=", {
|
|
250
270
|
local: group(match, 1),
|
|
251
271
|
typeOnly: false
|
|
@@ -268,18 +288,18 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
268
288
|
addAmbient("declare global", statement);
|
|
269
289
|
continue;
|
|
270
290
|
}
|
|
271
|
-
if (match =
|
|
291
|
+
if (match = EXPORT_AS_NAMESPACE.exec(flat)) {
|
|
272
292
|
addAmbient(`export as namespace ${group(match, 1)}`, statement);
|
|
273
293
|
continue;
|
|
274
294
|
}
|
|
275
|
-
if (match =
|
|
295
|
+
if (match = DEFAULT_NAME.exec(flat)) {
|
|
276
296
|
info.exported.set("default", {
|
|
277
297
|
local: group(match, 1),
|
|
278
298
|
typeOnly: false
|
|
279
299
|
});
|
|
280
300
|
continue;
|
|
281
301
|
}
|
|
282
|
-
match =
|
|
302
|
+
match = NAMELESS_DEFAULT.exec(flat);
|
|
283
303
|
if (match && (match[1] === "" || match[1] === "extends" || match[1] === "implements")) {
|
|
284
304
|
addLocal("default", withoutPrivateMembers(statement));
|
|
285
305
|
info.exported.set("default", {
|
|
@@ -291,7 +311,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
291
311
|
if (match = /^(export )?(?:declare )?(?:const|let|var) (?!enum\b)(.*?);?$/.exec(flat)) {
|
|
292
312
|
const exported = match[1] !== void 0;
|
|
293
313
|
for (const part of splitTopLevel(group(match, 2))) {
|
|
294
|
-
const name =
|
|
314
|
+
const name = DECLARATOR.exec(part);
|
|
295
315
|
if (!name) throw new Error(`A declaration that the report does not know, in ${file}:\n${statement}`);
|
|
296
316
|
addLocal(group(name, 1), statement);
|
|
297
317
|
if (exported) info.exported.set(group(name, 1), {
|
|
@@ -301,7 +321,7 @@ function parseDeclarations(source, file = "<text>") {
|
|
|
301
321
|
}
|
|
302
322
|
continue;
|
|
303
323
|
}
|
|
304
|
-
match =
|
|
324
|
+
match = DECLARATION.exec(flat);
|
|
305
325
|
if (match) {
|
|
306
326
|
const name = group(match, 3);
|
|
307
327
|
addLocal(name, withoutPrivateMembers(statement));
|
|
@@ -949,12 +969,18 @@ function globToRegExp(glob) {
|
|
|
949
969
|
}
|
|
950
970
|
/** The characters that make a path segment a pattern. */
|
|
951
971
|
const GLOB_CHARS = /[*?{]/;
|
|
972
|
+
/** This function removes the `/` characters at the end of a path, with a loop in place of a regular expression. */
|
|
973
|
+
function trimEndSlashes(path) {
|
|
974
|
+
let end = path.length;
|
|
975
|
+
while (end > 0 && path.charAt(end - 1) === "/") end -= 1;
|
|
976
|
+
return path.slice(0, end);
|
|
977
|
+
}
|
|
952
978
|
/**
|
|
953
979
|
* This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,
|
|
954
980
|
* in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.
|
|
955
981
|
*/
|
|
956
982
|
function globFolders(root, glob) {
|
|
957
|
-
const clean = glob.
|
|
983
|
+
const clean = trimEndSlashes(glob.startsWith("./") ? glob.slice(2) : glob);
|
|
958
984
|
const segments = clean.split("/");
|
|
959
985
|
const firstPattern = segments.findIndex((segment) => GLOB_CHARS.test(segment));
|
|
960
986
|
if (firstPattern < 0) return existsSync(join(root, clean)) ? [clean] : [];
|
|
@@ -1289,4 +1315,4 @@ function runCli(args, io) {
|
|
|
1289
1315
|
}
|
|
1290
1316
|
export { targetOf as C, statementsOf as D, parseDeclarations as E, publishedManifest as S, unifiedDiff as T, binsOf as _, runCli as a, entriesOf as b, globFolders as c, workspaceGlobs as d, DEFAULT_TOOL as f, PUBLISH_CONFIG_FIELDS as g, packageReport as h, readConfig as i, globToRegExp as l, apiReport as m, USAGE as n, runReports as o, HEADER_LINES as p, formatResult as r, summaryMarkdown as s, REPORT_FILE as t, packageFolders as u, byCode as v, diffLines as w, patternMatch as x, declarationPathOf as y };
|
|
1291
1317
|
|
|
1292
|
-
//# sourceMappingURL=run-
|
|
1318
|
+
//# sourceMappingURL=run-Rmc5sFt0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-Rmc5sFt0.js","names":[],"sources":["../src/declarations.ts","../src/diff.ts","../src/entries.ts","../src/report.ts","../src/workspace.ts","../src/run.ts"],"sourcesContent":["/**\n * The reader of the text of a declaration file. TypeScript 7 has no stable compiler API, so this\n * module reads the `.d.ts` files as text. The declaration emit of `tsc` and of `tsdown` is regular,\n * and an unknown form of statement throws.\n */\n\n/** An import of a declaration file, by its local name. */\nexport interface ImportBinding {\n /** The module specifier. */\n readonly from: string;\n /** The imported name, or `default`, `export=` or `*`. */\n readonly imported: string;\n readonly typeOnly: boolean;\n}\n\n/** A name that a module exports from its own scope. */\nexport interface LocalExport {\n /** The local name of the exported name. */\n readonly local: string;\n readonly typeOnly: boolean;\n}\n\n/** A part of an `export { a as b } from \"x\"` statement. */\nexport interface Reexport {\n readonly imported: string;\n readonly exported: string;\n readonly typeOnly: boolean;\n readonly from: string;\n}\n\n/** The statements of one declaration file, sorted by their kind. */\nexport interface DeclarationInfo {\n /** The declarations of the module by name, exported or not. */\n readonly locals: Map<string, string[]>;\n /** The names that the module exports from its own scope, by the exported name. */\n readonly exported: Map<string, LocalExport>;\n /** The `export { a as b } from \"x\"` parts. */\n readonly reexports: Reexport[];\n /** The `export * from \"x\"` statements. */\n readonly stars: { readonly from: string; readonly typeOnly: boolean }[];\n /** The `export * as name from \"x\"` statements. */\n readonly namespaces: { readonly name: string; readonly from: string; readonly typeOnly: boolean }[];\n /** The imports by local name. */\n readonly imports: Map<string, ImportBinding>;\n /** The ambient declarations by label: `declare module \"x\"`, `declare global`, `export as namespace X`. */\n readonly ambient: Map<string, string[]>;\n /** Each module specifier that the file names: the files that it reaches. */\n readonly references: Set<string>;\n}\n\n/** A mode of the reader of a template literal. */\ntype Mode = { readonly kind: \"template\" } | { readonly kind: \"part\"; readonly depth: number };\n\nconst BLOCK_HEADER = /^(?:export\\s+)?(?:default\\s+)?(?:declare\\s+)?(?:abstract\\s+class|class|interface|const\\s+enum|enum|namespace|module|global)\\b/;\n\n// A name of the ECMAScript grammar: a start letter, then continue letters. The letters include the letters that are not ASCII.\nconst NAME_START = String.raw`[\\p{ID_Start}$_]`;\nconst NAME_PART = String.raw`[\\p{ID_Continue}$]`;\nconst NAME = `${NAME_START}${NAME_PART}*`;\n\n/** This tag makes a pattern with the flag `u` from raw text. The `\\p{...}` classes of a name need that flag. */\nfunction unicode(strings: TemplateStringsArray, ...parts: string[]): RegExp {\n return new RegExp(String.raw({ raw: strings.raw }, ...parts), \"u\");\n}\n\nconst SPECIFIER = unicode`^(type\\s+)?(${NAME})(?:\\s+as\\s+(${NAME}|\"[^\"]*\"))?$`;\nconst PRIVATE_MEMBER = unicode`^\\s+(?:private\\s+(?:static\\s+)?(?:readonly\\s+)?${NAME}\\??;|#private;)$`;\nconst DEFAULT_IMPORT = unicode`^(${NAME})\\s*(?:,|$)`;\nconst NAMESPACE_IMPORT = unicode`^\\* as (${NAME})$`;\nconst IMPORT_REQUIRE = unicode`^(export )?import (type )?(${NAME}) = require\\([\"']([^\"']+)[\"']\\);?$`;\nconst IMPORT_ALIAS = unicode`^(export )?import (${NAME}) = ${NAME}(?:\\.${NAME})*;?$`;\nconst NAMESPACE_EXPORT = unicode`^export (type )?\\* as (${NAME}) from [\"']([^\"']+)[\"'];?$`;\nconst EXPORT_ASSIGNMENT = unicode`^export = (${NAME});?$`;\nconst EXPORT_AS_NAMESPACE = unicode`^export as namespace (${NAME});?$`;\nconst DEFAULT_NAME = unicode`^export default (${NAME});?$`;\n// The negative lookahead stops `classX` as a keyword. The name is empty for a default function or class without a name.\nconst NAMELESS_DEFAULT = unicode`^export default (?:declare )?(?:abstract )?(?:class|function\\*?)(?!${NAME_PART})\\s*((?:${NAME})?)`;\nconst DECLARATOR = unicode`^\\s*(${NAME})`;\nconst DECLARATION = unicode`^(export )?(default )?(?:declare )?(?:abstract )?(?:const (?=enum))?(?:function|class|interface|type|enum|namespace|module) (${NAME})`;\n\n/**\n * This function splits the text of a declaration file into its top-level statements. It removes the\n * comments, the blank lines and the spaces at the ends of the lines.\n */\nexport function statementsOf(source: string): string[] {\n // The declarations of a bin file keep its `#!` line\n const text = source.replace(/\\r\\n?/g, \"\\n\").replace(/^#![^\\n]*\\n?/, \"\");\n const statements: string[] = [];\n let current = \"\";\n let depth = 0;\n // The depth of the type arguments at the top level: `class A<T = {}> {` has a brace in them\n let angle = 0;\n // True when the body of a class, an interface, an enum or a namespace is open\n let body = false;\n // The template literals and their `${ }` parts, from the outside in\n const modes: Mode[] = [];\n\n const finish = (): void => {\n const lines = current\n .split(\"\\n\")\n .map((line) => line.trimEnd())\n .filter((line) => line.trim() !== \"\");\n if (lines.length > 0) statements.push(lines.join(\"\\n\"));\n current = \"\";\n angle = 0;\n body = false;\n };\n\n let index = 0;\n while (index < text.length) {\n const char = text.charAt(index);\n const next = text.charAt(index + 1);\n const mode = modes.at(-1);\n if (mode?.kind === \"template\") {\n if (char === \"\\\\\") {\n current += char + next;\n index += 2;\n } else if (char === \"`\") {\n modes.pop();\n current += char;\n index++;\n } else if (char === \"$\" && next === \"{\") {\n modes.push({ kind: \"part\", depth });\n current += \"${\";\n index += 2;\n } else {\n current += char;\n index++;\n }\n continue;\n }\n if (char === \"/\" && next === \"/\") {\n while (index < text.length && text.charAt(index) !== \"\\n\") index++;\n continue;\n }\n if (char === \"/\" && next === \"*\") {\n const end = text.indexOf(\"*/\", index + 2);\n index = end < 0 ? text.length : end + 2;\n current += \" \";\n continue;\n }\n if (char === '\"' || char === \"'\") {\n let end = index + 1;\n while (end < text.length && text.charAt(end) !== char) end += text.charAt(end) === \"\\\\\" ? 2 : 1;\n current += text.slice(index, end + 1);\n index = end + 1;\n continue;\n }\n if (char === \"`\") {\n modes.push({ kind: \"template\" });\n current += char;\n index++;\n continue;\n }\n if (modes.length === 0 && depth === 0) {\n // The `>` of an arrow `=>` closes nothing\n if (char === \"<\") angle++;\n else if (char === \">\" && text.charAt(index - 1) !== \"=\") angle = Math.max(0, angle - 1);\n else if (char === \"{\" && angle === 0 && !body && BLOCK_HEADER.test(current.trim())) body = true;\n }\n if (char === \"{\" || char === \"(\" || char === \"[\") depth++;\n if (char === \"}\" || char === \")\" || char === \"]\") {\n if (char === \"}\" && mode?.kind === \"part\" && depth === mode.depth) {\n modes.pop();\n current += char;\n index++;\n continue;\n }\n depth--;\n }\n current += char;\n index++;\n if (modes.length > 0 || depth !== 0) continue;\n if (char === \";\" || (char === \"}\" && body)) finish();\n }\n finish();\n return statements;\n}\n\n/** This function splits `text` at each comma outside brackets, type arguments and strings. */\nfunction splitTopLevel(text: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let index = 0; index < text.length; index++) {\n const char = text.charAt(index);\n if (char === '\"' || char === \"'\" || char === \"`\") {\n let end = index + 1;\n while (end < text.length && text.charAt(end) !== char) end += text.charAt(end) === \"\\\\\" ? 2 : 1;\n index = end;\n } else if (char === \"(\" || char === \"[\" || char === \"{\" || char === \"<\") depth++;\n else if (char === \")\" || char === \"]\" || char === \"}\" || (char === \">\" && text.charAt(index - 1) !== \"=\")) depth--;\n else if (char === \",\" && depth === 0) {\n parts.push(text.slice(start, index));\n start = index + 1;\n }\n }\n parts.push(text.slice(start));\n return parts;\n}\n\n/** The names of an export or import list: `a, type b, c as d`. */\nfunction specifiersOf(list: string, typeOnly: boolean): { imported: string; exported: string; typeOnly: boolean }[] {\n return list\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\")\n .map((part) => {\n const match = SPECIFIER.exec(part);\n if (!match?.[2]) throw new Error(`An export list part that the report does not know: ${part}`);\n return { imported: match[2], exported: match[3] ?? match[2], typeOnly: typeOnly || match[1] !== undefined };\n });\n}\n\n/** This function removes the private members of a class: they are not part of the API. */\nfunction withoutPrivateMembers(statement: string): string {\n return statement\n .split(\"\\n\")\n .filter((line) => !PRIVATE_MEMBER.test(line))\n .join(\"\\n\");\n}\n\n/** A capture group of a match that the pattern always sets. */\nconst group = (match: RegExpExecArray, index: number): string => match[index] ?? \"\";\n\n/**\n * This function sorts the statements of the text of one declaration file by their kind. `file`\n * names the file in the errors. An unknown form of statement throws.\n */\nexport function parseDeclarations(source: string, file = \"<text>\"): DeclarationInfo {\n const info: DeclarationInfo = {\n locals: new Map(),\n exported: new Map(),\n reexports: [],\n stars: [],\n namespaces: [],\n imports: new Map(),\n ambient: new Map(),\n references: new Set(),\n };\n const addLocal = (name: string, statement: string): void => {\n info.locals.set(name, [...(info.locals.get(name) ?? []), statement]);\n };\n const addAmbient = (label: string, statement: string): void => {\n info.ambient.set(label, [...(info.ambient.get(label) ?? []), statement]);\n };\n for (const statement of statementsOf(source)) {\n const flat = statement.replace(/\\s+/g, \" \");\n for (const found of flat.matchAll(/\\bimport\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g)) info.references.add(found[1] ?? \"\");\n let match: RegExpExecArray | null;\n if ((match = /^import (type )?(.+?) from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n const typeOnly = match[1] !== undefined;\n const from = group(match, 3);\n info.references.add(from);\n let clause = group(match, 2).trim();\n const defaultName = DEFAULT_IMPORT.exec(clause);\n if (defaultName) {\n info.imports.set(group(defaultName, 1), { from, imported: \"default\", typeOnly });\n clause = clause.slice(defaultName[0].length).trim();\n }\n const namespace = NAMESPACE_IMPORT.exec(clause);\n if (namespace) info.imports.set(group(namespace, 1), { from, imported: \"*\", typeOnly });\n const braces = /^\\{(.*)\\}$/.exec(clause);\n if (braces) {\n for (const specifier of specifiersOf(group(braces, 1), typeOnly)) {\n info.imports.set(specifier.exported, { from, imported: specifier.imported, typeOnly: specifier.typeOnly });\n }\n }\n continue;\n }\n if ((match = /^import [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n info.references.add(group(match, 1));\n continue;\n }\n // `import x = require(\"y\")`: the name is the `export =` of the module\n if ((match = IMPORT_REQUIRE.exec(flat))) {\n const name = group(match, 3);\n info.references.add(group(match, 4));\n info.imports.set(name, { from: group(match, 4), imported: \"export=\", typeOnly: match[2] !== undefined });\n if (match[1] !== undefined) info.exported.set(name, { local: name, typeOnly: false });\n continue;\n }\n // `import A = N.B`: an alias of a name of a namespace\n if ((match = IMPORT_ALIAS.exec(flat))) {\n const name = group(match, 2);\n addLocal(name, statement);\n if (match[1] !== undefined) info.exported.set(name, { local: name, typeOnly: false });\n continue;\n }\n if ((match = NAMESPACE_EXPORT.exec(flat))) {\n info.references.add(group(match, 3));\n info.namespaces.push({ name: group(match, 2), from: group(match, 3), typeOnly: match[1] !== undefined });\n continue;\n }\n if ((match = /^export (type )?\\* from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n info.references.add(group(match, 2));\n info.stars.push({ from: group(match, 2), typeOnly: match[1] !== undefined });\n continue;\n }\n if ((match = /^export (type )?\\{(.*)\\} from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n const from = group(match, 3);\n info.references.add(from);\n for (const specifier of specifiersOf(group(match, 2), match[1] !== undefined)) info.reexports.push({ ...specifier, from });\n continue;\n }\n if ((match = /^export (type )?\\{(.*)\\};?$/.exec(flat))) {\n for (const specifier of specifiersOf(group(match, 2), match[1] !== undefined)) {\n info.exported.set(specifier.exported, { local: specifier.imported, typeOnly: specifier.typeOnly });\n }\n continue;\n }\n // `export = X`: the module is the value X (CommonJS)\n if ((match = EXPORT_ASSIGNMENT.exec(flat))) {\n info.exported.set(\"export=\", { local: group(match, 1), typeOnly: false });\n continue;\n }\n if (/^export = /.test(flat)) {\n addLocal(\"export=\", statement);\n info.exported.set(\"export=\", { local: \"export=\", typeOnly: false });\n continue;\n }\n if ((match = /^(?:export )?declare module ([\"'][^\"']+[\"'])/.exec(flat))) {\n addAmbient(`declare module ${group(match, 1).replaceAll(\"'\", '\"')}`, statement);\n continue;\n }\n if (/^(?:export )?(?:declare )?global \\{/.test(flat)) {\n addAmbient(\"declare global\", statement);\n continue;\n }\n if ((match = EXPORT_AS_NAMESPACE.exec(flat))) {\n addAmbient(`export as namespace ${group(match, 1)}`, statement);\n continue;\n }\n // `export default x`: the default export is a name of the module\n if ((match = DEFAULT_NAME.exec(flat))) {\n info.exported.set(\"default\", { local: group(match, 1), typeOnly: false });\n continue;\n }\n // A default function or class without a name\n match = NAMELESS_DEFAULT.exec(flat);\n if (match && (match[1] === \"\" || match[1] === \"extends\" || match[1] === \"implements\")) {\n addLocal(\"default\", withoutPrivateMembers(statement));\n info.exported.set(\"default\", { local: \"default\", typeOnly: false });\n continue;\n }\n // `const a: A, b: B` declares two names\n if ((match = /^(export )?(?:declare )?(?:const|let|var) (?!enum\\b)(.*?);?$/.exec(flat))) {\n const exported = match[1] !== undefined;\n for (const part of splitTopLevel(group(match, 2))) {\n const name = DECLARATOR.exec(part);\n if (!name) throw new Error(`A declaration that the report does not know, in ${file}:\\n${statement}`);\n addLocal(group(name, 1), statement);\n if (exported) info.exported.set(group(name, 1), { local: group(name, 1), typeOnly: false });\n }\n continue;\n }\n match = DECLARATION.exec(flat);\n if (match) {\n const name = group(match, 3);\n addLocal(name, withoutPrivateMembers(statement));\n if (match[1] !== undefined) info.exported.set(match[2] !== undefined ? \"default\" : name, { local: name, typeOnly: false });\n continue;\n }\n // `export default <expression>`\n if (/^export default /.test(flat)) {\n addLocal(\"default\", statement);\n info.exported.set(\"default\", { local: \"default\", typeOnly: false });\n continue;\n }\n throw new Error(`A statement that the report does not know, in ${file}:\\n${statement}`);\n }\n return info;\n}\n","/** A line diff (the algorithm of Myers) and its text in the unified format of `diff -u` and git. */\n\n/** An operation of a line diff: a kept line, a removed line or an added line. */\nexport interface DiffLine {\n readonly kind: \" \" | \"-\" | \"+\";\n readonly text: string;\n}\n\n/** Above this number of changes, the diff replaces the whole changed part, so the memory stays small. */\nconst MAX_EDITS = 2000;\n\n/** This function gives the shortest edit script that changes the lines `before` into the lines `after`. */\nexport function diffLines(before: readonly string[], after: readonly string[]): DiffLine[] {\n // The common start and end need no search\n let start = 0;\n while (start < before.length && start < after.length && before[start] === after[start]) start++;\n let end = 0;\n while (end < before.length - start && end < after.length - start && before[before.length - 1 - end] === after[after.length - 1 - end]) end++;\n const a = before.slice(start, before.length - end);\n const b = after.slice(start, after.length - end);\n const kept = (lines: readonly string[]): DiffLine[] => lines.map((text) => ({ kind: \" \", text }));\n return [...kept(before.slice(0, start)), ...middle(a, b), ...kept(before.slice(before.length - end))];\n}\n\n/** This function gives the edit script of two lists that have different first lines and different last lines. */\nfunction middle(a: readonly string[], b: readonly string[]): DiffLine[] {\n const n = a.length;\n const m = b.length;\n const replace = (): DiffLine[] => [...a.map((text): DiffLine => ({ kind: \"-\", text })), ...b.map((text): DiffLine => ({ kind: \"+\", text }))];\n if (n === 0 || m === 0) return replace();\n const max = Math.min(n + m, MAX_EDITS);\n const offset = max + 1;\n const v = new Int32Array(2 * max + 3);\n // trace[d] holds v[-d..d] before the step d\n const trace: Int32Array[] = [];\n for (let d = 0; d <= max; d++) {\n trace.push(v.slice(offset - d, offset + d + 1));\n for (let k = -d; k <= d; k += 2) {\n const down = k === -d || (k !== d && (v[offset + k - 1] ?? 0) < (v[offset + k + 1] ?? 0));\n let x = down ? (v[offset + k + 1] ?? 0) : (v[offset + k - 1] ?? 0) + 1;\n let y = x - k;\n while (x < n && y < m && a[x] === b[y]) {\n x++;\n y++;\n }\n v[offset + k] = x;\n if (x >= n && y >= m) return backtrack(a, b, trace);\n }\n }\n return replace();\n}\n\n/** This function follows the trace of the search back from the end, and gives the operations in order. */\nfunction backtrack(a: readonly string[], b: readonly string[], trace: readonly Int32Array[]): DiffLine[] {\n const result: DiffLine[] = [];\n let x = a.length;\n let y = b.length;\n for (let d = trace.length - 1; d >= 0; d--) {\n const v = trace[d] ?? new Int32Array(0);\n const at = (k: number): number => v[k + d] ?? 0;\n const k = x - y;\n const down = k === -d || (k !== d && at(k - 1) < at(k + 1));\n const previousK = down ? k + 1 : k - 1;\n const previousX = d === 0 ? 0 : at(previousK);\n const previousY = d === 0 ? 0 : previousX - previousK;\n while (x > previousX && y > previousY) {\n result.push({ kind: \" \", text: a[x - 1] ?? \"\" });\n x--;\n y--;\n }\n if (d === 0) break;\n if (down) result.push({ kind: \"+\", text: b[y - 1] ?? \"\" });\n else result.push({ kind: \"-\", text: a[x - 1] ?? \"\" });\n x = previousX;\n y = previousY;\n }\n return result.reverse();\n}\n\n/** The options of a unified diff. */\nexport interface UnifiedDiffOptions {\n /** The number of kept lines around each change. The default is 3. */\n readonly context?: number;\n /** The name of the file before the change, after `---`. */\n readonly from?: string;\n /** The name of the file after the change, after `+++`. */\n readonly to?: string;\n}\n\n/**\n * This function gives the change from the text `before` to the text `after` in the unified format.\n * The result is an empty string when the texts are the same.\n */\nexport function unifiedDiff(before: string, after: string, options: UnifiedDiffOptions = {}): string {\n const split = (text: string): string[] => (text === \"\" ? [] : text.replace(/\\n$/, \"\").split(\"\\n\"));\n const ops = diffLines(split(before), split(after));\n const context = options.context ?? 3;\n // The position of each operation in the two texts\n const positions: { a: number; b: number }[] = [];\n let a = 0;\n let b = 0;\n for (const op of ops) {\n positions.push({ a, b });\n if (op.kind !== \"+\") a++;\n if (op.kind !== \"-\") b++;\n }\n const changes = ops.flatMap((op, index) => (op.kind === \" \" ? [] : [index]));\n if (changes.length === 0) return \"\";\n const lines = [`--- ${options.from ?? \"before\"}`, `+++ ${options.to ?? \"after\"}`];\n let index = 0;\n while (index < changes.length) {\n const first = changes[index] ?? 0;\n let last = first;\n while (index + 1 < changes.length && (changes[index + 1] ?? 0) - last <= 2 * context) last = changes[++index] ?? last;\n index++;\n const from = Math.max(0, first - context);\n const to = Math.min(ops.length - 1, last + context);\n const hunk = ops.slice(from, to + 1);\n const start = positions[from] ?? { a: 0, b: 0 };\n const countA = hunk.filter((op) => op.kind !== \"+\").length;\n const countB = hunk.filter((op) => op.kind !== \"-\").length;\n // As in diff -u, an empty side starts at the line before the hunk\n const range = (line: number, count: number): string => `${count === 0 ? line : line + 1}${count === 1 ? \"\" : `,${count}`}`;\n lines.push(`@@ -${range(start.a, countA)} +${range(start.b, countB)} @@`);\n for (const op of hunk) lines.push(`${op.kind}${op.text}`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n","/**\n * The entries of a package for its report: the subpaths of the `exports` field (or `types` and\n * `main`), each with its declaration file, and the bins.\n */\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\n\n/** The fields of a `package.json` file that the report reads. */\nexport interface Manifest {\n readonly name?: string;\n readonly private?: boolean;\n readonly exports?: unknown;\n readonly imports?: unknown;\n readonly types?: unknown;\n readonly typings?: unknown;\n readonly main?: unknown;\n readonly bin?: unknown;\n readonly publishConfig?: Readonly<Record<string, unknown>>;\n readonly [field: string]: unknown;\n}\n\n/** A file that an entry without a declaration file exports: the subpath and the path of the file. */\nexport interface EntryFile {\n /** The subpath that a consumer imports, for example `./tsconfig/base.json`. */\n readonly subpath: string;\n /** The file, relative to the package folder, for example `./tsconfig/base.json`. */\n readonly path: string;\n}\n\n/** An entry of a package: a subpath and its declaration file, or a note when it has none. */\nexport interface Entry {\n /** The subpath of the `exports` field, for example `.` or `./client`. */\n readonly subpath: string;\n /** The declaration file, relative to the package folder, for example `./build/index.d.ts`. */\n readonly types?: string;\n /** This text tells why the entry has no declaration file. */\n readonly note?: string;\n /** The files that an entry without a declaration file exports, in the order of the subpaths. A removed file changes the report. */\n readonly files?: readonly EntryFile[];\n}\n\n/** A command of the `bin` field of a package. */\nexport interface Bin {\n readonly name: string;\n readonly path: string;\n}\n\n/** The conditions of the `exports` field that a TypeScript consumer can use, in no order. */\nconst CONDITIONS = new Set([\"types\", \"import\", \"node\", \"default\", \"require\"]);\n\n/**\n * The fields of `publishConfig` that pnpm puts in the published `package.json`. A source package of\n * the template has `main: ./src/index.ts`, and its `publishConfig` gives the built entries.\n */\nexport const PUBLISH_CONFIG_FIELDS: readonly string[] = [\"bin\", \"main\", \"module\", \"exports\", \"imports\", \"types\", \"typings\", \"typesVersions\", \"browser\"];\n\n/** The order of the code units: the same on each machine, with no locale. */\nexport const byCode = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);\n\n/** This function gives a path relative to `root`, with `/`. */\nexport const relativePath = (root: string, file: string): string => relative(root, file).split(sep).join(\"/\");\n\n/** This function gives the manifest as pnpm publishes it: the fields of `publishConfig` replace the fields of the source. */\nexport function publishedManifest(manifest: Manifest): Manifest {\n const config = manifest.publishConfig;\n if (!config) return manifest;\n const result: Record<string, unknown> = { ...manifest };\n for (const field of PUBLISH_CONFIG_FIELDS) if (config[field] !== undefined) result[field] = config[field];\n return result;\n}\n\n/**\n * This function gives the declaration file of a JavaScript or declaration path: `a.js` gives\n * `a.d.ts`, and `a.mjs` gives `a.d.mts`. The result is undefined for a file of another kind.\n */\nexport function declarationPathOf(path: string): string | undefined {\n if (/\\.d\\.[mc]?ts$/.test(path)) return path;\n const js = /\\.([mc]?)js$/.exec(path);\n if (js) return `${path.slice(0, -js[0].length)}.d.${js[1] ?? \"\"}ts`;\n return undefined;\n}\n\n/** This function matches `subpath` with the key `pattern` of an `exports` or `imports` field. It gives the part of the `*`. */\nexport function patternMatch(pattern: string, subpath: string): string | undefined {\n const star = pattern.indexOf(\"*\");\n if (star < 0) return pattern === subpath ? \"\" : undefined;\n const prefix = pattern.slice(0, star);\n const suffix = pattern.slice(star + 1);\n if (subpath.length < prefix.length + suffix.length || !subpath.startsWith(prefix) || !subpath.endsWith(suffix)) return undefined;\n return subpath.slice(prefix.length, subpath.length - suffix.length);\n}\n\n/**\n * This function gives the target of an `exports` value for a TypeScript consumer: the first known\n * condition, in the order of the object. The result is `null` for an excluded subpath, and undefined\n * when no condition fits.\n */\nexport function targetOf(value: unknown): string | null | undefined {\n if (value === null) return null;\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) {\n for (const item of value) {\n const target = targetOf(item);\n if (typeof target === \"string\") return target;\n }\n return undefined;\n }\n if (typeof value === \"object\") {\n for (const [condition, inner] of Object.entries(value)) {\n if (!CONDITIONS.has(condition)) continue;\n const target = targetOf(inner);\n if (target !== undefined) return target;\n }\n }\n return undefined;\n}\n\n/** This function gives the `exports` field as a map of subpaths. */\nfunction subpathMap(exportsField: unknown): Record<string, unknown> {\n if (typeof exportsField !== \"object\" || Array.isArray(exportsField) || exportsField === null) return { \".\": exportsField };\n const keys = Object.keys(exportsField);\n if (keys.length > 0 && keys.every((key) => !key.startsWith(\".\"))) return { \".\": exportsField };\n return exportsField as Record<string, unknown>;\n}\n\n/** This function gives each file under `dir`, relative to `root` with `/`, without `node_modules`. */\nfunction filesUnder(root: string, dir: string): string[] {\n const start = join(root, dir);\n if (!existsSync(start) || !statSync(start).isDirectory()) return [];\n const found: string[] = [];\n const walk = (folder: string): void => {\n for (const entry of readdirSync(folder, { withFileTypes: true })) {\n if (entry.name === \"node_modules\" || entry.name === \".git\") continue;\n const path = join(folder, entry.name);\n if (entry.isDirectory()) walk(path);\n else found.push(relativePath(root, path));\n }\n };\n walk(start);\n return found.sort(byCode);\n}\n\n/**\n * This function gives each file under `root` that the target pattern `target` of the subpath\n * pattern `subpath` matches. Each file has its subpath, in the order of the subpaths. The function\n * skips each subpath that `isExcluded` excludes.\n */\nfunction patternFiles(root: string, subpath: string, target: string, isExcluded: (subpath: string) => boolean): EntryFile[] {\n const pattern = target.replace(/^\\.\\//, \"\");\n const folder = pattern.slice(0, pattern.indexOf(\"*\")).replace(/[^/]*$/, \"\");\n const matched: EntryFile[] = [];\n for (const file of filesUnder(root, folder)) {\n const part = patternMatch(pattern, file);\n if (part === undefined) continue;\n const expanded = subpath.split(\"*\").join(part);\n if (!isExcluded(expanded)) matched.push({ subpath: expanded, path: `./${file}` });\n }\n return matched.sort((a, b) => byCode(a.subpath, b.subpath) || byCode(a.path, b.path));\n}\n\n/** This function gives an entry without a declaration file, with the files that it exports. */\nfunction fileEntry(subpath: string, note: string, files: readonly EntryFile[]): Entry {\n return files.length > 0 ? { subpath, note, files } : { subpath, note };\n}\n\n/**\n * This function gives the entries of a package, in the order of the `exports` field. The\n * `./package.json` entry is not part of the API. A subpath pattern (`./*`) gives one entry for each\n * declaration file that it matches. An entry without a declaration file (for example a JSON or CSS\n * file) lists the files that it exports. `root` is the package folder.\n */\nexport function entriesOf(manifest: Manifest, root: string): Entry[] {\n const entries: Entry[] = [];\n const exists = (path: string): boolean => existsSync(resolve(root, path));\n if (manifest.exports === undefined) {\n // No `exports` field: TypeScript reads `types`, `typings`, then the declaration of `main`\n const field = manifest.types ?? manifest.typings;\n if (typeof field === \"string\") return [{ subpath: \".\", types: field }];\n const main = typeof manifest.main === \"string\" ? manifest.main : \"./index.js\";\n const types = declarationPathOf(main);\n if (types && exists(types)) return [{ subpath: \".\", types }];\n if (typeof manifest.main === \"string\") return [{ subpath: \".\", note: `no declaration file for main ${manifest.main}` }];\n return [];\n }\n const map = subpathMap(manifest.exports);\n const excluded = Object.entries(map)\n .filter(([, value]) => value === null)\n .map(([key]) => key);\n const isExcluded = (subpath: string): boolean => excluded.some((pattern) => patternMatch(pattern, subpath) !== undefined);\n for (const [subpath, value] of Object.entries(map)) {\n if (subpath === \"./package.json\" || value === null) continue;\n const target = targetOf(value);\n if (typeof target !== \"string\") {\n entries.push({ subpath, note: \"no condition for a TypeScript consumer\" });\n continue;\n }\n const declared = declarationPathOf(target);\n const own = (path: string): EntryFile[] => (exists(path) ? [{ subpath, path }] : []);\n if (!subpath.includes(\"*\")) {\n if (isExcluded(subpath)) continue;\n if (!declared) entries.push(fileEntry(subpath, `no declaration file for ${target}`, own(target)));\n // A JavaScript file without a declaration file has no types. A missing build throws later.\n else if (declared !== target && !exists(declared) && exists(target)) entries.push(fileEntry(subpath, `no declaration file for ${target}`, own(target)));\n else entries.push({ subpath, types: declared });\n continue;\n }\n if (!declared?.includes(\"*\")) {\n // A pattern of files that are not declarations, for example `./tsconfig/*.json`\n const files = target.includes(\"*\") ? patternFiles(root, subpath, target, isExcluded) : [];\n const note = files.length === 0 && target.includes(\"*\") ? `no file matches ${target}` : `no declaration pattern for ${target}`;\n entries.push(fileEntry(subpath, note, files));\n continue;\n }\n const matched = patternFiles(root, subpath, declared, isExcluded).map((file): Entry => ({ subpath: file.subpath, types: file.path }));\n if (matched.length === 0) entries.push({ subpath, note: `no file matches ${declared}` });\n entries.push(...matched);\n }\n return entries;\n}\n\n/** This function gives the commands of the `bin` field, in name order. A string `bin` has the name of the package without its scope. */\nexport function binsOf(manifest: Manifest): Bin[] {\n const { bin } = manifest;\n if (typeof bin === \"string\") return [{ name: (manifest.name ?? \"\").replace(/^@[^/]+\\//, \"\"), path: bin }];\n if (typeof bin !== \"object\" || bin === null) return [];\n return Object.entries(bin)\n .filter((entry): entry is [string, string] => typeof entry[1] === \"string\")\n .map(([name, path]) => ({ name, path }))\n .sort((a, b) => byCode(a.name, b.name));\n}\n","/**\n * The report of the public API of a package, from its built `.d.ts` files.\n *\n * The report lists the names that each entry of the `exports` field gives, and the declaration of\n * each name. It follows `export *`, `export { a as b } from`, `export * as ns` and the imports that\n * a module exports again. It also lists the ambient declarations of each file that an entry reaches,\n * and the bins. An entry without a declaration file (for example a JSON file) lists its files. The\n * report has no comments and no private members. Thus a change of a comment or of a private field\n * does not change it.\n *\n * The text is the same on Windows and on Linux. The line ends\n * are LF, the paths use `/`, and the sort does not use the locale.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { parseDeclarations, type DeclarationInfo } from \"./declarations.ts\";\nimport { binsOf, byCode, declarationPathOf, entriesOf, patternMatch, publishedManifest, relativePath, targetOf, type Entry, type Manifest } from \"./entries.ts\";\n\n/** The command that the header of a report names, when the options give no other command. */\nexport const DEFAULT_TOOL = \"api-report\";\n\n/** The options of a report. */\nexport interface ReportOptions {\n /** The manifest of the package: the report reads its `imports` and `bin` fields. */\n readonly manifest?: Manifest;\n /** The command that the header names, for example `api-report` or `node scripts/api-report.mjs`. */\n readonly tool?: string;\n}\n\n/** The binding of an exported name. */\ntype Binding =\n | { readonly kind: \"declaration\"; readonly file: string; readonly local: string; readonly typeOnly: boolean }\n | { readonly kind: \"namespace\"; readonly file: string; readonly typeOnly: boolean }\n | { readonly kind: \"external\"; readonly module: string; readonly name: string; readonly typeOnly: boolean };\n\n/** The reader of the declaration files of one package. */\nclass Reader {\n readonly #infos = new Map<string, DeclarationInfo>();\n readonly #bindings = new Map<string, Map<string, Binding>>();\n readonly #visiting = new Set<string>();\n readonly #root: string;\n readonly #manifest: Manifest;\n\n constructor(root: string, manifest: Manifest) {\n this.#root = root;\n this.#manifest = manifest;\n }\n\n info(file: string): DeclarationInfo {\n let info = this.#infos.get(file);\n if (!info) {\n info = parseDeclarations(readFileSync(file, \"utf8\"), relativePath(this.#root, file));\n this.#infos.set(file, info);\n }\n return info;\n }\n\n /** This method gives the candidate declaration files of a module path. */\n #candidates(base: string): string[] {\n const declared = declarationPathOf(base);\n if (declared) return [declared];\n const source = /\\.([mc]?)ts$/.exec(base);\n if (source) return [`${base.slice(0, -source[0].length)}.d.${source[1] ?? \"\"}ts`];\n return [`${base}.d.ts`, join(base, \"index.d.ts\")];\n }\n\n /**\n * This method gives the declaration file of a module specifier of `from`: a relative path, or a\n * `#` name of the `imports` field. The result is undefined for a module of a different package. A\n * missing file throws, or gives `null` when `soft` is true.\n */\n fileOf(from: string, specifier: string, soft = false): string | null | undefined {\n let base: string | undefined;\n if (specifier.startsWith(\".\")) base = resolve(dirname(from), specifier);\n else if (specifier.startsWith(\"#\") && typeof this.#manifest.imports === \"object\" && this.#manifest.imports !== null) {\n for (const [pattern, value] of Object.entries(this.#manifest.imports)) {\n const part = patternMatch(pattern, specifier);\n const target = part === undefined ? undefined : targetOf(value);\n if (part !== undefined && typeof target === \"string\" && target.startsWith(\".\")) {\n base = resolve(this.#root, target.split(\"*\").join(part));\n break;\n }\n }\n if (base === undefined) return undefined;\n } else return undefined;\n const file = this.#candidates(base).find((candidate) => existsSync(candidate));\n if (file) return file;\n if (soft) return null;\n throw new Error(`No declaration file for \"${specifier}\" from ${relativePath(this.#root, from)}`);\n }\n\n /** This method gives the binding of `imported` in the module `specifier` of `from`. */\n #bindingIn(from: string, specifier: string, imported: string, typeOnly: boolean): Binding {\n const file = this.fileOf(from, specifier);\n if (!file) return { kind: \"external\", module: specifier, name: imported, typeOnly };\n if (imported === \"*\") return { kind: \"namespace\", file, typeOnly };\n const binding = this.exportsOf(file).get(imported);\n if (!binding) throw new Error(`\"${specifier}\" from ${relativePath(this.#root, from)} does not export ${imported}`);\n return typeOnly ? { ...binding, typeOnly: true } : binding;\n }\n\n /** This method gives the names that a module exports, and their bindings. */\n exportsOf(file: string): Map<string, Binding> {\n const known = this.#bindings.get(file);\n if (known) return known;\n if (this.#visiting.has(file)) return new Map();\n this.#visiting.add(file);\n const info = this.info(file);\n const result = new Map<string, Binding>();\n for (const [name, { local, typeOnly }] of info.exported) {\n const imported = info.imports.get(local);\n if (info.locals.has(local)) result.set(name, { kind: \"declaration\", file, local, typeOnly });\n else if (imported) result.set(name, this.#bindingIn(file, imported.from, imported.imported, typeOnly || imported.typeOnly));\n else throw new Error(`${relativePath(this.#root, file)} exports ${local}, and has no declaration or import of it`);\n }\n for (const reexport of info.reexports) result.set(reexport.exported, this.#bindingIn(file, reexport.from, reexport.imported, reexport.typeOnly));\n for (const namespace of info.namespaces) result.set(namespace.name, this.#bindingIn(file, namespace.from, \"*\", namespace.typeOnly));\n // A name of `export *` never replaces an explicit export, and `default` does not pass\n const explicit = new Set(result.keys());\n for (const { from: star, typeOnly } of info.stars) {\n const target = this.fileOf(file, star);\n if (!target) {\n // The names of a different package are not in this package: the report names the package\n const name = `* from \"${star}\"`;\n if (!result.has(name)) result.set(name, { kind: \"external\", module: star, name: \"*\", typeOnly });\n continue;\n }\n // `export type *` gives each name as a type only\n for (const [name, binding] of this.exportsOf(target)) {\n if (name !== \"default\" && !explicit.has(name) && !result.has(name)) result.set(name, typeOnly ? { ...binding, typeOnly: true } : binding);\n }\n }\n this.#visiting.delete(file);\n this.#bindings.set(file, result);\n return result;\n }\n\n /**\n * This method gives each declaration file of the package that `file` reaches through its module\n * specifiers, and `file`. A file outside the package folder or in `node_modules` is not part of it.\n */\n reached(file: string): string[] {\n const seen = new Set<string>();\n const pending = [file];\n for (let next = pending.pop(); next !== undefined; next = pending.pop()) {\n if (seen.has(next)) continue;\n seen.add(next);\n for (const specifier of this.info(next).references) {\n const target = this.fileOf(next, specifier, true);\n if (!target) continue;\n const path = relativePath(this.#root, target);\n if (path.startsWith(\"../\") || path.split(\"/\").includes(\"node_modules\")) continue;\n pending.push(target);\n }\n }\n return [...seen];\n }\n}\n\n/** This function gives the lines of the header of a report. */\nfunction header(packageName: string, tool: string): string[] {\n return [\n `# The public API of ${packageName}`,\n \"#\",\n \"# The names of each entry of the exports field, and the declaration of each name, without comments\",\n `# and private members. The command \\`${tool} check\\` compares this file with the built .d.ts files.`,\n `# To accept a change of the API, start the build, then \\`${tool} update\\`, and review the diff.`,\n ];\n}\n\n/** The number of lines of the header of a report. */\nexport const HEADER_LINES = 5;\n\n/**\n * This function gives the report of the public API of a package. `entries` gives the subpath and\n * the declaration file of each entry, relative to `root`. The report has the exported names of each\n * entry, the bins of the manifest, and then the declaration of each name.\n */\nexport function apiReport(packageName: string, root: string, entries: readonly Entry[], options: ReportOptions = {}): string {\n const manifest = options.manifest ?? {};\n const reader = new Reader(root, manifest);\n const path = (file: string): string => relativePath(root, file);\n const keyOf = (binding: Binding): string =>\n binding.kind === \"declaration\" ? `${path(binding.file)}#${binding.local}` : binding.kind === \"namespace\" ? `${path(binding.file)}#*` : `${binding.module}#${binding.name}`;\n const declarations = new Map<string, string>();\n const lines = header(packageName, options.tool ?? DEFAULT_TOOL);\n if (entries.every((entry) => entry.types === undefined)) {\n lines.push(\"\", \"This package has no type declarations: no entry of its package.json gives a .d.ts file.\");\n }\n\n /** The lines of the names of a module, and the names of each namespace in it, with `prefix`. */\n const names = (bindings: Map<string, Binding>, prefix: string, parents: ReadonlySet<string>, typeOnly: boolean): void => {\n for (const [name, binding] of [...bindings].sort(([a], [b]) => byCode(a, b))) {\n const key = keyOf(binding);\n const isType = typeOnly || binding.typeOnly;\n lines.push(`${isType ? \"type \" : \"\"}${prefix}${name}: ${key}${binding.kind === \"declaration\" ? \"\" : ` (${binding.kind})`}`);\n if (binding.kind === \"declaration\" && !declarations.has(key)) {\n declarations.set(key, (reader.info(binding.file).locals.get(binding.local) ?? []).join(\"\\n\"));\n }\n // The names of a namespace are part of the API: `ns.name`\n if (binding.kind === \"namespace\" && !parents.has(binding.file)) {\n names(reader.exportsOf(binding.file), `${prefix}${name}.`, new Set([...parents, binding.file]), isType);\n }\n }\n };\n\n for (const entry of entries) {\n if (entry.types === undefined) {\n lines.push(\"\", `## ${entry.subpath}: ${entry.note ?? \"no declaration file\"}`);\n // The files of an entry without declarations: a removed file changes the report\n const files = entry.files ?? [];\n if (files.length > 0) lines.push(\"\", ...files.map((file) => `file ${file.subpath}: ${file.path.replace(/^\\.\\//, \"\")}`));\n continue;\n }\n const file = resolve(root, entry.types);\n if (!existsSync(file)) throw new Error(`${entry.subpath}: ${entry.types} is missing. Build the package first.`);\n const bindings = reader.exportsOf(file);\n lines.push(\"\", `## ${entry.subpath} (${path(file)}): ${bindings.size} names`, \"\");\n names(bindings, \"\", new Set([file]), false);\n // The ambient declarations of each file that the entry reaches\n const ambient: string[] = [];\n for (const reached of reader.reached(file)) {\n for (const [label, statements] of reader.info(reached).ambient) {\n const key = `${path(reached)}#${label}`;\n ambient.push(key);\n if (!declarations.has(key)) declarations.set(key, statements.join(\"\\n\"));\n }\n }\n for (const key of ambient.sort(byCode)) lines.push(`ambient: ${key}`);\n }\n const bins = binsOf(manifest);\n if (bins.length > 0) {\n lines.push(\"\", `## bin: ${bins.length} commands`, \"\");\n for (const bin of bins) lines.push(`${bin.name}: ${bin.path}`);\n }\n if (declarations.size > 0 || entries.some((entry) => entry.types !== undefined)) {\n lines.push(\"\", \"## Declarations\");\n for (const key of [...declarations.keys()].sort(byCode)) lines.push(\"\", `### ${key}`, declarations.get(key) ?? \"\");\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** The options of the report of a package folder. */\nexport interface PackageReportOptions {\n /** The command that the header names. */\n readonly tool?: string;\n /** When true (the default), the fields of `publishConfig` replace the fields of the source, as pnpm publishes them. */\n readonly publishConfig?: boolean;\n}\n\n/** This function gives the report of the package in the folder `dir`. */\nexport function packageReport(dir: string, options: PackageReportOptions = {}): string {\n const source = JSON.parse(readFileSync(join(dir, \"package.json\"), \"utf8\")) as Manifest;\n const manifest = options.publishConfig === false ? source : publishedManifest(source);\n const name = typeof manifest.name === \"string\" ? manifest.name : basename(dir);\n return apiReport(name, dir, entriesOf(manifest, dir), { manifest, ...(options.tool === undefined ? {} : { tool: options.tool }) });\n}\n","/**\n * The package folders of a repository: the folders that the globs of the workspace name, with a\n * `package.json` file.\n */\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { byCode, relativePath } from \"./entries.ts\";\n\n/** The characters that have a meaning in a regular expression. */\nconst SPECIAL = new Set([...\"\\\\^$.|+()[]{}*?/\"]);\n\n/**\n * This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path\n * segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of\n * its parts. The function escapes each other special character.\n */\nexport function globToRegExp(glob: string): RegExp {\n let source = \"\";\n let braces = 0;\n for (let index = 0; index < glob.length; index++) {\n const char = glob.charAt(index);\n if (char === \"/\" && glob.slice(index + 1) === \"**\") {\n // `a/**` matches `a` and each path under it\n source += \"(?:/.*)?\";\n break;\n }\n if (char === \"*\" && glob.charAt(index + 1) === \"*\") {\n const atStart = index === 0 || glob.charAt(index - 1) === \"/\";\n const after = glob.charAt(index + 2);\n if (atStart && after === \"/\") {\n // `**/` matches zero or more whole segments\n source += \"(?:[^/]+/)*\";\n index += 2;\n } else if (atStart && after === \"\") {\n source += \".*\";\n index += 1;\n } else {\n source += \"[^/]*\";\n index += 1;\n }\n } else if (char === \"*\") source += \"[^/]*\";\n else if (char === \"?\") source += \"[^/]\";\n else if (char === \"{\") {\n braces++;\n source += \"(?:\";\n } else if (char === \"}\" && braces > 0) {\n braces--;\n source += \")\";\n } else if (char === \",\" && braces > 0) source += \"|\";\n else if (SPECIAL.has(char)) source += `\\\\${char}`;\n else source += char;\n }\n if (braces > 0) throw new Error(`A glob with a \"{\" that has no \"}\": ${glob}`);\n return new RegExp(`^${source}$`);\n}\n\n/** The characters that make a path segment a pattern. */\nconst GLOB_CHARS = /[*?{]/;\n\n/** This function removes the `/` characters at the end of a path, with a loop in place of a regular expression. */\nfunction trimEndSlashes(path: string): string {\n let end = path.length;\n while (end > 0 && path.charAt(end - 1) === \"/\") end -= 1;\n return path.slice(0, end);\n}\n\n/**\n * This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,\n * in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.\n */\nexport function globFolders(root: string, glob: string): string[] {\n const clean = trimEndSlashes(glob.startsWith(\"./\") ? glob.slice(2) : glob);\n const segments = clean.split(\"/\");\n const firstPattern = segments.findIndex((segment) => GLOB_CHARS.test(segment));\n if (firstPattern < 0) return existsSync(join(root, clean)) ? [clean] : [];\n const base = segments.slice(0, firstPattern).join(\"/\");\n const depth = clean.includes(\"**\") ? Number.POSITIVE_INFINITY : segments.length - firstPattern;\n const pattern = globToRegExp(clean);\n const start = join(root, base);\n if (!existsSync(start)) return [];\n const found: string[] = [];\n const walk = (folder: string, level: number): void => {\n for (const entry of readdirSync(folder, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name === \"node_modules\" || entry.name.startsWith(\".\")) continue;\n const path = join(folder, entry.name);\n if (pattern.test(relativePath(root, path))) found.push(relativePath(root, path));\n if (level < depth) walk(path, level + 1);\n }\n };\n // `a/**` also names `a`\n if (base !== \"\" && pattern.test(base)) found.push(base);\n walk(start, 1);\n return found.sort(byCode);\n}\n\n/**\n * This function gives the globs of the workspace at `root`: the `packages` list of\n * `pnpm-workspace.yaml`, then the `workspaces` field of `package.json`. The result is undefined when\n * the repository has no workspace.\n */\nexport function workspaceGlobs(root: string): string[] | undefined {\n const yaml = join(root, \"pnpm-workspace.yaml\");\n if (existsSync(yaml)) {\n const lines = readFileSync(yaml, \"utf8\").split(/\\r?\\n/);\n const start = lines.findIndex((line) => /^packages\\s*:/.test(line));\n if (start >= 0) {\n const unquote = (text: string): string =>\n text\n .replace(/\\s+#.*$/, \"\")\n .trim()\n .replace(/^[\"']|[\"']$/g, \"\");\n const inline = /^packages\\s*:\\s*\\[(.*)\\]/.exec(lines[start] ?? \"\");\n if (inline) return (inline[1] ?? \"\").split(\",\").map(unquote).filter(Boolean);\n const globs: string[] = [];\n for (const line of lines.slice(start + 1)) {\n if (/^\\s*(#.*)?$/.test(line)) continue;\n const item = /^\\s+-\\s+(.+)$/.exec(line);\n if (!item) break;\n globs.push(unquote(item[1] ?? \"\"));\n }\n return globs;\n }\n }\n const manifestFile = join(root, \"package.json\");\n if (existsSync(manifestFile)) {\n const { workspaces } = JSON.parse(readFileSync(manifestFile, \"utf8\")) as { workspaces?: unknown };\n if (Array.isArray(workspaces)) return workspaces.filter((glob): glob is string => typeof glob === \"string\");\n if (typeof workspaces === \"object\" && workspaces !== null && \"packages\" in workspaces && Array.isArray(workspaces.packages)) {\n return workspaces.packages.filter((glob): glob is string => typeof glob === \"string\");\n }\n }\n return undefined;\n}\n\n/**\n * This function gives the package folders of the repository at `root`: the folders of the globs\n * that have a `package.json` file. A glob that starts with `!` removes folders. Without globs, the\n * function reads the globs of the workspace, and a repository with no workspace is one package.\n * The result has absolute paths, in the order of the code units.\n */\nexport function packageFolders(root: string, globs: readonly string[] | undefined = workspaceGlobs(root)): string[] {\n if (globs === undefined) return existsSync(join(root, \"package.json\")) ? [root] : [];\n const included = new Set<string>();\n // As in pnpm, a `!` glob removes its folders in each position of the list\n for (const glob of globs.filter((item) => !item.startsWith(\"!\"))) for (const folder of globFolders(root, glob)) included.add(folder);\n for (const glob of globs.filter((item) => item.startsWith(\"!\"))) for (const folder of globFolders(root, glob.slice(1))) included.delete(folder);\n return [...included]\n .filter((folder) => existsSync(join(root, folder, \"package.json\")))\n .sort(byCode)\n .map((folder) => join(root, folder));\n}\n","/**\n * The commands `check` and `update` of the bin `api-report`, as functions. `runReports` compares or\n * writes the reports of each package, and `runCli` reads the arguments and writes the result.\n */\nimport { appendFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { unifiedDiff } from \"./diff.ts\";\nimport { relativePath, type Manifest } from \"./entries.ts\";\nimport { DEFAULT_TOOL, packageReport } from \"./report.ts\";\nimport { packageFolders } from \"./workspace.ts\";\n\n/** The path of the report in a package folder, when the configuration gives no other path. */\nexport const REPORT_FILE = \"test/api/public-api.txt\";\n\n/** The configuration of the reports: the field `apiReport` of the root `package.json`, or the options of the CLI. */\nexport interface ApiReportConfig {\n /** The globs of the package folders, relative to the root. A glob that starts with `!` removes folders. The default is the globs of the workspace. */\n readonly packages?: readonly string[];\n /** The path of the report in each package folder. The default is `test/api/public-api.txt`. */\n readonly report?: string;\n /** When true, each private package also gets a report. The default is false. */\n readonly includePrivate?: boolean;\n /** When false, the report reads the fields of `package.json` without `publishConfig`. The default is true. */\n readonly publishConfig?: boolean;\n /** The command that the header of each report names. The default is `api-report`. */\n readonly tool?: string;\n}\n\n/** The command: `check` compares the reports, and `update` writes them. */\nexport type Mode = \"check\" | \"update\";\n\n/** The options of `runReports`. */\nexport interface RunOptions extends ApiReportConfig {\n readonly mode: Mode;\n /** The root of the repository. */\n readonly root: string;\n /** The package folders to examine. They replace the globs, and a named private package gets a report. */\n readonly folders?: readonly string[];\n}\n\n/** The result of one package. */\nexport interface PackageResult {\n /** The package folder, relative to the root, with `/`. */\n readonly folder: string;\n /** The report file, relative to the root, with `/`. */\n readonly file: string;\n /**\n * `same`: the report is current. `changed` and `new`: the report differs or is missing (`check`),\n * or the command wrote it (`update`). `stale`: a private package has a report. `private`: the\n * package has no report. `error`: the command did not make the report.\n */\n readonly status: \"same\" | \"changed\" | \"new\" | \"stale\" | \"private\" | \"error\";\n /** The change from the committed report to the new report, in the unified format. */\n readonly diff?: string;\n readonly error?: string;\n}\n\n/** The result of `runReports`. */\nexport interface RunResult {\n readonly mode: Mode;\n readonly packages: readonly PackageResult[];\n /** True when the command fails: an error, or (`check` only) a report that is not current. */\n readonly failed: boolean;\n}\n\n/**\n * This function reads the field `apiReport` of the `package.json` file at `root`. The result is an\n * empty configuration when the field does not exist.\n *\n * @throws Error when the field is not an object, or a value has the wrong type\n */\nexport function readConfig(root: string): ApiReportConfig {\n const file = join(root, \"package.json\");\n if (!existsSync(file)) return {};\n const value = (JSON.parse(readFileSync(file, \"utf8\")) as Manifest)[\"apiReport\"];\n if (value === undefined) return {};\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) throw new Error(\"The field apiReport of package.json must be an object.\");\n const config = value as Record<string, unknown>;\n const result: { -readonly [K in keyof ApiReportConfig]: ApiReportConfig[K] } = {};\n const packages = config[\"packages\"];\n if (packages !== undefined) {\n if (!Array.isArray(packages) || !packages.every((glob) => typeof glob === \"string\")) throw new Error(\"apiReport.packages must be an array of globs.\");\n result.packages = packages;\n }\n for (const key of [\"report\", \"tool\"] as const) {\n const item = config[key];\n if (item === undefined) continue;\n if (typeof item !== \"string\" || item === \"\") throw new Error(`apiReport.${key} must be a string.`);\n result[key] = item;\n }\n for (const key of [\"includePrivate\", \"publishConfig\"] as const) {\n const item = config[key];\n if (item === undefined) continue;\n if (typeof item !== \"boolean\") throw new Error(`apiReport.${key} must be true or false.`);\n result[key] = item;\n }\n const unknown = Object.keys(config).filter((key) => ![\"packages\", \"report\", \"tool\", \"includePrivate\", \"publishConfig\"].includes(key));\n if (unknown.length > 0) throw new Error(`apiReport has unknown fields: ${unknown.join(\", \")}.`);\n return result;\n}\n\n/** This function makes sure that the path of a report stays in its package folder. */\nfunction checkReportPath(report: string): string {\n const clean = report.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\");\n if (clean === \"\" || isAbsolute(report) || clean.split(\"/\").includes(\"..\")) throw new Error(`The path of a report must be relative to the package folder, with no \"..\": ${report}`);\n return clean;\n}\n\n/** This function compares (`check`) or writes (`update`) the report of each package. It writes nothing in `check` mode. */\nexport function runReports(options: RunOptions): RunResult {\n const root = resolve(options.root);\n const report = checkReportPath(options.report ?? REPORT_FILE);\n const named = options.folders !== undefined && options.folders.length > 0;\n const folders = named ? (options.folders ?? []).map((folder) => resolve(root, folder)) : packageFolders(root, options.packages);\n const results: PackageResult[] = [];\n for (const folder of folders) {\n const shown = relativePath(root, folder) || \".\";\n const file = join(folder, report);\n const shownFile = relativePath(root, file);\n const manifestFile = join(folder, \"package.json\");\n if (!existsSync(manifestFile)) {\n results.push({ folder: shown, file: shownFile, status: \"error\", error: \"no package.json\" });\n continue;\n }\n // A CRLF checkout gives the same text\n const current = existsSync(file) ? readFileSync(file, \"utf8\").replace(/\\r\\n/g, \"\\n\") : undefined;\n let manifest: Manifest;\n try {\n manifest = JSON.parse(readFileSync(manifestFile, \"utf8\")) as Manifest;\n } catch (error) {\n results.push({ folder: shown, file: shownFile, status: \"error\", error: error instanceof Error ? error.message : String(error) });\n continue;\n }\n // A private package has no public API. A named folder gets a report all the same.\n if (manifest.private === true && !named && options.includePrivate !== true) {\n if (current === undefined) results.push({ folder: shown, file: shownFile, status: \"private\" });\n else {\n if (options.mode === \"update\") rmSync(file);\n results.push({ folder: shown, file: shownFile, status: \"stale\" });\n }\n continue;\n }\n let text: string;\n try {\n text = packageReport(folder, {\n tool: options.tool ?? DEFAULT_TOOL,\n ...(options.publishConfig === undefined ? {} : { publishConfig: options.publishConfig }),\n });\n } catch (error) {\n results.push({ folder: shown, file: shownFile, status: \"error\", error: error instanceof Error ? error.message : String(error) });\n continue;\n }\n if (current === text) {\n results.push({ folder: shown, file: shownFile, status: \"same\" });\n continue;\n }\n if (options.mode === \"update\") {\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, text);\n }\n const diff = unifiedDiff(current ?? \"\", text, { from: current === undefined ? \"/dev/null\" : `a/${shownFile}`, to: `b/${shownFile}` });\n results.push({ folder: shown, file: shownFile, status: current === undefined ? \"new\" : \"changed\", diff });\n }\n const failed = results.some(\n (result) => result.status === \"error\" || (options.mode === \"check\" && (result.status === \"changed\" || result.status === \"new\" || result.status === \"stale\")),\n );\n return { mode: options.mode, packages: results, failed };\n}\n\n/** The most lines of the diff of one package in the output. */\nconst MAX_DIFF_LINES = 400;\n\n/** This function shortens a diff to `MAX_DIFF_LINES` lines. */\nfunction shortDiff(diff: string): string {\n const lines = diff.replace(/\\n$/, \"\").split(\"\\n\");\n if (lines.length <= MAX_DIFF_LINES) return `${lines.join(\"\\n\")}\\n`;\n return `${lines.slice(0, MAX_DIFF_LINES).join(\"\\n\")}\\n... ${lines.length - MAX_DIFF_LINES} more lines. Start the command update and read the diff in git.\\n`;\n}\n\n/** This function gives the text of a result for a terminal or a CI log. */\nexport function formatResult(result: RunResult, tool: string = DEFAULT_TOOL): string {\n const by = (status: PackageResult[\"status\"]): PackageResult[] => result.packages.filter((item) => item.status === status);\n const reports = result.packages.filter((item) => item.status !== \"private\" && item.status !== \"stale\" && item.status !== \"error\").length;\n const out: string[] = [`${reports} public packages with a report of the API, ${by(\"private\").length} private packages without a report.`];\n const list = (title: string, items: readonly PackageResult[], line: (item: PackageResult) => string): void => {\n if (items.length === 0) return;\n out.push(`${title}:`);\n for (const item of items) out.push(` ${line(item)}`);\n };\n const update = result.mode === \"update\";\n list(update ? \"Written\" : \"The report differs from the built .d.ts files\", by(\"changed\"), (item) => item.file);\n list(update ? \"Written (new)\" : \"No report\", by(\"new\"), (item) => (update ? item.file : `${item.folder} (${item.file})`));\n list(update ? \"Removed (the package is private)\" : \"A report of a private package\", by(\"stale\"), (item) => item.file);\n list(\"Errors\", by(\"error\"), (item) => `${item.folder}: ${item.error ?? \"unknown error\"}`);\n let text = `${out.join(\"\\n\")}\\n`;\n if (!update) {\n for (const item of by(\"changed\")) text += `\\n${shortDiff(item.diff ?? \"\")}`;\n if (by(\"changed\").length + by(\"new\").length + by(\"stale\").length > 0) {\n text += `\\nTo accept a change of the API, start the build, then \\`${tool} update\\`, review the diff, and commit the reports.\\n`;\n }\n }\n return text;\n}\n\n/** This function gives the result as Markdown for the summary of a GitHub Actions run. It gives an empty string when all reports are current. */\nexport function summaryMarkdown(result: RunResult): string {\n const changed = result.packages.filter((item) => item.status === \"changed\" || item.status === \"new\");\n const other = result.packages.filter((item) => item.status === \"stale\" || item.status === \"error\");\n if (changed.length === 0 && other.length === 0) return \"\";\n const out = [\"### Public API reports\", \"\"];\n for (const item of changed) out.push(`<details><summary><code>${item.file}</code> (${item.status})</summary>`, \"\", \"```diff\", shortDiff(item.diff ?? \"\").replace(/\\n$/, \"\"), \"```\", \"\", \"</details>\", \"\");\n for (const item of other) out.push(`- \\`${item.file}\\`: ${item.status === \"stale\" ? \"a report of a private package\" : (item.error ?? \"error\")}`);\n return `${out.join(\"\\n\")}\\n`;\n}\n\n/** The input and output of `runCli`. */\nexport interface CliIo {\n readonly cwd: string;\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\n/** The help text of the bin. */\nexport const USAGE: string = `Usage: api-report <check | update> [options] [<package folder>...]\n\n check Compare each report with the built .d.ts files. Exit code 1 when a report differs or is missing.\n update Write each report again.\n\n --root <folder> The root of the repository. The default is the current folder.\n --packages <glob> A glob of package folders. Use it again for more globs. The default is the globs of the workspace.\n --report <path> The path of the report in each package folder. The default is ${REPORT_FILE}.\n --include-private Also make a report for each private package.\n --no-publish-config Read the fields of package.json without publishConfig.\n -h, --help Show this text.\n\nThe field \"apiReport\" of the root package.json can set packages, report, includePrivate, publishConfig and tool.\n`;\n\n/** An error of the arguments: exit code 2 and the help text. */\nclass UsageError extends Error {}\n\n/** This function starts the bin with the arguments `args`, and gives its exit code. */\nexport function runCli(args: readonly string[], io: CliIo): number {\n let mode: Mode | undefined;\n let root = io.cwd;\n const packages: string[] = [];\n const folders: string[] = [];\n const flags: { report?: string; includePrivate?: boolean; publishConfig?: boolean } = {};\n for (let index = 0; index < args.length; index++) {\n const arg = args[index] ?? \"\";\n const value = (): string => {\n const next = args[++index];\n if (next === undefined || next.startsWith(\"-\")) throw new UsageError(`The option ${arg} needs a value.`);\n return next;\n };\n try {\n if (arg === \"check\" || arg === \"--check\") mode = \"check\";\n else if (arg === \"update\" || arg === \"--update\") mode = \"update\";\n else if (arg === \"--root\") root = resolve(io.cwd, value());\n else if (arg === \"--packages\") packages.push(value());\n else if (arg === \"--report\") flags.report = value();\n else if (arg === \"--include-private\") flags.includePrivate = true;\n else if (arg === \"--no-publish-config\") flags.publishConfig = false;\n else if (arg === \"--help\" || arg === \"-h\") {\n io.stdout(USAGE);\n return 0;\n } else if (arg.startsWith(\"-\")) throw new UsageError(`An unknown option: ${arg}`);\n else folders.push(arg);\n } catch (error) {\n if (!(error instanceof UsageError)) throw error;\n io.stderr(`api-report: ${error.message}\\n\\n${USAGE}`);\n return 2;\n }\n }\n if (mode === undefined) {\n io.stderr(`api-report: give the command check or update.\\n\\n${USAGE}`);\n return 2;\n }\n let result: RunResult;\n let tool: string;\n try {\n const config = readConfig(root);\n tool = config.tool ?? DEFAULT_TOOL;\n result = runReports({\n ...config,\n ...flags,\n ...(packages.length > 0 ? { packages } : {}),\n mode,\n root,\n folders: folders.map((folder) => resolve(io.cwd, folder)),\n });\n } catch (error) {\n io.stderr(`api-report: ${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n io.stdout(formatResult(result, tool));\n const summary = io.env[\"GITHUB_STEP_SUMMARY\"];\n if (summary && mode === \"check\") {\n const markdown = summaryMarkdown(result);\n if (markdown !== \"\") appendFileSync(summary, markdown);\n }\n return result.failed ? 1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astore.org/package",
|
|
3
3
|
"name": "@mark1russell7/api-report",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"description": "A report of the public API of each package of a workspace, from its built .d.ts files: a check in CI shows each change of the API in the pull request.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"api-report",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-BfM3MSZI.js","names":[],"sources":["../src/declarations.ts","../src/diff.ts","../src/entries.ts","../src/report.ts","../src/workspace.ts","../src/run.ts"],"sourcesContent":["/**\n * The reader of the text of a declaration file. TypeScript 7 has no stable compiler API, so this\n * module reads the `.d.ts` files as text. The declaration emit of `tsc` and of `tsdown` is regular,\n * and an unknown form of statement throws.\n */\n\n/** An import of a declaration file, by its local name. */\nexport interface ImportBinding {\n /** The module specifier. */\n readonly from: string;\n /** The imported name, or `default`, `export=` or `*`. */\n readonly imported: string;\n readonly typeOnly: boolean;\n}\n\n/** A name that a module exports from its own scope. */\nexport interface LocalExport {\n /** The local name of the exported name. */\n readonly local: string;\n readonly typeOnly: boolean;\n}\n\n/** A part of an `export { a as b } from \"x\"` statement. */\nexport interface Reexport {\n readonly imported: string;\n readonly exported: string;\n readonly typeOnly: boolean;\n readonly from: string;\n}\n\n/** The statements of one declaration file, sorted by their kind. */\nexport interface DeclarationInfo {\n /** The declarations of the module by name, exported or not. */\n readonly locals: Map<string, string[]>;\n /** The names that the module exports from its own scope, by the exported name. */\n readonly exported: Map<string, LocalExport>;\n /** The `export { a as b } from \"x\"` parts. */\n readonly reexports: Reexport[];\n /** The `export * from \"x\"` statements. */\n readonly stars: { readonly from: string; readonly typeOnly: boolean }[];\n /** The `export * as name from \"x\"` statements. */\n readonly namespaces: { readonly name: string; readonly from: string; readonly typeOnly: boolean }[];\n /** The imports by local name. */\n readonly imports: Map<string, ImportBinding>;\n /** The ambient declarations by label: `declare module \"x\"`, `declare global`, `export as namespace X`. */\n readonly ambient: Map<string, string[]>;\n /** Each module specifier that the file names: the files that it reaches. */\n readonly references: Set<string>;\n}\n\n/** A mode of the reader of a template literal. */\ntype Mode = { readonly kind: \"template\" } | { readonly kind: \"part\"; readonly depth: number };\n\nconst BLOCK_HEADER = /^(?:export\\s+)?(?:default\\s+)?(?:declare\\s+)?(?:abstract\\s+class|class|interface|const\\s+enum|enum|namespace|module|global)\\b/;\n\n/**\n * This function splits the text of a declaration file into its top-level statements. It removes the\n * comments, the blank lines and the spaces at the ends of the lines.\n */\nexport function statementsOf(source: string): string[] {\n // The declarations of a bin file keep its `#!` line\n const text = source.replace(/\\r\\n?/g, \"\\n\").replace(/^#![^\\n]*\\n?/, \"\");\n const statements: string[] = [];\n let current = \"\";\n let depth = 0;\n // The depth of the type arguments at the top level: `class A<T = {}> {` has a brace in them\n let angle = 0;\n // True when the body of a class, an interface, an enum or a namespace is open\n let body = false;\n // The template literals and their `${ }` parts, from the outside in\n const modes: Mode[] = [];\n\n const finish = (): void => {\n const lines = current\n .split(\"\\n\")\n .map((line) => line.trimEnd())\n .filter((line) => line.trim() !== \"\");\n if (lines.length > 0) statements.push(lines.join(\"\\n\"));\n current = \"\";\n angle = 0;\n body = false;\n };\n\n let index = 0;\n while (index < text.length) {\n const char = text.charAt(index);\n const next = text.charAt(index + 1);\n const mode = modes.at(-1);\n if (mode?.kind === \"template\") {\n if (char === \"\\\\\") {\n current += char + next;\n index += 2;\n } else if (char === \"`\") {\n modes.pop();\n current += char;\n index++;\n } else if (char === \"$\" && next === \"{\") {\n modes.push({ kind: \"part\", depth });\n current += \"${\";\n index += 2;\n } else {\n current += char;\n index++;\n }\n continue;\n }\n if (char === \"/\" && next === \"/\") {\n while (index < text.length && text.charAt(index) !== \"\\n\") index++;\n continue;\n }\n if (char === \"/\" && next === \"*\") {\n const end = text.indexOf(\"*/\", index + 2);\n index = end < 0 ? text.length : end + 2;\n current += \" \";\n continue;\n }\n if (char === '\"' || char === \"'\") {\n let end = index + 1;\n while (end < text.length && text.charAt(end) !== char) end += text.charAt(end) === \"\\\\\" ? 2 : 1;\n current += text.slice(index, end + 1);\n index = end + 1;\n continue;\n }\n if (char === \"`\") {\n modes.push({ kind: \"template\" });\n current += char;\n index++;\n continue;\n }\n if (modes.length === 0 && depth === 0) {\n // The `>` of an arrow `=>` closes nothing\n if (char === \"<\") angle++;\n else if (char === \">\" && text.charAt(index - 1) !== \"=\") angle = Math.max(0, angle - 1);\n else if (char === \"{\" && angle === 0 && !body && BLOCK_HEADER.test(current.trim())) body = true;\n }\n if (char === \"{\" || char === \"(\" || char === \"[\") depth++;\n if (char === \"}\" || char === \")\" || char === \"]\") {\n if (char === \"}\" && mode?.kind === \"part\" && depth === mode.depth) {\n modes.pop();\n current += char;\n index++;\n continue;\n }\n depth--;\n }\n current += char;\n index++;\n if (modes.length > 0 || depth !== 0) continue;\n if (char === \";\" || (char === \"}\" && body)) finish();\n }\n finish();\n return statements;\n}\n\n/** This function splits `text` at each comma outside brackets, type arguments and strings. */\nfunction splitTopLevel(text: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let index = 0; index < text.length; index++) {\n const char = text.charAt(index);\n if (char === '\"' || char === \"'\" || char === \"`\") {\n let end = index + 1;\n while (end < text.length && text.charAt(end) !== char) end += text.charAt(end) === \"\\\\\" ? 2 : 1;\n index = end;\n } else if (char === \"(\" || char === \"[\" || char === \"{\" || char === \"<\") depth++;\n else if (char === \")\" || char === \"]\" || char === \"}\" || (char === \">\" && text.charAt(index - 1) !== \"=\")) depth--;\n else if (char === \",\" && depth === 0) {\n parts.push(text.slice(start, index));\n start = index + 1;\n }\n }\n parts.push(text.slice(start));\n return parts;\n}\n\n/** The names of an export or import list: `a, type b, c as d`. */\nfunction specifiersOf(list: string, typeOnly: boolean): { imported: string; exported: string; typeOnly: boolean }[] {\n return list\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\")\n .map((part) => {\n const match = /^(type\\s+)?([\\w$]+)(?:\\s+as\\s+([\\w$]+|\"[^\"]*\"))?$/.exec(part);\n if (!match?.[2]) throw new Error(`An export list part that the report does not know: ${part}`);\n return { imported: match[2], exported: match[3] ?? match[2], typeOnly: typeOnly || match[1] !== undefined };\n });\n}\n\n/** This function removes the private members of a class: they are not part of the API. */\nfunction withoutPrivateMembers(statement: string): string {\n return statement\n .split(\"\\n\")\n .filter((line) => !/^\\s+(?:private\\s+(?:static\\s+)?(?:readonly\\s+)?[\\w$]+\\??;|#private;)$/.test(line))\n .join(\"\\n\");\n}\n\n/** A capture group of a match that the pattern always sets. */\nconst group = (match: RegExpExecArray, index: number): string => match[index] ?? \"\";\n\n/**\n * This function sorts the statements of the text of one declaration file by their kind. `file`\n * names the file in the errors. An unknown form of statement throws.\n */\nexport function parseDeclarations(source: string, file = \"<text>\"): DeclarationInfo {\n const info: DeclarationInfo = {\n locals: new Map(),\n exported: new Map(),\n reexports: [],\n stars: [],\n namespaces: [],\n imports: new Map(),\n ambient: new Map(),\n references: new Set(),\n };\n const addLocal = (name: string, statement: string): void => {\n info.locals.set(name, [...(info.locals.get(name) ?? []), statement]);\n };\n const addAmbient = (label: string, statement: string): void => {\n info.ambient.set(label, [...(info.ambient.get(label) ?? []), statement]);\n };\n for (const statement of statementsOf(source)) {\n const flat = statement.replace(/\\s+/g, \" \");\n for (const found of flat.matchAll(/\\bimport\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g)) info.references.add(found[1] ?? \"\");\n let match: RegExpExecArray | null;\n if ((match = /^import (type )?(.+?) from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n const typeOnly = match[1] !== undefined;\n const from = group(match, 3);\n info.references.add(from);\n let clause = group(match, 2).trim();\n const defaultName = /^([\\w$]+)\\s*(?:,|$)/.exec(clause);\n if (defaultName) {\n info.imports.set(group(defaultName, 1), { from, imported: \"default\", typeOnly });\n clause = clause.slice(defaultName[0].length).trim();\n }\n const namespace = /^\\* as ([\\w$]+)$/.exec(clause);\n if (namespace) info.imports.set(group(namespace, 1), { from, imported: \"*\", typeOnly });\n const braces = /^\\{(.*)\\}$/.exec(clause);\n if (braces) {\n for (const specifier of specifiersOf(group(braces, 1), typeOnly)) {\n info.imports.set(specifier.exported, { from, imported: specifier.imported, typeOnly: specifier.typeOnly });\n }\n }\n continue;\n }\n if ((match = /^import [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n info.references.add(group(match, 1));\n continue;\n }\n // `import x = require(\"y\")`: the name is the `export =` of the module\n if ((match = /^(export )?import (type )?([\\w$]+) = require\\([\"']([^\"']+)[\"']\\);?$/.exec(flat))) {\n const name = group(match, 3);\n info.references.add(group(match, 4));\n info.imports.set(name, { from: group(match, 4), imported: \"export=\", typeOnly: match[2] !== undefined });\n if (match[1] !== undefined) info.exported.set(name, { local: name, typeOnly: false });\n continue;\n }\n // `import A = N.B`: an alias of a name of a namespace\n if ((match = /^(export )?import ([\\w$]+) = [\\w$.]+;?$/.exec(flat))) {\n const name = group(match, 2);\n addLocal(name, statement);\n if (match[1] !== undefined) info.exported.set(name, { local: name, typeOnly: false });\n continue;\n }\n if ((match = /^export (type )?\\* as ([\\w$]+) from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n info.references.add(group(match, 3));\n info.namespaces.push({ name: group(match, 2), from: group(match, 3), typeOnly: match[1] !== undefined });\n continue;\n }\n if ((match = /^export (type )?\\* from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n info.references.add(group(match, 2));\n info.stars.push({ from: group(match, 2), typeOnly: match[1] !== undefined });\n continue;\n }\n if ((match = /^export (type )?\\{(.*)\\} from [\"']([^\"']+)[\"'];?$/.exec(flat))) {\n const from = group(match, 3);\n info.references.add(from);\n for (const specifier of specifiersOf(group(match, 2), match[1] !== undefined)) info.reexports.push({ ...specifier, from });\n continue;\n }\n if ((match = /^export (type )?\\{(.*)\\};?$/.exec(flat))) {\n for (const specifier of specifiersOf(group(match, 2), match[1] !== undefined)) {\n info.exported.set(specifier.exported, { local: specifier.imported, typeOnly: specifier.typeOnly });\n }\n continue;\n }\n // `export = X`: the module is the value X (CommonJS)\n if ((match = /^export = ([\\w$]+);?$/.exec(flat))) {\n info.exported.set(\"export=\", { local: group(match, 1), typeOnly: false });\n continue;\n }\n if (/^export = /.test(flat)) {\n addLocal(\"export=\", statement);\n info.exported.set(\"export=\", { local: \"export=\", typeOnly: false });\n continue;\n }\n if ((match = /^(?:export )?declare module ([\"'][^\"']+[\"'])/.exec(flat))) {\n addAmbient(`declare module ${group(match, 1).replaceAll(\"'\", '\"')}`, statement);\n continue;\n }\n if (/^(?:export )?(?:declare )?global \\{/.test(flat)) {\n addAmbient(\"declare global\", statement);\n continue;\n }\n if ((match = /^export as namespace ([\\w$]+);?$/.exec(flat))) {\n addAmbient(`export as namespace ${group(match, 1)}`, statement);\n continue;\n }\n // `export default x`: the default export is a name of the module\n if ((match = /^export default ([\\w$]+);?$/.exec(flat))) {\n info.exported.set(\"default\", { local: group(match, 1), typeOnly: false });\n continue;\n }\n // A default function or class without a name\n match = /^export default (?:declare )?(?:abstract )?(?:class|function\\*?)(?![\\w$])\\s*([\\w$]*)/.exec(flat);\n if (match && (match[1] === \"\" || match[1] === \"extends\" || match[1] === \"implements\")) {\n addLocal(\"default\", withoutPrivateMembers(statement));\n info.exported.set(\"default\", { local: \"default\", typeOnly: false });\n continue;\n }\n // `const a: A, b: B` declares two names\n if ((match = /^(export )?(?:declare )?(?:const|let|var) (?!enum\\b)(.*?);?$/.exec(flat))) {\n const exported = match[1] !== undefined;\n for (const part of splitTopLevel(group(match, 2))) {\n const name = /^\\s*([\\w$]+)/.exec(part);\n if (!name) throw new Error(`A declaration that the report does not know, in ${file}:\\n${statement}`);\n addLocal(group(name, 1), statement);\n if (exported) info.exported.set(group(name, 1), { local: group(name, 1), typeOnly: false });\n }\n continue;\n }\n match = /^(export )?(default )?(?:declare )?(?:abstract )?(?:const (?=enum))?(?:function|class|interface|type|enum|namespace|module) ([\\w$]+)/.exec(flat);\n if (match) {\n const name = group(match, 3);\n addLocal(name, withoutPrivateMembers(statement));\n if (match[1] !== undefined) info.exported.set(match[2] !== undefined ? \"default\" : name, { local: name, typeOnly: false });\n continue;\n }\n // `export default <expression>`\n if (/^export default /.test(flat)) {\n addLocal(\"default\", statement);\n info.exported.set(\"default\", { local: \"default\", typeOnly: false });\n continue;\n }\n throw new Error(`A statement that the report does not know, in ${file}:\\n${statement}`);\n }\n return info;\n}\n","/** A line diff (the algorithm of Myers) and its text in the unified format of `diff -u` and git. */\n\n/** An operation of a line diff: a kept line, a removed line or an added line. */\nexport interface DiffLine {\n readonly kind: \" \" | \"-\" | \"+\";\n readonly text: string;\n}\n\n/** Above this number of changes, the diff replaces the whole changed part, so the memory stays small. */\nconst MAX_EDITS = 2000;\n\n/** This function gives the shortest edit script that changes the lines `before` into the lines `after`. */\nexport function diffLines(before: readonly string[], after: readonly string[]): DiffLine[] {\n // The common start and end need no search\n let start = 0;\n while (start < before.length && start < after.length && before[start] === after[start]) start++;\n let end = 0;\n while (end < before.length - start && end < after.length - start && before[before.length - 1 - end] === after[after.length - 1 - end]) end++;\n const a = before.slice(start, before.length - end);\n const b = after.slice(start, after.length - end);\n const kept = (lines: readonly string[]): DiffLine[] => lines.map((text) => ({ kind: \" \", text }));\n return [...kept(before.slice(0, start)), ...middle(a, b), ...kept(before.slice(before.length - end))];\n}\n\n/** This function gives the edit script of two lists that have different first lines and different last lines. */\nfunction middle(a: readonly string[], b: readonly string[]): DiffLine[] {\n const n = a.length;\n const m = b.length;\n const replace = (): DiffLine[] => [...a.map((text): DiffLine => ({ kind: \"-\", text })), ...b.map((text): DiffLine => ({ kind: \"+\", text }))];\n if (n === 0 || m === 0) return replace();\n const max = Math.min(n + m, MAX_EDITS);\n const offset = max + 1;\n const v = new Int32Array(2 * max + 3);\n // trace[d] holds v[-d..d] before the step d\n const trace: Int32Array[] = [];\n for (let d = 0; d <= max; d++) {\n trace.push(v.slice(offset - d, offset + d + 1));\n for (let k = -d; k <= d; k += 2) {\n const down = k === -d || (k !== d && (v[offset + k - 1] ?? 0) < (v[offset + k + 1] ?? 0));\n let x = down ? (v[offset + k + 1] ?? 0) : (v[offset + k - 1] ?? 0) + 1;\n let y = x - k;\n while (x < n && y < m && a[x] === b[y]) {\n x++;\n y++;\n }\n v[offset + k] = x;\n if (x >= n && y >= m) return backtrack(a, b, trace);\n }\n }\n return replace();\n}\n\n/** This function follows the trace of the search back from the end, and gives the operations in order. */\nfunction backtrack(a: readonly string[], b: readonly string[], trace: readonly Int32Array[]): DiffLine[] {\n const result: DiffLine[] = [];\n let x = a.length;\n let y = b.length;\n for (let d = trace.length - 1; d >= 0; d--) {\n const v = trace[d] ?? new Int32Array(0);\n const at = (k: number): number => v[k + d] ?? 0;\n const k = x - y;\n const down = k === -d || (k !== d && at(k - 1) < at(k + 1));\n const previousK = down ? k + 1 : k - 1;\n const previousX = d === 0 ? 0 : at(previousK);\n const previousY = d === 0 ? 0 : previousX - previousK;\n while (x > previousX && y > previousY) {\n result.push({ kind: \" \", text: a[x - 1] ?? \"\" });\n x--;\n y--;\n }\n if (d === 0) break;\n if (down) result.push({ kind: \"+\", text: b[y - 1] ?? \"\" });\n else result.push({ kind: \"-\", text: a[x - 1] ?? \"\" });\n x = previousX;\n y = previousY;\n }\n return result.reverse();\n}\n\n/** The options of a unified diff. */\nexport interface UnifiedDiffOptions {\n /** The number of kept lines around each change. The default is 3. */\n readonly context?: number;\n /** The name of the file before the change, after `---`. */\n readonly from?: string;\n /** The name of the file after the change, after `+++`. */\n readonly to?: string;\n}\n\n/**\n * This function gives the change from the text `before` to the text `after` in the unified format.\n * The result is an empty string when the texts are the same.\n */\nexport function unifiedDiff(before: string, after: string, options: UnifiedDiffOptions = {}): string {\n const split = (text: string): string[] => (text === \"\" ? [] : text.replace(/\\n$/, \"\").split(\"\\n\"));\n const ops = diffLines(split(before), split(after));\n const context = options.context ?? 3;\n // The position of each operation in the two texts\n const positions: { a: number; b: number }[] = [];\n let a = 0;\n let b = 0;\n for (const op of ops) {\n positions.push({ a, b });\n if (op.kind !== \"+\") a++;\n if (op.kind !== \"-\") b++;\n }\n const changes = ops.flatMap((op, index) => (op.kind === \" \" ? [] : [index]));\n if (changes.length === 0) return \"\";\n const lines = [`--- ${options.from ?? \"before\"}`, `+++ ${options.to ?? \"after\"}`];\n let index = 0;\n while (index < changes.length) {\n const first = changes[index] ?? 0;\n let last = first;\n while (index + 1 < changes.length && (changes[index + 1] ?? 0) - last <= 2 * context) last = changes[++index] ?? last;\n index++;\n const from = Math.max(0, first - context);\n const to = Math.min(ops.length - 1, last + context);\n const hunk = ops.slice(from, to + 1);\n const start = positions[from] ?? { a: 0, b: 0 };\n const countA = hunk.filter((op) => op.kind !== \"+\").length;\n const countB = hunk.filter((op) => op.kind !== \"-\").length;\n // As in diff -u, an empty side starts at the line before the hunk\n const range = (line: number, count: number): string => `${count === 0 ? line : line + 1}${count === 1 ? \"\" : `,${count}`}`;\n lines.push(`@@ -${range(start.a, countA)} +${range(start.b, countB)} @@`);\n for (const op of hunk) lines.push(`${op.kind}${op.text}`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n","/**\n * The entries of a package for its report: the subpaths of the `exports` field (or `types` and\n * `main`), each with its declaration file, and the bins.\n */\nimport { existsSync, readdirSync, statSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\n\n/** The fields of a `package.json` file that the report reads. */\nexport interface Manifest {\n readonly name?: string;\n readonly private?: boolean;\n readonly exports?: unknown;\n readonly imports?: unknown;\n readonly types?: unknown;\n readonly typings?: unknown;\n readonly main?: unknown;\n readonly bin?: unknown;\n readonly publishConfig?: Readonly<Record<string, unknown>>;\n readonly [field: string]: unknown;\n}\n\n/** A file that an entry without a declaration file exports: the subpath and the path of the file. */\nexport interface EntryFile {\n /** The subpath that a consumer imports, for example `./tsconfig/base.json`. */\n readonly subpath: string;\n /** The file, relative to the package folder, for example `./tsconfig/base.json`. */\n readonly path: string;\n}\n\n/** An entry of a package: a subpath and its declaration file, or a note when it has none. */\nexport interface Entry {\n /** The subpath of the `exports` field, for example `.` or `./client`. */\n readonly subpath: string;\n /** The declaration file, relative to the package folder, for example `./build/index.d.ts`. */\n readonly types?: string;\n /** This text tells why the entry has no declaration file. */\n readonly note?: string;\n /** The files that an entry without a declaration file exports, in the order of the subpaths. A removed file changes the report. */\n readonly files?: readonly EntryFile[];\n}\n\n/** A command of the `bin` field of a package. */\nexport interface Bin {\n readonly name: string;\n readonly path: string;\n}\n\n/** The conditions of the `exports` field that a TypeScript consumer can use, in no order. */\nconst CONDITIONS = new Set([\"types\", \"import\", \"node\", \"default\", \"require\"]);\n\n/**\n * The fields of `publishConfig` that pnpm puts in the published `package.json`. A source package of\n * the template has `main: ./src/index.ts`, and its `publishConfig` gives the built entries.\n */\nexport const PUBLISH_CONFIG_FIELDS: readonly string[] = [\"bin\", \"main\", \"module\", \"exports\", \"imports\", \"types\", \"typings\", \"typesVersions\", \"browser\"];\n\n/** The order of the code units: the same on each machine, with no locale. */\nexport const byCode = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);\n\n/** This function gives a path relative to `root`, with `/`. */\nexport const relativePath = (root: string, file: string): string => relative(root, file).split(sep).join(\"/\");\n\n/** This function gives the manifest as pnpm publishes it: the fields of `publishConfig` replace the fields of the source. */\nexport function publishedManifest(manifest: Manifest): Manifest {\n const config = manifest.publishConfig;\n if (!config) return manifest;\n const result: Record<string, unknown> = { ...manifest };\n for (const field of PUBLISH_CONFIG_FIELDS) if (config[field] !== undefined) result[field] = config[field];\n return result;\n}\n\n/**\n * This function gives the declaration file of a JavaScript or declaration path: `a.js` gives\n * `a.d.ts`, and `a.mjs` gives `a.d.mts`. The result is undefined for a file of another kind.\n */\nexport function declarationPathOf(path: string): string | undefined {\n if (/\\.d\\.[mc]?ts$/.test(path)) return path;\n const js = /\\.([mc]?)js$/.exec(path);\n if (js) return `${path.slice(0, -js[0].length)}.d.${js[1] ?? \"\"}ts`;\n return undefined;\n}\n\n/** This function matches `subpath` with the key `pattern` of an `exports` or `imports` field. It gives the part of the `*`. */\nexport function patternMatch(pattern: string, subpath: string): string | undefined {\n const star = pattern.indexOf(\"*\");\n if (star < 0) return pattern === subpath ? \"\" : undefined;\n const prefix = pattern.slice(0, star);\n const suffix = pattern.slice(star + 1);\n if (subpath.length < prefix.length + suffix.length || !subpath.startsWith(prefix) || !subpath.endsWith(suffix)) return undefined;\n return subpath.slice(prefix.length, subpath.length - suffix.length);\n}\n\n/**\n * This function gives the target of an `exports` value for a TypeScript consumer: the first known\n * condition, in the order of the object. The result is `null` for an excluded subpath, and undefined\n * when no condition fits.\n */\nexport function targetOf(value: unknown): string | null | undefined {\n if (value === null) return null;\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) {\n for (const item of value) {\n const target = targetOf(item);\n if (typeof target === \"string\") return target;\n }\n return undefined;\n }\n if (typeof value === \"object\") {\n for (const [condition, inner] of Object.entries(value)) {\n if (!CONDITIONS.has(condition)) continue;\n const target = targetOf(inner);\n if (target !== undefined) return target;\n }\n }\n return undefined;\n}\n\n/** This function gives the `exports` field as a map of subpaths. */\nfunction subpathMap(exportsField: unknown): Record<string, unknown> {\n if (typeof exportsField !== \"object\" || Array.isArray(exportsField) || exportsField === null) return { \".\": exportsField };\n const keys = Object.keys(exportsField);\n if (keys.length > 0 && keys.every((key) => !key.startsWith(\".\"))) return { \".\": exportsField };\n return exportsField as Record<string, unknown>;\n}\n\n/** This function gives each file under `dir`, relative to `root` with `/`, without `node_modules`. */\nfunction filesUnder(root: string, dir: string): string[] {\n const start = join(root, dir);\n if (!existsSync(start) || !statSync(start).isDirectory()) return [];\n const found: string[] = [];\n const walk = (folder: string): void => {\n for (const entry of readdirSync(folder, { withFileTypes: true })) {\n if (entry.name === \"node_modules\" || entry.name === \".git\") continue;\n const path = join(folder, entry.name);\n if (entry.isDirectory()) walk(path);\n else found.push(relativePath(root, path));\n }\n };\n walk(start);\n return found.sort(byCode);\n}\n\n/**\n * This function gives each file under `root` that the target pattern `target` of the subpath\n * pattern `subpath` matches. Each file has its subpath, in the order of the subpaths. The function\n * skips each subpath that `isExcluded` excludes.\n */\nfunction patternFiles(root: string, subpath: string, target: string, isExcluded: (subpath: string) => boolean): EntryFile[] {\n const pattern = target.replace(/^\\.\\//, \"\");\n const folder = pattern.slice(0, pattern.indexOf(\"*\")).replace(/[^/]*$/, \"\");\n const matched: EntryFile[] = [];\n for (const file of filesUnder(root, folder)) {\n const part = patternMatch(pattern, file);\n if (part === undefined) continue;\n const expanded = subpath.split(\"*\").join(part);\n if (!isExcluded(expanded)) matched.push({ subpath: expanded, path: `./${file}` });\n }\n return matched.sort((a, b) => byCode(a.subpath, b.subpath) || byCode(a.path, b.path));\n}\n\n/** This function gives an entry without a declaration file, with the files that it exports. */\nfunction fileEntry(subpath: string, note: string, files: readonly EntryFile[]): Entry {\n return files.length > 0 ? { subpath, note, files } : { subpath, note };\n}\n\n/**\n * This function gives the entries of a package, in the order of the `exports` field. The\n * `./package.json` entry is not part of the API. A subpath pattern (`./*`) gives one entry for each\n * declaration file that it matches. An entry without a declaration file (for example a JSON or CSS\n * file) lists the files that it exports. `root` is the package folder.\n */\nexport function entriesOf(manifest: Manifest, root: string): Entry[] {\n const entries: Entry[] = [];\n const exists = (path: string): boolean => existsSync(resolve(root, path));\n if (manifest.exports === undefined) {\n // No `exports` field: TypeScript reads `types`, `typings`, then the declaration of `main`\n const field = manifest.types ?? manifest.typings;\n if (typeof field === \"string\") return [{ subpath: \".\", types: field }];\n const main = typeof manifest.main === \"string\" ? manifest.main : \"./index.js\";\n const types = declarationPathOf(main);\n if (types && exists(types)) return [{ subpath: \".\", types }];\n if (typeof manifest.main === \"string\") return [{ subpath: \".\", note: `no declaration file for main ${manifest.main}` }];\n return [];\n }\n const map = subpathMap(manifest.exports);\n const excluded = Object.entries(map)\n .filter(([, value]) => value === null)\n .map(([key]) => key);\n const isExcluded = (subpath: string): boolean => excluded.some((pattern) => patternMatch(pattern, subpath) !== undefined);\n for (const [subpath, value] of Object.entries(map)) {\n if (subpath === \"./package.json\" || value === null) continue;\n const target = targetOf(value);\n if (typeof target !== \"string\") {\n entries.push({ subpath, note: \"no condition for a TypeScript consumer\" });\n continue;\n }\n const declared = declarationPathOf(target);\n const own = (path: string): EntryFile[] => (exists(path) ? [{ subpath, path }] : []);\n if (!subpath.includes(\"*\")) {\n if (isExcluded(subpath)) continue;\n if (!declared) entries.push(fileEntry(subpath, `no declaration file for ${target}`, own(target)));\n // A JavaScript file without a declaration file has no types. A missing build throws later.\n else if (declared !== target && !exists(declared) && exists(target)) entries.push(fileEntry(subpath, `no declaration file for ${target}`, own(target)));\n else entries.push({ subpath, types: declared });\n continue;\n }\n if (!declared?.includes(\"*\")) {\n // A pattern of files that are not declarations, for example `./tsconfig/*.json`\n const files = target.includes(\"*\") ? patternFiles(root, subpath, target, isExcluded) : [];\n const note = files.length === 0 && target.includes(\"*\") ? `no file matches ${target}` : `no declaration pattern for ${target}`;\n entries.push(fileEntry(subpath, note, files));\n continue;\n }\n const matched = patternFiles(root, subpath, declared, isExcluded).map((file): Entry => ({ subpath: file.subpath, types: file.path }));\n if (matched.length === 0) entries.push({ subpath, note: `no file matches ${declared}` });\n entries.push(...matched);\n }\n return entries;\n}\n\n/** This function gives the commands of the `bin` field, in name order. A string `bin` has the name of the package without its scope. */\nexport function binsOf(manifest: Manifest): Bin[] {\n const { bin } = manifest;\n if (typeof bin === \"string\") return [{ name: (manifest.name ?? \"\").replace(/^@[^/]+\\//, \"\"), path: bin }];\n if (typeof bin !== \"object\" || bin === null) return [];\n return Object.entries(bin)\n .filter((entry): entry is [string, string] => typeof entry[1] === \"string\")\n .map(([name, path]) => ({ name, path }))\n .sort((a, b) => byCode(a.name, b.name));\n}\n","/**\n * The report of the public API of a package, from its built `.d.ts` files.\n *\n * The report lists the names that each entry of the `exports` field gives, and the declaration of\n * each name. It follows `export *`, `export { a as b } from`, `export * as ns` and the imports that\n * a module exports again. It also lists the ambient declarations of each file that an entry reaches,\n * and the bins. An entry without a declaration file (for example a JSON file) lists its files. The\n * report has no comments and no private members. Thus a change of a comment or of a private field\n * does not change it.\n *\n * The text is the same on Windows and on Linux. The line ends\n * are LF, the paths use `/`, and the sort does not use the locale.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { parseDeclarations, type DeclarationInfo } from \"./declarations.ts\";\nimport { binsOf, byCode, declarationPathOf, entriesOf, patternMatch, publishedManifest, relativePath, targetOf, type Entry, type Manifest } from \"./entries.ts\";\n\n/** The command that the header of a report names, when the options give no other command. */\nexport const DEFAULT_TOOL = \"api-report\";\n\n/** The options of a report. */\nexport interface ReportOptions {\n /** The manifest of the package: the report reads its `imports` and `bin` fields. */\n readonly manifest?: Manifest;\n /** The command that the header names, for example `api-report` or `node scripts/api-report.mjs`. */\n readonly tool?: string;\n}\n\n/** The binding of an exported name. */\ntype Binding =\n | { readonly kind: \"declaration\"; readonly file: string; readonly local: string; readonly typeOnly: boolean }\n | { readonly kind: \"namespace\"; readonly file: string; readonly typeOnly: boolean }\n | { readonly kind: \"external\"; readonly module: string; readonly name: string; readonly typeOnly: boolean };\n\n/** The reader of the declaration files of one package. */\nclass Reader {\n readonly #infos = new Map<string, DeclarationInfo>();\n readonly #bindings = new Map<string, Map<string, Binding>>();\n readonly #visiting = new Set<string>();\n readonly #root: string;\n readonly #manifest: Manifest;\n\n constructor(root: string, manifest: Manifest) {\n this.#root = root;\n this.#manifest = manifest;\n }\n\n info(file: string): DeclarationInfo {\n let info = this.#infos.get(file);\n if (!info) {\n info = parseDeclarations(readFileSync(file, \"utf8\"), relativePath(this.#root, file));\n this.#infos.set(file, info);\n }\n return info;\n }\n\n /** This method gives the candidate declaration files of a module path. */\n #candidates(base: string): string[] {\n const declared = declarationPathOf(base);\n if (declared) return [declared];\n const source = /\\.([mc]?)ts$/.exec(base);\n if (source) return [`${base.slice(0, -source[0].length)}.d.${source[1] ?? \"\"}ts`];\n return [`${base}.d.ts`, join(base, \"index.d.ts\")];\n }\n\n /**\n * This method gives the declaration file of a module specifier of `from`: a relative path, or a\n * `#` name of the `imports` field. The result is undefined for a module of a different package. A\n * missing file throws, or gives `null` when `soft` is true.\n */\n fileOf(from: string, specifier: string, soft = false): string | null | undefined {\n let base: string | undefined;\n if (specifier.startsWith(\".\")) base = resolve(dirname(from), specifier);\n else if (specifier.startsWith(\"#\") && typeof this.#manifest.imports === \"object\" && this.#manifest.imports !== null) {\n for (const [pattern, value] of Object.entries(this.#manifest.imports)) {\n const part = patternMatch(pattern, specifier);\n const target = part === undefined ? undefined : targetOf(value);\n if (part !== undefined && typeof target === \"string\" && target.startsWith(\".\")) {\n base = resolve(this.#root, target.split(\"*\").join(part));\n break;\n }\n }\n if (base === undefined) return undefined;\n } else return undefined;\n const file = this.#candidates(base).find((candidate) => existsSync(candidate));\n if (file) return file;\n if (soft) return null;\n throw new Error(`No declaration file for \"${specifier}\" from ${relativePath(this.#root, from)}`);\n }\n\n /** This method gives the binding of `imported` in the module `specifier` of `from`. */\n #bindingIn(from: string, specifier: string, imported: string, typeOnly: boolean): Binding {\n const file = this.fileOf(from, specifier);\n if (!file) return { kind: \"external\", module: specifier, name: imported, typeOnly };\n if (imported === \"*\") return { kind: \"namespace\", file, typeOnly };\n const binding = this.exportsOf(file).get(imported);\n if (!binding) throw new Error(`\"${specifier}\" from ${relativePath(this.#root, from)} does not export ${imported}`);\n return typeOnly ? { ...binding, typeOnly: true } : binding;\n }\n\n /** This method gives the names that a module exports, and their bindings. */\n exportsOf(file: string): Map<string, Binding> {\n const known = this.#bindings.get(file);\n if (known) return known;\n if (this.#visiting.has(file)) return new Map();\n this.#visiting.add(file);\n const info = this.info(file);\n const result = new Map<string, Binding>();\n for (const [name, { local, typeOnly }] of info.exported) {\n const imported = info.imports.get(local);\n if (info.locals.has(local)) result.set(name, { kind: \"declaration\", file, local, typeOnly });\n else if (imported) result.set(name, this.#bindingIn(file, imported.from, imported.imported, typeOnly || imported.typeOnly));\n else throw new Error(`${relativePath(this.#root, file)} exports ${local}, and has no declaration or import of it`);\n }\n for (const reexport of info.reexports) result.set(reexport.exported, this.#bindingIn(file, reexport.from, reexport.imported, reexport.typeOnly));\n for (const namespace of info.namespaces) result.set(namespace.name, this.#bindingIn(file, namespace.from, \"*\", namespace.typeOnly));\n // A name of `export *` never replaces an explicit export, and `default` does not pass\n const explicit = new Set(result.keys());\n for (const { from: star, typeOnly } of info.stars) {\n const target = this.fileOf(file, star);\n if (!target) {\n // The names of a different package are not in this package: the report names the package\n const name = `* from \"${star}\"`;\n if (!result.has(name)) result.set(name, { kind: \"external\", module: star, name: \"*\", typeOnly });\n continue;\n }\n // `export type *` gives each name as a type only\n for (const [name, binding] of this.exportsOf(target)) {\n if (name !== \"default\" && !explicit.has(name) && !result.has(name)) result.set(name, typeOnly ? { ...binding, typeOnly: true } : binding);\n }\n }\n this.#visiting.delete(file);\n this.#bindings.set(file, result);\n return result;\n }\n\n /**\n * This method gives each declaration file of the package that `file` reaches through its module\n * specifiers, and `file`. A file outside the package folder or in `node_modules` is not part of it.\n */\n reached(file: string): string[] {\n const seen = new Set<string>();\n const pending = [file];\n for (let next = pending.pop(); next !== undefined; next = pending.pop()) {\n if (seen.has(next)) continue;\n seen.add(next);\n for (const specifier of this.info(next).references) {\n const target = this.fileOf(next, specifier, true);\n if (!target) continue;\n const path = relativePath(this.#root, target);\n if (path.startsWith(\"../\") || path.split(\"/\").includes(\"node_modules\")) continue;\n pending.push(target);\n }\n }\n return [...seen];\n }\n}\n\n/** This function gives the lines of the header of a report. */\nfunction header(packageName: string, tool: string): string[] {\n return [\n `# The public API of ${packageName}`,\n \"#\",\n \"# The names of each entry of the exports field, and the declaration of each name, without comments\",\n `# and private members. The command \\`${tool} check\\` compares this file with the built .d.ts files.`,\n `# To accept a change of the API, start the build, then \\`${tool} update\\`, and review the diff.`,\n ];\n}\n\n/** The number of lines of the header of a report. */\nexport const HEADER_LINES = 5;\n\n/**\n * This function gives the report of the public API of a package. `entries` gives the subpath and\n * the declaration file of each entry, relative to `root`. The report has the exported names of each\n * entry, the bins of the manifest, and then the declaration of each name.\n */\nexport function apiReport(packageName: string, root: string, entries: readonly Entry[], options: ReportOptions = {}): string {\n const manifest = options.manifest ?? {};\n const reader = new Reader(root, manifest);\n const path = (file: string): string => relativePath(root, file);\n const keyOf = (binding: Binding): string =>\n binding.kind === \"declaration\" ? `${path(binding.file)}#${binding.local}` : binding.kind === \"namespace\" ? `${path(binding.file)}#*` : `${binding.module}#${binding.name}`;\n const declarations = new Map<string, string>();\n const lines = header(packageName, options.tool ?? DEFAULT_TOOL);\n if (entries.every((entry) => entry.types === undefined)) {\n lines.push(\"\", \"This package has no type declarations: no entry of its package.json gives a .d.ts file.\");\n }\n\n /** The lines of the names of a module, and the names of each namespace in it, with `prefix`. */\n const names = (bindings: Map<string, Binding>, prefix: string, parents: ReadonlySet<string>, typeOnly: boolean): void => {\n for (const [name, binding] of [...bindings].sort(([a], [b]) => byCode(a, b))) {\n const key = keyOf(binding);\n const isType = typeOnly || binding.typeOnly;\n lines.push(`${isType ? \"type \" : \"\"}${prefix}${name}: ${key}${binding.kind === \"declaration\" ? \"\" : ` (${binding.kind})`}`);\n if (binding.kind === \"declaration\" && !declarations.has(key)) {\n declarations.set(key, (reader.info(binding.file).locals.get(binding.local) ?? []).join(\"\\n\"));\n }\n // The names of a namespace are part of the API: `ns.name`\n if (binding.kind === \"namespace\" && !parents.has(binding.file)) {\n names(reader.exportsOf(binding.file), `${prefix}${name}.`, new Set([...parents, binding.file]), isType);\n }\n }\n };\n\n for (const entry of entries) {\n if (entry.types === undefined) {\n lines.push(\"\", `## ${entry.subpath}: ${entry.note ?? \"no declaration file\"}`);\n // The files of an entry without declarations: a removed file changes the report\n const files = entry.files ?? [];\n if (files.length > 0) lines.push(\"\", ...files.map((file) => `file ${file.subpath}: ${file.path.replace(/^\\.\\//, \"\")}`));\n continue;\n }\n const file = resolve(root, entry.types);\n if (!existsSync(file)) throw new Error(`${entry.subpath}: ${entry.types} is missing. Build the package first.`);\n const bindings = reader.exportsOf(file);\n lines.push(\"\", `## ${entry.subpath} (${path(file)}): ${bindings.size} names`, \"\");\n names(bindings, \"\", new Set([file]), false);\n // The ambient declarations of each file that the entry reaches\n const ambient: string[] = [];\n for (const reached of reader.reached(file)) {\n for (const [label, statements] of reader.info(reached).ambient) {\n const key = `${path(reached)}#${label}`;\n ambient.push(key);\n if (!declarations.has(key)) declarations.set(key, statements.join(\"\\n\"));\n }\n }\n for (const key of ambient.sort(byCode)) lines.push(`ambient: ${key}`);\n }\n const bins = binsOf(manifest);\n if (bins.length > 0) {\n lines.push(\"\", `## bin: ${bins.length} commands`, \"\");\n for (const bin of bins) lines.push(`${bin.name}: ${bin.path}`);\n }\n if (declarations.size > 0 || entries.some((entry) => entry.types !== undefined)) {\n lines.push(\"\", \"## Declarations\");\n for (const key of [...declarations.keys()].sort(byCode)) lines.push(\"\", `### ${key}`, declarations.get(key) ?? \"\");\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** The options of the report of a package folder. */\nexport interface PackageReportOptions {\n /** The command that the header names. */\n readonly tool?: string;\n /** When true (the default), the fields of `publishConfig` replace the fields of the source, as pnpm publishes them. */\n readonly publishConfig?: boolean;\n}\n\n/** This function gives the report of the package in the folder `dir`. */\nexport function packageReport(dir: string, options: PackageReportOptions = {}): string {\n const source = JSON.parse(readFileSync(join(dir, \"package.json\"), \"utf8\")) as Manifest;\n const manifest = options.publishConfig === false ? source : publishedManifest(source);\n const name = typeof manifest.name === \"string\" ? manifest.name : basename(dir);\n return apiReport(name, dir, entriesOf(manifest, dir), { manifest, ...(options.tool === undefined ? {} : { tool: options.tool }) });\n}\n","/**\n * The package folders of a repository: the folders that the globs of the workspace name, with a\n * `package.json` file.\n */\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { byCode, relativePath } from \"./entries.ts\";\n\n/** The characters that have a meaning in a regular expression. */\nconst SPECIAL = new Set([...\"\\\\^$.|+()[]{}*?/\"]);\n\n/**\n * This function gives a regular expression for a glob of `/` paths. `*` matches a part of one path\n * segment, `?` matches one character, `**` matches zero or more segments, and `{a,b}` matches one of\n * its parts. The function escapes each other special character.\n */\nexport function globToRegExp(glob: string): RegExp {\n let source = \"\";\n let braces = 0;\n for (let index = 0; index < glob.length; index++) {\n const char = glob.charAt(index);\n if (char === \"/\" && glob.slice(index + 1) === \"**\") {\n // `a/**` matches `a` and each path under it\n source += \"(?:/.*)?\";\n break;\n }\n if (char === \"*\" && glob.charAt(index + 1) === \"*\") {\n const atStart = index === 0 || glob.charAt(index - 1) === \"/\";\n const after = glob.charAt(index + 2);\n if (atStart && after === \"/\") {\n // `**/` matches zero or more whole segments\n source += \"(?:[^/]+/)*\";\n index += 2;\n } else if (atStart && after === \"\") {\n source += \".*\";\n index += 1;\n } else {\n source += \"[^/]*\";\n index += 1;\n }\n } else if (char === \"*\") source += \"[^/]*\";\n else if (char === \"?\") source += \"[^/]\";\n else if (char === \"{\") {\n braces++;\n source += \"(?:\";\n } else if (char === \"}\" && braces > 0) {\n braces--;\n source += \")\";\n } else if (char === \",\" && braces > 0) source += \"|\";\n else if (SPECIAL.has(char)) source += `\\\\${char}`;\n else source += char;\n }\n if (braces > 0) throw new Error(`A glob with a \"{\" that has no \"}\": ${glob}`);\n return new RegExp(`^${source}$`);\n}\n\n/** The characters that make a path segment a pattern. */\nconst GLOB_CHARS = /[*?{]/;\n\n/**\n * This function gives the folders under `root` that a glob names, as `/` paths relative to `root`,\n * in the order of the code units. It does not go into `node_modules` or a folder that starts with `.`.\n */\nexport function globFolders(root: string, glob: string): string[] {\n const clean = glob.replace(/^\\.\\//, \"\").replace(/\\/+$/, \"\");\n const segments = clean.split(\"/\");\n const firstPattern = segments.findIndex((segment) => GLOB_CHARS.test(segment));\n if (firstPattern < 0) return existsSync(join(root, clean)) ? [clean] : [];\n const base = segments.slice(0, firstPattern).join(\"/\");\n const depth = clean.includes(\"**\") ? Number.POSITIVE_INFINITY : segments.length - firstPattern;\n const pattern = globToRegExp(clean);\n const start = join(root, base);\n if (!existsSync(start)) return [];\n const found: string[] = [];\n const walk = (folder: string, level: number): void => {\n for (const entry of readdirSync(folder, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name === \"node_modules\" || entry.name.startsWith(\".\")) continue;\n const path = join(folder, entry.name);\n if (pattern.test(relativePath(root, path))) found.push(relativePath(root, path));\n if (level < depth) walk(path, level + 1);\n }\n };\n // `a/**` also names `a`\n if (base !== \"\" && pattern.test(base)) found.push(base);\n walk(start, 1);\n return found.sort(byCode);\n}\n\n/**\n * This function gives the globs of the workspace at `root`: the `packages` list of\n * `pnpm-workspace.yaml`, then the `workspaces` field of `package.json`. The result is undefined when\n * the repository has no workspace.\n */\nexport function workspaceGlobs(root: string): string[] | undefined {\n const yaml = join(root, \"pnpm-workspace.yaml\");\n if (existsSync(yaml)) {\n const lines = readFileSync(yaml, \"utf8\").split(/\\r?\\n/);\n const start = lines.findIndex((line) => /^packages\\s*:/.test(line));\n if (start >= 0) {\n const unquote = (text: string): string =>\n text\n .replace(/\\s+#.*$/, \"\")\n .trim()\n .replace(/^[\"']|[\"']$/g, \"\");\n const inline = /^packages\\s*:\\s*\\[(.*)\\]/.exec(lines[start] ?? \"\");\n if (inline) return (inline[1] ?? \"\").split(\",\").map(unquote).filter(Boolean);\n const globs: string[] = [];\n for (const line of lines.slice(start + 1)) {\n if (/^\\s*(#.*)?$/.test(line)) continue;\n const item = /^\\s+-\\s+(.+)$/.exec(line);\n if (!item) break;\n globs.push(unquote(item[1] ?? \"\"));\n }\n return globs;\n }\n }\n const manifestFile = join(root, \"package.json\");\n if (existsSync(manifestFile)) {\n const { workspaces } = JSON.parse(readFileSync(manifestFile, \"utf8\")) as { workspaces?: unknown };\n if (Array.isArray(workspaces)) return workspaces.filter((glob): glob is string => typeof glob === \"string\");\n if (typeof workspaces === \"object\" && workspaces !== null && \"packages\" in workspaces && Array.isArray(workspaces.packages)) {\n return workspaces.packages.filter((glob): glob is string => typeof glob === \"string\");\n }\n }\n return undefined;\n}\n\n/**\n * This function gives the package folders of the repository at `root`: the folders of the globs\n * that have a `package.json` file. A glob that starts with `!` removes folders. Without globs, the\n * function reads the globs of the workspace, and a repository with no workspace is one package.\n * The result has absolute paths, in the order of the code units.\n */\nexport function packageFolders(root: string, globs: readonly string[] | undefined = workspaceGlobs(root)): string[] {\n if (globs === undefined) return existsSync(join(root, \"package.json\")) ? [root] : [];\n const included = new Set<string>();\n // As in pnpm, a `!` glob removes its folders in each position of the list\n for (const glob of globs.filter((item) => !item.startsWith(\"!\"))) for (const folder of globFolders(root, glob)) included.add(folder);\n for (const glob of globs.filter((item) => item.startsWith(\"!\"))) for (const folder of globFolders(root, glob.slice(1))) included.delete(folder);\n return [...included]\n .filter((folder) => existsSync(join(root, folder, \"package.json\")))\n .sort(byCode)\n .map((folder) => join(root, folder));\n}\n","/**\n * The commands `check` and `update` of the bin `api-report`, as functions. `runReports` compares or\n * writes the reports of each package, and `runCli` reads the arguments and writes the result.\n */\nimport { appendFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { unifiedDiff } from \"./diff.ts\";\nimport { relativePath, type Manifest } from \"./entries.ts\";\nimport { DEFAULT_TOOL, packageReport } from \"./report.ts\";\nimport { packageFolders } from \"./workspace.ts\";\n\n/** The path of the report in a package folder, when the configuration gives no other path. */\nexport const REPORT_FILE = \"test/api/public-api.txt\";\n\n/** The configuration of the reports: the field `apiReport` of the root `package.json`, or the options of the CLI. */\nexport interface ApiReportConfig {\n /** The globs of the package folders, relative to the root. A glob that starts with `!` removes folders. The default is the globs of the workspace. */\n readonly packages?: readonly string[];\n /** The path of the report in each package folder. The default is `test/api/public-api.txt`. */\n readonly report?: string;\n /** When true, each private package also gets a report. The default is false. */\n readonly includePrivate?: boolean;\n /** When false, the report reads the fields of `package.json` without `publishConfig`. The default is true. */\n readonly publishConfig?: boolean;\n /** The command that the header of each report names. The default is `api-report`. */\n readonly tool?: string;\n}\n\n/** The command: `check` compares the reports, and `update` writes them. */\nexport type Mode = \"check\" | \"update\";\n\n/** The options of `runReports`. */\nexport interface RunOptions extends ApiReportConfig {\n readonly mode: Mode;\n /** The root of the repository. */\n readonly root: string;\n /** The package folders to examine. They replace the globs, and a named private package gets a report. */\n readonly folders?: readonly string[];\n}\n\n/** The result of one package. */\nexport interface PackageResult {\n /** The package folder, relative to the root, with `/`. */\n readonly folder: string;\n /** The report file, relative to the root, with `/`. */\n readonly file: string;\n /**\n * `same`: the report is current. `changed` and `new`: the report differs or is missing (`check`),\n * or the command wrote it (`update`). `stale`: a private package has a report. `private`: the\n * package has no report. `error`: the command did not make the report.\n */\n readonly status: \"same\" | \"changed\" | \"new\" | \"stale\" | \"private\" | \"error\";\n /** The change from the committed report to the new report, in the unified format. */\n readonly diff?: string;\n readonly error?: string;\n}\n\n/** The result of `runReports`. */\nexport interface RunResult {\n readonly mode: Mode;\n readonly packages: readonly PackageResult[];\n /** True when the command fails: an error, or (`check` only) a report that is not current. */\n readonly failed: boolean;\n}\n\n/**\n * This function reads the field `apiReport` of the `package.json` file at `root`. The result is an\n * empty configuration when the field does not exist.\n *\n * @throws Error when the field is not an object, or a value has the wrong type\n */\nexport function readConfig(root: string): ApiReportConfig {\n const file = join(root, \"package.json\");\n if (!existsSync(file)) return {};\n const value = (JSON.parse(readFileSync(file, \"utf8\")) as Manifest)[\"apiReport\"];\n if (value === undefined) return {};\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) throw new Error(\"The field apiReport of package.json must be an object.\");\n const config = value as Record<string, unknown>;\n const result: { -readonly [K in keyof ApiReportConfig]: ApiReportConfig[K] } = {};\n const packages = config[\"packages\"];\n if (packages !== undefined) {\n if (!Array.isArray(packages) || !packages.every((glob) => typeof glob === \"string\")) throw new Error(\"apiReport.packages must be an array of globs.\");\n result.packages = packages;\n }\n for (const key of [\"report\", \"tool\"] as const) {\n const item = config[key];\n if (item === undefined) continue;\n if (typeof item !== \"string\" || item === \"\") throw new Error(`apiReport.${key} must be a string.`);\n result[key] = item;\n }\n for (const key of [\"includePrivate\", \"publishConfig\"] as const) {\n const item = config[key];\n if (item === undefined) continue;\n if (typeof item !== \"boolean\") throw new Error(`apiReport.${key} must be true or false.`);\n result[key] = item;\n }\n const unknown = Object.keys(config).filter((key) => ![\"packages\", \"report\", \"tool\", \"includePrivate\", \"publishConfig\"].includes(key));\n if (unknown.length > 0) throw new Error(`apiReport has unknown fields: ${unknown.join(\", \")}.`);\n return result;\n}\n\n/** This function makes sure that the path of a report stays in its package folder. */\nfunction checkReportPath(report: string): string {\n const clean = report.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\");\n if (clean === \"\" || isAbsolute(report) || clean.split(\"/\").includes(\"..\")) throw new Error(`The path of a report must be relative to the package folder, with no \"..\": ${report}`);\n return clean;\n}\n\n/** This function compares (`check`) or writes (`update`) the report of each package. It writes nothing in `check` mode. */\nexport function runReports(options: RunOptions): RunResult {\n const root = resolve(options.root);\n const report = checkReportPath(options.report ?? REPORT_FILE);\n const named = options.folders !== undefined && options.folders.length > 0;\n const folders = named ? (options.folders ?? []).map((folder) => resolve(root, folder)) : packageFolders(root, options.packages);\n const results: PackageResult[] = [];\n for (const folder of folders) {\n const shown = relativePath(root, folder) || \".\";\n const file = join(folder, report);\n const shownFile = relativePath(root, file);\n const manifestFile = join(folder, \"package.json\");\n if (!existsSync(manifestFile)) {\n results.push({ folder: shown, file: shownFile, status: \"error\", error: \"no package.json\" });\n continue;\n }\n // A CRLF checkout gives the same text\n const current = existsSync(file) ? readFileSync(file, \"utf8\").replace(/\\r\\n/g, \"\\n\") : undefined;\n let manifest: Manifest;\n try {\n manifest = JSON.parse(readFileSync(manifestFile, \"utf8\")) as Manifest;\n } catch (error) {\n results.push({ folder: shown, file: shownFile, status: \"error\", error: error instanceof Error ? error.message : String(error) });\n continue;\n }\n // A private package has no public API. A named folder gets a report all the same.\n if (manifest.private === true && !named && options.includePrivate !== true) {\n if (current === undefined) results.push({ folder: shown, file: shownFile, status: \"private\" });\n else {\n if (options.mode === \"update\") rmSync(file);\n results.push({ folder: shown, file: shownFile, status: \"stale\" });\n }\n continue;\n }\n let text: string;\n try {\n text = packageReport(folder, {\n tool: options.tool ?? DEFAULT_TOOL,\n ...(options.publishConfig === undefined ? {} : { publishConfig: options.publishConfig }),\n });\n } catch (error) {\n results.push({ folder: shown, file: shownFile, status: \"error\", error: error instanceof Error ? error.message : String(error) });\n continue;\n }\n if (current === text) {\n results.push({ folder: shown, file: shownFile, status: \"same\" });\n continue;\n }\n if (options.mode === \"update\") {\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, text);\n }\n const diff = unifiedDiff(current ?? \"\", text, { from: current === undefined ? \"/dev/null\" : `a/${shownFile}`, to: `b/${shownFile}` });\n results.push({ folder: shown, file: shownFile, status: current === undefined ? \"new\" : \"changed\", diff });\n }\n const failed = results.some(\n (result) => result.status === \"error\" || (options.mode === \"check\" && (result.status === \"changed\" || result.status === \"new\" || result.status === \"stale\")),\n );\n return { mode: options.mode, packages: results, failed };\n}\n\n/** The most lines of the diff of one package in the output. */\nconst MAX_DIFF_LINES = 400;\n\n/** This function shortens a diff to `MAX_DIFF_LINES` lines. */\nfunction shortDiff(diff: string): string {\n const lines = diff.replace(/\\n$/, \"\").split(\"\\n\");\n if (lines.length <= MAX_DIFF_LINES) return `${lines.join(\"\\n\")}\\n`;\n return `${lines.slice(0, MAX_DIFF_LINES).join(\"\\n\")}\\n... ${lines.length - MAX_DIFF_LINES} more lines. Start the command update and read the diff in git.\\n`;\n}\n\n/** This function gives the text of a result for a terminal or a CI log. */\nexport function formatResult(result: RunResult, tool: string = DEFAULT_TOOL): string {\n const by = (status: PackageResult[\"status\"]): PackageResult[] => result.packages.filter((item) => item.status === status);\n const reports = result.packages.filter((item) => item.status !== \"private\" && item.status !== \"stale\" && item.status !== \"error\").length;\n const out: string[] = [`${reports} public packages with a report of the API, ${by(\"private\").length} private packages without a report.`];\n const list = (title: string, items: readonly PackageResult[], line: (item: PackageResult) => string): void => {\n if (items.length === 0) return;\n out.push(`${title}:`);\n for (const item of items) out.push(` ${line(item)}`);\n };\n const update = result.mode === \"update\";\n list(update ? \"Written\" : \"The report differs from the built .d.ts files\", by(\"changed\"), (item) => item.file);\n list(update ? \"Written (new)\" : \"No report\", by(\"new\"), (item) => (update ? item.file : `${item.folder} (${item.file})`));\n list(update ? \"Removed (the package is private)\" : \"A report of a private package\", by(\"stale\"), (item) => item.file);\n list(\"Errors\", by(\"error\"), (item) => `${item.folder}: ${item.error ?? \"unknown error\"}`);\n let text = `${out.join(\"\\n\")}\\n`;\n if (!update) {\n for (const item of by(\"changed\")) text += `\\n${shortDiff(item.diff ?? \"\")}`;\n if (by(\"changed\").length + by(\"new\").length + by(\"stale\").length > 0) {\n text += `\\nTo accept a change of the API, start the build, then \\`${tool} update\\`, review the diff, and commit the reports.\\n`;\n }\n }\n return text;\n}\n\n/** This function gives the result as Markdown for the summary of a GitHub Actions run. It gives an empty string when all reports are current. */\nexport function summaryMarkdown(result: RunResult): string {\n const changed = result.packages.filter((item) => item.status === \"changed\" || item.status === \"new\");\n const other = result.packages.filter((item) => item.status === \"stale\" || item.status === \"error\");\n if (changed.length === 0 && other.length === 0) return \"\";\n const out = [\"### Public API reports\", \"\"];\n for (const item of changed) out.push(`<details><summary><code>${item.file}</code> (${item.status})</summary>`, \"\", \"```diff\", shortDiff(item.diff ?? \"\").replace(/\\n$/, \"\"), \"```\", \"\", \"</details>\", \"\");\n for (const item of other) out.push(`- \\`${item.file}\\`: ${item.status === \"stale\" ? \"a report of a private package\" : (item.error ?? \"error\")}`);\n return `${out.join(\"\\n\")}\\n`;\n}\n\n/** The input and output of `runCli`. */\nexport interface CliIo {\n readonly cwd: string;\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\n/** The help text of the bin. */\nexport const USAGE: string = `Usage: api-report <check | update> [options] [<package folder>...]\n\n check Compare each report with the built .d.ts files. Exit code 1 when a report differs or is missing.\n update Write each report again.\n\n --root <folder> The root of the repository. The default is the current folder.\n --packages <glob> A glob of package folders. Use it again for more globs. The default is the globs of the workspace.\n --report <path> The path of the report in each package folder. The default is ${REPORT_FILE}.\n --include-private Also make a report for each private package.\n --no-publish-config Read the fields of package.json without publishConfig.\n -h, --help Show this text.\n\nThe field \"apiReport\" of the root package.json can set packages, report, includePrivate, publishConfig and tool.\n`;\n\n/** An error of the arguments: exit code 2 and the help text. */\nclass UsageError extends Error {}\n\n/** This function starts the bin with the arguments `args`, and gives its exit code. */\nexport function runCli(args: readonly string[], io: CliIo): number {\n let mode: Mode | undefined;\n let root = io.cwd;\n const packages: string[] = [];\n const folders: string[] = [];\n const flags: { report?: string; includePrivate?: boolean; publishConfig?: boolean } = {};\n for (let index = 0; index < args.length; index++) {\n const arg = args[index] ?? \"\";\n const value = (): string => {\n const next = args[++index];\n if (next === undefined || next.startsWith(\"-\")) throw new UsageError(`The option ${arg} needs a value.`);\n return next;\n };\n try {\n if (arg === \"check\" || arg === \"--check\") mode = \"check\";\n else if (arg === \"update\" || arg === \"--update\") mode = \"update\";\n else if (arg === \"--root\") root = resolve(io.cwd, value());\n else if (arg === \"--packages\") packages.push(value());\n else if (arg === \"--report\") flags.report = value();\n else if (arg === \"--include-private\") flags.includePrivate = true;\n else if (arg === \"--no-publish-config\") flags.publishConfig = false;\n else if (arg === \"--help\" || arg === \"-h\") {\n io.stdout(USAGE);\n return 0;\n } else if (arg.startsWith(\"-\")) throw new UsageError(`An unknown option: ${arg}`);\n else folders.push(arg);\n } catch (error) {\n if (!(error instanceof UsageError)) throw error;\n io.stderr(`api-report: ${error.message}\\n\\n${USAGE}`);\n return 2;\n }\n }\n if (mode === undefined) {\n io.stderr(`api-report: give the command check or update.\\n\\n${USAGE}`);\n return 2;\n }\n let result: RunResult;\n let tool: string;\n try {\n const config = readConfig(root);\n tool = config.tool ?? DEFAULT_TOOL;\n result = runReports({\n ...config,\n ...flags,\n ...(packages.length > 0 ? { packages } : {}),\n mode,\n root,\n folders: folders.map((folder) => resolve(io.cwd, folder)),\n });\n } catch (error) {\n io.stderr(`api-report: ${error instanceof Error ? error.message : String(error)}\\n`);\n return 1;\n }\n io.stdout(formatResult(result, tool));\n const summary = io.env[\"GITHUB_STEP_SUMMARY\"];\n if (summary && mode === \"check\") {\n const markdown = summaryMarkdown(result);\n if (markdown !== \"\") appendFileSync(summary, markdown);\n }\n return result.failed ? 1 : 0;\n}\n"],"mappings":";;;AAqDA,MAAM,eAAe;;;;;AAMrB,SAAgB,aAAa,QAA0B;CAErD,MAAM,OAAO,OAAO,QAAQ,UAAU,IAAI,CAAC,CAAC,QAAQ,gBAAgB,EAAE;CACtE,MAAM,aAAuB,CAAC;CAC9B,IAAI,UAAU;CACd,IAAI,QAAQ;CAEZ,IAAI,QAAQ;CAEZ,IAAI,OAAO;CAEX,MAAM,QAAgB,CAAC;CAEvB,MAAM,eAAqB;EACzB,MAAM,QAAQ,QACX,MAAM,IAAI,CAAC,CACX,KAAK,SAAS,KAAK,QAAQ,CAAC,CAAC,CAC7B,QAAQ,SAAS,KAAK,KAAK,MAAM,EAAE;EACtC,IAAI,MAAM,SAAS,GAAG,WAAW,KAAK,MAAM,KAAK,IAAI,CAAC;EACtD,UAAU;EACV,QAAQ;EACR,OAAO;CACT;CAEA,IAAI,QAAQ;CACZ,OAAO,QAAQ,KAAK,QAAQ;EAC1B,MAAM,OAAO,KAAK,OAAO,KAAK;EAC9B,MAAM,OAAO,KAAK,OAAO,QAAQ,CAAC;EAClC,MAAM,OAAO,MAAM,GAAG,EAAE;EACxB,IAAI,MAAM,SAAS,YAAY;GAC7B,IAAI,SAAS,MAAM;IACjB,WAAW,OAAO;IAClB,SAAS;GACX,OAAO,IAAI,SAAS,KAAK;IACvB,MAAM,IAAI;IACV,WAAW;IACX;GACF,OAAO,IAAI,SAAS,OAAO,SAAS,KAAK;IACvC,MAAM,KAAK;KAAE,MAAM;KAAQ;IAAM,CAAC;IA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