@arcgis/api-extractor 5.0.0-next.61 → 5.0.0-next.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +14 -0
- package/dist/diffTypes/index.d.ts +24 -0
- package/dist/diffTypes/index.js +65 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/utils/error.d.ts +2 -1
- package/package.json +10 -4
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command as i } from "@commander-js/extra-typings";
|
|
3
|
+
const e = new i();
|
|
4
|
+
e.name("api-extractor").description("Extract public API from a TypeScript project to produce .d.ts types and api.json docs");
|
|
5
|
+
e.command("diff-types").description("Generate a types diff summary .md file").requiredOption("--original-dts <originalTypings>", "Path to the original types folder").requiredOption("--new-dts <newTypings>", "Path to the new types folder").option("--output-md <outputMd>", "Path to the output markdown file", "types-diff.md").option("--no-truncate", "Do not truncate output if it is longer than 1000 lines", !1).action(async (t) => {
|
|
6
|
+
const { diffTypes: o } = await import("./diffTypes/index.js");
|
|
7
|
+
await o({
|
|
8
|
+
originalDtsPath: t.originalDts,
|
|
9
|
+
newDtsPath: t.newDts,
|
|
10
|
+
outputMdPath: t.outputMd,
|
|
11
|
+
truncate: t.truncate
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
e.parse();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface DiffTypesOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Path to the original types folder.
|
|
4
|
+
*/
|
|
5
|
+
originalDtsPath: string;
|
|
6
|
+
/**
|
|
7
|
+
* Path to the new types folder.
|
|
8
|
+
*/
|
|
9
|
+
newDtsPath: string;
|
|
10
|
+
/**
|
|
11
|
+
* Path to the output markdown file.
|
|
12
|
+
*
|
|
13
|
+
* @default "types-diff.md"
|
|
14
|
+
*/
|
|
15
|
+
outputMdPath: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to truncate output if the diff is longer than 1000 lines.
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
truncate?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function diffTypes({ originalDtsPath, newDtsPath, outputMdPath, truncate, }: DiffTypesOptions): Promise<void>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { path as s, sh as c } from "@arcgis/components-build-utils";
|
|
2
|
+
import { mkdir as d, writeFile as m } from "node:fs/promises";
|
|
3
|
+
const a = "diff --unified=2 --new-file --recursive";
|
|
4
|
+
async function I({
|
|
5
|
+
originalDtsPath: t,
|
|
6
|
+
newDtsPath: n,
|
|
7
|
+
outputMdPath: e = "types-diff.md",
|
|
8
|
+
truncate: i = !0
|
|
9
|
+
}) {
|
|
10
|
+
n = s.join(s.resolve(n), "/");
|
|
11
|
+
const l = c(`${a} ${t} ${n} || true`);
|
|
12
|
+
let o = "";
|
|
13
|
+
if (l.length === 0)
|
|
14
|
+
console.log("Public types did not change.");
|
|
15
|
+
else {
|
|
16
|
+
o = `### Public types changes
|
|
17
|
+
|
|
18
|
+
🧐 please verify that the changes to the public API/doc below are intentional.
|
|
19
|
+
🟥 If removing/changing APIs, remember the semver promise.
|
|
20
|
+
🟩 If adding APIs, add to release notes.`;
|
|
21
|
+
let r = u(l.split(`
|
|
22
|
+
`), n);
|
|
23
|
+
i && r.length > f && (o += `> [!WARNING]
|
|
24
|
+
> Too many changes. Only displaying the first ${f} lines (total ${r.length}) of the diff. If you need to see complete diff, re-run this command with --no-truncate.
|
|
25
|
+
|
|
26
|
+
`, r = r.slice(0, f)), o += `${h(r)}
|
|
27
|
+
|
|
28
|
+
`, console.log(`Wrote diff to ${e}`);
|
|
29
|
+
}
|
|
30
|
+
await d(s.dirname(e), { recursive: !0 }), await m(e, o);
|
|
31
|
+
}
|
|
32
|
+
function u(t, n) {
|
|
33
|
+
for (let e = 0; e < t.length; e++) {
|
|
34
|
+
const i = t[e];
|
|
35
|
+
if (
|
|
36
|
+
// Make diff smaller by excluding the `diff ...` lines
|
|
37
|
+
(i.startsWith(a) || // Redundant line - make file header smaller
|
|
38
|
+
i.startsWith("---") || // Not important
|
|
39
|
+
i === "\") && (t.splice(e, 1), e--), i.startsWith("+++")
|
|
40
|
+
) {
|
|
41
|
+
const l = i.indexOf(" ");
|
|
42
|
+
let o = i.slice(4, l === -1 ? i.length : l);
|
|
43
|
+
o.startsWith(n) && (o = o.slice(n.length)), t[e] = `🟦 ${o}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
}
|
|
48
|
+
const f = 1e3;
|
|
49
|
+
function h(t) {
|
|
50
|
+
const n = t.length, e = g(t.join(`
|
|
51
|
+
`));
|
|
52
|
+
return n <= 10 ? e : `<details><summary>See diff</summary>
|
|
53
|
+
|
|
54
|
+
${e}
|
|
55
|
+
|
|
56
|
+
</details>`;
|
|
57
|
+
}
|
|
58
|
+
function g(t) {
|
|
59
|
+
return `\`\`\`diff
|
|
60
|
+
${t}
|
|
61
|
+
\`\`\``;
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
I as diffTypes
|
|
65
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export { apiMemberToNodeDoc, nodeDocToString, nodeDocToSynthesizedComment } from
|
|
|
9
9
|
export { setApiDocFromJsDoc, setApiDocFromSymbol, symbolToDocs, getNodeDoc } from './utils/jsDocParser';
|
|
10
10
|
export { typeScriptGlobals, typeScriptGlobalsViewUrlCommonPrefix } from './config/typeReferences/globals';
|
|
11
11
|
export { printClass, printInterface, printMethod, printFunction, printSignature, printProperty, printGetterSetter, printVariable, printTypeAlias, printTypeParameters, } from './utils/partPrinter';
|
|
12
|
-
export { apiExtractorError, apiExtractorErrorCount, resetApiExtractorErrorCount, setApiExtractorErrorLogger, type ApiExtractorErrorContext, } from './utils/error';
|
|
12
|
+
export { apiExtractorError, apiExtractorErrorCount, resetApiExtractorErrorCount, setApiExtractorErrorLogger, apiExtractorDiagnosticContext, type ApiExtractorErrorContext, } from './utils/error';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import d from "typescript";
|
|
|
2
2
|
import $, { supportsColorStderr as z } from "chalk";
|
|
3
3
|
import { path as q } from "@arcgis/components-build-utils";
|
|
4
4
|
import { mappedFind as J } from "@arcgis/toolkit/array";
|
|
5
|
-
const H = "@arcgis/api-extractor", j = "5.0.0-next.
|
|
5
|
+
const H = "@arcgis/api-extractor", j = "5.0.0-next.63";
|
|
6
6
|
let A;
|
|
7
7
|
function X(e) {
|
|
8
8
|
return A ??= d.createPrinter(), A.printNode(d.EmitHint.Unspecified, e, void 0);
|
|
@@ -11,8 +11,8 @@ function Q(e, t) {
|
|
|
11
11
|
return e.pos !== -1 && e.end !== -1 && t !== void 0 ? e.getText(t) : X(e);
|
|
12
12
|
}
|
|
13
13
|
let N = 0;
|
|
14
|
-
function Re() {
|
|
15
|
-
N =
|
|
14
|
+
function Re(e = 0) {
|
|
15
|
+
N = e;
|
|
16
16
|
}
|
|
17
17
|
let B = console.error;
|
|
18
18
|
function Le(e) {
|
|
@@ -766,6 +766,7 @@ function ot(e, t, n, o) {
|
|
|
766
766
|
export {
|
|
767
767
|
Ne as ApiExtractor,
|
|
768
768
|
O as alternativeDocumentationHost,
|
|
769
|
+
Y as apiExtractorDiagnosticContext,
|
|
769
770
|
g as apiExtractorError,
|
|
770
771
|
N as apiExtractorErrorCount,
|
|
771
772
|
T as apiExtractorJsDocError,
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as ts } from 'typescript';
|
|
2
2
|
export declare let apiExtractorErrorCount: number;
|
|
3
|
-
export declare function resetApiExtractorErrorCount(): void;
|
|
3
|
+
export declare function resetApiExtractorErrorCount(newCount?: number): void;
|
|
4
4
|
export declare function setApiExtractorErrorLogger(logger: (msg: string) => void): void;
|
|
5
5
|
export interface ApiExtractorErrorContext {
|
|
6
6
|
file: ts.SourceFile | undefined;
|
|
@@ -9,6 +9,7 @@ export interface ApiExtractorErrorContext {
|
|
|
9
9
|
start?: number;
|
|
10
10
|
length?: number;
|
|
11
11
|
}
|
|
12
|
+
export declare const apiExtractorDiagnosticContext: ts.FormatDiagnosticsHost;
|
|
12
13
|
/**
|
|
13
14
|
* Produce an error message in the style of TypeScript compiler errors.
|
|
14
15
|
* Error message includes code snippet when possible.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/api-extractor",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -8,18 +8,24 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/index.js",
|
|
10
10
|
"./diff": "./dist/diff/index.js",
|
|
11
|
+
"./diffTypes": "./dist/diffTypes/index.js",
|
|
11
12
|
"./uiUtils": "./dist/uiUtils/index.js",
|
|
12
13
|
"./package.json": "./package.json"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"dist/"
|
|
16
17
|
],
|
|
18
|
+
"bin": "./dist/cli.js",
|
|
17
19
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@arcgis/components-build-utils": "5.0.0-next.
|
|
20
|
-
"@arcgis/toolkit": "5.0.0-next.
|
|
21
|
+
"@arcgis/components-build-utils": "5.0.0-next.63",
|
|
22
|
+
"@arcgis/toolkit": "5.0.0-next.63",
|
|
23
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
21
24
|
"chalk": "^5.4.1",
|
|
22
|
-
"
|
|
25
|
+
"commander": "^14.0.0",
|
|
26
|
+
"tslib": "^2.8.1"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
23
29
|
"typescript": "~5.9.3"
|
|
24
30
|
}
|
|
25
31
|
}
|