{"_id":"@achimismaili/easy-web-swa","_rev":"3-2d08af9fd41ddd8caf6ed4bde76292e9","name":"@achimismaili/easy-web-swa","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@achimismaili/easy-web-swa","version":"0.1.0","keywords":["astro-integration","azure-static-web-apps","swa","staticwebapp","404","not-found"],"license":"MIT","_id":"@achimismaili/easy-web-swa@0.1.0","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"homepage":"https://github.com/achimismaili/easy-web#readme","bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"dist":{"shasum":"c2a301268825e186e73906586c313ca00e0b2901","tarball":"https://registry.npmjs.org/@achimismaili/easy-web-swa/-/easy-web-swa-0.1.0.tgz","fileCount":7,"integrity":"sha512-J5TwlXYZkuSAnafGr3wnq0Etj4K6u3ff1dMVNiRjLTYSNZ5egjdS1DYq4lEuTPc2j7lYZS27h1O6vnyhHn56WQ==","signatures":[{"sig":"MEUCICsh2SexWc5Mx96OADeEE76sTGdtSlZPwIlaXq9FaAoCAiEA/8sZRCf6QCYWKIPF4AVa6ZNH8uwW4RGBuXUjVivhnXs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@achimismaili%2feasy-web-swa@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":17017},"main":"./dist/index.js","type":"module","_from":"file:achimismaili-easy-web-swa-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"achimismaili","email":"achim@ismaili.de"},"_resolved":"/tmp/0a000cf8a227af6d398b261368f3784b/achimismaili-easy-web-swa-0.1.0.tgz","_integrity":"sha512-J5TwlXYZkuSAnafGr3wnq0Etj4K6u3ff1dMVNiRjLTYSNZ5egjdS1DYq4lEuTPc2j7lYZS27h1O6vnyhHn56WQ==","repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/easy-web-swa"},"_npmVersion":"12.0.2","description":"AstroIntegration that merges a sentinel-marked staticwebapp.config.json slice for shared 404 handling on Azure Static Web Apps.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"astro":"^6.4.0","vitest":"^3.2.4","typescript":"^5.5.0","@types/node":"^22.0.0","@achimismaili/easy-web-i18n":"1.0.0"},"peerDependencies":{"astro":">=6.0.0 <8.0.0","@achimismaili/easy-web-i18n":">=1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/easy-web-swa_0.1.0_1785971646655_0.7472841051247077","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @easy-web/swa. Install that instead; this package is no longer updated."},"0.2.0":{"name":"@achimismaili/easy-web-swa","version":"0.2.0","keywords":["astro-integration","azure-static-web-apps","swa","staticwebapp","404","not-found"],"license":"MIT","_id":"@achimismaili/easy-web-swa@0.2.0","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"homepage":"https://github.com/achimismaili/easy-web#readme","bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"dist":{"shasum":"d212949a98fefe0d999629a8d6553c181e345645","tarball":"https://registry.npmjs.org/@achimismaili/easy-web-swa/-/easy-web-swa-0.2.0.tgz","fileCount":6,"integrity":"sha512-kVeJ+9ZyZTwYv8bfYfC5EHHFjLonGexBXiM0ql8sLuZf1FrzDHAefy0CruxbrDzbZbcJqLYa/No0YumFrR+AyQ==","signatures":[{"sig":"MEUCIQCi2RuF8oUg1HQrusX6wD4XvMUxUuaySxwR/C1BI5TcXgIgNa9bZOE5/ObMMUAkTxtDFSLRcsstGmf8nkUfkqBTqDo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15899},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"7854ccd34cfa63e5e2f837c90ca76c836616bc2a","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"achimismaili","email":"achim@ismaili.de"},"repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/easy-web-swa"},"_npmVersion":"10.9.8","description":"AstroIntegration that merges a sentinel-marked staticwebapp.config.json slice for shared 404 handling on Azure Static Web Apps.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"packageManager":"pnpm@10.34.4","devDependencies":{"astro":"^6.4.0","vitest":"^3.2.4","typescript":"^5.5.0","@types/node":"^22.0.0"},"peerDependencies":{"astro":">=6.0.0 <8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/easy-web-swa_0.2.0_1787470486210_0.034851240660540794","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @easy-web/swa. Install that instead; this package is no longer updated."}},"time":{"created":"2026-08-05T23:14:06.471Z","modified":"2026-08-30T11:43:37.493Z","0.1.0":"2026-08-05T23:14:06.806Z","0.2.0":"2026-08-23T07:34:46.362Z"},"bugs":{"url":"https://github.com/achimismaili/easy-web/issues"},"license":"MIT","homepage":"https://github.com/achimismaili/easy-web#readme","keywords":["astro-integration","azure-static-web-apps","swa","staticwebapp","404","not-found"],"repository":{"url":"git+https://github.com/achimismaili/easy-web.git","type":"git","directory":"packages/easy-web-swa"},"description":"AstroIntegration that merges a sentinel-marked staticwebapp.config.json slice for shared 404 handling on Azure Static Web Apps.","maintainers":[{"name":"achimismaili","email":"achim@ismaili.de"}],"readme":"# @achimismaili/easy-web-swa\r\n\r\nAstro integration that manages Azure Static Web Apps (SWA) 404 handling via a sentinel-marked sidecar file. Ensures the integration's configuration changes are preserved across rebuilds while respecting user-authored settings.\r\n\r\n## What it does\r\n\r\nWhen you add `easyWebNotFound()` to your Astro config, the integration:\r\n\r\n1. **Reads** the existing `staticwebapp.config.json` at build time (if present)\r\n2. **Emits** a global 404 response override (`responseOverrides.404`) that rewrites unmatched routes to `/404.html`\r\n3. **Tracks ownership** via a sidecar file (`staticwebapp.config.json.easy-web-managed.json`) so future builds know which settings the integration manages\r\n4. **Preserves** all user-authored settings: `auth`, `globalHeaders`, `navigationFallback`, custom routes, and any other `responseOverrides` the user defined\r\n\r\n## Usage\r\n\r\n```ts\r\n// astro.config.mjs\r\nimport { defineConfig } from 'astro/config';\r\nimport easyWebNotFound from '@achimismaili/easy-web-swa';\r\n\r\nexport default defineConfig({\r\n  integrations: [\r\n    easyWebNotFound(),\r\n  ],\r\n});\r\n```\r\n\r\nThe integration requires no configuration. The `Options` type (with optional `defaultLocale` and `locales` fields) is retained for API compatibility but has no effect in v0.2.0+.\r\n\r\n## How it works\r\n\r\n### The sidecar file\r\n\r\nSWA's `staticwebapp.config.json` schema uses `additionalProperties: false` at the root, which means the config file cannot store metadata about which keys are managed by which tool. To solve this, the integration maintains a sibling file:\r\n\r\n```json\r\n// staticwebapp.config.json.easy-web-managed.json\r\n{\r\n  \"keys\": [\"responseOverrides.404\"],\r\n  \"version\": \"0.2.0\",\r\n  \"docs\": \"https://github.com/achimismaili/websites/blob/main/docs/decisions/0013-shared-not-found-primitives.md\"\r\n}\r\n```\r\n\r\nOn the next build, the integration reads this sidecar to determine which keys it previously claimed. If the sidecar says it owns `responseOverrides.404`, the integration updates it; otherwise, it leaves the user's 404 override untouched.\r\n\r\n### Single global 404 limitation\r\n\r\nAzure Static Web Apps supports only **one global 404 response override**. This integration emits a single, locale-agnostic 404 handler. If your site uses i18n:\r\n\r\n- Unmatched routes in any locale will serve the **default-locale 404 body** (from `/404.html`)\r\n- Per-locale 404 content is **not supported** by this integration\r\n- If you need locale-specific 404 pages, you must implement them outside this integration (e.g., via Astro routing or a custom SWA configuration)\r\n\r\nSee [ADR 0013 — Shared Not-Found Primitives](https://github.com/achimismaili/websites/blob/main/docs/decisions/0013-shared-not-found-primitives.md) for the full rationale.\r\n\r\n## Preservation guarantees\r\n\r\nThe integration **only manages** `responseOverrides.404`. All other settings are preserved exactly as you authored them:\r\n\r\n- ✅ `auth` — untouched\r\n- ✅ `globalHeaders` — untouched\r\n- ✅ `navigationFallback` — untouched\r\n- ✅ `routes` — untouched\r\n- ✅ Other `responseOverrides` — untouched\r\n- ✅ All other root keys — untouched\r\n\r\nIf you define your own `responseOverrides.404` before the integration runs, the integration will detect this and skip managing the 404 override, logging a warning instead.\r\n\r\n## Compatibility\r\n\r\n- **Astro:** `>=6.0.0 <8.0.0`\r\n- **Node.js:** `>=18.0.0`\r\n","readmeFilename":"README.md"}