Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
9
node_modules/astro/dist/manifest/serialized.d.ts
generated
vendored
Normal file
9
node_modules/astro/dist/manifest/serialized.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { type Plugin } from 'vite';
|
||||
import type { AstroSettings } from '../types/astro.js';
|
||||
export declare const SERIALIZED_MANIFEST_ID = "virtual:astro:manifest";
|
||||
export declare const SERIALIZED_MANIFEST_RESOLVED_ID: string;
|
||||
export declare function serializedManifestPlugin({ settings, command, sync, }: {
|
||||
settings: AstroSettings;
|
||||
command: 'dev' | 'build';
|
||||
sync: boolean;
|
||||
}): Plugin;
|
||||
205
node_modules/astro/dist/manifest/serialized.js
generated
vendored
Normal file
205
node_modules/astro/dist/manifest/serialized.js
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { normalizePath } from "vite";
|
||||
import { ACTIONS_ENTRYPOINT_VIRTUAL_MODULE_ID } from "../actions/consts.js";
|
||||
import { toFallbackType } from "../core/app/common.js";
|
||||
import { toRoutingStrategy } from "../core/app/entrypoints/index.js";
|
||||
import { MANIFEST_REPLACE } from "../core/build/plugins/plugin-manifest.js";
|
||||
import {
|
||||
getAlgorithm,
|
||||
getDirectives,
|
||||
getScriptHashes,
|
||||
getScriptResources,
|
||||
getStrictDynamic,
|
||||
getStyleHashes,
|
||||
getStyleResources,
|
||||
shouldTrackCspHashes
|
||||
} from "../core/csp/common.js";
|
||||
import { createKey, encodeKey, getEnvironmentKey, hasEnvironmentKey } from "../core/encryption.js";
|
||||
import { MIDDLEWARE_MODULE_ID } from "../core/middleware/vite-plugin.js";
|
||||
import { SERVER_ISLAND_MANIFEST } from "../core/server-islands/vite-plugin-server-islands.js";
|
||||
import { VIRTUAL_CACHE_PROVIDER_ID } from "../core/cache/vite-plugin.js";
|
||||
import { VIRTUAL_SESSION_DRIVER_ID } from "../core/session/vite-plugin.js";
|
||||
import { VIRTUAL_PAGES_MODULE_ID } from "../vite-plugin-pages/index.js";
|
||||
import { ASTRO_RENDERERS_MODULE_ID } from "../vite-plugin-renderers/index.js";
|
||||
import { ASTRO_ROUTES_MODULE_ID } from "../vite-plugin-routes/index.js";
|
||||
import { cacheConfigToManifest } from "../core/cache/utils.js";
|
||||
import { sessionConfigToManifest } from "../core/session/utils.js";
|
||||
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
||||
import { resolveMiddlewareMode } from "../integrations/adapter-utils.js";
|
||||
const SERIALIZED_MANIFEST_ID = "virtual:astro:manifest";
|
||||
const SERIALIZED_MANIFEST_RESOLVED_ID = "\0" + SERIALIZED_MANIFEST_ID;
|
||||
function serializedManifestPlugin({
|
||||
settings,
|
||||
command,
|
||||
sync
|
||||
}) {
|
||||
const normalizedSrcDir = normalizePath(fileURLToPath(settings.config.srcDir));
|
||||
let encodedKeyPromise;
|
||||
function getEncodedKey() {
|
||||
encodedKeyPromise ??= (async () => {
|
||||
const key = hasEnvironmentKey() ? await getEnvironmentKey() : await createKey();
|
||||
return encodeKey(key);
|
||||
})();
|
||||
return encodedKeyPromise;
|
||||
}
|
||||
function reloadManifest(path, server) {
|
||||
if (path != null && normalizePath(path).startsWith(normalizedSrcDir)) {
|
||||
const environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
||||
const virtualMod = environment.moduleGraph.getModuleById(SERIALIZED_MANIFEST_RESOLVED_ID);
|
||||
if (!virtualMod) return;
|
||||
environment.moduleGraph.invalidateModule(virtualMod);
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: SERIALIZED_MANIFEST_ID,
|
||||
enforce: "pre",
|
||||
configureServer(server) {
|
||||
server.watcher.on("add", (path) => reloadManifest(path, server));
|
||||
server.watcher.on("unlink", (path) => reloadManifest(path, server));
|
||||
server.watcher.on("change", (path) => reloadManifest(path, server));
|
||||
},
|
||||
// Restrict to server environments only since the generated code imports
|
||||
// server-only virtual modules (virtual:astro:routes, virtual:astro:pages)
|
||||
applyToEnvironment(environment) {
|
||||
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.astro || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
||||
},
|
||||
resolveId: {
|
||||
filter: {
|
||||
id: new RegExp(`^${SERIALIZED_MANIFEST_ID}$`)
|
||||
},
|
||||
handler() {
|
||||
return SERIALIZED_MANIFEST_RESOLVED_ID;
|
||||
}
|
||||
},
|
||||
load: {
|
||||
filter: {
|
||||
id: new RegExp(`^${SERIALIZED_MANIFEST_RESOLVED_ID}$`)
|
||||
},
|
||||
async handler() {
|
||||
let manifestData;
|
||||
if (command === "build" && !sync) {
|
||||
manifestData = `'${MANIFEST_REPLACE}'`;
|
||||
} else {
|
||||
const serialized = await createSerializedManifest(settings, await getEncodedKey());
|
||||
manifestData = JSON.stringify(serialized);
|
||||
}
|
||||
const hasCacheConfig = !!settings.config.experimental?.cache?.provider;
|
||||
const cacheProviderLine = hasCacheConfig ? `cacheProvider: () => import('${VIRTUAL_CACHE_PROVIDER_ID}'),` : "";
|
||||
const code = `
|
||||
import { deserializeManifest as _deserializeManifest } from 'astro/app';
|
||||
import { renderers } from '${ASTRO_RENDERERS_MODULE_ID}';
|
||||
import { routes } from '${ASTRO_ROUTES_MODULE_ID}';
|
||||
import { pageMap } from '${VIRTUAL_PAGES_MODULE_ID}';
|
||||
|
||||
const _manifest = _deserializeManifest((${manifestData}));
|
||||
|
||||
// _manifest.routes contains enriched route info with scripts and styles,
|
||||
// TODO port this info over to virtual:astro:routes to prevent the need to
|
||||
// have this duplication
|
||||
const isDev = ${JSON.stringify(command === "dev")};
|
||||
const manifestRoutes = isDev ? routes : _manifest.routes;
|
||||
|
||||
const manifest = Object.assign(_manifest, {
|
||||
renderers,
|
||||
actions: () => import('${ACTIONS_ENTRYPOINT_VIRTUAL_MODULE_ID}'),
|
||||
middleware: () => import('${MIDDLEWARE_MODULE_ID}'),
|
||||
sessionDriver: () => import('${VIRTUAL_SESSION_DRIVER_ID}'),
|
||||
${cacheProviderLine}
|
||||
serverIslandMappings: () => import('${SERVER_ISLAND_MANIFEST}'),
|
||||
routes: manifestRoutes,
|
||||
pageMap,
|
||||
});
|
||||
export { manifest };
|
||||
`;
|
||||
return { code };
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
async function createSerializedManifest(settings, encodedKey) {
|
||||
let i18nManifest;
|
||||
let csp;
|
||||
if (settings.config.i18n) {
|
||||
i18nManifest = {
|
||||
fallback: settings.config.i18n.fallback,
|
||||
strategy: toRoutingStrategy(settings.config.i18n.routing, settings.config.i18n.domains),
|
||||
defaultLocale: settings.config.i18n.defaultLocale,
|
||||
locales: settings.config.i18n.locales,
|
||||
domainLookupTable: {},
|
||||
fallbackType: toFallbackType(settings.config.i18n.routing),
|
||||
domains: settings.config.i18n.domains
|
||||
};
|
||||
}
|
||||
if (shouldTrackCspHashes(settings.config.security.csp)) {
|
||||
csp = {
|
||||
cspDestination: settings.adapter?.adapterFeatures?.staticHeaders ? "adapter" : void 0,
|
||||
scriptHashes: getScriptHashes(settings.config.security.csp),
|
||||
scriptResources: getScriptResources(settings.config.security.csp),
|
||||
styleHashes: getStyleHashes(settings.config.security.csp),
|
||||
styleResources: getStyleResources(settings.config.security.csp),
|
||||
algorithm: getAlgorithm(settings.config.security.csp),
|
||||
directives: getDirectives(settings),
|
||||
isStrictDynamic: getStrictDynamic(settings.config.security.csp)
|
||||
};
|
||||
}
|
||||
return {
|
||||
rootDir: settings.config.root.toString(),
|
||||
srcDir: settings.config.srcDir.toString(),
|
||||
cacheDir: settings.config.cacheDir.toString(),
|
||||
outDir: settings.config.outDir.toString(),
|
||||
buildServerDir: settings.config.build.server.toString(),
|
||||
buildClientDir: settings.config.build.client.toString(),
|
||||
publicDir: settings.config.publicDir.toString(),
|
||||
assetsDir: settings.config.build.assets,
|
||||
trailingSlash: settings.config.trailingSlash,
|
||||
buildFormat: settings.config.build.format,
|
||||
compressHTML: settings.config.compressHTML,
|
||||
serverLike: settings.buildOutput === "server",
|
||||
middlewareMode: resolveMiddlewareMode(settings.adapter?.adapterFeatures),
|
||||
assets: [],
|
||||
entryModules: {},
|
||||
routes: [],
|
||||
adapterName: settings?.adapter?.name ?? "",
|
||||
clientDirectives: Array.from(settings.clientDirectives.entries()),
|
||||
renderers: [],
|
||||
base: settings.config.base,
|
||||
userAssetsBase: settings.config?.vite?.base,
|
||||
assetsPrefix: settings.config.build.assetsPrefix,
|
||||
site: settings.config.site,
|
||||
componentMetadata: [],
|
||||
inlinedScripts: [],
|
||||
i18n: i18nManifest,
|
||||
checkOrigin: (settings.config.security?.checkOrigin && settings.buildOutput === "server") ?? false,
|
||||
allowedDomains: settings.config.security?.allowedDomains,
|
||||
actionBodySizeLimit: settings.config.security?.actionBodySizeLimit ? settings.config.security.actionBodySizeLimit : 1024 * 1024,
|
||||
// 1mb default
|
||||
serverIslandBodySizeLimit: settings.config.security?.serverIslandBodySizeLimit ? settings.config.security.serverIslandBodySizeLimit : 1024 * 1024,
|
||||
// 1mb default
|
||||
key: encodedKey ?? await encodeKey(hasEnvironmentKey() ? await getEnvironmentKey() : await createKey()),
|
||||
sessionConfig: sessionConfigToManifest(settings.config.session),
|
||||
cacheConfig: cacheConfigToManifest(
|
||||
settings.config.experimental?.cache,
|
||||
settings.config.experimental?.routeRules
|
||||
),
|
||||
csp,
|
||||
image: {
|
||||
objectFit: settings.config.image.objectFit,
|
||||
objectPosition: settings.config.image.objectPosition,
|
||||
layout: settings.config.image.layout
|
||||
},
|
||||
devToolbar: {
|
||||
enabled: settings.config.devToolbar.enabled && await settings.preferences.get("devToolbar.enabled"),
|
||||
latestAstroVersion: settings.latestAstroVersion,
|
||||
debugInfoOutput: "",
|
||||
placement: settings.config.devToolbar.placement
|
||||
},
|
||||
logLevel: settings.logLevel,
|
||||
shouldInjectCspMetaTags: false,
|
||||
experimentalQueuedRendering: settings.config.experimental?.queuedRendering
|
||||
};
|
||||
}
|
||||
export {
|
||||
SERIALIZED_MANIFEST_ID,
|
||||
SERIALIZED_MANIFEST_RESOLVED_ID,
|
||||
serializedManifestPlugin
|
||||
};
|
||||
5
node_modules/astro/dist/manifest/virtual-module.d.ts
generated
vendored
Normal file
5
node_modules/astro/dist/manifest/virtual-module.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { Plugin } from 'vite';
|
||||
import type { AstroSettings } from '../types/astro.js';
|
||||
export default function virtualModulePlugin({ settings }: {
|
||||
settings: AstroSettings;
|
||||
}): Plugin;
|
||||
138
node_modules/astro/dist/manifest/virtual-module.js
generated
vendored
Normal file
138
node_modules/astro/dist/manifest/virtual-module.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
||||
import { SERIALIZED_MANIFEST_ID } from "./serialized.js";
|
||||
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
||||
import { fromRoutingStrategy, toFallbackType, toRoutingStrategy } from "../core/app/common.js";
|
||||
const VIRTUAL_SERVER_ID = "astro:config/server";
|
||||
const RESOLVED_VIRTUAL_SERVER_ID = "\0" + VIRTUAL_SERVER_ID;
|
||||
const VIRTUAL_CLIENT_ID = "astro:config/client";
|
||||
const RESOLVED_VIRTUAL_CLIENT_ID = "\0" + VIRTUAL_CLIENT_ID;
|
||||
function virtualModulePlugin({ settings }) {
|
||||
const config = settings.config;
|
||||
let i18nCode = "const i18n = undefined;";
|
||||
if (config.i18n) {
|
||||
const strategy = toRoutingStrategy(config.i18n.routing, config.i18n.domains);
|
||||
const fallbackType = toFallbackType(config.i18n.routing);
|
||||
const routing = fromRoutingStrategy(strategy, fallbackType);
|
||||
i18nCode = `const i18n = {
|
||||
defaultLocale: ${JSON.stringify(config.i18n.defaultLocale)},
|
||||
locales: ${JSON.stringify(config.i18n.locales)},
|
||||
routing: ${JSON.stringify(routing)},
|
||||
fallback: ${JSON.stringify(config.i18n.fallback)}
|
||||
};`;
|
||||
}
|
||||
let imageCode = "const image = undefined;";
|
||||
if (config.image) {
|
||||
imageCode = `const image = {
|
||||
objectFit: ${JSON.stringify(config.image.objectFit)},
|
||||
objectPosition: ${JSON.stringify(config.image.objectPosition)},
|
||||
layout: ${JSON.stringify(config.image.layout)},
|
||||
};`;
|
||||
}
|
||||
const clientConfigCode = `
|
||||
${i18nCode}
|
||||
${imageCode}
|
||||
const base = ${JSON.stringify(config.base)};
|
||||
const trailingSlash = ${JSON.stringify(config.trailingSlash)};
|
||||
const site = ${JSON.stringify(config.site)};
|
||||
const compressHTML = ${JSON.stringify(config.compressHTML)};
|
||||
const build = {
|
||||
format: ${JSON.stringify(config.build.format)},
|
||||
};
|
||||
|
||||
export { base, i18n, trailingSlash, site, compressHTML, build, image };
|
||||
`;
|
||||
return {
|
||||
name: "astro-manifest-plugin",
|
||||
resolveId: {
|
||||
filter: {
|
||||
id: new RegExp(`^(${VIRTUAL_SERVER_ID}|${VIRTUAL_CLIENT_ID})$`)
|
||||
},
|
||||
handler(id) {
|
||||
if (id === VIRTUAL_SERVER_ID) {
|
||||
return RESOLVED_VIRTUAL_SERVER_ID;
|
||||
}
|
||||
if (id === VIRTUAL_CLIENT_ID) {
|
||||
return RESOLVED_VIRTUAL_CLIENT_ID;
|
||||
}
|
||||
}
|
||||
},
|
||||
load: {
|
||||
filter: {
|
||||
id: new RegExp(`^(${RESOLVED_VIRTUAL_SERVER_ID}|${RESOLVED_VIRTUAL_CLIENT_ID})$`)
|
||||
},
|
||||
handler(id) {
|
||||
if (id === RESOLVED_VIRTUAL_CLIENT_ID) {
|
||||
return { code: clientConfigCode };
|
||||
}
|
||||
if (id === RESOLVED_VIRTUAL_SERVER_ID) {
|
||||
if (this.environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.client) {
|
||||
throw new AstroError({
|
||||
...AstroErrorData.ServerOnlyModule,
|
||||
message: AstroErrorData.ServerOnlyModule.message(VIRTUAL_SERVER_ID)
|
||||
});
|
||||
}
|
||||
const code = `
|
||||
import { manifest } from '${SERIALIZED_MANIFEST_ID}'
|
||||
import { fromRoutingStrategy } from "astro/app";
|
||||
|
||||
let i18n = undefined;
|
||||
if (manifest.i18n) {
|
||||
i18n = {
|
||||
defaultLocale: manifest.i18n.defaultLocale,
|
||||
locales: manifest.i18n.locales,
|
||||
routing: fromRoutingStrategy(manifest.i18n.strategy, manifest.i18n.fallbackType),
|
||||
fallback: manifest.i18n.fallback,
|
||||
domains: manifest.i18n.domains,
|
||||
};
|
||||
}
|
||||
|
||||
let image = undefined;
|
||||
if (manifest.image) {
|
||||
image = {
|
||||
objectFit: manifest.image.objectFit,
|
||||
objectPosition: manifest.image.objectPosition,
|
||||
layout: manifest.image.layout,
|
||||
};
|
||||
}
|
||||
|
||||
const base = manifest.base;
|
||||
const build = {
|
||||
server: new URL(manifest.buildServerDir),
|
||||
client: new URL(manifest.buildClientDir),
|
||||
format: manifest.buildFormat,
|
||||
};
|
||||
|
||||
const cacheDir = new URL(manifest.cacheDir);
|
||||
const outDir = new URL(manifest.outDir);
|
||||
const publicDir = new URL(manifest.publicDir);
|
||||
const srcDir = new URL(manifest.srcDir);
|
||||
const root = new URL(manifest.rootDir);
|
||||
const trailingSlash = manifest.trailingSlash;
|
||||
const site = manifest.site;
|
||||
const compressHTML = manifest.compressHTML;
|
||||
|
||||
export {
|
||||
base,
|
||||
build,
|
||||
cacheDir,
|
||||
outDir,
|
||||
publicDir,
|
||||
srcDir,
|
||||
root,
|
||||
trailingSlash,
|
||||
site,
|
||||
compressHTML,
|
||||
i18n,
|
||||
image,
|
||||
};
|
||||
|
||||
`;
|
||||
return { code };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
virtualModulePlugin as default
|
||||
};
|
||||
Reference in New Issue
Block a user