pull/16197/head
Rich Harris 5 months ago
commit fe6c00daa9

@ -1,5 +0,0 @@
---
'svelte': patch
---
fix: invoke parent boundary of deriveds that throw

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: reset `is_flushing` if `flushSync` is called and there's no scheduled effect

@ -1,5 +1,33 @@
# svelte
## 5.33.18
### Patch Changes
- chore: bump `esrap` dependency ([#16106](https://github.com/sveltejs/svelte/pull/16106))
- fix: destructuring state in ssr ([#16102](https://github.com/sveltejs/svelte/pull/16102))
## 5.33.17
### Patch Changes
- chore: update acorn parser `ecmaVersion` to parse import attributes ([#16098](https://github.com/sveltejs/svelte/pull/16098))
## 5.33.16
### Patch Changes
- fix: visit expression when destructuring state declarations ([#16081](https://github.com/sveltejs/svelte/pull/16081))
- fix: move xmlns attribute from SVGAttributes to to DOMAttributes ([#16080](https://github.com/sveltejs/svelte/pull/16080))
## 5.33.15
### Patch Changes
- fix: invoke parent boundary of deriveds that throw ([#16091](https://github.com/sveltejs/svelte/pull/16091))
## 5.33.14
### Patch Changes

@ -463,6 +463,8 @@ export interface DOMAttributes<T extends EventTarget> {
'on:fullscreenerror'?: EventHandler<Event, T> | undefined | null;
onfullscreenerror?: EventHandler<Event, T> | undefined | null;
onfullscreenerrorcapture?: EventHandler<Event, T> | undefined | null;
xmlns?: string | undefined | null;
}
// All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
@ -1809,7 +1811,6 @@ export interface SVGAttributes<T extends EventTarget> extends AriaAttributes, DO
'xlink:type'?: string | undefined | null;
'xml:base'?: string | undefined | null;
'xml:lang'?: string | undefined | null;
xmlns?: string | undefined | null;
'xmlns:xlink'?: string | undefined | null;
'xml:space'?: string | undefined | null;
y1?: number | string | undefined | null;

@ -2,7 +2,7 @@
"name": "svelte",
"description": "Cybernetically enhanced web apps",
"license": "MIT",
"version": "5.33.14",
"version": "5.33.18",
"type": "module",
"types": "./types/index.d.ts",
"engines": {
@ -174,7 +174,7 @@
"axobject-query": "^4.1.0",
"clsx": "^2.1.1",
"esm-env": "^1.2.1",
"esrap": "^1.4.6",
"esrap": "^1.4.8",
"is-reference": "^3.0.3",
"locate-character": "^3.0.0",
"magic-string": "^0.30.11",

@ -36,7 +36,7 @@ export function parse(source, typescript, is_script) {
ast = parser.parse(source, {
onComment,
sourceType: 'module',
ecmaVersion: 13,
ecmaVersion: 16,
locations: true
});
} finally {
@ -64,7 +64,7 @@ export function parse_expression_at(source, typescript, index) {
const ast = parser.parseExpressionAt(source, index, {
onComment,
sourceType: 'module',
ecmaVersion: 13,
ecmaVersion: 16,
locations: true
});

@ -148,7 +148,7 @@ export function VariableDeclaration(node, context) {
const { inserts, paths } = extract_paths(declarator.id, tmp);
declarations.push(
b.declarator(tmp, value),
b.declarator(tmp, /** @type {Expression} */ (context.visit(value))),
...inserts.map(({ id, value }) => {
id.name = context.state.scope.generate('$$array');
context.state.transform[id.name] = { read: get_value };

@ -197,9 +197,13 @@ function create_state_declarators(declarator, scope, value) {
}
const tmp = b.id(scope.generate('tmp'));
const { paths } = extract_paths(declarator.id, tmp);
const { paths, inserts } = extract_paths(declarator.id, tmp);
return [
b.declarator(tmp, value), // TODO inject declarator for opts, so we can use it below
...inserts.map(({ id, value }) => {
id.name = scope.generate('$$array');
return b.declarator(id, value);
}),
...paths.map((path) => {
const value = path.expression;
return b.declarator(path.node, value);

@ -724,6 +724,14 @@ export function flushSync(fn) {
batch.flush();
}
// this would be reset in `flush_queued_root_effects` but since we are early returning here,
// we need to reset it here as well in case the first time there's 0 queued root effects
last_scheduled_effect = null;
if (DEV) {
dev_effect_stack = [];
}
return /** @type {T} */ (result);
}

@ -4,5 +4,5 @@
* The current version, as set in package.json.
* @type {string}
*/
export const VERSION = '5.33.14';
export const VERSION = '5.33.18';
export const PUBLIC_VERSION = '5';

@ -15,16 +15,16 @@
"end": 20,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
},
{
"start": 21,
"end": 34,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 39,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "CallExpression",
"start": 21,
@ -66,7 +65,8 @@
}
],
"optional": false
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 28,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 20,
@ -31,7 +30,8 @@
}
},
"name": "message"
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 36,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "Literal",
"start": 21,
@ -32,7 +31,8 @@
},
"value": "tooltip msg",
"raw": "'tooltip msg'"
}
},
"modifiers": []
}
],
"children": []

@ -15,8 +15,8 @@
"end": 20,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": []

@ -20,8 +20,8 @@
"end": 50,
"type": "Animation",
"name": "flip",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": [

@ -15,7 +15,6 @@
"end": 22,
"type": "Class",
"name": "foo",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 16,
@ -31,7 +30,8 @@
}
},
"name": "isFoo"
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 23,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 19,
@ -31,7 +30,8 @@
}
},
"name": "foo"
}
},
"modifiers": []
}
],
"children": [

@ -22,13 +22,13 @@
"end": 46,
"type": "Binding",
"name": "foo",
"modifiers": [],
"expression": {
"start": 43,
"end": 46,
"type": "Identifier",
"name": "foo"
}
},
"modifiers": []
}
],
"children": []

@ -22,7 +22,6 @@
"end": 55,
"type": "Binding",
"name": "value",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 50,
@ -38,7 +37,8 @@
}
},
"name": "name"
}
},
"modifiers": []
}
],
"children": []

