Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[WIP] Support Svelte 3 #538

Merged
merged 38 commits into from Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
82a023c
various
Rich-Harris Dec 21, 2018
b25c642
upgrade shimport, bump alpha version
Rich-Harris Dec 23, 2018
14fc6b3
support Rollup 1.0
Conduitry Dec 31, 2018
c00af6d
update deps
Rich-Harris Jan 30, 2019
da540ef
update some tests
Rich-Harris Jan 30, 2019
e4319be
error handling
Rich-Harris Jan 30, 2019
83f7102
use nextTick
Rich-Harris Jan 30, 2019
2a82526
bump svelte version
Rich-Harris Jan 30, 2019
3499631
remove experimentalCodeSplitting
Rich-Harris Jan 30, 2019
1f9efd3
fix scrolling to deep links
Rich-Harris Jan 30, 2019
76ce7f2
tidy up test
Rich-Harris Jan 30, 2019
90f3393
default to generating app in src/node_modules/@sapper - fixes #551
Rich-Harris Jan 31, 2019
c990c77
switch to mjs to align with Svelte
Rich-Harris Jan 31, 2019
d486542
update store test
Rich-Harris Jan 31, 2019
f587161
first crack at context-driven store
Rich-Harris Feb 1, 2019
4940c5d
merge master -> svelte-3, fix various typescript and webpack oddities
Rich-Harris Feb 1, 2019
3445ec6
figure out if component has preload early on
Rich-Harris Feb 1, 2019
263bb08
various
Rich-Harris Feb 1, 2019
3bab780
only import preload when appropriate
Rich-Harris Feb 1, 2019
7ba1a0a
fix test
Rich-Harris Feb 1, 2019
548de70
move all page info to app-level stores
Rich-Harris Feb 2, 2019
0168d8b
tidy up
Rich-Harris Feb 2, 2019
6e8ba29
bump svelte version
Rich-Harris Feb 2, 2019
81bbfce
tidy up
Rich-Harris Feb 2, 2019
85c86b5
tidy up
Rich-Harris Feb 2, 2019
b7fce99
simplify
Rich-Harris Feb 2, 2019
3521eff
more tidying up
Rich-Harris Feb 2, 2019
7fefc59
tidy up
Rich-Harris Feb 2, 2019
11d3da3
add session tests
Rich-Harris Feb 2, 2019
91ea033
implement session/preload on server
Rich-Harris Feb 2, 2019
c964500
implement session/preload on client
Rich-Harris Feb 2, 2019
66be631
remove experimentalCodeSplitting
Rich-Harris Feb 3, 2019
3d7cfbb
tidy up
Rich-Harris Feb 3, 2019
0628ea9
minor fixes
Rich-Harris Feb 3, 2019
a85e142
fix segments
Rich-Harris Feb 3, 2019
7150c7e
-> v0.26.0-alpha.3
Rich-Harris Feb 3, 2019
293da8b
fix a cmd-f/cmd-r mistake
Rich-Harris Feb 3, 2019
96b9d19
remove typescript in favour of sucrase
Rich-Harris Feb 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -12,4 +12,5 @@ sapper
runtime.js
dist
!rollup.config.js
templates/*.js
/runtime/app.mjs
/runtime/server.mjs
3 changes: 1 addition & 2 deletions mocha.opts
@@ -1,5 +1,4 @@
--require source-map-support/register
--require ts-node/register
--require sucrase/register
--recursive
test/unit/*/*.ts
test/apps/*/test.ts
1,522 changes: 741 additions & 781 deletions package-lock.json

Large diffs are not rendered by default.

59 changes: 31 additions & 28 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "sapper",
"version": "0.25.0",
"version": "0.26.0-alpha.4",
"description": "Military-grade apps, engineered by Svelte",
"bin": {
"sapper": "./sapper"
Expand All @@ -11,69 +11,72 @@
"config",
"sapper",
"dist/*.js",
"templates/*.js"
"runtime/*.mjs",
"runtime/internal"
],
"directories": {
"test": "test"
},
"dependencies": {
"html-minifier": "^3.5.20",
"shimport": "0.0.11",
"source-map-support": "^0.5.9",
"sourcemap-codec": "^1.4.3",
"html-minifier": "^3.5.21",
"shimport": "0.0.14",
"source-map-support": "^0.5.10",
"sourcemap-codec": "^1.4.4",
"string-hash": "^1.1.3",
"tslib": "^1.9.3"
},
"devDependencies": {
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.0",
"@types/puppeteer": "^1.9.0",
"@types/node": "^10.12.21",
"@types/puppeteer": "^1.11.3",
"@types/rimraf": "^2.0.2",
"agadoo": "^1.0.1",
"cheap-watch": "^1.0.0",
"cheap-watch": "^1.0.2",
"cookie": "^0.3.1",
"devalue": "^1.0.4",
"eslint": "^5.7.0",
"eslint-plugin-import": "^2.14.0",
"kleur": "^2.0.2",
"devalue": "^1.1.0",
"eslint": "^5.12.1",
"eslint-plugin-import": "^2.16.0",
"kleur": "^3.0.1",
"mkdirp": "^0.5.1",
"mocha": "^5.2.0",
"node-fetch": "^2.2.0",
"node-fetch": "^2.3.0",
"npm-run-all": "^4.1.5",
"polka": "^0.5.1",
"port-authority": "^1.0.5",
"pretty-bytes": "^5.1.0",
"puppeteer": "^1.9.0",
"puppeteer": "^1.12.0",
"require-relative": "^0.8.7",
"rimraf": "^2.6.2",
"rollup": "^0.66.6",
"rimraf": "^2.6.3",
"rollup": "^1.1.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-svelte": "^4.3.2",
"rollup-plugin-typescript": "^1.0.0",
"sade": "^1.4.1",
"rollup-plugin-sucrase": "^2.1.0",
"rollup-plugin-svelte": "^5.0.1",
"sade": "^1.4.2",
"sander": "^0.6.0",
"sirv": "^0.2.2",
"svelte": "^2.13.5",
"svelte-loader": "^2.11.0",
"ts-node": "^7.0.1",
"typescript": "^3.1.3",
"webpack": "^4.20.2",
"webpack-format-messages": "^2.0.3",
"sucrase": "^3.9.5",
"svelte": "^3.0.0-alpha27",
"svelte-loader": "^2.12.0",
"webpack": "^4.29.0",
"webpack-format-messages": "^2.0.5",
"yootils": "0.0.14"
},
"peerDependencies": {
"svelte": "^3.0.0"
},
"scripts": {
"test": "mocha --opts mocha.opts",
"pretest": "npm run build",
"build": "rm -rf dist && rollup -c",
"prepare": "npm run build",
"dev": "rollup -cw",
"prepublishOnly": "npm test",
"update_mime_types": "curl http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | grep -e \"^[^#]\" > templates/src/server/middleware/mime-types.md"
"update_mime_types": "curl http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | grep -e \"^[^#]\" > runtime/src/server/middleware/mime-types.md"
},
"repository": "https://github.com/sveltejs/sapper",
"keywords": [
Expand Down
35 changes: 19 additions & 16 deletions rollup.config.js
@@ -1,4 +1,4 @@
import typescript from 'rollup-plugin-typescript';
import sucrase from 'rollup-plugin-sucrase';
import string from 'rollup-plugin-string';
import json from 'rollup-plugin-json';
import resolve from 'rollup-plugin-node-resolve';
Expand All @@ -12,31 +12,33 @@ const external = [].concat(
'sapper/core.js'
);

function template(kind, external, target) {
function template(kind, external) {
return {
input: `templates/src/${kind}/index.ts`,
input: `runtime/src/${kind}/index.ts`,
output: {
file: `templates/${kind}.js`,
format: 'es'
file: `runtime/${kind}.mjs`,
format: 'es',
paths: id => id.replace('@sapper', '.')
},
external,
plugins: [
resolve(),
resolve({
extensions: ['.mjs', '.js', '.ts']
}),
commonjs(),
string({
include: '**/*.md'
}),
typescript({
typescript: require('typescript'),
target
sucrase({
transforms: ['typescript']
})
]
};
}

