{"_id":"@bakkot-dumping-ground/zig-compile","_rev":"2-1bd585f9b09ab04b8b68e0fc75e76899","name":"@bakkot-dumping-ground/zig-compile","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bakkot-dumping-ground/zig-compile","version":"0.0.1","description":"eval c/cc/zig from javascript through the power of zig","repository":{"type":"git","url":"git+https://github.com/bakkot/npm-zig.git"},"main":"index.js","author":{"name":"bakkot"},"license":"MIT","//":"TODO optional dependencies","dependencies":{"@bakkot-dumping-ground/zig-macos-x86":"0.0.1-pre"},"gitHead":"0dc751e340593830737657ba147172cea60cc737","bugs":{"url":"https://github.com/bakkot/npm-zig/issues"},"homepage":"https://github.com/bakkot/npm-zig#readme","_id":"@bakkot-dumping-ground/zig-compile@0.0.1","_nodeVersion":"15.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-fQ9/5RRUDq16Lr20Juj7W21Yswjlqnsri/vB+p7d4BinERHzvckrsO+ZQ6zgBm7PXq+l0qFRmkFjFhlIBxkP+w==","shasum":"755378c44ed0a908d41376f68816406af77e2ed1","tarball":"https://registry.npmjs.org/@bakkot-dumping-ground/zig-compile/-/zig-compile-0.0.1.tgz","fileCount":3,"unpackedSize":3012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzHI3CRA9TVsSAnZWagAAAdMQAKJ6SMpd5V9eSbd7mmcf\nYjWI/xe+32KNyJaj4LYYA68Cp2nyF8vm6XVHhmKD25owzOsoo/OkLrrqVry8\n6SWsly1CwopnhimIHQ/zroclmjfolhNV1wgEq+YdJNj/dT10WzY7q92VO1eY\nkyTegvr6K/qPM5ORuBRLryZA//FO0VTDHPH/QfoVsLirNA0vMqaiX+P9HH1a\nEiI89eC1ymeE8ZVBg6cZXVOi+Tue94HzBLr+S/dvD7EzI7U5u0Z7b2qXs5VK\nqf8IBORdoaUUtOHKAuYYSbITFzhnauC+epUEVRlkARrcKPgajdOUBnREZ0Mk\nrgUc6mPknolNMtxe5DoijX28C9sD1cnG+Nzs7tIftopPwWdFgTcwJaVB5O0E\ni+zY4m5JgVjAmTrXZpYoehFjOynk6LZ3xdVyJZXbs/lq0EtSCX2mRzhuJ9/X\nmZPI7qqVOD6cDRp2kdtzB5KOsc8qPbm/dvSpu4N4aB+Y3KcGaz/ZLCY04Cps\n23+rZo7yxqKlBg6Oyjna2EnCtCvSkGudEpq1aAONz7FZUR91o363bGhdtW+Z\nG3O4xOHORVinCsLhNBslzCNpPuvkQ7s0bjcQpfGp2jNZFTyB0H6TlFIEzYPh\nbLY5SxsBhw6niJ/gT3baIu+KYqRxWDYovb8NCYnpCWLEtOMbAUSBwJ4qx5vD\ngLXI\r\n=7fA6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICAU/7GeuSczDOfEWoVM6paWwtUd3rC+WnHOk1whpfZMAiATQcUF8et+ciYxGNzrGMcUqR7x6gp9oRrmmvUKEH/UIQ=="}]},"_npmUser":{"name":"bakkot","email":"bakkot@gmail.com"},"directories":{},"maintainers":[{"name":"bakkot","email":"bakkot@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zig-compile_0.0.1_1634974854060_0.007394270511178025"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-23T07:40:54.011Z","0.0.1":"2021-10-23T07:40:54.394Z","modified":"2022-04-04T17:32:15.739Z"},"maintainers":[{"name":"bakkot","email":"bakkot@gmail.com"}],"description":"eval c/cc/zig from javascript through the power of zig","homepage":"https://github.com/bakkot/npm-zig#readme","repository":{"type":"git","url":"git+https://github.com/bakkot/npm-zig.git"},"author":{"name":"bakkot"},"bugs":{"url":"https://github.com/bakkot/npm-zig/issues"},"license":"MIT","readme":"# EXPERIMENTAL\n# Use zig to eval c via wasm, in JavaScript\n\n```js\nlet { compile } = require('@bakkot-dumping-ground/zig-compile');\n\nlet c = `\n  extern int print(int arg);\n\n  int add(int x, int y) {\n    return x + y;\n  }\n\n  void addAndPrint(int x, int y) {\n    print(add(x, y));\n  }\n`;\n\nlet { add, addAndPrint } = await compile({\n  source: c,\n  language: 'c',\n  env: { print: x => console.log('printing from c', x) },\n});\nconsole.log('printing from js', add(5, 6));\naddAndPrint(20, 22);\n```\n\n## But why?\n\nI saw that Knob A fit into Hole B, and then I couldn't stop myself.\n\n## Should I use this in production?\n\nNo.\n\n## Platforms\n\nRight now, just macOS-x86, because that's the only one I've bothered packaging. It's not a lot of work to add more if you want that.\n","readmeFilename":"README.md"}