{"id":19782525,"url":"https://github.com/skibz/urgh","last_synced_at":"2026-05-14T10:40:07.147Z","repository":{"id":57387459,"uuid":"324093152","full_name":"skibz/urgh","owner":"skibz","description":"use the c preprocessor in javascript","archived":false,"fork":false,"pushed_at":"2021-01-07T20:03:42.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T02:33:11.595Z","etag":null,"topics":["cpreprocessor","javascript","metaprogramming","nodejs","preprocessor"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/skibz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-24T07:19:05.000Z","updated_at":"2024-09-09T19:37:22.000Z","dependencies_parsed_at":"2022-09-07T13:01:48.121Z","dependency_job_id":null,"html_url":"https://github.com/skibz/urgh","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skibz%2Furgh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skibz%2Furgh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skibz%2Furgh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skibz%2Furgh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skibz","download_url":"https://codeload.github.com/skibz/urgh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241113434,"owners_count":19911884,"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":["cpreprocessor","javascript","metaprogramming","nodejs","preprocessor"],"created_at":"2024-11-12T06:05:26.944Z","updated_at":"2026-05-14T10:40:07.099Z","avatar_url":"https://github.com/skibz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# urgh\n\n## what?\n\nit's a [`require`](https://devdocs.io/node~10_lts/modules#modules_require) hook (courtesy of [`pirates`](https://npmjs.org/package/pirates)) that pipes source code through the c preprocessor.\n\n## but, why?\n\nit goes without saying that this is a terrible idea, but that doesn't mean i haven't been dying to have a familiar feeling macro system in javascript for as long as i can remember.\n\n## how?\n\nread the [tests](test/index.js) and [examples](test/examples), and/or [read](https://gcc.gnu.org/onlinedocs/cpp/) [a](https://en.wikipedia.org/wiki/C_preprocessor) [manual](https://www.tutorialspoint.com/cprogramming/c_preprocessors.htm).\n\n## the name?\n\nit's probably how you'd feel while using this tool 🙃\n\n## disclaimers\n\nthis module doesn't take care of installing a standards-compliant c preprocessor for you. and, more importantly, this foot-gun comes with no support. if you're (a sensible individual) looking for something reliable and predictable, go check out [sweet.js](https://www.sweetjs.org/), instead.\n\n## i'd actually like to use it\n\n```sh\nnpm install --save urgh\n```\n\nand then...\n\n```javascript\nvar urgh = require('urgh')\n\n// your environment variables automatically become preprocessor defines\nprocess.env.FOO = 'foo'\n\n// constructing the require hook returns the destructor\nvar disable = urgh()\n\n// after calling urgh() you can require files containing c preprocessor directives and macros\nrequire('./foo.urgh')\n\n// and then optionally disable urgh\ndisable()\n```\n\n```c\n// foo.urgh\n\n#ifdef FOO\nconsole.log(FOO)\n#endif\n\n#include \"some-file.js\"\n#include \"some-other-file.urgh\"\n```\n\nor preprocess your source files ahead-of-time...\n\n```sh\nurgh \u003c foo.urgh \u003e foo.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskibz%2Furgh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskibz%2Furgh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskibz%2Furgh/lists"}