`.
+
+`scale` accepts the following parameters:
+
+* `delay` (`number`, default 0) — milliseconds before starting
+* `speed` (`number`, default undefined) - the speed of the animation, see below.
+* `duration` (`number` | `function`, default 800) — milliseconds the transition lasts
+* `easing` (`function`, default `cubicInOut`) — an [easing function](docs#svelte_easing)
+
+The `speed` parameter is a means of setting the duration of the transition relative to the path's length. It is modifier that is applied to the length of the path: `duration = length / speed`. A path that is 1000 pixels with a speed of 1 will have a duration of `1000ms`, setting the speed to `0.5` will halve that duration and setting it to `2` will double it.
+
+```html
+
+
+
+ {#if condition}
+
+ {/if}
+
+
+```
+
+
+
+
-* fade, fly, slide, scale, draw
-* crossfade...
### `svelte/animate`
diff --git a/site/content/docs/04-compile-time.md b/site/content/docs/04-compile-time.md
index b019b9437b..c219bae497 100644
--- a/site/content/docs/04-compile-time.md
+++ b/site/content/docs/04-compile-time.md
@@ -308,8 +308,8 @@ const { code } = svelte.preprocess(source, [
```js
walk(ast: Node, {
- enter(node: Node, parent: Node)?: void,
- leave(node: Node, parent: Node)?: void
+ enter(node: Node, parent: Node, prop: string, index: number)?: void,
+ leave(node: Node, parent: Node, prop: string, index: number)?: void
})
```
@@ -323,13 +323,13 @@ The walker takes an abstract syntax tree to walk and an object with two optional
```js
const svelte = require('svelte/compiler');
svelte.walk(ast, {
- enter(node, parent) {
+ enter(node, parent, prop, index) {
do_something(node);
if (should_skip_children(node)) {
this.skip();
}
},
- leave(node, parent) {
+ leave(node, parent, prop, index) {
do_something_else(node);
}
});
diff --git a/site/content/examples/10-animations/00-animate/App.svelte b/site/content/examples/10-animations/00-animate/App.svelte
index c46096c204..faba1dd062 100644
--- a/site/content/examples/10-animations/00-animate/App.svelte
+++ b/site/content/examples/10-animations/00-animate/App.svelte
@@ -1,8 +1,9 @@
\ No newline at end of file
+
diff --git a/site/content/examples/10-animations/00-animate/crossfade.js b/site/content/examples/10-animations/00-animate/crossfade.js
deleted file mode 100644
index e11e18b60e..0000000000
--- a/site/content/examples/10-animations/00-animate/crossfade.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import { quintOut } from 'svelte/easing';
-
-export default function crossfade({ send, receive, fallback }) {
- let requested = new Map();
- let provided = new Map();
-
- function crossfade(from, node) {
- const to = node.getBoundingClientRect();
- const dx = from.left - to.left;
- const dy = from.top - to.top;
-
- const style = getComputedStyle(node);
- const transform = style.transform === 'none' ? '' : style.transform;
-
- return {
- duration: 400,
- easing: quintOut,
- css: (t, u) => `
- opacity: ${t};
- transform: ${transform} translate(${u * dx}px,${u * dy}px);
- `
- };
- }
-
- return {
- send(node, params) {
- provided.set(params.key, {
- rect: node.getBoundingClientRect()
- });
-
- return () => {
- if (requested.has(params.key)) {
- const { rect } = requested.get(params.key);
- requested.delete(params.key);
-
- return crossfade(rect, node);
- }
-
- // if the node is disappearing altogether
- // (i.e. wasn't claimed by the other list)
- // then we need to supply an outro
- provided.delete(params.key);
- return fallback(node, params);
- };
- },
-
- receive(node, params) {
- requested.set(params.key, {
- rect: node.getBoundingClientRect()
- });
-
- return () => {
- if (provided.has(params.key)) {
- const { rect } = provided.get(params.key);
- provided.delete(params.key);
-
- return crossfade(rect, node);
- }
-
- requested.delete(params.key);
- return fallback(node, params);
- };
- }
- };
-}
\ No newline at end of file
diff --git a/site/content/examples/19-7guis/05-7guis-crud/App.svelte b/site/content/examples/19-7guis/05-7guis-crud/App.svelte
index 1f39fe6642..a0d6ef7f3e 100644
--- a/site/content/examples/19-7guis/05-7guis-crud/App.svelte
+++ b/site/content/examples/19-7guis/05-7guis-crud/App.svelte
@@ -30,10 +30,7 @@
$: selected = filteredPeople[i];
- $: {
- first = selected ? selected.first : '';
- last = selected ? selected.last : '';
- }
+ $: reset_inputs(selected);
function create() {
people = people.concat({ first, last });
@@ -53,7 +50,8 @@
}
function reset_inputs(person) {
- ({ first, last } = person);
+ first = person ? person.first : '';
+ last = person ? person.last : '';
}
diff --git a/site/content/examples/20-miscellaneous/02-immutable-data/flash.js b/site/content/examples/20-miscellaneous/02-immutable-data/flash.js
index 8dff9cbe2f..c788cc6d35 100644
--- a/site/content/examples/20-miscellaneous/02-immutable-data/flash.js
+++ b/site/content/examples/20-miscellaneous/02-immutable-data/flash.js
@@ -1,11 +1,13 @@
export default function flash(element) {
- element.style.transition = 'none';
- element.style.color = 'rgba(255,62,0,1)';
- element.style.backgroundColor = 'rgba(255,62,0,0.2)';
+ requestAnimationFrame(() => {
+ element.style.transition = 'none';
+ element.style.color = 'rgba(255,62,0,1)';
+ element.style.backgroundColor = 'rgba(255,62,0,0.2)';
- setTimeout(() => {
- element.style.transition = 'color 1s, background 1s';
- element.style.color = '';
- element.style.backgroundColor = '';
+ setTimeout(() => {
+ element.style.transition = 'color 1s, background 1s';
+ element.style.color = '';
+ element.style.backgroundColor = '';
+ });
});
}
\ No newline at end of file
diff --git a/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md b/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
index 6deaad5837..1fd6774b8a 100644
--- a/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
+++ b/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
@@ -16,7 +16,7 @@ That's better. But Svelte is giving us a warning:
When building web apps, it's important to make sure that they're *accessible* to the broadest possible userbase, including people with (for example) impaired vision or motion, or people without powerful hardware or good internet connections. Accessibility (shortened to a11y) isn't always easy to get right, but Svelte will help by warning you if you write inaccessible markup.
-In this case, we're missing the `alt` tag that describes the image for people using screenreaders, or people with slow or flaky internet connections that can't download the image. Let's add one:
+In this case, we're missing the `alt` attribute that describes the image for people using screenreaders, or people with slow or flaky internet connections that can't download the image. Let's add one:
```html
diff --git a/site/content/tutorial/06-bindings/01-text-inputs/text.md b/site/content/tutorial/06-bindings/01-text-inputs/text.md
index 0082586133..7bcbc96fa6 100644
--- a/site/content/tutorial/06-bindings/01-text-inputs/text.md
+++ b/site/content/tutorial/06-bindings/01-text-inputs/text.md
@@ -4,7 +4,7 @@ title: Text inputs
As a general rule, data flow in Svelte is *top down* — a parent component can set props on a child component, and a component can set attributes on an element, but not the other way around.
-Sometimes it's useful to break that rule. Take the case of the ` ` element in this component — we *could* add an `on:input` event handler that set the value of `name` to `event.target.value`, but it's a bit... boilerplatey. It gets even worse with other kinds of form element, as we'll see.
+Sometimes it's useful to break that rule. Take the case of the ` ` element in this component — we *could* add an `on:input` event handler that set the value of `name` to `event.target.value`, but it's a bit... boilerplatey. It gets even worse with other form elements, as we'll see.
Instead, we can use the `bind:value` directive:
@@ -12,4 +12,4 @@ Instead, we can use the `bind:value` directive:
```
-This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`.
\ No newline at end of file
+This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`.
diff --git a/site/content/tutorial/10-transitions/03-in-and-out/text.md b/site/content/tutorial/10-transitions/03-in-and-out/text.md
index 21cb221342..1f1ac2c80b 100644
--- a/site/content/tutorial/10-transitions/03-in-and-out/text.md
+++ b/site/content/tutorial/10-transitions/03-in-and-out/text.md
@@ -2,7 +2,13 @@
title: In and out
---
-Instead of the `transition` directive, an element can have an `in` or an `out` directive, or both together:
+Instead of the `transition` directive, an element can have an `in` or an `out` directive, or both together. Import `fade` alongside `fly`...
+
+```js
+import { fade, fly } from 'svelte/transition';
+```
+
+...then replace the `transition` directive with separate `in` and `out` directives:
```html
diff --git a/site/content/tutorial/12-actions/01-actions/text.md b/site/content/tutorial/12-actions/01-actions/text.md
index 279dc3123f..38de8f9a65 100644
--- a/site/content/tutorial/12-actions/01-actions/text.md
+++ b/site/content/tutorial/12-actions/01-actions/text.md
@@ -27,7 +27,7 @@ import { pannable } from './pannable.js';
>
```
-Open the `pannable.js` file. Like transition functions, an action function receives a `node` and some optional parameters, and returns an action object. That object must have a `destroy` function, which is called when the element is unmounted.
+Open the `pannable.js` file. Like transition functions, an action function receives a `node` and some optional parameters, and returns an action object. That object can have a `destroy` function, which is called when the element is unmounted.
We want to fire `panstart` event when the user mouses down on the element, `panmove` events (with `dx` and `dy` properties showing how far the mouse moved) when they drag it, and `panend` events when they mouse up. One possible implementation looks like this:
@@ -84,4 +84,3 @@ export function pannable(node) {
Update the `pannable` function and try moving the box around.
> This implementation is for demonstration purposes — a more complete one would also consider touch events.
-
diff --git a/site/content/tutorial/16-special-elements/07-svelte-options/app-a/flash.js b/site/content/tutorial/16-special-elements/07-svelte-options/app-a/flash.js
index 8dff9cbe2f..c788cc6d35 100644
--- a/site/content/tutorial/16-special-elements/07-svelte-options/app-a/flash.js
+++ b/site/content/tutorial/16-special-elements/07-svelte-options/app-a/flash.js
@@ -1,11 +1,13 @@
export default function flash(element) {
- element.style.transition = 'none';
- element.style.color = 'rgba(255,62,0,1)';
- element.style.backgroundColor = 'rgba(255,62,0,0.2)';
+ requestAnimationFrame(() => {
+ element.style.transition = 'none';
+ element.style.color = 'rgba(255,62,0,1)';
+ element.style.backgroundColor = 'rgba(255,62,0,0.2)';
- setTimeout(() => {
- element.style.transition = 'color 1s, background 1s';
- element.style.color = '';
- element.style.backgroundColor = '';
+ setTimeout(() => {
+ element.style.transition = 'color 1s, background 1s';
+ element.style.color = '';
+ element.style.backgroundColor = '';
+ });
});
}
\ No newline at end of file
diff --git a/site/content/tutorial/16-special-elements/07-svelte-options/app-b/flash.js b/site/content/tutorial/16-special-elements/07-svelte-options/app-b/flash.js
index 8dff9cbe2f..c788cc6d35 100644
--- a/site/content/tutorial/16-special-elements/07-svelte-options/app-b/flash.js
+++ b/site/content/tutorial/16-special-elements/07-svelte-options/app-b/flash.js
@@ -1,11 +1,13 @@
export default function flash(element) {
- element.style.transition = 'none';
- element.style.color = 'rgba(255,62,0,1)';
- element.style.backgroundColor = 'rgba(255,62,0,0.2)';
+ requestAnimationFrame(() => {
+ element.style.transition = 'none';
+ element.style.color = 'rgba(255,62,0,1)';
+ element.style.backgroundColor = 'rgba(255,62,0,0.2)';
- setTimeout(() => {
- element.style.transition = 'color 1s, background 1s';
- element.style.color = '';
- element.style.backgroundColor = '';
+ setTimeout(() => {
+ element.style.transition = 'color 1s, background 1s';
+ element.style.color = '';
+ element.style.backgroundColor = '';
+ });
});
}
\ No newline at end of file
diff --git a/site/package-lock.json b/site/package-lock.json
index b0899b1779..b61cee722e 100644
--- a/site/package-lock.json
+++ b/site/package-lock.json
@@ -33,23 +33,6 @@
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
- },
- "dependencies": {
- "debug": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
- "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
- "dev": true,
- "requires": {
- "ms": "^2.1.1"
- }
- },
- "ms": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
- "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
- "dev": true
- }
}
},
"@babel/generator": {
@@ -808,23 +791,6 @@
"debug": "^4.1.0",
"globals": "^11.1.0",
"lodash": "^4.17.11"
- },
- "dependencies": {
- "debug": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
- "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
- "dev": true,
- "requires": {
- "ms": "^2.1.1"
- }
- },
- "ms": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
- "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
- "dev": true
- }
}
},
"@babel/types": {
@@ -1366,14 +1332,14 @@
"integrity": "sha512-ym6ooqMr09+cV+y52p5kszJ0jYcX+nJfm8POrQb7QYowvpPPuneZ71EclHrQSB7a50lcytgR/xtL6AUFdvyEkg=="
},
"@polka/send": {
- "version": "1.0.0-next.2",
- "resolved": "https://registry.npmjs.org/@polka/send/-/send-1.0.0-next.2.tgz",
- "integrity": "sha512-eq8gUzykpYPuOMrnyAzsL4KunhQXZKFiNsbThAwh19PrBAz2v8mECsj3YnxjYYifbB1w1vhR74nsXQWDi80oAg=="
+ "version": "1.0.0-next.3",
+ "resolved": "https://registry.npmjs.org/@polka/send/-/send-1.0.0-next.3.tgz",
+ "integrity": "sha512-54ftOGSZQMx8Xh8pnPgAj4499wppAEHQ892A7WacYOJ7ySuCWVgFmpODmXC2hU7qD9Scbi0iAu8rZls3ld+Eyg=="
},
"@polka/url": {
- "version": "1.0.0-next.1",
- "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.1.tgz",
- "integrity": "sha512-6d8YbKW4hjJMnU6ZJSDLtALWiB4J//OIPaP885ruf5U8MLZHigocDxhjgvLwbV6bGkikhllgTjD9eWioKWAQdA=="
+ "version": "1.0.0-next.3",
+ "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.3.tgz",
+ "integrity": "sha512-Uom7l6OeP6vcf85lMImelYu5WKVWjXyhkpi9WsRdRzlJFJFPVhjBtBCktgDUj7dk1N5FURUdegSZ5XOjxf8JZg=="
},
"@sindresorhus/slugify": {
"version": "0.9.1",
@@ -1396,9 +1362,9 @@
}
},
"@sveltejs/svelte-repl": {
- "version": "0.0.10",
- "resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.0.10.tgz",
- "integrity": "sha512-PYXCN8OC2q3WzwtMcbFinLGzFI7RlD3cHqjkUuQWDaIMHriKYuALun4H/FxP8w3B3hNe9OBprgGmBzlkPuGEJw==",
+ "version": "0.0.11",
+ "resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.0.11.tgz",
+ "integrity": "sha512-F284f8qaUs1rp8akqWXcB6oovlaso7qmsUz1rqm80FwUKLffjYIWy2a1p6+Yo1kRy6Q+fW8kj21JLEqv7pjOwA==",
"dev": true,
"requires": {
"codemirror": "^5.45.0",
@@ -1412,9 +1378,9 @@
"dev": true
},
"@types/node": {
- "version": "11.13.8",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.8.tgz",
- "integrity": "sha512-szA3x/3miL90ZJxUCzx9haNbK5/zmPieGraZEe4WI+3srN0eGLiT22NXeMHmyhNEopn+IrxqMc7wdVwvPl8meg==",
+ "version": "12.0.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz",
+ "integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==",
"dev": true
},
"@types/pg": {
@@ -1660,14 +1626,14 @@
"dev": true
},
"browserslist": {
- "version": "4.5.6",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.5.6.tgz",
- "integrity": "sha512-o/hPOtbU9oX507lIqon+UvPYqpx3mHc8cV3QemSBTXwkG8gSQSK6UKvXcE/DcleU3+A59XTUHyCvZ5qGy8xVAg==",
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.0.tgz",
+ "integrity": "sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg==",
"dev": true,
"requires": {
- "caniuse-lite": "^1.0.30000963",
- "electron-to-chromium": "^1.3.127",
- "node-releases": "^1.1.17"
+ "caniuse-lite": "^1.0.30000967",
+ "electron-to-chromium": "^1.3.133",
+ "node-releases": "^1.1.19"
}
},
"buffer": {
@@ -1742,9 +1708,9 @@
"dev": true
},
"caniuse-lite": {
- "version": "1.0.30000963",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000963.tgz",
- "integrity": "sha512-n4HUiullc7Lw0LyzpeLa2ffP8KxFBGdxqD/8G3bSL6oB758hZ2UE2CVK+tQN958tJIi0/tfpjAc67aAtoHgnrQ==",
+ "version": "1.0.30000967",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000967.tgz",
+ "integrity": "sha512-rUBIbap+VJfxTzrM4akJ00lkvVb5/n5v3EGXfWzSH5zT8aJmGzjA8HWhJ4U6kCpzxozUSnB+yvAYDRPY6mRpgQ==",
"dev": true
},
"chalk": {
@@ -1970,12 +1936,12 @@
}
},
"debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"dev": true,
"requires": {
- "ms": "2.0.0"
+ "ms": "^2.1.1"
}
},
"decamelize": {
@@ -2096,9 +2062,9 @@
}
},
"electron-to-chromium": {
- "version": "1.3.129",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.129.tgz",
- "integrity": "sha512-puirJsgZnedlFEmRa7WEUIaS8ZgHHn7d7inph+RiapCc0x80hdoDyEEpR9z3aRUSZy4fGxOTOFcxnGmySlrmhA==",
+ "version": "1.3.134",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.134.tgz",
+ "integrity": "sha512-C3uK2SrtWg/gSWaluLHWSHjyebVZCe4ZC0NVgTAoTq8tCR9FareRK5T7R7AS/nPZShtlEcjVMX1kQ8wi4nU68w==",
"dev": true
},
"emoji-regex": {
@@ -2157,9 +2123,9 @@
"dev": true
},
"eslint-plugin-svelte3": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-svelte3/-/eslint-plugin-svelte3-1.0.0.tgz",
- "integrity": "sha512-lsKUKPrzsjB4JAwmGhfg/Xssc/+L4KU8oL5WNZ0q/D3DkYkIVE4XpT/j8TY6oEFLd31Sznm7itw8Q7RsK6g0cA==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-svelte3/-/eslint-plugin-svelte3-1.2.0.tgz",
+ "integrity": "sha512-7tuYh8YdwE9PP96U9qNJUSVMaxxUS/HZEZtEDlNGSAe0g40xd12pJo6lrc5wGxOmXpR6adGy5DnkSSF1UXGDKg==",
"dev": true
},
"esm": {
@@ -2222,6 +2188,15 @@
"to-regex": "^3.0.1"
},
"dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
"define-property": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
@@ -2239,6 +2214,12 @@
"requires": {
"is-extendable": "^0.1.0"
}
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
}
}
},
@@ -2373,14 +2354,6 @@
"dev": true,
"requires": {
"is-buffer": "~2.0.3"
- },
- "dependencies": {
- "is-buffer": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
- "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==",
- "dev": true
- }
}
},
"for-each": {
@@ -2408,9 +2381,9 @@
}
},
"fs-minipass": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz",
- "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz",
+ "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==",
"dev": true,
"requires": {
"minipass": "^2.2.1"
@@ -2450,9 +2423,9 @@
"dev": true
},
"glob": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
- "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
+ "version": "7.1.4",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
+ "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@@ -2547,6 +2520,12 @@
"kind-of": "^4.0.0"
},
"dependencies": {
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
@@ -2577,26 +2556,18 @@
"dev": true
},
"html-minifier": {
- "version": "3.5.21",
- "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.21.tgz",
- "integrity": "sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA==",
- "dev": true,
- "requires": {
- "camel-case": "3.0.x",
- "clean-css": "4.2.x",
- "commander": "2.17.x",
- "he": "1.2.x",
- "param-case": "2.1.x",
- "relateurl": "0.2.x",
- "uglify-js": "3.4.x"
- },
- "dependencies": {
- "commander": {
- "version": "2.17.1",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
- "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
- "dev": true
- }
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz",
+ "integrity": "sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==",
+ "dev": true,
+ "requires": {
+ "camel-case": "^3.0.0",
+ "clean-css": "^4.2.1",
+ "commander": "^2.19.0",
+ "he": "^1.2.0",
+ "param-case": "^2.1.1",
+ "relateurl": "^0.2.7",
+ "uglify-js": "^3.5.1"
}
},
"http-link-header": {
@@ -2606,9 +2577,9 @@
"dev": true
},
"httpie": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/httpie/-/httpie-1.1.1.tgz",
- "integrity": "sha512-KYgUXOhxVPo5mYuFPqnKW14fP5goMGkLc9CRz0WD6b1TCED9nl9wzj4jqr+8LY+AhPJQ/LdCQLRfF2JrBEja5Q=="
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/httpie/-/httpie-1.1.2.tgz",
+ "integrity": "sha512-VQ82oXG95oY1fQw/XecHuvcFBA+lZQ9Vwj1RfLcO8a7HpDd4cc2ukwpJt+TUlFaLUAzZErylxWu6wclJ1rUhUQ=="
},
"ieee754": {
"version": "1.1.13",
@@ -2662,6 +2633,12 @@
"kind-of": "^3.0.2"
},
"dependencies": {
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -2680,9 +2657,9 @@
"dev": true
},
"is-buffer": {
- "version": "1.1.6",
- "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
- "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
+ "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==",
"dev": true
},
"is-callable": {
@@ -2700,6 +2677,12 @@
"kind-of": "^3.0.2"
},
"dependencies": {
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -2769,6 +2752,12 @@
"kind-of": "^3.0.2"
},
"dependencies": {
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -2949,13 +2938,6 @@
"lodash.once": "^4.0.0",
"ms": "^2.1.1",
"semver": "^5.6.0"
- },
- "dependencies": {
- "ms": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
- "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
- }
}
},
"jwa": {
@@ -3195,9 +3177,9 @@
}
},
"mime": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.2.tgz",
- "integrity": "sha512-zJBfZDkwRu+j3Pdd2aHsR5GfH2jIWhmL1ZzBoc+X+3JEti2hbArWcyJ+1laC1D2/U/W1a/+Cegj0/OnEU2ybjg=="
+ "version": "2.4.3",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.3.tgz",
+ "integrity": "sha512-QgrPRJfE+riq5TPZMcHZOtm8c6K/yYrMbKIoRfapfiGLxS8OTeIfRhUGW5LU7MlRa52KOAGCfUNruqLrIBvWZw=="
},
"mimic-fn": {
"version": "2.1.0",
@@ -3326,11 +3308,19 @@
"ms": "^2.1.1"
}
},
- "ms": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
- "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
- "dev": true
+ "glob": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
+ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
},
"supports-color": {
"version": "6.0.0",
@@ -3356,10 +3346,9 @@
"dev": true
},
"ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
- "dev": true
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"nanomatch": {
"version": "1.2.13",
@@ -3412,9 +3401,9 @@
"dev": true
},
"node-pg-migrate": {
- "version": "3.19.0",
- "resolved": "https://registry.npmjs.org/node-pg-migrate/-/node-pg-migrate-3.19.0.tgz",
- "integrity": "sha512-IIiiP6oHR9JDOqlIpaRFTnIedPIMXsYiMOkCPCSCGA2e+ZuDn/VS07CbDwVwKA+sBfwR0g5KIBx7QZGAS6sesQ==",
+ "version": "3.20.0",
+ "resolved": "https://registry.npmjs.org/node-pg-migrate/-/node-pg-migrate-3.20.0.tgz",
+ "integrity": "sha512-7crNxFNueGgLVYw74FIi0MFowbXlVVpK2ZVM0RvJkhlA0da0Gt+pLmQYFkAuCl2cdfcvK72yUEvtXiw0Uei5CQ==",
"dev": true,
"requires": {
"@types/pg": "^7.4.0",
@@ -3426,9 +3415,9 @@
}
},
"node-releases": {
- "version": "1.1.17",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.17.tgz",
- "integrity": "sha512-/SCjetyta1m7YXLgtACZGDYJdCSIBAWorDWkGCGZlydP2Ll7J48l7j/JxNYZ+xsgSPbWfdulVS/aY+GdjUsQ7Q==",
+ "version": "1.1.19",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.19.tgz",
+ "integrity": "sha512-SH/B4WwovHbulIALsQllAVwqZZD1kPmKCqrhGfR29dXjLAVZMHvBjD3S6nL9D/J9QkmZ1R92/0wCMDKXUUvyyA==",
"dev": true,
"requires": {
"semver": "^5.3.0"
@@ -3498,6 +3487,12 @@
"is-descriptor": "^0.1.0"
}
},
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -3725,9 +3720,9 @@
}
},
"pg": {
- "version": "7.10.0",
- "resolved": "https://registry.npmjs.org/pg/-/pg-7.10.0.tgz",
- "integrity": "sha512-aE6FZomsyn3OeGv1oM50v7Xu5zR75c15LXdOCwA9GGrfjXsQjzwYpbcTS6OwEMhYfZQS6m/FVU/ilPLiPzJDCw==",
+ "version": "7.11.0",
+ "resolved": "https://registry.npmjs.org/pg/-/pg-7.11.0.tgz",
+ "integrity": "sha512-YO4V7vCmEMGoF390LJaFaohWNKaA2ayoQOEZmiHVcAUF+YsRThpf/TaKCgSvsSE7cDm37Q/Cy3Gz41xiX/XjTw==",
"requires": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
@@ -3814,12 +3809,12 @@
"dev": true
},
"polka": {
- "version": "1.0.0-next.2",
- "resolved": "https://registry.npmjs.org/polka/-/polka-1.0.0-next.2.tgz",
- "integrity": "sha512-y82w42/8IA7bc4YwGwAmnbrXj8ZWWDGvnfwq1b0eCtFielZSSSJv7OXUIKQuc/vw5OCCM1hPIgrYsNPzbwDaJw==",
+ "version": "1.0.0-next.3",
+ "resolved": "https://registry.npmjs.org/polka/-/polka-1.0.0-next.3.tgz",
+ "integrity": "sha512-VmCsJK2uAqyjtV8e6ujEhgehibh+lvgdlrIgkTGsL+EKrCS/+BmGq57NV7yvkeGKI4XhsCw/J1YSeejmNfhbig==",
"requires": {
- "@polka/url": "^1.0.0-next.1",
- "trouter": "^3.0.1"
+ "@polka/url": "^1.0.0-next.3",
+ "trouter": "^3.0.2"
}
},
"posix-character-classes": {
@@ -3929,9 +3924,9 @@
"dev": true
},
"regenerate-unicode-properties": {
- "version": "8.0.2",
- "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.0.2.tgz",
- "integrity": "sha512-SbA/iNrBUf6Pv2zU8Ekv1Qbhv92yxL4hiDa2siuxs4KKn4oOoMDHXjAf7+Nz9qinUQ46B1LcWEi/PhJfPWpZWQ==",
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz",
+ "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==",
"dev": true,
"requires": {
"regenerate": "^1.4.0"
@@ -4047,9 +4042,9 @@
"dev": true
},
"resolve": {
- "version": "1.10.1",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.1.tgz",
- "integrity": "sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA==",
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
+ "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@@ -4077,9 +4072,9 @@
}
},
"rollup": {
- "version": "1.11.2",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.11.2.tgz",
- "integrity": "sha512-H5sS7GZ/Rn0t119Et8mw0QXtg5HTOI/1FL57EKHk5oduRmGaraOf3KcEt6j+dXJ9tXxWQkG+/FBjPS4dzxo6EA==",
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.11.3.tgz",
+ "integrity": "sha512-81MR7alHcFKxgWzGfG7jSdv+JQxSOIOD/Fa3iNUmpzbd7p+V19e1l9uffqT8/7YAHgGOzmoPGN3Fx3L2ptOf5g==",
"dev": true,
"requires": {
"@types/estree": "0.0.39",
@@ -4127,9 +4122,9 @@
}
},
"rollup-plugin-node-resolve": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.3.tgz",
- "integrity": "sha512-r+WaesPzdGEynpLZLALFEDugA4ACa5zn7bc/+LVX4vAXQQ8IgDHv0xfsSvJ8tDXUtprfBtrDtRFg27ifKjcJTg==",
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.4.tgz",
+ "integrity": "sha512-t/64I6l7fZ9BxqD3XlX4ZeO6+5RLKyfpwE2CiPNUKa+GocPlQhf/C208ou8y3AwtNsc6bjSk/8/6y/YAyxCIvw==",
"dev": true,
"requires": {
"@types/resolve": "0.0.8",
@@ -4172,9 +4167,9 @@
}
},
"rollup-pluginutils": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.6.0.tgz",
- "integrity": "sha512-aGQwspEF8oPKvg37u3p7h0cYNwmJR1sCBMZGZ5b9qy8HGtETknqjzcxrDRrcAnJNXN18lBH4Q9vZYth/p4n8jQ==",
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.7.0.tgz",
+ "integrity": "sha512-FoP6L1YnMYTAR06Dpq5LE3jJtMwPE6H4VEOqFU23yoziZnqNRSiWcVy6YgEY5PdQB4G7278+8c4TvB0JKS1csA==",
"dev": true,
"requires": {
"estree-walker": "^0.6.0",
@@ -4207,24 +4202,16 @@
}
},
"sapper": {
- "version": "0.26.0",
- "resolved": "https://registry.npmjs.org/sapper/-/sapper-0.26.0.tgz",
- "integrity": "sha512-KdouvzoCeCLirGwlf6U1KwT8GDTFNtK9KEQRFV8bQvNJQzwqS7+QyPAK8Z2MnR7gamluo+bDx84cTtnHD9I/mQ==",
+ "version": "0.27.1",
+ "resolved": "https://registry.npmjs.org/sapper/-/sapper-0.27.1.tgz",
+ "integrity": "sha512-RH0K1uQ3zJ1IXvowxr2SuboGXV69q22KaPMhhoM5VNDv9fsUlVHtluZE8WTcGxckiO2L1xFfgM7v/aINkSZpcw==",
"dev": true,
"requires": {
- "html-minifier": "^3.5.21",
+ "html-minifier": "^4.0.0",
"http-link-header": "^1.0.2",
"shimport": "^1.0.0",
"sourcemap-codec": "^1.4.4",
"string-hash": "^1.1.3"
- },
- "dependencies": {
- "shimport": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/shimport/-/shimport-1.0.0.tgz",
- "integrity": "sha512-XKd+39voZT1rFR1ct+pr8sFSYAW6IvM3LeF87FrgcGHc/uSZ4GfOZVA42LE5LXFOpTWgmDC5sS8DNDtiV4Vd4Q==",
- "dev": true
- }
}
},
"sax": {
@@ -4317,6 +4304,12 @@
"rechoir": "^0.6.2"
}
},
+ "shimport": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shimport/-/shimport-1.0.0.tgz",
+ "integrity": "sha512-XKd+39voZT1rFR1ct+pr8sFSYAW6IvM3LeF87FrgcGHc/uSZ4GfOZVA42LE5LXFOpTWgmDC5sS8DNDtiV4Vd4Q==",
+ "dev": true
+ },
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
@@ -4324,9 +4317,9 @@
"dev": true
},
"sirv": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/sirv/-/sirv-0.4.0.tgz",
- "integrity": "sha512-k/dcRW7Ry2VgERDiLyyq3peGZEnqP2EcTcG5646QjoLwz7lnDA50i20m/3Rn7J4FLtimyoKQsG4E2BItctwjhg==",
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/sirv/-/sirv-0.4.2.tgz",
+ "integrity": "sha512-dQbZnsMaIiTQPZmbGmktz+c74zt/hyrJEB4tdp2Jj0RNv9J6B/OWR5RyrZEvIn9fyh9Zlg2OlE2XzKz6wMKGAw==",
"requires": {
"@polka/url": "^0.5.0",
"mime": "^2.3.1"
@@ -4355,6 +4348,15 @@
"use": "^3.1.0"
},
"dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
"define-property": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
@@ -4372,6 +4374,12 @@
"requires": {
"is-extendable": "^0.1.0"
}
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
}
}
},
@@ -4435,6 +4443,12 @@
"kind-of": "^3.2.0"
},
"dependencies": {
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -4655,9 +4669,9 @@
}
},
"svelte": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.2.0.tgz",
- "integrity": "sha512-i/FSWUcqVw9JBo9bY69/ZI89WCCpyhdWjvAroOroI4qnQboh0WGlgjnFOEKOTvlv1XONd8cVpRGbOYYE3Ec6TQ==",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.3.0.tgz",
+ "integrity": "sha512-iJYkIJDvAak1kizEYnE4b4eJ17D25fU0adW7GjDgO0klbjcAFlqtWEGFJa9kpJOlUtNLilcF09k4Y9TDmK/vjg==",
"dev": true
},
"tar": {
@@ -4732,6 +4746,12 @@
"kind-of": "^3.0.2"
},
"dependencies": {
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "dev": true
+ },
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@@ -4772,29 +4792,23 @@
"dev": true
},
"trouter": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/trouter/-/trouter-3.0.1.tgz",
- "integrity": "sha512-9IBGrlL5bW65xhWufCCf4AsZyxGVIxv7Jy+PTwNtfPHJo+8hAp4wvt/+ersAHE//0Lgjy7obPROfgasNocoYuA==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/trouter/-/trouter-3.0.2.tgz",
+ "integrity": "sha512-wzUcM3oKmF8Fx5pd+3IxZj5LBugqW+hSQHm6cTHkpiZHL8w6YeZSzo3LPw0UdhlwaGPms3OxT7N4GEOIRTw+jw==",
"requires": {
"regexparam": "^1.2.0"
}
},
"uglify-js": {
- "version": "3.4.10",
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz",
- "integrity": "sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw==",
+ "version": "3.5.14",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.14.tgz",
+ "integrity": "sha512-dgyjIw8KFK6AyVl5vm2tEqPewv5TKGEiiVFLI1LbF+oHua/Njd8tZk3lIbF1AWU1rNdEg7scaceADb4zqCcWXg==",
"dev": true,
"requires": {
- "commander": "~2.19.0",
+ "commander": "~2.20.0",
"source-map": "~0.6.1"
},
"dependencies": {
- "commander": {
- "version": "2.19.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
- "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
- "dev": true
- },
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
diff --git a/site/package.json b/site/package.json
index cc593634da..d9de5a217e 100644
--- a/site/package.json
+++ b/site/package.json
@@ -12,7 +12,8 @@
"cy:run": "cypress run",
"cy:open": "cypress open",
"test": "run-p --race dev cy:run",
- "testsrc": "mocha -r esm test/**"
+ "testsrc": "mocha -r esm test/**",
+ "deploy": "make deploy"
},
"dependencies": {
"@polka/redirect": "^1.0.0-next.0",
@@ -37,7 +38,7 @@
"@babel/runtime": "^7.4.4",
"@sindresorhus/slugify": "^0.9.1",
"@sveltejs/site-kit": "^1.0.4",
- "@sveltejs/svelte-repl": "0.0.10",
+ "@sveltejs/svelte-repl": "0.0.11",
"degit": "^2.1.3",
"dotenv": "^8.0.0",
"eslint-plugin-svelte3": "^1.0.0",
@@ -47,7 +48,7 @@
"node-fetch": "^2.3.0",
"node-pg-migrate": "^3.18.1",
"npm-run-all": "^4.1.5",
- "rollup": "^1.11.2",
+ "rollup": "^1.11.3",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-json": "^4.0.0",
@@ -55,7 +56,7 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^4.0.4",
- "sapper": "^0.26.0",
+ "sapper": "^0.27.1",
"shelljs": "^0.8.3",
"svelte": "^3.0.0"
},
diff --git a/site/scripts/build-svelte-app-json.js b/site/scripts/build-svelte-app-json.js
deleted file mode 100644
index 59a4b4a07b..0000000000
--- a/site/scripts/build-svelte-app-json.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const fs = require('fs');
-
-const files = [];
-
-for (const path of process.argv.slice(2)) {
- if (!path.includes('/.')) {
- files.push({ path: path.slice(19), data: fs.readFileSync(path).toString() });
- }
-}
-
-fs.writeFileSync('static/svelte-app.json', JSON.stringify(files));
diff --git a/site/scripts/update_template.js b/site/scripts/update_template.js
index 814d402f5e..9d897c064f 100644
--- a/site/scripts/update_template.js
+++ b/site/scripts/update_template.js
@@ -1,7 +1,7 @@
const sh = require('shelljs');
const fs = require('fs');
-sh.cd(__dirname+'/../');
+sh.cd(__dirname + '/../');
// fetch svelte app
sh.rm('-rf','scripts/svelte-app');
@@ -16,7 +16,10 @@ const appPath = 'scripts/svelte-app';
const files = [];
for (const path of sh.find(appPath).filter(p => fs.lstatSync(p).isFile()) ) {
- files.push({ path: path.slice(appPath.length + 1), data: fs.readFileSync(path).toString() });
+ const bytes = fs.readFileSync(path);
+ const string = bytes.toString();
+ const data = bytes.compare(Buffer.from(string)) === 0 ? string : [...bytes];
+ files.push({ path: path.slice(appPath.length + 1), data });
}
fs.writeFileSync('static/svelte-app.json', JSON.stringify(files));
\ No newline at end of file
diff --git a/site/src/routes/_components/WhosUsingSvelte.svelte b/site/src/routes/_components/WhosUsingSvelte.svelte
index 1700312055..65d818a8bb 100644
--- a/site/src/routes/_components/WhosUsingSvelte.svelte
+++ b/site/src/routes/_components/WhosUsingSvelte.svelte
@@ -54,5 +54,7 @@
+
+
+ your company?
diff --git a/site/src/routes/faq.js b/site/src/routes/faq.js
new file mode 100644
index 0000000000..6263494a4c
--- /dev/null
+++ b/site/src/routes/faq.js
@@ -0,0 +1,4 @@
+export function get(req, res) {
+ res.writeHead(302, { Location: 'https://github.com/sveltejs/svelte/wiki/FAQ' });
+ res.end();
+}
\ No newline at end of file
diff --git a/site/src/routes/index.svelte b/site/src/routes/index.svelte
index 539f522b4e..cbbdf43e95 100644
--- a/site/src/routes/index.svelte
+++ b/site/src/routes/index.svelte
@@ -89,7 +89,7 @@ npx degit sveltejs/template my-svelte-project
cd my-svelte-project
npm install
-npm run dev & open http://localhost:5000
+npm run dev
See the quickstart guide for more information.
diff --git a/site/static/organisations/thunderdome.svg b/site/static/organisations/thunderdome.svg
new file mode 100644
index 0000000000..c8cbdaf039
--- /dev/null
+++ b/site/static/organisations/thunderdome.svg
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ image/svg+xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/site/static/organisations/tokopedia.png b/site/static/organisations/tokopedia.png
new file mode 100644
index 0000000000..bc5231cd5a
Binary files /dev/null and b/site/static/organisations/tokopedia.png differ
diff --git a/animate.mjs b/src/animate.ts
similarity index 86%
rename from animate.mjs
rename to src/animate.ts
index f22fabe401..cf64cd060a 100644
--- a/animate.mjs
+++ b/src/animate.ts
@@ -1,5 +1,5 @@
-import { cubicOut } from './easing';
-import { is_function } from './internal';
+import { cubicOut } from 'svelte/easing';
+import { is_function } from 'svelte/internal';
export function flip(node, animation, params) {
const style = getComputedStyle(node);
@@ -22,4 +22,4 @@ export function flip(node, animation, params) {
easing,
css: (t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);`
};
-}
\ No newline at end of file
+}
diff --git a/src/compile/Component.ts b/src/compile/Component.ts
index aad5e98413..a8145e6b2c 100644
--- a/src/compile/Component.ts
+++ b/src/compile/Component.ts
@@ -1,4 +1,5 @@
import MagicString, { Bundle } from 'magic-string';
+// @ts-ignore
import { walk, childKeys } from 'estree-walker';
import { getLocator } from 'locate-character';
import Stats from '../Stats';
@@ -21,6 +22,7 @@ import { remove_indentation, add_indentation } from '../utils/indentation';
import get_object from './utils/get_object';
import unwrap_parens from './utils/unwrap_parens';
import Slot from './nodes/Slot';
+import { Node as ESTreeNode } from 'estree';
type ComponentOptions = {
namespace?: string;
@@ -152,10 +154,14 @@ export default class Component {
this.namespace = namespaces[this.component_options.namespace] || this.component_options.namespace;
if (compile_options.customElement) {
- this.tag = this.component_options.tag || compile_options.tag;
- if (!this.tag) {
- throw new Error(`Cannot compile to a custom element without specifying a tag name via options.tag or `);
+ if (this.component_options.tag === undefined && compile_options.tag === undefined) {
+ const svelteOptions = ast.html.children.find(child => child.name === 'svelte:options') || { start: 0, end: 0 };
+ this.warn(svelteOptions, {
+ code: 'custom-element-no-tag',
+ message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use `
+ });
}
+ this.tag = this.component_options.tag || compile_options.tag;
} else {
this.tag = this.name;
}
@@ -754,12 +760,12 @@ export default class Component {
});
}
- if (is_reference(node, parent)) {
+ if (is_reference(node as ESTreeNode, parent as ESTreeNode)) {
const object = get_object(node);
const { name } = object;
if (name[0] === '$' && !scope.has(name)) {
- component.warn_if_undefined(object, null);
+ component.warn_if_undefined(name, object, null);
}
}
},
@@ -772,7 +778,7 @@ export default class Component {
});
}
- invalidate(name, value) {
+ invalidate(name, value?) {
const variable = this.var_lookup.get(name);
if (variable && (variable.subscribable && variable.reassigned)) {
@@ -1018,7 +1024,7 @@ export default class Component {
scope = map.get(node);
}
- if (is_reference(node, parent)) {
+ if (is_reference(node as ESTreeNode, parent as ESTreeNode)) {
const { name } = flatten_reference(node);
const owner = scope.find_owner(name);
@@ -1109,14 +1115,16 @@ export default class Component {
} else if (node.type === 'UpdateExpression') {
const identifier = get_object(node.argument);
assignees.add(identifier.name);
- } else if (is_reference(node, parent)) {
+ } else if (is_reference(node as ESTreeNode, parent as ESTreeNode)) {
const identifier = get_object(node);
if (!assignee_nodes.has(identifier)) {
const { name } = identifier;
const owner = scope.find_owner(name);
+ const component_var = component.var_lookup.get(name);
+ const is_writable_or_mutated = component_var && (component_var.writable || component_var.mutated);
if (
(!owner || owner === component.instance_scope) &&
- (name[0] === '$' || component.var_lookup.has(name) && component.var_lookup.get(name).writable)
+ (name[0] === '$' || is_writable_or_mutated)
) {
dependencies.add(name);
}
@@ -1202,9 +1210,7 @@ export default class Component {
return `ctx.${name}`;
}
- warn_if_undefined(node, template_scope: TemplateScope) {
- let { name } = node;
-
+ warn_if_undefined(name: string, node, template_scope: TemplateScope) {
if (name[0] === '$') {
name = name.slice(1);
this.has_reactive_assignments = true; // TODO does this belong here?
@@ -1267,9 +1273,9 @@ function process_component_options(component: Component, nodes) {
const message = `'tag' must be a string literal`;
const tag = get_value(attribute, code, message);
- if (typeof tag !== 'string') component.error(attribute, { code, message });
+ if (typeof tag !== 'string' && tag !== null) component.error(attribute, { code, message });
- if (!/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
+ if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
component.error(attribute, {
code: `invalid-tag-property`,
message: `tag name must be two or more words joined by the '-' character`
diff --git a/src/compile/index.ts b/src/compile/index.ts
index e80a937932..dac75f23e0 100644
--- a/src/compile/index.ts
+++ b/src/compile/index.ts
@@ -1,4 +1,4 @@
-import { assign } from '../internal';
+import { assign } from '../internal/index';
import Stats from '../Stats';
import parse from '../parse/index';
import render_dom from './render-dom/index';
@@ -55,7 +55,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
}
}
-function get_name(filename) {
+function get_name(filename: string) {
if (!filename) return null;
const parts = filename.split(/[\/\\]/);
@@ -105,4 +105,4 @@ export default function compile(source: string, options: CompileOptions = {}) {
: render_dom(component, options);
return component.generate(js);
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/Action.ts b/src/compile/nodes/Action.ts
index feec3fada8..77b9e3c846 100644
--- a/src/compile/nodes/Action.ts
+++ b/src/compile/nodes/Action.ts
@@ -11,7 +11,7 @@ export default class Action extends Node {
constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
- component.warn_if_undefined(info, scope);
+ component.warn_if_undefined(info.name, info, scope);
this.name = info.name;
component.qualify(info.name);
diff --git a/src/compile/nodes/Animation.ts b/src/compile/nodes/Animation.ts
index 638a88b169..6ccdbb0803 100644
--- a/src/compile/nodes/Animation.ts
+++ b/src/compile/nodes/Animation.ts
@@ -10,7 +10,7 @@ export default class Animation extends Node {
constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
- component.warn_if_undefined(info, scope);
+ component.warn_if_undefined(info.name, info, scope);
this.name = info.name;
component.qualify(info.name);
diff --git a/src/compile/nodes/Attribute.ts b/src/compile/nodes/Attribute.ts
index c07960ce47..0b2d3a3700 100644
--- a/src/compile/nodes/Attribute.ts
+++ b/src/compile/nodes/Attribute.ts
@@ -67,6 +67,7 @@ export default class Attribute extends Node {
this.should_cache = this.is_dynamic
? this.chunks.length === 1
+ // @ts-ignore todo: probably error
? this.chunks[0].node.type !== 'Identifier' || scope.names.has(this.chunks[0].node.name)
: true
: false;
@@ -91,8 +92,10 @@ export default class Attribute extends Node {
if (this.chunks.length === 0) return `""`;
if (this.chunks.length === 1) {
+
return this.chunks[0].type === 'Text'
- ? stringify(this.chunks[0].data)
+ ? stringify((this.chunks[0] as Text).data)
+ // @ts-ignore todo: probably error
: this.chunks[0].render(block);
}
@@ -102,6 +105,7 @@ export default class Attribute extends Node {
if (chunk.type === 'Text') {
return stringify(chunk.data);
} else {
+ // @ts-ignore todo: probably error
return chunk.get_precedence() <= 13 ? `(${chunk.render()})` : chunk.render();
}
})
@@ -114,7 +118,8 @@ export default class Attribute extends Node {
return this.is_true
? true
: this.chunks[0]
- ? this.chunks[0].data
+ // method should be called only when `is_static = true`
+ ? (this.chunks[0] as Text).data
: '';
}
}
diff --git a/src/compile/nodes/AwaitBlock.ts b/src/compile/nodes/AwaitBlock.ts
index f8e6896b5d..cd57750d29 100644
--- a/src/compile/nodes/AwaitBlock.ts
+++ b/src/compile/nodes/AwaitBlock.ts
@@ -5,6 +5,7 @@ import CatchBlock from './CatchBlock';
import Expression from './shared/Expression';
export default class AwaitBlock extends Node {
+ type: 'AwaitBlock';
expression: Expression;
value: string;
error: string;
diff --git a/src/compile/nodes/Binding.ts b/src/compile/nodes/Binding.ts
index b03eba0c36..0d666a543f 100644
--- a/src/compile/nodes/Binding.ts
+++ b/src/compile/nodes/Binding.ts
@@ -5,6 +5,7 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
export default class Binding extends Node {
+ type: 'Binding';
name: string;
expression: Expression;
is_contextual: boolean;
diff --git a/src/compile/nodes/CatchBlock.ts b/src/compile/nodes/CatchBlock.ts
index 23c08a494c..0edc0f76d8 100644
--- a/src/compile/nodes/CatchBlock.ts
+++ b/src/compile/nodes/CatchBlock.ts
@@ -3,6 +3,7 @@ import TemplateScope from './shared/TemplateScope';
import AbstractBlock from './shared/AbstractBlock';
export default class CatchBlock extends AbstractBlock {
+ type: 'CatchBlock';
scope: TemplateScope;
constructor(component, parent, scope, info) {
diff --git a/src/compile/nodes/DebugTag.ts b/src/compile/nodes/DebugTag.ts
index 4d2c3f6ae4..0fbfa592ad 100644
--- a/src/compile/nodes/DebugTag.ts
+++ b/src/compile/nodes/DebugTag.ts
@@ -2,6 +2,7 @@ import Node from './shared/Node';
import Expression from './shared/Expression';
export default class DebugTag extends Node {
+ type: 'DebugTag';
expressions: Expression[];
constructor(component, parent, scope, info) {
@@ -11,4 +12,4 @@ export default class DebugTag extends Node {
return new Expression(component, parent, scope, node);
});
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts
index b58c023ac9..2f18373137 100644
--- a/src/compile/nodes/EachBlock.ts
+++ b/src/compile/nodes/EachBlock.ts
@@ -6,8 +6,15 @@ import TemplateScope from './shared/TemplateScope';
import AbstractBlock from './shared/AbstractBlock';
import { Node as INode } from '../../interfaces';
import { new_tail } from '../utils/tail';
+import Element from './Element';
-function unpack_destructuring(contexts: Array<{ name: string, tail: string }>, node: INode, tail: string) {
+type Context = {
+ key: INode,
+ name?: string,
+ tail: string
+};
+
+function unpack_destructuring(contexts: Array, node: INode, tail: string) {
if (!node) return;
if (node.type === 'Identifier' || node.type === 'RestIdentifier') {
@@ -53,7 +60,7 @@ export default class EachBlock extends AbstractBlock {
context: string;
key: Expression;
scope: TemplateScope;
- contexts: Array<{ name: string, tail: string }>;
+ contexts: Array;
has_animation: boolean;
has_binding = false;
@@ -82,7 +89,7 @@ export default class EachBlock extends AbstractBlock {
if (this.index) {
// index can only change if this is a keyed each block
- const dependencies = this.key ? this.expression.dependencies : [];
+ const dependencies = this.key ? this.expression.dependencies : new Set([]);
this.scope.add(this.index, dependencies, this);
}
@@ -92,8 +99,8 @@ export default class EachBlock extends AbstractBlock {
if (this.has_animation) {
if (this.children.length !== 1) {
- const child = this.children.find(child => !!child.animation);
- component.error(child.animation, {
+ const child = this.children.find(child => !!(child as Element).animation);
+ component.error((child as Element).animation, {
code: `invalid-animation`,
message: `An element that use the animate directive must be the sole child of a keyed each block`
});
diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts
index ac2b81b3e7..1b2d82188c 100644
--- a/src/compile/nodes/Element.ts
+++ b/src/compile/nodes/Element.ts
@@ -15,6 +15,7 @@ import fuzzymatch from '../../utils/fuzzymatch';
import list from '../../utils/list';
import Let from './Let';
import TemplateScope from './shared/TemplateScope';
+import { INode } from './interfaces';
const svg = /^(?:altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform|circle|clipPath|color-profile|cursor|defs|desc|discard|ellipse|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|font|font-face|font-face-format|font-face-name|font-face-src|font-face-uri|foreignObject|g|glyph|glyphRef|hatch|hatchpath|hkern|image|line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata|missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor|stop|svg|switch|symbol|text|textPath|tref|tspan|unknown|use|view|vkern)$/;
@@ -101,7 +102,7 @@ export default class Element extends Node {
intro?: Transition = null;
outro?: Transition = null;
animation?: Animation = null;
- children: Node[];
+ children: INode[];
namespace: string;
constructor(component, parent, scope, info: any) {
@@ -136,7 +137,7 @@ export default class Element extends Node {
// Special case — treat these the same way:
// {foo}
// {foo}
- const value_attribute = info.attributes.find((attribute: Node) => attribute.name === 'value');
+ const value_attribute = info.attributes.find(attribute => attribute.name === 'value');
if (!value_attribute) {
info.attributes.push({
@@ -228,7 +229,7 @@ export default class Element extends Node {
let is_figure_parent = false;
while (parent) {
- if (parent.name === 'figure') {
+ if ((parent as Element).name === 'figure') {
is_figure_parent = true;
break;
}
@@ -253,7 +254,7 @@ export default class Element extends Node {
return true;
});
- const index = children.findIndex(child => child.name === 'figcaption');
+ const index = children.findIndex(child => (child as Element).name === 'figcaption');
if (index !== -1 && (index !== 0 && index !== children.length - 1)) {
this.component.warn(children[index], {
@@ -320,7 +321,9 @@ export default class Element extends Node {
}
const value = attribute.get_static_value();
+ // @ts-ignore
if (value && !aria_role_set.has(value)) {
+ // @ts-ignore
const match = fuzzymatch(value, aria_roles);
let message = `A11y: Unknown role '${value}'`;
if (match) message += ` (did you mean '${match}'?)`;
@@ -359,6 +362,7 @@ export default class Element extends Node {
// tabindex-no-positive
if (name === 'tabindex') {
const value = attribute.get_static_value();
+ // @ts-ignore todo is tabindex=true correct case?
if (!isNaN(value) && +value > 0) {
component.warn(attribute, {
code: `a11y-positive-tabindex`,
@@ -544,7 +548,7 @@ export default class Element extends Node {
message: `'group' binding can only be used with or `
});
}
- } else if (name == 'files') {
+ } else if (name === 'files') {
if (this.name !== 'input') {
component.error(binding, {
code: `invalid-binding`,
@@ -560,6 +564,14 @@ export default class Element extends Node {
message: `'files' binding can only be used with `
});
}
+
+ } else if (name === 'open') {
+ if (this.name !== 'details') {
+ component.error(binding, {
+ code: `invalid-binding`,
+ message: `'${name}' binding can only be used with `
+ });
+ }
} else if (
name === 'currentTime' ||
name === 'duration' ||
diff --git a/src/compile/nodes/ElseBlock.ts b/src/compile/nodes/ElseBlock.ts
index 61c1aa5455..5f3aa29529 100644
--- a/src/compile/nodes/ElseBlock.ts
+++ b/src/compile/nodes/ElseBlock.ts
@@ -1,10 +1,11 @@
import map_children from './shared/map_children';
import AbstractBlock from './shared/AbstractBlock';
+import Component from '../Component';
export default class ElseBlock extends AbstractBlock {
type: 'ElseBlock';
- constructor(component, parent, scope, info) {
+ constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
this.children = map_children(component, this, scope, info.children);
diff --git a/src/compile/nodes/EventHandler.ts b/src/compile/nodes/EventHandler.ts
index f5e7e0e898..dab60858d5 100644
--- a/src/compile/nodes/EventHandler.ts
+++ b/src/compile/nodes/EventHandler.ts
@@ -5,6 +5,7 @@ import deindent from '../utils/deindent';
import Block from '../render-dom/Block';
export default class EventHandler extends Node {
+ type: 'EventHandler';
name: string;
modifiers: Set;
expression: Expression;
@@ -65,4 +66,4 @@ export default class EventHandler extends Node {
// this.component.add_reference(this.handler_name);
return `ctx.${this.handler_name}`;
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/Fragment.ts b/src/compile/nodes/Fragment.ts
index ec25d41a1c..6025b036a6 100644
--- a/src/compile/nodes/Fragment.ts
+++ b/src/compile/nodes/Fragment.ts
@@ -3,10 +3,12 @@ import Component from '../Component';
import map_children from './shared/map_children';
import Block from '../render-dom/Block';
import TemplateScope from './shared/TemplateScope';
+import { INode } from './interfaces';
export default class Fragment extends Node {
+ type: 'Fragment';
block: Block;
- children: Node[];
+ children: INode[];
scope: TemplateScope;
constructor(component: Component, info: any) {
@@ -16,4 +18,4 @@ export default class Fragment extends Node {
this.scope = scope;
this.children = map_children(component, this, scope, info.children);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/Head.ts b/src/compile/nodes/Head.ts
index bc6e9bde40..2c08dcd595 100644
--- a/src/compile/nodes/Head.ts
+++ b/src/compile/nodes/Head.ts
@@ -1,5 +1,4 @@
import Node from './shared/Node';
-import Block from '../render-dom/Block';
import map_children from './shared/map_children';
export default class Head extends Node {
diff --git a/src/compile/nodes/InlineComponent.ts b/src/compile/nodes/InlineComponent.ts
index 0d8801aad1..8b6cd77282 100644
--- a/src/compile/nodes/InlineComponent.ts
+++ b/src/compile/nodes/InlineComponent.ts
@@ -7,6 +7,7 @@ import Expression from './shared/Expression';
import Component from '../Component';
import Let from './Let';
import TemplateScope from './shared/TemplateScope';
+import { INode } from './interfaces';
export default class InlineComponent extends Node {
type: 'InlineComponent';
@@ -16,15 +17,16 @@ export default class InlineComponent extends Node {
bindings: Binding[] = [];
handlers: EventHandler[] = [];
lets: Let[] = [];
- children: Node[];
+ children: INode[];
scope: TemplateScope;
constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
if (info.name !== 'svelte:component' && info.name !== 'svelte:self') {
- component.warn_if_undefined(info, scope);
- component.add_reference(info.name);
+ const name = info.name.split('.')[0]; // accommodate namespaces
+ component.warn_if_undefined(name, info, scope);
+ component.add_reference(name);
}
this.name = info.name;
diff --git a/src/compile/nodes/MustacheTag.ts b/src/compile/nodes/MustacheTag.ts
index e668987a9c..ac6688d503 100644
--- a/src/compile/nodes/MustacheTag.ts
+++ b/src/compile/nodes/MustacheTag.ts
@@ -1,3 +1,5 @@
import Tag from './shared/Tag';
-export default class MustacheTag extends Tag {}
\ No newline at end of file
+export default class MustacheTag extends Tag {
+ type: 'MustacheTag';
+}
diff --git a/src/compile/nodes/PendingBlock.ts b/src/compile/nodes/PendingBlock.ts
index 0fd71c0221..5ff7352558 100644
--- a/src/compile/nodes/PendingBlock.ts
+++ b/src/compile/nodes/PendingBlock.ts
@@ -2,7 +2,7 @@ import map_children from './shared/map_children';
import AbstractBlock from './shared/AbstractBlock';
export default class PendingBlock extends AbstractBlock {
-
+ type: 'PendingBlock';
constructor(component, parent, scope, info) {
super(component, parent, scope, info);
this.children = map_children(component, parent, scope, info.children);
diff --git a/src/compile/nodes/RawMustacheTag.ts b/src/compile/nodes/RawMustacheTag.ts
index ada3123410..fc63885942 100644
--- a/src/compile/nodes/RawMustacheTag.ts
+++ b/src/compile/nodes/RawMustacheTag.ts
@@ -1,3 +1,5 @@
import Tag from './shared/Tag';
-export default class RawMustacheTag extends Tag {}
\ No newline at end of file
+export default class RawMustacheTag extends Tag {
+ type: 'RawMustacheTag'
+}
diff --git a/src/compile/nodes/Slot.ts b/src/compile/nodes/Slot.ts
index dbb502b41a..a03fe8c026 100644
--- a/src/compile/nodes/Slot.ts
+++ b/src/compile/nodes/Slot.ts
@@ -1,17 +1,17 @@
-import Node from './shared/Node';
import Element from './Element';
import Attribute from './Attribute';
import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
+import { INode } from './interfaces';
export default class Slot extends Element {
type: 'Element';
name: string;
- children: Node[];
+ children: INode[];
slot_name: string;
values: Map = new Map();
- constructor(component: Component, parent: Node, scope: TemplateScope, info: any) {
+ constructor(component: Component, parent: INode, scope: TemplateScope, info: any) {
super(component, parent, scope, info);
info.attributes.forEach(attr => {
@@ -68,4 +68,4 @@ export default class Slot extends Element {
component.slots.set(this.slot_name, this);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/Text.ts b/src/compile/nodes/Text.ts
index 1c31c9d83d..7500f5ff30 100644
--- a/src/compile/nodes/Text.ts
+++ b/src/compile/nodes/Text.ts
@@ -1,13 +1,14 @@
import Node from './shared/Node';
import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
+import { INode } from './interfaces';
export default class Text extends Node {
type: 'Text';
data: string;
use_space = false;
- constructor(component: Component, parent: Node, scope: TemplateScope, info: any) {
+ constructor(component: Component, parent: INode, scope: TemplateScope, info: any) {
super(component, parent, scope, info);
this.data = info.data;
@@ -23,4 +24,4 @@ export default class Text extends Node {
this.use_space = true;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/ThenBlock.ts b/src/compile/nodes/ThenBlock.ts
index 7e4ed0e5da..7f9bbde0f0 100644
--- a/src/compile/nodes/ThenBlock.ts
+++ b/src/compile/nodes/ThenBlock.ts
@@ -3,6 +3,7 @@ import TemplateScope from './shared/TemplateScope';
import AbstractBlock from './shared/AbstractBlock';
export default class ThenBlock extends AbstractBlock {
+ type: 'ThenBlock';
scope: TemplateScope;
constructor(component, parent, scope, info) {
diff --git a/src/compile/nodes/Title.ts b/src/compile/nodes/Title.ts
index fd58d3043d..6ac0848053 100644
--- a/src/compile/nodes/Title.ts
+++ b/src/compile/nodes/Title.ts
@@ -1,12 +1,13 @@
import Node from './shared/Node';
-import map_children from './shared/map_children';
+import map_children, { Children } from './shared/map_children';
+import Component from '../Component';
export default class Title extends Node {
type: 'Title';
- children: any[]; // TODO
+ children: Children;
should_cache: boolean;
- constructor(component, parent, scope, info) {
+ constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
this.children = map_children(component, parent, scope, info.children);
@@ -33,4 +34,4 @@ export default class Title extends Node {
)
: true;
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/Transition.ts b/src/compile/nodes/Transition.ts
index c3f22d888e..82eb578f0f 100644
--- a/src/compile/nodes/Transition.ts
+++ b/src/compile/nodes/Transition.ts
@@ -12,7 +12,7 @@ export default class Transition extends Node {
constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
- component.warn_if_undefined(info, scope);
+ component.warn_if_undefined(info.name, info, scope);
this.name = info.name;
component.qualify(info.name);
diff --git a/src/compile/nodes/interfaces.ts b/src/compile/nodes/interfaces.ts
new file mode 100644
index 0000000000..434b09e5aa
--- /dev/null
+++ b/src/compile/nodes/interfaces.ts
@@ -0,0 +1,64 @@
+import Tag from './shared/Tag';
+
+import Action from './Action';
+import Animation from './Animation';
+import Attribute from './Attribute';
+import AwaitBlock from './AwaitBlock';
+import Binding from './Binding';
+import Body from './Body';
+import CatchBlock from './CatchBlock';
+import Class from './Class';
+import Comment from './Comment';
+import DebugTag from './DebugTag';
+import EachBlock from './EachBlock';
+import Element from './Element';
+import ElseBlock from './ElseBlock';
+import EventHandler from './EventHandler';
+import Fragment from './Fragment';
+import Head from './Head';
+import IfBlock from './IfBlock';
+import InlineComponent from './InlineComponent';
+import Let from './Let';
+import MustacheTag from './MustacheTag';
+import Options from './Options';
+import PendingBlock from './PendingBlock';
+import RawMustacheTag from './RawMustacheTag';
+import Slot from './Slot';
+import Text from './Text';
+import ThenBlock from './ThenBlock';
+import Title from './Title';
+import Transition from './Transition';
+import Window from './Window';
+
+// note: to write less types each of types in union below should have type defined as literal
+// https://www.typescriptlang.org/docs/handbook/advanced-types.html#discriminated-unions
+export type INode = Action
+ | Animation
+ | Attribute
+ | AwaitBlock
+ | Binding
+ | Body
+ | CatchBlock
+ | Class
+ | Comment
+ | DebugTag
+ | EachBlock
+ | Element
+ | ElseBlock
+ | EventHandler
+ | Fragment
+ | Head
+ | IfBlock
+ | InlineComponent
+ | Let
+ | MustacheTag
+ | Options
+ | PendingBlock
+ | RawMustacheTag
+ | Slot
+ | Tag
+ | Text
+ | ThenBlock
+ | Title
+ | Transition
+ | Window;
diff --git a/src/compile/nodes/shared/AbstractBlock.ts b/src/compile/nodes/shared/AbstractBlock.ts
index 1dfebd51f0..e1104e4928 100644
--- a/src/compile/nodes/shared/AbstractBlock.ts
+++ b/src/compile/nodes/shared/AbstractBlock.ts
@@ -1,10 +1,11 @@
import Block from '../../render-dom/Block';
import Component from './../../Component';
import Node from './Node';
+import { INode } from '../interfaces';
export default class AbstractBlock extends Node {
block: Block;
- children: Node[];
+ children: INode[];
constructor(component: Component, parent, scope, info: any) {
super(component, parent, scope, info);
diff --git a/src/compile/nodes/shared/Expression.ts b/src/compile/nodes/shared/Expression.ts
index 22cb403f75..e7c63dfec2 100644
--- a/src/compile/nodes/shared/Expression.ts
+++ b/src/compile/nodes/shared/Expression.ts
@@ -12,6 +12,7 @@ import TemplateScope from './TemplateScope';
import get_object from '../../utils/get_object';
import { nodes_match } from '../../../utils/nodes_match';
import Block from '../../render-dom/Block';
+import { INode } from '../interfaces';
const binary_operators: Record = {
'**': 15,
@@ -61,10 +62,12 @@ const precedence: Record number> = {
SequenceExpression: () => 0
};
+type Owner = Wrapper | INode;
+
export default class Expression {
- type = 'Expression';
+ type: 'Expression' = 'Expression';
component: Component;
- owner: Wrapper;
+ owner: Owner;
node: any;
snippet: string;
references: Set;
@@ -81,7 +84,8 @@ export default class Expression {
rendered: string;
- constructor(component: Component, owner: Wrapper, template_scope: TemplateScope, info) {
+ // todo: owner type
+ constructor(component: Component, owner: Owner, template_scope: TemplateScope, info) {
// TODO revert to direct property access in prod?
Object.defineProperties(this, {
component: {
@@ -92,6 +96,7 @@ export default class Expression {
this.node = info;
this.template_scope = template_scope;
this.owner = owner;
+ // @ts-ignore
this.is_synthetic = owner.is_synthetic;
const { dependencies, contextual_dependencies } = this;
@@ -149,7 +154,7 @@ export default class Expression {
}
component.add_reference(name);
- component.warn_if_undefined(nodes[0], template_scope);
+ component.warn_if_undefined(name, nodes[0], template_scope);
}
this.skip();
@@ -218,7 +223,7 @@ export default class Expression {
}
// TODO move this into a render-dom wrapper?
- render(block: Block) {
+ render(block?: Block) {
if (this.rendered) return this.rendered;
const {
@@ -510,4 +515,4 @@ function is_contextual(component: Component, scope: TemplateScope, name: string)
// assume contextual
return true;
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/shared/Node.ts b/src/compile/nodes/shared/Node.ts
index b6eaf9965d..b647e3a158 100644
--- a/src/compile/nodes/shared/Node.ts
+++ b/src/compile/nodes/shared/Node.ts
@@ -1,15 +1,17 @@
import Attribute from './../Attribute';
import Component from './../../Component';
+import { INode } from '../interfaces';
+import Text from '../Text';
export default class Node {
readonly start: number;
readonly end: number;
readonly component: Component;
- readonly parent: Node;
+ readonly parent: INode;
readonly type: string;
- prev?: Node;
- next?: Node;
+ prev?: INode;
+ next?: INode;
can_use_innerhtml: boolean;
var: string;
@@ -55,7 +57,7 @@ export default class Node {
if (attribute.chunks.length === 0) return '';
if (attribute.chunks.length === 1 && attribute.chunks[0].type === 'Text') {
- return attribute.chunks[0].data;
+ return (attribute.chunks[0] as Text).data;
}
return null;
diff --git a/src/compile/nodes/shared/Tag.ts b/src/compile/nodes/shared/Tag.ts
index 94971bef11..bc826458d9 100644
--- a/src/compile/nodes/shared/Tag.ts
+++ b/src/compile/nodes/shared/Tag.ts
@@ -2,6 +2,7 @@ import Node from './Node';
import Expression from './Expression';
export default class Tag extends Node {
+ type: 'MustacheTag' | 'RawMustacheTag';
expression: Expression;
should_cache: boolean;
@@ -14,4 +15,4 @@ export default class Tag extends Node {
(this.expression.dependencies.size && scope.names.has(info.expression.name))
);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/shared/TemplateScope.ts b/src/compile/nodes/shared/TemplateScope.ts
index abd366642e..5f30d0c883 100644
--- a/src/compile/nodes/shared/TemplateScope.ts
+++ b/src/compile/nodes/shared/TemplateScope.ts
@@ -2,6 +2,7 @@ import EachBlock from '../EachBlock';
import ThenBlock from '../ThenBlock';
import CatchBlock from '../CatchBlock';
import InlineComponent from '../InlineComponent';
+import Element from '../Element';
type NodeWithScope = EachBlock | ThenBlock | CatchBlock | InlineComponent | Element;
@@ -41,4 +42,4 @@ export default class TemplateScope {
const owner = this.get_owner(name);
return owner && (owner.type === 'Element' || owner.type === 'InlineComponent');
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/nodes/shared/map_children.ts b/src/compile/nodes/shared/map_children.ts
index b903853016..71d764a889 100644
--- a/src/compile/nodes/shared/map_children.ts
+++ b/src/compile/nodes/shared/map_children.ts
@@ -14,9 +14,11 @@ import Slot from '../Slot';
import Text from '../Text';
import Title from '../Title';
import Window from '../Window';
-import Node from './Node';
+import { Node } from '../../../interfaces';
-function get_constructor(type): typeof Node {
+export type Children = ReturnType;
+
+function get_constructor(type) {
switch (type) {
case 'AwaitBlock': return AwaitBlock;
case 'Body': return Body;
@@ -38,7 +40,7 @@ function get_constructor(type): typeof Node {
}
}
-export default function map_children(component, parent, scope, children: any[]) {
+export default function map_children(component, parent, scope, children: Node[]) {
let last = null;
return children.map(child => {
const constructor = get_constructor(child.type);
diff --git a/src/compile/render-dom/Block.ts b/src/compile/render-dom/Block.ts
index e40b3ceb55..531826edcb 100644
--- a/src/compile/render-dom/Block.ts
+++ b/src/compile/render-dom/Block.ts
@@ -9,7 +9,7 @@ export interface BlockOptions {
renderer?: Renderer;
comment?: string;
key?: string;
- bindings?: Map { object: string, property: string, snippet: string }>;
+ bindings?: Map;
dependencies?: Set;
}
diff --git a/src/compile/render-dom/Renderer.ts b/src/compile/render-dom/Renderer.ts
index 1d766c6345..ea07c1544f 100644
--- a/src/compile/render-dom/Renderer.ts
+++ b/src/compile/render-dom/Renderer.ts
@@ -3,7 +3,6 @@ import { CompileOptions } from '../../interfaces';
import Component from '../Component';
import FragmentWrapper from './wrappers/Fragment';
import CodeBuilder from '../utils/CodeBuilder';
-import SlotWrapper from './wrappers/Slot';
export default class Renderer {
component: Component; // TODO Maybe Renderer shouldn't know about Component?
@@ -18,6 +17,7 @@ export default class Renderer {
fragment: FragmentWrapper;
file_var: string;
+ locate: (c: number) => { line: number; column: number; };
constructor(component: Component, options: CompileOptions) {
this.component = component;
@@ -58,4 +58,4 @@ export default class Renderer {
this.fragment.render(this.block, null, 'nodes');
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/index.ts b/src/compile/render-dom/index.ts
index 0a0743b2a0..1432813e9d 100644
--- a/src/compile/render-dom/index.ts
+++ b/src/compile/render-dom/index.ts
@@ -134,7 +134,6 @@ export default function dom(
});
if (component.compile_options.dev) {
- // TODO check no uunexpected props were passed, as well as
// checking that expected ones were passed
const expected = props.filter(prop => !prop.initialised);
@@ -364,7 +363,7 @@ export default function dom(
}
const variable = component.var_lookup.get(n);
- return variable && variable.writable;
+ return variable && (variable.writable || variable.mutated);
})
.map(n => `$$dirty.${n}`).join(' || ');
@@ -395,6 +394,16 @@ export default function dom(
return $name;
});
+ let unknown_props_check;
+ if (component.compile_options.dev && writable_props.length) {
+ unknown_props_check = deindent`
+ const writable_props = [${writable_props.map(prop => `'${prop.export_name}'`).join(', ')}];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key)) console.warn(\`<${component.tag}> was created with unknown prop '\${key}'\`);
+ });
+ `;
+ }
+
builder.add_block(deindent`
function ${definition}(${args.join(', ')}) {
${reactive_store_declarations.length > 0 && `let ${reactive_store_declarations.join(', ')};`}
@@ -405,6 +414,8 @@ export default function dom(
${component.javascript}
+ ${unknown_props_check}
+
${component.slots.size && `let { $$slots = {}, $$scope } = $$props;`}
${renderer.binding_groups.length > 0 && `const $$binding_groups = [${renderer.binding_groups.map(_ => `[]`).join(', ')}];`}
@@ -462,9 +473,13 @@ export default function dom(
${body.length > 0 && body.join('\n\n')}
}
-
- customElements.define("${component.tag}", ${name});
`);
+
+ if (component.tag != null) {
+ builder.add_block(deindent`
+ customElements.define("${component.tag}", ${name});
+ `);
+ }
} else {
const superclass = options.dev ? 'SvelteComponentDev' : 'SvelteComponent';
diff --git a/src/compile/render-dom/wrappers/DebugTag.ts b/src/compile/render-dom/wrappers/DebugTag.ts
index 06fef90a62..bdad6d2493 100644
--- a/src/compile/render-dom/wrappers/DebugTag.ts
+++ b/src/compile/render-dom/wrappers/DebugTag.ts
@@ -25,7 +25,7 @@ export default class DebugTagWrapper extends Wrapper {
if (!renderer.options.dev) return;
- const { code } = component;
+ const { code, var_lookup } = component;
if (this.node.expressions.length === 0) {
// Debug all
@@ -50,23 +50,30 @@ export default class DebugTagWrapper extends Wrapper {
const condition = Array.from(dependencies).map(d => `changed.${d}`).join(' || ');
- const identifiers = this.node.expressions.map(e => e.node.name).join(', ');
+ const ctx_identifiers = this.node.expressions
+ .filter(e => {
+ const looked_up_var = var_lookup.get(e.node.name);
+ return !(looked_up_var && looked_up_var.hoistable);
+ })
+ .map(e => e.node.name)
+ .join(', ');
+ const logged_identifiers = this.node.expressions.map(e => e.node.name).join(', ');
block.builders.update.add_block(deindent`
if (${condition}) {
- const { ${identifiers} } = ctx;
- console.${log}({ ${identifiers} });
+ const { ${ctx_identifiers} } = ctx;
+ console.${log}({ ${logged_identifiers} });
debugger;
}
`);
block.builders.create.add_block(deindent`
{
- const { ${identifiers} } = ctx;
- console.${log}({ ${identifiers} });
+ const { ${ctx_identifiers} } = ctx;
+ console.${log}({ ${logged_identifiers} });
debugger;
}
`);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/EachBlock.ts b/src/compile/render-dom/wrappers/EachBlock.ts
index fe5d5746e5..9208c838ad 100644
--- a/src/compile/render-dom/wrappers/EachBlock.ts
+++ b/src/compile/render-dom/wrappers/EachBlock.ts
@@ -8,7 +8,7 @@ import deindent from '../../utils/deindent';
import ElseBlock from '../../nodes/ElseBlock';
import { attach_head } from '../../utils/tail';
-class ElseBlockWrapper extends Wrapper {
+export class ElseBlockWrapper extends Wrapper {
node: ElseBlock;
block: Block;
fragment: FragmentWrapper;
@@ -83,6 +83,7 @@ export default class EachBlockWrapper extends Wrapper {
this.block = block.child({
comment: create_debugging_comment(this.node, this.renderer.component),
name: renderer.component.get_unique_name('create_each_block'),
+ // @ts-ignore todo: probably error
key: node.key as string,
bindings: new Map(block.bindings)
@@ -310,7 +311,9 @@ export default class EachBlockWrapper extends Wrapper {
}
block.builders.init.add_block(deindent`
- const ${get_key} = ctx => ${this.node.key.render()};
+ const ${get_key} = ctx => ${
+ // @ts-ignore todo: probably error
+ this.node.key.render()};
for (var #i = 0; #i < ${this.vars.each_block_value}.${length}; #i += 1) {
let child_ctx = ${this.vars.get_each_context}(ctx, ${this.vars.each_block_value}, #i);
diff --git a/src/compile/render-dom/wrappers/Element/Attribute.ts b/src/compile/render-dom/wrappers/Element/Attribute.ts
index 9841f4e85d..876496e2f6 100644
--- a/src/compile/render-dom/wrappers/Element/Attribute.ts
+++ b/src/compile/render-dom/wrappers/Element/Attribute.ts
@@ -4,6 +4,7 @@ import fix_attribute_casing from './fix_attribute_casing';
import ElementWrapper from './index';
import { stringify } from '../../../utils/stringify';
import deindent from '../../../utils/deindent';
+import Expression from '../../../nodes/shared/Expression';
export default class AttributeWrapper {
node: Attribute;
@@ -21,7 +22,9 @@ export default class AttributeWrapper {
// special case — — see below
if (this.parent.node.name === 'option' && node.name === 'value') {
let select: ElementWrapper = this.parent;
- while (select && (select.node.type !== 'Element' || select.node.name !== 'select')) select = select.parent;
+ while (select && (select.node.type !== 'Element' || select.node.name !== 'select'))
+ // @ts-ignore todo: doublecheck this, but looks to be correct
+ select = select.parent;
if (select && select.select_binding_dependencies) {
select.select_binding_dependencies.forEach(prop => {
@@ -47,7 +50,7 @@ export default class AttributeWrapper {
(element.node.name === 'option' || // TODO check it's actually bound
(element.node.name === 'input' &&
element.node.bindings.find(
- (binding: Binding) =>
+ (binding) =>
/checked|group/.test(binding.name)
)));
@@ -78,13 +81,13 @@ export default class AttributeWrapper {
// DRY it out if that's possible without introducing crazy indirection
if (this.node.chunks.length === 1) {
// single {tag} — may be a non-string
- value = this.node.chunks[0].render(block);
+ value = (this.node.chunks[0] as Expression).render(block);
} else {
// '{foo} {bar}' — treat as string concatenation
value =
(this.node.chunks[0].type === 'Text' ? '' : `"" + `) +
this.node.chunks
- .map((chunk: Node) => {
+ .map((chunk) => {
if (chunk.type === 'Text') {
return stringify(chunk.data);
} else {
@@ -187,7 +190,7 @@ export default class AttributeWrapper {
: property_name
? `${element.var}.${property_name} = ${value};`
: is_dataset
- ? `${element.var}.dataset.${camel_case_name} = ${value};`
+ ? `${element.var}.dataset.${camel_case_name} = ${value === true ? '""' : value};`
: `${method}(${element.var}, "${name}", ${value === true ? '""' : value});`
);
diff --git a/src/compile/render-dom/wrappers/Element/StyleAttribute.ts b/src/compile/render-dom/wrappers/Element/StyleAttribute.ts
index b0a3663c63..64de2921b3 100644
--- a/src/compile/render-dom/wrappers/Element/StyleAttribute.ts
+++ b/src/compile/render-dom/wrappers/Element/StyleAttribute.ts
@@ -1,14 +1,15 @@
import Attribute from '../../../nodes/Attribute';
import Block from '../../Block';
import AttributeWrapper from './Attribute';
-import Node from '../../../nodes/shared/Node';
import ElementWrapper from '.';
import { stringify } from '../../../utils/stringify';
import add_to_set from '../../../utils/add_to_set';
+import Expression from '../../../nodes/shared/Expression';
+import Text from '../../../nodes/Text';
export interface StyleProp {
key: string;
- value: Node[];
+ value: (Text|Expression)[];
}
export default class StyleAttributeWrapper extends AttributeWrapper {
@@ -28,7 +29,7 @@ export default class StyleAttributeWrapper extends AttributeWrapper {
value =
((prop.value.length === 1 || prop.value[0].type === 'Text') ? '' : `"" + `) +
prop.value
- .map((chunk: Node) => {
+ .map((chunk) => {
if (chunk.type === 'Text') {
return stringify(chunk.data);
} else {
@@ -54,7 +55,7 @@ export default class StyleAttributeWrapper extends AttributeWrapper {
);
}
} else {
- value = stringify(prop.value[0].data);
+ value = stringify((prop.value[0] as Text).data);
}
block.builders.hydrate.add_line(
@@ -64,8 +65,8 @@ export default class StyleAttributeWrapper extends AttributeWrapper {
}
}
-function optimize_style(value: Node[]) {
- const props: { key: string, value: Node[] }[] = [];
+function optimize_style(value: (Text|Expression)[]) {
+ const props: StyleProp[] = [];
let chunks = value.slice();
while (chunks.length) {
@@ -87,13 +88,12 @@ function optimize_style(value: Node[]) {
end: chunk.end,
type: 'Text',
data: remaining_data
- };
+ } as Text;
} else {
chunks.shift();
}
const result = get_style_value(chunks);
- if (!result) return null;
props.push({ key, value: result.value });
chunks = result.chunks;
@@ -102,8 +102,8 @@ function optimize_style(value: Node[]) {
return props;
}
-function get_style_value(chunks: Node[]) {
- const value: Node[] = [];
+function get_style_value(chunks: (Text | Expression)[]) {
+ const value: (Text|Expression)[] = [];
let in_url = false;
let quote_mark = null;
@@ -122,7 +122,7 @@ function get_style_value(chunks: Node[]) {
} else if (char === '\\') {
escaped = true;
} else if (char === quote_mark) {
- quote_mark === null;
+ quote_mark = null;
} else if (char === '"' || char === "'") {
quote_mark = char;
} else if (char === ')' && in_url) {
@@ -142,7 +142,7 @@ function get_style_value(chunks: Node[]) {
start: chunk.start,
end: chunk.start + c,
data: chunk.data.slice(0, c)
- });
+ } as Text);
}
while (/[;\s]/.test(chunk.data[c])) c += 1;
@@ -154,7 +154,7 @@ function get_style_value(chunks: Node[]) {
end: chunk.end,
type: 'Text',
data: remaining_data
- });
+ } as Text);
break;
}
@@ -171,6 +171,6 @@ function get_style_value(chunks: Node[]) {
};
}
-function is_dynamic(value: Node[]) {
+function is_dynamic(value: (Text|Expression)[]) {
return value.length > 1 || value[0].type !== 'Text';
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/Element/index.ts b/src/compile/render-dom/wrappers/Element/index.ts
index d23aa43f19..b4767718c7 100644
--- a/src/compile/render-dom/wrappers/Element/index.ts
+++ b/src/compile/render-dom/wrappers/Element/index.ts
@@ -2,7 +2,6 @@ import Renderer from '../../Renderer';
import Element from '../../../nodes/Element';
import Wrapper from '../shared/Wrapper';
import Block from '../../Block';
-import Node from '../../../nodes/shared/Node';
import { is_void, quote_prop_if_necessary, quote_name_if_necessary, sanitize } from '../../../../utils/names';
import FragmentWrapper from '../Fragment';
import { stringify, escape_html, escape } from '../../../utils/stringify';
@@ -20,7 +19,6 @@ import add_event_handlers from '../shared/add_event_handlers';
import add_actions from '../shared/add_actions';
import create_debugging_comment from '../shared/create_debugging_comment';
import { get_context_merger } from '../shared/get_context_merger';
-import Slot from '../../../nodes/Slot';
import EventHandler from "../../../nodes/EventHandler";
import BindingWrapper from "./Binding";
@@ -29,13 +27,13 @@ const events = [
event_names: ['input'],
filter: (node: Element, name: string) =>
node.name === 'textarea' ||
- node.name === 'input' && !/radio|checkbox|range/.test(node.get_static_attribute_value('type'))
+ node.name === 'input' && !/radio|checkbox|range/.test(node.get_static_attribute_value('type') as string)
},
{
event_names: ['change'],
filter: (node: Element, name: string) =>
node.name === 'select' ||
- node.name === 'input' && /radio|checkbox/.test(node.get_static_attribute_value('type'))
+ node.name === 'input' && /radio|checkbox/.test(node.get_static_attribute_value('type') as string)
},
{
event_names: ['change', 'input'],
@@ -93,6 +91,12 @@ const events = [
name === 'playbackRate'
},
+ // details event
+ {
+ event_names: ['toggle'],
+ filter: (node: Element, name: string) =>
+ node.name === 'details'
+ },
];
export default class ElementWrapper extends Wrapper {
@@ -137,7 +141,7 @@ export default class ElementWrapper extends Wrapper {
}
if (owner && owner.node.type === 'InlineComponent') {
- const name = attribute.get_static_value();
+ const name = attribute.get_static_value() as string;
if (!(owner as InlineComponentWrapper).slots.has(name)) {
const child_block = block.child({
@@ -277,6 +281,7 @@ export default class ElementWrapper extends Wrapper {
if (!this.node.namespace && this.can_use_innerhtml && this.fragment.nodes.length > 0) {
if (this.fragment.nodes.length === 1 && this.fragment.nodes[0].node.type === 'Text') {
block.builders.create.add_line(
+ // @ts-ignore todo: should it be this.fragment.nodes[0].node.data instead?
`${node}.textContent = ${stringify(this.fragment.nodes[0].data)};`
);
} else {
@@ -325,7 +330,7 @@ export default class ElementWrapper extends Wrapper {
function to_html(wrapper: ElementWrapper | TextWrapper) {
if (wrapper.node.type === 'Text') {
- const { parent } = wrapper.node;
+ const parent = wrapper.node.parent as Element;
const raw = parent && (
parent.name === 'script' ||
@@ -350,7 +355,7 @@ export default class ElementWrapper extends Wrapper {
if (is_void(wrapper.node.name)) return open + '>';
- return `${open}>${wrapper.fragment.nodes.map(to_html).join('')}${wrapper.node.name}>`;
+ return `${open}>${(wrapper as ElementWrapper).fragment.nodes.map(to_html).join('')}${wrapper.node.name}>`;
}
if (renderer.options.dev) {
@@ -377,8 +382,8 @@ export default class ElementWrapper extends Wrapper {
get_claim_statement(nodes: string) {
const attributes = this.node.attributes
- .filter((attr: Node) => attr.type === 'Attribute')
- .map((attr: Node) => `${quote_name_if_necessary(attr.name)}: true`)
+ .filter((attr) => attr.type === 'Attribute')
+ .map((attr) => `${quote_name_if_necessary(attr.name)}: true`)
.join(', ');
const name = this.node.namespace
@@ -487,7 +492,7 @@ export default class ElementWrapper extends Wrapper {
function ${handler}() {
${animation_frame && deindent`
cancelAnimationFrame(${animation_frame});
- if (!${this.var}.paused) ${animation_frame} = requestAnimationFrame(${handler});`}
+ if (!${this.var}.paused) ${animation_frame} = @raf(${handler});`}
${needs_lock && `${lock} = true;`}
ctx.${handler}.call(${this.var}${contextual_dependencies.size > 0 ? ', ctx' : ''});
}
@@ -598,12 +603,13 @@ export default class ElementWrapper extends Wrapper {
}
add_attributes(block: Block) {
+ // @ts-ignore todo:
if (this.node.attributes.find(attr => attr.type === 'Spread')) {
this.add_spread_attributes(block);
return;
}
- this.attributes.forEach((attribute: Attribute) => {
+ this.attributes.forEach((attribute) => {
if (attribute.node.name === 'class' && attribute.node.is_dynamic) {
this.class_dependencies.push(...attribute.node.dependencies);
}
@@ -859,27 +865,28 @@ export default class ElementWrapper extends Wrapper {
});
}
- add_css_class(class_name = this.component.stylesheet.id) {
- const class_attribute = this.attributes.find(a => a.name === 'class');
- if (class_attribute && !class_attribute.is_true) {
- if (class_attribute.chunks.length === 1 && class_attribute.chunks[0].type === 'Text') {
- (class_attribute.chunks[0] as Text).data += ` ${class_name}`;
- } else {
- (class_attribute.chunks as Node[]).push(
- new Text(this.component, this, this.scope, {
- type: 'Text',
- data: ` ${class_name}`
- })
- );
- }
- } else {
- this.attributes.push(
- new Attribute(this.component, this, this.scope, {
- type: 'Attribute',
- name: 'class',
- value: [{ type: 'Text', data: class_name }]
- })
- );
- }
- }
+ // todo: looks to be dead code copypasted from Element.add_css_class in src/compile/nodes/Element.ts
+ // add_css_class(class_name = this.component.stylesheet.id) {
+ // const class_attribute = this.attributes.find(a => a.name === 'class');
+ // if (class_attribute && !class_attribute.is_true) {
+ // if (class_attribute.chunks.length === 1 && class_attribute.chunks[0].type === 'Text') {
+ // (class_attribute.chunks[0] as Text).data += ` ${class_name}`;
+ // } else {
+ // (class_attribute.chunks as Node[]).push(
+ // new Text(this.component, this, this.scope, {
+ // type: 'Text',
+ // data: ` ${class_name}`
+ // })
+ // );
+ // }
+ // } else {
+ // this.attributes.push(
+ // new Attribute(this.component, this, this.scope, {
+ // type: 'Attribute',
+ // name: 'class',
+ // value: [{ type: 'Text', data: class_name }]
+ // })
+ // );
+ // }
+ // }
}
diff --git a/src/compile/render-dom/wrappers/Fragment.ts b/src/compile/render-dom/wrappers/Fragment.ts
index 8d955b6d01..21a6704548 100644
--- a/src/compile/render-dom/wrappers/Fragment.ts
+++ b/src/compile/render-dom/wrappers/Fragment.ts
@@ -13,7 +13,7 @@ import Slot from './Slot';
import Text from './Text';
import Title from './Title';
import Window from './Window';
-import Node from '../../nodes/shared/Node';
+import { INode } from '../../nodes/interfaces';
import TextWrapper from './Text';
import Renderer from '../Renderer';
import Block from '../Block';
@@ -49,7 +49,7 @@ export default class FragmentWrapper {
constructor(
renderer: Renderer,
block: Block,
- nodes: Node[],
+ nodes: INode[],
parent: Wrapper,
strip_whitespace: boolean,
next_sibling: Wrapper
@@ -85,6 +85,7 @@ export default class FragmentWrapper {
// *unless* there is no whitespace between this node and its next sibling
if (this.nodes.length === 0) {
const should_trim = (
+ // @ts-ignore todo: probably error, should it be next_sibling.node.data?
next_sibling ? (next_sibling.node.type === 'Text' && /^\s/.test(next_sibling.data)) : !child.has_ancestor('EachBlock')
);
@@ -96,6 +97,7 @@ export default class FragmentWrapper {
// glue text nodes (which could e.g. be separated by comments) together
if (last_child && last_child.node.type === 'Text') {
+ // @ts-ignore todo: probably error, should it be last_child.node.data?
last_child.data = data + last_child.data;
continue;
}
diff --git a/src/compile/render-dom/wrappers/IfBlock.ts b/src/compile/render-dom/wrappers/IfBlock.ts
index f3b5c7f2b2..0d56ea85b2 100644
--- a/src/compile/render-dom/wrappers/IfBlock.ts
+++ b/src/compile/render-dom/wrappers/IfBlock.ts
@@ -96,7 +96,7 @@ export default class IfBlockWrapper extends Wrapper {
if (branch.block.has_outros) has_outros = true;
if (is_else_if(node.else)) {
- create_branches(node.else.children[0]);
+ create_branches(node.else.children[0] as IfBlock);
} else if (node.else) {
const branch = new IfBlockBranch(
renderer,
@@ -452,4 +452,4 @@ export default class IfBlockWrapper extends Wrapper {
block.builders.destroy.add_line(`${if_name}${name}.d(${parent_node ? '' : 'detaching'});`);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/InlineComponent/index.ts b/src/compile/render-dom/wrappers/InlineComponent/index.ts
index c696f4813c..049c21e256 100644
--- a/src/compile/render-dom/wrappers/InlineComponent/index.ts
+++ b/src/compile/render-dom/wrappers/InlineComponent/index.ts
@@ -63,7 +63,7 @@ export default class InlineComponentWrapper extends Wrapper {
this.var = (
this.node.name === 'svelte:self' ? renderer.component.name :
this.node.name === 'svelte:component' ? 'switch_instance' :
- this.node.name
+ sanitize(this.node.name)
).toLowerCase();
if (this.node.children.length) {
@@ -142,7 +142,7 @@ export default class InlineComponentWrapper extends Wrapper {
if (this.fragment) {
const default_slot = this.slots.get('default');
- this.fragment.nodes.forEach((child: Wrapper) => {
+ this.fragment.nodes.forEach((child) => {
child.render(default_slot.block, null, 'nodes');
});
}
@@ -505,4 +505,4 @@ export default class InlineComponentWrapper extends Wrapper {
);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/MustacheTag.ts b/src/compile/render-dom/wrappers/MustacheTag.ts
index f42d0c1de0..71faf91cb2 100644
--- a/src/compile/render-dom/wrappers/MustacheTag.ts
+++ b/src/compile/render-dom/wrappers/MustacheTag.ts
@@ -1,13 +1,14 @@
import Renderer from '../Renderer';
import Block from '../Block';
-import Node from '../../nodes/shared/Node';
import Tag from './shared/Tag';
import Wrapper from './shared/Wrapper';
+import MustacheTag from '../../nodes/MustacheTag';
+import RawMustacheTag from '../../nodes/RawMustacheTag';
export default class MustacheTagWrapper extends Tag {
var = 't';
- constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Node) {
+ constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag) {
super(renderer, block, parent, node);
this.cannot_use_innerhtml();
}
@@ -25,4 +26,4 @@ export default class MustacheTagWrapper extends Tag {
parent_node
);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/RawMustacheTag.ts b/src/compile/render-dom/wrappers/RawMustacheTag.ts
index eb71e16de9..326852bb18 100644
--- a/src/compile/render-dom/wrappers/RawMustacheTag.ts
+++ b/src/compile/render-dom/wrappers/RawMustacheTag.ts
@@ -1,9 +1,10 @@
import Renderer from '../Renderer';
import Block from '../Block';
-import Node from '../../nodes/shared/Node';
import Tag from './shared/Tag';
-import Wrapper from './shared/wrapper';
+import Wrapper from './shared/Wrapper';
import deindent from '../../utils/deindent';
+import MustacheTag from '../../nodes/MustacheTag';
+import RawMustacheTag from '../../nodes/RawMustacheTag';
export default class RawMustacheTagWrapper extends Tag {
var = 'raw';
@@ -12,7 +13,7 @@ export default class RawMustacheTagWrapper extends Tag {
renderer: Renderer,
block: Block,
parent: Wrapper,
- node: Node
+ node: MustacheTag | RawMustacheTag
) {
super(renderer, block, parent, node);
this.cannot_use_innerhtml();
@@ -100,4 +101,4 @@ export default class RawMustacheTagWrapper extends Tag {
add_anchor_after();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/Slot.ts b/src/compile/render-dom/wrappers/Slot.ts
index 31bb4853b1..8a9dc7aca2 100644
--- a/src/compile/render-dom/wrappers/Slot.ts
+++ b/src/compile/render-dom/wrappers/Slot.ts
@@ -9,7 +9,6 @@ import add_to_set from '../../utils/add_to_set';
import get_slot_data from '../../utils/get_slot_data';
import { stringify_props } from '../../utils/stringify_props';
import Expression from '../../nodes/shared/Expression';
-import Attribute from '../../nodes/Attribute';
export default class SlotWrapper extends Wrapper {
node: Slot;
diff --git a/src/compile/render-dom/wrappers/Title.ts b/src/compile/render-dom/wrappers/Title.ts
index eff1d2523b..f24e2926e0 100644
--- a/src/compile/render-dom/wrappers/Title.ts
+++ b/src/compile/render-dom/wrappers/Title.ts
@@ -4,6 +4,7 @@ import Block from '../Block';
import Title from '../../nodes/Title';
import { stringify } from '../../utils/stringify';
import add_to_set from '../../utils/add_to_set';
+import Text from '../../nodes/Text';
export default class TitleWrapper extends Wrapper {
node: Title;
@@ -31,6 +32,7 @@ export default class TitleWrapper extends Wrapper {
// DRY it out if that's possible without introducing crazy indirection
if (this.node.children.length === 1) {
// single {tag} — may be a non-string
+ // @ts-ignore todo: check this
const { expression } = this.node.children[0];
value = expression.render(block);
add_to_set(all_dependencies, expression.dependencies);
@@ -39,16 +41,18 @@ export default class TitleWrapper extends Wrapper {
value =
(this.node.children[0].type === 'Text' ? '' : `"" + `) +
this.node.children
- .map((chunk: Node) => {
+ .map((chunk) => {
if (chunk.type === 'Text') {
return stringify(chunk.data);
} else {
+ // @ts-ignore todo: check this
const snippet = chunk.expression.render(block);
-
+ // @ts-ignore todo: check this
chunk.expression.dependencies.forEach(d => {
all_dependencies.add(d);
});
+ // @ts-ignore todo: check this
return chunk.expression.get_precedence() <= 13 ? `(${snippet})` : snippet;
}
})
@@ -88,8 +92,8 @@ export default class TitleWrapper extends Wrapper {
);
}
} else {
- const value = stringify(this.node.children[0].data);
+ const value = stringify((this.node.children[0] as Text).data);
block.builders.hydrate.add_line(`document.title = ${value};`);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-dom/wrappers/Window.ts b/src/compile/render-dom/wrappers/Window.ts
index 2b58153d95..56c63adb3d 100644
--- a/src/compile/render-dom/wrappers/Window.ts
+++ b/src/compile/render-dom/wrappers/Window.ts
@@ -6,6 +6,7 @@ import deindent from '../../utils/deindent';
import add_event_handlers from './shared/add_event_handlers';
import Window from '../../nodes/Window';
import add_actions from './shared/add_actions';
+import { INode } from '../../nodes/interfaces';
const associated_events = {
innerWidth: 'resize',
@@ -33,7 +34,7 @@ const readonly = new Set([
export default class WindowWrapper extends Wrapper {
node: Window;
- constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Node) {
+ constructor(renderer: Renderer, block: Block, parent: Wrapper, node: INode) {
super(renderer, block, parent, node);
}
diff --git a/src/compile/render-dom/wrappers/shared/Wrapper.ts b/src/compile/render-dom/wrappers/shared/Wrapper.ts
index 2a9394415f..3315b6b483 100644
--- a/src/compile/render-dom/wrappers/shared/Wrapper.ts
+++ b/src/compile/render-dom/wrappers/shared/Wrapper.ts
@@ -1,11 +1,11 @@
import Renderer from '../../Renderer';
-import Node from '../../../nodes/shared/Node';
import Block from '../../Block';
+import { INode } from '../../../nodes/interfaces';
export default class Wrapper {
renderer: Renderer;
parent: Wrapper;
- node: Node;
+ node: INode;
prev: Wrapper | null;
next: Wrapper | null;
@@ -17,7 +17,7 @@ export default class Wrapper {
renderer: Renderer,
block: Block,
parent: Wrapper,
- node: Node
+ node: INode
) {
this.node = node;
@@ -75,4 +75,8 @@ export default class Wrapper {
this.node.type === 'MustacheTag'
);
}
-}
\ No newline at end of file
+
+ render(block: Block, parent_node: string, parent_nodes: string){
+ throw Error('Wrapper class is not renderable');
+ }
+}
diff --git a/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts b/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts
index b32d25c1a4..df1ae9ff8e 100644
--- a/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts
+++ b/src/compile/render-dom/wrappers/shared/create_debugging_comment.ts
@@ -1,8 +1,8 @@
import Component from '../../../Component';
-import { Node } from '../../../../interfaces';
+import { INode } from '../../../nodes/interfaces';
export default function create_debugging_comment(
- node: Node,
+ node: INode,
component: Component
) {
const { locate, source } = component;
@@ -19,6 +19,7 @@ export default function create_debugging_comment(
d = node.children.length ? node.children[0].start : node.start;
while (source[d - 1] !== '>') d -= 1;
} else {
+ // @ts-ignore
d = node.expression ? node.expression.node.end : c;
while (source[d] !== '}') d += 1;
while (source[d] === '}') d += 1;
diff --git a/src/compile/render-ssr/Renderer.ts b/src/compile/render-ssr/Renderer.ts
index c97965de14..ef1d16429e 100644
--- a/src/compile/render-ssr/Renderer.ts
+++ b/src/compile/render-ssr/Renderer.ts
@@ -12,6 +12,7 @@ import Tag from './handlers/Tag';
import Text from './handlers/Text';
import Title from './handlers/Title';
import { AppendTarget, CompileOptions } from '../../interfaces';
+import { INode } from '../nodes/interfaces';
type Handler = (node: any, renderer: Renderer, options: CompileOptions) => void;
@@ -36,6 +37,10 @@ const handlers: Record = {
Window: noop
};
+export interface RenderOptions extends CompileOptions{
+ locate: (c: number) => { line: number; column: number; };
+};
+
export default class Renderer {
has_bindings = false;
code = '';
@@ -51,7 +56,7 @@ export default class Renderer {
}
}
- render(nodes, options) {
+ render(nodes: INode[], options: RenderOptions) {
nodes.forEach(node => {
const handler = handlers[node.type];
diff --git a/src/compile/render-ssr/handlers/AwaitBlock.ts b/src/compile/render-ssr/handlers/AwaitBlock.ts
index bbc4a15e05..85bf7b3135 100644
--- a/src/compile/render-ssr/handlers/AwaitBlock.ts
+++ b/src/compile/render-ssr/handlers/AwaitBlock.ts
@@ -1,8 +1,8 @@
-import Renderer from '../Renderer';
-import { CompileOptions } from '../../../interfaces';
+import Renderer, { RenderOptions } from '../Renderer';
import { snip } from '../../utils/snip';
+import AwaitBlock from '../../nodes/AwaitBlock';
-export default function(node, renderer: Renderer, options: CompileOptions) {
+export default function(node: AwaitBlock, renderer: Renderer, options: RenderOptions) {
renderer.append('${(function(__value) { if(@is_promise(__value)) return `');
renderer.render(node.pending.children, options);
@@ -13,4 +13,4 @@ export default function(node, renderer: Renderer, options: CompileOptions) {
const snippet = snip(node.expression);
renderer.append(`\`;}(__value);}(${snippet})) }`);
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/Comment.ts b/src/compile/render-ssr/handlers/Comment.ts
index 4517faace5..237c260230 100644
--- a/src/compile/render-ssr/handlers/Comment.ts
+++ b/src/compile/render-ssr/handlers/Comment.ts
@@ -1,8 +1,8 @@
-import Renderer from '../Renderer';
-import { CompileOptions } from '../../../interfaces';
+import Renderer, { RenderOptions } from '../Renderer';
+import Comment from '../../nodes/Comment';
-export default function(node, renderer: Renderer, options: CompileOptions) {
+export default function(node: Comment, renderer: Renderer, options: RenderOptions) {
if (options.preserveComments) {
renderer.append(``);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/DebugTag.ts b/src/compile/render-ssr/handlers/DebugTag.ts
index b04d541105..3fd7584d57 100644
--- a/src/compile/render-ssr/handlers/DebugTag.ts
+++ b/src/compile/render-ssr/handlers/DebugTag.ts
@@ -1,9 +1,10 @@
import { stringify } from '../../utils/stringify';
-
-export default function(node, renderer, options) {
+import DebugTag from '../../nodes/DebugTag';
+import Renderer, { RenderOptions } from '../Renderer';
+export default function(node: DebugTag, renderer: Renderer, options: RenderOptions) {
if (!options.dev) return;
- const filename = options.file || null;
+ const filename = options.filename || null;
const { line, column } = options.locate(node.start + 1);
const obj = node.expressions.length === 0
@@ -15,4 +16,4 @@ export default function(node, renderer, options) {
const str = '${@debug(' + `${filename && stringify(filename)}, ${line}, ${column}, ${obj})}`;
renderer.append(str);
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/EachBlock.ts b/src/compile/render-ssr/handlers/EachBlock.ts
index 3731093a9b..5ed27dff15 100644
--- a/src/compile/render-ssr/handlers/EachBlock.ts
+++ b/src/compile/render-ssr/handlers/EachBlock.ts
@@ -1,6 +1,8 @@
import { snip } from '../../utils/snip';
+import Renderer, { RenderOptions } from '../Renderer';
+import EachBlock from '../../nodes/EachBlock';
-export default function(node, renderer, options) {
+export default function(node: EachBlock, renderer: Renderer, options: RenderOptions) {
const snippet = snip(node.expression);
const { start, end } = node.context_node;
@@ -24,4 +26,4 @@ export default function(node, renderer, options) {
}
renderer.append('}');
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/Element.ts b/src/compile/render-ssr/handlers/Element.ts
index 7717be48e3..fc6bc5b969 100644
--- a/src/compile/render-ssr/handlers/Element.ts
+++ b/src/compile/render-ssr/handlers/Element.ts
@@ -5,6 +5,9 @@ import Node from '../../nodes/shared/Node';
import { snip } from '../../utils/snip';
import { stringify_attribute } from '../../utils/stringify_attribute';
import { get_slot_scope } from './shared/get_slot_scope';
+import Renderer, { RenderOptions } from '../Renderer';
+import Element from '../../nodes/Element';
+import Text from '../../nodes/Text';
// source: https://gist.github.com/ArjanSchouten/0b8574a6ad7f5065a5e7
const boolean_attributes = new Set([
@@ -47,15 +50,17 @@ const boolean_attributes = new Set([
'translate'
]);
-export default function(node, renderer, options) {
+export default function(node: Element, renderer: Renderer, options: RenderOptions & {
+ slot_scopes: Map;
+}) {
let opening_tag = `<${node.name}`;
let textarea_contents; // awkward special case
const slot = node.get_static_attribute_value('slot');
const component = node.find_nearest(/InlineComponent/);
if (slot && component) {
- const slot = node.attributes.find((attribute: Node) => attribute.name === 'slot');
- const slot_name = slot.chunks[0].data;
+ const slot = node.attributes.find((attribute) => attribute.name === 'slot');
+ const slot_name = (slot.chunks[0] as Text).data;
const target = renderer.targets[renderer.targets.length - 1];
target.slot_stack.push(slot_name);
target.slots[slot_name] = '';
@@ -160,4 +165,4 @@ export default function(node, renderer, options) {
if (!is_void(node.name)) {
renderer.append(`${node.name}>`);
}
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/Head.ts b/src/compile/render-ssr/handlers/Head.ts
index 656759af3c..ecd32cc0ef 100644
--- a/src/compile/render-ssr/handlers/Head.ts
+++ b/src/compile/render-ssr/handlers/Head.ts
@@ -1,7 +1,10 @@
-export default function(node, renderer, options) {
+import Renderer, { RenderOptions } from '../Renderer';
+import Head from '../../nodes/Head';
+
+export default function(node: Head, renderer: Renderer, options: RenderOptions) {
renderer.append('${($$result.head += `');
renderer.render(node.children, options);
renderer.append('`, "")}');
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/HtmlTag.ts b/src/compile/render-ssr/handlers/HtmlTag.ts
index 7562186a4b..84e2e1f573 100644
--- a/src/compile/render-ssr/handlers/HtmlTag.ts
+++ b/src/compile/render-ssr/handlers/HtmlTag.ts
@@ -1,5 +1,7 @@
import { snip } from '../../utils/snip';
+import Renderer, { RenderOptions } from '../Renderer';
+import RawMustacheTag from '../../nodes/RawMustacheTag';
-export default function(node, renderer, options) {
+export default function(node: RawMustacheTag, renderer: Renderer, options: RenderOptions) {
renderer.append('${' + snip(node.expression) + '}');
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/IfBlock.ts b/src/compile/render-ssr/handlers/IfBlock.ts
index cbe505fef8..c841f1d593 100644
--- a/src/compile/render-ssr/handlers/IfBlock.ts
+++ b/src/compile/render-ssr/handlers/IfBlock.ts
@@ -1,6 +1,7 @@
import { snip } from '../../utils/snip';
-
-export default function(node, renderer, options) {
+import IfBlock from '../../nodes/IfBlock';
+import Renderer, { RenderOptions } from '../Renderer';
+export default function(node: IfBlock, renderer: Renderer, options: RenderOptions) {
const snippet = snip(node.expression);
renderer.append('${ ' + snippet + ' ? `');
@@ -14,4 +15,4 @@ export default function(node, renderer, options) {
}
renderer.append('` }');
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/InlineComponent.ts b/src/compile/render-ssr/handlers/InlineComponent.ts
index bc58be5df9..94fdcfd434 100644
--- a/src/compile/render-ssr/handlers/InlineComponent.ts
+++ b/src/compile/render-ssr/handlers/InlineComponent.ts
@@ -1,14 +1,17 @@
import { escape, escape_template, stringify } from '../../utils/stringify';
import { quote_name_if_necessary } from '../../../utils/names';
import { snip } from '../../utils/snip';
-import Renderer from '../Renderer';
+import Renderer, { RenderOptions } from '../Renderer';
import { stringify_props } from '../../utils/stringify_props';
import { get_slot_scope } from './shared/get_slot_scope';
import { AppendTarget } from '../../../interfaces';
+import InlineComponent from '../../nodes/InlineComponent';
+import { INode } from '../../nodes/interfaces';
+import Text from '../../nodes/Text';
-function stringify_attribute(chunk: Node) {
+function stringify_attribute(chunk: INode) {
if (chunk.type === 'Text') {
- return escape_template(escape(chunk.data));
+ return escape_template(escape((chunk as Text).data));
}
return '${@escape(' + snip(chunk) + ')}';
@@ -30,7 +33,7 @@ function get_attribute_value(attribute) {
return '`' + attribute.chunks.map(stringify_attribute).join('') + '`';
}
-export default function(node, renderer: Renderer, options) {
+export default function(node: InlineComponent, renderer: Renderer, options: RenderOptions) {
const binding_props = [];
const binding_fns = [];
diff --git a/src/compile/render-ssr/handlers/Slot.ts b/src/compile/render-ssr/handlers/Slot.ts
index b2e67f9e79..087519979b 100644
--- a/src/compile/render-ssr/handlers/Slot.ts
+++ b/src/compile/render-ssr/handlers/Slot.ts
@@ -1,7 +1,9 @@
import { quote_prop_if_necessary } from '../../../utils/names';
import get_slot_data from '../../utils/get_slot_data';
+import Renderer, { RenderOptions } from '../Renderer';
+import Slot from '../../nodes/Slot';
-export default function(node, renderer, options) {
+export default function(node: Slot, renderer: Renderer, options: RenderOptions) {
const prop = quote_prop_if_necessary(node.slot_name);
const slot_data = get_slot_data(node.values, true);
@@ -13,4 +15,4 @@ export default function(node, renderer, options) {
renderer.render(node.children, options);
renderer.append(`\`}`);
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/Tag.ts b/src/compile/render-ssr/handlers/Tag.ts
index eb887b8688..d03f46fe0a 100644
--- a/src/compile/render-ssr/handlers/Tag.ts
+++ b/src/compile/render-ssr/handlers/Tag.ts
@@ -1,6 +1,6 @@
import { snip } from '../../utils/snip';
-
-export default function(node, renderer, options) {
+import Renderer, { RenderOptions } from '../Renderer';
+export default function(node, renderer: Renderer, options: RenderOptions) {
const snippet = snip(node.expression);
renderer.append(
@@ -10,4 +10,4 @@ export default function(node, renderer, options) {
? '${' + snippet + '}'
: '${@escape(' + snippet + ')}'
);
-}
\ No newline at end of file
+}
diff --git a/src/compile/render-ssr/handlers/Text.ts b/src/compile/render-ssr/handlers/Text.ts
index e794025370..1d2906d10a 100644
--- a/src/compile/render-ssr/handlers/Text.ts
+++ b/src/compile/render-ssr/handlers/Text.ts
@@ -1,14 +1,17 @@
import { escape_html, escape_template, escape } from '../../utils/stringify';
+import Renderer, { RenderOptions } from '../Renderer';
+import Text from '../../nodes/Text';
+import Element from '../../nodes/Element';
-export default function(node, renderer, options) {
+export default function(node: Text, renderer: Renderer, options: RenderOptions) {
let text = node.data;
if (
!node.parent ||
node.parent.type !== 'Element' ||
- (node.parent.name !== 'script' && node.parent.name !== 'style')
+ ((node.parent as Element).name !== 'script' && (node.parent as Element).name !== 'style')
) {
// unless this Text node is inside a
+
+Hello {name}!
diff --git a/test/custom-elements/samples/no-svelte-options/test.js b/test/custom-elements/samples/no-svelte-options/test.js
new file mode 100644
index 0000000000..c77f035088
--- /dev/null
+++ b/test/custom-elements/samples/no-svelte-options/test.js
@@ -0,0 +1,12 @@
+import * as assert from 'assert';
+import CustomElement from './main.svelte';
+
+export default function (target) {
+ customElements.define('no-tag', CustomElement);
+ target.innerHTML = ` `;
+
+ const el = target.querySelector('no-tag');
+ const h1 = el.shadowRoot.querySelector('h1');
+
+ assert.equal(h1.textContent, 'Hello world!');
+}
diff --git a/test/custom-elements/samples/no-tag-warning/_config.js b/test/custom-elements/samples/no-tag-warning/_config.js
new file mode 100644
index 0000000000..7cdfdbaec6
--- /dev/null
+++ b/test/custom-elements/samples/no-tag-warning/_config.js
@@ -0,0 +1,17 @@
+export default {
+ warnings: [{
+ code: "custom-element-no-tag",
+ message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ",
+ pos: 0,
+ start: {
+ character: 0,
+ column: 0,
+ line: 1
+ },
+ end: {
+ character: 18,
+ column: 18,
+ line: 1
+ }
+ }]
+};
diff --git a/test/custom-elements/samples/no-tag-warning/main.svelte b/test/custom-elements/samples/no-tag-warning/main.svelte
new file mode 100644
index 0000000000..4f7cdc52ca
--- /dev/null
+++ b/test/custom-elements/samples/no-tag-warning/main.svelte
@@ -0,0 +1,7 @@
+
+
+
+
+Hello {name}!
diff --git a/test/custom-elements/samples/no-tag-warning/test.js b/test/custom-elements/samples/no-tag-warning/test.js
new file mode 100644
index 0000000000..c77f035088
--- /dev/null
+++ b/test/custom-elements/samples/no-tag-warning/test.js
@@ -0,0 +1,12 @@
+import * as assert from 'assert';
+import CustomElement from './main.svelte';
+
+export default function (target) {
+ customElements.define('no-tag', CustomElement);
+ target.innerHTML = ` `;
+
+ const el = target.querySelector('no-tag');
+ const h1 = el.shadowRoot.querySelector('h1');
+
+ assert.equal(h1.textContent, 'Hello world!');
+}
diff --git a/test/custom-elements/samples/no-tag/_config.js b/test/custom-elements/samples/no-tag/_config.js
new file mode 100644
index 0000000000..c81f1a9f82
--- /dev/null
+++ b/test/custom-elements/samples/no-tag/_config.js
@@ -0,0 +1,3 @@
+export default {
+ warnings: []
+};
diff --git a/test/custom-elements/samples/no-tag/main.svelte b/test/custom-elements/samples/no-tag/main.svelte
new file mode 100644
index 0000000000..031bd93694
--- /dev/null
+++ b/test/custom-elements/samples/no-tag/main.svelte
@@ -0,0 +1,7 @@
+
+
+
+
+Hello {name}!
diff --git a/test/custom-elements/samples/no-tag/test.js b/test/custom-elements/samples/no-tag/test.js
new file mode 100644
index 0000000000..c77f035088
--- /dev/null
+++ b/test/custom-elements/samples/no-tag/test.js
@@ -0,0 +1,12 @@
+import * as assert from 'assert';
+import CustomElement from './main.svelte';
+
+export default function (target) {
+ customElements.define('no-tag', CustomElement);
+ target.innerHTML = ` `;
+
+ const el = target.querySelector('no-tag');
+ const h1 = el.shadowRoot.querySelector('h1');
+
+ assert.equal(h1.textContent, 'Hello world!');
+}
diff --git a/test/js/samples/bind-open/expected.js b/test/js/samples/bind-open/expected.js
new file mode 100644
index 0000000000..7f739aec8b
--- /dev/null
+++ b/test/js/samples/bind-open/expected.js
@@ -0,0 +1,69 @@
+/* generated by Svelte vX.Y.Z */
+import {
+ SvelteComponent,
+ detach,
+ element,
+ init,
+ insert,
+ listen,
+ noop,
+ safe_not_equal
+} from "svelte/internal";
+
+function create_fragment(ctx) {
+ var details, dispose;
+
+ return {
+ c() {
+ details = element("details");
+ details.innerHTML = `summary content
+ `;
+ dispose = listen(details, "toggle", ctx.details_toggle_handler);
+ },
+
+ m(target, anchor) {
+ insert(target, details, anchor);
+
+ details.open = ctx.open;
+ },
+
+ p(changed, ctx) {
+ if (changed.open) details.open = ctx.open;
+ },
+
+ i: noop,
+ o: noop,
+
+ d(detaching) {
+ if (detaching) {
+ detach(details);
+ }
+
+ dispose();
+ }
+ };
+}
+
+function instance($$self, $$props, $$invalidate) {
+ let { open } = $$props;
+
+ function details_toggle_handler() {
+ open = this.open;
+ $$invalidate('open', open);
+ }
+
+ $$self.$set = $$props => {
+ if ('open' in $$props) $$invalidate('open', open = $$props.open);
+ };
+
+ return { open, details_toggle_handler };
+}
+
+class Component extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, ["open"]);
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/bind-open/input.svelte b/test/js/samples/bind-open/input.svelte
new file mode 100644
index 0000000000..3dd2b03a73
--- /dev/null
+++ b/test/js/samples/bind-open/input.svelte
@@ -0,0 +1,7 @@
+
+
+
+ summary content
+
diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js
index 98c2837ab7..c82cbeddd3 100644
--- a/test/js/samples/debug-empty/expected.js
+++ b/test/js/samples/debug-empty/expected.js
@@ -65,6 +65,11 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { name } = $$props;
+ const writable_props = ['name'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key)) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('name' in $$props) $$invalidate('name', name = $$props.name);
};
diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js
index c1391475b2..3e1571b890 100644
--- a/test/js/samples/debug-foo-bar-baz-things/expected.js
+++ b/test/js/samples/debug-foo-bar-baz-things/expected.js
@@ -151,6 +151,11 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { things, foo, bar, baz } = $$props;
+ const writable_props = ['things', 'foo', 'bar', 'baz'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key)) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('things' in $$props) $$invalidate('things', things = $$props.things);
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js
index f5daa7dad7..1af0fcaebe 100644
--- a/test/js/samples/debug-foo/expected.js
+++ b/test/js/samples/debug-foo/expected.js
@@ -151,6 +151,11 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { things, foo } = $$props;
+ const writable_props = ['things', 'foo'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key)) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('things' in $$props) $$invalidate('things', things = $$props.things);
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
diff --git a/test/js/samples/debug-hoisted/_config.js b/test/js/samples/debug-hoisted/_config.js
new file mode 100644
index 0000000000..414b026a97
--- /dev/null
+++ b/test/js/samples/debug-hoisted/_config.js
@@ -0,0 +1,5 @@
+export default {
+ options: {
+ dev: true
+ }
+};
diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js
new file mode 100644
index 0000000000..51d8bf63a3
--- /dev/null
+++ b/test/js/samples/debug-hoisted/expected.js
@@ -0,0 +1,56 @@
+/* generated by Svelte vX.Y.Z */
+import {
+ SvelteComponentDev,
+ init,
+ noop,
+ safe_not_equal
+} from "svelte/internal";
+
+const file = undefined;
+
+function create_fragment(ctx) {
+ return {
+ c: function create() {
+ {
+ const { obj } = ctx;
+ console.log({ obj, kobzol });
+ debugger;
+ }
+ },
+
+ l: function claim(nodes) {
+ throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
+ },
+
+ m: noop,
+
+ p: function update(changed, ctx) {
+ if (changed.obj || changed.kobzol) {
+ const { obj } = ctx;
+ console.log({ obj, kobzol });
+ debugger;
+ }
+ },
+
+ i: noop,
+ o: noop,
+ d: noop
+ };
+}
+
+let kobzol = 5;
+
+function instance($$self) {
+ let obj = { x: 5 };
+
+ return { obj };
+}
+
+class Component extends SvelteComponentDev {
+ constructor(options) {
+ super(options);
+ init(this, options, instance, create_fragment, safe_not_equal, []);
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/debug-hoisted/input.svelte b/test/js/samples/debug-hoisted/input.svelte
new file mode 100644
index 0000000000..94d584ccac
--- /dev/null
+++ b/test/js/samples/debug-hoisted/input.svelte
@@ -0,0 +1,6 @@
+
+
+{@debug obj, kobzol}
diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js
index 12e8a983d0..0c193934c0 100644
--- a/test/js/samples/dev-warning-missing-data-computed/expected.js
+++ b/test/js/samples/dev-warning-missing-data-computed/expected.js
@@ -65,6 +65,11 @@ function instance($$self, $$props, $$invalidate) {
let bar;
+ const writable_props = ['foo'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key)) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
};
diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js
index 94444b8947..ebe1fdda5f 100644
--- a/test/js/samples/media-bindings/expected.js
+++ b/test/js/samples/media-bindings/expected.js
@@ -8,6 +8,7 @@ import {
insert,
listen,
noop,
+ raf,
run_all,
safe_not_equal,
time_ranges_to_array
@@ -18,7 +19,7 @@ function create_fragment(ctx) {
function audio_timeupdate_handler() {
cancelAnimationFrame(audio_animationframe);
- if (!audio.paused) audio_animationframe = requestAnimationFrame(audio_timeupdate_handler);
+ if (!audio.paused) audio_animationframe = raf(audio_timeupdate_handler);
audio_updating = true;
ctx.audio_timeupdate_handler.call(audio);
}
diff --git a/test/parser/samples/action-with-call/output.json b/test/parser/samples/action-with-call/output.json
index d6aaa72892..e910f0b49f 100644
--- a/test/parser/samples/action-with-call/output.json
+++ b/test/parser/samples/action-with-call/output.json
@@ -41,8 +41,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/action-with-identifier/output.json b/test/parser/samples/action-with-identifier/output.json
index d58b9097b7..435aee4444 100644
--- a/test/parser/samples/action-with-identifier/output.json
+++ b/test/parser/samples/action-with-identifier/output.json
@@ -27,8 +27,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/action-with-literal/output.json b/test/parser/samples/action-with-literal/output.json
index 4a6f596d10..01a6b67549 100644
--- a/test/parser/samples/action-with-literal/output.json
+++ b/test/parser/samples/action-with-literal/output.json
@@ -28,8 +28,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/action/output.json b/test/parser/samples/action/output.json
index 2f553b5efa..9828e200dd 100644
--- a/test/parser/samples/action/output.json
+++ b/test/parser/samples/action/output.json
@@ -22,8 +22,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/animation/output.json b/test/parser/samples/animation/output.json
index 8332b3ad04..f4d183eb5c 100644
--- a/test/parser/samples/animation/output.json
+++ b/test/parser/samples/animation/output.json
@@ -35,6 +35,7 @@
"start": 51,
"end": 56,
"type": "Text",
+ "raw": "flips",
"data": "flips"
}
]
@@ -54,8 +55,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-containing-solidus/output.json b/test/parser/samples/attribute-containing-solidus/output.json
index 95372bd77d..f1158b4f50 100644
--- a/test/parser/samples/attribute-containing-solidus/output.json
+++ b/test/parser/samples/attribute-containing-solidus/output.json
@@ -20,6 +20,7 @@
"start": 8,
"end": 30,
"type": "Text",
+ "raw": "https://www.google.com",
"data": "https://www.google.com"
}
]
@@ -30,13 +31,11 @@
"start": 31,
"end": 37,
"type": "Text",
+ "raw": "Google",
"data": "Google"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-dynamic-boolean/output.json b/test/parser/samples/attribute-dynamic-boolean/output.json
index 81a19f49b9..478144152a 100644
--- a/test/parser/samples/attribute-dynamic-boolean/output.json
+++ b/test/parser/samples/attribute-dynamic-boolean/output.json
@@ -33,8 +33,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-dynamic-reserved/output.json b/test/parser/samples/attribute-dynamic-reserved/output.json
index 3a830d448f..22be3c9087 100644
--- a/test/parser/samples/attribute-dynamic-reserved/output.json
+++ b/test/parser/samples/attribute-dynamic-reserved/output.json
@@ -33,8 +33,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-dynamic/output.json b/test/parser/samples/attribute-dynamic/output.json
index 50d8ec60a5..a48f376876 100644
--- a/test/parser/samples/attribute-dynamic/output.json
+++ b/test/parser/samples/attribute-dynamic/output.json
@@ -18,8 +18,9 @@
"value": [
{
"start": 12,
- "end": 19,
+ "end": 20,
"type": "Text",
+ "raw": "color: ",
"data": "color: "
},
{
@@ -37,6 +38,7 @@
"start": 26,
"end": 27,
"type": "Text",
+ "raw": ";",
"data": ";"
}
]
@@ -57,8 +59,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-escaped/output.json b/test/parser/samples/attribute-escaped/output.json
index 6a4143e674..e60a8c2531 100644
--- a/test/parser/samples/attribute-escaped/output.json
+++ b/test/parser/samples/attribute-escaped/output.json
@@ -20,6 +20,7 @@
"start": 15,
"end": 33,
"type": "Text",
+ "raw": ""quoted"",
"data": "\"quoted\""
}
]
@@ -28,8 +29,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-multiple/output.json b/test/parser/samples/attribute-multiple/output.json
index 668409c0ef..c4be13e6ee 100644
--- a/test/parser/samples/attribute-multiple/output.json
+++ b/test/parser/samples/attribute-multiple/output.json
@@ -20,6 +20,7 @@
"start": 9,
"end": 10,
"type": "Text",
+ "raw": "x",
"data": "x"
}
]
@@ -34,6 +35,7 @@
"start": 19,
"end": 20,
"type": "Text",
+ "raw": "y",
"data": "y"
}
]
@@ -42,8 +44,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-shorthand/output.json b/test/parser/samples/attribute-shorthand/output.json
index 08ddf5eda9..f23e62b04e 100644
--- a/test/parser/samples/attribute-shorthand/output.json
+++ b/test/parser/samples/attribute-shorthand/output.json
@@ -33,8 +33,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-static-boolean/output.json b/test/parser/samples/attribute-static-boolean/output.json
index f63b5734e0..7d635004c1 100644
--- a/test/parser/samples/attribute-static-boolean/output.json
+++ b/test/parser/samples/attribute-static-boolean/output.json
@@ -21,8 +21,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-static/output.json b/test/parser/samples/attribute-static/output.json
index 3185e48736..37b41d9a89 100644
--- a/test/parser/samples/attribute-static/output.json
+++ b/test/parser/samples/attribute-static/output.json
@@ -20,6 +20,7 @@
"start": 12,
"end": 15,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -28,8 +29,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-unquoted/output.json b/test/parser/samples/attribute-unquoted/output.json
index c7556f2eba..11fa397819 100644
--- a/test/parser/samples/attribute-unquoted/output.json
+++ b/test/parser/samples/attribute-unquoted/output.json
@@ -20,6 +20,7 @@
"start": 11,
"end": 14,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -28,8 +29,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json
index f62ad16574..ac598a403a 100644
--- a/test/parser/samples/await-then-catch/output.json
+++ b/test/parser/samples/await-then-catch/output.json
@@ -19,13 +19,13 @@
"pending": {
"start": 19,
"end": 39,
- "skip": false,
"type": "PendingBlock",
"children": [
{
"start": 19,
"end": 21,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -39,6 +39,7 @@
"start": 24,
"end": 34,
"type": "Text",
+ "raw": "loading...",
"data": "loading..."
}
]
@@ -47,20 +48,22 @@
"start": 38,
"end": 39,
"type": "Text",
+ "raw": "\n",
"data": "\n"
}
- ]
+ ],
+ "skip": false
},
"then": {
"start": 39,
"end": 88,
- "skip": false,
"type": "ThenBlock",
"children": [
{
"start": 55,
"end": 57,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -74,6 +77,7 @@
"start": 60,
"end": 73,
"type": "Text",
+ "raw": "the value is ",
"data": "the value is "
},
{
@@ -93,20 +97,22 @@
"start": 87,
"end": 88,
"type": "Text",
+ "raw": "\n",
"data": "\n"
}
- ]
+ ],
+ "skip": false
},
"catch": {
"start": 88,
"end": 140,
- "skip": false,
"type": "CatchBlock",
"children": [
{
"start": 105,
"end": 107,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -120,6 +126,7 @@
"start": 110,
"end": 117,
"type": "Text",
+ "raw": "oh no! ",
"data": "oh no! "
},
{
@@ -151,14 +158,13 @@
"start": 139,
"end": 140,
"type": "Text",
+ "raw": "\n",
"data": "\n"
}
- ]
+ ],
+ "skip": false
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
-}
+ }
+}
\ No newline at end of file
diff --git a/test/parser/samples/binding-shorthand/output.json b/test/parser/samples/binding-shorthand/output.json
index 8f92101042..7fe7acb5b3 100644
--- a/test/parser/samples/binding-shorthand/output.json
+++ b/test/parser/samples/binding-shorthand/output.json
@@ -8,6 +8,7 @@
"start": 28,
"end": 30,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/binding/output.json b/test/parser/samples/binding/output.json
index d084050617..72ad60202c 100644
--- a/test/parser/samples/binding/output.json
+++ b/test/parser/samples/binding/output.json
@@ -8,6 +8,7 @@
"start": 29,
"end": 31,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/comment/output.json b/test/parser/samples/comment/output.json
index 89295c188a..2a57c4fa5d 100644
--- a/test/parser/samples/comment/output.json
+++ b/test/parser/samples/comment/output.json
@@ -11,8 +11,5 @@
"data": " a comment "
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/component-dynamic/output.json b/test/parser/samples/component-dynamic/output.json
index c2e4e3ee79..77837d1ca9 100644
--- a/test/parser/samples/component-dynamic/output.json
+++ b/test/parser/samples/component-dynamic/output.json
@@ -36,8 +36,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/convert-entities-in-element/output.json b/test/parser/samples/convert-entities-in-element/output.json
index fb0f5b288e..c830c276de 100644
--- a/test/parser/samples/convert-entities-in-element/output.json
+++ b/test/parser/samples/convert-entities-in-element/output.json
@@ -15,13 +15,11 @@
"start": 3,
"end": 20,
"type": "Text",
+ "raw": "Hello & World",
"data": "Hello & World"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/convert-entities/output.json b/test/parser/samples/convert-entities/output.json
index ca1c1356f8..f4cc1a6662 100644
--- a/test/parser/samples/convert-entities/output.json
+++ b/test/parser/samples/convert-entities/output.json
@@ -8,11 +8,9 @@
"start": 0,
"end": 17,
"type": "Text",
+ "raw": "Hello & World",
"data": "Hello & World"
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/css/output.json b/test/parser/samples/css/output.json
index 3127e01c71..12d74ae7f8 100644
--- a/test/parser/samples/css/output.json
+++ b/test/parser/samples/css/output.json
@@ -15,6 +15,7 @@
"start": 5,
"end": 8,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -23,6 +24,7 @@
"start": 14,
"end": 16,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
}
]
@@ -90,7 +92,5 @@
"end": 48,
"styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n"
}
- },
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/dynamic-import/output.json b/test/parser/samples/dynamic-import/output.json
index c0d4a45e0d..fa1acf7d9b 100644
--- a/test/parser/samples/dynamic-import/output.json
+++ b/test/parser/samples/dynamic-import/output.json
@@ -5,7 +5,6 @@
"type": "Fragment",
"children": []
},
- "css": null,
"instance": {
"start": 0,
"end": 146,
@@ -66,8 +65,8 @@
"start": 54,
"end": 134,
"id": null,
- "generator": false,
"expression": false,
+ "generator": false,
"async": false,
"params": [],
"body": {
@@ -120,8 +119,8 @@
"start": 88,
"end": 129,
"id": null,
- "generator": false,
"expression": false,
+ "generator": false,
"async": false,
"params": [
{
diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json
index 0c4b1a5c54..6368b445d6 100644
--- a/test/parser/samples/each-block-destructured/output.json
+++ b/test/parser/samples/each-block-destructured/output.json
@@ -37,6 +37,7 @@
"start": 50,
"end": 52,
"type": "Text",
+ "raw": ": ",
"data": ": "
},
{
@@ -80,8 +81,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
-}
+ }
+}
\ No newline at end of file
diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json
index aefc8c2f39..1e8ac455e6 100644
--- a/test/parser/samples/each-block-else/output.json
+++ b/test/parser/samples/each-block-else/output.json
@@ -58,6 +58,7 @@
"start": 55,
"end": 65,
"type": "Text",
+ "raw": "no animals",
"data": "no animals"
}
]
@@ -66,8 +67,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json
index 7518652468..77417ba67a 100644
--- a/test/parser/samples/each-block-indexed/output.json
+++ b/test/parser/samples/each-block-indexed/output.json
@@ -37,6 +37,7 @@
"start": 36,
"end": 38,
"type": "Text",
+ "raw": ": ",
"data": ": "
},
{
@@ -62,8 +63,5 @@
"index": "i"
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json
index fe893bcdb9..11cdd45ff1 100644
--- a/test/parser/samples/each-block-keyed/output.json
+++ b/test/parser/samples/each-block-keyed/output.json
@@ -62,8 +62,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json
index c16a71ad5d..6a60823952 100644
--- a/test/parser/samples/each-block/output.json
+++ b/test/parser/samples/each-block/output.json
@@ -44,8 +44,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/element-with-mustache/output.json b/test/parser/samples/element-with-mustache/output.json
index c8a386d681..f7c2e9936b 100644
--- a/test/parser/samples/element-with-mustache/output.json
+++ b/test/parser/samples/element-with-mustache/output.json
@@ -15,6 +15,7 @@
"start": 4,
"end": 10,
"type": "Text",
+ "raw": "hello ",
"data": "hello "
},
{
@@ -32,13 +33,11 @@
"start": 16,
"end": 17,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/element-with-text/output.json b/test/parser/samples/element-with-text/output.json
index 70f6163c93..b0e0f5c6cc 100644
--- a/test/parser/samples/element-with-text/output.json
+++ b/test/parser/samples/element-with-text/output.json
@@ -15,13 +15,11 @@
"start": 6,
"end": 10,
"type": "Text",
+ "raw": "test",
"data": "test"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/elements/output.json b/test/parser/samples/elements/output.json
index d216f7f5d8..75548c20f0 100644
--- a/test/parser/samples/elements/output.json
+++ b/test/parser/samples/elements/output.json
@@ -21,8 +21,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/event-handler/output.json b/test/parser/samples/event-handler/output.json
index b1fe89fc2a..f792ffadcc 100644
--- a/test/parser/samples/event-handler/output.json
+++ b/test/parser/samples/event-handler/output.json
@@ -21,8 +21,8 @@
"start": 19,
"end": 43,
"id": null,
- "generator": false,
"expression": true,
+ "generator": false,
"async": false,
"params": [],
"body": {
@@ -58,6 +58,7 @@
"start": 46,
"end": 52,
"type": "Text",
+ "raw": "toggle",
"data": "toggle"
}
]
@@ -66,6 +67,7 @@
"start": 61,
"end": 63,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -90,6 +92,7 @@
"start": 81,
"end": 87,
"type": "Text",
+ "raw": "hello!",
"data": "hello!"
}
]
@@ -97,8 +100,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/if-block-else/output.json b/test/parser/samples/if-block-else/output.json
index dedf2797c4..8b22cfa26b 100644
--- a/test/parser/samples/if-block-else/output.json
+++ b/test/parser/samples/if-block-else/output.json
@@ -26,6 +26,7 @@
"start": 14,
"end": 17,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -47,6 +48,7 @@
"start": 34,
"end": 41,
"type": "Text",
+ "raw": "not foo",
"data": "not foo"
}
]
@@ -55,8 +57,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/if-block-elseif/output.json b/test/parser/samples/if-block-elseif/output.json
index 188b57aaad..54fb53dacb 100644
--- a/test/parser/samples/if-block-elseif/output.json
+++ b/test/parser/samples/if-block-elseif/output.json
@@ -39,6 +39,7 @@
"start": 17,
"end": 37,
"type": "Text",
+ "raw": "x is greater than 10",
"data": "x is greater than 10"
}
]
@@ -85,6 +86,7 @@
"start": 63,
"end": 79,
"type": "Text",
+ "raw": "x is less than 5",
"data": "x is less than 5"
}
]
diff --git a/test/parser/samples/if-block/output.json b/test/parser/samples/if-block/output.json
index d560824766..1714bb7141 100644
--- a/test/parser/samples/if-block/output.json
+++ b/test/parser/samples/if-block/output.json
@@ -19,13 +19,11 @@
"start": 9,
"end": 12,
"type": "Text",
+ "raw": "bar",
"data": "bar"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/implicitly-closed-li/output.json b/test/parser/samples/implicitly-closed-li/output.json
index caf69d7109..f46a2b1a26 100644
--- a/test/parser/samples/implicitly-closed-li/output.json
+++ b/test/parser/samples/implicitly-closed-li/output.json
@@ -15,6 +15,7 @@
"start": 4,
"end": 6,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -28,6 +29,7 @@
"start": 10,
"end": 13,
"type": "Text",
+ "raw": "a\n\t",
"data": "a\n\t"
}
]
@@ -43,6 +45,7 @@
"start": 17,
"end": 20,
"type": "Text",
+ "raw": "b\n\t",
"data": "b\n\t"
}
]
@@ -58,6 +61,7 @@
"start": 24,
"end": 26,
"type": "Text",
+ "raw": "c\n",
"data": "c\n"
}
]
@@ -65,8 +69,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/nbsp/output.json b/test/parser/samples/nbsp/output.json
index 4fa318ce48..044de64cba 100644
--- a/test/parser/samples/nbsp/output.json
+++ b/test/parser/samples/nbsp/output.json
@@ -15,13 +15,11 @@
"start": 6,
"end": 12,
"type": "Text",
+ "raw": " ",
"data": " "
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/raw-mustaches/output.json b/test/parser/samples/raw-mustaches/output.json
index 1d92b21c85..1b3d9b7a9c 100644
--- a/test/parser/samples/raw-mustaches/output.json
+++ b/test/parser/samples/raw-mustaches/output.json
@@ -15,6 +15,7 @@
"start": 3,
"end": 4,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -32,6 +33,7 @@
"start": 16,
"end": 17,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -49,13 +51,11 @@
"start": 29,
"end": 30,
"type": "Text",
+ "raw": " ",
"data": " "
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/refs/output.json b/test/parser/samples/refs/output.json
index d15753b0a2..e09383f9b6 100644
--- a/test/parser/samples/refs/output.json
+++ b/test/parser/samples/refs/output.json
@@ -8,6 +8,7 @@
"start": 28,
"end": 30,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/script-comment-only/output.json b/test/parser/samples/script-comment-only/output.json
index 95ca769b20..ba28434318 100644
--- a/test/parser/samples/script-comment-only/output.json
+++ b/test/parser/samples/script-comment-only/output.json
@@ -8,6 +8,7 @@
"start": 43,
"end": 45,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/script-comment-trailing-multiline/output.json b/test/parser/samples/script-comment-trailing-multiline/output.json
index d4a45911a1..7d01599efa 100644
--- a/test/parser/samples/script-comment-trailing-multiline/output.json
+++ b/test/parser/samples/script-comment-trailing-multiline/output.json
@@ -8,6 +8,7 @@
"start": 77,
"end": 79,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -21,6 +22,7 @@
"start": 83,
"end": 89,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -38,6 +40,7 @@
"start": 95,
"end": 96,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
diff --git a/test/parser/samples/script-comment-trailing/output.json b/test/parser/samples/script-comment-trailing/output.json
index 92d431b558..bc8f3e4e67 100644
--- a/test/parser/samples/script-comment-trailing/output.json
+++ b/test/parser/samples/script-comment-trailing/output.json
@@ -8,6 +8,7 @@
"start": 66,
"end": 68,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -21,6 +22,7 @@
"start": 72,
"end": 78,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -38,6 +40,7 @@
"start": 84,
"end": 85,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
diff --git a/test/parser/samples/script/output.json b/test/parser/samples/script/output.json
index 95966f5dc6..75aa0a7d2c 100644
--- a/test/parser/samples/script/output.json
+++ b/test/parser/samples/script/output.json
@@ -8,6 +8,7 @@
"start": 39,
"end": 41,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -21,6 +22,7 @@
"start": 45,
"end": 51,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -38,6 +40,7 @@
"start": 57,
"end": 58,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
diff --git a/test/parser/samples/self-closing-element/output.json b/test/parser/samples/self-closing-element/output.json
index 47eea2f333..63ff17a466 100644
--- a/test/parser/samples/self-closing-element/output.json
+++ b/test/parser/samples/self-closing-element/output.json
@@ -13,8 +13,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/self-reference/output.json b/test/parser/samples/self-reference/output.json
index de5112a087..92dfdfe4d0 100644
--- a/test/parser/samples/self-reference/output.json
+++ b/test/parser/samples/self-reference/output.json
@@ -72,8 +72,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/space-between-mustaches/output.json b/test/parser/samples/space-between-mustaches/output.json
index c89409daeb..9a367bd2c1 100644
--- a/test/parser/samples/space-between-mustaches/output.json
+++ b/test/parser/samples/space-between-mustaches/output.json
@@ -15,6 +15,7 @@
"start": 3,
"end": 4,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -32,6 +33,7 @@
"start": 7,
"end": 8,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -49,6 +51,7 @@
"start": 11,
"end": 14,
"type": "Text",
+ "raw": " : ",
"data": " : "
},
{
@@ -66,13 +69,11 @@
"start": 17,
"end": 20,
"type": "Text",
+ "raw": " : ",
"data": " : "
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/spread/output.json b/test/parser/samples/spread/output.json
index 3986da3578..73a0dc9777 100644
--- a/test/parser/samples/spread/output.json
+++ b/test/parser/samples/spread/output.json
@@ -25,8 +25,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/textarea-children/output.json b/test/parser/samples/textarea-children/output.json
index 3b403458fc..90f31f3caf 100644
--- a/test/parser/samples/textarea-children/output.json
+++ b/test/parser/samples/textarea-children/output.json
@@ -16,8 +16,9 @@
"value": [
{
"start": 10,
- "end": 40,
+ "end": 41,
"type": "Text",
+ "raw": "\n\tnot actually an element. ",
"data": "\n\t
not actually an element. "
},
{
@@ -35,6 +36,7 @@
"start": 45,
"end": 50,
"type": "Text",
+ "raw": "
\n",
"data": "\n"
}
]
@@ -43,8 +45,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/transition-intro-no-params/output.json b/test/parser/samples/transition-intro-no-params/output.json
index edb15457e6..91b50f3ec8 100644
--- a/test/parser/samples/transition-intro-no-params/output.json
+++ b/test/parser/samples/transition-intro-no-params/output.json
@@ -26,13 +26,11 @@
"start": 13,
"end": 21,
"type": "Text",
+ "raw": "fades in",
"data": "fades in"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/transition-intro/output.json b/test/parser/samples/transition-intro/output.json
index 5583dd89bc..418bb97e16 100644
--- a/test/parser/samples/transition-intro/output.json
+++ b/test/parser/samples/transition-intro/output.json
@@ -54,13 +54,11 @@
"start": 31,
"end": 39,
"type": "Text",
+ "raw": "fades in",
"data": "fades in"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/unusual-identifier/output.json b/test/parser/samples/unusual-identifier/output.json
index c0d4ecc3ff..e4a2a18619 100644
--- a/test/parser/samples/unusual-identifier/output.json
+++ b/test/parser/samples/unusual-identifier/output.json
@@ -44,8 +44,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/whitespace-leading-trailing/output.json b/test/parser/samples/whitespace-leading-trailing/output.json
index f164af01ba..e4f387856e 100644
--- a/test/parser/samples/whitespace-leading-trailing/output.json
+++ b/test/parser/samples/whitespace-leading-trailing/output.json
@@ -8,6 +8,7 @@
"start": 0,
"end": 6,
"type": "Text",
+ "raw": "\n\n\t\t\t\t",
"data": "\n\n\t\t\t\t"
},
{
@@ -21,13 +22,11 @@
"start": 9,
"end": 32,
"type": "Text",
+ "raw": "just chillin' over here",
"data": "just chillin' over here"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/whitespace-normal/output.json b/test/parser/samples/whitespace-normal/output.json
index e4ce956331..acbae7ae17 100644
--- a/test/parser/samples/whitespace-normal/output.json
+++ b/test/parser/samples/whitespace-normal/output.json
@@ -15,6 +15,7 @@
"start": 4,
"end": 10,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -39,6 +40,7 @@
"start": 24,
"end": 26,
"type": "Text",
+ "raw": "! ",
"data": "! "
}
]
@@ -54,6 +56,7 @@
"start": 41,
"end": 53,
"type": "Text",
+ "raw": "How are you?",
"data": "How are you?"
}
]
@@ -61,8 +64,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/yield/output.json b/test/parser/samples/yield/output.json
index 16ea79d8e8..b2e4b9430f 100644
--- a/test/parser/samples/yield/output.json
+++ b/test/parser/samples/yield/output.json
@@ -16,8 +16,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/runtime/index.js b/test/runtime/index.js
index 579dc665c6..fd5ffdef04 100644
--- a/test/runtime/index.js
+++ b/test/runtime/index.js
@@ -3,7 +3,7 @@ import * as path from "path";
import * as fs from "fs";
import { rollup } from 'rollup';
import * as virtual from 'rollup-plugin-virtual';
-import { clear_loops } from "../../internal.js";
+import { clear_loops, set_now, set_raf } from "../../internal.js";
import {
showOutput,
@@ -75,7 +75,7 @@ describe("runtime", () => {
compileOptions.accessors = 'accessors' in config ? config.accessors : true;
Object.keys(require.cache)
- .filter(x => x.endsWith(".svelte"))
+ .filter(x => x.endsWith('.svelte'))
.forEach(file => {
delete require.cache[file];
});
@@ -100,8 +100,8 @@ describe("runtime", () => {
if (raf.callback) raf.callback();
}
};
- window.performance.now = () => raf.time;
- global.requestAnimationFrame = cb => {
+ set_now(() => raf.time);
+ set_raf(cb => {
let called = false;
raf.callback = () => {
if (!called) {
@@ -109,7 +109,7 @@ describe("runtime", () => {
cb();
}
};
- };
+ });
try {
mod = require(`./samples/${dir}/main.svelte`);
diff --git a/test/runtime/samples/attribute-dataset-without-value/_config.js b/test/runtime/samples/attribute-dataset-without-value/_config.js
new file mode 100644
index 0000000000..934f44eb06
--- /dev/null
+++ b/test/runtime/samples/attribute-dataset-without-value/_config.js
@@ -0,0 +1,3 @@
+export default {
+ html: '
',
+};
diff --git a/test/runtime/samples/attribute-dataset-without-value/main.svelte b/test/runtime/samples/attribute-dataset-without-value/main.svelte
new file mode 100644
index 0000000000..ed7d532652
--- /dev/null
+++ b/test/runtime/samples/attribute-dataset-without-value/main.svelte
@@ -0,0 +1 @@
+
diff --git a/test/runtime/samples/attribute-url/_config.js b/test/runtime/samples/attribute-url/_config.js
new file mode 100644
index 0000000000..28bc1bcb0c
--- /dev/null
+++ b/test/runtime/samples/attribute-url/_config.js
@@ -0,0 +1,8 @@
+export default {
+ test({ assert, target }) {
+ const div = target.querySelector( 'div' );
+
+ assert.equal( div.style.backgroundImage, 'url(https://example.com/foo.jpg)');
+ assert.equal( div.style.color, 'red' );
+ }
+};
diff --git a/test/runtime/samples/attribute-url/main.svelte b/test/runtime/samples/attribute-url/main.svelte
new file mode 100644
index 0000000000..357a352aaa
--- /dev/null
+++ b/test/runtime/samples/attribute-url/main.svelte
@@ -0,0 +1,6 @@
+
+
+{color}
diff --git a/test/runtime/samples/binding-details-open/_config.js b/test/runtime/samples/binding-details-open/_config.js
new file mode 100644
index 0000000000..cf2459c3f1
--- /dev/null
+++ b/test/runtime/samples/binding-details-open/_config.js
@@ -0,0 +1,25 @@
+export default {
+ html: `
+ toggle
+ `,
+
+ async test({ assert, component, target, window }) {
+ const details = target.querySelector('details');
+ const event = new window.Event('toggle');
+
+ details.open = true;
+ await details.dispatchEvent(event);
+ assert.equal(component.visible, true);
+ assert.htmlEqual(target.innerHTML, `
+ toggle
+ hello!
+ `);
+
+ details.open = false;
+ await details.dispatchEvent(event);
+ assert.equal(component.visible, false);
+ assert.htmlEqual(target.innerHTML, `
+ toggle
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-details-open/main.svelte b/test/runtime/samples/binding-details-open/main.svelte
new file mode 100644
index 0000000000..3a7a08e121
--- /dev/null
+++ b/test/runtime/samples/binding-details-open/main.svelte
@@ -0,0 +1,9 @@
+
+
+toggle
+
+{#if visible}
+ hello!
+{/if}
diff --git a/test/runtime/samples/component-namespaced/Foo.svelte b/test/runtime/samples/component-namespaced/Foo.svelte
new file mode 100644
index 0000000000..67ab955233
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/Foo.svelte
@@ -0,0 +1,5 @@
+
+
+foo {foo}
\ No newline at end of file
diff --git a/test/runtime/samples/component-namespaced/_config.js b/test/runtime/samples/component-namespaced/_config.js
new file mode 100644
index 0000000000..b91795d6c8
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/_config.js
@@ -0,0 +1,22 @@
+import * as path from 'path';
+
+export default {
+ props: {
+ a: 1
+ },
+
+ html: `
+ foo 1
+ `,
+
+ before_test() {
+ delete require.cache[path.resolve(__dirname, 'components.js')];
+ },
+
+ test({ assert, component, target }) {
+ component.a = 2;
+ assert.htmlEqual(target.innerHTML, `
+ foo 2
+ `);
+ }
+};
\ No newline at end of file
diff --git a/test/runtime/samples/component-namespaced/components.js b/test/runtime/samples/component-namespaced/components.js
new file mode 100644
index 0000000000..832d2412ee
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/components.js
@@ -0,0 +1,3 @@
+import Foo from './Foo.svelte';
+
+export default { Foo };
\ No newline at end of file
diff --git a/test/runtime/samples/component-namespaced/main.svelte b/test/runtime/samples/component-namespaced/main.svelte
new file mode 100644
index 0000000000..541b68e47e
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/main.svelte
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/test/runtime/samples/dev-warning-unknown-props/Foo.svelte b/test/runtime/samples/dev-warning-unknown-props/Foo.svelte
new file mode 100644
index 0000000000..cebe5fd571
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props/Foo.svelte
@@ -0,0 +1,5 @@
+
+
+{foo}
diff --git a/test/runtime/samples/dev-warning-unknown-props/_config.js b/test/runtime/samples/dev-warning-unknown-props/_config.js
new file mode 100644
index 0000000000..9bff4a2a74
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props/_config.js
@@ -0,0 +1,9 @@
+export default {
+ compileOptions: {
+ dev: true
+ },
+
+ warnings: [
+ ` was created with unknown prop 'fo'`
+ ]
+};
diff --git a/test/runtime/samples/dev-warning-unknown-props/main.svelte b/test/runtime/samples/dev-warning-unknown-props/main.svelte
new file mode 100644
index 0000000000..1566cf3e41
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props/main.svelte
@@ -0,0 +1,5 @@
+
+
+
diff --git a/test/runtime/samples/event-handler-multiple/_config.js b/test/runtime/samples/event-handler-multiple/_config.js
new file mode 100644
index 0000000000..cf17c61f60
--- /dev/null
+++ b/test/runtime/samples/event-handler-multiple/_config.js
@@ -0,0 +1,14 @@
+export default {
+ html: `
+ click me
+ `,
+
+ async test({ assert, component, target, window }) {
+ const button = target.querySelector('button');
+ const event = new window.MouseEvent('click');
+
+ await button.dispatchEvent(event);
+ assert.equal(component.clickHandlerOne, 1);
+ assert.equal(component.clickHandlerTwo, 1);
+ }
+};
diff --git a/test/runtime/samples/event-handler-multiple/main.svelte b/test/runtime/samples/event-handler-multiple/main.svelte
new file mode 100644
index 0000000000..f327a7fd2a
--- /dev/null
+++ b/test/runtime/samples/event-handler-multiple/main.svelte
@@ -0,0 +1,6 @@
+
+
+click me
diff --git a/test/runtime/samples/reactive-value-mutate-const/_config.js b/test/runtime/samples/reactive-value-mutate-const/_config.js
new file mode 100644
index 0000000000..da0a19dd28
--- /dev/null
+++ b/test/runtime/samples/reactive-value-mutate-const/_config.js
@@ -0,0 +1,17 @@
+export default {
+ html: `
+ Mutate a
+ {}
+ `,
+
+ async test({ assert, target }) {
+ const button = target.querySelector('button');
+ const click = new window.MouseEvent('click');
+
+ await button.dispatchEvent(click);
+ assert.htmlEqual(target.innerHTML, `
+ Mutate a
+ {"foo":42}
+ `);
+ }
+};
diff --git a/test/runtime/samples/reactive-value-mutate-const/main.svelte b/test/runtime/samples/reactive-value-mutate-const/main.svelte
new file mode 100644
index 0000000000..403544e5f1
--- /dev/null
+++ b/test/runtime/samples/reactive-value-mutate-const/main.svelte
@@ -0,0 +1,9 @@
+
+
+ a.foo = 42}>Mutate a
+{JSON.stringify(b)}
+
diff --git a/test/runtime/samples/spring/_config.js b/test/runtime/samples/spring/_config.js
new file mode 100644
index 0000000000..79399b777a
--- /dev/null
+++ b/test/runtime/samples/spring/_config.js
@@ -0,0 +1,3 @@
+export default {
+ html: `0
`
+}
\ No newline at end of file
diff --git a/test/runtime/samples/spring/main.svelte b/test/runtime/samples/spring/main.svelte
new file mode 100644
index 0000000000..39c9afde1d
--- /dev/null
+++ b/test/runtime/samples/spring/main.svelte
@@ -0,0 +1,8 @@
+
+
+{$x}
\ No newline at end of file
diff --git a/test/server-side-rendering/index.js b/test/server-side-rendering/index.js
index 6a546b0b7b..4b648c0591 100644
--- a/test/server-side-rendering/index.js
+++ b/test/server-side-rendering/index.js
@@ -96,10 +96,13 @@ describe("ssr", () => {
(config.skip ? it.skip : config.solo ? it.only : it)(dir, () => {
const cwd = path.resolve("test/runtime/samples", dir);
- glob('**/*.svelte', { cwd: `test/runtime/samples/${dir}` }).forEach(file => {
- const resolved = require.resolve(`../runtime/samples/${dir}/${file}`);
- delete require.cache[resolved];
- });
+ Object.keys(require.cache)
+ .filter(x => x.endsWith('.svelte'))
+ .forEach(file => {
+ delete require.cache[file];
+ });
+
+ delete global.window;
const compileOptions = Object.assign({ sveltePath }, config.compileOptions, {
generate: 'ssr'
diff --git a/test/store/index.js b/test/store/index.ts
similarity index 73%
rename from test/store/index.js
rename to test/store/index.ts
index 44617d6d00..13b8e1f869 100644
--- a/test/store/index.js
+++ b/test/store/index.ts
@@ -1,5 +1,5 @@
import * as assert from 'assert';
-import { readable, writable, derived, get } from '../../store.js';
+import { readable, writable, derived, get } from '../../store';
describe('store', () => {
describe('writable', () => {
@@ -30,10 +30,10 @@ describe('store', () => {
return () => called -= 1;
});
- const unsubscribe1 = store.subscribe(() => {});
+ const unsubscribe1 = store.subscribe(() => { });
assert.equal(called, 1);
- const unsubscribe2 = store.subscribe(() => {});
+ const unsubscribe2 = store.subscribe(() => { });
assert.equal(called, 1);
unsubscribe1();
@@ -73,7 +73,7 @@ describe('store', () => {
set(0);
return () => {
- tick = () => {};
+ tick = () => { };
running = false;
};
});
@@ -211,11 +211,78 @@ describe('store', () => {
unsubscribe();
});
+
+ it('calls a cleanup function', () => {
+ const num = writable(1);
+
+ const values = [];
+ const cleaned_up = [];
+
+ const d = derived(num, ($num, set) => {
+ set($num * 2);
+
+ return function cleanup() {
+ cleaned_up.push($num);
+ };
+ });
+
+ num.set(2);
+
+ const unsubscribe = d.subscribe(value => {
+ values.push(value);
+ });
+
+ num.set(3);
+ num.set(4);
+
+ assert.deepEqual(values, [4, 6, 8]);
+ assert.deepEqual(cleaned_up, [2, 3]);
+
+ unsubscribe();
+
+ assert.deepEqual(cleaned_up, [2, 3, 4]);
+ });
+
+ it('discards non-function return values', () => {
+ const num = writable(1);
+
+ const values = [];
+
+ const d = derived(num, ($num, set) => {
+ set($num * 2);
+ return {};
+ });
+
+ num.set(2);
+
+ const unsubscribe = d.subscribe(value => {
+ values.push(value);
+ });
+
+ num.set(3);
+ num.set(4);
+
+ assert.deepEqual(values, [4, 6, 8]);
+
+ unsubscribe();
+ });
+
+ it('allows derived with different types', () => {
+ const a = writable('one');
+ const b = writable(1);
+ const c = derived([a, b], ([a, b]) => `${a} ${b}`);
+
+ assert.deepEqual(get(c), 'one 1');
+
+ a.set('two');
+ b.set(2);
+ assert.deepEqual(get(c), 'two 2');
+ });
});
describe('get', () => {
it('gets the current value of a store', () => {
- const store = readable(42, () => {});
+ const store = readable(42, () => { });
assert.equal(get(store), 42);
});
});
diff --git a/test/test.js b/test/test.js
index 993b1f637c..380bbee304 100644
--- a/test/test.js
+++ b/test/test.js
@@ -2,6 +2,6 @@ const glob = require("tiny-glob/sync.js");
require("./setup");
-glob("*/index.js", { cwd: "test" }).forEach(function(file) {
+glob("*/index.{js,ts}", { cwd: "test" }).forEach(function(file) {
require("./" + file);
});
\ No newline at end of file
diff --git a/test/validator/samples/attribute-expected-equals/errors.json b/test/validator/samples/attribute-expected-equals/errors.json
new file mode 100644
index 0000000000..a3fa9d3cac
--- /dev/null
+++ b/test/validator/samples/attribute-expected-equals/errors.json
@@ -0,0 +1,15 @@
+[{
+ "code": "unexpected-token",
+ "message": "Expected =",
+ "start": {
+ "line": 5,
+ "column": 9,
+ "character": 50
+ },
+ "end": {
+ "line": 5,
+ "column": 9,
+ "character": 50
+ },
+ "pos": 50
+}]
diff --git a/test/validator/samples/attribute-expected-equals/input.svelte b/test/validator/samples/attribute-expected-equals/input.svelte
new file mode 100644
index 0000000000..91f4b0ca7b
--- /dev/null
+++ b/test/validator/samples/attribute-expected-equals/input.svelte
@@ -0,0 +1,5 @@
+
+
+Hello {name}!
diff --git a/test/validator/samples/component-namespaced/input.svelte b/test/validator/samples/component-namespaced/input.svelte
new file mode 100644
index 0000000000..996d2d8769
--- /dev/null
+++ b/test/validator/samples/component-namespaced/input.svelte
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/test/validator/samples/component-namespaced/warnings.json b/test/validator/samples/component-namespaced/warnings.json
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/test/validator/samples/component-namespaced/warnings.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/vars/samples/component-namespaced/_config.js b/test/vars/samples/component-namespaced/_config.js
new file mode 100644
index 0000000000..ac63873967
--- /dev/null
+++ b/test/vars/samples/component-namespaced/_config.js
@@ -0,0 +1,16 @@
+export default {
+ test(assert, vars) {
+ assert.deepEqual(vars, [
+ {
+ name: 'NS',
+ export_name: null,
+ injected: false,
+ module: false,
+ mutated: false,
+ reassigned: false,
+ referenced: true,
+ writable: false
+ }
+ ]);
+ }
+};
\ No newline at end of file
diff --git a/test/vars/samples/component-namespaced/input.svelte b/test/vars/samples/component-namespaced/input.svelte
new file mode 100644
index 0000000000..996d2d8769
--- /dev/null
+++ b/test/vars/samples/component-namespaced/input.svelte
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/transition.d.ts b/transition.d.ts
new file mode 100644
index 0000000000..54d5f036da
--- /dev/null
+++ b/transition.d.ts
@@ -0,0 +1 @@
+export * from './dist/transition';
diff --git a/tsconfig.json b/tsconfig.json
index fdb7367e05..994bc61b85 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,18 +1,35 @@
{
- "compilerOptions": {
- "target": "ES6",
- "diagnostics": true,
- "noImplicitThis": true,
- "noEmitOnError": true,
- "allowJs": true,
- "lib": ["es5", "es6", "dom"],
- "importHelpers": true,
- "moduleResolution": "node"
- },
- "include": [
- "src"
- ],
- "exclude": [
- "node_modules"
- ]
+ "compilerOptions": {
+ "target": "es2015",
+ "module": "es6",
+ "declarationDir": "./dist",
+ "outDir": "./dist",
+ "declaration": true,
+ "noImplicitThis": true,
+ "noEmitOnError": true,
+ "lib": [
+ "es5",
+ "es6",
+ "dom",
+ "es2015"
+ ],
+ "importHelpers": true,
+ "moduleResolution": "node",
+ "baseUrl": ".",
+ "paths": {
+ "svelte/internal": ["./src/internal"],
+ "svelte/easing": ["./src/easing"],
+ "svelte/motion": ["./src/motion"],
+ "svelte/store": ["./src/store"]
+ },
+ "typeRoots": [
+ "node_modules/@types"
+ ]
+ },
+ "include": [
+ "src/**/*"
+ ],
+ "exclude": [
+ "dist"
+ ]
}