@mattbasta/prql-js
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

prql-js

JavaScript bindings for prql-compiler. Check out https://prql-lang.org for more context.

This uses wasm-pack to generate bindings1.

Installation

To install the currently published version:

npm install prql-js

This package is built to target a bundler (i.e. webpack). To use it with Node.js or import it directly in a browser as an ES module, build it using a suitable --target.

Usage

import compile from "prql-js";

const { sql, error } = compile(`from employees | select first_name`);
console.log(sql);

Prints:

SELECT
  first_name
FROM
  employees

For more information about the language, see reference book.

Development

Build:

wasm-pack build

This builds a node package in the pkg path. An example of including that as a dependency is in playground.

Test:

wasm-pack test --firefox
  1. though we would be very open to other approaches, and used trunk successfully in a rust-driven approach to this, RIP prql-web.

/@mattbasta/prql-js/

    Package Sidebar

    Install

    npm i @mattbasta/prql-js

    Weekly Downloads

    0

    Version

    0.2.0

    License

    Apache-2.0

    Unpacked Size

    1.07 MB

    Total Files

    6

    Last publish

    Collaborators

    • mattbasta