@arcgis/api-extractor 5.0.0-next.17 → 5.0.0-next.170

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.
Files changed (61) hide show
  1. package/README.md +2 -3
  2. package/dist/ApiExtractor-nkPAVjKb.js +2664 -0
  3. package/dist/apiHelpers-BYzO767m.js +161 -0
  4. package/dist/apiJson.d.ts +783 -1011
  5. package/dist/cli-7PX_wNxb.js +34 -0
  6. package/dist/cli.js +57 -0
  7. package/dist/compilerHints.d.ts +62 -0
  8. package/dist/diff/apiDiffToMarkdown.d.ts +9 -0
  9. package/dist/diff/apiDiffToMarkdown.js +140 -0
  10. package/dist/diff/diffApiJson.d.ts +26 -3
  11. package/dist/diff/diffApiJson.js +260 -0
  12. package/dist/diff/fetchApiJsonFromNpm.d.ts +5 -2
  13. package/dist/diff/fetchApiJsonFromNpm.js +9 -0
  14. package/dist/diff/types.d.ts +81 -49
  15. package/dist/diffTypes/index.d.ts +21 -0
  16. package/dist/diffTypes/index.js +71 -0
  17. package/dist/extractor/ApiExtractor.d.ts +66 -0
  18. package/dist/extractor/ApiExtractor.js +9 -0
  19. package/dist/extractor/config.d.ts +486 -0
  20. package/dist/extractor/config.js +18 -0
  21. package/dist/extractor/extractors/copyDoc.d.ts +25 -0
  22. package/dist/extractor/processing/links.d.ts +15 -0
  23. package/dist/extractor/processing/links.js +172 -0
  24. package/dist/extractor/types.d.ts +19 -0
  25. package/dist/extractor/webComponent/findComponents.d.ts +19 -0
  26. package/dist/extractor/webComponent/findComponents.js +36 -0
  27. package/dist/extractor/webComponent/pathMapping.d.ts +11 -0
  28. package/dist/extractor/webComponent/pathMapping.js +44 -0
  29. package/dist/index.d.ts +164 -8
  30. package/dist/index.js +3 -283
  31. package/dist/typeScript-DMWUxd36.js +64 -0
  32. package/dist/uiUtils/index.d.ts +12 -0
  33. package/dist/uiUtils/index.js +5 -0
  34. package/dist/utils/apiHelpers.d.ts +43 -17
  35. package/dist/utils/apiHelpers.js +17 -0
  36. package/dist/utils/astHelpers.d.ts +24 -11
  37. package/dist/utils/astHelpers.js +67 -0
  38. package/dist/utils/createIndex.d.ts +30 -0
  39. package/dist/utils/createIndex.js +83 -0
  40. package/dist/utils/hydrateApiType.d.ts +26 -0
  41. package/dist/utils/hydrateApiType.js +62 -0
  42. package/dist/utils/inferEntrypoints.d.ts +17 -0
  43. package/dist/utils/inferEntrypoints.js +26 -0
  44. package/dist/utils/internalTypeScriptApis.d.ts +92 -0
  45. package/dist/utils/internalTypeScriptApis.js +58 -0
  46. package/dist/utils/partPrinter.d.ts +29 -0
  47. package/dist/utils/partPrinter.js +82 -0
  48. package/dist/vite/plugin.d.ts +53 -0
  49. package/dist/vite/plugin.js +107 -0
  50. package/dist/vite/typeScript.d.ts +16 -0
  51. package/dist/vite/typeScript.js +6 -0
  52. package/dist/worker-BkDzhZMK.js +3680 -0
  53. package/package.json +49 -5
  54. package/dist/diff/index.d.ts +0 -3
  55. package/dist/diff/index.js +0 -147
  56. package/dist/ensureValidType.d.ts +0 -1
  57. package/dist/extractor/index.d.ts +0 -46
  58. package/dist/types.d.ts +0 -25
  59. package/dist/utils/docHelpers.d.ts +0 -9
  60. package/dist/utils/error.d.ts +0 -12
  61. package/dist/utils/print.d.ts +0 -7
@@ -1,66 +1,98 @@
1
- import { ApiClassDeclaration, ApiClassField, ApiClassMethod, ApiCustomElementDeclaration, ApiFunctionDeclaration, ApiModule, ApiVariableDeclaration } from '../apiJson';
1
+ import type { ApiClassCallSignature, ApiClassConstructor, ApiClassDeclaration, ApiClassField, ApiClassMethod, ApiCustomElementDeclaration, ApiFunctionDeclaration, ApiInterfaceDeclaration, ApiMixinDeclaration, ApiModule, ApiVariableDeclaration } from "../apiJson.js";
2
+
2
3
  export interface ApiDiff {
3
- modules: ApiModuleDiff[];
4
+ modules: ApiModuleDiff[];
4
5
  }
