{"id":26600881,"url":"https://github.com/double-oxygen/nim-loader","last_synced_at":"2025-04-09T16:24:32.228Z","repository":{"id":39919231,"uuid":"160593378","full_name":"Double-oxygeN/nim-loader","owner":"Double-oxygeN","description":"A Webpack loader for the Nim language","archived":false,"fork":false,"pushed_at":"2022-12-11T05:01:34.000Z","size":705,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T14:53:40.207Z","etag":null,"topics":["nim","nim-lang","webpack","webpack-loader"],"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/Double-oxygeN.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":"2018-12-05T23:53:22.000Z","updated_at":"2024-09-12T13:19:43.000Z","dependencies_parsed_at":"2022-09-21T05:06:05.680Z","dependency_job_id":null,"html_url":"https://github.com/Double-oxygeN/nim-loader","commit_stats":null,"previous_names":["bmollot/nim-loader"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Double-oxygeN%2Fnim-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Double-oxygeN%2Fnim-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Double-oxygeN%2Fnim-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Double-oxygeN%2Fnim-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Double-oxygeN","download_url":"https://codeload.github.com/Double-oxygeN/nim-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248066132,"owners_count":21042042,"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":["nim","nim-lang","webpack","webpack-loader"],"created_at":"2025-03-23T18:35:56.576Z","updated_at":"2025-04-09T16:24:32.194Z","avatar_url":"https://github.com/Double-oxygeN.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nim-loader\n\nA [Webpack][webpack-home] loader for the [Nim][nim-home] language.\n\n## How do I use it?\n\nFirst of all, make sure that you have [Nim installed][nim-installation].  \nThen install [nim-loader]:\n\n```sh\nnpm install nim-loader\n```\n\nNext, configure your `webpack.config.js` to use this loader:\n\n```js\nmodule: {\n  ...\n  rules: [\n    ...\n    {\n      test: /\\.nim$/,\n      use: [\n        {\n          loader: 'nim-loader',\n          options: {\n            flags: ['--nim-compiler-flags']\n          }\n        }\n      ]\n    }\n    ...\n  ]\n  ...\n}\n```\n\nOf course, `options` is optional. If you don't want advanced behavior you can\nuse the terse syntax:\n\n```js\nmodule: {\n  ...\n  rules: [\n    ...\n    {\n      test: /\\.nim$/,\n      loader: 'nim-loader'\n    }\n    ...\n  ]\n  ...\n}\n```\n\nFinally, `import` your Nim file from your Javascript code.\n\n```js\nimport nimModule from './path/to/nim/file/module.nim'\nnimModules.exportedFunction(\"With arguments\")\n```\n\n## Caveats\n\nWhile Nim has native concepts of exporting functions and modules, these do not\ntranslate to the Javascript compile target. Instead, you are encouraged to use\nCommonJS module exports. This requires that your Nim code \"imports\" the `module` object. Doing so looks like this:\n\n```nim\nimport jsffi\nvar module {. importc, nodecl .}: JsObject\n...\nmodule.exports = exportObject\n```\n\nwhere `exportObject` is of type `JsObject`. Note that `modules.exports` is\nalready initialized to an empty object, so you can also do something like:\n\n```nim\n...\nmodule.exports.someFunction = functionImpl\nmodule.exports.someValue = nimValue\n...\n```\n\nto register your exports one-by-one.\n\n## Examples\n\nIf you're still confused, hopefully the [examples][nim-loader-demo] can help.\n\n[webpack-home]: https://webpack.js.org/\n[nim-home]: https://nim-lang.org/\n[nim-installation]: https://nim-lang.org/install.html\n[nim-loader]: https://github.com/bmollot/nim-loader\n[nim-loader-demo]: https://github.com/bmollot/nim-loader-demo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouble-oxygen%2Fnim-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdouble-oxygen%2Fnim-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouble-oxygen%2Fnim-loader/lists"}