From e79e077b401f79f4bb609341e540532ffff4a5ec Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Wed, 16 May 2018 23:40:42 -0700 Subject: [PATCH 01/35] cross-platform test setup via shelljs My attempt at solving https://github.com/sveltejs/svelte/issues/1478 --- package.json | 1 + test/cli/index.js | 80 ++++++++++---------- test/cli/samples/basic/command.sh | 2 +- test/cli/samples/custom-element/command.sh | 2 +- test/cli/samples/dev/command.sh | 2 +- test/cli/samples/dir-sourcemap/command.sh | 2 +- test/cli/samples/dir-subdir/command.sh | 2 +- test/cli/samples/dir/command.sh | 2 +- test/cli/samples/globals/command.sh | 2 +- test/cli/samples/sourcemap-inline/command.sh | 2 +- test/cli/samples/sourcemap/command.sh | 2 +- test/cli/samples/ssr/command.sh | 2 +- test/cli/samples/store/command.sh | 2 +- 13 files changed, 51 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 0e8cfe1880..36716012da 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "rollup-watch": "^4.3.1", "sade": "^1.4.0", "sander": "^0.6.0", + "shelljs": "^0.8.2", "source-map": "0.6", "source-map-support": "^0.5.4", "tiny-glob": "^0.2.1", diff --git a/test/cli/index.js b/test/cli/index.js index 816bc3301e..ed29bb84d0 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -1,10 +1,10 @@ const fs = require('fs'); const path = require('path'); -const child_process = require('child_process'); const assert = require('assert'); const glob = require('tiny-glob/sync.js'); +const shell = require("shelljs"); -const bin = path.resolve(`svelte`); +const cli = path.resolve(__dirname, "../../cli/index.ts.js"); function normalize(str) { return str @@ -31,49 +31,47 @@ describe('cli', () => { const command = fs.readFileSync('command.sh', 'utf-8'); - child_process.exec(` - alias svelte=${bin} - mkdir -p actual - rm -rf actual/* - ${command} - `, (err, stdout, stderr) => { - if (err) { - done(err); - return; - } + shell.mkdir("-p", "actual"); + shell.rm("-rf", "actual/*"); + const { commandErr } = shell.exec(`node ${cli} ${command}`); + + if (commandErr) { + done(commandErr); + return; + } + + const actual = glob('**', { cwd: 'actual', filesOnly: true }) + .map(file => { + return { + file, + contents: normalize(fs.readFileSync(`actual/${file}`, 'utf-8')) + }; + }); - const actual = glob('**', { cwd: 'actual', filesOnly: true }) - .map(file => { - return { - file, - contents: normalize(fs.readFileSync(`actual/${file}`, 'utf-8')) - }; - }); - - const expected = glob('**', { cwd: 'expected', filesOnly: true }) - .map(file => { - return { - file, - contents: normalize( - fs.readFileSync(`expected/${file}`, 'utf-8') - ) - }; - }); - - actual.forEach((a, i) => { - const e = expected[i]; - - assert.equal(a.file, e.file, 'File list mismatch'); - - if (/\.map$/.test(a.file)) { - assert.deepEqual(JSON.parse(a.contents), JSON.parse(e.contents)); - } else { - assert.equal(a.contents, e.contents); - } + const expected = glob('**', { cwd: 'expected', filesOnly: true }) + .map(file => { + return { + file, + contents: normalize( + fs.readFileSync(`expected/${file}`, 'utf-8') + ) + }; }); - done(); + actual.forEach((a, i) => { + const e = expected[i]; + + assert.equal(a.file, e.file, 'File list mismatch'); + + if (/\.map$/.test(a.file)) { + assert.deepEqual(JSON.parse(a.contents), JSON.parse(e.contents)); + } else { + assert.equal(a.contents, e.contents); + } }); + + done(); + // }); }); }); }); diff --git a/test/cli/samples/basic/command.sh b/test/cli/samples/basic/command.sh index 0ae80e4c95..7a5e0e4892 100644 --- a/test/cli/samples/basic/command.sh +++ b/test/cli/samples/basic/command.sh @@ -1 +1 @@ -svelte compile src/Main.html > actual/Main.js +compile src/Main.html > actual/Main.js diff --git a/test/cli/samples/custom-element/command.sh b/test/cli/samples/custom-element/command.sh index b93c2cb16a..f638d82a80 100644 --- a/test/cli/samples/custom-element/command.sh +++ b/test/cli/samples/custom-element/command.sh @@ -1 +1 @@ -svelte compile src/Main.html --customElement > actual/Main.js +compile src/Main.html --customElement > actual/Main.js diff --git a/test/cli/samples/dev/command.sh b/test/cli/samples/dev/command.sh index 37d9b87fc0..aac44940ff 100644 --- a/test/cli/samples/dev/command.sh +++ b/test/cli/samples/dev/command.sh @@ -1 +1 @@ -svelte compile src/Main.html -d > actual/Main.js \ No newline at end of file +compile src/Main.html -d > actual/Main.js diff --git a/test/cli/samples/dir-sourcemap/command.sh b/test/cli/samples/dir-sourcemap/command.sh index 37089f3f44..f914d1d591 100644 --- a/test/cli/samples/dir-sourcemap/command.sh +++ b/test/cli/samples/dir-sourcemap/command.sh @@ -1 +1 @@ -svelte compile src -m -o actual \ No newline at end of file +compile src -m -o actual diff --git a/test/cli/samples/dir-subdir/command.sh b/test/cli/samples/dir-subdir/command.sh index 10067cb1f9..c767d236bb 100644 --- a/test/cli/samples/dir-subdir/command.sh +++ b/test/cli/samples/dir-subdir/command.sh @@ -1 +1 @@ -svelte compile src -o actual \ No newline at end of file +compile src -o actual diff --git a/test/cli/samples/dir/command.sh b/test/cli/samples/dir/command.sh index 10067cb1f9..c767d236bb 100644 --- a/test/cli/samples/dir/command.sh +++ b/test/cli/samples/dir/command.sh @@ -1 +1 @@ -svelte compile src -o actual \ No newline at end of file +compile src -o actual diff --git a/test/cli/samples/globals/command.sh b/test/cli/samples/globals/command.sh index 9ed0c2a844..a37e9f856a 100644 --- a/test/cli/samples/globals/command.sh +++ b/test/cli/samples/globals/command.sh @@ -1 +1 @@ -svelte compile src/Main.html -f iife -g the-answer:theAnswer > actual/Main.js \ No newline at end of file +compile src/Main.html -f iife -g the-answer:theAnswer > actual/Main.js diff --git a/test/cli/samples/sourcemap-inline/command.sh b/test/cli/samples/sourcemap-inline/command.sh index 36b5b71b8d..df0c2f9afe 100644 --- a/test/cli/samples/sourcemap-inline/command.sh +++ b/test/cli/samples/sourcemap-inline/command.sh @@ -1 +1 @@ -svelte compile src/Main.html -m inline -o actual/Main.js \ No newline at end of file +compile src/Main.html -m inline -o actual/Main.js diff --git a/test/cli/samples/sourcemap/command.sh b/test/cli/samples/sourcemap/command.sh index 4309d50b89..9e957c28fc 100644 --- a/test/cli/samples/sourcemap/command.sh +++ b/test/cli/samples/sourcemap/command.sh @@ -1 +1 @@ -svelte compile src/Main.html -m -o actual/Main.js \ No newline at end of file +compile src/Main.html -m -o actual/Main.js diff --git a/test/cli/samples/ssr/command.sh b/test/cli/samples/ssr/command.sh index 30e155691a..ae8bc695f1 100644 --- a/test/cli/samples/ssr/command.sh +++ b/test/cli/samples/ssr/command.sh @@ -1 +1 @@ -svelte compile --generate ssr src/Main.html > actual/Main.js +compile --generate ssr src/Main.html > actual/Main.js diff --git a/test/cli/samples/store/command.sh b/test/cli/samples/store/command.sh index a734fdc772..ec919719d5 100644 --- a/test/cli/samples/store/command.sh +++ b/test/cli/samples/store/command.sh @@ -1 +1 @@ -svelte compile src/Main.html --store > actual/Main.js +compile src/Main.html --store > actual/Main.js From bd1884a953ab35d28f753a8dfd393d937da7295f Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 17 May 2018 14:13:48 -0400 Subject: [PATCH 02/35] update yarn.lock --- yarn.lock | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 77ac332dfc..643395e6e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1431,7 +1431,7 @@ glob@7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.2: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1699,6 +1699,10 @@ inquirer@^3.0.6: strip-ansi "^4.0.0" through "^2.3.6" +interpret@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" + invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -2978,6 +2982,12 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -3329,6 +3339,14 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" +shelljs@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.2.tgz#345b7df7763f4c2340d584abb532c5f752ca9e35" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + signal-exit@^3.0.0, signal-exit@^3.0.1, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" From 860a117f0eb60b048929b05bd8b639919899c739 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 17 May 2018 14:30:07 -0400 Subject: [PATCH 03/35] normalize paths in comments in cli tests --- test/cli/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/cli/index.js b/test/cli/index.js index ed29bb84d0..5ddb4eac10 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -9,7 +9,10 @@ const cli = path.resolve(__dirname, "../../cli/index.ts.js"); function normalize(str) { return str .replace(/^\s+$/gm, '') - .replace(/generated by Svelte v[.\d]+/, `generated by Svelte vx.y.z`) + .replace( + /\/\*(.*?)generated by Svelte v[.\d]+/, + (_, path) => `/*${path.replace(/\\/g, '/')}generated by Svelte vx.y.z` + ) .trim(); } From 5f156fd09c2aad62888080a0448def34671f76d0 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 17 May 2018 16:12:13 -0400 Subject: [PATCH 04/35] tidy, and revert changes to cli test sample commands --- test/cli/index.js | 5 +++-- test/cli/samples/basic/command.sh | 2 +- test/cli/samples/custom-element/command.sh | 2 +- test/cli/samples/dev/command.sh | 2 +- test/cli/samples/dir-sourcemap/command.sh | 2 +- test/cli/samples/dir-subdir/command.sh | 2 +- test/cli/samples/dir/command.sh | 2 +- test/cli/samples/globals/command.sh | 2 +- test/cli/samples/sourcemap-inline/command.sh | 2 +- test/cli/samples/sourcemap/command.sh | 2 +- test/cli/samples/ssr/command.sh | 2 +- test/cli/samples/store/command.sh | 2 +- 12 files changed, 14 insertions(+), 13 deletions(-) diff --git a/test/cli/index.js b/test/cli/index.js index 5ddb4eac10..bb17ec50c4 100644 --- a/test/cli/index.js +++ b/test/cli/index.js @@ -36,7 +36,9 @@ describe('cli', () => { shell.mkdir("-p", "actual"); shell.rm("-rf", "actual/*"); - const { commandErr } = shell.exec(`node ${cli} ${command}`); + const { commandErr } = shell.exec( + command.replace(/^svelte /, `node ${cli} `) + ); if (commandErr) { done(commandErr); @@ -74,7 +76,6 @@ describe('cli', () => { }); done(); - // }); }); }); }); diff --git a/test/cli/samples/basic/command.sh b/test/cli/samples/basic/command.sh index 7a5e0e4892..0ae80e4c95 100644 --- a/test/cli/samples/basic/command.sh +++ b/test/cli/samples/basic/command.sh @@ -1 +1 @@ -compile src/Main.html > actual/Main.js +svelte compile src/Main.html > actual/Main.js diff --git a/test/cli/samples/custom-element/command.sh b/test/cli/samples/custom-element/command.sh index f638d82a80..b93c2cb16a 100644 --- a/test/cli/samples/custom-element/command.sh +++ b/test/cli/samples/custom-element/command.sh @@ -1 +1 @@ -compile src/Main.html --customElement > actual/Main.js +svelte compile src/Main.html --customElement > actual/Main.js diff --git a/test/cli/samples/dev/command.sh b/test/cli/samples/dev/command.sh index aac44940ff..37d9b87fc0 100644 --- a/test/cli/samples/dev/command.sh +++ b/test/cli/samples/dev/command.sh @@ -1 +1 @@ -compile src/Main.html -d > actual/Main.js +svelte compile src/Main.html -d > actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/command.sh b/test/cli/samples/dir-sourcemap/command.sh index f914d1d591..37089f3f44 100644 --- a/test/cli/samples/dir-sourcemap/command.sh +++ b/test/cli/samples/dir-sourcemap/command.sh @@ -1 +1 @@ -compile src -m -o actual +svelte compile src -m -o actual \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/command.sh b/test/cli/samples/dir-subdir/command.sh index c767d236bb..10067cb1f9 100644 --- a/test/cli/samples/dir-subdir/command.sh +++ b/test/cli/samples/dir-subdir/command.sh @@ -1 +1 @@ -compile src -o actual +svelte compile src -o actual \ No newline at end of file diff --git a/test/cli/samples/dir/command.sh b/test/cli/samples/dir/command.sh index c767d236bb..10067cb1f9 100644 --- a/test/cli/samples/dir/command.sh +++ b/test/cli/samples/dir/command.sh @@ -1 +1 @@ -compile src -o actual +svelte compile src -o actual \ No newline at end of file diff --git a/test/cli/samples/globals/command.sh b/test/cli/samples/globals/command.sh index a37e9f856a..9ed0c2a844 100644 --- a/test/cli/samples/globals/command.sh +++ b/test/cli/samples/globals/command.sh @@ -1 +1 @@ -compile src/Main.html -f iife -g the-answer:theAnswer > actual/Main.js +svelte compile src/Main.html -f iife -g the-answer:theAnswer > actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/sourcemap-inline/command.sh b/test/cli/samples/sourcemap-inline/command.sh index df0c2f9afe..36b5b71b8d 100644 --- a/test/cli/samples/sourcemap-inline/command.sh +++ b/test/cli/samples/sourcemap-inline/command.sh @@ -1 +1 @@ -compile src/Main.html -m inline -o actual/Main.js +svelte compile src/Main.html -m inline -o actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/sourcemap/command.sh b/test/cli/samples/sourcemap/command.sh index 9e957c28fc..4309d50b89 100644 --- a/test/cli/samples/sourcemap/command.sh +++ b/test/cli/samples/sourcemap/command.sh @@ -1 +1 @@ -compile src/Main.html -m -o actual/Main.js +svelte compile src/Main.html -m -o actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/ssr/command.sh b/test/cli/samples/ssr/command.sh index ae8bc695f1..30e155691a 100644 --- a/test/cli/samples/ssr/command.sh +++ b/test/cli/samples/ssr/command.sh @@ -1 +1 @@ -compile --generate ssr src/Main.html > actual/Main.js +svelte compile --generate ssr src/Main.html > actual/Main.js diff --git a/test/cli/samples/store/command.sh b/test/cli/samples/store/command.sh index ec919719d5..a734fdc772 100644 --- a/test/cli/samples/store/command.sh +++ b/test/cli/samples/store/command.sh @@ -1 +1 @@ -compile src/Main.html --store > actual/Main.js +svelte compile src/Main.html --store > actual/Main.js From b57be7664e6357c278ae713ea2832e561f4f2143 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 24 May 2018 08:32:37 -0400 Subject: [PATCH 05/35] fix dynamic component bindings (#1489) --- src/compile/nodes/Component.ts | 20 +++++++---- .../Green.html | 11 ++++++ .../Red.html | 11 ++++++ .../_config.js | 36 +++++++++++++++++++ .../main.html | 16 +++++++++ 5 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 test/runtime/samples/dynamic-component-bindings-recreated-b/Green.html create mode 100644 test/runtime/samples/dynamic-component-bindings-recreated-b/Red.html create mode 100644 test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js create mode 100644 test/runtime/samples/dynamic-component-bindings-recreated-b/main.html diff --git a/src/compile/nodes/Component.ts b/src/compile/nodes/Component.ts index a782ca34db..8bb5537856 100644 --- a/src/compile/nodes/Component.ts +++ b/src/compile/nodes/Component.ts @@ -290,7 +290,7 @@ export default class Component extends Node { } statements.push(deindent` - if (${binding.prop} in ${binding.obj}) { + if (${binding.value.snippet} !== void 0) { ${name_initial_data}.${binding.name} = ${binding.value.snippet}; ${name_updating}.${binding.name} = true; }` @@ -304,7 +304,7 @@ export default class Component extends Node { updates.push(deindent` if (!${name_updating}.${binding.name} && ${[...binding.value.dependencies].map((dependency: string) => `changed.${dependency}`).join(' || ')}) { ${name_changes}.${binding.name} = ${binding.value.snippet}; - ${name_updating}.${binding.name} = true; + ${name_updating}.${binding.name} = ${binding.value.snippet} !== void 0; } `); }); @@ -318,7 +318,7 @@ export default class Component extends Node { // TODO use component.on('state', ...) instead of _bind componentInitProperties.push(deindent` - _bind: function(changed, childState) { + _bind(changed, childState) { var ${initialisers}; ${builder} ${hasStoreBindings && `#component.store.set(newStoreState);`} @@ -328,7 +328,7 @@ export default class Component extends Node { `); beforecreate = deindent` - #component.root._beforecreate.push(function() { + #component.root._beforecreate.push(() => { ${name}._bind({ ${this.bindings.map(b => `${b.name}: 1`).join(', ')} }, ${name}.get()); }); `; @@ -406,6 +406,14 @@ export default class Component extends Node { if (${switch_value}) { ${name} = new ${switch_value}(${switch_props}(ctx)); + + ${this.bindings.length > 0 && deindent` + #component.root._beforecreate.push(() => { + const changed = {}; + ${this.bindings.map(binding => deindent` + if (${binding.value.snippet} === void 0) changed.${binding.name} = 1;`)} + ${name}._bind(changed, ${name}.get()); + });`} ${name}._fragment.c(); ${this.children.map(child => child.remount(name))} @@ -554,8 +562,8 @@ export default class Component extends Node { const expression = ( this.name === 'svelte:self' ? this.compiler.name : - isDynamicComponent ? `((${this.expression.snippet}) || @missingComponent)` : - `%components-${this.name}` + (isDynamicComponent ? `((${this.expression.snippet}) || @missingComponent)` : + `%components-${this.name}`) ); this.bindings.forEach(binding => { diff --git a/test/runtime/samples/dynamic-component-bindings-recreated-b/Green.html b/test/runtime/samples/dynamic-component-bindings-recreated-b/Green.html new file mode 100644 index 0000000000..cb1506bfdb --- /dev/null +++ b/test/runtime/samples/dynamic-component-bindings-recreated-b/Green.html @@ -0,0 +1,11 @@ +

