Skip to content

v1.36.0

Choose a tag to compare

@github-actions github-actions released this 21 Oct 13:12
· 34 commits to main since this release
v1.36.0

Addons can now be loaded as WebAssembly, sandboxed through WASI, by importing a package with the host attribute. For example, here is SQLite whose only access to the filesystem is the data directory:

wasi.js

const { DirectorySync } = require('bare-directory')
const { HostDirectory } = require('bare-wasi/host')

module.exports = (url) => ({
  version: 'preview1',
  preopens: {
    '/': new HostDirectory(DirectorySync.open(__dirname + '/data'))
  }
})

app.js

const { DatabaseSync } = require('bare-sqlite', {
  with: { host: 'wasi-wasm32', wasi: './wasi.js' }
})

const db = new DatabaseSync('/books.db')

db.exec(`
  CREATE TABLE books (id INTEGER PRIMARY KEY, title TEXT);
  INSERT INTO books (title) VALUES ('Dune'), ('Foundation');
`)

for (const row of db.prepare('SELECT id, title FROM books').iterate()) {
  console.log(row)
}

db.close()

What's Changed

New Contributors

Full Changelog: v1.35.1...v1.36.0