mirror of
https://github.com/withastro/astro.git
synced 2025-03-24 23:21:57 -05:00
* Support the Markdown component in SSR * Adds a changeset * Support runtime markdown in Node.js * Remove option from test adapter
43 lines
1,009 B
JavaScript
43 lines
1,009 B
JavaScript
import { viteID } from '../dist/core/util.js';
|
|
|
|
/**
|
|
*
|
|
* @returns {import('../src/@types/astro').AstroIntegration}
|
|
*/
|
|
export default function () {
|
|
return {
|
|
name: 'my-ssr-adapter',
|
|
hooks: {
|
|
'astro:config:setup': ({ updateConfig }) => {
|
|
updateConfig({
|
|
vite: {
|
|
plugins: [
|
|
{
|
|
resolveId(id) {
|
|
if (id === '@my-ssr') {
|
|
return id;
|
|
} else if (id === 'astro/app') {
|
|
const id = viteID(new URL('../dist/core/app/index.js', import.meta.url));
|
|
return id;
|
|
}
|
|
},
|
|
load(id) {
|
|
if (id === '@my-ssr') {
|
|
return `import { App } from 'astro/app';export function createExports(manifest) { return { manifest, createApp: () => new App(manifest) }; }`;
|
|
}
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
},
|
|
'astro:config:done': ({ setAdapter }) => {
|
|
setAdapter({
|
|
name: 'my-ssr-adapter',
|
|
serverEntrypoint: '@my-ssr',
|
|
exports: ['manifest', 'createApp'],
|
|
});
|
|
}
|
|
},
|
|
};
|
|
}
|