Skip to content

[FEATURE]: Support BunJS for Drizzle-kit #4341

Open
@cooffeeRequired

Description

@cooffeeRequired

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Hello there, i just wrote simple polyfil for BunJS and drizzle-kit studio.

LINE: 88605 -> 88643

import zlib from 'node:zlib';

function polyfilCompressionStream() {
  // @bun

const make = (ctx, handle) => Object.assign(ctx, {
    writable: new WritableStream({
      write: chunk => handle.write(chunk),
      close: () => handle.end()
    }),
    readable: new ReadableStream({
      type: 'bytes',
      start (ctrl) {
        handle.on('data', chunk => ctrl.enqueue(chunk))
        handle.once('end', () => ctrl.close())
      }
    })
  })

globalThis.CompressionStream ??= class CompressionStream {
    constructor(format) {
        make(this, format === 'deflate' ? zlib.createDeflate() :
        format === 'gzip' ? zlib.createGzip() : zlib.createDeflateRaw())
    }
}

globalThis.DecompressionStream ??= class DecompressionStream {
    constructor(format) {
        make(this, format === 'deflate' ? zlib.createInflate() :
        format === 'gzip' ? zlib.createGunzip() :
        zlib.createInflateRaw())
    }
}
}


if (typeof globalThis.CompressionStream === 'undefined') {
  polyfilCompressionStream();
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions