@astroscope/node 1.3.0 → 2.0.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.
Files changed (65) hide show
  1. package/README.md +33 -1
  2. package/dist/boot.d.ts +0 -1
  3. package/dist/boot.d.ts.map +1 -1
  4. package/dist/{construct-DgB-jR0a.d.ts → construct-BGlPfWMF.d.ts} +1 -2
  5. package/dist/construct-BGlPfWMF.d.ts.map +1 -0
  6. package/dist/csrf-middleware-entrypoint.d.ts.map +1 -1
  7. package/dist/dev-middleware-entrypoint.d.ts +0 -1
  8. package/dist/dev-middleware-entrypoint.d.ts.map +1 -1
  9. package/dist/emitters-C20tjKLp.js +43 -0
  10. package/dist/emitters-C20tjKLp.js.map +1 -0
  11. package/dist/{events-CUzQ2_cp.d.ts → events-u7J3ezJR.d.ts} +1 -2
  12. package/dist/events-u7J3ezJR.d.ts.map +1 -0
  13. package/dist/{excludes-DLF3A_Cf.d.ts → excludes-BDiE3eyp.d.ts} +1 -2
  14. package/dist/excludes-BDiE3eyp.d.ts.map +1 -0
  15. package/dist/excludes.d.ts +1 -1
  16. package/dist/health.d.ts.map +1 -1
  17. package/dist/image-endpoint.d.ts +11 -0
  18. package/dist/image-endpoint.d.ts.map +1 -0
  19. package/dist/image-endpoint.js +11 -0
  20. package/dist/image-endpoint.js.map +1 -0
  21. package/dist/image-service.d.ts +15 -0
  22. package/dist/image-service.d.ts.map +1 -0
  23. package/dist/image-service.js +28 -0
  24. package/dist/image-service.js.map +1 -0
  25. package/dist/index.d.ts +27 -4
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +280 -7
  28. package/dist/index.js.map +1 -1
  29. package/dist/islands-middleware-entrypoint.d.ts +5 -0
  30. package/dist/islands-middleware-entrypoint.d.ts.map +1 -0
  31. package/dist/islands-middleware-entrypoint.js +58 -0
  32. package/dist/islands-middleware-entrypoint.js.map +1 -0
  33. package/dist/islands-runtime.d.ts +1 -0
  34. package/dist/islands-runtime.js +113 -0
  35. package/dist/islands-runtime.js.map +1 -0
  36. package/dist/islands.d.ts +2 -0
  37. package/dist/islands.js +3 -0
  38. package/dist/lifecycle/events.d.ts +1 -1
  39. package/dist/log/index.d.ts +1 -2
  40. package/dist/log/index.d.ts.map +1 -1
  41. package/dist/log-B69HEBvg.js.map +1 -1
  42. package/dist/native-mount-DjYEnO4X.js.map +1 -1
  43. package/dist/native.d.ts +0 -1
  44. package/dist/native.d.ts.map +1 -1
  45. package/dist/prepare-CXZsyAVk.js.map +1 -1
  46. package/dist/prerendered-CpEAJN_q.js +34 -0
  47. package/dist/prerendered-CpEAJN_q.js.map +1 -0
  48. package/dist/preview.d.ts +0 -1
  49. package/dist/preview.d.ts.map +1 -1
  50. package/dist/route-middleware-entrypoint.d.ts +0 -1
  51. package/dist/route-middleware-entrypoint.d.ts.map +1 -1
  52. package/dist/route-store-DdxGePj2.js +27 -0
  53. package/dist/route-store-DdxGePj2.js.map +1 -0
  54. package/dist/route-store-DtY3uvLf.d.ts +69 -0
  55. package/dist/route-store-DtY3uvLf.d.ts.map +1 -0
  56. package/dist/server.d.ts.map +1 -1
  57. package/dist/server.js +32 -15
  58. package/dist/server.js.map +1 -1
  59. package/dist/transform-D8dIBGEr.js +191 -0
  60. package/dist/transform-D8dIBGEr.js.map +1 -0
  61. package/dist/types-D0uMBi2M.d.ts.map +1 -1
  62. package/package.json +31 -11
  63. package/dist/construct-DgB-jR0a.d.ts.map +0 -1
  64. package/dist/events-CUzQ2_cp.d.ts.map +0 -1
  65. package/dist/excludes-DLF3A_Cf.d.ts.map +0 -1
package/README.md CHANGED
@@ -11,10 +11,13 @@ Opinionated, cloud-friendly Node adapter for Astro: boot lifecycle, health probe
11
11
  - **Telemetry** — OpenTelemetry NodeSDK, undici fetch instrumentation, runtime + host metrics, Prometheus reader
