Merge branch 'master' of https://github.com/sveltejs/svelte into gh-2668

pull/2717/head
Ihor Yemets 6 years ago
commit 97f86af40f

@ -1,7 +1,3 @@
src/shared
shared.js
store.js
test/test.js
test/setup.js
**/_actual.js
**/expected.js
test/*/samples/*/output.js

@ -1,44 +1,76 @@
{
"root": true,
"rules": {
"indent": [2, "tab", { "SwitchCase": 1 }],
"semi": [2, "always"],
"keyword-spacing": [2, { "before": true, "after": true }],
"space-before-blocks": [2, "always"],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"no-cond-assign": 0,
"no-unused-vars": 2,
"object-shorthand": [2, "always"],
"no-const-assign": 2,
"no-class-assign": 2,
"no-this-before-super": 2,
"no-var": 2,
"no-unreachable": 2,
"valid-typeof": 2,
"quote-props": [2, "as-needed"],
"one-var": [2, "never"],
"prefer-arrow-callback": 2,
"prefer-const": [2, { "destructuring": "all" }],
"arrow-spacing": 2,
"no-inner-declarations": 0
},
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module"
},
"settings": {
"import/core-modules": ["svelte"],
"svelte3/extensions": ["html"]
}
"root": true,
"rules": {
"indent": "off",
"no-unused-vars": "off",
"semi": [2, "always"],
"keyword-spacing": [2, { "before": true, "after": true }],
"space-before-blocks": [2, "always"],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"no-cond-assign": 0,
"object-shorthand": [2, "always"],
"no-const-assign": 2,
"no-class-assign": 2,
"no-this-before-super": 2,
"no-var": 2,
"no-unreachable": 2,
"valid-typeof": 2,
"quote-props": [2, "as-needed"],
"one-var": [2, "never"],
"prefer-arrow-callback": 2,
"prefer-const": [2, { "destructuring": "all" }],
"arrow-spacing": 2,
"no-inner-declarations": 0,
"@typescript-eslint/indent": ["error", "tab", {
"SwitchCase": 1,
"ignoredNodes": ["TemplateLiteral"]
}],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/array-type": ["error", "array-simple"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_"
}],
"@typescript-eslint/no-object-literal-type-assertion": ["error", {
"allowAsParameter": true
}],
"@typescript-eslint/no-unused-vars": "off"
},
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module"
},
"settings": {
"import/core-modules": [
"svelte",
"svelte/internal",
"svelte/store",
"svelte/easing",
"estree"
]
},
"overrides": [
{
"files": ["*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
]
}

@ -1,5 +1,5 @@
[ignore]
<PROJECT_ROOT>/dist/.*
<PROJECT_ROOT>/types/.*
[include]

21
.gitignore vendored

@ -1,16 +1,17 @@
.idea
.DS_Store
.nyc_output
node_modules
*.map
/src/compile/internal-exports.ts
/compiler.js
/index.js
/internal.*
/store.js
/easing.js
/motion.*
/transition.js
/animate.js
/src/compiler/compile/internal-exports.ts
/compiler.*js
/index.*js
/internal
/store
/easing
/motion
/transition
/animate
/scratch/
/coverage/
/coverage.lcov/
@ -20,6 +21,7 @@ node_modules
/test/sourcemaps/samples/*/output.css.map
/yarn-error.log
_actual*.*
/types
/site/cypress/screenshots/
/site/__sapper__/
@ -27,5 +29,6 @@ _actual*.*
/site/.sessions
/site/static/svelte-app.json
/site/static/contributors.jpg
/site/static/workers
/site/scripts/svelte-app
/site/src/routes/_contributors.js

@ -1,7 +1,8 @@
language: node_js
node_js:
- "node"
- "8"
- "10"
- "12"
env:
global:
- BUILD_TIMEOUT=20000

@ -1,5 +1,57 @@
# Svelte changelog
## 3.4.4
* Publish type declaration files ([#2874](https://github.com/sveltejs/svelte/issues/2874))
* Don't trigger updates for unreferenced values ([#2865](https://github.com/sveltejs/svelte/pull/2865))
* Omit readonly bindings from SSR output ([#2339](https://github.com/sveltejs/svelte/issues/2339))
* Prevent outdated animation CSS ([#2871](https://github.com/sveltejs/svelte/issues/2871))
* Repair dynamic `{@html ...}` in head ([#2880](https://github.com/sveltejs/svelte/pull/2880))
* Don't create unknown prop warnings for internal props, or if component has `$$props` ([#2881](https://github.com/sveltejs/svelte/pull/2881))
## 3.4.3
* Add type declaration files for everything ([#2842](https://github.com/sveltejs/svelte/pull/2842))
* Prevent `svelte/store` being bundled ([#2786](https://github.com/sveltejs/svelte/issues/2786))
* Warn on unknown props in dev mode ([#2840](https://github.com/sveltejs/svelte/pull/2840))
* Treat `requestAnimationFrame` as a no-op on the server ([#2856](https://github.com/sveltejs/svelte/pull/2856))
* Add `raw` property to AST's `Text` nodes ([#2714](https://github.com/sveltejs/svelte/issues/2714))
* Add `<details bind:open>` ([#2854](https://github.com/sveltejs/svelte/issues/2854))
## 3.4.2
* Use empty string for empty data attributes ([#2804](https://github.com/sveltejs/svelte/pull/2804))
* Support `customElement: true` with no `<svelte:options>` ([#2821](https://github.com/sveltejs/svelte/issues/2821))
* Add docstrings to `svelte/store` ([#2795](https://github.com/sveltejs/svelte/pull/2795))
## 3.4.1
* Handle non-falsy non-function return values from derivers ([#2780](https://github.com/sveltejs/svelte/issues/2780))
* Allow `spring` to work server-side ([#2773](https://github.com/sveltejs/svelte/issues/2773))
## 3.4.0
* Allow custom element to be defined without a `tag` ([#2417](https://github.com/sveltejs/svelte/issues/2417))
* Fix parsing of quote marks inside attribute values ([#2715](https://github.com/sveltejs/svelte/pull/2754))
* Convert `svelte/store` to TypeScript ([#2733](https://github.com/sveltejs/svelte/pull/2733))
* Allow `debug` tags to include hoisted values ([#2764](https://github.com/sveltejs/svelte/issues/2764))
* Parse error if attribute name is missing `=` ([#1513](https://github.com/sveltejs/svelte/pull/2770))
* Allow reactive declarations to depend on mutated `const` values ([#2728](https://github.com/sveltejs/svelte/issues/2728))
## 3.3.0
* Allow multiple event listeners on a single node ([#2688](https://github.com/sveltejs/svelte/issues/2688))
* Allow derivers to return a cleanup function ([#2553](https://github.com/sveltejs/svelte/issues/2553))
* Support namespaced components (`<Foo.Bar/>`) ([#2743](https://github.com/sveltejs/svelte/pull/2743))
## 3.2.2
* Add `window` and `document` to expected globals ([#2722](https://github.com/sveltejs/svelte/pull/2722))
* Prevent hoisting of functions that depend on reactive state ([#2703](https://github.com/sveltejs/svelte/pull/2703))
* Generate correct code when slot has no changes ([#2697](https://github.com/sveltejs/svelte/issues/2697))
* Prevent `Object.prototype`-related bugs ([#2696](https://github.com/sveltejs/svelte/pull/2696))
## 3.2.1
* Use same comparison logic for `derived` as for other stores ([#2644](https://github.com/sveltejs/svelte/issues/2644))

@ -1,7 +1,24 @@
<p align="center">
<p>
<a href="https://svelte.dev">
<img alt="Cybernetically enhanced web apps: Svelte" src="https://svelte-assets.surge.sh/banner.png">
</a>
<a href="https://www.npmjs.com/package/svelte">
<img src="https://img.shields.io/npm/v/svelte.svg" alt="npm version">
</a>
<a href="https://packagephobia.now.sh/result?p=svelte">
<img src="https://packagephobia.now.sh/badge?p=svelte" alt="install size">
</a>
<a href="https://travis-ci.org/sveltejs/svelte">
<img src="https://api.travis-ci.org/sveltejs/svelte.svg?branch=master"
alt="build status">
</a>
<a href="https://github.com/sveltejs/svelte/blob/master/LICENSE">
<img src="https://img.shields.io/npm/l/svelte.svg" alt="license">
</a>
</p>
@ -9,7 +26,7 @@
Svelte is a new way to build web applications. It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.
Learn more at the [Svelte website](https://svelte.dev), or stop by the [Discord chatroom](https://discord.gg/yy75DKs).
Learn more at the [Svelte website](https://svelte.dev), or stop by the [Discord chatroom](https://svelte.dev/chat).
## Development
@ -19,7 +36,7 @@ Pull requests are encouraged and always welcome. [Pick an issue](https://github.
To install and work on Svelte locally:
```bash
git clone git@github.com:sveltejs/svelte.git
git clone https://github.com/sveltejs/svelte.git
cd svelte
npm install
```

@ -1,25 +0,0 @@
import { cubicOut } from './easing';
import { is_function } from './internal';
export function flip(node, animation, params) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
const dx = animation.from.left - animation.to.left;
const dy = animation.from.top - animation.to.top;
const d = Math.sqrt(dx * dx + dy * dy);
const {
delay = 0,
duration = d => Math.sqrt(d) * 120,
easing = cubicOut
} = params;
return {
delay,
duration: is_function(duration) ? duration(d) : duration,
easing,
css: (t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);`
};
}

1
compiler.d.ts vendored

@ -0,0 +1 @@
export * from './types/compiler';

567
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "svelte",
"version": "3.1.0",
"version": "3.4.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -64,6 +64,60 @@
"integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==",
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.9.0.tgz",
"integrity": "sha512-FOgfBorxjlBGpDIw+0LaZIXRX6GEEUfzj8LXwaQIUCp+gDOvkI+1WgugJ7SmWiISqK9Vj5r8S7NDKO/LB+6X9A==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "1.9.0",
"@typescript-eslint/parser": "1.9.0",
"eslint-utils": "^1.3.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^2.0.1",
"requireindex": "^1.2.0",
"tsutils": "^3.7.0"
}
},
"@typescript-eslint/experimental-utils": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-1.9.0.tgz",
"integrity": "sha512-1s2dY9XxBwtS9IlSnRIlzqILPyeMly5tz1bfAmQ84Ul687xBBve5YsH5A5EKeIcGurYYqY2w6RkHETXIwnwV0A==",
"dev": true,
"requires": {
"@typescript-eslint/typescript-estree": "1.9.0"
}
},
"@typescript-eslint/parser": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-1.9.0.tgz",
"integrity": "sha512-CWgC1XrQ34H/+LwAU7vY5xteZDkNqeAkeidEpJnJgkKu0yqQ3ZhQ7S+dI6MX4vmmM1TKRbOrKuXc6W0fIHhdbA==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "1.9.0",
"@typescript-eslint/typescript-estree": "1.9.0",
"eslint-scope": "^4.0.0",
"eslint-visitor-keys": "^1.0.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-1.9.0.tgz",
"integrity": "sha512-7Eg0TEQpCkTsEwsl1lIzd6i7L3pJLQFWesV08dS87bNz0NeSjbL78gNAP1xCKaCejkds4PhpLnZkaAjx9SU8OA==",
"dev": true,
"requires": {
"lodash.unescape": "4.0.1",
"semver": "5.5.0"
},
"dependencies": {
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"dev": true
}
}
},
"abab": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz",
@ -148,9 +202,9 @@
}
},
"ansi-escapes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
"integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
"dev": true
},
"ansi-regex": {
@ -213,6 +267,16 @@
"integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=",
"dev": true
},
"array-includes": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz",
"integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.7.0"
}
},
"arrify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
@ -246,15 +310,6 @@
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
"dev": true
},
"async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz",
"integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==",
"dev": true,
"requires": {
"lodash": "^4.17.11"
}
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
@ -493,9 +548,9 @@
}
},
"callsites": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.0.0.tgz",
"integrity": "sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true
},
"caseless": {
@ -521,12 +576,6 @@
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
"dev": true
},
"circular-json": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
"integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",
"dev": true
},
"class-utils": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
@ -808,6 +857,15 @@
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
"dev": true
},
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
"dev": true,
"requires": {
"object-keys": "^1.0.12"
}
},
"define-property": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
@ -874,38 +932,14 @@
"dev": true
},
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
"integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"dom-serializer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
"integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=",
"dev": true,
"requires": {
"domelementtype": "~1.1.1",
"entities": "~1.1.1"
},
"dependencies": {
"domelementtype": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz",
"integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=",
"dev": true
}
}
},
"domelementtype": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
"integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==",
"dev": true
},
"domexception": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
@ -915,25 +949,6 @@
"webidl-conversions": "^4.0.2"
}
},
"domhandler": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz",
"integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==",
"dev": true,
"requires": {
"domelementtype": "1"
}
},
"domutils": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz",
"integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==",
"dev": true,
"requires": {
"dom-serializer": "0",
"domelementtype": "1"
}
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -944,6 +959,12 @@
"safer-buffer": "^2.1.0"
}
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
"end-of-stream": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
@ -953,12 +974,6 @@
"once": "^1.4.0"
}
},
"entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
"integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==",
"dev": true
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@ -968,6 +983,31 @@
"is-arrayish": "^0.2.1"
}
},
"es-abstract": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
"integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.0",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"object-keys": "^1.0.12"
}
},
"es-to-primitive": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
"integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
"dev": true,
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.2"
}
},
"es6-promise": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz",
@ -1011,48 +1051,61 @@
}
},
"eslint": {
"version": "5.12.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-5.12.1.tgz",
"integrity": "sha512-54NV+JkTpTu0d8+UYSA8mMKAG4XAsaOrozA9rCW7tgneg1mevcL7wIotPC+fZ0SkWwdhNqoXoxnQCTBp7UvTsg==",
"version": "5.16.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz",
"integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"ajv": "^6.5.3",
"ajv": "^6.9.1",
"chalk": "^2.1.0",
"cross-spawn": "^6.0.5",
"debug": "^4.0.1",
"doctrine": "^2.1.0",
"eslint-scope": "^4.0.0",
"doctrine": "^3.0.0",
"eslint-scope": "^4.0.3",
"eslint-utils": "^1.3.1",
"eslint-visitor-keys": "^1.0.0",
"espree": "^5.0.0",
"espree": "^5.0.1",
"esquery": "^1.0.1",
"esutils": "^2.0.2",
"file-entry-cache": "^2.0.0",
"file-entry-cache": "^5.0.1",
"functional-red-black-tree": "^1.0.1",
"glob": "^7.1.2",
"globals": "^11.7.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"inquirer": "^6.1.0",
"js-yaml": "^3.12.0",
"inquirer": "^6.2.2",
"js-yaml": "^3.13.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.3.0",
"lodash": "^4.17.5",
"lodash": "^4.17.11",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"natural-compare": "^1.4.0",
"optionator": "^0.8.2",
"path-is-inside": "^1.0.2",
"pluralize": "^7.0.0",
"progress": "^2.0.0",
"regexpp": "^2.0.1",
"semver": "^5.5.1",
"strip-ansi": "^4.0.0",
"strip-json-comments": "^2.0.1",
"table": "^5.0.2",
"table": "^5.2.3",
"text-table": "^0.2.0"
},
"dependencies": {
"ajv": {
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
"integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
}
}
},
"eslint-import-resolver-node": {
@ -1083,9 +1136,9 @@
}
},
"eslint-module-utils": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.3.0.tgz",
"integrity": "sha512-lmDJgeOOjk8hObTysjqH7wyMi+nsHwwvfBykwfhjR1LNdd7C2uFJBvx4OpWYpXOw4df1yE1cDEVd1yLHitk34w==",
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz",
"integrity": "sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw==",
"dev": true,
"requires": {
"debug": "^2.6.8",
@ -1109,31 +1162,23 @@
}
}
},
"eslint-plugin-html": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-5.0.0.tgz",
"integrity": "sha512-f7p/7YQdgQUFVAX3nB4dnMQbrDeTalcA01PDhuvTLk0ZadCwM4Pb+639SRuqEf1zMkIxckLY+ckCr0hVP5zl6A==",
"dev": true,
"requires": {
"htmlparser2": "^3.10.0"
}
},
"eslint-plugin-import": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.15.0.tgz",
"integrity": "sha512-LEHqgR+RcnpGqYW7h9WMkPb/tP+ekKxWdQDztfTtZeV43IHF+X8lXU+1HOCcR4oXD24qRgEwNSxIweD5uNKGVg==",
"version": "2.17.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.17.3.tgz",
"integrity": "sha512-qeVf/UwXFJbeyLbxuY8RgqDyEKCkqV7YC+E5S5uOjAp4tOc8zj01JP3ucoBM8JcEqd1qRasJSg6LLlisirfy0Q==",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
"contains-path": "^0.1.0",
"debug": "^2.6.9",
"doctrine": "1.5.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-module-utils": "^2.3.0",
"eslint-module-utils": "^2.4.0",
"has": "^1.0.3",
"lodash": "^4.17.11",
"minimatch": "^3.0.4",
"read-pkg-up": "^2.0.0",
"resolve": "^1.9.0"
"resolve": "^1.11.0"
},
"dependencies": {
"debug": {
@ -1160,13 +1205,22 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"resolve": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz",
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
}
}
},
"eslint-scope": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz",
"integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
"integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
"dev": true,
"requires": {
"esrecurse": "^4.1.0",
@ -1186,12 +1240,12 @@
"dev": true
},
"espree": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-5.0.0.tgz",
"integrity": "sha512-1MpUfwsdS9MMoN7ZXqAr9e9UKdVHDcvrJpyx7mm1WuQlx/ygErEQBzgi5Nh5qBHIoYweprhtMkTCb9GhcAIcsA==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz",
"integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==",
"dev": true,
"requires": {
"acorn": "^6.0.2",
"acorn": "^6.0.7",
"acorn-jsx": "^5.0.0",
"eslint-visitor-keys": "^1.0.0"
}
@ -1227,9 +1281,9 @@
"dev": true
},
"estree-walker": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.0.tgz",
"integrity": "sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw==",
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
"dev": true
},
"esutils": {
@ -1363,13 +1417,12 @@
}
},
"file-entry-cache": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
"integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
"integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==",
"dev": true,
"requires": {
"flat-cache": "^1.2.1",
"object-assign": "^4.0.1"
"flat-cache": "^2.0.1"
}
},
"find-up": {
@ -1382,17 +1435,22 @@
}
},
"flat-cache": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz",
"integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
"integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==",
"dev": true,
"requires": {
"circular-json": "^0.3.1",
"graceful-fs": "^4.1.2",
"rimraf": "~2.6.2",
"write": "^0.2.1"
"flatted": "^2.0.0",
"rimraf": "2.6.3",
"write": "1.0.3"
}
},
"flatted": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.0.tgz",
"integrity": "sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==",
"dev": true
},
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@ -1520,9 +1578,9 @@
}
},
"globals": {
"version": "11.10.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-11.10.0.tgz",
"integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==",
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
"dev": true
},
"globalyzer": {
@ -1550,12 +1608,12 @@
"dev": true
},
"handlebars": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz",
"integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==",
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz",
"integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==",
"dev": true,
"requires": {
"async": "^2.5.0",
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
"source-map": "^0.6.1",
"uglify-js": "^3.1.4"
@ -1592,6 +1650,12 @@
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"has-symbols": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
"integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=",
"dev": true
},
"has-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
@ -1673,20 +1737,6 @@
"whatwg-encoding": "^1.0.1"
}
},
"htmlparser2": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.0.tgz",
"integrity": "sha512-J1nEUGv+MkXS0weHNWVKJJ+UrLfePxRWpN3C9bEi9fLxL2+ggW94DQvgYVXsaT30PGwYRIZKNZXuyMhp3Di4bQ==",
"dev": true,
"requires": {
"domelementtype": "^1.3.0",
"domhandler": "^2.3.0",
"domutils": "^1.5.1",
"entities": "^1.1.1",
"inherits": "^2.0.1",
"readable-stream": "^3.0.6"
}
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
@ -1776,39 +1826,39 @@
"dev": true
},
"inquirer": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.1.tgz",
"integrity": "sha512-088kl3DRT2dLU5riVMKKr1DlImd6X7smDhpXUCkJDCKvTEJeRiXh0G132HG9u5a+6Ylw9plFRY7RuTnwohYSpg==",
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.3.1.tgz",
"integrity": "sha512-MmL624rfkFt4TG9y/Jvmt8vdmOo836U7Y0Hxr2aFk3RelZEGX4Igk0KabWrcaaZaTv9uzglOqWh1Vly+FAWAXA==",
"dev": true,
"requires": {
"ansi-escapes": "^3.0.0",
"chalk": "^2.0.0",
"ansi-escapes": "^3.2.0",
"chalk": "^2.4.2",
"cli-cursor": "^2.1.0",
"cli-width": "^2.0.0",
"external-editor": "^3.0.0",
"external-editor": "^3.0.3",
"figures": "^2.0.0",
"lodash": "^4.17.10",
"lodash": "^4.17.11",
"mute-stream": "0.0.7",
"run-async": "^2.2.0",
"rxjs": "^6.1.0",
"rxjs": "^6.4.0",
"string-width": "^2.1.0",
"strip-ansi": "^5.0.0",
"strip-ansi": "^5.1.0",
"through": "^2.3.6"
},
"dependencies": {
"ansi-regex": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz",
"integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"strip-ansi": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz",
"integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==",
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
"ansi-regex": "^4.0.0"
"ansi-regex": "^4.1.0"
}
}
}
@ -1849,6 +1899,12 @@
"builtin-modules": "^1.0.0"
}
},
"is-callable": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
"integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
"dev": true
},
"is-data-descriptor": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
@ -1858,6 +1914,12 @@
"kind-of": "^3.0.2"
}
},
"is-date-object": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
"dev": true
},
"is-descriptor": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
@ -1927,12 +1989,30 @@
"@types/estree": "0.0.39"
}
},
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
"dev": true,
"requires": {
"has": "^1.0.1"
}
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
},
"is-symbol": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
"integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
"dev": true,
"requires": {
"has-symbols": "^1.0.0"
}
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
@ -1996,9 +2076,9 @@
"dev": true
},
"js-yaml": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz",
"integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==",
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
@ -2166,6 +2246,12 @@
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
"dev": true
},
"lodash.unescape": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz",
"integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=",
"dev": true
},
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
@ -2448,6 +2534,12 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
"neo-async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
"dev": true
},
"nice-try": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
@ -2527,6 +2619,12 @@
}
}
},
"object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
"dev": true
},
"object-visit": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
@ -2671,9 +2769,9 @@
"dev": true
},
"parent-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.0.tgz",
"integrity": "sha512-8Mf5juOMmiE4FcmzYc4IaiS9L3+9paz2KOiXzkRviCP6aDmN49Hz6EMWz0lGNp9pX80GvvAuLADtyGfW/Em3TA==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
"integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
"dev": true,
"requires": {
"callsites": "^3.0.0"
@ -2775,12 +2873,6 @@
"find-up": "^2.1.0"
}
},
"pluralize": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
"integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==",
"dev": true
},
"pn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
@ -2888,17 +2980,6 @@
"read-pkg": "^2.0.0"
}
},
"readable-stream": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.1.tgz",
"integrity": "sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
},
"regex-not": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
@ -2987,6 +3068,12 @@
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true
},
"requireindex": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz",
"integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==",
"dev": true
},
"resolve": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
@ -3440,9 +3527,9 @@
}
},
"rxjs": {
"version": "6.3.3",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz",
"integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz",
"integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
@ -3535,9 +3622,9 @@
"dev": true
},
"slice-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.0.0.tgz",
"integrity": "sha512-4j2WTWjp3GsZ+AOagyzVbzp4vWGtZ0hEZ/gDY/uTvm6MTxUfTUIsnMIFb1bn8o0RuXiqUw15H1bue8f22Vw2oQ==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
"integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.0",
@ -3816,15 +3903,6 @@
"strip-ansi": "^4.0.0"
}
},
"string_decoder": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz",
"integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
@ -3888,15 +3966,55 @@
"dev": true
},
"table": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/table/-/table-5.2.1.tgz",
"integrity": "sha512-qmhNs2GEHNqY5fd2Mo+8N1r2sw/rvTAAvBZTaTx+Y7PHLypqyrxr1MdIu0pLw6Xvl/Gi4ONu/sdceP8vvUjkyA==",
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/table/-/table-5.4.0.tgz",
"integrity": "sha512-nHFDrxmbrkU7JAFKqKbDJXfzrX2UBsWmrieXFTGxiI5e4ncg3VqsZeI4EzNmX0ncp4XNGVeoxIWJXfCIXwrsvw==",
"dev": true,
"requires": {
"ajv": "^6.6.1",
"ajv": "^6.9.1",
"lodash": "^4.17.11",
"slice-ansi": "2.0.0",
"string-width": "^2.1.1"
"slice-ansi": "^2.1.0",
"string-width": "^3.0.0"
},
"dependencies": {
"ajv": {
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
"integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"dev": true,
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
}
}
},
"test-exclude": {
@ -4151,6 +4269,15 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==",
"dev": true
},
"tsutils": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.14.0.tgz",
"integrity": "sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -4182,26 +4309,26 @@
"dev": true
},
"typescript": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.4.tgz",
"integrity": "sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==",
"version": "3.4.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz",
"integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
"dev": true
},
"uglify-js": {
"version": "3.4.9",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz",
"integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==",
"version": "3.5.12",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.12.tgz",
"integrity": "sha512-KeQesOpPiZNgVwJj8Ge3P4JYbQHUdZzpx6Fahy6eKAYRSV4zhVmLXoC+JtOeYxcHCHTve8RG1ZGdTvpeOUM26Q==",
"dev": true,
"optional": true,
"requires": {
"commander": "~2.17.1",
"commander": "~2.20.0",
"source-map": "~0.6.1"
},
"dependencies": {
"commander": {
"version": "2.17.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"dev": true,
"optional": true
}
@ -4470,9 +4597,9 @@
"dev": true
},
"write": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",
"integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz",
"integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==",
"dev": true,
"requires": {
"mkdirp": "^0.5.1"

@ -1,22 +1,27 @@
{
"name": "svelte",
"version": "3.2.1",
"version": "3.4.4",
"description": "Cybernetically enhanced web apps",
"module": "index.mjs",
"main": "index",
"files": [
"compiler.js",
"types",
"compiler.*",
"register.js",
"index.*",
"internal.*",
"store.*",
"animate.*",
"transition.*",
"easing.*",
"motion.*",
"internal",
"store",
"animate",
"transition",
"easing",
"motion",
"svelte",
"README.md"
],
"engines": {
"node": ">= 8"
},
"types": "types/runtime",
"scripts": {
"test": "mocha --opts mocha.opts",
"test:unit": "mocha --require sucrase/register --recursive ./**/__test__.ts",
@ -25,13 +30,16 @@
"coverage": "c8 report --reporter=text-lcov > coverage.lcov && c8 report --reporter=html",
"codecov": "codecov",
"precodecov": "npm run coverage",
"lint": "eslint src test/*.js",
"build": "rollup -c",
"prepare": "npm run build",
"prepare": "npm run build && npm run tsd",
"dev": "rollup -cw",
"pretest": "npm run build",
"posttest": "agadoo src/internal/index.js",
"prepublishOnly": "export PUBLISH=true && npm run lint && npm test"
"posttest": "agadoo internal/index.mjs",
"prepublishOnly": "export PUBLISH=true && npm test && npm run create-stubs",
"create-stubs": "node scripts/create-stubs.js",
"tsd": "tsc -p . --emitDeclarationOnly",
"typecheck": "tsc -p . --noEmit",
"lint": "eslint \"{src,test}/**/*.{ts,js}\""
},
"repository": {
"type": "git",
@ -53,16 +61,17 @@
"@sveltejs/svelte-repl": "0.0.5",
"@types/mocha": "^5.2.0",
"@types/node": "^10.5.5",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"acorn": "^6.1.1",
"acorn-dynamic-import": "^4.0.0",
"agadoo": "^1.0.1",
"c8": "^3.4.0",
"codecov": "^3.0.0",
"css-tree": "1.0.0-alpha22",
"eslint": "^5.3.0",
"eslint-plugin-html": "^5.0.0",
"eslint-plugin-import": "^2.11.0",
"estree-walker": "^0.6.0",
"eslint": "^5.16.0",
"eslint-plugin-import": "^2.17.3",
"estree-walker": "^0.6.1",
"is-reference": "^1.1.1",
"jsdom": "^12.2.0",
"kleur": "^3.0.0",
@ -83,7 +92,7 @@
"tiny-glob": "^0.2.1",
"ts-node": "^8.0.2",
"tslib": "^1.8.0",
"typescript": "^3.0.1"
"typescript": "^3.4.0"
},
"nyc": {
"include": [

@ -25,8 +25,7 @@ function deregisterExtension(extension) {
function registerExtension(extension) {
require.extensions[extension] = function(module, filename) {
const name = path.basename(filename)
.slice(0, -path.extname(filename).length)
const name = path.parse(filename).name
.replace(/^\d/, '_$&')
.replace(/[^a-zA-Z0-9_$]/g, '');

@ -9,36 +9,70 @@ import pkg from './package.json';
const is_publish = !!process.env.PUBLISH;
const ts_plugin = is_publish
? typescript({
include: 'src/**',
typescript: require('typescript')
})
: sucrase({
transforms: ['typescript']
});
const external = id => id.startsWith('svelte/');
export default [
/* internal.[m]js */
/* runtime */
{
input: `src/internal/index.js`,
input: `src/runtime/index.ts`,
output: [
{
file: `internal.mjs`,
file: `index.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}`
},
{
file: `internal.js`,
file: `index.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '.')}`
}
],
external: id => id.startsWith('svelte/'),
plugins: [{
generateBundle(options, bundle) {
const mod = bundle['internal.mjs'];
if (mod) {
fs.writeFileSync('src/compile/internal-exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`);
}
}
}]
external,
plugins: [ts_plugin]
},
...fs.readdirSync('src/runtime')
.filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory())
.map(dir => ({
input: `src/runtime/${dir}/index.ts`,
output: [
{
file: `${dir}/index.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '..')}`
},
{
file: `${dir}/index.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && `${id.replace('svelte', '..')}`
}
],
external,
plugins: [
ts_plugin,
dir === 'internal' && {
generateBundle(options, bundle) {
const mod = bundle['index.mjs'];
if (mod) {
fs.writeFileSync('src/compiler/compile/internal-exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`);
}
}
}
]
})),
/* compiler.js */
{
input: 'src/index.ts',
input: 'src/compiler/index.ts',
plugins: [
replace({
__VERSION__: pkg.version
@ -48,15 +82,7 @@ export default [
include: ['node_modules/**']
}),
json(),
is_publish
? typescript({
include: 'src/**',
exclude: 'src/internal/**',
typescript: require('typescript')
})
: sucrase({
transforms: ['typescript']
})
ts_plugin
],
output: {
file: 'compiler.js',
@ -67,34 +93,5 @@ export default [
external: is_publish
? []
: id => id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree')
},
/* motion.mjs */
{
input: `src/motion/index.js`,
output: [
{
file: `motion.mjs`,
format: 'esm',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
},
{
file: `motion.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
}
],
external: id => id.startsWith('svelte/')
},
// everything else
...['index', 'store', 'easing', 'transition', 'animate'].map(name => ({
input: `${name}.mjs`,
output: {
file: `${name}.js`,
format: 'cjs',
paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
},
external: id => id !== `${name}.mjs`
}))
}
];

@ -0,0 +1,12 @@
const fs = require('fs');
fs.readdirSync('src/runtime')
.filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory())
.forEach(dir => {
fs.writeFileSync(`${dir}/package.json`, JSON.stringify({
main: './index.js',
module: './index.mjs'
}, null, ' '));
fs.writeFileSync(`${dir}/index.d.ts`, `export * from '../types/runtime/${dir}/index.d.ts';`);
});

@ -1,4 +1,4 @@
FROM mhart/alpine-node:11.14
FROM mhart/alpine-node:12
# install dependencies
WORKDIR /app
@ -9,7 +9,7 @@ RUN npm ci --production
# Only copy over the Node pieces we need
# ~> Saves 35MB
###
FROM mhart/alpine-node:base-11.14
FROM mhart/alpine-node:slim-12
WORKDIR /app
COPY --from=0 /app .

@ -13,7 +13,11 @@ Start the server with `npm run dev`, and navigate to [localhost:3000](http://loc
## Using a local copy of Svelte
By default, the REPL will fetch the most recent version of Svelte from https://unpkg.com/svelte. To use the local copy of the compiler and runtime from this repo, you can navigate to [localhost:3000/repl?version=local](http://localhost:3000/repl?version=local). To produce the proper browser-compatible UMD build, you will need to run `npm run build` with the `PUBLISH` environment variable set (to any non-empty string).
By default, the REPL will fetch the most recent version of Svelte from https://unpkg.com/svelte. When running the site locally, you can also use your local copy of Svelte.
To produce the proper browser-compatible UMD build of the compiler, you will need to run `npm run build` (or `npm run dev`) in the root of this repository with the `PUBLISH` environment variable set to any non-empty string.
Then visit the REPL at [localhost:3000/repl?version=local](http://localhost:3000/repl?version=local).
## REPL GitHub integration

@ -44,9 +44,11 @@ In the terminal, you can instantly create a new project like so:
npx degit sveltejs/template my-svelte-project
cd my-svelte-project
npm install
npm run dev & open http://localhost:5000
npm run dev
```
This will create a new project in the `my-svelte-project` directory, install its dependencies, and start a server on http://localhost:5000.
Once you've tinkered a bit and understood how everything fits together, you can fork [sveltejs/template](https://github.com/sveltejs/template) and start doing this instead:
```bash
@ -55,4 +57,4 @@ npx degit your-name/template my-new-project
And that's it! Do `npm run build` to create a production-ready version of your app, and check the project template's [README](https://github.com/sveltejs/template/blob/master/README.md) for instructions on how to easily deploy your app to the web with [Now](https://zeit.co/now) or [Surge](http://surge.sh/).
You're not restricted to using Rollup — there are also integrations for [webpack](https://github.com/sveltejs/svelte-loader), [Browserify](https://github.com/tehshrike/sveltify) and others, or you can use the [Svelte CLI](https://github.com/sveltejs/svelte-cli) (Update from 2019: with Svelte 3 the CLI was deprecated and we now use [sirv-cli](https://www.npmjs.com/package/sirv-cli) in our template. Feel free to use whatever tool you like!) or the [API](https://github.com/sveltejs/svelte/tree/v2#api) directly. If you make a project template using one of these tools, please share it with the [Svelte Discord chatroom](https://discord.gg/yy75DKs), or via [@sveltejs](https://twitter.com/sveltejs) on Twitter!
You're not restricted to using Rollup — there are also integrations for [webpack](https://github.com/sveltejs/svelte-loader), [Browserify](https://github.com/tehshrike/sveltify) and others, or you can use the [Svelte CLI](https://github.com/sveltejs/svelte-cli) (Update from 2019: with Svelte 3 the CLI was deprecated and we now use [sirv-cli](https://www.npmjs.com/package/sirv-cli) in our template. Feel free to use whatever tool you like!) or the [API](https://github.com/sveltejs/svelte/tree/v2#api) directly. If you make a project template using one of these tools, please share it with the [Svelte Discord chatroom](chat), or via [@sveltejs](https://twitter.com/sveltejs) on Twitter!

@ -81,4 +81,4 @@ I believe the next frontier of web performance is 'whole-app optimisation'. Curr
Speaking of Glimmer, the idea of compiling components to bytecode is one that we'll probably steal in 2018. A framework like Sapper could conceivably determine which compilation mode to use based on the characteristics of your app. It could even serve JavaScript for the initial route for the fastest possible startup time, then lazily serve a bytecode interpreter for subsequent routes, resulting in the optimal combination of startup size and total app size.
Mostly, though, we want the direction of Sapper to be determined by its users. If you're the kind of developer who enjoys life on the bleeding edge and would like to help shape the future of how we build web apps, please join us on [GitHub](https://github.com/sveltejs/svelte) and [Discord](https://discord.gg/yy75DKs).
Mostly, though, we want the direction of Sapper to be determined by its users. If you're the kind of developer who enjoys life on the bleeding edge and would like to help shape the future of how we build web apps, please join us on [GitHub](https://github.com/sveltejs/svelte) and [Discord](chat).

@ -12,7 +12,7 @@ Almost a year after we first started talking about version 2 on the Svelte issue
## tl;dr
Each of these items is described in more depth below. If you get stuck, ask for help in our friendly [Discord chatroom](https://discord.gg/yy75DKs).
Each of these items is described in more depth below. If you get stuck, ask for help in our friendly [Discord chatroom](chat).
- Install Svelte v2 from npm
- Upgrade your templates with [svelte-upgrade](https://github.com/sveltejs/svelte-upgrade)
@ -201,4 +201,4 @@ Before, there was a `svelte.validate` method which checked your component was va
## My app is broken! Help!
Hopefully this covers everything, and the update should be easier for you than it was for us. But if you find bugs, or discover things that aren't mentioned here, swing by [Discord chatroom](https://discord.gg/yy75DKs) or raise an issue on the [tracker](https://github.com/sveltejs/svelte/issues).
Hopefully this covers everything, and the update should be easier for you than it was for us. But if you find bugs, or discover things that aren't mentioned here, swing by [Discord chatroom](chat) or raise an issue on the [tracker](https://github.com/sveltejs/svelte/issues).

@ -14,9 +14,8 @@ Earlier this month, I had the privilege of appearing on [The Changelog](https://
...and, most importantly, Svelte 3.
Unless you hang out in our [Discord server](https://discord.gg/yy75DKs) or follow [@sveltejs](https://twitter.com/sveltejs) on Twitter, you might not know that Svelte 3 is just around the corner, and it's going to be a huge release. We've rethought the developer experience from the ground up, and while it *will* be a nuisance if you need to upgrade a Svelte 2 app (more on that soon) we think you're going to love it.
Unless you hang out in our [Discord server](chat) or follow [@sveltejs](https://twitter.com/sveltejs) on Twitter, you might not know that Svelte 3 is just around the corner, and it's going to be a huge release. We've rethought the developer experience from the ground up, and while it *will* be a nuisance if you need to upgrade a Svelte 2 app (more on that soon) we think you're going to love it.
On the podcast [Adam](https://twitter.com/adamstac), [Jerod](https://twitter.com/jerodsanto) and I talk about some of the changes and why we're making them. You can listen here or on the [podcast page](https://changelog.com/podcast/332).
<audio data-theme="night" style="width: 100%" data-src="https://changelog.com/podcast/332/embed" src="https://cdn.changelog.com/uploads/podcast/332/the-changelog-332.mp3" preload="none" class="changelog-episode" controls></audio><p><a href="https://changelog.com/podcast/332">The Changelog 332: A UI framework without the framework</a> Listen on <a href="https://changelog.com/">Changelog.com</a></p><script async src="//cdn.changelog.com/embed.js"></script>

@ -94,4 +94,4 @@ We don't take this lightly: hopefully once you've experienced Svelte 3 you'll un
As grueling as this release has been, we're nowhere near finished. We have a ton of ideas for generating smarter, more compact code, and a long feature wish-list. [Sapper](https://sapper.svelte.dev), our Next.js-style app framework, is still in the middle of being updated to use Svelte 3. The [Svelte Native](https://svelte-native.technology/) community project, which allows you to write Android and iOS apps in Svelte, is making solid progress but deserves more complete support from core. We don't yet have the bounty of editor extensions, syntax highlighters, component kits, devtools and so on that other frameworks have, and we should fix that. We *really* want to add first-class TypeScript support.
But in the meantime we think Svelte 3 is the best way to build web apps yet. Take an hour to go through the [tutorial](tutorial) and we hope to convince you of the same. Either way, we'd love to see you in our [Discord chatroom](https://discord.gg/yy75DKs) and on [GitHub](https://github.com/sveltejs/svelte) — everyone is welcome, especially you.
But in the meantime we think Svelte 3 is the best way to build web apps yet. Take an hour to go through the [tutorial](tutorial) and we hope to convince you of the same. Either way, we'd love to see you in our [Discord chatroom](chat) and on [GitHub](https://github.com/sveltejs/svelte) — everyone is welcome, especially you.

@ -2,7 +2,7 @@
title: Before we begin
---
> Temporary note: This document is a work-in-progress. Please forgive any missing or misleading parts, and don't be shy about asking for help in the [Discord chatroom](https://discord.gg/yy75DKs). The [tutorial](tutorial) is more complete; start there.
> Temporary note: This document is a work-in-progress. Please forgive any missing or misleading parts, and don't be shy about asking for help in the [Discord chatroom](chat). The [tutorial](tutorial) is more complete; start there.
This page contains detailed API reference documentation. It's intended to be a resource for people who already have some familiarity with Svelte.

@ -48,10 +48,13 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
// are immediately available
console.log(foo, bar);
// function declarations cannot be set externally,
// but can be accessed from outside
export function instanceMethod() {
alert(foo);
// Function expressions can also be props
export let format = (number) => (number.toFixed(2));
// Function declarations are added as methods
// on the component, rather than props
export function greetMethod() {
alert(`I'm a <${this.constructor.name}>!`);
}
// you can also use export { ... as ... } to have
@ -89,7 +92,7 @@ Because Svelte's reactivity is based on assignments, using array methods like `.
---
Any top-level statement (i.e. not inside a block or a function) can be made reactive by prefixing it with the `$:` label. Reactive statements run immediately before the component updates, whenever the values that they depend on have changed.
Any top-level statement (i.e. not inside a block or a function) can be made reactive by prefixing it with the `$:` [JS label syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label). Reactive statements run immediately before the component updates, whenever the values that they depend on have changed.
```html
<script>

@ -7,7 +7,7 @@ title: Template syntax
---
A lowercase tag, like `<div>`, denotes a regular HTML element. A capitalised tag, such as `<Widget>`, indicates a *component*.
A lowercase tag, like `<div>`, denotes a regular HTML element. A capitalised tag, such as `<Widget>` or `<Namespace.Widget>`, indicates a *component*.
```html
<script>
@ -351,6 +351,24 @@ If the `on:` directive is used without a value, the component will *forward* the
</button>
```
---
It's possible to have multiple event listeners for the same event:
```html
<script>
let counter = 0;
function increment() {
counter = counter + 1;
}
function track(event) {
trackEvent(event)
}
</script>
<button on:click={increment} on:click={track}>Click me!</button>
```
### Component events
@ -575,12 +593,12 @@ You can bind to component props using the same mechanism.
Components also support `bind:this`, allowing you to interact with component instances programmatically.
> Note that we can do `{cart.empty}` rather than `{() => cart.empty()}`, since component methods are closures. You don't need to worry about the value of `this` when calling them.
> Note that we can't do `{cart.empty}` since `cart` is `undefined` when the button is first rendered and throws an error.
```html
<ShoppingCart bind:this={cart}/>
<button on:click={cart.empty}>
<button on:click={() => cart.empty()}>
Empty shopping cart
</button>
```
@ -895,7 +913,138 @@ Local transitions only play when the block they belong to is created or destroye
### Animations
TODO i can't remember how any of this works
```sv
animate:name
```
```sv
animate:name={params}
```
```js
animation = (node: HTMLElement, { from: DOMRect, to: DOMRect } , params: any) => {
delay?: number,
duration?: number,
easing?: (t: number) => number,
css?: (t: number, u: number) => string,
tick?: (t: number, u: number) => void
}
```
```js
DOMRect {
bottom: number,
height: number,
left: number,
right: number,
top: number,
width: number,
x: number,
y:number
}
```
---
An animation is triggered when the contents of a [keyed each block](docs#Each_blocks) are re-ordered. Animations do not run when an element is removed, only when the each block's data is reordered. Animate directives must be on an element that is an *immediate* child of a keyed each block.
Animations can be used with Svelte's [built-in animation functions](docs#svelte_animate) or [custom animation functions](docs#Custom_animation_functions).
```html
<!-- When `list` is reordered the animation will run-->
{#each list as item, index (item)}
<li animate:flip>{item}</li>
{/each}
```
#### Animation Parameters
---
As with actions and transitions, animations can have parameters.
(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.)
```html
{#each list as item, index (item)}
<li animate:flip="{{ delay: 500 }}">{item}</li>
{/each}
```
#### Custom animation functions
---
Animations can use custom functions that provide the `node`, an `animation` object and any `paramaters` as arguments. The `animation` parameter is an object containing `from` and `to` properties each containing a [DOMRect](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect#Properties) describing the geometry of the element in its `start` and `end` positions. The `from` property is the DOMRect of the element in its starting position, the `to` property is the DOMRect of the element in its final position after the list has been reordered and the DOM updated.
If the returned object has a `css` method, Svelte will create a CSS animation that plays on the element.
The `t` argument passed to `css` is a value that goes from `0` and `1` after the `easing` function has been applied. The `u` argument is equal to `1 - t`.
The function is called repeatedly *before* the animation begins, with different `t` and `u` arguments.
```html
<script>
import { cubicOut } from 'svelte/easing';
function whizz(node, { from, to }, params) {
const dx = from.left - to.left;
const dy = from.top - to.top;
const d = Math.sqrt(dx * dx + dy * dy);
return {
delay: 0,
duration: Math.sqrt(d) * 120,
easing: cubicOut,
css: (t, u) =>
`transform: translate(${u * dx}px, ${u * dy}px) rotate(${t*360}deg);`
};
}
</script>
{#each list as item, index (item)}
<div animate:whizz>{item}</div>
{/each}
```
---
A custom animation function can also return a `tick` function, which is called *during* the animation with the same `t` and `u` arguments.
> If it's possible to use `css` instead of `tick`, do so — CSS animations can run off the main thread, preventing jank on slower devices.
```html
<script>
import { cubicOut } from 'svelte/easing';
function whizz(node, { from, to }, params) {
const dx = from.left - to.left;
const dy = from.top - to.top;
const d = Math.sqrt(dx * dx + dy * dy);
return {
delay: 0,
duration: Math.sqrt(d) * 120,
easing: cubicOut,
tick: (t, u) =>
Object.assign(node.style, {
color: t > 0.5 ? 'Pink' : 'Blue'
});
};
}
</script>
{#each list as item, index (item)}
<div animate:whizz>{item}</div>
{/each}
```
### Slots
@ -1130,3 +1279,50 @@ The `<svelte:options>` element provides a place to specify per-component compile
```html
<svelte:options tag="my-custom-element"/>
```
### @debug
```sv
{@debug}
```
```sv
{@debug var1, var2, ..., varN}
```
---
The `{@debug ...}` tag offers an alternative to `console.log(...)`. It logs the values of specific variables whenever they change, and pauses code execution if you have devtools open.
It accepts a comma-separated list of variable names (not arbitrary expressions).
```html
<script>
let user = {
firstname: 'Ada',
lastname: 'Lovelace'
};
</script>
{@debug user}
<h1>Hello {user.firstname}!</h1>
```
---
`{@debug ...}` accepts a comma-separated list of variable names (not arbitrary expressions).
```html
<!-- Compiles -->
{@debug user}
{@debug user1, user2, user3}
<!-- WON'T compile -->
{@debug user.firstname}
{@debug myArray[0]}
{@debug !isReady}
{@debug typeof user === 'object'}
```
The `{@debug}` tag without any arguments will insert a `debugger` statement that gets triggered when *any* state changes, as opposed to the specified variables.

@ -324,13 +324,13 @@ const time = readable(new Date(), set => {
store = derived(a, callback: (a: any) => any)
```
```js
store = derived(a, callback: (a: any, set: (value: any) => void) => void, initial_value: any)
store = derived(a, callback: (a: any, set: (value: any) => void) => void | () => void, initial_value: any)
```
```js
store = derived([a, ...b], callback: ([a: any, ...b: any[]]) => any)
```
```js
store = derived([a, ...b], callback: ([a: any, ...b: any[]], set: (value: any) => void) => void, initial_value: any)
store = derived([a, ...b], callback: ([a: any, ...b: any[]], set: (value: any) => void) => void | () => void, initial_value: any)
```
---
@ -359,6 +359,20 @@ const delayed = derived(a, ($a, set) => {
}, 'one moment...');
```
If you return a function from the callback, it will be called when a) the callback runs again, or b) the last subscriber unsubscribes:
```js
import { derived } from 'svelte/store';
const tick = derived(frequency, ($frequency, set) => {
const interval = setInterval(() => set(Date.now()), 1000 / frequency);
return () => {
clearInterval(interval);
}
}, 'one moment...');
```
---
In both cases, an array of arguments can be passed as the first argument instead of a single store.
@ -503,10 +517,204 @@ Both `set` and `update` can take a second argument — an object with `hard` or
### `svelte/transition`
TODO
The `svelte/transition` module exports six functions: `fade`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with svelte [`transitions`](docs#Transitions).
#### `fade`
```sv
transition:fade={params}
```
```sv
in:fade={params}
```
```sv
out:fade={params}
```
---
Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions.
`fade` accepts the following parameters:
* `delay` (`number`, default 0) — milliseconds before starting
* `duration` (`number`, default 400) — milliseconds the transition lasts
You can see the `fade` transition in action in the [transition tutorial](tutorial/transition).
```html
<script>
import { fade } from 'svelte/transition';
</script>
{#if condition}
<div transition:fade="{{delay: 250, duration: 300}}">
fades in and out
</div>
{/if}
```
#### `fly`
```sv
transition:fly={params}
```
```sv
in:fly={params}
```
```sv
out:fly={params}
```
---
Animates the x and y positions and the opacity of an element. `in` transitions animate from an element's current (default) values to the provided values, passed as parameters. `out` transitions animate from the provided values to an element's default values.
`fly` accepts the following parameters:
* `delay` (`number`, default 0) — milliseconds before starting
* `duration` (`number`, default 400) — milliseconds the transition lasts
* `easing` (`function`, default `cubicOut`) — an [easing function](docs#svelte_easing)
* `x` (`number`, default 0) - the x offset to animate out to and in from
* `y` (`number`, default 0) - the y offset to animate out to and in from
* `opacity` (`number`, default 0) - the opacity value to animate out to and in from
You can see the `fly` transition in action in the [transition tutorial](tutorial/adding-parameters-to-transitions).
```html
<script>
import { fly } from 'svelte/transition';
import { quintOut } from 'svelte/easing';
</script>
{#if condition}
<div transition:fly="{{delay: 250, duration: 300, x: 100, y: 500, opacity: 0.5, easing: quintOut}}">
flies in and out
</div>
{/if}
```
#### `slide`
```sv
transition:slide={params}
```
```sv
in:slide={params}
```
```sv
out:slide={params}
```
---
Slides an element in and out.
`slide` accepts the following parameters:
* `delay` (`number`, default 0) — milliseconds before starting
* `duration` (`number`, default 400) — milliseconds the transition lasts
* `easing` (`function`, default `cubicOut`) — an [easing function](docs#svelte_easing)
```html
<script>
import { slide } from 'svelte/transition';
import { quintOut } from 'svelte/easing';
</script>
{#if condition}
<div transition:slide="{{delay: 250, duration: 300, easing: quintOut }}">
slides in and out
</div>
{/if}
```
#### `scale`
```sv
transition:scale={params}
```
```sv
in:scale={params}
```
```sv
out:scale={params}
```
---
Animates the opacity and scale of an element. `in` transitions animate from an element's current (default) values to the provided values, passed as parameters. `out` transitions animate from the provided values to an element's default values.
`scale` accepts the following parameters:
* `delay` (`number`, default 0) — milliseconds before starting
* `duration` (`number`, default 400) — milliseconds the transition lasts
* `easing` (`function`, default `cubicOut`) — an [easing function](docs#svelte_easing)
* `start` (`number`, default 0) - the scale value to animate out to and in from
* `opacity` (`number`, default 0) - the opacity value to animate out to and in from
```html
<script>
import { scale } from 'svelte/transition';
import { quintOut } from 'svelte/easing';
</script>
{#if condition}
<div transition:scale="{{duration: 500, delay: 500, opacity: 0.5, start: 0.5, easing: quintOut}}">
scales in and out
</div>
{/if}
```
#### `draw`
```sv
transition:draw={params}
```
```sv
in:draw={params}
```
```sv
out:draw={params}
```
---
Animates the stroke of an SVG element, like a snake in a tube. `in` transitions begin with the path invisible and draw the path to the screen over time. `out` transitions start in a visible state and gradually erase the path. `draw` only works with elements that have a `getTotalLength` method, like `<path>` and `<polyline>`.
`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
<script>
import { draw } from 'svelte/transition';
import { quintOut } from 'svelte/easing';
</script>
<svg viewBox="0 0 5 5" xmlns="http://www.w3.org/2000/svg">
{#if condition}
<path transition:draw="{{duration: 5000, delay: 500, easing: quintOut}}"
d="M2 1 h1 v1 h1 v1 h-1 v1 h-1 v-1 h-1 v-1 h1 z"
fill="none"
stroke="cornflowerblue"
stroke-width="0.1px"
stroke-linejoin="round"
/>
{/if}
</svg>
```
<!-- Crossfade is coming soon... -->
* fade, fly, slide, scale, draw
* crossfade...
### `svelte/animate`

@ -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);
}
});

@ -1,5 +1,5 @@
<script>
import Eliza from 'elizanode';
import Eliza from 'elizabot';
import { beforeUpdate, afterUpdate } from 'svelte';
let div;

@ -1,8 +1,9 @@
<script>
import { quintOut } from 'svelte/easing';
import crossfade from './crossfade.js'; // TODO put this in svelte/transition!
import { crossfade } from 'svelte/transition';
import { flip } from 'svelte/animate';
const { send, receive } = crossfade({
const [send, receive] = crossfade({
fallback(node, params) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
@ -43,12 +44,6 @@
function remove(todo) {
todos = todos.filter(t => t !== todo);
}
function handleKeydown(event) {
if (event.which === 13) {
addTodo(event.target);
}
}
</script>
<style>
@ -114,7 +109,7 @@
</style>
<div class='board'>
<input class="new-todo" placeholder="what needs to be done?" on:enter={add}>
<input class="new-todo" placeholder="what needs to be done?" on:keydown="{event => event.which === 13 && add(this)}">
<div class='left'>
<h2>todo</h2>
@ -122,6 +117,7 @@
<label
in:receive="{{key: todo.id}}"
out:send="{{key: todo.id}}"
animate:flip
>
<input type=checkbox bind:checked={todo.done}>
{todo.description}
@ -136,6 +132,7 @@
<label
in:receive="{{key: todo.id}}"
out:send="{{key: todo.id}}"
animate:flip
>
<input type=checkbox bind:checked={todo.done}>
{todo.description}

@ -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);
};
}
};
}

@ -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 : '';
}
</script>

@ -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 = '';
});
});
}

@ -3,4 +3,4 @@
let name = 'Rick Astley';
</script>
<img {src} alt="{name} dancing">
<img {src} alt="{name} dances.">

@ -16,13 +16,13 @@ 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
<img src={src} alt="A man dancing">
<img src={src} alt="A man dances.">
```
We can use curly braces *inside* attributes. Try changing it to `"{name} dancing"` — remember to declare a `name` variable in the `<script>` block.
We can use curly braces *inside* attributes. Try changing it to `"{name} dances."` — remember to declare a `name` variable in the `<script>` block.
## Shorthand attributes
@ -30,6 +30,6 @@ We can use curly braces *inside* attributes. Try changing it to `"{name} dancing
It's not uncommon to have an attribute where the name and value are the same, like `src={src}`. Svelte gives us a convenient shorthand for these cases:
```html
<img {src} alt="A man dancing">
<img {src} alt="A man dances.">
```

@ -10,7 +10,7 @@ We can easily specify default values for props:
</script>
```
If we now instantiate the component without an `answer` prop, it will fall back to the default:
If we now add a second component *without* an `answer` prop, it will fall back to the default:
```html
<Nested answer={42}/>

@ -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 `<input>` 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 `<input>` 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:

@ -1,5 +1,5 @@
<script>
import Eliza from 'elizanode';
import Eliza from 'elizabot';
import { beforeUpdate, afterUpdate } from 'svelte';
let div;

@ -1,5 +1,5 @@
<script>
import Eliza from 'elizanode';
import Eliza from 'elizabot';
import { beforeUpdate, afterUpdate } from 'svelte';
let div;

@ -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
<p in:fly="{{ y: 200, duration: 2000 }}" out:fade>

@ -27,7 +27,7 @@ import { pannable } from './pannable.js';
></div>
```
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.

@ -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 = '';
});
});
}

@ -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 = '';
});
});
}

@ -8,4 +8,4 @@ To get set up in your local development environment, check out [the quickstart g
If you're looking for a more expansive framework that includes routing, server-side rendering and everything else, take a look at [Sapper](https://sapper.svelte.dev).
Most importantly: since you're now a member of the Svelte community, you should [join our friendly Discord chatroom](https://discord.gg/yy75DKs). That's where you'll find fellow Svelte users, and it's where we plan the future of the framework.
Most importantly: since you're now a member of the Svelte community, you should [join our friendly Discord chatroom](chat). That's where you'll find fellow Svelte users, and it's where we plan the future of the framework.

@ -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,13 +1362,15 @@
}
},
"@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.1.5",
"resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.1.5.tgz",
"integrity": "sha512-gk7Ny/i19g3njob9lGGV5JzDed8eAaFphHidxquFGW5QgMCScEu+YgweBo+tRkRE0sJObFzMz3MjudH5o+KdIw==",
"dev": true,
"requires": {
"codemirror": "^5.45.0",
"sourcemap-codec": "^1.4.4"
"estree-walker": "^0.6.0",
"sourcemap-codec": "^1.4.4",
"yootils": "0.0.15"
}
},
"@types/estree": {
@ -1412,9 +1380,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 +1628,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 +1710,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": {
@ -1833,9 +1801,9 @@
"dev": true
},
"codemirror": {
"version": "5.46.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.46.0.tgz",
"integrity": "sha512-3QpMge0vg4QEhHW3hBAtCipJEWjTJrqLLXdIaWptJOblf1vHFeXLNtFhPai/uX2lnFCehWNk4yOdaMR853Z02w==",
"version": "5.47.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.47.0.tgz",
"integrity": "sha512-kV49Fr+NGFHFc/Imsx6g180hSlkGhuHxTSDDmDHOuyln0MQYFLixDY4+bFkBVeCEiepYfDimAF/e++9jPJk4QA==",
"dev": true
},
"collection-visit": {
@ -1970,12 +1938,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 +2064,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 +2125,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 +2190,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 +2216,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 +2356,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 +2383,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 +2425,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 +2522,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 +2558,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 +2579,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 +2635,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 +2659,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 +2679,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 +2754,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 +2940,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 +3179,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 +3310,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 +3348,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 +3403,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 +3417,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 +3489,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 +3722,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 +3811,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 +3926,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 +4044,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 +4074,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 +4124,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 +4169,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 +4204,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 +4306,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 +4319,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 +4350,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 +4376,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 +4445,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 +4671,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 +4748,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 +4794,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",

@ -3,16 +3,18 @@
"version": "1.0.0",
"description": "Docs and examples for Svelte",
"scripts": {
"dev": "sapper dev",
"dev": "npm run copy-workers && sapper dev",
"copy-workers": "rm -rf static/workers && cp -r node_modules/@sveltejs/svelte-repl/workers static",
"migrate": "node-pg-migrate -r dotenv/config",
"sapper": "sapper build --legacy",
"sapper": "npm run copy-workers && sapper build --legacy",
"update_shimport": "cp node_modules/shimport/index.js __sapper__/build/client/shimport@0.0.14.js",
"update": "node scripts/update_template.js && node scripts/get-contributors.js",
"start": "node __sapper__/build",
"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 +39,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.1.5",
"degit": "^2.1.3",
"dotenv": "^8.0.0",
"eslint-plugin-svelte3": "^1.0.0",
@ -47,7 +49,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 +57,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"
},

@ -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));

@ -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));

@ -116,6 +116,7 @@
{#if process.browser}
<Repl
bind:this={repl}
workersUrl="workers"
fixed={mobile}
{svelteUrl}
{rollupUrl}

@ -18,15 +18,16 @@
a {
height: 40px;
margin: 0 0.5em 0.5em 0;
display: flex;
align-items: center;
border: 2px solid var(--second);
padding: 5px 10px;
border-radius: 20px;
color: var(--text);
}
.add-yourself {
display: flex;
align-items: center;
border: 2px solid var(--second);
color: var(--prime);
}
img {
@ -52,7 +53,12 @@
<a target="_blank" rel="noopener" href="http://mustlab.ru"><img src="organisations/mustlab.png" alt="Mustlab logo"></a>
<a target="_blank" rel="noopener" href="https://www.nesta.org.uk"><img src="organisations/nesta.svg" alt="Nesta logo"></a>
<a target="_blank" rel="noopener" href="https://nytimes.com"><img src="organisations/nyt.svg" alt="The New York Times logo"></a>
<a target="_blank" rel="noopener" href="https://openstate.eu"><img src="organisations/open-state-foundation.svg" alt="Open State Foundation logo"></a>
<a target="_blank" rel="noopener" href="https://razorpay.com"><img src="organisations/razorpay.svg" alt="Razorpay logo"></a>
<a target="_blank" rel="noopener" href="https://sp.nl"><img src="organisations/socialist-party.svg" alt="Socialist Party logo"></a>
<a target="_blank" rel="noopener" href="https://www.stone.co"><img src="organisations/stone.svg" alt="Stone Payments logo"></a>
<a target="_blank" rel="noopener" href="https://www.strixengine.com"><img src="organisations/strixcloud.svg" alt="Strix Cloud logo"><span>Strix Cloud</span></a>
<a target="_blank" rel="noopener" href="https://thunderdome.dev"><img src="organisations/thunderdome.svg" alt="Thunderdome logo"></a>
<a target="_blank" rel="noopener" href="https://m.tokopedia.com"><img src="organisations/tokopedia.png" alt="Tokopedia logo"></a>
<a target="_blank" rel="noopener" href="https://github.com/sveltejs/svelte/blob/master/site/src/routes/_components/WhosUsingSvelte.svelte" class="add-yourself"><span>+ your company?</span></a>
</div>

@ -61,7 +61,7 @@
<p>Please try reloading the page.</p>
{/if}
<p>If the error persists, please drop by <a href="https://discord.gg/yy75DKs">Discord chatroom</a> and let us know, or raise an issue on <a href="https://github.com/sveltejs/svelte">GitHub</a>. Thanks!</p>
<p>If the error persists, please drop by <a href="chat">Discord chatroom</a> and let us know, or raise an issue on <a href="https://github.com/sveltejs/svelte">GitHub</a>. Thanks!</p>
{/if}
{:else}
<h1>It looks like you're offline</h1>

@ -24,7 +24,7 @@
<NavItem external="https://sapper.svelte.dev">Sapper</NavItem>
<NavItem external="https://discord.gg/yy75DKs" title="Discord Chat">
<NavItem external="chat" title="Discord Chat">
<Icon name="message-square"/>
</NavItem>

@ -0,0 +1,4 @@
export function get(req, res) {
res.writeHead(302, { Location: 'https://discord.gg/yy75DKs' });
res.end();
}

@ -39,6 +39,10 @@
let isLoading = false;
const cache = {};
function showExampleCodeOnChange() {
offset = 1;
}
$: title = title_by_slug[active_slug] || '';
$: first_slug = sections[0].examples[0].slug;
$: mobile = width < 768; // note: same as per media query below
@ -46,7 +50,7 @@
$: if (repl && active_slug) {
if (active_slug in cache) {
repl.set({ components: cache[active_slug] });
offset = 1;
showExampleCodeOnChange();
} else {
isLoading = true;
fetch(`examples/${active_slug}.json`)
@ -59,7 +63,7 @@
.then(components => {
cache[active_slug] = components;
repl.set({components});
offset = 1;
showExampleCodeOnChange();
isLoading = false;
})
.catch(() => {
@ -102,6 +106,7 @@
<div class="repl-container" class:loading={isLoading}>
<Repl
bind:this={repl}
workersUrl="workers"
{svelteUrl}
{rollupUrl}
orientation={replOrientation}

@ -0,0 +1,4 @@
export function get(req, res) {
res.writeHead(302, { Location: 'https://github.com/sveltejs/svelte/wiki/FAQ' });
res.end();
}

@ -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
</pre>
<p style="flex: 1">See the <a href="blog/the-easiest-way-to-get-started">quickstart guide</a> for more information.</p>

@ -206,6 +206,7 @@
<div class="viewport" class:offset={checked}>
<Repl
bind:this={repl}
workersUrl="workers"
{svelteUrl}
{rollupUrl}
{relaxed}

@ -1,12 +1,13 @@
import { createReadStream } from 'fs';
export function get(req, res) {
if (process.env.NODE_ENV !== 'development' || !/^[a-z.]+$/.test(req.params.file)) {
const path = req.params.file.join('/');
if (process.env.NODE_ENV !== 'development' || ('/' + path).includes('/.')) {
res.writeHead(403);
res.end();
return;
}
createReadStream('../' + req.params.file)
createReadStream('../' + path)
.on('error', () => {
res.writeHead(403);
res.end();

@ -302,6 +302,7 @@
<div class="tutorial-repl">
<Repl
bind:this={repl}
workersUrl="workers"
{svelteUrl}
{rollupUrl}
orientation={mobile ? 'columns' : 'rows'}

@ -2,11 +2,12 @@ import sirv from 'sirv';
import * as sapper from '@sapper/server';
import { API } from './backend/auth';
const { PORT=3000 } = process.env;
const { PORT = 3000 } = process.env;
API()
.use(
sirv('static', {
dev: process.env.NODE_ENV === 'development',
setHeaders(res) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.hasHeader('Cache-Control') || res.setHeader('Cache-Control', 'max-age=600'); // 10min default

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.1 KiB

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg width="136.5" height="76.6" version="1.1" viewBox="0 0 136.5 76.599998" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-20.6,-7)" fill="#ec1b23"><path d="m36.4 57.2v5.2c0 4.2 1.4 7.9 6.8 7.9 4 0 5.7-3.6 5.7-7.3 0-6.1-5.1-8.5-9.5-11.2-5.3-3-9.7-5.8-12.9-9.5-3.1-3.7-5-8.2-5-14.6 0-13.7 8.3-20.7 21.5-20.7 14.9 0 22.5 9.9 21.7 23.7h-15.8c-0.2-4.3 0-10.1-5.6-10.5-3.5-0.3-5.5 1.7-5.9 4.9-0.5 4.4 1.8 6.6 5.2 9 6.4 4.1 12 6.6 16 10.3s6.3 8.6 6.3 17.4c0 14-7.8 21.8-22 21.8-15.7 0-22.3-8.8-22.3-18.4v-7.8h15.8z"/><path d="m72.8 81.6v-73h20.3c6.6 0 16.2 0.6 20.9 6 4 4.5 4.8 9.9 4.8 15.9 0 7.9-1.8 16.7-9.6 20.3-5.9 2.9-12.8 2-19.3 2.3v28.4h-17.1zm17.1-41.5c3.2-0.1 6.9 0.3 9.6-1.8 1.8-1.9 2.1-4.9 2.1-7.4 0-2.8-0.3-7.1-3.2-8.5-1.7-0.6-4-0.6-6.7-0.6h-1.8z"/><path d="m152.1 54.5c-2.2-2.2-4.8-3.3-7.7-3.3-2.5 0-4.2 0.8-5.3 1.4-0.2 0.1-0.2 0.3-0.2 0.5l0.7 2c0.1 0.2 0.2 0.3 0.4 0.3h4.3c0.2 0 0.3 0.1 0.4 0.3s0 0.3-0.1 0.4l-3.4 2.5c-0.1 0.1-0.2 0.3-0.1 0.4l1.3 4.1c0.1 0.2 0 0.3-0.1 0.4s-0.3 0.1-0.4 0l-3.9-2.5c-0.1-0.1-0.3-0.1-0.4 0l-3.5 2.5c-0.1 0.1-0.3 0.1-0.4 0s-0.2-0.3-0.1-0.4l1.3-4.1c0.1-0.2 0-0.3-0.1-0.4l-3.4-2.5c-0.1-0.1-0.2-0.3-0.1-0.4 0.1-0.2 0.2-0.3 0.4-0.3h4.3c0.2 0 0.3-0.1 0.4-0.3l0.7-2c0.1-0.2 0-0.4-0.2-0.5-1.1-0.6-2.8-1.4-5.3-1.4-2.9 0-5.6 1.1-7.7 3.3-2.9 2.9-4.6 7.3-4.6 11.9 0 9.4 8.5 17 18.9 17s18.9-7.6 18.9-17c-0.4-4.6-2.1-9.1-5-11.9z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,244 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="77.812546"
height="65.824883"
version="1.1"
viewBox="0 0 20.587969 17.416218"
id="svg3851"
sodipodi:docname="strix-logo-web.svg"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
<metadata
id="metadata3855">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1373"
id="namedview3853"
showgrid="false"
inkscape:zoom="12.474013"
inkscape:cx="9.5353719"
inkscape:cy="29.397461"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="g3849"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<defs
id="defs3783">
<linearGradient
id="SVGID_1_"
x1="675.27002"
x2="707.73999"
y1="88.300003"
y2="88.300003"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.26458,0,0,0.26458,-179.34646,261.28646)">
<stop
stop-color="#565756"
offset="0"
id="stop3778"
style="stop-color:#ff4081;stop-opacity:0.94117647" />
<stop
stop-color="#131313"
offset="1"
id="stop3780" />
</linearGradient>
<linearGradient
id="2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.71308228,0,0,0.71691205,-280.60594,-94.816757)"
x1="396.64001"
y1="546.10999"
x2="394.41"
y2="538.60999">
<stop
stop-color="#b7d7e1"
id="stop5184" />
<stop
offset="1"
stop-color="#fff"
id="stop5186" />
</linearGradient>
<linearGradient
id="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.45111156,0,0,0.45353436,-179.31551,50.009071)"
x1="393.82999"
y1="549.46002"
x2="390.45001"
y2="542.88">
<stop
stop-color="#c3e6ee"
id="stop5179" />
<stop
offset="1"
stop-color="#fff"
id="stop5181" />
</linearGradient>
<linearGradient
id="0"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.59937345,0,0,0.60259335,245.86106,-30.678204)"
x1="393.82999"
y1="549.46002"
x2="395.79001"
y2="542.83002">
<stop
stop-color="#c8e1e8"
id="stop5174" />
<stop
offset="1"
stop-color="#fff"
id="stop5176" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#SVGID_1_"
id="linearGradient5276"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.26458,0,0,0.26458,-179.34646,261.28646)"
x1="675.27002"
y1="88.300003"
x2="707.73999"
y2="88.300003" />
</defs>
<g
transform="translate(5.7515037,-283.32597)"
id="g3849">
<path
id="path5191"
d="m -1.1904367,292.97168 c -0.299931,-0.23541 -0.6770741,-0.37577 -1.0861321,-0.37577 -0.96362,0 -1.7477619,0.77728 -1.7724709,1.7457 -0.994505,0.37715 -1.702464,1.34763 -1.702464,2.48489 0,1.34386 0.987985,2.45401 2.2693799,2.62937 v 0.024 H 5.595054 v -0.004 c 1.265609,-0.0741 2.2693798,-1.13555 2.2693798,-2.4341 0,-1.25223 -0.9334208,-2.2838 -2.1352008,-2.42278 0.0048,-0.0762 0.0076,-0.1534 0.0076,-0.23095 0,-1.94063 -1.6194168,-3.51372 -3.6166637,-3.51372 -1.47837401,0 -2.74878801,0.86205 -3.310556,2.09677"
inkscape:connector-curvature="0"
style="fill:url(#2);stroke-width:0.34316954" />
<g
id="g5271"
transform="translate(0.795721,0.02191)">
<polygon
transform="matrix(0.26458,0,0,0.26458,-179.32,261.26)"
class="st9"
points="671.3,126.2 671.8,120.3 674.2,125.4 673.7,131.3 "
id="polygon3805"
style="fill:#567b03" />
<polygon
transform="matrix(0.26458,0,0,0.26458,-179.32,261.26)"
class="st10"
points="671.3,126.2 671.8,120.3 674.2,125.4 673.7,131.3 "
id="polygon3807"
style="fill:#231815" />
<g
transform="matrix(0.26458,0,0,0.26458,-179.32,261.26)"
class="st11"
id="g3813"
style="enable-background:new">
<path
class="st9"
d="m 670.8,127.3 -2.4,-5.1 c 0.3,-1.9 6.9,-37.6 6.8,-37.9 l 2.4,5.1 c 0.2,0.4 -6.4,36.1 -6.8,37.9"
id="path3809"
inkscape:connector-curvature="0"
style="fill:#567b03" />
<path
class="st10"
d="m 670.8,127.3 -2.4,-5.1 c 0.3,-1.9 6.9,-37.6 6.8,-37.9 l 2.4,5.1 c 0.2,0.4 -6.4,36.1 -6.8,37.9"
id="path3811"
inkscape:connector-curvature="0"
style="fill:#580024;fill-opacity:0.94117647" />
</g>
<path
sodipodi:nodetypes="ccccccccccc"
class="st12"
d="m 9.695952,294.54416 -0.899572,-0.44978 0.13229,1.56102 c -1.45519,0.13229 -5.000562,0.52916 -5.000562,1.95789 0,-1.42873 -3.545372,-1.58748 -5.000562,-1.61394 l 0.13229,-1.56102 -0.899572,0.52916 c 0.079374,-0.5027 1.82185242,-9.98946 1.79539442,-10.06883 0.52916,0.92603 2.72892358,1.12603 3.97244958,1.07311 1.243526,-0.0529 3.43954,-0.34395 3.9687,-1.29644 0,0.0794 1.71977,9.39259 1.799144,9.86883 z"
id="path3815"
inkscape:connector-curvature="0"
style="fill:#ff4081;fill-opacity:1;stroke-width:0.26458001" />
<path
class="st13"
d="m -0.040592,284.93991 -0.634992,-1.34936 c 0.52916,0.92603 2.725174,1.08478 3.9687,1.03187 1.243526,-0.0529 3.43954,-0.34396 3.9687,-1.29645 l 0.634992,1.34936 c -0.52916,0.97895 -2.725174,1.26999 -3.9687,1.29644 -1.243526,0.0529 -3.43954,-0.10583 -3.9687,-1.03186 z"
id="path3817"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient5276);stroke-width:0.26458001" />
<path
class="st6"
d="m 5.727252,286.8978 c -1.005404,0 -1.825602,0.8202 -1.825602,1.8256 0,-1.0054 -0.820198,-1.8256 -1.799144,-1.8256 -0.978946,0 -1.799144,0.8202 -1.799144,1.8256 0,1.00541 0.820198,1.82561 1.799144,1.82561 0.502702,0 0.952488,-0.21167 1.296442,-0.52916 l 0.52916,1.69331 0.52916,-1.69331 c 0.317496,0.34395 0.79374,0.52916 1.296442,0.52916 1.005404,0 1.825602,-0.8202 1.825602,-1.82561 -0.026458,-1.03186 -0.846656,-1.8256 -1.85206,-1.8256 z"
id="path3829"
inkscape:connector-curvature="0"
style="fill:#ffffff;stroke-width:0.26458001" />
<g
transform="matrix(0.26458,0,0,0.26458,-179.32,261.26)"
id="g3835"
style="fill:#231815">
<circle
class="st10"
cx="699.40002"
cy="103.7"
r="4.0999999"
id="circle3831" />
<circle
class="st10"
cx="685.70001"
cy="103.7"
r="4.0999999"
id="circle3833" />
</g>
<g
transform="matrix(0.26458,0,0,0.26458,-179.32,261.26)"
id="g3841"
style="fill:#ffffff">
<path
class="st6"
d="m 699.7,122.7 -3.3,3.3 -3.3,-3.3 c -0.2,-0.2 -0.6,-0.2 -0.8,0 l -3.3,3.3 -3.3,-3.3 c -0.2,-0.2 -0.6,-0.2 -0.8,0 -0.2,0.2 -0.2,0.6 0,0.8 l 3.7,3.7 c 0.2,0.2 0.6,0.2 0.8,0 l 3.3,-3.3 3.3,3.3 c 0.1,0.1 0.3,0.2 0.4,0.2 0.2,0 0.3,-0.1 0.4,-0.2 l 3.7,-3.7 c 0.2,-0.2 0.2,-0.6 0,-0.8 -0.2,-0.2 -0.6,-0.2 -0.8,0 z"
id="path3837"
inkscape:connector-curvature="0" />
<path
class="st6"
d="m 704.2,116.4 c -0.2,-0.2 -0.6,-0.2 -0.8,0 l -3.3,3.3 -3.3,-3.3 c -0.2,-0.2 -0.6,-0.2 -0.8,0 l -3.3,3.3 -3.3,-3.3 c -0.2,-0.2 -0.6,-0.2 -0.8,0 l -3.3,3.3 -3.3,-3.3 c -0.2,-0.2 -0.6,-0.2 -0.8,0 -0.2,0.2 -0.2,0.6 0,0.8 l 3.7,3.7 c 0.2,0.2 0.6,0.2 0.8,0 l 3.3,-3.3 3.3,3.3 c 0.1,0.1 0.3,0.2 0.4,0.2 0.2,0 0.3,-0.1 0.4,-0.2 l 3.3,-3.3 3.3,3.3 c 0.2,0.2 0.6,0.2 0.8,0 l 3.7,-3.7 c 0.2,-0.2 0.2,-0.5 0,-0.8 z"
id="path3839"
inkscape:connector-curvature="0" />
</g>
<circle
class="st16"
cx="5.7272587"
cy="288.69696"
r="1.5874799"
id="circle3843"
style="fill:none;stroke-width:0.26458001" />
</g>
<path
id="path5193"
d="m -2.5511142,295.33257 c -0.189742,-0.14893 -0.428331,-0.23772 -0.68711,-0.23772 -0.6096081,0 -1.105673,0.49172 -1.121304,1.10437 -0.629146,0.23859 -1.077017,0.85253 -1.077017,1.57199 0,0.85015 0.625021,1.55246 1.4356599,1.6634 v 0.0152 h 5.7424231 v -0.003 c 0.800652,-0.0469 1.435659,-0.71837 1.435659,-1.53986 0,-0.79219 -0.590502,-1.44478 -1.350775,-1.53271 0.003,-0.0482 0.0048,-0.097 0.0048,-0.1461 0,-1.22768 -1.024479,-2.22285 -2.28798204,-2.22285 -0.93525196,0 -1.73894386,0.54534 -2.09433096,1.32646"
inkscape:connector-curvature="0"
style="fill:url(#1);stroke-width:0.21709661" />
<path
id="path5195"
d="m 11.002773,295.27147 c 0.252287,-0.1981 0.570045,-0.31578 0.912918,-0.31578 0.809914,0 1.468852,0.6533 1.489735,1.46744 0.836159,0.3172 1.431037,1.13163 1.431037,2.08885 0,1.1288 -0.830233,2.06288 -1.907391,2.20991 v 0.0203 H 5.298379 v -0.004 c -1.063895,-0.0624 -1.907391,-0.9544 -1.907391,-2.04595 0,-1.05261 0.784516,-1.91953 1.794793,-2.03608 -0.0042,-0.0641 -0.0065,-0.12896 -0.0065,-0.19415 0,-1.63112 1.361052,-2.95351 3.040143,-2.95351 1.2428086,0 2.311219,0.72441 2.782776,1.76234"
inkscape:connector-curvature="0"
style="fill:url(#0);stroke-width:0.28220019" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg1459"
version="1.1"
viewBox="0 0 274.77133 60.298889"
height="60.298889mm"
width="274.77133mm">
<defs
id="defs1453" />
<metadata
id="metadata1456">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-42.531001,-116.41603)"
id="layer1">
<g
transform="translate(93.750421,-1.9345242)"
id="g997">
<g
id="g958"
transform="matrix(0.45367544,0,0,0.45367544,-70.17869,66.227085)">
<path
d="m 178.30147,211.4295 c 0,0 -41.87399,-81.14294 -120.817617,-67.37697 m -5.94379,67.68201 c 0,0 45.783,-83.2982 122.198207,-66.72283 m -58.28473,-25.96854 v 124.35097 m 45.89507,-84.33553 a 46.124953,39.331358 0 0 1 -46.12495,39.33136 46.124953,39.331358 0 0 1 -46.124947,-39.33136 46.124953,39.331358 0 0 1 46.124947,-39.33135 46.124953,39.331358 0 0 1 46.12495,39.33135 z m 26.30592,22.47508 a 72.482072,61.806418 0 0 1 -72.48207,61.80641 72.482072,61.806418 0 0 1 -72.482077,-61.80641 72.482072,61.806418 0 0 1 72.482077,-61.80643 72.482072,61.806418 0 0 1 72.48207,61.80643 z"
style="fill:none;stroke:#646464;stroke-width:1.80000019;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4645-2-8" />
<circle
r="3.9503546"
cy="198.46136"
cx="115.33445"
id="path4563-1-1-5-2"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="179.61028"
cx="154.28223"
id="path4563-1-1-4-0-7"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="211.14809"
cx="178.06921"
id="path4563-1-1-40-7-8"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="242.95314"
cx="115.79539"
id="path4563-1-1-8-5-8"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="211.14809"
cx="52.719795"
id="path4563-1-1-85-6-5"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="142.72708"
cx="157.48947"
id="path4563-1-1-6-5-4"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="151.54697"
cx="115.2609"
id="path4563-1-1-7-4-9"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="119.7419"
cx="115.2609"
id="path4563-1-1-3-7-6"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="142.19254"
cx="73.834099"
id="path4563-1-1-2-7-6"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="3.9503546"
cy="178.80847"
cx="76.506798"
id="path4563-1-1-34-5-3"
style="opacity:1;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:1.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
aria-label="THUNDERDOME"
transform="matrix(0.22880747,0,0,0.22880747,0.22823691,-38.584587)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="flowRoot4650-39-9">
<path
d="m 99.216,745.60469 -7.296,25.92 h 18.624 v 113.28 h 28.416 v -113.28 h 18.624 l -6.912,-25.92 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4889-2" />
<path
d="m 237.135,745.60469 h -28.416 v 59.52 h -15.168 v -59.52 h -28.416 v 139.2 h 28.416 v -55.68 h 15.168 v 55.68 h 28.416 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4891-4" />
<path
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:2.68477941;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m -814.90625,747.83984 v 0.0137 h -15.81836 v 97.19726 c 0,12.68484 4.7555,17.75977 17.91602,17.75977 h 23.62695 c 13.16052,0 17.91601,-5.07493 17.91602,-17.75977 v -97.19726 h -16.49805 v -0.0137 l -11.50586,40.55664 h 19.56055 l -29.33985,55.51563 7.76758,-41.70899 h -16.9707 l 14.60742,-54.36328 z"
transform="matrix(1.2108945,0,0,1.2108945,1254.6805,-159.96715)"
id="path4893-9" />
<path
d="m 332.385,884.80469 h 25.728 v -58.176 l 14.976,58.176 h 28.608 v -139.2 h -28.608 v 55.872 l -14.208,-55.872 h -26.496 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4895-2" />
<path
d="m 454.281,769.98869 c 1.92,0 2.496,0.96 2.496,2.688 v 84.864 c 0,2.112 -0.384,2.88 -2.688,2.88 h -13.056 v -90.432 z m 30.144,-7.488 c 0,-10.176 -5.568,-16.896 -16.512,-16.896 h -54.528 v 139.2 h 49.344 c 15.936,0 21.696,-6.144 21.696,-21.504 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4897-8" />
<path
d="m 495.885,884.80469 h 52.992 l 4.8,-25.92 h -29.184 v -30.336 h 23.04 v -24 h -23.04 v -33.024 h 30.336 l -4.8,-25.92 h -54.144 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4899-5" />
<path
d="m 605.982,769.98869 c 1.92,0 2.688,1.152 2.688,2.88 v 42.24 c 0,2.112 -0.576,2.88 -2.688,2.88 H 592.35 v -48 z m 30.144,-6.336 c 0,-10.944 -5.76,-18.048 -18.816,-18.048 h -52.8 v 139.2 h 27.84 v -44.352 h 3.648 l 13.44,44.352 h 28.8 l -14.592,-44.352 c 8.064,0 12.48,-6.144 12.48,-12.288 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4901-1" />
<path
d="m 689.031,769.98869 c 1.92,0 2.496,0.96 2.496,2.688 v 84.864 c 0,2.112 -0.384,2.88 -2.688,2.88 h -13.056 v -90.432 z m 30.144,-7.488 c 0,-10.176 -5.568,-16.896 -16.512,-16.896 h -54.528 v 139.2 h 49.344 c 15.936,0 21.696,-6.144 21.696,-21.504 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4903-4" />
<path
d="m 772.107,769.98869 c 1.92,0 2.496,0.96 2.496,2.688 v 84.864 c 0,2.112 -0.384,2.88 -2.688,2.88 h -10.56 c -2.304,0 -2.688,-0.768 -2.688,-2.88 v -84.864 c 0,-1.728 0.576,-2.688 2.496,-2.688 z m 30.72,-6.336 c 0,-10.944 -5.76,-18.048 -18.816,-18.048 h -34.56 c -13.056,0 -18.816,7.104 -18.816,18.048 v 101.376 c 0,10.56 4.416,19.776 19.968,19.776 h 32.256 c 15.552,0 19.968,-9.216 19.968,-19.776 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4905-7" />
<path
d="m 858.804,874.82069 17.664,-55.68 v 65.664 h 27.072 v -139.2 h -29.568 l -15.168,58.752 -15.168,-58.752 H 814.26 v 139.2 h 27.072 v -65.664 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4907-8" />
<path
d="m 915.135,884.80469 h 52.992 l 4.8,-25.92 h -29.184 v -30.336 h 23.04 v -24 h -23.04 v -33.024 h 30.336 l -4.8,-25.92 h -54.144 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;font-family:'American Captain';-inkscape-font-specification:'American Captain';fill:#ffdd57;fill-opacity:1;stroke:#646464;stroke-width:3.25098467;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4909-9" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@ -1,3 +0,0 @@
import Tag from './shared/Tag';
export default class MustacheTag extends Tag {}

@ -1,3 +0,0 @@
import Tag from './shared/Tag';
export default class RawMustacheTag extends Tag {}

@ -1,8 +0,0 @@
import Renderer from '../Renderer';
import { CompileOptions } from '../../../interfaces';
export default function(node, renderer: Renderer, options: CompileOptions) {
if (options.preserveComments) {
renderer.append(`<!--${node.data}-->`);
}
}

@ -1,7 +0,0 @@
export default function(node, renderer, options) {
renderer.append('${($$result.head += `');
renderer.render(node.children, options);
renderer.append('`, "")}');
}

@ -1,5 +0,0 @@
import { snip } from '../../utils/snip';
export default function(node, renderer, options) {
renderer.append('${' + snip(node.expression) + '}');
}

@ -1,7 +0,0 @@
export default function(node, renderer, options) {
renderer.append(`<title>`);
renderer.render(node.children, options);
renderer.append(`</title>`);
}

@ -1,5 +0,0 @@
export default function add_to_set(a: Set<any>, b: Set<any>) {
b.forEach(item => {
a.add(item);
});
}

@ -5,7 +5,7 @@ const now = (typeof process !== 'undefined' && process.hrtime)
}
: () => self.performance.now();
type Timing = {
interface Timing {
label: string;
start: number;
end: number;

@ -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,14 +22,15 @@ 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 = {
interface ComponentOptions {
namespace?: string;
tag?: string;
immutable?: boolean;
accessors?: boolean;
preserveWhitespace?: boolean;
};
}
// We need to tell estree-walker that it should always
// look for an `else` block, otherwise it might get
@ -95,7 +97,7 @@ export default class Component {
node_for_declaration: Map<string, Node> = new Map();
partly_hoisted: string[] = [];
fully_hoisted: string[] = [];
reactive_declarations: Array<{ assignees: Set<string>, dependencies: Set<string>, node: Node, declaration: Node }> = [];
reactive_declarations: Array<{ assignees: Set<string>; dependencies: Set<string>; node: Node; declaration: Node }> = [];
reactive_declaration_nodes: Set<Node> = new Set();
has_reactive_assignments = false;
injected_reactive_declaration_vars: Set<string> = new Set();
@ -104,12 +106,12 @@ export default class Component {
indirect_dependencies: Map<string, Set<string>> = new Map();
file: string;
locate: (c: number) => { line: number, column: number };
locate: (c: number) => { line: number; column: number };
// TODO this does the same as component.locate! remove one or the other
locator: (search: number, startIndex?: number) => {
line: number,
column: number
line: number;
column: number;
};
stylesheet: Stylesheet;
@ -138,6 +140,7 @@ export default class Component {
this.compile_options = compile_options;
this.file = compile_options.filename && (
// eslint-disable-next-line no-useless-escape
typeof process !== 'undefined' ? compile_options.filename.replace(process.cwd(), '').replace(/^[\/\\]/, '') : compile_options.filename
);
this.locate = getLocator(this.source);
@ -152,10 +155,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 <svelte:options>`);
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. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>`
});
}
this.tag = this.component_options.tag || compile_options.tag;
} else {
this.tag = this.name;
}
@ -242,7 +249,7 @@ export default class Component {
result = result
.replace(/__svelte:self__/g, this.name)
.replace(compile_options.generate === 'ssr' ? /(@+|#+)(\w*(?:-\w*)?)/g : /(@+)(\w*(?:-\w*)?)/g, (match: string, sigil: string, name: string) => {
.replace(compile_options.generate === 'ssr' ? /(@+|#+)(\w*(?:-\w*)?)/g : /(@+)(\w*(?:-\w*)?)/g, (_match: string, sigil: string, name: string) => {
if (sigil === '@') {
if (internal_exports.has(name)) {
if (compile_options.dev && internal_exports.has(`${name}Dev`)) name = `${name}Dev`;
@ -373,7 +380,7 @@ export default class Component {
reserved.forEach(add);
internal_exports.forEach(add);
this.var_lookup.forEach((value, key) => add(key));
this.var_lookup.forEach((_value, key) => add(key));
return (name: string) => {
if (test) name = `${name}$`;
@ -392,12 +399,12 @@ export default class Component {
error(
pos: {
start: number,
end: number
start: number;
end: number;
},
e : {
code: string,
message: string
e: {
code: string;
message: string;
}
) {
error(e.message, {
@ -412,12 +419,12 @@ export default class Component {
warn(
pos: {
start: number,
end: number
start: number;
end: number;
},
warning: {
code: string,
message: string
code: string;
message: string;
}
) {
if (!this.locator) {
@ -521,7 +528,7 @@ export default class Component {
let result = '';
script.content.body.forEach((node, i) => {
script.content.body.forEach((node) => {
if (this.hoistable_nodes.has(node) || this.reactive_declaration_nodes.has(node)) {
if (a !== b) result += `[✂${a}-${b}✂]`;
a = node.end;
@ -558,7 +565,7 @@ export default class Component {
this.add_sourcemap_locations(script.content);
let { scope, globals } = create_scopes(script.content);
const { scope, globals } = create_scopes(script.content);
this.module_scope = scope;
scope.declarations.forEach((node, name) => {
@ -582,7 +589,7 @@ export default class Component {
this.error(node, {
code: 'illegal-subscription',
message: `Cannot reference store value inside <script context="module">`
})
});
} else {
this.add_var({
name,
@ -618,7 +625,7 @@ export default class Component {
});
});
let { scope: instance_scope, map, globals } = create_scopes(script.content);
const { scope: instance_scope, map, globals } = create_scopes(script.content);
this.instance_scope = instance_scope;
this.instance_scope_map = map;
@ -640,7 +647,7 @@ export default class Component {
this.node_for_declaration.set(name, node);
});
globals.forEach((node, name) => {
globals.forEach((_node, name) => {
if (this.var_lookup.has(name)) return;
if (this.injected_reactive_declaration_vars.has(name)) {
@ -699,7 +706,7 @@ export default class Component {
let scope = instance_scope;
walk(this.ast.instance.content, {
enter(node, parent) {
enter(node) {
if (map.has(node)) {
scope = map.get(node);
}
@ -732,7 +739,7 @@ export default class Component {
scope = scope.parent;
}
}
})
});
}
extract_reactive_store_references() {
@ -754,12 +761,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 +779,7 @@ export default class Component {
});
}
invalidate(name, value) {
invalidate(name, value?) {
const variable = this.var_lookup.get(name);
if (variable && (variable.subscribable && variable.reassigned)) {
@ -780,7 +787,11 @@ export default class Component {
}
if (name[0] === '$' && name[1] !== '$') {
return `${name.slice(1)}.set(${name})`
return `${name.slice(1)}.set(${name})`;
}
if (variable && !variable.referenced && !variable.is_reactive_dependency && !variable.export_name && !name.startsWith('$$')) {
return value || name;
}
if (value) {
@ -878,13 +889,13 @@ export default class Component {
}
if (variable.writable && variable.name !== variable.export_name) {
code.prependRight(declarator.id.start, `${variable.export_name}: `)
code.prependRight(declarator.id.start, `${variable.export_name}: `);
}
if (next) {
const next_variable = component.var_lookup.get(next.id.name)
const next_variable = component.var_lookup.get(next.id.name);
const new_declaration = !next_variable.export_name
|| (current_group.insert && next_variable.subscribable)
|| (current_group.insert && next_variable.subscribable);
if (new_declaration) {
code.overwrite(declarator.end, next.start, ` ${node.kind} `);
@ -894,7 +905,7 @@ export default class Component {
current_group = null;
if (variable.subscribable) {
let insert = get_insert(variable);
const insert = get_insert(variable);
if (next) {
code.overwrite(declarator.end, next.start, `; ${insert}; ${node.kind} `);
@ -955,7 +966,7 @@ export default class Component {
// reference instance variables other than other
// hoistable functions. TODO others?
const { hoistable_nodes, var_lookup } = this;
const { hoistable_nodes, var_lookup, injected_reactive_declaration_vars } = this;
const top_level_function_declarations = new Map();
@ -965,9 +976,9 @@ export default class Component {
if (!d.init) return false;
if (d.init.type !== 'Literal') return false;
const v = this.var_lookup.get(d.id.name)
if (v.reassigned) return false
if (v.export_name) return false
const v = this.var_lookup.get(d.id.name);
if (v.reassigned) return false;
if (v.export_name) return false;
if (this.var_lookup.get(d.id.name).reassigned) return false;
if (this.vars.find(variable => variable.name === d.id.name && variable.module)) return false;
@ -996,7 +1007,7 @@ export default class Component {
});
const checked = new Set();
let walking = new Set();
const walking = new Set();
const is_hoistable = fn_declaration => {
if (fn_declaration.type === 'ExportNamedDeclaration') {
@ -1005,7 +1016,7 @@ export default class Component {
const instance_scope = this.instance_scope;
let scope = this.instance_scope;
let map = this.instance_scope_map;
const map = this.instance_scope_map;
let hoistable = true;
@ -1018,15 +1029,15 @@ 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);
if (name[0] === '$' && !owner) {
if (node.type === 'Identifier' && injected_reactive_declaration_vars.has(name)) {
hoistable = false;
}
else if (owner === instance_scope) {
} else if (name[0] === '$' && !owner) {
hoistable = false;
} else if (owner === instance_scope) {
if (name === fn_declaration.id.name) return;
const variable = var_lookup.get(name);
@ -1041,7 +1052,7 @@ export default class Component {
hoistable = false;
} else if (!is_hoistable(other_declaration)) {
hoistable = false;
}
}
}
else {
@ -1093,7 +1104,7 @@ export default class Component {
const dependencies = new Set();
let scope = this.instance_scope;
let map = this.instance_scope_map;
const map = this.instance_scope_map;
walk(node.body, {
enter(node, parent) {
@ -1109,14 +1120,17 @@ 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 variable = component.var_lookup.get(name);
if (variable) variable.is_reactive_dependency = true;
const is_writable_or_mutated = variable && (variable.writable || variable.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 +1216,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 +1279,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`
@ -1309,14 +1321,16 @@ function process_component_options(component: Component, nodes) {
case 'accessors':
case 'immutable':
case 'preserveWhitespace':
{
const code = `invalid-${name}-value`;
const message = `${name} attribute must be true or false`
const message = `${name} attribute must be true or false`;
const value = get_value(attribute, code, message);
if (typeof value !== 'boolean') component.error(attribute, { code, message });
component_options[name] = value;
break;
}
default:
component.error(attribute, {

@ -5,10 +5,10 @@ import { stringify_props } from './utils/stringify_props';
const wrappers = { esm, cjs };
type Export = {
interface Export {
name: string;
as: string;
};
}
export default function create_module(
code: string,
@ -16,7 +16,7 @@ export default function create_module(
name: string,
banner: string,
sveltePath = 'svelte',
helpers: { name: string, alias: string }[],
helpers: Array<{ name: string; alias: string }>,
imports: Node[],
module_exports: Export[],
source: string
@ -44,7 +44,7 @@ function esm(
banner: string,
sveltePath: string,
internal_path: string,
helpers: { name: string, alias: string }[],
helpers: Array<{ name: string; alias: string }>,
imports: Node[],
module_exports: Export[],
source: string
@ -84,7 +84,7 @@ function cjs(
banner: string,
sveltePath: string,
internal_path: string,
helpers: { name: string, alias: string }[],
helpers: Array<{ name: string; alias: string }>,
imports: Node[],
module_exports: Export[]
) {
@ -115,7 +115,7 @@ function cjs(
const source = edit_source(node.source.value, sveltePath);
return `const ${lhs} = require("${source}");`
return `const ${lhs} = require("${source}");`;
});
const exports = [`exports.default = ${name};`].concat(
@ -131,5 +131,5 @@ function cjs(
${code}
${exports}`
${exports}`;
}

@ -73,7 +73,7 @@ export default class Selector {
}
}
this.blocks.forEach((block, i) => {
this.blocks.forEach((block) => {
if (block.global) {
const selector = block.selectors[0];
const first = selector.children[0];
@ -238,8 +238,8 @@ function attribute_matches(node: Node, name: string, expected_value: string, ope
}
function class_matches(node, name: string) {
return node.classes.some(function(class_directive) {
return class_directive.name === name;
return node.classes.some((class_directive) => {
return new RegExp(`\\b${name}\\b`).test(class_directive.name);
});
}
@ -287,7 +287,7 @@ function group_selectors(selector: Node) {
const blocks = [block];
selector.children.forEach((child: Node, i: number) => {
selector.children.forEach((child: Node) => {
if (child.type === 'WhiteSpace' || child.type === 'Combinator') {
block = new Block(child);
blocks.push(block);

@ -43,11 +43,11 @@ class Rule {
return this.selectors.some(s => s.used);
}
minify(code: MagicString, dev: boolean) {
minify(code: MagicString, _dev: boolean) {
let c = this.node.start;
let started = false;
this.selectors.forEach((selector, i) => {
this.selectors.forEach((selector) => {
if (selector.used) {
const separator = started ? ',' : '';
if ((selector.node.start - c) > separator.length) {
@ -140,7 +140,7 @@ class Declaration {
class Atrule {
node: Node;
children: (Atrule|Rule)[];
children: Array<Atrule|Rule>;
constructor(node: Node) {
this.node = node;
@ -163,7 +163,7 @@ class Atrule {
}
}
is_used(dev: boolean) {
is_used(_dev: boolean) {
return true; // TODO
}
@ -253,7 +253,7 @@ export default class Stylesheet {
has_styles: boolean;
id: string;
children: (Rule|Atrule)[] = [];
children: Array<Rule|Atrule> = [];
keyframes: Map<string, string> = new Map();
nodes_with_css_class: Set<Node> = new Set();
@ -269,7 +269,7 @@ export default class Stylesheet {
this.has_styles = true;
const stack: (Rule | Atrule)[] = [];
const stack: Array<Rule | Atrule> = [];
let current_atrule: Atrule = null;
walk(ast.css, {

@ -1,9 +1,9 @@
import { assign } from '../internal';
import { assign } from '../../runtime/internal/index';
import Stats from '../Stats';
import parse from '../parse/index';
import render_dom from './render-dom/index';
import render_ssr from './render-ssr/index';
import { CompileOptions, Ast, Warning } from '../interfaces';
import { CompileOptions, Warning } from '../interfaces';
import Component from './Component';
import fuzzymatch from '../utils/fuzzymatch';
@ -55,8 +55,9 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
}
}
function get_name(filename) {
function get_name(filename: string) {
if (!filename) return null;
// eslint-disable-next-line no-useless-escape
const parts = filename.split(/[\/\\]/);
if (parts.length > 1 && /^index\.\w+/.test(parts[parts.length - 1])) {
@ -79,12 +80,10 @@ export default function compile(source: string, options: CompileOptions = {}) {
const stats = new Stats();
const warnings = [];
let ast: Ast;
validate_options(options, warnings);
stats.start('parse');
ast = parse(source, options);
const ast = parse(source, options);
stats.stop('parse');
stats.start('create component');

@ -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);

@ -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);

@ -21,7 +21,7 @@ export default class Attribute extends Node {
is_synthetic: boolean;
should_cache: boolean;
expression?: Expression;
chunks: (Text | Expression)[];
chunks: Array<Text | Expression>;
dependencies: Set<string>;
constructor(component, parent, scope, info) {
@ -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
: '';
}
}

@ -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;

@ -3,13 +3,24 @@ import get_object from '../utils/get_object';
import Expression from './shared/Expression';
import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
import {dimensions} from "../../utils/patterns";
// TODO this should live in a specific binding
const read_only_media_attributes = new Set([
'duration',
'buffered',
'seekable',
'played'
]);
export default class Binding extends Node {
type: 'Binding';
name: string;
expression: Expression;
is_contextual: boolean;
obj: string;
prop: string;
is_readonly: boolean;
constructor(component: Component, parent, scope: TemplateScope, info) {
super(component, parent, scope, info);
@ -63,5 +74,17 @@ export default class Binding extends Node {
this.obj = obj;
this.prop = prop;
const type = parent.get_static_attribute_value('type');
this.is_readonly = (
dimensions.test(this.name) ||
(parent.is_media_node && parent.is_media_node() && read_only_media_attributes.has(this.name)) ||
(parent.name === 'input' && type === 'file') // TODO others?
);
}
is_readonly_media_attribute() {
return read_only_media_attributes.has(this.name);
}
}

@ -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) {

@ -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) {

@ -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) {
interface Context {
key: INode;
name?: string;
tail: string;
}
function unpack_destructuring(contexts: Context[], node: INode, tail: string) {
if (!node) return;
if (node.type === 'Identifier' || node.type === 'RestIdentifier') {
@ -18,7 +25,7 @@ function unpack_destructuring(contexts: Array<{ name: string, tail: string }>, n
} else if (node.type === 'ArrayPattern') {
node.elements.forEach((element, i) => {
if (element && element.type === 'RestIdentifier') {
unpack_destructuring(contexts, element, `${tail}.slice(${i})`)
unpack_destructuring(contexts, element, `${tail}.slice(${i})`);
} else {
unpack_destructuring(contexts, element, `${tail}[${i}]`);
}
@ -53,7 +60,7 @@ export default class EachBlock extends AbstractBlock {
context: string;
key: Expression;
scope: TemplateScope;
contexts: Array<{ name: string, tail: string }>;
contexts: Context[];
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`
});

@ -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)$/;
@ -53,7 +54,7 @@ const a11y_required_content = new Set([
'h4',
'h5',
'h6'
])
]);
const invisible_elements = new Set(['meta', 'html', 'script', 'style']);
@ -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:
// <option>{foo}</option>
// <option value={foo}>{foo}</option>
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({
@ -179,10 +180,12 @@ export default class Element extends Node {
break;
case 'Transition':
{
const transition = new Transition(component, this, scope, node);
if (node.intro) this.intro = transition;
if (node.outro) this.outro = transition;
break;
}
case 'Animation':
this.animation = new Animation(component, this, scope, node);
@ -228,7 +231,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 +256,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 +323,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 +364,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 +550,7 @@ export default class Element extends Node {
message: `'group' binding can only be used with <input type="checkbox"> or <input type="radio">`
});
}
} else if (name == 'files') {
} else if (name === 'files') {
if (this.name !== 'input') {
component.error(binding, {
code: `invalid-binding`,
@ -560,6 +566,14 @@ export default class Element extends Node {
message: `'files' binding can only be used with <input type="file">`
});
}
} else if (name === 'open') {
if (this.name !== 'details') {
component.error(binding, {
code: `invalid-binding`,
message: `'${name}' binding can only be used with <details>`
});
}
} else if (
name === 'currentTime' ||
name === 'duration' ||
@ -675,7 +689,7 @@ export default class Element extends Node {
if (class_attribute.chunks.length === 1 && class_attribute.chunks[0].type === 'Text') {
(class_attribute.chunks[0] as Text).data += ` ${class_name}`;
} else {
(<Node[]>class_attribute.chunks).push(
(class_attribute.chunks as Node[]).push(
new Text(this.component, this, this.scope, {
type: 'Text',
data: ` ${class_name}`

@ -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);

@ -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<string>;
expression: Expression;

@ -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) {

@ -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 {

@ -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;
@ -34,6 +36,7 @@ export default class InlineComponent extends Node {
: null;
info.attributes.forEach(node => {
/* eslint-disable no-fallthrough */
switch (node.type) {
case 'Action':
component.error(node, {
@ -80,6 +83,7 @@ export default class InlineComponent extends Node {
default:
throw new Error(`Not implemented: ${node.type}`);
}
/* eslint-enable no-fallthrough */
});
if (this.lets.length > 0) {

@ -0,0 +1,5 @@
import Tag from './shared/Tag';
export default class MustacheTag extends Tag {
type: 'MustacheTag';
}

@ -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);

@ -0,0 +1,5 @@
import Tag from './shared/Tag';
export default class RawMustacheTag extends Tag {
type: 'RawMustacheTag'
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save