diff --git a/.gitignore b/.gitignore index e21a94e698..911ff19cab 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ node_modules /compiler.d.ts /compiler.*js /index.*js +/ssr.*js /internal /store /easing diff --git a/package.json b/package.json index 682f1d547a..316cfcb9b0 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,10 @@ "./transition": { "import": "./transition/index.mjs", "require": "./transition/index.js" + }, + "./ssr": { + "import": "./ssr.mjs", + "require": "./ssr.js" } }, "engines": { diff --git a/rollup.config.js b/rollup.config.js index 81fa24bd9f..b60423c35c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -42,6 +42,24 @@ export default [ plugins: [ts_plugin] }, + { + input: `src/runtime/ssr.ts`, + output: [ + { + file: `ssr.mjs`, + format: 'esm', + paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}/index.mjs` + }, + { + file: `ssr.js`, + format: 'cjs', + paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}/index.js` + } + ], + external, + plugins: [ts_plugin] + }, + ...fs.readdirSync('src/runtime') .filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory()) .map(dir => ({ diff --git a/src/runtime/ssr.ts b/src/runtime/ssr.ts new file mode 100644 index 0000000000..c75bb30349 --- /dev/null +++ b/src/runtime/ssr.ts @@ -0,0 +1,14 @@ +export { + setContext, + getContext, + hasContext, + tick, + createEventDispatcher, + SvelteComponent, + SvelteComponentTyped +} from './index'; + +export function onMount() {} +export function onDestroy() {} +export function beforeUpdate() {} +export function afterUpdate() {}