{"_id":"@antonyfaris/deno-astro-adapter","name":"@antonyfaris/deno-astro-adapter","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@antonyfaris/deno-astro-adapter","description":"Deploy your Astro site to a Deno server","version":"1.0.0","type":"module","author":{"name":"Antony Faris"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/antonyfaris/deno-astro-adapter.git"},"keywords":["withastro","astro-adapter"],"bugs":{"url":"https://github.com/antonyfaris/deno-astro-adapter/issues"},"homepage":"https://github.com/antonyfaris/deno-astro-adapter/","exports":{".":"./src/index.ts","./server.ts":"./src/server.ts","./__deno_imports.ts":"./src/__deno_imports.ts","./package.json":"./package.json"},"dependencies":{"esbuild":"^0.21.2","sharp":"^0.33.3"},"peerDependencies":{"astro":"^4.6.3","sharp":"^0.33.3"},"devDependencies":{"@types/node":"^20.12.11","astro":"^4.8.3","typescript":"^5.4.5"},"scripts":{"test":"deno test --allow-run --allow-env --allow-read --allow-net --allow-ffi --allow-sys ./test/","format":"deno fmt","format:check":"deno fmt --check","lint":"deno lint","check":"deno task check"},"_id":"@antonyfaris/deno-astro-adapter@1.0.0","_integrity":"sha512-B0JOKhgoySKqfoI6azbNddkFq3eYMeoLFLuHuznZDnNmNOmdAAiS7OCl3EvOLzWsNaZ9dJuxl24qpkzIqYuP8g==","_resolved":"C:\\Users\\acp32\\AppData\\Local\\Temp\\b2f19c8c1cbd9708298c657877f9cdb3\\antonyfaris-deno-astro-adapter-1.0.0.tgz","_from":"file:antonyfaris-deno-astro-adapter-1.0.0.tgz","_nodeVersion":"20.12.2","_npmVersion":"10.7.0","dist":{"integrity":"sha512-B0JOKhgoySKqfoI6azbNddkFq3eYMeoLFLuHuznZDnNmNOmdAAiS7OCl3EvOLzWsNaZ9dJuxl24qpkzIqYuP8g==","shasum":"abf1f2566e12bf4f42a904c6780d5134f6b3b99f","tarball":"https://registry.npmjs.org/@antonyfaris/deno-astro-adapter/-/deno-astro-adapter-1.0.0.tgz","fileCount":9,"unpackedSize":17203,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG8S/X0PhTcJj/qVtKeSET01+ZdZ//XvhaNW6vGxZSb5AiEA2iINt+AObG6j5eYRnvP8KoJ+gyZkpEn1A045lQqVlMU="}]},"_npmUser":{"name":"antonyfaris","email":"acp325@gmail.com"},"directories":{},"maintainers":[{"name":"antonyfaris","email":"acp325@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/deno-astro-adapter_1.0.0_1715645600909_0.9949681641019636"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-14T00:13:20.810Z","1.0.0":"2024-05-14T00:13:21.064Z","modified":"2024-05-14T00:13:21.370Z"},"maintainers":[{"name":"antonyfaris","email":"acp325@gmail.com"}],"description":"Deploy your Astro site to a Deno server","homepage":"https://github.com/antonyfaris/deno-astro-adapter/","keywords":["withastro","astro-adapter"],"repository":{"type":"git","url":"git+https://github.com/antonyfaris/deno-astro-adapter.git"},"author":{"name":"Antony Faris"},"bugs":{"url":"https://github.com/antonyfaris/deno-astro-adapter/issues"},"license":"MIT","readme":"> Note: Originally forked from [denoland/deno-astro-adapter](https://github.com/denoland/deno-astro-adapter) the README has not been updated to reflect the changes made to the adapter.\n\n# @astrojs/deno 🦖\n\nThis adapter allows Astro to deploy your SSR site to Deno targets.\n\nLearn how to deploy your Astro site in our [Deno Deploy deployment guide](https://docs.astro.build/en/guides/deploy/deno/).\n\n- <strong>[Why Astro Deno](#why-astro-deno)</strong>\n- <strong>[Installation](#installation)</strong>\n- <strong>[Usage](#usage)</strong>\n- <strong>[Configuration](#configuration)</strong>\n- <strong>[Examples](#examples)</strong>\n- <strong>[Troubleshooting](#troubleshooting)</strong>\n- <strong>[Contributing](#contributing)</strong>\n- <strong>[Changelog](#changelog)</strong>\n\n## Why Astro Deno\n\nIf you're using Astro as a static site builder—its behavior out of the box—you don't need an adapter.\n\nIf you wish to [use server-side rendering (SSR)](https://docs.astro.build/en/guides/server-side-rendering/), Astro requires an adapter that matches your deployment runtime.\n\n[Deno](https://deno.land/) is a runtime similar to Node, but with an API that's more similar to the browser's API. This adapter provides access to Deno's API and creates a script to run your project on a Deno server.\n\n## Installation\n\nAdd the Deno adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.\n\n```sh\n# Using NPM\nnpx astro add deno\n# Using Yarn\nyarn astro add deno\n# Using PNPM\npnpm astro add deno\n```\n\nIf you prefer to install the adapter manually instead, complete the following two steps:\n\n1. Install the Deno adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:\n\n   ```bash\n     npm install @astrojs/deno\n   ```\n\n1. Update your `astro.config.mjs` project configuration file with the changes below.\n\n   ```js ins={3,6-7}\n   // astro.config.mjs\n   import { defineConfig } from 'astro/config';\n   import deno from '@astrojs/deno';\n\n   export default defineConfig({\n     output: 'server',\n     adapter: deno(),\n   });\n   ```\n\nNext, update your `preview` script in `package.json` to run `deno`:\n\n```json ins={8}\n// package.json\n{\n  // ...\n  \"scripts\": {\n    \"dev\": \"astro dev\",\n    \"start\": \"astro dev\",\n    \"build\": \"astro build\",\n    \"preview\": \"deno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs\"\n  }\n}\n```\n\nYou can now use this command to preview your production Astro site locally with Deno.\n\n```bash\nnpm run preview\n```\n\n## Usage\n\nAfter [performing a build](https://docs.astro.build/en/guides/deploy/#building-your-site-locally) there will be a `dist/server/entry.mjs` module. You can start a server by importing this module in your Deno app:\n\n```js\nimport './dist/server/entry.mjs';\n```\n\nSee the `start` option below for how you can have more control over starting the Astro server.\n\nYou can also run the script directly using deno:\n\n```sh\ndeno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs\n```\n\n## Configuration\n\nTo configure this adapter, pass an object to the `deno()` function call in `astro.config.mjs`.\n\n```js\n// astro.config.mjs\nimport { defineConfig } from 'astro/config';\nimport deno from '@astrojs/deno';\n\nexport default defineConfig({\n  output: 'server',\n  adapter: deno({\n    //options go here\n  }),\n});\n```\n\n### start\n\nThis adapter automatically starts a server when it is imported. You can turn this off with the `start` option:\n\n```js\nimport { defineConfig } from 'astro/config';\nimport deno from '@astrojs/deno';\n\nexport default defineConfig({\n  output: 'server',\n  adapter: deno({\n    start: false,\n  }),\n});\n```\n\nIf you disable this, you need to write your own Deno web server. Import and call `handle` from the generated entry script to render requests:\n\n```ts\nimport { serve } from 'https://deno.land/std@0.167.0/http/server.ts';\nimport { handle } from './dist/server/entry.mjs';\n\nserve((req: Request) => {\n  // Check the request, maybe do static file handling here.\n\n  return handle(req);\n});\n```\n\n### port and hostname\n\nYou can set the port (default: `8085`) and hostname (default: `0.0.0.0`) for the deno server to use. If `start` is false, this has no effect; your own server must configure the port and hostname.\n\n```js\nimport { defineConfig } from 'astro/config';\nimport deno from '@astrojs/deno';\n\nexport default defineConfig({\n  output: 'server',\n  adapter: deno({\n    port: 8081,\n    hostname: 'myhost',\n  }),\n});\n```\n\n## Examples\n\nThe [Astro Deno](https://github.com/withastro/astro/tree/main/examples/deno) example includes a `preview` command that runs the entry script directly. Run `npm run build` then `npm run preview` to run the production deno server.\n\n## Troubleshooting\n\nFor help, check out the `#support` channel on [Discord](https://astro.build/chat). Our friendly Support Squad members are here to help!\n\nYou can also check our [Astro Integration Documentation][astro-integration] for more on integrations.\n\n## Contributing\n\nThis package is maintained by Astro's Core team. You're welcome to submit an issue or PR!\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a history of changes to this integration.\n\n[astro-integration]: https://docs.astro.build/en/guides/integrations-guide/\n","readmeFilename":"README.md"}