♻️ Migrated to actix rs
This commit is contained in:
6
test/data/warden/dist/server/chunks/_slug__3BAY271A.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/_slug__3BAY271A.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/_slug__TUDhKBhQ.mjs').then(n => n.c);
|
||||
|
||||
export { page };
|
6
test/data/warden/dist/server/chunks/_slug__EgGcJ0nJ.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/_slug__EgGcJ0nJ.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/_slug__TUDhKBhQ.mjs').then(n => n._);
|
||||
|
||||
export { page };
|
6
test/data/warden/dist/server/chunks/_slug__wxGnmrgA.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/_slug__wxGnmrgA.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/_slug__TUDhKBhQ.mjs').then(n => n.d);
|
||||
|
||||
export { page };
|
342
test/data/warden/dist/server/chunks/astro/assets-service_4dMyVCFm.mjs
vendored
Normal file
342
test/data/warden/dist/server/chunks/astro/assets-service_4dMyVCFm.mjs
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
import { isRemotePath, joinPaths } from '@astrojs/internal-helpers/path';
|
||||
import { A as AstroError, E as ExpectedImage, L as LocalImageUsedWrongly, M as MissingImageDimension, U as UnsupportedImageFormat, I as IncompatibleDescriptorOptions, a as UnsupportedImageConversion, b as MissingSharp } from '../astro_5WdVqH1c.mjs';
|
||||
|
||||
const VALID_SUPPORTED_FORMATS = [
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"png",
|
||||
"tiff",
|
||||
"webp",
|
||||
"gif",
|
||||
"svg",
|
||||
"avif"
|
||||
];
|
||||
const DEFAULT_OUTPUT_FORMAT = "webp";
|
||||
const DEFAULT_HASH_PROPS = ["src", "width", "height", "format", "quality"];
|
||||
|
||||
function isESMImportedImage(src) {
|
||||
return typeof src === "object";
|
||||
}
|
||||
function isRemoteImage(src) {
|
||||
return typeof src === "string";
|
||||
}
|
||||
|
||||
function matchPattern(url, remotePattern) {
|
||||
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
||||
}
|
||||
function matchPort(url, port) {
|
||||
return !port || port === url.port;
|
||||
}
|
||||
function matchProtocol(url, protocol) {
|
||||
return !protocol || protocol === url.protocol.slice(0, -1);
|
||||
}
|
||||
function matchHostname(url, hostname, allowWildcard) {
|
||||
if (!hostname) {
|
||||
return true;
|
||||
} else if (!allowWildcard || !hostname.startsWith("*")) {
|
||||
return hostname === url.hostname;
|
||||
} else if (hostname.startsWith("**.")) {
|
||||
const slicedHostname = hostname.slice(2);
|
||||
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
||||
} else if (hostname.startsWith("*.")) {
|
||||
const slicedHostname = hostname.slice(1);
|
||||
const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean);
|
||||
return additionalSubdomains.length === 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function matchPathname(url, pathname, allowWildcard) {
|
||||
if (!pathname) {
|
||||
return true;
|
||||
} else if (!allowWildcard || !pathname.endsWith("*")) {
|
||||
return pathname === url.pathname;
|
||||
} else if (pathname.endsWith("/**")) {
|
||||
const slicedPathname = pathname.slice(0, -2);
|
||||
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
||||
} else if (pathname.endsWith("/*")) {
|
||||
const slicedPathname = pathname.slice(0, -1);
|
||||
const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
|
||||
return additionalPathChunks.length === 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isRemoteAllowed(src, {
|
||||
domains = [],
|
||||
remotePatterns = []
|
||||
}) {
|
||||
if (!isRemotePath(src))
|
||||
return false;
|
||||
const url = new URL(src);
|
||||
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
||||
}
|
||||
|
||||
function isLocalService(service) {
|
||||
if (!service) {
|
||||
return false;
|
||||
}
|
||||
return "transform" in service;
|
||||
}
|
||||
function parseQuality(quality) {
|
||||
let result = parseInt(quality);
|
||||
if (Number.isNaN(result)) {
|
||||
return quality;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const baseService = {
|
||||
propertiesToHash: DEFAULT_HASH_PROPS,
|
||||
validateOptions(options) {
|
||||
if (!options.src || typeof options.src !== "string" && typeof options.src !== "object") {
|
||||
throw new AstroError({
|
||||
...ExpectedImage,
|
||||
message: ExpectedImage.message(
|
||||
JSON.stringify(options.src),
|
||||
typeof options.src,
|
||||
JSON.stringify(options, (_, v) => v === void 0 ? null : v)
|
||||
)
|
||||
});
|
||||
}
|
||||
if (!isESMImportedImage(options.src)) {
|
||||
if (options.src.startsWith("/@fs/") || !isRemotePath(options.src) && !options.src.startsWith("/")) {
|
||||
throw new AstroError({
|
||||
...LocalImageUsedWrongly,
|
||||
message: LocalImageUsedWrongly.message(options.src)
|
||||
});
|
||||
}
|
||||
let missingDimension;
|
||||
if (!options.width && !options.height) {
|
||||
missingDimension = "both";
|
||||
} else if (!options.width && options.height) {
|
||||
missingDimension = "width";
|
||||
} else if (options.width && !options.height) {
|
||||
missingDimension = "height";
|
||||
}
|
||||
if (missingDimension) {
|
||||
throw new AstroError({
|
||||
...MissingImageDimension,
|
||||
message: MissingImageDimension.message(missingDimension, options.src)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!VALID_SUPPORTED_FORMATS.includes(options.src.format)) {
|
||||
throw new AstroError({
|
||||
...UnsupportedImageFormat,
|
||||
message: UnsupportedImageFormat.message(
|
||||
options.src.format,
|
||||
options.src.src,
|
||||
VALID_SUPPORTED_FORMATS
|
||||
)
|
||||
});
|
||||
}
|
||||
if (options.widths && options.densities) {
|
||||
throw new AstroError(IncompatibleDescriptorOptions);
|
||||
}
|
||||
if (options.src.format === "svg") {
|
||||
options.format = "svg";
|
||||
}
|
||||
if (options.src.format === "svg" && options.format !== "svg" || options.src.format !== "svg" && options.format === "svg") {
|
||||
throw new AstroError(UnsupportedImageConversion);
|
||||
}
|
||||
}
|
||||
if (!options.format) {
|
||||
options.format = DEFAULT_OUTPUT_FORMAT;
|
||||
}
|
||||
if (options.width)
|
||||
options.width = Math.round(options.width);
|
||||
if (options.height)
|
||||
options.height = Math.round(options.height);
|
||||
return options;
|
||||
},
|
||||
getHTMLAttributes(options) {
|
||||
const { targetWidth, targetHeight } = getTargetDimensions(options);
|
||||
const { src, width, height, format, quality, densities, widths, formats, ...attributes } = options;
|
||||
return {
|
||||
...attributes,
|
||||
width: targetWidth,
|
||||
height: targetHeight,
|
||||
loading: attributes.loading ?? "lazy",
|
||||
decoding: attributes.decoding ?? "async"
|
||||
};
|
||||
},
|
||||
getSrcSet(options) {
|
||||
const srcSet = [];
|
||||
const { targetWidth } = getTargetDimensions(options);
|
||||
const { widths, densities } = options;
|
||||
const targetFormat = options.format ?? DEFAULT_OUTPUT_FORMAT;
|
||||
let imageWidth = options.width;
|
||||
let maxWidth = Infinity;
|
||||
if (isESMImportedImage(options.src)) {
|
||||
imageWidth = options.src.width;
|
||||
maxWidth = imageWidth;
|
||||
}
|
||||
const {
|
||||
width: transformWidth,
|
||||
height: transformHeight,
|
||||
...transformWithoutDimensions
|
||||
} = options;
|
||||
const allWidths = [];
|
||||
if (densities) {
|
||||
const densityValues = densities.map((density) => {
|
||||
if (typeof density === "number") {
|
||||
return density;
|
||||
} else {
|
||||
return parseFloat(density);
|
||||
}
|
||||
});
|
||||
const densityWidths = densityValues.sort().map((density) => Math.round(targetWidth * density));
|
||||
allWidths.push(
|
||||
...densityWidths.map((width, index) => ({
|
||||
maxTargetWidth: Math.min(width, maxWidth),
|
||||
descriptor: `${densityValues[index]}x`
|
||||
}))
|
||||
);
|
||||
} else if (widths) {
|
||||
allWidths.push(
|
||||
...widths.map((width) => ({
|
||||
maxTargetWidth: Math.min(width, maxWidth),
|
||||
descriptor: `${width}w`
|
||||
}))
|
||||
);
|
||||
}
|
||||
for (const { maxTargetWidth, descriptor } of allWidths) {
|
||||
const srcSetTransform = { ...transformWithoutDimensions };
|
||||
if (maxTargetWidth !== imageWidth) {
|
||||
srcSetTransform.width = maxTargetWidth;
|
||||
} else {
|
||||
if (options.width && options.height) {
|
||||
srcSetTransform.width = options.width;
|
||||
srcSetTransform.height = options.height;
|
||||
}
|
||||
}
|
||||
srcSet.push({
|
||||
transform: srcSetTransform,
|
||||
descriptor,
|
||||
attributes: {
|
||||
type: `image/${targetFormat}`
|
||||
}
|
||||
});
|
||||
}
|
||||
return srcSet;
|
||||
},
|
||||
getURL(options, imageConfig) {
|
||||
const searchParams = new URLSearchParams();
|
||||
if (isESMImportedImage(options.src)) {
|
||||
searchParams.append("href", options.src.src);
|
||||
} else if (isRemoteAllowed(options.src, imageConfig)) {
|
||||
searchParams.append("href", options.src);
|
||||
} else {
|
||||
return options.src;
|
||||
}
|
||||
const params = {
|
||||
w: "width",
|
||||
h: "height",
|
||||
q: "quality",
|
||||
f: "format"
|
||||
};
|
||||
Object.entries(params).forEach(([param, key]) => {
|
||||
options[key] && searchParams.append(param, options[key].toString());
|
||||
});
|
||||
const imageEndpoint = joinPaths("/", "/_image");
|
||||
return `${imageEndpoint}?${searchParams}`;
|
||||
},
|
||||
parseURL(url) {
|
||||
const params = url.searchParams;
|
||||
if (!params.has("href")) {
|
||||
return void 0;
|
||||
}
|
||||
const transform = {
|
||||
src: params.get("href"),
|
||||
width: params.has("w") ? parseInt(params.get("w")) : void 0,
|
||||
height: params.has("h") ? parseInt(params.get("h")) : void 0,
|
||||
format: params.get("f"),
|
||||
quality: params.get("q")
|
||||
};
|
||||
return transform;
|
||||
}
|
||||
};
|
||||
function getTargetDimensions(options) {
|
||||
let targetWidth = options.width;
|
||||
let targetHeight = options.height;
|
||||
if (isESMImportedImage(options.src)) {
|
||||
const aspectRatio = options.src.width / options.src.height;
|
||||
if (targetHeight && !targetWidth) {
|
||||
targetWidth = Math.round(targetHeight * aspectRatio);
|
||||
} else if (targetWidth && !targetHeight) {
|
||||
targetHeight = Math.round(targetWidth / aspectRatio);
|
||||
} else if (!targetWidth && !targetHeight) {
|
||||
targetWidth = options.src.width;
|
||||
targetHeight = options.src.height;
|
||||
}
|
||||
}
|
||||
return {
|
||||
targetWidth,
|
||||
targetHeight
|
||||
};
|
||||
}
|
||||
|
||||
let sharp;
|
||||
const qualityTable = {
|
||||
low: 25,
|
||||
mid: 50,
|
||||
high: 80,
|
||||
max: 100
|
||||
};
|
||||
async function loadSharp() {
|
||||
let sharpImport;
|
||||
try {
|
||||
sharpImport = (await import('sharp')).default;
|
||||
} catch (e) {
|
||||
throw new AstroError(MissingSharp);
|
||||
}
|
||||
return sharpImport;
|
||||
}
|
||||
const sharpService = {
|
||||
validateOptions: baseService.validateOptions,
|
||||
getURL: baseService.getURL,
|
||||
parseURL: baseService.parseURL,
|
||||
getHTMLAttributes: baseService.getHTMLAttributes,
|
||||
getSrcSet: baseService.getSrcSet,
|
||||
async transform(inputBuffer, transformOptions, config) {
|
||||
if (!sharp)
|
||||
sharp = await loadSharp();
|
||||
const transform = transformOptions;
|
||||
if (transform.format === "svg")
|
||||
return { data: inputBuffer, format: "svg" };
|
||||
const result = sharp(inputBuffer, {
|
||||
failOnError: false,
|
||||
pages: -1,
|
||||
limitInputPixels: config.service.config.limitInputPixels
|
||||
});
|
||||
result.rotate();
|
||||
if (transform.height && !transform.width) {
|
||||
result.resize({ height: Math.round(transform.height) });
|
||||
} else if (transform.width) {
|
||||
result.resize({ width: Math.round(transform.width) });
|
||||
}
|
||||
if (transform.format) {
|
||||
let quality = void 0;
|
||||
if (transform.quality) {
|
||||
const parsedQuality = parseQuality(transform.quality);
|
||||
if (typeof parsedQuality === "number") {
|
||||
quality = parsedQuality;
|
||||
} else {
|
||||
quality = transform.quality in qualityTable ? qualityTable[transform.quality] : void 0;
|
||||
}
|
||||
}
|
||||
result.toFormat(transform.format, { quality });
|
||||
}
|
||||
const { data, info } = await result.toBuffer({ resolveWithObject: true });
|
||||
return {
|
||||
data,
|
||||
format: info.format
|
||||
};
|
||||
}
|
||||
};
|
||||
var sharp_default = sharpService;
|
||||
|
||||
const sharp$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: sharp_default
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
export { DEFAULT_HASH_PROPS as D, isLocalService as a, isRemoteImage as b, isRemoteAllowed as c, isESMImportedImage as i, sharp$1 as s };
|
2196
test/data/warden/dist/server/chunks/astro_5WdVqH1c.mjs
vendored
Normal file
2196
test/data/warden/dist/server/chunks/astro_5WdVqH1c.mjs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
test/data/warden/dist/server/chunks/index_5_WFUSxR.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/index_5_WFUSxR.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/index_l5vwnKzb.mjs').then(n => n.b);
|
||||
|
||||
export { page };
|
6
test/data/warden/dist/server/chunks/index_6C3b8yBv.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/index_6C3b8yBv.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/index_l5vwnKzb.mjs').then(n => n.i);
|
||||
|
||||
export { page };
|
6
test/data/warden/dist/server/chunks/index_Ij1Dwoh1.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/index_Ij1Dwoh1.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/index_l5vwnKzb.mjs').then(n => n.a);
|
||||
|
||||
export { page };
|
6
test/data/warden/dist/server/chunks/node_0Fr8CwHA.mjs
vendored
Normal file
6
test/data/warden/dist/server/chunks/node_0Fr8CwHA.mjs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { renderers } from '../renderers.mjs';
|
||||
export { onRequest } from '../_empty-middleware.mjs';
|
||||
|
||||
const page = () => import('./pages/node_hIg2I-Kh.mjs');
|
||||
|
||||
export { page };
|
245
test/data/warden/dist/server/chunks/pages/_slug__TUDhKBhQ.mjs
vendored
Normal file
245
test/data/warden/dist/server/chunks/pages/_slug__TUDhKBhQ.mjs
vendored
Normal file
@@ -0,0 +1,245 @@
|
||||
/* empty css */
|
||||
import 'html-escaper';
|
||||
import { c as createAstro, d as createComponent, r as renderTemplate, m as maybeRenderHead, e as addAttribute, f as renderSlot, g as renderTransition, h as renderComponent, i as renderHead } from '../astro_5WdVqH1c.mjs';
|
||||
import 'kleur/colors';
|
||||
import 'clsx';
|
||||
import { DocumentRenderer } from '@keystone-6/document-renderer';
|
||||
/* empty css */
|
||||
/* empty css */
|
||||
|
||||
const $$Astro$7 = createAstro("https://smartsheep.studio");
|
||||
const $$Navbar = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
|
||||
Astro2.self = $$Navbar;
|
||||
const items = [
|
||||
{
|
||||
label: "\u60C5\u62A5",
|
||||
children: [
|
||||
{ href: "/posts", label: "\u8BB0\u5F55" },
|
||||
{ href: "/events", label: "\u6D3B\u52A8" }
|
||||
]
|
||||
}
|
||||
];
|
||||
return renderTemplate`${maybeRenderHead()}<div class="fixed top-0 navbar shadow-md bg-base-100 lg:px-5 z-10"> <div class="navbar-start"> <div class="dropdown"> <div tabindex="0" role="button" class="btn btn-ghost lg:hidden"> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h8m-8 6h16"></path> </svg> </div> <ul tabindex="0" class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"> ${items.map((item) => renderTemplate`<li> <a${addAttribute(item.href, "href")}>${item.label}</a> ${item.children && renderTemplate`<ul class="p-2"> ${item.children?.map((child) => renderTemplate`<li> <a${addAttribute(child.href, "href")}>${child.label}</a> </li>`)} </ul>`} </li>`)} </ul> </div> <a class="btn btn-ghost text-xl" href="/">山羊寒舍</a> </div> <div class="navbar-center hidden lg:flex"> <ul class="menu menu-horizontal px-1"> ${items.map((item) => renderTemplate`<li> ${item.children ? renderTemplate`<details> <summary>${item.label}</summary> <ul class="p-2"> ${item.children?.map((child) => renderTemplate`<li> <a${addAttribute(child.href, "href")}>${child.label}</a> </li>`)} </ul> </details>` : renderTemplate`<a${addAttribute(item.href, "href")}>${item.label}</a>`} </li>`)} </ul> </div> <div class="navbar-end"> <label class="swap swap-rotate px-[16px]"> <input type="checkbox" class="theme-controller" value="light" checked> <svg class="swap-on fill-current w-8 h-8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M5.64,17l-.71.71a1,1,0,0,0,0,1.41,1,1,0,0,0,1.41,0l.71-.71A1,1,0,0,0,5.64,17ZM5,12a1,1,0,0,0-1-1H3a1,1,0,0,0,0,2H4A1,1,0,0,0,5,12Zm7-7a1,1,0,0,0,1-1V3a1,1,0,0,0-2,0V4A1,1,0,0,0,12,5ZM5.64,7.05a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.41l-.71-.71A1,1,0,0,0,4.93,6.34Zm12,.29a1,1,0,0,0,.7-.29l.71-.71a1,1,0,1,0-1.41-1.41L17,5.64a1,1,0,0,0,0,1.41A1,1,0,0,0,17.66,7.34ZM21,11H20a1,1,0,0,0,0,2h1a1,1,0,0,0,0-2Zm-9,8a1,1,0,0,0-1,1v1a1,1,0,0,0,2,0V20A1,1,0,0,0,12,19ZM18.36,17A1,1,0,0,0,17,18.36l.71.71a1,1,0,0,0,1.41,0,1,1,0,0,0,0-1.41ZM12,6.5A5.5,5.5,0,1,0,17.5,12,5.51,5.51,0,0,0,12,6.5Zm0,9A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z"></path> </svg> <svg class="swap-off fill-current w-8 h-8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M21.64,13a1,1,0,0,0-1.05-.14,8.05,8.05,0,0,1-3.37.73A8.15,8.15,0,0,1,9.08,5.49a8.59,8.59,0,0,1,.25-2A1,1,0,0,0,8,2.36,10.14,10.14,0,1,0,22,14.05,1,1,0,0,0,21.64,13Zm-9.5,6.69A8.14,8.14,0,0,1,7.08,5.22v.27A10.15,10.15,0,0,0,17.22,15.63a9.79,9.79,0,0,0,2.1-.22A8.11,8.11,0,0,1,12.14,19.73Z"></path> </svg> </label> </div> </div>`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/components/Navbar.astro", void 0);
|
||||
|
||||
const $$Astro$6 = createAstro("https://smartsheep.studio");
|
||||
const $$ViewTransitions = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
|
||||
Astro2.self = $$ViewTransitions;
|
||||
const { fallback = "animate" } = Astro2.props;
|
||||
return renderTemplate`<meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback"${addAttribute(fallback, "content")}>`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/node_modules/astro/components/ViewTransitions.astro", void 0);
|
||||
|
||||
var __freeze = Object.freeze;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
||||
var _a;
|
||||
const $$Astro$5 = createAstro("https://smartsheep.studio");
|
||||
const $$RootLayout = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
|
||||
Astro2.self = $$RootLayout;
|
||||
const { title } = Astro2.props;
|
||||
return renderTemplate(_a || (_a = __template(['<html lang="en" data-astro-cid-mdysn4oi> <head><meta charset="utf-8"><link rel="icon" type="image/svg+xml" href="/favicon.svg"><meta name="viewport" content="width=device-width"><meta name="generator"', ">", "", "", "", "</head> <body data-astro-cid-mdysn4oi> <!-- Header --> ", " <!-- Content --> <main data-astro-cid-mdysn4oi", "> ", ' </main> <!-- Styles --> <script async src="https://analytics.smartsheep.studio/script.js" data-website-id="9d676a27-b473-44a3-b444-5a7d851e31e8"><\/script> </body> </html>'])), addAttribute(Astro2.generator, "content"), title && renderTemplate`<title>山羊寒舍 | ${title}</title>`, !title && renderTemplate`<title>山羊寒舍</title>`, renderComponent($$result, "ViewTransitions", $$ViewTransitions, { "data-astro-cid-mdysn4oi": true }), renderHead(), renderComponent($$result, "Navbar", $$Navbar, { "data-astro-cid-mdysn4oi": true }), addAttribute(renderTransition($$result, "53mar5bf", "slide", ""), "data-astro-transition-scope"), renderSlot($$result, $$slots["default"]));
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/layouts/RootLayout.astro", "self");
|
||||
|
||||
const $$Astro$4 = createAstro("https://smartsheep.studio");
|
||||
const $$PageLayout = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
|
||||
Astro2.self = $$PageLayout;
|
||||
const { title } = Astro2.props;
|
||||
return renderTemplate`${renderComponent($$result, "RootLayout", $$RootLayout, { "title": title }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<main class="container mx-auto h-fullpage mt-header"> ${renderSlot($$result2, $$slots["default"])} </main> ` })}`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/layouts/PageLayout.astro", void 0);
|
||||
|
||||
const defaultCms = "https://smartsheep.studio";
|
||||
async function graphQuery(query, variables) {
|
||||
const response = await fetch(`${process.env.PUBLIC_CMS ?? defaultCms}/api/graphql`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
query,
|
||||
variables
|
||||
})
|
||||
});
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const POST_TYPES = {
|
||||
article: "文章",
|
||||
podcast: "播客",
|
||||
announcements: "通告"
|
||||
};
|
||||
|
||||
const $$Astro$3 = createAstro("https://smartsheep.studio");
|
||||
const $$PostList = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
|
||||
Astro2.self = $$PostList;
|
||||
const { posts } = Astro2.props;
|
||||
return renderTemplate`${maybeRenderHead()}<div class="grid justify-items-strench shadow-lg"> ${posts?.map((item) => renderTemplate`<a${addAttribute(`/p/${item.slug}`, "href")}> <div class="card sm:card-side hover:bg-base-200 transition-colors sm:max-w-none"> ${item.cover.image.url && renderTemplate`<figure class="mx-auto w-full object-cover p-6 max-sm:pb-0 sm:max-w-[12rem] sm:pe-0"> <img loading="lazy"${addAttribute(item.cover.image.url, "src")} class="border-base-content bg-base-300 rounded-btn border border-opacity-5"${addAttribute(item.title, "alt")}> </figure>`} <div class="card-body"> <h2 class="text-xl">${item.title}</h2> <div class="mx-[-2px] mt-[-4px]"> <span class="badge badge-accent">${POST_TYPES[item.type]}</span> ${item.categories?.map((category) => renderTemplate`<span class="badge badge-primary">${category.name}</span>`)} ${item.tags?.map((tag) => renderTemplate`<span class="badge badge-secondary">${tag.name}</span>`)} </div> <div class="text-xs opacity-60 line-clamp-3"> ${item.description} </div> </div> </div> </a>`)} </div>`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/components/PostList.astro", void 0);
|
||||
|
||||
const $$Astro$2 = createAstro("https://smartsheep.studio");
|
||||
const prerender$2 = false;
|
||||
const $$slug$2 = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
|
||||
Astro2.self = $$slug$2;
|
||||
const { slug } = Astro2.params;
|
||||
const { posts } = (await graphQuery(
|
||||
`query Query($where: PostWhereInput!, $orderBy: [PostOrderByInput!]!) {
|
||||
posts(where: $where, orderBy: $orderBy) {
|
||||
slug
|
||||
type
|
||||
title
|
||||
description
|
||||
cover {
|
||||
image {
|
||||
url
|
||||
}
|
||||
}
|
||||
content {
|
||||
document
|
||||
}
|
||||
categories {
|
||||
name
|
||||
}
|
||||
tags {
|
||||
name
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
}`,
|
||||
{
|
||||
orderBy: [
|
||||
{
|
||||
createdAt: "desc"
|
||||
}
|
||||
],
|
||||
where: { categories: { some: { slug: { equals: slug } } } }
|
||||
}
|
||||
)).data;
|
||||
return renderTemplate`${renderComponent($$result, "PageLayout", $$PageLayout, { "title": "\u5206\u7C7B\u68C0\u7D22" }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="max-w-[720px] mx-auto"> <div class="pt-16 pb-6 px-6"> <h1 class="text-4xl font-bold">分类检索</h1> <p class="pt-3">以下是包含该分类的记录……</p> </div> ${renderComponent($$result2, "PostList", $$PostList, { "posts": posts })} </div> ` })}`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/pages/categories/[slug].astro", void 0);
|
||||
|
||||
const $$file$2 = "/Users/littlesheep/Documents/Projects/Capital/src/pages/categories/[slug].astro";
|
||||
const $$url$2 = "/categories/[slug]";
|
||||
|
||||
const _slug_$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: $$slug$2,
|
||||
file: $$file$2,
|
||||
prerender: prerender$2,
|
||||
url: $$url$2
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
const $$Astro$1 = createAstro("https://smartsheep.studio");
|
||||
const prerender$1 = false;
|
||||
const $$slug$1 = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
|
||||
Astro2.self = $$slug$1;
|
||||
const { slug } = Astro2.params;
|
||||
const { post } = (await graphQuery(
|
||||
`query Query($where: PostWhereUniqueInput!) {
|
||||
post(where: $where) {
|
||||
slug
|
||||
type
|
||||
title
|
||||
description
|
||||
author {
|
||||
name
|
||||
}
|
||||
assets {
|
||||
caption
|
||||
url
|
||||
type
|
||||
}
|
||||
cover {
|
||||
image {
|
||||
url
|
||||
}
|
||||
}
|
||||
content {
|
||||
document
|
||||
}
|
||||
categories {
|
||||
slug
|
||||
name
|
||||
}
|
||||
tags {
|
||||
slug
|
||||
name
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
}`,
|
||||
{
|
||||
where: { slug }
|
||||
}
|
||||
)).data;
|
||||
return renderTemplate`${renderComponent($$result, "PageLayout", $$PageLayout, { "title": post.title, "data-astro-cid-gysqo7gh": true }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="wrapper" data-astro-cid-gysqo7gh> <div class="card w-full shadow-xl" data-astro-cid-gysqo7gh> ${post.cover && renderTemplate`<figure data-astro-cid-gysqo7gh> <img${addAttribute(post.cover.image.url, "src")}${addAttribute(post.title, "alt")} data-astro-cid-gysqo7gh> </figure>`} <div class="card-body" data-astro-cid-gysqo7gh> <h2 class="card-title" data-astro-cid-gysqo7gh>${post.title}</h2> <p class="description" data-astro-cid-gysqo7gh>${post.description ?? "No description"}</p> <div class="divider" data-astro-cid-gysqo7gh></div> ${post.assets?.length > 0 && renderTemplate`<div class="mb-5 w-full" data-astro-cid-gysqo7gh> ${renderComponent($$result2, "Media", null, { "client:only": true, "sources": post.assets, "author": post.author, "client:component-hydration": "only", "data-astro-cid-gysqo7gh": true, "client:component-path": "/Users/littlesheep/Documents/Projects/Capital/src/components/posts/Media", "client:component-export": "default" })} </div>`} <div class="prose max-w-none" data-astro-cid-gysqo7gh> ${renderComponent($$result2, "DocumentRenderer", DocumentRenderer, { "document": post.content.document, "data-astro-cid-gysqo7gh": true })} </div> </div> </div> <div class="h-fit sticky top-header" data-astro-cid-gysqo7gh> <div class="card shadow-xl" data-astro-cid-gysqo7gh> <div class="card-body" data-astro-cid-gysqo7gh> <div class="gap-2 text-sm metadata description" data-astro-cid-gysqo7gh> <div data-astro-cid-gysqo7gh> <div data-astro-cid-gysqo7gh>作者</div> <div data-astro-cid-gysqo7gh>${post.author?.name ?? "\u4F5A\u540D"}</div> </div> <div data-astro-cid-gysqo7gh> <div data-astro-cid-gysqo7gh>类型</div> <div class="text-accent" data-astro-cid-gysqo7gh> ${POST_TYPES[post.type]} </div> </div> <div data-astro-cid-gysqo7gh> <div data-astro-cid-gysqo7gh>分类</div> <div class="flex gap-1" data-astro-cid-gysqo7gh> ${post.categories?.map((category) => renderTemplate`<a${addAttribute(`/categories/${category.slug}`, "href")} class="link link-primary" data-astro-cid-gysqo7gh> ${category.name} </a>`)} </div> </div> <div data-astro-cid-gysqo7gh> <div data-astro-cid-gysqo7gh>标签</div> <div class="flex gap-1" data-astro-cid-gysqo7gh> ${post.tags?.map((tag) => renderTemplate`<a${addAttribute(`/tags/${tag.slug}`, "href")} class="link link-secondary" data-astro-cid-gysqo7gh> ${tag.name} </a>`)} </div> </div> <div data-astro-cid-gysqo7gh> <div data-astro-cid-gysqo7gh>发布于</div> <div data-astro-cid-gysqo7gh>${new Date(post.createdAt).toLocaleString()}</div> </div> </div> </div> </div> </div> </div> ` })} `;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/pages/posts/[slug].astro", void 0);
|
||||
|
||||
const $$file$1 = "/Users/littlesheep/Documents/Projects/Capital/src/pages/posts/[slug].astro";
|
||||
const $$url$1 = "/posts/[slug]";
|
||||
|
||||
const _slug_$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: $$slug$1,
|
||||
file: $$file$1,
|
||||
prerender: prerender$1,
|
||||
url: $$url$1
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
const $$Astro = createAstro("https://smartsheep.studio");
|
||||
const prerender = false;
|
||||
const $$slug = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
|
||||
Astro2.self = $$slug;
|
||||
const { slug } = Astro2.params;
|
||||
const { posts } = (await graphQuery(
|
||||
`query Query($where: PostWhereInput!, $orderBy: [PostOrderByInput!]!) {
|
||||
posts(where: $where, orderBy: $orderBy) {
|
||||
slug
|
||||
type
|
||||
title
|
||||
description
|
||||
cover {
|
||||
image {
|
||||
url
|
||||
}
|
||||
}
|
||||
content {
|
||||
document
|
||||
}
|
||||
categories {
|
||||
name
|
||||
}
|
||||
tags {
|
||||
name
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
}`,
|
||||
{
|
||||
orderBy: [
|
||||
{
|
||||
createdAt: "desc"
|
||||
}
|
||||
],
|
||||
where: { tags: { some: { slug: { equals: slug } } } }
|
||||
}
|
||||
)).data;
|
||||
return renderTemplate`${renderComponent($$result, "PageLayout", $$PageLayout, { "title": "\u6807\u7B7E\u68C0\u7D22" }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="max-w-[720px] mx-auto"> <div class="pt-16 pb-6 px-6"> <h1 class="text-4xl font-bold">标签检索</h1> <p class="pt-3">以下是包含该标签的记录……</p> </div> ${renderComponent($$result2, "PostList", $$PostList, { "posts": posts })} </div> ` })}`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/pages/tags/[slug].astro", void 0);
|
||||
|
||||
const $$file = "/Users/littlesheep/Documents/Projects/Capital/src/pages/tags/[slug].astro";
|
||||
const $$url = "/tags/[slug]";
|
||||
|
||||
const _slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: $$slug,
|
||||
file: $$file,
|
||||
prerender,
|
||||
url: $$url
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
export { $$PageLayout as $, _slug_$2 as _, $$PostList as a, $$RootLayout as b, _slug_$1 as c, _slug_ as d, graphQuery as g };
|
153
test/data/warden/dist/server/chunks/pages/index_l5vwnKzb.mjs
vendored
Normal file
153
test/data/warden/dist/server/chunks/pages/index_l5vwnKzb.mjs
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
/* empty css */
|
||||
import { c as createAstro, d as createComponent, r as renderTemplate, h as renderComponent, m as maybeRenderHead, e as addAttribute } from '../astro_5WdVqH1c.mjs';
|
||||
import 'kleur/colors';
|
||||
import 'html-escaper';
|
||||
import { g as graphQuery, $ as $$PageLayout, a as $$PostList, b as $$RootLayout } from './_slug__TUDhKBhQ.mjs';
|
||||
import { DocumentRenderer } from '@keystone-6/document-renderer';
|
||||
import 'clsx';
|
||||
/* empty css */
|
||||
|
||||
const $$Astro$2 = createAstro("https://smartsheep.studio");
|
||||
const prerender$2 = false;
|
||||
const $$Index$2 = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
|
||||
Astro2.self = $$Index$2;
|
||||
const { events } = (await graphQuery(
|
||||
`query Query($where: EventWhereInput!) {
|
||||
events(where: $where) {
|
||||
slug
|
||||
title
|
||||
description
|
||||
content {
|
||||
document
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
}`,
|
||||
{
|
||||
where: {
|
||||
isHistory: {
|
||||
equals: true
|
||||
}
|
||||
}
|
||||
}
|
||||
)).data;
|
||||
return renderTemplate`${renderComponent($$result, "PageLayout", $$PageLayout, { "title": "\u6D3B\u52A8" }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="max-w-[720px] mx-auto"> <div class="card w-full shadow-xl"> <div class="card-body"> <h2 class="card-title">活动</h2> <p>读岁月史书,涨人生阅历</p> <div class="divider"></div> <ul class="timeline timeline-snap-icon max-md:timeline-compact timeline-vertical"> ${events?.map((item, idx) => {
|
||||
let align = idx % 2 === 0 ? "timeline-start" : "timeline-end";
|
||||
let textAlign = idx % 2 === 0 ? "md:text-right" : "md:text-left";
|
||||
return renderTemplate`<li> ${idx > 0 && renderTemplate`<hr>`} <div class="timeline-middle"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-5 w-5"> <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path> </svg> </div> <div${addAttribute(`${align} ${textAlign} mb-10`, "class")}> <time class="font-mono italic"> ${new Date(item.createdAt).toLocaleDateString()} </time> <div class="text-lg font-black">${item.title}</div> ${renderComponent($$result2, "DocumentRenderer", DocumentRenderer, { "document": item.content.document })} </div> <hr> </li>`;
|
||||
})} </ul> <div class="text-center max-md:text-left italic">
|
||||
我们的故事还在继续……
|
||||
</div> </div> </div> </div> ` })}`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/pages/events/index.astro", void 0);
|
||||
|
||||
const $$file$2 = "/Users/littlesheep/Documents/Projects/Capital/src/pages/events/index.astro";
|
||||
const $$url$2 = "/events";
|
||||
|
||||
const index$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: $$Index$2,
|
||||
file: $$file$2,
|
||||
prerender: prerender$2,
|
||||
url: $$url$2
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
const $$Astro$1 = createAstro("https://smartsheep.studio");
|
||||
const prerender$1 = false;
|
||||
const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
|
||||
Astro2.self = $$Index$1;
|
||||
const { posts } = (await graphQuery(
|
||||
`query Query($where: PostWhereInput!, $orderBy: [PostOrderByInput!]!) {
|
||||
posts(where: $where, orderBy: $orderBy) {
|
||||
slug
|
||||
type
|
||||
title
|
||||
description
|
||||
cover {
|
||||
image {
|
||||
url
|
||||
}
|
||||
}
|
||||
content {
|
||||
document
|
||||
}
|
||||
categories {
|
||||
name
|
||||
}
|
||||
tags {
|
||||
name
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
}`,
|
||||
{
|
||||
orderBy: [
|
||||
{
|
||||
createdAt: "desc"
|
||||
}
|
||||
],
|
||||
where: {}
|
||||
}
|
||||
)).data;
|
||||
return renderTemplate`${renderComponent($$result, "PageLayout", $$PageLayout, { "title": "\u8BB0\u5F55" }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="max-w-[720px] mx-auto"> <div class="pt-16 pb-6 px-6"> <h1 class="text-4xl font-bold">记录</h1> <p class="pt-2">记录生活,记录理想,记录记录……</p> </div> ${renderComponent($$result2, "PostList", $$PostList, { "posts": posts })} </div> ` })}`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/pages/posts/index.astro", void 0);
|
||||
|
||||
const $$file$1 = "/Users/littlesheep/Documents/Projects/Capital/src/pages/posts/index.astro";
|
||||
const $$url$1 = "/posts";
|
||||
|
||||
const index$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: $$Index$1,
|
||||
file: $$file$1,
|
||||
prerender: prerender$1,
|
||||
url: $$url$1
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
const $$Astro = createAstro("https://smartsheep.studio");
|
||||
const prerender = false;
|
||||
const $$Index = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
|
||||
Astro2.self = $$Index;
|
||||
const { events } = (await graphQuery(
|
||||
`query Query($where: EventWhereInput!) {
|
||||
events(where: $where) {
|
||||
slug
|
||||
title
|
||||
description
|
||||
createdAt
|
||||
}
|
||||
}`,
|
||||
{
|
||||
where: {
|
||||
isHistory: {
|
||||
equals: true
|
||||
}
|
||||
}
|
||||
}
|
||||
)).data;
|
||||
return renderTemplate`${renderComponent($$result, "RootLayout", $$RootLayout, { "data-astro-cid-j7pv25f6": true }, { "default": ($$result2) => renderTemplate` ${maybeRenderHead()}<div class="max-h-fullpage mt-header wrapper px-5 snap-y snap-mandatory" data-astro-cid-j7pv25f6> <div id="hello" class="hero h-fullpage snap-start" data-astro-cid-j7pv25f6> <div class="hero-content w-full grid grid-cols-1 md:grid-cols-2 max-md:gap-[60px]" data-astro-cid-j7pv25f6> <div class="max-md:text-center" data-astro-cid-j7pv25f6> <h1 class="text-5xl font-bold" data-astro-cid-j7pv25f6>你好呀 👋</h1> <p class="py-6" data-astro-cid-j7pv25f6>
|
||||
欢迎来到 SmartSheep Studio
|
||||
的官方网站!在这里了解,订阅,跟踪我们的最新消息。
|
||||
接触我们最大的官方社区,并且尝试最新产品,参与各种活动,提供反馈,让我们更好的服务您。
|
||||
</p> <a href="#about" class="btn btn-primary btn-md" data-astro-cid-j7pv25f6>了解更多</a> </div> <div class="flex justify-center md:justify-end max-md:order-first" data-astro-cid-j7pv25f6> <div class="spinning p-3 md:p-5 shadow-2xl aspect-square rounded-[30%] w-[192px] md:w-[256px] lg:w-[384px]" data-astro-cid-j7pv25f6> <img src="/favicon.svg" alt="logo" loading="lazy" data-astro-cid-j7pv25f6> </div> </div> </div> </div> <div id="about" class="hero h-fullpage snap-start" data-astro-cid-j7pv25f6> <div class="hero-content w-full grid grid-cols-1 md:grid-cols-2 max-md:gap-[60px]" data-astro-cid-j7pv25f6> <div class="flex justify-center md:justify-start" data-astro-cid-j7pv25f6> <div class="stats shadow overflow-x-auto" data-astro-cid-j7pv25f6> <div class="stat" data-astro-cid-j7pv25f6> <div class="stat-figure text-secondary" data-astro-cid-j7pv25f6> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-8 h-8 stroke-current" data-astro-cid-j7pv25f6><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" data-astro-cid-j7pv25f6></path></svg> </div> <div class="stat-title" data-astro-cid-j7pv25f6>People</div> <div class="stat-value" data-astro-cid-j7pv25f6>1</div> <div class="stat-desc" data-astro-cid-j7pv25f6>2019 - ${(/* @__PURE__ */ new Date()).getFullYear()}</div> </div> <div class="stat" data-astro-cid-j7pv25f6> <div class="stat-figure text-secondary" data-astro-cid-j7pv25f6> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-8 h-8 stroke-current" data-astro-cid-j7pv25f6><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4" data-astro-cid-j7pv25f6></path></svg> </div> <div class="stat-title" data-astro-cid-j7pv25f6>Clients</div> <div class="stat-value" data-astro-cid-j7pv25f6>180</div> <div class="stat-desc" data-astro-cid-j7pv25f6>↗︎ 80 (44%)</div> </div> <div class="stat" data-astro-cid-j7pv25f6> <div class="stat-figure text-secondary" data-astro-cid-j7pv25f6> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="inline-block w-8 h-8 stroke-current" data-astro-cid-j7pv25f6><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" data-astro-cid-j7pv25f6></path></svg> </div> <div class="stat-title" data-astro-cid-j7pv25f6>Products</div> <div class="stat-value" data-astro-cid-j7pv25f6>4</div> <div class="stat-desc" data-astro-cid-j7pv25f6>↘︎ 8 (67%)</div> </div> </div> </div> <div class="max-md:text-center" data-astro-cid-j7pv25f6> <h1 class="text-5xl font-bold" data-astro-cid-j7pv25f6>关于我们 🔖</h1> <p class="py-6" data-astro-cid-j7pv25f6>
|
||||
我们是一群充满活力、对开源充满热情的开发者。成立于 2019
|
||||
年。自那年起我们一直在开发让人喜欢的开源软件。在我们这里,“取之于开源,用之于开源”
|
||||
不仅是原则,更是我们信仰的座右铭。
|
||||
</p> <a href="#history" class="btn btn-primary btn-md pl-[24px]" data-astro-cid-j7pv25f6>
|
||||
查看「岁月史书」
|
||||
</a> </div> </div> </div> <div id="history" class="flex flex-col justify-center items-center h-fullpage snap-start" data-astro-cid-j7pv25f6> <div class="text-center" data-astro-cid-j7pv25f6> <div data-astro-cid-j7pv25f6> <h1 class="text-4xl font-bold" data-astro-cid-j7pv25f6>岁月史书</h1> <p class="pt-2 pb-4 tracking-[8px]" data-astro-cid-j7pv25f6>但当涉猎,见往事耳</p> <ul class="pb-6 mx-[-20px] max-w-[100vw] px-5 flex justify-center history timeline timeline-horizontal" data-astro-cid-j7pv25f6> ${events?.map((item, idx) => renderTemplate`<li data-astro-cid-j7pv25f6> ${idx > 0 && renderTemplate`<hr data-astro-cid-j7pv25f6>`} <div class="timeline-start" data-astro-cid-j7pv25f6> ${new Date(item.createdAt).toLocaleDateString()} </div> <div class="timeline-middle" data-astro-cid-j7pv25f6> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5" data-astro-cid-j7pv25f6> <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" data-astro-cid-j7pv25f6></path> </svg> </div> <div class="timeline-end timeline-box" data-astro-cid-j7pv25f6> <h2 class="font-bold text-lg" data-astro-cid-j7pv25f6>${item.title}</h2> <div class="line-clamp-2" data-astro-cid-j7pv25f6>${item.description}</div> </div> ${idx < events?.length - 1 && renderTemplate`<hr data-astro-cid-j7pv25f6>`} </li>`)} </ul> <a class="btn btn-primary" href="/events" data-astro-cid-j7pv25f6>查看更多</a> </div> </div> </div> </div> ` })} `;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/src/pages/index.astro", void 0);
|
||||
|
||||
const $$file = "/Users/littlesheep/Documents/Projects/Capital/src/pages/index.astro";
|
||||
const $$url = "";
|
||||
|
||||
const index = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: $$Index,
|
||||
file: $$file,
|
||||
prerender,
|
||||
url: $$url
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
export { index$1 as a, index as b, index$2 as i };
|
240
test/data/warden/dist/server/chunks/pages/node_hIg2I-Kh.mjs
vendored
Normal file
240
test/data/warden/dist/server/chunks/pages/node_hIg2I-Kh.mjs
vendored
Normal file
@@ -0,0 +1,240 @@
|
||||
import { isRemotePath } from '@astrojs/internal-helpers/path';
|
||||
import { readFile } from 'fs/promises';
|
||||
import mime from 'mime/lite.js';
|
||||
import 'os';
|
||||
import { A as AstroError, j as InvalidImageService, k as ExpectedImageOptions, E as ExpectedImage, c as createAstro, d as createComponent, l as ImageMissingAlt, r as renderTemplate, m as maybeRenderHead, e as addAttribute, s as spreadAttributes } from '../astro_5WdVqH1c.mjs';
|
||||
import { i as isESMImportedImage, a as isLocalService, b as isRemoteImage, D as DEFAULT_HASH_PROPS, c as isRemoteAllowed } from '../astro/assets-service_4dMyVCFm.mjs';
|
||||
import 'html-escaper';
|
||||
import 'clsx';
|
||||
|
||||
async function getConfiguredImageService() {
|
||||
if (!globalThis?.astroAsset?.imageService) {
|
||||
const { default: service } = await import(
|
||||
// @ts-expect-error
|
||||
'../astro/assets-service_4dMyVCFm.mjs'
|
||||
).then(n => n.s).catch((e) => {
|
||||
const error = new AstroError(InvalidImageService);
|
||||
error.cause = e;
|
||||
throw error;
|
||||
});
|
||||
if (!globalThis.astroAsset)
|
||||
globalThis.astroAsset = {};
|
||||
globalThis.astroAsset.imageService = service;
|
||||
return service;
|
||||
}
|
||||
return globalThis.astroAsset.imageService;
|
||||
}
|
||||
async function getImage$1(options, imageConfig) {
|
||||
if (!options || typeof options !== "object") {
|
||||
throw new AstroError({
|
||||
...ExpectedImageOptions,
|
||||
message: ExpectedImageOptions.message(JSON.stringify(options))
|
||||
});
|
||||
}
|
||||
if (typeof options.src === "undefined") {
|
||||
throw new AstroError({
|
||||
...ExpectedImage,
|
||||
message: ExpectedImage.message(
|
||||
options.src,
|
||||
"undefined",
|
||||
JSON.stringify(options)
|
||||
)
|
||||
});
|
||||
}
|
||||
const service = await getConfiguredImageService();
|
||||
const resolvedOptions = {
|
||||
...options,
|
||||
src: typeof options.src === "object" && "then" in options.src ? (await options.src).default ?? await options.src : options.src
|
||||
};
|
||||
const originalPath = isESMImportedImage(resolvedOptions.src) ? resolvedOptions.src.fsPath : resolvedOptions.src;
|
||||
const clonedSrc = isESMImportedImage(resolvedOptions.src) ? (
|
||||
// @ts-expect-error - clone is a private, hidden prop
|
||||
resolvedOptions.src.clone ?? resolvedOptions.src
|
||||
) : resolvedOptions.src;
|
||||
resolvedOptions.src = clonedSrc;
|
||||
const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions;
|
||||
const srcSetTransforms = service.getSrcSet ? await service.getSrcSet(validatedOptions, imageConfig) : [];
|
||||
let imageURL = await service.getURL(validatedOptions, imageConfig);
|
||||
let srcSets = await Promise.all(
|
||||
srcSetTransforms.map(async (srcSet) => ({
|
||||
transform: srcSet.transform,
|
||||
url: await service.getURL(srcSet.transform, imageConfig),
|
||||
descriptor: srcSet.descriptor,
|
||||
attributes: srcSet.attributes
|
||||
}))
|
||||
);
|
||||
if (isLocalService(service) && globalThis.astroAsset.addStaticImage && !(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) {
|
||||
const propsToHash = service.propertiesToHash ?? DEFAULT_HASH_PROPS;
|
||||
imageURL = globalThis.astroAsset.addStaticImage(validatedOptions, propsToHash, originalPath);
|
||||
srcSets = srcSetTransforms.map((srcSet) => ({
|
||||
transform: srcSet.transform,
|
||||
url: globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash, originalPath),
|
||||
descriptor: srcSet.descriptor,
|
||||
attributes: srcSet.attributes
|
||||
}));
|
||||
}
|
||||
return {
|
||||
rawOptions: resolvedOptions,
|
||||
options: validatedOptions,
|
||||
src: imageURL,
|
||||
srcSet: {
|
||||
values: srcSets,
|
||||
attribute: srcSets.map((srcSet) => `${srcSet.url} ${srcSet.descriptor}`).join(", ")
|
||||
},
|
||||
attributes: service.getHTMLAttributes !== void 0 ? await service.getHTMLAttributes(validatedOptions, imageConfig) : {}
|
||||
};
|
||||
}
|
||||
|
||||
const fnv1a52 = (str) => {
|
||||
const len = str.length;
|
||||
let i = 0, t0 = 0, v0 = 8997, t1 = 0, v1 = 33826, t2 = 0, v2 = 40164, t3 = 0, v3 = 52210;
|
||||
while (i < len) {
|
||||
v0 ^= str.charCodeAt(i++);
|
||||
t0 = v0 * 435;
|
||||
t1 = v1 * 435;
|
||||
t2 = v2 * 435;
|
||||
t3 = v3 * 435;
|
||||
t2 += v0 << 8;
|
||||
t3 += v1 << 8;
|
||||
t1 += t0 >>> 16;
|
||||
v0 = t0 & 65535;
|
||||
t2 += t1 >>> 16;
|
||||
v1 = t1 & 65535;
|
||||
v3 = t3 + (t2 >>> 16) & 65535;
|
||||
v2 = t2 & 65535;
|
||||
}
|
||||
return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4);
|
||||
};
|
||||
const etag = (payload, weak = false) => {
|
||||
const prefix = weak ? 'W/"' : '"';
|
||||
return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"';
|
||||
};
|
||||
|
||||
const $$Astro$1 = createAstro("https://smartsheep.studio");
|
||||
const $$Image = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
|
||||
Astro2.self = $$Image;
|
||||
const props = Astro2.props;
|
||||
if (props.alt === void 0 || props.alt === null) {
|
||||
throw new AstroError(ImageMissingAlt);
|
||||
}
|
||||
if (typeof props.width === "string") {
|
||||
props.width = parseInt(props.width);
|
||||
}
|
||||
if (typeof props.height === "string") {
|
||||
props.height = parseInt(props.height);
|
||||
}
|
||||
const image = await getImage(props);
|
||||
const additionalAttributes = {};
|
||||
if (image.srcSet.values.length > 0) {
|
||||
additionalAttributes.srcset = image.srcSet.attribute;
|
||||
}
|
||||
return renderTemplate`${maybeRenderHead()}<img${addAttribute(image.src, "src")}${spreadAttributes(additionalAttributes)}${spreadAttributes(image.attributes)}>`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/node_modules/astro/components/Image.astro", void 0);
|
||||
|
||||
const $$Astro = createAstro("https://smartsheep.studio");
|
||||
const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
||||
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
|
||||
Astro2.self = $$Picture;
|
||||
const defaultFormats = ["webp"];
|
||||
const defaultFallbackFormat = "png";
|
||||
const specialFormatsFallback = ["gif", "svg", "jpg", "jpeg"];
|
||||
const { formats = defaultFormats, pictureAttributes = {}, fallbackFormat, ...props } = Astro2.props;
|
||||
if (props.alt === void 0 || props.alt === null) {
|
||||
throw new AstroError(ImageMissingAlt);
|
||||
}
|
||||
const optimizedImages = await Promise.all(
|
||||
formats.map(
|
||||
async (format) => await getImage({ ...props, format, widths: props.widths, densities: props.densities })
|
||||
)
|
||||
);
|
||||
let resultFallbackFormat = fallbackFormat ?? defaultFallbackFormat;
|
||||
if (!fallbackFormat && isESMImportedImage(props.src) && specialFormatsFallback.includes(props.src.format)) {
|
||||
resultFallbackFormat = props.src.format;
|
||||
}
|
||||
const fallbackImage = await getImage({
|
||||
...props,
|
||||
format: resultFallbackFormat,
|
||||
widths: props.widths,
|
||||
densities: props.densities
|
||||
});
|
||||
const imgAdditionalAttributes = {};
|
||||
const sourceAdditionaAttributes = {};
|
||||
if (props.sizes) {
|
||||
sourceAdditionaAttributes.sizes = props.sizes;
|
||||
}
|
||||
if (fallbackImage.srcSet.values.length > 0) {
|
||||
imgAdditionalAttributes.srcset = fallbackImage.srcSet.attribute;
|
||||
}
|
||||
return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttributes)}> ${Object.entries(optimizedImages).map(([_, image]) => {
|
||||
const srcsetAttribute = props.densities || !props.densities && !props.widths ? `${image.src}${image.srcSet.values.length > 0 ? ", " + image.srcSet.attribute : ""}` : image.srcSet.attribute;
|
||||
return renderTemplate`<source${addAttribute(srcsetAttribute, "srcset")}${addAttribute("image/" + image.options.format, "type")}${spreadAttributes(sourceAdditionaAttributes)}>`;
|
||||
})} <img${addAttribute(fallbackImage.src, "src")}${spreadAttributes(imgAdditionalAttributes)}${spreadAttributes(fallbackImage.attributes)}> </picture>`;
|
||||
}, "/Users/littlesheep/Documents/Projects/Capital/node_modules/astro/components/Picture.astro", void 0);
|
||||
|
||||
const imageConfig = {"service":{"entrypoint":"astro/assets/services/sharp","config":{}},"domains":[],"remotePatterns":[],"endpoint":"astro/assets/endpoint/node"};
|
||||
const assetsDir = new URL("file:///Users/littlesheep/Documents/Projects/Capital/dist/client/");
|
||||
const getImage = async (options) => await getImage$1(options, imageConfig);
|
||||
|
||||
async function loadLocalImage(src, url) {
|
||||
const filePath = new URL("." + src, assetsDir);
|
||||
let buffer = void 0;
|
||||
try {
|
||||
buffer = await readFile(filePath);
|
||||
} catch (e) {
|
||||
const sourceUrl = new URL(src, url.origin);
|
||||
buffer = await loadRemoteImage(sourceUrl);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
async function loadRemoteImage(src) {
|
||||
try {
|
||||
const res = await fetch(src);
|
||||
if (!res.ok) {
|
||||
return void 0;
|
||||
}
|
||||
return Buffer.from(await res.arrayBuffer());
|
||||
} catch (err) {
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
const GET = async ({ request }) => {
|
||||
try {
|
||||
const imageService = await getConfiguredImageService();
|
||||
if (!("transform" in imageService)) {
|
||||
throw new Error("Configured image service is not a local service");
|
||||
}
|
||||
const url = new URL(request.url);
|
||||
const transform = await imageService.parseURL(url, imageConfig);
|
||||
if (!transform?.src) {
|
||||
throw new Error("Incorrect transform returned by `parseURL`");
|
||||
}
|
||||
let inputBuffer = void 0;
|
||||
if (isRemotePath(transform.src)) {
|
||||
if (isRemoteAllowed(transform.src, imageConfig) === false) {
|
||||
return new Response("Forbidden", { status: 403 });
|
||||
}
|
||||
inputBuffer = await loadRemoteImage(new URL(transform.src));
|
||||
} else {
|
||||
inputBuffer = await loadLocalImage(transform.src, url);
|
||||
}
|
||||
if (!inputBuffer) {
|
||||
return new Response("Not Found", { status: 404 });
|
||||
}
|
||||
const { data, format } = await imageService.transform(inputBuffer, transform, imageConfig);
|
||||
return new Response(data, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": mime.getType(format) ?? `image/${format}`,
|
||||
"Cache-Control": "public, max-age=31536000",
|
||||
ETag: etag(data.toString()),
|
||||
Date: (/* @__PURE__ */ new Date()).toUTCString()
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("Could not process image request:", err);
|
||||
return new Response(`Server Error: ${err}`, { status: 500 });
|
||||
}
|
||||
};
|
||||
|
||||
export { GET };
|
31
test/data/warden/dist/server/chunks/vnode-children_3wEZly-Z.mjs
vendored
Normal file
31
test/data/warden/dist/server/chunks/vnode-children_3wEZly-Z.mjs
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { parse, DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE } from 'ultrahtml';
|
||||
import { createElement, Fragment } from 'react';
|
||||
|
||||
let ids = 0;
|
||||
function convert(children) {
|
||||
let doc = parse(children.toString().trim());
|
||||
let id = ids++;
|
||||
let key = 0;
|
||||
|
||||
function createReactElementFromNode(node) {
|
||||
const childVnodes =
|
||||
Array.isArray(node.children) && node.children.length
|
||||
? node.children.map((child) => createReactElementFromNode(child)).filter(Boolean)
|
||||
: undefined;
|
||||
|
||||
if (node.type === DOCUMENT_NODE) {
|
||||
return createElement(Fragment, {}, childVnodes);
|
||||
} else if (node.type === ELEMENT_NODE) {
|
||||
const { class: className, ...props } = node.attributes;
|
||||
return createElement(node.name, { ...props, className, key: `${id}-${key++}` }, childVnodes);
|
||||
} else if (node.type === TEXT_NODE) {
|
||||
// 0-length text gets omitted in JSX
|
||||
return node.value.trim() ? node.value : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const root = createReactElementFromNode(doc);
|
||||
return root.props.children;
|
||||
}
|
||||
|
||||
export { convert as default };
|
Reference in New Issue
Block a user