6
+
5
7
  export interface ApiModuleDiff {
6
- path: ApiModule["path"];
7
- declarations: ApiDeclarationDiff[];
8
+ path: ApiModule["path"];
9
+ declarations: ApiDeclarationDiff[];
8
10
  }
11
+
9
12
  export interface ApiDiffBase {
10
- name: string;
11
- /**
12
- * True if this declaration was removed in the new api.json.
13
- * If class is removed, members are not listed.
14
- * @default false
15
- */
16
- removed?: true;
17
- /**
18
- * True if this declaration was added in the new api.json.
19
- * If class is added, members are not listed.
20
- *
21
- * @default false
22
- */
23
- added?: true;
24
- /**
25
- * Whether this declaration is deprecated in the new api.json, regardless of
26
- * whether it was deprecated in the old api.json.
27
- * If the value is a string, it's the reason for the deprecation.
28
- * Deprecated takes precedence over added.
29
- *
30
- * @default false
31
- */
32
- deprecated?: boolean | string;
13
+ name: string;
14
+ /**
15
+ * True if this declaration was removed in the new api.json.
16
+ * If class is removed, members are not listed.
17
+ *
18
+ * @default false
19
+ */
20
+ removed?: true;
21
+ /**
22
+ * True if this declaration was added in the new api.json.
23
+ * If class is added, members are not listed.
24
+ *
25
+ * @default false
26
+ */
27
+ added?: true;
28
+ /**
29
+ * Whether this declaration is deprecated in the new api.json. If declaration
30
+ * was removed, but was deprecated in the old api.json, this will show the old
31
+ * deprecation message as it points at the replacement API.
32
+ * If the value is a string, it's the reason for the deprecation.
33
+ * Deprecated takes precedence over added.
34
+ *
35
+ * @default false
36
+ */
37
+ deprecated?: boolean | string;
33
38
  }
34
- export type ApiDeclarationDiff = ApiClassDeclarationDiff | ApiCustomElementDeclarationDiff | ApiFunctionDeclarationDiff | ApiVariableDeclarationDiff;
39
+
40
+ export type ApiDeclarationDiff = ApiClassDeclarationDiff | ApiCustomElementDeclarationDiff | ApiFunctionDeclarationDiff | ApiInterfaceDeclarationDiff | ApiMixinDeclarationDiff | ApiVariableDeclarationDiff;
41
+
35
42
  export interface ApiClassDeclarationDiff extends ApiDiffBase {
36
- kind: ApiClassDeclaration["kind"];
37
- /**
38
- * Inherited members are not included in the diff.
39
- * Also, if entire class is added/removed, members are not included in the diff.
40
- */
41
- members?: ApiClassMemberDiff[];
42
- events?: ApiDiffBase[];
43
+ kind: ApiClassDeclaration["kind"];
44
+ /**
45
+ * Inherited members are not included in the diff.
46
+ * Also, if entire class is added/removed, members are not included in the diff.
47
+ */
48
+ members?: ApiClassMemberDiff[];
49
+ events?: ApiDiffBase[];
43
50
  }
51
+
52
+ export interface ApiInterfaceDeclarationDiff extends ApiDiffBase {
53
+ kind: ApiInterfaceDeclaration["kind"];
54
+ /**
55
+ * Inherited members are not included in the diff.
56
+ * Also, if entire class is added/removed, members are not included in the diff.
57
+ */
58
+ members?: ApiClassMemberDiff[];
59
+ }
60
+
61
+ export interface ApiMixinDeclarationDiff extends Omit<ApiClassDeclarationDiff, "kind"> {
62
+ kind: ApiMixinDeclaration["kind"];
63
+ }
64
+
44
65
  export interface ApiCustomElementDeclarationDiff extends ApiClassDeclarationDiff {
45
- /**
46
- * Attributes diff is not included as attributes are based on members.
47
- */
48
- tagName: ApiCustomElementDeclaration["tagName"];
49
- slots?: ApiDiffBase[];
50
- cssParts?: ApiDiffBase[];
51
- cssProperties?: ApiDiffBase[];
52
- cssStates?: ApiDiffBase[];
66
+ /** Attributes diff is not included as attributes are based on members. */
67
+ tagName: ApiCustomElementDeclaration["tagName"];
68
+ slots?: ApiDiffBase[];
69
+ cssParts?: ApiDiffBase[];
70
+ cssProperties?: ApiDiffBase[];
71
+ cssStates?: ApiDiffBase[];
53
72
  }
