Hello world!
\ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/command.sh b/test/cli/samples/dir-sourcemap/command.sh deleted file mode 100644 index 37089f3f44..0000000000 --- a/test/cli/samples/dir-sourcemap/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src -m -o actual \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js deleted file mode 100644 index e164569e1c..0000000000 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ /dev/null @@ -1,186 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ -import Widget from './Widget.svelte'; - - - -function create_main_fragment(component, ctx) { - - var widget = new Widget({ - root: component.root, - store: component.store - }); - - return { - c() { - widget._fragment.c(); - }, - - m(target, anchor) { - widget._mount(target, anchor); - }, - - p: noop, - - d(detach) { - widget.destroy(detach); - } - }; -} - -function Main(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - - flush(this); - } -} - -assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Main.prototype._recompute = noop; - -function noop() {} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Main; -//# sourceMappingURL=Main.js.map diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js.map b/test/cli/samples/dir-sourcemap/expected/Main.js.map deleted file mode 100644 index a0f4cf48c7..0000000000 --- a/test/cli/samples/dir-sourcemap/expected/Main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.svelte"],"sourcesContent":["widget
"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/src/Main.svelte b/test/cli/samples/dir-sourcemap/src/Main.svelte deleted file mode 100644 index 0a9d5bba87..0000000000 --- a/test/cli/samples/dir-sourcemap/src/Main.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -widget
\ No newline at end of file diff --git a/test/cli/samples/dir-subdir/command.sh b/test/cli/samples/dir-subdir/command.sh deleted file mode 100644 index 10067cb1f9..0000000000 --- a/test/cli/samples/dir-subdir/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src -o actual \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js deleted file mode 100644 index 3026a122e2..0000000000 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ /dev/null @@ -1,185 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ -import Widget from './widget/Widget.svelte'; - - - -function create_main_fragment(component, ctx) { - - var widget = new Widget({ - root: component.root, - store: component.store - }); - - return { - c() { - widget._fragment.c(); - }, - - m(target, anchor) { - widget._mount(target, anchor); - }, - - p: noop, - - d(detach) { - widget.destroy(detach); - } - }; -} - -function Main(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - - flush(this); - } -} - -assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Main.prototype._recompute = noop; - -function noop() {} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Main; \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js deleted file mode 100644 index e63ac2dad7..0000000000 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ /dev/null @@ -1,191 +0,0 @@ -/* src/widget/Widget.svelte generated by Svelte vx.y.z */ - -function create_main_fragment(component, ctx) { - var p; - - return { - c() { - p = createElement("p"); - p.textContent = "widget"; - }, - - m(target, anchor) { - insert(target, p, anchor); - }, - - p: noop, - - d(detach) { - if (detach) { - detachNode(p); - } - } - }; -} - -function Widget(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - } -} - -assign(Widget.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Widget.prototype._recompute = noop; - -function createElement(name) { - return document.createElement(name); -} - -function insert(target, node, anchor) { - target.insertBefore(node, anchor); -} - -function noop() {} - -function detachNode(node) { - node.parentNode.removeChild(node); -} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Widget; \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/src/Main.svelte b/test/cli/samples/dir-subdir/src/Main.svelte deleted file mode 100644 index ac663b4338..0000000000 --- a/test/cli/samples/dir-subdir/src/Main.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -widget
\ No newline at end of file diff --git a/test/cli/samples/dir/command.sh b/test/cli/samples/dir/command.sh deleted file mode 100644 index 10067cb1f9..0000000000 --- a/test/cli/samples/dir/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src -o actual \ No newline at end of file diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js deleted file mode 100644 index d87ac37939..0000000000 --- a/test/cli/samples/dir/expected/Main.js +++ /dev/null @@ -1,185 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ -import Widget from './Widget.svelte'; - - - -function create_main_fragment(component, ctx) { - - var widget = new Widget({ - root: component.root, - store: component.store - }); - - return { - c() { - widget._fragment.c(); - }, - - m(target, anchor) { - widget._mount(target, anchor); - }, - - p: noop, - - d(detach) { - widget.destroy(detach); - } - }; -} - -function Main(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - - flush(this); - } -} - -assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Main.prototype._recompute = noop; - -function noop() {} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Main; \ No newline at end of file diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js deleted file mode 100644 index eeb37e3cfa..0000000000 --- a/test/cli/samples/dir/expected/Widget.js +++ /dev/null @@ -1,191 +0,0 @@ -/* src/Widget.svelte generated by Svelte vx.y.z */ - -function create_main_fragment(component, ctx) { - var p; - - return { - c() { - p = createElement("p"); - p.textContent = "widget"; - }, - - m(target, anchor) { - insert(target, p, anchor); - }, - - p: noop, - - d(detach) { - if (detach) { - detachNode(p); - } - } - }; -} - -function Widget(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - } -} - -assign(Widget.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Widget.prototype._recompute = noop; - -function createElement(name) { - return document.createElement(name); -} - -function insert(target, node, anchor) { - target.insertBefore(node, anchor); -} - -function noop() {} - -function detachNode(node) { - node.parentNode.removeChild(node); -} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Widget; \ No newline at end of file diff --git a/test/cli/samples/dir/src/Main.svelte b/test/cli/samples/dir/src/Main.svelte deleted file mode 100644 index 0a9d5bba87..0000000000 --- a/test/cli/samples/dir/src/Main.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -widget
\ No newline at end of file diff --git a/test/cli/samples/globals/command.sh b/test/cli/samples/globals/command.sh deleted file mode 100644 index 9e1a2de74a..0000000000 --- a/test/cli/samples/globals/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src/Main.svelte -f iife -g the-answer:theAnswer > actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js deleted file mode 100644 index 8e526b08bf..0000000000 --- a/test/cli/samples/globals/expected/Main.js +++ /dev/null @@ -1,219 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ -var Main = (function(answer) { "use strict"; - answer = (answer && answer.__esModule) ? answer["default"] : answer; - - function data() { - return { - answer: answer - }; -}; - - function create_main_fragment(component, ctx) { - var p, text0, text1; - - return { - c() { - p = createElement("p"); - text0 = createText("The answer is "); - text1 = createText(ctx.answer); - }, - - m(target, anchor) { - insert(target, p, anchor); - append(p, text0); - append(p, text1); - }, - - p(changed, ctx) { - if (changed.answer) { - setData(text1, ctx.answer); - } - }, - - d(detach) { - if (detach) { - detachNode(p); - } - } - }; - } - - function Main(options) { - init(this, options); - this._state = assign(data(), options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - } - } - - assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - - Main.prototype._recompute = noop; - - function createElement(name) { - return document.createElement(name); - } - - function createText(data) { - return document.createTextNode(data); - } - - function insert(target, node, anchor) { - target.insertBefore(node, anchor); - } - - function append(target, node) { - target.appendChild(node); - } - - function setData(text, data) { - text.data = '' + data; - } - - function detachNode(node) { - node.parentNode.removeChild(node); - } - - function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } - } - - function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; - } - - function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; - } - - function get() { - return this._state; - } - - function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } - } - - function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; - } - - function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); - } - - function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } - } - - function _stage(newState) { - assign(this._staged, newState); - } - - function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); - } - - function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); - } - - function noop() {} - - function blankObject() { - return Object.create(null); - } - - function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; - } - - function callAll(fns) { - while (fns && fns.length) fns.shift()(); - } - return Main; -}(theAnswer)); \ No newline at end of file diff --git a/test/cli/samples/globals/src/Main.svelte b/test/cli/samples/globals/src/Main.svelte deleted file mode 100644 index 2fc0383a67..0000000000 --- a/test/cli/samples/globals/src/Main.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - -The answer is {answer}
\ No newline at end of file diff --git a/test/cli/samples/sourcemap-inline/command.sh b/test/cli/samples/sourcemap-inline/command.sh deleted file mode 100644 index 073fa7d259..0000000000 --- a/test/cli/samples/sourcemap-inline/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src/Main.svelte -m inline -o actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js deleted file mode 100644 index 534c6734f2..0000000000 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ /dev/null @@ -1,192 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ - -function create_main_fragment(component, ctx) { - var p; - - return { - c() { - p = createElement("p"); - p.textContent = "Hello world!"; - }, - - m(target, anchor) { - insert(target, p, anchor); - }, - - p: noop, - - d(detach) { - if (detach) { - detachNode(p); - } - } - }; -} - -function Main(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - } -} - -assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Main.prototype._recompute = noop; - -function createElement(name) { - return document.createElement(name); -} - -function insert(target, node, anchor) { - target.insertBefore(node, anchor); -} - -function noop() {} - -function detachNode(node) { - node.parentNode.removeChild(node); -} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Main; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= diff --git a/test/cli/samples/sourcemap-inline/src/Main.svelte b/test/cli/samples/sourcemap-inline/src/Main.svelte deleted file mode 100644 index 6f3f80bbff..0000000000 --- a/test/cli/samples/sourcemap-inline/src/Main.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - -Hello world!
\ No newline at end of file diff --git a/test/cli/samples/sourcemap/command.sh b/test/cli/samples/sourcemap/command.sh deleted file mode 100644 index 9164b1760c..0000000000 --- a/test/cli/samples/sourcemap/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src/Main.svelte -m -o actual/Main.js \ No newline at end of file diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js deleted file mode 100644 index 59059aadcb..0000000000 --- a/test/cli/samples/sourcemap/expected/Main.js +++ /dev/null @@ -1,192 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ - -function create_main_fragment(component, ctx) { - var p; - - return { - c() { - p = createElement("p"); - p.textContent = "Hello world!"; - }, - - m(target, anchor) { - insert(target, p, anchor); - }, - - p: noop, - - d(detach) { - if (detach) { - detachNode(p); - } - } - }; -} - -function Main(options) { - init(this, options); - this._state = assign({}, options.data); - this._intro = true; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - } -} - -assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Main.prototype._recompute = noop; - -function createElement(name) { - return document.createElement(name); -} - -function insert(target, node, anchor) { - target.insertBefore(node, anchor); -} - -function noop() {} - -function detachNode(node) { - node.parentNode.removeChild(node); -} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function blankObject() { - return Object.create(null); -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Main; -//# sourceMappingURL=Main.js.map diff --git a/test/cli/samples/sourcemap/expected/Main.js.map b/test/cli/samples/sourcemap/expected/Main.js.map deleted file mode 100644 index a31dec16ab..0000000000 --- a/test/cli/samples/sourcemap/expected/Main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.svelte"],"sourcesContent":["Hello world!
\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/sourcemap/src/Main.svelte b/test/cli/samples/sourcemap/src/Main.svelte deleted file mode 100644 index 6f3f80bbff..0000000000 --- a/test/cli/samples/sourcemap/src/Main.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - -Hello world!
\ No newline at end of file diff --git a/test/cli/samples/ssr/command.sh b/test/cli/samples/ssr/command.sh deleted file mode 100644 index 878f6038ab..0000000000 --- a/test/cli/samples/ssr/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile --generate ssr src/Main.svelte > actual/Main.js diff --git a/test/cli/samples/ssr/expected/Main.js b/test/cli/samples/ssr/expected/Main.js deleted file mode 100644 index b7a4f4addf..0000000000 --- a/test/cli/samples/ssr/expected/Main.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -var Main = {}; - -Main.filename = "src/Main.svelte"; - -Main.data = function() { - return {}; -}; - -Main.render = function(state, options = {}) { - var components = new Set(); - - function addComponent(component) { - components.add(component); - } - - var result = { head: '', addComponent }; - var html = Main._render(result, state, options); - - var cssCode = Array.from(components).map(c => c.css && c.css.code).filter(Boolean).join('\n'); - - return { - html, - head: result.head, - css: { code: cssCode, map: null }, - toString() { - return html; - } - }; -} - -Main._render = function(__result, ctx, options) { - __result.addComponent(Main); - - ctx = Object.assign({}, ctx); - - return `Hello world!
`; -}; - -Main.css = { - code: '', - map: null -}; - -var warned = false; - -module.exports = Main; \ No newline at end of file diff --git a/test/cli/samples/ssr/src/Main.svelte b/test/cli/samples/ssr/src/Main.svelte deleted file mode 100644 index aa994ea13e..0000000000 --- a/test/cli/samples/ssr/src/Main.svelte +++ /dev/null @@ -1 +0,0 @@ -Hello world!
\ No newline at end of file diff --git a/test/cli/samples/store/command.sh b/test/cli/samples/store/command.sh deleted file mode 100644 index dedeae05ef..0000000000 --- a/test/cli/samples/store/command.sh +++ /dev/null @@ -1 +0,0 @@ -svelte compile src/Main.svelte --store > actual/Main.js diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js deleted file mode 100644 index 28bc62b786..0000000000 --- a/test/cli/samples/store/expected/Main.js +++ /dev/null @@ -1,217 +0,0 @@ -/* src/Main.svelte generated by Svelte vx.y.z */ - -function create_main_fragment(component, ctx) { - var h1, text0, text1; - - return { - c() { - h1 = createElement("h1"); - text0 = createText("Hello "); - text1 = createText(ctx.$name); - }, - - m(target, anchor) { - insert(target, h1, anchor); - append(h1, text0); - append(h1, text1); - }, - - p(changed, ctx) { - if (changed.$name) { - setData(text1, ctx.$name); - } - }, - - d(detach) { - if (detach) { - detachNode(h1); - } - } - }; -} - -function Main(options) { - init(this, options); - this._state = assign(this.store._init(["name"]), options.data); - this.store._add(this, ["name"]); - this._intro = true; - - this._handlers.destroy = [removeFromStore]; - - this._fragment = create_main_fragment(this, this._state); - - if (options.target) { - this._fragment.c(); - this._mount(options.target, options.anchor); - } -} - -assign(Main.prototype, { - destroy: destroy, - get: get, - fire: fire, - on: on, - set: set, - _set: _set, - _stage: _stage, - _mount: _mount, - _differs: _differs - }); - -Main.prototype._recompute = noop; - -function createElement(name) { - return document.createElement(name); -} - -function createText(data) { - return document.createTextNode(data); -} - -function insert(target, node, anchor) { - target.insertBefore(node, anchor); -} - -function append(target, node) { - target.appendChild(node); -} - -function setData(text, data) { - text.data = '' + data; -} - -function detachNode(node) { - node.parentNode.removeChild(node); -} - -function init(component, options) { - component._handlers = blankObject(); - component._slots = blankObject(); - component._bind = options._bind; - component._staged = {}; - - component.options = options; - component.root = options.root || component; - component.store = options.store || component.root.store; - - if (!options.root) { - component._beforecreate = []; - component._oncreate = []; - component._aftercreate = []; - } -} - -function assign(tar, src) { - for (var k in src) tar[k] = src[k]; - return tar; -} - -function removeFromStore() { - this.store._remove(this); -} - -function destroy(detach) { - this.destroy = noop; - this.fire('destroy'); - this.set = noop; - - this._fragment.d(detach !== false); - this._fragment = null; - this._state = {}; -} - -function get() { - return this._state; -} - -function fire(eventName, data) { - var handlers = - eventName in this._handlers && this._handlers[eventName].slice(); - if (!handlers) return; - - for (var i = 0; i < handlers.length; i += 1) { - var handler = handlers[i]; - - if (!handler.__calling) { - try { - handler.__calling = true; - handler.call(this, data); - } finally { - handler.__calling = false; - } - } - } -} - -function on(eventName, handler) { - var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); - handlers.push(handler); - - return { - cancel: function() { - var index = handlers.indexOf(handler); - if (~index) handlers.splice(index, 1); - } - }; -} - -function set(newState) { - this._set(assign({}, newState)); - if (this.root._lock) return; - flush(this.root); -} - -function _set(newState) { - var oldState = this._state, - changed = {}, - dirty = false; - - newState = assign(this._staged, newState); - this._staged = {}; - - for (var key in newState) { - if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; - } - if (!dirty) return; - - this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); - if (this._bind) this._bind(changed, this._state); - - if (this._fragment) { - this.fire("state", { changed: changed, current: this._state, previous: oldState }); - this._fragment.p(changed, this._state); - this.fire("update", { changed: changed, current: this._state, previous: oldState }); - } -} - -function _stage(newState) { - assign(this._staged, newState); -} - -function _mount(target, anchor) { - this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); -} - -function _differs(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); -} - -function noop() {} - -function blankObject() { - return Object.create(null); -} - -function flush(component) { - component._lock = true; - callAll(component._beforecreate); - callAll(component._oncreate); - callAll(component._aftercreate); - component._lock = false; -} - -function callAll(fns) { - while (fns && fns.length) fns.shift()(); -} -export default Main; \ No newline at end of file diff --git a/test/cli/samples/store/src/Main.svelte b/test/cli/samples/store/src/Main.svelte deleted file mode 100644 index 3010a856fb..0000000000 --- a/test/cli/samples/store/src/Main.svelte +++ /dev/null @@ -1 +0,0 @@ -