Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
15
node_modules/astro/dist/vite-plugin-environment/index.d.ts
generated
vendored
Normal file
15
node_modules/astro/dist/vite-plugin-environment/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type * as vite from 'vite';
|
||||
import type { AstroSettings } from '../types/astro.js';
|
||||
import type { CrawlFrameworkPkgsResult } from 'vitefu';
|
||||
interface Payload {
|
||||
command: 'dev' | 'build';
|
||||
settings: AstroSettings;
|
||||
astroPkgsConfig: CrawlFrameworkPkgsResult;
|
||||
}
|
||||
/**
|
||||
* This plugin is responsible of setting up the environments of the vite server, such as
|
||||
* dependencies, SSR, etc.
|
||||
*
|
||||
*/
|
||||
export declare function vitePluginEnvironment({ command, settings, astroPkgsConfig, }: Payload): vite.Plugin;
|
||||
export {};
|
||||
76
node_modules/astro/dist/vite-plugin-environment/index.js
generated
vendored
Normal file
76
node_modules/astro/dist/vite-plugin-environment/index.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
||||
import { convertPathToPattern } from "tinyglobby";
|
||||
import { fileURLToPath } from "node:url";
|
||||
const ONLY_DEV_EXTERNAL = [
|
||||
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
|
||||
"prismjs/components/index.js",
|
||||
// Imported by `astro/assets` -> `packages/astro/src/core/logger/core.ts`
|
||||
"string-width"
|
||||
];
|
||||
const ALWAYS_NOEXTERNAL = [
|
||||
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
|
||||
"astro",
|
||||
// Vite fails on nested `.astro` imports without bundling
|
||||
"astro/components",
|
||||
// Handle recommended nanostores. Only @nanostores/preact is required from our testing!
|
||||
// Full explanation and related bug report: https://github.com/withastro/astro/pull/3667
|
||||
"@nanostores/preact",
|
||||
// fontsource packages are CSS that need to be processed
|
||||
"@fontsource/*"
|
||||
];
|
||||
function vitePluginEnvironment({
|
||||
command,
|
||||
settings,
|
||||
astroPkgsConfig
|
||||
}) {
|
||||
const srcDirPattern = convertPathToPattern(fileURLToPath(settings.config.srcDir));
|
||||
return {
|
||||
name: "astro:environment",
|
||||
configEnvironment(environmentName, _options) {
|
||||
const finalEnvironmentOptions = {
|
||||
optimizeDeps: {
|
||||
include: [],
|
||||
exclude: []
|
||||
},
|
||||
resolve: {
|
||||
// Astro imports in third-party packages should use the same version as root
|
||||
dedupe: ["astro"]
|
||||
}
|
||||
};
|
||||
if (environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.astro || environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.prerender || environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.client) {
|
||||
if (_options.resolve?.noExternal !== true) {
|
||||
finalEnvironmentOptions.resolve.noExternal = [
|
||||
...ALWAYS_NOEXTERNAL,
|
||||
...astroPkgsConfig.ssr.noExternal
|
||||
];
|
||||
finalEnvironmentOptions.resolve.external = [
|
||||
...command === "dev" ? ONLY_DEV_EXTERNAL : [],
|
||||
...astroPkgsConfig.ssr.external
|
||||
];
|
||||
}
|
||||
if (_options.optimizeDeps?.noDiscovery === false) {
|
||||
finalEnvironmentOptions.optimizeDeps = {
|
||||
entries: [`${srcDirPattern}**/*.{jsx,tsx,vue,svelte,html,astro}`],
|
||||
include: [],
|
||||
exclude: ["node-fetch"]
|
||||
};
|
||||
}
|
||||
}
|
||||
if (environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.client) {
|
||||
finalEnvironmentOptions.optimizeDeps = {
|
||||
include: [
|
||||
// For the dev toolbar
|
||||
"astro > html-escaper"
|
||||
],
|
||||
exclude: ["astro:*", "virtual:astro:*", "astro/virtual-modules/prefetch.js"],
|
||||
// Astro files can't be rendered on the client
|
||||
entries: [`${srcDirPattern}**/*.{jsx,tsx,vue,svelte,html}`]
|
||||
};
|
||||
}
|
||||
return finalEnvironmentOptions;
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
vitePluginEnvironment
|
||||
};
|
||||
Reference in New Issue
Block a user