@absolutejs/absolute 0.20.0-beta.56 → 0.20.0-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/browser.js +1 -45
- package/dist/angular/browser.js.map +2 -2
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +1 -17
- package/dist/angular/index.js.map +2 -2
- package/dist/build.js +8 -2
- package/dist/build.js.map +3 -3
- package/dist/client/chunks/angularPatch-arh4sr68.js +157 -0
- package/dist/client/chunks/angularPatch-arh4sr68.js.map +10 -0
- package/dist/client/chunks/index-5py90ctf.js +87 -0
- package/dist/client/chunks/index-5py90ctf.js.map +10 -0
- package/dist/client/chunks/index-m35nbkdp.js +374 -0
- package/dist/client/chunks/index-m35nbkdp.js.map +12 -0
- package/dist/client/chunks/index-qxjc7kc5.js +12 -0
- package/dist/client/chunks/index-qxjc7kc5.js.map +9 -0
- package/dist/client/chunks/islands-xj2n8nwf.js +281 -0
- package/dist/client/chunks/islands-xj2n8nwf.js.map +14 -0
- package/dist/client/chunks/react-pdg4325x.js +65 -0
- package/dist/client/chunks/react-pdg4325x.js.map +10 -0
- package/dist/client/chunks/svelte-s0c964kb.js +19 -0
- package/dist/client/chunks/svelte-s0c964kb.js.map +10 -0
- package/dist/client/chunks/vue-rdskrnyg.js +24 -0
- package/dist/client/chunks/vue-rdskrnyg.js.map +10 -0
- package/dist/client/index.js +56 -947
- package/dist/client/index.js.map +7 -22
- package/dist/index.js +8 -2
- package/dist/index.js.map +3 -3
- package/dist/islands/browser.js +1 -17
- package/dist/islands/browser.js.map +2 -2
- package/dist/islands/index.js +1 -17
- package/dist/islands/index.js.map +2 -2
- package/dist/react/browser.js +1 -45
- package/dist/react/browser.js.map +2 -2
- package/dist/react/hooks/index.js +1 -17
- package/dist/react/hooks/index.js.map +2 -2
- package/dist/react/index.js +1 -17
- package/dist/react/index.js.map +2 -2
- package/dist/svelte/browser.js +1 -17
- package/dist/svelte/browser.js.map +2 -2
- package/dist/svelte/index.js +1 -17
- package/dist/svelte/index.js.map +2 -2
- package/dist/vue/browser.js +84 -121
- package/dist/vue/browser.js.map +4 -4
- package/dist/vue/index.js +84 -121
- package/dist/vue/index.js.map +4 -4
- package/package.json +9 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/angular/resolveAngularPackage.ts", "node:path", "../src/utils/runtimeMode.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"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",
|
|
6
|
+
"function assertPath(path){if(typeof path!==\"string\")throw TypeError(\"Path must be a string. Received \"+JSON.stringify(path))}function normalizeStringPosix(path,allowAboveRoot){var res=\"\",lastSegmentLength=0,lastSlash=-1,dots=0,code;for(var i=0;i<=path.length;++i){if(i<path.length)code=path.charCodeAt(i);else if(code===47)break;else code=47;if(code===47){if(lastSlash===i-1||dots===1);else if(lastSlash!==i-1&&dots===2){if(res.length<2||lastSegmentLength!==2||res.charCodeAt(res.length-1)!==46||res.charCodeAt(res.length-2)!==46){if(res.length>2){var lastSlashIndex=res.lastIndexOf(\"/\");if(lastSlashIndex!==res.length-1){if(lastSlashIndex===-1)res=\"\",lastSegmentLength=0;else res=res.slice(0,lastSlashIndex),lastSegmentLength=res.length-1-res.lastIndexOf(\"/\");lastSlash=i,dots=0;continue}}else if(res.length===2||res.length===1){res=\"\",lastSegmentLength=0,lastSlash=i,dots=0;continue}}if(allowAboveRoot){if(res.length>0)res+=\"/..\";else res=\"..\";lastSegmentLength=2}}else{if(res.length>0)res+=\"/\"+path.slice(lastSlash+1,i);else res=path.slice(lastSlash+1,i);lastSegmentLength=i-lastSlash-1}lastSlash=i,dots=0}else if(code===46&&dots!==-1)++dots;else dots=-1}return res}function _format(sep,pathObject){var dir=pathObject.dir||pathObject.root,base=pathObject.base||(pathObject.name||\"\")+(pathObject.ext||\"\");if(!dir)return base;if(dir===pathObject.root)return dir+base;return dir+sep+base}function resolve(){var resolvedPath=\"\",resolvedAbsolute=!1,cwd;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path;if(i>=0)path=arguments[i];else{if(cwd===void 0)cwd=process.cwd();path=cwd}if(assertPath(path),path.length===0)continue;resolvedPath=path+\"/\"+resolvedPath,resolvedAbsolute=path.charCodeAt(0)===47}if(resolvedPath=normalizeStringPosix(resolvedPath,!resolvedAbsolute),resolvedAbsolute)if(resolvedPath.length>0)return\"/\"+resolvedPath;else return\"/\";else if(resolvedPath.length>0)return resolvedPath;else return\".\"}function normalize(path){if(assertPath(path),path.length===0)return\".\";var isAbsolute=path.charCodeAt(0)===47,trailingSeparator=path.charCodeAt(path.length-1)===47;if(path=normalizeStringPosix(path,!isAbsolute),path.length===0&&!isAbsolute)path=\".\";if(path.length>0&&trailingSeparator)path+=\"/\";if(isAbsolute)return\"/\"+path;return path}function isAbsolute(path){return assertPath(path),path.length>0&&path.charCodeAt(0)===47}function join(){if(arguments.length===0)return\".\";var joined;for(var i=0;i<arguments.length;++i){var arg=arguments[i];if(assertPath(arg),arg.length>0)if(joined===void 0)joined=arg;else joined+=\"/\"+arg}if(joined===void 0)return\".\";return normalize(joined)}function relative(from,to){if(assertPath(from),assertPath(to),from===to)return\"\";if(from=resolve(from),to=resolve(to),from===to)return\"\";var fromStart=1;for(;fromStart<from.length;++fromStart)if(from.charCodeAt(fromStart)!==47)break;var fromEnd=from.length,fromLen=fromEnd-fromStart,toStart=1;for(;toStart<to.length;++toStart)if(to.charCodeAt(toStart)!==47)break;var toEnd=to.length,toLen=toEnd-toStart,length=fromLen<toLen?fromLen:toLen,lastCommonSep=-1,i=0;for(;i<=length;++i){if(i===length){if(toLen>length){if(to.charCodeAt(toStart+i)===47)return to.slice(toStart+i+1);else if(i===0)return to.slice(toStart+i)}else if(fromLen>length){if(from.charCodeAt(fromStart+i)===47)lastCommonSep=i;else if(i===0)lastCommonSep=0}break}var fromCode=from.charCodeAt(fromStart+i),toCode=to.charCodeAt(toStart+i);if(fromCode!==toCode)break;else if(fromCode===47)lastCommonSep=i}var out=\"\";for(i=fromStart+lastCommonSep+1;i<=fromEnd;++i)if(i===fromEnd||from.charCodeAt(i)===47)if(out.length===0)out+=\"..\";else out+=\"/..\";if(out.length>0)return out+to.slice(toStart+lastCommonSep);else{if(toStart+=lastCommonSep,to.charCodeAt(toStart)===47)++toStart;return to.slice(toStart)}}function _makeLong(path){return path}function dirname(path){if(assertPath(path),path.length===0)return\".\";var code=path.charCodeAt(0),hasRoot=code===47,end=-1,matchedSlash=!0;for(var i=path.length-1;i>=1;--i)if(code=path.charCodeAt(i),code===47){if(!matchedSlash){end=i;break}}else matchedSlash=!1;if(end===-1)return hasRoot?\"/\":\".\";if(hasRoot&&end===1)return\"//\";return path.slice(0,end)}function basename(path,ext){if(ext!==void 0&&typeof ext!==\"string\")throw TypeError('\"ext\" argument must be a string');assertPath(path);var start=0,end=-1,matchedSlash=!0,i;if(ext!==void 0&&ext.length>0&&ext.length<=path.length){if(ext.length===path.length&&ext===path)return\"\";var extIdx=ext.length-1,firstNonSlashEnd=-1;for(i=path.length-1;i>=0;--i){var code=path.charCodeAt(i);if(code===47){if(!matchedSlash){start=i+1;break}}else{if(firstNonSlashEnd===-1)matchedSlash=!1,firstNonSlashEnd=i+1;if(extIdx>=0)if(code===ext.charCodeAt(extIdx)){if(--extIdx===-1)end=i}else extIdx=-1,end=firstNonSlashEnd}}if(start===end)end=firstNonSlashEnd;else if(end===-1)end=path.length;return path.slice(start,end)}else{for(i=path.length-1;i>=0;--i)if(path.charCodeAt(i)===47){if(!matchedSlash){start=i+1;break}}else if(end===-1)matchedSlash=!1,end=i+1;if(end===-1)return\"\";return path.slice(start,end)}}function extname(path){assertPath(path);var startDot=-1,startPart=0,end=-1,matchedSlash=!0,preDotState=0;for(var i=path.length-1;i>=0;--i){var code=path.charCodeAt(i);if(code===47){if(!matchedSlash){startPart=i+1;break}continue}if(end===-1)matchedSlash=!1,end=i+1;if(code===46){if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1}else if(startDot!==-1)preDotState=-1}if(startDot===-1||end===-1||preDotState===0||preDotState===1&&startDot===end-1&&startDot===startPart+1)return\"\";return path.slice(startDot,end)}function format(pathObject){if(pathObject===null||typeof pathObject!==\"object\")throw TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof pathObject);return _format(\"/\",pathObject)}function parse(path){assertPath(path);var ret={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(path.length===0)return ret;var code=path.charCodeAt(0),isAbsolute2=code===47,start;if(isAbsolute2)ret.root=\"/\",start=1;else start=0;var startDot=-1,startPart=0,end=-1,matchedSlash=!0,i=path.length-1,preDotState=0;for(;i>=start;--i){if(code=path.charCodeAt(i),code===47){if(!matchedSlash){startPart=i+1;break}continue}if(end===-1)matchedSlash=!1,end=i+1;if(code===46){if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1}else if(startDot!==-1)preDotState=-1}if(startDot===-1||end===-1||preDotState===0||preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1)if(startPart===0&&isAbsolute2)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end)}else{if(startPart===0&&isAbsolute2)ret.name=path.slice(1,startDot),ret.base=path.slice(1,end);else ret.name=path.slice(startPart,startDot),ret.base=path.slice(startPart,end);ret.ext=path.slice(startDot,end)}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute2)ret.dir=\"/\";return ret}var sep=\"/\",delimiter=\":\",posix=((p)=>(p.posix=p,p))({resolve,normalize,isAbsolute,join,relative,_makeLong,dirname,basename,extname,format,parse,sep,delimiter,win32:null,posix:null});var path_default=posix;export{sep,resolve,relative,posix,parse,normalize,join,isAbsolute,format,extname,dirname,delimiter,path_default as default,basename,_makeLong};",
|
|
7
|
+
"/* 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];\nexport const isDevelopmentRuntime = () =>\n\tprocess.env[ENV_VAR] === 'development';\nexport const isProductionRuntime = () => process.env[ENV_VAR] === 'production';\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";AAAA;;;ACAA,SAAS,UAAU,CAAC,MAAK;AAAA,EAAC,IAAG,OAAO,SAAO;AAAA,IAAS,MAAM,UAAU,qCAAmC,KAAK,UA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AA;;;AE7DvC,IAAM,UAAU;AAGT,IAAM,uBAAuB,MACnC,QAAQ,IAAI,aAAa;AACnB,IAAM,sBAAsB,MAAM,QAAQ,IAAI,aAAa;",
|
|
10
|
+
"debugId": "FBC668DD8DB2CD9E64756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined")
|
|
5
|
+
return require.apply(this, arguments);
|
|
6
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export { __require };
|
|
10
|
+
|
|
11
|
+
//# debugId=0F41BDA86B94C90364756E2164756E21
|
|
12
|
+
//# sourceMappingURL=index-qxjc7kc5.js.map
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isDevelopmentRuntime,
|
|
3
|
+
isProductionRuntime,
|
|
4
|
+
resolveAngularRuntimePath
|
|
5
|
+
} from "./index-m35nbkdp.js";
|
|
6
|
+
import {
|
|
7
|
+
__require
|
|
8
|
+
} from "./index-qxjc7kc5.js";
|
|
9
|
+
|
|
10
|
+
// src/angular/angularDeps.ts
|
|
11
|
+
var initDominoAdapter = (platformServer) => {
|
|
12
|
+
try {
|
|
13
|
+
platformServer.ɵDominoAdapter?.makeCurrent?.();
|
|
14
|
+
} catch (err) {
|
|
15
|
+
console.error("Failed to initialize DominoAdapter:", err);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var loadAngularDeps = async () => {
|
|
19
|
+
if (!isProductionRuntime()) {
|
|
20
|
+
await import("@angular/compiler");
|
|
21
|
+
}
|
|
22
|
+
const { applyPatches } = await import("./angularPatch-arh4sr68.js");
|
|
23
|
+
await applyPatches();
|
|
24
|
+
const useBareSpecifiers = !isProductionRuntime();
|
|
25
|
+
const [platformBrowser, platformServer, common, core] = await Promise.all([
|
|
26
|
+
useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
27
|
+
useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
28
|
+
useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
|
|
29
|
+
useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
|
|
30
|
+
]);
|
|
31
|
+
if (!isDevelopmentRuntime()) {
|
|
32
|
+
core.enableProdMode();
|
|
33
|
+
}
|
|
34
|
+
initDominoAdapter(platformServer);
|
|
35
|
+
return {
|
|
36
|
+
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
37
|
+
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
38
|
+
Component: core.Component,
|
|
39
|
+
DomSanitizer: platformBrowser.DomSanitizer,
|
|
40
|
+
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
41
|
+
inject: core.inject,
|
|
42
|
+
InjectionToken: core.InjectionToken,
|
|
43
|
+
NgComponentOutlet: common.NgComponentOutlet,
|
|
44
|
+
provideClientHydration: platformBrowser.provideClientHydration,
|
|
45
|
+
provideServerRendering: platformServer.provideServerRendering,
|
|
46
|
+
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
47
|
+
reflectComponentType: core.reflectComponentType,
|
|
48
|
+
renderApplication: platformServer.renderApplication,
|
|
49
|
+
REQUEST: core.REQUEST,
|
|
50
|
+
REQUEST_CONTEXT: core.REQUEST_CONTEXT,
|
|
51
|
+
RESPONSE_INIT: core.RESPONSE_INIT,
|
|
52
|
+
Sanitizer: core.Sanitizer,
|
|
53
|
+
SecurityContext: core.SecurityContext,
|
|
54
|
+
withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
var angularDeps = null;
|
|
58
|
+
var getAngularDeps = () => {
|
|
59
|
+
if (!angularDeps) {
|
|
60
|
+
angularDeps = loadAngularDeps();
|
|
61
|
+
}
|
|
62
|
+
return angularDeps;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/utils/registerClientScript.ts
|
|
66
|
+
var scriptRegistry = new Map;
|
|
67
|
+
var requestCounter = 0;
|
|
68
|
+
var getRequestId = () => `req_${Date.now()}_${++requestCounter}`;
|
|
69
|
+
var ssrContextGetter = null;
|
|
70
|
+
var getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value;
|
|
71
|
+
var registerClientScript = (script, requestId) => {
|
|
72
|
+
const id = requestId || getSsrContextId() || getRequestId();
|
|
73
|
+
if (!scriptRegistry.has(id)) {
|
|
74
|
+
scriptRegistry.set(id, new Set);
|
|
75
|
+
}
|
|
76
|
+
scriptRegistry.get(id)?.add(script);
|
|
77
|
+
return id;
|
|
78
|
+
};
|
|
79
|
+
if (typeof globalThis !== "undefined") {
|
|
80
|
+
Object.assign(globalThis, { registerClientScript });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/core/browserTranslation.ts
|
|
84
|
+
var BROWSER_TRANSLATION_BASELINE_SCRIPT = "window.__ABSOLUTE_SSR_TEXT_BASELINES__=new WeakMap();" + "{const r=document.body,b=window.__ABSOLUTE_SSR_TEXT_BASELINES__;" + 'if(r)for(const e of [r,...r.querySelectorAll("*")]){' + "const t=new Map();for(const [i,n]of[...e.childNodes].entries())" + 'if(n.nodeType===3)t.set(i,n.nodeValue??"");if(t.size)b.set(e,t);}}';
|
|
85
|
+
|
|
86
|
+
// src/angular/ssrRender.ts
|
|
87
|
+
var routeContextCache = new Map;
|
|
88
|
+
var selectorCache = new Map;
|
|
89
|
+
var withSuppressedAngularDevLogs = async (render) => {
|
|
90
|
+
const origLog = console.log;
|
|
91
|
+
console.log = (...args) => {
|
|
92
|
+
if (typeof args[0] === "string" && args[0].includes("development mode")) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
origLog.apply(console, args);
|
|
96
|
+
};
|
|
97
|
+
try {
|
|
98
|
+
return await render();
|
|
99
|
+
} finally {
|
|
100
|
+
console.log = origLog;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// src/angular/islands.ts
|
|
105
|
+
var angularIslandSelector = "abs-angular-island";
|
|
106
|
+
var getAngularIslandSelector = (_islandId) => angularIslandSelector;
|
|
107
|
+
var isAngularComponent = (value) => typeof value === "function";
|
|
108
|
+
var getSelectorFromRenderedIsland = (rootElement) => {
|
|
109
|
+
const firstChild = rootElement.firstElementChild;
|
|
110
|
+
if (!(firstChild instanceof HTMLElement)) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const selector = firstChild.tagName.toLowerCase();
|
|
114
|
+
return selector.length > 0 ? selector : null;
|
|
115
|
+
};
|
|
116
|
+
var getClientAngularComponentSelector = (component) => {
|
|
117
|
+
const maybeDef = Reflect.get(component, "ɵcmp");
|
|
118
|
+
if (typeof maybeDef !== "object" || maybeDef === null) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const maybeSelectors = Reflect.get(maybeDef, "selectors");
|
|
122
|
+
if (!Array.isArray(maybeSelectors)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const [firstSelectorGroup] = maybeSelectors;
|
|
126
|
+
if (!Array.isArray(firstSelectorGroup)) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const [selector] = firstSelectorGroup;
|
|
130
|
+
return typeof selector === "string" && selector.length > 0 ? selector : null;
|
|
131
|
+
};
|
|
132
|
+
var createAngularIslandApp = async () => {
|
|
133
|
+
const { EnvironmentInjector, provideZonelessChangeDetection } = await import("@angular/core");
|
|
134
|
+
const { createApplication } = await import("@angular/platform-browser");
|
|
135
|
+
const app = await createApplication({
|
|
136
|
+
providers: [provideZonelessChangeDetection()]
|
|
137
|
+
});
|
|
138
|
+
const environmentInjector = app.injector.get(EnvironmentInjector);
|
|
139
|
+
return { app, environmentInjector };
|
|
140
|
+
};
|
|
141
|
+
var angularIslandAppPromise = null;
|
|
142
|
+
var getAngularIslandApp = async () => {
|
|
143
|
+
if (!angularIslandAppPromise) {
|
|
144
|
+
angularIslandAppPromise = createAngularIslandApp();
|
|
145
|
+
}
|
|
146
|
+
return angularIslandAppPromise;
|
|
147
|
+
};
|
|
148
|
+
var wrapperMetadataCache = new Map;
|
|
149
|
+
var requestRenderCache = new Map;
|
|
150
|
+
var getRequestRenderCache = () => {
|
|
151
|
+
const requestId = getSsrContextId();
|
|
152
|
+
if (!requestId) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const cached = requestRenderCache.get(requestId);
|
|
156
|
+
if (cached) {
|
|
157
|
+
return cached;
|
|
158
|
+
}
|
|
159
|
+
const renderCache = new Map;
|
|
160
|
+
requestRenderCache.set(requestId, renderCache);
|
|
161
|
+
return renderCache;
|
|
162
|
+
};
|
|
163
|
+
var getAngularIslandWrapperKey = (component, _islandId) => {
|
|
164
|
+
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
165
|
+
return `${componentName}:${angularIslandSelector}`;
|
|
166
|
+
};
|
|
167
|
+
var getIslandRenderCacheKey = (component, props) => {
|
|
168
|
+
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
169
|
+
return `${componentName}:${JSON.stringify(props)}`;
|
|
170
|
+
};
|
|
171
|
+
var buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
|
|
172
|
+
const deps = await getAngularDeps();
|
|
173
|
+
const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
|
|
174
|
+
const selector = getAngularIslandSelector(islandId);
|
|
175
|
+
const propsToken = new InjectionToken(`${wrapperKey}:props`);
|
|
176
|
+
|
|
177
|
+
class AngularIslandWrapperComponent {
|
|
178
|
+
constructor() {
|
|
179
|
+
this.component = component;
|
|
180
|
+
this.props = inject(propsToken);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
deps,
|
|
185
|
+
propsToken,
|
|
186
|
+
selector,
|
|
187
|
+
WrapperComponent: Component({
|
|
188
|
+
imports: [NgComponentOutlet, component],
|
|
189
|
+
selector,
|
|
190
|
+
standalone: true,
|
|
191
|
+
template: '<ng-container *ngComponentOutlet="component; inputs: props"></ng-container>'
|
|
192
|
+
})(AngularIslandWrapperComponent)
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
var createAngularIslandWrapper = async (component, islandId) => {
|
|
196
|
+
const wrapperKey = getAngularIslandWrapperKey(component, islandId);
|
|
197
|
+
const cached = wrapperMetadataCache.get(wrapperKey);
|
|
198
|
+
if (cached) {
|
|
199
|
+
return cached;
|
|
200
|
+
}
|
|
201
|
+
const metadataPromise = buildAngularIslandWrapperMetadata(component, islandId, wrapperKey);
|
|
202
|
+
wrapperMetadataCache.set(wrapperKey, metadataPromise);
|
|
203
|
+
return metadataPromise;
|
|
204
|
+
};
|
|
205
|
+
var extractAngularIslandRoot = (html, selector) => {
|
|
206
|
+
const openTag = `<${selector}`;
|
|
207
|
+
const start = html.indexOf(openTag);
|
|
208
|
+
if (start < 0) {
|
|
209
|
+
throw new Error(`Could not find Angular island root "${selector}".`);
|
|
210
|
+
}
|
|
211
|
+
const endTag = `</${selector}>`;
|
|
212
|
+
const end = html.indexOf(endTag, start);
|
|
213
|
+
if (end < 0) {
|
|
214
|
+
throw new Error(`Could not close Angular island root "${selector}".`);
|
|
215
|
+
}
|
|
216
|
+
return html.slice(start, end + endTag.length);
|
|
217
|
+
};
|
|
218
|
+
var mountAngularIsland = async (component, element, props, islandId) => {
|
|
219
|
+
await import("@angular/compiler");
|
|
220
|
+
const { createComponent, inputBinding } = await import("@angular/core");
|
|
221
|
+
const selector = getAngularIslandSelector(islandId);
|
|
222
|
+
const { app, environmentInjector } = await getAngularIslandApp();
|
|
223
|
+
let rootElement = element.querySelector(selector);
|
|
224
|
+
if (!(rootElement instanceof HTMLElement)) {
|
|
225
|
+
element.innerHTML = `<${selector}></${selector}>`;
|
|
226
|
+
rootElement = element.querySelector(selector);
|
|
227
|
+
}
|
|
228
|
+
if (!(rootElement instanceof HTMLElement))
|
|
229
|
+
return app;
|
|
230
|
+
const componentSelector = getClientAngularComponentSelector(component) ?? getSelectorFromRenderedIsland(rootElement);
|
|
231
|
+
if (!componentSelector)
|
|
232
|
+
return app;
|
|
233
|
+
rootElement.innerHTML = `<${componentSelector}></${componentSelector}>`;
|
|
234
|
+
const hostElement = rootElement.querySelector(componentSelector);
|
|
235
|
+
if (!(hostElement instanceof HTMLElement))
|
|
236
|
+
return app;
|
|
237
|
+
const bindings = Object.entries(props).map(([key, value]) => inputBinding(key, () => value));
|
|
238
|
+
const componentRef = createComponent(component, {
|
|
239
|
+
bindings,
|
|
240
|
+
environmentInjector,
|
|
241
|
+
hostElement
|
|
242
|
+
});
|
|
243
|
+
app.attachView(componentRef.hostView);
|
|
244
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
245
|
+
window.__ABS_ANGULAR_ISLAND_APPS__ ??= [];
|
|
246
|
+
window.__ABS_ANGULAR_ISLAND_APPS__.push(app);
|
|
247
|
+
return app;
|
|
248
|
+
};
|
|
249
|
+
var renderAngularIslandToHtml = async (component, props, islandId) => {
|
|
250
|
+
const requestCache = getRequestRenderCache();
|
|
251
|
+
const renderCacheKey = getIslandRenderCacheKey(component, props);
|
|
252
|
+
const cachedHtml = requestCache?.get(renderCacheKey);
|
|
253
|
+
if (cachedHtml) {
|
|
254
|
+
return cachedHtml;
|
|
255
|
+
}
|
|
256
|
+
const { deps, propsToken, selector, WrapperComponent } = await createAngularIslandWrapper(component, islandId);
|
|
257
|
+
const providers = [
|
|
258
|
+
deps.provideServerRendering(),
|
|
259
|
+
deps.provideZonelessChangeDetection(),
|
|
260
|
+
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
261
|
+
{ provide: propsToken, useValue: props }
|
|
262
|
+
];
|
|
263
|
+
const document = `<!DOCTYPE html><html><body><${selector}></${selector}></body></html>`;
|
|
264
|
+
const html = await withSuppressedAngularDevLogs(() => deps.renderApplication((context) => deps.bootstrapApplication(WrapperComponent, { providers }, context), {
|
|
265
|
+
document,
|
|
266
|
+
platformProviders: [],
|
|
267
|
+
url: "/"
|
|
268
|
+
}));
|
|
269
|
+
const islandHtml = extractAngularIslandRoot(html, selector);
|
|
270
|
+
requestCache?.set(renderCacheKey, islandHtml);
|
|
271
|
+
return islandHtml;
|
|
272
|
+
};
|
|
273
|
+
export {
|
|
274
|
+
getAngularIslandSelector,
|
|
275
|
+
isAngularComponent,
|
|
276
|
+
mountAngularIsland,
|
|
277
|
+
renderAngularIslandToHtml
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
//# debugId=7C3519B230DCC58D64756E2164756E21
|
|
281
|
+
//# sourceMappingURL=islands-xj2n8nwf.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/angular/angularDeps.ts", "../src/utils/registerClientScript.ts", "../src/core/browserTranslation.ts", "../src/angular/ssrRender.ts", "../src/angular/islands.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"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\tComponent: core.Component,\n\t\tDomSanitizer: platformBrowser.DomSanitizer,\n\t\tENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,\n\t\tinject: core.inject,\n\t\tInjectionToken: core.InjectionToken,\n\t\tNgComponentOutlet: common.NgComponentOutlet,\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",
|
|
6
|
+
"/**\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",
|
|
7
|
+
"const BASELINE_MARKER = '__ABSOLUTE_SSR_TEXT_BASELINES__';\n\n/** Inline this after SSR markup and before any client entry executes. The\n * snapshot records server-authored text while keeping it out of the DOM, so\n * browser translation remains free to edit the rendered text. */\nexport const BROWSER_TRANSLATION_BASELINE_SCRIPT =\n\t'window.__ABSOLUTE_SSR_TEXT_BASELINES__=new WeakMap();' +\n\t'{const r=document.body,b=window.__ABSOLUTE_SSR_TEXT_BASELINES__;' +\n\t'if(r)for(const e of [r,...r.querySelectorAll(\"*\")]){' +\n\t'const t=new Map();for(const [i,n]of[...e.childNodes].entries())' +\n\t'if(n.nodeType===3)t.set(i,n.nodeValue??\"\");if(t.size)b.set(e,t);}}';\n\nexport const browserTranslationBaselineTag = () =>\n\t`<script>${BROWSER_TRANSLATION_BASELINE_SCRIPT}</script>`;\n\nexport const injectBrowserTranslationBaseline = (html: string) => {\n\tif (html.includes(BASELINE_MARKER)) return html;\n\tconst script = browserTranslationBaselineTag();\n\tconst closingBodyIndex = html.lastIndexOf('</body>');\n\tif (closingBodyIndex < 0) return `${html}${script}`;\n\n\treturn `${html.slice(0, closingBodyIndex)}${script}${html.slice(closingBodyIndex)}`;\n};\n",
|
|
8
|
+
"import type { EnvironmentProviders, Provider, Type } from '@angular/core';\nimport type { BootstrapContext } from '@angular/platform-browser';\nimport type { AngularDeps, CachedRouteData } from '../../types/angular';\nimport {\n\tgetAndClearClientScripts,\n\tgenerateClientScriptCode\n} from '../utils/registerClientScript';\nimport { browserTranslationBaselineTag } from '../core/browserTranslation';\nimport { buildAbsoluteHttpTransferCacheOptions } from './httpTransferCache';\nimport { buildRequestProviders } from './requestProviders';\n\n// --- Last-used requestContext cache for HMR ---\n// Stores { requestContext, headTag } from the most recent real request per\n// route so HMR re-renders with the same data the user last saw.\n\nconst routeContextCache = new Map<string, CachedRouteData>();\n\nexport const cacheRouteData = (pagePath: string, data: CachedRouteData) => {\n\tconst cacheKey = pagePath.split('?')[0] ?? pagePath;\n\trouteContextCache.set(cacheKey, data);\n};\nexport const getCachedRouteData = (pagePath: string) =>\n\trouteContextCache.get(pagePath);\n\n// --- Selector cache ---\n\nconst selectorCache = new Map<string, string>();\nexport const buildProviders = (\n\tdeps: AngularDeps,\n\tsanitizer: InstanceType<AngularDeps['DomSanitizer']>,\n\trequest: Request | undefined,\n\trequestContext: unknown,\n\tresponseInit: ResponseInit | undefined,\n\tuserProviders: ReadonlyArray<Provider | EnvironmentProviders> = []\n) => [\n\tdeps.provideServerRendering(),\n\tdeps.provideClientHydration(\n\t\tdeps.withHttpTransferCacheOptions(\n\t\t\tbuildAbsoluteHttpTransferCacheOptions()\n\t\t)\n\t),\n\tdeps.provideZonelessChangeDetection(),\n\t{ provide: deps.APP_BASE_HREF, useValue: '/' },\n\t{ provide: deps.DomSanitizer, useValue: sanitizer },\n\t{ provide: deps.Sanitizer, useValue: sanitizer },\n\t...buildRequestProviders(deps, request, requestContext, responseInit),\n\t...userProviders\n];\nexport const clearSelectorCache = () => selectorCache.clear();\n\nexport const resolveSelector = (\n\tdeps: AngularDeps,\n\tpagePath: string,\n\tPageComponent: Type<unknown>\n) => {\n\tconst cached = selectorCache.get(pagePath);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\n\tconst selector =\n\t\tdeps.reflectComponentType(PageComponent)?.selector ?? 'ng-app';\n\tselectorCache.set(pagePath, selector);\n\n\treturn selector;\n};\n\n// --- Inject HTML helper ---\n\nconst injectBeforeClose = (html: string, snippet: string) => {\n\tif (html.includes('</body>')) {\n\t\treturn html.replace('</body>', `${snippet}</body>`);\n\t}\n\tif (html.includes('</html>')) {\n\t\treturn html.replace('</html>', `${snippet}</html>`);\n\t}\n\n\treturn html + snippet;\n};\n\n// --- Post-render HTML injection ---\n\nexport const injectSsrScripts = (\n\thtml: string,\n\trequestId: string,\n\tindexPath: string,\n\trequestContext?: unknown\n) => {\n\tlet result = injectBeforeClose(html, browserTranslationBaselineTag());\n\n\tconst registeredScripts = getAndClearClientScripts(requestId);\n\tif (registeredScripts.length > 0) {\n\t\tresult = injectBeforeClose(\n\t\t\tresult,\n\t\t\tgenerateClientScriptCode(registeredScripts)\n\t\t);\n\t}\n\n\tif (requestContext !== undefined) {\n\t\tresult = injectBeforeClose(\n\t\t\tresult,\n\t\t\t`<script>window.__ABS_ANGULAR_REQUEST_CONTEXT__ = ${JSON.stringify(requestContext)};</script>`\n\t\t);\n\t}\n\n\tif (indexPath) {\n\t\tconst escapedIndexPath = JSON.stringify(indexPath);\n\t\tresult = injectBeforeClose(\n\t\t\tresult,\n\t\t\t`<script>import(${escapedIndexPath});</script>`\n\t\t);\n\t}\n\n\treturn result;\n};\nexport const renderAngularApp = async (\n\tdeps: AngularDeps,\n\tPageComponent: Type<unknown>,\n\tproviders: (Provider | EnvironmentProviders)[],\n\tdocument: string | Document,\n\turl: string = '/'\n) => {\n\tconst bootstrap = (context: BootstrapContext) =>\n\t\tdeps.bootstrapApplication(PageComponent, { providers }, context);\n\n\treturn withSuppressedAngularDevLogs(() =>\n\t\tdeps.renderApplication(bootstrap, {\n\t\t\tdocument,\n\t\t\tplatformProviders: [],\n\t\t\turl\n\t\t})\n\t);\n};\nexport const withSuppressedAngularDevLogs = async <T>(\n\trender: () => Promise<T>\n) => {\n\tconst origLog = console.log;\n\tconsole.log = (...args: unknown[]) => {\n\t\tif (\n\t\t\ttypeof args[0] === 'string' &&\n\t\t\targs[0].includes('development mode')\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\torigLog.apply(console, args);\n\t};\n\n\ttry {\n\t\treturn await render();\n\t} finally {\n\t\tconsole.log = origLog;\n\t}\n};\n",
|
|
9
|
+
"import { getAngularDeps } from './angularDeps';\nimport { withSuppressedAngularDevLogs } from './ssrRender';\nimport { getSsrContextId } from '../utils/registerClientScript';\n\nconst angularIslandSelector = 'abs-angular-island';\n\nexport const getAngularIslandSelector = (_islandId: string) =>\n\tangularIslandSelector;\nexport const isAngularComponent = (\n\tvalue: unknown\n): value is import('@angular/core').Type<object> => typeof value === 'function';\n\nconst getSelectorFromRenderedIsland = (rootElement: HTMLElement) => {\n\tconst firstChild = rootElement.firstElementChild;\n\tif (!(firstChild instanceof HTMLElement)) {\n\t\treturn null;\n\t}\n\n\tconst selector = firstChild.tagName.toLowerCase();\n\n\treturn selector.length > 0 ? selector : null;\n};\n\nconst getClientAngularComponentSelector = (\n\tcomponent: import('@angular/core').Type<object>\n) => {\n\tconst maybeDef = Reflect.get(component, 'ɵcmp');\n\tif (typeof maybeDef !== 'object' || maybeDef === null) {\n\t\treturn null;\n\t}\n\n\tconst maybeSelectors = Reflect.get(maybeDef, 'selectors');\n\tif (!Array.isArray(maybeSelectors)) {\n\t\treturn null;\n\t}\n\n\tconst [firstSelectorGroup] = maybeSelectors;\n\tif (!Array.isArray(firstSelectorGroup)) {\n\t\treturn null;\n\t}\n\n\tconst [selector] = firstSelectorGroup;\n\n\treturn typeof selector === 'string' && selector.length > 0\n\t\t? selector\n\t\t: null;\n};\n\nconst createAngularIslandApp = async () => {\n\tconst { EnvironmentInjector, provideZonelessChangeDetection } =\n\t\tawait import('@angular/core');\n\tconst { createApplication } = await import('@angular/platform-browser');\n\tconst app = await createApplication({\n\t\tproviders: [provideZonelessChangeDetection()]\n\t});\n\tconst environmentInjector = app.injector.get(EnvironmentInjector);\n\n\treturn { app, environmentInjector };\n};\n\nlet angularIslandAppPromise: Promise<{\n\tapp: import('@angular/core').ApplicationRef;\n\tenvironmentInjector: import('@angular/core').EnvironmentInjector;\n}> | null = null;\n\nconst getAngularIslandApp = async () => {\n\tif (!angularIslandAppPromise) {\n\t\tangularIslandAppPromise = createAngularIslandApp();\n\t}\n\n\treturn angularIslandAppPromise;\n};\n\ntype AngularIslandWrapperMetadata = {\n\tdeps: Awaited<ReturnType<typeof getAngularDeps>>;\n\tpropsToken: import('@angular/core').InjectionToken<Record<string, unknown>>;\n\tselector: string;\n\tWrapperComponent: import('@angular/core').Type<object>;\n};\n\nconst wrapperMetadataCache = new Map<\n\tstring,\n\tPromise<AngularIslandWrapperMetadata>\n>();\nconst requestRenderCache = new Map<string, Map<string, string>>();\n\nconst getRequestRenderCache = () => {\n\tconst requestId = getSsrContextId();\n\tif (!requestId) {\n\t\treturn null;\n\t}\n\n\tconst cached = requestRenderCache.get(requestId);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\n\tconst renderCache = new Map<string, string>();\n\trequestRenderCache.set(requestId, renderCache);\n\n\treturn renderCache;\n};\n\nconst getAngularIslandWrapperKey = (\n\tcomponent: import('@angular/core').Type<object>,\n\t_islandId: string\n) => {\n\tconst componentName =\n\t\ttypeof component.name === 'string' && component.name.length > 0\n\t\t\t? component.name\n\t\t\t: 'AngularIsland';\n\n\treturn `${componentName}:${angularIslandSelector}`;\n};\n\nconst getIslandRenderCacheKey = (\n\tcomponent: import('@angular/core').Type<object>,\n\tprops: Record<string, unknown>\n) => {\n\tconst componentName =\n\t\ttypeof component.name === 'string' && component.name.length > 0\n\t\t\t? component.name\n\t\t\t: 'AngularIsland';\n\n\treturn `${componentName}:${JSON.stringify(props)}`;\n};\n\nconst buildAngularIslandWrapperMetadata = async (\n\tcomponent: import('@angular/core').Type<object>,\n\tislandId: string,\n\twrapperKey: string\n) => {\n\t// Resolve Angular through getAngularDeps so the wrapper is built with the\n\t// SAME Angular instance that renders it. In production server-side imports\n\t// point at the pre-linked Angular vendor bundle; bare `@angular/*` imports\n\t// here would instead resolve to node_modules, giving the wrapper component\n\t// (its decorator, InjectionToken and inject) a different Angular instance\n\t// than the render pipeline's injector — every cross-instance token lookup\n\t// then fails with NG0201. (Dev uses a single node_modules Angular, so this\n\t// only manifests in production.)\n\tconst deps = await getAngularDeps();\n\tconst { Component, InjectionToken, NgComponentOutlet, inject } = deps;\n\tconst selector = getAngularIslandSelector(islandId);\n\tconst propsToken = new InjectionToken<Record<string, unknown>>(\n\t\t`${wrapperKey}:props`\n\t);\n\n\tclass AngularIslandWrapperComponent {\n\t\tcomponent = component;\n\t\tprops = inject(propsToken);\n\t}\n\n\treturn {\n\t\tdeps,\n\t\tpropsToken,\n\t\tselector,\n\t\tWrapperComponent: Component({\n\t\t\timports: [NgComponentOutlet, component],\n\t\t\tselector,\n\t\t\tstandalone: true,\n\t\t\ttemplate:\n\t\t\t\t'<ng-container *ngComponentOutlet=\"component; inputs: props\"></ng-container>'\n\t\t})(AngularIslandWrapperComponent)\n\t};\n};\n\nconst createAngularIslandWrapper = async (\n\tcomponent: import('@angular/core').Type<object>,\n\tislandId: string\n) => {\n\tconst wrapperKey = getAngularIslandWrapperKey(component, islandId);\n\tconst cached = wrapperMetadataCache.get(wrapperKey);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\n\tconst metadataPromise = buildAngularIslandWrapperMetadata(\n\t\tcomponent,\n\t\tislandId,\n\t\twrapperKey\n\t);\n\n\twrapperMetadataCache.set(wrapperKey, metadataPromise);\n\n\treturn metadataPromise;\n};\n\nconst extractAngularIslandRoot = (html: string, selector: string) => {\n\tconst openTag = `<${selector}`;\n\tconst start = html.indexOf(openTag);\n\tif (start < 0) {\n\t\tthrow new Error(`Could not find Angular island root \"${selector}\".`);\n\t}\n\n\tconst endTag = `</${selector}>`;\n\tconst end = html.indexOf(endTag, start);\n\tif (end < 0) {\n\t\tthrow new Error(`Could not close Angular island root \"${selector}\".`);\n\t}\n\n\treturn html.slice(start, end + endTag.length);\n};\n\nexport const mountAngularIsland = async <Props extends Record<string, unknown>>(\n\tcomponent: import('@angular/core').Type<object>,\n\telement: HTMLElement,\n\tprops: Props,\n\tislandId: string\n) => {\n\tawait import('@angular/compiler');\n\tconst { createComponent, inputBinding } = await import('@angular/core');\n\tconst selector = getAngularIslandSelector(islandId);\n\tconst { app, environmentInjector } = await getAngularIslandApp();\n\n\tlet rootElement = element.querySelector(selector);\n\tif (!(rootElement instanceof HTMLElement)) {\n\t\telement.innerHTML = `<${selector}></${selector}>`;\n\t\trootElement = element.querySelector(selector);\n\t}\n\tif (!(rootElement instanceof HTMLElement)) return app;\n\n\tconst componentSelector =\n\t\tgetClientAngularComponentSelector(component) ??\n\t\tgetSelectorFromRenderedIsland(rootElement);\n\tif (!componentSelector) return app;\n\n\trootElement.innerHTML = `<${componentSelector}></${componentSelector}>`;\n\tconst hostElement = rootElement.querySelector(componentSelector);\n\tif (!(hostElement instanceof HTMLElement)) return app;\n\n\tconst bindings = Object.entries(props).map(([key, value]) =>\n\t\tinputBinding(key, () => value)\n\t);\n\tconst componentRef = createComponent(component, {\n\t\tbindings,\n\t\tenvironmentInjector,\n\t\thostElement\n\t});\n\tapp.attachView(componentRef.hostView);\n\tcomponentRef.changeDetectorRef.detectChanges();\n\twindow.__ABS_ANGULAR_ISLAND_APPS__ ??= [];\n\twindow.__ABS_ANGULAR_ISLAND_APPS__.push(app);\n\n\treturn app;\n};\nexport const renderAngularIslandToHtml = async <\n\tProps extends Record<string, unknown>\n>(\n\tcomponent: import('@angular/core').Type<object>,\n\tprops: Props,\n\tislandId: string\n) => {\n\tconst requestCache = getRequestRenderCache();\n\tconst renderCacheKey = getIslandRenderCacheKey(component, props);\n\tconst cachedHtml = requestCache?.get(renderCacheKey);\n\tif (cachedHtml) {\n\t\treturn cachedHtml;\n\t}\n\n\tconst { deps, propsToken, selector, WrapperComponent } =\n\t\tawait createAngularIslandWrapper(component, islandId);\n\n\tconst providers: (\n\t\t| import('@angular/core').Provider\n\t\t| import('@angular/core').EnvironmentProviders\n\t)[] = [\n\t\tdeps.provideServerRendering(),\n\t\tdeps.provideZonelessChangeDetection(),\n\t\t{ provide: deps.APP_BASE_HREF, useValue: '/' },\n\t\t{ provide: propsToken, useValue: props }\n\t];\n\tconst document = `<!DOCTYPE html><html><body><${selector}></${selector}></body></html>`;\n\tconst html = await withSuppressedAngularDevLogs(() =>\n\t\tdeps.renderApplication(\n\t\t\t(context) =>\n\t\t\t\tdeps.bootstrapApplication(\n\t\t\t\t\tWrapperComponent,\n\t\t\t\t\t{ providers },\n\t\t\t\t\tcontext\n\t\t\t\t),\n\t\t\t{\n\t\t\t\tdocument,\n\t\t\t\tplatformProviders: [],\n\t\t\t\turl: '/'\n\t\t\t}\n\t\t)\n\t);\n\tconst islandHtml = extractAngularIslandRoot(html, selector);\n\trequestCache?.set(renderCacheKey, islandHtml);\n\n\treturn islandHtml;\n};\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;;;;;;;;;AAOA,IAAM,oBAAoB,CAAC,mBAErB;AAAA,EACL,IAA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AO;AAAA;",
|
|
12
|
+
"debugId": "7C3519B230DCC58D64756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
prepareBrowserTranslationHydration
|
|
3
|
+
} from "./index-5py90ctf.js";
|
|
4
|
+
import"./index-qxjc7kc5.js";
|
|
5
|
+
|
|
6
|
+
// src/client/hydrators/react.ts
|
|
7
|
+
import { createElement } from "react";
|
|
8
|
+
import { hydrateRoot } from "react-dom/client";
|
|
9
|
+
import { flushSync } from "react-dom";
|
|
10
|
+
var reactIslandRoots = new WeakMap;
|
|
11
|
+
var isPropsRecord = (value) => typeof value === "object" && value !== null;
|
|
12
|
+
var HOST_REACT_EXPANDO_PREFIXES = [
|
|
13
|
+
"__reactFiber$",
|
|
14
|
+
"__reactProps$",
|
|
15
|
+
"__reactContainer$",
|
|
16
|
+
"__reactEvents$",
|
|
17
|
+
"__reactListeners$",
|
|
18
|
+
"__reactHandles$"
|
|
19
|
+
];
|
|
20
|
+
var detachFromHostReactRoot = (element) => {
|
|
21
|
+
for (const key of Object.keys(element)) {
|
|
22
|
+
const isHostExpando = HOST_REACT_EXPANDO_PREFIXES.some((prefix) => key.startsWith(prefix));
|
|
23
|
+
if (!isHostExpando)
|
|
24
|
+
continue;
|
|
25
|
+
Reflect.deleteProperty(element, key);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var hydrateReactIsland = (component, element, props) => {
|
|
29
|
+
const existingRoot = reactIslandRoots.get(element);
|
|
30
|
+
if (existingRoot) {
|
|
31
|
+
existingRoot.render(isPropsRecord(props) ? createElement(component, props) : createElement(component));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
detachFromHostReactRoot(element);
|
|
35
|
+
const restoreTranslation = prepareBrowserTranslationHydration(element);
|
|
36
|
+
const hydrate = (elementToHydrate) => {
|
|
37
|
+
let root;
|
|
38
|
+
const startHydration = () => {
|
|
39
|
+
root = hydrateRoot(element, elementToHydrate);
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
if (restoreTranslation.hasTranslation)
|
|
43
|
+
flushSync(startHydration);
|
|
44
|
+
else
|
|
45
|
+
startHydration();
|
|
46
|
+
} finally {
|
|
47
|
+
restoreTranslation();
|
|
48
|
+
}
|
|
49
|
+
if (root !== undefined)
|
|
50
|
+
reactIslandRoots.set(element, root);
|
|
51
|
+
};
|
|
52
|
+
if (!isPropsRecord(props)) {
|
|
53
|
+
hydrate(createElement(component));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
hydrate(createElement(component, props));
|
|
57
|
+
};
|
|
58
|
+
var isReactComponent = (value) => typeof value === "function";
|
|
59
|
+
export {
|
|
60
|
+
hydrateReactIsland,
|
|
61
|
+
isReactComponent
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//# debugId=510C9829CFC48A1664756E2164756E21
|
|
65
|
+
//# sourceMappingURL=react-pdg4325x.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/client/hydrators/react.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { type ComponentType, createElement, type ReactNode } from 'react';\nimport { hydrateRoot, type Root as ReactRoot } from 'react-dom/client';\nimport { flushSync } from 'react-dom';\nimport { prepareBrowserTranslationHydration } from '../browserTranslation';\n\nconst reactIslandRoots = new WeakMap<HTMLElement, ReactRoot>();\n\nconst isPropsRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\n// The island marker is rendered by the host page's React tree as a\n// `dangerouslySetInnerHTML` boundary, so the host root tags it with internal\n// fiber expandos (`__reactFiber$…`, `__reactProps$…`). React refuses to create\n// a second root on a node it already manages that also sets\n// dangerouslySetInnerHTML (\"Cannot use a ref … as a container … if that element\n// also sets dangerouslySetInnerHTML\"). Detaching those expandos hands ownership\n// of the marker (and its opaque SSR children) to the island root before it\n// hydrates. The host root never recurses into the boundary, so it has no fibers\n// for the children and won't reconcile this subtree again.\nconst HOST_REACT_EXPANDO_PREFIXES = [\n\t'__reactFiber$',\n\t'__reactProps$',\n\t'__reactContainer$',\n\t'__reactEvents$',\n\t'__reactListeners$',\n\t'__reactHandles$'\n];\n\nconst detachFromHostReactRoot = (element: HTMLElement) => {\n\tfor (const key of Object.keys(element)) {\n\t\tconst isHostExpando = HOST_REACT_EXPANDO_PREFIXES.some((prefix) =>\n\t\t\tkey.startsWith(prefix)\n\t\t);\n\t\tif (!isHostExpando) continue;\n\t\tReflect.deleteProperty(element, key);\n\t}\n};\n\nexport const hydrateReactIsland = (\n\tcomponent: ComponentType<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\tconst existingRoot = reactIslandRoots.get(element);\n\tif (existingRoot) {\n\t\texistingRoot.render(\n\t\t\tisPropsRecord(props)\n\t\t\t\t? createElement(component, props)\n\t\t\t\t: createElement(component)\n\t\t);\n\n\t\treturn;\n\t}\n\n\tdetachFromHostReactRoot(element);\n\tconst restoreTranslation = prepareBrowserTranslationHydration(element);\n\tconst hydrate = (elementToHydrate: ReactNode) => {\n\t\tlet root: ReactRoot | undefined;\n\t\tconst startHydration = () => {\n\t\t\troot = hydrateRoot(element, elementToHydrate);\n\t\t};\n\t\ttry {\n\t\t\tif (restoreTranslation.hasTranslation) flushSync(startHydration);\n\t\t\telse startHydration();\n\t\t} finally {\n\t\t\trestoreTranslation();\n\t\t}\n\t\tif (root !== undefined) reactIslandRoots.set(element, root);\n\t};\n\n\tif (!isPropsRecord(props)) {\n\t\thydrate(createElement(component));\n\n\t\treturn;\n\t}\n\n\thydrate(createElement(component, props));\n};\nexport const isReactComponent = (\n\tvalue: unknown\n): value is ComponentType<Record<string, unknown>> =>\n\ttypeof value === 'function';\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;AAAA;AACA;AACA;AAGA,IAAM,mBAAmB,IAAI;AAE7B,IAAM,gBAAgB,C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FC48A1664756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import"./index-qxjc7kc5.js";
|
|
2
|
+
|
|
3
|
+
// src/client/hydrators/svelte.ts
|
|
4
|
+
import { hydrate as hydrateSvelte } from "svelte";
|
|
5
|
+
var isPropsRecord = (value) => typeof value === "object" && value !== null;
|
|
6
|
+
var hydrateSvelteIsland = (component, element, props) => {
|
|
7
|
+
hydrateSvelte(component, {
|
|
8
|
+
props: isPropsRecord(props) ? props : undefined,
|
|
9
|
+
target: element
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var isSvelteComponent = (value) => typeof value === "function";
|
|
13
|
+
export {
|
|
14
|
+
hydrateSvelteIsland,
|
|
15
|
+
isSvelteComponent
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//# debugId=69B52FC4F40D423C64756E2164756E21
|
|
19
|
+
//# sourceMappingURL=svelte-s0c964kb.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/client/hydrators/svelte.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { hydrate as hydrateSvelte } from 'svelte';\n\nconst isPropsRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const hydrateSvelteIsland = (\n\tcomponent: import('svelte').Component<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\thydrateSvelte(component, {\n\t\tprops: isPropsRecord(props) ? props : undefined,\n\t\ttarget: element\n\t});\n};\nexport const isSvelteComponent = (\n\tvalue: unknown\n): value is import('svelte').Component<Record<string, unknown>> =>\n\ttypeof value === 'function';\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;AAAA,oBAAS;AAET,IAAM,gBAAgB,CAAC,UACtB,OAAO,UAAU,YAAY,UAAU;AAEjC,IAAM,sBAAsB,CAClC,WACA,SACA,UACI;AAAA,EACJ,cAAc,WAAW;AAAA,IACxB,OAAO,cAAc,KAAK,IAAI,QAAQ;AAAA,IACtC,QAAQ;AAAA,EACT,CAAC;AAAA;AAEK,IAAM,oBAAoB,CAChC,UAEA,OAAO,UAAU;",
|
|
8
|
+
"debugId": "69B52FC4F40D423C64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import"./index-qxjc7kc5.js";
|
|
2
|
+
|
|
3
|
+
// src/client/hydrators/vue.ts
|
|
4
|
+
import { createSSRApp, h } from "vue";
|
|
5
|
+
var vueIslandApps = new WeakMap;
|
|
6
|
+
var isPropsRecord = (value) => typeof value === "object" && value !== null;
|
|
7
|
+
var hydrateVueIsland = (component, element, props) => {
|
|
8
|
+
if (vueIslandApps.has(element)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const app = createSSRApp({
|
|
12
|
+
render: () => h(component, isPropsRecord(props) ? props : undefined)
|
|
13
|
+
});
|
|
14
|
+
app.mount(element);
|
|
15
|
+
vueIslandApps.set(element, app);
|
|
16
|
+
};
|
|
17
|
+
var isVueComponent = (value) => typeof value === "function" || isPropsRecord(value);
|
|
18
|
+
export {
|
|
19
|
+
hydrateVueIsland,
|
|
20
|
+
isVueComponent
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# debugId=C2D823098117309864756E2164756E21
|
|
24
|
+
//# sourceMappingURL=vue-rdskrnyg.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/client/hydrators/vue.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { createSSRApp, h, type App as VueApp } from 'vue';\n\nconst vueIslandApps = new WeakMap<HTMLElement, VueApp>();\n\nconst isPropsRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const hydrateVueIsland = (\n\tcomponent: import('vue').Component<Record<string, unknown>>,\n\telement: HTMLElement,\n\tprops: unknown\n) => {\n\tif (vueIslandApps.has(element)) {\n\t\treturn;\n\t}\n\n\tconst app = createSSRApp({\n\t\trender: () => h(component, isPropsRecord(props) ? props : undefined)\n\t});\n\tapp.mount(element);\n\tvueIslandApps.set(element, app);\n};\nexport const isVueComponent = (\n\tvalue: unknown\n): value is import('vue').Component<Record<string, unknown>> =>\n\ttypeof value === 'function' || isPropsRecord(value);\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;AAAA;AAEA,IAAM,gBAAgB,IAAI;AAE1B,IAAM,gBAAgB,CAAC,UACtB,OAAO,UAAU,YAAY,UAAU;AAEjC,IAAM,mBAAmB,CAC/B,WACA,SACA,UACI;AAAA,EACJ,IAAI,cAAc,IAAI,OAAO,GAAG;AAAA,IAC/B;AAAA,EACD;AAAA,EAEA,MAAM,MAAM,aAAa;AAAA,IACxB,QAAQ,MAAM,EAAE,WAAW,cAAc,KAAK,IAAI,QAAQ,SAAS;AAAA,EACpE,CAAC;AAAA,EACD,IAAI,MAAM,OAAO;AAAA,EACjB,cAAc,IAAI,SAAS,GAAG;AAAA;AAExB,IAAM,iBAAiB,CAC7B,UAEA,OAAO,UAAU,cAAc,cAAc,KAAK;",
|
|
8
|
+
"debugId": "C2D823098117309864756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|