Merge pull request #3870 from sveltejs/gh-3855

reinstate comments
pull/3883/head
Rich Harris 6 years ago committed by GitHub
commit 4ffa6fc031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
package-lock.json generated

@ -500,9 +500,9 @@
"dev": true "dev": true
}, },
"code-red": { "code-red": {
"version": "0.0.18", "version": "0.0.19",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.0.18.tgz", "resolved": "https://registry.npmjs.org/code-red/-/code-red-0.0.19.tgz",
"integrity": "sha512-g7W6RwRqBbQTtMaUqrNWDyyl2GK0Uulk/uZPzGdgTXpOGX/LA8bW67EKQLdQgpYfd6APhZVwoX2lrL7mnJOWkA==", "integrity": "sha512-pzkA9ikMLR7KatByUJVz33kQKkrDnsJhyuvxSSUnyJNBggkGNStmDe/ezYvfP4CZ9XM7vYIID+YIaMJnlYGzLg==",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "^7.1.0", "acorn": "^7.1.0",

@ -56,15 +56,15 @@
}, },
"homepage": "https://github.com/sveltejs/svelte#README", "homepage": "https://github.com/sveltejs/svelte#README",
"devDependencies": { "devDependencies": {
"@rollup/plugin-replace": "^2.2.1",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@types/node": "^8.10.53", "@types/node": "^8.10.53",
"@typescript-eslint/eslint-plugin": "^1.13.0", "@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^2.1.0", "@typescript-eslint/parser": "^2.1.0",
"@rollup/plugin-replace": "^2.2.1",
"acorn": "^7.1.0", "acorn": "^7.1.0",
"agadoo": "^1.1.0", "agadoo": "^1.1.0",
"c8": "^5.0.1", "c8": "^5.0.1",
"code-red": "0.0.18", "code-red": "0.0.19",
"codecov": "^3.5.0", "codecov": "^3.5.0",
"css-tree": "1.0.0-alpha22", "css-tree": "1.0.0-alpha22",
"eslint": "^6.3.0", "eslint": "^6.3.0",

@ -240,8 +240,7 @@ export default class Component {
const { compile_options, name } = this; const { compile_options, name } = this;
const { format = 'esm' } = compile_options; const { format = 'esm' } = compile_options;
// TODO reinstate banner (along with fragment marker comments) const banner = `${this.file ? `${this.file} ` : ``}generated by Svelte v${'__VERSION__'}`;
const banner = `/* ${this.file ? `${this.file} ` : ``}generated by Svelte v${'__VERSION__'} */`;
const program: any = { type: 'Program', body: result }; const program: any = { type: 'Program', body: result };

@ -44,7 +44,7 @@ function edit_source(source, sveltePath) {
function esm( function esm(
program: any, program: any,
name: Identifier, name: Identifier,
_banner: string, banner: string,
sveltePath: string, sveltePath: string,
internal_path: string, internal_path: string,
helpers: Array<{ name: string; alias: Identifier }>, helpers: Array<{ name: string; alias: Identifier }>,
@ -98,6 +98,8 @@ function esm(
}; };
program.body = b` program.body = b`
/* ${banner} */
${import_declaration} ${import_declaration}
${internal_globals} ${internal_globals}
${imports} ${imports}
@ -112,7 +114,7 @@ function esm(
function cjs( function cjs(
program: any, program: any,
name: Identifier, name: Identifier,
_banner: string, banner: string,
sveltePath: string, sveltePath: string,
internal_path: string, internal_path: string,
helpers: Array<{ name: string; alias: Identifier }>, helpers: Array<{ name: string; alias: Identifier }>,
@ -188,6 +190,8 @@ function cjs(
const exports = module_exports.map(x => b`exports.${{ type: 'Identifier', name: x.as }} = ${{ type: 'Identifier', name: x.name }};`); const exports = module_exports.map(x => b`exports.${{ type: 'Identifier', name: x.as }} = ${{ type: 'Identifier', name: x.name }};`);
program.body = b` program.body = b`
/* ${banner} */
"use strict"; "use strict";
${internal_requires} ${internal_requires}
${internal_globals} ${internal_globals}

@ -423,17 +423,17 @@ export default class Block {
const key = this.key && this.get_unique_name('key'); const key = this.key && this.get_unique_name('key');
const args: any[] = [x`#ctx`]; const args: any[] = [x`#ctx`];
if (key) args.unshift(key); if (key) args.unshift(key);
// TODO include this.comment const fn = b`function ${this.name}(${args}) {
// ${this.comment && `// ${escape(this.comment, { only_escape_at_symbol: true })}`} ${this.get_contents(key)}
}`;
return b` return this.comment
function ${this.name}(${args}) { ? b`
${this.get_contents(key)} // ${this.comment}
} ${fn}`
`; : fn;
} }
render_listeners(chunk: string = '') { render_listeners(chunk: string = '') {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
component_subscribe, component_subscribe,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteElement, SvelteElement,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponentDev, SvelteComponentDev,
add_location, add_location,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponentDev, SvelteComponentDev,
add_location, add_location,
@ -23,6 +24,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (8:0) {#each things as thing}
function create_each_block(ctx) { function create_each_block(ctx) {
let span; let span;
let t0_value = ctx.thing.name + ""; let t0_value = ctx.thing.name + "";

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponentDev, SvelteComponentDev,
add_location, add_location,
@ -23,6 +24,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (6:0) {#each things as thing}
function create_each_block(ctx) { function create_each_block(ctx) {
let span; let span;
let t0_value = ctx.thing.name + ""; let t0_value = ctx.thing.name + "";

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponentDev, SvelteComponentDev,
dispatch_dev, dispatch_dev,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponentDev, SvelteComponentDev,
destroy_each, destroy_each,
@ -21,6 +22,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (4:0) {#each things as thing, index}
function create_each_block(ctx) { function create_each_block(ctx) {
let t0; let t0;
let t1_value = ctx.thing + ""; let t1_value = ctx.thing + "";

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { create_ssr_component, debug, each, escape } from "svelte/internal"; import { create_ssr_component, debug, each, escape } from "svelte/internal";
const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -19,6 +20,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (5:0) {#each createElement as node}
function create_each_block(ctx) { function create_each_block(ctx) {
let span; let span;
let t_value = ctx.node + ""; let t_value = ctx.node + "";

@ -1,4 +1,6 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
import { onMount } from "svelte"; import { onMount } from "svelte";
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponentDev, SvelteComponentDev,
add_location, add_location,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -19,6 +20,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (9:0) {#each [a, b, c, d, e] as num}
function create_each_block(ctx) { function create_each_block(ctx) {
let span; let span;
let t_value = ctx.num + ""; let t_value = ctx.num + "";

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
HtmlTag, HtmlTag,
SvelteComponent, SvelteComponent,
@ -22,6 +23,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (8:0) {#each comments as comment, i}
function create_each_block(ctx) { function create_each_block(ctx) {
let div; let div;
let strong; let strong;
@ -163,13 +165,7 @@ function instance($$self, $$props, $$invalidate) {
class Component extends SvelteComponent { class Component extends SvelteComponent {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal, { comments: 0, elapsed: 0, time: 0, foo: 0 });
init(this, options, instance, create_fragment, safe_not_equal, {
comments: 0,
elapsed: 0,
time: 0,
foo: 0
});
} }
} }

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -22,6 +23,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (19:0) {#each things as thing (thing.id)}
function create_each_block(key_1, ctx) { function create_each_block(key_1, ctx) {
let div; let div;
let t_value = ctx.thing.name + ""; let t_value = ctx.thing.name + "";

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -20,6 +21,7 @@ function get_each_context(ctx, list, i) {
return child_ctx; return child_ctx;
} }
// (5:0) {#each things as thing (thing.id)}
function create_each_block(key_1, ctx) { function create_each_block(key_1, ctx) {
let div; let div;
let t_value = ctx.thing.name + ""; let t_value = ctx.thing.name + "";

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self) { function instance($$self) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,
@ -26,6 +27,7 @@ function create_else_block(ctx) {
}; };
} }
// (5:0) {#if foo}
function create_if_block(ctx) { function create_if_block(ctx) {
let p; let p;

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -70,11 +71,7 @@ function instance($$self, $$props, $$invalidate) {
$$invalidate("test", test); $$invalidate("test", test);
} }
return { return { test, handleSubmit, input_input_handler };
test,
handleSubmit,
input_input_handler
};
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
attr, attr,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
create_component, create_component,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
detach, detach,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,4 +1,6 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
const SOME_CONSTANT = 42; const SOME_CONSTANT = 42;
function foo(bar) { function foo(bar) {

@ -1,4 +1,6 @@
/* generated by Svelte vX.Y.Z */
import { create_ssr_component } from "svelte/internal"; import { create_ssr_component } from "svelte/internal";
import { onDestroy, onMount } from "svelte"; import { onDestroy, onMount } from "svelte";
function preload(input) { function preload(input) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { create_ssr_component } from "svelte/internal"; import { create_ssr_component } from "svelte/internal";
const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal";
function create_fragment(ctx) { function create_fragment(ctx) {

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,
@ -47,6 +48,7 @@ function create_if_block(ctx) {
}; };
} }
// (9:1) {#if y}
function create_if_block_1(ctx) { function create_if_block_1(ctx) {
let div; let div;
let div_intro; let div_intro;

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
check_outros, check_outros,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
append, append,
@ -28,6 +29,7 @@ function create_if_block_4(ctx) {
}; };
} }
// (16:1) {#if b}
function create_if_block_3(ctx) { function create_if_block_3(ctx) {
let p; let p;
@ -45,6 +47,7 @@ function create_if_block_3(ctx) {
}; };
} }
// (20:1) {#if c}
function create_if_block_2(ctx) { function create_if_block_2(ctx) {
let p; let p;
@ -62,6 +65,7 @@ function create_if_block_2(ctx) {
}; };
} }
// (26:1) {#if d}
function create_if_block_1(ctx) { function create_if_block_1(ctx) {
let p; let p;
@ -79,6 +83,7 @@ function create_if_block_1(ctx) {
}; };
} }
// (33:0) {#if e}
function create_if_block(ctx) { function create_if_block(ctx) {
let p; let p;

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,

@ -1,3 +1,4 @@
/* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
add_render_callback, add_render_callback,

Loading…
Cancel
Save