{"id":13775185,"url":"https://github.com/shrynx/rollup-plugin-bucklescript","last_synced_at":"2025-05-11T07:32:10.803Z","repository":{"id":65412115,"uuid":"109090628","full_name":"shrynx/rollup-plugin-bucklescript","owner":"shrynx","description":"rollup plugin for using bucklescript","archived":true,"fork":false,"pushed_at":"2018-08-02T16:08:23.000Z","size":51,"stargazers_count":23,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-11T19:24:23.144Z","etag":null,"topics":["bucklescript","reason","reasonml","rollup-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/rollup-plugin-bucklescript","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shrynx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-01T05:26:50.000Z","updated_at":"2023-12-04T16:44:00.000Z","dependencies_parsed_at":"2023-01-22T07:35:14.353Z","dependency_job_id":null,"html_url":"https://github.com/shrynx/rollup-plugin-bucklescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrynx%2Frollup-plugin-bucklescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrynx%2Frollup-plugin-bucklescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrynx%2Frollup-plugin-bucklescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrynx%2Frollup-plugin-bucklescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shrynx","download_url":"https://codeload.github.com/shrynx/rollup-plugin-bucklescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224685874,"owners_count":17352794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bucklescript","reason","reasonml","rollup-plugin"],"created_at":"2024-08-03T17:01:35.010Z","updated_at":"2024-11-17T10:30:44.328Z","avatar_url":"https://github.com/shrynx.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Transpilation"],"readme":"# rollup-plugin-bucklescript\n\n![dependency-status](https://david-dm.org/shrynx/rollup-plugin-bucklescript.svg)\n[![npm version](https://badge.fury.io/js/rollup-plugin-bucklescript.svg)](https://badge.fury.io/js/rollup-plugin-bucklescript)\n\n\u003e [bucklescript](https://github.com/BuckleScript/bucklescript) compiler plugin for [rollup.js](https://rollupjs.org/)\n\nworks with both [ReasonML](https://reasonml.github.io/) and [OCaml](http://ocaml.org/)\n\n## Usage\n\n### Installation\n\nFirst install `bs-platform` in your project\n\n```shell\nnpm i -D bs-platform\n```\n\ncreate a `bsconfig.json` for Bucklescript in the root directory of your project\n\nand remember to specify `\"package-specs\"` as `[\"es6\"]`, so that rollup can consume it.\n\n```javascript\n{\n  \"name\": \"hello\",\n  \"sources\": [\"src\"],\n  \"bs-dependencies\": [\"reason-react\"],\n  \"reason\": {\n    \"react-jsx\": 2\n  },\n  \"package-specs\": [\"es6\"],\n  \"refmt\": 3\n}\n```\n\nFinally, install `rollup-plugin-bucklescript`\n\n```shell\nnpm i -D rollup-plugin-bucklescript\n```\n\nand add it to your rollup config.\n\n```javascript\nimport bucklescript from 'rollup-plugin-bucklescript'\n\nexport default {\n  input: 'src/main.re',\n  output: {\n    file: 'dist/main.js',\n    format: 'cjs',\n  },\n  plugins: [\n    bucklescript()\n  ],\n}\n```\n\n### Options\n\nAll the settings are taken from `bsconfig.json`, but few options can be overridden.\n\n### `include` and `exclude`\n\n each a minimatch pattern, or array of minimatch patterns, which determines which files are complied by Bucklescript.\n By default all  `.re` and `.ml` are included and all `.rei` and `.mli` are excluded.\n\n### `module`\n\nTo specify bucklescript output type for rollup to consume.\n\n**Note: Please check the [Caveats](#caveats) section**\n\n```javascript\n...\n\nplugins: [\n  bucklescript({\n    module: 'es6'\n  })\n]\n```\n\n### `inSource`\n\nTo use bs-loader with [bsb's in-souce builds](https://bucklescript.github.io/bucklescript/Manual.html#_in_source_build_support_since_1_9_0),\nadd the `inSource` option to your loader config:\n\n```javascript\n...\n\nplugins: [\n  bucklescript({\n    inSource: false\n  })\n]\n```\n\n### `cwd`\n\nThis option specifies what directory to run `bsb` from.\n\n```javascript\n...\n\nplugins: [\n  bucklescript({\n    cwd: 'path/to/dir'\n  })\n]\n```\n\n### `showWarnings`\n\nControls whether `bsb` compile warnings are shown. Defaults to `true`.\n\n```javascript\n...\n\nplugins: [\n  bucklescript({\n    showWarnings: true\n  })\n]\n```\n\n### `includeStandardLibrary`\n\n**Note: This is an advance feature and may not work as intended**\nBucklescript comes with OCaml standard library complied to javascript. \nChoose whether to bundle functions from standard library.\nDefaults to `true`.\n\n## Examples\n\nCheck the [examples folder](https://github.com/shrynx/rollup-plugin-bucklescript/tree/master/examples) in the github repo.\n\n## Caveats\n\nPlease use `es6` for `module` option as rollup works only with es modules.\nBut this breaks integration with with react, \nthought it can be easily solved by following the helpful error message provided by rollup.\n\nor check the [react example](https://github.com/shrynx/rollup-plugin-bucklescript/tree/master/examples/react) folder.\n\n## Acknowledgement\n\n-   [bs-loader](https://github.com/reasonml-community/bs-loader) - A webpack plugin for bucklescript,\n    for providing `bsb-js` and `read-bsconfig`.\n-   Reason team at facebook and all the project contributors for making ReasonML\n-   [@bobzhang](https://github.com/bobzhang) and all contributors of bucklescript.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrynx%2Frollup-plugin-bucklescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshrynx%2Frollup-plugin-bucklescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrynx%2Frollup-plugin-bucklescript/lists"}