@absolutejs/absolute 0.19.0-beta.960 → 0.19.0-beta.962

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.
@@ -7,7 +7,7 @@
7
7
  "import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\n/**\n * Resolve Angular package paths from the compiled runtime node_modules first,\n * then the app's process.cwd()/node_modules, falling back to the bare specifier.\n * This prevents Bun's baked import.meta.dir from resolving Angular packages\n * from the absolutejs source tree instead of the consumer's project when\n * running from a published npm package.\n */\nexport const resolveAngularPackageDir = (specifier: string) => {\n\tconst fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR\n\t\t? resolve(process.env.ABSOLUTE_BUILD_DIR, 'node_modules', specifier)\n\t\t: null;\n\tif (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {\n\t\treturn fromCompiledRuntime;\n\t}\n\n\tconst fromProject = resolve(process.cwd(), 'node_modules', specifier);\n\n\tif (existsSync(fromProject)) {\n\t\treturn fromProject;\n\t}\n\n\treturn null;\n};\n\nconst resolvePackageEntry = (packageDir: string) => {\n\ttry {\n\t\tconst pkg = JSON.parse(\n\t\t\treadFileSync(join(packageDir, 'package.json'), 'utf-8')\n\t\t);\n\t\tconst rootExport = pkg.exports?.['.'];\n\t\tconst entry =\n\t\t\t(typeof rootExport === 'string'\n\t\t\t\t? rootExport\n\t\t\t\t: rootExport?.default) ??\n\t\t\tpkg.module ??\n\t\t\tpkg.main ??\n\t\t\t'index.js';\n\n\t\treturn join(packageDir, entry);\n\t} catch {\n\t\treturn packageDir;\n\t}\n};\n\nexport const resolveAngularPackage = (specifier: string) => {\n\tconst packageDir = resolveAngularPackageDir(specifier);\n\tif (packageDir) return resolvePackageEntry(packageDir);\n\n\treturn specifier;\n};\n\nconst toSafeVendorName = (specifier: string) =>\n\tspecifier.replace(/^@/, '').replace(/\\//g, '_');\n\n/** Prefer the linked Bun-target vendor file built by\n * `buildAngularServerVendor`. The file is at\n * `<ABSOLUTE_BUILD_DIR>/angular/vendor/server/<safe>.js`, which is what every\n * server bundle's `@angular/*` imports get rewritten to point at. Sharing\n * this path keeps SSR's class identity unified — the dual-package hazard\n * that produces NG0201 only appears when the runtime imports a *different*\n * copy from the bundles. Falls back to `resolveAngularPackage` (node_modules)\n * when no vendor file is available — e.g. running tests outside an\n * absolutejs build, or before the vendor pass completes. */\nexport const resolveAngularRuntimePath = (specifier: string) => {\n\tconst buildDirs = [\n\t\tprocess.env.ABSOLUTE_BUILD_DIR,\n\t\tresolve(process.cwd(), 'build')\n\t].filter((value): value is string => Boolean(value));\n\n\tfor (const buildDir of buildDirs) {\n\t\tconst vendorPath = join(\n\t\t\tbuildDir,\n\t\t\t'angular',\n\t\t\t'vendor',\n\t\t\t'server',\n\t\t\t`${toSafeVendorName(specifier)}.js`\n\t\t);\n\t\tif (existsSync(vendorPath)) return vendorPath;\n\t}\n\n\treturn resolveAngularPackage(specifier);\n};\n",
8
8
  "/* Bundler-safe NODE_ENV reader.\n *\n * Bun (like esbuild and most modern bundlers) statically replaces\n * `process.env.NODE_ENV` with the build-time string. When absolutejs\n * itself is bundled (`bun run scripts/build.ts`), NODE_ENV is unset,\n * so every `process.env.NODE_ENV === 'production'` site collapses to\n * `false` and the production branch is dead-code-eliminated from\n * `dist/`. That breaks `bun start`, `bun compile`, and the standalone\n * compiled binary — they all run with NODE_ENV=production but see the\n * dev branches baked in.\n *\n * Computed-property access (`process.env[KEY]`) is NOT constant-folded\n * by Bun, so we read NODE_ENV through a string variable. Both branches\n * stay live in `dist/`, and the consumer's actual runtime NODE_ENV\n * decides which one fires.\n *\n * Verified empirically: Bun's bundler matches the literal AST shape\n * `MemberExpression { object: process.env, property: NODE_ENV }` for\n * its replacement. Computed-key access uses\n * `MemberExpression { computed: true, property: Identifier(KEY) }`,\n * which doesn't match the pattern. */\n\nconst ENV_VAR = 'NODE_ENV';\n\nexport const getNodeEnv = () => process.env[ENV_VAR];\n\nexport const isProductionRuntime = () => process.env[ENV_VAR] === 'production';\n\nexport const isDevelopmentRuntime = () =>\n\tprocess.env[ENV_VAR] === 'development';\n",
9
9
  "import { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport { isProductionRuntime } from '../utils/runtimeMode';\n\n// Patches Angular SSR's DominoAdapter to guard against null doc.head\n\nconst ensureHead = (doc: Document) => {\n\tif (!doc || doc.head || !doc.documentElement) {\n\t\treturn;\n\t}\n\n\tconst head = doc.createElement('head');\n\tdoc.documentElement.insertBefore(head, doc.documentElement.firstChild);\n};\n\n// Domino's Element does not implement layout APIs that browser components\n// (e.g. ngx-datatable, swiper, drag-drop) call eagerly during change detection.\n// Returning a zeroed DOMRect lets those components render in SSR without\n// crashing — the real values get computed once the page hydrates client-side.\nconst SSR_LAYOUT_RECT = Object.freeze({\n\tbottom: 0,\n\theight: 0,\n\tleft: 0,\n\tright: 0,\n\ttop: 0,\n\twidth: 0,\n\tx: 0,\n\ty: 0,\n\ttoJSON() {\n\t\treturn this;\n\t}\n});\nlet layoutPatchApplied = false;\nconst collectPrototypeChain = (instance: object | null) => {\n\tconst protos: object[] = [];\n\tlet current: object | null = instance\n\t\t? Object.getPrototypeOf(instance)\n\t\t: null;\n\twhile (current && current !== Object.prototype) {\n\t\tprotos.push(current);\n\t\tcurrent = Object.getPrototypeOf(current);\n\t}\n\n\treturn protos;\n};\n\nconst patchElementLayout = (doc: Document) => {\n\tif (layoutPatchApplied || !doc) {\n\t\treturn;\n\t}\n\tlet element: Element;\n\ttry {\n\t\telement = doc.createElement('div');\n\t} catch {\n\t\treturn;\n\t}\n\t// Walk the entire prototype chain so HTMLElement → Element → Node all get\n\t// the layout shims. Domino's base Element.prototype is several hops above\n\t// HTMLDivElement.prototype, and 3rd-party libs call methods anywhere along\n\t// the chain.\n\tconst protos = collectPrototypeChain(element);\n\tif (protos.length === 0) return;\n\n\tconst copyLayoutRect = (rect: typeof SSR_LAYOUT_RECT) => ({ ...rect });\n\tconst createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);\n\tconst getClientRects = () => [];\n\tconst noop = () => undefined;\n\tconst numericProps = [\n\t\t'clientWidth',\n\t\t'clientHeight',\n\t\t'clientLeft',\n\t\t'clientTop',\n\t\t'offsetWidth',\n\t\t'offsetHeight',\n\t\t'offsetLeft',\n\t\t'offsetTop',\n\t\t'scrollWidth',\n\t\t'scrollHeight',\n\t\t'scrollLeft',\n\t\t'scrollTop'\n\t];\n\n\tfor (const proto of protos) {\n\t\tconst define = (name: string, value: unknown) => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\t\t\tif (typeof descriptor?.value === 'function') return;\n\n\t\t\tObject.defineProperty(proto, name, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t};\n\n\t\tdefine('getBoundingClientRect', createLayoutRect);\n\t\tdefine('getClientRects', getClientRects);\n\t\tdefine('scrollTo', noop);\n\t\tdefine('scrollBy', noop);\n\t\tdefine('scrollIntoView', noop);\n\t\tdefine('focus', noop);\n\t\tdefine('blur', noop);\n\n\t\tfor (const prop of numericProps) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop);\n\t\t\tif (desc) continue;\n\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget: () => 0\n\t\t\t});\n\t\t}\n\t}\n\n\tlayoutPatchApplied = true;\n};\n\nexport const applyPatches = async () => {\n\t// §1.1 — bare specifier in dev shares Bun's module cache with bundled\n\t// server pages. Production stays on the resolved vendor path. Use\n\t// `isProductionRuntime()` instead of a direct `process.env.NODE_ENV`\n\t// read so Bun's bundler doesn't constant-fold this branch out of\n\t// dist/ at absolutejs build time.\n\tconst spec = isProductionRuntime()\n\t\t? resolveAngularRuntimePath('@angular/platform-server')\n\t\t: '@angular/platform-server';\n\tconst { ɵDominoAdapter } = await import(spec);\n\tif (!ɵDominoAdapter?.prototype) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] ɵDominoAdapter not found, skipping patches'\n\t\t);\n\n\t\treturn false;\n\t}\n\n\t// Patch the layout shims onto Domino's Element prototypes immediately\n\t// (don't wait for the first createHtmlDocument call). Components that\n\t// hold an ElementRef from the very first change-detection pass call\n\t// these methods before the lazy patch path would have run.\n\ttry {\n\t\tconst adapter = new ɵDominoAdapter();\n\t\tconst seedDoc =\n\t\t\ttypeof adapter.createHtmlDocument === 'function'\n\t\t\t\t? adapter.createHtmlDocument()\n\t\t\t\t: typeof adapter.getDefaultDocument === 'function'\n\t\t\t\t\t? adapter.getDefaultDocument()\n\t\t\t\t\t: null;\n\t\tif (seedDoc) {\n\t\t\tpatchElementLayout(seedDoc);\n\t\t\tconst probe = seedDoc.createElement('div') as Element & {\n\t\t\t\tgetBoundingClientRect?: () => DOMRect;\n\t\t\t};\n\t\t\tif (typeof probe.getBoundingClientRect !== 'function') {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[Angular Patch] Layout shim did not stick on probe element prototype chain'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] Could not eagerly patch Element prototypes:',\n\t\t\terror\n\t\t);\n\t}\n\n\tconst proto = ɵDominoAdapter.prototype;\n\n\tconst origGetBaseHref = proto.getBaseHref;\n\tproto.getBaseHref = function (doc: Document) {\n\t\tif (!doc || !doc.head || typeof doc.head.children === 'undefined') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn origGetBaseHref.call(this, doc);\n\t};\n\n\tconst origCreateHtmlDocument = proto.createHtmlDocument;\n\tproto.createHtmlDocument = function () {\n\t\tconst doc = origCreateHtmlDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\tconst origGetDefaultDocument = proto.getDefaultDocument;\n\tproto.getDefaultDocument = function () {\n\t\tconst doc = origGetDefaultDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\treturn true;\n};\n",
