Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

mateiadrielrafael/esbuild-plugin-purescript

 
 

Repository files navigation

🚧 This repo has been moved to prescientmoon/esbuild-plugin-purescript 🚧

PureScript esbuild plugin

esbuild integration for PureScript

What this plugin does:

  • Allows you to import .purs files directly from your JavaScript

What this plugin does not do:

  • Run spago build or similar commands for you. This plugin will only point esbuild to your existing output directory
  • Tree shake using zephyr for you. If you want to use zephyr, check out this example

Usage

First, install the library from npm:

npm install esbuild-plugin-purescript

Example build.js:

const esbuild = require("esbuild");
const PureScriptPlugin = require("esbuild-plugin-purescript");
const path = require("path");

esbuild
  .build({
    entryPoints: ["src/index.js"],
    bundle: true,
    outdir: "dist",
    plugins: [
      PureScriptPlugin({
        output: path.resolve(
          __dirname,
          "myOutput"
        ) /* set to 'output' by default */,
        sources: [
          "some/**/glob/*.purs",
        ] /* set to `spago sources` by default */,
      }),
    ],
  })
  .catch((_e) => process.exit(1));

Example src/index.js:

import { main } from "./Main.purs";

console.log("Loaded PureScript code 🚀");

main();

About

esbuild integration for PureScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 62.2%
  • Dhall 22.0%
  • PureScript 15.8%