Skip to content

Get ready for V6

Pre-release
Pre-release
Compare
Choose a tag to compare
@Julien-R44 Julien-R44 released this 21 Jun 00:56

Package is now only ESM. Ready to be used with AdonisJS v6 after some polish

Breaking changes

  • ESM only
  • Repl constructor signature has changed. It now accepts an object of options instead of individual arguments :

Before :

new Repl(adonisRequireTs, '.history_file_name')

Now :

new Repl({ compiler, historyFilePath })

compiler must follow the given interface :

interface Compiler {
  compile (contents: string, filename: string): string
  supportsTypescript: boolean
}

That means you are not forced to use @adonisjs/require-ts anymore. In theory, any TypeScript compiler should work. Tried with tsc and swc and both worked fine.

  • Since Node.js REPL isn't executed in a ESM context, you can't directly use the import statement. Instead, all modules should be imported with dynamic imports. For example :
// Before
import { foo } from './bar'

// Now
const { foo } = await import('./bar')

However, note that you can still use the import statement in the file you are importing through dynamic imports. and ESM is fully supported in those files because they are handled by the Node.js loader

New features

  • Added syntax highlighting in the REPL
  • Also added bracket matching. That means when you are hovering a bracket, the matching one will be highlighted.

v3.1.11...v4.0.0-0