@arcgis/api-extractor 4.33.0-next.8 → 4.33.0-next.80
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 +4 -5
- package/dist/extractor/index.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +62 -108
- package/dist/utils/apiHelpers.d.ts +1 -1
- package/dist/utils/astHelpers.d.ts +6 -3
- package/package.json +3 -3
package/dist/apiJson.d.ts
CHANGED
|
@@ -817,16 +817,15 @@ export type ApiCustomElementField = ApiClassField & {
|
|
|
817
817
|
*/
|
|
818
818
|
docsTags?: ApiDocsTag[];
|
|
819
819
|
/**
|
|
820
|
-
*
|
|
821
|
-
*
|
|
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
|
|
823
|
+
* @default undefined
|
|
825
824
|
*
|
|
826
825
|
* @remarks
|
|
827
826
|
* Not present in vanilla custom-elements-manifest.
|
|
828
827
|
*/
|
|
829
|
-
|
|
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
|
|
2
|
-
import ts from
|
|
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
|
|
2
|
-
export type * from
|
|
3
|
-
export { hasIgnoredModifier, setDefaultFromInitializer, getMemberName } from
|
|
4
|
-
export { isApiMethod, isApiProperty, globalPackageIdentifier } from
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.80", 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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(
|
|
14
|
+
extract(i) {
|
|
38
15
|
return {
|
|
39
16
|
timestamp: (/* @__PURE__ */ new Date()).toISOString().split(".")[0],
|
|
40
17
|
compiler: {
|
|
41
|
-
name,
|
|
42
|
-
version,
|
|
43
|
-
typescriptVersion:
|
|
18
|
+
name: p,
|
|
19
|
+
version: f,
|
|
20
|
+
typescriptVersion: o.version
|
|
44
21
|
},
|
|
45
22
|
schemaVersion: "1.0.0",
|
|
46
|
-
modules: this.extractModules(
|
|
23
|
+
modules: this.extractModules(i)
|
|
47
24
|
};
|
|
48
25
|
}
|
|
49
|
-
extractModules(
|
|
50
|
-
const
|
|
51
|
-
for (const
|
|
52
|
-
this.file =
|
|
53
|
-
|
|
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(
|
|
61
|
-
const
|
|
32
|
+
extractModule(i) {
|
|
33
|
+
const e = {
|
|
62
34
|
kind: "javascript-module",
|
|
63
|
-
path:
|
|
35
|
+
path: d.relative(this.options.cwd, i.fileName),
|
|
64
36
|
declarations: void 0,
|
|
65
37
|
exports: void 0
|
|
66
38
|
};
|
|
67
|
-
this.apiModule =
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
45
|
+
return e;
|
|
77
46
|
}
|
|
78
47
|
/**
|
|
79
48
|
* For a given module, extract all public declarations.
|
|
80
49
|
*/
|
|
81
|
-
extractDeclarations(
|
|
82
|
-
const
|
|
83
|
-
for (const
|
|
84
|
-
const
|
|
85
|
-
|
|
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
|
|
56
|
+
return e;
|
|
90
57
|
}
|
|
91
58
|
/**
|
|
92
59
|
* Infer ApiModule.exports based on ApiModule.declarations.
|
|
93
60
|
*/
|
|
94
|
-
inferExports(
|
|
95
|
-
const
|
|
96
|
-
for (const
|
|
97
|
-
const
|
|
98
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
|
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
|
|
2
|
-
import
|
|
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
|
|
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.
|
|
3
|
+
"version": "4.33.0-next.80",
|
|
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.
|
|
18
|
-
"@arcgis/components-utils": "4.33.0-next.
|
|
17
|
+
"@arcgis/components-build-utils": "4.33.0-next.80",
|
|
18
|
+
"@arcgis/components-utils": "4.33.0-next.80",
|
|
19
19
|
"tslib": "^2.7.0",
|
|
20
20
|
"typescript": "~5.6.3"
|
|
21
21
|
}
|