54
- export type ApiClassMemberDiff = ApiClassFieldDiff | ApiClassMethodDiff;
73
+
74
+ export type ApiClassMemberDiff = ApiClassCallSignatureDiff | ApiClassConstructorDiff | ApiClassFieldDiff | ApiClassMethodDiff;
75
+
55
76
  export interface ApiClassFieldDiff extends ApiDiffBase {
56
- kind: ApiClassField["kind"];
77
+ kind: ApiClassField["kind"];
57
78
  }
79
+
58
80
  export interface ApiClassMethodDiff extends ApiDiffBase {
59
- kind: ApiClassMethod["kind"];
81
+ kind: ApiClassMethod["kind"];
82
+ }
83
+
84
+ export interface ApiClassConstructorDiff extends Omit<ApiDiffBase, "name"> {
85
+ kind: ApiClassConstructor["kind"];
60
86
  }
87
+
88
+ export interface ApiClassCallSignatureDiff extends Omit<ApiDiffBase, "name"> {
89
+ kind: ApiClassCallSignature["kind"];
90
+ }
91
+
61
92
  export interface ApiFunctionDeclarationDiff extends ApiDiffBase {
62
- kind: ApiFunctionDeclaration["kind"];
93
+ kind: ApiFunctionDeclaration["kind"];
63
94
  }
