From 836cc36598bcf64f86daa78faf04d7f54e7e850c Mon Sep 17 00:00:00 2001 From: Robert Hall Date: Thu, 15 Feb 2018 22:10:07 +0700 Subject: [PATCH 01/30] Using pageYOffset & pageXOffset --- src/generators/nodes/Window.ts | 6 +++--- test/js/samples/window-binding-scroll/expected-bundle.js | 6 +++--- test/js/samples/window-binding-scroll/expected.js | 6 +++--- test/runtime/samples/window-bind-scroll-update/_config.js | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/generators/nodes/Window.ts b/src/generators/nodes/Window.ts index c8b044bb2d..12754c9110 100644 --- a/src/generators/nodes/Window.ts +++ b/src/generators/nodes/Window.ts @@ -158,10 +158,10 @@ export default class Window extends Node { clearTimeout(${timeout}); var x = ${bindings.scrollX ? `#component.get("${bindings.scrollX}")` - : `window.scrollX`}; + : `window.pageXOffset || window.scrollX`}; var y = ${bindings.scrollY ? `#component.get("${bindings.scrollY}")` - : `window.scrollY`}; + : `window.pageYOffset || window.scrollY`}; window.scrollTo(x, y); ${timeout} = setTimeout(${clear}, 100); } @@ -182,7 +182,7 @@ export default class Window extends Node { #component.observe("${bindings.scrollX || bindings.scrollY}", function(${isX ? 'x' : 'y'}) { ${lock} = true; clearTimeout(${timeout}); - window.scrollTo(${isX ? 'x, window.scrollY' : 'window.scrollX, y'}); + window.scrollTo(${isX ? 'x, window.pageYOffset || window.scrollY' : 'window.pageXOffset || window.scrollX, y'}); ${timeout} = setTimeout(${clear}, 100); }); `); diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index e3d8e74030..55b4874c75 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -198,7 +198,7 @@ function create_main_fragment(state, component) { window_updating = true; component.set({ - y: this.scrollY + y: this.pageYOffset || this.scrollY }); window_updating = false; } @@ -207,7 +207,7 @@ function create_main_fragment(state, component) { component.observe("y", function(y) { window_updating = true; clearTimeout(window_updating_timeout); - window.scrollTo(window.scrollX, y); + window.scrollTo(window.pageXOffset || window.scrollX, y); window_updating_timeout = setTimeout(clear_window_updating, 100); }); @@ -243,7 +243,7 @@ function create_main_fragment(state, component) { function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - this._state.y = window.scrollY; + this._state.y = window.pageYOffset || window.scrollY; this._fragment = create_main_fragment(this._state, this); diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 70eae003d7..237460f71e 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -9,7 +9,7 @@ function create_main_fragment(state, component) { window_updating = true; component.set({ - y: this.scrollY + y: this.pageYOffset || this.scrollY }); window_updating = false; } @@ -18,7 +18,7 @@ function create_main_fragment(state, component) { component.observe("y", function(y) { window_updating = true; clearTimeout(window_updating_timeout); - window.scrollTo(window.scrollX, y); + window.scrollTo(window.pageXOffset || window.scrollX, y); window_updating_timeout = setTimeout(clear_window_updating, 100); }); @@ -54,7 +54,7 @@ function create_main_fragment(state, component) { function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - this._state.y = window.scrollY; + this._state.y = window.pageYOffset || window.scrollY; this._fragment = create_main_fragment(this._state, this); diff --git a/test/runtime/samples/window-bind-scroll-update/_config.js b/test/runtime/samples/window-bind-scroll-update/_config.js index 3ae13c33ce..34a19a8c3f 100644 --- a/test/runtime/samples/window-bind-scroll-update/_config.js +++ b/test/runtime/samples/window-bind-scroll-update/_config.js @@ -2,10 +2,10 @@ export default { skip: true, // JSDOM test ( assert, component, target, window ) { - assert.equal( window.scrollY, 0 ); + assert.equal( window.pageYOffset || window.scrollY, 0 ); component.set({ scrollY: 100 }); - assert.equal( window.scrollY, 100 ); + assert.equal( window.pageYOffset || window.scrollY, 100 ); component.destroy(); } From 08c54eec111ca5e116a0c2501632c50ad0b82413 Mon Sep 17 00:00:00 2001 From: Gareth Oates Date: Sat, 24 Feb 2018 21:26:04 +0100 Subject: [PATCH 02/30] Shameless plug of my svelte store package --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0a948d99cc..95b352e16a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ This is the Svelte compiler, which is primarily intended for authors of tooling * [svelte-hot-loader](https://github.com/ekhaled/svelte-hot-loader) – Webpack loader addon to support HMR * [meteor-svelte](https://github.com/klaussner/meteor-svelte) – Meteor build plugin * [sveltejs-brunch](https://github.com/StarpTech/sveltejs-brunch) – Brunch build plugin +* [svelte-dev-store](https://github.com/GarethOates/svelte-dev-store) - Use Redux tools to visualise Svelte store * More to come! From a5cc451c9c558fcbbe83afae2dc2b8a873070b26 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Feb 2018 08:45:59 -0500 Subject: [PATCH 03/30] only use page[XY]Offset --- src/generators/nodes/Window.ts | 16 +++++++++++----- .../window-binding-scroll/expected-bundle.js | 6 +++--- .../js/samples/window-binding-scroll/expected.js | 6 +++--- .../samples/window-bind-scroll-update/_config.js | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/generators/nodes/Window.ts b/src/generators/nodes/Window.ts index 12754c9110..7a1f70376b 100644 --- a/src/generators/nodes/Window.ts +++ b/src/generators/nodes/Window.ts @@ -19,6 +19,11 @@ const associatedEvents = { scrollY: 'scroll', }; +const properties = { + scrollX: 'pageXOffset', + scrollY: 'pageYOffset' +}; + const readonly = new Set([ 'innerWidth', 'innerHeight', @@ -93,15 +98,16 @@ export default class Window extends Node { if (attribute.name === 'online') return; const associatedEvent = associatedEvents[attribute.name]; + const property = properties[attribute.name] || attribute.name; if (!events[associatedEvent]) events[associatedEvent] = []; events[associatedEvent].push( - `${attribute.value.name}: this.${attribute.name}` + `${attribute.value.name}: this.${property}` ); // add initial value generator.metaBindings.push( - `this._state.${attribute.value.name} = window.${attribute.name};` + `this._state.${attribute.value.name} = window.${property};` ); } }); @@ -158,10 +164,10 @@ export default class Window extends Node { clearTimeout(${timeout}); var x = ${bindings.scrollX ? `#component.get("${bindings.scrollX}")` - : `window.pageXOffset || window.scrollX`}; + : `window.pageXOffset`}; var y = ${bindings.scrollY ? `#component.get("${bindings.scrollY}")` - : `window.pageYOffset || window.scrollY`}; + : `window.pageYOffset`}; window.scrollTo(x, y); ${timeout} = setTimeout(${clear}, 100); } @@ -182,7 +188,7 @@ export default class Window extends Node { #component.observe("${bindings.scrollX || bindings.scrollY}", function(${isX ? 'x' : 'y'}) { ${lock} = true; clearTimeout(${timeout}); - window.scrollTo(${isX ? 'x, window.pageYOffset || window.scrollY' : 'window.pageXOffset || window.scrollX, y'}); + window.scrollTo(${isX ? 'x, window.pageYOffset' : 'window.pageXOffset, y'}); ${timeout} = setTimeout(${clear}, 100); }); `); diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 55b4874c75..c362344587 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -198,7 +198,7 @@ function create_main_fragment(state, component) { window_updating = true; component.set({ - y: this.pageYOffset || this.scrollY + y: this.pageYOffset }); window_updating = false; } @@ -207,7 +207,7 @@ function create_main_fragment(state, component) { component.observe("y", function(y) { window_updating = true; clearTimeout(window_updating_timeout); - window.scrollTo(window.pageXOffset || window.scrollX, y); + window.scrollTo(window.pageXOffset, y); window_updating_timeout = setTimeout(clear_window_updating, 100); }); @@ -243,7 +243,7 @@ function create_main_fragment(state, component) { function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - this._state.y = window.pageYOffset || window.scrollY; + this._state.y = window.pageYOffset; this._fragment = create_main_fragment(this._state, this); diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 237460f71e..be6360a650 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -9,7 +9,7 @@ function create_main_fragment(state, component) { window_updating = true; component.set({ - y: this.pageYOffset || this.scrollY + y: this.pageYOffset }); window_updating = false; } @@ -18,7 +18,7 @@ function create_main_fragment(state, component) { component.observe("y", function(y) { window_updating = true; clearTimeout(window_updating_timeout); - window.scrollTo(window.pageXOffset || window.scrollX, y); + window.scrollTo(window.pageXOffset, y); window_updating_timeout = setTimeout(clear_window_updating, 100); }); @@ -54,7 +54,7 @@ function create_main_fragment(state, component) { function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); - this._state.y = window.pageYOffset || window.scrollY; + this._state.y = window.pageYOffset; this._fragment = create_main_fragment(this._state, this); diff --git a/test/runtime/samples/window-bind-scroll-update/_config.js b/test/runtime/samples/window-bind-scroll-update/_config.js index 34a19a8c3f..71a880e438 100644 --- a/test/runtime/samples/window-bind-scroll-update/_config.js +++ b/test/runtime/samples/window-bind-scroll-update/_config.js @@ -2,10 +2,10 @@ export default { skip: true, // JSDOM test ( assert, component, target, window ) { - assert.equal( window.pageYOffset || window.scrollY, 0 ); + assert.equal( window.pageYOffset, 0 ); component.set({ scrollY: 100 }); - assert.equal( window.pageYOffset || window.scrollY, 100 ); + assert.equal( window.pageYOffset, 100 ); component.destroy(); } From 1bc675da508e355789f3eae187e4a393dbbf4e54 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Feb 2018 10:36:54 -0500 Subject: [PATCH 04/30] fix a couple of TODOs --- src/generators/Generator.ts | 8 +------- src/generators/dom/Block.ts | 9 +++------ src/parse/state/tag.ts | 6 +++++- src/shared/index.js | 4 ++++ src/validate/html/index.ts | 21 +++++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/generators/Generator.ts b/src/generators/Generator.ts index cac7858c19..6aac05286d 100644 --- a/src/generators/Generator.ts +++ b/src/generators/Generator.ts @@ -168,7 +168,7 @@ export default class Generator { if (options.customElement === true) { this.customElement = { tag: this.tag, - props: this.props // TODO autofill this in + props: this.props } } else { this.customElement = options.customElement; @@ -752,12 +752,6 @@ export default class Generator { if (node.type === 'Element' && (node.name === ':Component' || node.name === ':Self' || generator.components.has(node.name))) { node.type = 'Component'; Object.setPrototypeOf(node, nodes.Component.prototype); - } else if (node.name === ':Window') { // TODO do this in parse? - node.type = 'Window'; - Object.setPrototypeOf(node, nodes.Window.prototype); - } else if (node.name === ':Head') { // TODO do this in parse? - node.type = 'Head'; - Object.setPrototypeOf(node, nodes.Head.prototype); } else if (node.type === 'Element' && node.name === 'title' && parentIsHead(parent)) { // TODO do this in parse? node.type = 'Title'; Object.setPrototypeOf(node, nodes.Title.prototype); diff --git a/src/generators/dom/Block.ts b/src/generators/dom/Block.ts index 0d786752dc..e393313e87 100644 --- a/src/generators/dom/Block.ts +++ b/src/generators/dom/Block.ts @@ -308,22 +308,19 @@ export default class Block { if (this.hasOutroMethod) { if (hasOutros) { properties.addBlock(deindent` - o: function outro(${this.alias('outrocallback')}) { + o: function outro(#outrocallback) { if (${outroing}) return; ${outroing} = true; ${hasIntros && `${introing} = false;`} - var ${this.alias('outros')} = ${this.outros}; + var #outros = ${this.outros}; ${this.builders.outro} }, `); } else { - // TODO should this be a helper? properties.addBlock(deindent` - o: function outro(outrocallback) { - outrocallback(); - }, + o: @run, `); } } diff --git a/src/parse/state/tag.ts b/src/parse/state/tag.ts index 57e2b1bbb9..b24fa31ae3 100644 --- a/src/parse/state/tag.ts +++ b/src/parse/state/tag.ts @@ -109,10 +109,14 @@ export default function tag(parser: Parser) { } } + const type = metaTags.has(name) + ? name.slice(1) + : 'Element'; // TODO in v2, capitalised name means 'Component' + const element: Node = { start, end: null, // filled in later - type: 'Element', + type, name, attributes: [], children: [], diff --git a/src/shared/index.js b/src/shared/index.js index d9d6475e64..839f9a4e54 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -138,6 +138,10 @@ export function onDev(eventName, handler) { return on.call(this, eventName, handler); } +export function run(fn) { + fn(); +} + export function set(newState) { this._set(assign({}, newState)); if (this.root._lock) return; diff --git a/src/validate/html/index.ts b/src/validate/html/index.ts index 9ae50baca1..680b8b729b 100644 --- a/src/validate/html/index.ts +++ b/src/validate/html/index.ts @@ -7,11 +7,6 @@ import flattenReference from '../../utils/flattenReference'; import { Validator } from '../index'; import { Node } from '../../interfaces'; -const meta = new Map([ - [':Window', validateWindow], - [':Head', validateHead] -]); - function isEmptyBlock(node: Node) { if (!/Block$/.test(node.type) || !node.children) return false; if (node.children.length > 1) return false; @@ -26,11 +21,15 @@ export default function validateHtml(validator: Validator, html: Node) { const elementStack: Node[] = []; function visit(node: Node) { - if (node.type === 'Element') { - if (meta.has(node.name)) { - return meta.get(node.name)(validator, node, refs, refCallees); - } + if (node.type === 'Window') { + validateWindow(validator, node, refs, refCallees); + } + else if (node.type === 'Head') { + validateHead(validator, node, refs, refCallees); + } + + else if (node.type === 'Element') { const isComponent = node.name === ':Self' || node.name === ':Component' || @@ -49,7 +48,9 @@ export default function validateHtml(validator: Validator, html: Node) { if (!isComponent) { a11y(validator, node, elementStack); } - } else if (node.type === 'EachBlock') { + } + + else if (node.type === 'EachBlock') { if (validator.helpers.has(node.context)) { let c = node.expression.end; From c6bba03f1da00fd4982ff3de38d59e90eb1ebb3b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Feb 2018 10:48:06 -0500 Subject: [PATCH 05/30] use external is-reference library --- src/generators/Generator.ts | 2 +- src/generators/dom/index.ts | 2 +- src/utils/isReference.ts | 34 -------------------- src/validate/js/utils/usesThisOrArguments.ts | 2 +- 4 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 src/utils/isReference.ts diff --git a/src/generators/Generator.ts b/src/generators/Generator.ts index 6aac05286d..294c7fd8fa 100644 --- a/src/generators/Generator.ts +++ b/src/generators/Generator.ts @@ -1,10 +1,10 @@ import MagicString, { Bundle } from 'magic-string'; +import isReference from 'is-reference'; import { walk, childKeys } from 'estree-walker'; import { getLocator } from 'locate-character'; import deindent from '../utils/deindent'; import CodeBuilder from '../utils/CodeBuilder'; import getCodeFrame from '../utils/getCodeFrame'; -import isReference from '../utils/isReference'; import flattenReference from '../utils/flattenReference'; import reservedNames from '../utils/reservedNames'; import namespaces from '../utils/namespaces'; diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 1d25c4bcfc..90d94ce384 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -1,7 +1,7 @@ import MagicString from 'magic-string'; +import isReference from 'is-reference'; import { parseExpressionAt } from 'acorn'; import annotateWithScopes from '../../utils/annotateWithScopes'; -import isReference from '../../utils/isReference'; import { walk } from 'estree-walker'; import deindent from '../../utils/deindent'; import { stringify, escape } from '../../utils/stringify'; diff --git a/src/utils/isReference.ts b/src/utils/isReference.ts deleted file mode 100644 index 9a5f3688fb..0000000000 --- a/src/utils/isReference.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Node } from '../interfaces'; - -export default function isReference(node: Node, parent: Node): boolean { - if (node.type === 'MemberExpression') { - return !node.computed && isReference(node.object, node); - } - - if (node.type === 'Identifier') { - // the only time we could have an identifier node without a parent is - // if it's the entire body of a function without a block statement – - // i.e. an arrow function expression like `a => a` - if (!parent) return true; - - // TODO is this right? - if ( - parent.type === 'MemberExpression' || - parent.type === 'MethodDefinition' - ) { - return parent.computed || node === parent.object; - } - - // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }` - if (parent.type === 'Property') - return parent.computed || node === parent.value; - - // disregard the `bar` in `class Foo { bar () {...} }` - if (parent.type === 'MethodDefinition') return false; - - // disregard the `bar` in `export { foo as bar }` - if (parent.type === 'ExportSpecifier' && node !== parent.local) return; - - return true; - } -} diff --git a/src/validate/js/utils/usesThisOrArguments.ts b/src/validate/js/utils/usesThisOrArguments.ts index 958594a9eb..b727ed387b 100644 --- a/src/validate/js/utils/usesThisOrArguments.ts +++ b/src/validate/js/utils/usesThisOrArguments.ts @@ -1,5 +1,5 @@ import { walk } from 'estree-walker'; -import isReference from '../../../utils/isReference'; +import isReference from 'is-reference'; import { Node } from '../../../interfaces'; export default function usesThisOrArguments(node: Node) { From da155878a8dd7c4eff2c6b9105c2c4cca86c458f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Feb 2018 10:56:50 -0500 Subject: [PATCH 06/30] refactor IfBlock slightly --- src/generators/nodes/IfBlock.ts | 588 +++++++++++++++----------------- 1 file changed, 280 insertions(+), 308 deletions(-) diff --git a/src/generators/nodes/IfBlock.ts b/src/generators/nodes/IfBlock.ts index 17cd92bc29..8441bff714 100644 --- a/src/generators/nodes/IfBlock.ts +++ b/src/generators/nodes/IfBlock.ts @@ -101,7 +101,7 @@ export default class IfBlock extends Node { ? block.getUniqueName(`${name}_anchor`) : (this.next && this.next.var) || 'null'; - const branches = getBranches(this.generator, block, parentNode, parentNodes, this); + const branches = this.getBranches(block, parentNode, parentNodes, this); const hasElse = isElseBranch(branches[branches.length - 1]); const if_name = hasElse ? '' : `if (${name}) `; @@ -113,21 +113,12 @@ export default class IfBlock extends Node { if (this.else) { if (hasOutros) { - compoundWithOutros( - this.generator, - block, - parentNode, - parentNodes, - this, - branches, - dynamic, - vars - ); + this.buildCompoundWithOutros(block, parentNode, parentNodes, branches, dynamic, vars); } else { - compound(this.generator, block, parentNode, parentNodes, this, branches, dynamic, vars); + this.buildCompound(block, parentNode, parentNodes, branches, dynamic, vars); } } else { - simple(this.generator, block, parentNode, parentNodes, this, branches[0], dynamic, vars); + this.buildSimple(block, parentNode, parentNodes, branches[0], dynamic, vars); } block.builders.create.addLine(`${if_name}${name}.c();`); @@ -147,353 +138,334 @@ export default class IfBlock extends Node { ); } } -} - + buildCompound( + block: Block, + parentNode: string, + parentNodes: string, + branches, + dynamic, + { name, anchor, hasElse, if_name } + ) { + const select_block_type = this.generator.getUniqueName(`select_block_type`); + const current_block_type = block.getUniqueName(`current_block_type`); + const current_block_type_and = hasElse ? '' : `${current_block_type} && `; + + this.generator.blocks.push(deindent` + function ${select_block_type}(state) { + ${branches + .map(({ condition, block }) => `${condition ? `if (${condition}) ` : ''}return ${block};`) + .join('\n')} + } + `); + block.builders.init.addBlock(deindent` + var ${current_block_type} = ${select_block_type}(state); + var ${name} = ${current_block_type_and}${current_block_type}(#component, state); + `); + const mountOrIntro = branches[0].hasIntroMethod ? 'i' : 'm'; -// TODO move all this into the class + const initialMountNode = parentNode || '#target'; + const anchorNode = parentNode ? 'null' : 'anchor'; + block.builders.mount.addLine( + `${if_name}${name}.${mountOrIntro}(${initialMountNode}, ${anchorNode});` + ); -function getBranches( - generator: DomGenerator, - block: Block, - parentNode: string, - parentNodes: string, - node: Node -) { - block.contextualise(node.expression); // TODO remove + const updateMountNode = this.getUpdateMountNode(anchor); - const branches = [ - { - condition: node.metadata.snippet, - block: node.block.name, - hasUpdateMethod: node.block.hasUpdateMethod, - hasIntroMethod: node.block.hasIntroMethod, - hasOutroMethod: node.block.hasOutroMethod, - }, - ]; + const changeBlock = deindent` + ${hasElse + ? deindent` + ${name}.u(); + ${name}.d(); + ` + : deindent` + if (${name}) { + ${name}.u(); + ${name}.d(); + }`} + ${name} = ${current_block_type_and}${current_block_type}(#component, state); + ${if_name}${name}.c(); + ${if_name}${name}.${mountOrIntro}(${updateMountNode}, ${anchor}); + `; - visitChildren(generator, block, node); + if (dynamic) { + block.builders.update.addBlock(deindent` + if (${current_block_type} === (${current_block_type} = ${select_block_type}(state)) && ${name}) { + ${name}.p(changed, state); + } else { + ${changeBlock} + } + `); + } else { + block.builders.update.addBlock(deindent` + if (${current_block_type} !== (${current_block_type} = ${select_block_type}(state))) { + ${changeBlock} + } + `); + } - if (isElseIf(node.else)) { - branches.push( - ...getBranches(generator, block, parentNode, parentNodes, node.else.children[0]) - ); - } else { - branches.push({ - condition: null, - block: node.else ? node.else.block.name : null, - hasUpdateMethod: node.else ? node.else.block.hasUpdateMethod : false, - hasIntroMethod: node.else ? node.else.block.hasIntroMethod : false, - hasOutroMethod: node.else ? node.else.block.hasOutroMethod : false, - }); + block.builders.unmount.addLine(`${if_name}${name}.u();`); - if (node.else) { - visitChildren(generator, block, node.else); - } + block.builders.destroy.addLine(`${if_name}${name}.d();`); } - return branches; -} + // if any of the siblings have outros, we need to keep references to the blocks + // (TODO does this only apply to bidi transitions?) + buildCompoundWithOutros( + block: Block, + parentNode: string, + parentNodes: string, + branches, + dynamic, + { name, anchor, hasElse } + ) { + const select_block_type = block.getUniqueName(`select_block_type`); + const current_block_type_index = block.getUniqueName(`current_block_type_index`); + const previous_block_index = block.getUniqueName(`previous_block_index`); + const if_block_creators = block.getUniqueName(`if_block_creators`); + const if_blocks = block.getUniqueName(`if_blocks`); -function visitChildren( - generator: DomGenerator, - block: Block, - node: Node -) { - node.children.forEach((child: Node) => { - child.build(node.block, null, 'nodes'); - }); -} + const if_current_block_type_index = hasElse + ? '' + : `if (~${current_block_type_index}) `; + block.addVariable(current_block_type_index); + block.addVariable(name); + block.builders.init.addBlock(deindent` + var ${if_block_creators} = [ + ${branches.map(branch => branch.block).join(',\n')} + ]; -function simple( - generator: DomGenerator, - block: Block, - parentNode: string, - parentNodes: string, - node: Node, - branch, - dynamic, - { name, anchor, if_name } -) { - block.builders.init.addBlock(deindent` - var ${name} = (${branch.condition}) && ${branch.block}(#component, state); - `); + var ${if_blocks} = []; - const mountOrIntro = branch.hasIntroMethod ? 'i' : 'm'; - const initialMountNode = parentNode || '#target'; - const anchorNode = parentNode ? 'null' : 'anchor'; + function ${select_block_type}(state) { + ${branches + .map(({ condition, block }, i) => `${condition ? `if (${condition}) ` : ''}return ${block ? i : -1};`) + .join('\n')} + } + `); - block.builders.mount.addLine( - `if (${name}) ${name}.${mountOrIntro}(${initialMountNode}, ${anchorNode});` - ); + if (hasElse) { + block.builders.init.addBlock(deindent` + ${current_block_type_index} = ${select_block_type}(state); + ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](#component, state); + `); + } else { + block.builders.init.addBlock(deindent` + if (~(${current_block_type_index} = ${select_block_type}(state))) { + ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](#component, state); + } + `); + } - const updateMountNode = node.getUpdateMountNode(anchor); + const mountOrIntro = branches[0].hasIntroMethod ? 'i' : 'm'; + const initialMountNode = parentNode || '#target'; + const anchorNode = parentNode ? 'null' : 'anchor'; - const enter = dynamic - ? branch.hasIntroMethod + block.builders.mount.addLine( + `${if_current_block_type_index}${if_blocks}[${current_block_type_index}].${mountOrIntro}(${initialMountNode}, ${anchorNode});` + ); + + const updateMountNode = this.getUpdateMountNode(anchor); + + const destroyOldBlock = deindent` + ${name}.o(function() { + ${if_blocks}[ ${previous_block_index} ].u(); + ${if_blocks}[ ${previous_block_index} ].d(); + ${if_blocks}[ ${previous_block_index} ] = null; + }); + `; + + const createNewBlock = deindent` + ${name} = ${if_blocks}[${current_block_type_index}]; + if (!${name}) { + ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](#component, state); + ${name}.c(); + } + ${name}.${mountOrIntro}(${updateMountNode}, ${anchor}); + `; + + const changeBlock = hasElse ? deindent` - if (${name}) { - ${name}.p(changed, state); - } else { - ${name} = ${branch.block}(#component, state); - if (${name}) ${name}.c(); - } + ${destroyOldBlock} - ${name}.i(${updateMountNode}, ${anchor}); + ${createNewBlock} ` : deindent` if (${name}) { - ${name}.p(changed, state); - } else { - ${name} = ${branch.block}(#component, state); - ${name}.c(); - ${name}.m(${updateMountNode}, ${anchor}); + ${destroyOldBlock} } - ` - : branch.hasIntroMethod - ? deindent` - if (!${name}) { - ${name} = ${branch.block}(#component, state); - ${name}.c(); - } - ${name}.i(${updateMountNode}, ${anchor}); - ` - : deindent` - if (!${name}) { - ${name} = ${branch.block}(#component, state); - ${name}.c(); - ${name}.m(${updateMountNode}, ${anchor}); + + if (~${current_block_type_index}) { + ${createNewBlock} + } else { + ${name} = null; } `; - // no `p()` here — we don't want to update outroing nodes, - // as that will typically result in glitching - const exit = branch.hasOutroMethod - ? deindent` - ${name}.o(function() { - ${name}.u(); - ${name}.d(); - ${name} = null; - }); - ` - : deindent` - ${name}.u(); - ${name}.d(); - ${name} = null; - `; - - block.builders.update.addBlock(deindent` - if (${branch.condition}) { - ${enter} - } else if (${name}) { - ${exit} + if (dynamic) { + block.builders.update.addBlock(deindent` + var ${previous_block_index} = ${current_block_type_index}; + ${current_block_type_index} = ${select_block_type}(state); + if (${current_block_type_index} === ${previous_block_index}) { + ${if_current_block_type_index}${if_blocks}[${current_block_type_index}].p(changed, state); + } else { + ${changeBlock} + } + `); + } else { + block.builders.update.addBlock(deindent` + var ${previous_block_index} = ${current_block_type_index}; + ${current_block_type_index} = ${select_block_type}(state); + if (${current_block_type_index} !== ${previous_block_index}) { + ${changeBlock} + } + `); } - `); - block.builders.unmount.addLine(`${if_name}${name}.u();`); - - block.builders.destroy.addLine(`${if_name}${name}.d();`); -} + block.builders.destroy.addLine(deindent` + ${if_current_block_type_index}{ + ${if_blocks}[${current_block_type_index}].u(); + ${if_blocks}[${current_block_type_index}].d(); + } + `); + } -function compound( - generator: DomGenerator, - block: Block, - parentNode: string, + buildSimple( + block: Block, + parentNode: string, parentNodes: string, - node: Node, - branches, - dynamic, - { name, anchor, hasElse, if_name } -) { - const select_block_type = generator.getUniqueName(`select_block_type`); - const current_block_type = block.getUniqueName(`current_block_type`); - const current_block_type_and = hasElse ? '' : `${current_block_type} && `; - - generator.blocks.push(deindent` - function ${select_block_type}(state) { - ${branches - .map(({ condition, block }) => `${condition ? `if (${condition}) ` : ''}return ${block};`) - .join('\n')} - } - `); - - block.builders.init.addBlock(deindent` - var ${current_block_type} = ${select_block_type}(state); - var ${name} = ${current_block_type_and}${current_block_type}(#component, state); - `); - - const mountOrIntro = branches[0].hasIntroMethod ? 'i' : 'm'; + branch, + dynamic, + { name, anchor, if_name } + ) { + block.builders.init.addBlock(deindent` + var ${name} = (${branch.condition}) && ${branch.block}(#component, state); + `); - const initialMountNode = parentNode || '#target'; - const anchorNode = parentNode ? 'null' : 'anchor'; - block.builders.mount.addLine( - `${if_name}${name}.${mountOrIntro}(${initialMountNode}, ${anchorNode});` - ); + const mountOrIntro = branch.hasIntroMethod ? 'i' : 'm'; + const initialMountNode = parentNode || '#target'; + const anchorNode = parentNode ? 'null' : 'anchor'; - const updateMountNode = node.getUpdateMountNode(anchor); + block.builders.mount.addLine( + `if (${name}) ${name}.${mountOrIntro}(${initialMountNode}, ${anchorNode});` + ); - const changeBlock = deindent` - ${hasElse + const updateMountNode = this.getUpdateMountNode(anchor); + + const enter = dynamic + ? branch.hasIntroMethod + ? deindent` + if (${name}) { + ${name}.p(changed, state); + } else { + ${name} = ${branch.block}(#component, state); + if (${name}) ${name}.c(); + } + + ${name}.i(${updateMountNode}, ${anchor}); + ` + : deindent` + if (${name}) { + ${name}.p(changed, state); + } else { + ${name} = ${branch.block}(#component, state); + ${name}.c(); + ${name}.m(${updateMountNode}, ${anchor}); + } + ` + : branch.hasIntroMethod + ? deindent` + if (!${name}) { + ${name} = ${branch.block}(#component, state); + ${name}.c(); + } + ${name}.i(${updateMountNode}, ${anchor}); + ` + : deindent` + if (!${name}) { + ${name} = ${branch.block}(#component, state); + ${name}.c(); + ${name}.m(${updateMountNode}, ${anchor}); + } + `; + + // no `p()` here — we don't want to update outroing nodes, + // as that will typically result in glitching + const exit = branch.hasOutroMethod ? deindent` - ${name}.u(); - ${name}.d(); - ` - : deindent` - if (${name}) { + ${name}.o(function() { ${name}.u(); ${name}.d(); - }`} - ${name} = ${current_block_type_and}${current_block_type}(#component, state); - ${if_name}${name}.c(); - ${if_name}${name}.${mountOrIntro}(${updateMountNode}, ${anchor}); - `; + ${name} = null; + }); + ` + : deindent` + ${name}.u(); + ${name}.d(); + ${name} = null; + `; - if (dynamic) { block.builders.update.addBlock(deindent` - if (${current_block_type} === (${current_block_type} = ${select_block_type}(state)) && ${name}) { - ${name}.p(changed, state); - } else { - ${changeBlock} + if (${branch.condition}) { + ${enter} + } else if (${name}) { + ${exit} } `); - } else { - block.builders.update.addBlock(deindent` - if (${current_block_type} !== (${current_block_type} = ${select_block_type}(state))) { - ${changeBlock} - } - `); - } - block.builders.unmount.addLine(`${if_name}${name}.u();`); + block.builders.unmount.addLine(`${if_name}${name}.u();`); - block.builders.destroy.addLine(`${if_name}${name}.d();`); -} + block.builders.destroy.addLine(`${if_name}${name}.d();`); + } -// if any of the siblings have outros, we need to keep references to the blocks -// (TODO does this only apply to bidi transitions?) -function compoundWithOutros( - generator: DomGenerator, - block: Block, - parentNode: string, - parentNodes: string, - node: Node, - branches, - dynamic, - { name, anchor, hasElse } -) { - const select_block_type = block.getUniqueName(`select_block_type`); - const current_block_type_index = block.getUniqueName(`current_block_type_index`); - const previous_block_index = block.getUniqueName(`previous_block_index`); - const if_block_creators = block.getUniqueName(`if_block_creators`); - const if_blocks = block.getUniqueName(`if_blocks`); - - const if_current_block_type_index = hasElse - ? '' - : `if (~${current_block_type_index}) `; - - block.addVariable(current_block_type_index); - block.addVariable(name); - - block.builders.init.addBlock(deindent` - var ${if_block_creators} = [ - ${branches.map(branch => branch.block).join(',\n')} + getBranches( + block: Block, + parentNode: string, + parentNodes: string, + node: Node + ) { + block.contextualise(node.expression); // TODO remove + + const branches = [ + { + condition: node.metadata.snippet, + block: node.block.name, + hasUpdateMethod: node.block.hasUpdateMethod, + hasIntroMethod: node.block.hasIntroMethod, + hasOutroMethod: node.block.hasOutroMethod, + }, ]; - var ${if_blocks} = []; + this.visitChildren(block, node); - function ${select_block_type}(state) { - ${branches - .map(({ condition, block }, i) => `${condition ? `if (${condition}) ` : ''}return ${block ? i : -1};`) - .join('\n')} - } - `); + if (isElseIf(node.else)) { + branches.push( + ...this.getBranches(block, parentNode, parentNodes, node.else.children[0]) + ); + } else { + branches.push({ + condition: null, + block: node.else ? node.else.block.name : null, + hasUpdateMethod: node.else ? node.else.block.hasUpdateMethod : false, + hasIntroMethod: node.else ? node.else.block.hasIntroMethod : false, + hasOutroMethod: node.else ? node.else.block.hasOutroMethod : false, + }); - if (hasElse) { - block.builders.init.addBlock(deindent` - ${current_block_type_index} = ${select_block_type}(state); - ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](#component, state); - `); - } else { - block.builders.init.addBlock(deindent` - if (~(${current_block_type_index} = ${select_block_type}(state))) { - ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](#component, state); + if (node.else) { + this.visitChildren(block, node.else); } - `); - } - - const mountOrIntro = branches[0].hasIntroMethod ? 'i' : 'm'; - const initialMountNode = parentNode || '#target'; - const anchorNode = parentNode ? 'null' : 'anchor'; - - block.builders.mount.addLine( - `${if_current_block_type_index}${if_blocks}[${current_block_type_index}].${mountOrIntro}(${initialMountNode}, ${anchorNode});` - ); - - const updateMountNode = node.getUpdateMountNode(anchor); - - const destroyOldBlock = deindent` - ${name}.o(function() { - ${if_blocks}[ ${previous_block_index} ].u(); - ${if_blocks}[ ${previous_block_index} ].d(); - ${if_blocks}[ ${previous_block_index} ] = null; - }); - `; - - const createNewBlock = deindent` - ${name} = ${if_blocks}[${current_block_type_index}]; - if (!${name}) { - ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](#component, state); - ${name}.c(); } - ${name}.${mountOrIntro}(${updateMountNode}, ${anchor}); - `; - const changeBlock = hasElse - ? deindent` - ${destroyOldBlock} - - ${createNewBlock} - ` - : deindent` - if (${name}) { - ${destroyOldBlock} - } - - if (~${current_block_type_index}) { - ${createNewBlock} - } else { - ${name} = null; - } - `; - - if (dynamic) { - block.builders.update.addBlock(deindent` - var ${previous_block_index} = ${current_block_type_index}; - ${current_block_type_index} = ${select_block_type}(state); - if (${current_block_type_index} === ${previous_block_index}) { - ${if_current_block_type_index}${if_blocks}[${current_block_type_index}].p(changed, state); - } else { - ${changeBlock} - } - `); - } else { - block.builders.update.addBlock(deindent` - var ${previous_block_index} = ${current_block_type_index}; - ${current_block_type_index} = ${select_block_type}(state); - if (${current_block_type_index} !== ${previous_block_index}) { - ${changeBlock} - } - `); + return branches; } - block.builders.destroy.addLine(deindent` - ${if_current_block_type_index}{ - ${if_blocks}[${current_block_type_index}].u(); - ${if_blocks}[${current_block_type_index}].d(); - } - `); + visitChildren(block: Block, node: Node) { + node.children.forEach((child: Node) => { + child.build(node.block, null, 'nodes'); + }); + } } \ No newline at end of file From 7638964fc064389d1a02d54889f3f9194ac6aaa3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Feb 2018 11:13:02 -0500 Subject: [PATCH 07/30] use else instead of if (!previousCondition) where possible --- src/generators/nodes/Slot.ts | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/generators/nodes/Slot.ts b/src/generators/nodes/Slot.ts index 2a2251448d..dcb1f9ef8c 100644 --- a/src/generators/nodes/Slot.ts +++ b/src/generators/nodes/Slot.ts @@ -9,7 +9,7 @@ import Block from '../dom/Block'; export default class Slot extends Element { type: 'Element'; name: string; - attributes: Attribute[]; // TODO have more specific Attribute type + attributes: Attribute[]; children: Node[]; init( @@ -54,6 +54,9 @@ export default class Slot extends Element { if (needsAnchorBefore) block.addVariable(anchorBefore); if (needsAnchorAfter) block.addVariable(anchorAfter); + let mountBefore = block.builders.mount.toString(); + let unmountBefore = block.builders.unmount.toString(); + block.builders.create.pushCondition(`!${content_name}`); block.builders.hydrate.pushCondition(`!${content_name}`); block.builders.mount.pushCondition(`!${content_name}`); @@ -72,10 +75,13 @@ export default class Slot extends Element { block.builders.unmount.popCondition(); block.builders.destroy.popCondition(); - // TODO can we use an else here? + const mountLeadin = block.builders.mount.toString() !== mountBefore + ? `else` + : `if (${content_name})`; + if (parentNode) { block.builders.mount.addBlock(deindent` - if (${content_name}) { + ${mountLeadin} { ${needsAnchorBefore && `@appendNode(${anchorBefore} || (${anchorBefore} = @createComment()), ${parentNode});`} @appendNode(${content_name}, ${parentNode}); ${needsAnchorAfter && `@appendNode(${anchorAfter} || (${anchorAfter} = @createComment()), ${parentNode});`} @@ -83,7 +89,7 @@ export default class Slot extends Element { `); } else { block.builders.mount.addBlock(deindent` - if (${content_name}) { + ${mountLeadin} { ${needsAnchorBefore && `@insertNode(${anchorBefore} || (${anchorBefore} = @createComment()), #target, anchor);`} @insertNode(${content_name}, #target, anchor); ${needsAnchorAfter && `@insertNode(${anchorAfter} || (${anchorAfter} = @createComment()), #target, anchor);`} @@ -95,28 +101,31 @@ export default class Slot extends Element { // so that it can be reinserted later // TODO so that this can work with public API, component._slotted should // be all fragments, derived from options.slots. Not === options.slots - // TODO can we use an else here? + const unmountLeadin = block.builders.unmount.toString() !== unmountBefore + ? `else` + : `if (${content_name})`; + if (anchorBefore === 'null' && anchorAfter === 'null') { block.builders.unmount.addBlock(deindent` - if (${content_name}) { + ${unmountLeadin} { @reinsertChildren(${parentNode}, ${content_name}); } `); } else if (anchorBefore === 'null') { block.builders.unmount.addBlock(deindent` - if (${content_name}) { + ${unmountLeadin} { @reinsertBefore(${anchorAfter}, ${content_name}); } `); } else if (anchorAfter === 'null') { block.builders.unmount.addBlock(deindent` - if (${content_name}) { + ${unmountLeadin} { @reinsertAfter(${anchorBefore}, ${content_name}); } `); } else { block.builders.unmount.addBlock(deindent` - if (${content_name}) { + ${unmountLeadin} { @reinsertBetween(${anchorBefore}, ${anchorAfter}, ${content_name}); @detachNode(${anchorBefore}); @detachNode(${anchorAfter}); From f8d6d999304999508ec4f2025f6f6815c9a7544f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Feb 2018 11:20:13 -0500 Subject: [PATCH 08/30] implement remount on individual nodes --- src/generators/nodes/Component.ts | 34 ++++---------------------- src/generators/nodes/EachBlock.ts | 5 ++++ src/generators/nodes/Element.ts | 9 +++++++ src/generators/nodes/MustacheTag.ts | 4 +++ src/generators/nodes/RawMustacheTag.ts | 4 +++ src/generators/nodes/Text.ts | 4 +++ src/generators/nodes/shared/Node.ts | 4 +++ 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/generators/nodes/Component.ts b/src/generators/nodes/Component.ts index d2cf47e22d..566b1c83a1 100644 --- a/src/generators/nodes/Component.ts +++ b/src/generators/nodes/Component.ts @@ -320,7 +320,7 @@ export default class Component extends Node { ${name} = new ${switch_vars.value}(${switch_vars.props}(state)); ${name}._fragment.c(); - ${this.children.map(child => remount(generator, child, name))} + ${this.children.map(child => child.remount(name))} ${name}._mount(${updateMountNode}, ${anchor}); ${eventHandlers.map(handler => deindent` @@ -398,6 +398,10 @@ export default class Component extends Node { `); } } + + remount(name: string) { + return `${this.var}._mount(${name}._slotted${this.generator.legacy ? `["default"]` : `.default`}, null);`; + } } function mungeAttribute(attribute: Node, block: Block): Attribute { @@ -547,32 +551,4 @@ function isComputed(node: Node) { } return false; -} - -function remount(generator: DomGenerator, node: Node, name: string) { - // TODO make this a method of the nodes - - if (node.type === 'Component') { - return `${node.var}._mount(${name}._slotted${generator.legacy ? `["default"]` : `.default`}, null);`; - } - - if (node.type === 'Element') { - const slot = node.attributes.find(attribute => attribute.name === 'slot'); - if (slot) { - return `@appendNode(${node.var}, ${name}._slotted.${node.getStaticAttributeValue('slot')});`; - } - - return `@appendNode(${node.var}, ${name}._slotted${generator.legacy ? `["default"]` : `.default`});`; - } - - if (node.type === 'Text' || node.type === 'MustacheTag' || node.type === 'RawMustacheTag') { - return `@appendNode(${node.var}, ${name}._slotted${generator.legacy ? `["default"]` : `.default`});`; - } - - if (node.type === 'EachBlock') { - // TODO consider keyed blocks - return `for (var #i = 0; #i < ${node.iterations}.length; #i += 1) ${node.iterations}[#i].m(${name}._slotted${generator.legacy ? `["default"]` : `.default`}, null);`; - } - - return `${node.var}.m(${name}._slotted${generator.legacy ? `["default"]` : `.default`}, null);`; } \ No newline at end of file diff --git a/src/generators/nodes/EachBlock.ts b/src/generators/nodes/EachBlock.ts index 11a8a0c632..97671c37b0 100644 --- a/src/generators/nodes/EachBlock.ts +++ b/src/generators/nodes/EachBlock.ts @@ -594,4 +594,9 @@ export default class EachBlock extends Node { block.builders.destroy.addBlock(`@destroyEach(${iterations});`); } + + remount(name: string) { + // TODO consider keyed blocks + return `for (var #i = 0; #i < ${this.iterations}.length; #i += 1) ${this.iterations}[#i].m(${name}._slotted${this.generator.legacy ? `["default"]` : `.default`}, null);`; + } } diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index 13f8ccff5c..2a75f1fc36 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -671,6 +671,15 @@ export default class Element extends Node { isMediaNode() { return this.name === 'audio' || this.name === 'video'; } + + remount(name: string) { + const slot = this.attributes.find(attribute => attribute.name === 'slot'); + if (slot) { + return `@appendNode(${this.var}, ${name}._slotted.${this.getStaticAttributeValue('slot')});`; + } + + return `@appendNode(${this.var}, ${name}._slotted${this.generator.legacy ? `["default"]` : `.default`});`; + } } function getRenderStatement( diff --git a/src/generators/nodes/MustacheTag.ts b/src/generators/nodes/MustacheTag.ts index 21b3b30df2..7960f06949 100644 --- a/src/generators/nodes/MustacheTag.ts +++ b/src/generators/nodes/MustacheTag.ts @@ -26,4 +26,8 @@ export default class MustacheTag extends Tag { parentNode ); } + + remount(name: string) { + return `@appendNode(${this.var}, ${name}._slotted${this.generator.legacy ? `["default"]` : `.default`});`; + } } \ No newline at end of file diff --git a/src/generators/nodes/RawMustacheTag.ts b/src/generators/nodes/RawMustacheTag.ts index 6e9e5e664e..0d01135fa7 100644 --- a/src/generators/nodes/RawMustacheTag.ts +++ b/src/generators/nodes/RawMustacheTag.ts @@ -89,4 +89,8 @@ export default class RawMustacheTag extends Tag { addAnchorAfter(); } } + + remount(name: string) { + return `@appendNode(${this.var}, ${name}._slotted${this.generator.legacy ? `["default"]` : `.default`});`; + } } \ No newline at end of file diff --git a/src/generators/nodes/Text.ts b/src/generators/nodes/Text.ts index b0e5a823c2..c1e401a665 100644 --- a/src/generators/nodes/Text.ts +++ b/src/generators/nodes/Text.ts @@ -58,4 +58,8 @@ export default class Text extends Node { parentNode ); } + + remount(name: string) { + return `@appendNode(${this.var}, ${name}._slotted${this.generator.legacy ? `["default"]` : `.default`});`; + } } \ No newline at end of file diff --git a/src/generators/nodes/shared/Node.ts b/src/generators/nodes/shared/Node.ts index 3461ddd6f2..1dad916983 100644 --- a/src/generators/nodes/shared/Node.ts +++ b/src/generators/nodes/shared/Node.ts @@ -161,4 +161,8 @@ export default class Node { getUpdateMountNode(anchor: string) { return this.parent.isDomNode() ? this.parent.var : `${anchor}.parentNode`; } + + remount(name: string) { + return `${this.var}.m(${name}._slotted${this.generator.legacy ? `["default"]` : `.default`}, null);`; + } } \ No newline at end of file From ff6e104f92f74adaf7c8d59c991c55745cd3a3f9 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 2 Mar 2018 15:54:17 -0500 Subject: [PATCH 09/30] add failing test for #1195 --- test/runtime/samples/if-block-else-in-each/_config.js | 9 +++++++++ test/runtime/samples/if-block-else-in-each/main.html | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 test/runtime/samples/if-block-else-in-each/_config.js create mode 100644 test/runtime/samples/if-block-else-in-each/main.html diff --git a/test/runtime/samples/if-block-else-in-each/_config.js b/test/runtime/samples/if-block-else-in-each/_config.js new file mode 100644 index 0000000000..99337dfc40 --- /dev/null +++ b/test/runtime/samples/if-block-else-in-each/_config.js @@ -0,0 +1,9 @@ +export default { + data: { + array: [true, false], + }, + html: ` +
foo
+
bar
+ `, +}; diff --git a/test/runtime/samples/if-block-else-in-each/main.html b/test/runtime/samples/if-block-else-in-each/main.html new file mode 100644 index 0000000000..81cd07273f --- /dev/null +++ b/test/runtime/samples/if-block-else-in-each/main.html @@ -0,0 +1,7 @@ +{{#each array as item}} + {{#if item}} +
foo
+ {{else}} +
bar
+ {{/if}} +{{/each}} From 2e2ae8fdc9c99a7bd0827da1a36be5026f6f103c Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 2 Mar 2018 15:58:13 -0500 Subject: [PATCH 10/30] unhoist select_block_type function for now (resolves #1195) --- src/generators/nodes/IfBlock.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/generators/nodes/IfBlock.ts b/src/generators/nodes/IfBlock.ts index 17cd92bc29..463fe4ab5e 100644 --- a/src/generators/nodes/IfBlock.ts +++ b/src/generators/nodes/IfBlock.ts @@ -313,15 +313,12 @@ function compound( const current_block_type = block.getUniqueName(`current_block_type`); const current_block_type_and = hasElse ? '' : `${current_block_type} && `; - generator.blocks.push(deindent` + block.builders.init.addBlock(deindent` function ${select_block_type}(state) { ${branches .map(({ condition, block }) => `${condition ? `if (${condition}) ` : ''}return ${block};`) .join('\n')} } - `); - - block.builders.init.addBlock(deindent` var ${current_block_type} = ${select_block_type}(state); var ${name} = ${current_block_type_and}${current_block_type}(#component, state); `); From a2873df71178717da7efb0d90eded755a2652f8b Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 2 Mar 2018 16:01:02 -0500 Subject: [PATCH 11/30] update js if-block-no-update test --- test/js/samples/if-block-no-update/expected-bundle.js | 9 ++++----- test/js/samples/if-block-no-update/expected.js | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 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 2e6975d978..28e8b500bc 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -189,6 +189,10 @@ var proto = { function create_main_fragment(component, state) { var if_block_anchor; + function select_block_type(state) { + if (state.foo) return create_if_block; + return create_if_block_1; + } var current_block_type = select_block_type(state); var if_block = current_block_type(component, state); @@ -268,11 +272,6 @@ function create_if_block_1(component, state) { }; } -function select_block_type(state) { - if (state.foo) return create_if_block; - return create_if_block_1; -} - function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index a6e7f09d8d..31b4b0f7a4 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -4,6 +4,10 @@ import { assign, createComment, createElement, detachNode, init, insertNode, noo function create_main_fragment(component, state) { var if_block_anchor; + function select_block_type(state) { + if (state.foo) return create_if_block; + return create_if_block_1; + } var current_block_type = select_block_type(state); var if_block = current_block_type(component, state); @@ -83,11 +87,6 @@ function create_if_block_1(component, state) { }; } -function select_block_type(state) { - if (state.foo) return create_if_block; - return create_if_block_1; -} - function SvelteComponent(options) { init(this, options); this._state = assign({}, options.data); From cbdbff54bf2f3b8f299528fbf9ac20f33e93d113 Mon Sep 17 00:00:00 2001 From: Lee Reamsnyder Date: Sun, 4 Mar 2018 13:38:43 -0500 Subject: [PATCH 12/30] process code in @supports queries with cascade: false with the cascade: false compiler option, CSS in @supports blocks was getting removed --- src/css/Stylesheet.ts | 10 +++++++++- test/css/samples/supports-query/_config.js | 3 +++ test/css/samples/supports-query/expected.css | 1 + test/css/samples/supports-query/input.html | 9 +++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/css/samples/supports-query/_config.js create mode 100644 test/css/samples/supports-query/expected.css create mode 100644 test/css/samples/supports-query/input.html diff --git a/src/css/Stylesheet.ts b/src/css/Stylesheet.ts index 200e73f582..d16af09293 100644 --- a/src/css/Stylesheet.ts +++ b/src/css/Stylesheet.ts @@ -163,7 +163,7 @@ class Atrule { } apply(node: Element, stack: Element[]) { - if (this.node.name === 'media') { + if (this.node.name === 'media' || this.node.name === 'supports') { this.children.forEach(child => { child.apply(node, stack); }); @@ -199,6 +199,14 @@ class Atrule { 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); + } else if (this.node.name === 'supports') { + let c = this.node.start + 9; + if (this.node.expression.start - c > 1) code.overwrite(c, this.node.expression.start, ' '); + this.node.expression.children.forEach((query: Node) => { + // TODO minify queries + c = query.end; + }); + code.remove(c, this.node.block.start); } // TODO other atrules diff --git a/test/css/samples/supports-query/_config.js b/test/css/samples/supports-query/_config.js new file mode 100644 index 0000000000..c66e0e5271 --- /dev/null +++ b/test/css/samples/supports-query/_config.js @@ -0,0 +1,3 @@ +export default { + cascade: false +}; diff --git a/test/css/samples/supports-query/expected.css b/test/css/samples/supports-query/expected.css new file mode 100644 index 0000000000..f76c91c4c4 --- /dev/null +++ b/test/css/samples/supports-query/expected.css @@ -0,0 +1 @@ +@supports (display: grid){.maybe-grid[svelte-xyz]{display:grid}} \ No newline at end of file diff --git a/test/css/samples/supports-query/input.html b/test/css/samples/supports-query/input.html new file mode 100644 index 0000000000..776a7e9369 --- /dev/null +++ b/test/css/samples/supports-query/input.html @@ -0,0 +1,9 @@ +
something with a nice layout
+ + From 355490878d41eb06db173d8ef5106f95719203b2 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 5 Mar 2018 06:57:32 -0500 Subject: [PATCH 13/30] -> v1.56.1 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d0597de60..ea176af14e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Svelte changelog +## 1.56.1 + +* Fix if-in-each bug ([#1195](https://github.com/sveltejs/svelte/issues/1195)) +* Cross-browser `scrollX`/`scrollY` support ([#1175](https://github.com/sveltejs/svelte/issues/1175)) + ## 1.56.0 * Internal refactor ([#1122](https://github.com/sveltejs/svelte/issues/1122)) diff --git a/package.json b/package.json index c08645b16d..c4e849bd41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "1.56.0", + "version": "1.56.1", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "files": [ From 7b4c486be94824ee839dada5a98c2b661b88445e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 5 Mar 2018 10:50:09 -0500 Subject: [PATCH 14/30] only apply key to keyed each block, not its children - fixes #1202 --- src/generators/dom/Block.ts | 2 +- test/runtime/samples/if-in-keyed-each/_config.js | 15 +++++++++++++++ test/runtime/samples/if-in-keyed-each/main.html | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/if-in-keyed-each/_config.js create mode 100644 test/runtime/samples/if-in-keyed-each/main.html diff --git a/src/generators/dom/Block.ts b/src/generators/dom/Block.ts index 0d786752dc..49f4f81d86 100644 --- a/src/generators/dom/Block.ts +++ b/src/generators/dom/Block.ts @@ -163,7 +163,7 @@ export default class Block { } child(options: BlockOptions) { - return new Block(Object.assign({}, this, options, { parent: this })); + return new Block(Object.assign({}, this, { key: null }, options, { parent: this })); } contextualise(expression: Node, context?: string, isEventHandler?: boolean) { diff --git a/test/runtime/samples/if-in-keyed-each/_config.js b/test/runtime/samples/if-in-keyed-each/_config.js new file mode 100644 index 0000000000..d7f8c5870d --- /dev/null +++ b/test/runtime/samples/if-in-keyed-each/_config.js @@ -0,0 +1,15 @@ +export default { + data: { + items: [ + { id: 1, name: 'one' }, + { id: 2, name: 'two' } + ] + }, + + html: ` +
    +
  • one
  • +
  • two
  • +
+ ` +}; diff --git a/test/runtime/samples/if-in-keyed-each/main.html b/test/runtime/samples/if-in-keyed-each/main.html new file mode 100644 index 0000000000..1787fa3218 --- /dev/null +++ b/test/runtime/samples/if-in-keyed-each/main.html @@ -0,0 +1,7 @@ +
    + {{#each items as item @id}} + {{#if item.id}} +
  • {{item.name}}
  • + {{/if}} + {{/each}} +
\ No newline at end of file From 94c76308a11f1cf3eb45fe162aefa4cb88782730 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 5 Mar 2018 11:14:27 -0500 Subject: [PATCH 15/30] update deps to get tests to pass again --- package.json | 2 +- .../expected-bundle.js | 2 +- .../expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../component-static/expected-bundle.js | 1 + .../computed-collapsed-if/expected-bundle.js | 1 + .../css-media-query/expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../deconflict-globals/expected-bundle.js | 2 +- .../samples/do-use-dataset/expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../event-handlers-custom/expected-bundle.js | 2 +- .../head-no-whitespace/expected-bundle.js | 1 + .../if-block-no-update/expected-bundle.js | 1 + .../if-block-simple/expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../inline-style-optimized/expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../samples/legacy-default/expected-bundle.js | 1 + .../legacy-input-type/expected-bundle.js | 1 + .../legacy-quote-class/expected-bundle.js | 1 + .../samples/media-bindings/expected-bundle.js | 1 + .../non-imported-component/expected-bundle.js | 3 + .../expected-bundle.js | 3 +- .../samples/setup-method/expected-bundle.js | 1 + .../ssr-no-oncreate-etc/expected-bundle.js | 2 - test/js/samples/svg-title/expected-bundle.js | 1 + test/js/samples/title/expected-bundle.js | 1 + .../expected-bundle.js | 1 + .../window-binding-scroll/expected-bundle.js | 1 + yarn.lock | 338 +++++++++--------- 35 files changed, 205 insertions(+), 176 deletions(-) diff --git a/package.json b/package.json index c4e849bd41..4f03456c5c 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "nyc": "^11.1.0", "prettier": "^1.7.0", "reify": "^0.12.3", - "rollup": "^0.48.2", + "rollup": "^0.56.4", "rollup-plugin-buble": "^0.15.0", "rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-json": "^2.1.0", 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 8520eae5a7..5a321c0311 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -194,10 +194,10 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function data() { return { foo: 42 } } - function encapsulateStyles(node) { setAttribute(node, "svelte-2794052100", ""); } diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index b188229ec7..047169075a 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -174,6 +174,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + var Nested = window.Nested; function create_main_fragment(component, state) { diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index b188229ec7..047169075a 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -174,6 +174,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + var Nested = window.Nested; function create_main_fragment(component, state) { diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 3db3d982e1..5798f22df2 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -170,6 +170,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + var Nested = window.Nested; function create_main_fragment(component, state) { diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 97faae3978..08d3d2fca9 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -170,6 +170,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function a(x) { return x * 2; } diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index fb4f540eea..51f7c56732 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -190,6 +190,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function encapsulateStyles(node) { setAttribute(node, "svelte-3905933315", ""); } 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 6017c3a0d7..9ed1bbcef8 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -182,6 +182,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div; diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 2d75a472bd..e210ffe3ac 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -170,6 +170,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function data_1() { return { foo: 'bar' @@ -179,7 +180,6 @@ function data_1() { function oncreate() { alert(JSON.stringify(data())); } - function create_main_fragment(component, state) { return { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 2482e65cbf..229e4a3450 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div, text, div_1; 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 9efc43320f..75ce562da6 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 @@ -190,6 +190,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div, text, div_1; 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 2a6a930ea1..6cd012d4b7 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 @@ -190,6 +190,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var svg, g, g_1; 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 626c47980b..11916f82b4 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -202,6 +202,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var text, p, text_1; diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 4be9a16f0b..25f4ea324a 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -182,10 +182,10 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function foo( node, callback ) { // code goes here } - var methods = { foo ( bar ) { console.log( bar ); diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index a50f2dbef5..f3eec8c97b 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -182,6 +182,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var meta, meta_1; 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 28e8b500bc..662f80f0aa 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var if_block_anchor; diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index d18967e282..9298283711 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var if_block_anchor; 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 987b425333..682b3f0423 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div; 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 79117c831e..38f088a8e7 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div; diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index ff75016f84..e875dfc740 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div; diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index 903af075b8..77a78ca5c0 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -186,6 +186,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div, text, div_1, div_1_style_value; 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 a0f57143e2..64b1dd79ad 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -190,6 +190,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var input; diff --git a/test/js/samples/legacy-default/expected-bundle.js b/test/js/samples/legacy-default/expected-bundle.js index 023ac9b1bc..ce2e08302b 100644 --- a/test/js/samples/legacy-default/expected-bundle.js +++ b/test/js/samples/legacy-default/expected-bundle.js @@ -204,6 +204,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var text, p, text_1, text_2, text_3, slot_content_default = component._slotted["default"], slot_content_default_before, slot_content_default_after; diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index d08fda0519..69d4f501dc 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -188,6 +188,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var input; diff --git a/test/js/samples/legacy-quote-class/expected-bundle.js b/test/js/samples/legacy-quote-class/expected-bundle.js index 79a5921c4d..acc11efb5c 100644 --- a/test/js/samples/legacy-quote-class/expected-bundle.js +++ b/test/js/samples/legacy-quote-class/expected-bundle.js @@ -205,6 +205,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div; diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index 9427fbe0a4..552a17c725 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -198,6 +198,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var audio, audio_is_paused = true, audio_updating = false, audio_animationframe; diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 2026d476ed..85a5f677a9 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -184,6 +184,9 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + + + function create_main_fragment(component, state) { var text; diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js index e77cc220bf..09775d1f81 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js @@ -170,10 +170,9 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ -function oncreate() {} +function oncreate() {} function ondestroy() {} - function create_main_fragment(component, state) { return { diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 530a65fb1e..c30f01edb1 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -170,6 +170,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + var methods = { foo ( bar ) { console.log( bar ); diff --git a/test/js/samples/ssr-no-oncreate-etc/expected-bundle.js b/test/js/samples/ssr-no-oncreate-etc/expected-bundle.js index 42c2006f75..13c64c9d6c 100644 --- a/test/js/samples/ssr-no-oncreate-etc/expected-bundle.js +++ b/test/js/samples/ssr-no-oncreate-etc/expected-bundle.js @@ -1,9 +1,7 @@ function preload(input) { return output; } - var SvelteComponent = {}; - SvelteComponent.data = function() { return {}; }; diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 2cb1bf8ca9..2beb78a678 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -190,6 +190,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var svg, title, text; diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index 36b72b2e93..c37f7cb20a 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -170,6 +170,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var title_value; 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 e08d4d3831..8a4a7817a3 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -194,6 +194,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var div, text, p, text_2, text_3, text_4, p_1, text_6, text_8, if_block_4_anchor; diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 8959769d1d..cac144881d 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -190,6 +190,7 @@ var proto = { }; /* generated by Svelte vX.Y.Z */ + function create_main_fragment(component, state) { var window_updating = false, clear_window_updating = function() { window_updating = false; }, window_updating_timeout, p, text, text_1; diff --git a/yarn.lock b/yarn.lock index 65ad9e5307..29f526c67c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,16 +7,12 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.38.tgz#c1be40aa933723c608820a99a373a16d215a1ca2" "@types/mocha@^2.2.41": - version "2.2.47" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.47.tgz#30bbd880834d4af0f609025f282a69b8d4458f06" + version "2.2.48" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.48.tgz#3523b126a0b049482e1c3c11877460f76622ffab" -"@types/node@^7.0.18": - version "7.0.52" - resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.52.tgz#8990d3350375542b0c21a83cd0331e6a8fc86716" - -"@types/node@^8.0.17": - version "8.5.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.9.tgz#7155cfb4ae405bca4dd8df1a214c339e939109bf" +"@types/node@^8.0.17", "@types/node@^8.0.24": + version "8.9.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.9.4.tgz#dfd327582a06c114eb6e0441fa3d6fab35edad48" abab@^1.0.4: version "1.0.4" @@ -58,13 +54,9 @@ acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" -acorn@^5.0.0, acorn@^5.2.1, acorn@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.3.0.tgz#7446d39459c54fb49a80e6ee6478149b940ec822" - -acorn@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" +acorn@^5.0.0, acorn@^5.3.0, acorn@^5.4.1, acorn@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.0.tgz#1abb587fbf051f94e3de20e6b26ef910b1828298" acorn@~5.1.1: version "5.1.2" @@ -118,9 +110,9 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" dependencies: color-convert "^1.9.0" @@ -153,8 +145,8 @@ are-we-there-yet@~1.1.2: readable-stream "^2.0.6" argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" dependencies: sprintf-js "~1.0.2" @@ -247,8 +239,8 @@ babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: js-tokens "^3.0.2" babel-generator@^6.18.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" dependencies: babel-messages "^6.23.0" babel-runtime "^6.26.0" @@ -256,7 +248,7 @@ babel-generator@^6.18.0: detect-indent "^4.0.0" jsesc "^1.3.0" lodash "^4.17.4" - source-map "^0.5.6" + source-map "^0.5.7" trim-right "^1.0.1" babel-messages@^6.23.0: @@ -348,8 +340,8 @@ boom@5.x.x: hoek "4.x.x" brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -449,12 +441,12 @@ chalk@^1.1.1, chalk@^1.1.3: supports-color "^2.0.0" chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + version "2.3.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" dependencies: - ansi-styles "^3.1.0" + ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" - supports-color "^4.0.0" + supports-color "^5.3.0" chardet@^0.4.0: version "0.4.2" @@ -535,9 +527,9 @@ 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.5, combined-stream@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" +combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" dependencies: delayed-stream "~1.0.0" @@ -554,8 +546,8 @@ commander@2.9.0: graceful-readlink ">= 1.0.0" commander@^2.9.0: - version "2.13.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + version "2.14.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" commondir@^1.0.1: version "1.0.1" @@ -569,7 +561,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, concat-stream@^1.6.0: +concat-stream@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -577,6 +569,14 @@ concat-stream@1.6.0, concat-stream@^1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" +concat-stream@^1.6.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.1.tgz#261b8f518301f1d834e36342b9fea095d2620a26" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" @@ -748,8 +748,8 @@ diff@3.2.0: resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" diff@^3.1.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" doctrine@1.5.0: version "1.5.0" @@ -792,8 +792,8 @@ domhandler@^2.3.0: domelementtype "1" domutils@^1.5.1: - version "1.6.2" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.6.2.tgz#1958cc0b4c9426e9ed367fb1c8e854891b0fa3ff" + version "1.7.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" dependencies: dom-serializer "0" domelementtype "1" @@ -819,10 +819,10 @@ electron-download@^3.0.1: sumchecker "^1.2.0" electron@^1.4.4: - version "1.7.11" - resolved "https://registry.yarnpkg.com/electron/-/electron-1.7.11.tgz#993b6aa79e0e79a7cfcc369f4c813fbd9a0b08d9" + version "1.8.2" + resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.2.tgz#a817cd733c2972b3c7cc4f777caf6e424b88014d" dependencies: - "@types/node" "^7.0.18" + "@types/node" "^8.0.24" electron-download "^3.0.1" extract-zip "^1.0.3" @@ -851,15 +851,15 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" escodegen@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.0.tgz#9811a2f265dc1cd3894420ee3717064b632b8852" + version "1.9.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.1.tgz#dbae17ef96c8e4bedb1356f4504fa4cc2f7cb7e2" dependencies: esprima "^3.1.3" estraverse "^4.2.0" esutils "^2.0.2" optionator "^0.8.1" optionalDependencies: - source-map "~0.5.6" + source-map "~0.6.1" eslint-import-resolver-node@^0.3.1: version "0.3.2" @@ -883,8 +883,8 @@ eslint-plugin-html@^3.0.0: semver "^5.4.1" eslint-plugin-import@^2.2.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" + version "2.9.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.9.0.tgz#26002efbfca5989b7288ac047508bd24f217b169" dependencies: builtin-modules "^1.1.1" contains-path "^0.1.0" @@ -893,7 +893,7 @@ eslint-plugin-import@^2.2.0: eslint-import-resolver-node "^0.3.1" eslint-module-utils "^2.1.1" has "^1.0.1" - lodash.cond "^4.3.0" + lodash "^4.17.4" minimatch "^3.0.3" read-pkg-up "^2.0.0" @@ -909,8 +909,8 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" eslint@^4.3.0: - version "4.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.16.0.tgz#934ada9e98715e1d7bbfd6f6f0519ed2fab35cc1" + version "4.18.2" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.18.2.tgz#0f81267ad1012e7d2051e186a9004cc2267b8d45" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" @@ -947,14 +947,14 @@ eslint@^4.3.0: semver "^5.3.0" strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^4.0.1" + table "4.0.2" text-table "~0.2.0" espree@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" dependencies: - acorn "^5.2.1" + acorn "^5.5.0" acorn-jsx "^3.0.0" esprima@^3.1.3: @@ -972,11 +972,10 @@ esquery@^1.0.0: estraverse "^4.0.0" esrecurse@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" dependencies: estraverse "^4.1.0" - object-assign "^4.0.1" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" @@ -1058,8 +1057,8 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" fast-deep-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" fast-json-stable-stringify@^2.0.0: version "2.0.0" @@ -1162,11 +1161,11 @@ form-data@~2.1.1: mime-types "^2.1.12" form-data@~2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" + version "2.3.2" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" dependencies: asynckit "^0.4.0" - combined-stream "^1.0.5" + combined-stream "1.0.6" mime-types "^2.1.12" fs-extra@^0.30.0: @@ -1296,8 +1295,8 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2: path-is-absolute "^1.0.0" globals@^11.0.1: - version "11.2.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.2.0.tgz#aa2ece052a787563ba70a3dcd9dc2eb8a9a0488c" + version "11.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" globals@^9.18.0: version "9.18.0" @@ -1377,9 +1376,9 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" has-unicode@^2.0.0: version "2.0.1" @@ -1418,8 +1417,8 @@ hoek@2.x.x: resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" hoek@4.x.x: - version "4.2.0" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" + 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" @@ -1521,8 +1520,8 @@ inquirer@^3.0.6: through "^2.3.6" invariant@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + version "2.2.3" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688" dependencies: loose-envify "^1.0.0" @@ -1594,12 +1593,17 @@ is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" +is-my-ip-valid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824" + is-my-json-valid@^2.12.4: - version "2.17.1" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.17.1.tgz#3da98914a70a22f0a8563ef1511a246c6fc55471" + version "2.17.2" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz#6b2103a288e94ef3de5cf15d29dd85fc4b78d65c" dependencies: generate-function "^2.0.0" generate-object-property "^1.1.0" + is-my-ip-valid "^1.0.0" jsonpointer "^4.0.0" xtend "^4.0.0" @@ -1691,9 +1695,9 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" -istanbul-lib-coverage@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" +istanbul-lib-coverage@^1.1.1, istanbul-lib-coverage@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.2.tgz#4113c8ff6b7a40a1ef7350b01016331f63afde14" istanbul-lib-hook@^1.1.0: version "1.1.0" @@ -1702,39 +1706,39 @@ istanbul-lib-hook@^1.1.0: append-transform "^0.4.0" istanbul-lib-instrument@^1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz#250b30b3531e5d3251299fdd64b0b2c9db6b558e" + version "1.9.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.2.tgz#84905bf47f7e0b401d6b840da7bad67086b4aab6" dependencies: babel-generator "^6.18.0" babel-template "^6.16.0" babel-traverse "^6.18.0" babel-types "^6.18.0" babylon "^6.18.0" - istanbul-lib-coverage "^1.1.1" + istanbul-lib-coverage "^1.1.2" semver "^5.3.0" istanbul-lib-report@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz#922be27c13b9511b979bd1587359f69798c1d425" + version "1.1.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.3.tgz#2df12188c0fa77990c0d2176d2d0ba3394188259" dependencies: - istanbul-lib-coverage "^1.1.1" + istanbul-lib-coverage "^1.1.2" mkdirp "^0.5.1" path-parse "^1.0.5" supports-color "^3.1.2" istanbul-lib-source-maps@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz#750578602435f28a0c04ee6d7d9e0f2960e62c1c" + version "1.2.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.3.tgz#20fb54b14e14b3fb6edb6aca3571fd2143db44e6" dependencies: debug "^3.1.0" - istanbul-lib-coverage "^1.1.1" + istanbul-lib-coverage "^1.1.2" mkdirp "^0.5.1" rimraf "^2.6.1" source-map "^0.5.3" istanbul-reports@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.3.tgz#3b9e1e8defb6d18b1d425da8e8b32c5a163f2d10" + version "1.1.4" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.4.tgz#5ccba5e22b7b5a5d91d5e0a830f89be334bf97bd" dependencies: handlebars "^4.0.3" @@ -1743,8 +1747,8 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" js-yaml@^3.9.1: - version "3.10.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + version "3.11.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -1754,8 +1758,8 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" jsdom@^11.6.1: - version "11.6.1" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.6.1.tgz#43fffc10072597a8ee9680cba46900d9e4dbeba2" + version "11.6.2" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.6.2.tgz#25d1ef332d48adf77fc5221fe2619967923f16bb" dependencies: abab "^1.0.4" acorn "^5.3.0" @@ -1770,7 +1774,7 @@ jsdom@^11.6.1: html-encoding-sniffer "^1.0.2" left-pad "^1.2.0" nwmatcher "^1.4.3" - parse5 "^4.0.0" + parse5 "4.0.0" pn "^1.1.0" request "^2.83.0" request-promise-native "^1.0.5" @@ -1937,10 +1941,6 @@ lodash._isiterateecall@^3.0.0: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" - lodash.create@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" @@ -1974,8 +1974,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.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" longest@^1.0.1: version "1.0.1" @@ -2014,8 +2014,8 @@ magic-string@^0.22.3, magic-string@^0.22.4: vlq "^0.2.1" make-error@^1.1.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.2.tgz#8762ffad2444dd8ff1f7c819629fa28e24fea1c4" + version "1.3.4" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.4.tgz#19978ed575f9e9545d2ff8c13e33b5d18a67d535" map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" @@ -2080,19 +2080,19 @@ micromatch@^2.1.5, micromatch@^2.3.11: parse-glob "^3.0.4" regex-cache "^0.4.2" -mime-db@~1.30.0: - version "1.30.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" +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: - version "2.1.17" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" + version "2.1.18" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" dependencies: - mime-db "~1.30.0" + mime-db "~1.33.0" mimic-fn@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" @@ -2168,8 +2168,8 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" nan@^2.3.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a" + version "2.9.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866" natural-compare@^1.4.0: version "1.4.0" @@ -2375,8 +2375,8 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" osenv@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.0" @@ -2420,7 +2420,7 @@ parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" -parse5@^4.0.0: +parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" @@ -2513,8 +2513,8 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" prettier@^1.7.0: - version "1.10.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.10.2.tgz#1af8356d1842276a99a5b5529c82dd9e9ad3cc93" + version "1.11.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75" pretty-bytes@^1.0.2: version "1.0.4" @@ -2523,9 +2523,9 @@ pretty-bytes@^1.0.2: get-stdin "^4.0.1" meow "^3.1.0" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" progress-stream@^1.1.0: version "1.2.0" @@ -2570,8 +2570,8 @@ randomatic@^1.1.3: kind-of "^4.0.0" rc@^1.1.2, rc@^1.1.7: - version "1.2.4" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.4.tgz#a0f606caae2a3b862bbd0ef85482c0125b315fa3" + version "1.2.5" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.5.tgz#275cd687f6e3b36cc756baa26dfee80a790301fd" dependencies: deep-extend "~0.4.0" ini "~1.3.0" @@ -2609,13 +2609,13 @@ read-pkg@^2.0.0: path-type "^2.0.0" readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" + version "2.3.5" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.5.tgz#b4f85003a938cbb6ecbce2a124fb1012bd1a838d" dependencies: core-util-is "~1.0.0" inherits "~2.0.3" isarray "~1.0.0" - process-nextick-args "~1.0.6" + process-nextick-args "~2.0.0" safe-buffer "~5.1.1" string_decoder "~1.0.3" util-deprecate "~1.0.1" @@ -2834,10 +2834,9 @@ rollup-plugin-buble@^0.15.0: rollup-pluginutils "^1.5.0" rollup-plugin-commonjs@^8.0.2: - version "8.3.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.3.0.tgz#91b4ba18f340951e39ed7b1901f377a80ab3f9c3" + version "8.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.4.0.tgz#07c3b5a7555171a58cf3b376b812013de8a631e4" dependencies: - acorn "^5.2.1" estree-walker "^0.5.0" magic-string "^0.22.4" resolve "^1.4.0" @@ -2850,8 +2849,8 @@ rollup-plugin-json@^2.1.0: rollup-pluginutils "^2.0.1" rollup-plugin-node-resolve@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.2.tgz#38babc12fd404cc2ba1ff68648fe43fa3ffee6b0" + version "3.0.3" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.3.tgz#8f57b253edd00e5b0ad0aed7b7e9cf5982e98fa4" dependencies: builtin-modules "^1.1.0" is-module "^1.0.0" @@ -2901,9 +2900,9 @@ rollup-watch@^4.3.1: require-relative "0.8.7" rollup-pluginutils "^2.0.1" -rollup@^0.48.2: - version "0.48.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.48.2.tgz#dd9214eaf78d98a7771bf5583123cc80a0b5d6dc" +rollup@^0.56.4: + version "0.56.4" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.56.4.tgz#84c3d08b37bd63189c4517d2faad405412ebb8fc" run-async@^2.2.0: version "2.3.0" @@ -3003,11 +3002,11 @@ source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6: +source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" -source-map@^0.6.1: +source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -3022,19 +3021,27 @@ spawn-wrap@^1.4.2: signal-exit "^3.0.2" which "^1.3.0" -spdx-correct@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" +spdx-correct@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" dependencies: - spdx-license-ids "^1.0.2" + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" -spdx-expression-parse@~1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" +spdx-exceptions@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" -spdx-license-ids@^1.0.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" +spdx-license-ids@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" speedometer@~0.1.2: version "0.1.4" @@ -3156,17 +3163,17 @@ supports-color@^3.1.2: dependencies: has-flag "^1.0.0" -supports-color@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" +supports-color@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0" dependencies: - has-flag "^2.0.0" + has-flag "^3.0.0" symbol-tree@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" -table@^4.0.1: +table@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: @@ -3199,8 +3206,8 @@ tar@^2.2.1: inherits "2" test-exclude@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" + version "4.2.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.0.tgz#07e3613609a362c74516a717515e13322ab45b3c" dependencies: arrify "^1.0.1" micromatch "^2.3.11" @@ -3249,8 +3256,8 @@ to-fast-properties@^1.0.3: resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.0, tough-cookie@~2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" + version "2.3.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" dependencies: punycode "^1.4.1" @@ -3323,8 +3330,8 @@ typescript@^1.8.9: resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e" typescript@^2.6.1: - version "2.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" + version "2.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" uglify-js@^2.6: version "2.8.29" @@ -3343,10 +3350,6 @@ uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - urlgrey@0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f" @@ -3360,17 +3363,17 @@ uuid@^3.0.0, uuid@^3.1.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" v8flags@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.1.tgz#dce8fc379c17d9f2c9e9ed78d89ce00052b1b76b" + version "3.0.2" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.2.tgz#ad6a78a20a6b23d03a8debc11211e3cc23149477" dependencies: homedir-polyfill "^1.0.1" validate-npm-package-license@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + version "3.0.3" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" dependencies: - spdx-correct "~1.0.0" - spdx-expression-parse "~1.0.0" + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" verror@1.10.0: version "1.10.0" @@ -3466,12 +3469,11 @@ write@^0.2.1: mkdirp "^0.5.1" ws@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-4.0.0.tgz#bfe1da4c08eeb9780b986e0e4d10eccd7345999f" + version "4.1.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-4.1.0.tgz#a979b5d7d4da68bf54efe0408967c324869a7289" dependencies: async-limiter "~1.0.0" safe-buffer "~5.1.0" - ultron "~1.1.0" xml-name-validator@^3.0.0: version "3.0.0" From 18d3313838bb744017f18a60d28046c2af645ac8 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 5 Mar 2018 15:42:07 -0500 Subject: [PATCH 16/30] -> v1.56.2 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea176af14e..e1103eb326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 1.56.2 + +* Null out `key` for children of keyed each blocks ([#1202](https://github.com/sveltejs/svelte/issues/1202)) + ## 1.56.1 * Fix if-in-each bug ([#1195](https://github.com/sveltejs/svelte/issues/1195)) diff --git a/package.json b/package.json index 4f03456c5c..3524d42eb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "1.56.1", + "version": "1.56.2", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "files": [ From e2d50617c2821a3c65aaae9783c36b04c9c64e9e Mon Sep 17 00:00:00 2001 From: ekhaled Date: Tue, 6 Mar 2018 16:59:47 +0000 Subject: [PATCH 17/30] fixes #1188, fixes #1201 --- src/generators/dom/index.ts | 2 +- src/shared/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 1d25c4bcfc..2f43286ba9 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -280,7 +280,7 @@ export default function dom( ${options.dev && `if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the \`hydratable: true\` option");`} this._fragment.c(); `} - this._fragment.${block.hasIntroMethod ? 'i' : 'm'}(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); ${(generator.hasComponents || generator.hasComplexBindings || templateProperties.oncreate || generator.hasIntroTransitions) && deindent` ${generator.hasComponents && `this._lock = true;`} diff --git a/src/shared/index.js b/src/shared/index.js index d9d6475e64..bc917a6004 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -185,7 +185,7 @@ export function callAll(fns) { } export function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } export function _unmount() { From 2e3724f7d3ba62d2c5b5afe3e0ece3760af95e6f Mon Sep 17 00:00:00 2001 From: ekhaled Date: Tue, 6 Mar 2018 17:07:49 +0000 Subject: [PATCH 18/30] fix snapshots --- .../samples/collapses-text-around-comments/expected-bundle.js | 4 ++-- test/js/samples/collapses-text-around-comments/expected.js | 2 +- test/js/samples/component-static-immutable/expected-bundle.js | 4 ++-- test/js/samples/component-static-immutable/expected.js | 2 +- .../js/samples/component-static-immutable2/expected-bundle.js | 4 ++-- test/js/samples/component-static-immutable2/expected.js | 2 +- test/js/samples/component-static/expected-bundle.js | 4 ++-- test/js/samples/component-static/expected.js | 2 +- test/js/samples/computed-collapsed-if/expected-bundle.js | 4 ++-- test/js/samples/computed-collapsed-if/expected.js | 2 +- test/js/samples/css-media-query/expected-bundle.js | 4 ++-- test/js/samples/css-media-query/expected.js | 2 +- test/js/samples/css-shadow-dom-keyframes/expected-bundle.js | 2 +- test/js/samples/deconflict-globals/expected-bundle.js | 4 ++-- test/js/samples/deconflict-globals/expected.js | 2 +- test/js/samples/do-use-dataset/expected-bundle.js | 4 ++-- test/js/samples/do-use-dataset/expected.js | 2 +- test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js | 4 ++-- test/js/samples/dont-use-dataset-in-legacy/expected.js | 2 +- test/js/samples/dont-use-dataset-in-svg/expected-bundle.js | 4 ++-- test/js/samples/dont-use-dataset-in-svg/expected.js | 2 +- test/js/samples/each-block-changed-check/expected-bundle.js | 4 ++-- test/js/samples/each-block-changed-check/expected.js | 2 +- test/js/samples/event-handlers-custom/expected-bundle.js | 4 ++-- test/js/samples/event-handlers-custom/expected.js | 2 +- test/js/samples/head-no-whitespace/expected-bundle.js | 4 ++-- test/js/samples/head-no-whitespace/expected.js | 2 +- test/js/samples/if-block-no-update/expected-bundle.js | 4 ++-- test/js/samples/if-block-no-update/expected.js | 2 +- test/js/samples/if-block-simple/expected-bundle.js | 4 ++-- test/js/samples/if-block-simple/expected.js | 2 +- .../inline-style-optimized-multiple/expected-bundle.js | 4 ++-- test/js/samples/inline-style-optimized-multiple/expected.js | 2 +- test/js/samples/inline-style-optimized-url/expected-bundle.js | 4 ++-- test/js/samples/inline-style-optimized-url/expected.js | 2 +- test/js/samples/inline-style-optimized/expected-bundle.js | 4 ++-- test/js/samples/inline-style-optimized/expected.js | 2 +- test/js/samples/inline-style-unoptimized/expected-bundle.js | 4 ++-- test/js/samples/inline-style-unoptimized/expected.js | 2 +- .../samples/input-without-blowback-guard/expected-bundle.js | 4 ++-- test/js/samples/input-without-blowback-guard/expected.js | 2 +- test/js/samples/legacy-default/expected-bundle.js | 4 ++-- test/js/samples/legacy-default/expected.js | 2 +- test/js/samples/legacy-input-type/expected-bundle.js | 4 ++-- test/js/samples/legacy-input-type/expected.js | 2 +- test/js/samples/legacy-quote-class/expected-bundle.js | 4 ++-- test/js/samples/legacy-quote-class/expected.js | 2 +- test/js/samples/media-bindings/expected-bundle.js | 4 ++-- test/js/samples/media-bindings/expected.js | 2 +- test/js/samples/non-imported-component/expected-bundle.js | 4 ++-- test/js/samples/non-imported-component/expected.js | 2 +- .../samples/onrender-onteardown-rewritten/expected-bundle.js | 4 ++-- test/js/samples/onrender-onteardown-rewritten/expected.js | 2 +- test/js/samples/setup-method/expected-bundle.js | 4 ++-- test/js/samples/setup-method/expected.js | 2 +- test/js/samples/svg-title/expected-bundle.js | 4 ++-- test/js/samples/svg-title/expected.js | 2 +- test/js/samples/title/expected-bundle.js | 4 ++-- test/js/samples/title/expected.js | 2 +- test/js/samples/use-elements-as-anchors/expected-bundle.js | 4 ++-- test/js/samples/use-elements-as-anchors/expected.js | 2 +- test/js/samples/window-binding-scroll/expected-bundle.js | 4 ++-- test/js/samples/window-binding-scroll/expected.js | 2 +- 63 files changed, 94 insertions(+), 94 deletions(-) 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 5a321c0311..2e58552394 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -171,7 +171,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -252,7 +252,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 17e612b644..ac6fe0181b 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -59,7 +59,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index 047169075a..090f3ccf3b 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -151,7 +151,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -219,7 +219,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index 647b068179..153c6810f2 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -45,7 +45,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index 047169075a..090f3ccf3b 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -151,7 +151,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -219,7 +219,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index 647b068179..153c6810f2 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -45,7 +45,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 5798f22df2..5853ee8b52 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -147,7 +147,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -215,7 +215,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index a689848dc0..26b1381047 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -45,7 +45,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 08d3d2fca9..5269391741 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -147,7 +147,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -203,7 +203,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index d87ef16f92..5e1728bacf 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -33,7 +33,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index 51f7c56732..a05d9980f9 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -167,7 +167,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -239,7 +239,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index 6e03ca0a0a..d5fa749559 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -49,7 +49,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 9ed1bbcef8..ed607a1822 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -159,7 +159,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index e210ffe3ac..8bd863b938 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -147,7 +147,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -211,7 +211,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); callAll(this._oncreate); } diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js index d740fe634d..b3cba40e20 100644 --- a/test/js/samples/deconflict-globals/expected.js +++ b/test/js/samples/deconflict-globals/expected.js @@ -42,7 +42,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); callAll(this._oncreate); } diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 229e4a3450..aa771127c9 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -233,7 +233,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/do-use-dataset/expected.js b/test/js/samples/do-use-dataset/expected.js index 27a335d0a6..74a14dd0f9 100644 --- a/test/js/samples/do-use-dataset/expected.js +++ b/test/js/samples/do-use-dataset/expected.js @@ -47,7 +47,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 75ce562da6..d532914b7e 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 @@ -167,7 +167,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -237,7 +237,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected.js b/test/js/samples/dont-use-dataset-in-legacy/expected.js index e9062d7ba1..5d47666a98 100644 --- a/test/js/samples/dont-use-dataset-in-legacy/expected.js +++ b/test/js/samples/dont-use-dataset-in-legacy/expected.js @@ -47,7 +47,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 6cd012d4b7..f299b5b8e8 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 @@ -167,7 +167,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -235,7 +235,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/dont-use-dataset-in-svg/expected.js b/test/js/samples/dont-use-dataset-in-svg/expected.js index 9e541886bc..e5cf46fcbd 100644 --- a/test/js/samples/dont-use-dataset-in-svg/expected.js +++ b/test/js/samples/dont-use-dataset-in-svg/expected.js @@ -45,7 +45,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 11916f82b4..e5fbf4c884 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -179,7 +179,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -360,7 +360,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 2eb66567a6..68617bd207 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -158,7 +158,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 25f4ea324a..55eb888b29 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -159,7 +159,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -233,7 +233,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js index 785fefbeef..79eee1454a 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -52,7 +52,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index f3eec8c97b..804d8f8991 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -159,7 +159,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -224,7 +224,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/head-no-whitespace/expected.js b/test/js/samples/head-no-whitespace/expected.js index 9ba161c69d..9bf8e8370d 100644 --- a/test/js/samples/head-no-whitespace/expected.js +++ b/test/js/samples/head-no-whitespace/expected.js @@ -42,7 +42,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 662f80f0aa..2606f3de0b 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -281,7 +281,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index 31b4b0f7a4..ce11747151 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -95,7 +95,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 9298283711..7d4b12bbbf 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -258,7 +258,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index 4c999546c0..35ad2dcf81 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -72,7 +72,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 682b3f0423..86ae0aaf8e 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -231,7 +231,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js index ce3ffda243..3c84da0774 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -45,7 +45,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 38f088a8e7..f8142a8a12 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -226,7 +226,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js index 376cad092a..8ef2fe0b15 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -40,7 +40,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index e875dfc740..432619f817 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -226,7 +226,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js index 74c4b6f417..0efa7e34fb 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -40,7 +40,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index 77a78ca5c0..3ecbc5cc56 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -163,7 +163,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -237,7 +237,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index 04e1226f6d..89a7bc51e4 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -51,7 +51,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 64b1dd79ad..5c5fbeeb01 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -167,7 +167,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -237,7 +237,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index d313c7c01d..7a6926b406 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -47,7 +47,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-default/expected-bundle.js b/test/js/samples/legacy-default/expected-bundle.js index ce2e08302b..b46e8293da 100644 --- a/test/js/samples/legacy-default/expected-bundle.js +++ b/test/js/samples/legacy-default/expected-bundle.js @@ -181,7 +181,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -275,7 +275,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/legacy-default/expected.js b/test/js/samples/legacy-default/expected.js index 6c90bb8f13..f1edfcc6d4 100644 --- a/test/js/samples/legacy-default/expected.js +++ b/test/js/samples/legacy-default/expected.js @@ -71,7 +71,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 69d4f501dc..f79e8420d1 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -165,7 +165,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -224,7 +224,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js index 5236b758dc..705fe79d96 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -36,7 +36,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-quote-class/expected-bundle.js b/test/js/samples/legacy-quote-class/expected-bundle.js index acc11efb5c..3ffb2890c6 100644 --- a/test/js/samples/legacy-quote-class/expected-bundle.js +++ b/test/js/samples/legacy-quote-class/expected-bundle.js @@ -182,7 +182,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -251,7 +251,7 @@ function SvelteComponent(options) { var nodes = children(options.target); options.hydrate ? this._fragment.l(nodes) : this._fragment.c(); nodes.forEach(detachNode); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-quote-class/expected.js b/test/js/samples/legacy-quote-class/expected.js index 76490fd6f9..bc489b5fcc 100644 --- a/test/js/samples/legacy-quote-class/expected.js +++ b/test/js/samples/legacy-quote-class/expected.js @@ -46,7 +46,7 @@ function SvelteComponent(options) { var nodes = children(options.target); options.hydrate ? this._fragment.l(nodes) : this._fragment.c(); nodes.forEach(detachNode); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index 552a17c725..84634ed65e 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -175,7 +175,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -295,7 +295,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); callAll(this._beforecreate); } diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 527e233cfd..db71a78a55 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -97,7 +97,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); callAll(this._beforecreate); } diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 85a5f677a9..f4045659d3 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -161,7 +161,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -240,7 +240,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 089e8db6e5..2d28036e8d 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -57,7 +57,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js index 09775d1f81..0146c27bf6 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js @@ -147,7 +147,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -206,7 +206,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); callAll(this._oncreate); } diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js index 83e8d6200f..87c1cd6591 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected.js @@ -38,7 +38,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); callAll(this._oncreate); } diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index c30f01edb1..b187353281 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -147,7 +147,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -210,7 +210,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/setup-method/expected.js b/test/js/samples/setup-method/expected.js index e4778f5826..5ec2a8fbb7 100644 --- a/test/js/samples/setup-method/expected.js +++ b/test/js/samples/setup-method/expected.js @@ -40,7 +40,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 2beb78a678..44b61ea48c 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -167,7 +167,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -225,7 +225,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/svg-title/expected.js b/test/js/samples/svg-title/expected.js index 059d1d804d..e3ffee8334 100644 --- a/test/js/samples/svg-title/expected.js +++ b/test/js/samples/svg-title/expected.js @@ -35,7 +35,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index c37f7cb20a..1aab21c762 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -147,7 +147,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -201,7 +201,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/title/expected.js b/test/js/samples/title/expected.js index d5546cd4c2..3a39eb61e9 100644 --- a/test/js/samples/title/expected.js +++ b/test/js/samples/title/expected.js @@ -31,7 +31,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } 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 8a4a7817a3..cdc0be6a01 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -171,7 +171,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -448,7 +448,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index 0ff85d63b0..4732232ed2 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -254,7 +254,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index cac144881d..b911b01faa 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -167,7 +167,7 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.m(target, anchor); + this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor); } function _unmount() { @@ -250,7 +250,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 0c22523b61..0f9b4d3b45 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -60,7 +60,7 @@ function SvelteComponent(options) { if (options.target) { this._fragment.c(); - this._fragment.m(options.target, options.anchor || null); + this._mount(options.target, options.anchor || null); } } From 7401004a667e2514282a6951722fdd433b05d5d0 Mon Sep 17 00:00:00 2001 From: ekhaled Date: Tue, 6 Mar 2018 18:09:04 +0000 Subject: [PATCH 19/30] add test for transitions on nested components --- .../transition-js-nested-intro/_config.js | 21 +++++++++++++++++++ .../transition-js-nested-intro/child.html | 17 +++++++++++++++ .../transition-js-nested-intro/main.html | 10 +++++++++ 3 files changed, 48 insertions(+) create mode 100644 test/runtime/samples/transition-js-nested-intro/_config.js create mode 100644 test/runtime/samples/transition-js-nested-intro/child.html create mode 100644 test/runtime/samples/transition-js-nested-intro/main.html diff --git a/test/runtime/samples/transition-js-nested-intro/_config.js b/test/runtime/samples/transition-js-nested-intro/_config.js new file mode 100644 index 0000000000..9906be26d2 --- /dev/null +++ b/test/runtime/samples/transition-js-nested-intro/_config.js @@ -0,0 +1,21 @@ +export default { + test ( assert, component, target, window, raf ) { + component.set({ visible: true }); + const div = target.querySelector( 'div' ); + assert.equal( div.foo, 0 ); + + raf.tick( 50 ); + assert.equal( div.foo, 0 ); + + raf.tick( 100 ); + assert.equal( div.foo, 0.5 ); + + raf.tick( 125 ); + assert.equal( div.foo, 0.75 ); + + raf.tick( 150 ); + assert.equal( div.foo, 1 ); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-nested-intro/child.html b/test/runtime/samples/transition-js-nested-intro/child.html new file mode 100644 index 0000000000..32a4b81152 --- /dev/null +++ b/test/runtime/samples/transition-js-nested-intro/child.html @@ -0,0 +1,17 @@ +
+ + \ No newline at end of file diff --git a/test/runtime/samples/transition-js-nested-intro/main.html b/test/runtime/samples/transition-js-nested-intro/main.html new file mode 100644 index 0000000000..c8bf70b0ae --- /dev/null +++ b/test/runtime/samples/transition-js-nested-intro/main.html @@ -0,0 +1,10 @@ +{{#if visible}} + delayed +{{/if}} + + \ No newline at end of file From 7b2246126e138e89621c98c8c883689a29e3adbb Mon Sep 17 00:00:00 2001 From: ekhaled Date: Tue, 6 Mar 2018 18:27:46 +0000 Subject: [PATCH 20/30] fix tests on linux --- .../transition-js-nested-intro/Child.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/runtime/samples/transition-js-nested-intro/Child.html diff --git a/test/runtime/samples/transition-js-nested-intro/Child.html b/test/runtime/samples/transition-js-nested-intro/Child.html new file mode 100644 index 0000000000..32a4b81152 --- /dev/null +++ b/test/runtime/samples/transition-js-nested-intro/Child.html @@ -0,0 +1,17 @@ +
+ + \ No newline at end of file From ae86cf9f4b71208068968975a841383a2c3e7602 Mon Sep 17 00:00:00 2001 From: ekhaled Date: Tue, 6 Mar 2018 18:30:15 +0000 Subject: [PATCH 21/30] clarify in test that its an intro test only --- test/runtime/samples/transition-js-nested-intro/Child.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtime/samples/transition-js-nested-intro/Child.html b/test/runtime/samples/transition-js-nested-intro/Child.html index 32a4b81152..672c5244b3 100644 --- a/test/runtime/samples/transition-js-nested-intro/Child.html +++ b/test/runtime/samples/transition-js-nested-intro/Child.html @@ -1,4 +1,4 @@ -
+
\ No newline at end of file diff --git a/test/runtime/samples/transition-js-nested-intro/child.html b/test/runtime/samples/transition-js-nested-intro/child.html deleted file mode 100644 index 32a4b81152..0000000000 --- a/test/runtime/samples/transition-js-nested-intro/child.html +++ /dev/null @@ -1,17 +0,0 @@ -
- - \ No newline at end of file From f9d606a5c9f7cfe18dafe81696debfbf0243c812 Mon Sep 17 00:00:00 2001 From: ekhaled Date: Tue, 6 Mar 2018 19:05:39 +0000 Subject: [PATCH 27/30] re-add Child.html --- .../transition-js-nested-intro/Child.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/runtime/samples/transition-js-nested-intro/Child.html diff --git a/test/runtime/samples/transition-js-nested-intro/Child.html b/test/runtime/samples/transition-js-nested-intro/Child.html new file mode 100644 index 0000000000..32a4b81152 --- /dev/null +++ b/test/runtime/samples/transition-js-nested-intro/Child.html @@ -0,0 +1,17 @@ +
+ + \ No newline at end of file From c45b18a387f6e20b26c4630cbef7f5d7812c9395 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 6 Mar 2018 15:24:51 -0500 Subject: [PATCH 28/30] -> v1.56.3 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1103eb326..647a7c446a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Svelte changelog +## 1.56.3 + +* Top-level transitions work inside nested components ([#1188](https://github.com/sveltejs/svelte/issues/1188)) +* Always use internal `_mount` method ([#1201](https://github.com/sveltejs/svelte/issues/1201)) + ## 1.56.2 * Null out `key` for children of keyed each blocks ([#1202](https://github.com/sveltejs/svelte/issues/1202)) diff --git a/package.json b/package.json index 3524d42eb4..0ba0e9f05a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "1.56.2", + "version": "1.56.3", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "files": [ From fad5ccdf59a40725fc8ef40b076eb87981dfff87 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 7 Mar 2018 09:53:46 -0500 Subject: [PATCH 29/30] prevent context variables being called component or state - fixes #1213 --- src/generators/dom/Block.ts | 8 ++++++-- .../deconflict-component-refs/_config.js | 17 +++++++++++++++++ .../samples/deconflict-component-refs/main.html | 11 +++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 test/runtime/samples/deconflict-component-refs/_config.js create mode 100644 test/runtime/samples/deconflict-component-refs/main.html diff --git a/src/generators/dom/Block.ts b/src/generators/dom/Block.ts index 49f4f81d86..089817a637 100644 --- a/src/generators/dom/Block.ts +++ b/src/generators/dom/Block.ts @@ -112,9 +112,13 @@ export default class Block { this.hasOutroMethod = false; this.outros = 0; - this.aliases = new Map(); - this.variables = new Map(); this.getUniqueName = this.generator.getUniqueNameMaker(); + this.variables = new Map(); + + this.aliases = new Map() + .set('component', this.getUniqueName('component')) + .set('state', this.getUniqueName('state')); + if (this.key) this.aliases.set('key', this.getUniqueName('key')); this.hasUpdateMethod = false; // determined later } diff --git a/test/runtime/samples/deconflict-component-refs/_config.js b/test/runtime/samples/deconflict-component-refs/_config.js new file mode 100644 index 0000000000..213abd245c --- /dev/null +++ b/test/runtime/samples/deconflict-component-refs/_config.js @@ -0,0 +1,17 @@ +export default { + html: ` +
    +
  • +
  • bar
  • +
  • baz
  • +
+ `, + + data: { + components: [ + { name: 'foo', edit: true }, + { name: 'bar', edit: false }, + { name: 'baz', edit: false } + ] + } +}; \ No newline at end of file diff --git a/test/runtime/samples/deconflict-component-refs/main.html b/test/runtime/samples/deconflict-component-refs/main.html new file mode 100644 index 0000000000..78f0c26661 --- /dev/null +++ b/test/runtime/samples/deconflict-component-refs/main.html @@ -0,0 +1,11 @@ +
    + {{#each components as component}} +
  • + {{#if component.edit}} + + {{else}} + {{component.name}} + {{/if}} +
  • + {{/each}} +
\ No newline at end of file From 22f0ed9bbfdd74572192f8802a2864c6320e3f43 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 7 Mar 2018 10:10:57 -0500 Subject: [PATCH 30/30] -> v1.56.4 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 647a7c446a..39d1dbf801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Svelte changelog +## 1.56.4 + +* Allow `component` and `state` to be context names ([#1213](https://github.com/sveltejs/svelte/issues/1213)) +* Don't remove `@supports` rules when `cascade: false` ([#1215](https://github.com/sveltejs/svelte/issues/1215)) + ## 1.56.3 * Top-level transitions work inside nested components ([#1188](https://github.com/sveltejs/svelte/issues/1188)) diff --git a/package.json b/package.json index 0ba0e9f05a..78cd37d6e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "1.56.3", + "version": "1.56.4", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "files": [