Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bsb-native

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bsb-native

bucklescript compiler, ocaml standard libary by bucklescript and its required runtime support

  • 1.8.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
increased by420%
Maintainers
1
Weekly downloads
 
Created
Source

bsb-native

Bsb-native is like bsb, but compiles to native OCaml instead.

Install

  1. Add "bsb-native": "bsansouci/bsb-native" as a devDependency to your package.json
  2. Add a bsconfig.json like you would for bsb. Bsb-native uses the same schema, located here

For example:

{
  "name" : "NameOfLibrary",
  "sources" : "src",
  "entries": [{
    "kind": "bytecode",
    "main": "Index"
  }]
}

Run

./node_modules/.bin/bsb (or add an npm script to simply run bsb)

Useful flags

The -make-world flag builds all of the dependencies.

The -w enabled the watch mode which will rebuild on any source file change.

The -backend [js|bytecode|native] flag tells bsb-native to build all entries in the bsconfig.json to either js, bytecode or native.

The build artifacts are put into the folder lib/bs. The bytecode executable would be at lib/bs/bytecode/index.byte and the native one at lib/bs/native/index.native.

Multi-target

bsb-native actually supports building Reason/OCaml to JS as well as to native/bytecode. What that enables is code that is truly cross platform, that depends on a JS implementation of a library or a native implementation, and bsb-native will build the right implementation depending on what you target.

For example, you can write code that depends on the module Reasongl, and bsb-native will use ReasonglNative as the implementation for Reasongl when building to native/bytecode or it'll use ReasonglWeb when building to JS.

Currently the way this works is to have each platform specific dependency expose a module with the same name and rely on the field allowed-build-kinds in the bsconfig.json to tell bsb-native which one of platform specific dep you want to build, given that you want to build the whole project to a specific target. Say you target JS, then ReasonglWeb will get built which exposes its own Reasongl module.

Keywords

FAQs

Package last updated on 17 Aug 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc