@arcgis/api-extractor 4.33.0-next.9 → 4.33.0-next.91

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/apiJson.d.ts CHANGED
@@ -817,16 +817,15 @@ export type ApiCustomElementField = ApiClassField & {
817
817
  */
818
818
  docsTags?: ApiDocsTag[];
819
819
  /**
820
- * Whether field has both getter and setter, and their types are different.
821
- * The actual getter type is not included in the api.json at the moment, but
822
- * can be added if that information is needed.
820
+ * If getter type differs from setter type, this property will
821
+ * contain the getter type.
823
822
  *
824
- * @default false
823
+ * @default undefined
825
824
  *
826
825
  * @remarks
827
826
  * Not present in vanilla custom-elements-manifest.
828
827
  */
829
- getterTypeDiffers?: boolean;
828
+ getterType?: Pick<ApiType, "text">;
830
829
  /**
831
830
  * For some properties, we show them as read-only in the docs and in the
832
831
  * typings but don't actually enforce read-only at runtime.
@@ -1,5 +1,5 @@
1
- import type { ApiDeclaration, ApiExport, ApiJson, ApiModule } from "../apiJson";
2
- import ts from "typescript";
1
+ import { ApiDeclaration, ApiExport, ApiJson, ApiModule } from '../apiJson';
2
+ import { default as ts } from 'typescript';
3
3
  export type ApiExtractorOptions = {
4
4
  /**
5
5
  * Whether to extract full API information, with type-checking. This should be
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { ApiExtractor, type ApiExtractorOptions } from "./extractor";
2
- export type * from "./apiJson";
3
- export { hasIgnoredModifier, setDefaultFromInitializer, getMemberName } from "./utils/astHelpers";
4
- export { isApiMethod, isApiProperty, globalPackageIdentifier } from "./utils/apiHelpers";
1
+ export { ApiExtractor, type ApiExtractorOptions } from './extractor';
2
+ export type * from './apiJson';
3
+ export { hasIgnoredModifier, setDefaultFromInitializer, getMemberName } from './utils/astHelpers';
4
+ export { isApiMethod, isApiProperty, globalPackageIdentifier } from './utils/apiHelpers';
package/dist/index.js CHANGED
@@ -1,141 +1,95 @@
1
- // package.json
2
- var name = "@arcgis/api-extractor";
3
- var version = "4.33.0-next.9";
4
-
5
- // src/extractor/index.ts
6
- import ts from "typescript";
7
-
8
- // src/utils/apiHelpers.ts
9
- var isApiMethod = (member) => member.kind === "method";
10
- var isApiProperty = (member) => member.kind === "field";
11
- function naturalSortModules(left, right) {
12
- const leftSplit = left.path.split("/");
13
- const leftName = leftSplit.pop();
14
- const leftDirectories = leftSplit.join("/");
15
- const rightSplit = right.path.split("/");
16
- const rightName = rightSplit.pop();
17
- const rightDirectories = rightSplit.join("/");
18
- if (leftDirectories === rightDirectories) {
19
- return leftName < rightName ? -1 : 1;
20
- } else if (leftDirectories.startsWith(rightDirectories)) {
21
- return 1;
22
- } else if (rightDirectories.startsWith(leftDirectories)) {
23
- return -1;
24
- } else {
25
- return leftDirectories < rightDirectories ? -1 : 1;
26
- }
1
+ import o from "typescript";
2
+ import { path as d } from "@arcgis/components-build-utils";
3
+ const p = "@arcgis/api-extractor", f = "4.33.0-next.91", g = (t) => t.kind === "method", S = (t) => t.kind === "field";
4
+ function u(t, i) {
5
+ const e = t.path.split("/"), r = e.pop(), s = e.join("/"), a = i.path.split("/"), l = a.pop(), n = a.join("/");
6
+ return s === n ? r < l ? -1 : 1 : s.startsWith(n) ? 1 : n.startsWith(s) || s < n ? -1 : 1;
27
7
  }
28
- var globalPackageIdentifier = "global:";
29
-
30
- // src/extractor/index.ts
31
- import { path } from "@arcgis/components-build-utils";
32
- var ApiExtractor = class {
33
- constructor(options) {
34
- this.options = options;
8
+ const k = "global:";
9
+ class y {
10
+ constructor(i) {
11
+ this.options = i;
35
12
  }
36
13
  /** Given an array of TypeScript source files, generate an api.json file */
37
- extract(files) {
14
+ extract(i) {
38
15
  return {
39
16
  timestamp: (/* @__PURE__ */ new Date()).toISOString().split(".")[0],
40
17
  compiler: {
41
- name,
42
- version,
43
- typescriptVersion: ts.version
18
+ name: p,
19
+ version: f,
20
+ typescriptVersion: o.version
44
21
  },
45
22
  schemaVersion: "1.0.0",
46
- modules: this.extractModules(files)
23
+ modules: this.extractModules(i)
47
24
  };
48
25
  }
49
- extractModules(files) {
50
- const modules = [];
51
- for (const file of files) {
52
- this.file = file;
53
- modules.push(this.extractModule(file));
54
- }
55
- if (this.options.isFullApiExtraction) {
56
- modules.sort(naturalSortModules);
57
- }
58
- return modules;
26
+ extractModules(i) {
27
+ const e = [];
28
+ for (const r of i)
29
+ this.file = r, e.push(this.extractModule(r));
30
+ return this.options.isFullApiExtraction && e.sort(u), e;
59
31
  }
60
- extractModule(module) {
61
- const apiModule = {
32
+ extractModule(i) {
33
+ const e = {
62
34
  kind: "javascript-module",
63
- path: path.relative(this.options.cwd, module.fileName),
35
+ path: d.relative(this.options.cwd, i.fileName),
64
36
  declarations: void 0,
65
37
  exports: void 0
66
38
  };
67
- this.apiModule = apiModule;
68
- const declarations = this.extractDeclarations(module);
69
- apiModule.declarations = declarations;
70
- if (this.options.isFullApiExtraction) {
71
- const exports = this.inferExports(declarations);
72
- if (exports.length > 0) {
73
- apiModule.exports = exports;
74
- }
39
+ this.apiModule = e;
40
+ const r = this.extractDeclarations(i);
41
+ if (e.declarations = r, this.options.isFullApiExtraction) {
42
+ const s = this.inferExports(r);
43
+ s.length > 0 && (e.exports = s);
75
44
  }
76
- return apiModule;
45
+ return e;
77
46
  }
78
47
  /**
79
48
  * For a given module, extract all public declarations.
80
49
  */
81
- extractDeclarations(module) {
82
- const declarations = [];
83
- for (const statement of module.statements) {
84
- const declaration = this.extractDeclaration(statement);
85
- if (declaration !== void 0) {
86
- declarations.push(declaration);
87
- }
50
+ extractDeclarations(i) {
51
+ const e = [];
52
+ for (const r of i.statements) {
53
+ const s = this.extractDeclaration(r);
54
+ s !== void 0 && e.push(s);
88
55
  }
89
- return declarations;
56
+ return e;
90
57
  }
91
58
  /**
92
59
  * Infer ApiModule.exports based on ApiModule.declarations.
93
60
  */
94
- inferExports(declarations) {
95
- const exports = [];
96
- for (const declaration of declarations) {
97
- const exported = this.inferExport(declaration);
98
- if (exported !== void 0) {
99
- exports.push(exported);
100
- }
101
- }
102
- return exports;
103
- }
104
- };
105
-
106
- // src/utils/astHelpers.ts
107
- import ts2 from "typescript";
108
- var hasIgnoredModifier = (member) => member.modifiers?.some?.(
109
- (modifier) => modifier.kind === ts2.SyntaxKind.StaticKeyword || modifier.kind === ts2.SyntaxKind.PrivateKeyword || modifier.kind === ts2.SyntaxKind.ProtectedKeyword
110
- ) ?? false;
111
- function setDefaultFromInitializer(node, property, sourceFile) {
112
- if (!property.default && "initializer" in node && node.initializer) {
113
- const unpacked = unpackInitializer(node.initializer);
114
- if (isDefaultValueDocumentationEligible(unpacked)) {
115
- property.default = unpacked.getText(sourceFile);
61
+ inferExports(i) {
62
+ const e = [];
63
+ for (const r of i) {
64
+ const s = this.inferExport(r);
65
+ s !== void 0 && e.push(s);
116
66
  }
67
+ return e;
117
68
  }
118
69
  }
119
- var isDefaultValueDocumentationEligible = (initializer) => ts2.isLiteralExpression(initializer) || initializer.kind === ts2.SyntaxKind.TrueKeyword || initializer.kind === ts2.SyntaxKind.FalseKeyword || ts2.isPrefixUnaryExpression(initializer) && ts2.isLiteralExpression(initializer.operand);
120
- function unpackInitializer(expression) {
121
- if (ts2.isSatisfiesExpression(expression) || ts2.isParenthesizedExpression(expression)) {
122
- return unpackInitializer(expression.expression);
123
- } else {
124
- return expression;
70
+ const E = (t) => t.modifiers?.some?.(
71
+ (i) => i.kind === o.SyntaxKind.StaticKeyword || i.kind === o.SyntaxKind.PrivateKeyword || i.kind === o.SyntaxKind.ProtectedKeyword
72
+ ) ?? !1;
73
+ function v(t, i, e) {
74
+ if (!i.default && "initializer" in t && t.initializer) {
75
+ const r = c(t.initializer);
76
+ x(r) && (i.default = r.getText(e));
125
77
  }
126
78
  }
127
- function getMemberName(name2) {
128
- if (ts2.isIdentifier(name2) || ts2.isStringLiteralLike(name2)) {
129
- return name2.text;
130
- }
131
- return void 0;
79
+ const x = (t) => o.isLiteralExpression(t) || t.kind === o.SyntaxKind.TrueKeyword || t.kind === o.SyntaxKind.FalseKeyword || o.isPrefixUnaryExpression(t) && o.isLiteralExpression(t.operand);
80
+ function c(t) {
81
+ return o.isSatisfiesExpression(t) || o.isParenthesizedExpression(t) ? c(t.expression) : t;
82
+ }
83
+ function K(t) {
84
+ if (t !== void 0 && (o.isIdentifier(t) || o.isStringLiteralLike(t)))
85
+ return t.text;
132
86
  }
133
87
  export {
134
- ApiExtractor,
135
- getMemberName,
136
- globalPackageIdentifier,
137
- hasIgnoredModifier,
138
- isApiMethod,
139
- isApiProperty,
140
- setDefaultFromInitializer
88
+ y as ApiExtractor,
89
+ K as getMemberName,
90
+ k as globalPackageIdentifier,
91
+ E as hasIgnoredModifier,
92
+ g as isApiMethod,
93
+ S as isApiProperty,
94
+ v as setDefaultFromInitializer
141
95
  };
@@ -1,4 +1,4 @@
1
- import type { ApiClassMember, ApiClassMethod, ApiCustomElementField, ApiModule } from "../apiJson";
1
+ import { ApiClassMember, ApiClassMethod, ApiCustomElementField, ApiModule } from '../apiJson';
2
2
  export declare const isApiMethod: (member: ApiClassMember) => member is ApiClassMethod;
3
3
  export declare const isApiProperty: (member: ApiClassMember) => member is ApiCustomElementField;
4
4
  /**
@@ -1,9 +1,12 @@
1
- import ts from "typescript";
2
- import type { ApiPropertyLike } from "../apiJson";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiPropertyLike } from '../apiJson';
3
+ /**
4
+ * Check if a member has a static, private, or protected modifier.
5
+ */
3
6
  export declare const hasIgnoredModifier: (member: ts.ClassElement) => boolean;
4
7
  export declare function setDefaultFromInitializer(node: ts.AccessorDeclaration | ts.PropertyDeclaration, property: ApiPropertyLike, sourceFile: ts.SourceFile): void;
5
8
  /**
6
9
  * Convert property name node into a string. Converts Identifier and
7
10
  * StringLiteralLike nodes. The rest return undefined.
8
11
  */
9
- export declare function getMemberName(name: ts.PropertyName): string | undefined;
12
+ export declare function getMemberName(name?: ts.PropertyName): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/api-extractor",
3
- "version": "4.33.0-next.9",
3
+ "version": "4.33.0-next.91",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -14,8 +14,8 @@
14
14
  ],
15
15
  "license": "SEE LICENSE IN LICENSE.md",
16
16
  "dependencies": {
17
- "@arcgis/components-build-utils": "4.33.0-next.9",
18
- "@arcgis/components-utils": "4.33.0-next.9",
17
+ "@arcgis/components-build-utils": "4.33.0-next.91",
18
+ "@arcgis/components-utils": "4.33.0-next.91",
19
19
  "tslib": "^2.7.0",
20
20
  "typescript": "~5.6.3"
21
21
  }