@intentweave/swift-parser 0.1.0
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/LICENSE +202 -0
- package/dist/extractor.d.ts +53 -0
- package/dist/extractor.d.ts.map +1 -0
- package/dist/extractor.js +553 -0
- package/dist/extractor.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2025 - 2026 Benjamin Becker
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SwiftFileResult, SwiftExtractionOptions, SwiftBatchResult } from "./types.js";
|
|
2
|
+
export declare class SwiftExtractor {
|
|
3
|
+
private parser;
|
|
4
|
+
private workspaceRoot;
|
|
5
|
+
private defaultOptions;
|
|
6
|
+
constructor(workspaceRoot: string, options?: Partial<SwiftExtractionOptions>);
|
|
7
|
+
/**
|
|
8
|
+
* Extract symbols from a single Swift file.
|
|
9
|
+
*/
|
|
10
|
+
extractFile(filePath: string, options?: Partial<SwiftExtractionOptions>): Promise<SwiftFileResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Extract symbols from a Swift source string (for testing / in-memory).
|
|
13
|
+
*/
|
|
14
|
+
extractFromString(content: string, filePath: string, options?: Partial<SwiftExtractionOptions>): SwiftFileResult;
|
|
15
|
+
/**
|
|
16
|
+
* Extract symbols from multiple Swift files.
|
|
17
|
+
*/
|
|
18
|
+
extractBatch(filePaths: string[], options?: Partial<SwiftExtractionOptions>): Promise<SwiftBatchResult>;
|
|
19
|
+
private walkNode;
|
|
20
|
+
/**
|
|
21
|
+
* Handles class, struct, enum, and extension (all `class_declaration`).
|
|
22
|
+
*/
|
|
23
|
+
private extractClassDeclaration;
|
|
24
|
+
/**
|
|
25
|
+
* Extract protocol declaration.
|
|
26
|
+
*/
|
|
27
|
+
private extractProtocol;
|
|
28
|
+
/**
|
|
29
|
+
* Extract function declaration.
|
|
30
|
+
*/
|
|
31
|
+
private extractFunction;
|
|
32
|
+
/**
|
|
33
|
+
* Extract initializer declaration.
|
|
34
|
+
*/
|
|
35
|
+
private extractInit;
|
|
36
|
+
/**
|
|
37
|
+
* Extract typealias.
|
|
38
|
+
*/
|
|
39
|
+
private extractTypealias;
|
|
40
|
+
/**
|
|
41
|
+
* Extract property declaration (let / var) or protocol_property_declaration.
|
|
42
|
+
*/
|
|
43
|
+
private extractProperty;
|
|
44
|
+
/**
|
|
45
|
+
* Extract import declaration.
|
|
46
|
+
*/
|
|
47
|
+
private extractImport;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a Swift extractor instance.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createSwiftExtractor(workspaceRoot: string, options?: Partial<SwiftExtractionOptions>): SwiftExtractor;
|
|
53
|
+
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../src/extractor.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAGV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAsKpB,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAmC;gBAGvD,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAe3C;;OAEG;IACG,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACxC,OAAO,CAAC,eAAe,CAAC;IAuB3B;;OAEG;IACH,iBAAiB,CACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACxC,eAAe;IAwBlB;;OAEG;IACG,YAAY,CAChB,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACxC,OAAO,CAAC,gBAAgB,CAAC;IA+B5B,OAAO,CAAC,QAAQ;IAqEhB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAkF/B;;OAEG;IACH,OAAO,CAAC,eAAe;IAuDvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAyCvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAoCnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+BxB;;OAEG;IACH,OAAO,CAAC,eAAe;IA4CvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAkDtB;AAID;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACxC,cAAc,CAEhB"}
|
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
// Copyright 2025-2026 Benjamin Becker
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* @file Swift AST Extractor
|
|
5
|
+
*
|
|
6
|
+
* Tree-sitter based Swift AST extractor.
|
|
7
|
+
* Extracts structs, classes, protocols, enums, extensions, functions,
|
|
8
|
+
* properties, initialisers, and import statements from Swift source files.
|
|
9
|
+
*/
|
|
10
|
+
import Parser from "tree-sitter";
|
|
11
|
+
import Swift from "tree-sitter-swift";
|
|
12
|
+
import * as fs from "fs";
|
|
13
|
+
import * as path from "path";
|
|
14
|
+
// ── Node type → SwiftSymbolKind mapping ──────────────────────────────────────
|
|
15
|
+
/**
|
|
16
|
+
* In tree-sitter-swift, `struct`, `class`, `enum`, and `extension` all parse
|
|
17
|
+
* as `class_declaration`. We distinguish them by the keyword child node text.
|
|
18
|
+
*/
|
|
19
|
+
function classDeclarationKind(node) {
|
|
20
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
21
|
+
const child = node.child(i);
|
|
22
|
+
switch (child.type) {
|
|
23
|
+
case "struct":
|
|
24
|
+
return "struct";
|
|
25
|
+
case "enum":
|
|
26
|
+
return "enum";
|
|
27
|
+
case "extension":
|
|
28
|
+
return "extension";
|
|
29
|
+
case "class":
|
|
30
|
+
return "class";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return "class"; // fallback
|
|
34
|
+
}
|
|
35
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
36
|
+
function toRange(node) {
|
|
37
|
+
return {
|
|
38
|
+
startLine: node.startPosition.row + 1,
|
|
39
|
+
startColumn: node.startPosition.column,
|
|
40
|
+
endLine: node.endPosition.row + 1,
|
|
41
|
+
endColumn: node.endPosition.column,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Extract visibility modifier from a `modifiers` child node. */
|
|
45
|
+
function extractAccessControl(node) {
|
|
46
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
47
|
+
const child = node.child(i);
|
|
48
|
+
if (child.type === "modifiers") {
|
|
49
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
50
|
+
const mod = child.child(j);
|
|
51
|
+
if (mod.type === "visibility_modifier") {
|
|
52
|
+
return mod.text;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
/** Check for static / class modifier. */
|
|
60
|
+
function isStaticDeclaration(node) {
|
|
61
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
62
|
+
const child = node.child(i);
|
|
63
|
+
if (child.type === "modifiers") {
|
|
64
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
65
|
+
const mod = child.child(j);
|
|
66
|
+
if ((mod.type === "property_modifier" || mod.type === "member_modifier") &&
|
|
67
|
+
(mod.text === "static" || mod.text === "class")) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Also check direct `class` keyword before `func`
|
|
73
|
+
if (child.type === "class" && node.type === "function_declaration") {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
/** Check for async keyword. */
|
|
80
|
+
function isAsyncDeclaration(node) {
|
|
81
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
82
|
+
if (node.child(i).type === "async")
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
/** Check for throws/rethrows keyword. */
|
|
88
|
+
function isThrowingDeclaration(node) {
|
|
89
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
90
|
+
const t = node.child(i).type;
|
|
91
|
+
if (t === "throws" || t === "rethrows")
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
/** Extract parameter labels from function/init declaration. */
|
|
97
|
+
function extractParameters(node) {
|
|
98
|
+
const params = [];
|
|
99
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
100
|
+
const child = node.child(i);
|
|
101
|
+
if (child.type === "parameter") {
|
|
102
|
+
const nameNode = child.childForFieldName("name");
|
|
103
|
+
if (nameNode)
|
|
104
|
+
params.push(nameNode.text);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return params;
|
|
108
|
+
}
|
|
109
|
+
/** Extract inheritance specifiers (conformances / superclass). */
|
|
110
|
+
function extractInheritance(node) {
|
|
111
|
+
const result = [];
|
|
112
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
113
|
+
const child = node.child(i);
|
|
114
|
+
if (child.type === "inheritance_specifier") {
|
|
115
|
+
// Walk into user_type → type_identifier
|
|
116
|
+
const userType = child.firstChild;
|
|
117
|
+
if (userType) {
|
|
118
|
+
const typeId = userType.type === "type_identifier"
|
|
119
|
+
? userType
|
|
120
|
+
: userType.childForFieldName("name") ?? userType.firstChild;
|
|
121
|
+
if (typeId)
|
|
122
|
+
result.push(typeId.text);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
/** Extract preceding doc comment (triple-slash or block doc comment). */
|
|
129
|
+
function extractDocComment(node, content) {
|
|
130
|
+
const prev = node.previousSibling;
|
|
131
|
+
if (!prev)
|
|
132
|
+
return undefined;
|
|
133
|
+
if (prev.type === "comment") {
|
|
134
|
+
const text = prev.text;
|
|
135
|
+
if (text.startsWith("///")) {
|
|
136
|
+
return text.replace(/^\/\/\/\s?/, "").trim();
|
|
137
|
+
}
|
|
138
|
+
if (text.startsWith("/**")) {
|
|
139
|
+
return text.replace(/^\/\*\*\s?/, "").replace(/\s?\*\/$/, "").trim();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
/** Build a displayable signature string. */
|
|
145
|
+
function buildSignature(node, kind) {
|
|
146
|
+
const lines = node.text.split("\n");
|
|
147
|
+
const firstLine = lines[0].trim();
|
|
148
|
+
// Trim body
|
|
149
|
+
const bodyIdx = firstLine.indexOf("{");
|
|
150
|
+
if (bodyIdx > 0)
|
|
151
|
+
return firstLine.substring(0, bodyIdx).trim();
|
|
152
|
+
return firstLine.length > 120 ? firstLine.substring(0, 120) + "…" : firstLine;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Is a symbol "exported" (public-facing)?
|
|
156
|
+
* In Swift, `public` and `open` are exported. Everything else is internal.
|
|
157
|
+
*/
|
|
158
|
+
function isExported(ac) {
|
|
159
|
+
return ac === "public" || ac === "open";
|
|
160
|
+
}
|
|
161
|
+
// ── Extractor ────────────────────────────────────────────────────────────────
|
|
162
|
+
export class SwiftExtractor {
|
|
163
|
+
parser;
|
|
164
|
+
workspaceRoot;
|
|
165
|
+
defaultOptions;
|
|
166
|
+
constructor(workspaceRoot, options) {
|
|
167
|
+
this.workspaceRoot = workspaceRoot;
|
|
168
|
+
this.parser = new Parser();
|
|
169
|
+
this.parser.setLanguage(Swift);
|
|
170
|
+
this.defaultOptions = {
|
|
171
|
+
includePrivate: options?.includePrivate ?? false,
|
|
172
|
+
includeDocSummary: options?.includeDocSummary ?? true,
|
|
173
|
+
includeParameters: options?.includeParameters ?? true,
|
|
174
|
+
includeMembers: options?.includeMembers ?? true,
|
|
175
|
+
maxDepth: options?.maxDepth ?? 2,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Extract symbols from a single Swift file.
|
|
180
|
+
*/
|
|
181
|
+
async extractFile(filePath, options) {
|
|
182
|
+
const opts = { ...this.defaultOptions, ...options };
|
|
183
|
+
const absolutePath = path.isAbsolute(filePath)
|
|
184
|
+
? filePath
|
|
185
|
+
: path.join(this.workspaceRoot, filePath);
|
|
186
|
+
const relativePath = path.relative(this.workspaceRoot, absolutePath);
|
|
187
|
+
try {
|
|
188
|
+
const content = await fs.promises.readFile(absolutePath, "utf-8");
|
|
189
|
+
return this.extractFromString(content, relativePath, opts);
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
return {
|
|
193
|
+
filePath: relativePath,
|
|
194
|
+
language: "swift",
|
|
195
|
+
symbols: [],
|
|
196
|
+
imports: [],
|
|
197
|
+
extractedAt: Date.now(),
|
|
198
|
+
errors: [error.message],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Extract symbols from a Swift source string (for testing / in-memory).
|
|
204
|
+
*/
|
|
205
|
+
extractFromString(content, filePath, options) {
|
|
206
|
+
const opts = { ...this.defaultOptions, ...options };
|
|
207
|
+
const tree = this.parser.parse(content);
|
|
208
|
+
const symbols = [];
|
|
209
|
+
const imports = [];
|
|
210
|
+
const errors = [];
|
|
211
|
+
this.walkNode(tree.rootNode, content, filePath, symbols, imports, opts, undefined, 0);
|
|
212
|
+
if (tree.rootNode.hasError) {
|
|
213
|
+
errors.push("Parse errors detected in file");
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
filePath,
|
|
217
|
+
language: "swift",
|
|
218
|
+
symbols,
|
|
219
|
+
imports,
|
|
220
|
+
extractedAt: Date.now(),
|
|
221
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Extract symbols from multiple Swift files.
|
|
226
|
+
*/
|
|
227
|
+
async extractBatch(filePaths, options) {
|
|
228
|
+
const startTime = Date.now();
|
|
229
|
+
const files = new Map();
|
|
230
|
+
const failures = [];
|
|
231
|
+
let totalSymbols = 0;
|
|
232
|
+
for (const filePath of filePaths) {
|
|
233
|
+
try {
|
|
234
|
+
const result = await this.extractFile(filePath, options);
|
|
235
|
+
files.set(result.filePath, result);
|
|
236
|
+
totalSymbols += result.symbols.length;
|
|
237
|
+
if (result.errors?.length) {
|
|
238
|
+
failures.push({ filePath: result.filePath, error: result.errors[0] });
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
failures.push({ filePath, error: error.message });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
files,
|
|
247
|
+
totalSymbols,
|
|
248
|
+
totalFiles: filePaths.length,
|
|
249
|
+
failures,
|
|
250
|
+
durationMs: Date.now() - startTime,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
// ── Tree walker ──────────────────────────────────────────────────────────
|
|
254
|
+
walkNode(node, content, filePath, symbols, imports, options, parentName, depth) {
|
|
255
|
+
if (depth > options.maxDepth)
|
|
256
|
+
return;
|
|
257
|
+
switch (node.type) {
|
|
258
|
+
case "class_declaration":
|
|
259
|
+
this.extractClassDeclaration(node, content, filePath, symbols, imports, options, parentName, depth);
|
|
260
|
+
break;
|
|
261
|
+
case "protocol_declaration":
|
|
262
|
+
this.extractProtocol(node, content, filePath, symbols, imports, options, depth);
|
|
263
|
+
break;
|
|
264
|
+
case "function_declaration":
|
|
265
|
+
case "protocol_function_declaration":
|
|
266
|
+
this.extractFunction(node, content, filePath, symbols, options, parentName);
|
|
267
|
+
break;
|
|
268
|
+
case "init_declaration":
|
|
269
|
+
this.extractInit(node, content, filePath, symbols, options, parentName);
|
|
270
|
+
break;
|
|
271
|
+
case "typealias_declaration":
|
|
272
|
+
this.extractTypealias(node, content, filePath, symbols, options, parentName);
|
|
273
|
+
break;
|
|
274
|
+
case "property_declaration":
|
|
275
|
+
case "protocol_property_declaration":
|
|
276
|
+
this.extractProperty(node, content, filePath, symbols, options, parentName);
|
|
277
|
+
break;
|
|
278
|
+
case "import_declaration":
|
|
279
|
+
this.extractImport(node, imports);
|
|
280
|
+
break;
|
|
281
|
+
default:
|
|
282
|
+
// Recurse into children for top-level or body nodes
|
|
283
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
284
|
+
this.walkNode(node.child(i), content, filePath, symbols, imports, options, parentName, depth);
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// ── Extractors ───────────────────────────────────────────────────────────
|
|
290
|
+
/**
|
|
291
|
+
* Handles class, struct, enum, and extension (all `class_declaration`).
|
|
292
|
+
*/
|
|
293
|
+
extractClassDeclaration(node, content, filePath, symbols, imports, options, parentName, depth) {
|
|
294
|
+
const kind = classDeclarationKind(node);
|
|
295
|
+
const nameNode = node.childForFieldName("name");
|
|
296
|
+
const name = nameNode?.text ?? "<anonymous>";
|
|
297
|
+
const ac = extractAccessControl(node);
|
|
298
|
+
if (!options.includePrivate && (ac === "private" || ac === "fileprivate")) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const inheritance = extractInheritance(node);
|
|
302
|
+
const sym = {
|
|
303
|
+
name,
|
|
304
|
+
kind,
|
|
305
|
+
filePath,
|
|
306
|
+
range: toRange(node),
|
|
307
|
+
parent: parentName,
|
|
308
|
+
isExported: isExported(ac),
|
|
309
|
+
accessControl: ac,
|
|
310
|
+
signature: buildSignature(node, kind),
|
|
311
|
+
};
|
|
312
|
+
if (options.includeDocSummary) {
|
|
313
|
+
sym.docSummary = extractDocComment(node, content);
|
|
314
|
+
}
|
|
315
|
+
// Inheritance
|
|
316
|
+
if (kind === "class" && inheritance.length > 0) {
|
|
317
|
+
// First item could be superclass (starts uppercase, not a protocol convention)
|
|
318
|
+
sym.superclass = inheritance[0];
|
|
319
|
+
sym.conformances = inheritance.slice(1);
|
|
320
|
+
}
|
|
321
|
+
else if (kind === "struct" || kind === "enum") {
|
|
322
|
+
sym.conformances = inheritance;
|
|
323
|
+
}
|
|
324
|
+
else if (kind === "extension") {
|
|
325
|
+
// For extensions, the "name" is the extended type
|
|
326
|
+
const userTypeNode = node.children.find((c) => c.type === "user_type");
|
|
327
|
+
if (userTypeNode) {
|
|
328
|
+
sym.extendedType = userTypeNode.text;
|
|
329
|
+
sym.name = userTypeNode.text;
|
|
330
|
+
}
|
|
331
|
+
sym.conformances = inheritance;
|
|
332
|
+
}
|
|
333
|
+
if (kind === "class") {
|
|
334
|
+
sym.isFinal = node.text.includes("final ");
|
|
335
|
+
}
|
|
336
|
+
symbols.push(sym);
|
|
337
|
+
// Extract members
|
|
338
|
+
if (options.includeMembers) {
|
|
339
|
+
const body = node.children.find((c) => c.type === "class_body" || c.type === "enum_class_body");
|
|
340
|
+
if (body) {
|
|
341
|
+
for (let i = 0; i < body.childCount; i++) {
|
|
342
|
+
this.walkNode(body.child(i), content, filePath, symbols, imports, options, name, depth + 1);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Extract protocol declaration.
|
|
349
|
+
*/
|
|
350
|
+
extractProtocol(node, content, filePath, symbols, imports, options, depth) {
|
|
351
|
+
const nameNode = node.childForFieldName("name");
|
|
352
|
+
const name = nameNode?.text ?? "<anonymous>";
|
|
353
|
+
const ac = extractAccessControl(node);
|
|
354
|
+
if (!options.includePrivate && (ac === "private" || ac === "fileprivate")) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const inheritance = extractInheritance(node);
|
|
358
|
+
const sym = {
|
|
359
|
+
name,
|
|
360
|
+
kind: "protocol",
|
|
361
|
+
filePath,
|
|
362
|
+
range: toRange(node),
|
|
363
|
+
isExported: isExported(ac),
|
|
364
|
+
accessControl: ac,
|
|
365
|
+
conformances: inheritance,
|
|
366
|
+
signature: buildSignature(node, "protocol"),
|
|
367
|
+
};
|
|
368
|
+
if (options.includeDocSummary) {
|
|
369
|
+
sym.docSummary = extractDocComment(node, content);
|
|
370
|
+
}
|
|
371
|
+
symbols.push(sym);
|
|
372
|
+
// Extract protocol members
|
|
373
|
+
if (options.includeMembers) {
|
|
374
|
+
const body = node.children.find((c) => c.type === "protocol_body");
|
|
375
|
+
if (body) {
|
|
376
|
+
for (let i = 0; i < body.childCount; i++) {
|
|
377
|
+
this.walkNode(body.child(i), content, filePath, symbols, imports, options, name, depth + 1);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Extract function declaration.
|
|
384
|
+
*/
|
|
385
|
+
extractFunction(node, content, filePath, symbols, options, parentName) {
|
|
386
|
+
const nameNode = node.childForFieldName("name");
|
|
387
|
+
const name = nameNode?.text ?? "<anonymous>";
|
|
388
|
+
const ac = extractAccessControl(node);
|
|
389
|
+
if (!options.includePrivate && (ac === "private" || ac === "fileprivate")) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const kind = parentName ? "method" : "function";
|
|
393
|
+
const sym = {
|
|
394
|
+
name,
|
|
395
|
+
kind,
|
|
396
|
+
filePath,
|
|
397
|
+
range: toRange(node),
|
|
398
|
+
parent: parentName,
|
|
399
|
+
isExported: isExported(ac),
|
|
400
|
+
accessControl: ac,
|
|
401
|
+
isAsync: isAsyncDeclaration(node),
|
|
402
|
+
isThrowing: isThrowingDeclaration(node),
|
|
403
|
+
isStatic: isStaticDeclaration(node),
|
|
404
|
+
signature: buildSignature(node, kind),
|
|
405
|
+
};
|
|
406
|
+
if (options.includeParameters) {
|
|
407
|
+
sym.parameters = extractParameters(node);
|
|
408
|
+
}
|
|
409
|
+
if (options.includeDocSummary) {
|
|
410
|
+
sym.docSummary = extractDocComment(node, content);
|
|
411
|
+
}
|
|
412
|
+
symbols.push(sym);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Extract initializer declaration.
|
|
416
|
+
*/
|
|
417
|
+
extractInit(node, content, filePath, symbols, options, parentName) {
|
|
418
|
+
const ac = extractAccessControl(node);
|
|
419
|
+
if (!options.includePrivate && (ac === "private" || ac === "fileprivate")) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const sym = {
|
|
423
|
+
name: "init",
|
|
424
|
+
kind: "initializer",
|
|
425
|
+
filePath,
|
|
426
|
+
range: toRange(node),
|
|
427
|
+
parent: parentName,
|
|
428
|
+
isExported: isExported(ac),
|
|
429
|
+
accessControl: ac,
|
|
430
|
+
isThrowing: isThrowingDeclaration(node),
|
|
431
|
+
signature: buildSignature(node, "initializer"),
|
|
432
|
+
};
|
|
433
|
+
if (options.includeParameters) {
|
|
434
|
+
sym.parameters = extractParameters(node);
|
|
435
|
+
}
|
|
436
|
+
if (options.includeDocSummary) {
|
|
437
|
+
sym.docSummary = extractDocComment(node, content);
|
|
438
|
+
}
|
|
439
|
+
symbols.push(sym);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Extract typealias.
|
|
443
|
+
*/
|
|
444
|
+
extractTypealias(node, content, filePath, symbols, options, parentName) {
|
|
445
|
+
const nameNode = node.childForFieldName("name");
|
|
446
|
+
const name = nameNode?.text ?? "<anonymous>";
|
|
447
|
+
const ac = extractAccessControl(node);
|
|
448
|
+
if (!options.includePrivate && (ac === "private" || ac === "fileprivate")) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
symbols.push({
|
|
452
|
+
name,
|
|
453
|
+
kind: "typealias",
|
|
454
|
+
filePath,
|
|
455
|
+
range: toRange(node),
|
|
456
|
+
parent: parentName,
|
|
457
|
+
isExported: isExported(ac),
|
|
458
|
+
accessControl: ac,
|
|
459
|
+
signature: buildSignature(node, "typealias"),
|
|
460
|
+
docSummary: options.includeDocSummary
|
|
461
|
+
? extractDocComment(node, content)
|
|
462
|
+
: undefined,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Extract property declaration (let / var) or protocol_property_declaration.
|
|
467
|
+
*/
|
|
468
|
+
extractProperty(node, content, filePath, symbols, options, parentName) {
|
|
469
|
+
let nameNode = node.childForFieldName("name");
|
|
470
|
+
let name;
|
|
471
|
+
if (node.type === "protocol_property_declaration") {
|
|
472
|
+
// protocol_property_declaration has a `pattern` child with the identifier
|
|
473
|
+
const pattern = node.children.find((c) => c.type === "pattern");
|
|
474
|
+
name = pattern
|
|
475
|
+
? (pattern.childForFieldName("bound_identifier")?.text ??
|
|
476
|
+
pattern.text.replace(/^(var|let)\s+/, "").trim())
|
|
477
|
+
: (nameNode?.text ?? "<anonymous>");
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
name = nameNode?.text ?? "<anonymous>";
|
|
481
|
+
}
|
|
482
|
+
const ac = extractAccessControl(node);
|
|
483
|
+
if (!options.includePrivate && (ac === "private" || ac === "fileprivate")) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
symbols.push({
|
|
487
|
+
name,
|
|
488
|
+
kind: "property",
|
|
489
|
+
filePath,
|
|
490
|
+
range: toRange(node),
|
|
491
|
+
parent: parentName,
|
|
492
|
+
isExported: isExported(ac),
|
|
493
|
+
accessControl: ac,
|
|
494
|
+
isStatic: isStaticDeclaration(node),
|
|
495
|
+
signature: buildSignature(node, "property"),
|
|
496
|
+
docSummary: options.includeDocSummary
|
|
497
|
+
? extractDocComment(node, content)
|
|
498
|
+
: undefined,
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Extract import declaration.
|
|
503
|
+
*/
|
|
504
|
+
extractImport(node, imports) {
|
|
505
|
+
// import_declaration children: "import" keyword, optional kind, identifier(s)
|
|
506
|
+
let moduleName = "";
|
|
507
|
+
let importKind;
|
|
508
|
+
let symbolName;
|
|
509
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
510
|
+
const child = node.child(i);
|
|
511
|
+
if (child.type === "import")
|
|
512
|
+
continue; // skip keyword
|
|
513
|
+
// Kind specifier: `import struct Foundation.URL`
|
|
514
|
+
if (["struct", "class", "protocol", "enum", "func", "var", "typealias"].includes(child.text)) {
|
|
515
|
+
importKind = child.text;
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
// The identifier node contains the module path
|
|
519
|
+
if (child.type === "identifier") {
|
|
520
|
+
const parts = [];
|
|
521
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
522
|
+
const part = child.child(j);
|
|
523
|
+
if (part && part.type === "simple_identifier") {
|
|
524
|
+
parts.push(part.text);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (parts.length > 1) {
|
|
528
|
+
moduleName = parts[0];
|
|
529
|
+
symbolName = parts.slice(1).join(".");
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
moduleName = parts[0] ?? child.text;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (moduleName) {
|
|
537
|
+
imports.push({
|
|
538
|
+
moduleName,
|
|
539
|
+
kind: importKind,
|
|
540
|
+
symbolName,
|
|
541
|
+
range: toRange(node),
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
// ── Factory ──────────────────────────────────────────────────────────────────
|
|
547
|
+
/**
|
|
548
|
+
* Create a Swift extractor instance.
|
|
549
|
+
*/
|
|
550
|
+
export function createSwiftExtractor(workspaceRoot, options) {
|
|
551
|
+
return new SwiftExtractor(workspaceRoot, options);
|
|
552
|
+
}
|
|
553
|
+
//# sourceMappingURL=extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../src/extractor.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAEtC;;;;;;GAMG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAY7B,gFAAgF;AAEhF;;;GAGG;AACH,SAAS,oBAAoB,CAAC,IAAuB;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;QAC7B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB,KAAK,MAAM;gBACT,OAAO,MAAM,CAAC;YAChB,KAAK,WAAW;gBACd,OAAO,WAAW,CAAC;YACrB,KAAK,OAAO;gBACV,OAAO,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,WAAW;AAC7B,CAAC;AAED,gFAAgF;AAEhF,SAAS,OAAO,CAAC,IAAuB;IACt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AK,CAAC,IAAI,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC;gBACX,UAAU;gBACV,IAAI,EAAE,UAAU;gBAChB,UAAU;gBACV,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAED,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,aAAqB,EACrB,OAAyC;IAEzC,OAAO,IAAI,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Swift Parser - Public API
|
|
3
|
+
*
|
|
4
|
+
* Tree-sitter based AST extractor for Swift source files.
|
|
5
|
+
* Extracts structs, classes, protocols, enums, extensions, functions,
|
|
6
|
+
* properties, and imports from .swift files.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createSwiftExtractor } from '@intentweave/swift-parser';
|
|
11
|
+
*
|
|
12
|
+
* const extractor = createSwiftExtractor('/path/to/swift-project');
|
|
13
|
+
* const result = await extractor.extractFile('Sources/App/Model.swift');
|
|
14
|
+
*
|
|
15
|
+
* console.log(`Found ${result.symbols.length} symbols`);
|
|
16
|
+
* for (const sym of result.symbols) {
|
|
17
|
+
* console.log(` ${sym.kind} ${sym.name} (${sym.accessControl ?? 'internal'})`);
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type { SwiftSymbolKind, AccessControl, SourceRange, SwiftSymbol, SwiftImport, SwiftFileResult, SwiftExtractionOptions, SwiftBatchResult, } from "./types.js";
|
|
22
|
+
export { SwiftExtractor, createSwiftExtractor } from "./extractor.js";
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,YAAY,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAmCtC,sBAAsB;AACtB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Swift Parser Types
|
|
3
|
+
*
|
|
4
|
+
* Types for extracted Swift code symbols.
|
|
5
|
+
* Compatible with the @intentweave/ast-extractor type shapes so AX stage
|
|
6
|
+
* can consume both TypeScript and Swift extraction results uniformly.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Kind of extracted Swift symbol.
|
|
10
|
+
* Superset of the base SymbolKind — adds Swift-specific constructs.
|
|
11
|
+
*/
|
|
12
|
+
export type SwiftSymbolKind = "function" | "class" | "struct" | "protocol" | "enum" | "extension" | "method" | "property" | "initializer" | "subscript" | "typealias" | "associatedtype" | "variable" | "operator" | "macro";
|
|
13
|
+
/**
|
|
14
|
+
* Swift access control levels.
|
|
15
|
+
*/
|
|
16
|
+
export type AccessControl = "open" | "public" | "package" | "internal" | "fileprivate" | "private";
|
|
17
|
+
/**
|
|
18
|
+
* Source location range.
|
|
19
|
+
*/
|
|
20
|
+
export interface SourceRange {
|
|
21
|
+
startLine: number;
|
|
22
|
+
startColumn: number;
|
|
23
|
+
endLine: number;
|
|
24
|
+
endColumn: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Extracted Swift symbol.
|
|
28
|
+
*/
|
|
29
|
+
export interface SwiftSymbol {
|
|
30
|
+
/** Symbol name */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Kind of symbol */
|
|
33
|
+
kind: SwiftSymbolKind;
|
|
34
|
+
/** File path (relative to workspace) */
|
|
35
|
+
filePath: string;
|
|
36
|
+
/** Source location */
|
|
37
|
+
range: SourceRange;
|
|
38
|
+
/** Parent symbol name (for nested symbols like methods in a class) */
|
|
39
|
+
parent?: string;
|
|
40
|
+
/** Is this symbol exported (public/open)? */
|
|
41
|
+
isExported: boolean;
|
|
42
|
+
/** Swift access control level */
|
|
43
|
+
accessControl?: AccessControl;
|
|
44
|
+
/** For functions/methods: is async? */
|
|
45
|
+
isAsync?: boolean;
|
|
46
|
+
/** For functions/methods: is throwing? */
|
|
47
|
+
isThrowing?: boolean;
|
|
48
|
+
/** For class members: is static / class? */
|
|
49
|
+
isStatic?: boolean;
|
|
50
|
+
/** For classes: is final? */
|
|
51
|
+
isFinal?: boolean;
|
|
52
|
+
/** For protocol members: is optional? */
|
|
53
|
+
isOptional?: boolean;
|
|
54
|
+
/** Doc comment summary (first line of triple-slash or block doc comments). */
|
|
55
|
+
docSummary?: string;
|
|
56
|
+
/** Function/method parameter labels (external names) */
|
|
57
|
+
parameters?: string[];
|
|
58
|
+
/** Raw signature for display */
|
|
59
|
+
signature?: string;
|
|
60
|
+
/** Protocol conformances (for class/struct/enum) */
|
|
61
|
+
conformances?: string[];
|
|
62
|
+
/** Superclass (for class declarations) */
|
|
63
|
+
superclass?: string;
|
|
64
|
+
/** Adopted protocols within an extension */
|
|
65
|
+
extendedType?: string;
|
|
66
|
+
/** Generic type parameters */
|
|
67
|
+
genericParameters?: string[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Swift import statement.
|
|
71
|
+
*/
|
|
72
|
+
export interface SwiftImport {
|
|
73
|
+
/** Module name (e.g., "Foundation", "SwiftUI") */
|
|
74
|
+
moduleName: string;
|
|
75
|
+
/** Specific symbol import (e.g., import struct Foundation.URL). */
|
|
76
|
+
kind?: "struct" | "class" | "protocol" | "enum" | "func" | "var" | "typealias";
|
|
77
|
+
/** Specific imported name within the module */
|
|
78
|
+
symbolName?: string;
|
|
79
|
+
/** Source range */
|
|
80
|
+
range: SourceRange;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Result of extracting a single Swift file.
|
|
84
|
+
* Shape-compatible with @intentweave/ast-extractor FileExtractionResult.
|
|
85
|
+
*/
|
|
86
|
+
export interface SwiftFileResult {
|
|
87
|
+
/** File path (relative to workspace) */
|
|
88
|
+
filePath: string;
|
|
89
|
+
/** Always "swift" */
|
|
90
|
+
language: "swift";
|
|
91
|
+
/** Extracted symbols */
|
|
92
|
+
symbols: SwiftSymbol[];
|
|
93
|
+
/** Import statements */
|
|
94
|
+
imports: SwiftImport[];
|
|
95
|
+
/** Extraction timestamp */
|
|
96
|
+
extractedAt: number;
|
|
97
|
+
/** Parse errors (if any) */
|
|
98
|
+
errors?: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Options for Swift extraction.
|
|
102
|
+
*/
|
|
103
|
+
export interface SwiftExtractionOptions {
|
|
104
|
+
/** Include private/fileprivate symbols (default: false) */
|
|
105
|
+
includePrivate?: boolean;
|
|
106
|
+
/** Include doc comment summary (default: true) */
|
|
107
|
+
includeDocSummary?: boolean;
|
|
108
|
+
/** Include parameter labels (default: true) */
|
|
109
|
+
includeParameters?: boolean;
|
|
110
|
+
/** Include method/property details in types (default: true) */
|
|
111
|
+
includeMembers?: boolean;
|
|
112
|
+
/** Max depth for nested symbols (default: 2) */
|
|
113
|
+
maxDepth?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Batch extraction result for Swift files.
|
|
117
|
+
*/
|
|
118
|
+
export interface SwiftBatchResult {
|
|
119
|
+
/** Results by file path */
|
|
120
|
+
files: Map<string, SwiftFileResult>;
|
|
121
|
+
/** Total symbols extracted */
|
|
122
|
+
totalSymbols: number;
|
|
123
|
+
/** Total files processed */
|
|
124
|
+
totalFiles: number;
|
|
125
|
+
/** Failed files */
|
|
126
|
+
failures: Array<{
|
|
127
|
+
filePath: string;
|
|
128
|
+
error: string;
|
|
129
|
+
}>;
|
|
130
|
+
/** Extraction duration (ms) */
|
|
131
|
+
durationMs: number;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,OAAO,GACP,QAAQ,GACR,UAAU,GACV,MAAM,GACN,WAAW,GACX,QAAQ,GACR,UAAU,GACV,aAAa,GACb,WAAW,GACX,WAAW,GACX,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,UAAU,GACV,aAAa,GACb,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IAEb,qBAAqB;IACrB,IAAI,EAAE,eAAe,CAAC;IAEtB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,KAAK,EAAE,WAAW,CAAC;IAEnB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAE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CAAC;IAEvB,wBAAwB;IACxB,OAAO,EAAE,WAAW,EAAE,CAAC;IAEvB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IAEpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2DAA2D;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAEpC,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IAErB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IAEnB,mBAAmB;IACnB,QAAQ,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAErD,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intentweave/swift-parser",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Tree-sitter based AST extractor for Swift source files",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"tree-sitter": "^0.21.1",
|
|
22
|
+
"tree-sitter-swift": "^0.7.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.6.0",
|
|
26
|
+
"vitest": "^2.1.0"
|
|
27
|
+
},
|
|
28
|
+
"intentweave": {
|
|
29
|
+
"tier": "oss",
|
|
30
|
+
"description": "Swift AST extraction engine — open-source, enables code linking for Swift projects"
|
|
31
|
+
},
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/intentweave/intentweave.git",
|
|
36
|
+
"directory": "packages/swift-parser"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20.0.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:unit": "vitest run",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"lint": "echo 'TODO: eslint'",
|
|
47
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
48
|
+
}
|
|
49
|
+
}
|