{"id":19507057,"url":"https://github.com/pauan/rollup-plugin-purs","last_synced_at":"2025-04-26T02:33:08.585Z","repository":{"id":48257498,"uuid":"77335345","full_name":"Pauan/rollup-plugin-purs","owner":"Pauan","description":"Bundles PureScript modules with Rollup","archived":false,"fork":false,"pushed_at":"2021-08-04T05:11:30.000Z","size":947,"stargazers_count":72,"open_issues_count":30,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-13T08:40:51.732Z","etag":null,"topics":["plugin","purescript","rollup","rollup-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pauan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-25T17:03:52.000Z","updated_at":"2024-01-31T13:39:09.000Z","dependencies_parsed_at":"2022-08-24T04:20:40.310Z","dependency_job_id":null,"html_url":"https://github.com/Pauan/rollup-plugin-purs","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/Pauan%2Frollup-plugin-purs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pauan%2Frollup-plugin-purs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pauan%2Frollup-plugin-purs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pauan%2Frollup-plugin-purs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pauan","download_url":"https://codeload.github.com/Pauan/rollup-plugin-purs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224023732,"owners_count":17242998,"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":["plugin","purescript","rollup","rollup-plugin"],"created_at":"2024-11-10T22:39:20.116Z","updated_at":"2024-11-10T22:39:21.264Z","avatar_url":"https://github.com/Pauan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-purs\n\nBundles PureScript modules with Rollup\n\n\n## Why Rollup?\n\nHere are the file sizes for the `examples/tab-organizer` program:\n\n| Bundler            | Unminified | JSMin      | UglifyJS   |\n| ------------------ | ---------: | ---------: | ---------: |\n| rollup-plugin-purs | `112.2 kB` | `70.3 kB`  | `35.7 kB`  |\n| purs bundle        | `157.8 kB` | `107.2 kB` | `65.2 kB`  |\n| webpack            | `977.4 kB` | `654.0 kB` | `178.8 kB` |\n\n\n## Installation\n\n1. Add the following to your `package.json`:\n\n   ```json\n   \"devDependencies\": {\n     \"rollup\": \"^0.41.6\",\n     \"rollup-plugin-purs\": \"^1.0.35\"\n   },\n   \"scripts\": {\n     \"build\": \"rollup --config\"\n   }\n   ```\n\n2. Run `npm install`\n\n3. Place this code into a file called `rollup.config.js`:\n\n   ```js\n   import purs from \"rollup-plugin-purs\";\n\n   export default {\n     entry: \"src/Main.purs\",\n     dest: \"bundle.js\",\n     format: \"iife\",\n     sourceMap: true,\n     plugins: [\n       purs()\n     ]\n   };\n   ```\n\n4. This plugin does **not** compile PureScript code, so you will need to run `pulp build -- --source-maps` (or equivalent)\n\n5. Run `npm run build`\n\n6. The final bundle is in the `bundle.js` file. Enjoy the smaller file size and optimizations!\n\nYou can see an example program in the `examples/pulp init` folder.\n\n\n## Options\n\nThese are the default options:\n\n```js\npurs({\n  include: undefined,      // Glob pattern for files/directories to include\n  exclude: undefined,      // Glob pattern for files/directories to exclude\n  buildDir: \"output\",      // Directory where the `purs compile` files are located\n  runMain: true,           // Whether to call the `main` function or not\n  debug: true,             // Displays additional warnings and statistics\n  optimizations: {\n    uncurry: true,         // Whether to apply the uncurrying optimization or not\n    inline: true,          // Whether to inline some functions or not\n    removeDeadCode: true,  // Whether to remove dead code or not\n    assumePureVars: true   // Whether to assume that variable assignment is always pure\n  }\n})\n```\n\nThe default options should be fine for most use cases.\n\n\n## Optimizations\n\nThese are the optimizations which can be turned on or off:\n\n* `uncurry`\n\n  Replaces curried functions with uncurried functions, for improved performance and smaller file size.\n\n* `inline`\n\n  Inlines some functions, which can increase performance and decrease the file size.\n\n  It also inlines typeclass instance methods when it can. This can dramatically improve performance and reduce the file size.\n\n* `removeDeadCode`\n\n  Removes code which is not used. This dramatically reduces the file size.\n\n* `assumePureVars`\n\n  When there is a variable assignment like `var foo = ...` it will assume that the `...` is pure. When used in combination with `removeDeadCode`, this significantly reduces the file size.\n\n  If `assumePureVars` is `false`, then `rollup-plugin-purs` only removes unused variables if it can prove that the variables are pure. But sometimes it won't remove unused variables, because it's not smart enough to realize that the variables are pure.\n\n  If `assumePureVars` is `true`, then `rollup-plugin-purs` will remove all unused variables, even if it can't prove that the variables are pure.\n\n  PureScript variables are always pure, so `assumePureVars` is safe. But if you do weird things with the FFI, or if you use an unsafe PureScript function, or if you import a JavaScript library, then `assumePureVars` might break your program.\n\nIn addition to the above optimizations, there are some optimizations which are *always* applied:\n\n* Constant propagation / folding\n\n\n## Planned optimizations\n\n* Common subexpression elimination\n\n\n## Comment pragmas\n\nYou can disable certain warnings by including a special comment in your code:\n\n```\n// rollup-plugin-purs ignore dynamic exports\n```\n\n```\n// rollup-plugin-purs ignore dynamic require\n```\n\n```\n// rollup-plugin-purs ignore dynamic module\n```\n\nEach comment disables a specific warning.\n\nThe comments must be exactly the same as above, and they must be placed at the top-level of your code, with zero spaces to the left of the comment.\n\n\n## Converting from CommonJS to ES6 modules\n\nThis package also contains a `convert-commonjs` program which can be used to convert a file from CommonJS to ES6 modules.\n\nYou can run `node_modules/.bin/convert-commonjs input.js \u003e output.js` which will take the `input.js` file (which is CommonJS) and will output to the `output.js` file (which is ES6 modules).\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpauan%2Frollup-plugin-purs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpauan%2Frollup-plugin-purs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpauan%2Frollup-plugin-purs/lists"}