@constellationdev/cli 1.3.1 → 1.3.2
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/main.js +49 -49
- package/package.json +4 -2
- package/third_party/tree-sitter-swift/LICENSE +21 -0
- package/third_party/tree-sitter-swift/README.md +34 -0
- package/third_party/tree-sitter-swift/binding.gyp +25 -0
- package/third_party/tree-sitter-swift/bindings/node/binding.cc +20 -0
- package/third_party/tree-sitter-swift/bindings/node/index.d.ts +28 -0
- package/third_party/tree-sitter-swift/bindings/node/index.js +7 -0
- package/third_party/tree-sitter-swift/package.json +17 -0
- package/third_party/tree-sitter-swift/src/node-types.json +31727 -0
- package/third_party/tree-sitter-swift/src/parser.c +484485 -0
- package/third_party/tree-sitter-swift/src/scanner.c +856 -0
- package/third_party/tree-sitter-swift/src/tree_sitter/alloc.h +54 -0
- package/third_party/tree-sitter-swift/src/tree_sitter/array.h +290 -0
- package/third_party/tree-sitter-swift/src/tree_sitter/parser.h +266 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constellationdev/cli",
|
|
3
3
|
"description": "Codebase Understanding for AI Coding Agents",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"author": "ShiftinBits Inc",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"type": "module",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"tree-sitter-go": "0.21.2",
|
|
38
38
|
"tree-sitter-javascript": "0.21.4",
|
|
39
39
|
"tree-sitter-python": "0.21.0",
|
|
40
|
+
"tree-sitter-swift": "file:third_party/tree-sitter-swift",
|
|
40
41
|
"tree-sitter-typescript": "0.21.2",
|
|
41
42
|
"tsconfck": "^3.1.6",
|
|
42
43
|
"undici": "^7.22.0",
|
|
@@ -71,7 +72,8 @@
|
|
|
71
72
|
"npm": ">=10.0.0"
|
|
72
73
|
},
|
|
73
74
|
"files": [
|
|
74
|
-
"dist"
|
|
75
|
+
"dist",
|
|
76
|
+
"third_party/tree-sitter-swift"
|
|
75
77
|
],
|
|
76
78
|
"homepage": "https://constellationdev.io",
|
|
77
79
|
"bugs": "https://github.com/ShiftinBits/constellation-cli/issues",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 alex-pinkus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# tree-sitter-swift (vendored)
|
|
2
|
+
|
|
3
|
+
Vendored copy of [`tree-sitter-swift@0.6.0`](https://github.com/alex-pinkus/tree-sitter-swift)
|
|
4
|
+
(npm: `tree-sitter-swift`, by Alex Pinkus, MIT). Pinned to `0.6.0` because it is the
|
|
5
|
+
last release that peers on `tree-sitter@^0.21.1`; `0.7.x` requires `tree-sitter@^0.22`,
|
|
6
|
+
which the other grammars in this CLI do not support.
|
|
7
|
+
|
|
8
|
+
## Why vendored
|
|
9
|
+
|
|
10
|
+
The upstream package cannot be consumed directly:
|
|
11
|
+
|
|
12
|
+
- Its `binding.gyp` **regenerates** `src/parser.c` at install time via `tree-sitter generate`
|
|
13
|
+
(a hard `tree-sitter-cli@^0.23` dependency). Under npm hoisting the generate action's
|
|
14
|
+
relative path to `tree-sitter-cli` breaks the native build
|
|
15
|
+
(`make: No rule to make target ../node_modules/tree-sitter-cli`), which fails for every
|
|
16
|
+
consumer including end-user installs of the published CLI.
|
|
17
|
+
- Regenerating with `tree-sitter-cli@0.23` would also emit a `LANGUAGE_VERSION 15` parser,
|
|
18
|
+
which is **incompatible** with the pinned `tree-sitter@0.21.1` runtime (max ABI 14).
|
|
19
|
+
|
|
20
|
+
This vendored copy keeps only the **shipped, pre-generated `LANGUAGE_VERSION 14`** sources
|
|
21
|
+
(`src/parser.c`, `src/scanner.c`, `src/tree_sitter/`, `src/node-types.json`) and a
|
|
22
|
+
**compile-only `binding.gyp`** (identical in shape to the `tree-sitter-c-sharp` grammar).
|
|
23
|
+
There is no regeneration step and no `tree-sitter-cli` dependency, so it builds cleanly
|
|
24
|
+
against `tree-sitter@0.21.1` wherever the CLI is installed.
|
|
25
|
+
|
|
26
|
+
ABI 14 matches the other grammars in this CLI (`tree-sitter-c-sharp`, `tree-sitter-go`,
|
|
27
|
+
etc.), so the existing grammars and the `tree-sitter` core are entirely unaffected.
|
|
28
|
+
|
|
29
|
+
## Updating
|
|
30
|
+
|
|
31
|
+
To bump the grammar, copy the pre-generated `src/` (parser.c, scanner.c, tree_sitter/,
|
|
32
|
+
node-types.json) and `bindings/node/` from a `tree-sitter-swift` release whose `parser.c`
|
|
33
|
+
declares `LANGUAGE_VERSION <= 14`, keep this directory's `binding.gyp` and `package.json`,
|
|
34
|
+
and rebuild. Do not copy the upstream `binding.gyp` (it reintroduces regeneration).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"targets": [
|
|
3
|
+
{
|
|
4
|
+
"target_name": "tree_sitter_swift_binding",
|
|
5
|
+
"dependencies": [
|
|
6
|
+
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
|
|
7
|
+
],
|
|
8
|
+
"include_dirs": [
|
|
9
|
+
"src",
|
|
10
|
+
],
|
|
11
|
+
"sources": [
|
|
12
|
+
"bindings/node/binding.cc",
|
|
13
|
+
"src/parser.c",
|
|
14
|
+
"src/scanner.c",
|
|
15
|
+
],
|
|
16
|
+
"conditions": [
|
|
17
|
+
["OS!='win'", {
|
|
18
|
+
"cflags_c": [ "-std=c11" ],
|
|
19
|
+
}, {
|
|
20
|
+
"cflags_c": [ "/std:c11", "/utf-8" ],
|
|
21
|
+
}],
|
|
22
|
+
],
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#include <napi.h>
|
|
2
|
+
|
|
3
|
+
typedef struct TSLanguage TSLanguage;
|
|
4
|
+
|
|
5
|
+
extern "C" TSLanguage *tree_sitter_swift();
|
|
6
|
+
|
|
7
|
+
// "tree-sitter", "language" hashed with BLAKE2
|
|
8
|
+
const napi_type_tag LANGUAGE_TYPE_TAG = {
|
|
9
|
+
0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
13
|
+
exports["name"] = Napi::String::New(env, "swift");
|
|
14
|
+
auto language = Napi::External<TSLanguage>::New(env, tree_sitter_swift());
|
|
15
|
+
language.TypeTag(&LANGUAGE_TYPE_TAG);
|
|
16
|
+
exports["language"] = language;
|
|
17
|
+
return exports;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
NODE_API_MODULE(tree_sitter_swift_binding, Init)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type BaseNode = {
|
|
2
|
+
type: string;
|
|
3
|
+
named: boolean;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type ChildNode = {
|
|
7
|
+
multiple: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
types: BaseNode[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type NodeInfo =
|
|
13
|
+
| (BaseNode & {
|
|
14
|
+
subtypes: BaseNode[];
|
|
15
|
+
})
|
|
16
|
+
| (BaseNode & {
|
|
17
|
+
fields: { [name: string]: ChildNode };
|
|
18
|
+
children: ChildNode[];
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
type Language = {
|
|
22
|
+
name: string;
|
|
23
|
+
language: unknown;
|
|
24
|
+
nodeTypeInfo: NodeInfo[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare const language: Language;
|
|
28
|
+
export = language;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-sitter-swift",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Swift grammar for tree-sitter (vendored, compile-only build)",
|
|
5
|
+
"main": "bindings/node",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"tree-sitter": "^0.21.1"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"node-addon-api": "^8.0.0",
|
|
12
|
+
"node-gyp-build": "^4.8.0"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"install": "node-gyp-build"
|
|
16
|
+
}
|
|
17
|
+
}
|