Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
babel-plugin-bucklescript
Advanced tools
Write ReasonML and Bucklescript in your existing babel projects
Write ReasonML and Bucklescript in your existing babel projects
Functional programming is cool. ReasonML is cool. Bucklescript is cool. But you may not have the opportunity to start a new project or rewrite an existing one in those languages. In that case, babel-plugin-bucklescript
is here for you!
babel-plugin-bucklescript
lets you easily add ReasonML or Bucklescript projects to your existing codebases via a babel plugin. It relies on existing tools like bs-platform
to work. And since bs-platform
is amazingly fast, so is this plugin. It works for node-style require
calls as well as ES2015 import
statements.
To get started, add babel-plugin-bucklescript
and bs-platform
to your project's dev dependencies.
# with good ol' npm
npm install -D babel-plugin-bucklescript bs-platform
# with yarn
yarn add -D babel-plugin-bucklescript bs-platform
After that's finished, add the plugin to your babel dependencies. By default, this plugin will assume you're using the js
package spec. For more information, see the bucklescript manual on using bsb.
{
"plugins": ["babel-plugin-bucklescript"]
}
If, however, you want to compile to amdjs
or es6
, you can pass that in as an option.
{
"plugins": [
["babel-plugin-bucklescript", { "module": "es6" }]
]
}
Finally, you'll want to add a bsconfig.json
file in the root of your project. Note that by default, bsb
will compile to a folder called lib
in the root of your project, no matter where your source code is. Take that into account when building your project. As of right now, this plugin only supports that compilation directory.
{
"name": "your-cool-project",
"sources": ["src"],
"bs-dependencies": ["reason-react"],
"reason": {
"react-jsx": 2
},
"package-specs": ["commonjs"]
}
/* In a file called test.re */
let add x y => x + y
// In a file called index.js
const { add } = require("./test.re");
console.log(add(1, 2)) // -> 3
Issues and Pull requests are both welcomed! Prettier is enabled by default as a pre-commit hook, but feel free to add it to your editor.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
FAQs
Write ReasonML and Bucklescript in your existing babel projects
The npm package babel-plugin-bucklescript receives a total of 12 weekly downloads. As such, babel-plugin-bucklescript popularity was classified as not popular.
We found that babel-plugin-bucklescript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.