10
- "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
10
+ "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// docs/ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
11
11
  "const normalizeSlug = (str: string) =>\n\tstr\n\t\t.trim()\n\t\t.replace(/\\s+/g, '-')\n\t\t.replace(/[^A-Za-z0-9\\-_]+/g, '')\n\t\t.replace(/[-_]{2,}/g, '-');\n\nexport const toKebab = (str: string) =>\n\tnormalizeSlug(str)\n\t\t.replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n\t\t.toLowerCase();\nexport const toPascal = (str: string) => {\n\tif (!str.includes('-') && !str.includes('_')) {\n\t\treturn str.charAt(0).toUpperCase() + str.slice(1);\n\t}\n\n\treturn normalizeSlug(str)\n\t\t.split(/[-_]/)\n\t\t.filter(Boolean)\n\t\t.map(\n\t\t\t(segment) =>\n\t\t\t\tsegment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()\n\t\t)\n\t\t.join('');\n};\nexport const toScreamingSnake = (str: string) =>\n\tstr.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toUpperCase();\n",
12
12
  "/**\n * Utility for registering client-side scripts that need to run after Angular SSR hydration.\n *\n * This is necessary because Angular's lifecycle hooks don't always run reliably on the client\n * after SSR hydration, especially for event listeners attached to DOM elements.\n *\n * Usage in Angular components:\n * ```typescript\n * import { registerClientScript } from '@absolutejs/absolute';\n *\n * // Register an event listener script\n * registerClientScript(() => {\n * const element = document.querySelector('.my-element');\n * if (element) {\n * element.addEventListener('click', () => {\n * console.log('Clicked!');\n * });\n * }\n * });\n * ```\n *\n * The script will be automatically injected into the HTML response and executed on the client.\n */\n\n// Request-scoped registry for client scripts\n// Each request gets its own set of scripts to inject\nconst scriptRegistry = new Map<string, Set<() => void>>();\n\n// Generate a unique request ID for tracking scripts per request\nlet requestCounter = 0;\nconst getRequestId = () => `req_${Date.now()}_${++requestCounter}`;\n\n// Allow SSR frameworks to inject a request context getter (e.g. AsyncLocalStorage)\nlet ssrContextGetter: (() => string | undefined) | null = null;\nexport const getSsrContextId = () =>\n\tssrContextGetter?.() ||\n\tObject.getOwnPropertyDescriptor(globalThis, '__absolutejs_requestId')\n\t\t?.value;\nexport const registerClientScript = (\n\tscript: () => void,\n\trequestId?: string\n) => {\n\t// Try to get requestId from explicit arg, then Async Context, then global fallback\n\tconst id = requestId || getSsrContextId() || getRequestId();\n\n\tif (!scriptRegistry.has(id)) {\n\t\tscriptRegistry.set(id, new Set());\n\t}\n\n\tscriptRegistry.get(id)?.add(script);\n\n\treturn id;\n};\nexport const setSsrContextGetter = (getter: () => string | undefined) => {\n\tssrContextGetter = getter;\n};\n\n// Make registerClientScript available globally during SSR for Angular components\n// Using type assertion for globalThis extension\nif (typeof globalThis !== 'undefined') {\n\tObject.assign(globalThis, { registerClientScript });\n}\n\n/**\n * Get all registered scripts for a request and clear them.\n * This is called by the page handler after rendering.\n *\n * @param requestId - The request ID to get scripts for\n * @returns Array of script functions, or empty array if none registered\n */\nexport const clearAllClientScripts = () => {\n\tscriptRegistry.clear();\n};\nexport const generateClientScriptCode = (scripts: (() => void)[]) => {\n\tif (scripts.length === 0) {\n\t\treturn '';\n\t}\n\n\t// Convert functions to strings and wrap in IIFE\n\tconst scriptCode = scripts\n\t\t.map((script, index) => {\n\t\t\t// Get the function body as a string\n\t\t\tconst funcString = script.toString();\n\n\t\t\t// Extract the body (everything between { and })\n\t\t\tconst bodyMatch = funcString.match(/\\{([\\s\\S]*)\\}/);\n\t\t\tif (!bodyMatch || !bodyMatch[1]) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst body = bodyMatch[1].trim();\n\n\t\t\t// Wrap in IIFE with MutationObserver for DOM readiness\n\t\t\treturn `\n\t(function() {\n\t\tvar executed = false;\n\t\tfunction executeScript_${index}() {\n\t\t\tif (executed) return;\n\t\t\texecuted = true;\n\t\t\t${body}\n\t\t}\n\n\t\tif (document.readyState === 'complete' || document.readyState === 'interactive') {\n\t\t\texecuteScript_${index}();\n\t\t} else {\n\t\t\tdocument.addEventListener('DOMContentLoaded', executeScript_${index});\n\t\t}\n\n\t\t// Watch for hydration-added elements\n\t\tvar observer = new MutationObserver(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tif (executed) observer.disconnect();\n\t\t});\n\t\tif (!executed) {\n\t\t\tobserver.observe(document.body || document.documentElement, { childList: true, subtree: true });\n\t\t}\n\n\t\t// Single fallback timeout\n\t\tsetTimeout(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tobserver.disconnect();\n\t\t}, 1000);\n\t})();`;\n\t\t})\n\t\t.join('\\n');\n\n\treturn `<script>\n(function() {\n${scriptCode}\n})();\n</script>`;\n};\nexport const getAndClearClientScripts = (requestId?: string) => {\n\tconst id = requestId || ssrContextGetter?.();\n\tif (!id) return [];\n\n\tconst scripts = scriptRegistry.get(id);\n\tif (!scripts) {\n\t\treturn [];\n\t}\n\n\tconst scriptArray = Array.from(scripts);\n\tscriptRegistry.delete(id);\n\n\treturn scriptArray;\n};\n",
13
13
  "import type { HttpTransferCacheOptions } from '@angular/common/http';\n\nexport const ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = 'x-skip-transfer-cache';\n\nexport type AbsoluteHttpTransferCacheOptions = Omit<\n\tHttpTransferCacheOptions,\n\t'filter'\n> & {\n\tfilter?: NonNullable<HttpTransferCacheOptions['filter']>;\n\tskipHeader?: string;\n};\n\nexport const buildAbsoluteHttpTransferCacheOptions = (\n\toptions: AbsoluteHttpTransferCacheOptions = {}\n) => {\n\tconst {\n\t\tfilter: userFilter,\n\t\tskipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,\n\t\t...angularOptions\n\t} = options;\n\n\treturn {\n\t\tincludePostRequests: false,\n\t\tincludeRequestsWithAuthHeaders: false,\n\t\t...angularOptions,\n\t\tfilter: (request) =>\n\t\t\t!request.headers.has(skipHeader) && (userFilter?.(request) ?? true)\n\t} satisfies HttpTransferCacheOptions;\n};\n",
@@ -19,7 +19,7 @@
19
19
  "import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\n/**\n * Resolve Angular package paths from the compiled runtime node_modules first,\n * then the app's process.cwd()/node_modules, falling back to the bare specifier.\n * This prevents Bun's baked import.meta.dir from resolving Angular packages\n * from the absolutejs source tree instead of the consumer's project when\n * running from a published npm package.\n */\nexport const resolveAngularPackageDir = (specifier: string) => {\n\tconst fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR\n\t\t? resolve(process.env.ABSOLUTE_BUILD_DIR, 'node_modules', specifier)\n\t\t: null;\n\tif (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {\n\t\treturn fromCompiledRuntime;\n\t}\n\n\tconst fromProject = resolve(process.cwd(), 'node_modules', specifier);\n\n\tif (existsSync(fromProject)) {\n\t\treturn fromProject;\n\t}\n\n\treturn null;\n};\n\nconst resolvePackageEntry = (packageDir: string) => {\n\ttry {\n\t\tconst pkg = JSON.parse(\n\t\t\treadFileSync(join(packageDir, 'package.json'), 'utf-8')\n\t\t);\n\t\tconst rootExport = pkg.exports?.['.'];\n\t\tconst entry =\n\t\t\t(typeof rootExport === 'string'\n\t\t\t\t? rootExport\n\t\t\t\t: rootExport?.default) ??\n\t\t\tpkg.module ??\n\t\t\tpkg.main ??\n\t\t\t'index.js';\n\n\t\treturn join(packageDir, entry);\n\t} catch {\n\t\treturn packageDir;\n\t}\n};\n\nexport const resolveAngularPackage = (specifier: string) => {\n\tconst packageDir = resolveAngularPackageDir(specifier);\n\tif (packageDir) return resolvePackageEntry(packageDir);\n\n\treturn specifier;\n};\n\nconst toSafeVendorName = (specifier: string) =>\n\tspecifier.replace(/^@/, '').replace(/\\//g, '_');\n\n/** Prefer the linked Bun-target vendor file built by\n * `buildAngularServerVendor`. The file is at\n * `<ABSOLUTE_BUILD_DIR>/angular/vendor/server/<safe>.js`, which is what every\n * server bundle's `@angular/*` imports get rewritten to point at. Sharing\n * this path keeps SSR's class identity unified — the dual-package hazard\n * that produces NG0201 only appears when the runtime imports a *different*\n * copy from the bundles. Falls back to `resolveAngularPackage` (node_modules)\n * when no vendor file is available — e.g. running tests outside an\n * absolutejs build, or before the vendor pass completes. */\nexport const resolveAngularRuntimePath = (specifier: string) => {\n\tconst buildDirs = [\n\t\tprocess.env.ABSOLUTE_BUILD_DIR,\n\t\tresolve(process.cwd(), 'build')\n\t].filter((value): value is string => Boolean(value));\n\n\tfor (const buildDir of buildDirs) {\n\t\tconst vendorPath = join(\n\t\t\tbuildDir,\n\t\t\t'angular',\n\t\t\t'vendor',\n\t\t\t'server',\n\t\t\t`${toSafeVendorName(specifier)}.js`\n\t\t);\n\t\tif (existsSync(vendorPath)) return vendorPath;\n\t}\n\n\treturn resolveAngularPackage(specifier);\n};\n",
