Skip to content

Commit

Permalink
expose svelte/ssr which have noop for lifecycle events (#6416)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhauhau authored Jun 29, 2021
1 parent eadb83b commit e7af4d7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ node_modules
/compiler.d.ts
/compiler.*js
/index.*js
/ssr.*js
/internal
/store
/easing
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
"./transition": {
"import": "./transition/index.mjs",
"require": "./transition/index.js"
},
"./ssr": {
"import": "./ssr.mjs",
"require": "./ssr.js"
}
},
"engines": {
Expand Down
18 changes: 18 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ({
Expand Down
14 changes: 14 additions & 0 deletions src/runtime/ssr.ts
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit e7af4d7

Please sign in to comment.