@sdk-usage/plugin-typescript 0.2.0-next.1793882632335.0093cac → 0.2.0-next.1794006346244.8e5731c
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/README.md +51 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
<br>
|
|
2
|
+
<div align="center">
|
|
3
|
+
<h1>@sdk-usage/plugin-typescript</h1>
|
|
4
|
+
<strong>Parser plugin for collecting imported TypeScript type usage.</strong>
|
|
5
|
+
</div>
|
|
6
|
+
<br>
|
|
7
|
+
<br>
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- Collects imported type aliases and qualified namespace types such as `UI.ButtonProps`.
|
|
12
|
+
- Supports inline import types such as `import("ui").ButtonProps`.
|
|
13
|
+
- Collects interface heritage, `implements` references, and `typeof` queries such as
|
|
14
|
+
`typeof UI.Button`.
|
|
15
|
+
- Collects indexed-access types through their referenced base type, once per reference.
|
|
16
|
+
|
|
17
|
+
For qualified names, the collected name is the final type name. Inline import types require a
|
|
18
|
+
qualified type; an unqualified `import("ui")` does not identify a specific SDK usage. Local types,
|
|
19
|
+
primitive types, and type declarations by themselves are not collected.
|
|
20
|
+
|
|
21
|
+
## 🚀 Usage
|
|
22
|
+
|
|
23
|
+
Install the core package and the plugin:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
pnpm add @sdk-usage/core @sdk-usage/plugin-typescript
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createInstance } from "@sdk-usage/core";
|
|
31
|
+
import { plugin } from "@sdk-usage/plugin-typescript";
|
|
32
|
+
|
|
33
|
+
const analyzer = createInstance(process.cwd(), { plugins: [plugin] });
|
|
34
|
+
|
|
35
|
+
for await (const item of analyzer.getItems()) {
|
|
36
|
+
console.log(item);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🏗️ Architecture
|
|
41
|
+
|
|
42
|
+
The plugin registers TypeScript syntax visitors with core and emits `typescript/type` items for
|
|
43
|
+
references to imported modules. Core resolves each item to its source location and package
|
|
44
|
+
metadata. See [core](../core/README.md) for scanning options.
|
|
45
|
+
|
|
46
|
+
## ✍️ Contribution
|
|
47
|
+
|
|
48
|
+
See the repository [contribution guide](../../CONTRIBUTING.md).
|
|
49
|
+
|
|
50
|
+
## 📖 License
|
|
51
|
+
|
|
52
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-usage/plugin-typescript",
|
|
3
|
-
"version": "0.2.0-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0-next.1794006346244.8e5731c",
|
|
4
|
+
"description": "Parser plugin for collecting imported TypeScript type usage.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analyze",
|
|
7
7
|
"analyzer",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"registry": "https://registry.npmjs.org"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@sdk-usage/core": "0.2.0-next.
|
|
47
|
+
"@sdk-usage/core": "0.2.0-next.1794006346244.8e5731c",
|
|
48
48
|
"@types/node": "26.6.6",
|
|
49
49
|
"quickbundle": "3.2.2",
|
|
50
50
|
"vitest": "5.1.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@sdk-usage/core": "0.2.0-next.
|
|
53
|
+
"@sdk-usage/core": "0.2.0-next.1794006346244.8e5731c"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "quickbundle build",
|