20
20
  "/* Bundler-safe NODE_ENV reader.\n *\n * Bun (like esbuild and most modern bundlers) statically replaces\n * `process.env.NODE_ENV` with the build-time string. When absolutejs\n * itself is bundled (`bun run scripts/build.ts`), NODE_ENV is unset,\n * so every `process.env.NODE_ENV === 'production'` site collapses to\n * `false` and the production branch is dead-code-eliminated from\n * `dist/`. That breaks `bun start`, `bun compile`, and the standalone\n * compiled binary — they all run with NODE_ENV=production but see the\n * dev branches baked in.\n *\n * Computed-property access (`process.env[KEY]`) is NOT constant-folded\n * by Bun, so we read NODE_ENV through a string variable. Both branches\n * stay live in `dist/`, and the consumer's actual runtime NODE_ENV\n * decides which one fires.\n *\n * Verified empirically: Bun's bundler matches the literal AST shape\n * `MemberExpression { object: process.env, property: NODE_ENV }` for\n * its replacement. Computed-key access uses\n * `MemberExpression { computed: true, property: Identifier(KEY) }`,\n * which doesn't match the pattern. */\n\nconst ENV_VAR = 'NODE_ENV';\n\nexport const getNodeEnv = () => process.env[ENV_VAR];\n\nexport const isProductionRuntime = () => process.env[ENV_VAR] === 'production';\n\nexport const isDevelopmentRuntime = () =>\n\tprocess.env[ENV_VAR] === 'development';\n",
21
21
  "import { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport { isProductionRuntime } from '../utils/runtimeMode';\n\n// Patches Angular SSR's DominoAdapter to guard against null doc.head\n\nconst ensureHead = (doc: Document) => {\n\tif (!doc || doc.head || !doc.documentElement) {\n\t\treturn;\n\t}\n\n\tconst head = doc.createElement('head');\n\tdoc.documentElement.insertBefore(head, doc.documentElement.firstChild);\n};\n\n// Domino's Element does not implement layout APIs that browser components\n// (e.g. ngx-datatable, swiper, drag-drop) call eagerly during change detection.\n// Returning a zeroed DOMRect lets those components render in SSR without\n// crashing — the real values get computed once the page hydrates client-side.\nconst SSR_LAYOUT_RECT = Object.freeze({\n\tbottom: 0,\n\theight: 0,\n\tleft: 0,\n\tright: 0,\n\ttop: 0,\n\twidth: 0,\n\tx: 0,\n\ty: 0,\n\ttoJSON() {\n\t\treturn this;\n\t}\n});\nlet layoutPatchApplied = false;\nconst collectPrototypeChain = (instance: object | null) => {\n\tconst protos: object[] = [];\n\tlet current: object | null = instance\n\t\t? Object.getPrototypeOf(instance)\n\t\t: null;\n\twhile (current && current !== Object.prototype) {\n\t\tprotos.push(current);\n\t\tcurrent = Object.getPrototypeOf(current);\n\t}\n\n\treturn protos;\n};\n\nconst patchElementLayout = (doc: Document) => {\n\tif (layoutPatchApplied || !doc) {\n\t\treturn;\n\t}\n\tlet element: Element;\n\ttry {\n\t\telement = doc.createElement('div');\n\t} catch {\n\t\treturn;\n\t}\n\t// Walk the entire prototype chain so HTMLElement → Element → Node all get\n\t// the layout shims. Domino's base Element.prototype is several hops above\n\t// HTMLDivElement.prototype, and 3rd-party libs call methods anywhere along\n\t// the chain.\n\tconst protos = collectPrototypeChain(element);\n\tif (protos.length === 0) return;\n\n\tconst copyLayoutRect = (rect: typeof SSR_LAYOUT_RECT) => ({ ...rect });\n\tconst createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);\n\tconst getClientRects = () => [];\n\tconst noop = () => undefined;\n\tconst numericProps = [\n\t\t'clientWidth',\n\t\t'clientHeight',\n\t\t'clientLeft',\n\t\t'clientTop',\n\t\t'offsetWidth',\n\t\t'offsetHeight',\n\t\t'offsetLeft',\n\t\t'offsetTop',\n\t\t'scrollWidth',\n\t\t'scrollHeight',\n\t\t'scrollLeft',\n\t\t'scrollTop'\n\t];\n\n\tfor (const proto of protos) {\n\t\tconst define = (name: string, value: unknown) => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\t\t\tif (typeof descriptor?.value === 'function') return;\n\n\t\t\tObject.defineProperty(proto, name, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t};\n\n\t\tdefine('getBoundingClientRect', createLayoutRect);\n\t\tdefine('getClientRects', getClientRects);\n\t\tdefine('scrollTo', noop);\n\t\tdefine('scrollBy', noop);\n\t\tdefine('scrollIntoView', noop);\n\t\tdefine('focus', noop);\n\t\tdefine('blur', noop);\n\n\t\tfor (const prop of numericProps) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop);\n\t\t\tif (desc) continue;\n\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget: () => 0\n\t\t\t});\n\t\t}\n\t}\n\n\tlayoutPatchApplied = true;\n};\n\nexport const applyPatches = async () => {\n\t// §1.1 — bare specifier in dev shares Bun's module cache with bundled\n\t// server pages. Production stays on the resolved vendor path. Use\n\t// `isProductionRuntime()` instead of a direct `process.env.NODE_ENV`\n\t// read so Bun's bundler doesn't constant-fold this branch out of\n\t// dist/ at absolutejs build time.\n\tconst spec = isProductionRuntime()\n\t\t? resolveAngularRuntimePath('@angular/platform-server')\n\t\t: '@angular/platform-server';\n\tconst { ɵDominoAdapter } = await import(spec);\n\tif (!ɵDominoAdapter?.prototype) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] ɵDominoAdapter not found, skipping patches'\n\t\t);\n\n\t\treturn false;\n\t}\n\n\t// Patch the layout shims onto Domino's Element prototypes immediately\n\t// (don't wait for the first createHtmlDocument call). Components that\n\t// hold an ElementRef from the very first change-detection pass call\n\t// these methods before the lazy patch path would have run.\n\ttry {\n\t\tconst adapter = new ɵDominoAdapter();\n\t\tconst seedDoc =\n\t\t\ttypeof adapter.createHtmlDocument === 'function'\n\t\t\t\t? adapter.createHtmlDocument()\n\t\t\t\t: typeof adapter.getDefaultDocument === 'function'\n\t\t\t\t\t? adapter.getDefaultDocument()\n\t\t\t\t\t: null;\n\t\tif (seedDoc) {\n\t\t\tpatchElementLayout(seedDoc);\n\t\t\tconst probe = seedDoc.createElement('div') as Element & {\n\t\t\t\tgetBoundingClientRect?: () => DOMRect;\n\t\t\t};\n\t\t\tif (typeof probe.getBoundingClientRect !== 'function') {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[Angular Patch] Layout shim did not stick on probe element prototype chain'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] Could not eagerly patch Element prototypes:',\n\t\t\terror\n\t\t);\n\t}\n\n\tconst proto = ɵDominoAdapter.prototype;\n\n\tconst origGetBaseHref = proto.getBaseHref;\n\tproto.getBaseHref = function (doc: Document) {\n\t\tif (!doc || !doc.head || typeof doc.head.children === 'undefined') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn origGetBaseHref.call(this, doc);\n\t};\n\n\tconst origCreateHtmlDocument = proto.createHtmlDocument;\n\tproto.createHtmlDocument = function () {\n\t\tconst doc = origCreateHtmlDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\tconst origGetDefaultDocument = proto.getDefaultDocument;\n\tproto.getDefaultDocument = function () {\n\t\tconst doc = origGetDefaultDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\treturn true;\n};\n",
22
- "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
22
+ "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// docs/ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
23
23
  "/**\n * Utility for registering client-side scripts that need to run after Angular SSR hydration.\n *\n * This is necessary because Angular's lifecycle hooks don't always run reliably on the client\n * after SSR hydration, especially for event listeners attached to DOM elements.\n *\n * Usage in Angular components:\n * ```typescript\n * import { registerClientScript } from '@absolutejs/absolute';\n *\n * // Register an event listener script\n * registerClientScript(() => {\n * const element = document.querySelector('.my-element');\n * if (element) {\n * element.addEventListener('click', () => {\n * console.log('Clicked!');\n * });\n * }\n * });\n * ```\n *\n * The script will be automatically injected into the HTML response and executed on the client.\n */\n\n// Request-scoped registry for client scripts\n// Each request gets its own set of scripts to inject\nconst scriptRegistry = new Map<string, Set<() => void>>();\n\n// Generate a unique request ID for tracking scripts per request\nlet requestCounter = 0;\nconst getRequestId = () => `req_${Date.now()}_${++requestCounter}`;\n\n// Allow SSR frameworks to inject a request context getter (e.g. AsyncLocalStorage)\nlet ssrContextGetter: (() => string | undefined) | null = null;\nexport const getSsrContextId = () =>\n\tssrContextGetter?.() ||\n\tObject.getOwnPropertyDescriptor(globalThis, '__absolutejs_requestId')\n\t\t?.value;\nexport const registerClientScript = (\n\tscript: () => void,\n\trequestId?: string\n) => {\n\t// Try to get requestId from explicit arg, then Async Context, then global fallback\n\tconst id = requestId || getSsrContextId() || getRequestId();\n\n\tif (!scriptRegistry.has(id)) {\n\t\tscriptRegistry.set(id, new Set());\n\t}\n\n\tscriptRegistry.get(id)?.add(script);\n\n\treturn id;\n};\nexport const setSsrContextGetter = (getter: () => string | undefined) => {\n\tssrContextGetter = getter;\n};\n\n// Make registerClientScript available globally during SSR for Angular components\n// Using type assertion for globalThis extension\nif (typeof globalThis !== 'undefined') {\n\tObject.assign(globalThis, { registerClientScript });\n}\n\n/**\n * Get all registered scripts for a request and clear them.\n * This is called by the page handler after rendering.\n *\n * @param requestId - The request ID to get scripts for\n * @returns Array of script functions, or empty array if none registered\n */\nexport const clearAllClientScripts = () => {\n\tscriptRegistry.clear();\n};\nexport const generateClientScriptCode = (scripts: (() => void)[]) => {\n\tif (scripts.length === 0) {\n\t\treturn '';\n\t}\n\n\t// Convert functions to strings and wrap in IIFE\n\tconst scriptCode = scripts\n\t\t.map((script, index) => {\n\t\t\t// Get the function body as a string\n\t\t\tconst funcString = script.toString();\n\n\t\t\t// Extract the body (everything between { and })\n\t\t\tconst bodyMatch = funcString.match(/\\{([\\s\\S]*)\\}/);\n\t\t\tif (!bodyMatch || !bodyMatch[1]) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst body = bodyMatch[1].trim();\n\n\t\t\t// Wrap in IIFE with MutationObserver for DOM readiness\n\t\t\treturn `\n\t(function() {\n\t\tvar executed = false;\n\t\tfunction executeScript_${index}() {\n\t\t\tif (executed) return;\n\t\t\texecuted = true;\n\t\t\t${body}\n\t\t}\n\n\t\tif (document.readyState === 'complete' || document.readyState === 'interactive') {\n\t\t\texecuteScript_${index}();\n\t\t} else {\n\t\t\tdocument.addEventListener('DOMContentLoaded', executeScript_${index});\n\t\t}\n\n\t\t// Watch for hydration-added elements\n\t\tvar observer = new MutationObserver(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tif (executed) observer.disconnect();\n\t\t});\n\t\tif (!executed) {\n\t\t\tobserver.observe(document.body || document.documentElement, { childList: true, subtree: true });\n\t\t}\n\n\t\t// Single fallback timeout\n\t\tsetTimeout(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tobserver.disconnect();\n\t\t}, 1000);\n\t})();`;\n\t\t})\n\t\t.join('\\n');\n\n\treturn `<script>\n(function() {\n${scriptCode}\n})();\n</script>`;\n};\nexport const getAndClearClientScripts = (requestId?: string) => {\n\tconst id = requestId || ssrContextGetter?.();\n\tif (!id) return [];\n\n\tconst scripts = scriptRegistry.get(id);\n\tif (!scripts) {\n\t\treturn [];\n\t}\n\n\tconst scriptArray = Array.from(scripts);\n\tscriptRegistry.delete(id);\n\n\treturn scriptArray;\n};\n",
