diff --git a/.eslintignore b/.eslintignore
index 4a113378ce..97a855e951 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,7 +1,3 @@
-src/shared
-shared.js
-store.js
-test/test.js
-test/setup.js
**/_actual.js
-**/expected.js
\ No newline at end of file
+**/expected.js
+test/*/samples/*/output.js
diff --git a/.eslintrc.json b/.eslintrc.json
index 7e8c26382a..c821993c40 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -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"
+ }
+ }
+ ]
}
diff --git a/.flowconfig b/.flowconfig
index 2ed2b0c713..c1961b7a6b 100644
--- a/.flowconfig
+++ b/.flowconfig
@@ -1,5 +1,5 @@
[ignore]
-/dist/.*
+/types/.*
[include]
diff --git a/.gitignore b/.gitignore
index 06671edc2b..4d7bbc7ac3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/.travis.yml b/.travis.yml
index aeadd48f8d..a4603a26e2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,8 @@
language: node_js
node_js:
- - "node"
-
+ - "8"
+ - "10"
+ - "12"
env:
global:
- BUILD_TIMEOUT=20000
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a509bd0f47..766a1634e4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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 `` ([#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 `` ([#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 (` `) ([#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))
diff --git a/README.md b/README.md
index bcda0501ad..7d0af8ac2e 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,24 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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
```
diff --git a/animate.mjs b/animate.mjs
deleted file mode 100644
index f22fabe401..0000000000
--- a/animate.mjs
+++ /dev/null
@@ -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);`
- };
-}
\ No newline at end of file
diff --git a/compiler.d.ts b/compiler.d.ts
new file mode 100644
index 0000000000..e2a3820bc5
--- /dev/null
+++ b/compiler.d.ts
@@ -0,0 +1 @@
+export * from './types/compiler';
diff --git a/package-lock.json b/package-lock.json
index 7c7363db2e..f1e8bf1d32 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -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"
diff --git a/package.json b/package.json
index b9f70f547a..5004c27cfb 100644
--- a/package.json
+++ b/package.json
@@ -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": [
diff --git a/register.js b/register.js
index f5cbeb5063..3278c1cbf5 100644
--- a/register.js
+++ b/register.js
@@ -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, '');
@@ -46,4 +45,4 @@ function registerExtension(extension) {
registerExtension('.svelte');
registerExtension('.html');
-module.exports = register;
\ No newline at end of file
+module.exports = register;
diff --git a/rollup.config.js b/rollup.config.js
index f7b2d07d4b..8907ae4e6c 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -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`
- }))
+ }
];
diff --git a/scripts/create-stubs.js b/scripts/create-stubs.js
new file mode 100644
index 0000000000..191b86cbfd
--- /dev/null
+++ b/scripts/create-stubs.js
@@ -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';`);
+ });
\ No newline at end of file
diff --git a/site/Dockerfile b/site/Dockerfile
index f53e6a0c4a..c2a65122d9 100644
--- a/site/Dockerfile
+++ b/site/Dockerfile
@@ -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 .
diff --git a/site/README.md b/site/README.md
index c438bda5ca..59380feffc 100644
--- a/site/README.md
+++ b/site/README.md
@@ -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
diff --git a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md
index e91166430c..9d4c661615 100644
--- a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md
+++ b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md
@@ -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!
diff --git a/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md b/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md
index 040e95a8c3..8799fdacce 100644
--- a/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md
+++ b/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md
@@ -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).
diff --git a/site/content/blog/2018-04-18-version-2.md b/site/content/blog/2018-04-18-version-2.md
index 778d703b1d..900debc0fb 100644
--- a/site/content/blog/2018-04-18-version-2.md
+++ b/site/content/blog/2018-04-18-version-2.md
@@ -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).
diff --git a/site/content/blog/2019-01-31-svelte-on-the-changelog.md b/site/content/blog/2019-01-31-svelte-on-the-changelog.md
index 936c50240e..0b8e1894e4 100644
--- a/site/content/blog/2019-01-31-svelte-on-the-changelog.md
+++ b/site/content/blog/2019-01-31-svelte-on-the-changelog.md
@@ -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).
The Changelog 332: A UI framework without the framework – Listen on Changelog.com
-
diff --git a/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md b/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md
index 0721c09692..3ae0085e86 100644
--- a/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md
+++ b/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md
@@ -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.
\ No newline at end of file
+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.
\ No newline at end of file
diff --git a/site/content/docs/00-introduction.md b/site/content/docs/00-introduction.md
index c218cdfb5f..2456b85f9c 100644
--- a/site/content/docs/00-introduction.md
+++ b/site/content/docs/00-introduction.md
@@ -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.
diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md
index 356fa1170d..ddd2667075 100644
--- a/site/content/docs/01-component-format.md
+++ b/site/content/docs/01-component-format.md
@@ -47,11 +47,14 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
// Values that are passed in as props
// 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
+
+Click me!
+```
### 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
-
+ cart.empty()}>
Empty shopping cart
```
@@ -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
+
+{#each list as item, index (item)}
+ {item}
+{/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)}
+ {item}
+{/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
+
+
+{#each list as item, index (item)}
+ {item}
+{/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
+
+
+{#each list as item, index (item)}
+ {item}
+{/each}
+```
+
### Slots
@@ -1130,3 +1279,50 @@ The `` element provides a place to specify per-component compile
```html
```
+
+
+### @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
+
+
+{@debug user}
+
+Hello {user.firstname}!
+```
+
+---
+
+`{@debug ...}` accepts a comma-separated list of variable names (not arbitrary expressions).
+
+```html
+
+{@debug user}
+{@debug user1, user2, user3}
+
+
+{@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.
diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md
index dfb270dc97..6db20b5d14 100644
--- a/site/content/docs/03-run-time.md
+++ b/site/content/docs/03-run-time.md
@@ -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
+
+
+{#if condition}
+
+ fades in and out
+
+{/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
+
+
+{#if condition}
+
+ flies in and out
+
+{/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
+
+
+{#if condition}
+
+ slides in and out
+
+{/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
+
+
+{#if condition}
+
+ scales in and out
+
+{/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 `` and ``.
+
+`scale` accepts the following parameters:
+
+* `delay` (`number`, default 0) — milliseconds before starting
+* `speed` (`number`, default undefined) - the speed of the animation, see below.
+* `duration` (`number` | `function`, default 800) — milliseconds the transition lasts
+* `easing` (`function`, default `cubicInOut`) — an [easing function](docs#svelte_easing)
+
+The `speed` parameter is a means of setting the duration of the transition relative to the path's length. It is modifier that is applied to the length of the path: `duration = length / speed`. A path that is 1000 pixels with a speed of 1 will have a duration of `1000ms`, setting the speed to `0.5` will halve that duration and setting it to `2` will double it.
+
+```html
+
+
+
+ {#if condition}
+
+ {/if}
+
+
+```
+
+
+
+
-* fade, fly, slide, scale, draw
-* crossfade...
### `svelte/animate`
diff --git a/site/content/docs/04-compile-time.md b/site/content/docs/04-compile-time.md
index b019b9437b..c219bae497 100644
--- a/site/content/docs/04-compile-time.md
+++ b/site/content/docs/04-compile-time.md
@@ -308,8 +308,8 @@ const { code } = svelte.preprocess(source, [
```js
walk(ast: Node, {
- enter(node: Node, parent: Node)?: void,
- leave(node: Node, parent: Node)?: void
+ enter(node: Node, parent: Node, prop: string, index: number)?: void,
+ leave(node: Node, parent: Node, prop: string, index: number)?: void
})
```
@@ -323,13 +323,13 @@ The walker takes an abstract syntax tree to walk and an object with two optional
```js
const svelte = require('svelte/compiler');
svelte.walk(ast, {
- enter(node, parent) {
+ enter(node, parent, prop, index) {
do_something(node);
if (should_skip_children(node)) {
this.skip();
}
},
- leave(node, parent) {
+ leave(node, parent, prop, index) {
do_something_else(node);
}
});
diff --git a/site/content/examples/06-lifecycle/02-update/App.svelte b/site/content/examples/06-lifecycle/02-update/App.svelte
index 373b6dcb6a..3eb2dceb52 100644
--- a/site/content/examples/06-lifecycle/02-update/App.svelte
+++ b/site/content/examples/06-lifecycle/02-update/App.svelte
@@ -1,5 +1,5 @@
\ No newline at end of file
+
diff --git a/site/content/examples/10-animations/00-animate/crossfade.js b/site/content/examples/10-animations/00-animate/crossfade.js
deleted file mode 100644
index e11e18b60e..0000000000
--- a/site/content/examples/10-animations/00-animate/crossfade.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import { quintOut } from 'svelte/easing';
-
-export default function crossfade({ send, receive, fallback }) {
- let requested = new Map();
- let provided = new Map();
-
- function crossfade(from, node) {
- const to = node.getBoundingClientRect();
- const dx = from.left - to.left;
- const dy = from.top - to.top;
-
- const style = getComputedStyle(node);
- const transform = style.transform === 'none' ? '' : style.transform;
-
- return {
- duration: 400,
- easing: quintOut,
- css: (t, u) => `
- opacity: ${t};
- transform: ${transform} translate(${u * dx}px,${u * dy}px);
- `
- };
- }
-
- return {
- send(node, params) {
- provided.set(params.key, {
- rect: node.getBoundingClientRect()
- });
-
- return () => {
- if (requested.has(params.key)) {
- const { rect } = requested.get(params.key);
- requested.delete(params.key);
-
- return crossfade(rect, node);
- }
-
- // if the node is disappearing altogether
- // (i.e. wasn't claimed by the other list)
- // then we need to supply an outro
- provided.delete(params.key);
- return fallback(node, params);
- };
- },
-
- receive(node, params) {
- requested.set(params.key, {
- rect: node.getBoundingClientRect()
- });
-
- return () => {
- if (provided.has(params.key)) {
- const { rect } = provided.get(params.key);
- provided.delete(params.key);
-
- return crossfade(rect, node);
- }
-
- requested.delete(params.key);
- return fallback(node, params);
- };
- }
- };
-}
\ No newline at end of file
diff --git a/site/content/examples/19-7guis/05-7guis-crud/App.svelte b/site/content/examples/19-7guis/05-7guis-crud/App.svelte
index 1f39fe6642..a0d6ef7f3e 100644
--- a/site/content/examples/19-7guis/05-7guis-crud/App.svelte
+++ b/site/content/examples/19-7guis/05-7guis-crud/App.svelte
@@ -30,10 +30,7 @@
$: selected = filteredPeople[i];
- $: {
- first = selected ? selected.first : '';
- last = selected ? selected.last : '';
- }
+ $: reset_inputs(selected);
function create() {
people = people.concat({ first, last });
@@ -53,7 +50,8 @@
}
function reset_inputs(person) {
- ({ first, last } = person);
+ first = person ? person.first : '';
+ last = person ? person.last : '';
}
diff --git a/site/content/examples/20-miscellaneous/02-immutable-data/flash.js b/site/content/examples/20-miscellaneous/02-immutable-data/flash.js
index 8dff9cbe2f..c788cc6d35 100644
--- a/site/content/examples/20-miscellaneous/02-immutable-data/flash.js
+++ b/site/content/examples/20-miscellaneous/02-immutable-data/flash.js
@@ -1,11 +1,13 @@
export default function flash(element) {
- element.style.transition = 'none';
- element.style.color = 'rgba(255,62,0,1)';
- element.style.backgroundColor = 'rgba(255,62,0,0.2)';
+ requestAnimationFrame(() => {
+ element.style.transition = 'none';
+ element.style.color = 'rgba(255,62,0,1)';
+ element.style.backgroundColor = 'rgba(255,62,0,0.2)';
- setTimeout(() => {
- element.style.transition = 'color 1s, background 1s';
- element.style.color = '';
- element.style.backgroundColor = '';
+ setTimeout(() => {
+ element.style.transition = 'color 1s, background 1s';
+ element.style.color = '';
+ element.style.backgroundColor = '';
+ });
});
}
\ No newline at end of file
diff --git a/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte b/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte
index 6a12752e1a..e61b4d48e0 100644
--- a/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte
+++ b/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte
@@ -3,4 +3,4 @@
let name = 'Rick Astley';
-
\ No newline at end of file
+
diff --git a/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md b/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
index 6deaad5837..c503b4f548 100644
--- a/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
+++ b/site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
@@ -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
-
+
```
-We can use curly braces *inside* attributes. Try changing it to `"{name} dancing"` — remember to declare a `name` variable in the `
```
-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
-```
\ No newline at end of file
+```
diff --git a/site/content/tutorial/06-bindings/01-text-inputs/text.md b/site/content/tutorial/06-bindings/01-text-inputs/text.md
index 0082586133..7bcbc96fa6 100644
--- a/site/content/tutorial/06-bindings/01-text-inputs/text.md
+++ b/site/content/tutorial/06-bindings/01-text-inputs/text.md
@@ -4,7 +4,7 @@ title: Text inputs
As a general rule, data flow in Svelte is *top down* — a parent component can set props on a child component, and a component can set attributes on an element, but not the other way around.
-Sometimes it's useful to break that rule. Take the case of the ` ` element in this component — we *could* add an `on:input` event handler that set the value of `name` to `event.target.value`, but it's a bit... boilerplatey. It gets even worse with other kinds of form element, as we'll see.
+Sometimes it's useful to break that rule. Take the case of the ` ` element in this component — we *could* add an `on:input` event handler that set the value of `name` to `event.target.value`, but it's a bit... boilerplatey. It gets even worse with other form elements, as we'll see.
Instead, we can use the `bind:value` directive:
@@ -12,4 +12,4 @@ Instead, we can use the `bind:value` directive:
```
-This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`.
\ No newline at end of file
+This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`.
diff --git a/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte b/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte
index 2081b6ab8c..75fce63ca2 100644
--- a/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte
+++ b/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte
@@ -1,5 +1,5 @@
+
+Hello world
+
+
diff --git a/test/custom-elements/index.js b/test/custom-elements/index.js
index 32e95266ec..9255d33c0e 100644
--- a/test/custom-elements/index.js
+++ b/test/custom-elements/index.js
@@ -5,6 +5,7 @@ import { rollup } from 'rollup';
import * as virtual from 'rollup-plugin-virtual';
import * as puppeteer from 'puppeteer';
import { addLineNumbers, loadConfig, loadSvelte } from "../helpers.js";
+import { deepEqual } from 'assert';
const page = `
@@ -57,18 +58,20 @@ describe('custom-elements', function() {
const solo = /\.solo$/.test(dir);
const skip = /\.skip$/.test(dir);
- const internal = path.resolve('internal.mjs');
+ const internal = path.resolve('internal/index.mjs');
const index = path.resolve('index.mjs');
+ const warnings = [];
(solo ? it.only : skip ? it.skip : it)(dir, async () => {
const config = loadConfig(`./custom-elements/samples/${dir}/_config.js`);
+ const expected_warnings = config.warnings || [];
const bundle = await rollup({
input: `test/custom-elements/samples/${dir}/test.js`,
plugins: [
{
resolveId(importee) {
- if (importee === 'svelte/internal') {
+ if (importee === 'svelte/internal' || importee === './internal') {
return internal;
}
@@ -84,6 +87,8 @@ describe('custom-elements', function() {
dev: config.dev
});
+ compiled.warnings.forEach(w => warnings.push(w));
+
return compiled.js;
}
}
@@ -112,6 +117,16 @@ describe('custom-elements', function() {
} catch (err) {
console.log(addLineNumbers(code));
throw err;
+ } finally {
+ if (expected_warnings) {
+ deepEqual(warnings.map(w => ({
+ code: w.code,
+ message: w.message,
+ pos: w.pos,
+ start: w.start,
+ end: w.end
+ })), expected_warnings);
+ }
}
});
});
diff --git a/test/custom-elements/samples/no-svelte-options/_config.js b/test/custom-elements/samples/no-svelte-options/_config.js
new file mode 100644
index 0000000000..e45582a127
--- /dev/null
+++ b/test/custom-elements/samples/no-svelte-options/_config.js
@@ -0,0 +1,17 @@
+export default {
+ warnings: [{
+ code: "custom-element-no-tag",
+ message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ",
+ pos: 0,
+ start: {
+ character: 0,
+ column: 0,
+ line: 1
+ },
+ end: {
+ character: 0,
+ column: 0,
+ line: 1
+ }
+ }]
+};
diff --git a/test/custom-elements/samples/no-svelte-options/main.svelte b/test/custom-elements/samples/no-svelte-options/main.svelte
new file mode 100644
index 0000000000..538dc970e9
--- /dev/null
+++ b/test/custom-elements/samples/no-svelte-options/main.svelte
@@ -0,0 +1,5 @@
+
+
+Hello {name}!
diff --git a/test/custom-elements/samples/no-svelte-options/test.js b/test/custom-elements/samples/no-svelte-options/test.js
new file mode 100644
index 0000000000..c77f035088
--- /dev/null
+++ b/test/custom-elements/samples/no-svelte-options/test.js
@@ -0,0 +1,12 @@
+import * as assert from 'assert';
+import CustomElement from './main.svelte';
+
+export default function (target) {
+ customElements.define('no-tag', CustomElement);
+ target.innerHTML = ` `;
+
+ const el = target.querySelector('no-tag');
+ const h1 = el.shadowRoot.querySelector('h1');
+
+ assert.equal(h1.textContent, 'Hello world!');
+}
diff --git a/test/custom-elements/samples/no-tag-warning/_config.js b/test/custom-elements/samples/no-tag-warning/_config.js
new file mode 100644
index 0000000000..7cdfdbaec6
--- /dev/null
+++ b/test/custom-elements/samples/no-tag-warning/_config.js
@@ -0,0 +1,17 @@
+export default {
+ warnings: [{
+ code: "custom-element-no-tag",
+ message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ",
+ pos: 0,
+ start: {
+ character: 0,
+ column: 0,
+ line: 1
+ },
+ end: {
+ character: 18,
+ column: 18,
+ line: 1
+ }
+ }]
+};
diff --git a/test/custom-elements/samples/no-tag-warning/main.svelte b/test/custom-elements/samples/no-tag-warning/main.svelte
new file mode 100644
index 0000000000..4f7cdc52ca
--- /dev/null
+++ b/test/custom-elements/samples/no-tag-warning/main.svelte
@@ -0,0 +1,7 @@
+
+
+
+
+Hello {name}!
diff --git a/test/custom-elements/samples/no-tag-warning/test.js b/test/custom-elements/samples/no-tag-warning/test.js
new file mode 100644
index 0000000000..c77f035088
--- /dev/null
+++ b/test/custom-elements/samples/no-tag-warning/test.js
@@ -0,0 +1,12 @@
+import * as assert from 'assert';
+import CustomElement from './main.svelte';
+
+export default function (target) {
+ customElements.define('no-tag', CustomElement);
+ target.innerHTML = ` `;
+
+ const el = target.querySelector('no-tag');
+ const h1 = el.shadowRoot.querySelector('h1');
+
+ assert.equal(h1.textContent, 'Hello world!');
+}
diff --git a/test/custom-elements/samples/no-tag/_config.js b/test/custom-elements/samples/no-tag/_config.js
new file mode 100644
index 0000000000..c81f1a9f82
--- /dev/null
+++ b/test/custom-elements/samples/no-tag/_config.js
@@ -0,0 +1,3 @@
+export default {
+ warnings: []
+};
diff --git a/test/custom-elements/samples/no-tag/main.svelte b/test/custom-elements/samples/no-tag/main.svelte
new file mode 100644
index 0000000000..031bd93694
--- /dev/null
+++ b/test/custom-elements/samples/no-tag/main.svelte
@@ -0,0 +1,7 @@
+
+
+
+
+Hello {name}!
diff --git a/test/custom-elements/samples/no-tag/test.js b/test/custom-elements/samples/no-tag/test.js
new file mode 100644
index 0000000000..c77f035088
--- /dev/null
+++ b/test/custom-elements/samples/no-tag/test.js
@@ -0,0 +1,12 @@
+import * as assert from 'assert';
+import CustomElement from './main.svelte';
+
+export default function (target) {
+ customElements.define('no-tag', CustomElement);
+ target.innerHTML = ` `;
+
+ const el = target.querySelector('no-tag');
+ const h1 = el.shadowRoot.querySelector('h1');
+
+ assert.equal(h1.textContent, 'Hello world!');
+}
diff --git a/test/js/samples/bind-open/expected.js b/test/js/samples/bind-open/expected.js
new file mode 100644
index 0000000000..7f739aec8b
--- /dev/null
+++ b/test/js/samples/bind-open/expected.js
@@ -0,0 +1,69 @@
+/* generated by Svelte vX.Y.Z */
+import {
+ SvelteComponent,
+ detach,
+ element,
+ init,
+ insert,
+ listen,
+ noop,
+ safe_not_equal
+} from "svelte/internal";
+
+function create_fragment(ctx) {
+ var details, dispose;
+
+ return {
+ c() {
+ details = element("details");
+ details.innerHTML = `summary content
+ `;
+ dispose = listen(details, "toggle", ctx.details_toggle_handler);
+ },
+
+ m(target, anchor) {
+ insert(target, details, anchor);
+
+ details.open = ctx.open;
+ },
+
+ p(changed, ctx) {
+ if (changed.open) details.open = ctx.open;
+ },
+
+ i: noop,
+ o: noop,
+
+ d(detaching) {
+ if (detaching) {
+ detach(details);
+ }
+
+ dispose();
+ }
+ };
+}
+
+function instance($$self, $$props, $$invalidate) {
+ let { open } = $$props;
+
+ function details_toggle_handler() {
+ open = this.open;
+ $$invalidate('open', open);
+ }
+
+ $$self.$set = $$props => {
+ if ('open' in $$props) $$invalidate('open', open = $$props.open);
+ };
+
+ return { open, details_toggle_handler };
+}
+
+class Component extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, ["open"]);
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/bind-open/input.svelte b/test/js/samples/bind-open/input.svelte
new file mode 100644
index 0000000000..3dd2b03a73
--- /dev/null
+++ b/test/js/samples/bind-open/input.svelte
@@ -0,0 +1,7 @@
+
+
+
+ summary content
+
diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js
index 98c2837ab7..6f07993590 100644
--- a/test/js/samples/debug-empty/expected.js
+++ b/test/js/samples/debug-empty/expected.js
@@ -65,6 +65,11 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { name } = $$props;
+ const writable_props = ['name'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('name' in $$props) $$invalidate('name', name = $$props.name);
};
diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js
index c1391475b2..eea35d5ba7 100644
--- a/test/js/samples/debug-foo-bar-baz-things/expected.js
+++ b/test/js/samples/debug-foo-bar-baz-things/expected.js
@@ -151,6 +151,11 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { things, foo, bar, baz } = $$props;
+ const writable_props = ['things', 'foo', 'bar', 'baz'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('things' in $$props) $$invalidate('things', things = $$props.things);
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js
index f5daa7dad7..5b931d9464 100644
--- a/test/js/samples/debug-foo/expected.js
+++ b/test/js/samples/debug-foo/expected.js
@@ -151,6 +151,11 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { things, foo } = $$props;
+ const writable_props = ['things', 'foo'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('things' in $$props) $$invalidate('things', things = $$props.things);
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
diff --git a/test/js/samples/debug-hoisted/_config.js b/test/js/samples/debug-hoisted/_config.js
new file mode 100644
index 0000000000..414b026a97
--- /dev/null
+++ b/test/js/samples/debug-hoisted/_config.js
@@ -0,0 +1,5 @@
+export default {
+ options: {
+ dev: true
+ }
+};
diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js
new file mode 100644
index 0000000000..51d8bf63a3
--- /dev/null
+++ b/test/js/samples/debug-hoisted/expected.js
@@ -0,0 +1,56 @@
+/* generated by Svelte vX.Y.Z */
+import {
+ SvelteComponentDev,
+ init,
+ noop,
+ safe_not_equal
+} from "svelte/internal";
+
+const file = undefined;
+
+function create_fragment(ctx) {
+ return {
+ c: function create() {
+ {
+ const { obj } = ctx;
+ console.log({ obj, kobzol });
+ debugger;
+ }
+ },
+
+ l: function claim(nodes) {
+ throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
+ },
+
+ m: noop,
+
+ p: function update(changed, ctx) {
+ if (changed.obj || changed.kobzol) {
+ const { obj } = ctx;
+ console.log({ obj, kobzol });
+ debugger;
+ }
+ },
+
+ i: noop,
+ o: noop,
+ d: noop
+ };
+}
+
+let kobzol = 5;
+
+function instance($$self) {
+ let obj = { x: 5 };
+
+ return { obj };
+}
+
+class Component extends SvelteComponentDev {
+ constructor(options) {
+ super(options);
+ init(this, options, instance, create_fragment, safe_not_equal, []);
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/debug-hoisted/input.svelte b/test/js/samples/debug-hoisted/input.svelte
new file mode 100644
index 0000000000..94d584ccac
--- /dev/null
+++ b/test/js/samples/debug-hoisted/input.svelte
@@ -0,0 +1,6 @@
+
+
+{@debug obj, kobzol}
diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js
index 12e8a983d0..5c4b2ece1b 100644
--- a/test/js/samples/dev-warning-missing-data-computed/expected.js
+++ b/test/js/samples/dev-warning-missing-data-computed/expected.js
@@ -65,6 +65,11 @@ function instance($$self, $$props, $$invalidate) {
let bar;
+ const writable_props = ['foo'];
+ Object.keys($$props).forEach(key => {
+ if (!writable_props.includes(key) && !key.startsWith('$$')) console.warn(` was created with unknown prop '${key}'`);
+ });
+
$$self.$set = $$props => {
if ('foo' in $$props) $$invalidate('foo', foo = $$props.foo);
};
diff --git a/test/js/samples/each-block-keyed-animated/expected.js b/test/js/samples/each-block-keyed-animated/expected.js
index d18c569fa1..ec28e60d5f 100644
--- a/test/js/samples/each-block-keyed-animated/expected.js
+++ b/test/js/samples/each-block-keyed-animated/expected.js
@@ -6,7 +6,7 @@ import {
detach,
element,
empty,
- fix_and_outro_and_destroy_block,
+ fix_and_destroy_block,
fix_position,
init,
insert,
@@ -100,7 +100,7 @@ function create_fragment(ctx) {
p(changed, ctx) {
const each_value = ctx.things;
for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].r();
- each_blocks = update_keyed_each(each_blocks, changed, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, fix_and_outro_and_destroy_block, create_each_block, each_1_anchor, get_each_context);
+ each_blocks = update_keyed_each(each_blocks, changed, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, fix_and_destroy_block, create_each_block, each_1_anchor, get_each_context);
for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].a();
},
diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js
index 8a193f698b..f45f9ce8db 100644
--- a/test/js/samples/media-bindings/expected.js
+++ b/test/js/samples/media-bindings/expected.js
@@ -8,6 +8,7 @@ import {
insert,
listen,
noop,
+ raf,
run_all,
safe_not_equal,
time_ranges_to_array
@@ -18,7 +19,7 @@ function create_fragment(ctx) {
function audio_timeupdate_handler() {
cancelAnimationFrame(audio_animationframe);
- if (!audio.paused) audio_animationframe = requestAnimationFrame(audio_timeupdate_handler);
+ if (!audio.paused) audio_animationframe = raf(audio_timeupdate_handler);
audio_updating = true;
ctx.audio_timeupdate_handler.call(audio);
}
diff --git a/test/js/samples/reactive-values-non-topologically-ordered/expected.js b/test/js/samples/reactive-values-non-topologically-ordered/expected.js
index 2f729362b0..b5e2b04f75 100644
--- a/test/js/samples/reactive-values-non-topologically-ordered/expected.js
+++ b/test/js/samples/reactive-values-non-topologically-ordered/expected.js
@@ -29,7 +29,7 @@ function instance($$self, $$props, $$invalidate) {
$$self.$$.update = ($$dirty = { x: 1, b: 1 }) => {
if ($$dirty.x) { $$invalidate('b', b = x); }
- if ($$dirty.b) { $$invalidate('a', a = b); }
+ if ($$dirty.b) { a = b; }
};
return { x };
diff --git a/test/js/samples/reactive-values-non-writable-dependencies/expected.js b/test/js/samples/reactive-values-non-writable-dependencies/expected.js
index 62057cc6f0..8958f1ffbc 100644
--- a/test/js/samples/reactive-values-non-writable-dependencies/expected.js
+++ b/test/js/samples/reactive-values-non-writable-dependencies/expected.js
@@ -17,26 +17,25 @@ function create_fragment(ctx) {
};
}
-let a = 1;
-
-let b = 2;
-
function instance($$self, $$props, $$invalidate) {
-
+ let { a = 1, b = 2 } = $$props;
- let max;
+ $$self.$set = $$props => {
+ if ('a' in $$props) $$invalidate('a', a = $$props.a);
+ if ('b' in $$props) $$invalidate('b', b = $$props.b);
+ };
$$self.$$.update = ($$dirty = { a: 1, b: 1 }) => {
- if ($$dirty.a || $$dirty.b) { $$invalidate('max', max = Math.max(a, b)); }
+ if ($$dirty.a || $$dirty.b) { console.log('max', Math.max(a, b)); }
};
- return {};
+ return { a, b };
}
class Component extends SvelteComponent {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal, []);
+ init(this, options, instance, create_fragment, safe_not_equal, ["a", "b"]);
}
}
diff --git a/test/js/samples/reactive-values-non-writable-dependencies/input.svelte b/test/js/samples/reactive-values-non-writable-dependencies/input.svelte
index 8e3397e40d..3fb70d5e8f 100644
--- a/test/js/samples/reactive-values-non-writable-dependencies/input.svelte
+++ b/test/js/samples/reactive-values-non-writable-dependencies/input.svelte
@@ -1,7 +1,6 @@
\ No newline at end of file
diff --git a/test/js/samples/unreferenced-state-not-invalidated/expected.js b/test/js/samples/unreferenced-state-not-invalidated/expected.js
new file mode 100644
index 0000000000..17b5638a84
--- /dev/null
+++ b/test/js/samples/unreferenced-state-not-invalidated/expected.js
@@ -0,0 +1,78 @@
+/* generated by Svelte vX.Y.Z */
+import {
+ SvelteComponent,
+ append,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ set_data,
+ text
+} from "svelte/internal";
+import { onMount } from "svelte";
+
+function create_fragment(ctx) {
+ var p, t;
+
+ return {
+ c() {
+ p = element("p");
+ t = text(ctx.y);
+ },
+
+ m(target, anchor) {
+ insert(target, p, anchor);
+ append(p, t);
+ },
+
+ p(changed, ctx) {
+ if (changed.y) {
+ set_data(t, ctx.y);
+ }
+ },
+
+ i: noop,
+ o: noop,
+
+ d(detaching) {
+ if (detaching) {
+ detach(p);
+ }
+ }
+ };
+}
+
+function instance($$self, $$props, $$invalidate) {
+ let a, b, c;
+
+ onMount(() => {
+ const interval = setInterval(() => {
+ $$invalidate('b', b += 1);
+ c += 1;
+
+ console.log(b, c);
+ }, 1000);
+
+ return () => clearInterval(interval);
+ });
+
+ let x, y;
+
+ $$self.$$.update = ($$dirty = { a: 1, b: 1 }) => {
+ if ($$dirty.a) { x = a * 2; }
+ if ($$dirty.b) { $$invalidate('y', y = b * 2); }
+ };
+
+ return { y };
+}
+
+class Component extends SvelteComponent {
+ constructor(options) {
+ super();
+ init(this, options, instance, create_fragment, safe_not_equal, []);
+ }
+}
+
+export default Component;
\ No newline at end of file
diff --git a/test/js/samples/unreferenced-state-not-invalidated/input.svelte b/test/js/samples/unreferenced-state-not-invalidated/input.svelte
new file mode 100644
index 0000000000..fff60f181d
--- /dev/null
+++ b/test/js/samples/unreferenced-state-not-invalidated/input.svelte
@@ -0,0 +1,21 @@
+
+
+{y}
\ No newline at end of file
diff --git a/test/parser/samples/action-with-call/output.json b/test/parser/samples/action-with-call/output.json
index d6aaa72892..e910f0b49f 100644
--- a/test/parser/samples/action-with-call/output.json
+++ b/test/parser/samples/action-with-call/output.json
@@ -41,8 +41,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/action-with-identifier/output.json b/test/parser/samples/action-with-identifier/output.json
index d58b9097b7..435aee4444 100644
--- a/test/parser/samples/action-with-identifier/output.json
+++ b/test/parser/samples/action-with-identifier/output.json
@@ -27,8 +27,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/action-with-literal/output.json b/test/parser/samples/action-with-literal/output.json
index 4a6f596d10..01a6b67549 100644
--- a/test/parser/samples/action-with-literal/output.json
+++ b/test/parser/samples/action-with-literal/output.json
@@ -28,8 +28,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/action/output.json b/test/parser/samples/action/output.json
index 2f553b5efa..9828e200dd 100644
--- a/test/parser/samples/action/output.json
+++ b/test/parser/samples/action/output.json
@@ -22,8 +22,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/animation/output.json b/test/parser/samples/animation/output.json
index 8332b3ad04..f4d183eb5c 100644
--- a/test/parser/samples/animation/output.json
+++ b/test/parser/samples/animation/output.json
@@ -35,6 +35,7 @@
"start": 51,
"end": 56,
"type": "Text",
+ "raw": "flips",
"data": "flips"
}
]
@@ -54,8 +55,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-containing-solidus/output.json b/test/parser/samples/attribute-containing-solidus/output.json
index 95372bd77d..f1158b4f50 100644
--- a/test/parser/samples/attribute-containing-solidus/output.json
+++ b/test/parser/samples/attribute-containing-solidus/output.json
@@ -20,6 +20,7 @@
"start": 8,
"end": 30,
"type": "Text",
+ "raw": "https://www.google.com",
"data": "https://www.google.com"
}
]
@@ -30,13 +31,11 @@
"start": 31,
"end": 37,
"type": "Text",
+ "raw": "Google",
"data": "Google"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-dynamic-boolean/output.json b/test/parser/samples/attribute-dynamic-boolean/output.json
index 81a19f49b9..478144152a 100644
--- a/test/parser/samples/attribute-dynamic-boolean/output.json
+++ b/test/parser/samples/attribute-dynamic-boolean/output.json
@@ -33,8 +33,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-dynamic-reserved/output.json b/test/parser/samples/attribute-dynamic-reserved/output.json
index 3a830d448f..22be3c9087 100644
--- a/test/parser/samples/attribute-dynamic-reserved/output.json
+++ b/test/parser/samples/attribute-dynamic-reserved/output.json
@@ -33,8 +33,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-dynamic/output.json b/test/parser/samples/attribute-dynamic/output.json
index 50d8ec60a5..a48f376876 100644
--- a/test/parser/samples/attribute-dynamic/output.json
+++ b/test/parser/samples/attribute-dynamic/output.json
@@ -18,8 +18,9 @@
"value": [
{
"start": 12,
- "end": 19,
+ "end": 20,
"type": "Text",
+ "raw": "color: ",
"data": "color: "
},
{
@@ -37,6 +38,7 @@
"start": 26,
"end": 27,
"type": "Text",
+ "raw": ";",
"data": ";"
}
]
@@ -57,8 +59,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-escaped/output.json b/test/parser/samples/attribute-escaped/output.json
index 6a4143e674..e60a8c2531 100644
--- a/test/parser/samples/attribute-escaped/output.json
+++ b/test/parser/samples/attribute-escaped/output.json
@@ -20,6 +20,7 @@
"start": 15,
"end": 33,
"type": "Text",
+ "raw": ""quoted"",
"data": "\"quoted\""
}
]
@@ -28,8 +29,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-multiple/output.json b/test/parser/samples/attribute-multiple/output.json
index 668409c0ef..c4be13e6ee 100644
--- a/test/parser/samples/attribute-multiple/output.json
+++ b/test/parser/samples/attribute-multiple/output.json
@@ -20,6 +20,7 @@
"start": 9,
"end": 10,
"type": "Text",
+ "raw": "x",
"data": "x"
}
]
@@ -34,6 +35,7 @@
"start": 19,
"end": 20,
"type": "Text",
+ "raw": "y",
"data": "y"
}
]
@@ -42,8 +44,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-shorthand/output.json b/test/parser/samples/attribute-shorthand/output.json
index 08ddf5eda9..f23e62b04e 100644
--- a/test/parser/samples/attribute-shorthand/output.json
+++ b/test/parser/samples/attribute-shorthand/output.json
@@ -33,8 +33,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-static-boolean/output.json b/test/parser/samples/attribute-static-boolean/output.json
index f63b5734e0..7d635004c1 100644
--- a/test/parser/samples/attribute-static-boolean/output.json
+++ b/test/parser/samples/attribute-static-boolean/output.json
@@ -21,8 +21,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-static/output.json b/test/parser/samples/attribute-static/output.json
index 3185e48736..37b41d9a89 100644
--- a/test/parser/samples/attribute-static/output.json
+++ b/test/parser/samples/attribute-static/output.json
@@ -20,6 +20,7 @@
"start": 12,
"end": 15,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -28,8 +29,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/attribute-unquoted/output.json b/test/parser/samples/attribute-unquoted/output.json
index c7556f2eba..11fa397819 100644
--- a/test/parser/samples/attribute-unquoted/output.json
+++ b/test/parser/samples/attribute-unquoted/output.json
@@ -20,6 +20,7 @@
"start": 11,
"end": 14,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -28,8 +29,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json
index f62ad16574..ac598a403a 100644
--- a/test/parser/samples/await-then-catch/output.json
+++ b/test/parser/samples/await-then-catch/output.json
@@ -19,13 +19,13 @@
"pending": {
"start": 19,
"end": 39,
- "skip": false,
"type": "PendingBlock",
"children": [
{
"start": 19,
"end": 21,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -39,6 +39,7 @@
"start": 24,
"end": 34,
"type": "Text",
+ "raw": "loading...",
"data": "loading..."
}
]
@@ -47,20 +48,22 @@
"start": 38,
"end": 39,
"type": "Text",
+ "raw": "\n",
"data": "\n"
}
- ]
+ ],
+ "skip": false
},
"then": {
"start": 39,
"end": 88,
- "skip": false,
"type": "ThenBlock",
"children": [
{
"start": 55,
"end": 57,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -74,6 +77,7 @@
"start": 60,
"end": 73,
"type": "Text",
+ "raw": "the value is ",
"data": "the value is "
},
{
@@ -93,20 +97,22 @@
"start": 87,
"end": 88,
"type": "Text",
+ "raw": "\n",
"data": "\n"
}
- ]
+ ],
+ "skip": false
},
"catch": {
"start": 88,
"end": 140,
- "skip": false,
"type": "CatchBlock",
"children": [
{
"start": 105,
"end": 107,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -120,6 +126,7 @@
"start": 110,
"end": 117,
"type": "Text",
+ "raw": "oh no! ",
"data": "oh no! "
},
{
@@ -151,14 +158,13 @@
"start": 139,
"end": 140,
"type": "Text",
+ "raw": "\n",
"data": "\n"
}
- ]
+ ],
+ "skip": false
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
-}
+ }
+}
\ No newline at end of file
diff --git a/test/parser/samples/binding-shorthand/output.json b/test/parser/samples/binding-shorthand/output.json
index 8f92101042..7fe7acb5b3 100644
--- a/test/parser/samples/binding-shorthand/output.json
+++ b/test/parser/samples/binding-shorthand/output.json
@@ -8,6 +8,7 @@
"start": 28,
"end": 30,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/binding/output.json b/test/parser/samples/binding/output.json
index d084050617..72ad60202c 100644
--- a/test/parser/samples/binding/output.json
+++ b/test/parser/samples/binding/output.json
@@ -8,6 +8,7 @@
"start": 29,
"end": 31,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/comment/output.json b/test/parser/samples/comment/output.json
index 89295c188a..2a57c4fa5d 100644
--- a/test/parser/samples/comment/output.json
+++ b/test/parser/samples/comment/output.json
@@ -11,8 +11,5 @@
"data": " a comment "
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/component-dynamic/output.json b/test/parser/samples/component-dynamic/output.json
index c2e4e3ee79..77837d1ca9 100644
--- a/test/parser/samples/component-dynamic/output.json
+++ b/test/parser/samples/component-dynamic/output.json
@@ -36,8 +36,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/convert-entities-in-element/output.json b/test/parser/samples/convert-entities-in-element/output.json
index fb0f5b288e..c830c276de 100644
--- a/test/parser/samples/convert-entities-in-element/output.json
+++ b/test/parser/samples/convert-entities-in-element/output.json
@@ -15,13 +15,11 @@
"start": 3,
"end": 20,
"type": "Text",
+ "raw": "Hello & World",
"data": "Hello & World"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/convert-entities/output.json b/test/parser/samples/convert-entities/output.json
index ca1c1356f8..f4cc1a6662 100644
--- a/test/parser/samples/convert-entities/output.json
+++ b/test/parser/samples/convert-entities/output.json
@@ -8,11 +8,9 @@
"start": 0,
"end": 17,
"type": "Text",
+ "raw": "Hello & World",
"data": "Hello & World"
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/css/output.json b/test/parser/samples/css/output.json
index 3127e01c71..12d74ae7f8 100644
--- a/test/parser/samples/css/output.json
+++ b/test/parser/samples/css/output.json
@@ -15,6 +15,7 @@
"start": 5,
"end": 8,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -23,6 +24,7 @@
"start": 14,
"end": 16,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
}
]
@@ -90,7 +92,5 @@
"end": 48,
"styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n"
}
- },
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/dynamic-import/output.json b/test/parser/samples/dynamic-import/output.json
index c0d4a45e0d..fa1acf7d9b 100644
--- a/test/parser/samples/dynamic-import/output.json
+++ b/test/parser/samples/dynamic-import/output.json
@@ -5,7 +5,6 @@
"type": "Fragment",
"children": []
},
- "css": null,
"instance": {
"start": 0,
"end": 146,
@@ -66,8 +65,8 @@
"start": 54,
"end": 134,
"id": null,
- "generator": false,
"expression": false,
+ "generator": false,
"async": false,
"params": [],
"body": {
@@ -120,8 +119,8 @@
"start": 88,
"end": 129,
"id": null,
- "generator": false,
"expression": false,
+ "generator": false,
"async": false,
"params": [
{
diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json
index 0c4b1a5c54..6368b445d6 100644
--- a/test/parser/samples/each-block-destructured/output.json
+++ b/test/parser/samples/each-block-destructured/output.json
@@ -37,6 +37,7 @@
"start": 50,
"end": 52,
"type": "Text",
+ "raw": ": ",
"data": ": "
},
{
@@ -80,8 +81,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
-}
+ }
+}
\ No newline at end of file
diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json
index aefc8c2f39..1e8ac455e6 100644
--- a/test/parser/samples/each-block-else/output.json
+++ b/test/parser/samples/each-block-else/output.json
@@ -58,6 +58,7 @@
"start": 55,
"end": 65,
"type": "Text",
+ "raw": "no animals",
"data": "no animals"
}
]
@@ -66,8 +67,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json
index 7518652468..77417ba67a 100644
--- a/test/parser/samples/each-block-indexed/output.json
+++ b/test/parser/samples/each-block-indexed/output.json
@@ -37,6 +37,7 @@
"start": 36,
"end": 38,
"type": "Text",
+ "raw": ": ",
"data": ": "
},
{
@@ -62,8 +63,5 @@
"index": "i"
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json
index fe893bcdb9..11cdd45ff1 100644
--- a/test/parser/samples/each-block-keyed/output.json
+++ b/test/parser/samples/each-block-keyed/output.json
@@ -62,8 +62,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json
index c16a71ad5d..6a60823952 100644
--- a/test/parser/samples/each-block/output.json
+++ b/test/parser/samples/each-block/output.json
@@ -44,8 +44,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/element-with-mustache/output.json b/test/parser/samples/element-with-mustache/output.json
index c8a386d681..f7c2e9936b 100644
--- a/test/parser/samples/element-with-mustache/output.json
+++ b/test/parser/samples/element-with-mustache/output.json
@@ -15,6 +15,7 @@
"start": 4,
"end": 10,
"type": "Text",
+ "raw": "hello ",
"data": "hello "
},
{
@@ -32,13 +33,11 @@
"start": 16,
"end": 17,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/element-with-text/output.json b/test/parser/samples/element-with-text/output.json
index 70f6163c93..b0e0f5c6cc 100644
--- a/test/parser/samples/element-with-text/output.json
+++ b/test/parser/samples/element-with-text/output.json
@@ -15,13 +15,11 @@
"start": 6,
"end": 10,
"type": "Text",
+ "raw": "test",
"data": "test"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/elements/output.json b/test/parser/samples/elements/output.json
index d216f7f5d8..75548c20f0 100644
--- a/test/parser/samples/elements/output.json
+++ b/test/parser/samples/elements/output.json
@@ -21,8 +21,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/event-handler/output.json b/test/parser/samples/event-handler/output.json
index b1fe89fc2a..f792ffadcc 100644
--- a/test/parser/samples/event-handler/output.json
+++ b/test/parser/samples/event-handler/output.json
@@ -21,8 +21,8 @@
"start": 19,
"end": 43,
"id": null,
- "generator": false,
"expression": true,
+ "generator": false,
"async": false,
"params": [],
"body": {
@@ -58,6 +58,7 @@
"start": 46,
"end": 52,
"type": "Text",
+ "raw": "toggle",
"data": "toggle"
}
]
@@ -66,6 +67,7 @@
"start": 61,
"end": 63,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -90,6 +92,7 @@
"start": 81,
"end": 87,
"type": "Text",
+ "raw": "hello!",
"data": "hello!"
}
]
@@ -97,8 +100,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/if-block-else/output.json b/test/parser/samples/if-block-else/output.json
index dedf2797c4..8b22cfa26b 100644
--- a/test/parser/samples/if-block-else/output.json
+++ b/test/parser/samples/if-block-else/output.json
@@ -26,6 +26,7 @@
"start": 14,
"end": 17,
"type": "Text",
+ "raw": "foo",
"data": "foo"
}
]
@@ -47,6 +48,7 @@
"start": 34,
"end": 41,
"type": "Text",
+ "raw": "not foo",
"data": "not foo"
}
]
@@ -55,8 +57,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/if-block-elseif/output.json b/test/parser/samples/if-block-elseif/output.json
index 188b57aaad..54fb53dacb 100644
--- a/test/parser/samples/if-block-elseif/output.json
+++ b/test/parser/samples/if-block-elseif/output.json
@@ -39,6 +39,7 @@
"start": 17,
"end": 37,
"type": "Text",
+ "raw": "x is greater than 10",
"data": "x is greater than 10"
}
]
@@ -85,6 +86,7 @@
"start": 63,
"end": 79,
"type": "Text",
+ "raw": "x is less than 5",
"data": "x is less than 5"
}
]
diff --git a/test/parser/samples/if-block/output.json b/test/parser/samples/if-block/output.json
index d560824766..1714bb7141 100644
--- a/test/parser/samples/if-block/output.json
+++ b/test/parser/samples/if-block/output.json
@@ -19,13 +19,11 @@
"start": 9,
"end": 12,
"type": "Text",
+ "raw": "bar",
"data": "bar"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/implicitly-closed-li/output.json b/test/parser/samples/implicitly-closed-li/output.json
index caf69d7109..f46a2b1a26 100644
--- a/test/parser/samples/implicitly-closed-li/output.json
+++ b/test/parser/samples/implicitly-closed-li/output.json
@@ -15,6 +15,7 @@
"start": 4,
"end": 6,
"type": "Text",
+ "raw": "\n\t",
"data": "\n\t"
},
{
@@ -28,6 +29,7 @@
"start": 10,
"end": 13,
"type": "Text",
+ "raw": "a\n\t",
"data": "a\n\t"
}
]
@@ -43,6 +45,7 @@
"start": 17,
"end": 20,
"type": "Text",
+ "raw": "b\n\t",
"data": "b\n\t"
}
]
@@ -58,6 +61,7 @@
"start": 24,
"end": 26,
"type": "Text",
+ "raw": "c\n",
"data": "c\n"
}
]
@@ -65,8 +69,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/nbsp/output.json b/test/parser/samples/nbsp/output.json
index 4fa318ce48..044de64cba 100644
--- a/test/parser/samples/nbsp/output.json
+++ b/test/parser/samples/nbsp/output.json
@@ -15,13 +15,11 @@
"start": 6,
"end": 12,
"type": "Text",
+ "raw": " ",
"data": " "
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/raw-mustaches/output.json b/test/parser/samples/raw-mustaches/output.json
index 1d92b21c85..1b3d9b7a9c 100644
--- a/test/parser/samples/raw-mustaches/output.json
+++ b/test/parser/samples/raw-mustaches/output.json
@@ -15,6 +15,7 @@
"start": 3,
"end": 4,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -32,6 +33,7 @@
"start": 16,
"end": 17,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -49,13 +51,11 @@
"start": 29,
"end": 30,
"type": "Text",
+ "raw": " ",
"data": " "
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/refs/output.json b/test/parser/samples/refs/output.json
index d15753b0a2..e09383f9b6 100644
--- a/test/parser/samples/refs/output.json
+++ b/test/parser/samples/refs/output.json
@@ -8,6 +8,7 @@
"start": 28,
"end": 30,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/script-comment-only/output.json b/test/parser/samples/script-comment-only/output.json
index 95ca769b20..ba28434318 100644
--- a/test/parser/samples/script-comment-only/output.json
+++ b/test/parser/samples/script-comment-only/output.json
@@ -8,6 +8,7 @@
"start": 43,
"end": 45,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
diff --git a/test/parser/samples/script-comment-trailing-multiline/output.json b/test/parser/samples/script-comment-trailing-multiline/output.json
index d4a45911a1..7d01599efa 100644
--- a/test/parser/samples/script-comment-trailing-multiline/output.json
+++ b/test/parser/samples/script-comment-trailing-multiline/output.json
@@ -8,6 +8,7 @@
"start": 77,
"end": 79,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -21,6 +22,7 @@
"start": 83,
"end": 89,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -38,6 +40,7 @@
"start": 95,
"end": 96,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
diff --git a/test/parser/samples/script-comment-trailing/output.json b/test/parser/samples/script-comment-trailing/output.json
index 92d431b558..bc8f3e4e67 100644
--- a/test/parser/samples/script-comment-trailing/output.json
+++ b/test/parser/samples/script-comment-trailing/output.json
@@ -8,6 +8,7 @@
"start": 66,
"end": 68,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -21,6 +22,7 @@
"start": 72,
"end": 78,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -38,6 +40,7 @@
"start": 84,
"end": 85,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
diff --git a/test/parser/samples/script/output.json b/test/parser/samples/script/output.json
index 95966f5dc6..75aa0a7d2c 100644
--- a/test/parser/samples/script/output.json
+++ b/test/parser/samples/script/output.json
@@ -8,6 +8,7 @@
"start": 39,
"end": 41,
"type": "Text",
+ "raw": "\n\n",
"data": "\n\n"
},
{
@@ -21,6 +22,7 @@
"start": 45,
"end": 51,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -38,6 +40,7 @@
"start": 57,
"end": 58,
"type": "Text",
+ "raw": "!",
"data": "!"
}
]
diff --git a/test/parser/samples/self-closing-element/output.json b/test/parser/samples/self-closing-element/output.json
index 47eea2f333..63ff17a466 100644
--- a/test/parser/samples/self-closing-element/output.json
+++ b/test/parser/samples/self-closing-element/output.json
@@ -13,8 +13,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/self-reference/output.json b/test/parser/samples/self-reference/output.json
index de5112a087..92dfdfe4d0 100644
--- a/test/parser/samples/self-reference/output.json
+++ b/test/parser/samples/self-reference/output.json
@@ -72,8 +72,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/space-between-mustaches/output.json b/test/parser/samples/space-between-mustaches/output.json
index c89409daeb..9a367bd2c1 100644
--- a/test/parser/samples/space-between-mustaches/output.json
+++ b/test/parser/samples/space-between-mustaches/output.json
@@ -15,6 +15,7 @@
"start": 3,
"end": 4,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -32,6 +33,7 @@
"start": 7,
"end": 8,
"type": "Text",
+ "raw": " ",
"data": " "
},
{
@@ -49,6 +51,7 @@
"start": 11,
"end": 14,
"type": "Text",
+ "raw": " : ",
"data": " : "
},
{
@@ -66,13 +69,11 @@
"start": 17,
"end": 20,
"type": "Text",
+ "raw": " : ",
"data": " : "
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/spread/output.json b/test/parser/samples/spread/output.json
index 3986da3578..73a0dc9777 100644
--- a/test/parser/samples/spread/output.json
+++ b/test/parser/samples/spread/output.json
@@ -25,8 +25,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/textarea-children/output.json b/test/parser/samples/textarea-children/output.json
index 3b403458fc..90f31f3caf 100644
--- a/test/parser/samples/textarea-children/output.json
+++ b/test/parser/samples/textarea-children/output.json
@@ -16,8 +16,9 @@
"value": [
{
"start": 10,
- "end": 40,
+ "end": 41,
"type": "Text",
+ "raw": "\n\tnot actually an element. ",
"data": "\n\t
not actually an element. "
},
{
@@ -35,6 +36,7 @@
"start": 45,
"end": 50,
"type": "Text",
+ "raw": "
\n",
"data": "
\n"
}
]
@@ -43,8 +45,5 @@
"children": []
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/transition-intro-no-params/output.json b/test/parser/samples/transition-intro-no-params/output.json
index edb15457e6..91b50f3ec8 100644
--- a/test/parser/samples/transition-intro-no-params/output.json
+++ b/test/parser/samples/transition-intro-no-params/output.json
@@ -26,13 +26,11 @@
"start": 13,
"end": 21,
"type": "Text",
+ "raw": "fades in",
"data": "fades in"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/transition-intro/output.json b/test/parser/samples/transition-intro/output.json
index 5583dd89bc..418bb97e16 100644
--- a/test/parser/samples/transition-intro/output.json
+++ b/test/parser/samples/transition-intro/output.json
@@ -54,13 +54,11 @@
"start": 31,
"end": 39,
"type": "Text",
+ "raw": "fades in",
"data": "fades in"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/unusual-identifier/output.json b/test/parser/samples/unusual-identifier/output.json
index c0d4ecc3ff..e4a2a18619 100644
--- a/test/parser/samples/unusual-identifier/output.json
+++ b/test/parser/samples/unusual-identifier/output.json
@@ -44,8 +44,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/whitespace-leading-trailing/output.json b/test/parser/samples/whitespace-leading-trailing/output.json
index f164af01ba..e4f387856e 100644
--- a/test/parser/samples/whitespace-leading-trailing/output.json
+++ b/test/parser/samples/whitespace-leading-trailing/output.json
@@ -8,6 +8,7 @@
"start": 0,
"end": 6,
"type": "Text",
+ "raw": "\n\n\t\t\t\t",
"data": "\n\n\t\t\t\t"
},
{
@@ -21,13 +22,11 @@
"start": 9,
"end": 32,
"type": "Text",
+ "raw": "just chillin' over here",
"data": "just chillin' over here"
}
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/whitespace-normal/output.json b/test/parser/samples/whitespace-normal/output.json
index e4ce956331..acbae7ae17 100644
--- a/test/parser/samples/whitespace-normal/output.json
+++ b/test/parser/samples/whitespace-normal/output.json
@@ -15,6 +15,7 @@
"start": 4,
"end": 10,
"type": "Text",
+ "raw": "Hello ",
"data": "Hello "
},
{
@@ -39,6 +40,7 @@
"start": 24,
"end": 26,
"type": "Text",
+ "raw": "! ",
"data": "! "
}
]
@@ -54,6 +56,7 @@
"start": 41,
"end": 53,
"type": "Text",
+ "raw": "How are you?",
"data": "How are you?"
}
]
@@ -61,8 +64,5 @@
]
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/parser/samples/yield/output.json b/test/parser/samples/yield/output.json
index 16ea79d8e8..b2e4b9430f 100644
--- a/test/parser/samples/yield/output.json
+++ b/test/parser/samples/yield/output.json
@@ -16,8 +16,5 @@
}
}
]
- },
- "css": null,
- "instance": null,
- "module": null
+ }
}
\ No newline at end of file
diff --git a/test/runtime/index.js b/test/runtime/index.js
index 579dc665c6..77879edc1f 100644
--- a/test/runtime/index.js
+++ b/test/runtime/index.js
@@ -3,7 +3,7 @@ import * as path from "path";
import * as fs from "fs";
import { rollup } from 'rollup';
import * as virtual from 'rollup-plugin-virtual';
-import { clear_loops } from "../../internal.js";
+import { clear_loops, set_now, set_raf } from "../../internal";
import {
showOutput,
@@ -20,7 +20,7 @@ let compileOptions = null;
let compile = null;
const sveltePath = process.cwd().split('\\').join('/');
-const internal = `${sveltePath}/internal.js`;
+const internal = `${sveltePath}/internal`;
describe("runtime", () => {
before(() => {
@@ -75,7 +75,7 @@ describe("runtime", () => {
compileOptions.accessors = 'accessors' in config ? config.accessors : true;
Object.keys(require.cache)
- .filter(x => x.endsWith(".svelte"))
+ .filter(x => x.endsWith('.svelte'))
.forEach(file => {
delete require.cache[file];
});
@@ -100,8 +100,8 @@ describe("runtime", () => {
if (raf.callback) raf.callback();
}
};
- window.performance.now = () => raf.time;
- global.requestAnimationFrame = cb => {
+ set_now(() => raf.time);
+ set_raf(cb => {
let called = false;
raf.callback = () => {
if (!called) {
@@ -109,7 +109,7 @@ describe("runtime", () => {
cb();
}
};
- };
+ });
try {
mod = require(`./samples/${dir}/main.svelte`);
@@ -223,7 +223,7 @@ describe("runtime", () => {
{
resolveId: (importee, importer) => {
if (importee.startsWith('svelte/')) {
- return importee.replace('svelte', process.cwd()) + '.mjs';
+ return importee.replace('svelte', process.cwd()) + '/index.mjs';
}
}
}
diff --git a/test/runtime/samples/animation-css/_config.js b/test/runtime/samples/animation-css/_config.js
index 544c6378ff..201a282e58 100644
--- a/test/runtime/samples/animation-css/_config.js
+++ b/test/runtime/samples/animation-css/_config.js
@@ -29,9 +29,9 @@ export default {
right: 100,
top,
bottom: top + 20
- }
+ };
};
- })
+ });
component.things = [
{ id: 5, name: 'e' },
diff --git a/test/runtime/samples/animation-js-delay/_config.js b/test/runtime/samples/animation-js-delay/_config.js
index faed25ecaa..6bd02d17e6 100644
--- a/test/runtime/samples/animation-js-delay/_config.js
+++ b/test/runtime/samples/animation-js-delay/_config.js
@@ -29,9 +29,9 @@ export default {
right: 100,
top,
bottom: top + 20
- }
+ };
};
- })
+ });
component.things = [
{ id: 5, name: 'e' },
diff --git a/test/runtime/samples/animation-js-easing/_config.js b/test/runtime/samples/animation-js-easing/_config.js
index a31825c3f9..415af042a9 100644
--- a/test/runtime/samples/animation-js-easing/_config.js
+++ b/test/runtime/samples/animation-js-easing/_config.js
@@ -29,9 +29,9 @@ export default {
right: 100,
top,
bottom: top + 20
- }
+ };
};
- })
+ });
component.things = [
{ id: 5, name: 'e' },
diff --git a/test/runtime/samples/animation-js/_config.js b/test/runtime/samples/animation-js/_config.js
index d5991a915a..521753633d 100644
--- a/test/runtime/samples/animation-js/_config.js
+++ b/test/runtime/samples/animation-js/_config.js
@@ -29,7 +29,7 @@ export default {
right: 100,
top,
bottom: top + 20
- }
+ };
};
});
diff --git a/test/runtime/samples/attribute-dataset-without-value/_config.js b/test/runtime/samples/attribute-dataset-without-value/_config.js
new file mode 100644
index 0000000000..934f44eb06
--- /dev/null
+++ b/test/runtime/samples/attribute-dataset-without-value/_config.js
@@ -0,0 +1,3 @@
+export default {
+ html: '
',
+};
diff --git a/test/runtime/samples/attribute-dataset-without-value/main.svelte b/test/runtime/samples/attribute-dataset-without-value/main.svelte
new file mode 100644
index 0000000000..ed7d532652
--- /dev/null
+++ b/test/runtime/samples/attribute-dataset-without-value/main.svelte
@@ -0,0 +1 @@
+
diff --git a/test/runtime/samples/attribute-url/_config.js b/test/runtime/samples/attribute-url/_config.js
new file mode 100644
index 0000000000..28bc1bcb0c
--- /dev/null
+++ b/test/runtime/samples/attribute-url/_config.js
@@ -0,0 +1,8 @@
+export default {
+ test({ assert, target }) {
+ const div = target.querySelector( 'div' );
+
+ assert.equal( div.style.backgroundImage, 'url(https://example.com/foo.jpg)');
+ assert.equal( div.style.color, 'red' );
+ }
+};
diff --git a/test/runtime/samples/attribute-url/main.svelte b/test/runtime/samples/attribute-url/main.svelte
new file mode 100644
index 0000000000..357a352aaa
--- /dev/null
+++ b/test/runtime/samples/attribute-url/main.svelte
@@ -0,0 +1,6 @@
+
+
+{color}
diff --git a/test/runtime/samples/await-containing-if/_config.js b/test/runtime/samples/await-containing-if/_config.js
index 9e24e4f614..cd83585cc1 100644
--- a/test/runtime/samples/await-containing-if/_config.js
+++ b/test/runtime/samples/await-containing-if/_config.js
@@ -1,6 +1,6 @@
let fulfil;
-let thePromise = new Promise(f => {
+const thePromise = new Promise(f => {
fulfil = f;
});
diff --git a/test/runtime/samples/await-in-each/_config.js b/test/runtime/samples/await-in-each/_config.js
index b1a232e4bd..6c7da69ee3 100644
--- a/test/runtime/samples/await-in-each/_config.js
+++ b/test/runtime/samples/await-in-each/_config.js
@@ -1,6 +1,6 @@
let fulfil;
-let thePromise = new Promise(f => {
+const thePromise = new Promise(f => {
fulfil = f;
});
diff --git a/test/runtime/samples/await-then-catch-order/_config.js b/test/runtime/samples/await-then-catch-order/_config.js
index 5c4eb530e9..f972520904 100644
--- a/test/runtime/samples/await-then-catch-order/_config.js
+++ b/test/runtime/samples/await-then-catch-order/_config.js
@@ -1,6 +1,6 @@
let fulfil;
-let thePromise = new Promise(f => {
+const thePromise = new Promise(f => {
fulfil = f;
});
diff --git a/test/runtime/samples/await-with-components/_config.js b/test/runtime/samples/await-with-components/_config.js
index ffef7441ff..a0a558782a 100644
--- a/test/runtime/samples/await-with-components/_config.js
+++ b/test/runtime/samples/await-with-components/_config.js
@@ -1,6 +1,7 @@
export default {
async test({ assert, component, target }) {
- let resolve, reject;
+ let resolve;
+ let reject;
let promise = new Promise(ok => resolve = ok);
component.promise = promise;
diff --git a/test/runtime/samples/binding-details-open/_config.js b/test/runtime/samples/binding-details-open/_config.js
new file mode 100644
index 0000000000..cf2459c3f1
--- /dev/null
+++ b/test/runtime/samples/binding-details-open/_config.js
@@ -0,0 +1,25 @@
+export default {
+ html: `
+ toggle
+ `,
+
+ async test({ assert, component, target, window }) {
+ const details = target.querySelector('details');
+ const event = new window.Event('toggle');
+
+ details.open = true;
+ await details.dispatchEvent(event);
+ assert.equal(component.visible, true);
+ assert.htmlEqual(target.innerHTML, `
+ toggle
+ hello!
+ `);
+
+ details.open = false;
+ await details.dispatchEvent(event);
+ assert.equal(component.visible, false);
+ assert.htmlEqual(target.innerHTML, `
+ toggle
+ `);
+ }
+};
diff --git a/test/runtime/samples/binding-details-open/main.svelte b/test/runtime/samples/binding-details-open/main.svelte
new file mode 100644
index 0000000000..3a7a08e121
--- /dev/null
+++ b/test/runtime/samples/binding-details-open/main.svelte
@@ -0,0 +1,9 @@
+
+
+toggle
+
+{#if visible}
+ hello!
+{/if}
diff --git a/test/runtime/samples/binding-textarea/_config.js b/test/runtime/samples/binding-textarea/_config.js
index c09256e059..ac092096e6 100644
--- a/test/runtime/samples/binding-textarea/_config.js
+++ b/test/runtime/samples/binding-textarea/_config.js
@@ -9,7 +9,7 @@ export default {
`,
ssrHtml: `
-
+
some text
`,
diff --git a/test/runtime/samples/component-namespaced/Foo.svelte b/test/runtime/samples/component-namespaced/Foo.svelte
new file mode 100644
index 0000000000..67ab955233
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/Foo.svelte
@@ -0,0 +1,5 @@
+
+
+foo {foo}
\ No newline at end of file
diff --git a/test/runtime/samples/component-namespaced/_config.js b/test/runtime/samples/component-namespaced/_config.js
new file mode 100644
index 0000000000..b91795d6c8
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/_config.js
@@ -0,0 +1,22 @@
+import * as path from 'path';
+
+export default {
+ props: {
+ a: 1
+ },
+
+ html: `
+ foo 1
+ `,
+
+ before_test() {
+ delete require.cache[path.resolve(__dirname, 'components.js')];
+ },
+
+ test({ assert, component, target }) {
+ component.a = 2;
+ assert.htmlEqual(target.innerHTML, `
+ foo 2
+ `);
+ }
+};
\ No newline at end of file
diff --git a/test/runtime/samples/component-namespaced/components.js b/test/runtime/samples/component-namespaced/components.js
new file mode 100644
index 0000000000..832d2412ee
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/components.js
@@ -0,0 +1,3 @@
+import Foo from './Foo.svelte';
+
+export default { Foo };
\ No newline at end of file
diff --git a/test/runtime/samples/component-namespaced/main.svelte b/test/runtime/samples/component-namespaced/main.svelte
new file mode 100644
index 0000000000..541b68e47e
--- /dev/null
+++ b/test/runtime/samples/component-namespaced/main.svelte
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js b/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js
index 212c57308a..a07a1482bc 100644
--- a/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js
+++ b/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js
@@ -22,4 +22,4 @@ export default {
`);
}
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/test/runtime/samples/dev-warning-unknown-props-with-$$props/Foo.svelte b/test/runtime/samples/dev-warning-unknown-props-with-$$props/Foo.svelte
new file mode 100644
index 0000000000..9e5c62339d
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props-with-$$props/Foo.svelte
@@ -0,0 +1,7 @@
+
+
+{foo}
+{JSON.stringify($$props)}
diff --git a/test/runtime/samples/dev-warning-unknown-props-with-$$props/_config.js b/test/runtime/samples/dev-warning-unknown-props-with-$$props/_config.js
new file mode 100644
index 0000000000..62ad08624d
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props-with-$$props/_config.js
@@ -0,0 +1,7 @@
+export default {
+ compileOptions: {
+ dev: true
+ },
+
+ warnings: []
+};
diff --git a/test/runtime/samples/dev-warning-unknown-props-with-$$props/main.svelte b/test/runtime/samples/dev-warning-unknown-props-with-$$props/main.svelte
new file mode 100644
index 0000000000..1566cf3e41
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props-with-$$props/main.svelte
@@ -0,0 +1,5 @@
+
+
+
diff --git a/test/runtime/samples/dev-warning-unknown-props-with-$$scope/Foo.svelte b/test/runtime/samples/dev-warning-unknown-props-with-$$scope/Foo.svelte
new file mode 100644
index 0000000000..b9f7feec24
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props-with-$$scope/Foo.svelte
@@ -0,0 +1,6 @@
+
+
+{answer}
+
diff --git a/test/runtime/samples/dev-warning-unknown-props-with-$$scope/_config.js b/test/runtime/samples/dev-warning-unknown-props-with-$$scope/_config.js
new file mode 100644
index 0000000000..62ad08624d
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props-with-$$scope/_config.js
@@ -0,0 +1,7 @@
+export default {
+ compileOptions: {
+ dev: true
+ },
+
+ warnings: []
+};
diff --git a/test/runtime/samples/dev-warning-unknown-props-with-$$scope/main.svelte b/test/runtime/samples/dev-warning-unknown-props-with-$$scope/main.svelte
new file mode 100644
index 0000000000..a1656e86e0
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props-with-$$scope/main.svelte
@@ -0,0 +1,7 @@
+
+
+
+ bar
+
diff --git a/test/runtime/samples/dev-warning-unknown-props/Foo.svelte b/test/runtime/samples/dev-warning-unknown-props/Foo.svelte
new file mode 100644
index 0000000000..cebe5fd571
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props/Foo.svelte
@@ -0,0 +1,5 @@
+
+
+{foo}
diff --git a/test/runtime/samples/dev-warning-unknown-props/_config.js b/test/runtime/samples/dev-warning-unknown-props/_config.js
new file mode 100644
index 0000000000..9bff4a2a74
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props/_config.js
@@ -0,0 +1,9 @@
+export default {
+ compileOptions: {
+ dev: true
+ },
+
+ warnings: [
+ ` was created with unknown prop 'fo'`
+ ]
+};
diff --git a/test/runtime/samples/dev-warning-unknown-props/main.svelte b/test/runtime/samples/dev-warning-unknown-props/main.svelte
new file mode 100644
index 0000000000..1566cf3e41
--- /dev/null
+++ b/test/runtime/samples/dev-warning-unknown-props/main.svelte
@@ -0,0 +1,5 @@
+
+
+
diff --git a/test/runtime/samples/element-invalid-name/_config.js b/test/runtime/samples/element-invalid-name/_config.js
index af6e4933ce..d70c920a19 100644
--- a/test/runtime/samples/element-invalid-name/_config.js
+++ b/test/runtime/samples/element-invalid-name/_config.js
@@ -2,4 +2,4 @@ export default {
html: `
Hello
`
-}
+};
diff --git a/test/runtime/samples/event-handler-multiple/_config.js b/test/runtime/samples/event-handler-multiple/_config.js
new file mode 100644
index 0000000000..cf17c61f60
--- /dev/null
+++ b/test/runtime/samples/event-handler-multiple/_config.js
@@ -0,0 +1,14 @@
+export default {
+ html: `
+ click me
+ `,
+
+ async test({ assert, component, target, window }) {
+ const button = target.querySelector('button');
+ const event = new window.MouseEvent('click');
+
+ await button.dispatchEvent(event);
+ assert.equal(component.clickHandlerOne, 1);
+ assert.equal(component.clickHandlerTwo, 1);
+ }
+};
diff --git a/test/runtime/samples/event-handler-multiple/main.svelte b/test/runtime/samples/event-handler-multiple/main.svelte
new file mode 100644
index 0000000000..f327a7fd2a
--- /dev/null
+++ b/test/runtime/samples/event-handler-multiple/main.svelte
@@ -0,0 +1,6 @@
+
+
+click me
diff --git a/test/runtime/samples/export-function-hoisting/_config.js b/test/runtime/samples/export-function-hoisting/_config.js
index c56851d065..f01c8b4841 100644
--- a/test/runtime/samples/export-function-hoisting/_config.js
+++ b/test/runtime/samples/export-function-hoisting/_config.js
@@ -1,3 +1,3 @@
export default {
- html: 'Compile plz'
-}
+ html: 'Compile plz'
+};
diff --git a/test/runtime/samples/function-hoisting/_config.js b/test/runtime/samples/function-hoisting/_config.js
index 5a22ffaf0b..91492d8c38 100644
--- a/test/runtime/samples/function-hoisting/_config.js
+++ b/test/runtime/samples/function-hoisting/_config.js
@@ -1,7 +1,7 @@
export default {
- props: {
- greeting: 'Good day'
- },
+ props: {
+ greeting: 'Good day'
+ },
- html: 'Good day, world '
-}
+ html: 'Good day, world '
+};
diff --git a/test/runtime/samples/get-after-destroy/_config.js b/test/runtime/samples/get-after-destroy/_config.js
index bf4d8e90ba..5d10bbe72a 100644
--- a/test/runtime/samples/get-after-destroy/_config.js
+++ b/test/runtime/samples/get-after-destroy/_config.js
@@ -10,4 +10,4 @@ export default {
const { foo } = component;
assert.equal(foo, undefined);
}
-}
\ No newline at end of file
+};
diff --git a/test/runtime/samples/head-if-block/_config.js b/test/runtime/samples/head-if-block/_config.js
index 26e1457be7..439ed2cb1b 100644
--- a/test/runtime/samples/head-if-block/_config.js
+++ b/test/runtime/samples/head-if-block/_config.js
@@ -9,4 +9,4 @@ export default {
component.condition = true;
assert.equal(window.document.title, 'woo!!!');
}
-};
\ No newline at end of file
+};
diff --git a/test/runtime/samples/head-if-block/main.svelte b/test/runtime/samples/head-if-block/main.svelte
index a6b115bf28..1656278b9e 100644
--- a/test/runtime/samples/head-if-block/main.svelte
+++ b/test/runtime/samples/head-if-block/main.svelte
@@ -6,4 +6,4 @@
{#if condition}
woo!!!
{/if}
-
\ No newline at end of file
+
diff --git a/test/runtime/samples/head-if-else-block/_config.js b/test/runtime/samples/head-if-else-block/_config.js
new file mode 100644
index 0000000000..7665bfe90b
--- /dev/null
+++ b/test/runtime/samples/head-if-else-block/_config.js
@@ -0,0 +1,14 @@
+export default {
+ props: {
+ condition: false
+ },
+
+ test({ assert, component, target, window }) {
+ assert.equal(window.document.title, '');
+ assert.equal(Boolean(window.document.getElementById('meta')), true);
+
+ component.condition = true;
+ assert.equal(window.document.title, 'woo!!!');
+ assert.equal(window.document.getElementById('meta'), null);
+ }
+};
diff --git a/test/runtime/samples/head-if-else-block/main.svelte b/test/runtime/samples/head-if-else-block/main.svelte
new file mode 100644
index 0000000000..a31bdf3330
--- /dev/null
+++ b/test/runtime/samples/head-if-else-block/main.svelte
@@ -0,0 +1,11 @@
+
+
+
+ {#if condition}
+ woo!!!
+ {:else}
+
+ {/if}
+
diff --git a/test/runtime/samples/head-if-else-raw-dynamic/_config.js b/test/runtime/samples/head-if-else-raw-dynamic/_config.js
new file mode 100644
index 0000000000..b6da617cb9
--- /dev/null
+++ b/test/runtime/samples/head-if-else-raw-dynamic/_config.js
@@ -0,0 +1,19 @@
+const foo = '';
+const bar = '';
+
+export default {
+ props: {
+ condition: false,
+ foo,
+ bar
+ },
+
+ test({ assert, component, window }) {
+ assert.equal(window.document.head.innerHTML.includes(foo), false);
+ assert.equal(window.document.head.innerHTML.includes(bar), true);
+
+ component.condition = true;
+ assert.equal(window.document.head.innerHTML.includes(foo), true);
+ assert.equal(window.document.head.innerHTML.includes(bar), false);
+ }
+};
diff --git a/test/runtime/samples/head-if-else-raw-dynamic/main.svelte b/test/runtime/samples/head-if-else-raw-dynamic/main.svelte
new file mode 100644
index 0000000000..ca322dad83
--- /dev/null
+++ b/test/runtime/samples/head-if-else-raw-dynamic/main.svelte
@@ -0,0 +1,11 @@
+
+
+
+ {#if condition}
+ {@html foo}
+ {:else}
+ {@html bar}
+ {/if}
+
diff --git a/test/runtime/samples/head-raw-dynamic/Bar.svelte b/test/runtime/samples/head-raw-dynamic/Bar.svelte
new file mode 100644
index 0000000000..11e5cb9ee8
--- /dev/null
+++ b/test/runtime/samples/head-raw-dynamic/Bar.svelte
@@ -0,0 +1,11 @@
+
+
+
+
+ {#if true}
+ {@html bar}
+ {/if}
+ bar!!!
+
diff --git a/test/runtime/samples/head-raw-dynamic/Foo.svelte b/test/runtime/samples/head-raw-dynamic/Foo.svelte
new file mode 100644
index 0000000000..f4fd5741ac
--- /dev/null
+++ b/test/runtime/samples/head-raw-dynamic/Foo.svelte
@@ -0,0 +1,7 @@
+
+
+
+ {@html foo}
+
diff --git a/test/runtime/samples/head-raw-dynamic/_config.js b/test/runtime/samples/head-raw-dynamic/_config.js
new file mode 100644
index 0000000000..61e86727ff
--- /dev/null
+++ b/test/runtime/samples/head-raw-dynamic/_config.js
@@ -0,0 +1,26 @@
+const foo = '';
+const bar = '';
+
+export default {
+ props: {
+ condition: 1,
+ foo,
+ bar
+ },
+
+ test({ assert, component, window }) {
+ assert.equal(window.document.head.innerHTML.includes(foo), true);
+
+ component.condition = false;
+ assert.equal(window.document.head.innerHTML.includes(foo), false);
+
+ component.condition = 2;
+ assert.equal(window.document.title, 'bar!!!');
+ assert.equal(window.document.head.innerHTML.includes(bar), true);
+ assert.equal(Boolean(window.document.getElementById('meta')), true);
+
+ component.condition = false;
+ assert.equal(window.document.head.innerHTML.includes(bar), false);
+ assert.equal(window.document.getElementById('meta'), null);
+ }
+};
diff --git a/test/runtime/samples/head-raw-dynamic/main.svelte b/test/runtime/samples/head-raw-dynamic/main.svelte
new file mode 100644
index 0000000000..69f341ae36
--- /dev/null
+++ b/test/runtime/samples/head-raw-dynamic/main.svelte
@@ -0,0 +1,12 @@
+
+
+{#if condition === 1}
+
+{:else if condition === 2}
+
+{/if}
diff --git a/test/runtime/samples/immutable-nested/Nested.svelte b/test/runtime/samples/immutable-nested/Nested.svelte
index 45385e9b0b..acb0b480a4 100644
--- a/test/runtime/samples/immutable-nested/Nested.svelte
+++ b/test/runtime/samples/immutable-nested/Nested.svelte
@@ -1,7 +1,7 @@
-Called {count} times.
\ No newline at end of file
+Called {count} times.
+{foo.bar} {mounted}
\ No newline at end of file
diff --git a/test/runtime/samples/immutable-nested/_config.js b/test/runtime/samples/immutable-nested/_config.js
index e5c515fc78..8b1dd7e68a 100644
--- a/test/runtime/samples/immutable-nested/_config.js
+++ b/test/runtime/samples/immutable-nested/_config.js
@@ -1,16 +1,36 @@
export default {
immutable: true,
- html: `
Called 1 times. `,
+ html: `
+
+
Called 1 times.
+
baz true
+
+ `,
- ssrHtml: `
Called 0 times. `,
+ ssrHtml: `
+
+
Called 0 times.
+
baz false
+
`,
- test({ assert, component, target, window }) {
- var nested = component.nested;
+ test({ assert, component, target }) {
+ const nested = component.nested;
- assert.htmlEqual(target.innerHTML, `
Called 1 times. `);
+ assert.htmlEqual(target.innerHTML, `
+
+
Called 1 times.
+
baz true
+
+ `);
+ // eslint-disable-next-line no-self-assign
nested.foo = nested.foo;
- assert.htmlEqual(target.innerHTML, `
Called 1 times. `);
+ assert.htmlEqual(target.innerHTML, `
+
+
Called 1 times.
+
baz true
+
+ `);
}
};
diff --git a/test/runtime/samples/immutable-nested/main.svelte b/test/runtime/samples/immutable-nested/main.svelte
index e50055be0c..4ccf7008cd 100644
--- a/test/runtime/samples/immutable-nested/main.svelte
+++ b/test/runtime/samples/immutable-nested/main.svelte
@@ -5,5 +5,5 @@
-
+
diff --git a/test/runtime/samples/immutable-option/_config.js b/test/runtime/samples/immutable-option/_config.js
index 0aaa742fbe..1224d0213a 100644
--- a/test/runtime/samples/immutable-option/_config.js
+++ b/test/runtime/samples/immutable-option/_config.js
@@ -4,6 +4,7 @@ export default {
html: `
Called 1 times. `,
test({ assert, component, target }) {
+ // eslint-disable-next-line no-self-assign
component.foo = component.foo;
assert.htmlEqual(target.innerHTML, `
Called 1 times. `);
}
diff --git a/test/runtime/samples/immutable-svelte-meta-false/_config.js b/test/runtime/samples/immutable-svelte-meta-false/_config.js
index 933c151d6b..664f99f087 100644
--- a/test/runtime/samples/immutable-svelte-meta-false/_config.js
+++ b/test/runtime/samples/immutable-svelte-meta-false/_config.js
@@ -4,6 +4,7 @@ export default {
html: `
Called 1 times. `,
test({ assert, component, target }) {
+ // eslint-disable-next-line no-self-assign
component.foo = component.foo;
assert.htmlEqual(target.innerHTML, `
Called 2 times. `);
}
diff --git a/test/runtime/samples/immutable-svelte-meta/_config.js b/test/runtime/samples/immutable-svelte-meta/_config.js
index 9bd32dbd11..4e39f36224 100644
--- a/test/runtime/samples/immutable-svelte-meta/_config.js
+++ b/test/runtime/samples/immutable-svelte-meta/_config.js
@@ -2,6 +2,7 @@ export default {
html: `
Called 1 times. `,
test({ assert, component, target }) {
+ // eslint-disable-next-line no-self-assign
component.foo = component.foo;
assert.htmlEqual(target.innerHTML, `
Called 1 times. `);
}
diff --git a/test/runtime/samples/internal-state/_config.js b/test/runtime/samples/internal-state/_config.js
index 09ea61a8eb..6b8440aaf3 100644
--- a/test/runtime/samples/internal-state/_config.js
+++ b/test/runtime/samples/internal-state/_config.js
@@ -1,18 +1,18 @@
export default {
- html: `
- internal: 1
- click me
- `,
+ html: `
+ internal: 1
+ click me
+ `,
- async test({ assert, target, window }) {
- const button = target.querySelector('button');
- const click = new window.MouseEvent('click');
+ async test({ assert, target, window }) {
+ const button = target.querySelector('button');
+ const click = new window.MouseEvent('click');
- await button.dispatchEvent(click);
+ await button.dispatchEvent(click);
- assert.htmlEqual(target.innerHTML, `
- internal: 1
- click me
- `);
- }
-};
\ No newline at end of file
+ assert.htmlEqual(target.innerHTML, `
+ internal: 1
+ click me
+ `);
+ }
+};
diff --git a/test/runtime/samples/mixed-let-export/_config.js b/test/runtime/samples/mixed-let-export/_config.js
index 5ac8585742..f3da4215d9 100644
--- a/test/runtime/samples/mixed-let-export/_config.js
+++ b/test/runtime/samples/mixed-let-export/_config.js
@@ -1,9 +1,9 @@
export default {
- props: {
- a: 42
- },
+ props: {
+ a: 42
+ },
- html: `
- 42
- `
-}
+ html: `
+ 42
+ `
+};
diff --git a/test/runtime/samples/prop-exports/_config.js b/test/runtime/samples/prop-exports/_config.js
index 631c9eb0ad..e1620c015f 100644
--- a/test/runtime/samples/prop-exports/_config.js
+++ b/test/runtime/samples/prop-exports/_config.js
@@ -2,29 +2,29 @@ import { writable } from '../../../../store';
export default {
props: {
- s1: writable(42),
- s2: writable(43),
- p1: 2,
- p3: 3,
- a1: writable(1),
- a2: 4,
- a6: writable(29),
- for: 'loop',
- continue: '...',
+ s1: writable(42),
+ s2: writable(43),
+ p1: 2,
+ p3: 3,
+ a1: writable(1),
+ a2: 4,
+ a6: writable(29),
+ for: 'loop',
+ continue: '...',
},
html: `
- $s1=42
- $s2=43
- p1=2
- p3=3
- $v1=1
- v2=4
- vi1=4
- $vs1=1
- vl0=hello
- vl1=test
- $s3=29
- loop...
- `
-}
+ $s1=42
+ $s2=43
+ p1=2
+ p3=3
+ $v1=1
+ v2=4
+ vi1=4
+ $vs1=1
+ vl0=hello
+ vl1=test
+ $s3=29
+ loop...
+ `
+};
diff --git a/test/runtime/samples/prop-subscribable/_config.js b/test/runtime/samples/prop-subscribable/_config.js
index 69f8104fab..84cde8c9af 100644
--- a/test/runtime/samples/prop-subscribable/_config.js
+++ b/test/runtime/samples/prop-subscribable/_config.js
@@ -1,4 +1,4 @@
-import { writable } from '../../../../store.js';
+import { writable } from '../../../../store';
export default {
props: {
diff --git a/test/runtime/samples/reactive-value-function-hoist/_config.js b/test/runtime/samples/reactive-value-function-hoist/_config.js
new file mode 100644
index 0000000000..6198a57ef6
--- /dev/null
+++ b/test/runtime/samples/reactive-value-function-hoist/_config.js
@@ -0,0 +1,15 @@
+export default {
+ html: `
+ Click me
+ `,
+
+ async test({ assert, target, window }) {
+ const event = new window.MouseEvent('click');
+ const button = target.querySelector('button');
+
+ await button.dispatchEvent(event);
+ assert.htmlEqual(target.innerHTML, `
+ 4
+ `);
+ }
+};
diff --git a/test/runtime/samples/reactive-value-function-hoist/main.svelte b/test/runtime/samples/reactive-value-function-hoist/main.svelte
new file mode 100644
index 0000000000..0f2dadb561
--- /dev/null
+++ b/test/runtime/samples/reactive-value-function-hoist/main.svelte
@@ -0,0 +1,10 @@
+
+
+Click me
diff --git a/test/runtime/samples/reactive-value-mutate-const/_config.js b/test/runtime/samples/reactive-value-mutate-const/_config.js
new file mode 100644
index 0000000000..da0a19dd28
--- /dev/null
+++ b/test/runtime/samples/reactive-value-mutate-const/_config.js
@@ -0,0 +1,17 @@
+export default {
+ html: `
+ Mutate a
+ {}
+ `,
+
+ async test({ assert, target }) {
+ const button = target.querySelector('button');
+ const click = new window.MouseEvent('click');
+
+ await button.dispatchEvent(click);
+ assert.htmlEqual(target.innerHTML, `
+ Mutate a
+ {"foo":42}
+ `);
+ }
+};
diff --git a/test/runtime/samples/reactive-value-mutate-const/main.svelte b/test/runtime/samples/reactive-value-mutate-const/main.svelte
new file mode 100644
index 0000000000..403544e5f1
--- /dev/null
+++ b/test/runtime/samples/reactive-value-mutate-const/main.svelte
@@ -0,0 +1,9 @@
+
+
+ a.foo = 42}>Mutate a
+{JSON.stringify(b)}
+
diff --git a/test/runtime/samples/spring/_config.js b/test/runtime/samples/spring/_config.js
new file mode 100644
index 0000000000..49367ce08b
--- /dev/null
+++ b/test/runtime/samples/spring/_config.js
@@ -0,0 +1,3 @@
+export default {
+ html: `0
`
+};
diff --git a/test/runtime/samples/spring/main.svelte b/test/runtime/samples/spring/main.svelte
new file mode 100644
index 0000000000..39c9afde1d
--- /dev/null
+++ b/test/runtime/samples/spring/main.svelte
@@ -0,0 +1,8 @@
+
+
+{$x}
\ No newline at end of file
diff --git a/test/runtime/samples/store-assignment-updates-reactive/_config.js b/test/runtime/samples/store-assignment-updates-reactive/_config.js
index a7439bde5c..e81b3bb180 100644
--- a/test/runtime/samples/store-assignment-updates-reactive/_config.js
+++ b/test/runtime/samples/store-assignment-updates-reactive/_config.js
@@ -1,4 +1,4 @@
-import { writable } from '../../../../store.js';
+import { writable } from '../../../../store';
const c = writable(0);
diff --git a/test/runtime/samples/store-assignment-updates-reactive/main.svelte b/test/runtime/samples/store-assignment-updates-reactive/main.svelte
index 18ec3bd7a7..9975ea87b8 100644
--- a/test/runtime/samples/store-assignment-updates-reactive/main.svelte
+++ b/test/runtime/samples/store-assignment-updates-reactive/main.svelte
@@ -1,5 +1,5 @@
+
+{status}
+
+{#each things as thing}
+ {#if visible}
+ {thing}
+ {/if}
+{/each}
\ No newline at end of file
diff --git a/test/server-side-rendering/index.js b/test/server-side-rendering/index.js
index 6a546b0b7b..cf6e5ad964 100644
--- a/test/server-side-rendering/index.js
+++ b/test/server-side-rendering/index.js
@@ -1,7 +1,6 @@
import * as assert from "assert";
import * as fs from "fs";
import * as path from "path";
-import * as glob from 'tiny-glob/sync.js';
import {
showOutput,
@@ -96,10 +95,13 @@ describe("ssr", () => {
(config.skip ? it.skip : config.solo ? it.only : it)(dir, () => {
const cwd = path.resolve("test/runtime/samples", dir);
- glob('**/*.svelte', { cwd: `test/runtime/samples/${dir}` }).forEach(file => {
- const resolved = require.resolve(`../runtime/samples/${dir}/${file}`);
- delete require.cache[resolved];
- });
+ Object.keys(require.cache)
+ .filter(x => x.endsWith('.svelte'))
+ .forEach(file => {
+ delete require.cache[file];
+ });
+
+ delete global.window;
const compileOptions = Object.assign({ sveltePath }, config.compileOptions, {
generate: 'ssr'
diff --git a/test/server-side-rendering/samples/bindings-readonly/_expected.html b/test/server-side-rendering/samples/bindings-readonly/_expected.html
new file mode 100644
index 0000000000..af678acde0
--- /dev/null
+++ b/test/server-side-rendering/samples/bindings-readonly/_expected.html
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/test/server-side-rendering/samples/bindings-readonly/main.svelte b/test/server-side-rendering/samples/bindings-readonly/main.svelte
new file mode 100644
index 0000000000..3ff98a3ead
--- /dev/null
+++ b/test/server-side-rendering/samples/bindings-readonly/main.svelte
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
diff --git a/test/server-side-rendering/samples/text-area-bind/_expected.html b/test/server-side-rendering/samples/text-area-bind/_expected.html
new file mode 100644
index 0000000000..c3c8441f56
--- /dev/null
+++ b/test/server-side-rendering/samples/text-area-bind/_expected.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/server-side-rendering/samples/text-area-bind/main.svelte b/test/server-side-rendering/samples/text-area-bind/main.svelte
new file mode 100644
index 0000000000..7126e09375
--- /dev/null
+++ b/test/server-side-rendering/samples/text-area-bind/main.svelte
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/test/setup.js b/test/setup.js
index 8bb73d81d0..7406a07dd9 100644
--- a/test/setup.js
+++ b/test/setup.js
@@ -7,7 +7,7 @@ process.env.TEST = true;
require.extensions['.js'] = function(module, filename) {
const exports = [];
- var code = fs.readFileSync(filename, 'utf-8')
+ let code = fs.readFileSync(filename, 'utf-8')
.replace(/^import \* as (\w+) from ['"]([^'"]+)['"];?/gm, 'var $1 = require("$2");')
.replace(/^import (\w+) from ['"]([^'"]+)['"];?/gm, 'var {default: $1} = require("$2");')
.replace(/^import {([^}]+)} from ['"](.+)['"];?/gm, 'var {$1} = require("$2");')
@@ -35,4 +35,4 @@ require.extensions['.js'] = function(module, filename) {
console.log(code); // eslint-disable-line no-console
throw err;
}
-};
\ No newline at end of file
+};
diff --git a/test/sourcemaps/index.js b/test/sourcemaps/index.js
index 79028719b9..ee169ebe1b 100644
--- a/test/sourcemaps/index.js
+++ b/test/sourcemaps/index.js
@@ -1,7 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as assert from "assert";
-import { loadConfig, svelte } from "../helpers.js";
+import { svelte } from "../helpers.js";
import { SourceMapConsumer } from "source-map";
import { getLocator } from "locate-character";
@@ -18,8 +18,6 @@ describe("sourcemaps", () => {
}
(solo ? it.only : skip ? it.skip : it)(dir, () => {
- const config = loadConfig(`./sourcemaps/samples/${dir}/_config.js`);
-
const filename = path.resolve(
`test/sourcemaps/samples/${dir}/input.svelte`
);
diff --git a/test/store/index.js b/test/store/index.ts
similarity index 65%
rename from test/store/index.js
rename to test/store/index.ts
index 44617d6d00..bb999f1220 100644
--- a/test/store/index.js
+++ b/test/store/index.ts
@@ -1,5 +1,5 @@
import * as assert from 'assert';
-import { readable, writable, derived, get } from '../../store.js';
+import { readable, writable, derived, get } from '../../store';
describe('store', () => {
describe('writable', () => {
@@ -30,10 +30,10 @@ describe('store', () => {
return () => called -= 1;
});
- const unsubscribe1 = store.subscribe(() => {});
+ const unsubscribe1 = store.subscribe(() => { });
assert.equal(called, 1);
- const unsubscribe2 = store.subscribe(() => {});
+ const unsubscribe2 = store.subscribe(() => { });
assert.equal(called, 1);
unsubscribe1();
@@ -49,7 +49,7 @@ describe('store', () => {
const store = writable(obj);
- store.subscribe(value => {
+ store.subscribe(() => {
called += 1;
});
@@ -73,7 +73,7 @@ describe('store', () => {
set(0);
return () => {
- tick = () => {};
+ tick = () => { };
running = false;
};
});
@@ -189,6 +189,34 @@ describe('store', () => {
unsubscribe();
});
+ it('prevents diamond dependency problem', () => {
+ const count = writable(0);
+ const values = [];
+
+ const a = derived(count, $count => {
+ return 'a' + $count;
+ });
+
+ const b = derived(count, $count => {
+ return 'b' + $count;
+ });
+
+ const combined = derived([a, b], ([a, b]) => {
+ return a + b;
+ });
+
+ const unsubscribe = combined.subscribe(v => {
+ values.push(v);
+ });
+
+ assert.deepEqual(values, ['a0b0']);
+
+ count.set(1);
+ assert.deepEqual(values, ['a0b0', 'a1b1']);
+
+ unsubscribe();
+ });
+
it('is updated with safe_not_equal logic', () => {
const arr = [0];
@@ -211,11 +239,78 @@ describe('store', () => {
unsubscribe();
});
+
+ it('calls a cleanup function', () => {
+ const num = writable(1);
+
+ const values = [];
+ const cleaned_up = [];
+
+ const d = derived(num, ($num, set) => {
+ set($num * 2);
+
+ return function cleanup() {
+ cleaned_up.push($num);
+ };
+ });
+
+ num.set(2);
+
+ const unsubscribe = d.subscribe(value => {
+ values.push(value);
+ });
+
+ num.set(3);
+ num.set(4);
+
+ assert.deepEqual(values, [4, 6, 8]);
+ assert.deepEqual(cleaned_up, [2, 3]);
+
+ unsubscribe();
+
+ assert.deepEqual(cleaned_up, [2, 3, 4]);
+ });
+
+ it('discards non-function return values', () => {
+ const num = writable(1);
+
+ const values = [];
+
+ const d = derived(num, ($num, set) => {
+ set($num * 2);
+ return {};
+ });
+
+ num.set(2);
+
+ const unsubscribe = d.subscribe(value => {
+ values.push(value);
+ });
+
+ num.set(3);
+ num.set(4);
+
+ assert.deepEqual(values, [4, 6, 8]);
+
+ unsubscribe();
+ });
+
+ it('allows derived with different types', () => {
+ const a = writable('one');
+ const b = writable(1);
+ const c = derived([a, b], ([a, b]) => `${a} ${b}`);
+
+ assert.deepEqual(get(c), 'one 1');
+
+ a.set('two');
+ b.set(2);
+ assert.deepEqual(get(c), 'two 2');
+ });
});
describe('get', () => {
it('gets the current value of a store', () => {
- const store = readable(42, () => {});
+ const store = readable(42, () => { });
assert.equal(get(store), 42);
});
});
diff --git a/test/test.js b/test/test.js
index 993b1f637c..7759941dbb 100644
--- a/test/test.js
+++ b/test/test.js
@@ -2,6 +2,6 @@ const glob = require("tiny-glob/sync.js");
require("./setup");
-glob("*/index.js", { cwd: "test" }).forEach(function(file) {
+glob("*/index.{js,ts}", { cwd: "test" }).forEach((file) => {
require("./" + file);
-});
\ No newline at end of file
+});
diff --git a/test/validator/index.js b/test/validator/index.js
index b26b087bb3..1e54cc20db 100644
--- a/test/validator/index.js
+++ b/test/validator/index.js
@@ -24,7 +24,7 @@ describe("validate", () => {
let error;
try {
- let { warnings } = svelte.compile(input, {
+ const { warnings } = svelte.compile(input, {
dev: config.dev,
legacy: config.legacy,
generate: false
@@ -59,7 +59,7 @@ describe("validate", () => {
assert.deepEqual(error.end, expected.end);
assert.equal(error.pos, expected.pos);
} catch (e) {
- console.error(error)
+ console.error(error); // eslint-disable-line no-console
throw e;
}
}
diff --git a/test/validator/samples/attribute-expected-equals/errors.json b/test/validator/samples/attribute-expected-equals/errors.json
new file mode 100644
index 0000000000..a3fa9d3cac
--- /dev/null
+++ b/test/validator/samples/attribute-expected-equals/errors.json
@@ -0,0 +1,15 @@
+[{
+ "code": "unexpected-token",
+ "message": "Expected =",
+ "start": {
+ "line": 5,
+ "column": 9,
+ "character": 50
+ },
+ "end": {
+ "line": 5,
+ "column": 9,
+ "character": 50
+ },
+ "pos": 50
+}]
diff --git a/test/validator/samples/attribute-expected-equals/input.svelte b/test/validator/samples/attribute-expected-equals/input.svelte
new file mode 100644
index 0000000000..91f4b0ca7b
--- /dev/null
+++ b/test/validator/samples/attribute-expected-equals/input.svelte
@@ -0,0 +1,5 @@
+
+
+Hello {name}!
diff --git a/test/validator/samples/component-namespaced/input.svelte b/test/validator/samples/component-namespaced/input.svelte
new file mode 100644
index 0000000000..996d2d8769
--- /dev/null
+++ b/test/validator/samples/component-namespaced/input.svelte
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/test/validator/samples/component-namespaced/warnings.json b/test/validator/samples/component-namespaced/warnings.json
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/test/validator/samples/component-namespaced/warnings.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/test/vars/samples/component-namespaced/_config.js b/test/vars/samples/component-namespaced/_config.js
new file mode 100644
index 0000000000..ac63873967
--- /dev/null
+++ b/test/vars/samples/component-namespaced/_config.js
@@ -0,0 +1,16 @@
+export default {
+ test(assert, vars) {
+ assert.deepEqual(vars, [
+ {
+ name: 'NS',
+ export_name: null,
+ injected: false,
+ module: false,
+ mutated: false,
+ reassigned: false,
+ referenced: true,
+ writable: false
+ }
+ ]);
+ }
+};
\ No newline at end of file
diff --git a/test/vars/samples/component-namespaced/input.svelte b/test/vars/samples/component-namespaced/input.svelte
new file mode 100644
index 0000000000..996d2d8769
--- /dev/null
+++ b/test/vars/samples/component-namespaced/input.svelte
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index fdb7367e05..07bc24acaf 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,18 +1,33 @@
{
- "compilerOptions": {
- "target": "ES6",
- "diagnostics": true,
- "noImplicitThis": true,
- "noEmitOnError": true,
- "allowJs": true,
- "lib": ["es5", "es6", "dom"],
- "importHelpers": true,
- "moduleResolution": "node"
- },
- "include": [
- "src"
- ],
- "exclude": [
- "node_modules"
- ]
+ "compilerOptions": {
+ "target": "es2015",
+ "module": "es6",
+ "declaration": true,
+ "declarationDir": "types",
+ "noImplicitThis": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noEmitOnError": true,
+ "lib": [
+ "es5",
+ "es6",
+ "dom",
+ "es2015"
+ ],
+ "importHelpers": true,
+ "moduleResolution": "node",
+ "baseUrl": ".",
+ "paths": {
+ "svelte/internal": ["./src/runtime/internal/index"],
+ "svelte/easing": ["./src/runtime/easing/index"],
+ "svelte/motion": ["./src/runtime/motion/index"],
+ "svelte/store": ["./src/runtime/store/index"]
+ },
+ "typeRoots": [
+ "node_modules/@types"
+ ]
+ },
+ "include": [
+ "src/**/*"
+ ]
}