95
+
64
96
  export interface ApiVariableDeclarationDiff extends ApiDiffBase {
65
- kind: ApiVariableDeclaration["kind"];
66
- }
97
+ kind: ApiVariableDeclaration["kind"];
98
+ }
@@ -0,0 +1,21 @@
1
+ export interface DiffTypesOptions {
2
+ /** Path to the original types folder. */
3
+ originalDtsPath: string;
4
+ /** Path to the new types folder. */
5
+ newDtsPath: string;
6
+ /**
7
+ * Path to the output markdown file.
8
+ *
9
+ * @default "types-diff.md"
10
+ */
11
+ outputMdPath: string;
12
+ /**
13
+ * Whether to truncate output if the diff is longer than 1000 lines.
14
+ *
15
+ * @default true
16
+ */
17
+ truncate?: boolean;
18
+ }
19
+
20
+ /** @param options */
21
+ export function diffTypes(options: DiffTypesOptions): Promise<void>;
@@ -0,0 +1,71 @@
1
+ import { path as s } from "@arcgis/components-build-utils";
2
+ import { execSync as c } from "node:child_process";
3
+ import { mkdir as m, writeFile as d } from "node:fs/promises";
4
+ const a = "diff --new-file --recursive", u = `${a} --unified=2`;
5
+ async function b({
6
+ originalDtsPath: t,
7
+ newDtsPath: n,
8
+ outputMdPath: e = "types-diff.md",
9
+ truncate: i = !0
10
+ }) {
11
+ n = s.join(s.resolve(n), "/");
12
+ const r = c(`${u} ${t} ${n} || true`, {
13
+ encoding: "utf8",
14
+ maxBuffer: 1024 * 1024 * 20
15
+ }).trim();
16
+ let o = "";
17
+ if (r.length === 0)
18
+ console.log("Public types did not change.");
19
+ else {
20
+ o = `### Public types changes
21
+
22
+ 🧐 please verify that the changes to the public API/doc below are intentional.
23
+ 🟥 If removing/changing APIs, remember the semver promise.
24
+ 🟩 If adding APIs, add to release notes.
25
+
26
+ `;
27
+ let f = g(r.split(`
28
+ `), n);
29
+ i && f.length > l && (o += `> [!WARNING]
30
+ > Too many changes. Only displaying the first ${l} lines (total ${f.length}) of the diff. If you need to see complete diff, re-run this command with --no-truncate.
31
+
32
+ `, f = f.slice(0, l)), o += `${h(f)}
33
+
34
+ `, console.log(`Wrote diff to ${e}`);
35
+ }
36
+ await m(s.dirname(e), { recursive: !0 }), await d(e, o);
37
+ }
38
+ function g(t, n) {
39
+ for (let e = 0; e < t.length; ++e) {
40
+ const i = t[e];
41
+ if (
42
+ // Make diff smaller by excluding the `diff ...` lines
43
+ (i.startsWith(a) || // Redundant line - make file header smaller
44
+ i.startsWith("---") || // Not important
45
+ i === "\") && (t.splice(e, 1), e--), i.startsWith("+++")
46
+ ) {
47
+ const r = i.indexOf(" ");
48
+ let o = i.slice(4, r === -1 ? i.length : r);
49
+ o.startsWith(n) && (o = o.slice(n.length)), t[e] = `🟦 ${o}`;
50
+ }
51
+ }
52
+ return t;
53
+ }
54
+ const l = 1e3;
55
+ function h(t) {
56
+ const n = t.length, e = p(t.join(`
57
+ `));
58
+ return n <= 10 ? e : `<details><summary>See diff</summary>
59
+
60
+ ${e}
61
+
62
+ </details>`;
63
+ }
64
+ function p(t) {
65
+ return `\`\`\`diff
66
+ ${t}
67
+ \`\`\``;
68
+ }
69
+ export {
70
+ b as diffTypes
71
+ };
@@ -0,0 +1,66 @@
1
+ import type ts from "typescript";
2
+ import type { ApiExtractorConfig, ResolvedApiExtractorConfig } from "./config.js";
3
+ import type { ApiExtractorResult, ApiExtractorWatcher } from "./types.js";
4
+
5
+ /**
6
+ * ApiExtractor's main JavaScript entrypoint.
7
+ *
8
+ * @example
9
+ * ```js
10
+ *
11
+ * import { loadApiExtractorConfig, mergeApiExtractorConfigs } from "@arcgis/api-extractor/extractor/config";
12
+ * import { ApiExtractor } from "@arcgis/api-extractor/extractor/ApiExtractor";
13
+ *
14
+ * const baseConfig = await loadApiExtractorConfig(process.cwd(), "api-extractor.config.ts");
15
+ *
16
+ * // Optionally override parts of the config
17
+ * const mergedConfig = mergeApiExtractorConfigs(baseConfig, {
18
+ * types: {
19
+ * fullTypeCheck: true,
20
+ * },
21
+ * });
22
+ *
23
+ * const extractor = new ApiExtractor(mergedConfig);
24
+ *
25
+ * const { apiJson, dtsFiles } = await extractor.run();
26
+ * // OR, start a watcher:
27
+ * const watcher = await extractor.watch();
28
+ * ```
29
+ */
30
+ export class ApiExtractor {
31
+ constructor(rawConfig?: ApiExtractorConfig);
32
+ readonly config: ResolvedApiExtractorConfig;
33
+ /**
34
+ * Number of errors logged during the extraction process.
35
+ * Errors will be logged using the `config.logger.error` callback if provided.
36
+ * Otherwise, they will be logged using `console.error`.
37
+ *
38
+ * @default 0
39
+ */
40
+ errorCount: number;
41
+ /**
42
+ * If doing typed extraction or full type check, this will be the ts.Program.
43
+ * If doing untyped watch, this will be a minimal Program-like object to reuse
44
+ * SourceFiles for unchanged files.
45
+ * Otherwise, undefined.
46
+ */
47
+ program?: {
48
+ getSourceFile: ts.Program["getSourceFile"];
49
+ getSourceFiles: ts.Program["getSourceFiles"];
50
+ getTypeChecker?: ts.Program["getTypeChecker"];
51
+ };
52
+ /**
53
+ * @deprecated
54
+ * @default 0
55
+ */
56
+ silencedBrokenLinkCount: number;
57
+ /** The high-level API for running the extractor on the current project. */
58
+ run(): Promise<ApiExtractorResult>;
59
+ /**
60
+ * The high-level API for starting a watch-mode extraction on the current project.
61
+ * When watching, double check that the configuration options the ApiExtractor
62
+ * was created with are appropriate for watch mode (disable full type check
63
+ * and type verifier if not necessary).
64
+ */
65
+ watch(): Promise<ApiExtractorWatcher>;
66
+ }
@@ -0,0 +1,9 @@
1
+ import "../typeScript-DMWUxd36.js";
2
+ import "../worker-BkDzhZMK.js";
3
+ import "./processing/links.js";
4
+ import "typescript";
5
+ import { A as x } from "../ApiExtractor-nkPAVjKb.js";
6
+ import "@arcgis/toolkit/function";
7
+ export {
8
+ x as ApiExtractor
9
+ };