Initial commit: New MoreminiMore website with fresh design

This commit is contained in:
MoreminiMore
2026-04-22 01:59:05 +07:00
commit 76409638cc
14010 changed files with 2052041 additions and 0 deletions

59
node_modules/@astrojs/node/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,59 @@
MIT License
Copyright (c) 2021 Fred K. Schott
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/sveltejs/kit repository:
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
"""
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/vitejs/vite repository:
MIT License
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

38
node_modules/@astrojs/node/README.md generated vendored Normal file
View File

@@ -0,0 +1,38 @@
# @astrojs/node
This adapter allows Astro to deploy your SSR site to Node targets.
## Documentation
Read the [`@astrojs/node` docs][docs]
## Support
- Get help in the [Astro Discord][discord]. Post questions in our `#support` forum, or visit our dedicated `#dev` channel to discuss current development and more!
- Check our [Astro Integration Documentation][astro-integration] for more on integrations.
- Submit bug reports and feature requests as [GitHub issues][issues].
## Contributing
This package is maintained by Astro's Core team. You're welcome to submit an issue or PR! These links will help you get started:
- [Contributor Manual][contributing]
- [Code of Conduct][coc]
- [Community Guide][community]
## License
MIT
Copyright (c) 2023present [Astro][astro]
[astro]: https://astro.build/
[docs]: https://docs.astro.build/en/guides/integrations-guide/node/
[contributing]: https://github.com/withastro/astro/blob/main/CONTRIBUTING.md
[coc]: https://github.com/withastro/.github/blob/main/CODE_OF_CONDUCT.md
[community]: https://github.com/withastro/.github/blob/main/COMMUNITY_GUIDE.md
[discord]: https://astro.build/chat/
[issues]: https://github.com/withastro/astro/issues
[astro-integration]: https://docs.astro.build/en/guides/integrations/

4
node_modules/@astrojs/node/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { AstroAdapter, AstroIntegration } from 'astro';
import type { Options, UserOptions } from './types.js';
export declare function getAdapter({ staticHeaders }: Pick<Options, 'staticHeaders'>): AstroAdapter;
export default function createIntegration(userOptions: UserOptions): AstroIntegration;

116
node_modules/@astrojs/node/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,116 @@
import { fileURLToPath } from "node:url";
import { writeJson } from "@astrojs/internal-helpers/fs";
import { AstroError } from "astro/errors";
import { STATIC_HEADERS_FILE } from "./shared.js";
import { sessionDrivers } from "astro/config";
import { createConfigPlugin } from "./vite-plugin-config.js";
function getAdapter({ staticHeaders }) {
return {
name: "@astrojs/node",
entrypointResolution: "auto",
serverEntrypoint: "@astrojs/node/server.js",
previewEntrypoint: "@astrojs/node/preview.js",
adapterFeatures: {
buildOutput: "server",
middlewareMode: "classic",
staticHeaders
},
supportedAstroFeatures: {
hybridOutput: "stable",
staticOutput: "stable",
serverOutput: "stable",
sharpImageService: "stable",
i18nDomains: "experimental",
envGetSecret: "stable"
}
};
}
function createIntegration(userOptions) {
if (!userOptions?.mode) {
throw new AstroError(`Setting the 'mode' option is required.`);
}
let _config = void 0;
let _routeToHeaders = void 0;
return {
name: "@astrojs/node",
hooks: {
"astro:config:setup": async ({ updateConfig, config, logger, command }) => {
let session = config.session;
_config = config;
if (!session?.driver) {
logger.info("Enabling sessions with filesystem storage");
session = {
driver: sessionDrivers.fsLite({
base: fileURLToPath(new URL("sessions", config.cacheDir))
}),
cookie: session?.cookie,
ttl: session?.ttl
};
}
updateConfig({
build: {
redirects: false
},
image: {
endpoint: {
route: config.image.endpoint.route ?? "_image",
entrypoint: config.image.endpoint.entrypoint ?? (command === "dev" ? "astro/assets/endpoint/dev" : "astro/assets/endpoint/node")
}
},
session,
vite: {
plugins: [
createConfigPlugin({
...userOptions,
client: _config.build.client?.toString(),
server: _config.build.server?.toString(),
host: _config.server.host,
port: _config.server.port,
staticHeaders: userOptions.staticHeaders ?? false,
bodySizeLimit: userOptions.bodySizeLimit ?? 1024 * 1024 * 1024,
experimentalDisableStreaming: userOptions.experimentalDisableStreaming ?? false
})
]
}
});
},
"astro:build:generated": ({ routeToHeaders }) => {
_routeToHeaders = routeToHeaders;
},
"astro:config:done": ({ setAdapter, config }) => {
_config = config;
setAdapter(getAdapter({ staticHeaders: userOptions.staticHeaders ?? false }));
},
"astro:build:done": async () => {
if (!_config) {
return;
}
if (_routeToHeaders && _routeToHeaders.size > 0) {
const headersFileUrl = new URL(STATIC_HEADERS_FILE, _config.outDir);
const headersValue = [];
for (const [pathname, { headers }] of _routeToHeaders.entries()) {
if (_config.security.csp) {
const csp = headers.get("Content-Security-Policy");
if (csp) {
headersValue.push({
pathname,
headers: [
{
key: "Content-Security-Policy",
value: csp
}
]
});
}
}
}
await writeJson(headersFileUrl, headersValue);
}
}
}
};
}
export {
createIntegration as default,
getAdapter
};

View File

@@ -0,0 +1,4 @@
import type http from 'node:http';
import https from 'node:https';
import type { AstroIntegrationLogger } from 'astro';
export declare function logListeningOn(logger: AstroIntegrationLogger, server: http.Server | https.Server, configuredHost: string | boolean | undefined): Promise<void>;

54
node_modules/@astrojs/node/dist/log-listening-on.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import https from "node:https";
import os from "node:os";
const wildcardHosts = /* @__PURE__ */ new Set(["0.0.0.0", "::", "0000:0000:0000:0000:0000:0000:0000:0000"]);
async function logListeningOn(logger, server, configuredHost) {
await new Promise((resolve) => server.once("listening", resolve));
const protocol = server instanceof https.Server ? "https" : "http";
const host = getResolvedHostForHttpServer(configuredHost);
const { port } = server.address();
const address = getNetworkAddress(protocol, host, port);
if (host === void 0 || wildcardHosts.has(host)) {
logger.info(
`Server listening on
local: ${address.local[0]}
network: ${address.network[0]}
`
);
} else {
logger.info(`Server listening on ${address.local[0]}`);
}
}
function getResolvedHostForHttpServer(host) {
if (host === false) {
return "localhost";
} else if (host === true) {
return void 0;
} else {
return host;
}
}
function getNetworkAddress(protocol = "http", hostname, port, base) {
const NetworkAddress = {
local: [],
network: []
};
Object.values(os.networkInterfaces()).flatMap((nInterface) => nInterface ?? []).filter((detail) => detail && detail.address && detail.family === "IPv4").forEach((detail) => {
let host = detail.address.replace(
"127.0.0.1",
hostname === void 0 || wildcardHosts.has(hostname) ? "localhost" : hostname
);
if (host.includes(":")) {
host = `[${host}]`;
}
const url = `${protocol}://${host}:${port}${base ? base : ""}`;
if (detail.address.includes("127.0.0.1")) {
NetworkAddress.local.push(url);
} else {
NetworkAddress.network.push(url);
}
});
return NetworkAddress;
}
export {
logListeningOn
};

11
node_modules/@astrojs/node/dist/middleware.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import type { BaseApp } from 'astro/app';
import type { Options, RequestHandler } from './types.js';
/**
* Creates a middleware that can be used with Express, Connect, etc.
*
* Similar to `createAppHandler` but can additionally be placed in the express
* chain as an error middleware.
*
* https://expressjs.com/en/guide/using-middleware.html#middleware.error-handling
*/
export default function createMiddleware(app: BaseApp, options: Options): RequestHandler;

29
node_modules/@astrojs/node/dist/middleware.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import { createAppHandler } from "./serve-app.js";
function createMiddleware(app, options) {
const handler = createAppHandler(app, options);
const logger = app.getAdapterLogger();
return async (...args) => {
const [req, res, next, locals] = args;
if (req instanceof Error) {
const error = req;
if (next) {
return next(error);
} else {
throw error;
}
}
try {
await handler(req, res, next, locals);
} catch (err) {
logger.error(`Could not render ${req.url}`);
console.error(err);
if (!res.headersSent) {
res.writeHead(500, `Server error`);
res.end();
}
}
};
}
export {
createMiddleware as default
};

3
node_modules/@astrojs/node/dist/preview.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { CreatePreviewServer } from 'astro';
declare const createPreviewServer: CreatePreviewServer;
export { createPreviewServer as default };

50
node_modules/@astrojs/node/dist/preview.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import { fileURLToPath } from "node:url";
import { AstroError } from "astro/errors";
import { logListeningOn } from "./log-listening-on.js";
import { createServer } from "./standalone.js";
const createPreviewServer = async (preview) => {
let ssrHandler;
try {
process.env.ASTRO_NODE_AUTOSTART = "disabled";
const ssrModule = await import(preview.serverEntrypoint.toString());
if (typeof ssrModule.handler === "function") {
ssrHandler = ssrModule.handler;
} else {
throw new AstroError(
`The server entrypoint doesn't have a handler. Are you sure this is the right file?`
);
}
} catch (err) {
if (err.code === "ERR_MODULE_NOT_FOUND" && err.url === preview.serverEntrypoint.href) {
throw new AstroError(
`The server entrypoint ${fileURLToPath(
preview.serverEntrypoint
)} does not exist. Have you ran a build yet?`
);
} else {
throw err;
}
}
const host = process.env.HOST ?? preview.host ?? "0.0.0.0";
const port = preview.port ?? 4321;
const server = createServer(ssrHandler, host, port);
if (preview.headers) {
server.server.addListener("request", (_, res) => {
if (res.statusCode === 200) {
for (const [name, value] of Object.entries(preview.headers ?? {})) {
if (value) res.setHeader(name, value);
}
}
});
}
logListeningOn(preview.logger, server.server, host);
await new Promise((resolve, reject) => {
server.server.once("listening", resolve);
server.server.once("error", reject);
server.server.listen(port, host);
});
return server;
};
export {
createPreviewServer as default
};

8
node_modules/@astrojs/node/dist/serve-app.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { BaseApp } from 'astro/app';
import type { Options, RequestHandler } from './types.js';
/**
* Creates a Node.js http listener for on-demand rendered pages, compatible with http.createServer and Connect middleware.
* If the next callback is provided, it will be called if the request does not have a matching route.
* Intended to be used in both standalone and middleware mode.
*/
export declare function createAppHandler(app: BaseApp, options: Options): RequestHandler;

92
node_modules/@astrojs/node/dist/serve-app.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
import { AsyncLocalStorage } from "node:async_hooks";
import { createReadStream } from "node:fs";
import path from "node:path";
import { Readable } from "node:stream";
import { createRequest, writeResponse, getAbortControllerCleanup } from "astro/app/node";
import { resolveClientDir } from "./shared.js";
async function readErrorPageFromDisk(client, status) {
const filePaths = [`${status}.html`, `${status}/index.html`];
for (const filePath of filePaths) {
const fullPath = path.join(client, filePath);
let stream;
try {
stream = createReadStream(fullPath);
await new Promise((resolve, reject) => {
stream.once("open", () => resolve());
stream.once("error", reject);
});
const webStream = Readable.toWeb(stream);
return new Response(webStream, {
headers: { "Content-Type": "text/html; charset=utf-8" }
});
} catch {
stream?.destroy();
}
}
return void 0;
}
function createAppHandler(app, options) {
const als = new AsyncLocalStorage();
const logger = app.getAdapterLogger();
process.on("unhandledRejection", (reason) => {
const requestUrl = als.getStore();
logger.error(`Unhandled rejection while rendering ${requestUrl}`);
console.error(reason);
});
const client = resolveClientDir(options);
const prerenderedErrorPageFetch = async (url) => {
const { pathname } = new URL(url);
if (pathname.endsWith("/404.html") || pathname.endsWith("/404/index.html")) {
const response = await readErrorPageFromDisk(client, 404);
if (response) return response;
}
if (pathname.endsWith("/500.html") || pathname.endsWith("/500/index.html")) {
const response = await readErrorPageFromDisk(client, 500);
if (response) return response;
}
return new Response(null, { status: 404 });
};
const effectiveBodySizeLimit = options.bodySizeLimit === 0 || options.bodySizeLimit === Number.POSITIVE_INFINITY ? void 0 : options.bodySizeLimit;
return async (req, res, next, locals) => {
let request;
try {
request = createRequest(req, {
allowedDomains: app.getAllowedDomains?.() ?? [],
bodySizeLimit: effectiveBodySizeLimit,
port: options.port
});
} catch (err) {
logger.error(`Could not render ${req.url}`);
console.error(err);
res.statusCode = 500;
res.end("Internal Server Error");
return;
}
const routeData = app.match(request, true);
if (routeData && !(routeData.type === "page" && routeData.prerender)) {
const response = await als.run(
request.url,
() => app.render(request, {
addCookieHeader: true,
locals,
routeData,
prerenderedErrorPageFetch
})
);
await writeResponse(response, res);
} else if (next) {
const cleanup = getAbortControllerCleanup(req);
if (cleanup) cleanup();
return next();
} else {
const response = await app.render(request, {
addCookieHeader: true,
prerenderedErrorPageFetch
});
await writeResponse(response, res);
}
};
}
export {
createAppHandler
};

21
node_modules/@astrojs/node/dist/serve-static.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { BaseApp } from 'astro/app';
import type { NodeAppHeadersJson, Options } from './types.js';
/**
* Resolves a URL path to a filesystem path within the client directory,
* and checks whether it is a directory.
*
* Returns `isDirectory: false` if the resolved path escapes the client root
* (e.g. via `..` path traversal segments).
*/
export declare function resolveStaticPath(client: string, urlPath: string): {
filePath: string;
isDirectory: boolean;
};
/**
* Creates a Node.js http listener for static files and prerendered pages.
* In standalone mode, the static handler is queried first for the static files.
* If one matching the request path is not found, it relegates to the SSR handler.
* Intended to be used only in the standalone mode.
*/
export declare function createStaticHandler(app: BaseApp, options: Options, headersMap: NodeAppHeadersJson | undefined): (req: IncomingMessage, res: ServerResponse, ssr: () => unknown) => ServerResponse<IncomingMessage> | undefined;

119
node_modules/@astrojs/node/dist/serve-static.js generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import fs from "node:fs";
import path from "node:path";
import { hasFileExtension, isInternalPath } from "@astrojs/internal-helpers/path";
import send from "send";
import { resolveClientDir } from "./shared.js";
import { createRequest } from "astro/app/node";
function resolveStaticPath(client, urlPath) {
const filePath = path.join(client, urlPath);
const resolved = path.resolve(filePath);
const resolvedClient = path.resolve(client);
if (resolved !== resolvedClient && !resolved.startsWith(resolvedClient + path.sep)) {
return { filePath: resolved, isDirectory: false };
}
let isDirectory = false;
try {
isDirectory = fs.lstatSync(filePath).isDirectory();
} catch {
}
return { filePath: resolved, isDirectory };
}
function createStaticHandler(app, options, headersMap) {
const client = resolveClientDir(options);
return (req, res, ssr) => {
if (req.url) {
let fullUrl = req.url;
if (req.url.includes("#")) {
fullUrl = fullUrl.slice(0, req.url.indexOf("#"));
}
const [urlPath, urlQuery] = fullUrl.split("?");
const { isDirectory } = resolveStaticPath(client, app.removeBase(urlPath));
const hasSlash = urlPath.endsWith("/");
let pathname = urlPath;
if (headersMap && headersMap.length > 0) {
const request = createRequest(req, {
allowedDomains: app.getAllowedDomains?.() ?? [],
port: options.port
});
const routeData = app.match(request, true);
if (routeData && routeData.prerender) {
const baselessPathname = prependForwardSlash(app.removeBase(urlPath));
const matchedRoute = headersMap.find(
(header) => header.pathname.includes(baselessPathname)
);
if (matchedRoute) {
for (const header of matchedRoute.headers) {
res.setHeader(header.key, header.value);
}
}
}
}
switch (app.manifest.trailingSlash) {
case "never": {
if (isDirectory && urlPath !== "/" && hasSlash) {
pathname = urlPath.slice(0, -1) + (urlQuery ? "?" + urlQuery : "");
res.statusCode = 301;
res.setHeader("Location", pathname);
return res.end();
}
if (isDirectory && !hasSlash) {
pathname = `${urlPath}/index.html`;
}
break;
}
case "ignore": {
if (isDirectory && !hasSlash) {
pathname = `${urlPath}/index.html`;
}
break;
}
case "always": {
if (!hasSlash && !hasFileExtension(urlPath) && !isInternalPath(urlPath)) {
pathname = urlPath + "/" + (urlQuery ? "?" + urlQuery : "");
res.statusCode = 301;
res.setHeader("Location", pathname);
return res.end();
}
break;
}
}
pathname = prependForwardSlash(app.removeBase(pathname));
const normalizedPathname = path.posix.normalize(pathname);
const stream = send(req, normalizedPathname, {
root: client,
dotfiles: normalizedPathname.startsWith("/.well-known/") ? "allow" : "deny"
});
let forwardError = false;
stream.on("error", (err) => {
if (forwardError) {
const status = "statusCode" in err ? err.statusCode : 500;
if (status >= 500) {
console.error(err.toString());
}
res.writeHead(status);
res.end(status >= 500 ? "Internal server error" : "");
return;
}
ssr();
});
stream.on("file", () => {
forwardError = true;
});
stream.on("stream", () => {
if (normalizedPathname.startsWith(`/${app.manifest.assetsDir}/`)) {
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
}
});
stream.pipe(res);
} else {
ssr();
}
};
}
function prependForwardSlash(pth) {
return pth.startsWith("/") ? pth : "/" + pth;
}
export {
createStaticHandler,
resolveStaticPath
};

13
node_modules/@astrojs/node/dist/server.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import * as options from 'virtual:astro-node:config';
export { options };
export declare const handler: import("./types.js").RequestHandler;
export declare const startServer: () => {
server: {
host: string;
port: number;
closed(): Promise<void>;
stop(): Promise<void>;
server: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
};
done: Promise<void>;
};

19
node_modules/@astrojs/node/dist/server.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { createApp } from "astro/app/entrypoint";
import { setGetEnv } from "astro/env/setup";
import * as options from "virtual:astro-node:config";
import createMiddleware from "./middleware.js";
import { readHeadersJson } from "./shared.js";
import _startServer, { createStandaloneHandler } from "./standalone.js";
setGetEnv((key) => process.env[key]);
const app = createApp({ streaming: !options.experimentalDisableStreaming });
const headersMap = options.staticHeaders ? readHeadersJson(app.manifest.outDir) : void 0;
const handler = options.mode === "middleware" ? createMiddleware(app, options) : createStandaloneHandler(app, options, headersMap);
const startServer = () => _startServer(app, options, headersMap);
if (options.mode === "standalone" && process.env.ASTRO_NODE_AUTOSTART !== "disabled") {
startServer();
}
export {
handler,
options,
startServer
};

14
node_modules/@astrojs/node/dist/shared.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import type { NodeAppHeadersJson, Options } from './types.js';
export declare const STATIC_HEADERS_FILE = "_headers.json";
/**
* Resolves the client directory path at runtime.
*
* At build time, we know the relative path between server and client directories.
* At runtime, we need to find the actual location based on where the server entry is running.
*
* ## Error
*
* It throws an error if it can't find the directory while walking the parent directories.
*/
export declare function resolveClientDir(options: Options): string;
export declare function readHeadersJson(outDir: string | URL): NodeAppHeadersJson | undefined;

44
node_modules/@astrojs/node/dist/shared.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import path from "node:path";
import url from "node:url";
import fs from "node:fs";
import { appendForwardSlash } from "@astrojs/internal-helpers/path";
const STATIC_HEADERS_FILE = "_headers.json";
function resolveClientDir(options) {
const clientURLRaw = new URL(options.client);
const serverURLRaw = new URL(options.server);
const rel = path.relative(url.fileURLToPath(serverURLRaw), url.fileURLToPath(clientURLRaw));
const serverFolder = path.basename(options.server);
let serverEntryFolderURL = path.dirname(import.meta.url);
let previous = "";
while (!serverEntryFolderURL.endsWith(serverFolder)) {
if (serverEntryFolderURL === previous) {
throw new Error(
`[@astrojs/node] Could not find the server directory "${serverFolder}" by walking up from "${import.meta.url}". This can happen when the server entry point is bundled into a single file (e.g. with esbuild) so that import.meta.url no longer contains the original "${serverFolder}" path segment. When bundling the server entry, make sure the output path contains a "${serverFolder}" directory segment, or avoid bundling the server entry entirely.`
);
}
previous = serverEntryFolderURL;
serverEntryFolderURL = path.dirname(serverEntryFolderURL);
}
const serverEntryURL = serverEntryFolderURL + "/entry.mjs";
const clientURL = new URL(appendForwardSlash(rel), serverEntryURL);
return url.fileURLToPath(clientURL);
}
function readHeadersJson(outDir) {
let headersMap = void 0;
const headersUrl = new URL(STATIC_HEADERS_FILE, outDir);
if (fs.existsSync(headersUrl)) {
const content = fs.readFileSync(headersUrl, "utf-8");
try {
headersMap = JSON.parse(content);
} catch (e) {
console.error("[@astrojs/node] Error parsing _headers.json: " + e.message);
console.error("[@astrojs/node] Please make sure your _headers.json is valid JSON.");
}
}
return headersMap;
}
export {
STATIC_HEADERS_FILE,
readHeadersJson,
resolveClientDir
};

23
node_modules/@astrojs/node/dist/standalone.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import http from 'node:http';
import https from 'node:https';
import type { BaseApp } from 'astro/app';
import type { NodeAppHeadersJson, Options } from './types.js';
export declare const hostOptions: (host: Options["host"]) => string;
export default function standalone(app: BaseApp, options: Options, headersMap: NodeAppHeadersJson | undefined): {
server: {
host: string;
port: number;
closed(): Promise<void>;
stop(): Promise<void>;
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
};
done: Promise<void>;
};
export declare function createStandaloneHandler(app: BaseApp, options: Options, headersMap: NodeAppHeadersJson | undefined): (req: http.IncomingMessage, res: http.ServerResponse) => void;
export declare function createServer(listener: http.RequestListener, host: string, port: number): {
host: string;
port: number;
closed(): Promise<void>;
stop(): Promise<void>;
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
};

83
node_modules/@astrojs/node/dist/standalone.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
import fs from "node:fs";
import http from "node:http";
import https from "node:https";
import enableDestroy from "server-destroy";
import { logListeningOn } from "./log-listening-on.js";
import { createAppHandler } from "./serve-app.js";
import { createStaticHandler } from "./serve-static.js";
const hostOptions = (host) => {
if (typeof host === "boolean") {
return host ? "0.0.0.0" : "localhost";
}
return host;
};
function standalone(app, options, headersMap) {
const port = process.env.PORT ? Number(process.env.PORT) : options.port ?? 8080;
const host = process.env.HOST ?? hostOptions(options.host);
const resolvedOptions = { ...options, port };
const handler = createStandaloneHandler(app, resolvedOptions, headersMap);
const server = createServer(handler, host, port);
server.server.listen(port, host);
if (process.env.ASTRO_NODE_LOGGING !== "disabled") {
logListeningOn(app.getAdapterLogger(), server.server, host);
}
return {
server,
done: server.closed()
};
}
function createStandaloneHandler(app, options, headersMap) {
const appHandler = createAppHandler(app, options);
const staticHandler = createStaticHandler(app, options, headersMap);
return (req, res) => {
try {
decodeURI(req.url);
} catch {
res.writeHead(400);
res.end("Bad request.");
return;
}
staticHandler(req, res, () => appHandler(req, res));
};
}
function createServer(listener, host, port) {
let httpServer;
if (process.env.SERVER_CERT_PATH && process.env.SERVER_KEY_PATH) {
httpServer = https.createServer(
{
key: fs.readFileSync(process.env.SERVER_KEY_PATH),
cert: fs.readFileSync(process.env.SERVER_CERT_PATH)
},
listener
);
} else {
httpServer = http.createServer(listener);
}
enableDestroy(httpServer);
const closed = new Promise((resolve, reject) => {
httpServer.addListener("close", resolve);
httpServer.addListener("error", reject);
});
const previewable = {
host,
port,
closed() {
return closed;
},
async stop() {
await new Promise((resolve, reject) => {
httpServer.destroy((err) => err ? reject(err) : resolve(void 0));
});
}
};
return {
server: httpServer,
...previewable
};
}
export {
createServer,
createStandaloneHandler,
standalone as default,
hostOptions
};

53
node_modules/@astrojs/node/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
export interface UserOptions {
/**
* Specifies the mode that the adapter builds to.
*
* - 'middleware' - Build to middleware, to be used within another Node.js server, such as Express.
* - 'standalone' - Build to a standalone server. The server starts up just by running the built script.
*/
mode: 'middleware' | 'standalone';
/**
* Disables HTML streaming. This is useful for example if there are constraints from your host.
*/
experimentalDisableStreaming?: boolean;
/**
* If enabled, the adapter will save [static headers in the framework API file](https://docs.netlify.com/frameworks-api/#headers).
*
* Here the list of the headers that are added:
* - The CSP header of the static pages is added when CSP support is enabled.
*/
staticHeaders?: boolean;
/**
* Maximum allowed request body size in bytes. Requests with bodies larger than
* this limit will throw an error when the body is consumed.
*
* Set to `Infinity` or `0` to disable the limit.
*
* @default {1073741824} 1GB
*/
bodySizeLimit?: number;
}
export interface Options extends UserOptions {
host: string | boolean;
port: number;
server: string;
client: string;
staticHeaders: boolean;
bodySizeLimit: number;
}
export type RequestHandler = (...args: RequestHandlerParams) => void | Promise<void>;
type RequestHandlerParams = [
req: IncomingMessage,
res: ServerResponse,
next?: (err?: unknown) => void,
locals?: object
];
export type NodeAppHeadersJson = {
pathname: string;
headers: {
key: string;
value: string;
}[];
}[];
export {};

0
node_modules/@astrojs/node/dist/types.js generated vendored Normal file
View File

View File

@@ -0,0 +1,3 @@
import type { AstroConfig } from 'astro';
import type { Options } from './types.js';
export declare function createConfigPlugin(config: Options): NonNullable<AstroConfig['vite']['plugins']>[number];

36
node_modules/@astrojs/node/dist/vite-plugin-config.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
const VIRTUAL_CONFIG_ID = "virtual:astro-node:config";
const RESOLVED_VIRTUAL_CONFIG_ID = "\0" + VIRTUAL_CONFIG_ID;
const SERVER_ENVIRONMENTS = ["ssr", "prerender", "astro"];
function createConfigPlugin(config) {
return {
name: VIRTUAL_CONFIG_ID,
configEnvironment(environmentName) {
if (SERVER_ENVIRONMENTS.includes(environmentName)) {
return {
resolve: {
noExternal: ["@astrojs/node"]
}
};
}
},
resolveId: {
filter: {
id: new RegExp(`^${VIRTUAL_CONFIG_ID}$`)
},
handler() {
return RESOLVED_VIRTUAL_CONFIG_ID;
}
},
load: {
filter: {
id: new RegExp(`^${RESOLVED_VIRTUAL_CONFIG_ID}$`)
},
handler() {
return Object.entries(config).map(([k, v]) => `export const ${k} = ${JSON.stringify(v)};`).join("\n");
}
}
};
}
export {
createConfigPlugin
};

63
node_modules/@astrojs/node/package.json generated vendored Normal file
View File

@@ -0,0 +1,63 @@
{
"name": "@astrojs/node",
"description": "Deploy your site to a Node.js server",
"version": "10.0.5",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/withastro/astro.git",
"directory": "packages/integrations/node"
},
"keywords": [
"withastro",
"astro-adapter"
],
"bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://docs.astro.build/en/guides/integrations-guide/node/",
"exports": {
".": "./dist/index.js",
"./server.js": "./dist/server.js",
"./preview.js": "./dist/preview.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"dependencies": {
"send": "^1.2.1",
"server-destroy": "^1.0.1",
"@astrojs/internal-helpers": "0.8.0"
},
"peerDependencies": {
"astro": "^6.0.0"
},
"devDependencies": {
"@fastify/middie": "^9.1.0",
"@fastify/static": "^9.0.0",
"@types/node": "^22.10.6",
"@types/send": "^1.2.1",
"@types/server-destroy": "^1.0.4",
"cheerio": "1.2.0",
"devalue": "^5.6.3",
"express": "^5.2.1",
"fastify": "^5.7.4",
"node-mocks-http": "^1.17.2",
"astro": "6.1.7",
"astro-scripts": "0.0.14"
},
"astro": {
"external": true
},
"publishConfig": {
"provenance": true
},
"scripts": {
"dev": "astro-scripts dev \"src/**/*.ts\"",
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"build:ci": "astro-scripts build \"src/**/*.ts\"",
"test": "astro-scripts test \"test/**/*.test.js\""
}
}