{"_id":"@astro-firebase/hosting","name":"@astro-firebase/hosting","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@astro-firebase/hosting","version":"0.1.0","description":"Firebase Hosting CDN cache provider for Astro","type":"module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/galkin/astro-firebase.git","directory":"packages/hosting"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./runtime":{"types":"./dist/runtime.d.ts","default":"./dist/runtime.js"}},"peerDependencies":{"astro":"^7.0.0"},"devDependencies":{"astro":"^7.2.4","typescript":"~6.0.3","vitest":"^4.1.11"},"scripts":{"build":"tsc -b","test":"vitest run"},"_nodeVersion":"24.18.0","_id":"@astro-firebase/hosting@0.1.0","dist":{"integrity":"sha512-iUDwHXbU+mIVBL4jtzw0k4GqvcWD00xsHh9Xgz6pJrVnyX6UGY0bO/9jb/eSqG2RMGUQCPpRSsyrtMl+WKhZ1Q==","shasum":"2767dd8402d5407206cc36fdeda59ee9146628c3","tarball":"https://registry.npmjs.org/@astro-firebase/hosting/-/hosting-0.1.0.tgz","fileCount":27,"unpackedSize":13473,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC9k3t+gVRtcgFXOiMoY97Uup6mqCNLmIbLk6MyvrKzZgIgORPPBj7VkCxLvPjlcExSO0nSmbpUoAE0Xbl/dKhGv9Y="}]},"_npmUser":{"name":"galkin","email":"nikita@galk.in"},"directories":{},"maintainers":[{"name":"galkin","email":"nikita@galk.in"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hosting_0.1.0_1787237338896_0.23287689573505066"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-20T14:48:58.705Z","0.1.0":"2026-08-20T14:48:59.039Z","modified":"2026-08-20T14:48:59.433Z"},"maintainers":[{"name":"galkin","email":"nikita@galk.in"}],"description":"Firebase Hosting CDN cache provider for Astro","repository":{"type":"git","url":"git+https://github.com/galkin/astro-firebase.git","directory":"packages/hosting"},"license":"MIT","readme":"# @astro-firebase/hosting\n\n[![npm](https://img.shields.io/npm/v/@astro-firebase/hosting)](https://www.npmjs.com/package/@astro-firebase/hosting)\n[![license](https://img.shields.io/npm/l/@astro-firebase/hosting)](../../LICENSE)\n\nA Firebase Hosting CDN [cache provider](https://docs.astro.build/en/reference/cache-provider-reference/) for Astro — the same pattern as `@astrojs/netlify/cache`, `@astrojs/vercel/cache`, and `@astrojs/cloudflare/cache`, targeting Firebase Hosting instead.\n\nIt only sets response headers and calls Firebase Hosting's cache-purge endpoint. It does not configure `firebase.json` and does not deploy — pair it with whatever SSR adapter you already use to run Astro on Firebase (Cloud Functions, Cloud Run, etc.).\n\n## Installation\n\n```sh\npnpm add @astro-firebase/hosting\n```\n\nRequires `astro@^7.0.0`.\n\n## Usage\n\n```js\n// astro.config.mjs\nimport { defineConfig } from 'astro/config';\nimport { cacheFirebase } from '@astro-firebase/hosting';\n\nexport default defineConfig({\n\tcache: {\n\t\tprovider: cacheFirebase({\n\t\t\thostingUrl: 'https://example.com',\n\t\t}),\n\t},\n});\n```\n\nThen, in a page or API route:\n\n```ts\n// src/pages/index.astro or src/pages/api/*.ts\nAstro.cache.set({ maxAge: 300 });\n```\n\n## Config\n\n| Option          | Type                            | Default  | Description                                                                                                          |\n| --------------- | ------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |\n| `hostingUrl`    | `string`                        | required | Full base URL that `invalidate({ path })` sends purge requests against. Never guessed from a Firebase site ID.       |\n| `onUnsupported` | `'silent' \\| 'warn' \\| 'error'` | `'warn'` | How to react to `tags`, `swr`, or `invalidate({ tags })` — none of which Firebase Hosting's CDN supports. See below. |\n\n## What it does and doesn't do\n\n- **`maxAge`** → `Cache-Control: public, s-maxage=<maxAge>`. Never sets `max-age` — `cache.set()` configures CDN freshness only; set your own `Cache-Control` if you also want to control browser caching.\n- **`lastModified` / `etag`** → passed straight through as `Last-Modified` / `ETag`. Nothing is computed. `304` negotiation is handled by Firebase Hosting's CDN itself, like any standard HTTP cache.\n- **`tags` / `swr`** → Firebase Hosting's CDN doesn't support either. Governed by `onUnsupported`: `'warn'` omits the header and logs, `'error'` throws, `'silent'` does neither.\n- **`invalidate({ path })`** → sends an HTTP `PURGE` request to `<hostingUrl><path>`. This is Firebase Hosting's only point-purge mechanism, and it is **undocumented and unauthenticated** — see [ADR-0001](./docs/adr/0001-purge-via-undocumented-firebase-endpoint.md) for the risk this carries. Access-control whatever route in your app calls `invalidate()`.\n- **`invalidate({ tags })`** → governed by the same `onUnsupported` policy, since Firebase Hosting has no tag store to purge against.\n- **`onRequest`** → not implemented. Firebase Hosting's CDN already does the caching; there's no in-process store to intercept requests for.\n\nSee [`CONTEXT.md`](./CONTEXT.md) and [`docs/adr/`](./docs/adr/) for the full domain vocabulary and the reasoning behind these decisions.\n\n## License\n\nMIT\n","readmeFilename":"","_rev":"1-0b794fe1bdd32ca0731a8e3dc0616a39"}