Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brave-baboons-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

chore: update acorn parser `ecmaVersion` to parse import attributes
4 changes: 2 additions & 2 deletions packages/svelte/src/compiler/phases/1-parse/acorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 39,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "CallExpression",
"start": 21,
Expand Down Expand Up @@ -66,7 +65,8 @@
}
],
"optional": false
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 28,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 20,
Expand All @@ -31,7 +30,8 @@
}
},
"name": "message"
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 36,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "Literal",
"start": 21,
Expand All @@ -32,7 +31,8 @@
},
"value": "tooltip msg",
"raw": "'tooltip msg'"
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"end": 20,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"end": 50,
"type": "Animation",
"name": "flip",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 22,
"type": "Class",
"name": "foo",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 16,
Expand All @@ -31,7 +30,8 @@
}
},
"name": "isFoo"
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 23,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 19,
Expand All @@ -31,7 +30,8 @@
}
},
"name": "foo"
}
},
"modifiers": []
}
],
"children": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"end": 46,
"type": "Binding",
"name": "foo",
"modifiers": [],
"expression": {
"start": 43,
"end": 46,
"type": "Identifier",
"name": "foo"
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"end": 55,
"type": "Binding",
"name": "value",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 50,
Expand All @@ -38,7 +37,8 @@
}
},
"name": "name"
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
},
"value": "svelte",
"raw": "'svelte'"
}
},
"attributes": []
},
{
"type": "ExpressionStatement",
Expand Down Expand Up @@ -257,7 +258,8 @@
},
"value": "./foo.js",
"raw": "'./foo.js'"
}
},
"options": null
},
"property": {
"type": "Identifier",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 45,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 19,
Expand Down Expand Up @@ -100,7 +99,8 @@
}
}
}
}
},
"modifiers": []
}
],
"children": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"end": 692,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 596,
Expand Down Expand Up @@ -137,7 +136,8 @@
"end": 594
}
]
}
},
"modifiers": []
}
],
"children": [
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/tests/parser-legacy/samples/refs/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"end": 53,
"type": "Binding",
"name": "this",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 49,
Expand All @@ -38,7 +37,8 @@
}
},
"name": "foo"
}
},
"modifiers": []
}
],
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"end": 12,
"type": "Transition",
"name": "fade",
"modifiers": [],
"expression": null,
"modifiers": [],
"intro": true,
"outro": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"end": 30,
"type": "Transition",
"name": "style",
"modifiers": [],
"expression": {
"type": "ObjectExpression",
"start": 16,
Expand Down Expand Up @@ -85,6 +84,7 @@
}
]
},
"modifiers": [],
"intro": true,
"outro": false
}
Expand Down