Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
2
node_modules/astro/dist/vite-plugin-pages/const.d.ts
generated
vendored
Normal file
2
node_modules/astro/dist/vite-plugin-pages/const.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const VIRTUAL_PAGE_MODULE_ID = "virtual:astro:page:";
|
||||
export declare const VIRTUAL_PAGE_RESOLVED_MODULE_ID: string;
|
||||
6
node_modules/astro/dist/vite-plugin-pages/const.js
generated
vendored
Normal file
6
node_modules/astro/dist/vite-plugin-pages/const.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const VIRTUAL_PAGE_MODULE_ID = "virtual:astro:page:";
|
||||
const VIRTUAL_PAGE_RESOLVED_MODULE_ID = "\0" + VIRTUAL_PAGE_MODULE_ID;
|
||||
export {
|
||||
VIRTUAL_PAGE_MODULE_ID,
|
||||
VIRTUAL_PAGE_RESOLVED_MODULE_ID
|
||||
};
|
||||
2
node_modules/astro/dist/vite-plugin-pages/index.d.ts
generated
vendored
Normal file
2
node_modules/astro/dist/vite-plugin-pages/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { pluginPage } from './page.js';
|
||||
export { pluginPages, VIRTUAL_PAGES_MODULE_ID } from './pages.js';
|
||||
7
node_modules/astro/dist/vite-plugin-pages/index.js
generated
vendored
Normal file
7
node_modules/astro/dist/vite-plugin-pages/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { pluginPage } from "./page.js";
|
||||
import { pluginPages, VIRTUAL_PAGES_MODULE_ID } from "./pages.js";
|
||||
export {
|
||||
VIRTUAL_PAGES_MODULE_ID,
|
||||
pluginPage,
|
||||
pluginPages
|
||||
};
|
||||
7
node_modules/astro/dist/vite-plugin-pages/page.d.ts
generated
vendored
Normal file
7
node_modules/astro/dist/vite-plugin-pages/page.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import type { RoutesList } from '../types/astro.js';
|
||||
interface PagePluginOptions {
|
||||
routesList: RoutesList;
|
||||
}
|
||||
export declare function pluginPage({ routesList }: PagePluginOptions): VitePlugin;
|
||||
export {};
|
||||
54
node_modules/astro/dist/vite-plugin-pages/page.js
generated
vendored
Normal file
54
node_modules/astro/dist/vite-plugin-pages/page.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { prependForwardSlash } from "../core/path.js";
|
||||
import { DEFAULT_COMPONENTS } from "../core/routing/default.js";
|
||||
import { routeIsRedirect } from "../core/routing/helpers.js";
|
||||
import { VIRTUAL_PAGE_MODULE_ID, VIRTUAL_PAGE_RESOLVED_MODULE_ID } from "./const.js";
|
||||
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
||||
function pluginPage({ routesList }) {
|
||||
return {
|
||||
name: "@astro/plugin-page",
|
||||
applyToEnvironment(environment) {
|
||||
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
||||
},
|
||||
resolveId: {
|
||||
filter: {
|
||||
id: new RegExp(`^${VIRTUAL_PAGE_MODULE_ID}`)
|
||||
},
|
||||
handler(id) {
|
||||
return VIRTUAL_PAGE_RESOLVED_MODULE_ID + id.slice(VIRTUAL_PAGE_MODULE_ID.length);
|
||||
}
|
||||
},
|
||||
load: {
|
||||
filter: {
|
||||
id: new RegExp(`^${VIRTUAL_PAGE_RESOLVED_MODULE_ID}`)
|
||||
},
|
||||
handler(id) {
|
||||
const componentPath = getComponentFromVirtualModulePageName(
|
||||
VIRTUAL_PAGE_RESOLVED_MODULE_ID,
|
||||
id
|
||||
);
|
||||
if (DEFAULT_COMPONENTS.some((component) => componentPath === component)) {
|
||||
return { code: "" };
|
||||
}
|
||||
const routes = routesList.routes.filter((route) => route.component === componentPath);
|
||||
for (const route of routes) {
|
||||
if (routeIsRedirect(route)) {
|
||||
continue;
|
||||
}
|
||||
const astroModuleId = prependForwardSlash(componentPath);
|
||||
const imports = [];
|
||||
const exports = [];
|
||||
imports.push(`import * as _page from ${JSON.stringify(astroModuleId)};`);
|
||||
exports.push(`export const page = () => _page`);
|
||||
return { code: `${imports.join("\n")}
|
||||
${exports.join("\n")}` };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function getComponentFromVirtualModulePageName(virtualModulePrefix, id) {
|
||||
return id.slice(virtualModulePrefix.length).replace(/@_@/g, ".");
|
||||
}
|
||||
export {
|
||||
pluginPage
|
||||
};
|
||||
8
node_modules/astro/dist/vite-plugin-pages/pages.d.ts
generated
vendored
Normal file
8
node_modules/astro/dist/vite-plugin-pages/pages.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import type { RoutesList } from '../types/astro.js';
|
||||
export declare const VIRTUAL_PAGES_MODULE_ID = "virtual:astro:pages";
|
||||
interface PagesPluginOptions {
|
||||
routesList: RoutesList;
|
||||
}
|
||||
export declare function pluginPages({ routesList }: PagesPluginOptions): VitePlugin;
|
||||
export {};
|
||||
79
node_modules/astro/dist/vite-plugin-pages/pages.js
generated
vendored
Normal file
79
node_modules/astro/dist/vite-plugin-pages/pages.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
import { DEFAULT_COMPONENTS } from "../core/routing/default.js";
|
||||
import { routeIsRedirect } from "../core/routing/helpers.js";
|
||||
import { VIRTUAL_PAGE_MODULE_ID } from "./const.js";
|
||||
import { getVirtualModulePageName } from "./util.js";
|
||||
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
||||
const VIRTUAL_PAGES_MODULE_ID = "virtual:astro:pages";
|
||||
const VIRTUAL_PAGES_RESOLVED_MODULE_ID = "\0" + VIRTUAL_PAGES_MODULE_ID;
|
||||
function getRoutesForEnvironment(routes, isPrerender) {
|
||||
const result = /* @__PURE__ */ new Set();
|
||||
for (const route of routes) {
|
||||
if (route.prerender === isPrerender) {
|
||||
result.add(route);
|
||||
}
|
||||
if (route.redirectRoute) {
|
||||
result.add(route.redirectRoute);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function pluginPages({ routesList }) {
|
||||
return {
|
||||
name: "@astro/plugin-pages",
|
||||
enforce: "post",
|
||||
applyToEnvironment(environment) {
|
||||
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
||||
},
|
||||
resolveId: {
|
||||
filter: {
|
||||
id: new RegExp(`^${VIRTUAL_PAGES_MODULE_ID}$`)
|
||||
},
|
||||
handler() {
|
||||
return VIRTUAL_PAGES_RESOLVED_MODULE_ID;
|
||||
}
|
||||
},
|
||||
load: {
|
||||
filter: {
|
||||
id: new RegExp(`^${VIRTUAL_PAGES_RESOLVED_MODULE_ID}$`)
|
||||
},
|
||||
async handler() {
|
||||
const imports = [];
|
||||
const pageMap = [];
|
||||
let i = 0;
|
||||
const envName = this.environment.name;
|
||||
const isSSR = envName === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
|
||||
const isPrerender = envName === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
||||
const routes = isSSR || isPrerender ? getRoutesForEnvironment(routesList.routes, isPrerender) : new Set(routesList.routes);
|
||||
for (const route of routes) {
|
||||
if (routeIsRedirect(route)) {
|
||||
continue;
|
||||
}
|
||||
if (DEFAULT_COMPONENTS.some((component) => route.component === component)) {
|
||||
continue;
|
||||
}
|
||||
const virtualModuleName = getVirtualModulePageName(
|
||||
VIRTUAL_PAGE_MODULE_ID,
|
||||
route.component
|
||||
);
|
||||
const module = await this.resolve(virtualModuleName);
|
||||
if (module) {
|
||||
const variable = `_page${i}`;
|
||||
imports.push(`const ${variable} = () => import("${virtualModuleName}");`);
|
||||
pageMap.push(`[${JSON.stringify(route.component)}, ${variable}]`);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
const pageMapCode = `const pageMap = new Map([
|
||||
${pageMap.join(",\n ")}
|
||||
]);
|
||||
|
||||
export { pageMap };`;
|
||||
return { code: [...imports, pageMapCode].join("\n") };
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
VIRTUAL_PAGES_MODULE_ID,
|
||||
pluginPages
|
||||
};
|
||||
8
node_modules/astro/dist/vite-plugin-pages/util.d.ts
generated
vendored
Normal file
8
node_modules/astro/dist/vite-plugin-pages/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Prevents Rollup from triggering other plugins in the process by masking the extension (hence the virtual file).
|
||||
* Inverse function of getComponentFromVirtualModulePageName() below.
|
||||
* @param virtualModulePrefix The prefix used to create the virtual module
|
||||
* @param path Page component path
|
||||
*/
|
||||
export declare function getVirtualModulePageName(virtualModulePrefix: string, path: string): string;
|
||||
export declare function getVirtualModulePageNameForComponent(component: string): string;
|
||||
15
node_modules/astro/dist/vite-plugin-pages/util.js
generated
vendored
Normal file
15
node_modules/astro/dist/vite-plugin-pages/util.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { fileExtension } from "@astrojs/internal-helpers/path";
|
||||
import { VIRTUAL_PAGE_MODULE_ID } from "./const.js";
|
||||
const ASTRO_PAGE_EXTENSION_POST_PATTERN = "@_@";
|
||||
function getVirtualModulePageName(virtualModulePrefix, path) {
|
||||
const extension = fileExtension(path);
|
||||
return virtualModulePrefix + (extension.startsWith(".") ? path.slice(0, -extension.length) + extension.replace(".", ASTRO_PAGE_EXTENSION_POST_PATTERN) : path);
|
||||
}
|
||||
function getVirtualModulePageNameForComponent(component) {
|
||||
const virtualModuleName = getVirtualModulePageName(VIRTUAL_PAGE_MODULE_ID, component);
|
||||
return virtualModuleName;
|
||||
}
|
||||
export {
|
||||
getVirtualModulePageName,
|
||||
getVirtualModulePageNameForComponent
|
||||
};
|
||||
Reference in New Issue
Block a user