@absolutejs/absolute 0.19.0-beta.190 → 0.19.0-beta.191
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/ROADMAP.md +0 -22
- package/dist/react/components/index.js +605 -0
- package/dist/react/components/index.js.map +13 -0
- package/dist/{src/vue → vue}/components/index.js +1 -1
- package/package.json +2 -2
- package/scripts/build.ts +157 -0
- /package/dist/{src/angular → angular}/components/index.js +0 -0
- /package/dist/{src/angular → angular}/components/index.js.map +0 -0
- /package/dist/{src/angular → angular}/index.js +0 -0
- /package/dist/{src/angular → angular}/index.js.map +0 -0
- /package/dist/{src/build.js → build.js} +0 -0
- /package/dist/{src/build.js.map → build.js.map} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/index.js.map → index.js.map} +0 -0
- /package/dist/{src/react → react}/hooks/index.js +0 -0
- /package/dist/{src/react → react}/hooks/index.js.map +0 -0
- /package/dist/{src/react → react}/index.js +0 -0
- /package/dist/{src/react → react}/index.js.map +0 -0
- /package/dist/{src/svelte → svelte}/index.js +0 -0
- /package/dist/{src/svelte → svelte}/index.js.map +0 -0
- /package/dist/{src/vue → vue}/components/index.js.map +0 -0
- /package/dist/{src/vue → vue}/index.js +0 -0
- /package/dist/{src/vue → vue}/index.js.map +0 -0
package/ROADMAP.md
CHANGED
|
@@ -4,28 +4,6 @@ Features missing from AbsoluteJS that Next.js provides, ordered by priority. Eac
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## 1. P1 — Image Optimization
|
|
8
|
-
|
|
9
|
-
**What Next.js does:**
|
|
10
|
-
`<Image>` component that automatically converts images to WebP/AVIF, generates responsive `srcset` attributes, lazy loads with blur placeholders, and serves optimized images through an on-demand image optimization API route. Prevents layout shift with required width/height.
|
|
11
|
-
|
|
12
|
-
**What AbsoluteJS has today:**
|
|
13
|
-
Nothing. Images are served as-is from the public/assets directory.
|
|
14
|
-
|
|
15
|
-
**What needs to be built:**
|
|
16
|
-
- An `<Image>` component (React version at minimum, ideally per-framework) that renders responsive `<img>` tags with `srcset`, `sizes`, `loading="lazy"`, and `width`/`height` for CLS prevention
|
|
17
|
-
- An image optimization endpoint or build-time processor that converts to WebP/AVIF and generates multiple sizes
|
|
18
|
-
- Sharp or libvips integration for the actual image processing (Sharp works with Bun)
|
|
19
|
-
- Caching layer for optimized images so they're only processed once
|
|
20
|
-
- Optional blur placeholder generation (tiny base64 inline preview)
|
|
21
|
-
|
|
22
|
-
**Files likely involved:**
|
|
23
|
-
- New: `src/react/components/Image.tsx`, and equivalents for other frameworks
|
|
24
|
-
- New: `src/plugins/imageOptimizer.ts` — Elysia plugin that handles `/image?url=...&w=...&q=...` requests
|
|
25
|
-
- New: `src/build/optimizeImages.ts` — optional build-time optimization pass
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
7
|
## 2. P1 — Loading / Error / Not-Found States
|
|
30
8
|
|
|
31
9
|
**What Next.js does:**
|
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toCommonJS = (from) => {
|
|
34
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
35
|
+
if (entry)
|
|
36
|
+
return entry;
|
|
37
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (var key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(entry, key))
|
|
41
|
+
__defProp(entry, key, {
|
|
42
|
+
get: __accessProp.bind(from, key),
|
|
43
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
__moduleCache.set(from, entry);
|
|
47
|
+
return entry;
|
|
48
|
+
};
|
|
49
|
+
var __moduleCache;
|
|
50
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
51
|
+
var __returnValue = (v) => v;
|
|
52
|
+
function __exportSetter(name, newValue) {
|
|
53
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
54
|
+
}
|
|
55
|
+
var __export = (target, all) => {
|
|
56
|
+
for (var name in all)
|
|
57
|
+
__defProp(target, name, {
|
|
58
|
+
get: all[name],
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
set: __exportSetter.bind(all, name)
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
65
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
66
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
67
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
68
|
+
else
|
|
69
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
70
|
+
if (d = decorators[i])
|
|
71
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
72
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
73
|
+
};
|
|
74
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
75
|
+
var __require = import.meta.require;
|
|
76
|
+
|
|
77
|
+
// src/utils/imageProcessing.ts
|
|
78
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
79
|
+
import { join, resolve } from "path";
|
|
80
|
+
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
81
|
+
for (const size of sizes) {
|
|
82
|
+
if (size >= target)
|
|
83
|
+
return size;
|
|
84
|
+
}
|
|
85
|
+
return sizes[sizes.length - 1] ?? target;
|
|
86
|
+
}, matchHostname = (actual, pattern) => {
|
|
87
|
+
if (pattern === actual)
|
|
88
|
+
return true;
|
|
89
|
+
if (pattern.startsWith("*.")) {
|
|
90
|
+
const suffix = pattern.slice(1);
|
|
91
|
+
return actual.endsWith(suffix) && actual.length > suffix.length;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}, matchPathname = (actual, pattern) => {
|
|
95
|
+
if (pattern.endsWith("/**")) {
|
|
96
|
+
const prefix = pattern.slice(0, -2);
|
|
97
|
+
return actual.startsWith(prefix);
|
|
98
|
+
}
|
|
99
|
+
return actual === pattern;
|
|
100
|
+
}, MIME_MAP, callSharp = (sharpRef, input) => {
|
|
101
|
+
const factory = sharpRef;
|
|
102
|
+
return factory(input);
|
|
103
|
+
}, toBuffer = (input) => {
|
|
104
|
+
if (Buffer.isBuffer(input))
|
|
105
|
+
return input;
|
|
106
|
+
return Buffer.from(input);
|
|
107
|
+
}, buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`, formatToMime = (format) => MIME_MAP[format], generateBlurSvg = (base64Thumbnail) => {
|
|
108
|
+
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>`;
|
|
109
|
+
const encoded = encodeURIComponent(svg);
|
|
110
|
+
return `url("data:image/svg+xml,${encoded}")`;
|
|
111
|
+
}, generateSrcSet = (src, width, sizes, config, loader) => {
|
|
112
|
+
const quality = config?.quality ?? DEFAULT_QUALITY;
|
|
113
|
+
const basePath = config?.path ?? OPTIMIZATION_ENDPOINT;
|
|
114
|
+
const buildUrl = loader ?? ((params) => buildOptimizedUrl(params.src, params.width, params.quality, basePath));
|
|
115
|
+
if (sizes) {
|
|
116
|
+
const allSizes = getAllSizes(config);
|
|
117
|
+
return allSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
|
|
118
|
+
}
|
|
119
|
+
if (width) {
|
|
120
|
+
const allSizes = getAllSizes(config);
|
|
121
|
+
const w1x = snapToSize(width, allSizes);
|
|
122
|
+
const w2x = snapToSize(width * 2, allSizes);
|
|
123
|
+
return `${buildUrl({ quality, src, width: w1x })} 1x, ${buildUrl({ quality, src, width: w2x })} 2x`;
|
|
124
|
+
}
|
|
125
|
+
const deviceSizes = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
|
|
126
|
+
return deviceSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
|
|
127
|
+
}, getAllSizes = (config) => {
|
|
128
|
+
const device = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
|
|
129
|
+
const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
130
|
+
return [...device, ...image].sort((left, right) => left - right);
|
|
131
|
+
}, getCacheDir = (buildDir) => {
|
|
132
|
+
const dir = join(buildDir, ".cache", "images");
|
|
133
|
+
if (!existsSync(dir))
|
|
134
|
+
mkdirSync(dir, { recursive: true });
|
|
135
|
+
return dir;
|
|
136
|
+
}, getCacheKey = (url, width, quality, format) => {
|
|
137
|
+
const hasher = new Bun.CryptoHasher("sha256");
|
|
138
|
+
hasher.update(`${url}|${width}|${quality}|${format}`);
|
|
139
|
+
return hasher.digest("hex");
|
|
140
|
+
}, isCacheStale = (meta) => Date.now() > meta.expireAt, matchRemotePattern = (urlString, patterns) => {
|
|
141
|
+
let parsed;
|
|
142
|
+
try {
|
|
143
|
+
parsed = new URL(urlString);
|
|
144
|
+
} catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return patterns.some((pattern) => {
|
|
148
|
+
if (pattern.protocol && parsed.protocol !== `${pattern.protocol}:`)
|
|
149
|
+
return false;
|
|
150
|
+
if (!matchHostname(parsed.hostname, pattern.hostname))
|
|
151
|
+
return false;
|
|
152
|
+
if (pattern.port && parsed.port !== pattern.port)
|
|
153
|
+
return false;
|
|
154
|
+
if (pattern.pathname && !matchPathname(parsed.pathname, pattern.pathname))
|
|
155
|
+
return false;
|
|
156
|
+
return true;
|
|
157
|
+
});
|
|
158
|
+
}, negotiateFormat = (acceptHeader, configuredFormats) => {
|
|
159
|
+
for (const format of configuredFormats) {
|
|
160
|
+
const mime = MIME_MAP[format];
|
|
161
|
+
if (mime && acceptHeader.includes(mime))
|
|
162
|
+
return format;
|
|
163
|
+
}
|
|
164
|
+
if (configuredFormats.includes("webp") && acceptHeader.includes("image/webp")) {
|
|
165
|
+
return "webp";
|
|
166
|
+
}
|
|
167
|
+
return "jpeg";
|
|
168
|
+
}, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, optimizeImage = async (buffer, width, quality, format) => {
|
|
169
|
+
const sharp = await tryLoadSharp();
|
|
170
|
+
if (!sharp)
|
|
171
|
+
return toBuffer(buffer);
|
|
172
|
+
const pipeline = callSharp(sharp, toBuffer(buffer)).rotate().resize(width, undefined, { withoutEnlargement: true });
|
|
173
|
+
switch (format) {
|
|
174
|
+
case "avif":
|
|
175
|
+
return pipeline.avif({ effort: AVIF_EFFORT, quality: Math.max(1, quality - AVIF_QUALITY_OFFSET) }).toBuffer();
|
|
176
|
+
case "jpeg":
|
|
177
|
+
return pipeline.jpeg({ mozjpeg: true, quality }).toBuffer();
|
|
178
|
+
case "png":
|
|
179
|
+
return pipeline.png({ quality }).toBuffer();
|
|
180
|
+
case "webp":
|
|
181
|
+
return pipeline.webp({ quality }).toBuffer();
|
|
182
|
+
default:
|
|
183
|
+
return toBuffer(buffer);
|
|
184
|
+
}
|
|
185
|
+
}, readFromCache = (cacheDir, cacheKey) => {
|
|
186
|
+
const metaPath = join(cacheDir, `${cacheKey}.meta`);
|
|
187
|
+
const dataPath = join(cacheDir, `${cacheKey}.data`);
|
|
188
|
+
if (!existsSync(metaPath) || !existsSync(dataPath))
|
|
189
|
+
return null;
|
|
190
|
+
try {
|
|
191
|
+
const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
|
|
192
|
+
const buffer = readFileSync(dataPath);
|
|
193
|
+
return { buffer, meta };
|
|
194
|
+
} catch {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
}, tryLoadSharp = async () => {
|
|
198
|
+
if (sharpLoaded)
|
|
199
|
+
return sharpModule;
|
|
200
|
+
sharpLoaded = true;
|
|
201
|
+
try {
|
|
202
|
+
const sharpPath = resolve(process.cwd(), "node_modules/sharp");
|
|
203
|
+
const mod = await import(sharpPath);
|
|
204
|
+
sharpModule = mod.default ?? mod;
|
|
205
|
+
return sharpModule;
|
|
206
|
+
} catch {
|
|
207
|
+
if (sharpWarned)
|
|
208
|
+
return null;
|
|
209
|
+
sharpWarned = true;
|
|
210
|
+
console.warn("[image] sharp not installed \u2014 serving unoptimized images. Install with: bun add sharp");
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
214
|
+
const metaPath = join(cacheDir, `${cacheKey}.meta`);
|
|
215
|
+
const dataPath = join(cacheDir, `${cacheKey}.data`);
|
|
216
|
+
writeFileSync(dataPath, buffer);
|
|
217
|
+
writeFileSync(metaPath, JSON.stringify(meta));
|
|
218
|
+
};
|
|
219
|
+
var init_imageProcessing = __esm(() => {
|
|
220
|
+
DEFAULT_DEVICE_SIZES = [
|
|
221
|
+
640,
|
|
222
|
+
750,
|
|
223
|
+
828,
|
|
224
|
+
1080,
|
|
225
|
+
1200,
|
|
226
|
+
1920,
|
|
227
|
+
2048,
|
|
228
|
+
3840
|
|
229
|
+
];
|
|
230
|
+
DEFAULT_IMAGE_SIZES = [
|
|
231
|
+
16,
|
|
232
|
+
32,
|
|
233
|
+
48,
|
|
234
|
+
64,
|
|
235
|
+
96,
|
|
236
|
+
128,
|
|
237
|
+
256,
|
|
238
|
+
384
|
|
239
|
+
];
|
|
240
|
+
MIME_MAP = {
|
|
241
|
+
avif: "image/avif",
|
|
242
|
+
jpeg: "image/jpeg",
|
|
243
|
+
png: "image/png",
|
|
244
|
+
webp: "image/webp"
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// src/react/components/Head.tsx
|
|
249
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
250
|
+
var RobotsContent = ({ robots }) => {
|
|
251
|
+
const directives = [];
|
|
252
|
+
if (robots.index === false)
|
|
253
|
+
directives.push("noindex");
|
|
254
|
+
if (robots.index === true)
|
|
255
|
+
directives.push("index");
|
|
256
|
+
if (robots.follow === false)
|
|
257
|
+
directives.push("nofollow");
|
|
258
|
+
if (robots.follow === true)
|
|
259
|
+
directives.push("follow");
|
|
260
|
+
if (robots.noarchive)
|
|
261
|
+
directives.push("noarchive");
|
|
262
|
+
if (robots.nosnippet)
|
|
263
|
+
directives.push("nosnippet");
|
|
264
|
+
if (robots.noimageindex)
|
|
265
|
+
directives.push("noimageindex");
|
|
266
|
+
if (robots.maxSnippet !== undefined)
|
|
267
|
+
directives.push(`max-snippet:${robots.maxSnippet}`);
|
|
268
|
+
if (robots.maxImagePreview)
|
|
269
|
+
directives.push(`max-image-preview:${robots.maxImagePreview}`);
|
|
270
|
+
if (robots.maxVideoPreview !== undefined)
|
|
271
|
+
directives.push(`max-video-preview:${robots.maxVideoPreview}`);
|
|
272
|
+
const content = directives.join(", ");
|
|
273
|
+
return content ? /* @__PURE__ */ jsxDEV("meta", {
|
|
274
|
+
content,
|
|
275
|
+
name: "robots"
|
|
276
|
+
}, undefined, false, undefined, this) : null;
|
|
277
|
+
};
|
|
278
|
+
var OpenGraphTags = ({
|
|
279
|
+
openGraph,
|
|
280
|
+
title,
|
|
281
|
+
description
|
|
282
|
+
}) => /* @__PURE__ */ jsxDEV(Fragment, {
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
285
|
+
content: openGraph.title ?? title,
|
|
286
|
+
property: "og:title"
|
|
287
|
+
}, undefined, false, undefined, this),
|
|
288
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
289
|
+
content: openGraph.description ?? description,
|
|
290
|
+
property: "og:description"
|
|
291
|
+
}, undefined, false, undefined, this),
|
|
292
|
+
openGraph.url && /* @__PURE__ */ jsxDEV("meta", {
|
|
293
|
+
content: openGraph.url,
|
|
294
|
+
property: "og:url"
|
|
295
|
+
}, undefined, false, undefined, this),
|
|
296
|
+
openGraph.image && /* @__PURE__ */ jsxDEV("meta", {
|
|
297
|
+
content: openGraph.image,
|
|
298
|
+
property: "og:image"
|
|
299
|
+
}, undefined, false, undefined, this),
|
|
300
|
+
openGraph.imageAlt && /* @__PURE__ */ jsxDEV("meta", {
|
|
301
|
+
content: openGraph.imageAlt,
|
|
302
|
+
property: "og:image:alt"
|
|
303
|
+
}, undefined, false, undefined, this),
|
|
304
|
+
openGraph.imageWidth && /* @__PURE__ */ jsxDEV("meta", {
|
|
305
|
+
content: String(openGraph.imageWidth),
|
|
306
|
+
property: "og:image:width"
|
|
307
|
+
}, undefined, false, undefined, this),
|
|
308
|
+
openGraph.imageHeight && /* @__PURE__ */ jsxDEV("meta", {
|
|
309
|
+
content: String(openGraph.imageHeight),
|
|
310
|
+
property: "og:image:height"
|
|
311
|
+
}, undefined, false, undefined, this),
|
|
312
|
+
openGraph.type && /* @__PURE__ */ jsxDEV("meta", {
|
|
313
|
+
content: openGraph.type,
|
|
314
|
+
property: "og:type"
|
|
315
|
+
}, undefined, false, undefined, this),
|
|
316
|
+
openGraph.siteName && /* @__PURE__ */ jsxDEV("meta", {
|
|
317
|
+
content: openGraph.siteName,
|
|
318
|
+
property: "og:site_name"
|
|
319
|
+
}, undefined, false, undefined, this),
|
|
320
|
+
openGraph.locale && /* @__PURE__ */ jsxDEV("meta", {
|
|
321
|
+
content: openGraph.locale,
|
|
322
|
+
property: "og:locale"
|
|
323
|
+
}, undefined, false, undefined, this)
|
|
324
|
+
]
|
|
325
|
+
}, undefined, true, undefined, this);
|
|
326
|
+
var TwitterTags = ({
|
|
327
|
+
twitter,
|
|
328
|
+
title,
|
|
329
|
+
description
|
|
330
|
+
}) => /* @__PURE__ */ jsxDEV(Fragment, {
|
|
331
|
+
children: [
|
|
332
|
+
twitter.card && /* @__PURE__ */ jsxDEV("meta", {
|
|
333
|
+
content: twitter.card,
|
|
334
|
+
name: "twitter:card"
|
|
335
|
+
}, undefined, false, undefined, this),
|
|
336
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
337
|
+
content: twitter.title ?? title,
|
|
338
|
+
name: "twitter:title"
|
|
339
|
+
}, undefined, false, undefined, this),
|
|
340
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
341
|
+
content: twitter.description ?? description,
|
|
342
|
+
name: "twitter:description"
|
|
343
|
+
}, undefined, false, undefined, this),
|
|
344
|
+
twitter.image && /* @__PURE__ */ jsxDEV("meta", {
|
|
345
|
+
content: twitter.image,
|
|
346
|
+
name: "twitter:image"
|
|
347
|
+
}, undefined, false, undefined, this),
|
|
348
|
+
twitter.imageAlt && /* @__PURE__ */ jsxDEV("meta", {
|
|
349
|
+
content: twitter.imageAlt,
|
|
350
|
+
name: "twitter:image:alt"
|
|
351
|
+
}, undefined, false, undefined, this),
|
|
352
|
+
twitter.site && /* @__PURE__ */ jsxDEV("meta", {
|
|
353
|
+
content: twitter.site,
|
|
354
|
+
name: "twitter:site"
|
|
355
|
+
}, undefined, false, undefined, this),
|
|
356
|
+
twitter.creator && /* @__PURE__ */ jsxDEV("meta", {
|
|
357
|
+
content: twitter.creator,
|
|
358
|
+
name: "twitter:creator"
|
|
359
|
+
}, undefined, false, undefined, this)
|
|
360
|
+
]
|
|
361
|
+
}, undefined, true, undefined, this);
|
|
362
|
+
var CustomMetaTag = ({ tag }) => {
|
|
363
|
+
if (tag.property)
|
|
364
|
+
return /* @__PURE__ */ jsxDEV("meta", {
|
|
365
|
+
content: tag.content,
|
|
366
|
+
property: tag.property
|
|
367
|
+
}, undefined, false, undefined, this);
|
|
368
|
+
if (tag.httpEquiv)
|
|
369
|
+
return /* @__PURE__ */ jsxDEV("meta", {
|
|
370
|
+
content: tag.content,
|
|
371
|
+
httpEquiv: tag.httpEquiv
|
|
372
|
+
}, undefined, false, undefined, this);
|
|
373
|
+
return /* @__PURE__ */ jsxDEV("meta", {
|
|
374
|
+
content: tag.content,
|
|
375
|
+
name: tag.name
|
|
376
|
+
}, undefined, false, undefined, this);
|
|
377
|
+
};
|
|
378
|
+
var Head = ({
|
|
379
|
+
title = "AbsoluteJS",
|
|
380
|
+
description = "A page created using AbsoluteJS",
|
|
381
|
+
icon = "/assets/ico/favicon.ico",
|
|
382
|
+
font,
|
|
383
|
+
cssPath,
|
|
384
|
+
canonical,
|
|
385
|
+
openGraph,
|
|
386
|
+
twitter,
|
|
387
|
+
robots,
|
|
388
|
+
meta
|
|
389
|
+
} = {}) => /* @__PURE__ */ jsxDEV("head", {
|
|
390
|
+
suppressHydrationWarning: true,
|
|
391
|
+
children: [
|
|
392
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
393
|
+
charSet: "utf-8"
|
|
394
|
+
}, undefined, false, undefined, this),
|
|
395
|
+
/* @__PURE__ */ jsxDEV("title", {
|
|
396
|
+
children: title
|
|
397
|
+
}, undefined, false, undefined, this),
|
|
398
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
399
|
+
content: description,
|
|
400
|
+
name: "description"
|
|
401
|
+
}, undefined, false, undefined, this),
|
|
402
|
+
/* @__PURE__ */ jsxDEV("meta", {
|
|
403
|
+
content: "width=device-width, initial-scale=1",
|
|
404
|
+
name: "viewport"
|
|
405
|
+
}, undefined, false, undefined, this),
|
|
406
|
+
/* @__PURE__ */ jsxDEV("link", {
|
|
407
|
+
href: icon,
|
|
408
|
+
rel: "icon"
|
|
409
|
+
}, undefined, false, undefined, this),
|
|
410
|
+
canonical && /* @__PURE__ */ jsxDEV("link", {
|
|
411
|
+
href: canonical,
|
|
412
|
+
rel: "canonical"
|
|
413
|
+
}, undefined, false, undefined, this),
|
|
414
|
+
openGraph && /* @__PURE__ */ jsxDEV(OpenGraphTags, {
|
|
415
|
+
description,
|
|
416
|
+
openGraph,
|
|
417
|
+
title
|
|
418
|
+
}, undefined, false, undefined, this),
|
|
419
|
+
twitter && /* @__PURE__ */ jsxDEV(TwitterTags, {
|
|
420
|
+
description,
|
|
421
|
+
title,
|
|
422
|
+
twitter
|
|
423
|
+
}, undefined, false, undefined, this),
|
|
424
|
+
robots && /* @__PURE__ */ jsxDEV(RobotsContent, {
|
|
425
|
+
robots
|
|
426
|
+
}, undefined, false, undefined, this),
|
|
427
|
+
meta?.map((tag, i) => /* @__PURE__ */ jsxDEV(CustomMetaTag, {
|
|
428
|
+
tag
|
|
429
|
+
}, i, false, undefined, this)),
|
|
430
|
+
font && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ jsxDEV("link", {
|
|
433
|
+
href: "https://fonts.googleapis.com",
|
|
434
|
+
rel: "preconnect"
|
|
435
|
+
}, undefined, false, undefined, this),
|
|
436
|
+
/* @__PURE__ */ jsxDEV("link", {
|
|
437
|
+
crossOrigin: "anonymous",
|
|
438
|
+
href: "https://fonts.gstatic.com",
|
|
439
|
+
rel: "preconnect",
|
|
440
|
+
suppressHydrationWarning: true
|
|
441
|
+
}, undefined, false, undefined, this),
|
|
442
|
+
/* @__PURE__ */ jsxDEV("link", {
|
|
443
|
+
href: `https://fonts.googleapis.com/css2?family=${font}:wght@100..900&display=swap`,
|
|
444
|
+
rel: "stylesheet",
|
|
445
|
+
suppressHydrationWarning: true
|
|
446
|
+
}, undefined, false, undefined, this)
|
|
447
|
+
]
|
|
448
|
+
}, undefined, true, undefined, this),
|
|
449
|
+
cssPath && [cssPath].flat().map((path) => /* @__PURE__ */ jsxDEV("link", {
|
|
450
|
+
href: path,
|
|
451
|
+
rel: "stylesheet",
|
|
452
|
+
suppressHydrationWarning: true,
|
|
453
|
+
type: "text/css"
|
|
454
|
+
}, path, false, undefined, this))
|
|
455
|
+
]
|
|
456
|
+
}, undefined, true, undefined, this);
|
|
457
|
+
// src/react/components/Image.tsx
|
|
458
|
+
init_imageProcessing();
|
|
459
|
+
import { jsxDEV as jsxDEV2, Fragment as Fragment2 } from "react/jsx-dev-runtime";
|
|
460
|
+
var resolveSource = (src, overrideSrc, unoptimized, loader, width, quality) => {
|
|
461
|
+
if (overrideSrc)
|
|
462
|
+
return overrideSrc;
|
|
463
|
+
if (unoptimized)
|
|
464
|
+
return src;
|
|
465
|
+
if (loader)
|
|
466
|
+
return loader({ quality, src, width: width ?? 0 });
|
|
467
|
+
if (!width)
|
|
468
|
+
return buildOptimizedUrl(src, 0, quality);
|
|
469
|
+
return buildOptimizedUrl(src, width, quality);
|
|
470
|
+
};
|
|
471
|
+
var resolveBlurBackground = (hasBlur, placeholder, blurDataURL) => {
|
|
472
|
+
if (!hasBlur)
|
|
473
|
+
return;
|
|
474
|
+
if (typeof placeholder === "string" && placeholder !== "blur" && placeholder.startsWith("data:")) {
|
|
475
|
+
return generateBlurSvg(placeholder);
|
|
476
|
+
}
|
|
477
|
+
if (blurDataURL)
|
|
478
|
+
return generateBlurSvg(blurDataURL);
|
|
479
|
+
return;
|
|
480
|
+
};
|
|
481
|
+
var Image = ({
|
|
482
|
+
alt,
|
|
483
|
+
blurDataURL,
|
|
484
|
+
className,
|
|
485
|
+
crossOrigin,
|
|
486
|
+
fetchPriority,
|
|
487
|
+
fill,
|
|
488
|
+
height,
|
|
489
|
+
loader,
|
|
490
|
+
loading,
|
|
491
|
+
onError,
|
|
492
|
+
onLoad,
|
|
493
|
+
overrideSrc,
|
|
494
|
+
placeholder,
|
|
495
|
+
priority,
|
|
496
|
+
quality = DEFAULT_QUALITY,
|
|
497
|
+
referrerPolicy,
|
|
498
|
+
sizes,
|
|
499
|
+
src,
|
|
500
|
+
style,
|
|
501
|
+
unoptimized,
|
|
502
|
+
width
|
|
503
|
+
}) => {
|
|
504
|
+
const resolvedSrc = resolveSource(src, overrideSrc, unoptimized, loader, width, quality);
|
|
505
|
+
const srcSet = unoptimized ? undefined : generateSrcSet(src, width, sizes, undefined, loader ?? undefined);
|
|
506
|
+
const resolvedSizes = sizes ?? (fill ? "100vw" : undefined);
|
|
507
|
+
const resolvedLoading = priority ? "eager" : loading ?? "lazy";
|
|
508
|
+
const resolvedFetchPriority = priority ? "high" : fetchPriority;
|
|
509
|
+
const hasBlur = placeholder === "blur" || typeof placeholder === "string" && placeholder !== "empty" && placeholder.startsWith("data:");
|
|
510
|
+
const blurBackground = resolveBlurBackground(hasBlur, placeholder, blurDataURL);
|
|
511
|
+
const imgStyle = {
|
|
512
|
+
...style ?? {},
|
|
513
|
+
...blurBackground ? {
|
|
514
|
+
backgroundImage: blurBackground,
|
|
515
|
+
backgroundPosition: "center",
|
|
516
|
+
backgroundRepeat: "no-repeat",
|
|
517
|
+
backgroundSize: "cover"
|
|
518
|
+
} : {},
|
|
519
|
+
...fill ? {
|
|
520
|
+
color: "transparent",
|
|
521
|
+
height: "100%",
|
|
522
|
+
inset: 0,
|
|
523
|
+
objectFit: "cover",
|
|
524
|
+
position: "absolute",
|
|
525
|
+
width: "100%"
|
|
526
|
+
} : { color: "transparent" }
|
|
527
|
+
};
|
|
528
|
+
const preloadLink = priority ? /* @__PURE__ */ jsxDEV2("link", {
|
|
529
|
+
as: "image",
|
|
530
|
+
crossOrigin,
|
|
531
|
+
href: resolvedSrc,
|
|
532
|
+
imageSizes: resolvedSizes,
|
|
533
|
+
imageSrcSet: srcSet,
|
|
534
|
+
rel: "preload"
|
|
535
|
+
}, undefined, false, undefined, this) : null;
|
|
536
|
+
const imgElement = /* @__PURE__ */ jsxDEV2("img", {
|
|
537
|
+
alt,
|
|
538
|
+
className,
|
|
539
|
+
crossOrigin,
|
|
540
|
+
decoding: "async",
|
|
541
|
+
fetchPriority: resolvedFetchPriority,
|
|
542
|
+
height: fill ? undefined : height,
|
|
543
|
+
loading: resolvedLoading,
|
|
544
|
+
onError: onError ? (event) => onError(event.nativeEvent) : undefined,
|
|
545
|
+
onLoad: (event) => {
|
|
546
|
+
const { target } = event;
|
|
547
|
+
if (blurBackground && target instanceof HTMLImageElement) {
|
|
548
|
+
target.style.backgroundImage = "none";
|
|
549
|
+
}
|
|
550
|
+
if (onLoad)
|
|
551
|
+
onLoad(event.nativeEvent);
|
|
552
|
+
},
|
|
553
|
+
referrerPolicy,
|
|
554
|
+
sizes: resolvedSizes,
|
|
555
|
+
src: resolvedSrc,
|
|
556
|
+
srcSet,
|
|
557
|
+
style: imgStyle,
|
|
558
|
+
width: fill ? undefined : width
|
|
559
|
+
}, undefined, false, undefined, this);
|
|
560
|
+
if (fill) {
|
|
561
|
+
return /* @__PURE__ */ jsxDEV2(Fragment2, {
|
|
562
|
+
children: [
|
|
563
|
+
preloadLink,
|
|
564
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
565
|
+
style: {
|
|
566
|
+
display: "block",
|
|
567
|
+
height: "100%",
|
|
568
|
+
overflow: "hidden",
|
|
569
|
+
position: "relative",
|
|
570
|
+
width: "100%"
|
|
571
|
+
},
|
|
572
|
+
children: imgElement
|
|
573
|
+
}, undefined, false, undefined, this)
|
|
574
|
+
]
|
|
575
|
+
}, undefined, true, undefined, this);
|
|
576
|
+
}
|
|
577
|
+
return /* @__PURE__ */ jsxDEV2(Fragment2, {
|
|
578
|
+
children: [
|
|
579
|
+
preloadLink,
|
|
580
|
+
imgElement
|
|
581
|
+
]
|
|
582
|
+
}, undefined, true, undefined, this);
|
|
583
|
+
};
|
|
584
|
+
// src/react/components/JsonLd.tsx
|
|
585
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
586
|
+
var JsonLd = ({
|
|
587
|
+
schema
|
|
588
|
+
}) => {
|
|
589
|
+
const data = Array.isArray(schema) ? schema.map((s) => ({
|
|
590
|
+
"@context": "https://schema.org",
|
|
591
|
+
...s
|
|
592
|
+
})) : { "@context": "https://schema.org", ...schema };
|
|
593
|
+
return /* @__PURE__ */ jsxDEV3("script", {
|
|
594
|
+
dangerouslySetInnerHTML: { __html: JSON.stringify(data) },
|
|
595
|
+
type: "application/ld+json"
|
|
596
|
+
}, undefined, false, undefined, this);
|
|
597
|
+
};
|
|
598
|
+
export {
|
|
599
|
+
JsonLd,
|
|
600
|
+
Image,
|
|
601
|
+
Head
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
//# debugId=58926FCD79B639F064756E2164756E21
|
|
605
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils/imageProcessing.ts", "../src/react/components/Head.tsx", "../src/react/components/Image.tsx", "../src/react/components/JsonLd.tsx"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport type { ImageConfig, ImageFormat, RemotePattern } from '../../types/image';\n\n// ── Constants ──────────────────────────────────────────────────────\n\n/* eslint-disable no-magic-numbers */\nexport const DEFAULT_DEVICE_SIZES = [\n\t640, 750, 828, 1080, 1200, 1920, 2048, 3840\n];\n\nexport const DEFAULT_IMAGE_SIZES = [\n\t16, 32, 48, 64, 96, 128, 256, 384\n];\n\nexport const DEFAULT_QUALITY = 75;\n/* eslint-enable no-magic-numbers */\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, -2); // eslint-disable-line no-magic-numbers\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\n/** Convert sharp dynamic import result to a callable factory */\nconst callSharp = (sharpRef: unknown, input: Buffer) => {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions -- sharp is dynamically imported\n\tconst factory = sharpRef as any;\n\n\treturn factory(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) =>\n\t`${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 = loader ?? ((params: { quality: number; src: string; width: number }) =>\n\t\tbuildOptimizedUrl(params.src, params.width, params.quality, basePath));\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((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`)\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((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`)\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}:`) return 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 (pattern.pathname && !matchPathname(parsed.pathname, pattern.pathname)) return 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 (configuredFormats.includes('webp') && acceptHeader.includes('image/webp')) {\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({ effort: AVIF_EFFORT, quality: Math.max(1, quality - AVIF_QUALITY_OFFSET) })\n\t\t\t\t.toBuffer();\n\t\tcase 'jpeg':\n\t\t\treturn pipeline\n\t\t\t\t.jpeg({ mozjpeg: true, quality })\n\t\t\t\t.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
|
+
"import type {\n\tMetadata,\n\tMetaTag,\n\tOpenGraph,\n\tTwitterCard,\n\tRobotsDirective\n} from '../../../types/metadata';\n\nconst RobotsContent = ({ robots }: { robots: RobotsDirective }) => {\n\tconst directives: string[] = [];\n\tif (robots.index === false) directives.push('noindex');\n\tif (robots.index === true) directives.push('index');\n\tif (robots.follow === false) directives.push('nofollow');\n\tif (robots.follow === true) directives.push('follow');\n\tif (robots.noarchive) directives.push('noarchive');\n\tif (robots.nosnippet) directives.push('nosnippet');\n\tif (robots.noimageindex) directives.push('noimageindex');\n\tif (robots.maxSnippet !== undefined)\n\t\tdirectives.push(`max-snippet:${robots.maxSnippet}`);\n\tif (robots.maxImagePreview)\n\t\tdirectives.push(`max-image-preview:${robots.maxImagePreview}`);\n\tif (robots.maxVideoPreview !== undefined)\n\t\tdirectives.push(`max-video-preview:${robots.maxVideoPreview}`);\n\n\tconst content = directives.join(', ');\n\n\treturn content ? <meta content={content} name=\"robots\" /> : null;\n};\n\nconst OpenGraphTags = ({\n\topenGraph,\n\ttitle,\n\tdescription\n}: {\n\topenGraph: OpenGraph;\n\ttitle: string;\n\tdescription: string;\n}) => (\n\t<>\n\t\t<meta content={openGraph.title ?? title} property=\"og:title\" />\n\t\t<meta\n\t\t\tcontent={openGraph.description ?? description}\n\t\t\tproperty=\"og:description\"\n\t\t/>\n\t\t{openGraph.url && <meta content={openGraph.url} property=\"og:url\" />}\n\t\t{openGraph.image && (\n\t\t\t<meta content={openGraph.image} property=\"og:image\" />\n\t\t)}\n\t\t{openGraph.imageAlt && (\n\t\t\t<meta content={openGraph.imageAlt} property=\"og:image:alt\" />\n\t\t)}\n\t\t{openGraph.imageWidth && (\n\t\t\t<meta\n\t\t\t\tcontent={String(openGraph.imageWidth)}\n\t\t\t\tproperty=\"og:image:width\"\n\t\t\t/>\n\t\t)}\n\t\t{openGraph.imageHeight && (\n\t\t\t<meta\n\t\t\t\tcontent={String(openGraph.imageHeight)}\n\t\t\t\tproperty=\"og:image:height\"\n\t\t\t/>\n\t\t)}\n\t\t{openGraph.type && <meta content={openGraph.type} property=\"og:type\" />}\n\t\t{openGraph.siteName && (\n\t\t\t<meta content={openGraph.siteName} property=\"og:site_name\" />\n\t\t)}\n\t\t{openGraph.locale && (\n\t\t\t<meta content={openGraph.locale} property=\"og:locale\" />\n\t\t)}\n\t</>\n);\n\nconst TwitterTags = ({\n\ttwitter,\n\ttitle,\n\tdescription\n}: {\n\ttwitter: TwitterCard;\n\ttitle: string;\n\tdescription: string;\n}) => (\n\t<>\n\t\t{twitter.card && <meta content={twitter.card} name=\"twitter:card\" />}\n\t\t<meta content={twitter.title ?? title} name=\"twitter:title\" />\n\t\t<meta\n\t\t\tcontent={twitter.description ?? description}\n\t\t\tname=\"twitter:description\"\n\t\t/>\n\t\t{twitter.image && <meta content={twitter.image} name=\"twitter:image\" />}\n\t\t{twitter.imageAlt && (\n\t\t\t<meta content={twitter.imageAlt} name=\"twitter:image:alt\" />\n\t\t)}\n\t\t{twitter.site && <meta content={twitter.site} name=\"twitter:site\" />}\n\t\t{twitter.creator && (\n\t\t\t<meta content={twitter.creator} name=\"twitter:creator\" />\n\t\t)}\n\t</>\n);\n\nconst CustomMetaTag = ({ tag }: { tag: MetaTag }) => {\n\tif (tag.property)\n\t\treturn <meta content={tag.content} property={tag.property} />;\n\n\tif (tag.httpEquiv)\n\t\treturn <meta content={tag.content} httpEquiv={tag.httpEquiv} />;\n\n\treturn <meta content={tag.content} name={tag.name} />;\n};\n\nexport const Head = ({\n\ttitle = 'AbsoluteJS',\n\tdescription = 'A page created using AbsoluteJS',\n\ticon = '/assets/ico/favicon.ico',\n\tfont,\n\tcssPath,\n\tcanonical,\n\topenGraph,\n\ttwitter,\n\trobots,\n\tmeta\n}: Metadata = {}) => (\n\t<head suppressHydrationWarning>\n\t\t<meta charSet=\"utf-8\" />\n\t\t<title>{title}</title>\n\t\t<meta content={description} name=\"description\" />\n\t\t<meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n\t\t<link href={icon} rel=\"icon\" />\n\t\t{canonical && <link href={canonical} rel=\"canonical\" />}\n\t\t{openGraph && (\n\t\t\t<OpenGraphTags\n\t\t\t\tdescription={description}\n\t\t\t\topenGraph={openGraph}\n\t\t\t\ttitle={title}\n\t\t\t/>\n\t\t)}\n\t\t{twitter && (\n\t\t\t<TwitterTags\n\t\t\t\tdescription={description}\n\t\t\t\ttitle={title}\n\t\t\t\ttwitter={twitter}\n\t\t\t/>\n\t\t)}\n\t\t{robots && <RobotsContent robots={robots} />}\n\t\t{meta?.map((tag, i) => <CustomMetaTag key={i} tag={tag} />)}\n\t\t{font && (\n\t\t\t<>\n\t\t\t\t<link href=\"https://fonts.googleapis.com\" rel=\"preconnect\" />\n\t\t\t\t<link\n\t\t\t\t\tcrossOrigin=\"anonymous\"\n\t\t\t\t\thref=\"https://fonts.gstatic.com\"\n\t\t\t\t\trel=\"preconnect\"\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t/>\n\t\t\t\t<link\n\t\t\t\t\thref={`https://fonts.googleapis.com/css2?family=${font}:wght@100..900&display=swap`}\n\t\t\t\t\trel=\"stylesheet\"\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t/>\n\t\t\t</>\n\t\t)}\n\t\t{cssPath &&\n\t\t\t[cssPath]\n\t\t\t\t.flat()\n\t\t\t\t.map((path) => (\n\t\t\t\t\t<link\n\t\t\t\t\t\thref={path}\n\t\t\t\t\t\tkey={path}\n\t\t\t\t\t\trel=\"stylesheet\"\n\t\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\t\ttype=\"text/css\"\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t</head>\n);\n",
|
|
7
|
+
"import type { ImageProps } from '../../../types/image';\nimport {\n\tDEFAULT_QUALITY,\n\tbuildOptimizedUrl,\n\tgenerateBlurSvg,\n\tgenerateSrcSet\n} from '../../utils/imageProcessing';\n\nconst resolveSource = (\n\tsrc: string,\n\toverrideSrc: ImageProps['overrideSrc'],\n\tunoptimized: ImageProps['unoptimized'],\n\tloader: ImageProps['loader'],\n\twidth: ImageProps['width'],\n\tquality: number\n) => {\n\tif (overrideSrc) return overrideSrc;\n\tif (unoptimized) return src;\n\tif (loader) return loader({ quality, src, width: width ?? 0 });\n\tif (!width) return buildOptimizedUrl(src, 0, quality);\n\n\treturn buildOptimizedUrl(src, width, quality);\n};\n\nconst resolveBlurBackground = (\n\thasBlur: boolean,\n\tplaceholder: ImageProps['placeholder'],\n\tblurDataURL: ImageProps['blurDataURL']\n) => {\n\tif (!hasBlur) return undefined;\n\n\tif (\n\t\ttypeof placeholder === 'string' &&\n\t\tplaceholder !== 'blur' &&\n\t\tplaceholder.startsWith('data:')\n\t) {\n\t\treturn generateBlurSvg(placeholder);\n\t}\n\n\tif (blurDataURL) return generateBlurSvg(blurDataURL);\n\n\treturn undefined;\n};\n\nexport const Image = ({\n\talt,\n\tblurDataURL,\n\tclassName,\n\tcrossOrigin,\n\tfetchPriority,\n\tfill,\n\theight,\n\tloader,\n\tloading,\n\tonError,\n\tonLoad,\n\toverrideSrc,\n\tplaceholder,\n\tpriority,\n\tquality = DEFAULT_QUALITY,\n\treferrerPolicy,\n\tsizes,\n\tsrc,\n\tstyle,\n\tunoptimized,\n\twidth\n}: ImageProps) => {\n\t// ── Resolve src ─────────────────────────────────────────────\n\tconst resolvedSrc = resolveSource(src, overrideSrc, unoptimized, loader, width, quality);\n\n\t// ── srcSet ──────────────────────────────────────────────────\n\tconst srcSet = unoptimized\n\t\t? undefined\n\t\t: generateSrcSet(src, width, sizes, undefined, loader ?? undefined);\n\n\t// ── Sizes ───────────────────────────────────────────────────\n\tconst resolvedSizes = sizes ?? (fill ? '100vw' : undefined);\n\n\t// ── Loading behavior ────────────────────────────────────────\n\tconst resolvedLoading = priority ? 'eager' : (loading ?? 'lazy');\n\tconst resolvedFetchPriority = priority ? 'high' : fetchPriority;\n\n\t// ── Blur placeholder ────────────────────────────────────────\n\tconst hasBlur =\n\t\tplaceholder === 'blur' ||\n\t\t(typeof placeholder === 'string' &&\n\t\t\tplaceholder !== 'empty' &&\n\t\t\tplaceholder.startsWith('data:'));\n\n\tconst blurBackground = resolveBlurBackground(hasBlur, placeholder, blurDataURL);\n\n\t// ── Styles ──────────────────────────────────────────────────\n\tconst imgStyle: Record<string, string | number> = {\n\t\t...(style ?? {}),\n\t\t...(blurBackground\n\t\t\t? {\n\t\t\t\t\tbackgroundImage: blurBackground,\n\t\t\t\t\tbackgroundPosition: 'center',\n\t\t\t\t\tbackgroundRepeat: 'no-repeat',\n\t\t\t\t\tbackgroundSize: 'cover'\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(fill\n\t\t\t? {\n\t\t\t\t\tcolor: 'transparent',\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tinset: 0,\n\t\t\t\t\tobjectFit: 'cover',\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\twidth: '100%'\n\t\t\t\t}\n\t\t\t: { color: 'transparent' })\n\t};\n\n\t// ── Preload link for priority images ────────────────────────\n\tconst preloadLink = priority ? (\n\t\t<link\n\t\t\tas=\"image\"\n\t\t\tcrossOrigin={crossOrigin}\n\t\t\thref={resolvedSrc}\n\t\t\timageSizes={resolvedSizes}\n\t\t\timageSrcSet={srcSet}\n\t\t\trel=\"preload\"\n\t\t/>\n\t) : null;\n\n\t// ── Fill mode wrapper ───────────────────────────────────────\n\tconst imgElement = (\n\t\t<img\n\t\t\talt={alt}\n\t\t\tclassName={className}\n\t\t\tcrossOrigin={crossOrigin}\n\t\t\tdecoding=\"async\"\n\t\t\tfetchPriority={resolvedFetchPriority}\n\t\t\theight={fill ? undefined : height}\n\t\t\tloading={resolvedLoading}\n\t\t\tonError={onError ? (event) => onError(event.nativeEvent) : undefined}\n\t\t\tonLoad={(event) => {\n\t\t\t\tconst { target } = event;\n\n\t\t\t\tif (blurBackground && target instanceof HTMLImageElement) {\n\t\t\t\t\ttarget.style.backgroundImage = 'none';\n\t\t\t\t}\n\n\t\t\t\tif (onLoad) onLoad(event.nativeEvent);\n\t\t\t}}\n\t\t\treferrerPolicy={referrerPolicy}\n\t\t\tsizes={resolvedSizes}\n\t\t\tsrc={resolvedSrc}\n\t\t\tsrcSet={srcSet}\n\t\t\tstyle={imgStyle}\n\t\t\twidth={fill ? undefined : width}\n\t\t/>\n\t);\n\n\tif (fill) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{preloadLink}\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\twidth: '100%'\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{imgElement}\n\t\t\t\t</span>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{preloadLink}\n\t\t\t{imgElement}\n\t\t</>\n\t);\n};\n",
|
|
8
|
+
"import type { JsonLdSchema, WithContext } from '../../../types/jsonLd';\n\nexport const JsonLd = ({\n\tschema\n}: {\n\tschema: JsonLdSchema | JsonLdSchema[];\n}) => {\n\tconst data: WithContext<JsonLdSchema> | WithContext<JsonLdSchema>[] =\n\t\tArray.isArray(schema)\n\t\t\t? schema.map((s) => ({\n\t\t\t\t\t'@context': 'https://schema.org' as const,\n\t\t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T;AAAA,EACJ,EAAE,IACD,EAAE,YAAY,yBAAkC,OAAO;AAAA,EAE3D,uBACC,QAAC,UAAD;AAAA,IACC,yBAAyB,EAAE,QAAQ,KAAK,UAAU,IAAI,EAAE;AAAA,IACxD,MAAK;AAAA,KAFN,iCAGA;AAAA;",
|
|
11
|
+
"debugId": "58926FCD79B639F064756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -75,7 +75,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
75
75
|
var __require = import.meta.require;
|
|
76
76
|
|
|
77
77
|
// src/vue/components/Image.vue
|
|
78
|
-
var Image_default = "
|
|
78
|
+
var Image_default = "../../Image-fpjk72vg.vue";
|
|
79
79
|
export {
|
|
80
80
|
Image_default as Image
|
|
81
81
|
};
|
package/package.json
CHANGED
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
"url": "git+https://github.com/absolutejs/absolutejs.git"
|
|
195
195
|
},
|
|
196
196
|
"scripts": {
|
|
197
|
-
"build": "
|
|
197
|
+
"build": "bun run scripts/build.ts",
|
|
198
198
|
"build:native": "./native/build.sh",
|
|
199
199
|
"db:push": "drizzle-kit push",
|
|
200
200
|
"db:studio": "drizzle-kit studio",
|
|
@@ -208,5 +208,5 @@
|
|
|
208
208
|
"typecheck": "bun run vue-tsc --noEmit"
|
|
209
209
|
},
|
|
210
210
|
"types": "./dist/src/index.d.ts",
|
|
211
|
-
"version": "0.19.0-beta.
|
|
211
|
+
"version": "0.19.0-beta.191"
|
|
212
212
|
}
|
package/scripts/build.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { $ } from "bun";
|
|
2
|
+
import { rm, cp, mkdir, readdir } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const DIST = "dist";
|
|
6
|
+
|
|
7
|
+
const SERVER_ENTRY_POINTS = [
|
|
8
|
+
"src/index.ts",
|
|
9
|
+
"src/build.ts",
|
|
10
|
+
"src/angular/index.ts",
|
|
11
|
+
"src/angular/components/index.ts",
|
|
12
|
+
"src/react/index.ts",
|
|
13
|
+
"src/react/components/index.ts",
|
|
14
|
+
"src/react/hooks/index.ts",
|
|
15
|
+
"src/svelte/index.ts",
|
|
16
|
+
"src/vue/index.ts",
|
|
17
|
+
"src/vue/components/index.ts",
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const EXTERNALS = [
|
|
21
|
+
"react",
|
|
22
|
+
"react-dom",
|
|
23
|
+
"vue",
|
|
24
|
+
"@vue/compiler-sfc",
|
|
25
|
+
"vue/server-renderer",
|
|
26
|
+
"svelte",
|
|
27
|
+
"svelte/compiler",
|
|
28
|
+
"svelte/server",
|
|
29
|
+
"elysia",
|
|
30
|
+
"@elysiajs/static",
|
|
31
|
+
"@angular/compiler-cli",
|
|
32
|
+
"@angular/core",
|
|
33
|
+
"@angular/common",
|
|
34
|
+
"@angular/platform-browser",
|
|
35
|
+
"@angular/platform-server",
|
|
36
|
+
"@angular/ssr",
|
|
37
|
+
"zone.js",
|
|
38
|
+
"debug",
|
|
39
|
+
"sharp",
|
|
40
|
+
"@absolutejs/native-linux-x64",
|
|
41
|
+
"@absolutejs/native-linux-arm64",
|
|
42
|
+
"@absolutejs/native-darwin-x64",
|
|
43
|
+
"@absolutejs/native-darwin-arm64",
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
async function build() {
|
|
47
|
+
console.log("Cleaning dist/...");
|
|
48
|
+
await rm(DIST, { recursive: true, force: true });
|
|
49
|
+
|
|
50
|
+
console.log("Building server entry points...");
|
|
51
|
+
const serverBuild = await Bun.build({
|
|
52
|
+
entrypoints: SERVER_ENTRY_POINTS,
|
|
53
|
+
outdir: DIST,
|
|
54
|
+
sourcemap: "linked",
|
|
55
|
+
target: "bun",
|
|
56
|
+
external: EXTERNALS,
|
|
57
|
+
root: "src",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (!serverBuild.success) {
|
|
61
|
+
console.error("Server build failed:");
|
|
62
|
+
for (const log of serverBuild.logs) console.error(log);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log("Building image client (browser target)...");
|
|
67
|
+
const imageBuild = await Bun.build({
|
|
68
|
+
entrypoints: ["src/utils/imageClient.ts"],
|
|
69
|
+
outdir: join(DIST, "image-client"),
|
|
70
|
+
target: "browser",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (!imageBuild.success) {
|
|
74
|
+
console.error("Image client build failed:");
|
|
75
|
+
for (const log of imageBuild.logs) console.error(log);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
console.log("Building CLI...");
|
|
80
|
+
const cliBuild = await Bun.build({
|
|
81
|
+
entrypoints: ["src/cli/index.ts"],
|
|
82
|
+
outdir: join(DIST, "cli"),
|
|
83
|
+
target: "bun",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (!cliBuild.success) {
|
|
87
|
+
console.error("CLI build failed:");
|
|
88
|
+
for (const log of cliBuild.logs) console.error(log);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
console.log("Generating type declarations...");
|
|
93
|
+
await $`tsc --emitDeclarationOnly --project tsconfig.build.json`;
|
|
94
|
+
|
|
95
|
+
console.log("Copying static assets...");
|
|
96
|
+
|
|
97
|
+
await mkdir(join(DIST, "dev"), { recursive: true });
|
|
98
|
+
await cp("src/dev/client", join(DIST, "dev", "client"), { recursive: true });
|
|
99
|
+
|
|
100
|
+
await mkdir(join(DIST, "svelte", "components"), { recursive: true });
|
|
101
|
+
const svelteFiles = await readdir("src/svelte/components");
|
|
102
|
+
for (const file of svelteFiles.filter((f) => f.endsWith(".svelte"))) {
|
|
103
|
+
await cp(
|
|
104
|
+
join("src", "svelte", "components", file),
|
|
105
|
+
join(DIST, "svelte", "components", file),
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
await mkdir(join(DIST, "vue", "components"), { recursive: true });
|
|
110
|
+
const vueFiles = await readdir("src/vue/components");
|
|
111
|
+
for (const file of vueFiles.filter((f) => f.endsWith(".vue"))) {
|
|
112
|
+
await cp(
|
|
113
|
+
join("src", "vue", "components", file),
|
|
114
|
+
join(DIST, "vue", "components", file),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log("Verifying exports...");
|
|
119
|
+
await verifyExports();
|
|
120
|
+
|
|
121
|
+
console.log("Build complete.");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function verifyExports() {
|
|
125
|
+
const pkg = await Bun.file("package.json").json();
|
|
126
|
+
const exports = pkg.exports as Record<
|
|
127
|
+
string,
|
|
128
|
+
{ import?: string; types?: string }
|
|
129
|
+
>;
|
|
130
|
+
const missing: string[] = [];
|
|
131
|
+
|
|
132
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
133
|
+
if (value.import) {
|
|
134
|
+
const path = value.import.replace("./", "");
|
|
135
|
+
const file = Bun.file(path);
|
|
136
|
+
if (!(await file.exists())) {
|
|
137
|
+
missing.push(`${key} → ${value.import}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (pkg.main) {
|
|
143
|
+
const mainPath = pkg.main.replace("./", "");
|
|
144
|
+
const file = Bun.file(mainPath);
|
|
145
|
+
if (!(await file.exists())) {
|
|
146
|
+
missing.push(`main → ${pkg.main}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (missing.length > 0) {
|
|
151
|
+
console.error("\nExport verification failed! Missing files:");
|
|
152
|
+
for (const m of missing) console.error(` ${m}`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
build();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|