@easy-web/swa 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Achim Ismaili
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,73 +1,97 @@
1
- # @easy-web/swa
2
-
3
- Astro 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.
4
-
5
- ## What it does
6
-
7
- When you add `easyWebNotFound()` to your Astro config, the integration:
8
-
9
- 1. **Reads** the existing `staticwebapp.config.json` at build time (if present)
10
- 2. **Emits** a global 404 response override (`responseOverrides.404`) that rewrites unmatched routes to `/404.html`
11
- 3. **Tracks ownership** via a sidecar file (`staticwebapp.config.json.easy-web-managed.json`) so future builds know which settings the integration manages
12
- 4. **Preserves** all user-authored settings: `auth`, `globalHeaders`, `navigationFallback`, custom routes, and any other `responseOverrides` the user defined
13
-
14
- ## Usage
15
-
16
- ```ts
17
- // astro.config.mjs
18
- import { defineConfig } from 'astro/config';
19
- import easyWebNotFound from '@easy-web/swa';
20
-
21
- export default defineConfig({
22
- integrations: [
23
- easyWebNotFound(),
24
- ],
25
- });
26
- ```
27
-
28
- The 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+.
29
-
30
- ## How it works
31
-
32
- ### The sidecar file
33
-
34
- SWA'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:
35
-
36
- ```json
37
- // staticwebapp.config.json.easy-web-managed.json
38
- {
39
- "keys": ["responseOverrides.404"],
40
- "version": "0.2.0",
41
- "docs": "https://github.com/achimismaili/websites/blob/main/docs/decisions/0013-shared-not-found-primitives.md"
42
- }
43
- ```
44
-
45
- On 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.
46
-
47
- ### Single global 404 limitation
48
-
49
- Azure Static Web Apps supports only **one global 404 response override**. This integration emits a single, locale-agnostic 404 handler. If your site uses i18n:
50
-
51
- - Unmatched routes in any locale will serve the **default-locale 404 body** (from `/404.html`)
52
- - Per-locale 404 content is **not supported** by this integration
53
- - If you need locale-specific 404 pages, you must implement them outside this integration (e.g., via Astro routing or a custom SWA configuration)
54
-
55
- See [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.
56
-
57
- ## Preservation guarantees
58
-
59
- The integration **only manages** `responseOverrides.404`. All other settings are preserved exactly as you authored them:
60
-
61
- - ✅ `auth` — untouched
62
- - ✅ `globalHeaders` — untouched
63
- - ✅ `navigationFallback` — untouched
64
- - ✅ `routes` — untouched
65
- - ✅ Other `responseOverrides` — untouched
66
- - ✅ All other root keys — untouched
67
-
68
- If 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.
69
-
70
- ## Compatibility
71
-
72
- - **Astro:** `>=6.0.0 <8.0.0`
73
- - **Node.js:** `>=18.0.0`
1
+ # @easy-web/swa
2
+
3
+ Astro 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.
4
+
5
+ ## What it does
6
+
7
+ When you add `easyWebNotFound()` to your Astro config, the integration:
8
+
9
+ 1. **Reads** the existing `staticwebapp.config.json` at build time (if present)
10
+ 2. **Emits** a global 404 response override (`responseOverrides.404`) that rewrites unmatched routes to `/404.html`
11
+ 3. **Derives** `trailingSlash` from your Astro config so the SWA redirect can never contradict the canonical URLs `@easy-web/seo` emits
12
+ 4. **Tracks ownership** via a sidecar file (`staticwebapp.config.json.easy-web-managed.json`) so future builds know which settings the integration manages
13
+ 5. **Preserves** all user-authored settings: `auth`, `globalHeaders`, `navigationFallback`, custom routes, and any other `responseOverrides` the user defined
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ // astro.config.mjs
19
+ import { defineConfig } from 'astro/config';
20
+ import easyWebNotFound from '@easy-web/swa';
21
+
22
+ export default defineConfig({
23
+ integrations: [
24
+ easyWebNotFound(),
25
+ ],
26
+ });
27
+ ```
28
+
29
+ The 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+.
30
+
31
+ ## How it works
32
+
33
+ ### The sidecar file
34
+
35
+ SWA'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:
36
+
37
+ ```json
38
+ // staticwebapp.config.json.easy-web-managed.json
39
+ {
40
+ "keys": ["responseOverrides.404", "trailingSlash"],
41
+ "version": "1.2.0",
42
+ "docs": "https://dev.azure.com/it-ci/websites/_git/websites?path=/docs/decisions/0013-shared-not-found-primitives.md"
43
+ }
44
+ ```
45
+
46
+ On 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.
47
+
48
+ ### Single global 404 limitation
49
+
50
+ Azure Static Web Apps supports only **one global 404 response override**. This integration emits a single, locale-agnostic 404 handler. If your site uses i18n:
51
+
52
+ - Unmatched routes in any locale will serve the **default-locale 404 body** (from `/404.html`)
53
+ - Per-locale 404 content is **not supported** by this integration
54
+ - If you need locale-specific 404 pages, you must implement them outside this integration (e.g., via Astro routing or a custom SWA configuration)
55
+
56
+ See [ADR 0013 — Shared Not-Found Primitives](https://dev.azure.com/it-ci/websites/_git/websites?path=/docs/decisions/0013-shared-not-found-primitives.md) for the full rationale.
57
+
58
+ ### Trailing slash
59
+
60
+ Azure SWA serves `/about` and `/about/` with `200` by default, so both forms are reachable and search engines see duplicate content. The integration therefore derives an explicit `trailingSlash` from your Astro config - the same config that drives the canonical, hreflang and sitemap URLs emitted by `@easy-web/seo`, so the redirect and the canonical cannot disagree.
61
+
62
+ | Astro config | Emitted `trailingSlash` | SWA behaviour |
63
+ | :--- | :--- | :--- |
64
+ | `trailingSlash: 'always'` / `'never'` | used as-is | explicit intent outranks the output shape |
65
+ | `build.format: 'directory'` (default) | `always` | `/about` -> 301 -> `/about/` |
66
+ | `build.format: 'file'` | `never` | `/about/` -> 301 -> `/about` |
67
+ | `build.format: 'preserve'` | *unmanaged* | emits both shapes, so no single rule is correct |
68
+
69
+ To choose the other form, set it once in `astro.config.mjs`:
70
+
71
+ ```ts
72
+ export default defineConfig({
73
+ trailingSlash: 'never',
74
+ });
75
+ ```
76
+
77
+ The canonical tag, hreflang alternates, sitemap `<loc>` entries and the SWA redirect all follow that one value.
78
+
79
+ Setting `trailingSlash` yourself in `staticwebapp.config.json` still wins, with a warning. Remove it to hand control back to the integration.
80
+
81
+ ## Preservation guarantees
82
+
83
+ The integration **only manages** `responseOverrides.404` and `trailingSlash`. All other settings are preserved exactly as you authored them:
84
+
85
+ - ✅ `auth` — untouched
86
+ - ✅ `globalHeaders` — untouched
87
+ - ✅ `navigationFallback` — untouched
88
+ - ✅ `routes` — untouched
89
+ - ✅ Other `responseOverrides` — untouched
90
+ - ✅ All other root keys — untouched
91
+
92
+ If 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.
93
+
94
+ ## Compatibility
95
+
96
+ - **Astro:** `>=6.0.0 <8.0.0`
97
+ - **Node.js:** `>=18.0.0`
package/dist/index.d.ts CHANGED
@@ -9,6 +9,26 @@ export type Options = {
9
9
  readonly defaultLocale?: string;
10
10
  readonly locales?: readonly string[];
11
11
  };
12
+ /** The two URL forms Azure SWA can normalise to. Astro's `'ignore'` has no SWA equivalent. */
13
+ export type SwaTrailingSlash = 'always' | 'never';
14
+ type AstroUrlShape = {
15
+ readonly trailingSlash?: string;
16
+ readonly build?: {
17
+ readonly format?: string;
18
+ };
19
+ };
20
+ /**
21
+ * Derives the SWA `trailingSlash` mode from Astro's own configuration.
22
+ *
23
+ * Read directly from Astro rather than shared with `@easy-web/seo`: Astro's
24
+ * config is the single source of truth both packages consume, so this is two
25
+ * readers of one value rather than two competing rules. Keeping it local also
26
+ * spares this package a dependency it otherwise does not need.
27
+ *
28
+ * Returns `null` when no single form is correct, in which case the key is left
29
+ * unmanaged rather than guessed.
30
+ */
31
+ export declare function resolveSwaTrailingSlash(config: AstroUrlShape): SwaTrailingSlash | null;
12
32
  /**
13
33
  * Astro integration that adds shared Azure Static Web Apps 404 handling.
14
34
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAK9C;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC;AAkCF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,GAAE,OAAY,GAAG,gBAAgB,CAkCxE;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAK9C;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,CAAC;AAmCF,8FAA8F;AAC9F,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,GACpB,gBAAgB,GAAG,IAAI,CAQzB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,GAAE,OAAY,GAAG,gBAAgB,CA6CxE;AAED,eAAe,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
- const SENTINEL_VERSION = '0.2.0';
5
- const SENTINEL_DOCS = 'https://github.com/achimismaili/websites/blob/main/docs/decisions/0013-shared-not-found-primitives.md';
4
+ const SENTINEL_VERSION = '1.2.0';
5
+ const SENTINEL_DOCS = 'https://dev.azure.com/it-ci/websites/_git/websites?path=/docs/decisions/0013-shared-not-found-primitives.md';
6
6
  const KEY_RESPONSE_OVERRIDES_404 = 'responseOverrides.404';
7
+ const KEY_TRAILING_SLASH = 'trailingSlash';
7
8
  const SIDECAR_SUFFIX = '.easy-web-managed.json';
8
9
  const SCHEMA_LEGAL_ROOT_KEYS = new Set([
9
10
  '$schema',
@@ -22,6 +23,28 @@ const MANAGED_RESPONSE_OVERRIDE = {
22
23
  rewrite: '/404.html',
23
24
  statusCode: 404,
24
25
  };
26
+ /**
27
+ * Derives the SWA `trailingSlash` mode from Astro's own configuration.
28
+ *
29
+ * Read directly from Astro rather than shared with `@easy-web/seo`: Astro's
30
+ * config is the single source of truth both packages consume, so this is two
31
+ * readers of one value rather than two competing rules. Keeping it local also
32
+ * spares this package a dependency it otherwise does not need.
33
+ *
34
+ * Returns `null` when no single form is correct, in which case the key is left
35
+ * unmanaged rather than guessed.
36
+ */
37
+ export function resolveSwaTrailingSlash(config) {
38
+ if (config.trailingSlash === 'always')
39
+ return 'always';
40
+ if (config.trailingSlash === 'never')
41
+ return 'never';
42
+ if (config.build?.format === 'directory')
43
+ return 'always';
44
+ if (config.build?.format === 'file')
45
+ return 'never';
46
+ return null;
47
+ }
25
48
  /**
26
49
  * Astro integration that adds shared Azure Static Web Apps 404 handling.
27
50
  *
@@ -31,6 +54,7 @@ const MANAGED_RESPONSE_OVERRIDE = {
31
54
  * setting are preserved; no locale-wide rewrite routes are emitted.
32
55
  */
33
56
  export function easyWebNotFound(_options = {}) {
57
+ let trailingSlash = null;
34
58
  return {
35
59
  name: '@easy-web/swa',
36
60
  hooks: {
@@ -41,6 +65,10 @@ export function easyWebNotFound(_options = {}) {
41
65
  if (config.output === 'server') {
42
66
  console.warn('[easy-web-swa] non-static output detected; integration will write staticwebapp.config.json directly to dist/ instead of relying on public/ passthrough');
43
67
  }
68
+ trailingSlash = resolveSwaTrailingSlash(config);
69
+ if (trailingSlash === null) {
70
+ console.warn('[easy-web-swa] build.format "preserve" emits both file and directory routes, so no single trailingSlash rule is correct; leaving the key unmanaged. Set trailingSlash in astro.config.mjs to have it managed.');
71
+ }
44
72
  },
45
73
  'astro:build:done': ({ dir }) => {
46
74
  const distDir = fileURLToPath(dir);
@@ -48,7 +76,7 @@ export function easyWebNotFound(_options = {}) {
48
76
  const sidecarPath = `${configPath}${SIDECAR_SUFFIX}`;
49
77
  const existing = readConfig(configPath);
50
78
  const previousSentinel = readSidecar(sidecarPath);
51
- const { config, sentinel } = mergeConfig(existing, previousSentinel, configPath);
79
+ const { config, sentinel } = mergeConfig(existing, previousSentinel, configPath, trailingSlash);
52
80
  writeJson(configPath, config);
53
81
  writeJson(sidecarPath, sentinel);
54
82
  },
@@ -93,25 +121,43 @@ function parseObjectFile(filePath) {
93
121
  }
94
122
  return value;
95
123
  }
96
- function mergeConfig(existing, previousSentinel, configPath) {
124
+ function mergeConfig(existing, previousSentinel, configPath, trailingSlash) {
97
125
  const config = schemaLegalConfig(existing);
98
126
  const responseOverrides = readResponseOverrides(config, configPath);
99
127
  const integrationOwns404 = previousSentinel?.keys.includes(KEY_RESPONSE_OVERRIDES_404) ?? false;
100
128
  const userOwns404 = '404' in responseOverrides && !integrationOwns404;
129
+ const managedKeys = [];
130
+ let merged = config;
101
131
  if (userOwns404) {
102
132
  console.warn('[easy-web-swa] user has defined responseOverrides.404; user override wins; integration will not manage it');
103
- return { config, sentinel: makeSentinel([]) };
104
133
  }
105
- return {
106
- config: {
107
- ...config,
134
+ else {
135
+ merged = {
136
+ ...merged,
108
137
  responseOverrides: {
109
138
  ...responseOverrides,
110
139
  '404': MANAGED_RESPONSE_OVERRIDE,
111
140
  },
112
- },
113
- sentinel: makeSentinel([KEY_RESPONSE_OVERRIDES_404]),
114
- };
141
+ };
142
+ managedKeys.push(KEY_RESPONSE_OVERRIDES_404);
143
+ }
144
+ const integrationOwnsTrailingSlash = previousSentinel?.keys.includes(KEY_TRAILING_SLASH) ?? false;
145
+ const userOwnsTrailingSlash = KEY_TRAILING_SLASH in merged && !integrationOwnsTrailingSlash;
146
+ if (userOwnsTrailingSlash) {
147
+ console.warn(`[easy-web-swa] user has defined trailingSlash: "${String(merged[KEY_TRAILING_SLASH])}" in staticwebapp.config.json; user override wins; integration will not manage it. Remove it to have the value derived from astro.config.mjs.`);
148
+ }
149
+ else if (trailingSlash !== null) {
150
+ merged = { ...merged, [KEY_TRAILING_SLASH]: trailingSlash };
151
+ managedKeys.push(KEY_TRAILING_SLASH);
152
+ }
153
+ else if (integrationOwnsTrailingSlash) {
154
+ merged = withoutStaleTrailingSlash(merged);
155
+ }
156
+ return { config: merged, sentinel: makeSentinel(managedKeys) };
157
+ }
158
+ function withoutStaleTrailingSlash(config) {
159
+ const { [KEY_TRAILING_SLASH]: _stale, ...rest } = config;
160
+ return rest;
115
161
  }
116
162
  function schemaLegalConfig(existing) {
117
163
  if (existing === null)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAazC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACjC,MAAM,aAAa,GACjB,uGAAuG,CAAC;AAC1G,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAC3D,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACrC,SAAS;IACT,QAAQ;IACR,oBAAoB;IACpB,mBAAmB;IACnB,WAAW;IACX,eAAe;IACf,MAAM;IACN,YAAY;IACZ,mBAAmB;IACnB,UAAU;IACV,eAAe;CAChB,CAAC,CAAC;AAUH,MAAM,yBAAyB,GAAG;IAChC,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,GAAG;CACP,CAAC;AAEX;;;;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Aa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,52 +1,51 @@
1
- {
2
- "name": "@easy-web/swa",
3
- "version": "1.0.0",
4
- "type": "module",
5
- "packageManager": "pnpm@10.34.4",
6
- "description": "AstroIntegration that merges a sentinel-marked staticwebapp.config.json slice for shared 404 handling on Azure Static Web Apps.",
7
- "keywords": [
8
- "astro-integration",
9
- "azure-static-web-apps",
10
- "swa",
11
- "staticwebapp",
12
- "404",
13
- "not-found"
14
- ],
15
- "main": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
- "exports": {
18
- ".": {
19
- "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js"
21
- }
22
- },
23
- "files": [
24
- "dist",
25
- "README.md"
26
- ],
27
- "sideEffects": false,
28
- "scripts": {
29
- "build": "tsc -p tsconfig.build.json",
30
- "test": "vitest run",
31
- "typecheck": "tsc --noEmit"
32
- },
33
- "peerDependencies": {
34
- "astro": ">=6.0.0 <8.0.0"
35
- },
36
- "devDependencies": {
37
- "astro": "^6.4.0",
38
- "@types/node": "^22.0.0",
39
- "typescript": "^5.5.0",
40
- "vitest": "^3.2.4"
41
- },
42
- "publishConfig": {
43
- "access": "public",
44
- "provenance": true
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "https://github.com/achimismaili/easy-web.git",
49
- "directory": "packages/easy-web-swa"
50
- },
51
- "license": "MIT"
52
- }
1
+ {
2
+ "name": "@easy-web/swa",
3
+ "version": "1.2.0",
4
+ "type": "module",
5
+ "description": "AstroIntegration that merges a sentinel-marked staticwebapp.config.json slice for shared 404 handling on Azure Static Web Apps.",
6
+ "keywords": [
7
+ "astro-integration",
8
+ "azure-static-web-apps",
9
+ "swa",
10
+ "staticwebapp",
11
+ "404",
12
+ "not-found"
13
+ ],
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md"
25
+ ],
26
+ "sideEffects": false,
27
+ "peerDependencies": {
28
+ "astro": ">=6.0.0 <8.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "astro": "^6.4.0",
32
+ "@types/node": "^22.0.0",
33
+ "typescript": "^5.5.0",
34
+ "vitest": "^3.2.4"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "provenance": true
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/achimismaili/easy-web.git",
43
+ "directory": "packages/easy-web-swa"
44
+ },
45
+ "license": "MIT",
46
+ "scripts": {
47
+ "build": "tsc -p tsconfig.build.json",
48
+ "test": "vitest run",
49
+ "typecheck": "tsc --noEmit"
50
+ }
51
+ }