mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-13 23:14:20 +00:00
fix(swift): address parser runtime review
Add explicit Swift prebuild checks and vendor guidance so parser runtime packaging remains observable and maintainable.
This commit is contained in:
parent
50d9b69860
commit
078b939d9e
3 changed files with 18 additions and 2 deletions
|
|
@ -3,6 +3,8 @@ WORKDIR /app
|
|||
RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
|
||||
COPY . .
|
||||
RUN npm ci --ignore-scripts \
|
||||
&& npm rebuild tree-sitter-swift 2>&1 \
|
||||
&& node -e "require('tree-sitter-swift')" \
|
||||
&& (npm rebuild 2>&1 || true) \
|
||||
&& cd node_modules/tree-sitter-kotlin && npx --yes node-gyp rebuild 2>&1
|
||||
CMD ["npx", "vitest", "run", "test/integration", "--reporter=verbose"]
|
||||
|
|
|
|||
|
|
@ -129,12 +129,14 @@ const swiftExtractFunctionName = (
|
|||
};
|
||||
|
||||
const orderSwiftSameNameTypeCandidates = ({
|
||||
callSiteFilePath,
|
||||
candidates,
|
||||
}: {
|
||||
readonly typeName: string;
|
||||
readonly callSiteFilePath: string;
|
||||
readonly candidates: readonly SymbolDefinition[];
|
||||
}): readonly SymbolDefinition[] | null => {
|
||||
if (!callSiteFilePath.endsWith('.swift')) return null;
|
||||
if (candidates.length <= 1) return null;
|
||||
if (!candidates.every((c) => c.type === candidates[0].type)) return null;
|
||||
if (candidates[0].type !== 'Class' && candidates[0].type !== 'Struct') return null;
|
||||
|
|
|
|||
16
gitnexus/vendor/tree-sitter-swift/README.md
vendored
16
gitnexus/vendor/tree-sitter-swift/README.md
vendored
|
|
@ -1,3 +1,15 @@
|
|||
## GitNexus vendor notice
|
||||
|
||||
This directory is a GitNexus-managed vendored copy of the official
|
||||
`tree-sitter-swift@0.7.1` npm runtime package, including its official native
|
||||
prebuilds. GitNexus keeps the top-level `tree-sitter` dependency pinned to
|
||||
`^0.21.1` until the broader parser runtime upgrade is handled separately.
|
||||
|
||||
When updating this vendor package, replace it from an official
|
||||
`tree-sitter-swift` npm release, keep the native `prebuilds/` artifacts, update
|
||||
the `_vendoredBy` provenance fields in `package.json`, and verify the packed
|
||||
GitNexus tarball can load `tree-sitter-swift`.
|
||||
|
||||

|
||||
[](https://crates.io/crates/tree-sitter-swift)
|
||||
[](https://www.npmjs.com/package/tree-sitter-swift)
|
||||
|
|
@ -87,12 +99,12 @@ module. [see](https://github.com/tree-sitter/tree-sitter/blob/master/lib/binding
|
|||
3. Boot tree-sitter wasm like this.
|
||||
|
||||
```js
|
||||
const Parser = require("web-tree-sitter");
|
||||
const Parser = require('web-tree-sitter');
|
||||
async function run() {
|
||||
//needs to happen first
|
||||
await Parser.init();
|
||||
//wait for the load of swift
|
||||
const Swift = await Parser.Language.load("./tree-sitter-swift.wasm");
|
||||
const Swift = await Parser.Language.load('./tree-sitter-swift.wasm');
|
||||
|
||||
const parser = new Parser();
|
||||
parser.setLanguage(Swift);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue