{"_id":"@binclusive/tree-sitter-swift-wasm","name":"@binclusive/tree-sitter-swift-wasm","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@binclusive/tree-sitter-swift-wasm","version":"0.1.0","description":"The tree-sitter Swift grammar (alex-pinkus/tree-sitter-swift 0.7.3) vendored as a checksum-pinned wasm asset, resolvable by package name.","license":"MIT","homepage":"https://github.com/Binclusive/monorepo/tree/main/packages/tree-sitter-swift-wasm","repository":{"type":"git","url":"git+https://github.com/Binclusive/monorepo.git","directory":"packages/tree-sitter-swift-wasm"},"keywords":["tree-sitter","swift","wasm","grammar"],"type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./tree-sitter-swift.wasm":"./wasm/tree-sitter-swift.wasm","./package.json":"./package.json"},"engines":{"node":">=20"},"publishConfig":{"access":"public"},"devDependencies":{"tsup":"^8.0.0","typescript":"5.8.3","vitest":"~3.0.7","web-tree-sitter":"0.26.11","zod":"4.0.0","@binclusive/tsconfig":"^0.0.0"},"scripts":{"build":"tsup","typecheck":"tsc --noEmit","test":"vitest run","verify:tarball":"bash scripts/verify-tarball.sh"},"module":"./dist/index.js","_id":"@binclusive/tree-sitter-swift-wasm@0.1.0","bugs":{"url":"https://github.com/Binclusive/monorepo/issues"},"_integrity":"sha512-QZr3UahyLhPUZtBmcleKzx/TTWT4dcXv9Xb8OeGrubtqsu1aNbaBYrlzeiM4XZzmm/Q+YDQEnk7/rg15SGZU1A==","_resolved":"/private/tmp/claude-501/-Users-cansirin-Documents-development-Binclusive-monorepo/16d6b2a4-8660-4b55-b1fd-453a173592e3/scratchpad/publish-wt/packages/tree-sitter-swift-wasm/binclusive-tree-sitter-swift-wasm-0.1.0.tgz","_from":"file:binclusive-tree-sitter-swift-wasm-0.1.0.tgz","_nodeVersion":"26.2.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-QZr3UahyLhPUZtBmcleKzx/TTWT4dcXv9Xb8OeGrubtqsu1aNbaBYrlzeiM4XZzmm/Q+YDQEnk7/rg15SGZU1A==","shasum":"4d460f8ad789c56f274004070be5bb11ed1a9333","tarball":"https://registry.npmjs.org/@binclusive/tree-sitter-swift-wasm/-/tree-sitter-swift-wasm-0.1.0.tgz","fileCount":8,"unpackedSize":3840612,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBB1xYacwZ5E6CAOPhDQC6v4a5QqT/ftsbpxhjoWXTSfAiEA/bcGInWoi26pekvuKAHj3o3ZPGowatsmH24VAqpyOgw="}]},"_npmUser":{"name":"cansirin","email":"cansirin12@gmail.com"},"directories":{},"maintainers":[{"name":"luuwa","email":"m.mucahitozekinci@gmail.com"},{"name":"cansirin","email":"cansirin12@gmail.com"},{"name":"binclusive-eng","email":"eng@binclusive.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tree-sitter-swift-wasm_0.1.0_1785026221262_0.9074216619034823"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-26T00:37:01.065Z","0.1.0":"2026-07-26T00:37:01.448Z","modified":"2026-07-26T00:37:01.719Z"},"maintainers":[{"name":"luuwa","email":"m.mucahitozekinci@gmail.com"},{"name":"cansirin","email":"cansirin12@gmail.com"},{"name":"binclusive-eng","email":"eng@binclusive.io"}],"description":"The tree-sitter Swift grammar (alex-pinkus/tree-sitter-swift 0.7.3) vendored as a checksum-pinned wasm asset, resolvable by package name.","homepage":"https://github.com/Binclusive/monorepo/tree/main/packages/tree-sitter-swift-wasm","keywords":["tree-sitter","swift","wasm","grammar"],"repository":{"type":"git","url":"git+https://github.com/Binclusive/monorepo.git","directory":"packages/tree-sitter-swift-wasm"},"bugs":{"url":"https://github.com/Binclusive/monorepo/issues"},"license":"MIT","readme":"# `@binclusive/tree-sitter-swift-wasm`\n\nThe [tree-sitter Swift grammar](https://github.com/alex-pinkus/tree-sitter-swift) vendored as a\nchecksum-pinned `.wasm` asset, with zero runtime dependencies.\n\nUpstream publishes the wasm **only as a GitHub release asset**, so there is nothing on npm to\ndepend on. This package republishes the asset unmodified, which lets a consumer resolve the\ngrammar by **package name** through ordinary module resolution instead of standing up a second\nacquisition mechanism for one language. Full provenance, the reproduce command and the upgrade\nprocedure are in [`PROVENANCE.md`](./PROVENANCE.md).\n\n## Install\n\nPin it **exactly**. The grammar version decides what the scanner can see, so it is a correctness\ninput, not a compatible-upgrade axis:\n\n```sh\npnpm add -E @binclusive/tree-sitter-swift-wasm\n```\n\n## Use\n\n```ts\nimport { readFile } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n  SWIFT_GRAMMAR,\n  SWIFT_GRAMMAR_WASM_SPECIFIER,\n} from \"@binclusive/tree-sitter-swift-wasm\";\nimport { Language, Parser } from \"web-tree-sitter\";\n\nconst wasmPath = fileURLToPath(import.meta.resolve(SWIFT_GRAMMAR_WASM_SPECIFIER));\n\n// Verify before you parse: a wrong or truncated grammar under-parses SILENTLY, so it\n// surfaces as missing findings rather than an error.\nconst bytes = await readFile(wasmPath);\nconst digest = Buffer.from(\n  await crypto.subtle.digest(\"SHA-256\", bytes),\n).toString(\"hex\");\nif (digest !== SWIFT_GRAMMAR.sha256) throw new Error(\"Swift grammar digest mismatch\");\n\nawait Parser.init();\nconst parser = new Parser();\nparser.setLanguage(await Language.load(wasmPath));\n```\n\n`import.meta.resolve` is the load-bearing detail: resolution runs through this package's\n`exports` map by name. A directory join off the *consumer's* `import.meta.url` is the exact\nmechanism behind #3120 — it resolves on the machine that built the image and nowhere else.\n\n## Exports\n\n| Specifier | What |\n| --- | --- |\n| `@binclusive/tree-sitter-swift-wasm` | `SWIFT_GRAMMAR` (upstream repo, release tag, asset name, byte length, SHA-256, ABI, licence) and `SWIFT_GRAMMAR_WASM_SPECIFIER` |\n| `@binclusive/tree-sitter-swift-wasm/tree-sitter-swift.wasm` | the grammar bytes |\n\nThe entry point is constants only — no `node:` imports, no runtime dependency — so it loads on\nNode, Workers and the browser alike.\n\n## Publishing\n\nThe workspace tests verify the committed bytes; `verify:tarball` verifies the artifact a customer\nactually receives. It packs, installs the tarball into a throwaway directory outside this repo,\nresolves the wasm **by package name** from that install and parses Swift with it — so a broken\n`files` list or `publishConfig` exports map fails here rather than at a consumer:\n\n```sh\npnpm --filter @binclusive/tree-sitter-swift-wasm verify:tarball\n```\n\nThen publish the tarball (this workspace publishes packed tarballs rather than running\n`pnpm publish` in place):\n\n```sh\ncd packages/tree-sitter-swift-wasm\npnpm build\npnpm pack\nnpm publish --access public binclusive-tree-sitter-swift-wasm-<version>.tgz\n```\n\nA freshly published version is not installable in this workspace for about a day — the\n`minimumReleaseAge` supply-chain gate rejects it — so publish **before** the consumer bump that\nneeds it, not alongside.\n\n## Licence\n\nThe grammar is MIT, © 2021 alex-pinkus. The upstream notice ships verbatim in\n[`LICENSE`](./LICENSE) and applies to the vendored wasm, which is the unmodified upstream\nartifact. This package adds no separately-licensed code.\n","readmeFilename":"README.md","_rev":"1-133e099e4209d43c6cac6f0aa088e885"}