update code-red, update some tests etc

pull/3539/head
Richard Harris 6 years ago
parent 42e1c8f191
commit da4d90004e

35
package-lock.json generated

@ -318,11 +318,6 @@
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
"dev": true
},
"astring": {
"version": "github:Rich-Harris/astring#9f675d470d1c758de5ec42724aa5dd2e1dabf919",
"from": "github:Rich-Harris/astring#generic-handler",
"dev": true
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
@ -495,16 +490,15 @@
"dev": true
},
"code-red": {
"version": "0.0.15",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.0.15.tgz",
"integrity": "sha512-r3c5r7IFsgKw3IE+F1wkTOezvwZ1N6xXKAJ0Dfyrs+JxHVEWbPU+goKwbo6XCCc8ykO5IU5Pofq1BvuxiXMQHQ==",
"version": "0.0.16",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.0.16.tgz",
"integrity": "sha512-40SV6oWnBVVfUP+i8NYeTo9EQWtTnlZ17LIv91dKhLa6R/iZKqxOAV/5HEkj86EhLmNiRB7O6hEnga2jy0hoBA==",
"dev": true,
"requires": {
"acorn": "^7.0.0",
"astring": "github:Rich-Harris/astring#9f675d470d1c758de5ec42724aa5dd2e1dabf919",
"is-reference": "^1.1.3",
"periscopic": "^1.0.0",
"source-map": "^0.7.3"
"periscopic": "^1.0.1",
"sourcemap-codec": "^1.4.6"
}
},
"codecov": {
@ -2727,12 +2721,23 @@
"dev": true
},
"periscopic": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-1.0.0.tgz",
"integrity": "sha512-ftydZZH2Ca4FdWJXDwQ1Uuz4VEBhh4jXuT1bprR4qg/zM2+FhulluBUxnQXI0olDqADmsQRE1eHLs42iIhNjtA==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-1.0.1.tgz",
"integrity": "sha512-JcSQ6sufVNGT04lPr2f2qGuJ2FCkZcbWBw0gQ8mzSVf9+6bEX9ea6l48+PdAekjJIHlEwSrqJND1TR2cC1FbtQ==",
"dev": true,
"requires": {
"is-reference": "^1.1.4"
},
"dependencies": {
"is-reference": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz",
"integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==",
"dev": true,
"requires": {
"is-reference": "^1.1.3"
"@types/estree": "0.0.39"
}
}
}
},
"pify": {

@ -63,7 +63,7 @@
"acorn": "^7.0.0",
"agadoo": "^1.1.0",
"c8": "^5.0.1",
"code-red": "0.0.15",
"code-red": "0.0.16",
"codecov": "^3.5.0",
"css-tree": "1.0.0-alpha22",
"eslint": "^6.3.0",

@ -283,7 +283,7 @@ export default function dom(
const instance_javascript = component.extract_javascript(component.ast.instance);
const has_definition = (
instance_javascript ||
instance_javascript.length > 0 ||
filtered_props.length > 0 ||
uses_props ||
component.partly_hoisted.length > 0 ||

@ -33,7 +33,7 @@ export default function add_actions(
);
if (dependencies && dependencies.length > 0) {
let condition = x`typeof ${id}.update === 'function'`;
let condition = x`@is_function(${id}.update)`;
// TODO can this case be handled more elegantly?
if (dependencies.length > 0) {
@ -51,7 +51,7 @@ export default function add_actions(
}
block.chunks.destroy.push(
b`if (${id} && typeof ${id}.destroy === 'function') ${id}.destroy();`
b`if (${id} && @is_function(${id}.destroy)) ${id}.destroy();`
);
});
}

@ -1,62 +1,53 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
detach,
element,
init,
insert,
is_function,
noop,
safe_not_equal
} from "svelte/internal";
function create_fragment(ctx) {
var button, foo_action;
let button;
let foo_action;
return {
c() {
button = element("button");
button.textContent = "foo";
},
m(target, anchor) {
insert(target, button, anchor);
foo_action = foo.call(null, button, ctx.foo_function) || {};
foo_action = foo.call(null, button, ctx.foo_function) || ({});
},
p(changed, ctx) {
if (typeof foo_action.update === 'function' && changed.bar) {
foo_action.update.call(null, ctx.foo_function);
}
if (is_function(foo_action.update) && changed.bar) foo_action.update.call(null, ctx.foo_function);
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(button);
}
if (foo_action && typeof foo_action.destroy === 'function') foo_action.destroy();
if (detaching) detach(button);
if (foo_action && is_function(foo_action.destroy)) foo_action.destroy();
}
};
}
function handleFoo(bar) {
console.log(bar);
function foo(node, callback) {
}
function foo(node, callback) {
// code goes here
function handleFoo(bar) {
console.log(bar);
}
function instance($$self, $$props, $$invalidate) {
let { bar } = $$props;
const foo_function = () => handleFoo(bar);
$$self.$set = $$props => {
if ('bar' in $$props) $$invalidate('bar', bar = $$props.bar);
if ("bar" in $$props) $$invalidate("bar", bar = $$props.bar);
};
return { bar, foo_function };

@ -1,4 +1,3 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
attr,
@ -6,12 +5,14 @@ import {
element,
init,
insert,
is_function,
noop,
safe_not_equal
} from "svelte/internal";
function create_fragment(ctx) {
var a, link_action;
let a;
let link_action;
return {
c() {
@ -19,22 +20,16 @@ function create_fragment(ctx) {
a.textContent = "Test";
attr(a, "href", "#");
},
m(target, anchor) {
insert(target, a, anchor);
link_action = link.call(null, a) || {};
link_action = link.call(null, a) || ({});
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(a);
}
if (link_action && typeof link_action.destroy === 'function') link_action.destroy();
if (detaching) detach(a);
if (link_action && is_function(link_action.destroy)) link_action.destroy();
}
};
}
@ -45,13 +40,13 @@ function link(node) {
history.pushState(null, null, event.target.href);
}
node.addEventListener('click', onClick);
node.addEventListener("click", onClick);
return {
destroy() {
node.removeEventListener('click', onClick);
}
node.removeEventListener("click", onClick);
}
};
}
class Component extends SvelteComponent {

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

Loading…
Cancel
Save