mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-13 14:16:54 +00:00
## Summary
`@lancedb/lancedb` pins the optional dependency
`@huggingface/transformers` at 3.0.2, which requires `sharp ^0.33.5`.
Every npm install of LanceDB therefore pulled in a sharp version with
critical advisories (GHSA-wq5f-xc86-pv6w, GHSA-rgj7-g3m4-5g8c). No 3.x
release of transformers allows a patched sharp, so this upgrades to
4.3.2, which requires `sharp ^0.35.4`. A fresh install resolves that
range to 0.35.5, the first release that fixes both advisories.
- `nodejs/package.json`: `@huggingface/transformers` 3.0.2 → 4.3.2.
- `nodejs/pnpm-workspace.yaml`: remove the `sharp: ^0.35.4` override. It
only covered our own install, not consumers, and transformers now
requires that range itself.
- `nodejs/examples`: transformers 3.0.2 → 4.3.2, sharp 0.33.5 → 0.35.5.
- Both lockfiles resolve sharp to 0.35.5; `pnpm audit` reports no sharp
advisories in either.
`TransformersEmbeddingFunction` needed no code changes. The transformers
types are only used in private fields, so the published typings don't
change.
`docs/web-tests/ts` and `docs/web-tests/blob-v2/ts` are left alone: they
resolve transformers through a published `@lancedb/lancedb`, so they
pick this up after a release.
## Evidence
Embeddings from the built-in `huggingface` embedding function (default
`Xenova/all-MiniLM-L6-v2`) on 4.3.2, compared with the same mean pooling
on 3.0.2, for three sentences:
```
transformers 4.3.2: 3 x 384
text 0: max|diff|=6.62e-07 cosine=1.00000000
text 1: max|diff|=6.26e-07 cosine=1.00000000
text 2: max|diff|=7.33e-07 cosine=1.00000000
```
End to end through a table, `search("a feline sat down")` returns `["The
cat sat on the mat.", "A dog barked at the mailman."]`.
## Merge Risk
**Door:** Two-way. A revert restores the 3.0.2 pin.
**Blast Radius:** Node `huggingface` embedding function, and install
footprint of the optional dependency (onnxruntime-node 1.19.2 → 1.30.0,
which still downloads the CUDA provider on Linux x64 by default, as
1.19.2 did).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.3 KiB
JSON
36 lines
1.3 KiB
JSON
{
|
|
"name": "examples",
|
|
"version": "1.0.0",
|
|
"description": "Examples for LanceDB",
|
|
"main": "index.js",
|
|
"type": "module",
|
|
"scripts": {
|
|
"//1": "--experimental-vm-modules is needed to run jest with sentence-transformers",
|
|
"//2": "--testEnvironment is needed to run jest with sentence-transformers",
|
|
"//3": "See: https://github.com/huggingface/transformers.js/issues/57",
|
|
"//4": "jest is invoked by its JS entry, not node_modules/.bin/jest: under pnpm that path is a shell shim, which `node` cannot execute",
|
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --testEnvironment jest-environment-node-single-context --verbose",
|
|
"lint": "biome check *.ts && biome format *.ts",
|
|
"lint-ci": "biome ci .",
|
|
"lint-fix": "biome check --write *.ts && pnpm format",
|
|
"format": "biome format --write *.ts"
|
|
},
|
|
"author": "Lance Devs",
|
|
"license": "Apache-2.0",
|
|
"packageManager": "pnpm@11.1.1",
|
|
"dependencies": {
|
|
"@huggingface/transformers": "4.3.2",
|
|
"@lancedb/lancedb": "file:../dist",
|
|
"openai": "4.29.2",
|
|
"sharp": "0.35.5"
|
|
},
|
|
"devDependencies": {
|
|
"@biomejs/biome": "^1.7.3",
|
|
"@jest/globals": "^29.7.0",
|
|
"jest": "^29.7.0",
|
|
"jest-environment-node-single-context": "^29.4.0",
|
|
"ts-jest": "^29.2.5",
|
|
"typescript": "^5.5.4"
|
|
}
|
|
}
|