24
24
  "import type { HttpTransferCacheOptions } from '@angular/common/http';\n\nexport const ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = 'x-skip-transfer-cache';\n\nexport type AbsoluteHttpTransferCacheOptions = Omit<\n\tHttpTransferCacheOptions,\n\t'filter'\n> & {\n\tfilter?: NonNullable<HttpTransferCacheOptions['filter']>;\n\tskipHeader?: string;\n};\n\nexport const buildAbsoluteHttpTransferCacheOptions = (\n\toptions: AbsoluteHttpTransferCacheOptions = {}\n) => {\n\tconst {\n\t\tfilter: userFilter,\n\t\tskipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,\n\t\t...angularOptions\n\t} = options;\n\n\treturn {\n\t\tincludePostRequests: false,\n\t\tincludeRequestsWithAuthHeaders: false,\n\t\t...angularOptions,\n\t\tfilter: (request) =>\n\t\t\t!request.headers.has(skipHeader) && (userFilter?.(request) ?? true)\n\t} satisfies HttpTransferCacheOptions;\n};\n",
25
25
  "import type { AngularDeps } from '../../types/angular';\n\n/* `REQUEST`, `REQUEST_CONTEXT`, and `RESPONSE_INIT` are public Angular DI\n tokens — import them directly from `@angular/core`. Re-exporting them\n here would force a static `import { ... } from \"@angular/core\"` into\n every absolutejs bundle that transitively reaches this file, breaking\n non-Angular consumers (no `@angular/core` installed) at module-load\n time. Bun's bundler treats `await import(\"./angular/...\")` as a\n static dep when `splitting: false`, so even guarded dynamic loaders\n on the consumer side pull this file in. The cleanest fix is to not\n own these symbols here at all. */\n\nexport const buildRequestProviders = (\n\tdeps: AngularDeps,\n\trequest: Request | undefined,\n\trequestContext: unknown,\n\tresponseInit: ResponseInit | undefined\n) => [\n\t{ provide: deps.REQUEST, useValue: request ?? null },\n\t{ provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },\n\t{ provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }\n];\n",
@@ -2,6 +2,8 @@ export type { AngularPageDefinition, AngularPagePropsOf } from '../../types/angu
2
2
  export { ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER, buildAbsoluteHttpTransferCacheOptions } from './httpTransferCache';
3
3
  export { createDeterministicRandom, DETERMINISTIC_NOW, DETERMINISTIC_RANDOM, DETERMINISTIC_SEED, provideDeterministicEnv } from './deterministicEnv';
4
4
  export { defineAngularPage } from './page';
5
+ export { useResource, useSubscription, useTimers } from './composables';
6
+ export type { Observer, Resource, ResourceFetcher, ResourceOptions } from './composables';
5
7
  export { preserveAcrossHmr } from './preserveAcrossHmr';
6
8
  export { Island } from './Island.browser';
7
9
  export { withPendingTask } from './pendingTask';