12
12
  - **CSRF protection** — origin check for unsafe methods, with path exclusions
13
13
  - **Platform entry files** — env loading → `src/config.ts` → `src/instrumentation.ts` → `src/log.ts` → boot, each picked up automatically when the file exists
14
+ - **Island preloading** — each island's JS is preloaded in parallel instead of being discovered module by module, removing the hydration request waterfall ([Island preloading](#island-preloading))
14
15
  - **Pre-compressed static serving** — build-time brotli/gzip variants, negotiated per `Accept-Encoding`
15
16
  - **Native mounts** — http-native handlers (`oidc-provider`, ACME) mounted on the adapter's server
16
17
  - **Build tweaks** — SSR sourcemaps, SSR effect stripping
18
+ - **Image processing off unless configured** — without an explicit `image.service`, any `astro:assets` use fails loudly instead of opening astro's on-demand sharp endpoint ([Image processing](#image-processing))
17
19
  - **Dev restart machinery** — changes to the boot file or entry seams restart the dev server behind a holding page
20
+ - **Dev island warmup** — `.astro` sources are scanned for `client:*` components; their deps are pre-optimized and their module graphs warmed at server start, preventing "504 Outdated Optimize Dep" hydration failures from vite's lazy dep discovery
18
21
  - **HTTPS for development** — `SERVER_CERT_PATH` / `SERVER_KEY_PATH` serve TLS directly for local runs of the built server ([HTTPS](#https)); in production, terminate TLS at the ingress
19
22
 
20
23
  ## What it does NOT do — beware
@@ -24,7 +27,7 @@ The adapter assumes a container behind a load balancer / reverse proxy (Kubernet
24
27
  - **Opens `0.0.0.0:9090` in production** — the health probe server. Meant for the kubelet; do not expose it publicly.
25
28
  - **Opens `0.0.0.0:9464` in production** — the Prometheus metrics reader. Same: cluster-internal only.
26
29
  - **Trusts any `Host` / `X-Forwarded-Host`** — sets `security.allowedDomains: [{}]` (unless you set it yourself), because the reverse proxy is expected to control these headers. Without one, host header injection is possible.
27
- - **Overrides Astro security and config defaults** — `security.checkOrigin: false` (the embedded CSRF middleware replaces it; `csrf: false` restores Astro's check), `build.redirects: false` (redirects handled at runtime), `trailingSlash: 'never'` (only when yours is at the default `'ignore'`).
30
+ - **Overrides Astro security and config defaults** — `security.checkOrigin: false` (the embedded CSRF middleware replaces it; `csrf: false` restores Astro's check), `build.redirects: false` (redirects handled at runtime), `trailingSlash: 'never'` (only when yours is at the default `'ignore'`), `astro:assets` disabled when `image.service` is at its default ([Image processing](#image-processing)).
28
31
  - **Standalone only.** No middleware mode — the adapter always owns the server.
29
32
  - **No session driver.** Astro sessions are unsupported unless you configure `session.driver` yourself.
30
33
  - **No health probes in dev.** The health server only exists in production and `astro preview`.
@@ -237,6 +240,12 @@ export const onRequest = withExcluded(someExternalMiddleware(), RECOMMENDED_EXCL
237
240
 
238
241
  For hot paths, compile the set once with `createMatcher` from `@entwico/dash/match` instead of scanning per request (the adapter's own request instrumentation does exactly that).
239
242
 
243
+ ## Island preloading
244
+
245
+ Without it, an island's JS loads as a chain: the browser fetches the component module, parses it, discovers its imports, fetches those, and so on. In production the adapter knows each island's chunks from the build and emits preload tags next to the island, so the browser fetches everything in parallel. Deferred islands (`client:visible`, `client:idle`, `client:media`) are preloaded just ahead of their hydration.
246
+
247
+ Always on in production; `islands: false` disables it.
248
+
240
249
  ## Pre-compressed static serving
241
250
 
242
251
  At build time, every compressible file in `dist/client` gets max-quality `.br` (brotli 11) and `.gz` (gzip 9) variants written next to it — variants that don't shrink the file are skipped. At request time the static handler negotiates `Accept-Encoding` and serves the best variant with the original's content-type, `content-encoding`, `vary: accept-encoding` and per-variant etags (304s included). Behind a caching proxy with per-encoding cache keys, the origin serves each asset once per encoding.
@@ -248,6 +257,22 @@ Always on, no configuration:
248
257
  - **SSR sourcemaps** — the server bundle gets sourcemaps for readable stack traces; client bundles stay unmapped so browsers can't fetch source
249
258
  - **SSR effect stripping** — `useEffect`/`useLayoutEffect`/`useInsertionEffect` callbacks are emptied in the SSR bundle (effects never run on the server), letting the bundler drop client-only dynamic imports (maplibre-gl, hls.js, …) from the server build and the docker image
250
259
 
260
+ ## Image processing
261
+
262
+ In SSR, astro's default sharp service makes `/_image` an on-demand decode+encode endpoint whose transform space is attacker-controlled: every distinct query string (`w`, `h`, `q`, `fit`, `position`, `background`) costs a full sharp run and is a distinct cache key, so no fronting cache can absorb it. Most SSR apps serve pre-generated variants from a CMS/CDN anyway, so the adapter keeps processing off unless you ask for it — governed by one option:
263
+
264
+ ```typescript
265
+ node({
266
+ imageService: 'auto', // 'on' | 'off' | 'auto'
267
+ });
268
+ ```
269
+
270
+ - `'auto'` (default) — on when the astro config sets `image.service` itself, off otherwise
271
+ - `'on'` — astro's default sharp service, no further config needed
272
+ - `'off'` — off even over an explicit `image.service`
273
+
274
+ Off is loud, not silent: the adapter installs a service whose every method throws with an explanation, so any `astro:assets` use — `<Image>`, `<Picture>`, `getImage()`, markdown or content-collection images — fails at render/build time instead of quietly serving unoptimized bytes. The `/_image` endpoint is replaced with a 404 responder — to clients the endpoint simply doesn't exist. Apps without images never load any of it.
275
+
251
276
  ## Options
252
277
 
253
278
  ```typescript
@@ -286,6 +311,13 @@ node({
286
311
  dev: false, // start the SDK in dev too (once per process)
287
312
  },
288
313
 
314
+ // island dependency preloading (production-only); false disables it
315
+ islands: false,
316
+
317
+ // on-demand image processing: 'auto' = on only when image.service is set
318
+ // in the astro config (see the Image processing section)
319
+ imageService: 'auto',
320
+
289
321
  bodySizeLimit: 1024 * 1024 * 1024, // request body limit in bytes
290
322
  shutdownTimeout: 10_000, // ms to wait for in-flight requests on shutdown
291
323
  });
package/dist/boot.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { t as BootContext } from "./types-D0uMBi2M.js";
2
-
3
2
  //#region src/lifecycle/context.d.ts
4
3
  /**
5
4
  * The boot context of the server running in this process, or `undefined` when
@@ -1 +1 @@
1
- {"version":3,"file":"boot.d.ts","names":[],"sources":["../src/lifecycle/context.ts"],"mappings":";;;;AAiBA;;;;AAA6C;;;iBAA7B,cAAA,IAAkB,WAAW"}
1
+ {"version":3,"file":"boot.d.ts","names":[],"sources":["../src/lifecycle/context.ts"],"mappings":";;;;;;;;;;iBAiBgB,kBAAkB"}
@@ -1,5 +1,4 @@
1
1
  import { Logger, LoggerOptions } from "pino";
2
-
3
2
  //#region src/observability/log/construct.d.ts
4
3
  /**
5
4
  * Contract of the `src/log.ts` entry seam: pino logger options, or a factory
@@ -11,4 +10,4 @@ type LoggerOptionsFactory = LoggerOptions | ((ctx: {
11
10
  }) => LoggerOptions | Promise<LoggerOptions>);
12
11
  //#endregion
13
12
  export { LoggerOptionsFactory as t };
14
- //# sourceMappingURL=construct-DgB-jR0a.d.ts.map
13
+ //# sourceMappingURL=construct-BGlPfWMF.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-BGlPfWMF.d.ts","names":[],"sources":["../src/observability/log/construct.ts"],"mappings":";;;;;;;KASY,uBAAuB,kBAAkB;EAAO;MAAmB,gBAAgB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"csrf-middleware-entrypoint.d.ts","names":[],"sources":["../src/csrf/middleware-entrypoint.ts"],"mappings":";cAKa,SAAA,kBAAS,iBAA4D"}
1
+ {"version":3,"file":"csrf-middleware-entrypoint.d.ts","names":[],"sources":["../src/csrf/middleware-entrypoint.ts"],"mappings":";cAKa,2BAAS"}
@@ -1,5 +1,4 @@
1
1
  import { MiddlewareHandler } from "astro";
2
-
3
2
  //#region src/dev-mode/middleware-entrypoint.d.ts
4
3
  /**
5
4
  * Wrap every request so errors thrown by a stale render (one whose user
@@ -1 +1 @@
1
- {"version":3,"file":"dev-middleware-entrypoint.d.ts","names":[],"sources":["../src/dev-mode/middleware-entrypoint.ts"],"mappings":";;;;;AAWA;;;;AAcC;;cAdY,SAAA,EAAW,iBAcvB"}
1
+ {"version":3,"file":"dev-middleware-entrypoint.d.ts","names":[],"sources":["../src/dev-mode/middleware-entrypoint.ts"],"mappings":";;;;;;;;;;cAWa,WAAW"}
@@ -0,0 +1,43 @@
1
+ //#region src/islands/emitters.ts
2
+ /**
3
+ * Emitters registered by other packages (e.g. `@astroscope/i18n`). Keyed on
4
+ * `globalThis` via `Symbol.for` so the vite-runner and native module instances share
5
+ * one registry — same pattern as the log store.
6
+ */
7
+ const ISLAND_REGISTRY = Symbol.for("@astroscope/node.islandEmitters");
8
+ const DOCUMENT_REGISTRY = Symbol.for("@astroscope/node.documentEmitters");
9
+ function islandRegistry() {
10
+ const scope = globalThis;
11
+ return scope[ISLAND_REGISTRY] ??= [];
12
+ }
13
+ function documentRegistry() {
14
+ const scope = globalThis;
15
+ return scope[DOCUMENT_REGISTRY] ??= [];
16
+ }
17
+ /**
18
+ * Register an emitter that contributes preload links and/or attributes for every
19
+ * island the islands middleware sees. Registration is process-wide — call it once
20
+ * during boot or module initialization, not per request.
21
+ */
22
+ function registerIslandEmitter(emitter) {
23
+ islandRegistry().push(emitter);
24
+ }
25
+ function getIslandEmitters() {
26
+ return islandRegistry();
27
+ }
28
+ /**
29
+ * Register an emitter that contributes document-level content (a head bootstrap
30
+ * script, a stream-end script) for every html page response the islands middleware
31
+ * streams. Registration is process-wide — call it once during boot or module
32
+ * initialization, not per request.
33
+ */
34
+ function registerDocumentEmitter(emitter) {
35
+ documentRegistry().push(emitter);
36
+ }
37
+ function getDocumentEmitters() {
38
+ return documentRegistry();
39
+ }
40
+ //#endregion
41
+ export { registerIslandEmitter as i, getIslandEmitters as n, registerDocumentEmitter as r, getDocumentEmitters as t };
42
+
43
+ //# sourceMappingURL=emitters-C20tjKLp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitters-C20tjKLp.js","names":[],"sources":["../src/islands/emitters.ts"],"sourcesContent":["import type { DocumentEmitter, IslandEmitter } from './types.js';\n\n/**\n * Emitters registered by other packages (e.g. `@astroscope/i18n`). Keyed on\n * `globalThis` via `Symbol.for` so the vite-runner and native module instances share\n * one registry — same pattern as the log store.\n */\nconst ISLAND_REGISTRY = Symbol.for('@astroscope/node.islandEmitters');\nconst DOCUMENT_REGISTRY = Symbol.for('@astroscope/node.documentEmitters');\n\ntype Scope = { [ISLAND_REGISTRY]?: IslandEmitter[]; [DOCUMENT_REGISTRY]?: DocumentEmitter[] };\n\nfunction islandRegistry(): IslandEmitter[] {\n const scope = globalThis as Scope;\n\n return (scope[ISLAND_REGISTRY] ??= []);\n}\n\nfunction documentRegistry(): DocumentEmitter[] {\n const scope = globalThis as Scope;\n\n return (scope[DOCUMENT_REGISTRY] ??= []);\n}\n\n/**\n * Register an emitter that contributes preload links and/or attributes for every\n * island the islands middleware sees. Registration is process-wide — call it once\n * during boot or module initialization, not per request.\n */\nexport function registerIslandEmitter(emitter: IslandEmitter): void {\n islandRegistry().push(emitter);\n}\n\nexport function getIslandEmitters(): readonly IslandEmitter[] {\n return islandRegistry();\n}\n\n/**\n * Register an emitter that contributes document-level content (a head bootstrap\n * script, a stream-end script) for every html page response the islands middleware\n * streams. Registration is process-wide — call it once during boot or module\n * initialization, not per request.\n */\nexport function registerDocumentEmitter(emitter: DocumentEmitter): void {\n documentRegistry().push(emitter);\n}\n\nexport function getDocumentEmitters(): readonly DocumentEmitter[] {\n return documentRegistry();\n}\n"],"mappings":";;;;;;AAOA,MAAM,kBAAkB,OAAO,IAAI,iCAAiC;AACpE,MAAM,oBAAoB,OAAO,IAAI,mCAAmC;AAIxE,SAAS,iBAAkC;CACzC,MAAM,QAAQ;CAEd,OAAQ,MAAM,qBAAqB,CAAC;AACtC;AAEA,SAAS,mBAAsC;CAC7C,MAAM,QAAQ;CAEd,OAAQ,MAAM,uBAAuB,CAAC;AACxC;;;;;;AAOA,SAAgB,sBAAsB,SAA8B;CAClE,eAAe,CAAC,CAAC,KAAK,OAAO;AAC/B;AAEA,SAAgB,oBAA8C;CAC5D,OAAO,eAAe;AACxB;;;;;;;AAQA,SAAgB,wBAAwB,SAAgC;CACtE,iBAAiB,CAAC,CAAC,KAAK,OAAO;AACjC;AAEA,SAAgB,sBAAkD;CAChE,OAAO,iBAAiB;AAC1B"}
@@ -1,5 +1,4 @@
1
1
  import { t as BootContext } from "./types-D0uMBi2M.js";
2
-
3
2
  //#region src/lifecycle/events.d.ts
4
3
  type BootEventName = 'beforeOnStartup' | 'afterOnStartup' | 'beforeOnShutdown' | 'afterOnShutdown';
5
4
  type BootEventHandler = (context: BootContext) => Promise<void> | void;
@@ -17,4 +16,4 @@ declare function off(event: BootEventName, handler: BootEventHandler): void;
17
16
  declare function emit(event: BootEventName, context: BootContext): Promise<void>;
18
17
  //#endregion
19
18
  export { on as a, off as i, BootEventName as n, emit as r, BootEventHandler as t };
20
- //# sourceMappingURL=events-CUzQ2_cp.d.ts.map
19
+ //# sourceMappingURL=events-u7J3ezJR.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-u7J3ezJR.d.ts","names":[],"sources":["../src/lifecycle/events.ts"],"mappings":";;KAEY;KAEA,oBAAoB,SAAS,gBAAgB;;;;iBAuBzC,GAAG,OAAO,eAAe,SAAS;;;;iBAelC,IAAI,OAAO,eAAe,SAAS;;;;iBAS7B,KAAK,OAAO,eAAe,SAAS,cAAc"}
@@ -1,6 +1,5 @@
1
1
  import { StringPattern } from "@entwico/dash/match";
2
2
  import { APIContext, MiddlewareHandler } from "astro";
3
-
4
3
  //#region src/excludes/excludes.d.ts
5
4
  /**
6
5
  * Patterns accepted by @astroscope/node exclude options. The serializable
@@ -60,4 +59,4 @@ declare function shouldExclude(ctx: APIContext, exclude: readonly StringPattern[
60
59
  declare function withExcluded(middleware: MiddlewareHandler, exclude: readonly StringPattern[] | ((context: APIContext) => boolean)): MiddlewareHandler;
61
60
  //#endregion
62
61
  export { STATIC_EXCLUDES as a, RECOMMENDED_EXCLUDES as i, DEV_EXCLUDES as n, shouldExclude as o, ExcludePattern as r, withExcluded as s, ASTRO_STATIC_EXCLUDES as t };
63
- //# sourceMappingURL=excludes-DLF3A_Cf.d.ts.map
62
+ //# sourceMappingURL=excludes-BDiE3eyp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"excludes-BDiE3eyp.d.ts","names":[],"sources":["../src/excludes/excludes.ts"],"mappings":";;;;;;;;KAQY,iBAAiB,QAAQ,gBAAgB;;;;cAKxC,cAAc;;;;cAWd,uBAAuB;;;;cAKvB,iBAAiB;;;;;;;;;;;;;;;;cAwBjB,sBAAsB;;;;iBAKnB,cACd,KAAK,YACL,kBAAkB,oBAAoB,SAAS;;;;;;;;;;;;;;;;;;iBA4BjC,aACd,YAAY,mBACZ,kBAAkB,oBAAoB,SAAS,0BAC9C"}
@@ -1,2 +1,2 @@
1
- import { a as STATIC_EXCLUDES, i as RECOMMENDED_EXCLUDES, n as DEV_EXCLUDES, o as shouldExclude, r as ExcludePattern, s as withExcluded, t as ASTRO_STATIC_EXCLUDES } from "./excludes-DLF3A_Cf.js";
1
+ import { a as STATIC_EXCLUDES, i as RECOMMENDED_EXCLUDES, n as DEV_EXCLUDES, o as shouldExclude, r as ExcludePattern, s as withExcluded, t as ASTRO_STATIC_EXCLUDES } from "./excludes-BDiE3eyp.js";
2
2
  export { ASTRO_STATIC_EXCLUDES, DEV_EXCLUDES, ExcludePattern, RECOMMENDED_EXCLUDES, STATIC_EXCLUDES, shouldExclude, withExcluded };
@@ -1 +1 @@
1
- {"version":3,"file":"health.d.ts","names":[],"sources":["../src/health/health.ts"],"mappings":";UAEiB,iBAAA;EACf,MAAA;EACA,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,qBAAA;EAJf;;;EAQA,IAAA;EAJe;;;;EAUf,KAAA,QAAa,OAAA,CAAQ,iBAAA,WAA4B,iBAAA;EAAA;;;;EAMjD,QAAA;EANa;;;;EAYb,OAAA;AAAA;AAAO;AAUT;;;;AAAqE;;AAV5D,iBAUO,mBAAA,CAAoB,UAAiC,EAArB,qBAAqB"}
1
+ {"version":3,"file":"health.d.ts","names":[],"sources":["../src/health/health.ts"],"mappings":";UAEiB;EACf;EACA;EACA;;UAGe;;;;EAIf;;;;;EAMA,aAAa,QAAQ,4BAA4B;;;;;EAMjD;;;;;EAMA;;;;;;;;;iBAUc,oBAAoB,YAAY"}
@@ -0,0 +1,11 @@
1
+ import { APIRoute } from "astro";
2
+ //#region src/image/endpoint-disabled.d.ts
3
+ /**
4
+ * Replaces the `/_image` endpoint when image processing is disabled. As far as
5
+ * clients are concerned the endpoint does not exist, so requests answer 404 —
6
+ * a 400 would advertise a live processing surface behind the route.
7
+ */
8
+ declare const GET: APIRoute;
9
+ //#endregion
10
+ export { GET };
11
+ //# sourceMappingURL=image-endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-endpoint.d.ts","names":[],"sources":["../src/image/endpoint-disabled.ts"],"mappings":";;;;;;;cAOa,KAAK"}
@@ -0,0 +1,11 @@
1
+ //#region src/image/endpoint-disabled.ts
2
+ /**
3
+ * Replaces the `/_image` endpoint when image processing is disabled. As far as
4
+ * clients are concerned the endpoint does not exist, so requests answer 404 —
5
+ * a 400 would advertise a live processing surface behind the route.
6
+ */
7
+ const GET = () => new Response(null, { status: 404 });
8
+ //#endregion
9
+ export { GET };
10
+
11
+ //# sourceMappingURL=image-endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-endpoint.js","names":[],"sources":["../src/image/endpoint-disabled.ts"],"sourcesContent":["import type { APIRoute } from 'astro';\n\n/**\n * Replaces the `/_image` endpoint when image processing is disabled. As far as\n * clients are concerned the endpoint does not exist, so requests answer 404 —\n * a 400 would advertise a live processing surface behind the route.\n */\nexport const GET: APIRoute = () => new Response(null, { status: 404 });\n"],"mappings":";;;;;;AAOA,MAAa,YAAsB,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { LocalImageService } from "astro";
2
+ //#region src/image/no-image-service.d.ts
3
+ /**
4
+ * The service injected for `imageService: 'off'` (and `'auto'` without a
5
+ * configured `image.service`). Any `astro:assets` use — `<Image>`,
6
+ * `<Picture>`, `getImage()`, markdown or content-collection images — throws
7
+ * the explanation above at render/build time, so disabled processing fails
8
+ * loudly instead of silently serving unoptimized bytes. `/_image` itself is
9
+ * replaced by the 404 endpoint in `endpoint-disabled.ts`. The module is only
10
+ * ever imported on first `astro:assets` use.
11
+ */
12
+ declare const service: LocalImageService;
13
+ //#endregion
14
+ export { service as default };
15
+ //# sourceMappingURL=image-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-service.d.ts","names":[],"sources":["../src/image/no-image-service.ts"],"mappings":";;;;;;;;;;;cAqBM,SAAS"}
@@ -0,0 +1,28 @@
1
+ //#region src/image/no-image-service.ts
2
+ const MESSAGE = "[@astroscope/node] image processing is disabled: astro's on-demand `/_image` endpoint is a decode+encode amplification surface, so the adapter turns it off unless a service is configured. Serve pre-generated variants with a plain <img>, or opt in via the adapter option `imageService: 'on'` (astro's sharp service) or an explicit `image.service` in the astro config.";
3
+ function disabled() {
4
+ throw new Error(MESSAGE);
5
+ }
6
+ /**
7
+ * The service injected for `imageService: 'off'` (and `'auto'` without a
8
+ * configured `image.service`). Any `astro:assets` use — `<Image>`,
9
+ * `<Picture>`, `getImage()`, markdown or content-collection images — throws
10
+ * the explanation above at render/build time, so disabled processing fails
11
+ * loudly instead of silently serving unoptimized bytes. `/_image` itself is
12
+ * replaced by the 404 endpoint in `endpoint-disabled.ts`. The module is only
13
+ * ever imported on first `astro:assets` use.
14
+ */
15
+ const service = {
16
+ propertiesToHash: ["src"],
17
+ validateOptions: disabled,
18
+ getHTMLAttributes: disabled,
19
+ getSrcSet: disabled,
20
+ getURL: disabled,
21
+ getRemoteSize: disabled,
22
+ parseURL: () => void 0,
23
+ transform: disabled
24
+ };
25
+ //#endregion
26
+ export { service as default };
27
+
28
+ //# sourceMappingURL=image-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-service.js","names":[],"sources":["../src/image/no-image-service.ts"],"sourcesContent":["import type { LocalImageService } from 'astro';\n\nconst MESSAGE =\n \"[@astroscope/node] image processing is disabled: astro's on-demand `/_image` endpoint is a decode+encode \" +\n 'amplification surface, so the adapter turns it off unless a service is configured. Serve pre-generated ' +\n \"variants with a plain <img>, or opt in via the adapter option `imageService: 'on'` (astro's sharp service) \" +\n 'or an explicit `image.service` in the astro config.';\n\nfunction disabled(): never {\n throw new Error(MESSAGE);\n}\n\n/**\n * The service injected for `imageService: 'off'` (and `'auto'` without a\n * configured `image.service`). Any `astro:assets` use — `<Image>`,\n * `<Picture>`, `getImage()`, markdown or content-collection images — throws\n * the explanation above at render/build time, so disabled processing fails\n * loudly instead of silently serving unoptimized bytes. `/_image` itself is\n * replaced by the 404 endpoint in `endpoint-disabled.ts`. The module is only\n * ever imported on first `astro:assets` use.\n */\nconst service: LocalImageService = {\n propertiesToHash: ['src'],\n validateOptions: disabled,\n getHTMLAttributes: disabled,\n getSrcSet: disabled,\n getURL: disabled,\n getRemoteSize: disabled,\n parseURL: () => undefined,\n transform: disabled,\n};\n\nexport default service;\n"],"mappings":";AAEA,MAAM,UACJ;AAKF,SAAS,WAAkB;CACzB,MAAM,IAAI,MAAM,OAAO;AACzB;;;;;;;;;;AAWA,MAAM,UAA6B;CACjC,kBAAkB,CAAC,KAAK;CACxB,iBAAiB;CACjB,mBAAmB;CACnB,WAAW;CACX,QAAQ;CACR,eAAe;CACf,gBAAgB,KAAA;CAChB,WAAW;AACb"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { r as ExcludePattern } from "./excludes-DLF3A_Cf.js";
1
+ import { r as ExcludePattern } from "./excludes-BDiE3eyp.js";
2
+ import "./construct-BGlPfWMF.js";
3
+ import { c as IslandEmitter, i as registerIslandEmitter, l as IslandInfo, s as IslandEmission, t as getRequestRouteData } from "./route-store-DtY3uvLf.js";
2
4
  import { t as BootContext } from "./types-D0uMBi2M.js";
3
- import { n as BootEventName, t as BootEventHandler } from "./events-CUzQ2_cp.js";
5
+ import { n as BootEventName, t as BootEventHandler } from "./events-u7J3ezJR.js";
4
6
  import { AstroIntegration } from "astro";
5
-
6
7
  //#region src/types.d.ts
7
8
  interface NodeBootOptions {
8
9
  /**
@@ -130,6 +131,28 @@ interface NodeOptions {
130
131
  csrf?: {
131
132
  exclude?: ExcludePattern[] | undefined;
132
133
  } | false | undefined;
134
+ /**
135
+ * Island dependency preloading: streams html responses through a rewriter that
136
+ * emits `modulepreload` links (and preload data for deferred islands, fired by a
137
+ * small gate runtime with the directive's own scheduling) for each island's
138
+ * chunk closure, removing the hydration request waterfall. Production-only —
139
+ * dev has no chunk graph. Set to `false` to disable the preloading; the islands
140
+ * middleware itself stays active for packages that registered island or document
141
+ * emitters (e.g. `@astroscope/i18n`, `@astroscope/wormhole`).
142
+ */
143
+ islands?: false | undefined;
144
+ /**
145
+ * On-demand image processing (`astro:assets` through the `/_image`
146
+ * endpoint). `'auto'`: enabled only when the astro config sets
147
+ * `image.service` itself; otherwise processing is disabled — any
148
+ * `<Image>`/`getImage()` use throws with an explanation and `/_image`
149
+ * answers 404, as if the endpoint did not exist. `'on'` keeps astro's default sharp service; `'off'` disables
150
+ * even over an explicit `image.service`. Off unless configured because the
151
+ * sharp endpoint is an on-demand decode+encode amplification surface most
152
+ * SSR apps (serving pre-generated variants) don't need.
153
+ * @default 'auto'
154
+ */
155
+ imageService?: 'on' | 'off' | 'auto' | undefined;
133
156
  /**
134
157
  * Maximum request body size in bytes. `0` or `Infinity` disables the limit.
135
158
  * @default 1073741824 (1 GiB)
@@ -163,5 +186,5 @@ interface BootModule {
163
186
  onShutdown?: ((context: BootContext) => Promise<void> | void) | undefined;
164
187
  }
165
188
  //#endregion
166
- export { type BootContext, type BootEventHandler, type BootEventName, type BootModule, type HealthProbePaths, type InstrumentationContext, type NodeBootOptions, type NodeHealthOptions, type NodeLoggingOptions, type NodeOptions, type NodePrometheusOptions, type NodeTelemetryOptions, node as default };
189
+ export { type BootContext, type BootEventHandler, type BootEventName, type BootModule, type HealthProbePaths, type InstrumentationContext, type IslandEmission, type IslandEmitter, type IslandInfo, type NodeBootOptions, type NodeHealthOptions, type NodeLoggingOptions, type NodeOptions, type NodePrometheusOptions, type NodeTelemetryOptions, node as default, getRequestRouteData, registerIslandEmitter };
167
190
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/integration/integration.ts","../src/platform/prepare.ts","../src/lifecycle/lifecycle.ts"],"mappings":";;;;;;UAEiB,eAAA;;;;;EAKf,KAAA;EALe;;;;AAYV;EAAL,KAAK;AAAA;;;;UAMU,gBAAA;EACf,IAAA;EACA,OAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,UAGe,iBAAA;;;;;EAKf,IAAA;EAYQ;;AAAgB;AAG1B;EATE,IAAA;;;;;EAMA,KAAA,GAAQ,gBAAgB;AAAA;AAAA,UAGT,kBAAA;EAmBZ;AAGL;;;EAjBE,OAAA,GAAU,cAAc;EA4BpB;AAGN;;;;EAxBE,QAAA;EA6BU;;;;;EAtBV,GAAA;AAAA;AAAA,UAGe,qBAAA;;;;;EAKf,IAAA;EAqEmB;;;;EA/DnB,IAAI;AAAA;AAAA,UAGW,oBAAA;EA6Cf;;;;EAxCA,OAAA,GAAU,cAAA;EAuDD;;;;EAjDT,UAAA,GAAa,qBAAqB;EA8DnB;;;;ACzI+D;EDkF9E,GAAA;AAAA;AAAA,UAGe,WAAA;ECnCqB;;;;AAAmC;;;ED2CvE,IAAA,GAAO,eAAA;EE1GQ;;;;AACZ;;EFiHH,OAAA,GAAU,kBAAA;;AGrHZ;;;;;EH6HE,SAAA,GAAY,oBAAA;EG3H4B;;;;;EHkIxC,MAAA,GAAS,iBAAA;EGnI8B;;;;;;EH2IvC,IAAA;IAAS,OAAA,GAAU,cAAA;EAAA;;;;;EAMnB,aAAA;;;;;;EAOA,eAAA;AAAA;;;;;;AA9IK;AAMP;;iBCiDwB,IAAA,CAAK,OAAA,GAAS,WAAA,GAAmB,gBAAgB;;;UC/DxD,sBAAA;EACf,GAAG;AAAA;;;UCJY,UAAA;EACf,SAAA,KAAc,OAAA,EAAS,WAAA,KAAgB,OAAA;EACvC,UAAA,KAAe,OAAA,EAAS,WAAA,KAAgB,OAAA;AAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/integration/integration.ts","../src/platform/prepare.ts","../src/lifecycle/lifecycle.ts"],"mappings":";;;;;;;UAEiB;;;;;EAKf;;;;;;EAOA;;;;;UAMe;EACf;EACA;EACA;EACA;;UAGe;;;;;EAKf;;;;;EAMA;;;;;EAMA,QAAQ;;UAGO;;;;;EAKf,UAAU;;;;;;EAOV;;;;;;EAOA;;UAGe;;;;;EAKf;;;;;EAMA;;UAGe;;;;;EAKf,UAAU;;;;;EAMV,aAAa;;;;;;EAOb;;UAGe;;;;;;;;EAQf,OAAO;;;;;;;EAQP,UAAU;;;;;;;EAQV,YAAY;;;;;;EAOZ,SAAS;;;;;;;EAQT;IAAS,UAAU;;;;;;;;;;;EAWnB;;;;;;;;;;;;EAaA;;;;;EAMA;;;;;;EAOA;;;;;;;;;;iBC5GsB,KAAK,UAAS,cAAmB;;;UClExC;EACf;;;;UCJe;EACf,cAAc,SAAS,gBAAgB;EACvC,eAAe,SAAS,gBAAgB"}