Skip to content

Commit e7af4d7

Browse files
authored
expose svelte/ssr which have noop for lifecycle events (sveltejs#6416)
1 parent eadb83b commit e7af4d7

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ node_modules
88
/compiler.d.ts
99
/compiler.*js
1010
/index.*js
11+
/ssr.*js
1112
/internal
1213
/store
1314
/easing

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
"./transition": {
5555
"import": "./transition/index.mjs",
5656
"require": "./transition/index.js"
57+
},
58+
"./ssr": {
59+
"import": "./ssr.mjs",
60+
"require": "./ssr.js"
5761
}
5862
},
5963
"engines": {

rollup.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ export default [
4242
plugins: [ts_plugin]
4343
},
4444

45+
{
46+
input: `src/runtime/ssr.ts`,
47+
output: [
48+
{
49+
file: `ssr.mjs`,
50+
format: 'esm',
51+
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}/index.mjs`
52+
},
53+
{
54+
file: `ssr.js`,
55+
format: 'cjs',
56+
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}/index.js`
57+
}
58+
],
59+
external,
60+
plugins: [ts_plugin]
61+
},
62+
4563
...fs.readdirSync('src/runtime')
4664
.filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory())
4765
.map(dir => ({

src/runtime/ssr.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export {
2+
setContext,
3+
getContext,
4+
hasContext,
5+
tick,
6+
createEventDispatcher,
7+
SvelteComponent,
8+
SvelteComponentTyped
9+
} from './index';
10+
11+
export function onMount() {}
12+
export function onDestroy() {}
13+
export function beforeUpdate() {}
14+
export function afterUpdate() {}

0 commit comments

Comments
 (0)