0.0.3 • Published 2 years ago

rollup-plugin-node-deno v0.0.3

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

rollup-plugin-node-deno

Convert NodeJS to Deno compatible code with rollup.

  • Converts builtin imports to deno node compat
  • Injects polyfills for global built-ins like timers by usage

🧪 Note: This is an experimental plugin.

Install

# npm
npm install rollup-plugin-node-deno

# yarn
yarn add rollup-plugin-node-deno

Usage

Example rollup.config file:

Note: Config below needs installing @rollup/plugin-node-resolve @rollup/plugin-commonjs @rollup/plugin-json.

import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import deno from 'rollup-plugin-node-deno'

export default {
  input: 'src/index.mjs',
  output: {
    file: 'dist/index.mjs',
    format: 'esm'
  },
  plugins: [
    deno(),
    resolve(),
    json(),
    commonjs()
  ]
}

Support

Deno Node compatibility (https://deno.land/std@0.160.0/node/README.md):

  • assert
  • assert/strict partly
  • async_hooks partly
  • buffer
  • child_process partly
  • cluster partly
  • console partly
  • constants partly
  • crypto partly
  • dgram partly
  • diagnostics_channel
  • dns partly
  • events
  • fs partly
  • fs/promises partly
  • http partly
  • http2
  • https partly
  • inspector partly
  • module
  • net
  • os partly
  • path
  • path/posix
  • path/win32
  • perf_hooks
  • process partly
  • punycode
  • querystring
  • readline
  • repl partly
  • stream
  • stream/promises
  • stream/web partly
  • string_decoder
  • sys
  • timers
  • timers/promises
  • tls
  • trace_events
  • tty partly
  • url
  • util partly
  • util/types partly
  • v8
  • vm partly
  • wasi
  • webcrypto
  • worker_threads
  • zlib

Extras: (see ./lib/extras)

Globals:

  • process
  • global (~> globalThis)
  • Buffer
  • Timers (setTimeout, clearTimeout, setInterval, clearInterval, setImmediate, clearImmediate)

Related

License

MIT