🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

7
node_modules/astro/dist/config/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
import type { UserConfig } from 'vite';
import type { AstroUserConfig } from '../@types/astro';
export declare function defineConfig(config: AstroUserConfig): AstroUserConfig;
export declare function getViteConfig(inlineConfig: UserConfig): ({ mode, command }: {
mode: string;
command: 'serve' | 'build';
}) => Promise<Record<string, any>>;

48
node_modules/astro/dist/config/index.js generated vendored Normal file
View file

@ -0,0 +1,48 @@
function defineConfig(config) {
return config;
}
function getViteConfig(inlineConfig) {
return async ({ mode, command }) => {
const cmd = command === "serve" ? "dev" : command;
const [
fs,
{ mergeConfig },
{ nodeLogDestination },
{ openConfig, createSettings },
{ createVite },
{ runHookConfigSetup, runHookConfigDone },
{ astroContentListenPlugin }
] = await Promise.all([
import("node:fs"),
import("vite"),
import("../core/logger/node.js"),
import("../core/config/index.js"),
import("../core/create-vite.js"),
import("../integrations/index.js"),
import("./vite-plugin-content-listen.js")
]);
const logging = {
dest: nodeLogDestination,
level: "info"
};
const { astroConfig: config } = await openConfig({ cmd });
const settings = createSettings(config, inlineConfig.root);
await runHookConfigSetup({ settings, command: cmd, logging });
const viteConfig = await createVite(
{
mode,
plugins: [
// Initialize the content listener
astroContentListenPlugin({ settings, logging, fs })
]
},
{ settings, logging, mode }
);
await runHookConfigDone({ settings, logging });
return mergeConfig(viteConfig, inlineConfig);
};
}
export {
defineConfig,
getViteConfig
};

View file

@ -0,0 +1,18 @@
/// <reference types="node" />
import type fsMod from 'node:fs';
import type { Plugin } from 'vite';
import type { AstroSettings } from '../@types/astro';
import type { LogOptions } from '../core/logger/core.js';
/**
* Listen for Astro content directory changes and generate types.
*
* This is a separate plugin for `getViteConfig` as the `attachContentServerListeners` API
* needs to be called at different times in `astro dev` and `getViteConfig`. For `astro dev`,
* it needs to be called after the Astro server is started (packages/astro/src/core/dev/dev.ts).
* For `getViteConfig`, it needs to be called after the Vite server is started.
*/
export declare function astroContentListenPlugin({ settings, logging, fs, }: {
settings: AstroSettings;
logging: LogOptions;
fs: typeof fsMod;
}): Plugin;

View file

@ -0,0 +1,26 @@
import { attachContentServerListeners } from "../content/server-listeners.js";
function astroContentListenPlugin({
settings,
logging,
fs
}) {
let server;
return {
name: "astro:content-listen",
apply: "serve",
configureServer(_server) {
server = _server;
},
async buildStart() {
await attachContentServerListeners({
fs,
settings,
logging,
viteServer: server
});
}
};
}
export {
astroContentListenPlugin
};