@absolutejs/absolute 0.19.0-beta.808 → 0.19.0-beta.809
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 +9801 -57
- package/dist/angular/browser.js.map +246 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +14877 -60
- package/dist/angular/index.js.map +281 -4
- package/dist/angular/server.js +5610 -45
- package/dist/angular/server.js.map +51 -3
- package/dist/build.js +18092 -45
- package/dist/build.js.map +99 -3
- package/dist/cli/index.js +317 -86
- package/dist/client/index.js +1100 -40
- package/dist/client/index.js.map +24 -4
- package/dist/core/streamingSlotRegistrar.js +108 -11
- package/dist/core/streamingSlotRegistrar.js.map +4 -3
- package/dist/core/streamingSlotRegistry.js +169 -7
- package/dist/core/streamingSlotRegistry.js.map +5 -3
- package/dist/index.js +19957 -547
- package/dist/index.js.map +116 -3
- package/dist/islands/browser.js +228 -9
- package/dist/islands/browser.js.map +9 -4
- package/dist/islands/index.js +1908 -17
- package/dist/islands/index.js.map +27 -3
- package/dist/react/browser.js +328 -12
- package/dist/react/browser.js.map +12 -4
- package/dist/react/components/index.js +167 -16
- package/dist/react/components/index.js.map +6 -3
- package/dist/react/hooks/index.js +183 -8
- package/dist/react/hooks/index.js.map +7 -3
- package/dist/react/index.js +3627 -36
- package/dist/react/index.js.map +45 -4
- package/dist/react/jsxDevRuntimeCompat.js +61 -2
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +1789 -18
- package/dist/react/server.js.map +21 -3
- package/dist/src/angular/injectorPatch.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/svelte/browser.js +247 -12
- package/dist/svelte/browser.js.map +10 -3
- package/dist/svelte/index.js +3732 -37
- package/dist/svelte/index.js.map +47 -4
- package/dist/svelte/server.js +2794 -21
- package/dist/svelte/server.js.map +27 -3
- package/dist/vue/browser.js +348 -12
- package/dist/vue/browser.js.map +12 -4
- package/dist/vue/components/Image.js +240 -7
- package/dist/vue/components/Image.js.map +6 -3
- package/dist/vue/components/index.js +544 -11
- package/dist/vue/components/index.js.map +9 -3
- package/dist/vue/index.js +4212 -52
- package/dist/vue/index.js.map +50 -4
- package/dist/vue/server.js +1849 -18
- package/dist/vue/server.js.map +21 -3
- package/package.json +1 -1
- package/dist/chunk-0867j0r0.js +0 -136
- package/dist/chunk-0867j0r0.js.map +0 -10
- package/dist/chunk-0kdc6r16.js +0 -20
- package/dist/chunk-0kdc6r16.js.map +0 -10
- package/dist/chunk-102fp7xe.js +0 -63
- package/dist/chunk-102fp7xe.js.map +0 -10
- package/dist/chunk-11zpfqz6.js +0 -19
- package/dist/chunk-11zpfqz6.js.map +0 -10
- package/dist/chunk-1rfh7hw9.js +0 -319
- package/dist/chunk-1rfh7hw9.js.map +0 -11
- package/dist/chunk-25v9t56f.js +0 -29
- package/dist/chunk-25v9t56f.js.map +0 -11
- package/dist/chunk-2f21eenc.js +0 -21
- package/dist/chunk-2f21eenc.js.map +0 -10
- package/dist/chunk-2ga2znex.js +0 -13
- package/dist/chunk-2ga2znex.js.map +0 -9
- package/dist/chunk-30yrw0f6.js +0 -33
- package/dist/chunk-30yrw0f6.js.map +0 -10
- package/dist/chunk-38jwhqcw.js +0 -4410
- package/dist/chunk-38jwhqcw.js.map +0 -28
- package/dist/chunk-3g91wb4f.js +0 -358
- package/dist/chunk-3g91wb4f.js.map +0 -10
- package/dist/chunk-3yjzpcne.js +0 -34
- package/dist/chunk-3yjzpcne.js.map +0 -10
- package/dist/chunk-41bf6aqt.js +0 -17
- package/dist/chunk-41bf6aqt.js.map +0 -9
- package/dist/chunk-4d39r92n.js +0 -81
- package/dist/chunk-4d39r92n.js.map +0 -10
- package/dist/chunk-5003emhv.js +0 -17
- package/dist/chunk-5003emhv.js.map +0 -10
- package/dist/chunk-5f67rsed.js +0 -466
- package/dist/chunk-5f67rsed.js.map +0 -10
- package/dist/chunk-5fhp1jap.js +0 -9169
- package/dist/chunk-5fhp1jap.js.map +0 -236
- package/dist/chunk-6pdj08z3.js +0 -73
- package/dist/chunk-6pdj08z3.js.map +0 -12
- package/dist/chunk-6qjbrt0k.js +0 -13
- package/dist/chunk-6qjbrt0k.js.map +0 -9
- package/dist/chunk-6sccb4jr.js +0 -14
- package/dist/chunk-6sccb4jr.js.map +0 -9
- package/dist/chunk-798spvzv.js +0 -50
- package/dist/chunk-798spvzv.js.map +0 -10
- package/dist/chunk-7fw6x3js.js +0 -131
- package/dist/chunk-7fw6x3js.js.map +0 -11
- package/dist/chunk-7kjj42xm.js +0 -11
- package/dist/chunk-7kjj42xm.js.map +0 -10
- package/dist/chunk-7mtstdqn.js +0 -90
- package/dist/chunk-7mtstdqn.js.map +0 -10
- package/dist/chunk-851whwc7.js +0 -17
- package/dist/chunk-851whwc7.js.map +0 -10
- package/dist/chunk-85n68sy6.js +0 -103
- package/dist/chunk-85n68sy6.js.map +0 -10
- package/dist/chunk-8kcfffry.js +0 -35
- package/dist/chunk-8kcfffry.js.map +0 -10
- package/dist/chunk-8qqxc1h2.js +0 -426
- package/dist/chunk-8qqxc1h2.js.map +0 -14
- package/dist/chunk-92fsjfpp.js +0 -1731
- package/dist/chunk-92fsjfpp.js.map +0 -11
- package/dist/chunk-93sqk7be.js +0 -139
- package/dist/chunk-93sqk7be.js.map +0 -12
- package/dist/chunk-94gvx0hg.js +0 -28
- package/dist/chunk-94gvx0hg.js.map +0 -10
- package/dist/chunk-9c5tj4k3.js +0 -130
- package/dist/chunk-9c5tj4k3.js.map +0 -10
- package/dist/chunk-9ve9jq72.js +0 -203
- package/dist/chunk-9ve9jq72.js.map +0 -10
- package/dist/chunk-9xrsjeem.js +0 -12
- package/dist/chunk-9xrsjeem.js.map +0 -9
- package/dist/chunk-a9mvyp04.js +0 -87
- package/dist/chunk-a9mvyp04.js.map +0 -10
- package/dist/chunk-b3gbnrwe.js +0 -21
- package/dist/chunk-b3gbnrwe.js.map +0 -10
- package/dist/chunk-bmgqm774.js +0 -65
- package/dist/chunk-bmgqm774.js.map +0 -9
- package/dist/chunk-bxfghpma.js +0 -69
- package/dist/chunk-bxfghpma.js.map +0 -10
- package/dist/chunk-c1jfjnka.js +0 -74
- package/dist/chunk-c1jfjnka.js.map +0 -10
- package/dist/chunk-cbkrwmvh.js +0 -80
- package/dist/chunk-cbkrwmvh.js.map +0 -10
- package/dist/chunk-cdxd7sy2.js +0 -71
- package/dist/chunk-cdxd7sy2.js.map +0 -10
- package/dist/chunk-cg95827x.js +0 -21
- package/dist/chunk-cg95827x.js.map +0 -10
- package/dist/chunk-cm0g4q6w.js +0 -149
- package/dist/chunk-cm0g4q6w.js.map +0 -10
- package/dist/chunk-cwfy538a.js +0 -51
- package/dist/chunk-cwfy538a.js.map +0 -9
- package/dist/chunk-d7mwkzry.js +0 -261
- package/dist/chunk-d7mwkzry.js.map +0 -10
- package/dist/chunk-d8w0qm28.js +0 -184
- package/dist/chunk-d8w0qm28.js.map +0 -11
- package/dist/chunk-d9c0am65.js +0 -12
- package/dist/chunk-d9c0am65.js.map +0 -10
- package/dist/chunk-daqghmg8.js +0 -12
- package/dist/chunk-daqghmg8.js.map +0 -9
- package/dist/chunk-e3r9fxaa.js +0 -149
- package/dist/chunk-e3r9fxaa.js.map +0 -10
- package/dist/chunk-e8eecyrq.js +0 -244
- package/dist/chunk-e8eecyrq.js.map +0 -10
- package/dist/chunk-ex2hxe0v.js +0 -160
- package/dist/chunk-ex2hxe0v.js.map +0 -11
- package/dist/chunk-fak944et.js +0 -91
- package/dist/chunk-fak944et.js.map +0 -10
- package/dist/chunk-ff70rnhd.js +0 -672
- package/dist/chunk-ff70rnhd.js.map +0 -15
- package/dist/chunk-fygx2ymm.js +0 -118
- package/dist/chunk-fygx2ymm.js.map +0 -12
- package/dist/chunk-g15qj669.js +0 -271
- package/dist/chunk-g15qj669.js.map +0 -11
- package/dist/chunk-gd6wmknh.js +0 -121
- package/dist/chunk-gd6wmknh.js.map +0 -11
- package/dist/chunk-gf0ygptk.js +0 -85
- package/dist/chunk-gf0ygptk.js.map +0 -11
- package/dist/chunk-gytkmthr.js +0 -220
- package/dist/chunk-gytkmthr.js.map +0 -10
- package/dist/chunk-h5bbfn3n.js +0 -28
- package/dist/chunk-h5bbfn3n.js.map +0 -11
- package/dist/chunk-h6mye9r3.js +0 -93
- package/dist/chunk-h6mye9r3.js.map +0 -10
- package/dist/chunk-hcsmxw1v.js +0 -85
- package/dist/chunk-hcsmxw1v.js.map +0 -10
- package/dist/chunk-hyjs4bqs.js +0 -8
- package/dist/chunk-hyjs4bqs.js.map +0 -10
- package/dist/chunk-j88z31ep.js +0 -25
- package/dist/chunk-j88z31ep.js.map +0 -10
- package/dist/chunk-jn91vzkh.js +0 -66
- package/dist/chunk-jn91vzkh.js.map +0 -10
- package/dist/chunk-jpkjdgsk.js +0 -167
- package/dist/chunk-jpkjdgsk.js.map +0 -11
- package/dist/chunk-jwxt8gnp.js +0 -13
- package/dist/chunk-jwxt8gnp.js.map +0 -9
- package/dist/chunk-kk8w9rh5.js +0 -195
- package/dist/chunk-kk8w9rh5.js.map +0 -10
- package/dist/chunk-m97ze5hz.js +0 -46
- package/dist/chunk-m97ze5hz.js.map +0 -10
- package/dist/chunk-mbazhahf.js +0 -60
- package/dist/chunk-mbazhahf.js.map +0 -10
- package/dist/chunk-mgfwq18r.js +0 -15
- package/dist/chunk-mgfwq18r.js.map +0 -9
- package/dist/chunk-mtgf69xn.js +0 -88
- package/dist/chunk-mtgf69xn.js.map +0 -10
- package/dist/chunk-mtxzyxpg.js +0 -102
- package/dist/chunk-mtxzyxpg.js.map +0 -10
- package/dist/chunk-nehhtthw.js +0 -225
- package/dist/chunk-nehhtthw.js.map +0 -10
- package/dist/chunk-p5504p14.js +0 -16
- package/dist/chunk-p5504p14.js.map +0 -10
- package/dist/chunk-pnscgw95.js +0 -90
- package/dist/chunk-pnscgw95.js.map +0 -10
- package/dist/chunk-pvpp4pvs.js +0 -17
- package/dist/chunk-pvpp4pvs.js.map +0 -10
- package/dist/chunk-qh75agse.js +0 -95
- package/dist/chunk-qh75agse.js.map +0 -10
- package/dist/chunk-qxq2zcty.js +0 -52
- package/dist/chunk-qxq2zcty.js.map +0 -10
- package/dist/chunk-r6e8pytx.js +0 -22
- package/dist/chunk-r6e8pytx.js.map +0 -9
- package/dist/chunk-r7jmgqnw.js +0 -114
- package/dist/chunk-r7jmgqnw.js.map +0 -10
- package/dist/chunk-s6defjk2.js +0 -116
- package/dist/chunk-s6defjk2.js.map +0 -10
- package/dist/chunk-sd39p726.js +0 -619
- package/dist/chunk-sd39p726.js.map +0 -10
- package/dist/chunk-swrnzs4c.js +0 -63
- package/dist/chunk-swrnzs4c.js.map +0 -10
- package/dist/chunk-tfe3sb44.js +0 -33
- package/dist/chunk-tfe3sb44.js.map +0 -10
- package/dist/chunk-tjr0kcev.js +0 -41
- package/dist/chunk-tjr0kcev.js.map +0 -9
- package/dist/chunk-tx9edm1x.js +0 -34
- package/dist/chunk-tx9edm1x.js.map +0 -10
- package/dist/chunk-txhm2vb5.js +0 -18
- package/dist/chunk-txhm2vb5.js.map +0 -9
- package/dist/chunk-v5vmsxmy.js +0 -526
- package/dist/chunk-v5vmsxmy.js.map +0 -12
- package/dist/chunk-vjhxm8n2.js +0 -29
- package/dist/chunk-vjhxm8n2.js.map +0 -9
- package/dist/chunk-vkrpm7kc.js +0 -247
- package/dist/chunk-vkrpm7kc.js.map +0 -12
- package/dist/chunk-w3m4m5we.js +0 -4925
- package/dist/chunk-w3m4m5we.js.map +0 -12
- package/dist/chunk-wrxtn9ve.js +0 -18
- package/dist/chunk-wrxtn9ve.js.map +0 -10
- package/dist/chunk-wwzvp0zn.js +0 -192
- package/dist/chunk-wwzvp0zn.js.map +0 -10
- package/dist/chunk-x09cskqd.js +0 -377
- package/dist/chunk-x09cskqd.js.map +0 -10
- package/dist/chunk-xnt8c6h2.js +0 -576
- package/dist/chunk-xnt8c6h2.js.map +0 -10
- package/dist/chunk-xw0tx842.js +0 -13
- package/dist/chunk-xw0tx842.js.map +0 -9
- package/dist/chunk-xx5b6b9m.js +0 -69
- package/dist/chunk-xx5b6b9m.js.map +0 -10
- package/dist/chunk-xz1kdswj.js +0 -21
- package/dist/chunk-xz1kdswj.js.map +0 -9
- package/dist/chunk-y84qnsd3.js +0 -32
- package/dist/chunk-y84qnsd3.js.map +0 -10
- package/dist/chunk-ywjn0rad.js +0 -14
- package/dist/chunk-ywjn0rad.js.map +0 -9
- package/dist/chunk-z9nvhm6r.js +0 -13
- package/dist/chunk-z9nvhm6r.js.map +0 -9
- package/dist/chunk-zhmvdpk6.js +0 -15
- package/dist/chunk-zhmvdpk6.js.map +0 -9
- package/dist/chunk-zrg9d4zw.js +0 -784
- package/dist/chunk-zrg9d4zw.js.map +0 -10
package/dist/chunk-kk8w9rh5.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
IMAGE_DEFAULT_DEVICE_SIZES,
|
|
4
|
-
IMAGE_DEFAULT_IMAGE_SIZES,
|
|
5
|
-
IMAGE_DEFAULT_QUALITY,
|
|
6
|
-
IMAGE_GLOB_SUFFIX_LENGTH
|
|
7
|
-
} from "./chunk-qh75agse.js";
|
|
8
|
-
|
|
9
|
-
// src/utils/imageProcessing.ts
|
|
10
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
11
|
-
import { join, resolve } from "path";
|
|
12
|
-
var DEFAULT_DEVICE_SIZES = IMAGE_DEFAULT_DEVICE_SIZES;
|
|
13
|
-
var DEFAULT_IMAGE_SIZES = IMAGE_DEFAULT_IMAGE_SIZES;
|
|
14
|
-
var DEFAULT_QUALITY = IMAGE_DEFAULT_QUALITY;
|
|
15
|
-
var OPTIMIZATION_ENDPOINT = "/_absolute/image";
|
|
16
|
-
var BLUR_DEVIATION = 20;
|
|
17
|
-
var sharpModule = undefined;
|
|
18
|
-
var sharpLoaded = false;
|
|
19
|
-
var sharpWarned = false;
|
|
20
|
-
var snapToSize = (target, sizes) => {
|
|
21
|
-
for (const size of sizes) {
|
|
22
|
-
if (size >= target)
|
|
23
|
-
return size;
|
|
24
|
-
}
|
|
25
|
-
return sizes[sizes.length - 1] ?? target;
|
|
26
|
-
};
|
|
27
|
-
var matchHostname = (actual, pattern) => {
|
|
28
|
-
if (pattern === actual)
|
|
29
|
-
return true;
|
|
30
|
-
if (pattern.startsWith("*.")) {
|
|
31
|
-
const suffix = pattern.slice(1);
|
|
32
|
-
return actual.endsWith(suffix) && actual.length > suffix.length;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
};
|
|
36
|
-
var matchPathname = (actual, pattern) => {
|
|
37
|
-
if (pattern.endsWith("/**")) {
|
|
38
|
-
const prefix = pattern.slice(0, -IMAGE_GLOB_SUFFIX_LENGTH);
|
|
39
|
-
return actual.startsWith(prefix);
|
|
40
|
-
}
|
|
41
|
-
return actual === pattern;
|
|
42
|
-
};
|
|
43
|
-
var MIME_MAP = {
|
|
44
|
-
avif: "image/avif",
|
|
45
|
-
jpeg: "image/jpeg",
|
|
46
|
-
png: "image/png",
|
|
47
|
-
webp: "image/webp"
|
|
48
|
-
};
|
|
49
|
-
var isSharpFactory = (value) => typeof value === "function";
|
|
50
|
-
var callSharp = (sharpRef, input) => {
|
|
51
|
-
if (!isSharpFactory(sharpRef)) {
|
|
52
|
-
throw new Error("Loaded sharp module is not callable.");
|
|
53
|
-
}
|
|
54
|
-
return sharpRef(input);
|
|
55
|
-
};
|
|
56
|
-
var toBuffer = (input) => {
|
|
57
|
-
if (Buffer.isBuffer(input))
|
|
58
|
-
return input;
|
|
59
|
-
return Buffer.from(input);
|
|
60
|
-
};
|
|
61
|
-
var buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;
|
|
62
|
-
var formatToMime = (format) => MIME_MAP[format];
|
|
63
|
-
var generateBlurSvg = (base64Thumbnail) => {
|
|
64
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
|
|
65
|
-
const encoded = encodeURIComponent(svg);
|
|
66
|
-
return `url("data:image/svg+xml,${encoded}")`;
|
|
67
|
-
};
|
|
68
|
-
var generateSrcSet = (src, width, sizes, config, loader) => {
|
|
69
|
-
const quality = config?.quality ?? DEFAULT_QUALITY;
|
|
70
|
-
const basePath = config?.path ?? OPTIMIZATION_ENDPOINT;
|
|
71
|
-
const buildUrl = loader ?? ((params) => buildOptimizedUrl(params.src, params.width, params.quality, basePath));
|
|
72
|
-
if (sizes) {
|
|
73
|
-
const allSizes = getAllSizes(config);
|
|
74
|
-
return allSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
|
|
75
|
-
}
|
|
76
|
-
if (width) {
|
|
77
|
-
const allSizes = getAllSizes(config);
|
|
78
|
-
const w1x = snapToSize(width, allSizes);
|
|
79
|
-
const w2x = snapToSize(width * 2, allSizes);
|
|
80
|
-
return `${buildUrl({ quality, src, width: w1x })} 1x, ${buildUrl({ quality, src, width: w2x })} 2x`;
|
|
81
|
-
}
|
|
82
|
-
const deviceSizes = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
|
|
83
|
-
return deviceSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
|
|
84
|
-
};
|
|
85
|
-
var getAllSizes = (config) => {
|
|
86
|
-
const device = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
|
|
87
|
-
const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
88
|
-
return [...device, ...image].sort((left, right) => left - right);
|
|
89
|
-
};
|
|
90
|
-
var getCacheDir = (buildDir) => {
|
|
91
|
-
const dir = join(buildDir, ".cache", "images");
|
|
92
|
-
if (!existsSync(dir))
|
|
93
|
-
mkdirSync(dir, { recursive: true });
|
|
94
|
-
return dir;
|
|
95
|
-
};
|
|
96
|
-
var getCacheKey = (url, width, quality, format) => {
|
|
97
|
-
const hasher = new Bun.CryptoHasher("sha256");
|
|
98
|
-
hasher.update(`${url}|${width}|${quality}|${format}`);
|
|
99
|
-
return hasher.digest("hex");
|
|
100
|
-
};
|
|
101
|
-
var isCacheStale = (meta) => Date.now() > meta.expireAt;
|
|
102
|
-
var matchRemotePattern = (urlString, patterns) => {
|
|
103
|
-
let parsed;
|
|
104
|
-
try {
|
|
105
|
-
parsed = new URL(urlString);
|
|
106
|
-
} catch {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
return patterns.some((pattern) => {
|
|
110
|
-
if (pattern.protocol && parsed.protocol !== `${pattern.protocol}:`)
|
|
111
|
-
return false;
|
|
112
|
-
if (!matchHostname(parsed.hostname, pattern.hostname))
|
|
113
|
-
return false;
|
|
114
|
-
if (pattern.port && parsed.port !== pattern.port)
|
|
115
|
-
return false;
|
|
116
|
-
if (pattern.pathname && !matchPathname(parsed.pathname, pattern.pathname))
|
|
117
|
-
return false;
|
|
118
|
-
return true;
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
var negotiateFormat = (acceptHeader, configuredFormats) => {
|
|
122
|
-
for (const format of configuredFormats) {
|
|
123
|
-
const mime = MIME_MAP[format];
|
|
124
|
-
if (mime && acceptHeader.includes(mime))
|
|
125
|
-
return format;
|
|
126
|
-
}
|
|
127
|
-
if (configuredFormats.includes("webp") && acceptHeader.includes("image/webp")) {
|
|
128
|
-
return "webp";
|
|
129
|
-
}
|
|
130
|
-
return "jpeg";
|
|
131
|
-
};
|
|
132
|
-
var AVIF_QUALITY_OFFSET = 20;
|
|
133
|
-
var AVIF_EFFORT = 3;
|
|
134
|
-
var optimizeImage = async (buffer, width, quality, format) => {
|
|
135
|
-
const sharp = await tryLoadSharp();
|
|
136
|
-
if (!sharp)
|
|
137
|
-
return toBuffer(buffer);
|
|
138
|
-
const pipeline = callSharp(sharp, toBuffer(buffer)).rotate().resize(width, undefined, { withoutEnlargement: true });
|
|
139
|
-
switch (format) {
|
|
140
|
-
case "avif":
|
|
141
|
-
return pipeline.avif({
|
|
142
|
-
effort: AVIF_EFFORT,
|
|
143
|
-
quality: Math.max(1, quality - AVIF_QUALITY_OFFSET)
|
|
144
|
-
}).toBuffer();
|
|
145
|
-
case "jpeg":
|
|
146
|
-
return pipeline.jpeg({ mozjpeg: true, quality }).toBuffer();
|
|
147
|
-
case "png":
|
|
148
|
-
return pipeline.png({ quality }).toBuffer();
|
|
149
|
-
case "webp":
|
|
150
|
-
return pipeline.webp({ quality }).toBuffer();
|
|
151
|
-
default:
|
|
152
|
-
return toBuffer(buffer);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
var readFromCache = (cacheDir, cacheKey) => {
|
|
156
|
-
const metaPath = join(cacheDir, `${cacheKey}.meta`);
|
|
157
|
-
const dataPath = join(cacheDir, `${cacheKey}.data`);
|
|
158
|
-
if (!existsSync(metaPath) || !existsSync(dataPath))
|
|
159
|
-
return null;
|
|
160
|
-
try {
|
|
161
|
-
const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
|
|
162
|
-
const buffer = readFileSync(dataPath);
|
|
163
|
-
return { buffer, meta };
|
|
164
|
-
} catch {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
var tryLoadSharp = async () => {
|
|
169
|
-
if (sharpLoaded)
|
|
170
|
-
return sharpModule;
|
|
171
|
-
sharpLoaded = true;
|
|
172
|
-
try {
|
|
173
|
-
const sharpPath = resolve(process.cwd(), "node_modules/sharp");
|
|
174
|
-
const mod = await import(sharpPath);
|
|
175
|
-
sharpModule = mod.default ?? mod;
|
|
176
|
-
return sharpModule;
|
|
177
|
-
} catch {
|
|
178
|
-
if (sharpWarned)
|
|
179
|
-
return null;
|
|
180
|
-
sharpWarned = true;
|
|
181
|
-
console.warn("[image] sharp not installed \u2014 serving unoptimized images. Install with: bun add sharp");
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
var writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
186
|
-
const metaPath = join(cacheDir, `${cacheKey}.meta`);
|
|
187
|
-
const dataPath = join(cacheDir, `${cacheKey}.data`);
|
|
188
|
-
writeFileSync(dataPath, buffer);
|
|
189
|
-
writeFileSync(metaPath, JSON.stringify(meta));
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export { DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_ENDPOINT, buildOptimizedUrl, formatToMime, generateBlurSvg, generateSrcSet, getAllSizes, getCacheDir, getCacheKey, isCacheStale, matchRemotePattern, negotiateFormat, optimizeImage, readFromCache, writeToCache };
|
|
193
|
-
|
|
194
|
-
//# debugId=0E6FC26DA6D20EE064756E2164756E21
|
|
195
|
-
//# sourceMappingURL=chunk-kk8w9rh5.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utils/imageProcessing.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport type {\n\tImageConfig,\n\tImageFormat,\n\tRemotePattern\n} from '../../types/image';\nimport {\n\tIMAGE_DEFAULT_DEVICE_SIZES,\n\tIMAGE_DEFAULT_IMAGE_SIZES,\n\tIMAGE_DEFAULT_QUALITY,\n\tIMAGE_GLOB_SUFFIX_LENGTH\n} from '../constants';\n\n// ── Constants ──────────────────────────────────────────────────────\n\nexport const DEFAULT_DEVICE_SIZES = IMAGE_DEFAULT_DEVICE_SIZES;\nexport const DEFAULT_IMAGE_SIZES = IMAGE_DEFAULT_IMAGE_SIZES;\nexport const DEFAULT_QUALITY = IMAGE_DEFAULT_QUALITY;\n\nexport const OPTIMIZATION_ENDPOINT = '/_absolute/image';\n\n// ── Blur Placeholder ───────────────────────────────────────────────\n\nconst BLUR_SIZE = 8;\nconst BLUR_QUALITY = 70;\nconst BLUR_DEVIATION = 20;\n\n// ── Sharp Loading ──────────────────────────────────────────────────\n\nlet sharpModule: unknown = undefined;\nlet sharpLoaded = false;\nlet sharpWarned = false;\n\n// ── Shared Internals ───────────────────────────────────────────────\n\n/** Snap a target width UP to the nearest configured size */\nconst snapToSize = (target: number, sizes: number[]) => {\n\tfor (const size of sizes) {\n\t\tif (size >= target) return size;\n\t}\n\n\treturn sizes[sizes.length - 1] ?? target;\n};\n\n/** Match hostname with wildcard support: \"*.example.com\" matches \"cdn.example.com\" */\nconst matchHostname = (actual: string, pattern: string) => {\n\tif (pattern === actual) return true;\n\n\tif (pattern.startsWith('*.')) {\n\t\tconst suffix = pattern.slice(1); // \".example.com\"\n\n\t\treturn actual.endsWith(suffix) && actual.length > suffix.length;\n\t}\n\n\treturn false;\n};\n\n/** Match pathname with glob prefix: \"/images/**\" matches \"/images/photo.jpg\" */\nconst matchPathname = (actual: string, pattern: string) => {\n\tif (pattern.endsWith('/**')) {\n\t\tconst prefix = pattern.slice(0, -IMAGE_GLOB_SUFFIX_LENGTH);\n\n\t\treturn actual.startsWith(prefix);\n\t}\n\n\treturn actual === pattern;\n};\n\nconst MIME_MAP: Record<ImageFormat, string> = {\n\tavif: 'image/avif',\n\tjpeg: 'image/jpeg',\n\tpng: 'image/png',\n\twebp: 'image/webp'\n};\n\ntype SharpPipeline = {\n\tavif: (options: { effort: number; quality: number }) => SharpPipeline;\n\tjpeg: (options: { mozjpeg?: boolean; quality: number }) => SharpPipeline;\n\tpng: (options: { quality: number }) => SharpPipeline;\n\tresize: (\n\t\twidth: number,\n\t\theight?: number,\n\t\toptions?: { fit?: string; withoutEnlargement?: boolean }\n\t) => SharpPipeline;\n\trotate: () => SharpPipeline;\n\ttoBuffer: () => Promise<Buffer>;\n\twebp: (options: { quality: number }) => SharpPipeline;\n};\n\ntype SharpFactory = (input: Buffer) => SharpPipeline;\n\nconst isSharpFactory = (value: unknown): value is SharpFactory =>\n\ttypeof value === 'function';\n\n/** Convert sharp dynamic import result to a callable factory */\nconst callSharp = (sharpRef: unknown, input: Buffer) => {\n\tif (!isSharpFactory(sharpRef)) {\n\t\tthrow new Error('Loaded sharp module is not callable.');\n\t}\n\n\treturn sharpRef(input);\n};\n\nconst toBuffer = (input: Buffer | ArrayBuffer) => {\n\tif (Buffer.isBuffer(input)) return input;\n\n\treturn Buffer.from(input);\n};\n\n// ── Exports (alphabetically sorted) ────────────────────────────────\n\nexport const buildOptimizedUrl = (\n\tsrc: string,\n\twidth: number,\n\tquality: number,\n\tbasePath = OPTIMIZATION_ENDPOINT\n) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;\n\nexport type CacheMeta = {\n\tcontentType: string;\n\tetag: string;\n\texpireAt: number;\n\tupstreamEtag?: string;\n};\n\nexport const formatToMime = (format: ImageFormat) => MIME_MAP[format];\n\nexport const generateBlurDataURL = async (buffer: Buffer | ArrayBuffer) => {\n\tconst sharp = await tryLoadSharp();\n\n\tif (!sharp) return '';\n\n\tconst tiny: Buffer = await callSharp(sharp, toBuffer(buffer))\n\t\t.resize(BLUR_SIZE, BLUR_SIZE, { fit: 'inside' })\n\t\t.webp({ quality: BLUR_QUALITY })\n\t\t.toBuffer();\n\n\treturn `data:image/webp;base64,${tiny.toString('base64')}`;\n};\n\nexport const generateBlurSvg = (base64Thumbnail: string) => {\n\t// Match Next.js: wrap tiny thumbnail in SVG with Gaussian blur\n\tconst svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 320\"><filter id=\"b\" color-interpolation-filters=\"sRGB\"><feGaussianBlur stdDeviation=\"${BLUR_DEVIATION}\"/><feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1\"/></filter><image filter=\"url(#b)\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" href=\"${base64Thumbnail}\"/></svg>`;\n\n\tconst encoded = encodeURIComponent(svg);\n\n\treturn `url(\"data:image/svg+xml,${encoded}\")`;\n};\n\nexport const generateSrcSet = (\n\tsrc: string,\n\twidth: number | undefined,\n\tsizes: string | undefined,\n\tconfig?: ImageConfig,\n\tloader?: (params: { quality: number; src: string; width: number }) => string\n) => {\n\tconst quality = config?.quality ?? DEFAULT_QUALITY;\n\n\tconst basePath = config?.path ?? OPTIMIZATION_ENDPOINT;\n\n\tconst buildUrl =\n\t\tloader ??\n\t\t((params: { quality: number; src: string; width: number }) =>\n\t\t\tbuildOptimizedUrl(\n\t\t\t\tparams.src,\n\t\t\t\tparams.width,\n\t\t\t\tparams.quality,\n\t\t\t\tbasePath\n\t\t\t));\n\n\tif (sizes) {\n\t\t// With sizes: use all breakpoints with w descriptors\n\t\tconst allSizes = getAllSizes(config);\n\n\t\treturn allSizes\n\t\t\t.map(\n\t\t\t\t(sizeWidth) =>\n\t\t\t\t\t`${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`\n\t\t\t)\n\t\t\t.join(', ');\n\t}\n\n\tif (width) {\n\t\t// Without sizes: generate 1x and 2x density descriptors\n\t\tconst allSizes = getAllSizes(config);\n\n\t\tconst w1x = snapToSize(width, allSizes);\n\n\t\tconst w2x = snapToSize(width * 2, allSizes);\n\n\t\treturn `${buildUrl({ quality, src, width: w1x })} 1x, ${buildUrl({ quality, src, width: w2x })} 2x`;\n\t}\n\n\t// No width or sizes — use device sizes with w descriptors\n\tconst deviceSizes = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;\n\n\treturn deviceSizes\n\t\t.map(\n\t\t\t(sizeWidth) =>\n\t\t\t\t`${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`\n\t\t)\n\t\t.join(', ');\n};\n\nexport const getAllSizes = (config?: ImageConfig) => {\n\tconst device = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;\n\n\tconst image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;\n\n\treturn [...device, ...image].sort((left, right) => left - right);\n};\n\nexport const getCacheDir = (buildDir: string) => {\n\tconst dir = join(buildDir, '.cache', 'images');\n\n\tif (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n\n\treturn dir;\n};\n\nexport const getCacheKey = (\n\turl: string,\n\twidth: number,\n\tquality: number,\n\tformat: string\n) => {\n\tconst hasher = new Bun.CryptoHasher('sha256');\n\n\thasher.update(`${url}|${width}|${quality}|${format}`);\n\n\treturn hasher.digest('hex');\n};\n\nexport const isCacheStale = (meta: CacheMeta) => Date.now() > meta.expireAt;\n\nexport const matchRemotePattern = (\n\turlString: string,\n\tpatterns: RemotePattern[]\n) => {\n\tlet parsed: URL;\n\n\ttry {\n\t\tparsed = new URL(urlString);\n\t} catch {\n\t\treturn false;\n\t}\n\n\treturn patterns.some((pattern) => {\n\t\tif (pattern.protocol && parsed.protocol !== `${pattern.protocol}:`)\n\t\t\treturn false;\n\n\t\tif (!matchHostname(parsed.hostname, pattern.hostname)) return false;\n\n\t\tif (pattern.port && parsed.port !== pattern.port) return false;\n\n\t\tif (\n\t\t\tpattern.pathname &&\n\t\t\t!matchPathname(parsed.pathname, pattern.pathname)\n\t\t)\n\t\t\treturn false;\n\n\t\treturn true;\n\t});\n};\n\nexport const negotiateFormat = (\n\tacceptHeader: string,\n\tconfiguredFormats: ImageFormat[]\n) => {\n\t// Check configured formats in preference order against Accept header\n\tfor (const format of configuredFormats) {\n\t\tconst mime = MIME_MAP[format];\n\n\t\tif (mime && acceptHeader.includes(mime)) return format;\n\t}\n\n\t// Fallback: if webp is configured and accepted, use it\n\tif (\n\t\tconfiguredFormats.includes('webp') &&\n\t\tacceptHeader.includes('image/webp')\n\t) {\n\t\treturn 'webp';\n\t}\n\n\t// Final fallback to jpeg\n\treturn 'jpeg';\n};\n\nconst AVIF_QUALITY_OFFSET = 20;\nconst AVIF_EFFORT = 3;\n\nexport const optimizeImage = async (\n\tbuffer: Buffer | ArrayBuffer,\n\twidth: number,\n\tquality: number,\n\tformat: ImageFormat\n) => {\n\tconst sharp = await tryLoadSharp();\n\n\tif (!sharp) return toBuffer(buffer);\n\n\tconst pipeline = callSharp(sharp, toBuffer(buffer))\n\t\t.rotate()\n\t\t.resize(width, undefined, { withoutEnlargement: true });\n\n\tswitch (format) {\n\t\tcase 'avif':\n\t\t\treturn pipeline\n\t\t\t\t.avif({\n\t\t\t\t\teffort: AVIF_EFFORT,\n\t\t\t\t\tquality: Math.max(1, quality - AVIF_QUALITY_OFFSET)\n\t\t\t\t})\n\t\t\t\t.toBuffer();\n\t\tcase 'jpeg':\n\t\t\treturn pipeline.jpeg({ mozjpeg: true, quality }).toBuffer();\n\t\tcase 'png':\n\t\t\treturn pipeline.png({ quality }).toBuffer();\n\t\tcase 'webp':\n\t\t\treturn pipeline.webp({ quality }).toBuffer();\n\t\tdefault:\n\t\t\treturn toBuffer(buffer);\n\t}\n};\n\nexport const readFromCache = (cacheDir: string, cacheKey: string) => {\n\tconst metaPath = join(cacheDir, `${cacheKey}.meta`);\n\n\tconst dataPath = join(cacheDir, `${cacheKey}.data`);\n\n\tif (!existsSync(metaPath) || !existsSync(dataPath)) return null;\n\n\ttry {\n\t\tconst meta: CacheMeta = JSON.parse(readFileSync(metaPath, 'utf-8'));\n\n\t\tconst buffer = readFileSync(dataPath);\n\n\t\treturn { buffer, meta };\n\t} catch {\n\t\treturn null;\n\t}\n};\n\nexport const tryLoadSharp = async () => {\n\tif (sharpLoaded) return sharpModule;\n\n\tsharpLoaded = true;\n\n\ttry {\n\t\t// Resolve sharp from the user's project root (not from absolutejs source,\n\t\t// which is baked into import.meta paths at bundle time)\n\t\tconst sharpPath = resolve(process.cwd(), 'node_modules/sharp');\n\n\t\tconst mod = await import(sharpPath);\n\n\t\tsharpModule = mod.default ?? mod;\n\n\t\treturn sharpModule;\n\t} catch {\n\t\tif (sharpWarned) return null;\n\n\t\tsharpWarned = true;\n\n\t\tconsole.warn(\n\t\t\t'[image] sharp not installed — serving unoptimized images. Install with: bun add sharp'\n\t\t);\n\n\t\treturn null;\n\t}\n};\n\nexport const writeToCache = (\n\tcacheDir: string,\n\tcacheKey: string,\n\tbuffer: Buffer,\n\tmeta: CacheMeta\n) => {\n\tconst metaPath = join(cacheDir, `${cacheKey}.meta`);\n\n\tconst dataPath = join(cacheDir, `${cacheKey}.data`);\n\n\twriteFileSync(dataPath, buffer);\n\n\twriteFileSync(metaPath, JSON.stringify(meta));\n};\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;AAAA;AACA;AAeO,IAAM,uBAAuB;AAC7B,IAAM,sBAAsB;AAC5B,IAAM,kBAAkB;AAExB,IAAM,wBAAwB;AAMrC,IAAM,iBAAiB;AAIvB,IAAI,cAAuB;AAC3B,IAAI,cAAc;AAClB,IAAI,cAAc;AAKlB,IAAM,aAAa,CAAC,QAAgB,UAAoB;AAAA,EACvD,WAAW,QAAQ,OAAO;AAAA,IACzB,IAAI,QAAQ;AAAA,MAAQ,OAAO;AAAA,EAC5B;AAAA,EAEA,OAAO,MAAM,MAAM,SAAS,MAAM;AAAA;AAInC,IAAM,gBAAgB,CAAC,QAAgB,YAAoB;AAAA,EAC1D,IAAI,YAAY;AAAA,IAAQ,OAAO;AAAA,EAE/B,IAAI,QAAQ,WAAW,IAAI,GAAG;AAAA,IAC7B,MAAM,SAAS,QAAQ,MAAM,CAAC;AAAA,IAE9B,OAAO,OAAO,SAAS,MAAM,KAAK,OAAO,SAAS,OAAO;AAAA,EAC1D;AAAA,EAEA,OAAO;AAAA;AAIR,IAAM,gBAAgB,CAAC,QAAgB,YAAoB;AAAA,EAC1D,IAAI,QAAQ,SAAS,KAAK,GAAG;AAAA,IAC5B,MAAM,SAAS,QAAQ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FC26DA6D20EE064756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/chunk-m97ze5hz.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/angular/resolveAngularPackage.ts
|
|
3
|
-
import { existsSync, readFileSync } from "fs";
|
|
4
|
-
import { join, resolve } from "path";
|
|
5
|
-
var resolveAngularPackageDir = (specifier) => {
|
|
6
|
-
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
7
|
-
if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
|
|
8
|
-
return fromCompiledRuntime;
|
|
9
|
-
}
|
|
10
|
-
const fromProject = resolve(process.cwd(), "node_modules", specifier);
|
|
11
|
-
if (existsSync(fromProject)) {
|
|
12
|
-
return fromProject;
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
};
|
|
16
|
-
var resolvePackageEntry = (packageDir) => {
|
|
17
|
-
try {
|
|
18
|
-
const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
|
|
19
|
-
const rootExport = pkg.exports?.["."];
|
|
20
|
-
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
21
|
-
return join(packageDir, entry);
|
|
22
|
-
} catch {
|
|
23
|
-
return packageDir;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var resolveAngularPackage = (specifier) => {
|
|
27
|
-
const packageDir = resolveAngularPackageDir(specifier);
|
|
28
|
-
if (packageDir)
|
|
29
|
-
return resolvePackageEntry(packageDir);
|
|
30
|
-
return specifier;
|
|
31
|
-
};
|
|
32
|
-
var toSafeVendorName = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_");
|
|
33
|
-
var resolveAngularRuntimePath = (specifier) => {
|
|
34
|
-
const buildDir = process.env.ABSOLUTE_BUILD_DIR;
|
|
35
|
-
if (buildDir) {
|
|
36
|
-
const vendorPath = join(buildDir, "angular", "vendor", "server", `${toSafeVendorName(specifier)}.js`);
|
|
37
|
-
if (existsSync(vendorPath))
|
|
38
|
-
return vendorPath;
|
|
39
|
-
}
|
|
40
|
-
return resolveAngularPackage(specifier);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export { resolveAngularRuntimePath };
|
|
44
|
-
|
|
45
|
-
//# debugId=962497DD515683EC64756E2164756E21
|
|
46
|
-
//# sourceMappingURL=chunk-m97ze5hz.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/angular/resolveAngularPackage.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 buildDir = process.env.ABSOLUTE_BUILD_DIR;\n\tif (buildDir) {\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
|
-
],
|
|
7
|
-
"mappings": ";;AAAA;AACA;AASO,IAAM,2BAA2B,CAAC,cAAsB;AAAA,EAC9D,MAAM,sBAAsB,QAAQ,IAAI,qBACrC,QAAQ,QAAQ,IAAI,oBAAoB,gBAAgB,SAAS,IACjE;AAAA,EACH,IAAI,uBAAuB,WAAW,mBAAmB,GAAG;AAAA,IAC3D,OAAO;AAAA,EACR;AAAA,EAEA,MAAM,cAAc,QAAQ,QAAQ,IAAI,GAAG,gBAAgB,SAAS;AAAA,EAEpE,IAAI,WAAW,WAAW,GAAG;AAAA,IAC5B,OAAO;AAAA,EACR;AAAA,EAEA,OAAO;AAAA;AAGR,IAAM,sBAAsB,CAAC,eAAuB;AAAA,EACnD,IAAI;AAAA,IACH,MAAM,MAAM,KAAK,MAChB,aAAa,KAAK,YAAY,cAAc,GAAG,OAAO,CACvD;AAAA,IACA,MAAM,aAAa,IAAI,UAAU;AAAA,IACjC,MAAM,SACJ,OAAO,eAAe,WACpB,aACA,YAAY,YACf,IAAI,UACJ,IAAI,QACJ;AAAA,IAED,OAAO,KAAK,YAAY,KAAK;AAAA,IAC5B,MAAM;AAAA,IACP,OAAO;AAAA;AAAA;AAIF,IAAM,wBAAwB,CAAC,cAAsB;AAAA,EAC3D,MAAM,aAAa,yBAAyB,SAAS;AAAA,EACrD,IAAI;AAAA,IAAY,OAAO,oBAAoB,UAAU;AAAA,EAErD,OAAO;AAAA;AAGR,IAAM,mBAAmB,CAAC,cACzB,UAAU,QAAQ,MAAM,EAAE,EAAE,QAAQ,OAAO,GAAG;AAWxC,IAAM,4BAA4B,CAAC,cAAsB;AAAA,EAC/D,MAAM,WAAW,QAAQ,IAAI;AAAA,EAC7B,IAAI,UAAU;AAAA,IACb,MAAM,aAAa,KAClB,UACA,WACA,UACA,UACA,GAAG,iBAAiB,SAAS,MAC9B;AAAA,IACA,IAAI,WAAW,UAAU;AAAA,MAAG,OAAO;AAAA,EACpC;AAAA,EAEA,OAAO,sBAAsB,SAAS;AAAA;",
|
|
8
|
-
"debugId": "962497DD515683EC64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/chunk-mbazhahf.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/build/resolvePackageImport.ts
|
|
3
|
-
import { resolve, join } from "path";
|
|
4
|
-
import { existsSync, readFileSync } from "fs";
|
|
5
|
-
var resolveExportPath = (entry, conditions) => {
|
|
6
|
-
if (typeof entry === "string")
|
|
7
|
-
return entry;
|
|
8
|
-
if (!entry || typeof entry !== "object")
|
|
9
|
-
return null;
|
|
10
|
-
for (const condition of conditions) {
|
|
11
|
-
const target = Reflect.get(entry, condition);
|
|
12
|
-
if (typeof target === "string") {
|
|
13
|
-
return target;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return null;
|
|
17
|
-
};
|
|
18
|
-
var resolvePackageImport = (specifier, conditions = ["import"]) => {
|
|
19
|
-
if (specifier.startsWith(".") || specifier.startsWith("/"))
|
|
20
|
-
return null;
|
|
21
|
-
const parts = specifier.split("/");
|
|
22
|
-
const isScoped = specifier.startsWith("@");
|
|
23
|
-
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
24
|
-
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
25
|
-
const exportKey = subpath ? `./${subpath}` : ".";
|
|
26
|
-
const currentPackageJsonPath = resolve(process.cwd(), "package.json");
|
|
27
|
-
const currentPackageJson = existsSync(currentPackageJsonPath) ? JSON.parse(readFileSync(currentPackageJsonPath, "utf-8")) : null;
|
|
28
|
-
const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
|
|
29
|
-
const packageDir = currentPackageDir ?? resolve(process.cwd(), "node_modules", packageName ?? "");
|
|
30
|
-
const packageJsonPath = join(packageDir, "package.json");
|
|
31
|
-
if (!existsSync(packageJsonPath))
|
|
32
|
-
return null;
|
|
33
|
-
try {
|
|
34
|
-
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
35
|
-
const { exports } = packageJson;
|
|
36
|
-
if (!exports)
|
|
37
|
-
return null;
|
|
38
|
-
const entry = exports[exportKey];
|
|
39
|
-
if (!entry)
|
|
40
|
-
return null;
|
|
41
|
-
const importPath = resolveExportPath(entry, conditions);
|
|
42
|
-
if (!importPath)
|
|
43
|
-
return null;
|
|
44
|
-
if (currentPackageDir && importPath.startsWith("./dist/")) {
|
|
45
|
-
const sourceCandidate = resolve(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
|
|
46
|
-
if (existsSync(sourceCandidate)) {
|
|
47
|
-
return sourceCandidate;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const resolved = resolve(packageDir, importPath);
|
|
51
|
-
return existsSync(resolved) ? resolved : null;
|
|
52
|
-
} catch {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export { resolvePackageImport };
|
|
58
|
-
|
|
59
|
-
//# debugId=A916F1CE5206C7E864756E2164756E21
|
|
60
|
-
//# sourceMappingURL=chunk-mbazhahf.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/build/resolvePackageImport.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { resolve, join } from 'node:path';\nimport { existsSync, readFileSync } from 'node:fs';\n\n/**\n * Resolve a bare module import (e.g. \"@absolutejs/absolute/svelte/components/Image.svelte\")\n * to an absolute file path by reading the package's exports map in package.json.\n *\n * Returns the resolved absolute path, or null if the import can't be resolved.\n */\ntype ExportConditions = 'browser' | 'import';\n\nconst resolveExportPath = (\n\tentry: unknown,\n\tconditions: ExportConditions[]\n) => {\n\tif (typeof entry === 'string') return entry;\n\tif (!entry || typeof entry !== 'object') return null;\n\n\tfor (const condition of conditions) {\n\t\tconst target = Reflect.get(entry, condition);\n\t\tif (typeof target === 'string') {\n\t\t\treturn target;\n\t\t}\n\t}\n\n\treturn null;\n};\n\nexport const resolvePackageImport = (\n\tspecifier: string,\n\tconditions: ExportConditions[] = ['import']\n) => {\n\t// Only handle bare module imports (not relative or absolute paths)\n\tif (specifier.startsWith('.') || specifier.startsWith('/')) return null;\n\n\t// Split into package name and subpath\n\tconst parts = specifier.split('/');\n\tconst isScoped = specifier.startsWith('@');\n\tconst packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];\n\tconst subpath = isScoped ? parts.slice(2).join('/') : parts.slice(1).join('/');\n\tconst exportKey = subpath ? `./${subpath}` : '.';\n\n\tconst currentPackageJsonPath = resolve(process.cwd(), 'package.json');\n\tconst currentPackageJson = existsSync(currentPackageJsonPath)\n\t\t? JSON.parse(readFileSync(currentPackageJsonPath, 'utf-8'))\n\t\t: null;\n\tconst currentPackageDir =\n\t\tcurrentPackageJson?.name === packageName ? process.cwd() : null;\n\tconst packageDir =\n\t\tcurrentPackageDir ?? resolve(process.cwd(), 'node_modules', packageName ?? '');\n\tconst packageJsonPath = join(packageDir, 'package.json');\n\n\tif (!existsSync(packageJsonPath)) return null;\n\n\ttry {\n\t\tconst packageJson =\n\t\t\tcurrentPackageDir && currentPackageJson\n\t\t\t\t? currentPackageJson\n\t\t\t\t: JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\tconst {exports} = packageJson;\n\n\t\tif (!exports) return null;\n\n\t\t// Try exact match first, then try without extension for .svelte/.vue files\n\t\tconst entry = exports[exportKey];\n\n\t\tif (!entry) return null;\n\n\t\tconst importPath = resolveExportPath(entry, conditions);\n\n\t\tif (!importPath) return null;\n\n\t\tif (currentPackageDir && importPath.startsWith('./dist/')) {\n\t\t\tconst sourceCandidate = resolve(\n\t\t\t\tpackageDir,\n\t\t\t\timportPath.replace(/^\\.\\/dist\\//, './src/')\n\t\t\t);\n\t\t\tif (existsSync(sourceCandidate)) {\n\t\t\t\treturn sourceCandidate;\n\t\t\t}\n\t\t}\n\n\t\tconst resolved = resolve(packageDir, importPath);\n\n\t\treturn existsSync(resolved) ? resolved : null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;AAAA;AACA;AAUA,IAAM,oBAAoB,CACzB,OACA,eACI;AAAA,EACJ,IAAI,OAAO,UAAU;AAAA,IAAU,OAAO;AAAA,EACtC,IAAI,CAAC,SAAS,OAAO,UAAU;AAAA,IAAU,OAAO;AAAA,EAEhD,WAAW,aAAa,YAAY;AAAA,IACnC,MAAM,SAAS,QAAQ,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B,OAAO,UAAU;AAAA,IAEtD,IAAI,CAAC;AAAA,MAAY,OAAO;AAAA,IAExB,IAAI,qBAAqB,WAAW,WAAW,SAAS,GAAG;AAAA,MAC1D,MAAM,kBAAkB,QACvB,YACA,WAAW,QAAQ,eAAe,QAAQ,CAC3C;AAAA,MACA,IAAI,WAAW,eAAe,GAAG;AAAA,QAChC,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IAEA,MAAM,WAAW,QAAQ,YAAY,UAAU;AAAA,IAE/C,OAAO,WAAW,QAAQ,IAAI,WAAW;AAAA,IACxC,MAAM;AAAA,IACP,OAAO;AAAA;AAAA;",
|
|
8
|
-
"debugId": "A916F1CE5206C7E864756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
package/dist/chunk-mgfwq18r.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
devtoolsJson,
|
|
4
|
-
normalizeDevtoolsWorkspaceRoot,
|
|
5
|
-
resolveDevtoolsUuidCachePath
|
|
6
|
-
} from "./chunk-xx5b6b9m.js";
|
|
7
|
-
import"./chunk-bmgqm774.js";
|
|
8
|
-
export {
|
|
9
|
-
resolveDevtoolsUuidCachePath,
|
|
10
|
-
normalizeDevtoolsWorkspaceRoot,
|
|
11
|
-
devtoolsJson
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//# debugId=1D1F01D69CD9200664756E2164756E21
|
|
15
|
-
//# sourceMappingURL=chunk-mgfwq18r.js.map
|
package/dist/chunk-mtgf69xn.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/core/devRouteRegistrationCallsite.ts
|
|
3
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
4
|
-
import { Elysia } from "elysia";
|
|
5
|
-
var ROUTE_CALLSITE_STORAGE_KEY = Symbol.for("absolutejs.devRouteRegistrationCallsiteStorage");
|
|
6
|
-
var ROUTE_CALLSITE_PATCHED_KEY = Symbol.for("absolutejs.devRouteRegistrationCallsitePatched");
|
|
7
|
-
var ROUTE_METHOD_NAMES = [
|
|
8
|
-
"all",
|
|
9
|
-
"delete",
|
|
10
|
-
"get",
|
|
11
|
-
"head",
|
|
12
|
-
"options",
|
|
13
|
-
"patch",
|
|
14
|
-
"post",
|
|
15
|
-
"put"
|
|
16
|
-
];
|
|
17
|
-
var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
|
|
18
|
-
var isAsyncLocalStorage = (value) => isObjectRecord(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
19
|
-
var isRouteMethod = (value) => typeof value === "function";
|
|
20
|
-
var getRouteCallsiteStorage = () => {
|
|
21
|
-
const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
|
|
22
|
-
if (value === null || typeof value === "undefined") {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
return isAsyncLocalStorage(value) ? value : undefined;
|
|
26
|
-
};
|
|
27
|
-
var ensureRouteCallsiteStorage = () => {
|
|
28
|
-
const existing = getRouteCallsiteStorage();
|
|
29
|
-
if (existing) {
|
|
30
|
-
return existing;
|
|
31
|
-
}
|
|
32
|
-
const storage = new AsyncLocalStorage;
|
|
33
|
-
Reflect.set(globalThis, ROUTE_CALLSITE_STORAGE_KEY, storage);
|
|
34
|
-
return storage;
|
|
35
|
-
};
|
|
36
|
-
var normalizeCallsitePath = (value) => value.replace(`${process.cwd()}/`, "").replace(process.cwd(), "").replace(/^\.\/+/, "");
|
|
37
|
-
var shouldIgnoreRouteCallsiteFrame = (frame) => frame.includes("/node_modules/") || frame.includes("/dist/") || frame.includes("/src/core/devRouteRegistrationCallsite.");
|
|
38
|
-
var getRouteCallsiteLocation = (frame) => frame.match(/\((\/[^)]+:\d+:\d+)\)$/)?.[1] ?? frame.match(/at (\/[^ ]+:\d+:\d+)$/)?.[1];
|
|
39
|
-
var extractRouteRegistrationCallsite = (stack) => {
|
|
40
|
-
const location = stack.split(`
|
|
41
|
-
`).slice(1).map((line) => line.trim()).filter((frame) => !shouldIgnoreRouteCallsiteFrame(frame)).map((frame) => getRouteCallsiteLocation(frame)).find((frameLocation) => frameLocation !== undefined);
|
|
42
|
-
return location ? normalizeCallsitePath(location) : undefined;
|
|
43
|
-
};
|
|
44
|
-
var captureRouteRegistrationCallsite = () => {
|
|
45
|
-
const { stack } = new Error;
|
|
46
|
-
if (!stack) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
return extractRouteRegistrationCallsite(stack);
|
|
50
|
-
};
|
|
51
|
-
var wrapRouteHandlerWithCallsite = (handler, callsite) => {
|
|
52
|
-
if (typeof handler !== "function" || !callsite) {
|
|
53
|
-
return handler;
|
|
54
|
-
}
|
|
55
|
-
const storage = ensureRouteCallsiteStorage();
|
|
56
|
-
const routeHandler = handler;
|
|
57
|
-
return function wrappedRouteHandler(...args) {
|
|
58
|
-
return storage.run({ callsite }, () => Reflect.apply(routeHandler, this, args));
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
var createPatchedRouteMethod = (originalMethod) => function patchedRouteMethod(path, handler, ...rest) {
|
|
62
|
-
const callsite = captureRouteRegistrationCallsite();
|
|
63
|
-
return Reflect.apply(originalMethod, this, [
|
|
64
|
-
path,
|
|
65
|
-
wrapRouteHandlerWithCallsite(handler, callsite),
|
|
66
|
-
...rest
|
|
67
|
-
]);
|
|
68
|
-
};
|
|
69
|
-
var getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite;
|
|
70
|
-
var patchElysiaRouteRegistrationCallsites = () => {
|
|
71
|
-
if (false) {}
|
|
72
|
-
if (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const { prototype } = Elysia;
|
|
76
|
-
ROUTE_METHOD_NAMES.forEach((methodName) => {
|
|
77
|
-
const originalMethod = Reflect.get(prototype, methodName);
|
|
78
|
-
if (!isRouteMethod(originalMethod))
|
|
79
|
-
return;
|
|
80
|
-
Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod));
|
|
81
|
-
});
|
|
82
|
-
Reflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export { getCurrentRouteRegistrationCallsite, patchElysiaRouteRegistrationCallsites };
|
|
86
|
-
|
|
87
|
-
//# debugId=4B6B614F7C6043D164756E2164756E21
|
|
88
|
-
//# sourceMappingURL=chunk-mtgf69xn.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/core/devRouteRegistrationCallsite.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { AsyncLocalStorage } from 'node:async_hooks';\nimport { Elysia } from 'elysia';\n\ntype RouteCallsiteStore = { callsite?: string };\ntype RouteCallsiteStorage = AsyncLocalStorage<RouteCallsiteStore>;\ntype RouteMethod = (this: unknown, ...args: unknown[]) => unknown;\n\nconst ROUTE_CALLSITE_STORAGE_KEY = Symbol.for(\n\t'absolutejs.devRouteRegistrationCallsiteStorage'\n);\nconst ROUTE_CALLSITE_PATCHED_KEY = Symbol.for(\n\t'absolutejs.devRouteRegistrationCallsitePatched'\n);\n\nconst ROUTE_METHOD_NAMES = [\n\t'all',\n\t'delete',\n\t'get',\n\t'head',\n\t'options',\n\t'patch',\n\t'post',\n\t'put'\n] as const;\n\nconst isObjectRecord = (value: unknown): value is Record<string, unknown> =>\n\tBoolean(value) && typeof value === 'object';\n\nconst isAsyncLocalStorage = (value: unknown): value is RouteCallsiteStorage =>\n\tisObjectRecord(value) &&\n\t'getStore' in value &&\n\ttypeof value.getStore === 'function' &&\n\t'run' in value &&\n\ttypeof value.run === 'function';\n\nconst isRouteMethod = (value: unknown): value is RouteMethod =>\n\ttypeof value === 'function';\n\nconst getRouteCallsiteStorage = () => {\n\tconst value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);\n\tif (value === null || typeof value === 'undefined') {\n\t\treturn undefined;\n\t}\n\n\treturn isAsyncLocalStorage(value) ? value : undefined;\n};\n\nconst ensureRouteCallsiteStorage = () => {\n\tconst existing = getRouteCallsiteStorage();\n\tif (existing) {\n\t\treturn existing;\n\t}\n\n\tconst storage = new AsyncLocalStorage<RouteCallsiteStore>();\n\tReflect.set(globalThis, ROUTE_CALLSITE_STORAGE_KEY, storage);\n\n\treturn storage;\n};\n\nconst normalizeCallsitePath = (value: string) =>\n\tvalue\n\t\t.replace(`${process.cwd()}/`, '')\n\t\t.replace(process.cwd(), '')\n\t\t.replace(/^\\.\\/+/, '');\n\nconst shouldIgnoreRouteCallsiteFrame = (frame: string) =>\n\tframe.includes('/node_modules/') ||\n\tframe.includes('/dist/') ||\n\tframe.includes('/src/core/devRouteRegistrationCallsite.');\n\nconst getRouteCallsiteLocation = (frame: string) =>\n\tframe.match(/\\((\\/[^)]+:\\d+:\\d+)\\)$/)?.[1] ??\n\tframe.match(/at (\\/[^ ]+:\\d+:\\d+)$/)?.[1];\n\nconst extractRouteRegistrationCallsite = (stack: string) => {\n\tconst location = stack\n\t\t.split('\\n')\n\t\t.slice(1)\n\t\t.map((line) => line.trim())\n\t\t.filter((frame) => !shouldIgnoreRouteCallsiteFrame(frame))\n\t\t.map((frame) => getRouteCallsiteLocation(frame))\n\t\t.find((frameLocation) => frameLocation !== undefined);\n\n\treturn location ? normalizeCallsitePath(location) : undefined;\n};\n\nconst captureRouteRegistrationCallsite = () => {\n\tconst { stack } = new Error();\n\tif (!stack) {\n\t\treturn undefined;\n\t}\n\n\treturn extractRouteRegistrationCallsite(stack);\n};\n\nconst wrapRouteHandlerWithCallsite = (handler: unknown, callsite?: string) => {\n\tif (typeof handler !== 'function' || !callsite) {\n\t\treturn handler;\n\t}\n\n\tconst storage = ensureRouteCallsiteStorage();\n\tconst routeHandler = handler;\n\n\treturn function wrappedRouteHandler(this: unknown, ...args: unknown[]) {\n\t\treturn storage.run({ callsite }, () =>\n\t\t\tReflect.apply(routeHandler, this, args)\n\t\t);\n\t};\n};\n\nconst createPatchedRouteMethod = (originalMethod: RouteMethod) =>\n\tfunction patchedRouteMethod(\n\t\tthis: unknown,\n\t\tpath: unknown,\n\t\thandler: unknown,\n\t\t...rest: unknown[]\n\t) {\n\t\tconst callsite = captureRouteRegistrationCallsite();\n\n\t\treturn Reflect.apply(originalMethod, this, [\n\t\t\tpath,\n\t\t\twrapRouteHandlerWithCallsite(handler, callsite),\n\t\t\t...rest\n\t\t]);\n\t};\n\nexport const getCurrentRouteRegistrationCallsite = () =>\n\tgetRouteCallsiteStorage()?.getStore()?.callsite;\nexport const patchElysiaRouteRegistrationCallsites = () => {\n\tif (process.env.NODE_ENV === 'production') {\n\t\treturn;\n\t}\n\n\tif (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {\n\t\treturn;\n\t}\n\n\tconst { prototype } = Elysia;\n\tROUTE_METHOD_NAMES.forEach((methodName) => {\n\t\tconst originalMethod = Reflect.get(prototype, methodName);\n\t\tif (!isRouteMethod(originalMethod)) return;\n\t\tReflect.set(\n\t\t\tprototype,\n\t\t\tmethodName,\n\t\t\tcreatePatchedRouteMethod(originalMethod)\n\t\t);\n\t});\n\n\tReflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);\n};\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;AAAA;AACA;AAMA,IAAM,6BAA6B,OAAO,IACzC,gDACD;AACA,IAAM,6BAA6B,OAAO,IACzC,gDACD;AAEA,IAAM,qBAAqB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAM,iBAAiB,CAAC,UACvB,QAAQ,KAAK,KAAK,OAAO,UAAU;AAEpC,IAAM,sBAAsB,CAAC,UAC5B,eAAe,KAAK,MACpB,cAAc,UACd,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dist/chunk-mtxzyxpg.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
normalizePath
|
|
4
|
-
} from "./chunk-hyjs4bqs.js";
|
|
5
|
-
import {
|
|
6
|
-
logWarn
|
|
7
|
-
} from "./chunk-cbkrwmvh.js";
|
|
8
|
-
import {
|
|
9
|
-
toPascal
|
|
10
|
-
} from "./chunk-p5504p14.js";
|
|
11
|
-
import {
|
|
12
|
-
UNFOUND_INDEX
|
|
13
|
-
} from "./chunk-qh75agse.js";
|
|
14
|
-
import {
|
|
15
|
-
getIslandManifestKey
|
|
16
|
-
} from "./chunk-3yjzpcne.js";
|
|
17
|
-
|
|
18
|
-
// src/build/generateManifest.ts
|
|
19
|
-
import { extname } from "path";
|
|
20
|
-
var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular) => {
|
|
21
|
-
if (folder === "indexes")
|
|
22
|
-
return `${pascalName}Index`;
|
|
23
|
-
if (isClientComponent)
|
|
24
|
-
return `${pascalName}Client`;
|
|
25
|
-
if (folder !== "pages")
|
|
26
|
-
return pascalName;
|
|
27
|
-
if (isReact)
|
|
28
|
-
return `${pascalName}Page`;
|
|
29
|
-
if (isVue || isSvelte || isAngular)
|
|
30
|
-
return pascalName;
|
|
31
|
-
return `${pascalName}Page`;
|
|
32
|
-
};
|
|
33
|
-
var getCssKey = (pascalName, segments) => {
|
|
34
|
-
const isFromVue = segments.some((seg) => seg === "vue");
|
|
35
|
-
if (isFromVue && segments.includes("css"))
|
|
36
|
-
return `${pascalName}CompiledCSS`;
|
|
37
|
-
const isFromReact = segments.some((seg) => seg === "react");
|
|
38
|
-
const isFromSvelte = segments.some((seg) => seg === "svelte");
|
|
39
|
-
const isFromAngular = segments.some((seg) => seg === "angular");
|
|
40
|
-
if (isFromReact || isFromVue || isFromSvelte || isFromAngular)
|
|
41
|
-
return `${pascalName}BundledCSS`;
|
|
42
|
-
return `${pascalName}CSS`;
|
|
43
|
-
};
|
|
44
|
-
var getArtifactBaseName = (fileName, hash) => {
|
|
45
|
-
const ext = extname(fileName);
|
|
46
|
-
const stem = ext ? fileName.slice(0, -ext.length) : fileName;
|
|
47
|
-
if (!hash)
|
|
48
|
-
return stem;
|
|
49
|
-
const hashSuffix = `.${hash}`;
|
|
50
|
-
if (stem.endsWith(hashSuffix))
|
|
51
|
-
return stem.slice(0, -hashSuffix.length);
|
|
52
|
-
return stem;
|
|
53
|
-
};
|
|
54
|
-
var generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
|
|
55
|
-
const normalizedArtifactPath = normalizePath(artifact.path);
|
|
56
|
-
const normalizedBuildPath = normalizePath(buildPath);
|
|
57
|
-
let relative = normalizedArtifactPath.startsWith(normalizedBuildPath) ? normalizedArtifactPath.slice(normalizedBuildPath.length) : normalizedArtifactPath;
|
|
58
|
-
relative = relative.replace(/^\/+/, "");
|
|
59
|
-
const segments = relative.split("/");
|
|
60
|
-
const fileWithHash = segments.pop();
|
|
61
|
-
if (!fileWithHash)
|
|
62
|
-
return manifest;
|
|
63
|
-
const baseName = getArtifactBaseName(fileWithHash, artifact.hash);
|
|
64
|
-
if (!baseName)
|
|
65
|
-
return manifest;
|
|
66
|
-
const pascalName = toPascal(baseName);
|
|
67
|
-
const ext = extname(fileWithHash);
|
|
68
|
-
const islandIndex = segments.findIndex((seg) => seg === "islands");
|
|
69
|
-
if (ext === ".css") {
|
|
70
|
-
if (segments.includes("server"))
|
|
71
|
-
return manifest;
|
|
72
|
-
const cssKey = getCssKey(pascalName, segments);
|
|
73
|
-
if (manifest[cssKey] && manifest[cssKey] !== `/${relative}`)
|
|
74
|
-
logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${relative}". Use unique page names across frameworks.`);
|
|
75
|
-
manifest[cssKey] = `/${relative}`;
|
|
76
|
-
return manifest;
|
|
77
|
-
}
|
|
78
|
-
const frameworkSegment = islandIndex > UNFOUND_INDEX ? segments[islandIndex + 1] : undefined;
|
|
79
|
-
if (frameworkSegment === "react" || frameworkSegment === "svelte" || frameworkSegment === "vue" || frameworkSegment === "angular") {
|
|
80
|
-
const manifestKey2 = getIslandManifestKey(frameworkSegment, pascalName);
|
|
81
|
-
manifest[manifestKey2] = `/${relative}`;
|
|
82
|
-
return manifest;
|
|
83
|
-
}
|
|
84
|
-
const idx = segments.findIndex((seg) => seg === "indexes" || seg === "pages" || seg === "client");
|
|
85
|
-
const folder = idx > UNFOUND_INDEX ? segments[idx] : segments[0];
|
|
86
|
-
const isReact = segments.some((seg) => seg === "react");
|
|
87
|
-
const isVue = segments.some((seg) => seg === "vue");
|
|
88
|
-
const isSvelte = segments.some((seg) => seg === "svelte");
|
|
89
|
-
const isAngular = segments.some((seg) => seg === "angular");
|
|
90
|
-
const isClientComponent = segments.includes("client");
|
|
91
|
-
const manifestKey = getManifestKey(folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular);
|
|
92
|
-
if (manifest[manifestKey] && manifest[manifestKey] !== `/${relative}`) {
|
|
93
|
-
logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${relative}". Use unique page names across frameworks.`);
|
|
94
|
-
}
|
|
95
|
-
manifest[manifestKey] = `/${relative}`;
|
|
96
|
-
return manifest;
|
|
97
|
-
}, {});
|
|
98
|
-
|
|
99
|
-
export { generateManifest };
|
|
100
|
-
|
|
101
|
-
//# debugId=0A117CCD4566069A64756E2164756E21
|
|
102
|
-
//# sourceMappingURL=chunk-mtxzyxpg.js.map
|