@absolutejs/absolute 0.19.0-beta.782 → 0.19.0-beta.784
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 +57 -9801
- package/dist/angular/browser.js.map +4 -246
- package/dist/angular/index.js +61 -14880
- package/dist/angular/index.js.map +4 -282
- package/dist/angular/server.js +46 -5613
- package/dist/angular/server.js.map +3 -52
- package/dist/build.js +45 -17902
- package/dist/build.js.map +3 -100
- package/dist/chunk-102fp7xe.js +63 -0
- package/dist/chunk-102fp7xe.js.map +10 -0
- package/dist/chunk-11zpfqz6.js +19 -0
- package/dist/chunk-11zpfqz6.js.map +10 -0
- package/dist/chunk-1e9vsfyh.js +100 -0
- package/dist/chunk-1e9vsfyh.js.map +10 -0
- package/dist/chunk-25v9t56f.js +29 -0
- package/dist/chunk-25v9t56f.js.map +11 -0
- package/dist/chunk-2f21eenc.js +21 -0
- package/dist/chunk-2f21eenc.js.map +10 -0
- package/dist/chunk-2ga2znex.js +13 -0
- package/dist/chunk-2ga2znex.js.map +9 -0
- package/dist/chunk-30yrw0f6.js +33 -0
- package/dist/chunk-30yrw0f6.js.map +10 -0
- package/dist/chunk-3c7mpj3m.js +784 -0
- package/dist/chunk-3c7mpj3m.js.map +10 -0
- package/dist/chunk-3g91wb4f.js +358 -0
- package/dist/chunk-3g91wb4f.js.map +10 -0
- package/dist/chunk-3yjzpcne.js +34 -0
- package/dist/chunk-3yjzpcne.js.map +10 -0
- package/dist/chunk-4bq79t8v.js +136 -0
- package/dist/chunk-4bq79t8v.js.map +10 -0
- package/dist/chunk-4d39r92n.js +81 -0
- package/dist/chunk-4d39r92n.js.map +10 -0
- package/dist/chunk-4m75s5xf.js +184 -0
- package/dist/chunk-4m75s5xf.js.map +11 -0
- package/dist/chunk-5003emhv.js +17 -0
- package/dist/chunk-5003emhv.js.map +10 -0
- package/dist/chunk-5fhp1jap.js +9169 -0
- package/dist/chunk-5fhp1jap.js.map +236 -0
- package/dist/chunk-6fkgm9s5.js +569 -0
- package/dist/chunk-6fkgm9s5.js.map +10 -0
- package/dist/chunk-6pdj08z3.js +73 -0
- package/dist/chunk-6pdj08z3.js.map +12 -0
- package/dist/chunk-6qjbrt0k.js +13 -0
- package/dist/chunk-6qjbrt0k.js.map +9 -0
- package/dist/chunk-6sccb4jr.js +14 -0
- package/dist/chunk-6sccb4jr.js.map +9 -0
- package/dist/chunk-73brtyw5.js +16 -0
- package/dist/chunk-73brtyw5.js.map +9 -0
- package/dist/chunk-77cqkarb.js +25 -0
- package/dist/chunk-77cqkarb.js.map +9 -0
- package/dist/chunk-798spvzv.js +50 -0
- package/dist/chunk-798spvzv.js.map +10 -0
- package/dist/chunk-7fw6x3js.js +131 -0
- package/dist/chunk-7fw6x3js.js.map +11 -0
- package/dist/chunk-7kjj42xm.js +11 -0
- package/dist/chunk-7kjj42xm.js.map +10 -0
- package/dist/chunk-851whwc7.js +17 -0
- package/dist/chunk-851whwc7.js.map +10 -0
- package/dist/chunk-85n68sy6.js +103 -0
- package/dist/chunk-85n68sy6.js.map +10 -0
- package/dist/chunk-8feq2qek.js +17 -0
- package/dist/chunk-8feq2qek.js.map +9 -0
- package/dist/chunk-8kcfffry.js +35 -0
- package/dist/chunk-8kcfffry.js.map +10 -0
- package/dist/chunk-93sqk7be.js +139 -0
- package/dist/chunk-93sqk7be.js.map +12 -0
- package/dist/chunk-97572s32.js +262 -0
- package/dist/chunk-97572s32.js.map +12 -0
- package/dist/chunk-9a307ca6.js +1742 -0
- package/dist/chunk-9a307ca6.js.map +11 -0
- package/dist/chunk-9c5tj4k3.js +130 -0
- package/dist/chunk-9c5tj4k3.js.map +10 -0
- package/dist/chunk-9xrsjeem.js +12 -0
- package/dist/chunk-9xrsjeem.js.map +9 -0
- package/dist/chunk-a9mvyp04.js +87 -0
- package/dist/chunk-a9mvyp04.js.map +10 -0
- package/dist/chunk-b3gbnrwe.js +21 -0
- package/dist/chunk-b3gbnrwe.js.map +10 -0
- package/dist/chunk-bmgqm774.js +65 -0
- package/dist/chunk-bmgqm774.js.map +9 -0
- package/dist/chunk-bxfghpma.js +69 -0
- package/dist/chunk-bxfghpma.js.map +10 -0
- package/dist/chunk-c1jfjnka.js +74 -0
- package/dist/chunk-c1jfjnka.js.map +10 -0
- package/dist/chunk-cbkrwmvh.js +80 -0
- package/dist/chunk-cbkrwmvh.js.map +10 -0
- package/dist/chunk-cdxd7sy2.js +71 -0
- package/dist/chunk-cdxd7sy2.js.map +10 -0
- package/dist/chunk-cg95827x.js +21 -0
- package/dist/chunk-cg95827x.js.map +10 -0
- package/dist/chunk-d9c0am65.js +12 -0
- package/dist/chunk-d9c0am65.js.map +10 -0
- package/dist/chunk-daqghmg8.js +12 -0
- package/dist/chunk-daqghmg8.js.map +9 -0
- package/dist/chunk-dr9yqsdb.js +203 -0
- package/dist/chunk-dr9yqsdb.js.map +10 -0
- package/dist/chunk-e8eecyrq.js +244 -0
- package/dist/chunk-e8eecyrq.js.map +10 -0
- package/dist/chunk-ex2hxe0v.js +160 -0
- package/dist/chunk-ex2hxe0v.js.map +11 -0
- package/dist/chunk-ey5hs6x6.js +253 -0
- package/dist/chunk-ey5hs6x6.js.map +11 -0
- package/dist/chunk-fak944et.js +91 -0
- package/dist/chunk-fak944et.js.map +10 -0
- package/dist/chunk-fygx2ymm.js +118 -0
- package/dist/chunk-fygx2ymm.js.map +12 -0
- package/dist/chunk-g15qj669.js +271 -0
- package/dist/chunk-g15qj669.js.map +11 -0
- package/dist/chunk-g3j22qf6.js +51 -0
- package/dist/chunk-g3j22qf6.js.map +9 -0
- package/dist/chunk-gd6wmknh.js +121 -0
- package/dist/chunk-gd6wmknh.js.map +11 -0
- package/dist/chunk-gf0ygptk.js +85 -0
- package/dist/chunk-gf0ygptk.js.map +11 -0
- package/dist/chunk-gq0zxpm0.js +90 -0
- package/dist/chunk-gq0zxpm0.js.map +10 -0
- package/dist/chunk-gytkmthr.js +220 -0
- package/dist/chunk-gytkmthr.js.map +10 -0
- package/dist/chunk-h5bbfn3n.js +28 -0
- package/dist/chunk-h5bbfn3n.js.map +11 -0
- package/dist/chunk-h6mye9r3.js +93 -0
- package/dist/chunk-h6mye9r3.js.map +10 -0
- package/dist/chunk-hcsmxw1v.js +85 -0
- package/dist/chunk-hcsmxw1v.js.map +10 -0
- package/dist/chunk-hep68ja7.js +4444 -0
- package/dist/chunk-hep68ja7.js.map +29 -0
- package/dist/chunk-hhqh49fz.js +149 -0
- package/dist/chunk-hhqh49fz.js.map +10 -0
- package/dist/chunk-hyjs4bqs.js +8 -0
- package/dist/chunk-hyjs4bqs.js.map +10 -0
- package/dist/chunk-hza0n8qm.js +20 -0
- package/dist/chunk-hza0n8qm.js.map +9 -0
- package/dist/chunk-jn91vzkh.js +66 -0
- package/dist/chunk-jn91vzkh.js.map +10 -0
- package/dist/chunk-jwxt8gnp.js +13 -0
- package/dist/chunk-jwxt8gnp.js.map +9 -0
- package/dist/chunk-kk8w9rh5.js +195 -0
- package/dist/chunk-kk8w9rh5.js.map +10 -0
- package/dist/chunk-kndkjsya.js +261 -0
- package/dist/chunk-kndkjsya.js.map +10 -0
- package/dist/chunk-kvq01j35.js +36 -0
- package/dist/chunk-kvq01j35.js.map +10 -0
- package/dist/chunk-mbazhahf.js +60 -0
- package/dist/chunk-mbazhahf.js.map +10 -0
- package/dist/chunk-mgfwq18r.js +15 -0
- package/dist/chunk-mgfwq18r.js.map +9 -0
- package/dist/chunk-mtgf69xn.js +88 -0
- package/dist/chunk-mtgf69xn.js.map +10 -0
- package/dist/chunk-nehhtthw.js +225 -0
- package/dist/chunk-nehhtthw.js.map +10 -0
- package/dist/chunk-nhzf4az4.js +149 -0
- package/dist/chunk-nhzf4az4.js.map +10 -0
- package/dist/chunk-p5504p14.js +16 -0
- package/dist/chunk-p5504p14.js.map +10 -0
- package/dist/chunk-pnscgw95.js +90 -0
- package/dist/chunk-pnscgw95.js.map +10 -0
- package/dist/chunk-pvpp4pvs.js +17 -0
- package/dist/chunk-pvpp4pvs.js.map +10 -0
- package/dist/chunk-qh75agse.js +95 -0
- package/dist/chunk-qh75agse.js.map +10 -0
- package/dist/chunk-qk8kd3hr.js +526 -0
- package/dist/chunk-qk8kd3hr.js.map +12 -0
- package/dist/chunk-qxq2zcty.js +52 -0
- package/dist/chunk-qxq2zcty.js.map +10 -0
- package/dist/chunk-r7jmgqnw.js +114 -0
- package/dist/chunk-r7jmgqnw.js.map +10 -0
- package/dist/chunk-s6defjk2.js +116 -0
- package/dist/chunk-s6defjk2.js.map +10 -0
- package/dist/chunk-sd39p726.js +619 -0
- package/dist/chunk-sd39p726.js.map +10 -0
- package/dist/chunk-smgj0epn.js +18 -0
- package/dist/chunk-smgj0epn.js.map +9 -0
- package/dist/chunk-swrnzs4c.js +63 -0
- package/dist/chunk-swrnzs4c.js.map +10 -0
- package/dist/chunk-t81a331y.js +27 -0
- package/dist/chunk-t81a331y.js.map +10 -0
- package/dist/chunk-tfe3sb44.js +33 -0
- package/dist/chunk-tfe3sb44.js.map +10 -0
- package/dist/chunk-tx9edm1x.js +34 -0
- package/dist/chunk-tx9edm1x.js.map +10 -0
- package/dist/chunk-vkrpm7kc.js +247 -0
- package/dist/chunk-vkrpm7kc.js.map +12 -0
- package/dist/chunk-vvz7dcvq.js +434 -0
- package/dist/chunk-vvz7dcvq.js.map +13 -0
- package/dist/chunk-w3m4m5we.js +4925 -0
- package/dist/chunk-w3m4m5we.js.map +12 -0
- package/dist/chunk-wrxtn9ve.js +18 -0
- package/dist/chunk-wrxtn9ve.js.map +10 -0
- package/dist/chunk-xpkjbmd3.js +428 -0
- package/dist/chunk-xpkjbmd3.js.map +14 -0
- package/dist/chunk-xrmjy8kk.js +454 -0
- package/dist/chunk-xrmjy8kk.js.map +10 -0
- package/dist/chunk-xw0tx842.js +13 -0
- package/dist/chunk-xw0tx842.js.map +9 -0
- package/dist/chunk-xx5b6b9m.js +69 -0
- package/dist/chunk-xx5b6b9m.js.map +10 -0
- package/dist/chunk-xz1kdswj.js +21 -0
- package/dist/chunk-xz1kdswj.js.map +9 -0
- package/dist/chunk-xzvy9hr4.js +377 -0
- package/dist/chunk-xzvy9hr4.js.map +10 -0
- package/dist/chunk-yfqhr31t.js +39 -0
- package/dist/chunk-yfqhr31t.js.map +9 -0
- package/dist/chunk-ygzd5s4z.js +184 -0
- package/dist/chunk-ygzd5s4z.js.map +10 -0
- package/dist/chunk-ywjn0rad.js +14 -0
- package/dist/chunk-ywjn0rad.js.map +9 -0
- package/dist/chunk-z9nvhm6r.js +13 -0
- package/dist/chunk-z9nvhm6r.js.map +9 -0
- package/dist/chunk-zhmvdpk6.js +15 -0
- package/dist/chunk-zhmvdpk6.js.map +9 -0
- package/dist/cli/index.js +6 -3
- package/dist/client/index.js +32 -1112
- package/dist/client/index.js.map +4 -22
- package/dist/core/streamingSlotRegistrar.js +11 -108
- package/dist/core/streamingSlotRegistrar.js.map +3 -4
- package/dist/core/streamingSlotRegistry.js +7 -169
- package/dist/core/streamingSlotRegistry.js.map +3 -5
- package/dist/index.js +537 -19714
- package/dist/index.js.map +3 -117
- package/dist/islands/browser.js +9 -228
- package/dist/islands/browser.js.map +4 -9
- package/dist/islands/index.js +18 -1900
- package/dist/islands/index.js.map +3 -28
- package/dist/react/browser.js +12 -328
- package/dist/react/browser.js.map +4 -12
- package/dist/react/components/index.js +16 -167
- package/dist/react/components/index.js.map +3 -6
- package/dist/react/hooks/index.js +8 -183
- package/dist/react/hooks/index.js.map +3 -7
- package/dist/react/index.js +37 -3619
- package/dist/react/index.js.map +4 -46
- package/dist/react/jsxDevRuntimeCompat.js +2 -61
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +18 -1789
- package/dist/react/server.js.map +3 -21
- package/dist/src/build/stylePreprocessor.d.ts +3 -0
- package/dist/src/core/index.d.ts +0 -2
- package/dist/svelte/browser.js +12 -247
- package/dist/svelte/browser.js.map +3 -10
- package/dist/svelte/index.js +38 -3724
- package/dist/svelte/index.js.map +4 -48
- package/dist/svelte/server.js +22 -2701
- package/dist/svelte/server.js.map +3 -27
- package/dist/vue/browser.js +12 -348
- package/dist/vue/browser.js.map +4 -12
- package/dist/vue/components/Image.js +7 -240
- package/dist/vue/components/Image.js.map +3 -6
- package/dist/vue/components/index.js +11 -544
- package/dist/vue/components/index.js.map +3 -9
- package/dist/vue/index.js +53 -4204
- package/dist/vue/index.js.map +4 -51
- package/dist/vue/server.js +18 -1849
- package/dist/vue/server.js.map +3 -21
- package/package.json +7 -7
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/build/buildReactVendor.ts
|
|
3
|
+
import { existsSync, mkdirSync } from "fs";
|
|
4
|
+
import { join, resolve } from "path";
|
|
5
|
+
import { rm } from "fs/promises";
|
|
6
|
+
var {build: bunBuild } = globalThis.Bun;
|
|
7
|
+
var resolveJsxDevRuntimeCompatPath = () => {
|
|
8
|
+
const candidates = [
|
|
9
|
+
resolve(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
10
|
+
resolve(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
11
|
+
resolve(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
12
|
+
resolve(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13
|
+
resolve(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
14
|
+
resolve(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
15
|
+
];
|
|
16
|
+
for (const candidate of candidates) {
|
|
17
|
+
if (existsSync(candidate)) {
|
|
18
|
+
return candidate.replace(/\\/g, "/");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return (candidates[0] ?? resolve(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
22
|
+
};
|
|
23
|
+
var jsxDevRuntimeCompatPath = resolveJsxDevRuntimeCompatPath();
|
|
24
|
+
var reactSpecifiers = [
|
|
25
|
+
"react",
|
|
26
|
+
"react-dom",
|
|
27
|
+
"react-dom/client",
|
|
28
|
+
"react/jsx-runtime",
|
|
29
|
+
"react/jsx-dev-runtime"
|
|
30
|
+
];
|
|
31
|
+
var isResolvable = (specifier) => {
|
|
32
|
+
try {
|
|
33
|
+
Bun.resolveSync(specifier, process.cwd());
|
|
34
|
+
return true;
|
|
35
|
+
} catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var resolveVendorSpecifiers = () => {
|
|
40
|
+
if (isResolvable("react-refresh/runtime")) {
|
|
41
|
+
return [...reactSpecifiers, "react-refresh/runtime"];
|
|
42
|
+
}
|
|
43
|
+
return reactSpecifiers;
|
|
44
|
+
};
|
|
45
|
+
var toSafeFileName = (specifier) => specifier.replace(/\//g, "_");
|
|
46
|
+
var computeVendorPaths = () => {
|
|
47
|
+
const paths = {};
|
|
48
|
+
for (const specifier of resolveVendorSpecifiers()) {
|
|
49
|
+
paths[specifier] = `/react/vendor/${toSafeFileName(specifier)}.js`;
|
|
50
|
+
}
|
|
51
|
+
return paths;
|
|
52
|
+
};
|
|
53
|
+
var generateEntrySource = async (specifier) => {
|
|
54
|
+
if (specifier === "react/jsx-dev-runtime") {
|
|
55
|
+
return `export { Fragment, jsxDEV } from '${jsxDevRuntimeCompatPath}';
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
const mod = await import(specifier);
|
|
59
|
+
const exportNames = Object.keys(mod).filter((key) => key !== "default" && key !== "__esModule");
|
|
60
|
+
const lines = [];
|
|
61
|
+
if (exportNames.length > 0) {
|
|
62
|
+
lines.push(`export { ${exportNames.join(", ")} } from '${specifier}';`);
|
|
63
|
+
}
|
|
64
|
+
if ("default" in mod) {
|
|
65
|
+
lines.push(`export { default } from '${specifier}';`);
|
|
66
|
+
}
|
|
67
|
+
return `${lines.join(`
|
|
68
|
+
`)}
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
var buildReactVendor = async (buildDir) => {
|
|
72
|
+
const vendorDir = join(buildDir, "react", "vendor");
|
|
73
|
+
mkdirSync(vendorDir, { recursive: true });
|
|
74
|
+
const tmpDir = join(buildDir, "_vendor_tmp");
|
|
75
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
76
|
+
const specifiers = resolveVendorSpecifiers();
|
|
77
|
+
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
78
|
+
const safeName = toSafeFileName(specifier);
|
|
79
|
+
const entryPath = join(tmpDir, `${safeName}.ts`);
|
|
80
|
+
const source = await generateEntrySource(specifier);
|
|
81
|
+
await Bun.write(entryPath, source);
|
|
82
|
+
return entryPath;
|
|
83
|
+
}));
|
|
84
|
+
const result = await bunBuild({
|
|
85
|
+
entrypoints,
|
|
86
|
+
format: "esm",
|
|
87
|
+
minify: false,
|
|
88
|
+
naming: "[name].[ext]",
|
|
89
|
+
outdir: vendorDir,
|
|
90
|
+
splitting: true,
|
|
91
|
+
target: "browser",
|
|
92
|
+
throw: false
|
|
93
|
+
});
|
|
94
|
+
await rm(tmpDir, { force: true, recursive: true });
|
|
95
|
+
if (!result.success) {
|
|
96
|
+
console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { computeVendorPaths, buildReactVendor };
|
|
101
|
+
|
|
102
|
+
//# debugId=DA15DD9162F09FED64756E2164756E21
|
|
103
|
+
//# sourceMappingURL=chunk-85n68sy6.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/build/buildReactVendor.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { existsSync, mkdirSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { rm } from 'node:fs/promises';\nimport { build as bunBuild } from 'bun';\n\nconst resolveJsxDevRuntimeCompatPath = () => {\n\tconst candidates = [\n\t\tresolve(import.meta.dir, 'react', 'jsxDevRuntimeCompat.js'),\n\t\tresolve(import.meta.dir, 'src', 'react', 'jsxDevRuntimeCompat.ts'),\n\t\tresolve(import.meta.dir, '..', 'react', 'jsxDevRuntimeCompat.js'),\n\t\tresolve(import.meta.dir, '..', 'src', 'react', 'jsxDevRuntimeCompat.ts'),\n\t\tresolve(import.meta.dir, '..', '..', 'dist', 'react', 'jsxDevRuntimeCompat.js'),\n\t\tresolve(import.meta.dir, '..', '..', 'src', 'react', 'jsxDevRuntimeCompat.ts')\n\t];\n\tfor (const candidate of candidates) {\n\t\tif (existsSync(candidate)) {\n\t\t\treturn candidate.replace(/\\\\/g, '/');\n\t\t}\n\t}\n\n\treturn (candidates[0] ?? resolve(import.meta.dir, 'react', 'jsxDevRuntimeCompat.js')).replace(\n\t\t/\\\\/g,\n\t\t'/'\n\t);\n};\n\nconst jsxDevRuntimeCompatPath = resolveJsxDevRuntimeCompatPath();\n\n/** Bare specifiers that need stable vendor builds */\nconst reactSpecifiers = [\n\t'react',\n\t'react-dom',\n\t'react-dom/client',\n\t'react/jsx-runtime',\n\t'react/jsx-dev-runtime'\n];\n\nconst isResolvable = (specifier: string) => {\n\ttry {\n\t\tBun.resolveSync(specifier, process.cwd());\n\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n/** Includes react-refresh/runtime when the package is installed (dev HMR) */\nconst resolveVendorSpecifiers = () => {\n\tif (isResolvable('react-refresh/runtime')) {\n\t\treturn [...reactSpecifiers, 'react-refresh/runtime'];\n\t}\n\n\treturn reactSpecifiers;\n};\n\n/** Convert a bare specifier to a safe filename: react-dom/client → react-dom_client */\nconst toSafeFileName = (specifier: string) =>\n\tspecifier.replace(/\\//g, '_');\n\n/** Compute the deterministic vendor paths mapping (no build needed).\n * This can be called before vendor files exist on disk. */\nexport const computeVendorPaths = () => {\n\tconst paths: Record<string, string> = {};\n\tfor (const specifier of resolveVendorSpecifiers()) {\n\t\tpaths[specifier] = `/react/vendor/${toSafeFileName(specifier)}.js`;\n\t}\n\n\treturn paths;\n};\n\n/** Introspect a package's exports at runtime and generate an entry file\n * with explicit named re-exports. This is necessary because React is a\n * CJS module — `export * from 'react'` can't statically determine the\n * export names, so Bun produces an empty re-export. */\nconst generateEntrySource = async (specifier: string) => {\n\tif (specifier === 'react/jsx-dev-runtime') {\n\t\treturn `export { Fragment, jsxDEV } from '${jsxDevRuntimeCompatPath}';\\n`;\n\t}\n\n\tconst mod = await import(specifier);\n\tconst exportNames = Object.keys(mod).filter(\n\t\t(key) => key !== 'default' && key !== '__esModule'\n\t);\n\n\tconst lines: string[] = [];\n\tif (exportNames.length > 0) {\n\t\tlines.push(`export { ${exportNames.join(', ')} } from '${specifier}';`);\n\t}\n\tif ('default' in mod) {\n\t\tlines.push(`export { default } from '${specifier}';`);\n\t}\n\n\treturn `${lines.join('\\n') }\\n`;\n};\n\n/** Build React packages into stable vendor files (no content hash).\n * Output goes to {buildDir}/react/vendor/ with predictable names like\n * react.js, react-dom_client.js, etc. These files never change between\n * rebuilds, so the browser always loads React from a single source. */\nexport const buildReactVendor = async (buildDir: string) => {\n\tconst vendorDir = join(buildDir, 'react', 'vendor');\n\tmkdirSync(vendorDir, { recursive: true });\n\n\tconst tmpDir = join(buildDir, '_vendor_tmp');\n\tmkdirSync(tmpDir, { recursive: true });\n\n\tconst specifiers = resolveVendorSpecifiers();\n\n\t// Create temp entry files with explicit named exports\n\tconst entrypoints = await Promise.all(\n\t\tspecifiers.map(async (specifier) => {\n\t\t\tconst safeName = toSafeFileName(specifier);\n\t\t\tconst entryPath = join(tmpDir, `${safeName}.ts`);\n\t\t\tconst source = await generateEntrySource(specifier);\n\t\t\tawait Bun.write(entryPath, source);\n\n\t\t\treturn entryPath;\n\t\t})\n\t);\n\n\tconst result = await bunBuild({\n\t\tentrypoints,\n\t\tformat: 'esm',\n\t\tminify: false,\n\t\tnaming: '[name].[ext]',\n\t\toutdir: vendorDir,\n\t\tsplitting: true,\n\t\ttarget: 'browser',\n\t\tthrow: false\n\t});\n\n\tawait rm(tmpDir, { force: true, recursive: true });\n\n\tif (!result.success) {\n\t\tconsole.warn('⚠️ React vendor build had errors:', result.logs);\n\t}\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "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",
|
|
8
|
+
"debugId": "DA15DD9162F09FED64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
generateManifest
|
|
4
|
+
} from "./chunk-1e9vsfyh.js";
|
|
5
|
+
import"./chunk-hyjs4bqs.js";
|
|
6
|
+
import"./chunk-cbkrwmvh.js";
|
|
7
|
+
import"./chunk-gf0ygptk.js";
|
|
8
|
+
import"./chunk-p5504p14.js";
|
|
9
|
+
import"./chunk-qh75agse.js";
|
|
10
|
+
import"./chunk-3yjzpcne.js";
|
|
11
|
+
import"./chunk-bmgqm774.js";
|
|
12
|
+
export {
|
|
13
|
+
generateManifest
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//# debugId=C379B9CF434B0B1A64756E2164756E21
|
|
17
|
+
//# sourceMappingURL=chunk-8feq2qek.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/core/islands.ts
|
|
3
|
+
var defineIslandComponent = (component, options) => ({
|
|
4
|
+
component,
|
|
5
|
+
export: options.export,
|
|
6
|
+
source: options.source
|
|
7
|
+
});
|
|
8
|
+
var defineIslandRegistry = (registry) => registry;
|
|
9
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
10
|
+
var getIslandBuildReference = (component) => {
|
|
11
|
+
if (!isIslandComponentDefinition(component))
|
|
12
|
+
return null;
|
|
13
|
+
return {
|
|
14
|
+
export: component.export,
|
|
15
|
+
source: component.source
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string";
|
|
19
|
+
function getIslandComponent(component) {
|
|
20
|
+
if (isIslandComponentDefinition(component)) {
|
|
21
|
+
return component.component;
|
|
22
|
+
}
|
|
23
|
+
return component;
|
|
24
|
+
}
|
|
25
|
+
var parseIslandProps = (rawProps) => {
|
|
26
|
+
if (!rawProps)
|
|
27
|
+
return {};
|
|
28
|
+
return JSON.parse(rawProps);
|
|
29
|
+
};
|
|
30
|
+
var serializeIslandProps = (props) => JSON.stringify(props ?? {});
|
|
31
|
+
|
|
32
|
+
export { defineIslandComponent, defineIslandRegistry, getIslandBuildReference, isIslandComponentDefinition, getIslandComponent, parseIslandProps, serializeIslandProps };
|
|
33
|
+
|
|
34
|
+
//# debugId=730C288CB38BBBFB64756E2164756E21
|
|
35
|
+
//# sourceMappingURL=chunk-8kcfffry.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/islands.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type {\n\tIslandComponentDefinition,\n\tIslandRegistry,\n\tIslandRegistryInput\n} from '../../types/island';\n\nexport const defineIslandComponent = <Component>(\n\tcomponent: Component,\n\toptions: {\n\t\texport?: string;\n\t\tsource: string;\n\t}\n): IslandComponentDefinition<Component> => ({\n\tcomponent,\n\texport: options.export,\n\tsource: options.source\n});\nexport const defineIslandRegistry = <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T>\n) => registry;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const getIslandBuildReference = <Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) => {\n\tif (!isIslandComponentDefinition(component)) return null;\n\n\treturn {\n\t\texport: component.export,\n\t\tsource: component.source\n\t};\n};\nexport const isIslandComponentDefinition = <Component>(\n\tvalue: Component | IslandComponentDefinition<Component>\n): value is IslandComponentDefinition<Component> =>\n\tisRecord(value) &&\n\t'component' in value &&\n\t'source' in value &&\n\ttypeof value.source === 'string';\n\nexport function getIslandComponent<Component>(component: Component): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: IslandComponentDefinition<Component>\n): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) {\n\tif (isIslandComponentDefinition(component)) {\n\t\treturn component.component;\n\t}\n\n\treturn component;\n}\nexport const parseIslandProps = (rawProps: string | null) => {\n\tif (!rawProps) return {};\n\n\treturn JSON.parse(rawProps);\n};\nexport const serializeIslandProps = (props: unknown) =>\n\tJSON.stringify(props ?? {});\n\nexport {\n\tgetIslandManifestEntries,\n\tgetIslandManifestKey\n} from './islandManifest';\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAMO,IAAM,wBAAwB,CACpC,WACA,aAI2C;AAAA,EAC3C;AAAA,EACA,QAAQ,QAAQ;AAAA,EAChB,QAAQ,QAAQ;AACjB;AACO,IAAM,uBAAuB,CACnC,aACI;AAEL,IAAM,WAAW,CAAC,UACjB,OAAO,UAAU,YAAY,UAAU;AAEjC,IAAM,0BAA0B,CACtC,cACI;AAAA,EACJ,IAAI,CAAC,4BAA4B,SAAS;AAAA,IAAG,OAAO;AAAA,EAEpD,OAAO;AAAA,IACN,QAAQ,UAAU;AAAA,IAClB,QAAQ,UAAU;AAAA,EACnB;AAAA;AAEM,IAAM,8BAA8B,CAC1C,UAEA,SAAS,KAAK,MACd,eAAe,WACf,YAAY,UACZ,OAAO,MAAM,WAAW;AAMlB,SAAS,kBAA6B,CAC5C,WACC;AAAA,EACD,IAAI,4BAA4B,SAAS,GAAG;AAAA,IAC3C,OAAO,UAAU;AAAA,EAClB;AAAA,EAEA,OAAO;AAAA;AAED,IAAM,mBAAmB,CAAC,aAA4B;AAAA,EAC5D,IAAI,CAAC;AAAA,IAAU,OAAO,CAAC;AAAA,EAEvB,OAAO,KAAK,MAAM,QAAQ;AAAA;AAEpB,IAAM,uBAAuB,CAAC,UACpC,KAAK,UAAU,SAAS,CAAC,CAAC;",
|
|
8
|
+
"debugId": "730C288CB38BBBFB64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
scanEntryPoints
|
|
4
|
+
} from "./chunk-11zpfqz6.js";
|
|
5
|
+
import {
|
|
6
|
+
toPascal
|
|
7
|
+
} from "./chunk-p5504p14.js";
|
|
8
|
+
|
|
9
|
+
// src/build/updateAssetPaths.ts
|
|
10
|
+
import { readFile, writeFile } from "fs/promises";
|
|
11
|
+
|
|
12
|
+
// src/cli/telemetryEvent.ts
|
|
13
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
14
|
+
import { arch, platform } from "os";
|
|
15
|
+
import { dirname, join as join2, parse } from "path";
|
|
16
|
+
|
|
17
|
+
// src/cli/scripts/telemetry.ts
|
|
18
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
19
|
+
import { homedir } from "os";
|
|
20
|
+
import { join } from "path";
|
|
21
|
+
var configDir = join(homedir(), ".absolutejs");
|
|
22
|
+
var configPath = join(configDir, "telemetry.json");
|
|
23
|
+
var getTelemetryConfig = () => {
|
|
24
|
+
try {
|
|
25
|
+
if (!existsSync(configPath))
|
|
26
|
+
return null;
|
|
27
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
28
|
+
const config = JSON.parse(raw);
|
|
29
|
+
return config;
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/cli/telemetryEvent.ts
|
|
36
|
+
var checkCandidate = (candidate) => {
|
|
37
|
+
if (!existsSync2(candidate)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
|
|
41
|
+
if (pkg.name === "@absolutejs/absolute") {
|
|
42
|
+
const ver = pkg.version;
|
|
43
|
+
return ver;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
var getVersion = () => {
|
|
48
|
+
try {
|
|
49
|
+
return findPackageVersion();
|
|
50
|
+
} catch {
|
|
51
|
+
return "unknown";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var findPackageVersion = () => {
|
|
55
|
+
let { dir } = import.meta;
|
|
56
|
+
while (dir !== parse(dir).root) {
|
|
57
|
+
const candidate = join2(dir, "package.json");
|
|
58
|
+
const version = checkCandidate(candidate);
|
|
59
|
+
if (version) {
|
|
60
|
+
return version;
|
|
61
|
+
}
|
|
62
|
+
dir = dirname(dir);
|
|
63
|
+
}
|
|
64
|
+
return "unknown";
|
|
65
|
+
};
|
|
66
|
+
var sendTelemetryEvent = (event, payload) => {
|
|
67
|
+
try {
|
|
68
|
+
if (process.env.TELEMETRY_OFF === "1")
|
|
69
|
+
return;
|
|
70
|
+
const config = getTelemetryConfig();
|
|
71
|
+
if (!config?.enabled)
|
|
72
|
+
return;
|
|
73
|
+
const body = {
|
|
74
|
+
anonymousId: config.anonymousId,
|
|
75
|
+
arch: arch(),
|
|
76
|
+
bunVersion: Bun.version,
|
|
77
|
+
event,
|
|
78
|
+
os: platform(),
|
|
79
|
+
payload,
|
|
80
|
+
timestamp: new Date().toISOString(),
|
|
81
|
+
version: getVersion()
|
|
82
|
+
};
|
|
83
|
+
fetch("https://absolutejs.com/api/telemetry", {
|
|
84
|
+
body: JSON.stringify(body),
|
|
85
|
+
headers: { "Content-Type": "application/json" },
|
|
86
|
+
method: "POST"
|
|
87
|
+
}).catch(() => {
|
|
88
|
+
return;
|
|
89
|
+
});
|
|
90
|
+
} catch {}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/build/updateAssetPaths.ts
|
|
94
|
+
var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath) => {
|
|
95
|
+
if (/data-external(?:\s*=\s*["'][^"']*["'])?/i.test(match)) {
|
|
96
|
+
return match;
|
|
97
|
+
}
|
|
98
|
+
const pascal = toPascal(name);
|
|
99
|
+
let key;
|
|
100
|
+
if (ext === ".css") {
|
|
101
|
+
key = `${pascal}CSS`;
|
|
102
|
+
} else if (dir.includes("/indexes/")) {
|
|
103
|
+
key = `${pascal}Index`;
|
|
104
|
+
} else {
|
|
105
|
+
key = pascal;
|
|
106
|
+
}
|
|
107
|
+
const newPath = manifest[key];
|
|
108
|
+
if (!newPath) {
|
|
109
|
+
console.error(`error: no manifest entry for ${ext.slice(1)} "${name}" referenced in ${filePath}`);
|
|
110
|
+
sendTelemetryEvent("build:missing-manifest-entry", {
|
|
111
|
+
assetName: name,
|
|
112
|
+
assetType: ext.slice(1),
|
|
113
|
+
htmlFile: filePath
|
|
114
|
+
});
|
|
115
|
+
return match;
|
|
116
|
+
}
|
|
117
|
+
const isScript = ext === ".js" || ext === ".ts";
|
|
118
|
+
const hasTypeModule = isScript && /type\s*=\s*["']module["']/i.test(match);
|
|
119
|
+
if (isScript && !hasTypeModule) {
|
|
120
|
+
const newSuffix = suffix.replace(/>$/, ' type="module">');
|
|
121
|
+
return `${prefix}${newPath}${newSuffix}`;
|
|
122
|
+
}
|
|
123
|
+
return `${prefix}${newPath}${suffix}`;
|
|
124
|
+
};
|
|
125
|
+
var updateAssetPaths = async (manifest, directory) => {
|
|
126
|
+
const htmlFiles = await scanEntryPoints(directory, "*.html");
|
|
127
|
+
const assetRegex = /((?:<script[^>]+src=|<link[^>]*?rel=["']stylesheet["'][^>]*?href=)["'])(?!\/?(?:.*\/)?htmx\.min\.js)(\/?(?:.*\/)?)([^./"']+)(?:\.[^."'/]+)?(\.(?:js|ts|css))(["'][^>]*>)/g;
|
|
128
|
+
const tasks = htmlFiles.map(async (filePath) => {
|
|
129
|
+
const original = await readFile(filePath, "utf8");
|
|
130
|
+
const updated = original.replace(assetRegex, (match, prefix, dir, name, ext, suffix) => replaceAssetRef(match, prefix, dir, name, ext, suffix, manifest, filePath));
|
|
131
|
+
await writeFile(filePath, updated, "utf8");
|
|
132
|
+
});
|
|
133
|
+
await Promise.all(tasks);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { sendTelemetryEvent, updateAssetPaths };
|
|
137
|
+
|
|
138
|
+
//# debugId=DE253A6378E03D6264756E2164756E21
|
|
139
|
+
//# sourceMappingURL=chunk-93sqk7be.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/build/updateAssetPaths.ts", "../src/cli/telemetryEvent.ts", "../src/cli/scripts/telemetry.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { readFile, writeFile } from 'node:fs/promises';\nimport { sendTelemetryEvent } from '../cli/telemetryEvent';\nimport { toPascal } from '../utils/stringModifiers';\nimport { scanEntryPoints } from './scanEntryPoints';\n\nconst replaceAssetRef = (\n\tmatch: string,\n\tprefix: string,\n\tdir: string,\n\tname: string,\n\text: string,\n\tsuffix: string,\n\tmanifest: Record<string, string>,\n\tfilePath: string\n) => {\n\tif (/data-external(?:\\s*=\\s*[\"'][^\"']*[\"'])?/i.test(match)) {\n\t\treturn match;\n\t}\n\n\tconst pascal = toPascal(name);\n\n\tlet key;\n\tif (ext === '.css') {\n\t\tkey = `${pascal}CSS`;\n\t} else if (dir.includes('/indexes/')) {\n\t\tkey = `${pascal}Index`;\n\t} else {\n\t\tkey = pascal;\n\t}\n\n\tconst newPath = manifest[key];\n\tif (!newPath) {\n\t\tconsole.error(\n\t\t\t`error: no manifest entry for ${ext.slice(1)} \"${name}\" referenced in ${filePath}`\n\t\t);\n\t\tsendTelemetryEvent('build:missing-manifest-entry', {\n\t\t\tassetName: name,\n\t\t\tassetType: ext.slice(1),\n\t\t\thtmlFile: filePath\n\t\t});\n\n\t\treturn match;\n\t}\n\n\tconst isScript = ext === '.js' || ext === '.ts';\n\tconst hasTypeModule = isScript && /type\\s*=\\s*[\"']module[\"']/i.test(match);\n\n\tif (isScript && !hasTypeModule) {\n\t\tconst newSuffix = suffix.replace(/>$/, ' type=\"module\">');\n\n\t\treturn `${prefix}${newPath}${newSuffix}`;\n\t}\n\n\treturn `${prefix}${newPath}${suffix}`;\n};\n\nexport const updateAssetPaths = async (\n\tmanifest: Record<string, string>,\n\tdirectory: string\n) => {\n\tconst htmlFiles = await scanEntryPoints(directory, '*.html');\n\tconst assetRegex =\n\t\t/((?:<script[^>]+src=|<link[^>]*?rel=[\"']stylesheet[\"'][^>]*?href=)[\"'])(?!\\/?(?:.*\\/)?htmx\\.min\\.js)(\\/?(?:.*\\/)?)([^./\"']+)(?:\\.[^.\"'/]+)?(\\.(?:js|ts|css))([\"'][^>]*>)/g;\n\n\tconst tasks = htmlFiles.map(async (filePath) => {\n\t\tconst original = await readFile(filePath, 'utf8');\n\t\tconst updated = original.replace(\n\t\t\tassetRegex,\n\t\t\t(match, prefix, dir, name, ext, suffix) =>\n\t\t\t\treplaceAssetRef(match, prefix, dir, name, ext, suffix, manifest, filePath)\n\t\t);\n\t\tawait writeFile(filePath, updated, 'utf8');\n\t});\n\n\tawait Promise.all(tasks);\n};\n",
|
|
6
|
+
"import { existsSync, readFileSync } from 'node:fs';\nimport { arch, platform } from 'node:os';\nimport { dirname, join, parse } from 'node:path';\nimport type { TelemetryEvent } from '../../types/telemetry';\nimport { getTelemetryConfig } from './scripts/telemetry';\n\nconst checkCandidate = (candidate: string) => {\n\tif (!existsSync(candidate)) {\n\t\treturn null;\n\t}\n\tconst pkg = JSON.parse(readFileSync(candidate, 'utf-8'));\n\n\tif (pkg.name === '@absolutejs/absolute') {\n\t\tconst ver: string = pkg.version;\n\n\t\treturn ver;\n\t}\n\n\treturn null;\n};\n\nconst getVersion = () => {\n\ttry {\n\t\treturn findPackageVersion();\n\t} catch {\n\t\treturn 'unknown';\n\t}\n};\n\nconst findPackageVersion = () => {\n\tlet { dir } = import.meta;\n\n\twhile (dir !== parse(dir).root) {\n\t\tconst candidate = join(dir, 'package.json');\n\t\tconst version = checkCandidate(candidate);\n\t\tif (version) {\n\t\t\treturn version;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\n\treturn 'unknown';\n};\n\nexport const sendTelemetryEvent = (\n\tevent: string,\n\tpayload: Record<string, unknown>\n) => {\n\ttry {\n\t\tif (process.env.TELEMETRY_OFF === '1') return;\n\t\tconst config = getTelemetryConfig();\n\t\tif (!config?.enabled) return;\n\n\t\tconst body: TelemetryEvent = {\n\t\t\tanonymousId: config.anonymousId,\n\t\t\tarch: arch(),\n\t\t\tbunVersion: Bun.version,\n\t\t\tevent,\n\t\t\tos: platform(),\n\t\t\tpayload,\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tversion: getVersion()\n\t\t};\n\n\t\tfetch('https://absolutejs.com/api/telemetry', {\n\t\t\tbody: JSON.stringify(body),\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tmethod: 'POST'\n\t\t}).catch(() => undefined);\n\t} catch {\n\t\t/* silently ignore */\n\t}\n};\n",
|
|
7
|
+
"import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport type { TelemetryConfig } from '../../../types/telemetry';\n\nconst configDir = join(homedir(), '.absolutejs');\nconst configPath = join(configDir, 'telemetry.json');\n\nexport const getTelemetryConfig = () => {\n\ttry {\n\t\tif (!existsSync(configPath)) return null;\n\t\tconst raw = readFileSync(configPath, 'utf-8');\n\n\t\tconst config: TelemetryConfig = JSON.parse(raw);\n\n\t\treturn config;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\nexport const isTelemetryEnabled = () => {\n\tconst config = getTelemetryConfig();\n\n\treturn config?.enabled === true;\n};\n\nexport const saveTelemetryConfig = (config: TelemetryConfig) => {\n\tmkdirSync(configDir, { recursive: true });\n\twriteFileSync(configPath, `${JSON.stringify(config, null, '\\t')}\\n`);\n};\n\nconst enable = () => {\n\tconst existing = getTelemetryConfig();\n\tconst config: TelemetryConfig = {\n\t\tanonymousId: existing?.anonymousId ?? crypto.randomUUID(),\n\t\tcreatedAt: existing?.createdAt ?? new Date().toISOString(),\n\t\tenabled: true\n\t};\n\tsaveTelemetryConfig(config);\n\tconsole.log('Telemetry enabled.');\n\tconsole.log(`Anonymous ID: ${config.anonymousId}`);\n};\n\nconst disable = () => {\n\tconst existing = getTelemetryConfig();\n\tif (existing) {\n\t\tsaveTelemetryConfig({ ...existing, enabled: false });\n\t}\n\tconsole.log('Telemetry disabled.');\n};\n\nconst status = () => {\n\tconst config = getTelemetryConfig();\n\tif (!config || !config.enabled) {\n\t\tconsole.log('Telemetry is disabled.');\n\t} else {\n\t\tconsole.log('Telemetry is enabled.');\n\t\tconsole.log(`Anonymous ID: ${config.anonymousId}`);\n\t}\n};\n\nexport const telemetry = (args: string[]) => {\n\tconst [subcommand] = args;\n\n\tif (subcommand === 'enable') {\n\t\tenable();\n\n\t\treturn;\n\t}\n\tif (subcommand === 'disable') {\n\t\tdisable();\n\n\t\treturn;\n\t}\n\tif (subcommand === 'status') {\n\t\tstatus();\n\n\t\treturn;\n\t}\n\tif (!subcommand) {\n\t\tstatus();\n\t\tconsole.log('');\n\t\tconsole.log('Usage: absolute telemetry <command>');\n\t\tconsole.log('Commands:');\n\t\tconsole.log(' enable Enable anonymous telemetry');\n\t\tconsole.log(' disable Disable telemetry');\n\t\tconsole.log(' status Show current telemetry status');\n\n\t\treturn;\n\t}\n\tconsole.error(`Unknown telemetry command: ${subcommand}`);\n\tconsole.error('Usage: absolute telemetry <enable|disable|status>');\n\tprocess.exit(1);\n};\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": "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",
|
|
10
|
+
"debugId": "DE253A6378E03D6264756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
resolveAngularPackage,
|
|
4
|
+
resolveAngularPackageDir
|
|
5
|
+
} from "./chunk-kvq01j35.js";
|
|
6
|
+
import {
|
|
7
|
+
generateClientScriptCode,
|
|
8
|
+
getAndClearClientScripts
|
|
9
|
+
} from "./chunk-pnscgw95.js";
|
|
10
|
+
import {
|
|
11
|
+
toScreamingSnake
|
|
12
|
+
} from "./chunk-p5504p14.js";
|
|
13
|
+
import {
|
|
14
|
+
buildAbsoluteHttpTransferCacheOptions,
|
|
15
|
+
buildRequestProviders
|
|
16
|
+
} from "./chunk-25v9t56f.js";
|
|
17
|
+
import {
|
|
18
|
+
__require
|
|
19
|
+
} from "./chunk-bmgqm774.js";
|
|
20
|
+
|
|
21
|
+
// src/angular/injectorPatch.ts
|
|
22
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
23
|
+
import { dirname, join } from "path";
|
|
24
|
+
var applyInjectorPatch = (chunkPath, content) => {
|
|
25
|
+
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const original = [
|
|
29
|
+
"let _currentInjector = undefined;",
|
|
30
|
+
"function getCurrentInjector() {",
|
|
31
|
+
" return _currentInjector;",
|
|
32
|
+
"}",
|
|
33
|
+
"function setCurrentInjector(injector) {",
|
|
34
|
+
" const former = _currentInjector;",
|
|
35
|
+
" _currentInjector = injector;",
|
|
36
|
+
" return former;",
|
|
37
|
+
"}"
|
|
38
|
+
].join(`
|
|
39
|
+
`);
|
|
40
|
+
const replacement = [
|
|
41
|
+
'const _injSym = Symbol.for("angular.currentInjector");',
|
|
42
|
+
"if (!globalThis[_injSym]) globalThis[_injSym] = { v: undefined };",
|
|
43
|
+
"function getCurrentInjector() {",
|
|
44
|
+
" return globalThis[_injSym].v;",
|
|
45
|
+
"}",
|
|
46
|
+
"function setCurrentInjector(injector) {",
|
|
47
|
+
" const former = globalThis[_injSym].v;",
|
|
48
|
+
" globalThis[_injSym].v = injector;",
|
|
49
|
+
" return former;",
|
|
50
|
+
"}"
|
|
51
|
+
].join(`
|
|
52
|
+
`);
|
|
53
|
+
const patched = content.replace(original, replacement);
|
|
54
|
+
if (patched === content) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
writeFileSync(chunkPath, patched, "utf-8");
|
|
58
|
+
};
|
|
59
|
+
var resolveAngularCoreDir = () => {
|
|
60
|
+
const resolved = resolveAngularPackageDir("@angular/core");
|
|
61
|
+
if (resolved && existsSync(join(resolved, "package.json"))) {
|
|
62
|
+
return resolved;
|
|
63
|
+
}
|
|
64
|
+
return dirname(__require.resolve("@angular/core/package.json"));
|
|
65
|
+
};
|
|
66
|
+
var patchAngularInjectorSingleton = () => {
|
|
67
|
+
try {
|
|
68
|
+
const coreDir = resolveAngularCoreDir();
|
|
69
|
+
const chunkPath = join(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
70
|
+
const content = readFileSync(chunkPath, "utf-8");
|
|
71
|
+
applyInjectorPatch(chunkPath, content);
|
|
72
|
+
} catch {}
|
|
73
|
+
};
|
|
74
|
+
patchAngularInjectorSingleton();
|
|
75
|
+
|
|
76
|
+
// src/angular/angularDeps.ts
|
|
77
|
+
var initDominoAdapter = (platformServer) => {
|
|
78
|
+
try {
|
|
79
|
+
const DominoAdapter = platformServer.\u{275}DominoAdapter;
|
|
80
|
+
DominoAdapter?.makeCurrent?.();
|
|
81
|
+
} catch (err) {
|
|
82
|
+
console.error("Failed to initialize DominoAdapter:", err);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var loadAngularDeps = async () => {
|
|
86
|
+
patchAngularInjectorSingleton();
|
|
87
|
+
await import(resolveAngularPackage("@angular/compiler"));
|
|
88
|
+
const { applyPatches } = await import("./chunk-hhqh49fz.js");
|
|
89
|
+
await applyPatches();
|
|
90
|
+
const [platformBrowser, platformServer, common, core] = await Promise.all([
|
|
91
|
+
import(resolveAngularPackage("@angular/platform-browser")),
|
|
92
|
+
import(resolveAngularPackage("@angular/platform-server")),
|
|
93
|
+
import(resolveAngularPackage("@angular/common")),
|
|
94
|
+
import(resolveAngularPackage("@angular/core"))
|
|
95
|
+
]);
|
|
96
|
+
if (false) {}
|
|
97
|
+
initDominoAdapter(platformServer);
|
|
98
|
+
return {
|
|
99
|
+
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
100
|
+
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
101
|
+
DomSanitizer: platformBrowser.DomSanitizer,
|
|
102
|
+
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
103
|
+
inject: core.inject,
|
|
104
|
+
provideClientHydration: platformBrowser.provideClientHydration,
|
|
105
|
+
provideServerRendering: platformServer.provideServerRendering,
|
|
106
|
+
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
107
|
+
reflectComponentType: core.reflectComponentType,
|
|
108
|
+
renderApplication: platformServer.renderApplication,
|
|
109
|
+
REQUEST: core.REQUEST,
|
|
110
|
+
REQUEST_CONTEXT: core.REQUEST_CONTEXT,
|
|
111
|
+
RESPONSE_INIT: core.RESPONSE_INIT,
|
|
112
|
+
Sanitizer: core.Sanitizer,
|
|
113
|
+
SecurityContext: core.SecurityContext,
|
|
114
|
+
withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
var angularDeps = null;
|
|
118
|
+
var getAngularDeps = () => {
|
|
119
|
+
if (!angularDeps) {
|
|
120
|
+
angularDeps = loadAngularDeps();
|
|
121
|
+
}
|
|
122
|
+
return angularDeps;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/angular/ssrRender.ts
|
|
126
|
+
var routePropsCache = new Map;
|
|
127
|
+
var cacheRouteData = (pagePath, data) => {
|
|
128
|
+
const cacheKey = pagePath.split("?")[0] ?? pagePath;
|
|
129
|
+
routePropsCache.set(cacheKey, data);
|
|
130
|
+
};
|
|
131
|
+
var getCachedRouteData = (pagePath) => routePropsCache.get(pagePath);
|
|
132
|
+
var selectorCache = new Map;
|
|
133
|
+
var buildDeps = (ssrResult, baseDeps) => {
|
|
134
|
+
if (!ssrResult?.core) {
|
|
135
|
+
return baseDeps;
|
|
136
|
+
}
|
|
137
|
+
const { common, core, platformBrowser, platformServer } = ssrResult;
|
|
138
|
+
return {
|
|
139
|
+
APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
|
|
140
|
+
bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
|
|
141
|
+
DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
|
|
142
|
+
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER ?? baseDeps.ENVIRONMENT_INITIALIZER,
|
|
143
|
+
inject: core.inject ?? baseDeps.inject,
|
|
144
|
+
provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
|
|
145
|
+
provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
|
|
146
|
+
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
147
|
+
reflectComponentType: core.reflectComponentType,
|
|
148
|
+
renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
|
|
149
|
+
REQUEST: core.REQUEST ?? baseDeps.REQUEST,
|
|
150
|
+
REQUEST_CONTEXT: core.REQUEST_CONTEXT ?? baseDeps.REQUEST_CONTEXT,
|
|
151
|
+
RESPONSE_INIT: core.RESPONSE_INIT ?? baseDeps.RESPONSE_INIT,
|
|
152
|
+
Sanitizer: core.Sanitizer,
|
|
153
|
+
SecurityContext: core.SecurityContext,
|
|
154
|
+
withHttpTransferCacheOptions: platformBrowser?.withHttpTransferCacheOptions ?? baseDeps.withHttpTransferCacheOptions
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
var buildProviders = (deps, sanitizer, maybeProps, tokenMap, request, requestContext, responseInit, userProviders = []) => {
|
|
158
|
+
const providers = [
|
|
159
|
+
deps.provideServerRendering(),
|
|
160
|
+
deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
|
|
161
|
+
deps.provideZonelessChangeDetection(),
|
|
162
|
+
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
163
|
+
{
|
|
164
|
+
provide: deps.DomSanitizer,
|
|
165
|
+
useValue: sanitizer
|
|
166
|
+
},
|
|
167
|
+
{ provide: deps.Sanitizer, useValue: sanitizer },
|
|
168
|
+
...buildRequestProviders(deps, request, requestContext, responseInit),
|
|
169
|
+
...userProviders
|
|
170
|
+
];
|
|
171
|
+
if (!maybeProps) {
|
|
172
|
+
return providers;
|
|
173
|
+
}
|
|
174
|
+
const propProviders = Object.entries(maybeProps).map(([propName, propValue]) => ({
|
|
175
|
+
token: tokenMap.get(toScreamingSnake(propName)),
|
|
176
|
+
value: propValue
|
|
177
|
+
})).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
|
|
178
|
+
return [...providers, ...propProviders];
|
|
179
|
+
};
|
|
180
|
+
var clearSelectorCache = () => selectorCache.clear();
|
|
181
|
+
var isInjectionToken = (value) => {
|
|
182
|
+
if (!value || typeof value !== "object") {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return "ngMetadataName" in value && value.ngMetadataName === "InjectionToken";
|
|
186
|
+
};
|
|
187
|
+
var discoverTokens = (pageModule) => new Map(Object.entries(pageModule).filter(([, value]) => isInjectionToken(value)));
|
|
188
|
+
var loadSsrDeps = async (pagePath) => {
|
|
189
|
+
const ssrDepsPath = (pagePath.split("?")[0] ?? pagePath).replace(/\.js$/, ".ssr-deps.js");
|
|
190
|
+
try {
|
|
191
|
+
const ssrDeps = await import(ssrDepsPath);
|
|
192
|
+
const result = {
|
|
193
|
+
common: ssrDeps.__angularCommon,
|
|
194
|
+
core: ssrDeps.__angularCore,
|
|
195
|
+
platformBrowser: ssrDeps.__angularPlatformBrowser,
|
|
196
|
+
platformServer: ssrDeps.__angularPlatformServer
|
|
197
|
+
};
|
|
198
|
+
return result;
|
|
199
|
+
} catch {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
var resolveSelector = (deps, pagePath, PageComponent) => {
|
|
204
|
+
const cached = selectorCache.get(pagePath);
|
|
205
|
+
if (cached) {
|
|
206
|
+
return cached;
|
|
207
|
+
}
|
|
208
|
+
const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
|
|
209
|
+
selectorCache.set(pagePath, selector);
|
|
210
|
+
return selector;
|
|
211
|
+
};
|
|
212
|
+
var injectBeforeClose = (html, snippet) => {
|
|
213
|
+
if (html.includes("</body>")) {
|
|
214
|
+
return html.replace("</body>", `${snippet}</body>`);
|
|
215
|
+
}
|
|
216
|
+
if (html.includes("</html>")) {
|
|
217
|
+
return html.replace("</html>", `${snippet}</html>`);
|
|
218
|
+
}
|
|
219
|
+
return html + snippet;
|
|
220
|
+
};
|
|
221
|
+
var injectSsrScripts = (html, requestId, indexPath, props) => {
|
|
222
|
+
let result = html;
|
|
223
|
+
const registeredScripts = getAndClearClientScripts(requestId);
|
|
224
|
+
if (registeredScripts.length > 0) {
|
|
225
|
+
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
226
|
+
}
|
|
227
|
+
if (props) {
|
|
228
|
+
result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_PAGE_PROPS__ = ${JSON.stringify(props)};</script>`);
|
|
229
|
+
}
|
|
230
|
+
if (indexPath) {
|
|
231
|
+
const escapedIndexPath = JSON.stringify(indexPath);
|
|
232
|
+
result = injectBeforeClose(result, `<script>import(${escapedIndexPath});</script>`);
|
|
233
|
+
}
|
|
234
|
+
return result;
|
|
235
|
+
};
|
|
236
|
+
var renderAngularApp = async (deps, PageComponent, providers, document, url = "/") => {
|
|
237
|
+
const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
|
|
238
|
+
return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
|
|
239
|
+
document,
|
|
240
|
+
platformProviders: [],
|
|
241
|
+
url
|
|
242
|
+
}));
|
|
243
|
+
};
|
|
244
|
+
var withSuppressedAngularDevLogs = async (render) => {
|
|
245
|
+
const origLog = console.log;
|
|
246
|
+
console.log = (...args) => {
|
|
247
|
+
if (typeof args[0] === "string" && args[0].includes("development mode")) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
origLog.apply(console, args);
|
|
251
|
+
};
|
|
252
|
+
try {
|
|
253
|
+
return await render();
|
|
254
|
+
} finally {
|
|
255
|
+
console.log = origLog;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export { getAngularDeps, cacheRouteData, getCachedRouteData, buildDeps, buildProviders, clearSelectorCache, discoverTokens, loadSsrDeps, resolveSelector, injectSsrScripts, renderAngularApp, withSuppressedAngularDevLogs };
|
|
260
|
+
|
|
261
|
+
//# debugId=F18EECBA8801ACB864756E2164756E21
|
|
262
|
+
//# sourceMappingURL=chunk-97572s32.js.map
|