{"_id":"@allstak/astro","_rev":"2-2a469837bb24887ce3ce3eefcd447da3","name":"@allstak/astro","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@allstak/astro","version":"0.1.0","keywords":["astro","astro-integration","observability","error-tracking","logging","monitoring","tracing","allstak"],"author":{"name":"AllStak","email":"sdk@allstak.sa"},"license":"MIT","_id":"@allstak/astro@0.1.0","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"homepage":"https://allstak.sa","bugs":{"url":"https://github.com/AllStak/allstak-astro/issues"},"dist":{"shasum":"a89087fdc32a502031b38d7bd1405156654ef32d","tarball":"https://registry.npmjs.org/@allstak/astro/-/astro-0.1.0.tgz","fileCount":28,"integrity":"sha512-a3AAKX0TgNNgPS72ZJcRZcpnKDlcPUOtWh4QwSRWMht169nPYNJ76ByCl3hSZ0XenwLsZrACWKjlt++6xN1kTA==","signatures":[{"sig":"MEYCIQCNDBO2+Yo9HnpSDDJzMP4nBiiEjFHvOFJnI2LHbSvkvQIhAKUTRnfg1PVAuMSDTO+po/NaueeFC5N+ouk/muFlX9Wy","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@allstak%2fastro@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":109238},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./client":{"import":{"types":"./dist/client.d.ts","default":"./dist/client.js"},"require":{"types":"./dist/client.d.cts","default":"./dist/client.cjs"}},"./middleware":{"import":{"types":"./dist/middleware.d.ts","default":"./dist/middleware.js"},"require":{"types":"./dist/middleware.d.cts","default":"./dist/middleware.cjs"}}},"gitHead":"8f6210f1e6415d55d5583f6fe55783e3a2158441","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"repository":{"url":"git+https://github.com/AllStak/allstak-astro.git","type":"git"},"_npmVersion":"10.8.2","description":"Official AllStak SDK for Astro — error tracking, structured logs, distributed tracing, and observability for Astro applications (SSR and static).","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@allstak/js":"^0.3.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","astro":"^6.0.0","vitest":"^2.1.0","typescript":"^5.4.0","@types/node":"^22.0.0"},"peerDependencies":{"astro":"^3.5.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/astro_0.1.0_1780089172366_0.44059132150233427","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allstak/astro","version":"0.1.1","description":"Official AllStak SDK for Astro — error tracking, structured logs, distributed tracing, and observability for Astro applications (SSR and static).","keywords":["astro","astro-integration","observability","error-tracking","logging","monitoring","tracing","allstak"],"homepage":"https://allstak.sa","repository":{"type":"git","url":"git+https://github.com/AllStak/allstak-astro.git"},"bugs":{"url":"https://github.com/AllStak/allstak-astro/issues"},"license":"MIT","author":{"name":"AllStak","email":"sdk@allstak.sa"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./middleware":{"import":{"types":"./dist/middleware.d.ts","default":"./dist/middleware.js"},"require":{"types":"./dist/middleware.d.cts","default":"./dist/middleware.cjs"}},"./client":{"import":{"types":"./dist/client.d.ts","default":"./dist/client.js"},"require":{"types":"./dist/client.d.cts","default":"./dist/client.cjs"}}},"scripts":{"build":"tsup","typecheck":"tsc --noEmit","test":"vitest run"},"peerDependencies":{"astro":"^3.5.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"},"dependencies":{"@allstak/js":"^0.3.0"},"devDependencies":{"@types/node":"^22.0.0","astro":"^6.0.0","tsup":"^8.0.0","typescript":"^5.4.0","vitest":"^2.1.0"},"publishConfig":{"access":"public","provenance":true,"registry":"https://registry.npmjs.org/"},"_id":"@allstak/astro@0.1.1","gitHead":"0c7e09ad7eb0517d7230cd4f8d73018f0e90af5b","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-mTAIz/zkC8zP0YrRtpCo9VGFXC5+h51Y9gK/gb8zV5oZcj6dcvyCLUPCw0+izEty6SOQujMgggj0KYFsIGKUBg==","shasum":"f20bbde34feeedf5f16ac666610c4ff60d04cd26","tarball":"https://registry.npmjs.org/@allstak/astro/-/astro-0.1.1.tgz","fileCount":28,"unpackedSize":109796,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@allstak%2fastro@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDjogXD6kemP7q9/fSR0wKBz4VAdrHSmisqaRcY6+3PZAIhANouOVf7vHWsRww/sN5m2gi5t6nw7X6Xgk/LfmJIAngV"}]},"_npmUser":{"name":"allstak-","email":"hello@allstak.sa"},"directories":{},"maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/astro_0.1.1_1780099128278_0.0366460651461582"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-29T21:12:52.170Z","modified":"2026-05-29T23:58:48.718Z","0.1.0":"2026-05-29T21:12:52.529Z","0.1.1":"2026-05-29T23:58:48.431Z"},"bugs":{"url":"https://github.com/AllStak/allstak-astro/issues"},"author":{"name":"AllStak","email":"sdk@allstak.sa"},"license":"MIT","homepage":"https://allstak.sa","keywords":["astro","astro-integration","observability","error-tracking","logging","monitoring","tracing","allstak"],"repository":{"type":"git","url":"git+https://github.com/AllStak/allstak-astro.git"},"description":"Official AllStak SDK for Astro — error tracking, structured logs, distributed tracing, and observability for Astro applications (SSR and static).","maintainers":[{"name":"allstak-","email":"hello@allstak.sa"}],"readme":"# @allstak/astro\n\n[![npm](https://img.shields.io/npm/v/@allstak/astro.svg)](https://www.npmjs.com/package/@allstak/astro)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nOfficial AllStak SDK for **Astro**, shipped as an Astro integration. Captures\nuncaught exceptions, structured logs, distributed traces, HTTP requests, and\nweb vitals — across both the browser and the SSR server, with zero boilerplate\nbeyond a single line in `astro.config`.\n\nWorks in both **SSR/hybrid** and **static** output. In static builds only the\nclient runtime is active (there is no request pipeline to instrument); in\nserver output the SDK additionally wraps every on-demand request.\n\n## Install\n\n```bash\nnpm install @allstak/astro\n# or\npnpm add @allstak/astro\n# or\nyarn add @allstak/astro\n```\n\n`astro@>=3.5` is a peer dependency.\n\n## Setup\n\nAdd the integration to `astro.config.mjs`:\n\n```js\nimport { defineConfig } from 'astro/config';\nimport allstak from '@allstak/astro';\n\nexport default defineConfig({\n  integrations: [\n    allstak({\n      apiKey: process.env.ALLSTAK_API_KEY,\n      environment: process.env.NODE_ENV,\n      release: process.env.npm_package_version,\n    }),\n  ],\n});\n```\n\nThat single `allstak({ … })` wires:\n\n- a client bootstrap injected on every page — `AllStak.init` runs in the\n  browser, Web Vitals start, and Astro View Transitions navigations open spans;\n- in server output, an SSR middleware (`order: 'pre'`) that wraps each request\n  in an `http.server` span, records the response status, and captures any error\n  thrown while rendering — then re-throws so your error pages still work;\n- the full `@allstak/js` ingest pipeline (HTTP, db, logs, breadcrumbs,\n  web vitals) on both runtimes.\n\n## Capturing inside your app\n\n`import * as AllStak`-style access works anywhere — `.astro` frontmatter, API\nroutes, and middleware — because the package re-exports the entire\n`@allstak/js` surface:\n\n```astro\n---\nimport { AllStak } from '@allstak/astro';\n\ntry {\n  await loadDashboard();\n} catch (err) {\n  AllStak.captureException(err, { page: 'dashboard' });\n  throw err;\n}\n---\n```\n\n```ts\n// src/pages/api/checkout.ts\nimport { AllStak } from '@allstak/astro';\n\nexport async function POST() {\n  const span = AllStak.startSpan('checkout.charge', { op: 'task' });\n  try {\n    // …\n    span.finish('ok');\n    return new Response('ok');\n  } catch (err) {\n    AllStak.captureException(err);\n    span.finish('error');\n    throw err;\n  }\n}\n```\n\n## Manual middleware (older Astro)\n\nOn Astro `>=3.5` the SSR middleware is added automatically. On older versions,\nwire it yourself in `src/middleware.ts`:\n\n```ts\nimport { onRequest as allstak } from '@allstak/astro/middleware';\nimport { sequence } from 'astro:middleware';\n\nexport const onRequest = sequence(allstak);\n```\n\nThe handler carries a double-wrap guard, so adding it manually alongside\nauto-instrumentation will not duplicate spans.\n\n## Manual client bootstrap\n\nIf you disable client auto-injection (`enabled: { client: false }`) you can\nbootstrap the browser SDK yourself:\n\n```ts\nimport { initClient } from '@allstak/astro/client';\n\ninitClient({ apiKey: import.meta.env.PUBLIC_ALLSTAK_API_KEY });\n```\n\n## Configuration\n\n`allstak(options)` accepts every option that `@allstak/js`'s `AllStak.init`\naccepts (`apiKey`, `host`, `environment`, `release`, `dist`, `sampleRate`,\n`tracesSampleRate`, `enableWebVitals`, `enableOfflineQueue`, `beforeSend`, …),\nplus the integration-only switches below:\n\n| Option | Default | Purpose |\n|---|---|---|\n| `apiKey` | — | **Required.** Your AllStak ingest key |\n| `environment` | — | Deployment environment tag (e.g. `production`) |\n| `release` | — | Release identifier for release-health |\n| `enabled` | `true` | `true` / `false`, or `{ client?, server? }` to toggle each runtime |\n| `autoInstrumentServer` | `true` | Add the SSR request-wrapping middleware in server output |\n| `debug` | `false` | Build-time logging from the integration (what it injected/added) |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}