{"id":13503831,"url":"https://github.com/zetachang/opalrb-loader","last_synced_at":"2025-03-29T18:31:29.014Z","repository":{"id":141842132,"uuid":"41352907","full_name":"zetachang/opalrb-loader","owner":"zetachang","description":"Opal Ruby module loader for webpack","archived":false,"fork":false,"pushed_at":"2016-04-05T19:06:57.000Z","size":354,"stargazers_count":9,"open_issues_count":4,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T00:32:26.559Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zetachang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-08-25T08:34:09.000Z","updated_at":"2020-05-02T21:04:37.000Z","dependencies_parsed_at":"2024-01-16T10:37:23.485Z","dependency_job_id":"152edcf7-51a2-4287-aebe-84586fd6585b","html_url":"https://github.com/zetachang/opalrb-loader","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetachang%2Fopalrb-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetachang%2Fopalrb-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetachang%2Fopalrb-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zetachang%2Fopalrb-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zetachang","download_url":"https://codeload.github.com/zetachang/opalrb-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246227044,"owners_count":20743876,"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":[],"created_at":"2024-07-31T23:00:46.097Z","updated_at":"2025-03-29T18:31:28.659Z","avatar_url":"https://github.com/zetachang.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# opalrb-loader\n\u003e Opal is a compiler for writing JavaScript in Ruby.\n\nThis package allows transpiling Ruby files using [Opal](http://opalrb.org) and [webpack](https://github.com/webpack/webpack).\n\nCheck out [this blog post](https://medium.com/@zetachang/from-sprockets-to-webpack-5f3d1afbd1b0) if you are interested in the project background.\n\n[![npm version](https://img.shields.io/npm/v/opalrb-loader.svg?style=flat-square)](https://www.npmjs.com/package/opalrb-loader)\n[![npm downloads](https://img.shields.io/npm/dt/opalrb-loader.svg?style=flat-square)](https://www.npmjs.com/package/opalrb-loader)\n[![Circle CI](https://circleci.com/gh/zetachang/opalrb-loader.svg?style=svg)](https://circleci.com/gh/zetachang/opalrb-loader)\n\n## Installation\n\n```bash\nnpm install opalrb-loader --save-dev\n```\n\n## Usage\n\n[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)\n\n```javascript\n// webpack.config.js \nmodule: {\n  loaders: [\n    {\n      test: /\\.rb?$/,\n      loader: 'opalrb-loader'\n    }\n  ]\n}\n```\n\n### Options\n\nSee `Opal::Compiler` [options](https://github.com/opal/opal/blob/master/lib/opal/compiler.rb) for possible options.\n\n```javascript\n// webpack.config.js \nmodule: {\n  loaders: [\n    {\n      test: /\\.rb?$/,\n      loader: 'opalrb-loader',\n      query: {\n        requirable: false,\n        freezing: false,\n      }\n    }\n  ]\n}\n```\n\n#### OPAL_LOAD_PATH\n\nBy passing `OPAL_LOAD_PATH` environment variable to webpack, the loader will correctly resolve file other than relative path.\n\n`opalrb-loader` is only bundled with compiler module. It left the decision on managing runtime, corelib or gems to developer. \n\nSee the example [Rakefile](https://github.com/zetachang/opalrb-loader/blob/master/examples/complex/Rakefile) for how to integrate using other Opal gems. \n\n### Compared to `Opal::Builder`\n* Relative `require` is correctly resolved.\n* `require_trees` is **not yet implemented**.\n* erb is not supported (which should be implemented as separate loader).\n\n### Known issues\n* First time compiling is relatively slow compared to Ruby one, use `--watch` option for webpack to speed up dev iteration.\n* Use `require` to load JS file is broken, but you can write as below to load JS module (webpack will correctly resolve it).\n```ruby\n# Inside ruby file\n`var $ = require(\"jquery\")`\n```\n* **stdlib** and some gems may not be correctly compiled, please file an issue if you encounter one.\n\n### Examples\n\nIt's under [Examples](https://github.com/zetachang/opalrb-loader/tree/master/examples) folder.\n\n* simple: Basic setup without further dependency.\n* complex: Compile opal/corelib and other gems.\n\n## Development\n\n* `npm install`\n* `npm run build_compiler` to build compiler\n* `npm start` to compile \u0026 watch `index.es6.js`\n\n## Contact\n\n[David Chang](http://github.com/zetachang)\n[@zetachang](https://twitter.com/zetachang)\n\n## License\n\nAvailable under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzetachang%2Fopalrb-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzetachang%2Fopalrb-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzetachang%2Fopalrb-loader/lists"}