@@ -4,7 +4,6 @@ type SlotResolver = () => Promise<string> | string;
4
4
  export declare class StreamSlotComponent {
5
5
  private readonly cdr;
6
6
  private readonly sanitizer;
7
- private readonly zone;
8
7
  private readonly slotConsumer;
9
8
  className?: string;
10
9
  errorHtml?: string;
@@ -0,0 +1,5 @@
1
+ export { useResource } from './useResource';
2
+ export type { Resource, ResourceFetcher, ResourceOptions } from './useResource';
3
+ export { useSubscription } from './useSubscription';
4
+ export type { Observer } from './useSubscription';
5
+ export { useTimers } from './useTimers';
@@ -0,0 +1,36 @@
1
+ import { type Signal } from '@angular/core';
2
+ export type ResourceFetcher<T> = (signal: AbortSignal) => Promise<T>;
3
+ export type ResourceOptions = {
4
+ /** Run the fetcher immediately on creation. Default: true. Pass
5
+ * `false` to defer the first load until `refresh()` is called. */
6
+ immediate?: boolean;
7
+ };
8
+ export type Resource<T> = {
9
+ /** Latest resolved value, or `null` before the first successful load. */
10
+ data: Signal<T | null>;
11
+ /** Latest rejection reason, or `null` when the resource is healthy. */
12
+ error: Signal<unknown>;
13
+ /** True while a fetch is in flight. */
14
+ loading: Signal<boolean>;
15
+ /** Re-runs the fetcher. Any in-flight request is aborted first. */
16
+ refresh: () => Promise<void>;
17
+ /** Aborts the in-flight request, if any. No-op otherwise. */
18
+ cancel: () => void;
19
+ };
20
+ /** Signal-backed async data composable. Replaces the React
21
+ * `useEffect(() => { fetch(); }, [])` + `useState` pair with a single
22
+ * call that's safe in zoneless Angular (the signals it returns trigger
23
+ * change detection automatically when consumed in a template).
24
+ *
25
+ * ```ts
26
+ * const profile = useResource(() => api.profile.me.get());
27
+ *
28
+ * // in template:
29
+ * // @if (profile.loading()) { … }
30
+ * // @if (profile.data(); as data) { {{ data.name }} }
31
+ * ```
32
+ *
33
+ * The fetcher receives an `AbortSignal` it can pass to `fetch` — the
34
+ * signal aborts on component destroy or on a new `refresh()` call.
35
+ * Must be called in an injection context. */
36
+ export declare const useResource: <T>(fetcher: ResourceFetcher<T>, options?: ResourceOptions) => Resource<T>;
@@ -0,0 +1,20 @@
1
+ import type { Observable, Subscription } from 'rxjs';
2
+ export type Observer<T> = {
3
+ next?: (value: T) => void;
4
+ error?: (err: unknown) => void;
5
+ complete?: () => void;
6
+ };
7
+ /** Subscribe to an Observable with automatic teardown when the host
8
+ * component is destroyed. Equivalent to
9
+ * `observable.pipe(takeUntilDestroyed(destroyRef)).subscribe(observer)`,
10
+ * collapsed into one call so consumers can't forget the cleanup
11
+ * operator (the most common Angular memory-leak source).
12
+ *
13
+ * Must be called in an injection context.
14
+ *
15
+ * Note: this composable handles teardown only — it does not trigger
16
+ * change detection on emissions. If the observer mutates state that
17
+ * drives the template, store that state in a `signal()` so updates
18
+ * propagate in zoneless Angular. */
19
+ export declare function useSubscription<T>(observable: Observable<T>, next: (value: T) => void): Subscription;
20
+ export declare function useSubscription<T>(observable: Observable<T>, observer: Observer<T>): Subscription;
@@ -0,0 +1,18 @@
1
+ /** Component-scoped `setTimeout` / `setInterval` with automatic cleanup
2
+ * on `DestroyRef.onDestroy`. Use instead of raw `setTimeout` so timers
3
+ * scheduled by a component never outlive it.
4
+ *
5
+ * Must be called in an Angular injection context (component constructor,
6
+ * field initializer, or `runInInjectionContext`).
7
+ *
8
+ * Note: this composable just manages timers — it does not trigger change
9
+ * detection. If the timer callback mutates state that drives the template,
10
+ * store that state in a `signal()` so the update propagates in zoneless
11
+ * Angular. See the absolutejs docs on zoneless change detection. */
12
+ export declare const useTimers: () => {
13
+ clearAll: () => void;
14
+ clearInterval(timer: ReturnType<typeof setInterval> | null | undefined): void;
15
+ clearTimeout(timer: ReturnType<typeof setTimeout> | null | undefined): void;
16
+ setInterval(callback: () => void, delayMs: number): NodeJS.Timeout;
17
+ setTimeout(callback: () => void, delayMs: number): NodeJS.Timeout;
18
+ };
@@ -4,6 +4,8 @@ export { ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER, buildAbsoluteHttpTransferCach
4
4
  export { createDeterministicRandom, DETERMINISTIC_NOW, DETERMINISTIC_RANDOM, DETERMINISTIC_SEED, provideDeterministicEnv } from './deterministicEnv';
5
5
  export { handleAngularPageRequest } from './pageHandler';
6
6
  export { defineAngularPage } from './page';
7
+ export { useResource, useSubscription, useTimers } from './composables';
8
+ export type { Observer, Resource, ResourceFetcher, ResourceOptions } from './composables';
7
9
  export { preserveAcrossHmr } from './preserveAcrossHmr';
8
10
  export { withPendingTask } from './pendingTask';
9
11
  export { createTypedIsland } from './createIsland';
@@ -60,10 +60,10 @@ export declare const Image: import("vue").DefineComponent<{
60
60
  width: number;
61
61
  onLoad: Function;
62
62
  className: string;
63
+ quality: number;
63
64
  sizes: string;
64
65
  priority: boolean;
65
66
  unoptimized: boolean;
66
- quality: number;
67
67
  crossOrigin: string;
68
68
  overrideSrc: string;
69
69
  placeholder: string;
@@ -21,7 +21,7 @@
21
21
  "import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\n/**\n * Resolve Angular package paths from the compiled runtime node_modules first,\n * then the app's process.cwd()/node_modules, falling back to the bare specifier.\n * This prevents Bun's baked import.meta.dir from resolving Angular packages\n * from the absolutejs source tree instead of the consumer's project when\n * running from a published npm package.\n */\nexport const resolveAngularPackageDir = (specifier: string) => {\n\tconst fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR\n\t\t? resolve(process.env.ABSOLUTE_BUILD_DIR, 'node_modules', specifier)\n\t\t: null;\n\tif (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {\n\t\treturn fromCompiledRuntime;\n\t}\n\n\tconst fromProject = resolve(process.cwd(), 'node_modules', specifier);\n\n\tif (existsSync(fromProject)) {\n\t\treturn fromProject;\n\t}\n\n\treturn null;\n};\n\nconst resolvePackageEntry = (packageDir: string) => {\n\ttry {\n\t\tconst pkg = JSON.parse(\n\t\t\treadFileSync(join(packageDir, 'package.json'), 'utf-8')\n\t\t);\n\t\tconst rootExport = pkg.exports?.['.'];\n\t\tconst entry =\n\t\t\t(typeof rootExport === 'string'\n\t\t\t\t? rootExport\n\t\t\t\t: rootExport?.default) ??\n\t\t\tpkg.module ??\n\t\t\tpkg.main ??\n\t\t\t'index.js';\n\n\t\treturn join(packageDir, entry);\n\t} catch {\n\t\treturn packageDir;\n\t}\n};\n\nexport const resolveAngularPackage = (specifier: string) => {\n\tconst packageDir = resolveAngularPackageDir(specifier);\n\tif (packageDir) return resolvePackageEntry(packageDir);\n\n\treturn specifier;\n};\n\nconst toSafeVendorName = (specifier: string) =>\n\tspecifier.replace(/^@/, '').replace(/\\//g, '_');\n\n/** Prefer the linked Bun-target vendor file built by\n * `buildAngularServerVendor`. The file is at\n * `<ABSOLUTE_BUILD_DIR>/angular/vendor/server/<safe>.js`, which is what every\n * server bundle's `@angular/*` imports get rewritten to point at. Sharing\n * this path keeps SSR's class identity unified — the dual-package hazard\n * that produces NG0201 only appears when the runtime imports a *different*\n * copy from the bundles. Falls back to `resolveAngularPackage` (node_modules)\n * when no vendor file is available — e.g. running tests outside an\n * absolutejs build, or before the vendor pass completes. */\nexport const resolveAngularRuntimePath = (specifier: string) => {\n\tconst buildDirs = [\n\t\tprocess.env.ABSOLUTE_BUILD_DIR,\n\t\tresolve(process.cwd(), 'build')\n\t].filter((value): value is string => Boolean(value));\n\n\tfor (const buildDir of buildDirs) {\n\t\tconst vendorPath = join(\n\t\t\tbuildDir,\n\t\t\t'angular',\n\t\t\t'vendor',\n\t\t\t'server',\n\t\t\t`${toSafeVendorName(specifier)}.js`\n\t\t);\n\t\tif (existsSync(vendorPath)) return vendorPath;\n\t}\n\n\treturn resolveAngularPackage(specifier);\n};\n",
22
22
  "/* Bundler-safe NODE_ENV reader.\n *\n * Bun (like esbuild and most modern bundlers) statically replaces\n * `process.env.NODE_ENV` with the build-time string. When absolutejs\n * itself is bundled (`bun run scripts/build.ts`), NODE_ENV is unset,\n * so every `process.env.NODE_ENV === 'production'` site collapses to\n * `false` and the production branch is dead-code-eliminated from\n * `dist/`. That breaks `bun start`, `bun compile`, and the standalone\n * compiled binary — they all run with NODE_ENV=production but see the\n * dev branches baked in.\n *\n * Computed-property access (`process.env[KEY]`) is NOT constant-folded\n * by Bun, so we read NODE_ENV through a string variable. Both branches\n * stay live in `dist/`, and the consumer's actual runtime NODE_ENV\n * decides which one fires.\n *\n * Verified empirically: Bun's bundler matches the literal AST shape\n * `MemberExpression { object: process.env, property: NODE_ENV }` for\n * its replacement. Computed-key access uses\n * `MemberExpression { computed: true, property: Identifier(KEY) }`,\n * which doesn't match the pattern. */\n\nconst ENV_VAR = 'NODE_ENV';\n\nexport const getNodeEnv = () => process.env[ENV_VAR];\n\nexport const isProductionRuntime = () => process.env[ENV_VAR] === 'production';\n\nexport const isDevelopmentRuntime = () =>\n\tprocess.env[ENV_VAR] === 'development';\n",
23
23
  "import { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport { isProductionRuntime } from '../utils/runtimeMode';\n\n// Patches Angular SSR's DominoAdapter to guard against null doc.head\n\nconst ensureHead = (doc: Document) => {\n\tif (!doc || doc.head || !doc.documentElement) {\n\t\treturn;\n\t}\n\n\tconst head = doc.createElement('head');\n\tdoc.documentElement.insertBefore(head, doc.documentElement.firstChild);\n};\n\n// Domino's Element does not implement layout APIs that browser components\n// (e.g. ngx-datatable, swiper, drag-drop) call eagerly during change detection.\n// Returning a zeroed DOMRect lets those components render in SSR without\n// crashing — the real values get computed once the page hydrates client-side.\nconst SSR_LAYOUT_RECT = Object.freeze({\n\tbottom: 0,\n\theight: 0,\n\tleft: 0,\n\tright: 0,\n\ttop: 0,\n\twidth: 0,\n\tx: 0,\n\ty: 0,\n\ttoJSON() {\n\t\treturn this;\n\t}\n});\nlet layoutPatchApplied = false;\nconst collectPrototypeChain = (instance: object | null) => {\n\tconst protos: object[] = [];\n\tlet current: object | null = instance\n\t\t? Object.getPrototypeOf(instance)\n\t\t: null;\n\twhile (current && current !== Object.prototype) {\n\t\tprotos.push(current);\n\t\tcurrent = Object.getPrototypeOf(current);\n\t}\n\n\treturn protos;\n};\n\nconst patchElementLayout = (doc: Document) => {\n\tif (layoutPatchApplied || !doc) {\n\t\treturn;\n\t}\n\tlet element: Element;\n\ttry {\n\t\telement = doc.createElement('div');\n\t} catch {\n\t\treturn;\n\t}\n\t// Walk the entire prototype chain so HTMLElement → Element → Node all get\n\t// the layout shims. Domino's base Element.prototype is several hops above\n\t// HTMLDivElement.prototype, and 3rd-party libs call methods anywhere along\n\t// the chain.\n\tconst protos = collectPrototypeChain(element);\n\tif (protos.length === 0) return;\n\n\tconst copyLayoutRect = (rect: typeof SSR_LAYOUT_RECT) => ({ ...rect });\n\tconst createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);\n\tconst getClientRects = () => [];\n\tconst noop = () => undefined;\n\tconst numericProps = [\n\t\t'clientWidth',\n\t\t'clientHeight',\n\t\t'clientLeft',\n\t\t'clientTop',\n\t\t'offsetWidth',\n\t\t'offsetHeight',\n\t\t'offsetLeft',\n\t\t'offsetTop',\n\t\t'scrollWidth',\n\t\t'scrollHeight',\n\t\t'scrollLeft',\n\t\t'scrollTop'\n\t];\n\n\tfor (const proto of protos) {\n\t\tconst define = (name: string, value: unknown) => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\t\t\tif (typeof descriptor?.value === 'function') return;\n\n\t\t\tObject.defineProperty(proto, name, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t};\n\n\t\tdefine('getBoundingClientRect', createLayoutRect);\n\t\tdefine('getClientRects', getClientRects);\n\t\tdefine('scrollTo', noop);\n\t\tdefine('scrollBy', noop);\n\t\tdefine('scrollIntoView', noop);\n\t\tdefine('focus', noop);\n\t\tdefine('blur', noop);\n\n\t\tfor (const prop of numericProps) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop);\n\t\t\tif (desc) continue;\n\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget: () => 0\n\t\t\t});\n\t\t}\n\t}\n\n\tlayoutPatchApplied = true;\n};\n\nexport const applyPatches = async () => {\n\t// §1.1 — bare specifier in dev shares Bun's module cache with bundled\n\t// server pages. Production stays on the resolved vendor path. Use\n\t// `isProductionRuntime()` instead of a direct `process.env.NODE_ENV`\n\t// read so Bun's bundler doesn't constant-fold this branch out of\n\t// dist/ at absolutejs build time.\n\tconst spec = isProductionRuntime()\n\t\t? resolveAngularRuntimePath('@angular/platform-server')\n\t\t: '@angular/platform-server';\n\tconst { ɵDominoAdapter } = await import(spec);\n\tif (!ɵDominoAdapter?.prototype) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] ɵDominoAdapter not found, skipping patches'\n\t\t);\n\n\t\treturn false;\n\t}\n\n\t// Patch the layout shims onto Domino's Element prototypes immediately\n\t// (don't wait for the first createHtmlDocument call). Components that\n\t// hold an ElementRef from the very first change-detection pass call\n\t// these methods before the lazy patch path would have run.\n\ttry {\n\t\tconst adapter = new ɵDominoAdapter();\n\t\tconst seedDoc =\n\t\t\ttypeof adapter.createHtmlDocument === 'function'\n\t\t\t\t? adapter.createHtmlDocument()\n\t\t\t\t: typeof adapter.getDefaultDocument === 'function'\n\t\t\t\t\t? adapter.getDefaultDocument()\n\t\t\t\t\t: null;\n\t\tif (seedDoc) {\n\t\t\tpatchElementLayout(seedDoc);\n\t\t\tconst probe = seedDoc.createElement('div') as Element & {\n\t\t\t\tgetBoundingClientRect?: () => DOMRect;\n\t\t\t};\n\t\t\tif (typeof probe.getBoundingClientRect !== 'function') {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[Angular Patch] Layout shim did not stick on probe element prototype chain'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] Could not eagerly patch Element prototypes:',\n\t\t\terror\n\t\t);\n\t}\n\n\tconst proto = ɵDominoAdapter.prototype;\n\n\tconst origGetBaseHref = proto.getBaseHref;\n\tproto.getBaseHref = function (doc: Document) {\n\t\tif (!doc || !doc.head || typeof doc.head.children === 'undefined') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn origGetBaseHref.call(this, doc);\n\t};\n\n\tconst origCreateHtmlDocument = proto.createHtmlDocument;\n\tproto.createHtmlDocument = function () {\n\t\tconst doc = origCreateHtmlDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\tconst origGetDefaultDocument = proto.getDefaultDocument;\n\tproto.getDefaultDocument = function () {\n\t\tconst doc = origGetDefaultDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\treturn true;\n};\n",
24
- "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
24
+ "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// docs/ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
25
25
  "/**\n * Utility for registering client-side scripts that need to run after Angular SSR hydration.\n *\n * This is necessary because Angular's lifecycle hooks don't always run reliably on the client\n * after SSR hydration, especially for event listeners attached to DOM elements.\n *\n * Usage in Angular components:\n * ```typescript\n * import { registerClientScript } from '@absolutejs/absolute';\n *\n * // Register an event listener script\n * registerClientScript(() => {\n * const element = document.querySelector('.my-element');\n * if (element) {\n * element.addEventListener('click', () => {\n * console.log('Clicked!');\n * });\n * }\n * });\n * ```\n *\n * The script will be automatically injected into the HTML response and executed on the client.\n */\n\n// Request-scoped registry for client scripts\n// Each request gets its own set of scripts to inject\nconst scriptRegistry = new Map<string, Set<() => void>>();\n\n// Generate a unique request ID for tracking scripts per request\nlet requestCounter = 0;\nconst getRequestId = () => `req_${Date.now()}_${++requestCounter}`;\n\n// Allow SSR frameworks to inject a request context getter (e.g. AsyncLocalStorage)\nlet ssrContextGetter: (() => string | undefined) | null = null;\nexport const getSsrContextId = () =>\n\tssrContextGetter?.() ||\n\tObject.getOwnPropertyDescriptor(globalThis, '__absolutejs_requestId')\n\t\t?.value;\nexport const registerClientScript = (\n\tscript: () => void,\n\trequestId?: string\n) => {\n\t// Try to get requestId from explicit arg, then Async Context, then global fallback\n\tconst id = requestId || getSsrContextId() || getRequestId();\n\n\tif (!scriptRegistry.has(id)) {\n\t\tscriptRegistry.set(id, new Set());\n\t}\n\n\tscriptRegistry.get(id)?.add(script);\n\n\treturn id;\n};\nexport const setSsrContextGetter = (getter: () => string | undefined) => {\n\tssrContextGetter = getter;\n};\n\n// Make registerClientScript available globally during SSR for Angular components\n// Using type assertion for globalThis extension\nif (typeof globalThis !== 'undefined') {\n\tObject.assign(globalThis, { registerClientScript });\n}\n\n/**\n * Get all registered scripts for a request and clear them.\n * This is called by the page handler after rendering.\n *\n * @param requestId - The request ID to get scripts for\n * @returns Array of script functions, or empty array if none registered\n */\nexport const clearAllClientScripts = () => {\n\tscriptRegistry.clear();\n};\nexport const generateClientScriptCode = (scripts: (() => void)[]) => {\n\tif (scripts.length === 0) {\n\t\treturn '';\n\t}\n\n\t// Convert functions to strings and wrap in IIFE\n\tconst scriptCode = scripts\n\t\t.map((script, index) => {\n\t\t\t// Get the function body as a string\n\t\t\tconst funcString = script.toString();\n\n\t\t\t// Extract the body (everything between { and })\n\t\t\tconst bodyMatch = funcString.match(/\\{([\\s\\S]*)\\}/);\n\t\t\tif (!bodyMatch || !bodyMatch[1]) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst body = bodyMatch[1].trim();\n\n\t\t\t// Wrap in IIFE with MutationObserver for DOM readiness\n\t\t\treturn `\n\t(function() {\n\t\tvar executed = false;\n\t\tfunction executeScript_${index}() {\n\t\t\tif (executed) return;\n\t\t\texecuted = true;\n\t\t\t${body}\n\t\t}\n\n\t\tif (document.readyState === 'complete' || document.readyState === 'interactive') {\n\t\t\texecuteScript_${index}();\n\t\t} else {\n\t\t\tdocument.addEventListener('DOMContentLoaded', executeScript_${index});\n\t\t}\n\n\t\t// Watch for hydration-added elements\n\t\tvar observer = new MutationObserver(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tif (executed) observer.disconnect();\n\t\t});\n\t\tif (!executed) {\n\t\t\tobserver.observe(document.body || document.documentElement, { childList: true, subtree: true });\n\t\t}\n\n\t\t// Single fallback timeout\n\t\tsetTimeout(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tobserver.disconnect();\n\t\t}, 1000);\n\t})();`;\n\t\t})\n\t\t.join('\\n');\n\n\treturn `<script>\n(function() {\n${scriptCode}\n})();\n</script>`;\n};\nexport const getAndClearClientScripts = (requestId?: string) => {\n\tconst id = requestId || ssrContextGetter?.();\n\tif (!id) return [];\n\n\tconst scripts = scriptRegistry.get(id);\n\tif (!scripts) {\n\t\treturn [];\n\t}\n\n\tconst scriptArray = Array.from(scripts);\n\tscriptRegistry.delete(id);\n\n\treturn scriptArray;\n};\n",
26
26
  "import type { HttpTransferCacheOptions } from '@angular/common/http';\n\nexport const ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = 'x-skip-transfer-cache';\n\nexport type AbsoluteHttpTransferCacheOptions = Omit<\n\tHttpTransferCacheOptions,\n\t'filter'\n> & {\n\tfilter?: NonNullable<HttpTransferCacheOptions['filter']>;\n\tskipHeader?: string;\n};\n\nexport const buildAbsoluteHttpTransferCacheOptions = (\n\toptions: AbsoluteHttpTransferCacheOptions = {}\n) => {\n\tconst {\n\t\tfilter: userFilter,\n\t\tskipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,\n\t\t...angularOptions\n\t} = options;\n\n\treturn {\n\t\tincludePostRequests: false,\n\t\tincludeRequestsWithAuthHeaders: false,\n\t\t...angularOptions,\n\t\tfilter: (request) =>\n\t\t\t!request.headers.has(skipHeader) && (userFilter?.(request) ?? true)\n\t} satisfies HttpTransferCacheOptions;\n};\n",
27
27
  "import type { AngularDeps } from '../../types/angular';\n\n/* `REQUEST`, `REQUEST_CONTEXT`, and `RESPONSE_INIT` are public Angular DI\n tokens — import them directly from `@angular/core`. Re-exporting them\n here would force a static `import { ... } from \"@angular/core\"` into\n every absolutejs bundle that transitively reaches this file, breaking\n non-Angular consumers (no `@angular/core` installed) at module-load\n time. Bun's bundler treats `await import(\"./angular/...\")` as a\n static dep when `splitting: false`, so even guarded dynamic loaders\n on the consumer side pull this file in. The cleanest fix is to not\n own these symbols here at all. */\n\nexport const buildRequestProviders = (\n\tdeps: AngularDeps,\n\trequest: Request | undefined,\n\trequestContext: unknown,\n\tresponseInit: ResponseInit | undefined\n) => [\n\t{ provide: deps.REQUEST, useValue: request ?? null },\n\t{ provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },\n\t{ provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }\n];\n",
@@ -3,6 +3,11 @@ export type SitemapRouteOverride = {
3
3
  changefreq?: ChangeFrequency;
4
4
  priority?: number;
5
5
  lastmod?: string;
6
+ /** Per-route opt-out. When set on a page handler's `sitemap` block
7
+ * (e.g. `sitemap: { exclude: true }`), the route is omitted from
8
+ * the generated sitemap.xml. Use for auth-gated routes, token
9
+ * pages, or anything that shouldn't be crawled. */
10
+ exclude?: boolean;
6
11
  };
7
12
  /** Per-route sitemap metadata, accepted as an optional `sitemap` field
8
13
  * on every framework page-handler input (`handleAngularPageRequest`,
@@ -19,7 +19,7 @@
19
19
  "import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\n/**\n * Resolve Angular package paths from the compiled runtime node_modules first,\n * then the app's process.cwd()/node_modules, falling back to the bare specifier.\n * This prevents Bun's baked import.meta.dir from resolving Angular packages\n * from the absolutejs source tree instead of the consumer's project when\n * running from a published npm package.\n */\nexport const resolveAngularPackageDir = (specifier: string) => {\n\tconst fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR\n\t\t? resolve(process.env.ABSOLUTE_BUILD_DIR, 'node_modules', specifier)\n\t\t: null;\n\tif (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {\n\t\treturn fromCompiledRuntime;\n\t}\n\n\tconst fromProject = resolve(process.cwd(), 'node_modules', specifier);\n\n\tif (existsSync(fromProject)) {\n\t\treturn fromProject;\n\t}\n\n\treturn null;\n};\n\nconst resolvePackageEntry = (packageDir: string) => {\n\ttry {\n\t\tconst pkg = JSON.parse(\n\t\t\treadFileSync(join(packageDir, 'package.json'), 'utf-8')\n\t\t);\n\t\tconst rootExport = pkg.exports?.['.'];\n\t\tconst entry =\n\t\t\t(typeof rootExport === 'string'\n\t\t\t\t? rootExport\n\t\t\t\t: rootExport?.default) ??\n\t\t\tpkg.module ??\n\t\t\tpkg.main ??\n\t\t\t'index.js';\n\n\t\treturn join(packageDir, entry);\n\t} catch {\n\t\treturn packageDir;\n\t}\n};\n\nexport const resolveAngularPackage = (specifier: string) => {\n\tconst packageDir = resolveAngularPackageDir(specifier);\n\tif (packageDir) return resolvePackageEntry(packageDir);\n\n\treturn specifier;\n};\n\nconst toSafeVendorName = (specifier: string) =>\n\tspecifier.replace(/^@/, '').replace(/\\//g, '_');\n\n/** Prefer the linked Bun-target vendor file built by\n * `buildAngularServerVendor`. The file is at\n * `<ABSOLUTE_BUILD_DIR>/angular/vendor/server/<safe>.js`, which is what every\n * server bundle's `@angular/*` imports get rewritten to point at. Sharing\n * this path keeps SSR's class identity unified — the dual-package hazard\n * that produces NG0201 only appears when the runtime imports a *different*\n * copy from the bundles. Falls back to `resolveAngularPackage` (node_modules)\n * when no vendor file is available — e.g. running tests outside an\n * absolutejs build, or before the vendor pass completes. */\nexport const resolveAngularRuntimePath = (specifier: string) => {\n\tconst buildDirs = [\n\t\tprocess.env.ABSOLUTE_BUILD_DIR,\n\t\tresolve(process.cwd(), 'build')\n\t].filter((value): value is string => Boolean(value));\n\n\tfor (const buildDir of buildDirs) {\n\t\tconst vendorPath = join(\n\t\t\tbuildDir,\n\t\t\t'angular',\n\t\t\t'vendor',\n\t\t\t'server',\n\t\t\t`${toSafeVendorName(specifier)}.js`\n\t\t);\n\t\tif (existsSync(vendorPath)) return vendorPath;\n\t}\n\n\treturn resolveAngularPackage(specifier);\n};\n",
20
20
  "/* Bundler-safe NODE_ENV reader.\n *\n * Bun (like esbuild and most modern bundlers) statically replaces\n * `process.env.NODE_ENV` with the build-time string. When absolutejs\n * itself is bundled (`bun run scripts/build.ts`), NODE_ENV is unset,\n * so every `process.env.NODE_ENV === 'production'` site collapses to\n * `false` and the production branch is dead-code-eliminated from\n * `dist/`. That breaks `bun start`, `bun compile`, and the standalone\n * compiled binary — they all run with NODE_ENV=production but see the\n * dev branches baked in.\n *\n * Computed-property access (`process.env[KEY]`) is NOT constant-folded\n * by Bun, so we read NODE_ENV through a string variable. Both branches\n * stay live in `dist/`, and the consumer's actual runtime NODE_ENV\n * decides which one fires.\n *\n * Verified empirically: Bun's bundler matches the literal AST shape\n * `MemberExpression { object: process.env, property: NODE_ENV }` for\n * its replacement. Computed-key access uses\n * `MemberExpression { computed: true, property: Identifier(KEY) }`,\n * which doesn't match the pattern. */\n\nconst ENV_VAR = 'NODE_ENV';\n\nexport const getNodeEnv = () => process.env[ENV_VAR];\n\nexport const isProductionRuntime = () => process.env[ENV_VAR] === 'production';\n\nexport const isDevelopmentRuntime = () =>\n\tprocess.env[ENV_VAR] === 'development';\n",
21
21
  "import { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport { isProductionRuntime } from '../utils/runtimeMode';\n\n// Patches Angular SSR's DominoAdapter to guard against null doc.head\n\nconst ensureHead = (doc: Document) => {\n\tif (!doc || doc.head || !doc.documentElement) {\n\t\treturn;\n\t}\n\n\tconst head = doc.createElement('head');\n\tdoc.documentElement.insertBefore(head, doc.documentElement.firstChild);\n};\n\n// Domino's Element does not implement layout APIs that browser components\n// (e.g. ngx-datatable, swiper, drag-drop) call eagerly during change detection.\n// Returning a zeroed DOMRect lets those components render in SSR without\n// crashing — the real values get computed once the page hydrates client-side.\nconst SSR_LAYOUT_RECT = Object.freeze({\n\tbottom: 0,\n\theight: 0,\n\tleft: 0,\n\tright: 0,\n\ttop: 0,\n\twidth: 0,\n\tx: 0,\n\ty: 0,\n\ttoJSON() {\n\t\treturn this;\n\t}\n});\nlet layoutPatchApplied = false;\nconst collectPrototypeChain = (instance: object | null) => {\n\tconst protos: object[] = [];\n\tlet current: object | null = instance\n\t\t? Object.getPrototypeOf(instance)\n\t\t: null;\n\twhile (current && current !== Object.prototype) {\n\t\tprotos.push(current);\n\t\tcurrent = Object.getPrototypeOf(current);\n\t}\n\n\treturn protos;\n};\n\nconst patchElementLayout = (doc: Document) => {\n\tif (layoutPatchApplied || !doc) {\n\t\treturn;\n\t}\n\tlet element: Element;\n\ttry {\n\t\telement = doc.createElement('div');\n\t} catch {\n\t\treturn;\n\t}\n\t// Walk the entire prototype chain so HTMLElement → Element → Node all get\n\t// the layout shims. Domino's base Element.prototype is several hops above\n\t// HTMLDivElement.prototype, and 3rd-party libs call methods anywhere along\n\t// the chain.\n\tconst protos = collectPrototypeChain(element);\n\tif (protos.length === 0) return;\n\n\tconst copyLayoutRect = (rect: typeof SSR_LAYOUT_RECT) => ({ ...rect });\n\tconst createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);\n\tconst getClientRects = () => [];\n\tconst noop = () => undefined;\n\tconst numericProps = [\n\t\t'clientWidth',\n\t\t'clientHeight',\n\t\t'clientLeft',\n\t\t'clientTop',\n\t\t'offsetWidth',\n\t\t'offsetHeight',\n\t\t'offsetLeft',\n\t\t'offsetTop',\n\t\t'scrollWidth',\n\t\t'scrollHeight',\n\t\t'scrollLeft',\n\t\t'scrollTop'\n\t];\n\n\tfor (const proto of protos) {\n\t\tconst define = (name: string, value: unknown) => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\t\t\tif (typeof descriptor?.value === 'function') return;\n\n\t\t\tObject.defineProperty(proto, name, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t};\n\n\t\tdefine('getBoundingClientRect', createLayoutRect);\n\t\tdefine('getClientRects', getClientRects);\n\t\tdefine('scrollTo', noop);\n\t\tdefine('scrollBy', noop);\n\t\tdefine('scrollIntoView', noop);\n\t\tdefine('focus', noop);\n\t\tdefine('blur', noop);\n\n\t\tfor (const prop of numericProps) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop);\n\t\t\tif (desc) continue;\n\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget: () => 0\n\t\t\t});\n\t\t}\n\t}\n\n\tlayoutPatchApplied = true;\n};\n\nexport const applyPatches = async () => {\n\t// §1.1 — bare specifier in dev shares Bun's module cache with bundled\n\t// server pages. Production stays on the resolved vendor path. Use\n\t// `isProductionRuntime()` instead of a direct `process.env.NODE_ENV`\n\t// read so Bun's bundler doesn't constant-fold this branch out of\n\t// dist/ at absolutejs build time.\n\tconst spec = isProductionRuntime()\n\t\t? resolveAngularRuntimePath('@angular/platform-server')\n\t\t: '@angular/platform-server';\n\tconst { ɵDominoAdapter } = await import(spec);\n\tif (!ɵDominoAdapter?.prototype) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] ɵDominoAdapter not found, skipping patches'\n\t\t);\n\n\t\treturn false;\n\t}\n\n\t// Patch the layout shims onto Domino's Element prototypes immediately\n\t// (don't wait for the first createHtmlDocument call). Components that\n\t// hold an ElementRef from the very first change-detection pass call\n\t// these methods before the lazy patch path would have run.\n\ttry {\n\t\tconst adapter = new ɵDominoAdapter();\n\t\tconst seedDoc =\n\t\t\ttypeof adapter.createHtmlDocument === 'function'\n\t\t\t\t? adapter.createHtmlDocument()\n\t\t\t\t: typeof adapter.getDefaultDocument === 'function'\n\t\t\t\t\t? adapter.getDefaultDocument()\n\t\t\t\t\t: null;\n\t\tif (seedDoc) {\n\t\t\tpatchElementLayout(seedDoc);\n\t\t\tconst probe = seedDoc.createElement('div') as Element & {\n\t\t\t\tgetBoundingClientRect?: () => DOMRect;\n\t\t\t};\n\t\t\tif (typeof probe.getBoundingClientRect !== 'function') {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[Angular Patch] Layout shim did not stick on probe element prototype chain'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] Could not eagerly patch Element prototypes:',\n\t\t\terror\n\t\t);\n\t}\n\n\tconst proto = ɵDominoAdapter.prototype;\n\n\tconst origGetBaseHref = proto.getBaseHref;\n\tproto.getBaseHref = function (doc: Document) {\n\t\tif (!doc || !doc.head || typeof doc.head.children === 'undefined') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn origGetBaseHref.call(this, doc);\n\t};\n\n\tconst origCreateHtmlDocument = proto.createHtmlDocument;\n\tproto.createHtmlDocument = function () {\n\t\tconst doc = origCreateHtmlDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\tconst origGetDefaultDocument = proto.getDefaultDocument;\n\tproto.getDefaultDocument = function () {\n\t\tconst doc = origGetDefaultDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\treturn true;\n};\n",
22
- "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
22
+ "import type { AngularDeps } from '../../types/angular';\nimport { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport {\n\tisDevelopmentRuntime,\n\tisProductionRuntime\n} from '../utils/runtimeMode';\n\nconst initDominoAdapter = (platformServer: {\n\tɵDominoAdapter?: { makeCurrent?: () => void };\n}) => {\n\ttry {\n\t\tplatformServer.ɵDominoAdapter?.makeCurrent?.();\n\t} catch (err) {\n\t\tconsole.error('Failed to initialize DominoAdapter:', err);\n\t}\n};\n\nconst loadAngularDeps = async () => {\n\t// JIT compiler is only needed in development, where user pages are\n\t// runtime-compiled by `compileAngularFileJIT` and emit partial\n\t// declarations that need the compiler facade to link. In production\n\t// the linker has already processed every partial declaration into\n\t// final ɵdir/ɵcmp/ɵfac at vendor build time, so the compiler isn't\n\t// imported and isn't part of the prod vendor bundle.\n\tif (!isProductionRuntime()) {\n\t\t// Bare specifier in dev — Bun's module cache dedupes on\n\t\t// normalized specifier, so this is the same instance as the\n\t\t// `import \"@angular/compiler\"` baked into bundled server pages.\n\t\tawait import('@angular/compiler');\n\t}\n\n\t// angularPatch imports @angular/platform-server internally, so it\n\t// must also run after the compiler is available.\n\tconst { applyPatches } = await import('./angularPatch');\n\tawait applyPatches();\n\n\t// In dev (no Angular server vendor on disk — see §1.1), use bare\n\t// specifiers so Bun resolves them through node_modules and shares\n\t// the same module records with the bundled server pages, which\n\t// also have bare `@angular/*` imports in dev. Production keeps the\n\t// resolved-path import because the vendor bundle is what every\n\t// server-side import points at, and the resolved path is stable.\n\tconst useBareSpecifiers = !isProductionRuntime();\n\tconst [platformBrowser, platformServer, common, core] = await Promise.all([\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-browser'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-browser')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/platform-server'\n\t\t\t\t: resolveAngularRuntimePath('@angular/platform-server')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/common'\n\t\t\t\t: resolveAngularRuntimePath('@angular/common')\n\t\t),\n\t\timport(\n\t\t\tuseBareSpecifiers\n\t\t\t\t? '@angular/core'\n\t\t\t\t: resolveAngularRuntimePath('@angular/core')\n\t\t)\n\t]);\n\n\tif (!isDevelopmentRuntime()) {\n\t\tcore.enableProdMode();\n\t}\n\n\tinitDominoAdapter(platformServer);\n\n\treturn {\n\t\tAPP_BASE_HREF: common.APP_BASE_HREF,\n\t\tbootstrapApplication: platformBrowser.bootstrapApplication,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tprovideClientHydration: platformBrowser.provideClientHydration,\n\t\tprovideServerRendering: platformServer.provideServerRendering,\n\t\tprovideZonelessChangeDetection: core.provideZonelessChangeDetection,\n\t\treflectComponentType: core.reflectComponentType,\n\t\trenderApplication: platformServer.renderApplication,\n\t\tREQUEST: core.REQUEST,\n\t\tREQUEST_CONTEXT: core.REQUEST_CONTEXT,\n\t\tRESPONSE_INIT: core.RESPONSE_INIT,\n\t\tSanitizer: core.Sanitizer,\n\t\tSecurityContext: core.SecurityContext,\n\t\twithHttpTransferCacheOptions:\n\t\t\tplatformBrowser.withHttpTransferCacheOptions\n\t};\n};\n\nlet angularDeps: Promise<AngularDeps> | null = null;\n\nexport const getAngularDeps = () => {\n\tif (!angularDeps) {\n\t\tangularDeps = loadAngularDeps();\n\t}\n\n\treturn angularDeps;\n};\n\n// TODO(test): the unit-style coverage in\n// `tests/integration/angular/single-core.test.ts` checks that\n// `resolveAngularRuntimePath` is consistent across calls and that two\n// dynamic imports from the resolved path return the same module record\n// — necessary but not sufficient. A stronger test would spawn a dev\n// server, trigger an HMR cycle, and assert the SSR process never sees\n// two `@angular/core` evaluations (e.g. via a marker incremented at\n// module init in a vendor stub). The fixture in\n// `tests/fixtures/compile-angular` is wired for compile-time checks\n// only, so end-to-end verification of the SSR core uniqueness fix\n// happens manually in `~/onspark/absolutejs/dealroom` (see\n// docs/ABSOLUTEJS_ANGULAR_HMR.md §3.9).\n",
23
23
  "/**\n * Utility for registering client-side scripts that need to run after Angular SSR hydration.\n *\n * This is necessary because Angular's lifecycle hooks don't always run reliably on the client\n * after SSR hydration, especially for event listeners attached to DOM elements.\n *\n * Usage in Angular components:\n * ```typescript\n * import { registerClientScript } from '@absolutejs/absolute';\n *\n * // Register an event listener script\n * registerClientScript(() => {\n * const element = document.querySelector('.my-element');\n * if (element) {\n * element.addEventListener('click', () => {\n * console.log('Clicked!');\n * });\n * }\n * });\n * ```\n *\n * The script will be automatically injected into the HTML response and executed on the client.\n */\n\n// Request-scoped registry for client scripts\n// Each request gets its own set of scripts to inject\nconst scriptRegistry = new Map<string, Set<() => void>>();\n\n// Generate a unique request ID for tracking scripts per request\nlet requestCounter = 0;\nconst getRequestId = () => `req_${Date.now()}_${++requestCounter}`;\n\n// Allow SSR frameworks to inject a request context getter (e.g. AsyncLocalStorage)\nlet ssrContextGetter: (() => string | undefined) | null = null;\nexport const getSsrContextId = () =>\n\tssrContextGetter?.() ||\n\tObject.getOwnPropertyDescriptor(globalThis, '__absolutejs_requestId')\n\t\t?.value;\nexport const registerClientScript = (\n\tscript: () => void,\n\trequestId?: string\n) => {\n\t// Try to get requestId from explicit arg, then Async Context, then global fallback\n\tconst id = requestId || getSsrContextId() || getRequestId();\n\n\tif (!scriptRegistry.has(id)) {\n\t\tscriptRegistry.set(id, new Set());\n\t}\n\n\tscriptRegistry.get(id)?.add(script);\n\n\treturn id;\n};\nexport const setSsrContextGetter = (getter: () => string | undefined) => {\n\tssrContextGetter = getter;\n};\n\n// Make registerClientScript available globally during SSR for Angular components\n// Using type assertion for globalThis extension\nif (typeof globalThis !== 'undefined') {\n\tObject.assign(globalThis, { registerClientScript });\n}\n\n/**\n * Get all registered scripts for a request and clear them.\n * This is called by the page handler after rendering.\n *\n * @param requestId - The request ID to get scripts for\n * @returns Array of script functions, or empty array if none registered\n */\nexport const clearAllClientScripts = () => {\n\tscriptRegistry.clear();\n};\nexport const generateClientScriptCode = (scripts: (() => void)[]) => {\n\tif (scripts.length === 0) {\n\t\treturn '';\n\t}\n\n\t// Convert functions to strings and wrap in IIFE\n\tconst scriptCode = scripts\n\t\t.map((script, index) => {\n\t\t\t// Get the function body as a string\n\t\t\tconst funcString = script.toString();\n\n\t\t\t// Extract the body (everything between { and })\n\t\t\tconst bodyMatch = funcString.match(/\\{([\\s\\S]*)\\}/);\n\t\t\tif (!bodyMatch || !bodyMatch[1]) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst body = bodyMatch[1].trim();\n\n\t\t\t// Wrap in IIFE with MutationObserver for DOM readiness\n\t\t\treturn `\n\t(function() {\n\t\tvar executed = false;\n\t\tfunction executeScript_${index}() {\n\t\t\tif (executed) return;\n\t\t\texecuted = true;\n\t\t\t${body}\n\t\t}\n\n\t\tif (document.readyState === 'complete' || document.readyState === 'interactive') {\n\t\t\texecuteScript_${index}();\n\t\t} else {\n\t\t\tdocument.addEventListener('DOMContentLoaded', executeScript_${index});\n\t\t}\n\n\t\t// Watch for hydration-added elements\n\t\tvar observer = new MutationObserver(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tif (executed) observer.disconnect();\n\t\t});\n\t\tif (!executed) {\n\t\t\tobserver.observe(document.body || document.documentElement, { childList: true, subtree: true });\n\t\t}\n\n\t\t// Single fallback timeout\n\t\tsetTimeout(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tobserver.disconnect();\n\t\t}, 1000);\n\t})();`;\n\t\t})\n\t\t.join('\\n');\n\n\treturn `<script>\n(function() {\n${scriptCode}\n})();\n</script>`;\n};\nexport const getAndClearClientScripts = (requestId?: string) => {\n\tconst id = requestId || ssrContextGetter?.();\n\tif (!id) return [];\n\n\tconst scripts = scriptRegistry.get(id);\n\tif (!scripts) {\n\t\treturn [];\n\t}\n\n\tconst scriptArray = Array.from(scripts);\n\tscriptRegistry.delete(id);\n\n\treturn scriptArray;\n};\n",
24
24
  "import type { HttpTransferCacheOptions } from '@angular/common/http';\n\nexport const ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = 'x-skip-transfer-cache';\n\nexport type AbsoluteHttpTransferCacheOptions = Omit<\n\tHttpTransferCacheOptions,\n\t'filter'\n> & {\n\tfilter?: NonNullable<HttpTransferCacheOptions['filter']>;\n\tskipHeader?: string;\n};\n\nexport const buildAbsoluteHttpTransferCacheOptions = (\n\toptions: AbsoluteHttpTransferCacheOptions = {}\n) => {\n\tconst {\n\t\tfilter: userFilter,\n\t\tskipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,\n\t\t...angularOptions\n\t} = options;\n\n\treturn {\n\t\tincludePostRequests: false,\n\t\tincludeRequestsWithAuthHeaders: false,\n\t\t...angularOptions,\n\t\tfilter: (request) =>\n\t\t\t!request.headers.has(skipHeader) && (userFilter?.(request) ?? true)\n\t} satisfies HttpTransferCacheOptions;\n};\n",
25
25
  "import type { AngularDeps } from '../../types/angular';\n\n/* `REQUEST`, `REQUEST_CONTEXT`, and `RESPONSE_INIT` are public Angular DI\n tokens — import them directly from `@angular/core`. Re-exporting them\n here would force a static `import { ... } from \"@angular/core\"` into\n every absolutejs bundle that transitively reaches this file, breaking\n non-Angular consumers (no `@angular/core` installed) at module-load\n time. Bun's bundler treats `await import(\"./angular/...\")` as a\n static dep when `splitting: false`, so even guarded dynamic loaders\n on the consumer side pull this file in. The cleanest fix is to not\n own these symbols here at all. */\n\nexport const buildRequestProviders = (\n\tdeps: AngularDeps,\n\trequest: Request | undefined,\n\trequestContext: unknown,\n\tresponseInit: ResponseInit | undefined\n) => [\n\t{ provide: deps.REQUEST, useValue: request ?? null },\n\t{ provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },\n\t{ provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }\n];\n",
package/package.json CHANGED
@@ -31,11 +31,12 @@
31
31
  "@simple-dom/void-map": "^1.4.0",
32
32
  "@sinclair/typebox": "^0.34.0",
33
33
  "@stylistic/eslint-plugin": "^5.10.0",
34
- "@types/bun": "1.3.9",
34
+ "@types/bun": "1.3.14",
35
35
  "@types/react": "19.2.0",
36
36
  "@types/react-dom": "19.2.0",
37
37
  "@vue/compiler-sfc": "3.5.27",
38
38
  "autoprefixer": "10.4.21",
39
+ "bun-types": "1.3.14",
39
40
  "content-tag": "^4.1.1",
40
41
  "elysia": "1.4.18",
41
42
  "elysia-scoped-state": "0.1.1",
@@ -66,7 +67,7 @@
66
67
  "vue-tsc": "^3.2.5"
67
68
  },
68
69
  "engines": {
69
- "bun": ">=1.3.6"
70
+ "bun": ">=1.3.14"
70
71
  },
71
72
  "exports": {
72
73
  ".": {
@@ -401,5 +402,5 @@
401
402
  ]
402
403
  }
403
404
  },
404
- "version": "0.19.0-beta.960"
405
+ "version": "0.19.0-beta.962"
405
406
  }