green {foo}

+ + \ No newline at end of file diff --git a/test/runtime/samples/dynamic-component-bindings-recreated-b/Red.html b/test/runtime/samples/dynamic-component-bindings-recreated-b/Red.html new file mode 100644 index 0000000000..e86ea16182 --- /dev/null +++ b/test/runtime/samples/dynamic-component-bindings-recreated-b/Red.html @@ -0,0 +1,11 @@ +

red {foo}

+ + \ No newline at end of file diff --git a/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js b/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js new file mode 100644 index 0000000000..050dff684f --- /dev/null +++ b/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js @@ -0,0 +1,36 @@ +export default { + data: { + x: true + }, + + html: ` +

parent green

+

green green

+ `, + + test(assert, component, target) { + // TODO replace this with component.set({ foo: undefined }) post-#1488 + // component.set({ foo: undefined }); + // delete component._state.foo; + + component.set({ + x: false, + foo: undefined + }); + + assert.htmlEqual(target.innerHTML, ` +

parent red

+

red red

+ `); + + component.set({ + x: true, + foo: undefined + }); + + assert.htmlEqual(target.innerHTML, ` +

parent green

+

green green

+ `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/dynamic-component-bindings-recreated-b/main.html b/test/runtime/samples/dynamic-component-bindings-recreated-b/main.html new file mode 100644 index 0000000000..41a54e8ee9 --- /dev/null +++ b/test/runtime/samples/dynamic-component-bindings-recreated-b/main.html @@ -0,0 +1,16 @@ +

parent {foo}

+ + + \ No newline at end of file From d9999bc5365453b2c946a0a7006f9f054aa6765b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 24 May 2018 17:26:52 -0400 Subject: [PATCH 06/35] replace window with self - fixes #1487 --- src/Stats.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stats.ts b/src/Stats.ts index 6faca18e75..613064f987 100644 --- a/src/Stats.ts +++ b/src/Stats.ts @@ -6,7 +6,7 @@ const now = (typeof process !== 'undefined' && process.hrtime) const t = process.hrtime(); return t[0] * 1e3 + t[1] / 1e6; } - : () => window.performance.now(); + : () => self.performance.now(); type Timing = { label: string; From 9e52cf931da6078c9e34803d1be971632b82f6cf Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 24 May 2018 17:48:38 -0400 Subject: [PATCH 07/35] -> v2.6.4 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd5a52c0ae..3afecdf6fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Svelte changelog +## 2.6.4 + +* Web worker support ([#1487](https://github.com/sveltejs/svelte/issues/1487)) +* Update dynamic component bindings when component changes ([#1489](https://github.com/sveltejs/svelte/issues/1489)) + ## 2.6.3 * Nested transitions respect `skipIntroByDefault` ([#1460](https://github.com/sveltejs/svelte/issues/1460)) diff --git a/package.json b/package.json index 36716012da..ab894f553b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.6.3", + "version": "2.6.4", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From 15efef9a989616d894e6a4d6158562b603c43deb Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 24 May 2018 23:42:11 -0400 Subject: [PATCH 08/35] separate hasOutros from hasOutroMethod - fixes #1492 --- src/compile/dom/Block.ts | 8 +++++--- src/compile/nodes/Attribute.ts | 4 ++-- src/compile/nodes/AwaitBlock.ts | 4 ++-- src/compile/nodes/EachBlock.ts | 12 +++++------ src/compile/nodes/IfBlock.ts | 12 +++++------ src/compile/nodes/Title.ts | 2 +- src/compile/nodes/shared/Tag.ts | 2 +- src/parse/read/directives.ts | 2 +- .../if-block-else-partial-outro/Foo.html | 1 + .../if-block-else-partial-outro/_config.js | 19 ++++++++++++++++++ .../if-block-else-partial-outro/main.html | 20 +++++++++++++++++++ 11 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 test/runtime/samples/if-block-else-partial-outro/Foo.html create mode 100644 test/runtime/samples/if-block-else-partial-outro/_config.js create mode 100644 test/runtime/samples/if-block-else-partial-outro/main.html diff --git a/src/compile/dom/Block.ts b/src/compile/dom/Block.ts index a6cf1e75d2..6b753ed1aa 100644 --- a/src/compile/dom/Block.ts +++ b/src/compile/dom/Block.ts @@ -44,7 +44,9 @@ export default class Block { maintainContext: boolean; hasAnimation: boolean; - hasIntroMethod: boolean; + hasIntros: boolean; + hasOutros: boolean; + hasIntroMethod: boolean; // could have the method without the transition, due to siblings hasOutroMethod: boolean; outros: number; @@ -127,11 +129,11 @@ export default class Block { } addIntro() { - this.hasIntroMethod = this.compiler.target.hasIntroTransitions = true; + this.hasIntros = this.hasIntroMethod = this.compiler.target.hasIntroTransitions = true; } addOutro() { - this.hasOutroMethod = this.compiler.target.hasOutroTransitions = true; + this.hasOutros = this.hasOutroMethod = this.compiler.target.hasOutroTransitions = true; this.outros += 1; } diff --git a/src/compile/nodes/Attribute.ts b/src/compile/nodes/Attribute.ts index b933ca2e7c..ac1cbeda6c 100644 --- a/src/compile/nodes/Attribute.ts +++ b/src/compile/nodes/Attribute.ts @@ -232,7 +232,7 @@ export default class Attribute extends Node { if (this.dependencies.size || isSelectValueAttribute) { const dependencies = Array.from(this.dependencies); const changedCheck = ( - ( block.hasOutroMethod ? `#outroing || ` : '' ) + + ( block.hasOutros ? `#outroing || ` : '' ) + dependencies.map(dependency => `changed.${dependency}`).join(' || ') ); @@ -308,7 +308,7 @@ export default class Attribute extends Node { if (propDependencies.size) { const dependencies = Array.from(propDependencies); const condition = ( - (block.hasOutroMethod ? `#outroing || ` : '') + + (block.hasOutros ? `#outroing || ` : '') + dependencies.map(dependency => `changed.${dependency}`).join(' || ') ); diff --git a/src/compile/nodes/AwaitBlock.ts b/src/compile/nodes/AwaitBlock.ts index 9a8aa51020..882a27885f 100644 --- a/src/compile/nodes/AwaitBlock.ts +++ b/src/compile/nodes/AwaitBlock.ts @@ -61,8 +61,8 @@ export default class AwaitBlock extends Node { block.addDependencies(child.block.dependencies); } - if (child.block.hasIntroMethod) hasIntros = true; - if (child.block.hasOutroMethod) hasOutros = true; + if (child.block.hasIntros) hasIntros = true; + if (child.block.hasOutros) hasOutros = true; }); this.pending.block.hasUpdateMethod = isDynamic; diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts index 70ce3ab218..720161971d 100644 --- a/src/compile/nodes/EachBlock.ts +++ b/src/compile/nodes/EachBlock.ts @@ -119,7 +119,7 @@ export default class EachBlock extends Node { this.else.block.hasUpdateMethod = this.else.block.dependencies.size > 0; } - if (this.block.hasOutroMethod || (this.else && this.else.block.hasOutroMethod)) { + if (this.block.hasOutros || (this.else && this.else.block.hasOutros)) { block.addOutro(); } } @@ -317,14 +317,14 @@ export default class EachBlock extends Node { const rects = block.getUniqueName('rects'); const destroy = this.block.hasAnimation ? `@fixAndOutroAndDestroyBlock` - : this.block.hasOutroMethod + : this.block.hasOutros ? `@outroAndDestroyBlock` : `@destroyBlock`; block.builders.update.addBlock(deindent` const ${this.each_block_value} = ${snippet}; - ${this.block.hasOutroMethod && `@transitionManager.groupOutros();`} + ${this.block.hasOutros && `@transitionManager.groupOutros();`} ${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].r();`} ${blocks} = @updateKeyedEach(${blocks}, #component, changed, ${get_key}, ${dynamic ? '1' : '0'}, ctx, ${this.each_block_value}, ${lookup}, ${updateMountNode}, ${destroy}, ${create_each_block}, "${mountOrIntro}", ${anchor}, ${this.get_each_context}); ${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].a();`} @@ -393,7 +393,7 @@ export default class EachBlock extends Node { allDependencies.add(dependency); }); - const outro = this.block.hasOutroMethod && block.getUniqueName('outro') + const outro = this.block.hasOutros && block.getUniqueName('outro') if (outro) { block.builders.init.addBlock(deindent` function ${outro}(i, detach, fn) { @@ -415,7 +415,7 @@ export default class EachBlock extends Node { if (condition !== '') { const forLoopBody = this.block.hasUpdateMethod - ? (this.block.hasIntroMethod || this.block.hasOutroMethod) + ? (this.block.hasIntros || this.block.hasOutros) ? deindent` if (${iterations}[#i]) { ${iterations}[#i].p(changed, child_ctx); @@ -444,7 +444,7 @@ export default class EachBlock extends Node { let destroy; - if (this.block.hasOutroMethod) { + if (this.block.hasOutros) { destroy = deindent` @transitionManager.groupOutros(); for (; #i < ${iterations}.length; #i += 1) ${outro}(#i, 1); diff --git a/src/compile/nodes/IfBlock.ts b/src/compile/nodes/IfBlock.ts index 87727e5b9e..3ecab77f43 100644 --- a/src/compile/nodes/IfBlock.ts +++ b/src/compile/nodes/IfBlock.ts @@ -68,8 +68,8 @@ export default class IfBlock extends Node { block.addDependencies(node.block.dependencies); } - if (node.block.hasIntroMethod) hasIntros = true; - if (node.block.hasOutroMethod) hasOutros = true; + if (node.block.hasIntros) hasIntros = true; + if (node.block.hasOutros) hasOutros = true; if (isElseIf(node.else)) { attachBlocks(node.else.children[0]); @@ -302,8 +302,8 @@ export default class IfBlock extends Node { const destroyOldBlock = deindent` @transitionManager.groupOutros(); ${name}.o(function() { - ${if_blocks}[ ${previous_block_index} ].d(1); - ${if_blocks}[ ${previous_block_index} ] = null; + ${if_blocks}[${previous_block_index}].d(1); + ${if_blocks}[${previous_block_index}] = null; }); `; @@ -355,9 +355,7 @@ export default class IfBlock extends Node { } block.builders.destroy.addLine(deindent` - ${if_current_block_type_index}{ - ${if_blocks}[${current_block_type_index}].d(${parentNode ? '' : 'detach'}); - } + ${if_current_block_type_index}${if_blocks}[${current_block_type_index}].d(${parentNode ? '' : 'detach'}); `); } diff --git a/src/compile/nodes/Title.ts b/src/compile/nodes/Title.ts index f2c8eb2a62..b6029312f4 100644 --- a/src/compile/nodes/Title.ts +++ b/src/compile/nodes/Title.ts @@ -81,7 +81,7 @@ export default class Title extends Node { if (allDependencies.size) { const dependencies = Array.from(allDependencies); const changedCheck = ( - ( block.hasOutroMethod ? `#outroing || ` : '' ) + + ( block.hasOutros ? `#outroing || ` : '' ) + dependencies.map(dependency => `changed.${dependency}`).join(' || ') ); diff --git a/src/compile/nodes/shared/Tag.ts b/src/compile/nodes/shared/Tag.ts index b3cc7cb0df..82b7123798 100644 --- a/src/compile/nodes/shared/Tag.ts +++ b/src/compile/nodes/shared/Tag.ts @@ -35,7 +35,7 @@ export default class Tag extends Node { if (dependencies.size) { const changedCheck = ( - (block.hasOutroMethod ? `#outroing || ` : '') + + (block.hasOutros ? `#outroing || ` : '') + [...dependencies].map((dependency: string) => `changed.${dependency}`).join(' || ') ); diff --git a/src/parse/read/directives.ts b/src/parse/read/directives.ts index feb668d25f..62a249a158 100644 --- a/src/parse/read/directives.ts +++ b/src/parse/read/directives.ts @@ -77,7 +77,7 @@ const DIRECTIVES: Record1 + `, + + nestedTransitions: true, + + test(assert, component, target) { + component.set({ x: 2 }); + assert.htmlEqual(target.innerHTML, ` + 2 + `); + }, +}; diff --git a/test/runtime/samples/if-block-else-partial-outro/main.html b/test/runtime/samples/if-block-else-partial-outro/main.html new file mode 100644 index 0000000000..9cb4408b73 --- /dev/null +++ b/test/runtime/samples/if-block-else-partial-outro/main.html @@ -0,0 +1,20 @@ +{#if y} + +{:else} + {x} +{/if} + + \ No newline at end of file From 2b3e9a35231f3c7cade06080d5a0921cfeb07c85 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 24 May 2018 23:55:11 -0400 Subject: [PATCH 09/35] use CSS classes for ref:* selectors (#1230) --- src/compile/nodes/Element.ts | 25 +++---------------- src/css/Selector.ts | 12 ++++----- src/css/Stylesheet.ts | 5 ++++ test/css/samples/refs-qualified/expected.css | 2 +- test/css/samples/refs-qualified/expected.html | 2 +- test/css/samples/refs/expected.css | 2 +- test/css/samples/refs/expected.html | 4 +-- 7 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index 34203d5c63..423134db07 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -300,13 +300,6 @@ export default class Element extends Node { block.builders.destroy.addConditional('detach', `@detachNode(${name});`); } - // TODO move this into a class as well? - if (this._cssRefAttribute) { - block.builders.hydrate.addLine( - `@setAttribute(${name}, "svelte-ref-${this._cssRefAttribute}", "");` - ) - } - // insert static children with textContent or innerHTML if (!this.namespace && this.canUseInnerHTML && this.children.length > 0) { if (this.children.length === 1 && this.children[0].type === 'Text') { @@ -394,10 +387,6 @@ export default class Element extends Node { let open = `<${node.name}`; - if (node._cssRefAttribute) { - open += ` svelte-ref-${node._cssRefAttribute}`; - } - node.attributes.forEach((attr: Node) => { open += ` ${fixAttributeCasing(attr.name)}${stringifyAttributeValue(attr.chunks)}` }); @@ -858,19 +847,17 @@ export default class Element extends Node { return `@appendNode(${this.var}, ${name}._slotted.default);`; } - addCssClass() { + addCssClass(className = this.compiler.stylesheet.id) { const classAttribute = this.attributes.find(a => a.name === 'class'); if (classAttribute && !classAttribute.isTrue) { if (classAttribute.chunks.length === 1 && classAttribute.chunks[0].type === 'Text') { - (classAttribute.chunks[0]).data += ` ${this.compiler.stylesheet.id}`; + (classAttribute.chunks[0]).data += ` ${className}`; } else { (classAttribute.chunks).push( new Text(this.compiler, this, this.scope, { type: 'Text', - data: ` ${this.compiler.stylesheet.id}` + data: ` ${className}` }) - - // new Text({ type: 'Text', data: ` ${this.compiler.stylesheet.id}` }) ); } } else { @@ -878,7 +865,7 @@ export default class Element extends Node { new Attribute(this.compiler, this, this.scope, { type: 'Attribute', name: 'class', - value: [{ type: 'Text', data: `${this.compiler.stylesheet.id}` }] + value: [{ type: 'Text', data: className }] }) ); } @@ -945,10 +932,6 @@ export default class Element extends Node { }); } - if (this._cssRefAttribute) { - openingTag += ` svelte-ref-${this._cssRefAttribute}`; - } - openingTag += '>'; compiler.target.append(openingTag); diff --git a/src/css/Selector.ts b/src/css/Selector.ts index 71e127edb3..8abb4353cd 100644 --- a/src/css/Selector.ts +++ b/src/css/Selector.ts @@ -30,7 +30,7 @@ export default class Selector { apply(node: Node, stack: Node[]) { const toEncapsulate: Node[] = []; - applySelector(this.localBlocks.slice(), node, stack.slice(), toEncapsulate); + applySelector(this.stylesheet, this.localBlocks.slice(), node, stack.slice(), toEncapsulate); if (toEncapsulate.length > 0) { toEncapsulate.filter((_, i) => i === 0 || i === toEncapsulate.length - 1).forEach(({ node, block }) => { @@ -76,7 +76,7 @@ export default class Selector { const selector = block.selectors[i]; if (selector.type === 'RefSelector') { - code.overwrite(selector.start, selector.end, `[svelte-ref-${selector.name}]`, { + code.overwrite(selector.start, selector.end, `.svelte-ref-${selector.name}`, { contentOnly: true, storeName: false }); @@ -136,7 +136,7 @@ function isDescendantSelector(selector: Node) { return selector.type === 'WhiteSpace' || selector.type === 'Combinator'; } -function applySelector(blocks: Block[], node: Node, stack: Node[], toEncapsulate: any[]): boolean { +function applySelector(stylesheet: Stylesheet, blocks: Block[], node: Node, stack: Node[], toEncapsulate: any[]): boolean { const block = blocks.pop(); if (!block) return false; @@ -179,7 +179,7 @@ function applySelector(blocks: Block[], node: Node, stack: Node[], toEncapsulate else if (selector.type === 'RefSelector') { if (node.ref === selector.name) { - node._cssRefAttribute = selector.name; + stylesheet.nodesWithRefCssClass.set(selector.name, node); toEncapsulate.push({ node, block }); return true; } @@ -196,7 +196,7 @@ function applySelector(blocks: Block[], node: Node, stack: Node[], toEncapsulate if (block.combinator) { if (block.combinator.type === 'WhiteSpace') { while (stack.length) { - if (applySelector(blocks.slice(), stack.pop(), stack, toEncapsulate)) { + if (applySelector(stylesheet, blocks.slice(), stack.pop(), stack, toEncapsulate)) { toEncapsulate.push({ node, block }); return true; } @@ -204,7 +204,7 @@ function applySelector(blocks: Block[], node: Node, stack: Node[], toEncapsulate return false; } else if (block.combinator.name === '>') { - if (applySelector(blocks, stack.pop(), stack, toEncapsulate)) { + if (applySelector(stylesheet, blocks, stack.pop(), stack, toEncapsulate)) { toEncapsulate.push({ node, block }); return true; } diff --git a/src/css/Stylesheet.ts b/src/css/Stylesheet.ts index 586599021b..70f19fd48b 100644 --- a/src/css/Stylesheet.ts +++ b/src/css/Stylesheet.ts @@ -247,6 +247,7 @@ export default class Stylesheet { keyframes: Map; nodesWithCssClass: Set; + nodesWithRefCssClass: Map; constructor(source: string, ast: Ast, filename: string, dev: boolean) { this.source = source; @@ -258,6 +259,7 @@ export default class Stylesheet { this.keyframes = new Map(); this.nodesWithCssClass = new Set(); + this.nodesWithRefCssClass = new Map(); if (ast.css && ast.css.children.length) { this.id = `svelte-${hash(ast.css.content.styles)}`; @@ -337,6 +339,9 @@ export default class Stylesheet { this.nodesWithCssClass.forEach((node: Node) => { node.addCssClass(); }); + this.nodesWithRefCssClass.forEach((node: Node, name: String) => { + node.addCssClass(`svelte-ref-${name}`); + }) } render(cssOutputFilename: string, shouldTransformSelectors: boolean) { diff --git a/test/css/samples/refs-qualified/expected.css b/test/css/samples/refs-qualified/expected.css index 90e58e2a80..9872b67fed 100644 --- a/test/css/samples/refs-qualified/expected.css +++ b/test/css/samples/refs-qualified/expected.css @@ -1 +1 @@ -[svelte-ref-button].active.svelte-xyz{color:red} \ No newline at end of file +.svelte-ref-button.active.svelte-xyz{color:red} \ No newline at end of file diff --git a/test/css/samples/refs-qualified/expected.html b/test/css/samples/refs-qualified/expected.html index 536bae83f8..06ddcc43ef 100644 --- a/test/css/samples/refs-qualified/expected.html +++ b/test/css/samples/refs-qualified/expected.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/test/css/samples/refs/expected.css b/test/css/samples/refs/expected.css index c0018c9593..2ab337cd2c 100644 --- a/test/css/samples/refs/expected.css +++ b/test/css/samples/refs/expected.css @@ -1 +1 @@ -[svelte-ref-a].svelte-xyz{color:red}[svelte-ref-b].svelte-xyz{color:green} \ No newline at end of file +.svelte-ref-a.svelte-xyz{color:red}.svelte-ref-b.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/refs/expected.html b/test/css/samples/refs/expected.html index 2b504628c3..bc892a94e1 100644 --- a/test/css/samples/refs/expected.html +++ b/test/css/samples/refs/expected.html @@ -1,3 +1,3 @@ -
-
+
+
\ No newline at end of file From 058f7ea43a94cd880d086457c72cab7a10463eec Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 25 May 2018 08:41:36 -0400 Subject: [PATCH 10/35] -> v2.6.5 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3afecdf6fa..e390575554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.6.5 + +* Handle cases where only some `if` block branches have outros ([#1492](https://github.com/sveltejs/svelte/issues/1492)) + ## 2.6.4 * Web worker support ([#1487](https://github.com/sveltejs/svelte/issues/1487)) diff --git a/package.json b/package.json index ab894f553b..3c195739b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.6.4", + "version": "2.6.5", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From ac7f591f60b92f699e061937c3835b18629f838e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 25 May 2018 16:34:34 -0400 Subject: [PATCH 11/35] fix #1497 --- src/compile/nodes/EachBlock.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts index 720161971d..89953ca19a 100644 --- a/src/compile/nodes/EachBlock.ts +++ b/src/compile/nodes/EachBlock.ts @@ -393,14 +393,16 @@ export default class EachBlock extends Node { allDependencies.add(dependency); }); - const outro = this.block.hasOutros && block.getUniqueName('outro') - if (outro) { + const outroBlock = this.block.hasOutros && block.getUniqueName('outroBlock') + if (outroBlock) { block.builders.init.addBlock(deindent` - function ${outro}(i, detach, fn) { + function ${outroBlock}(i, detach, fn) { if (${iterations}[i]) { ${iterations}[i].o(() => { - ${iterations}[i].d(detach); - if (detach) ${iterations}[i] = null; + if (detach) { + ${iterations}[i].d(detach); + ${iterations}[i] = null; + } if (fn) fn(); }); } @@ -447,7 +449,7 @@ export default class EachBlock extends Node { if (this.block.hasOutros) { destroy = deindent` @transitionManager.groupOutros(); - for (; #i < ${iterations}.length; #i += 1) ${outro}(#i, 1); + for (; #i < ${iterations}.length; #i += 1) ${outroBlock}(#i, 1); `; } else { destroy = deindent` @@ -473,10 +475,10 @@ export default class EachBlock extends Node { `); } - if (outro && this.compiler.options.nestedTransitions) { + if (outroBlock && this.compiler.options.nestedTransitions) { block.builders.outro.addBlock(deindent` #outrocallback = @callAfter(#outrocallback, #i); - for (let #i = 0; #i < ${iterations}.length; #i += 1) ${outro}(#i, 0, #outrocallback);` + for (let #i = 0; #i < ${iterations}.length; #i += 1) ${outroBlock}(#i, 0, #outrocallback);` ); } From 04fc83d791c6655bb1961f63d84004a066f48c20 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 25 May 2018 18:28:57 -0400 Subject: [PATCH 12/35] fix nested outro transitions --- src/compile/nodes/AwaitBlock.ts | 7 +-- src/compile/nodes/EachBlock.ts | 10 +++-- src/compile/nodes/IfBlock.ts | 7 +-- .../nested-transition-detach-each/_config.js | 41 +++++++++++++++++ .../nested-transition-detach-each/main.html | 22 ++++++++++ .../Folder.html | 44 +++++++++++++++++++ .../_config.js | 26 +++++++++++ .../main.html | 9 ++++ 8 files changed, 156 insertions(+), 10 deletions(-) create mode 100644 test/runtime/samples/nested-transition-detach-each/_config.js create mode 100644 test/runtime/samples/nested-transition-detach-each/main.html create mode 100644 test/runtime/samples/nested-transition-detach-if-false/Folder.html create mode 100644 test/runtime/samples/nested-transition-detach-if-false/_config.js create mode 100644 test/runtime/samples/nested-transition-detach-if-false/main.html diff --git a/src/compile/nodes/AwaitBlock.ts b/src/compile/nodes/AwaitBlock.ts index 882a27885f..4897adcd59 100644 --- a/src/compile/nodes/AwaitBlock.ts +++ b/src/compile/nodes/AwaitBlock.ts @@ -172,12 +172,13 @@ export default class AwaitBlock extends Node { } if (this.pending.block.hasOutroMethod && this.compiler.options.nestedTransitions) { + const countdown = block.getUniqueName('countdown'); block.builders.outro.addBlock(deindent` - #outrocallback = @callAfter(#outrocallback, 3); + const ${countdown} = @callAfter(#outrocallback, 3); for (let #i = 0; #i < 3; #i += 1) { const block = ${info}.blocks[#i]; - if (block) block.o(#outrocallback); - else #outrocallback(); + if (block) block.o(${countdown}); + else ${countdown}(); } `); } diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts index 89953ca19a..adf23d85c9 100644 --- a/src/compile/nodes/EachBlock.ts +++ b/src/compile/nodes/EachBlock.ts @@ -331,9 +331,10 @@ export default class EachBlock extends Node { `); if (this.compiler.options.nestedTransitions) { + const countdown = block.getUniqueName('countdown'); block.builders.outro.addBlock(deindent` - #outrocallback = @callAfter(#outrocallback, ${blocks}.length); - for (#i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].o(#outrocallback); + const ${countdown} = @callAfter(#outrocallback, ${blocks}.length); + for (#i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].o(${countdown}); `); } @@ -476,9 +477,10 @@ export default class EachBlock extends Node { } if (outroBlock && this.compiler.options.nestedTransitions) { + const countdown = block.getUniqueName('countdown'); block.builders.outro.addBlock(deindent` - #outrocallback = @callAfter(#outrocallback, #i); - for (let #i = 0; #i < ${iterations}.length; #i += 1) ${outroBlock}(#i, 0, #outrocallback);` + const ${countdown} = @callAfter(#outrocallback, ${iterations}.length); + for (let #i = 0; #i < ${iterations}.length; #i += 1) ${outroBlock}(#i, 0, ${countdown});` ); } diff --git a/src/compile/nodes/IfBlock.ts b/src/compile/nodes/IfBlock.ts index 3ecab77f43..ee5cb41a83 100644 --- a/src/compile/nodes/IfBlock.ts +++ b/src/compile/nodes/IfBlock.ts @@ -147,9 +147,10 @@ export default class IfBlock extends Node { this.buildSimple(block, parentNode, parentNodes, branches[0], dynamic, vars); if (hasOutros && this.compiler.options.nestedTransitions) { - block.builders.outro.addLine( - `if (${name}) ${name}.o(#outrocallback);` - ); + block.builders.outro.addBlock(deindent` + if (${name}) ${name}.o(#outrocallback); + else #outrocallback(); + `); } } diff --git a/test/runtime/samples/nested-transition-detach-each/_config.js b/test/runtime/samples/nested-transition-detach-each/_config.js new file mode 100644 index 0000000000..523be65e97 --- /dev/null +++ b/test/runtime/samples/nested-transition-detach-each/_config.js @@ -0,0 +1,41 @@ +export default { + data: { + visible: false, + rows: [1, 2, 3], + cols: ['a', 'b', 'c'] + }, + + html: ``, + + compileOptions: { + dev: true + }, + nestedTransitions: true, + skipIntroByDefault: true, + + test(assert, component, target, window, raf) { + component.set({ visible: true }); + assert.htmlEqual(target.innerHTML, ` +
+
1, a
+
1, b
+
1, c
+
+
+
2, a
+
2, b
+
2, c
+
+
+
3, a
+
3, b
+
3, c
+
+ `); + + component.set({ visible: false }); + raf.tick(0); + raf.tick(100); + assert.htmlEqual(target.innerHTML, ``); + }, +}; diff --git a/test/runtime/samples/nested-transition-detach-each/main.html b/test/runtime/samples/nested-transition-detach-each/main.html new file mode 100644 index 0000000000..c81fc3eb78 --- /dev/null +++ b/test/runtime/samples/nested-transition-detach-each/main.html @@ -0,0 +1,22 @@ +{#if visible} + {#each rows as row} +
+ {#each cols as col} +
{row}, {col}
+ {/each} +
+ {/each} +{/if} + + \ No newline at end of file diff --git a/test/runtime/samples/nested-transition-detach-if-false/Folder.html b/test/runtime/samples/nested-transition-detach-if-false/Folder.html new file mode 100644 index 0000000000..cd3448a3f2 --- /dev/null +++ b/test/runtime/samples/nested-transition-detach-if-false/Folder.html @@ -0,0 +1,44 @@ +
  • + {dir} + + {#if open} +
      + {#each items as item (item.filename)} + {#if item.isDir} + + {:else} +
    • {item.filename}
    • + {/if} + {/each} +
    + {/if} +
  • + + \ No newline at end of file diff --git a/test/runtime/samples/nested-transition-detach-if-false/_config.js b/test/runtime/samples/nested-transition-detach-if-false/_config.js new file mode 100644 index 0000000000..1e26a54787 --- /dev/null +++ b/test/runtime/samples/nested-transition-detach-if-false/_config.js @@ -0,0 +1,26 @@ +export default { + html: ` +
  • + a +
      +
    • + a/b +
        +
      • a/b/c
      • +
      +
    • +
    +
  • + `, + + nestedTransitions: true, + + test(assert, component, target, window, raf) { + component.refs.folder.set({ open: false }); + assert.htmlEqual(target.innerHTML, ` +
  • + a +
  • + `); + }, +}; diff --git a/test/runtime/samples/nested-transition-detach-if-false/main.html b/test/runtime/samples/nested-transition-detach-if-false/main.html new file mode 100644 index 0000000000..cf14773c9c --- /dev/null +++ b/test/runtime/samples/nested-transition-detach-if-false/main.html @@ -0,0 +1,9 @@ + + + \ No newline at end of file From 54799736b8b03da41b7110a321dca8a3d880ed32 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 25 May 2018 19:29:28 -0400 Subject: [PATCH 13/35] -> v2.6.6 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e390575554..6034a30aee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.6.6 + +* Fix nested transition bug ([#1497](https://github.com/sveltejs/svelte/issues/1497)) + ## 2.6.5 * Handle cases where only some `if` block branches have outros ([#1492](https://github.com/sveltejs/svelte/issues/1492)) diff --git a/package.json b/package.json index 3c195739b5..7e2ac64cfb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.6.5", + "version": "2.6.6", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From 63a712ccd9e43078697a4f5ffb814f76ab288eef Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 26 May 2018 11:54:12 -0400 Subject: [PATCH 14/35] add location info to nodes - fixes #1499 --- src/compile/Compiler.ts | 4 + src/compile/dom/index.ts | 10 +- src/compile/nodes/Element.ts | 9 +- src/shared/utils.js | 4 + test/cli/samples/basic/expected/Main.js | 2 +- .../samples/custom-element/expected/Main.js | 2 +- test/cli/samples/dev/expected/Main.js | 22 +- .../samples/dir-sourcemap/expected/Main.js | 2 +- .../samples/dir-sourcemap/expected/Widget.js | 2 +- test/cli/samples/dir-subdir/expected/Main.js | 2 +- .../dir-subdir/expected/widget/Widget.js | 2 +- test/cli/samples/dir/expected/Main.js | 2 +- test/cli/samples/dir/expected/Widget.js | 2 +- test/cli/samples/globals/expected/Main.js | 2 +- .../samples/sourcemap-inline/expected/Main.js | 2 +- test/cli/samples/sourcemap/expected/Main.js | 2 +- test/cli/samples/store/expected/Main.js | 2 +- .../expected-bundle.js | 7 + .../expected.js | 5 +- .../samples/element-source-location/Foo.html | 3 + .../element-source-location/_config.js | 24 + .../samples/element-source-location/main.html | 10 + yarn.lock | 495 ++++++------------ 23 files changed, 263 insertions(+), 354 deletions(-) create mode 100644 test/runtime/samples/element-source-location/Foo.html create mode 100644 test/runtime/samples/element-source-location/_config.js create mode 100644 test/runtime/samples/element-source-location/main.html diff --git a/src/compile/Compiler.ts b/src/compile/Compiler.ts index e022689aac..491a72f214 100644 --- a/src/compile/Compiler.ts +++ b/src/compile/Compiler.ts @@ -117,6 +117,7 @@ export default class Compiler { expectedProperties: Set; usesRefs: boolean; + file: string; locate: (c: number) => { line: number, column: number }; stylesheet: Stylesheet; @@ -159,6 +160,9 @@ export default class Compiler { this.bindingGroups = []; this.indirectDependencies = new Map(); + this.file = options.filename && ( + typeof process !== 'undefined' ? options.filename.replace(process.cwd(), '').replace(/^[\/\\]/, '') : options.filename + ); this.locate = getLocator(this.source); // track which properties are needed, so we can provide useful info diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index 2cc5792d39..54bfbe4352 100644 --- a/src/compile/dom/index.ts +++ b/src/compile/dom/index.ts @@ -100,6 +100,10 @@ export default function dom( builder.addBlock(compiler.javascript); } + if (compiler.options.dev) { + builder.addLine(`const __file = ${JSON.stringify(compiler.file)};`); + } + const css = compiler.stylesheet.render(options.filename, !compiler.customElement); const styles = compiler.stylesheet.hasStyles && stringify(options.dev ? `${css.code}\n/*# sourceMappingURL=${css.map.toUrl()} */` : @@ -354,12 +358,8 @@ export default function dom( let result = builder.toString(); - const filename = options.filename && ( - typeof process !== 'undefined' ? options.filename.replace(process.cwd(), '').replace(/^[\/\\]/, '') : options.filename - ); - return compiler.generate(result, options, { - banner: `/* ${filename ? `${filename} ` : ``}generated by Svelte v${"__VERSION__"} */`, + banner: `/* ${compiler.file ? `${compiler.file} ` : ``}generated by Svelte v${"__VERSION__"} */`, sharedPath, name, format, diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index 423134db07..f6bb7a3d37 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -143,7 +143,7 @@ export default class Element extends Node { stripWhitespace: boolean, nextSibling: Node ) { - if (this.name === 'slot' || this.name === 'option') { + if (this.name === 'slot' || this.name === 'option' || this.compiler.options.dev) { this.cannotUseInnerHTML(); } @@ -395,6 +395,13 @@ export default class Element extends Node { return `${open}>${node.children.map(toHTML).join('')}`; } + + if (this.compiler.options.dev) { + const loc = this.compiler.locate(this.start); + block.builders.hydrate.addLine( + `@addLoc(${this.var}, __file, ${loc.line}, ${loc.column}, ${this.start});` + ); + } } addBindings( diff --git a/src/shared/utils.js b/src/shared/utils.js index d1f2c7f5e5..61a68f2f19 100644 --- a/src/shared/utils.js +++ b/src/shared/utils.js @@ -18,4 +18,8 @@ export function callAfter(fn, i) { return () => { if (!--i) fn(); }; +} + +export function addLoc(element, file, line, column, char) { + element.__svelte_meta = { file, line, column, char }; } \ No newline at end of file diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index 7407ee4be3..b9e931bc33 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index 4fef083d78..7f33c3053e 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 9cfeb5ba58..88f6fddfe0 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -1,16 +1,20 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ + +const __file = "src/Main.html"; function create_main_fragment(component, ctx) { - var p; + var p, text; return { c: function create() { p = createElement("p"); - p.textContent = "Hello world!"; + text = createText("Hello world!"); + addLoc(p, __file, 0, 0, 0); }, m: function mount(target, anchor) { insertNode(p, target, anchor); + appendNode(text, p); }, p: noop, @@ -59,10 +63,22 @@ function createElement(name) { return document.createElement(name); } +function createText(data) { + return document.createTextNode(data); +} + +function addLoc(element, file, line, column, char) { + element.__svelte_meta = { file, line, column, char }; +} + function insertNode(node, target, anchor) { target.insertBefore(node, anchor); } +function appendNode(node, target) { + target.appendChild(node); +} + function noop() {} function detachNode(node) { diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 2169df3ed8..15115afe72 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ import Widget from './Widget.html'; diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index 8c63eca928..e915821a6c 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -1,4 +1,4 @@ -/* src/Widget.html generated by Svelte v2.5.1 */ +/* src/Widget.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index 7a5e0e65f4..e6a09e53f2 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ import Widget from './widget/Widget.html'; diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index e4bf9ce919..9907de389d 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -1,4 +1,4 @@ -/* src/widget/Widget.html generated by Svelte v2.5.1 */ +/* src/widget/Widget.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index 0ab0b9a372..ea629502a9 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ import Widget from './Widget.html'; diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index e9ca0c6056..d61cc7b617 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -1,4 +1,4 @@ -/* src/Widget.html generated by Svelte v2.5.1 */ +/* src/Widget.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index e317e7e689..083477513e 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ var Main = (function(answer) { "use strict"; answer = (answer && answer.__esModule) ? answer["default"] : answer; diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index b52eed5b1e..75a692a928 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 9e025d21f9..c5efda8486 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index 00d4ead864..664e16f3d4 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.5.1 */ +/* src/Main.html generated by Svelte v2.6.6 */ function create_main_fragment(component, ctx) { var h1, text, text_1; diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index cc3446f88b..dd0f7b2640 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -5,6 +5,10 @@ function assign(tar, src) { return tar; } +function addLoc(element, file, line, column, char) { + element.__svelte_meta = { file, line, column, char }; +} + function appendNode(node, target) { target.appendChild(node); } @@ -159,6 +163,8 @@ function bar({ foo }) { return foo * 2; } +const __file = undefined; + function create_main_fragment(component, ctx) { var p, text_value = ctx.Math.max(0, ctx.foo), text, text_1, text_2; @@ -168,6 +174,7 @@ function create_main_fragment(component, ctx) { text = createText(text_value); text_1 = createText("\n\t"); text_2 = createText(ctx.bar); + addLoc(p, __file, 0, 0, 0); }, m: function mount(target, anchor) { 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 b9d70d63ac..cb1746cc47 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -1,10 +1,12 @@ /* generated by Svelte vX.Y.Z */ -import { appendNode, assign, createElement, createText, detachNode, init, insertNode, protoDev } from "svelte/shared.js"; +import { addLoc, appendNode, assign, createElement, createText, detachNode, init, insertNode, protoDev } from "svelte/shared.js"; function bar({ foo }) { return foo * 2; } +const __file = undefined; + function create_main_fragment(component, ctx) { var p, text_value = ctx.Math.max(0, ctx.foo), text, text_1, text_2; @@ -14,6 +16,7 @@ function create_main_fragment(component, ctx) { text = createText(text_value); text_1 = createText("\n\t"); text_2 = createText(ctx.bar); + addLoc(p, __file, 0, 0, 0); }, m: function mount(target, anchor) { diff --git a/test/runtime/samples/element-source-location/Foo.html b/test/runtime/samples/element-source-location/Foo.html new file mode 100644 index 0000000000..0bf81d7347 --- /dev/null +++ b/test/runtime/samples/element-source-location/Foo.html @@ -0,0 +1,3 @@ +
    +

    this is a paragraph

    +
    \ No newline at end of file diff --git a/test/runtime/samples/element-source-location/_config.js b/test/runtime/samples/element-source-location/_config.js new file mode 100644 index 0000000000..f99ee5ef77 --- /dev/null +++ b/test/runtime/samples/element-source-location/_config.js @@ -0,0 +1,24 @@ +import path from 'path'; + +export default { + dev: true, + + test(assert, component, target) { + const h1 = target.querySelector('h1'); + const p = target.querySelector('p'); + + assert.deepEqual(h1.__svelte_meta, { + file: path.relative(process.cwd(), path.resolve(__dirname, 'main.html')), + line: 0, + column: 0, + char: 0 + }); + + assert.deepEqual(p.__svelte_meta, { + file: path.relative(process.cwd(), path.resolve(__dirname, 'Foo.html')), + line: 1, + column: 1, + char: 7 + }); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/element-source-location/main.html b/test/runtime/samples/element-source-location/main.html new file mode 100644 index 0000000000..2231e19439 --- /dev/null +++ b/test/runtime/samples/element-source-location/main.html @@ -0,0 +1,10 @@ +

    this is a header

    + + + \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 643395e6e6..540332563f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,13 +10,17 @@ version "5.2.0" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.0.tgz#b3c8e69f038835db1a7fdc0b3d879fc50506e29e" -"@types/node@*", "@types/node@^9.6.6": - version "9.6.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.6.tgz#439b91f9caf3983cad2eef1e11f6bedcbf9431d2" +"@types/node@*": + version "10.1.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.2.tgz#1b928a0baa408fc8ae3ac012cc81375addc147c6" "@types/node@^8.0.24": - version "8.10.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.9.tgz#b507a74a7d3eddc74a17dc35fd40d8f45dde0d6c" + version "8.10.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.17.tgz#d48cf10f0dc6dcf59f827f5a3fc7a4a6004318d3" + +"@types/node@^9.6.6": + version "9.6.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.18.tgz#092e13ef64c47e986802c9c45a61c1454813b31d" abab@^1.0.4: version "1.0.4" @@ -62,13 +66,6 @@ ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" -ajv@^4.9.1: - version "4.11.8" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" - ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" @@ -134,8 +131,8 @@ archy@^1.0.0: resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" dependencies: delegates "^1.0.0" readable-stream "^2.0.6" @@ -206,10 +203,6 @@ assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" -assert-plus@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" - assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" @@ -230,19 +223,15 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" -atob@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.0.tgz#ab2b150e51d7b122b9efc8d7340c06b6c41076bc" - -aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" +atob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.1.tgz#ae2d5a729477f289d60dd7f96a6314a22dd6c22a" aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" -aws4@^1.2.1, aws4@^1.6.0: +aws4@^1.6.0: version "1.7.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.7.0.tgz#d4d0e9b9dbfca77bf08eeb0a8a471550fe39e289" @@ -343,24 +332,6 @@ binary-extensions@^1.0.0: version "1.11.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" -boom@2.x.x: - version "2.10.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" - dependencies: - hoek "2.x.x" - -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -497,8 +468,8 @@ chalk@^1.1.3: supports-color "^2.0.0" chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.0.tgz#a060a297a6b57e15b61ca63ce84995daa0fe6e52" + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" @@ -559,8 +530,8 @@ cliui@^2.1.0: wordwrap "0.0.2" cliui@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" @@ -583,11 +554,11 @@ code-point-at@^1.0.0: resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" codecov@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.0.0.tgz#c273b8c4f12945723e8dc9d25803d89343e5f28e" + version "3.0.2" + resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.0.2.tgz#aea43843a5cd2fb6b7e488b2eff25d367ab70b12" dependencies: argv "0.0.2" - request "2.81.0" + request "^2.81.0" urlgrey "0.4.4" collection-visit@^1.0.0: @@ -607,7 +578,7 @@ color-name@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" -combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: +combined-stream@1.0.6, combined-stream@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" dependencies: @@ -641,15 +612,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" - dependencies: - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -concat-stream@^1.6.0: +concat-stream@1.6.2, concat-stream@^1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" dependencies: @@ -679,8 +642,8 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" core-js@^2.4.0: - version "2.5.5" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.5.tgz#b14dde936c640c0579a6b50cabcc132dd6127e3b" + version "2.5.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" @@ -701,18 +664,6 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0: shebang-command "^1.2.0" which "^1.2.9" -cryptiles@2.x.x: - version "2.0.5" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" - dependencies: - boom "2.x.x" - -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - css-tree@1.0.0-alpha22: version "1.0.0-alpha22" resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha22.tgz#338a006e331c7b4f9dab7b6af539ece56ff78af2" @@ -724,9 +675,9 @@ cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.2" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" -"cssstyle@>= 0.2.37 < 0.3.0": - version "0.2.37" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" +"cssstyle@>= 0.3.1 < 0.4.0": + version "0.3.1" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.3.1.tgz#6da9b4cff1bc5d716e6e5fe8e04fcb1b50a49adf" dependencies: cssom "0.3.x" @@ -786,9 +737,9 @@ deep-defaults@^1.0.3: dependencies: lodash "3.0.x" -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" +deep-extend@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.5.1.tgz#b894a9dd90d3023fbf1c55a394fb858eb2066f1f" deep-is@~0.1.3: version "0.1.3" @@ -898,8 +849,8 @@ domexception@^1.0.0: webidl-conversions "^4.0.2" domhandler@^2.3.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.1.tgz#892e47000a99be55bbf3774ffea0561d8879c259" + version "2.4.2" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" dependencies: domelementtype "1" @@ -931,8 +882,8 @@ electron-download@^3.0.1: sumchecker "^1.2.0" electron@^1.8.4: - version "1.8.4" - resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.4.tgz#cca8d0e6889f238f55b414ad224f03e03b226a38" + version "1.8.7" + resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.7.tgz#373c1dc4589d7ab4acd49aff8db4a1c0a6c3bcc1" dependencies: "@types/node" "^8.0.24" electron-download "^3.0.1" @@ -994,8 +945,8 @@ eslint-plugin-html@^4.0.3: htmlparser2 "^3.8.2" eslint-plugin-import@^2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.11.0.tgz#15aeea37a67499d848e8e981806d4627b5503816" + version "2.12.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.12.0.tgz#dad31781292d6664b25317fd049d2e2b2f02205d" dependencies: contains-path "^0.1.0" debug "^2.6.8" @@ -1097,13 +1048,9 @@ estree-walker@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" -estree-walker@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa" - -estree-walker@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.1.tgz#64fc375053abc6f57d73e9bd2f004644ad3c5854" +estree-walker@^0.5.1, estree-walker@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" esutils@^2.0.2: version "2.0.2" @@ -1158,7 +1105,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@~3.0.0, extend@~3.0.1: +extend@~3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" @@ -1190,12 +1137,12 @@ extglob@^2.0.4: to-regex "^3.0.1" extract-zip@^1.0.3: - version "1.6.6" - resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c" + version "1.6.7" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" dependencies: - concat-stream "1.6.0" + concat-stream "1.6.2" debug "2.6.9" - mkdirp "0.5.0" + mkdirp "0.5.1" yauzl "2.4.1" extsprintf@1.3.0: @@ -1242,12 +1189,12 @@ filename-regex@^2.0.0: resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" dependencies: is-number "^2.1.0" isobject "^2.0.0" - randomatic "^1.1.3" + randomatic "^3.0.0" repeat-element "^1.1.2" repeat-string "^1.5.2" @@ -1311,14 +1258,6 @@ forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" -form-data@~2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - form-data@~2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" @@ -1354,11 +1293,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" fsevents@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.0.tgz#e11a5ff285471e4cc43ab9cd09bb7986c565dcdc" + version "1.2.4" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" dependencies: nan "^2.9.2" - node-pre-gyp "^0.9.0" + node-pre-gyp "^0.10.0" function-bind@^1.0.2: version "1.1.1" @@ -1443,8 +1382,8 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.2: path-is-absolute "^1.0.0" globals@^11.0.1: - version "11.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc" + version "11.5.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.5.0.tgz#6bc840de6771173b191f13d3a9c94d441ee92642" globals@^9.18.0: version "9.18.0" @@ -1491,21 +1430,10 @@ handlebars@^4.0.3: optionalDependencies: uglify-js "^2.6" -har-schema@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" -har-validator@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" - dependencies: - ajv "^4.9.1" - har-schema "^1.0.5" - har-validator@~5.0.3: version "5.0.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" @@ -1564,39 +1492,13 @@ has@^1.0.1: dependencies: function-bind "^1.0.2" -hawk@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" - dependencies: - boom "2.x.x" - cryptiles "2.x.x" - hoek "2.x.x" - sntp "1.x.x" - -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" - he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" -hoek@2.x.x: - version "2.16.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" - -hoek@4.x.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" - home-path@^1.0.1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.5.tgz#788b29815b12d53bacf575648476e6f9041d133f" + version "1.0.6" + resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.6.tgz#d549dc2465388a7f8667242c5b31588d29af29fc" hosted-git-info@^2.1.4: version "2.6.0" @@ -1619,14 +1521,6 @@ htmlparser2@^3.8.2: inherits "^2.0.1" readable-stream "^2.0.2" -http-signature@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" - dependencies: - assert-plus "^0.2.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -1640,10 +1534,10 @@ iconv-lite@0.4.19: resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" iconv-lite@^0.4.17, iconv-lite@^0.4.4: - version "0.4.21" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.21.tgz#c47f8733d02171189ebc4a400f3218d348094798" + version "0.4.23" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" dependencies: - safer-buffer "^2.1.0" + safer-buffer ">= 2.1.2 < 3" ignore-walk@^3.0.1: version "3.0.1" @@ -1652,8 +1546,8 @@ ignore-walk@^3.0.1: minimatch "^3.0.4" ignore@^3.3.3: - version "3.3.7" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + version "3.3.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.8.tgz#3f8e9c35d38708a3a7e0e9abb6c73e7ee7707b2b" imurmurhash@^0.1.4: version "0.1.4" @@ -1994,21 +1888,21 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" jsdom@^11.8.0: - version "11.8.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.8.0.tgz#a52e9a7d2b931284f62c80dad5f17d7390499d8b" + version "11.11.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.11.0.tgz#df486efad41aee96c59ad7a190e2449c7eb1110e" dependencies: abab "^1.0.4" acorn "^5.3.0" acorn-globals "^4.1.0" array-equal "^1.0.0" cssom ">= 0.3.2 < 0.4.0" - cssstyle ">= 0.2.37 < 0.3.0" + cssstyle ">= 0.3.1 < 0.4.0" data-urls "^1.0.0" domexception "^1.0.0" escodegen "^1.9.0" html-encoding-sniffer "^1.0.2" left-pad "^1.2.0" - nwmatcher "^1.4.3" + nwsapi "^2.0.0" parse5 "4.0.0" pn "^1.1.0" request "^2.83.0" @@ -2020,7 +1914,7 @@ jsdom@^11.8.0: webidl-conversions "^4.0.2" whatwg-encoding "^1.0.3" whatwg-mimetype "^2.1.0" - whatwg-url "^6.4.0" + whatwg-url "^6.4.1" ws "^4.0.0" xml-name-validator "^3.0.0" @@ -2044,12 +1938,6 @@ json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" -json-stable-stringify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" - json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -2064,10 +1952,6 @@ jsonfile@^2.1.0: optionalDependencies: graceful-fs "^4.1.6" -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -2214,8 +2098,8 @@ lodash@3.0.x: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.0.1.tgz#14d49028a38bc740241d11e2ecd57ec06d73c19a" lodash@^4.13.1, lodash@^4.17.4, lodash@^4.3.0: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" longest@^1.0.1: version "1.0.1" @@ -2235,8 +2119,8 @@ loud-rejection@^1.0.0: signal-exit "^3.0.0" lru-cache@^4.0.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.2.tgz#45234b2e6e2f2b33da125624c4664929a0224c3f" + version "4.1.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" dependencies: pseudomap "^1.0.2" yallist "^2.1.2" @@ -2248,8 +2132,8 @@ magic-string@^0.22.4: vlq "^0.2.2" magic-string@^0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.24.0.tgz#1b396d26406188f1fa3730a68229562d36a1c2f2" + version "0.24.1" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.24.1.tgz#7e38e5f126cae9f15e71f0cf8e450818ca7d5a8f" dependencies: sourcemap-codec "^1.4.1" @@ -2271,6 +2155,10 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +math-random@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac" + md5-hex@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" @@ -2282,8 +2170,8 @@ md5-o-matic@^0.1.1: resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" mdn-data@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.1.tgz#79586c90321787e5a2e51eb6823bb448949bc1ab" + version "1.1.3" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.3.tgz#d0929cdf73db32b0afd6d3ab8ef3da2b29b6f76b" mem@^1.1.0: version "1.1.0" @@ -2306,7 +2194,7 @@ meow@^3.1.0: redent "^1.0.0" trim-newlines "^1.0.0" -merge-source-map@^1.0.2: +merge-source-map@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" dependencies: @@ -2330,7 +2218,7 @@ micromatch@^2.1.5, micromatch@^2.3.11: parse-glob "^3.0.4" regex-cache "^0.4.2" -micromatch@^3.1.8: +micromatch@^3.1.10, micromatch@^3.1.8: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" dependencies: @@ -2352,7 +2240,7 @@ mime-db@~1.33.0: version "1.33.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" -mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.7: +mime-types@^2.1.12, mime-types@~2.1.17: version "2.1.18" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" dependencies: @@ -2380,11 +2268,11 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" -minipass@^2.2.1, minipass@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.2.4.tgz#03c824d84551ec38a8d1bb5bc350a5a30a354a40" +minipass@^2.2.1, minipass@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.3.tgz#a7dcc8b7b833f5d368759cce544dccb55f50f233" dependencies: - safe-buffer "^5.1.1" + safe-buffer "^5.1.2" yallist "^3.0.0" minizlib@^1.1.0: @@ -2406,12 +2294,6 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" - dependencies: - minimist "0.0.8" - mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -2436,8 +2318,8 @@ mocha@3: supports-color "3.1.2" mri@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.0.tgz#5c0a3f29c8ccffbbb1ec941dcec09d71fa32f36a" + version "1.1.1" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.1.tgz#85aa26d3daeeeedf80dc5984af95cc5ca5cad9f1" ms@2.0.0: version "2.0.0" @@ -2479,8 +2361,8 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" needle@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.0.tgz#f14efc69cee1024b72c8b21c7bdf94a731dc12fa" + version "2.2.1" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.1.tgz#b5e325bd3aae8c2678902fa296f729455d1d3a7d" dependencies: debug "^2.1.2" iconv-lite "^0.4.4" @@ -2505,9 +2387,9 @@ nightmare@^3.0.1: sliced "1.0.1" split2 "^2.0.1" -node-pre-gyp@^0.9.0: - version "0.9.1" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.9.1.tgz#f11c07516dd92f87199dbc7e1838eab7cd56c9e0" +node-pre-gyp@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz#6e4ef5bb5c5203c6552448828c852c40111aac46" dependencies: detect-libc "^1.0.2" mkdirp "^0.5.1" @@ -2591,13 +2473,13 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" -nwmatcher@^1.4.3: - version "1.4.4" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.4.tgz#2285631f34a95f0d0395cd900c96ed39b58f346e" +nwsapi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.0.0.tgz#7c8faf4ad501e1d17a651ebc5547f966b547c5c7" nyc@^11.7.1: - version "11.7.1" - resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.7.1.tgz#7cb0a422e501b88ff2c1634341dec2560299d67b" + version "11.8.0" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.8.0.tgz#1e8453b0644f8fea4d829b1a6636663157cd3b00" dependencies: archy "^1.0.0" arrify "^1.0.1" @@ -2616,18 +2498,18 @@ nyc@^11.7.1: istanbul-lib-source-maps "^1.2.3" istanbul-reports "^1.4.0" md5-hex "^1.2.0" - merge-source-map "^1.0.2" - micromatch "^2.3.11" + merge-source-map "^1.1.0" + micromatch "^3.1.10" mkdirp "^0.5.0" resolve-from "^2.0.0" - rimraf "^2.5.4" + rimraf "^2.6.2" signal-exit "^3.0.1" spawn-wrap "^1.4.2" test-exclude "^4.2.0" yargs "11.1.0" yargs-parser "^8.0.0" -oauth-sign@~0.8.1, oauth-sign@~0.8.2: +oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -2812,10 +2694,6 @@ pend@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" -performance-now@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -2895,29 +2773,26 @@ punycode@^1.4.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" punycode@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" - -qs@~6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" +randomatic@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.0.0.tgz#d35490030eb4f7578de292ce6dfb04a91a128923" dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" rc@^1.1.2, rc@^1.1.7: - version "1.2.6" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.6.tgz#eb18989c6d4f4f162c399f79ddd29f3835568092" + version "1.2.7" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.7.tgz#8a10ca30d588d00464360372b890d06dacd02297" dependencies: - deep-extend "~0.4.0" + deep-extend "^0.5.1" ini "~1.3.0" minimist "^1.2.0" strip-json-comments "~2.0.1" @@ -3055,36 +2930,9 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.0" tough-cookie ">=2.3.3" -request@2.81.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" - -request@^2.45.0, request@^2.83.0: - version "2.85.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa" +request@^2.45.0, request@^2.81.0, request@^2.83.0: + version "2.87.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e" dependencies: aws-sign2 "~0.7.0" aws4 "^1.6.0" @@ -3094,7 +2942,6 @@ request@^2.45.0, request@^2.83.0: forever-agent "~0.6.1" form-data "~2.3.1" har-validator "~5.0.3" - hawk "~6.0.2" http-signature "~1.2.0" is-typedarray "~1.0.0" isstream "~0.1.2" @@ -3104,7 +2951,6 @@ request@^2.45.0, request@^2.83.0: performance-now "^2.1.0" qs "~6.5.1" safe-buffer "^5.1.1" - stringstream "~0.0.5" tough-cookie "~2.3.3" tunnel-agent "^0.6.0" uuid "^3.1.0" @@ -3163,7 +3009,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@^2.2.8, rimraf@^2.4.3, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: +rimraf@^2.2.8, rimraf@^2.4.3, rimraf@^2.5.2, rimraf@^2.6.1, rimraf@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: @@ -3177,8 +3023,8 @@ rollup-plugin-buble@^0.19.2: rollup-pluginutils "^2.0.1" rollup-plugin-commonjs@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.1.0.tgz#468341aab32499123ee9a04b22f51d9bf26fdd94" + version "9.1.3" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.1.3.tgz#37bfbf341292ea14f512438a56df8f9ca3ba4d67" dependencies: estree-walker "^0.5.1" magic-string "^0.22.4" @@ -3186,8 +3032,8 @@ rollup-plugin-commonjs@^9.1.0: rollup-pluginutils "^2.0.1" rollup-plugin-json@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-json/-/rollup-plugin-json-2.3.0.tgz#3c07a452c1b5391be28006fbfff3644056ce0add" + version "2.3.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-json/-/rollup-plugin-json-2.3.1.tgz#9759d27f33dcd2c896de18b6235df162b88edd77" dependencies: rollup-pluginutils "^2.0.1" @@ -3229,10 +3075,10 @@ rollup-pluginutils@^1.3.1: minimatch "^3.0.2" rollup-pluginutils@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0" + version "2.3.0" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.0.tgz#478ace04bd7f6da2e724356ca798214884738fc4" dependencies: - estree-walker "^0.3.0" + estree-walker "^0.5.2" micromatch "^2.3.11" rollup-watch@^4.3.1: @@ -3244,8 +3090,8 @@ rollup-watch@^4.3.1: rollup-pluginutils "^2.0.1" rollup@^0.58.1: - version "0.58.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.58.1.tgz#5e2e05ceb103f770868b12c4048c22d3903fa2dd" + version "0.58.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.58.2.tgz#2feddea8c0c022f3e74b35c48e3c21b3433803ce" dependencies: "@types/estree" "0.0.38" "@types/node" "*" @@ -3267,15 +3113,15 @@ rx-lite@*, rx-lite@^4.0.8: resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" sade@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/sade/-/sade-1.4.0.tgz#51874eb18600aa54ee39c8f566c2f4c999a7cd47" + version "1.4.1" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.4.1.tgz#80c6dfd3c03db1fbcd6bc10c0eb52f71e7cadc01" dependencies: mri "^1.1.0" pad-right "^0.2.2" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" safe-regex@^1.1.0: version "1.1.0" @@ -3283,7 +3129,7 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -safer-buffer@^2.1.0: +"safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -3402,32 +3248,21 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -sntp@1.x.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" - dependencies: - hoek "2.x.x" - -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" - dependencies: - hoek "4.x.x" - source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" dependencies: - atob "^2.0.0" + atob "^2.1.1" decode-uri-component "^0.2.0" resolve-url "^0.2.1" source-map-url "^0.4.0" urix "^0.1.0" source-map-support@^0.5.3, source-map-support@^0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.4.tgz#54456efa89caa9270af7cd624cc2f123e51fbae8" + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" dependencies: + buffer-from "^1.0.0" source-map "^0.6.0" source-map-url@^0.4.0: @@ -3530,7 +3365,7 @@ stealthy-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" -string-width@^1.0.1, string-width@^1.0.2: +string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" dependencies: @@ -3538,7 +3373,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -3555,10 +3390,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringstream@~0.0.4, stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -3640,15 +3471,15 @@ table@4.0.2: string-width "^2.1.1" tar@^4: - version "4.4.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.1.tgz#b25d5a8470c976fd7a9a8a350f42c59e9fa81749" + version "4.4.4" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.4.tgz#ec8409fae9f665a4355cc3b4087d0820232bb8cd" dependencies: chownr "^1.0.1" fs-minipass "^1.2.5" - minipass "^2.2.4" + minipass "^2.3.3" minizlib "^1.1.0" mkdirp "^0.5.0" - safe-buffer "^5.1.1" + safe-buffer "^5.1.2" yallist "^3.0.2" test-exclude@^4.2.0: @@ -3730,13 +3561,13 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.0, tough-cookie@~2.3.3: +tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.3: version "2.3.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" dependencies: punycode "^1.4.1" -tr46@^1.0.0: +tr46@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" dependencies: @@ -3751,8 +3582,8 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" ts-node@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-6.0.0.tgz#46c25f8498593a9248eeea16906f1598fa098140" + version "6.0.5" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-6.0.5.tgz#977c1c931da7a2b09ae2930101f0104a5c2271e9" dependencies: arrify "^1.0.0" chalk "^2.3.0" @@ -3764,8 +3595,8 @@ ts-node@^6.0.0: yn "^2.0.0" tslib@^1.8.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" + version "1.9.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.1.tgz#a5d1f0532a49221c87755cfcc89ca37197242ba7" tunnel-agent@^0.6.0: version "0.6.0" @@ -3842,7 +3673,7 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -uuid@^3.0.0, uuid@^3.1.0: +uuid@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" @@ -3875,7 +3706,7 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" -webidl-conversions@^4.0.1, webidl-conversions@^4.0.2: +webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" @@ -3889,29 +3720,29 @@ whatwg-mimetype@^2.0.0, whatwg-mimetype@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz#f0f21d76cbba72362eb609dbed2a30cd17fcc7d4" -whatwg-url@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.4.0.tgz#08fdf2b9e872783a7a1f6216260a1d66cc722e08" +whatwg-url@^6.4.0, whatwg-url@^6.4.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.4.1.tgz#fdb94b440fd4ad836202c16e9737d511f012fd67" dependencies: lodash.sortby "^4.7.0" - tr46 "^1.0.0" - webidl-conversions "^4.0.1" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" which@^1.2.9, which@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" dependencies: isexe "^2.0.0" wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" dependencies: - string-width "^1.0.2" + string-width "^1.0.2 || 2" window-size@0.1.0: version "0.1.0" From cf2be1be63e262d0c0352aac6508f7d9c8e1d9a1 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 27 May 2018 14:55:42 -0400 Subject: [PATCH 15/35] fix bind:online in dev mode (#1502) --- src/compile/nodes/Window.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compile/nodes/Window.ts b/src/compile/nodes/Window.ts index 6651fce854..6a7988738e 100644 --- a/src/compile/nodes/Window.ts +++ b/src/compile/nodes/Window.ts @@ -200,7 +200,9 @@ export default class Window extends Node { const handlerName = block.getUniqueName(`onlinestatuschanged`); block.builders.init.addBlock(deindent` function ${handlerName}(event) { + ${compiler.options.dev && `component._updatingReadonlyProperty = true;`} #component.set({ ${bindings.online}: navigator.onLine }); + ${compiler.options.dev && `component._updatingReadonlyProperty = false;`} } window.addEventListener("online", ${handlerName}); window.addEventListener("offline", ${handlerName}); From 877fbeffec960de41dac992384563c4b87c923ae Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Sun, 27 May 2018 15:56:52 -0300 Subject: [PATCH 16/35] Make the compiler also transform prefixed @keyframes --- src/css/Stylesheet.ts | 15 +++++---- src/utils/isKeyframesNode.ts | 7 ++++ .../keyframes-autoprefixed/expected.css | 1 + .../samples/keyframes-autoprefixed/input.html | 32 +++++++++++++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 src/utils/isKeyframesNode.ts create mode 100644 test/css/samples/keyframes-autoprefixed/expected.css create mode 100644 test/css/samples/keyframes-autoprefixed/input.html diff --git a/src/css/Stylesheet.ts b/src/css/Stylesheet.ts index 70f19fd48b..8dadc4e296 100644 --- a/src/css/Stylesheet.ts +++ b/src/css/Stylesheet.ts @@ -4,6 +4,7 @@ import { getLocator } from 'locate-character'; import Selector from './Selector'; import getCodeFrame from '../utils/getCodeFrame'; import hash from '../utils/hash'; +import isKeyframesNode from '../utils/isKeyframesNode'; import Element from '../compile/nodes/Element'; import { Validator } from '../validate/index'; import { Node, Ast, Warning } from '../interfaces'; @@ -26,7 +27,7 @@ class Rule { } isUsed(dev: boolean) { - if (this.parent && this.parent.node.type === 'Atrule' && this.parent.node.name === 'keyframes') return true; + if (this.parent && this.parent.node.type === 'Atrule' && isKeyframesNode(this.parent.node)) return true; if (this.declarations.length === 0) return dev; return this.selectors.some(s => s.used); } @@ -67,7 +68,7 @@ class Rule { } transform(code: MagicString, id: string, keyframes: Map) { - if (this.parent && this.parent.node.type === 'Atrule' && this.parent.node.name === 'keyframes') return true; + if (this.parent && this.parent.node.type === 'Atrule' && isKeyframesNode(this.parent.node)) return true; const attr = `.${id}`; @@ -142,7 +143,7 @@ class Atrule { }); } - else if (this.node.name === 'keyframes') { + else if (isKeyframesNode(this.node)) { this.children.forEach((rule: Rule) => { rule.selectors.forEach(selector => { selector.used = true; @@ -167,8 +168,8 @@ class Atrule { }); code.remove(c, this.node.block.start); - } else if (this.node.name === 'keyframes') { - let c = this.node.start + 10; + } else if (isKeyframesNode(this.node)) { + let c = this.node.start + this.node.name.length + 1; if (this.node.expression.start - c > 1) code.overwrite(c, this.node.expression.start, ' '); c = this.node.expression.end; if (this.node.block.start - c > 0) code.remove(c, this.node.block.start); @@ -200,7 +201,7 @@ class Atrule { } transform(code: MagicString, id: string, keyframes: Map) { - if (this.node.name === 'keyframes') { + if (isKeyframesNode(this.node)) { this.node.expression.children.forEach(({ type, name, start, end }: Node) => { if (type === 'Identifier') { if (name.startsWith('-global-')) { @@ -287,7 +288,7 @@ export default class Stylesheet { this.children.push(atrule); } - if (node.name === 'keyframes') { + if (isKeyframesNode(node)) { node.expression.children.forEach((expression: Node) => { if (expression.type === 'Identifier' && !expression.name.startsWith('-global-')) { this.keyframes.set(expression.name, `${this.id}-${expression.name}`); diff --git a/src/utils/isKeyframesNode.ts b/src/utils/isKeyframesNode.ts new file mode 100644 index 0000000000..4ce899ff99 --- /dev/null +++ b/src/utils/isKeyframesNode.ts @@ -0,0 +1,7 @@ +import { Node } from '../interfaces'; + +export default function isKeyframesNode(node: Node): boolean { + return ['', '-webkit-', '-moz-', '-o-'].some( + prefix => node.name === `${prefix}keyframes` + ); +} diff --git a/test/css/samples/keyframes-autoprefixed/expected.css b/test/css/samples/keyframes-autoprefixed/expected.css new file mode 100644 index 0000000000..a50a2b94d3 --- /dev/null +++ b/test/css/samples/keyframes-autoprefixed/expected.css @@ -0,0 +1 @@ +@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-webkit-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-moz-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-o-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.animated.svelte-xyz{animation:svelte-xyz-why 2s}.also-animated.svelte-xyz{animation:not-defined-here 2s} \ No newline at end of file diff --git a/test/css/samples/keyframes-autoprefixed/input.html b/test/css/samples/keyframes-autoprefixed/input.html new file mode 100644 index 0000000000..dfe5dd4578 --- /dev/null +++ b/test/css/samples/keyframes-autoprefixed/input.html @@ -0,0 +1,32 @@ +
    animated
    +
    also animated
    + + From 5e8a8b95e52a0cc4ed996bfe3db8b76221b58883 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 27 May 2018 15:48:21 -0400 Subject: [PATCH 17/35] update some stray references to v1 syntax --- src/compile/nodes/Title.ts | 2 +- src/parse/state/mustache.ts | 12 ++++++------ src/validate/html/validateElement.ts | 2 +- src/validate/html/validateHead.ts | 2 +- .../samples/styles-nested/One.html | 2 +- test/validator/samples/title-no-children/errors.json | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compile/nodes/Title.ts b/src/compile/nodes/Title.ts index b6029312f4..8be46bd53b 100644 --- a/src/compile/nodes/Title.ts +++ b/src/compile/nodes/Title.ts @@ -35,7 +35,7 @@ export default class Title extends Node { // TODO some of this code is repeated in Tag.ts — would be good to // DRY it out if that's possible without introducing crazy indirection if (this.children.length === 1) { - // single {{tag}} — may be a non-string + // single {tag} — may be a non-string const { expression } = this.children[0]; const { dependencies, snippet } = this.children[0].expression; diff --git a/src/parse/state/mustache.ts b/src/parse/state/mustache.ts index 77cbad1058..657aceac65 100644 --- a/src/parse/state/mustache.ts +++ b/src/parse/state/mustache.ts @@ -37,7 +37,7 @@ export default function mustache(parser: Parser) { parser.allowWhitespace(); - // {{/if}} or {{/each}} + // {/if} or {/each} if (parser.eat('/')) { let block = parser.current(); let expected; @@ -92,7 +92,7 @@ export default function mustache(parser: Parser) { if (block.type !== 'IfBlock') parser.error({ code: `invalid-elseif-placement`, - message: 'Cannot have an {{elseif ...}} block outside an {{#if ...}} block' + message: 'Cannot have an {:elseif ...} block outside an {#if ...} block' }); parser.requireWhitespace(); @@ -124,7 +124,7 @@ export default function mustache(parser: Parser) { if (block.type !== 'IfBlock' && block.type !== 'EachBlock') { parser.error({ code: `invalid-else-placement`, - message: 'Cannot have an {{else}} block outside an {{#if ...}} or {{#each ...}} block' + message: 'Cannot have an {:else} block outside an {#if ...} or {#each ...} block' }); } @@ -187,7 +187,7 @@ export default function mustache(parser: Parser) { parser.stack.push(catchBlock); } } else if (parser.eat('#')) { - // {{#if foo}} or {{#each foo}} + // {#if foo}, {#each foo} or {#await foo} let type; if (parser.eat('if')) { @@ -244,7 +244,7 @@ export default function mustache(parser: Parser) { parser.allowWhitespace(); - // {{#each}} blocks must declare a context – {{#each list as item}} + // {#each} blocks must declare a context – {#each list as item} if (type === 'EachBlock') { parser.eat('as', true); parser.requireWhitespace(); @@ -299,7 +299,7 @@ export default function mustache(parser: Parser) { parser.stack.push(childBlock); } } else if (parser.eat('@html')) { - // {{{raw}}} mustache + // {@html content} tag const expression = readExpression(parser); parser.allowWhitespace(); diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index 4a700c4bc2..002120e721 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -69,7 +69,7 @@ export default function validateElement( if (child.type !== 'Text' && child.type !== 'MustacheTag') { validator.error(child, { code: 'illegal-structure', - message: ` can only contain text and {{tags}}` + message: `<title> can only contain text and {tags}` }); } }); diff --git a/src/validate/html/validateHead.ts b/src/validate/html/validateHead.ts index 1fcfd050fc..b6dd6d0fc0 100644 --- a/src/validate/html/validateHead.ts +++ b/src/validate/html/validateHead.ts @@ -13,7 +13,7 @@ export default function validateHead(validator: Validator, node: Node, refs: Map // TODO ensure only valid elements are included here node.children.forEach(node => { - if (node.type !== 'Element' && node.type !== 'Title') return; // TODO handle {{#if}} and friends? + if (node.type !== 'Element' && node.type !== 'Title') return; // TODO handle {#if} and friends? validateElement(validator, node, refs, refCallees, [], []); }); } diff --git a/test/server-side-rendering/samples/styles-nested/One.html b/test/server-side-rendering/samples/styles-nested/One.html index 8906363014..0e68dd3c28 100644 --- a/test/server-side-rendering/samples/styles-nested/One.html +++ b/test/server-side-rendering/samples/styles-nested/One.html @@ -1,7 +1,7 @@ <div>green: {message}</div> <!-- Two styles should *not* be included --> -<!-- <Two message='{{message}}'/> --> +<!-- <Two {message}/> --> <style> div { diff --git a/test/validator/samples/title-no-children/errors.json b/test/validator/samples/title-no-children/errors.json index 9b10d700eb..37179189d2 100644 --- a/test/validator/samples/title-no-children/errors.json +++ b/test/validator/samples/title-no-children/errors.json @@ -1,6 +1,6 @@ [{ "code": "illegal-structure", - "message": "<title> can only contain text and {{tags}}", + "message": "<title> can only contain text and {tags}", "start": { "line": 2, "column": 11, From d3201603d9fa142e66912359932115fff8a00db7 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Mon, 28 May 2018 19:07:12 -0400 Subject: [PATCH 18/35] change __svelte_meta to __svelte_meta.loc --- src/shared/utils.js | 4 +++- test/cli/samples/dev/expected/Main.js | 4 +++- .../dev-warning-missing-data-computed/expected-bundle.js | 4 +++- test/runtime/samples/element-source-location/_config.js | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/shared/utils.js b/src/shared/utils.js index 61a68f2f19..436782dcf6 100644 --- a/src/shared/utils.js +++ b/src/shared/utils.js @@ -21,5 +21,7 @@ export function callAfter(fn, i) { } export function addLoc(element, file, line, column, char) { - element.__svelte_meta = { file, line, column, char }; + element.__svelte_meta = { + loc: { file, line, column, char } + }; } \ No newline at end of file diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 88f6fddfe0..1e9d5b083a 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -68,7 +68,9 @@ function createText(data) { } function addLoc(element, file, line, column, char) { - element.__svelte_meta = { file, line, column, char }; + element.__svelte_meta = { + loc: { file, line, column, char } + }; } function insertNode(node, target, anchor) { diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index dd0f7b2640..0e9722426a 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -6,7 +6,9 @@ function assign(tar, src) { } function addLoc(element, file, line, column, char) { - element.__svelte_meta = { file, line, column, char }; + element.__svelte_meta = { + loc: { file, line, column, char } + }; } function appendNode(node, target) { diff --git a/test/runtime/samples/element-source-location/_config.js b/test/runtime/samples/element-source-location/_config.js index f99ee5ef77..47ae986cbb 100644 --- a/test/runtime/samples/element-source-location/_config.js +++ b/test/runtime/samples/element-source-location/_config.js @@ -7,14 +7,14 @@ export default { const h1 = target.querySelector('h1'); const p = target.querySelector('p'); - assert.deepEqual(h1.__svelte_meta, { + assert.deepEqual(h1.__svelte_meta.loc, { file: path.relative(process.cwd(), path.resolve(__dirname, 'main.html')), line: 0, column: 0, char: 0 }); - assert.deepEqual(p.__svelte_meta, { + assert.deepEqual(p.__svelte_meta.loc, { file: path.relative(process.cwd(), path.resolve(__dirname, 'Foo.html')), line: 1, column: 1, From 48c885bcbb84bf65f21222c458f9ef78d418536d Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Mon, 28 May 2018 19:14:43 -0400 Subject: [PATCH 19/35] update CLI tests to fix version number thing --- test/cli/samples/basic/expected/Main.js | 2 +- test/cli/samples/custom-element/expected/Main.js | 2 +- test/cli/samples/dev/expected/Main.js | 2 +- test/cli/samples/dir-sourcemap/expected/Main.js | 2 +- test/cli/samples/dir-sourcemap/expected/Widget.js | 2 +- test/cli/samples/dir-subdir/expected/Main.js | 2 +- .../cli/samples/dir-subdir/expected/widget/Widget.js | 2 +- test/cli/samples/dir/expected/Main.js | 2 +- test/cli/samples/dir/expected/Widget.js | 2 +- test/cli/samples/globals/expected/Main.js | 2 +- test/cli/samples/sourcemap-inline/expected/Main.js | 2 +- test/cli/samples/sourcemap/expected/Main.js | 2 +- test/cli/samples/store/expected/Main.js | 2 +- test/cli/update.js | 12 +++++++++++- 14 files changed, 24 insertions(+), 14 deletions(-) diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index b9e931bc33..d42218c622 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index 7f33c3053e..74c99b1f1d 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 1e9d5b083a..1d5d7e41d3 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ const __file = "src/Main.html"; diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 15115afe72..3d507d9867 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ import Widget from './Widget.html'; diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index e915821a6c..25e36da0dd 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -1,4 +1,4 @@ -/* src/Widget.html generated by Svelte v2.6.6 */ +/* src/Widget.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index e6a09e53f2..73503e2106 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ import Widget from './widget/Widget.html'; diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index 9907de389d..f27a3b1257 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -1,4 +1,4 @@ -/* src/widget/Widget.html generated by Svelte v2.6.6 */ +/* src/widget/Widget.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index ea629502a9..017f054795 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ import Widget from './Widget.html'; diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index d61cc7b617..cfc85b0c1c 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -1,4 +1,4 @@ -/* src/Widget.html generated by Svelte v2.6.6 */ +/* src/Widget.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 083477513e..357e10b9c4 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ var Main = (function(answer) { "use strict"; answer = (answer && answer.__esModule) ? answer["default"] : answer; diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index 75a692a928..78bc2da178 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index c5efda8486..70c50e76b5 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index 664e16f3d4..0cadb9e366 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte v2.6.6 */ +/* src/Main.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var h1, text, text_1; diff --git a/test/cli/update.js b/test/cli/update.js index bc87c18bff..468fe51f15 100644 --- a/test/cli/update.js +++ b/test/cli/update.js @@ -1,4 +1,5 @@ const sander = require('sander'); +const glob = require('tiny-glob/sync'); process.chdir(__dirname); @@ -6,5 +7,14 @@ sander.readdirSync('samples').forEach(dir => { if (dir[0] === '.') return; sander.rimrafSync(`samples/${dir}/expected`); - sander.copydirSync(`samples/${dir}/actual`).to(`samples/${dir}/expected`); + + const files = glob(`**`, { cwd: `samples/${dir}/actual`, filesOnly: true }); + files.forEach(file => { + const source = sander.readFileSync(`samples/${dir}/actual/${file}`, { encoding: 'utf-8' }); + + sander.writeFileSync( + `samples/${dir}/expected/${file}`, + source.replace(/generated by Svelte v(\d+\.\d+\.\d+)/, 'generated by Svelte vx.y.z') + ); + }); }); \ No newline at end of file From 04ef203787355fd559877961862756464a7d5f22 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Mon, 28 May 2018 19:35:36 -0400 Subject: [PATCH 20/35] prevent possibility of conflicts with __file --- src/compile/Compiler.ts | 3 +++ src/compile/dom/index.ts | 2 +- src/compile/nodes/Element.ts | 2 +- test/cli/samples/dev/expected/Main.js | 4 ++-- .../dev-warning-missing-data-computed/expected-bundle.js | 4 ++-- test/js/samples/dev-warning-missing-data-computed/expected.js | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/compile/Compiler.ts b/src/compile/Compiler.ts index 491a72f214..4a4239bbae 100644 --- a/src/compile/Compiler.ts +++ b/src/compile/Compiler.ts @@ -118,6 +118,7 @@ export default class Compiler { usesRefs: boolean; file: string; + fileVar: string; locate: (c: number) => { line: number, column: number }; stylesheet: Stylesheet; @@ -182,6 +183,8 @@ export default class Compiler { this.aliases = new Map(); this.usedNames = new Set(); + this.fileVar = options.dev && this.getUniqueName('file'); + this.computations = []; this.templateProperties = {}; diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index 54bfbe4352..0a02b664be 100644 --- a/src/compile/dom/index.ts +++ b/src/compile/dom/index.ts @@ -101,7 +101,7 @@ export default function dom( } if (compiler.options.dev) { - builder.addLine(`const __file = ${JSON.stringify(compiler.file)};`); + builder.addLine(`const ${compiler.fileVar} = ${JSON.stringify(compiler.file)};`); } const css = compiler.stylesheet.render(options.filename, !compiler.customElement); diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index f6bb7a3d37..8c7fe2b217 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -399,7 +399,7 @@ export default class Element extends Node { if (this.compiler.options.dev) { const loc = this.compiler.locate(this.start); block.builders.hydrate.addLine( - `@addLoc(${this.var}, __file, ${loc.line}, ${loc.column}, ${this.start});` + `@addLoc(${this.var}, ${this.compiler.fileVar}, ${loc.line}, ${loc.column}, ${this.start});` ); } } diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 1d5d7e41d3..664f9ec0b8 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -1,6 +1,6 @@ /* src/Main.html generated by Svelte vx.y.z */ -const __file = "src/Main.html"; +const file = "src/Main.html"; function create_main_fragment(component, ctx) { var p, text; @@ -9,7 +9,7 @@ function create_main_fragment(component, ctx) { c: function create() { p = createElement("p"); text = createText("Hello world!"); - addLoc(p, __file, 0, 0, 0); + addLoc(p, file, 0, 0, 0); }, m: function mount(target, anchor) { diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index 0e9722426a..b26570734c 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -165,7 +165,7 @@ function bar({ foo }) { return foo * 2; } -const __file = undefined; +const file = undefined; function create_main_fragment(component, ctx) { var p, text_value = ctx.Math.max(0, ctx.foo), text, text_1, text_2; @@ -176,7 +176,7 @@ function create_main_fragment(component, ctx) { text = createText(text_value); text_1 = createText("\n\t"); text_2 = createText(ctx.bar); - addLoc(p, __file, 0, 0, 0); + addLoc(p, file, 0, 0, 0); }, m: function mount(target, anchor) { 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 cb1746cc47..834da725e7 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -5,7 +5,7 @@ function bar({ foo }) { return foo * 2; } -const __file = undefined; +const file = undefined; function create_main_fragment(component, ctx) { var p, text_value = ctx.Math.max(0, ctx.foo), text, text_1, text_2; @@ -16,7 +16,7 @@ function create_main_fragment(component, ctx) { text = createText(text_value); text_1 = createText("\n\t"); text_2 = createText(ctx.bar); - addLoc(p, __file, 0, 0, 0); + addLoc(p, file, 0, 0, 0); }, m: function mount(target, anchor) { From 7032ec745cdf17f25c47659ebb989c88fe24a157 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Mon, 28 May 2018 19:45:13 -0400 Subject: [PATCH 21/35] -> v2.7.0 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6034a30aee..e5a71e44e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Svelte changelog +## 2.7.0 + +* Add `__svelte_meta` object to elements in dev mode, containing source info ([#1499](https://github.com/sveltejs/svelte/issues/1499)) +* Fix `bind:online` in dev mode ([#1502](https://github.com/sveltejs/svelte/issues/1502)) +* Update v1 warnings/errors ([#1508](https://github.com/sveltejs/svelte/pull/1508)) +* Transform prefixed keyframes ([#1504](https://github.com/sveltejs/svelte/issues/1504)) + ## 2.6.6 * Fix nested transition bug ([#1497](https://github.com/sveltejs/svelte/issues/1497)) diff --git a/package.json b/package.json index 7e2ac64cfb..d20e6b193a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.6.6", + "version": "2.7.0", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From 755f085b1bda2b60809cd21d0481728e4b9aa95f Mon Sep 17 00:00:00 2001 From: Conduitry <git@chor.date> Date: Wed, 30 May 2018 12:03:36 -0400 Subject: [PATCH 22/35] fix spread when an attribute or prop has multiple dependencies (#1515) --- src/compile/nodes/Component.ts | 2 +- src/compile/nodes/Element.ts | 2 +- .../Widget.html | 1 + .../_config.js | 10 ++++++++++ .../main.html | 13 +++++++++++++ .../spread-element-multiple-dependencies/_config.js | 10 ++++++++++ .../spread-element-multiple-dependencies/main.html | 12 ++++++++++++ 7 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 test/runtime/samples/spread-component-multiple-dependencies/Widget.html create mode 100644 test/runtime/samples/spread-component-multiple-dependencies/_config.js create mode 100644 test/runtime/samples/spread-component-multiple-dependencies/main.html create mode 100644 test/runtime/samples/spread-element-multiple-dependencies/_config.js create mode 100644 test/runtime/samples/spread-element-multiple-dependencies/main.html diff --git a/src/compile/nodes/Component.ts b/src/compile/nodes/Component.ts index 8bb5537856..c5efd25afb 100644 --- a/src/compile/nodes/Component.ts +++ b/src/compile/nodes/Component.ts @@ -176,7 +176,7 @@ export default class Component extends Node { const { name, dependencies } = attr; const condition = dependencies.size > 0 && (dependencies.size !== allDependencies.size) - ? [...dependencies].map(d => `changed.${d}`).join(' || ') + ? `(${[...dependencies].map(d => `changed.${d}`).join(' || ')})` : null; if (attr.isSpread) { diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index 8c7fe2b217..6c174f0272 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -559,7 +559,7 @@ export default class Element extends Node { .filter(attr => attr.type === 'Attribute' || attr.type === 'Spread') .forEach(attr => { const condition = attr.dependencies.size > 0 - ? [...attr.dependencies].map(d => `changed.${d}`).join(' || ') + ? `(${[...attr.dependencies].map(d => `changed.${d}`).join(' || ')})` : null; if (attr.isSpread) { diff --git a/test/runtime/samples/spread-component-multiple-dependencies/Widget.html b/test/runtime/samples/spread-component-multiple-dependencies/Widget.html new file mode 100644 index 0000000000..ab2d2d0242 --- /dev/null +++ b/test/runtime/samples/spread-component-multiple-dependencies/Widget.html @@ -0,0 +1 @@ +{foo} {baz} diff --git a/test/runtime/samples/spread-component-multiple-dependencies/_config.js b/test/runtime/samples/spread-component-multiple-dependencies/_config.js new file mode 100644 index 0000000000..42b0c5693f --- /dev/null +++ b/test/runtime/samples/spread-component-multiple-dependencies/_config.js @@ -0,0 +1,10 @@ +export default { + html: `b baz`, + test(assert, component, target) { + component.set({ foo: true }); + assert.htmlEqual( + target.innerHTML, + `a baz` + ); + }, +}; diff --git a/test/runtime/samples/spread-component-multiple-dependencies/main.html b/test/runtime/samples/spread-component-multiple-dependencies/main.html new file mode 100644 index 0000000000..dedfa27477 --- /dev/null +++ b/test/runtime/samples/spread-component-multiple-dependencies/main.html @@ -0,0 +1,13 @@ +<Widget foo={foo ? a : b} {...bar}/> + +<script> + export default { + components: { Widget: './Widget.html' }, + data: () => ({ + foo: false, + a: 'a', + b: 'b', + bar: { baz: 'baz' }, + }), + }; +</script> diff --git a/test/runtime/samples/spread-element-multiple-dependencies/_config.js b/test/runtime/samples/spread-element-multiple-dependencies/_config.js new file mode 100644 index 0000000000..e8f3d68e32 --- /dev/null +++ b/test/runtime/samples/spread-element-multiple-dependencies/_config.js @@ -0,0 +1,10 @@ +export default { + html: `<div class='b' title='baz'></div>`, + test(assert, component, target) { + component.set({ foo: true }); + assert.htmlEqual( + target.innerHTML, + `<div class='a' title='baz'></div>` + ); + }, +}; diff --git a/test/runtime/samples/spread-element-multiple-dependencies/main.html b/test/runtime/samples/spread-element-multiple-dependencies/main.html new file mode 100644 index 0000000000..f6f436714d --- /dev/null +++ b/test/runtime/samples/spread-element-multiple-dependencies/main.html @@ -0,0 +1,12 @@ +<div class={foo ? a : b} {...bar}></div> + +<script> + export default { + data: () => ({ + foo: false, + a: 'a', + b: 'b', + bar: { title: 'baz' }, + }), + }; +</script> From 7c0986fded4b24a62881929912bf33283175aa8a Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Tue, 5 Jun 2018 16:57:26 -0400 Subject: [PATCH 23/35] -> v2.7.1 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5a71e44e7..cbe89dff0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.7.1 + +* Fix spread props with multiple dependencies ([#1515](https://github.com/sveltejs/svelte/issues/1515)) + ## 2.7.0 * Add `__svelte_meta` object to elements in dev mode, containing source info ([#1499](https://github.com/sveltejs/svelte/issues/1499)) diff --git a/package.json b/package.json index d20e6b193a..b832f7a90e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.7.0", + "version": "2.7.1", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From 19d541ab776ec0025b9370857f74d63885046df6 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann <christian@kaisermann.me> Date: Wed, 6 Jun 2018 14:32:34 -0300 Subject: [PATCH 24/35] Add refs.* to valid event handler callees warning message --- src/validate/html/validateEventHandler.ts | 2 +- test/validator/samples/method-nonexistent-helper/warnings.json | 2 +- test/validator/samples/method-nonexistent/warnings.json | 2 +- test/validator/samples/window-event-invalid/warnings.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/validate/html/validateEventHandler.ts b/src/validate/html/validateEventHandler.ts index 1b33b3e786..df499a9fd5 100644 --- a/src/validate/html/validateEventHandler.ts +++ b/src/validate/html/validateEventHandler.ts @@ -43,7 +43,7 @@ export default function validateEventHandlerCallee( return; } - const validCallees = ['this.*', 'event.*', 'options.*', 'console.*'].concat( + const validCallees = ['this.*', 'refs.*', 'event.*', 'options.*', 'console.*'].concat( Array.from(validBuiltins), Array.from(validator.methods.keys()) ); diff --git a/test/validator/samples/method-nonexistent-helper/warnings.json b/test/validator/samples/method-nonexistent-helper/warnings.json index b463045538..d1999de882 100644 --- a/test/validator/samples/method-nonexistent-helper/warnings.json +++ b/test/validator/samples/method-nonexistent-helper/warnings.json @@ -1,6 +1,6 @@ [{ "code": "invalid-callee", - "message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire, destroy or bar). 'foo' exists on 'helpers', did you put it in the wrong place?", + "message": "'foo' is an invalid callee (should be one of this.*, refs.*, event.*, options.*, console.*, set, fire, destroy or bar). 'foo' exists on 'helpers', did you put it in the wrong place?", "pos": 18, "start": { "line": 1, diff --git a/test/validator/samples/method-nonexistent/warnings.json b/test/validator/samples/method-nonexistent/warnings.json index 3ad9ee8734..d0a30ab928 100644 --- a/test/validator/samples/method-nonexistent/warnings.json +++ b/test/validator/samples/method-nonexistent/warnings.json @@ -1,6 +1,6 @@ [{ "code": "invalid-callee", - "message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire, destroy or bar)", + "message": "'foo' is an invalid callee (should be one of this.*, refs.*, event.*, options.*, console.*, set, fire, destroy or bar)", "pos": 18, "start": { "line": 1, diff --git a/test/validator/samples/window-event-invalid/warnings.json b/test/validator/samples/window-event-invalid/warnings.json index 1d20c8fac9..2e403fe27b 100644 --- a/test/validator/samples/window-event-invalid/warnings.json +++ b/test/validator/samples/window-event-invalid/warnings.json @@ -1,6 +1,6 @@ [{ "code": "invalid-callee", - "message": "'resize' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire or destroy)", + "message": "'resize' is an invalid callee (should be one of this.*, refs.*, event.*, options.*, console.*, set, fire or destroy)", "start": { "line": 1, "column": 26, From 52032bef8f2f900014b214d8b0dafa85d7fad72c Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Wed, 6 Jun 2018 16:52:01 -0400 Subject: [PATCH 25/35] failing test for #1527 --- .../Span.html | 1 + .../_config.js | 26 +++++++++++++++++++ .../main.html | 14 ++++++++++ 3 files changed, 41 insertions(+) create mode 100644 test/runtime/samples/nested-transition-if-block-not-remounted/Span.html create mode 100644 test/runtime/samples/nested-transition-if-block-not-remounted/_config.js create mode 100644 test/runtime/samples/nested-transition-if-block-not-remounted/main.html diff --git a/test/runtime/samples/nested-transition-if-block-not-remounted/Span.html b/test/runtime/samples/nested-transition-if-block-not-remounted/Span.html new file mode 100644 index 0000000000..b16b370950 --- /dev/null +++ b/test/runtime/samples/nested-transition-if-block-not-remounted/Span.html @@ -0,0 +1 @@ +<span><slot></slot></span> \ No newline at end of file diff --git a/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js b/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js new file mode 100644 index 0000000000..128a518134 --- /dev/null +++ b/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js @@ -0,0 +1,26 @@ +export default { + data: { + x: true, + value: 'one' + }, + + html: ` + <div> + <input> + <span>x</span> + </div> + `, + + nestedTransitions: true, + + test(assert, component, target, window, raf) { + const div = target.querySelector('div'); + const { appendChild, insertBefore } = div; + + div.appendChild = div.insertBefore = () => { + throw new Error('DOM was mutated'); + }; + + component.set({ value: 'two' }); + }, +}; diff --git a/test/runtime/samples/nested-transition-if-block-not-remounted/main.html b/test/runtime/samples/nested-transition-if-block-not-remounted/main.html new file mode 100644 index 0000000000..ad8b2454a8 --- /dev/null +++ b/test/runtime/samples/nested-transition-if-block-not-remounted/main.html @@ -0,0 +1,14 @@ +<div> + {#if x} + <input on:input="set({ value: this.value })"> + <Span>x</Span> + {/if} +</div> + +<script> + export default { + components: { + Span: './Span.html' + } + }; +</script> \ No newline at end of file From 1cd55d1f2bc1b933d299250c869eb6fa83127937 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Wed, 6 Jun 2018 16:52:27 -0400 Subject: [PATCH 26/35] avoid double intro --- src/compile/dom/Block.ts | 51 +++++++++++----------------------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/src/compile/dom/Block.ts b/src/compile/dom/Block.ts index 6b753ed1aa..0b16d1502a 100644 --- a/src/compile/dom/Block.ts +++ b/src/compile/dom/Block.ts @@ -166,18 +166,11 @@ export default class Block { toString() { const { dev } = this.compiler.options; - let introing; - const hasIntros = !this.builders.intro.isEmpty(); - if (hasIntros) { - introing = this.getUniqueName('introing'); - this.addVariable(introing); - } - - let outroing; - const hasOutros = !this.builders.outro.isEmpty(); - if (hasOutros) { - outroing = this.alias('outroing'); - this.addVariable(outroing); + let current; + if (this.hasIntroMethod || this.hasOutroMethod) { + current = this.getUniqueName('current'); + this.addVariable(current); + this.builders.mount.addLine(`${current} = true;`); } if (this.autofocus) { @@ -275,46 +268,30 @@ export default class Block { } if (this.hasIntroMethod || this.hasOutroMethod) { - if (hasIntros) { + if (this.builders.mount.isEmpty() && this.builders.outro.isEmpty()) { + properties.addBlock(`i: @noop,`); + properties.addBlock(`o: @run,`); + } else { properties.addBlock(deindent` ${dev ? 'i: function intro' : 'i'}(#target, anchor) { - if (${introing}) return; - ${introing} = true; - ${hasOutros && `${outroing} = false;`} - + console.trace("intro", #component.constructor.name, ${current}); + if (${current}) return; ${this.builders.intro} - this.m(#target, anchor); }, `); - } else { - if (this.builders.mount.isEmpty()) { - properties.addBlock(`i: @noop,`); - } else { - properties.addBlock(deindent` - ${dev ? 'i: function intro' : 'i'}(#target, anchor) { - this.m(#target, anchor); - }, - `); - } - } - if (hasOutros) { properties.addBlock(deindent` ${dev ? 'o: function outro' : 'o'}(#outrocallback) { - if (${outroing}) return; - ${outroing} = true; - ${hasIntros && `${introing} = false;`} + console.trace("outro", #component.constructor.name, ${current}); + if (!${current}) return; + ${current} = false; ${this.outros > 1 && `#outrocallback = @callAfter(#outrocallback, ${this.outros});`} ${this.builders.outro} }, `); - } else { - properties.addBlock(deindent` - o: @run, - `); } } From 3b928b36a93fb98d90db2a2244db5f044905bbfb Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Wed, 6 Jun 2018 17:23:35 -0400 Subject: [PATCH 27/35] fix the bugs --- src/compile/dom/Block.ts | 31 ++++++++++++++++++++----------- src/compile/nodes/Attribute.ts | 4 ++-- src/compile/nodes/Title.ts | 2 +- src/compile/nodes/shared/Tag.ts | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/compile/dom/Block.ts b/src/compile/dom/Block.ts index 0b16d1502a..977486bd8d 100644 --- a/src/compile/dom/Block.ts +++ b/src/compile/dom/Block.ts @@ -142,6 +142,10 @@ export default class Block { } addVariable(name: string, init?: string) { + if (name[0] === '#') { + name = this.alias(name.slice(1)); + } + if (this.variables.has(name) && this.variables.get(name) !== init) { throw new Error( `Variable '${name}' already initialised with a different value` @@ -166,11 +170,16 @@ export default class Block { toString() { const { dev } = this.compiler.options; - let current; if (this.hasIntroMethod || this.hasOutroMethod) { - current = this.getUniqueName('current'); - this.addVariable(current); - this.builders.mount.addLine(`${current} = true;`); + this.addVariable('#current'); + + if (!this.builders.mount.isEmpty()) { + this.builders.mount.addLine(`#current = true;`); + } + + if (!this.builders.outro.isEmpty()) { + this.builders.outro.addLine(`#current = false;`); + } } if (this.autofocus) { @@ -268,24 +277,24 @@ export default class Block { } if (this.hasIntroMethod || this.hasOutroMethod) { - if (this.builders.mount.isEmpty() && this.builders.outro.isEmpty()) { + if (this.builders.mount.isEmpty()) { properties.addBlock(`i: @noop,`); - properties.addBlock(`o: @run,`); } else { properties.addBlock(deindent` ${dev ? 'i: function intro' : 'i'}(#target, anchor) { - console.trace("intro", #component.constructor.name, ${current}); - if (${current}) return; + if (#current) return; ${this.builders.intro} this.m(#target, anchor); }, `); + } + if (this.builders.outro.isEmpty()) { + properties.addBlock(`o: @run,`); + } else { properties.addBlock(deindent` ${dev ? 'o: function outro' : 'o'}(#outrocallback) { - console.trace("outro", #component.constructor.name, ${current}); - if (!${current}) return; - ${current} = false; + if (!#current) return; ${this.outros > 1 && `#outrocallback = @callAfter(#outrocallback, ${this.outros});`} diff --git a/src/compile/nodes/Attribute.ts b/src/compile/nodes/Attribute.ts index ac1cbeda6c..53996469e9 100644 --- a/src/compile/nodes/Attribute.ts +++ b/src/compile/nodes/Attribute.ts @@ -232,7 +232,7 @@ export default class Attribute extends Node { if (this.dependencies.size || isSelectValueAttribute) { const dependencies = Array.from(this.dependencies); const changedCheck = ( - ( block.hasOutros ? `#outroing || ` : '' ) + + (block.hasOutros ? `!#current || ` : '') + dependencies.map(dependency => `changed.${dependency}`).join(' || ') ); @@ -308,7 +308,7 @@ export default class Attribute extends Node { if (propDependencies.size) { const dependencies = Array.from(propDependencies); const condition = ( - (block.hasOutros ? `#outroing || ` : '') + + (block.hasOutros ? `!#current || ` : '') + dependencies.map(dependency => `changed.${dependency}`).join(' || ') ); diff --git a/src/compile/nodes/Title.ts b/src/compile/nodes/Title.ts index 8be46bd53b..080d122535 100644 --- a/src/compile/nodes/Title.ts +++ b/src/compile/nodes/Title.ts @@ -81,7 +81,7 @@ export default class Title extends Node { if (allDependencies.size) { const dependencies = Array.from(allDependencies); const changedCheck = ( - ( block.hasOutros ? `#outroing || ` : '' ) + + ( block.hasOutros ? `!#current || ` : '' ) + dependencies.map(dependency => `changed.${dependency}`).join(' || ') ); diff --git a/src/compile/nodes/shared/Tag.ts b/src/compile/nodes/shared/Tag.ts index 82b7123798..df17a1f9c0 100644 --- a/src/compile/nodes/shared/Tag.ts +++ b/src/compile/nodes/shared/Tag.ts @@ -35,7 +35,7 @@ export default class Tag extends Node { if (dependencies.size) { const changedCheck = ( - (block.hasOutros ? `#outroing || ` : '') + + (block.hasOutros ? `!#current || ` : '') + [...dependencies].map((dependency: string) => `changed.${dependency}`).join(' || ') ); From f8ca0d4efe2ed736c099956df03050a513511e0b Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Thu, 7 Jun 2018 08:28:09 -0400 Subject: [PATCH 28/35] call outrocallback immediately for empty each block --- src/shared/utils.js | 1 + .../samples/each-block-empty-outro/Thing.html | 1 + .../samples/each-block-empty-outro/_config.js | 20 +++++++++++++++++++ .../samples/each-block-empty-outro/main.html | 17 ++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 test/runtime/samples/each-block-empty-outro/Thing.html create mode 100644 test/runtime/samples/each-block-empty-outro/_config.js create mode 100644 test/runtime/samples/each-block-empty-outro/main.html diff --git a/src/shared/utils.js b/src/shared/utils.js index 436782dcf6..c431a673f8 100644 --- a/src/shared/utils.js +++ b/src/shared/utils.js @@ -15,6 +15,7 @@ export function isPromise(value) { } export function callAfter(fn, i) { + if (i === 0) fn(); return () => { if (!--i) fn(); }; diff --git a/test/runtime/samples/each-block-empty-outro/Thing.html b/test/runtime/samples/each-block-empty-outro/Thing.html new file mode 100644 index 0000000000..150c8fd252 --- /dev/null +++ b/test/runtime/samples/each-block-empty-outro/Thing.html @@ -0,0 +1 @@ +<p>{thing}</p> \ No newline at end of file diff --git a/test/runtime/samples/each-block-empty-outro/_config.js b/test/runtime/samples/each-block-empty-outro/_config.js new file mode 100644 index 0000000000..443371892b --- /dev/null +++ b/test/runtime/samples/each-block-empty-outro/_config.js @@ -0,0 +1,20 @@ +export default { + data: { + visible: true, + empty: [] + }, + + html: ` + <div> + <p>text</p> + </div> + `, + + nestedTransitions: true, + + test(assert, component, target) { + component.set({ visible: false }); + + assert.htmlEqual(target.innerHTML, ``); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/each-block-empty-outro/main.html b/test/runtime/samples/each-block-empty-outro/main.html new file mode 100644 index 0000000000..b5d1b95260 --- /dev/null +++ b/test/runtime/samples/each-block-empty-outro/main.html @@ -0,0 +1,17 @@ +{#if visible} + <div> + {#each empty as thing} + <Thing {thing}/> + {/each} + + <p>text</p> + </div> +{/if} + +<script> + export default { + components: { + Thing: './Thing.html' + } + }; +</script> \ No newline at end of file From 9cd5dd9fbc53ba0c3c596bb08721cdf7109743b7 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Fri, 8 Jun 2018 14:47:04 +0100 Subject: [PATCH 29/35] -> v2.7.2 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe89dff0d..f5051a1b22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Svelte changelog +## 2.7.2 + +* Prevent unnecessary remounts ([#1527](https://github.com/sveltejs/svelte/issues/1527)) +* Allow `refs.*` as callee ([#1526](https://github.com/sveltejs/svelte/pull/1526)) +* Handle empty lists when outroing ([#1532](https://github.com/sveltejs/svelte/issues/1532)) + ## 2.7.1 * Fix spread props with multiple dependencies ([#1515](https://github.com/sveltejs/svelte/issues/1515)) diff --git a/package.json b/package.json index b832f7a90e..c1890ee3ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.7.1", + "version": "2.7.2", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From 52ece0b5f02e78d1a92b9088bb35ec858745a88d Mon Sep 17 00:00:00 2001 From: Pavel Malyshev <pavel@mustlab.ru> Date: Wed, 20 Jun 2018 18:10:48 +0300 Subject: [PATCH 30/35] Fix for #1538 --- src/compile/nodes/Component.ts | 2 +- src/shared/index.js | 2 +- test/cli/samples/basic/expected/Main.js | 2 +- test/cli/samples/custom-element/expected/Main.js | 2 +- test/cli/samples/dev/expected/Main.js | 2 +- test/cli/samples/dir-sourcemap/expected/Main.js | 7 ++++--- test/cli/samples/dir-sourcemap/expected/Main.js.map | 2 +- test/cli/samples/dir-sourcemap/expected/Widget.js | 4 ++-- test/cli/samples/dir-subdir/expected/Main.js | 5 +++-- test/cli/samples/dir-subdir/expected/widget/Widget.js | 2 +- test/cli/samples/dir/expected/Main.js | 5 +++-- test/cli/samples/dir/expected/Widget.js | 2 +- test/cli/samples/globals/expected/Main.js | 2 +- test/cli/samples/sourcemap-inline/expected/Main.js | 2 +- test/cli/samples/sourcemap/expected/Main.js | 2 +- test/cli/samples/store/expected/Main.js | 2 +- test/js/samples/action/expected-bundle.js | 2 +- test/js/samples/bind-width-height/expected-bundle.js | 2 +- .../collapses-text-around-comments/expected-bundle.js | 2 +- test/js/samples/component-static-array/expected-bundle.js | 3 ++- test/js/samples/component-static-array/expected.js | 1 + .../samples/component-static-immutable/expected-bundle.js | 3 ++- test/js/samples/component-static-immutable/expected.js | 1 + .../component-static-immutable2/expected-bundle.js | 3 ++- test/js/samples/component-static-immutable2/expected.js | 1 + test/js/samples/component-static/expected-bundle.js | 3 ++- test/js/samples/component-static/expected.js | 1 + test/js/samples/computed-collapsed-if/expected-bundle.js | 2 +- test/js/samples/css-media-query/expected-bundle.js | 2 +- .../samples/css-shadow-dom-keyframes/expected-bundle.js | 2 +- test/js/samples/deconflict-builtins/expected-bundle.js | 2 +- test/js/samples/deconflict-globals/expected-bundle.js | 2 +- .../dev-warning-missing-data-computed/expected-bundle.js | 2 +- test/js/samples/do-use-dataset/expected-bundle.js | 2 +- .../samples/dont-use-dataset-in-legacy/expected-bundle.js | 2 +- .../js/samples/dont-use-dataset-in-svg/expected-bundle.js | 2 +- .../samples/each-block-changed-check/expected-bundle.js | 2 +- .../samples/each-block-keyed-animated/expected-bundle.js | 2 +- test/js/samples/each-block-keyed/expected-bundle.js | 2 +- test/js/samples/event-handlers-custom/expected-bundle.js | 2 +- test/js/samples/head-no-whitespace/expected-bundle.js | 2 +- test/js/samples/if-block-no-update/expected-bundle.js | 2 +- test/js/samples/if-block-simple/expected-bundle.js | 2 +- .../inline-style-optimized-multiple/expected-bundle.js | 2 +- .../samples/inline-style-optimized-url/expected-bundle.js | 2 +- test/js/samples/inline-style-optimized/expected-bundle.js | 2 +- .../samples/inline-style-unoptimized/expected-bundle.js | 2 +- test/js/samples/input-range/expected-bundle.js | 2 +- .../input-without-blowback-guard/expected-bundle.js | 2 +- test/js/samples/legacy-input-type/expected-bundle.js | 2 +- test/js/samples/media-bindings/expected-bundle.js | 2 +- test/js/samples/non-imported-component/expected-bundle.js | 8 +++++--- test/js/samples/non-imported-component/expected.js | 6 ++++-- test/js/samples/setup-method/expected-bundle.js | 2 +- test/js/samples/svg-title/expected-bundle.js | 2 +- test/js/samples/title/expected-bundle.js | 2 +- .../js/samples/use-elements-as-anchors/expected-bundle.js | 2 +- test/js/samples/window-binding-scroll/expected-bundle.js | 2 +- 58 files changed, 77 insertions(+), 62 deletions(-) diff --git a/src/compile/nodes/Component.ts b/src/compile/nodes/Component.ts index c5efd25afb..736b2306ea 100644 --- a/src/compile/nodes/Component.ts +++ b/src/compile/nodes/Component.ts @@ -123,7 +123,7 @@ export default class Component extends Node { const name = this.var; - const componentInitProperties = [`root: #component.root`]; + const componentInitProperties = [`root: #component.root`, `store: #component.store`]; if (this.children.length > 0) { const slots = Array.from(this._slots).map(name => `${quoteNameIfNecessary(name)}: @createFragment()`); diff --git a/src/shared/index.js b/src/shared/index.js index c9d901af64..4d0e7896c6 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -64,7 +64,7 @@ export function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } export function on(eventName, handler) { diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index d42218c622..19de3981da 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index 74c99b1f1d..64981ea826 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -90,7 +90,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 664f9ec0b8..3808927235 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -93,7 +93,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 3d507d9867..85e8e85480 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte vx.y.z */ +/* src/Main.html generated by Svelte v2.7.2 */ import Widget from './Widget.html'; @@ -6,7 +6,8 @@ import Widget from './Widget.html'; function create_main_fragment(component, ctx) { var widget = new Widget({ - root: component.root + root: component.root, + store: component.store }); return { @@ -72,7 +73,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js.map b/test/cli/samples/dir-sourcemap/expected/Main.js.map index e164b7b845..3177f8b8be 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<Widget/>\n\n<script>\n\timport Widget from './Widget.html';\n\n\texport default {\n\t\tcomponents: {\n\t\t\tWidget\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<Widget/>\n\n<script>\n\timport Widget from './Widget.html';\n\n\texport default {\n\t\tcomponents: {\n\t\t\tWidget\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index 25e36da0dd..47794ea409 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -1,4 +1,4 @@ -/* src/Widget.html generated by Svelte vx.y.z */ +/* src/Widget.html generated by Svelte v2.7.2 */ function create_main_fragment(component, ctx) { var p; @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index 73503e2106..a80bf2f976 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -6,7 +6,8 @@ import Widget from './widget/Widget.html'; function create_main_fragment(component, ctx) { var widget = new Widget({ - root: component.root + root: component.root, + store: component.store }); return { @@ -72,7 +73,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index f27a3b1257..974326ad95 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index 017f054795..edfbe3c67f 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -6,7 +6,8 @@ import Widget from './Widget.html'; function create_main_fragment(component, ctx) { var widget = new Widget({ - root: component.root + root: component.root, + store: component.store }); return { @@ -72,7 +73,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index cfc85b0c1c..7bec9ae438 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 357e10b9c4..1a79813b58 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -90,7 +90,7 @@ var Main = (function(answer) { "use strict"; component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index 78bc2da178..de6a8894ce 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 70c50e76b5..e136e16f48 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index 0cadb9e366..3f97badad4 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -85,7 +85,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function assign(tar, src) { diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index fe61c32b09..e1b3e6ce18 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -61,7 +61,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index e66cc47aaf..8a441a8d3f 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -93,7 +93,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index 49c9c75813..87f65ba860 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/component-static-array/expected-bundle.js b/test/js/samples/component-static-array/expected-bundle.js index 1fd894e093..5f85c7487a 100644 --- a/test/js/samples/component-static-array/expected-bundle.js +++ b/test/js/samples/component-static-array/expected-bundle.js @@ -49,7 +49,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { @@ -124,6 +124,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: [1, 2, 3] }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js index c1dcfea4a7..bae0c850f7 100644 --- a/test/js/samples/component-static-array/expected.js +++ b/test/js/samples/component-static-array/expected.js @@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: [1, 2, 3] }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index dc6d94a1f2..3ebd360b2a 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -53,7 +53,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { @@ -128,6 +128,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: "bar" }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index 41fe5a349b..f40f060325 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: "bar" }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index dc6d94a1f2..3ebd360b2a 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -53,7 +53,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { @@ -128,6 +128,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: "bar" }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index 41fe5a349b..f40f060325 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: "bar" }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 21c70ae9a7..d2c8280062 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -49,7 +49,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { @@ -124,6 +124,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: "bar" }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 2318521cf4..1a5631fc58 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -8,6 +8,7 @@ function create_main_fragment(component, ctx) { var nested_initial_data = { foo: "bar" }; var nested = new Nested({ root: component.root, + store: component.store, data: nested_initial_data }); diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 0e967c7a67..73830ee233 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -49,7 +49,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index b481784118..ff7bdcfcc1 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js index c34d69215b..8d9d31dff2 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -61,7 +61,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index 976c71face..c3d9d762b9 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -79,7 +79,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 524d379e88..0d2226d5cb 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -54,7 +54,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index b26570734c..3b9a92c90e 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -82,7 +82,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 7eac008dbe..10c7600975 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js index 93fbd587cf..4a963e3300 100644 --- a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js index 349eff3f4d..5b1827344d 100644 --- a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index b06f8662f9..02db1ce829 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -81,7 +81,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/each-block-keyed-animated/expected-bundle.js b/test/js/samples/each-block-keyed-animated/expected-bundle.js index 54876c6152..9989c77978 100644 --- a/test/js/samples/each-block-keyed-animated/expected-bundle.js +++ b/test/js/samples/each-block-keyed-animated/expected-bundle.js @@ -391,7 +391,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/each-block-keyed/expected-bundle.js b/test/js/samples/each-block-keyed/expected-bundle.js index 89f1655008..09f61a6d3e 100644 --- a/test/js/samples/each-block-keyed/expected-bundle.js +++ b/test/js/samples/each-block-keyed/expected-bundle.js @@ -164,7 +164,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 5e04f88939..78d5d1a005 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -61,7 +61,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index f7bbdcc431..d878a85cbf 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -61,7 +61,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index 358177436b..f07810c565 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 6028d9dfc1..88729b1159 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js index be92ba9730..37dd300b5d 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js index 439a9b8740..716dac771d 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index a5a474d08f..817462d0bd 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index f9611d370a..a378c2f4a6 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -65,7 +65,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/input-range/expected-bundle.js b/test/js/samples/input-range/expected-bundle.js index 61560074dc..108fc37a01 100644 --- a/test/js/samples/input-range/expected-bundle.js +++ b/test/js/samples/input-range/expected-bundle.js @@ -77,7 +77,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index 9a0998ed9a..e3fb0c60a4 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -73,7 +73,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 41701a0b41..e1d6f84a8f 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -67,7 +67,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index 151a26f603..fd83ed3c68 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -77,7 +77,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 0cfeadbd9d..345d98d16e 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -63,7 +63,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { @@ -137,11 +137,13 @@ function create_main_fragment(component, ctx) { var text; var imported = new Imported({ - root: component.root + root: component.root, + store: component.store }); var nonimported = new NonImported({ - root: component.root + root: component.root, + store: component.store }); return { diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index e384445105..b3e01289c3 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -8,11 +8,13 @@ function create_main_fragment(component, ctx) { var text; var imported = new Imported({ - root: component.root + root: component.root, + store: component.store }); var nonimported = new NonImported({ - root: component.root + root: component.root, + store: component.store }); return { diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index da8d02f4d6..df0ea63860 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -49,7 +49,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 948fb03a4d..4073da0148 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index 1060deab4c..109ec3276b 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -49,7 +49,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index 979a7ff3e7..2771ac3719 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -73,7 +73,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 7fdc38fc63..2d718e483f 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -69,7 +69,7 @@ function init(component, options) { component.options = options; component.root = options.root || component; - component.store = component.root.store || options.store; + component.store = options.store || component.root.store; } function on(eventName, handler) { From 17000e38f66d184389b8fd562a3a7f4b0a39bdb3 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Wed, 20 Jun 2018 14:23:23 -0400 Subject: [PATCH 31/35] -> v2.8.0 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5051a1b22..653a14ed76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.8.0 + +* Correctly set store on nested components (to parent store, not root store) ([#1538](https://github.com/sveltejs/svelte/issues/1538)) + ## 2.7.2 * Prevent unnecessary remounts ([#1527](https://github.com/sveltejs/svelte/issues/1527)) diff --git a/package.json b/package.json index c1890ee3ae..b48344748c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.7.2", + "version": "2.8.0", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From fe9a68d071f05e7f613a235027829c2d7c879529 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann <christian@kaisermann.me> Date: Fri, 22 Jun 2018 14:55:13 -0300 Subject: [PATCH 32/35] Fix prefixed animation name replacement --- .editorconfig | 3 +++ src/css/Stylesheet.ts | 6 ++++-- src/utils/isKeyframesNode.ts | 7 ------- src/utils/removeCSSPrefix.ts | 3 +++ test/css/samples/keyframes-autoprefixed/expected.css | 2 +- test/css/samples/keyframes-autoprefixed/input.html | 2 ++ 6 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 src/utils/isKeyframesNode.ts create mode 100644 src/utils/removeCSSPrefix.ts diff --git a/.editorconfig b/.editorconfig index 854167bbed..ed2a319d58 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,6 +8,9 @@ indent_size = 2 charset = utf-8 trim_trailing_whitespace = true +[test/**/expected.css] +insert_final_newline = false + [{package.json,.travis.yml,.eslintrc.json}] indent_style = space indent_size = 2 diff --git a/src/css/Stylesheet.ts b/src/css/Stylesheet.ts index 8dadc4e296..32052f50d5 100644 --- a/src/css/Stylesheet.ts +++ b/src/css/Stylesheet.ts @@ -4,11 +4,13 @@ import { getLocator } from 'locate-character'; import Selector from './Selector'; import getCodeFrame from '../utils/getCodeFrame'; import hash from '../utils/hash'; -import isKeyframesNode from '../utils/isKeyframesNode'; +import removeCSSPrefix from '../utils/removeCSSPrefix'; import Element from '../compile/nodes/Element'; import { Validator } from '../validate/index'; import { Node, Ast, Warning } from '../interfaces'; +const isKeyframesNode = (node: Node) => removeCSSPrefix(node.name) === 'keyframes' + class Rule { selectors: Selector[]; declarations: Declaration[]; @@ -97,7 +99,7 @@ class Declaration { } transform(code: MagicString, keyframes: Map<string, string>) { - const property = this.node.property && this.node.property.toLowerCase(); + const property = this.node.property && removeCSSPrefix(this.node.property.toLowerCase()); if (property === 'animation' || property === 'animation-name') { this.node.value.children.forEach((block: Node) => { if (block.type === 'Identifier') { diff --git a/src/utils/isKeyframesNode.ts b/src/utils/isKeyframesNode.ts deleted file mode 100644 index 4ce899ff99..0000000000 --- a/src/utils/isKeyframesNode.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Node } from '../interfaces'; - -export default function isKeyframesNode(node: Node): boolean { - return ['', '-webkit-', '-moz-', '-o-'].some( - prefix => node.name === `${prefix}keyframes` - ); -} diff --git a/src/utils/removeCSSPrefix.ts b/src/utils/removeCSSPrefix.ts new file mode 100644 index 0000000000..df1849f119 --- /dev/null +++ b/src/utils/removeCSSPrefix.ts @@ -0,0 +1,3 @@ +export default function(name: string): string { + return name.replace(/^-((webkit)|(moz)|(o)|(ms))-/, ''); +} diff --git a/test/css/samples/keyframes-autoprefixed/expected.css b/test/css/samples/keyframes-autoprefixed/expected.css index a50a2b94d3..d9866778a9 100644 --- a/test/css/samples/keyframes-autoprefixed/expected.css +++ b/test/css/samples/keyframes-autoprefixed/expected.css @@ -1 +1 @@ -@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-webkit-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-moz-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-o-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.animated.svelte-xyz{animation:svelte-xyz-why 2s}.also-animated.svelte-xyz{animation:not-defined-here 2s} \ No newline at end of file +@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-webkit-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-moz-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}@-o-keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.animated.svelte-xyz{-webkit-animation:svelte-xyz-why 2s;animation:svelte-xyz-why 2s}.also-animated.svelte-xyz{-webkit-animation:not-defined-here 2s;animation:not-defined-here 2s} \ No newline at end of file diff --git a/test/css/samples/keyframes-autoprefixed/input.html b/test/css/samples/keyframes-autoprefixed/input.html index dfe5dd4578..1c0e1bc630 100644 --- a/test/css/samples/keyframes-autoprefixed/input.html +++ b/test/css/samples/keyframes-autoprefixed/input.html @@ -23,10 +23,12 @@ } .animated { + -webkit-animation: why 2s; animation: why 2s; } .also-animated { + -webkit-animation: not-defined-here 2s; animation: not-defined-here 2s; } </style> From f1fc81a49f5a399f0c3687bad96a135b0fbc4e65 Mon Sep 17 00:00:00 2001 From: Pavel Malyshev <pavel@mustlab.ru> Date: Fri, 22 Jun 2018 21:05:29 +0300 Subject: [PATCH 33/35] Fix for #1553 --- src/compile/nodes/EventHandler.ts | 4 ++-- test/js/samples/event-handlers-custom/expected-bundle.js | 2 +- test/js/samples/event-handlers-custom/expected.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compile/nodes/EventHandler.ts b/src/compile/nodes/EventHandler.ts index 54dbd66157..6c15de7efd 100644 --- a/src/compile/nodes/EventHandler.ts +++ b/src/compile/nodes/EventHandler.ts @@ -67,12 +67,12 @@ export default class EventHandler extends Node { compiler.code.overwrite( this.insertionPoint, this.insertionPoint + 1, - `${component}.store.` + `return ${component}.store.` ); } else { compiler.code.prependRight( this.insertionPoint, - `${component}.` + `return ${component}.` ); } } diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 78d5d1a005..501b2a9a3f 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -146,7 +146,7 @@ function create_main_fragment(component, ctx) { button = createElement("button"); button.textContent = "foo"; foo_handler = foo.call(component, button, function(event) { - component.foo( ctx.bar ); + return component.foo( ctx.bar ); }); }, diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js index c72362620b..855bea59ba 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -19,7 +19,7 @@ function create_main_fragment(component, ctx) { button = createElement("button"); button.textContent = "foo"; foo_handler = foo.call(component, button, function(event) { - component.foo( ctx.bar ); + return component.foo( ctx.bar ); }); }, From ce575e106502624cddd23ba1d8c0e565e51dcb20 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Fri, 22 Jun 2018 20:08:51 -0400 Subject: [PATCH 34/35] Revert "Fix for #1553" --- src/compile/nodes/EventHandler.ts | 4 ++-- test/js/samples/event-handlers-custom/expected-bundle.js | 2 +- test/js/samples/event-handlers-custom/expected.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compile/nodes/EventHandler.ts b/src/compile/nodes/EventHandler.ts index 6c15de7efd..54dbd66157 100644 --- a/src/compile/nodes/EventHandler.ts +++ b/src/compile/nodes/EventHandler.ts @@ -67,12 +67,12 @@ export default class EventHandler extends Node { compiler.code.overwrite( this.insertionPoint, this.insertionPoint + 1, - `return ${component}.store.` + `${component}.store.` ); } else { compiler.code.prependRight( this.insertionPoint, - `return ${component}.` + `${component}.` ); } } diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 501b2a9a3f..78d5d1a005 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -146,7 +146,7 @@ function create_main_fragment(component, ctx) { button = createElement("button"); button.textContent = "foo"; foo_handler = foo.call(component, button, function(event) { - return component.foo( ctx.bar ); + component.foo( ctx.bar ); }); }, diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js index 855bea59ba..c72362620b 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -19,7 +19,7 @@ function create_main_fragment(component, ctx) { button = createElement("button"); button.textContent = "foo"; foo_handler = foo.call(component, button, function(event) { - return component.foo( ctx.bar ); + component.foo( ctx.bar ); }); }, From bec49a0ad08489cd3fefbe348bd6807575191604 Mon Sep 17 00:00:00 2001 From: Rich Harris <richard.a.harris@gmail.com> Date: Fri, 22 Jun 2018 20:19:25 -0400 Subject: [PATCH 35/35] -> v2.8.1 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 653a14ed76..d3e7b5a137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.8.1 + +* Fix prefixed animation name replacement ([#1556](https://github.com/sveltejs/svelte/pull/1556)) + ## 2.8.0 * Correctly set store on nested components (to parent store, not root store) ([#1538](https://github.com/sveltejs/svelte/issues/1538)) diff --git a/package.json b/package.json index b48344748c..16f3142e90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.8.0", + "version": "2.8.1", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": {