@arcgis/api-extractor 4.33.0-next.61 → 4.33.0-next.62

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.
@@ -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.61";
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.62", g = (t) => t.kind === "method", S = (t) => t.kind === "field";
4
+ function u(t, i) {
5
+ const e = t.path.split("/"), s = e.pop(), r = e.join("/"), a = i.path.split("/"), l = a.pop(), n = a.join("/");
6
+ return r === n ? s < l ? -1 : 1 : r.startsWith(n) ? 1 : n.startsWith(r) || r < 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 s of i)
29
+ this.file = s, e.push(this.extractModule(s));
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 s = this.extractDeclarations(i);
41
+ if (e.declarations = s, this.options.isFullApiExtraction) {
42
+ const r = this.inferExports(s);
43
+ r.length > 0 && (e.exports = r);
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 s of i.statements) {
53
+ const r = this.extractDeclaration(s);
54
+ r !== void 0 && e.push(r);
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 s of i) {
64
+ const r = this.inferExport(s);
65
+ r !== void 0 && e.push(r);
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 s = c(t.initializer);
76
+ x(s) && (i.default = s.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 (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,5 +1,5 @@
1
- import ts from "typescript";
2
- import type { ApiPropertyLike } from "../apiJson";
1
+ import { default as ts } from 'typescript';
2
+ import { ApiPropertyLike } from '../apiJson';
3
3
  export declare const hasIgnoredModifier: (member: ts.ClassElement) => boolean;
4
4
  export declare function setDefaultFromInitializer(node: ts.AccessorDeclaration | ts.PropertyDeclaration, property: ApiPropertyLike, sourceFile: ts.SourceFile): void;
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/api-extractor",
3
- "version": "4.33.0-next.61",
3
+ "version": "4.33.0-next.62",
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.61",
18
- "@arcgis/components-utils": "4.33.0-next.61",
17
+ "@arcgis/components-build-utils": "4.33.0-next.62",
18
+ "@arcgis/components-utils": "4.33.0-next.62",
19
19
  "tslib": "^2.7.0",
20
20
  "typescript": "~5.6.3"
21
21
  }