Skip to content

Commit eaec840

Browse files
authored
Merge branch 'master' into gh-3283
2 parents fd46685 + cf24dbd commit eaec840

File tree

37 files changed

+548
-1737
lines changed

37 files changed

+548
-1737
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Svelte changelog
22

3+
## 3.6.10
4+
5+
* Use `change` event for file inputs ([#3226](https://github.com/sveltejs/svelte/issues/3226))
6+
* Always fire reactive declarations with `$$props` ([#3286](https://github.com/sveltejs/svelte/issues/3286))
7+
* More conservative spread prop updates ([#3289](https://github.com/sveltejs/svelte/issues/3289))
8+
* Quote props if necessary in SSR mode ([#3312](https://github.com/sveltejs/svelte/issues/3312))
9+
310
## 3.6.9
411

512
* Always update derived stores with a derived input whose value does not change ([#3191](https://github.com/sveltejs/svelte/issues/3191))

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte",
3-
"version": "3.6.9",
3+
"version": "3.6.10",
44
"description": "Cybernetically enhanced web apps",
55
"module": "index.mjs",
66
"main": "index",

site/package-lock.json

+318-1,533
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

+12-13
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,46 @@
1414
},
1515
"dependencies": {
1616
"@polka/redirect": "^1.0.0-next.0",
17-
"@polka/send": "^1.0.0-next.2",
17+
"@polka/send": "^1.0.0-next.3",
1818
"devalue": "^2.0.0",
1919
"do-not-zip": "^1.0.0",
20-
"golden-fleece": "^1.0.9",
2120
"httpie": "^1.1.2",
2221
"jsonwebtoken": "^8.5.1",
2322
"marked": "^0.7.0",
24-
"pg": "^7.11.0",
25-
"polka": "^1.0.0-next.2",
26-
"prismjs": "^1.16.0",
23+
"pg": "^7.12.0",
24+
"polka": "^1.0.0-next.4",
25+
"prismjs": "^1.17.1",
2726
"sirv": "^0.4.2",
2827
"yootils": "0.0.16"
2928
},
3029
"devDependencies": {
31-
"@babel/core": "^7.5.4",
30+
"@babel/core": "^7.5.5",
3231
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
33-
"@babel/plugin-transform-runtime": "^7.5.0",
34-
"@babel/preset-env": "^7.5.4",
35-
"@babel/runtime": "^7.5.4",
32+
"@babel/plugin-transform-runtime": "^7.5.5",
33+
"@babel/preset-env": "^7.5.5",
34+
"@babel/runtime": "^7.5.5",
3635
"@sindresorhus/slugify": "^0.9.1",
3736
"@sveltejs/site-kit": "^1.1.1",
3837
"@sveltejs/svelte-repl": "^0.1.8",
3938
"degit": "^2.1.3",
4039
"dotenv": "^8.0.0",
4140
"esm": "^3.2.25",
4241
"jimp": "^0.6.4",
43-
"mocha": "^6.1.4",
42+
"mocha": "^6.2.0",
4443
"node-fetch": "^2.6.0",
4544
"node-pg-migrate": "^3.21.1",
4645
"npm-run-all": "^4.1.5",
47-
"rollup": "^1.16.7",
46+
"rollup": "^1.17.0",
4847
"rollup-plugin-babel": "^4.3.3",
4948
"rollup-plugin-commonjs": "^10.0.1",
5049
"rollup-plugin-json": "^4.0.0",
5150
"rollup-plugin-node-resolve": "^5.2.0",
5251
"rollup-plugin-replace": "^2.2.0",
5352
"rollup-plugin-svelte": "^5.1.0",
5453
"rollup-plugin-terser": "^5.1.1",
55-
"sapper": "^0.27.4",
54+
"sapper": "^0.27.8",
5655
"shelljs": "^0.8.3",
57-
"svelte": "^3.6.7"
56+
"svelte": "^3.6.9"
5857
},
5958
"engines": {
6059
"node": ">=10.0.0"

site/static/curl.js

-22
This file was deleted.

site/static/repl-runner.js

-105
This file was deleted.

src/compiler/compile/css/Selector.ts

+2
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ function attribute_matches(node: Node, name: string, expected_value: string, ope
219219
const spread = node.attributes.find(attr => attr.type === 'Spread');
220220
if (spread) return true;
221221

222+
if (node.bindings.some((binding: Node) => binding.name === name)) return true;
223+
222224
const attr = node.attributes.find((attr: Node) => attr.name === name);
223225
if (!attr) return false;
224226
if (attr.is_true) return operator === null;

src/compiler/compile/nodes/EachBlock.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ export default class EachBlock extends AbstractBlock {
8383
this.scope.add(context.key.name, this.expression.dependencies, this);
8484
});
8585

86-
this.key = info.key
87-
? new Expression(component, this, this.scope, info.key)
88-
: null;
89-
9086
if (this.index) {
9187
// index can only change if this is a keyed each block
92-
const dependencies = this.key ? this.expression.dependencies : new Set([]);
88+
const dependencies = info.key ? this.expression.dependencies : new Set([]);
9389
this.scope.add(this.index, dependencies, this);
9490
}
9591

92+
this.key = info.key
93+
? new Expression(component, this, this.scope, info.key)
94+
: null;
95+
9696
this.has_animation = false;
9797

9898
this.children = map_children(component, this, this.scope, info.children);

src/compiler/compile/nodes/Element.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,12 @@ export default class Element extends Node {
451451
if (this.name === 'input') {
452452
const type = attribute_map.get('type');
453453
if (type && type.get_static_value() === 'image') {
454-
should_have_attribute(
455-
this,
456-
['alt', 'aria-label', 'aria-labelledby'],
457-
'input type="image"'
458-
);
454+
const required_attributes = ['alt', 'aria-label', 'aria-labelledby'];
455+
const has_attribute = required_attributes.some(name => attribute_map.has(name));
456+
457+
if (!has_attribute) {
458+
should_have_attribute(this, required_attributes, 'input type="image"');
459+
}
459460
}
460461
}
461462
}

src/compiler/compile/nodes/shared/Expression.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export default class Expression {
363363
}
364364

365365
const fn = deindent`
366-
function ${name}(${args.join(', ')}) ${body}
366+
${node.async && 'async '}function${node.generator && '*'} ${name}(${args.join(', ')}) ${body}
367367
`;
368368

369369
if (dependencies.size === 0 && contextual_dependencies.size === 0) {

src/compiler/compile/render_dom/index.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ export default function dom(
267267
return `$$subscribe_${name}()`;
268268
}
269269

270-
const subscribe = component.helper('subscribe');
270+
const component_subscribe = component.helper('component_subscribe');
271271

272-
let insert = `${subscribe}($$self, ${name}, $${callback})`;
272+
let insert = `${component_subscribe}($$self, ${name}, $${callback})`;
273273
if (component.compile_options.dev) {
274274
const validate_store = component.helper('validate_store');
275275
insert = `${validate_store}(${name}, '${name}'); ${insert}`;
@@ -343,7 +343,7 @@ export default function dom(
343343
})
344344
.map(({ name }) => deindent`
345345
${component.compile_options.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`}
346-
@subscribe($$self, ${name.slice(1)}, $$value => { ${name} = $$value; $$invalidate('${name}', ${name}); });
346+
@component_subscribe($$self, ${name.slice(1)}, $$value => { ${name} = $$value; $$invalidate('${name}', ${name}); });
347347
`);
348348

349349
const resubscribable_reactive_store_unsubscribers = reactive_stores
@@ -359,15 +359,11 @@ export default function dom(
359359

360360
component.reactive_declarations
361361
.forEach(d => {
362-
let uses_props;
362+
const dependencies = Array.from(d.dependencies);
363+
const uses_props = !!dependencies.find(n => n === '$$props');
363364

364-
const condition = Array.from(d.dependencies)
365+
const condition = !uses_props && dependencies
365366
.filter(n => {
366-
if (n === '$$props') {
367-
uses_props = true;
368-
return false;
369-
}
370-
371367
const variable = component.var_lookup.get(n);
372368
return variable && (variable.writable || variable.mutated);
373369
})
@@ -394,7 +390,7 @@ export default function dom(
394390

395391
const store = component.var_lookup.get(name);
396392
if (store && store.reassigned) {
397-
return `${$name}, $$unsubscribe_${name} = @noop, $$subscribe_${name} = () => { $$unsubscribe_${name}(); $$unsubscribe_${name} = ${name}.subscribe($$value => { ${$name} = $$value; $$invalidate('${$name}', ${$name}); }) }`;
393+
return `${$name}, $$unsubscribe_${name} = @noop, $$subscribe_${name} = () => { $$unsubscribe_${name}(); $$unsubscribe_${name} = @subscribe(${name}, $$value => { ${$name} = $$value; $$invalidate('${$name}', ${$name}); }) }`;
398394
}
399395

400396
return $name;

src/compiler/compile/render_dom/wrappers/Element/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const events = [
2626
event_names: ['input'],
2727
filter: (node: Element, _name: string) =>
2828
node.name === 'textarea' ||
29-
node.name === 'input' && !/radio|checkbox|range/.test(node.get_static_attribute_value('type') as string)
29+
node.name === 'input' && !/radio|checkbox|range|file/.test(node.get_static_attribute_value('type') as string)
3030
},
3131
{
3232
event_names: ['input'],
@@ -38,7 +38,7 @@ const events = [
3838
event_names: ['change'],
3939
filter: (node: Element, _name: string) =>
4040
node.name === 'select' ||
41-
node.name === 'input' && /radio|checkbox/.test(node.get_static_attribute_value('type') as string)
41+
node.name === 'input' && /radio|checkbox|file/.test(node.get_static_attribute_value('type') as string)
4242
},
4343
{
4444
event_names: ['change', 'input'],

src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export default class InlineComponentWrapper extends Wrapper {
185185
add_to_set(all_dependencies, attr.dependencies);
186186
});
187187

188-
this.node.attributes.forEach(attr => {
188+
this.node.attributes.forEach((attr, i) => {
189189
const { name, dependencies } = attr;
190190

191191
const condition = dependencies.size > 0 && (dependencies.size !== all_dependencies.size)
@@ -201,7 +201,7 @@ export default class InlineComponentWrapper extends Wrapper {
201201
const obj = `{ ${quote_name_if_necessary(name)}: ${attr.get_value(block)} }`;
202202
initial_props.push(obj);
203203

204-
changes.push(condition ? `${condition} && ${obj}` : obj);
204+
changes.push(condition ? `${condition} && ${obj}` : `${levels}[${i}]`);
205205
}
206206
});
207207

0 commit comments

Comments
 (0)