{"_id":"@brendonovich/vercel-rust","_rev":"1-049a84c25e8d9acc6e58c5e39a88a97e","name":"@brendonovich/vercel-rust","dist-tags":{"latest":"0.0.0-main-08f8cde"},"versions":{"0.0.0-main-76998c2":{"name":"@brendonovich/vercel-rust","version":"0.0.0-main-76998c2","description":"Rust runtime for Vercel Functions.","homepage":"https://github.com/vercel-community/rust","repository":{"type":"git","url":"git+https://github.com/vercel-community/rust.git"},"license":"MIT","main":"./dist/index","prettier":"@vercel/style-guide/prettier","dependencies":{"@iarna/toml":"^2.2.5","execa":"5","typescript":"^4.9.4"},"devDependencies":{"@types/fs-extra":"^11.0.1","@types/jest":"^29.4.0","@types/ms":"^0.7.31","@types/node":"^18.11.18","@types/node-fetch":"^2.6.2","@vercel/build-utils":"^6.2.1","@vercel/routing-utils":"^2.1.8","@vercel/style-guide":"^4.0.2","eslint":"^8.35.0","husky":"^8.0.3","jest":"^29.5.0","ms":"^2.1.3","node-fetch":"2.6.0","prettier":"^2.8.4","rimraf":"^4.1.1","ts-jest":"^29.0.5","vercel":"^28.16.15"},"scripts":{"build":"rimraf dist/ && tsc --removeComments","test":"jest","typecheck":"tsc --noEmit"},"bugs":{"url":"https://github.com/vercel-community/rust/issues"},"_id":"@brendonovich/vercel-rust@0.0.0-main-76998c2","_integrity":"sha512-IekwqrQhgKTrSwBfLVJWxRNw1jkDgDLL/g9IeZSLS9XIER4xDt2o6PXAojfctr1ROMI214UAQZvNCWlZWlV6Rw==","_resolved":"/private/var/folders/09/05vxh1_d3q3c07yj9c313c700000gn/T/8ac3f58e62f504511d74ab3a0223969d/brendonovich-vercel-rust-0.0.0-main-76998c2.tgz","_from":"file:brendonovich-vercel-rust-0.0.0-main-76998c2.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-IekwqrQhgKTrSwBfLVJWxRNw1jkDgDLL/g9IeZSLS9XIER4xDt2o6PXAojfctr1ROMI214UAQZvNCWlZWlV6Rw==","shasum":"e6759b532a063bbf2f7135050651c1487afb1996","tarball":"https://registry.npmjs.org/@brendonovich/vercel-rust/-/vercel-rust-0.0.0-main-76998c2.tgz","fileCount":8,"unpackedSize":18953,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDxmyul2qU8Z2W7zFFDnFKvcvgrPN7Q7jmsvBk/nkBLIgIhAJXTq1eb3K82Tl4Y6dZ4dx1fYHDVRnw/q92nzuA+1hSt"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkFD3lACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSIg//ZWyRk8SBY2LggxCybR7hmbEKG4YCs2dmeZ8bTM+WGhEyUcXL\r\nqU3ocVaZnhLE4LWQdvlo9e/62g70sREYMLTwPU0r+RWGtJIc8RThDD1zE+up\r\nTk9KRa5o2a9qTdlTm9PfpF/JP0mn3wRIZEBcUs3KyMjQdbwHve7kpTw4s2pR\r\n4w3tzouTk6veOXaT23vCPCrInzsTAS6Fwv8Z4m86+CRC3ura1n+IHoYdCyVw\r\nlM7gOkpwQ5gJDr2afps85Pk+1M+I65eURiyqYPaA515LEHxX+KIPxlWufhu4\r\n8xs5Fic2rGJ07CjYOAZek/08iPR/4xedHkRkJOpZeUHXbPtnoZMFrI8Ab1EA\r\nRUJ2IagZkpTVAp6Mu2jERAoZ6Fe2rVBsZ3XCEO/AQ32m7lpjuBzw8z8ePdd+\r\nYL+BUNAnKrMJ6I6p60KTwIrJ3ATCgknGYXcOgVSZXNBvUYaezY3NS+iOMpiJ\r\n28TqUC+bd7PZqg6pwSNQjPwlWIQEozWVLHV2zTPts1kvxGvK/qJqPdTKOuDo\r\n+0DWHBfRhZFEc4alm9E3sCGblZYET5TzII9vpzHFvh3EmHV/0aF+PdNjKSag\r\n5xHvfreKoXWxHeQlQ63W1pfh60ZYzpX1OPz2tDlel6+NOy3JmdBDbUUmMpe8\r\nBIw7o0d7gtqaGOBv9mkZYBmbuHCwX1cPO9Y=\r\n=9kc8\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"brendonovich","email":"brendonovich@outlook.com"},"directories":{},"maintainers":[{"name":"brendonovich","email":"brendonovich@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vercel-rust_0.0.0-main-76998c2_1679048164831_0.44287529954847193"},"_hasShrinkwrap":false},"0.0.0-main-08f8cde":{"name":"@brendonovich/vercel-rust","version":"0.0.0-main-08f8cde","description":"Rust runtime for Vercel Functions.","homepage":"https://github.com/vercel-community/rust","repository":{"type":"git","url":"git+https://github.com/vercel-community/rust.git"},"license":"MIT","main":"./dist/index","scripts":{"build":"rimraf dist/ && tsc --removeComments","prepare":"husky install","prepublishOnly":"tsc","test":"jest","typecheck":"tsc --noEmit"},"prettier":"@vercel/style-guide/prettier","dependencies":{"@iarna/toml":"^2.2.5","execa":"5","typescript":"^4.9.4"},"devDependencies":{"@types/fs-extra":"^11.0.1","@types/jest":"^29.4.0","@types/ms":"^0.7.31","@types/node":"^18.11.18","@types/node-fetch":"^2.6.2","@vercel/build-utils":"^6.2.1","@vercel/routing-utils":"^2.1.8","@vercel/style-guide":"^4.0.2","eslint":"^8.35.0","husky":"^8.0.3","jest":"^29.5.0","ms":"^2.1.3","node-fetch":"2.6.0","prettier":"^2.8.4","rimraf":"^4.1.1","ts-jest":"^29.0.5","vercel":"^28.16.15"},"gitHead":"08f8cdef35ae2103b1d078518b6a5601e8218c4f","bugs":{"url":"https://github.com/vercel-community/rust/issues"},"_id":"@brendonovich/vercel-rust@0.0.0-main-08f8cde","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-OL7ivYkrFtxoonJ1HLfYRS00yNoZnlVKA6qe6piSpAQt0rXjpcm7qtvsBDJ2iUjkjhrmTCQjNYyF1IJiiPLqbw==","shasum":"b38714a558b44c2449b4ab0f3bd1bacb5f14c5f9","tarball":"https://registry.npmjs.org/@brendonovich/vercel-rust/-/vercel-rust-0.0.0-main-08f8cde.tgz","fileCount":8,"unpackedSize":19176,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEPSaiz5+MFQD1iGz7HjhkexJOyfHJxFYxO2BSZqNH0aAiBu4QkYnH7DY20Qc2kVP6TvS4m2z1TIPf45j6D1JlSeLg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkFVG0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3Kw//Q9hdhkojIojPRPYD4XFeuo3c4E/GOjYO6DjBo9fgGoOK2Cby\r\nBFkMccTOe6CR27wrKDFn2kPU6ZMUguNsCHiwvhKN9wx1+Ku1QBiI8aKEJ28X\r\nJTRu4uctFm2G0ILPtvu0Gmdr4Hn5eivs7Kg5iFyK9CL9Gyu8vsobBHzI+64E\r\n02DFK6qlDMLwSVMql9f7BopENTUn2h+sk43gcY1/2rTiZ8trhDfsIglnRGJY\r\n3b5FoOoMNMFCyHlbQA2z5MJYqklwswm1r7OVMuvx2x1Zy25FoPoPOqQv0C6P\r\nfWph/WHe1i507DZBeavMmNpFqfSMtTPMD4324fn7L2CbqOpHEtyWO+nsq0Jd\r\nYFyJKR9CrzvduH4pgLjUpYxtpPp2tHHhtQCcddTo96uM1NnD7Zx3u0Jk0bkx\r\n0ZVJ37Rqh0kzhCHh/KsOhtxzY5vOjguA9+I61HJacHyGputA9aDYN7+QWtVh\r\nYpZAUu28UGaqIC0p456dRfw84hpyjVIxRoQofVB2a+t1xoxVyHkbjYQt1U70\r\ndBaBioo/huGZve/BmecL5/0dagrf07ICKPK8RcXbgVHw/DKq6r1HzrN73NVW\r\n1wfZQpNqWyRopLOR43hOmn+yo0Eg47X0qHSUJpLRP7A5bOgT5wEJVeQVfbrD\r\nl7zKtbBM1bSYTx0bUAQaAzgGLkEi0DURxKI=\r\n=UK19\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"brendonovich","email":"brendonovich@outlook.com"},"directories":{},"maintainers":[{"name":"brendonovich","email":"brendonovich@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vercel-rust_0.0.0-main-08f8cde_1679118772296_0.3227824166868678"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-17T10:16:04.769Z","0.0.0-main-76998c2":"2023-03-17T10:16:05.075Z","modified":"2023-03-18T05:52:52.594Z","0.0.0-main-08f8cde":"2023-03-18T05:52:52.464Z"},"maintainers":[{"name":"brendonovich","email":"brendonovich@outlook.com"}],"description":"Rust runtime for Vercel Functions.","homepage":"https://github.com/vercel-community/rust","repository":{"type":"git","url":"git+https://github.com/vercel-community/rust.git"},"bugs":{"url":"https://github.com/vercel-community/rust/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <a href=\"https://vercel.com\">\n    <img src=\"https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png\" height=\"96\">\n    <h3 align=\"center\">Rust</h3>\n  </a>\n  <p align=\"center\">Rust runtime for Vercel Functions.</p>\n</p>\n\nCommunity-maintained package to support using [Rust](https://www.rust-lang.org/) inside [Vercel Functions](https://vercel.com/docs/serverless-functions/introduction) as a [Runtime](https://vercel.com/docs/runtimes).\n\n## Legacy Runtime\n\nThe below documentation is for the `vercel_runtime` crate (in beta). If you are looking for the legacy runtime instructions using `vercel_lambda` see [tree/a9495a0](https://github.com/vercel-community/rust/tree/a9495a0f0d882a36ea165f1629fcc79c30bc3108).\n\n## Usage\n\nFirst, you'll need a `vercel.json` file in your project:\n\n```json\n{\n  \"functions\": {\n    \"api/**/*.rs\": {\n      \"runtime\": \"vercel-rust@4.0.0-beta.2\"\n    }\n  }\n}\n```\n\nA Vercel Function will be created for every file that matches `api/**/*.rs`.\n\nExample:\n\n```rust\nuse serde_json::json;\nuse vercel_runtime::{run, Body, Error, Request, Response, StatusCode};\n\n#[tokio::main]\nasync fn main() -> Result<(), Error> {\n    run(handler).await\n}\n\npub async fn handler(_req: Request) -> Result<Response<Body>, Error> {\n    Ok(Response::builder()\n        .status(StatusCode::OK)\n        .header(\"Content-Type\", \"application/json\")\n        .body(\n            json!({\n              \"message\": \"你好，世界\"\n            })\n            .to_string()\n            .into(),\n        )?)\n}\n```\n\nFinally we need a `Cargo.toml` file at the root of your repository.\n\n```toml\n# --snip--\n\n[dependencies]\n# --snip--\n# Documentation: https://docs.rs/vercel_runtime/latest/vercel_runtime\nvercel_runtime = { version = \"0.2.1\" }\n\n# You can specify a library for shared logic here (optional)\n# [lib]\n# path = \"src-rs/lib.rs\"\n\n# Each handler has to be specified as [[bin]]\n[[bin]]\nname = \"handler\"\npath = \"api/handler.rs\"\n\n# Note that you need to provide unique names for dynamic paths\n[[bin]]\nname = \"user-id\"\npath = \"api/user/[id].rs\"\n\n[[bin]]\nname = \"group-id\"\npath = \"api/group/[id].rs\"\n\n\n# --snip--\n```\n\n### Dependencies\n\nThis Builder supports installing dependencies defined in the `Cargo.toml` file.\n\nFurthermore, more system dependencies can be installed at build time with the presence of a shell `build.sh` file in the same directory as the entrypoint file.\n\n## Local Development\n\nWith `vercel dev` and `vercel-rust`, you can develop your Rust-based lambdas on your own machine.\n\nDuring local development with `vercel dev`, ensure `rust` and `cargo` are already installed and available in your `PATH`, since they will not be installed automatically. The recommended way to install is with [rustup](https://rustup.rs/).\n\n## Contributing\n\nSince this project contains both Rust and Node.js code, you need to install the relevant dependencies. If you're only working on the JavaScript side, you only need to install those dependencies (and vice-versa).\n\n```shell\n# install node dependencies\npnpm install\n\n\n# install cargo dependencies\ncargo fetch\n```\n\n## Invocation Flowchart\n\n```mermaid\ngraph TD\n    A[\"Lambda Invocation\"] --> |\"process_request(event: LambdaEvent&lt;VercelEvent&gt;) → Request\"| B[Request]\n    B --> |\"handler_fn(req: Request) → Future&lt;Output = Result&lt;Response&lt;Body&gt;, Error&gt;&gt;\"| C[\"Runtime calls handler_fn\"]\n    C --> |\"Ok(r) => process_response(r)\"| D[\"Response\"]\n```\n\n## FAQ\n\n<details>\n  <summary>Can I use musl/static linking?</summary>\n  \nUnfortunately, the AWS Lambda Runtime for Rust relies (tangentially) on `proc_macro`, which won't compile on musl targets. Without `musl`, all linking must be dynamic. If you have a crate that relies on system libraries like `postgres` or `mysql`, you can include those library files with the `includeFiles` config option and set the proper environment variables, config, etc. that you need to get the library to compile.\n\nFor more information, please see [this issue](https://github.com/mike-engel/vercel-rust/issues/2).\n\n</details>\n","readmeFilename":"README.md"}