@ -104,7 +104,8 @@
},
"value": "svelte",
"raw": "'svelte'"
}
},
"attributes": []
},
{
"type": "ExpressionStatement",
@ -257,7 +258,8 @@
},
"value": "./foo.js",
"raw": "'./foo.js'"
}
},
"options": null
},
"property": {
"type": "Identifier",

@ -15,7 +15,6 @@
"end": 45,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 19,
@ -100,7 +99,8 @@
}
}
}
}
},
"modifiers": []
}
],
"children": [

@ -22,7 +22,6 @@
"end": 692,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 596,
@ -137,7 +136,8 @@
"end": 594
}
]
}
},
"modifiers": []
}
],
"children": [

@ -22,7 +22,6 @@
"end": 53,
"type": "Binding",
"name": "this",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 49,
@ -38,7 +37,8 @@
}
},
"name": "foo"
}
},
"modifiers": []
}
],
"children": []

@ -15,8 +15,8 @@
"end": 12,
"type": "Transition",
"name": "fade",
"modifiers": [],
"expression": null,
"modifiers": [],
"intro": true,
"outro": false
}

@ -15,7 +15,6 @@
"end": 30,
"type": "Transition",
"name": "style",
"modifiers": [],
"expression": {
"type": "ObjectExpression",
"start": 16,
@ -85,6 +84,7 @@
}
]
},
"modifiers": [],
"intro": true,
"outro": false
}

@ -0,0 +1,6 @@
<script>
let { data } = $props();
let { foo } = $state(data);
</script>
{foo}

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: `bar`
});

@ -0,0 +1,5 @@
<script>
import Child from './Child.svelte';
</script>
<Child data={{ foo: 'bar' }} />

@ -0,0 +1,16 @@
import { ok, test } from '../../test';
export default test({
async test({ assert, target }) {
const btn = target.querySelector('button');
const main = target.querySelector('main');
ok(main);
console.log(main.innerHTML);
assert.htmlEqual(main.innerHTML, `<div>true</div>`);
// we don't want to use flush sync (or tick that use it inside) since we are testing that calling `flushSync` once
// when there are no scheduled effects does not cause reactivity to break
btn?.click();
await Promise.resolve();
assert.htmlEqual(main.innerHTML, `<div>false</div> <div>false</div>`);
}
});

@ -0,0 +1,23 @@
<script>
import { flushSync } from 'svelte'
let flag = $state(true)
let test = $state(true);
</script>
<button onclick={()=>{
flushSync(() => {
test = !test
})
flag = !flag;
}}>switch</button>
<main>
<div>{flag}</div>
{#if !flag}
<div>{test} </div>
{/if}
</main>

@ -0,0 +1,11 @@
<script lang="ts">
let count = 0;
function* test(){
while (true) {
yield count++;
}
}
let [one, two] = $state(test())
</script>
{one}, {two}

@ -0,0 +1,5 @@
<script lang="ts">
let [level, custom] = $state([10, "Admin"])
</script>
{level}, {custom}

@ -87,8 +87,8 @@ importers:
specifier: ^1.2.1
version: 1.2.1
esrap:
specifier: ^1.4.6
version: 1.4.6
specifier: ^1.4.8
version: 1.4.8
is-reference:
specifier: ^3.0.3
version: 3.0.3
@ -1261,8 +1261,8 @@ packages:
resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==}
engines: {node: '>=0.10'}
esrap@1.4.6:
resolution: {integrity: sha512-F/D2mADJ9SHY3IwksD4DAXjTt7qt7GWUf3/8RhCNWmC/67tyb55dpimHmy7EplakFaflV0R/PC+fdSPqrRHAQw==}
esrap@1.4.8:
resolution: {integrity: sha512-jlENbjZ7lqgJV9/OmgAtVqrFFMwsl70ctOgPIg5oTdQVGC13RSkMdtvAmu7ZTLax92c9ljnIG0xleEkdL69hwg==}
esrecurse@4.3.0:
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
@ -3622,7 +3622,7 @@ snapshots:
dependencies:
estraverse: 5.3.0
esrap@1.4.6:
esrap@1.4.8:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.0

Loading…
Cancel
Save