export default [
template('client', ['__ROOT__', '__ERROR__'], 'ES2017'),
template('server', builtinModules, 'ES2015'),
template('app', id => /^(svelte\/?|@sapper\/)/.test(id)),
template('server', id => builtinModules.includes(id)),

{
input: [
Expand All @@ -54,12 +56,13 @@ export default [
external,
plugins: [
json(),
resolve(),
resolve({
extensions: ['.mjs', '.js', '.ts']
}),
commonjs(),
typescript({
typescript: require('typescript')
sucrase({
transforms: ['typescript']
})
],
experimentalCodeSplitting: true
]
}
];
12 changes: 12 additions & 0 deletions runtime/internal/Sapper.html
@@ -0,0 +1,12 @@
<script>
import { setContext } from 'svelte';
import { CONTEXT_KEY } from './shared';

export let Root;
export let props;
export let session;

setContext(CONTEXT_KEY, session);
</script>

<Root {...props}/>
1 change: 1 addition & 0 deletions runtime/internal/layout.html
@@ -0,0 +1 @@
<svelte:component this={child.component} {...child.props}/>
10 changes: 10 additions & 0 deletions runtime/internal/shared.mjs
@@ -0,0 +1,10 @@
import { writable } from 'svelte/store';

export const stores = {
preloading: writable(false),
page: writable(null)
};

export const CONTEXT_KEY = {};

export const preload = () => ({});