pgvector / pgvector-node

pgvector support for Node.js, Deno, and Bun (and TypeScript)
MIT License
303 stars 9 forks source link

feat: Add ESM support with dual-module setup #6

Closed pnutmath closed 1 year ago

pnutmath commented 1 year ago

feat: Add ESM support with dual-module setup

To solve issue #5

pnutmath commented 1 year ago

@ankane Please review this.

Test case results:

➜  pgvector-node git:(master) ✗ yarn test
yarn run v1.22.19
$ node --experimental-vm-modules ./node_modules/.bin/jest
(node:97680) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  src/prisma/index.test.js
 PASS  src/pg/index.test.js
  ● Console

    console.log
      rows [
        { id: 1, embedding: [ 1, 2, 3 ] },
        { id: 2, embedding: [ 1, 2, 3 ] }
      ]

      at Object.<anonymous> (src/pg/index.test.js:31:11)

 PASS  src/pg-promise/index.test.js
 PASS  src/sequelize/index.test.js

Test Suites: 4 passed, 4 total
Tests:       12 passed, 12 total
Snapshots:   0 total
Time:        1.538 s, estimated 2 s
Ran all test suites.
✨  Done in 2.19s.
vishu3011 commented 1 year ago

+1 to this PR, it is required for my project also thanks @pnutmath for raising the same

pnutmath commented 1 year ago

@vishu3011 You can add this package as Github repo till it gets verified and merge!

"pgvector": "github:pnutmath/pgvector-node",
ankane commented 1 year ago

Hi @pnutmath, thanks for reporting and the PR. Pushed a fix in the commit above.