From 48298db60e3ed0a7c082d11f390a7ed956a03d33 Mon Sep 17 00:00:00 2001 From: pushkine Date: Sun, 17 May 2020 15:22:24 +0200 Subject: [PATCH] update expected --- .../compile/render_dom/wrappers/Head.ts | 2 +- test/css/index.ts | 3 + test/custom-elements/index.ts | 6 +- .../samples/extended-builtin/_config.js | 30 ++-- .../samples/no-svelte-options/_config.js | 31 ++-- .../samples/no-tag-warning/_config.js | 31 ++-- .../_after_head.html | 6 +- .../_before_head.html | 6 +- .../action-custom-event-handler/expected.js | 4 +- test/js/samples/bind-online/expected.js | 9 +- test/js/samples/bind-open/expected.js | 1 + test/js/samples/bind-width-height/expected.js | 1 + .../bindings-readonly-order/expected.js | 12 +- .../samples/capture-inject-state/expected.js | 41 ++--- .../expected.js | 9 +- .../component-static-array/expected.js | 3 +- .../component-static-immutable/expected.js | 3 +- .../component-static-immutable2/expected.js | 3 +- .../samples/component-static-var/expected.js | 5 +- test/js/samples/component-static/expected.js | 3 +- .../expected.js | 8 +- .../expected.js | 9 +- .../expected.js | 4 +- .../samples/computed-collapsed-if/expected.js | 1 + test/js/samples/css-media-query/expected.js | 8 +- test/js/samples/data-attribute/expected.js | 1 + test/js/samples/debug-empty/expected.js | 17 ++- .../debug-foo-bar-baz-things/expected.js | 49 +++--- test/js/samples/debug-foo/expected.js | 49 +++--- test/js/samples/debug-hoisted/expected.js | 4 +- .../samples/debug-no-dependencies/expected.js | 34 +++-- .../samples/deconflict-builtins/expected.js | 25 ++-- .../js/samples/deconflict-globals/expected.js | 1 + .../expected.js | 17 ++- test/js/samples/dynamic-import/expected.js | 3 +- .../each-block-array-literal/expected.js | 27 ++-- .../each-block-changed-check/expected.js | 25 ++-- .../each-block-keyed-animated/expected.js | 42 ++++-- test/js/samples/each-block-keyed/expected.js | 19 +-- .../samples/event-handler-dynamic/expected.js | 14 +- test/js/samples/event-modifiers/expected.js | 11 +- .../js/samples/if-block-no-update/expected.js | 1 + test/js/samples/if-block-simple/expected.js | 1 + .../expected.js | 1 + .../inline-style-optimized-url/expected.js | 1 + .../inline-style-optimized/expected.js | 1 + .../inline-style-unoptimized/expected.js | 1 + test/js/samples/input-files/expected.js | 1 + .../input-no-initial-value/expected.js | 11 +- test/js/samples/input-range/expected.js | 12 +- .../input-without-blowback-guard/expected.js | 1 + test/js/samples/legacy-input-type/expected.js | 6 +- test/js/samples/loop-protect/expected.js | 24 +-- test/js/samples/media-bindings/expected.js | 11 +- .../non-imported-component/expected.js | 5 +- .../expected.js | 1 + .../expected.js | 1 + .../samples/select-dynamic-value/expected.js | 1 + .../samples/src-attribute-check/expected.js | 1 + test/js/samples/title/expected.js | 1 + test/js/samples/transition-local/expected.js | 19 +-- .../transition-repeated-outro/expected.js | 25 ++-- .../use-elements-as-anchors/expected.js | 1 + test/js/samples/video-bindings/expected.js | 12 +- .../samples/window-binding-online/expected.js | 9 +- .../samples/window-binding-scroll/expected.js | 1 + test/parser/samples/animation/output.json | 16 +- .../attribute-unique-binding-error/error.json | 13 +- .../samples/attribute-unique-error/error.json | 13 +- .../error.json | 13 +- test/parser/samples/await-catch/output.json | 72 ++++----- .../samples/await-then-catch/output.json | 108 +++++++------- .../samples/binding-shorthand/output.json | 40 ++--- test/parser/samples/binding/output.json | 40 ++--- test/parser/samples/css/output.json | 48 +++--- .../parser/samples/dynamic-import/output.json | 112 +++++++------- .../each-block-destructured/output.json | 28 ++-- .../samples/each-block-else/output.json | 28 ++-- .../samples/each-block-indexed/output.json | 28 ++-- .../samples/each-block-keyed/output.json | 16 +- test/parser/samples/each-block/output.json | 16 +- .../error-catch-before-closing/error.json | 19 ++- .../error-catch-without-await/error.json | 13 +- .../samples/error-comment-unclosed/error.json | 13 +- test/parser/samples/error-css/error.json | 15 +- .../error-else-before-closing-2/error.json | 19 ++- .../error-else-before-closing-3/error.json | 19 ++- .../error-else-before-closing/error.json | 19 ++- .../error-else-if-before-closing-2/error.json | 19 ++- .../error-else-if-before-closing/error.json | 19 ++- .../error-else-if-without-if/error.json | 19 ++- .../error-illegal-expression/error.json | 13 +- .../samples/error-multiple-styles/error.json | 15 +- .../samples/error-script-unclosed/error.json | 13 +- .../samples/error-self-reference/error.json | 11 +- .../error-svelte-selfdestructive/error.json | 19 ++- .../error-then-before-closing/error.json | 19 ++- .../error-then-without-await/error.json | 13 +- .../error.json | 13 +- .../error.json | 13 +- .../error.json | 13 +- .../error-unexpected-end-of-input/error.json | 13 +- .../error-unmatched-closing-tag/error.json | 13 +- .../samples/error-void-closing/error.json | 13 +- .../samples/error-window-children/error.json | 11 +- .../samples/error-window-duplicate/error.json | 13 +- .../error-window-inside-block/error.json | 13 +- .../error-window-inside-element/error.json | 13 +- test/parser/samples/event-handler/output.json | 24 +-- test/parser/samples/if-block-else/output.json | 24 +-- .../samples/if-block-elseif/output.json | 40 ++--- .../implicitly-closed-li-block/output.json | 62 ++++---- .../samples/implicitly-closed-li/output.json | 46 +++--- .../no-error-if-before-closing/output.json | 140 +++++++++--------- .../raw-mustaches-whitespace-error/error.json | 13 +- test/parser/samples/refs/output.json | 40 ++--- .../samples/script-comment-only/output.json | 24 +-- .../output.json | 58 ++++---- .../script-comment-trailing/output.json | 56 +++---- test/parser/samples/script/output.json | 52 +++---- .../parser/samples/self-reference/output.json | 28 ++-- .../samples/textarea-children/output.json | 26 ++-- .../samples/unusual-identifier/output.json | 16 +- .../whitespace-leading-trailing/output.json | 18 +-- 124 files changed, 1373 insertions(+), 1016 deletions(-) diff --git a/src/compiler/compile/render_dom/wrappers/Head.ts b/src/compiler/compile/render_dom/wrappers/Head.ts index 63c528c00c..69559a22b8 100644 --- a/src/compiler/compile/render_dom/wrappers/Head.ts +++ b/src/compiler/compile/render_dom/wrappers/Head.ts @@ -30,7 +30,7 @@ export default class HeadWrapper extends Wrapper { if (this.renderer.options.hydratable && this.fragment.nodes.length) { nodes = block.get_unique_name('head_nodes'); block.chunks.claim.push( - b`const ${nodes} = Array.from((@_document.head||@_document.body).querySelectorAll('[data-svelte="${this.node.id}"]'));` + b`const ${nodes} = Array.from(( @_document.head || @_document.body ).querySelectorAll('[data-svelte="${this.node.id}"]'));` ); } diff --git a/test/css/index.ts b/test/css/index.ts index d037a53425..8f1545bb6b 100644 --- a/test/css/index.ts +++ b/test/css/index.ts @@ -16,6 +16,9 @@ function normalize_warning(warning) { warning.frame = warning.frame.replace(/^\n/, '').replace(/^\t+/gm, '').replace(/\s+$/gm, ''); delete warning.filename; delete warning.toString; + delete warning.start; + delete warning.end; + delete warning.pos; return warning; } diff --git a/test/custom-elements/index.ts b/test/custom-elements/index.ts index b8c4aa22a1..4707159fb8 100644 --- a/test/custom-elements/index.ts +++ b/test/custom-elements/index.ts @@ -131,9 +131,9 @@ describe('custom-elements', function () { warnings.map((w) => ({ code: w.code, message: w.message, - pos: w.pos, - start: w.start, - end: w.end, + // pos: w.pos, + // start: w.start, + // end: w.end, })), expected_warnings ); diff --git a/test/custom-elements/samples/extended-builtin/_config.js b/test/custom-elements/samples/extended-builtin/_config.js index cbd57acc65..0370421696 100644 --- a/test/custom-elements/samples/extended-builtin/_config.js +++ b/test/custom-elements/samples/extended-builtin/_config.js @@ -1,17 +1,19 @@ export default { - warnings: [{ - code: "avoid-is", - message: "The 'is' attribute is not supported cross-browser and should be avoided", - pos: 98, - start: { - character: 98, - column: 8, - line: 7 + warnings: [ + { + code: 'avoid-is', + message: "The 'is' attribute is not supported cross-browser and should be avoided", + // pos: 98, + // start: { + // character: 98, + // column: 8, + // line: 7 + // }, + // end: { + // character: 116, + // column: 26, + // line: 7 + // } }, - end: { - character: 116, - column: 26, - line: 7 - } - }] + ], }; diff --git a/test/custom-elements/samples/no-svelte-options/_config.js b/test/custom-elements/samples/no-svelte-options/_config.js index e45582a127..cd41cf6ed6 100644 --- a/test/custom-elements/samples/no-svelte-options/_config.js +++ b/test/custom-elements/samples/no-svelte-options/_config.js @@ -1,17 +1,20 @@ export default { - warnings: [{ - code: "custom-element-no-tag", - message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ", - pos: 0, - start: { - character: 0, - column: 0, - line: 1 + warnings: [ + { + code: 'custom-element-no-tag', + message: + 'No custom element \'tag\' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ', + // pos: 0, + // start: { + // character: 0, + // column: 0, + // line: 1 + // }, + // end: { + // character: 0, + // column: 0, + // line: 1 + // } }, - end: { - character: 0, - column: 0, - line: 1 - } - }] + ], }; diff --git a/test/custom-elements/samples/no-tag-warning/_config.js b/test/custom-elements/samples/no-tag-warning/_config.js index 7cdfdbaec6..bb41b41bbf 100644 --- a/test/custom-elements/samples/no-tag-warning/_config.js +++ b/test/custom-elements/samples/no-tag-warning/_config.js @@ -1,17 +1,20 @@ export default { - warnings: [{ - code: "custom-element-no-tag", - message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ", - pos: 0, - start: { - character: 0, - column: 0, - line: 1 + warnings: [ + { + code: 'custom-element-no-tag', + message: + 'No custom element \'tag\' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ', + // pos: 0, + // start: { + // character: 0, + // column: 0, + // line: 1 + // }, + // end: { + // character: 18, + // column: 18, + // line: 1 + // } }, - end: { - character: 18, - column: 18, - line: 1 - } - }] + ], }; diff --git a/test/hydration/samples/head-meta-hydrate-duplicate/_after_head.html b/test/hydration/samples/head-meta-hydrate-duplicate/_after_head.html index 10cf2c8b9a..73baebf925 100644 --- a/test/hydration/samples/head-meta-hydrate-duplicate/_after_head.html +++ b/test/hydration/samples/head-meta-hydrate-duplicate/_after_head.html @@ -1,4 +1,4 @@ Some Title - - - \ No newline at end of file + + + diff --git a/test/hydration/samples/head-meta-hydrate-duplicate/_before_head.html b/test/hydration/samples/head-meta-hydrate-duplicate/_before_head.html index 107753cdd0..a9e78c59c8 100644 --- a/test/hydration/samples/head-meta-hydrate-duplicate/_before_head.html +++ b/test/hydration/samples/head-meta-hydrate-duplicate/_before_head.html @@ -1,4 +1,4 @@ Some Title - - - \ No newline at end of file + + + diff --git a/test/js/samples/action-custom-event-handler/expected.js b/test/js/samples/action-custom-event-handler/expected.js index aa2941f404..21baf19a01 100644 --- a/test/js/samples/action-custom-event-handler/expected.js +++ b/test/js/samples/action-custom-event-handler/expected.js @@ -6,7 +6,6 @@ import { element, init, insert, - is_function, noop, safe_not_equal } from "svelte/internal"; @@ -27,7 +26,7 @@ function create_fragment(ctx) { dispose = action_destroyer(foo_action = foo.call(null, button, /*foo_function*/ ctx[1])); }, p(ctx, [dirty]) { - if (foo_action && is_function(foo_action.update) && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[1]); + if (foo_action && "function" === typeof foo_action.update && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[1]); }, i: noop, o: noop, @@ -52,6 +51,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("bar" in $$props) $$invalidate(0, bar = $$props.bar); + 0; }; return [bar, foo_function]; diff --git a/test/js/samples/bind-online/expected.js b/test/js/samples/bind-online/expected.js index fa955e4fd5..6724b52363 100644 --- a/test/js/samples/bind-online/expected.js +++ b/test/js/samples/bind-online/expected.js @@ -5,7 +5,6 @@ import { init, listen, noop, - run_all, safe_not_equal } from "svelte/internal"; @@ -16,7 +15,9 @@ function create_fragment(ctx) { return { c: noop, m(target, anchor, remount) { - if (remount) run_all(dispose); + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(window, "online", /*onlinestatuschanged*/ ctx[1]), @@ -27,7 +28,9 @@ function create_fragment(ctx) { i: noop, o: noop, d(detaching) { - run_all(dispose); + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } diff --git a/test/js/samples/bind-open/expected.js b/test/js/samples/bind-open/expected.js index 77b68f1b27..7bf7628e34 100644 --- a/test/js/samples/bind-open/expected.js +++ b/test/js/samples/bind-open/expected.js @@ -51,6 +51,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("open" in $$props) $$invalidate(0, open = $$props.open); + 0; }; return [open, details_toggle_handler]; diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index 4848704c4b..bb216c7630 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -49,6 +49,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("w" in $$props) $$invalidate(0, w = $$props.w); if ("h" in $$props) $$invalidate(1, h = $$props.h); + 0; }; return [w, h, div_elementresize_handler]; diff --git a/test/js/samples/bindings-readonly-order/expected.js b/test/js/samples/bindings-readonly-order/expected.js index 00e8a5bf00..51c3d6c5cd 100644 --- a/test/js/samples/bindings-readonly-order/expected.js +++ b/test/js/samples/bindings-readonly-order/expected.js @@ -8,7 +8,6 @@ import { insert, listen, noop, - run_all, safe_not_equal, space } from "svelte/internal"; @@ -31,7 +30,10 @@ function create_fragment(ctx) { insert(target, input0, anchor); insert(target, t, anchor); insert(target, input1, anchor); - if (remount) run_all(dispose); + + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(input0, "change", /*input0_change_handler*/ ctx[1]), @@ -45,7 +47,10 @@ function create_fragment(ctx) { if (detaching) detach(input0); if (detaching) detach(t); if (detaching) detach(input1); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } @@ -65,6 +70,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("files" in $$props) $$invalidate(0, files = $$props.files); + 0; }; return [files, input0_change_handler, input1_change_handler]; diff --git a/test/js/samples/capture-inject-state/expected.js b/test/js/samples/capture-inject-state/expected.js index cd719ac5d2..0b515b094e 100644 --- a/test/js/samples/capture-inject-state/expected.js +++ b/test/js/samples/capture-inject-state/expected.js @@ -1,8 +1,8 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponentDev, - add_location, - append_dev, + add_location_dev, + append, detach_dev, dispatch_dev, element, @@ -14,8 +14,8 @@ import { space, subscribe, text, - validate_slots, - validate_store + validate_slots_dev, + validate_store_dev } from "svelte/internal"; const file = undefined; @@ -48,24 +48,24 @@ function create_fragment(ctx) { t8 = text(/*$prop*/ ctx[2]); t9 = space(); t10 = text(/*shadowedByModule*/ ctx[4]); - add_location(p, file, 22, 0, 430); + add_location_dev(p, file, 22, 0, 452); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, p, anchor); - append_dev(p, t0); - append_dev(p, t1); - append_dev(p, t2); - append_dev(p, t3); - append_dev(p, t4); - append_dev(p, t5); - append_dev(p, t6); - append_dev(p, t7); - append_dev(p, t8); - append_dev(p, t9); - append_dev(p, t10); + append(p, t0); + append(p, t1); + append(p, t2); + append(p, t3); + append(p, t4); + append(p, t5); + append(p, t6); + append(p, t7); + append(p, t8); + append(p, t9); + append(p, t10); }, p: function update(ctx, [dirty]) { if (dirty & /*prop*/ 1) set_data_dev(t0, /*prop*/ ctx[0]); @@ -100,11 +100,13 @@ const priv = "priv"; function instance($$self, $$props, $$invalidate) { let $prop, $$unsubscribe_prop = noop, - $$subscribe_prop = () => ($$unsubscribe_prop(), $$unsubscribe_prop = subscribe(prop, $$value => $$invalidate(2, $prop = $$value)), prop); + $$subscribe_prop = () => ($$unsubscribe_prop(), $$unsubscribe_prop = subscribe(prop, value => { + $$invalidate(2, $prop = value); + }), prop); $$self.$$.on_destroy.push(() => $$unsubscribe_prop()); let { prop } = $$props; - validate_store(prop, "prop"); + validate_store_dev(prop, "prop"); $$subscribe_prop(); let { alias: realName } = $$props; let local; @@ -116,11 +118,12 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); $$self.$set = $$props => { if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop)); if ("alias" in $$props) $$invalidate(1, realName = $$props.alias); + 0; }; $$self.$capture_state = () => ({ diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 6fef0f9490..427f8b8c75 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -15,8 +15,8 @@ import { function add_css() { var style = element("style"); - style.id = "svelte-1a7i8ec-style"; - style.textContent = "p.svelte-1a7i8ec{color:red}"; + style.id = "svelte-1o8xv48-style"; + style.textContent = "p.svelte-1o8xv48{color:red}"; append(document.head, style); } @@ -28,7 +28,7 @@ function create_fragment(ctx) { c() { p = element("p"); t = text(/*foo*/ ctx[0]); - attr(p, "class", "svelte-1a7i8ec"); + attr(p, "class", "svelte-1o8xv48"); }, m(target, anchor) { insert(target, p, anchor); @@ -50,6 +50,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + 0; }; return [foo]; @@ -58,7 +59,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1a7i8ec-style")) add_css(); + if (!document.getElementById("svelte-1o8xv48-style")) add_css(); init(this, options, instance, create_fragment, safe_not_equal, { foo: 0 }); } } diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js index 44e8dbfe33..acf8dc94fe 100644 --- a/test/js/samples/component-static-array/expected.js +++ b/test/js/samples/component-static-array/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, init, mount_component, @@ -17,7 +16,7 @@ function create_fragment(ctx) { return { c() { - create_component(nested.$$.fragment); + if (nested.$$.fragment) nested.$$.fragment.c(); }, m(target, anchor) { mount_component(nested, target, anchor); diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index a7dd8128fa..6ae2c1f58f 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, init, mount_component, @@ -17,7 +16,7 @@ function create_fragment(ctx) { return { c() { - create_component(nested.$$.fragment); + if (nested.$$.fragment) nested.$$.fragment.c(); }, m(target, anchor) { mount_component(nested, target, anchor); diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index a7dd8128fa..6ae2c1f58f 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, init, mount_component, @@ -17,7 +16,7 @@ function create_fragment(ctx) { return { c() { - create_component(nested.$$.fragment); + if (nested.$$.fragment) nested.$$.fragment.c(); }, m(target, anchor) { mount_component(nested, target, anchor); diff --git a/test/js/samples/component-static-var/expected.js b/test/js/samples/component-static-var/expected.js index c032a0636d..5016ea1557 100644 --- a/test/js/samples/component-static-var/expected.js +++ b/test/js/samples/component-static-var/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, detach, element, @@ -30,9 +29,9 @@ function create_fragment(ctx) { return { c() { - create_component(foo.$$.fragment); + if (foo.$$.fragment) foo.$$.fragment.c(); t0 = space(); - create_component(bar.$$.fragment); + if (bar.$$.fragment) bar.$$.fragment.c(); t1 = space(); input = element("input"); }, diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 26c63f550b..093c7006f1 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, init, mount_component, @@ -17,7 +16,7 @@ function create_fragment(ctx) { return { c() { - create_component(nested.$$.fragment); + if (nested.$$.fragment) nested.$$.fragment.c(); }, m(target, anchor) { mount_component(nested, target, anchor); diff --git a/test/js/samples/component-store-access-invalidate/expected.js b/test/js/samples/component-store-access-invalidate/expected.js index 4c7bfd7009..3e5aaaed8c 100644 --- a/test/js/samples/component-store-access-invalidate/expected.js +++ b/test/js/samples/component-store-access-invalidate/expected.js @@ -2,7 +2,6 @@ import { SvelteComponent, append, - component_subscribe, detach, element, init, @@ -10,6 +9,7 @@ import { noop, safe_not_equal, set_data, + subscribe, text } from "svelte/internal"; @@ -42,7 +42,11 @@ function create_fragment(ctx) { function instance($$self, $$props, $$invalidate) { let $foo; const foo = writable(0); - component_subscribe($$self, foo, value => $$invalidate(0, $foo = value)); + + $$self.$$.on_destroy.push(subscribe(foo, value => { + $$invalidate(0, $foo = value); + })); + return [$foo, foo]; } diff --git a/test/js/samples/component-store-file-invalidate/expected.js b/test/js/samples/component-store-file-invalidate/expected.js index d2fb3d0be4..7aca01464b 100644 --- a/test/js/samples/component-store-file-invalidate/expected.js +++ b/test/js/samples/component-store-file-invalidate/expected.js @@ -1,17 +1,20 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - component_subscribe, init, safe_not_equal, - set_store_value + set_store_value, + subscribe } from "svelte/internal"; import { count } from "./store.js"; function instance($$self, $$props, $$invalidate) { let $count; - component_subscribe($$self, count, $$value => $$invalidate(1, $count = $$value)); + + $$self.$$.on_destroy.push(subscribe(count, value => { + $$invalidate(1, $count = value); + })); function increment() { set_store_value(count, $count++, $count); diff --git a/test/js/samples/component-store-reassign-invalidate/expected.js b/test/js/samples/component-store-reassign-invalidate/expected.js index b33047d8f3..a412286288 100644 --- a/test/js/samples/component-store-reassign-invalidate/expected.js +++ b/test/js/samples/component-store-reassign-invalidate/expected.js @@ -57,7 +57,9 @@ function create_fragment(ctx) { function instance($$self, $$props, $$invalidate) { let $foo, $$unsubscribe_foo = noop, - $$subscribe_foo = () => ($$unsubscribe_foo(), $$unsubscribe_foo = subscribe(foo, $$value => $$invalidate(1, $foo = $$value)), foo); + $$subscribe_foo = () => ($$unsubscribe_foo(), $$unsubscribe_foo = subscribe(foo, value => { + $$invalidate(1, $foo = value); + }), foo); $$self.$$.on_destroy.push(() => $$unsubscribe_foo()); let foo = writable(0); diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index 8e5964f8a6..22e2512018 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -14,6 +14,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("x" in $$props) $$invalidate(0, x = $$props.x); + 0; }; return [x, a, b]; diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index f477670059..1797c62e69 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -13,8 +13,8 @@ import { function add_css() { var style = element("style"); - style.id = "svelte-1slhpfn-style"; - style.textContent = "@media(min-width: 1px){div.svelte-1slhpfn{color:red}}"; + style.id = "svelte-8exri5-style"; + style.textContent = "@media(min-width: 1px){div.svelte-8exri5{color:red}}"; append(document.head, style); } @@ -24,7 +24,7 @@ function create_fragment(ctx) { return { c() { div = element("div"); - attr(div, "class", "svelte-1slhpfn"); + attr(div, "class", "svelte-8exri5"); }, m(target, anchor) { insert(target, div, anchor); @@ -41,7 +41,7 @@ function create_fragment(ctx) { class Component extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-1slhpfn-style")) add_css(); + if (!document.getElementById("svelte-8exri5-style")) add_css(); init(this, options, null, create_fragment, safe_not_equal, {}); } } diff --git a/test/js/samples/data-attribute/expected.js b/test/js/samples/data-attribute/expected.js index 49ad2f2626..65c97eee57 100644 --- a/test/js/samples/data-attribute/expected.js +++ b/test/js/samples/data-attribute/expected.js @@ -49,6 +49,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("bar" in $$props) $$invalidate(0, bar = $$props.bar); + 0; }; return [bar]; diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index dd142adb26..319ab2ca10 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -1,8 +1,8 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponentDev, - add_location, - append_dev, + add_location_dev, + append, detach_dev, dispatch_dev, element, @@ -13,7 +13,7 @@ import { set_data_dev, space, text, - validate_slots + validate_slots_dev } from "svelte/internal"; const file = undefined; @@ -33,16 +33,16 @@ function create_fragment(ctx) { t2 = text("!"); t3 = space(); debugger; - add_location(h1, file, 4, 0, 38); + add_location_dev(h1, file, 4, 0, 42); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, h1, anchor); - append_dev(h1, t0); - append_dev(h1, t1); - append_dev(h1, t2); + append(h1, t0); + append(h1, t1); + append(h1, t2); insert_dev(target, t3, anchor); }, p: function update(ctx, [dirty]) { @@ -77,10 +77,11 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); $$self.$set = $$props => { if ("name" in $$props) $$invalidate(0, name = $$props.name); + 0; }; $$self.$capture_state = () => ({ name }); diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 977702b99f..9bcc7c6f40 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -1,21 +1,21 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponentDev, - add_location, - append_dev, + add_location_dev, + append, destroy_each, detach_dev, dispatch_dev, element, init, insert_dev, + is_array_like_dev, noop, safe_not_equal, set_data_dev, space, text, - validate_each_argument, - validate_slots + validate_slots_dev } from "svelte/internal"; const file = undefined; @@ -48,11 +48,11 @@ function create_each_block(ctx) { debugger; } - add_location(span, file, 8, 1, 116); + add_location_dev(span, file, 8, 1, 124); }, m: function mount(target, anchor) { insert_dev(target, span, anchor); - append_dev(span, t0); + append(span, t0); insert_dev(target, t1, anchor); }, p: function update(ctx, dirty) { @@ -90,16 +90,16 @@ function create_fragment(ctx) { let t1; let t2; let each_value = /*things*/ ctx[0]; - validate_each_argument(each_value); + is_array_like_dev(each_value); let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { + for (let i = 0; i < each_value.length; i++) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } const block = { c: function create() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } @@ -107,40 +107,42 @@ function create_fragment(ctx) { p = element("p"); t1 = text("foo: "); t2 = text(/*foo*/ ctx[1]); - add_location(p, file, 12, 0, 182); + add_location_dev(p, file, 12, 0, 194); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } insert_dev(target, t0, anchor); insert_dev(target, p, anchor); - append_dev(p, t1); - append_dev(p, t2); + append(p, t1); + append(p, t2); }, p: function update(ctx, [dirty]) { if (dirty & /*things*/ 1) { each_value = /*things*/ ctx[0]; - validate_each_argument(each_value); - let i; + is_array_like_dev(each_value); + let i = 0; + let block; - for (i = 0; i < each_value.length; i += 1) { + for (; i < each_value.length; i++) { + block = each_blocks[i]; const child_ctx = get_each_context(ctx, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); + if (block) { + block.p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(t0.parentNode, t0); + block = each_blocks[i] = create_each_block(child_ctx); + block.c(); + block.m(t0.parentNode, t0); } } - for (; i < each_blocks.length; i += 1) { + for (; i < each_blocks.length; i++) { each_blocks[i].d(1); } @@ -181,13 +183,14 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); if ("bar" in $$props) $$invalidate(2, bar = $$props.bar); if ("baz" in $$props) $$invalidate(3, baz = $$props.baz); + 0; }; $$self.$capture_state = () => ({ things, foo, bar, baz }); diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index fe62ff77bf..cd095519cb 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -1,21 +1,21 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponentDev, - add_location, - append_dev, + add_location_dev, + append, destroy_each, detach_dev, dispatch_dev, element, init, insert_dev, + is_array_like_dev, noop, safe_not_equal, set_data_dev, space, text, - validate_each_argument, - validate_slots + validate_slots_dev } from "svelte/internal"; const file = undefined; @@ -45,11 +45,11 @@ function create_each_block(ctx) { debugger; } - add_location(span, file, 6, 1, 82); + add_location_dev(span, file, 6, 1, 88); }, m: function mount(target, anchor) { insert_dev(target, span, anchor); - append_dev(span, t0); + append(span, t0); insert_dev(target, t1, anchor); }, p: function update(ctx, dirty) { @@ -84,16 +84,16 @@ function create_fragment(ctx) { let t1; let t2; let each_value = /*things*/ ctx[0]; - validate_each_argument(each_value); + is_array_like_dev(each_value); let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { + for (let i = 0; i < each_value.length; i++) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } const block = { c: function create() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } @@ -101,40 +101,42 @@ function create_fragment(ctx) { p = element("p"); t1 = text("foo: "); t2 = text(/*foo*/ ctx[1]); - add_location(p, file, 10, 0, 131); + add_location_dev(p, file, 10, 0, 141); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } insert_dev(target, t0, anchor); insert_dev(target, p, anchor); - append_dev(p, t1); - append_dev(p, t2); + append(p, t1); + append(p, t2); }, p: function update(ctx, [dirty]) { if (dirty & /*things*/ 1) { each_value = /*things*/ ctx[0]; - validate_each_argument(each_value); - let i; + is_array_like_dev(each_value); + let i = 0; + let block; - for (i = 0; i < each_value.length; i += 1) { + for (; i < each_value.length; i++) { + block = each_blocks[i]; const child_ctx = get_each_context(ctx, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); + if (block) { + block.p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(t0.parentNode, t0); + block = each_blocks[i] = create_each_block(child_ctx); + block.c(); + block.m(t0.parentNode, t0); } } - for (; i < each_blocks.length; i += 1) { + for (; i < each_blocks.length; i++) { each_blocks[i].d(1); } @@ -173,11 +175,12 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); + 0; }; $$self.$capture_state = () => ({ things, foo }); diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index 0e634297f0..a5dca308f1 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -5,7 +5,7 @@ import { init, noop, safe_not_equal, - validate_slots + validate_slots_dev } from "svelte/internal"; const file = undefined; @@ -58,7 +58,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); $$self.$capture_state = () => ({ obj, kobzol }); $$self.$inject_state = $$props => { diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index 76068e8cf4..c504c82d10 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -7,12 +7,12 @@ import { empty, init, insert_dev, + is_array_like_dev, noop, safe_not_equal, space, text, - validate_each_argument, - validate_slots + validate_slots_dev } from "svelte/internal"; const file = undefined; @@ -66,16 +66,16 @@ function create_each_block(ctx) { function create_fragment(ctx) { let each_1_anchor; let each_value = things; - validate_each_argument(each_value); + is_array_like_dev(each_value); let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { + for (let i = 0; i < each_value.length; i++) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } const block = { c: function create() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } @@ -85,7 +85,7 @@ function create_fragment(ctx) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } @@ -94,22 +94,24 @@ function create_fragment(ctx) { p: function update(ctx, [dirty]) { if (dirty & /*things*/ 0) { each_value = things; - validate_each_argument(each_value); - let i; + is_array_like_dev(each_value); + let i = 0; + let block; - for (i = 0; i < each_value.length; i += 1) { + for (; i < each_value.length; i++) { + block = each_blocks[i]; const child_ctx = get_each_context(ctx, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); + if (block) { + block.p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + block = each_blocks[i] = create_each_block(child_ctx); + block.c(); + block.m(each_1_anchor.parentNode, each_1_anchor); } } - for (; i < each_blocks.length; i += 1) { + for (; i < each_blocks.length; i++) { each_blocks[i].d(1); } @@ -143,7 +145,7 @@ function instance($$self, $$props) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); return []; } diff --git a/test/js/samples/deconflict-builtins/expected.js b/test/js/samples/deconflict-builtins/expected.js index fb98844ef7..9acbbd181c 100644 --- a/test/js/samples/deconflict-builtins/expected.js +++ b/test/js/samples/deconflict-builtins/expected.js @@ -49,20 +49,20 @@ function create_fragment(ctx) { let each_value = /*createElement*/ ctx[0]; let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { + for (let i = 0; i < each_value.length; i++) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } return { c() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } each_1_anchor = empty(); }, m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } @@ -71,21 +71,23 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (dirty & /*createElement*/ 1) { each_value = /*createElement*/ ctx[0]; - let i; + let i = 0; + let block; - for (i = 0; i < each_value.length; i += 1) { + for (; i < each_value.length; i++) { + block = each_blocks[i]; const child_ctx = get_each_context(ctx, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); + if (block) { + block.p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + block = each_blocks[i] = create_each_block(child_ctx); + block.c(); + block.m(each_1_anchor.parentNode, each_1_anchor); } } - for (; i < each_blocks.length; i += 1) { + for (; i < each_blocks.length; i++) { each_blocks[i].d(1); } @@ -106,6 +108,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("createElement" in $$props) $$invalidate(0, createElement = $$props.createElement); + 0; }; return [createElement]; diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js index 7e83c21f0e..ef8012ee69 100644 --- a/test/js/samples/deconflict-globals/expected.js +++ b/test/js/samples/deconflict-globals/expected.js @@ -12,6 +12,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + 0; }; return [foo]; diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js index 0a50e2cd97..ea18757f82 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -1,8 +1,8 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponentDev, - add_location, - append_dev, + add_location_dev, + append, detach_dev, dispatch_dev, element, @@ -13,7 +13,7 @@ import { set_data_dev, space, text, - validate_slots + validate_slots_dev } from "svelte/internal"; const file = undefined; @@ -31,16 +31,16 @@ function create_fragment(ctx) { t0 = text(t0_value); t1 = space(); t2 = text(/*bar*/ ctx[1]); - add_location(p, file, 7, 0, 67); + add_location_dev(p, file, 7, 0, 74); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { insert_dev(target, p, anchor); - append_dev(p, t0); - append_dev(p, t1); - append_dev(p, t2); + append(p, t0); + append(p, t1); + append(p, t2); }, p: function update(ctx, [dirty]) { if (dirty & /*foo*/ 1 && t0_value !== (t0_value = Math.max(0, /*foo*/ ctx[0]) + "")) set_data_dev(t0, t0_value); @@ -74,10 +74,11 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + 0; }; $$self.$capture_state = () => ({ foo, bar }); diff --git a/test/js/samples/dynamic-import/expected.js b/test/js/samples/dynamic-import/expected.js index 4394e7d8a9..5013dc2829 100644 --- a/test/js/samples/dynamic-import/expected.js +++ b/test/js/samples/dynamic-import/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, init, mount_component, @@ -19,7 +18,7 @@ function create_fragment(ctx) { return { c() { - create_component(lazyload.$$.fragment); + if (lazyload.$$.fragment) lazyload.$$.fragment.c(); }, m(target, anchor) { mount_component(lazyload, target, anchor); diff --git a/test/js/samples/each-block-array-literal/expected.js b/test/js/samples/each-block-array-literal/expected.js index 10d835cf78..2838935b48 100644 --- a/test/js/samples/each-block-array-literal/expected.js +++ b/test/js/samples/each-block-array-literal/expected.js @@ -49,20 +49,20 @@ function create_fragment(ctx) { let each_value = [/*a*/ ctx[0], /*b*/ ctx[1], /*c*/ ctx[2], /*d*/ ctx[3], /*e*/ ctx[4]]; let each_blocks = []; - for (let i = 0; i < 5; i += 1) { + for (let i = 0; i < each_value.length; i++) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } return { c() { - for (let i = 0; i < 5; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } each_1_anchor = empty(); }, m(target, anchor) { - for (let i = 0; i < 5; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } @@ -71,23 +71,27 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (dirty & /*a, b, c, d, e*/ 31) { each_value = [/*a*/ ctx[0], /*b*/ ctx[1], /*c*/ ctx[2], /*d*/ ctx[3], /*e*/ ctx[4]]; - let i; + let i = 0; + let block; - for (i = 0; i < 5; i += 1) { + for (; i < each_value.length; i++) { + block = each_blocks[i]; const child_ctx = get_each_context(ctx, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); + if (block) { + block.p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + block = each_blocks[i] = create_each_block(child_ctx); + block.c(); + block.m(each_1_anchor.parentNode, each_1_anchor); } } - for (; i < 5; i += 1) { + for (; i < each_blocks.length; i++) { each_blocks[i].d(1); } + + each_blocks.length = each_value.length; } }, i: noop, @@ -112,6 +116,7 @@ function instance($$self, $$props, $$invalidate) { if ("c" in $$props) $$invalidate(2, c = $$props.c); if ("d" in $$props) $$invalidate(3, d = $$props.d); if ("e" in $$props) $$invalidate(4, e = $$props.e); + 0; }; return [a, b, c, d, e]; diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 5d88032b87..673b0996bf 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -87,13 +87,13 @@ function create_fragment(ctx) { let each_value = /*comments*/ ctx[0]; let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { + for (let i = 0; i < each_value.length; i++) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); } return { c() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } @@ -102,7 +102,7 @@ function create_fragment(ctx) { t1 = text(/*foo*/ ctx[3]); }, m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } @@ -113,21 +113,23 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (dirty & /*comments, elapsed, time*/ 7) { each_value = /*comments*/ ctx[0]; - let i; + let i = 0; + let block; - for (i = 0; i < each_value.length; i += 1) { + for (; i < each_value.length; i++) { + block = each_blocks[i]; const child_ctx = get_each_context(ctx, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); + if (block) { + block.p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(t0.parentNode, t0); + block = each_blocks[i] = create_each_block(child_ctx); + block.c(); + block.m(t0.parentNode, t0); } } - for (; i < each_blocks.length; i += 1) { + for (; i < each_blocks.length; i++) { each_blocks[i].d(1); } @@ -157,6 +159,7 @@ function instance($$self, $$props, $$invalidate) { if ("elapsed" in $$props) $$invalidate(1, elapsed = $$props.elapsed); if ("time" in $$props) $$invalidate(2, time = $$props.time); if ("foo" in $$props) $$invalidate(3, foo = $$props.foo); + 0; }; return [comments, elapsed, time, foo]; diff --git a/test/js/samples/each-block-keyed-animated/expected.js b/test/js/samples/each-block-keyed-animated/expected.js index 7fb81c27a2..e65ac87d65 100644 --- a/test/js/samples/each-block-keyed-animated/expected.js +++ b/test/js/samples/each-block-keyed-animated/expected.js @@ -2,15 +2,14 @@ import { SvelteComponent, append, - create_animation, detach, element, empty, - fix_and_destroy_block, fix_position, init, insert, noop, + run_animation, safe_not_equal, set_data, text, @@ -28,6 +27,7 @@ function create_each_block(key_1, ctx) { let div; let t_value = /*thing*/ ctx[1].name + ""; let t; + let unfreeze; let rect; let stop_animation = noop; @@ -43,22 +43,26 @@ function create_each_block(key_1, ctx) { insert(target, div, anchor); append(div, t); }, - p(ctx, dirty) { + p(new_ctx, dirty) { + ctx = new_ctx; if (dirty & /*things*/ 1 && t_value !== (t_value = /*thing*/ ctx[1].name + "")) set_data(t, t_value); }, r() { rect = div.getBoundingClientRect(); }, f() { - fix_position(div); stop_animation(); + unfreeze = fix_position(div, rect); }, a() { - stop_animation(); - stop_animation = create_animation(div, rect, foo, {}); + if (unfreeze) return; else { + stop_animation(); + stop_animation = run_animation(div, rect, foo); + } }, d(detaching) { if (detaching) detach(div); + unfreeze = void 0; } }; } @@ -70,22 +74,22 @@ function create_fragment(ctx) { let each_value = /*things*/ ctx[0]; const get_key = ctx => /*thing*/ ctx[1].id; - for (let i = 0; i < each_value.length; i += 1) { - let child_ctx = get_each_context(ctx, each_value, i); - let key = get_key(child_ctx); + for (let i = 0; i < each_value.length; i++) { + const child_ctx = get_each_context(ctx, each_value, i); + const key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); } return { c() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } each_1_anchor = empty(); }, m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } @@ -94,15 +98,22 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (dirty & /*things*/ 1) { const each_value = /*things*/ ctx[0]; - for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].r(); - each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, fix_and_destroy_block, create_each_block, each_1_anchor, get_each_context); - for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].a(); + + for (let i = 0; i < each_blocks.length; i++) { + each_blocks[i].r(); + } + + each_blocks = update_keyed_each(each_blocks, dirty, ctx, 3, get_key, each_value, each_1_lookup, each_1_anchor.parentNode, create_each_block, each_1_anchor, get_each_context); + + for (let i = 0; i < each_blocks.length; i++) { + each_blocks[i].a(); + } } }, i: noop, o: noop, d(detaching) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].d(detaching); } @@ -130,6 +141,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); + 0; }; return [things]; diff --git a/test/js/samples/each-block-keyed/expected.js b/test/js/samples/each-block-keyed/expected.js index ad8c074e99..79490187f0 100644 --- a/test/js/samples/each-block-keyed/expected.js +++ b/test/js/samples/each-block-keyed/expected.js @@ -2,7 +2,6 @@ import { SvelteComponent, append, - destroy_block, detach, element, empty, @@ -39,7 +38,8 @@ function create_each_block(key_1, ctx) { insert(target, div, anchor); append(div, t); }, - p(ctx, dirty) { + p(new_ctx, dirty) { + ctx = new_ctx; if (dirty & /*things*/ 1 && t_value !== (t_value = /*thing*/ ctx[1].name + "")) set_data(t, t_value); }, d(detaching) { @@ -55,22 +55,22 @@ function create_fragment(ctx) { let each_value = /*things*/ ctx[0]; const get_key = ctx => /*thing*/ ctx[1].id; - for (let i = 0; i < each_value.length; i += 1) { - let child_ctx = get_each_context(ctx, each_value, i); - let key = get_key(child_ctx); + for (let i = 0; i < each_value.length; i++) { + const child_ctx = get_each_context(ctx, each_value, i); + const key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); } return { c() { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].c(); } each_1_anchor = empty(); }, m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].m(target, anchor); } @@ -79,13 +79,13 @@ function create_fragment(ctx) { p(ctx, [dirty]) { if (dirty & /*things*/ 1) { const each_value = /*things*/ ctx[0]; - each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, destroy_block, create_each_block, each_1_anchor, get_each_context); + each_blocks = update_keyed_each(each_blocks, dirty, ctx, 1, get_key, each_value, each_1_lookup, each_1_anchor.parentNode, create_each_block, each_1_anchor, get_each_context); } }, i: noop, o: noop, d(detaching) { - for (let i = 0; i < each_blocks.length; i += 1) { + for (let i = 0; i < each_blocks.length; i++) { each_blocks[i].d(detaching); } @@ -99,6 +99,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); + 0; }; return [things]; diff --git a/test/js/samples/event-handler-dynamic/expected.js b/test/js/samples/event-handler-dynamic/expected.js index d8f5710023..372a01afeb 100644 --- a/test/js/samples/event-handler-dynamic/expected.js +++ b/test/js/samples/event-handler-dynamic/expected.js @@ -6,10 +6,8 @@ import { element, init, insert, - is_function, listen, noop, - run_all, safe_not_equal, set_data, space, @@ -53,13 +51,16 @@ function create_fragment(ctx) { append(p1, t4); insert(target, t5, anchor); insert(target, button2, anchor); - if (remount) run_all(dispose); + + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(button0, "click", /*updateHandler1*/ ctx[2]), listen(button1, "click", /*updateHandler2*/ ctx[3]), listen(button2, "click", function () { - if (is_function(/*clickHandler*/ ctx[0])) /*clickHandler*/ ctx[0].apply(this, arguments); + if ("function" === typeof /*clickHandler*/ ctx[0]) /*clickHandler*/ ctx[0].apply(this, arguments); }) ]; }, @@ -75,7 +76,10 @@ function create_fragment(ctx) { if (detaching) detach(p1); if (detaching) detach(t5); if (detaching) detach(button2); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } diff --git a/test/js/samples/event-modifiers/expected.js b/test/js/samples/event-modifiers/expected.js index 2eca5f29b8..b43f299fd1 100644 --- a/test/js/samples/event-modifiers/expected.js +++ b/test/js/samples/event-modifiers/expected.js @@ -9,7 +9,6 @@ import { listen, noop, prevent_default, - run_all, safe_not_equal, space, stop_propagation @@ -43,7 +42,10 @@ function create_fragment(ctx) { append(div, button1); append(div, t3); append(div, button2); - if (remount) run_all(dispose); + + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(button0, "click", stop_propagation(prevent_default(handleClick))), @@ -57,7 +59,10 @@ function create_fragment(ctx) { o: noop, d(detaching) { if (detaching) detach(div); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index f225c221bf..9c30f26bfc 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -90,6 +90,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + 0; }; return [foo]; diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index eb6c8e8949..262eee286b 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -68,6 +68,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + 0; }; return [foo]; diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js index 84a38abd7b..b185dcd24d 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -48,6 +48,7 @@ function instance($$self, $$props, $$invalidate) { if ("color" in $$props) $$invalidate(0, color = $$props.color); if ("x" in $$props) $$invalidate(1, x = $$props.x); if ("y" in $$props) $$invalidate(2, y = $$props.y); + 0; }; return [color, x, y]; diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js index 77870348a5..ce433d9f3d 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -39,6 +39,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("data" in $$props) $$invalidate(0, data = $$props.data); + 0; }; return [data]; diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js index 5bef284f09..4eec246766 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -39,6 +39,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("color" in $$props) $$invalidate(0, color = $$props.color); + 0; }; return [color]; diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index fdff685ead..c5fd885fc9 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -58,6 +58,7 @@ function instance($$self, $$props, $$invalidate) { if ("style" in $$props) $$invalidate(0, style = $$props.style); if ("key" in $$props) $$invalidate(1, key = $$props.key); if ("value" in $$props) $$invalidate(2, value = $$props.value); + 0; }; return [style, key, value]; diff --git a/test/js/samples/input-files/expected.js b/test/js/samples/input-files/expected.js index 1c1e57fc9b..8fff0bfeef 100644 --- a/test/js/samples/input-files/expected.js +++ b/test/js/samples/input-files/expected.js @@ -46,6 +46,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("files" in $$props) $$invalidate(0, files = $$props.files); + 0; }; return [files, input_change_handler]; diff --git a/test/js/samples/input-no-initial-value/expected.js b/test/js/samples/input-no-initial-value/expected.js index f72daa22a3..4295ac97f2 100644 --- a/test/js/samples/input-no-initial-value/expected.js +++ b/test/js/samples/input-no-initial-value/expected.js @@ -9,7 +9,6 @@ import { insert, listen, noop, - run_all, safe_not_equal, set_input_value, space @@ -38,7 +37,10 @@ function create_fragment(ctx) { set_input_value(input, /*test*/ ctx[0]); append(form, t0); append(form, button); - if (remount) run_all(dispose); + + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(input, "input", /*input_input_handler*/ ctx[2]), @@ -54,7 +56,10 @@ function create_fragment(ctx) { o: noop, d(detaching) { if (detaching) detach(form); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } diff --git a/test/js/samples/input-range/expected.js b/test/js/samples/input-range/expected.js index 17a8065449..d6ae3e937c 100644 --- a/test/js/samples/input-range/expected.js +++ b/test/js/samples/input-range/expected.js @@ -8,7 +8,6 @@ import { insert, listen, noop, - run_all, safe_not_equal, set_input_value, to_number @@ -26,7 +25,10 @@ function create_fragment(ctx) { m(target, anchor, remount) { insert(target, input, anchor); set_input_value(input, /*value*/ ctx[0]); - if (remount) run_all(dispose); + + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(input, "change", /*input_change_input_handler*/ ctx[1]), @@ -42,7 +44,10 @@ function create_fragment(ctx) { o: noop, d(detaching) { if (detaching) detach(input); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } @@ -57,6 +62,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("value" in $$props) $$invalidate(0, value = $$props.value); + 0; }; return [value, input_change_input_handler]; diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index 1e379032f3..a4048c44fe 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -50,6 +50,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + 0; }; return [foo, input_change_handler]; diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js index 2b76a48522..d02eae4ee4 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -1,13 +1,13 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, + attr, detach, element, init, insert, noop, - safe_not_equal, - set_input_type + safe_not_equal } from "svelte/internal"; function create_fragment(ctx) { @@ -16,7 +16,7 @@ function create_fragment(ctx) { return { c() { input = element("input"); - set_input_type(input, "search"); + attr(input, "type", "search"); }, m(target, anchor) { insert(target, input, anchor); diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index c52d9df437..d2dd6a5080 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -1,7 +1,7 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponentDev, - add_location, + add_location_dev, binding_callbacks, detach_dev, dispatch_dev, @@ -9,10 +9,10 @@ import { globals, init, insert_dev, - loop_guard, + loop_guard_dev, noop, safe_not_equal, - validate_slots + validate_slots_dev } from "svelte/internal"; const { console: console_1 } = globals; @@ -24,7 +24,7 @@ function create_fragment(ctx) { const block = { c: function create() { div = element("div"); - add_location(div, file, 22, 0, 288); + add_location_dev(div, file, 22, 0, 310); }, l: function claim(nodes) { throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); @@ -57,7 +57,7 @@ function foo() { const guard = "foo"; { - const guard_1 = loop_guard(100); + const guard_1 = loop_guard_dev(100); while (true) { console.log(guard); @@ -70,7 +70,7 @@ function instance($$self, $$props, $$invalidate) { let node; { - const guard = loop_guard(100); + const guard = loop_guard_dev(100); while (true) { foo(); @@ -79,7 +79,7 @@ function instance($$self, $$props, $$invalidate) { } { - const guard_2 = loop_guard(100); + const guard_2 = loop_guard_dev(100); for (; ; ) { foo(); @@ -88,7 +88,7 @@ function instance($$self, $$props, $$invalidate) { } { - const guard_3 = loop_guard(100); + const guard_3 = loop_guard_dev(100); while (true) { foo(); @@ -97,7 +97,7 @@ function instance($$self, $$props, $$invalidate) { } { - const guard_5 = loop_guard(100); + const guard_5 = loop_guard_dev(100); do { foo(); @@ -112,7 +112,7 @@ function instance($$self, $$props, $$invalidate) { }); let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); + validate_slots_dev("Component", $$slots, []); function div_binding($$value) { binding_callbacks[$$value ? "unshift" : "push"](() => { @@ -131,7 +131,7 @@ function instance($$self, $$props, $$invalidate) { } $: { - const guard_4 = loop_guard(100); + const guard_4 = loop_guard_dev(100); while (true) { foo(); @@ -140,7 +140,7 @@ function instance($$self, $$props, $$invalidate) { } $: { - const guard_6 = loop_guard(100); + const guard_6 = loop_guard_dev(100); do { foo(); diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index e58d32cf29..c999e4bc6b 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -9,7 +9,6 @@ import { listen, noop, raf, - run_all, safe_not_equal, time_ranges_to_array } from "svelte/internal"; @@ -53,7 +52,9 @@ function create_fragment(ctx) { audio.playbackRate = /*playbackRate*/ ctx[7]; } - if (remount) run_all(dispose); + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(audio, "progress", /*audio_progress_handler*/ ctx[10]), @@ -92,7 +93,10 @@ function create_fragment(ctx) { o: noop, d(detaching) { if (detaching) detach(audio); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } @@ -171,6 +175,7 @@ function instance($$self, $$props, $$invalidate) { if ("playbackRate" in $$props) $$invalidate(7, playbackRate = $$props.playbackRate); if ("seeking" in $$props) $$invalidate(8, seeking = $$props.seeking); if ("ended" in $$props) $$invalidate(9, ended = $$props.ended); + 0; }; return [ diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index 2784fd17ac..7119c63c6e 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -1,7 +1,6 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - create_component, destroy_component, detach, init, @@ -24,9 +23,9 @@ function create_fragment(ctx) { return { c() { - create_component(imported.$$.fragment); + if (imported.$$.fragment) imported.$$.fragment.c(); t = space(); - create_component(nonimported.$$.fragment); + if (nonimported.$$.fragment) nonimported.$$.fragment.c(); }, m(target, anchor) { mount_component(imported, target, anchor); diff --git a/test/js/samples/reactive-values-non-topologically-ordered/expected.js b/test/js/samples/reactive-values-non-topologically-ordered/expected.js index 3d266f10ac..ef1dfe2475 100644 --- a/test/js/samples/reactive-values-non-topologically-ordered/expected.js +++ b/test/js/samples/reactive-values-non-topologically-ordered/expected.js @@ -8,6 +8,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("x" in $$props) $$invalidate(0, x = $$props.x); + 0; }; $$self.$$.update = () => { diff --git a/test/js/samples/reactive-values-non-writable-dependencies/expected.js b/test/js/samples/reactive-values-non-writable-dependencies/expected.js index 38bd356d85..6f1d47f1ae 100644 --- a/test/js/samples/reactive-values-non-writable-dependencies/expected.js +++ b/test/js/samples/reactive-values-non-writable-dependencies/expected.js @@ -8,6 +8,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("a" in $$props) $$invalidate(0, a = $$props.a); if ("b" in $$props) $$invalidate(1, b = $$props.b); + 0; }; $$self.$$.update = () => { diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js index a93a47bd3a..b311b7b1df 100644 --- a/test/js/samples/select-dynamic-value/expected.js +++ b/test/js/samples/select-dynamic-value/expected.js @@ -68,6 +68,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("current" in $$props) $$invalidate(0, current = $$props.current); + 0; }; return [current]; diff --git a/test/js/samples/src-attribute-check/expected.js b/test/js/samples/src-attribute-check/expected.js index e03b3a6ba7..3ebe905a8e 100644 --- a/test/js/samples/src-attribute-check/expected.js +++ b/test/js/samples/src-attribute-check/expected.js @@ -70,6 +70,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("url" in $$props) $$invalidate(0, url = $$props.url); if ("slug" in $$props) $$invalidate(1, slug = $$props.slug); + 0; }; return [url, slug]; diff --git a/test/js/samples/title/expected.js b/test/js/samples/title/expected.js index d4e7e1a584..a6dbbc5fa0 100644 --- a/test/js/samples/title/expected.js +++ b/test/js/samples/title/expected.js @@ -24,6 +24,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("custom" in $$props) $$invalidate(0, custom = $$props.custom); + 0; }; return [custom]; diff --git a/test/js/samples/transition-local/expected.js b/test/js/samples/transition-local/expected.js index 25a03f026f..02cf645d5c 100644 --- a/test/js/samples/transition-local/expected.js +++ b/test/js/samples/transition-local/expected.js @@ -1,14 +1,13 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - add_render_callback, - create_in_transition, detach, element, empty, init, insert, noop, + run_transition, safe_not_equal, transition_in } from "svelte/internal"; @@ -53,7 +52,7 @@ function create_if_block(ctx) { // (9:1) {#if y} function create_if_block_1(ctx) { let div; - let div_intro; + let div_intro = noop; return { c() { @@ -64,16 +63,11 @@ function create_if_block_1(ctx) { insert(target, div, anchor); }, i(local) { - if (local) { - if (!div_intro) { - add_render_callback(() => { - div_intro = create_in_transition(div, foo, {}); - div_intro.start(); - }); - } - } + if (local) div_intro = run_transition(div, foo, 1); + }, + o(local) { + div_intro(); }, - o: noop, d(detaching) { if (detaching) detach(div); } @@ -127,6 +121,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("x" in $$props) $$invalidate(0, x = $$props.x); if ("y" in $$props) $$invalidate(1, y = $$props.y); + 0; }; return [x, y]; diff --git a/test/js/samples/transition-repeated-outro/expected.js b/test/js/samples/transition-repeated-outro/expected.js index 1f76a93666..f25749ce1e 100644 --- a/test/js/samples/transition-repeated-outro/expected.js +++ b/test/js/samples/transition-repeated-outro/expected.js @@ -1,14 +1,14 @@ /* generated by Svelte vX.Y.Z */ import { SvelteComponent, - check_outros, - create_out_transition, detach, element, empty, - group_outros, + group_transition_out, init, insert, + noop, + run_transition, safe_not_equal, transition_in, transition_out @@ -18,7 +18,7 @@ import { fade } from "svelte/transition"; function create_if_block(ctx) { let div; - let div_outro; + let div_outro = noop; let current; return { @@ -32,16 +32,16 @@ function create_if_block(ctx) { }, i(local) { if (current) return; - if (div_outro) div_outro.end(1); + div_outro(); current = true; }, o(local) { - div_outro = create_out_transition(div, fade, {}); + div_outro = run_transition(div, fade, 2); current = false; }, d(detaching) { if (detaching) detach(div); - if (detaching && div_outro) div_outro.end(); + if (detaching) div_outro(); } }; } @@ -74,13 +74,11 @@ function create_fragment(ctx) { if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { - group_outros(); - - transition_out(if_block, 1, 1, () => { - if_block = null; + group_transition_out(transition_out => { + transition_out(if_block, () => { + if_block = null; + }); }); - - check_outros(); } }, i(local) { @@ -104,6 +102,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("num" in $$props) $$invalidate(0, num = $$props.num); + 0; }; return [num]; diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index 5be8808edb..0b4390d986 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -249,6 +249,7 @@ function instance($$self, $$props, $$invalidate) { if ("c" in $$props) $$invalidate(2, c = $$props.c); if ("d" in $$props) $$invalidate(3, d = $$props.d); if ("e" in $$props) $$invalidate(4, e = $$props.e); + 0; }; return [a, b, c, d, e]; diff --git a/test/js/samples/video-bindings/expected.js b/test/js/samples/video-bindings/expected.js index 9c5467e1a0..f36d4c17df 100644 --- a/test/js/samples/video-bindings/expected.js +++ b/test/js/samples/video-bindings/expected.js @@ -10,7 +10,6 @@ import { listen, noop, raf, - run_all, safe_not_equal } from "svelte/internal"; @@ -41,7 +40,10 @@ function create_fragment(ctx) { m(target, anchor, remount) { insert(target, video, anchor); video_resize_listener = add_resize_listener(video, /*video_elementresize_handler*/ ctx[6].bind(video)); - if (remount) run_all(dispose); + + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(video, "timeupdate", video_timeupdate_handler), @@ -60,7 +62,10 @@ function create_fragment(ctx) { d(detaching) { if (detaching) detach(video); video_resize_listener(); - run_all(dispose); + + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } @@ -93,6 +98,7 @@ function instance($$self, $$props, $$invalidate) { if ("videoHeight" in $$props) $$invalidate(1, videoHeight = $$props.videoHeight); if ("videoWidth" in $$props) $$invalidate(2, videoWidth = $$props.videoWidth); if ("offsetWidth" in $$props) $$invalidate(3, offsetWidth = $$props.offsetWidth); + 0; }; return [ diff --git a/test/js/samples/window-binding-online/expected.js b/test/js/samples/window-binding-online/expected.js index fa955e4fd5..6724b52363 100644 --- a/test/js/samples/window-binding-online/expected.js +++ b/test/js/samples/window-binding-online/expected.js @@ -5,7 +5,6 @@ import { init, listen, noop, - run_all, safe_not_equal } from "svelte/internal"; @@ -16,7 +15,9 @@ function create_fragment(ctx) { return { c: noop, m(target, anchor, remount) { - if (remount) run_all(dispose); + if (remount) for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } dispose = [ listen(window, "online", /*onlinestatuschanged*/ ctx[1]), @@ -27,7 +28,9 @@ function create_fragment(ctx) { i: noop, o: noop, d(detaching) { - run_all(dispose); + for (let i = 0; i < dispose.length; i++) { + dispose[i](); + } } }; } diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 30723cc142..fa996c2708 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -75,6 +75,7 @@ function instance($$self, $$props, $$invalidate) { $$self.$set = $$props => { if ("y" in $$props) $$invalidate(0, y = $$props.y); + 0; }; return [y, onwindowscroll]; diff --git a/test/parser/samples/animation/output.json b/test/parser/samples/animation/output.json index 1958ba2817..124c110be0 100644 --- a/test/parser/samples/animation/output.json +++ b/test/parser/samples/animation/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 70, + "end": 72, "type": "Fragment", "children": [ { "start": 0, - "end": 70, + "end": 72, "type": "EachBlock", "expression": { "type": "Identifier", @@ -26,14 +26,14 @@ }, "children": [ { - "start": 33, - "end": 62, + "start": 34, + "end": 63, "type": "Element", "name": "div", "attributes": [ { - "start": 38, - "end": 50, + "start": 39, + "end": 51, "type": "Animation", "name": "flip", "modifiers": [], @@ -42,8 +42,8 @@ ], "children": [ { - "start": 51, - "end": 56, + "start": 52, + "end": 57, "type": "Text", "raw": "flips", "data": "flips" diff --git a/test/parser/samples/attribute-unique-binding-error/error.json b/test/parser/samples/attribute-unique-binding-error/error.json index dd14572149..28045832cc 100644 --- a/test/parser/samples/attribute-unique-binding-error/error.json +++ b/test/parser/samples/attribute-unique-binding-error/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "duplicate-attribute", - "message": "Attributes need to be unique", "start": { "line": 1, "column": 17, "character": 17 }, - "pos": 17 -} + "end": { + "line": 1, + "column": 17, + "character": 17 + }, + "pos": 17, + "frame": "1: \n ^", + "message": "Attributes need to be unique" +} \ No newline at end of file diff --git a/test/parser/samples/attribute-unique-error/error.json b/test/parser/samples/attribute-unique-error/error.json index dd14572149..5ff0538a9d 100644 --- a/test/parser/samples/attribute-unique-error/error.json +++ b/test/parser/samples/attribute-unique-error/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "duplicate-attribute", - "message": "Attributes need to be unique", "start": { "line": 1, "column": 17, "character": 17 }, - "pos": 17 -} + "end": { + "line": 1, + "column": 17, + "character": 17 + }, + "pos": 17, + "frame": "1:
\n ^", + "message": "Attributes need to be unique" +} \ No newline at end of file diff --git a/test/parser/samples/attribute-unique-shorthand-error/error.json b/test/parser/samples/attribute-unique-shorthand-error/error.json index dd14572149..2daa03b0df 100644 --- a/test/parser/samples/attribute-unique-shorthand-error/error.json +++ b/test/parser/samples/attribute-unique-shorthand-error/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "duplicate-attribute", - "message": "Attributes need to be unique", "start": { "line": 1, "column": 17, "character": 17 }, - "pos": 17 -} + "end": { + "line": 1, + "column": 17, + "character": 17 + }, + "pos": 17, + "frame": "1:
\n ^", + "message": "Attributes need to be unique" +} \ No newline at end of file diff --git a/test/parser/samples/await-catch/output.json b/test/parser/samples/await-catch/output.json index d47d27e4cb..7232deaf13 100644 --- a/test/parser/samples/await-catch/output.json +++ b/test/parser/samples/await-catch/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 99, + "end": 103, "type": "Fragment", "children": [ { "start": 0, - "end": 99, + "end": 103, "type": "AwaitBlock", "expression": { "type": "Identifier", @@ -31,26 +31,26 @@ }, "pending": { "start": 19, - "end": 39, + "end": 41, "type": "PendingBlock", "children": [ { "start": 19, - "end": 21, + "end": 22, "type": "Text", - "raw": "\n\t", - "data": "\n\t" + "raw": "\r\n\t", + "data": "\r\n\t" }, { - "start": 21, - "end": 38, + "start": 22, + "end": 39, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 24, - "end": 34, + "start": 25, + "end": 35, "type": "Text", "raw": "loading...", "data": "loading..." @@ -58,11 +58,11 @@ ] }, { - "start": 38, - "end": 39, + "start": 39, + "end": 41, "type": "Text", - "raw": "\n", - "data": "\n" + "raw": "\r\n", + "data": "\r\n" } ], "skip": false @@ -75,39 +75,39 @@ "skip": true }, "catch": { - "start": 39, - "end": 91, + "start": 41, + "end": 95, "type": "CatchBlock", "children": [ { - "start": 56, - "end": 58, + "start": 58, + "end": 61, "type": "Text", - "raw": "\n\t", - "data": "\n\t" + "raw": "\r\n\t", + "data": "\r\n\t" }, { - "start": 58, - "end": 90, + "start": 61, + "end": 93, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 61, - "end": 68, + "start": 64, + "end": 71, "type": "Text", "raw": "oh no! ", "data": "oh no! " }, { - "start": 68, - "end": 86, + "start": 71, + "end": 89, "type": "MustacheTag", "expression": { "type": "MemberExpression", - "start": 69, - "end": 85, + "start": 72, + "end": 88, "loc": { "start": { "line": 4, @@ -120,8 +120,8 @@ }, "object": { "type": "Identifier", - "start": 69, - "end": 77, + "start": 72, + "end": 80, "loc": { "start": { "line": 4, @@ -136,8 +136,8 @@ }, "property": { "type": "Identifier", - "start": 78, - "end": 85, + "start": 81, + "end": 88, "loc": { "start": { "line": 4, @@ -156,11 +156,11 @@ ] }, { - "start": 90, - "end": 91, + "start": 93, + "end": 95, "type": "Text", - "raw": "\n", - "data": "\n" + "raw": "\r\n", + "data": "\r\n" } ], "skip": false diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json index 01dc89f3f9..120faec7e0 100644 --- a/test/parser/samples/await-then-catch/output.json +++ b/test/parser/samples/await-then-catch/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 148, + "end": 154, "type": "Fragment", "children": [ { "start": 0, - "end": 148, + "end": 154, "type": "AwaitBlock", "expression": { "type": "Identifier", @@ -34,26 +34,26 @@ }, "pending": { "start": 19, - "end": 39, + "end": 41, "type": "PendingBlock", "children": [ { "start": 19, - "end": 21, + "end": 22, "type": "Text", - "raw": "\n\t", - "data": "\n\t" + "raw": "\r\n\t", + "data": "\r\n\t" }, { - "start": 21, - "end": 38, + "start": 22, + "end": 39, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 24, - "end": 34, + "start": 25, + "end": 35, "type": "Text", "raw": "loading...", "data": "loading..." @@ -61,49 +61,49 @@ ] }, { - "start": 38, - "end": 39, + "start": 39, + "end": 41, "type": "Text", - "raw": "\n", - "data": "\n" + "raw": "\r\n", + "data": "\r\n" } ], "skip": false }, "then": { - "start": 39, - "end": 88, + "start": 41, + "end": 92, "type": "ThenBlock", "children": [ { - "start": 55, - "end": 57, + "start": 57, + "end": 60, "type": "Text", - "raw": "\n\t", - "data": "\n\t" + "raw": "\r\n\t", + "data": "\r\n\t" }, { - "start": 57, - "end": 87, + "start": 60, + "end": 90, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 60, - "end": 73, + "start": 63, + "end": 76, "type": "Text", "raw": "the value is ", "data": "the value is " }, { - "start": 73, - "end": 83, + "start": 76, + "end": 86, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 74, - "end": 82, + "start": 77, + "end": 85, "loc": { "start": { "line": 4, @@ -120,49 +120,49 @@ ] }, { - "start": 87, - "end": 88, + "start": 90, + "end": 92, "type": "Text", - "raw": "\n", - "data": "\n" + "raw": "\r\n", + "data": "\r\n" } ], "skip": false }, "catch": { - "start": 88, - "end": 140, + "start": 92, + "end": 146, "type": "CatchBlock", "children": [ { - "start": 105, - "end": 107, + "start": 109, + "end": 112, "type": "Text", - "raw": "\n\t", - "data": "\n\t" + "raw": "\r\n\t", + "data": "\r\n\t" }, { - "start": 107, - "end": 139, + "start": 112, + "end": 144, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 110, - "end": 117, + "start": 115, + "end": 122, "type": "Text", "raw": "oh no! ", "data": "oh no! " }, { - "start": 117, - "end": 135, + "start": 122, + "end": 140, "type": "MustacheTag", "expression": { "type": "MemberExpression", - "start": 118, - "end": 134, + "start": 123, + "end": 139, "loc": { "start": { "line": 6, @@ -175,8 +175,8 @@ }, "object": { "type": "Identifier", - "start": 118, - "end": 126, + "start": 123, + "end": 131, "loc": { "start": { "line": 6, @@ -191,8 +191,8 @@ }, "property": { "type": "Identifier", - "start": 127, - "end": 134, + "start": 132, + "end": 139, "loc": { "start": { "line": 6, @@ -211,11 +211,11 @@ ] }, { - "start": 139, - "end": 140, + "start": 144, + "end": 146, "type": "Text", - "raw": "\n", - "data": "\n" + "raw": "\r\n", + "data": "\r\n" } ], "skip": false diff --git a/test/parser/samples/binding-shorthand/output.json b/test/parser/samples/binding-shorthand/output.json index 17012db31a..c196a8db90 100644 --- a/test/parser/samples/binding-shorthand/output.json +++ b/test/parser/samples/binding-shorthand/output.json @@ -1,31 +1,31 @@ { "html": { - "start": 30, - "end": 48, + "start": 34, + "end": 52, "type": "Fragment", "children": [ { - "start": 28, - "end": 30, + "start": 30, + "end": 34, "type": "Text", - "raw": "\n\n", - "data": "\n\n" + "raw": "\r\n\r\n", + "data": "\r\n\r\n" }, { - "start": 30, - "end": 48, + "start": 34, + "end": 52, "type": "InlineComponent", "name": "Widget", "attributes": [ { - "start": 38, - "end": 46, + "start": 42, + "end": 50, "type": "Binding", "name": "foo", "modifiers": [], "expression": { - "start": 43, - "end": 46, + "start": 47, + "end": 50, "type": "Identifier", "name": "foo" } @@ -38,12 +38,12 @@ "instance": { "type": "Script", "start": 0, - "end": 28, + "end": 30, "context": "default", "content": { "type": "Program", "start": 8, - "end": 19, + "end": 21, "loc": { "start": { "line": 1, @@ -57,8 +57,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 10, - "end": 18, + "start": 11, + "end": 19, "loc": { "start": { "line": 2, @@ -72,8 +72,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 14, - "end": 17, + "start": 15, + "end": 18, "loc": { "start": { "line": 2, @@ -86,8 +86,8 @@ }, "id": { "type": "Identifier", - "start": 14, - "end": 17, + "start": 15, + "end": 18, "loc": { "start": { "line": 2, diff --git a/test/parser/samples/binding/output.json b/test/parser/samples/binding/output.json index c980b7f3eb..41728bee29 100644 --- a/test/parser/samples/binding/output.json +++ b/test/parser/samples/binding/output.json @@ -1,32 +1,32 @@ { "html": { - "start": 31, - "end": 56, + "start": 35, + "end": 60, "type": "Fragment", "children": [ { - "start": 29, - "end": 31, + "start": 31, + "end": 35, "type": "Text", - "raw": "\n\n", - "data": "\n\n" + "raw": "\r\n\r\n", + "data": "\r\n\r\n" }, { - "start": 31, - "end": 56, + "start": 35, + "end": 60, "type": "Element", "name": "input", "attributes": [ { - "start": 38, - "end": 55, + "start": 42, + "end": 59, "type": "Binding", "name": "value", "modifiers": [], "expression": { "type": "Identifier", - "start": 50, - "end": 54, + "start": 54, + "end": 58, "loc": { "start": { "line": 5, @@ -48,12 +48,12 @@ "instance": { "type": "Script", "start": 0, - "end": 29, + "end": 31, "context": "default", "content": { "type": "Program", "start": 8, - "end": 20, + "end": 22, "loc": { "start": { "line": 1, @@ -67,8 +67,8 @@ "body": [ { "type": "VariableDeclaration", - "start": 10, - "end": 19, + "start": 11, + "end": 20, "loc": { "start": { "line": 2, @@ -82,8 +82,8 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 14, - "end": 18, + "start": 15, + "end": 19, "loc": { "start": { "line": 2, @@ -96,8 +96,8 @@ }, "id": { "type": "Identifier", - "start": 14, - "end": 18, + "start": 15, + "end": 19, "loc": { "start": { "line": 2, diff --git a/test/parser/samples/css/output.json b/test/parser/samples/css/output.json index 676b11f6a9..a61381e21b 100644 --- a/test/parser/samples/css/output.json +++ b/test/parser/samples/css/output.json @@ -22,17 +22,17 @@ }, { "start": 14, - "end": 16, + "end": 18, "type": "Text", - "raw": "\n\n", - "data": "\n\n" + "raw": "\r\n\r\n", + "data": "\r\n\r\n" } ] }, "css": { "type": "Style", - "start": 16, - "end": 56, + "start": 18, + "end": 62, "attributes": [], "children": [ { @@ -46,16 +46,16 @@ { "type": "TypeSelector", "name": "div", - "start": 25, - "end": 28 + "start": 28, + "end": 31 } ], - "start": 25, - "end": 28 + "start": 28, + "end": 31 } ], - "start": 25, - "end": 28 + "start": 28, + "end": 31 }, "block": { "type": "Block", @@ -70,28 +70,28 @@ { "type": "Identifier", "name": "red", - "start": 40, - "end": 43 + "start": 44, + "end": 47 } ], - "start": 39, - "end": 43 + "start": 43, + "end": 47 }, - "start": 33, - "end": 43 + "start": 37, + "end": 47 } ], - "start": 29, - "end": 47 + "start": 32, + "end": 52 }, - "start": 25, - "end": 47 + "start": 28, + "end": 52 } ], "content": { - "start": 23, - "end": 48, - "styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n" + "start": 25, + "end": 54, + "styles": "\r\n\tdiv {\r\n\t\tcolor: red;\r\n\t}\r\n" } } } \ No newline at end of file diff --git a/test/parser/samples/dynamic-import/output.json b/test/parser/samples/dynamic-import/output.json index 1e41252afa..2201f30a91 100644 --- a/test/parser/samples/dynamic-import/output.json +++ b/test/parser/samples/dynamic-import/output.json @@ -8,12 +8,12 @@ "instance": { "type": "Script", "start": 0, - "end": 146, + "end": 154, "context": "default", "content": { "type": "Program", "start": 8, - "end": 137, + "end": 145, "loc": { "start": { "line": 1, @@ -27,8 +27,8 @@ "body": [ { "type": "ImportDeclaration", - "start": 10, - "end": 43, + "start": 11, + "end": 44, "loc": { "start": { "line": 2, @@ -42,8 +42,8 @@ "specifiers": [ { "type": "ImportSpecifier", - "start": 19, - "end": 26, + "start": 20, + "end": 27, "loc": { "start": { "line": 2, @@ -56,8 +56,8 @@ }, "imported": { "type": "Identifier", - "start": 19, - "end": 26, + "start": 20, + "end": 27, "loc": { "start": { "line": 2, @@ -72,8 +72,8 @@ }, "local": { "type": "Identifier", - "start": 19, - "end": 26, + "start": 20, + "end": 27, "loc": { "start": { "line": 2, @@ -90,8 +90,8 @@ ], "source": { "type": "Literal", - "start": 34, - "end": 42, + "start": 35, + "end": 43, "loc": { "start": { "line": 2, @@ -108,8 +108,8 @@ }, { "type": "ExpressionStatement", - "start": 46, - "end": 136, + "start": 49, + "end": 143, "loc": { "start": { "line": 4, @@ -122,8 +122,8 @@ }, "expression": { "type": "CallExpression", - "start": 46, - "end": 135, + "start": 49, + "end": 142, "loc": { "start": { "line": 4, @@ -136,8 +136,8 @@ }, "callee": { "type": "Identifier", - "start": 46, - "end": 53, + "start": 49, + "end": 56, "loc": { "start": { "line": 4, @@ -153,8 +153,8 @@ "arguments": [ { "type": "ArrowFunctionExpression", - "start": 54, - "end": 134, + "start": 57, + "end": 141, "loc": { "start": { "line": 4, @@ -172,8 +172,8 @@ "params": [], "body": { "type": "BlockStatement", - "start": 60, - "end": 134, + "start": 63, + "end": 141, "loc": { "start": { "line": 4, @@ -187,8 +187,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 64, - "end": 131, + "start": 68, + "end": 137, "loc": { "start": { "line": 5, @@ -201,8 +201,8 @@ }, "expression": { "type": "CallExpression", - "start": 64, - "end": 130, + "start": 68, + "end": 136, "loc": { "start": { "line": 5, @@ -215,8 +215,8 @@ }, "callee": { "type": "MemberExpression", - "start": 64, - "end": 87, + "start": 68, + "end": 91, "loc": { "start": { "line": 5, @@ -229,8 +229,8 @@ }, "object": { "type": "ImportExpression", - "start": 64, - "end": 82, + "start": 68, + "end": 86, "loc": { "start": { "line": 5, @@ -243,8 +243,8 @@ }, "source": { "type": "Literal", - "start": 71, - "end": 81, + "start": 75, + "end": 85, "loc": { "start": { "line": 5, @@ -261,8 +261,8 @@ }, "property": { "type": "Identifier", - "start": 83, - "end": 87, + "start": 87, + "end": 91, "loc": { "start": { "line": 5, @@ -280,8 +280,8 @@ "arguments": [ { "type": "ArrowFunctionExpression", - "start": 88, - "end": 129, + "start": 92, + "end": 135, "loc": { "start": { "line": 5, @@ -299,8 +299,8 @@ "params": [ { "type": "Identifier", - "start": 88, - "end": 91, + "start": 92, + "end": 95, "loc": { "start": { "line": 5, @@ -316,8 +316,8 @@ ], "body": { "type": "BlockStatement", - "start": 95, - "end": 129, + "start": 99, + "end": 135, "loc": { "start": { "line": 5, @@ -331,8 +331,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 100, - "end": 125, + "start": 105, + "end": 130, "loc": { "start": { "line": 6, @@ -345,8 +345,8 @@ }, "expression": { "type": "CallExpression", - "start": 100, - "end": 124, + "start": 105, + "end": 129, "loc": { "start": { "line": 6, @@ -359,8 +359,8 @@ }, "callee": { "type": "MemberExpression", - "start": 100, - "end": 111, + "start": 105, + "end": 116, "loc": { "start": { "line": 6, @@ -373,8 +373,8 @@ }, "object": { "type": "Identifier", - "start": 100, - "end": 107, + "start": 105, + "end": 112, "loc": { "start": { "line": 6, @@ -389,8 +389,8 @@ }, "property": { "type": "Identifier", - "start": 108, - "end": 111, + "start": 113, + "end": 116, "loc": { "start": { "line": 6, @@ -408,8 +408,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 112, - "end": 123, + "start": 117, + "end": 128, "loc": { "start": { "line": 6, @@ -422,8 +422,8 @@ }, "object": { "type": "Identifier", - "start": 112, - "end": 115, + "start": 117, + "end": 120, "loc": { "start": { "line": 6, @@ -438,8 +438,8 @@ }, "property": { "type": "Identifier", - "start": 116, - "end": 123, + "start": 121, + "end": 128, "loc": { "start": { "line": 6, diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json index 425c609a2c..861d320855 100644 --- a/test/parser/samples/each-block-destructured/output.json +++ b/test/parser/samples/each-block-destructured/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 71, + "end": 73, "type": "Fragment", "children": [ { "start": 0, - "end": 71, + "end": 73, "type": "EachBlock", "expression": { "type": "Identifier", @@ -26,20 +26,20 @@ }, "children": [ { - "start": 42, - "end": 63, + "start": 43, + "end": 64, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 45, - "end": 50, + "start": 46, + "end": 51, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 46, - "end": 49, + "start": 47, + "end": 50, "loc": { "start": { "line": 2, @@ -54,20 +54,20 @@ } }, { - "start": 50, - "end": 52, + "start": 51, + "end": 53, "type": "Text", "raw": ": ", "data": ": " }, { - "start": 52, - "end": 59, + "start": 53, + "end": 60, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 53, - "end": 58, + "start": 54, + "end": 59, "loc": { "start": { "line": 2, diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json index 2720ce5292..e3384b8eb1 100644 --- a/test/parser/samples/each-block-else/output.json +++ b/test/parser/samples/each-block-else/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 77, + "end": 81, "type": "Fragment", "children": [ { "start": 0, - "end": 77, + "end": 81, "type": "EachBlock", "expression": { "type": "Identifier", @@ -26,20 +26,20 @@ }, "children": [ { - "start": 27, - "end": 42, + "start": 28, + "end": 43, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 30, - "end": 38, + "start": 31, + "end": 39, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 31, - "end": 37, + "start": 32, + "end": 38, "loc": { "start": { "line": 2, @@ -63,20 +63,20 @@ "name": "animal" }, "else": { - "start": 50, - "end": 70, + "start": 52, + "end": 74, "type": "ElseBlock", "children": [ { - "start": 52, - "end": 69, + "start": 55, + "end": 72, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 55, - "end": 65, + "start": 58, + "end": 68, "type": "Text", "raw": "no animals", "data": "no animals" diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json index 50f2000a36..e54bd43479 100644 --- a/test/parser/samples/each-block-indexed/output.json +++ b/test/parser/samples/each-block-indexed/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 58, + "end": 60, "type": "Fragment", "children": [ { "start": 0, - "end": 58, + "end": 60, "type": "EachBlock", "expression": { "type": "Identifier", @@ -26,20 +26,20 @@ }, "children": [ { - "start": 30, - "end": 50, + "start": 31, + "end": 51, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 33, - "end": 36, + "start": 34, + "end": 37, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 34, - "end": 35, + "start": 35, + "end": 36, "loc": { "start": { "line": 2, @@ -54,20 +54,20 @@ } }, { - "start": 36, - "end": 38, + "start": 37, + "end": 39, "type": "Text", "raw": ": ", "data": ": " }, { - "start": 38, - "end": 46, + "start": 39, + "end": 47, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 39, - "end": 45, + "start": 40, + "end": 46, "loc": { "start": { "line": 2, diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json index 7dc8681453..e1a2b3ca8c 100644 --- a/test/parser/samples/each-block-keyed/output.json +++ b/test/parser/samples/each-block-keyed/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 54, + "end": 56, "type": "Fragment", "children": [ { "start": 0, - "end": 54, + "end": 56, "type": "EachBlock", "expression": { "type": "Identifier", @@ -26,20 +26,20 @@ }, "children": [ { - "start": 33, - "end": 46, + "start": 34, + "end": 47, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 36, - "end": 42, + "start": 37, + "end": 43, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 37, - "end": 41, + "start": 38, + "end": 42, "loc": { "start": { "line": 2, diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json index 6594fb50a6..5cbbaf46cf 100644 --- a/test/parser/samples/each-block/output.json +++ b/test/parser/samples/each-block/output.json @@ -1,12 +1,12 @@ { "html": { "start": 0, - "end": 50, + "end": 52, "type": "Fragment", "children": [ { "start": 0, - "end": 50, + "end": 52, "type": "EachBlock", "expression": { "type": "Identifier", @@ -26,20 +26,20 @@ }, "children": [ { - "start": 27, - "end": 42, + "start": 28, + "end": 43, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 30, - "end": 38, + "start": 31, + "end": 39, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 31, - "end": 37, + "start": 32, + "end": 38, "loc": { "start": { "line": 2, diff --git a/test/parser/samples/error-catch-before-closing/error.json b/test/parser/samples/error-catch-before-closing/error.json index 30fbf5fbd5..af92f710c7 100644 --- a/test/parser/samples/error-catch-before-closing/error.json +++ b/test/parser/samples/error-catch-before-closing/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-catch-placement", - "message": "Expected to close {#each} block before seeing {:catch} block", - "start": { "line": 3, "column": 7, "character": 41 }, - "pos": 41 -} + "start": { + "line": 3, + "column": 7, + "character": 43 + }, + "end": { + "line": 3, + "column": 7, + "character": 43 + }, + "pos": 43, + "frame": "1: {#await true}\r\n2: {#each foo as bar}\r\n3: {:catch f}\r\n ^\n4: {/await}", + "message": "Expected to close {#each} block before seeing {:catch} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-catch-without-await/error.json b/test/parser/samples/error-catch-without-await/error.json index 86cf64a673..696d26a5a8 100644 --- a/test/parser/samples/error-catch-without-await/error.json +++ b/test/parser/samples/error-catch-without-await/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "invalid-catch-placement", - "message": "Cannot have an {:catch} block outside an {#await ...} block", "start": { "line": 1, "column": 7, "character": 7 }, - "pos": 7 -} + "end": { + "line": 1, + "column": 7, + "character": 7 + }, + "pos": 7, + "frame": "1: {:catch theValue}\n ^", + "message": "Cannot have an {:catch} block outside an {#await ...} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-comment-unclosed/error.json b/test/parser/samples/error-comment-unclosed/error.json index 8e355fb821..5ce487613c 100644 --- a/test/parser/samples/error-comment-unclosed/error.json +++ b/test/parser/samples/error-comment-unclosed/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "unexpected-eof", - "message": "comment was left open, expected -->", "start": { "line": 1, "column": 24, "character": 24 }, - "pos": 24 -} + "end": { + "line": 1, + "column": 24, + "character": 24 + }, + "pos": 24, + "frame": "1: " +} \ No newline at end of file diff --git a/test/parser/samples/error-css/error.json b/test/parser/samples/error-css/error.json index 90f7a091d2..97b9b37d04 100644 --- a/test/parser/samples/error-css/error.json +++ b/test/parser/samples/error-css/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "css-syntax-error", - "message": "LeftCurlyBracket is expected", "start": { "line": 2, "column": 16, - "character": 24 + "character": 25 }, - "pos": 24 -} + "end": { + "line": 2, + "column": 16, + "character": 25 + }, + "pos": 25, + "frame": "1: ", + "message": "LeftCurlyBracket is expected" +} \ No newline at end of file diff --git a/test/parser/samples/error-else-before-closing-2/error.json b/test/parser/samples/error-else-before-closing-2/error.json index d35be1abf5..560eb5c6fd 100644 --- a/test/parser/samples/error-else-before-closing-2/error.json +++ b/test/parser/samples/error-else-before-closing-2/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-else-placement", - "message": "Expected to close {#await} block before seeing {:else} block", - "start": { "line": 3, "column": 6, "character": 29 }, - "pos": 29 -} + "start": { + "line": 3, + "column": 6, + "character": 31 + }, + "end": { + "line": 3, + "column": 6, + "character": 31 + }, + "pos": 31, + "frame": "1: {#if true}\r\n2: {#await p}\r\n3: {:else}\r\n ^\n4: {/if}", + "message": "Expected to close {#await} block before seeing {:else} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-else-before-closing-3/error.json b/test/parser/samples/error-else-before-closing-3/error.json index e5ec210c75..9fad156dfa 100644 --- a/test/parser/samples/error-else-before-closing-3/error.json +++ b/test/parser/samples/error-else-before-closing-3/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-else-placement", - "message": "Cannot have an {:else} block outside an {#if ...} or {#each ...} block", - "start": { "line": 2, "column": 6, "character": 11 }, - "pos": 11 -} + "start": { + "line": 2, + "column": 6, + "character": 12 + }, + "end": { + "line": 2, + "column": 6, + "character": 12 + }, + "pos": 12, + "frame": "1:
  • \r\n2: {:else}\n ^", + "message": "Cannot have an {:else} block outside an {#if ...} or {#each ...} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-else-before-closing/error.json b/test/parser/samples/error-else-before-closing/error.json index 5b6e490c0f..053efeb8f6 100644 --- a/test/parser/samples/error-else-before-closing/error.json +++ b/test/parser/samples/error-else-before-closing/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-else-placement", - "message": "Expected to close
  • tag before seeing {:else} block", - "start": { "line": 3, "column": 6, "character": 23 }, - "pos": 23 -} + "start": { + "line": 3, + "column": 6, + "character": 25 + }, + "end": { + "line": 3, + "column": 6, + "character": 25 + }, + "pos": 25, + "frame": "1: {#if true}\r\n2:
  • \r\n3: {:else}\r\n ^\n4: {/if}", + "message": "Expected to close
  • tag before seeing {:else} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-else-if-before-closing-2/error.json b/test/parser/samples/error-else-if-before-closing-2/error.json index e55f4f11e5..ab4caedc94 100644 --- a/test/parser/samples/error-else-if-before-closing-2/error.json +++ b/test/parser/samples/error-else-if-before-closing-2/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-elseif-placement", - "message": "Expected to close

    tag before seeing {:else if ...} block", - "start": { "line": 3, "column": 9, "character": 25 }, - "pos": 25 -} + "start": { + "line": 3, + "column": 9, + "character": 27 + }, + "end": { + "line": 3, + "column": 9, + "character": 27 + }, + "pos": 27, + "frame": "1: {#if true}\r\n2:

    \r\n3: {:else if false}\r\n ^\n4: {/if}", + "message": "Expected to close

    tag before seeing {:else if ...} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-else-if-before-closing/error.json b/test/parser/samples/error-else-if-before-closing/error.json index 21d16c72a4..3d754e7058 100644 --- a/test/parser/samples/error-else-if-before-closing/error.json +++ b/test/parser/samples/error-else-if-before-closing/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-elseif-placement", - "message": "Expected to close {#await} block before seeing {:else if ...} block", - "start": { "line": 3, "column": 9, "character": 34 }, - "pos": 34 -} + "start": { + "line": 3, + "column": 9, + "character": 36 + }, + "end": { + "line": 3, + "column": 9, + "character": 36 + }, + "pos": 36, + "frame": "1: {#if true}\r\n2: {#await foo}\r\n3: {:else if false}\r\n ^\n4: {/if}", + "message": "Expected to close {#await} block before seeing {:else if ...} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-else-if-without-if/error.json b/test/parser/samples/error-else-if-without-if/error.json index dd69df6772..7cecb7b895 100644 --- a/test/parser/samples/error-else-if-without-if/error.json +++ b/test/parser/samples/error-else-if-without-if/error.json @@ -1,6 +1,17 @@ { + "name": "ParseError", "code": "invalid-elseif-placement", - "message": "Cannot have an {:else if ...} block outside an {#if ...} block", - "start": { "line": 3, "column": 10, "character": 35 }, - "pos": 35 -} + "start": { + "line": 3, + "column": 10, + "character": 37 + }, + "end": { + "line": 3, + "column": 10, + "character": 37 + }, + "pos": 37, + "frame": "1: {#await foo}\r\n2: {:then bar}\r\n3: {:else if}\r\n ^\n4: {/await}", + "message": "Cannot have an {:else if ...} block outside an {#if ...} block" +} \ No newline at end of file diff --git a/test/parser/samples/error-illegal-expression/error.json b/test/parser/samples/error-illegal-expression/error.json index d8b48a786e..3e40cc10ca 100644 --- a/test/parser/samples/error-illegal-expression/error.json +++ b/test/parser/samples/error-illegal-expression/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "parse-error", - "message": "Assigning to rvalue", "start": { "line": 1, "column": 1, "character": 1 }, - "pos": 1 -} + "end": { + "line": 1, + "column": 1, + "character": 1 + }, + "pos": 1, + "frame": "1: {42 = nope}\n ^", + "message": "Assigning to rvalue" +} \ No newline at end of file diff --git a/test/parser/samples/error-multiple-styles/error.json b/test/parser/samples/error-multiple-styles/error.json index 1c460c5bad..73e7e00ab7 100644 --- a/test/parser/samples/error-multiple-styles/error.json +++ b/test/parser/samples/error-multiple-styles/error.json @@ -1,10 +1,17 @@ { + "name": "ParseError", "code": "duplicate-style", - "message": "You can only have one top-level \r\n 8: \r\n 9: