Packages

kysely

0.29.9 · 12 Nov 2026MIT32M / weekRepositoryHomepagenpmAtom feed

Your version

0.19.0

11 May 2022Where it was published

0.29.9 is the newest release of 0.19.x.

Security

Release note

What's new

Kysely now has absolutely no internal dependecies to anything. Not even dynamic ones. The same code runs on node, deno, browser and is compatible with all bundlers out of the box! All dependencies are passed from the outside.

Breaking changes

The dialects now take an instance of the underlying db drivers's pool (or other connection object if a pool is not available). This is how you'd create an instance of Kysely in 0.19.0:

import { Pool } from 'pg'

const db = new Kysely<Database>({
  dialect: new PostgresDialect({
    pool: new Pool({
      host: 'localhost',
      database: 'kysely_test'
    })
  })
})
import { createPool } from 'mysql2'

const db = new Kysely<Database>({
  dialect: new MysqlDialect({
    pool: createPool({
      host: 'localhost',
      database: 'kysely_test'
    })
  })
})
import Database from 'better-sqlite3'

const db = new Kysely<Database>({
  dialect: new SqliteDialect({
    database: new Database('db.sqlite')
  })
})

If you want to initialize the pool lazily when it's used for the first time, you can use a thunk:

import { Pool } from 'pg'

const db = new Kysely<Database>({
  dialect: new PostgresDialect({
    pool: async () => new Pool({
      host: 'localhost',
      database: 'kysely_test'
    })
  })
})

FileMigrationProvider

I also changed the FileMigrationProvider once again, even though I promised never to do that again 😞. This was done to get rid of all dependencies. You now need to use the class like this:

import { promises as fs } from 'fs'
import path from 'path'

new FileMigrationProvider({
  fs,
  path,
  migrationFolder: 'path/to/migrations/folder',
})

Deno and browser builds

There's no more need for the index-nodeless file and it has been removed. You can simply import kysely or the index.ts file from the dist folder. Nothing refers to node or any node library.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.