File tree Expand file tree Collapse file tree 5 files changed +204
-1
lines changed
tests/parser-modern/samples/options Expand file tree Collapse file tree 5 files changed +204
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ export default function read_options(node) {
1111 /** @type {import('#compiler').SvelteOptions} */
1212 const component_options = {
1313 start: node.start,
14- end: node.end
14+ end: node.end,
15+ attributes: node.attributes
1516 };
1617
1718 if (!node) {
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ export interface SvelteOptions {
9393 */
9494 extend?: ArrowFunctionExpression | Identifier;
9595 };
96+ attributes: Array<Attribute | SpreadAttribute | Directive>;
9697}
9798
9899/** Static text */
Original file line number Diff line number Diff line change 1+ <svelte:options customElement="my-custom-element" runes={true} />
2+
3+ <script context="module" lang="ts">
4+ </script>
5+
6+ <script lang="ts">
7+ </script>
Original file line number Diff line number Diff line change 1+ {
2+ "css": null,
3+ "js": [],
4+ "start": 0,
5+ "end": 112,
6+ "type": "Root",
7+ "fragment": {
8+ "type": "Fragment",
9+ "nodes": [
10+ {
11+ "type": "Text",
12+ "start": 65,
13+ "end": 67,
14+ "raw": "\n\n",
15+ "data": "\n\n"
16+ },
17+ {
18+ "type": "Text",
19+ "start": 112,
20+ "end": 114,
21+ "raw": "\n\n",
22+ "data": "\n\n"
23+ }
24+ ],
25+ "transparent": false
26+ },
27+ "options": {
28+ "start": 0,
29+ "end": 65,
30+ "attributes": [
31+ {
32+ "type": "Attribute",
33+ "start": 16,
34+ "end": 49,
35+ "name": "customElement",
36+ "value": [
37+ {
38+ "start": 31,
39+ "end": 48,
40+ "type": "Text",
41+ "raw": "my-custom-element",
42+ "data": "my-custom-element",
43+ "parent": null
44+ }
45+ ],
46+ "parent": null,
47+ "metadata": {
48+ "dynamic": false,
49+ "delegated": null
50+ }
51+ },
52+ {
53+ "type": "Attribute",
54+ "start": 50,
55+ "end": 62,
56+ "name": "runes",
57+ "value": [
58+ {
59+ "type": "ExpressionTag",
60+ "start": 56,
61+ "end": 62,
62+ "expression": {
63+ "type": "Literal",
64+ "start": 57,
65+ "end": 61,
66+ "loc": {
67+ "start": {
68+ "line": 1,
69+ "column": 57
70+ },
71+ "end": {
72+ "line": 1,
73+ "column": 61
74+ }
75+ },
76+ "value": true,
77+ "raw": "true"
78+ },
79+ "parent": null,
80+ "metadata": {
81+ "contains_call_expression": false,
82+ "dynamic": false
83+ }
84+ }
85+ ],
86+ "parent": null,
87+ "metadata": {
88+ "dynamic": false,
89+ "delegated": null
90+ }
91+ }
92+ ],
93+ "customElement": {
94+ "tag": "my-custom-element"
95+ },
96+ "runes": true
97+ },
98+ "module": {
99+ "type": "Script",
100+ "start": 67,
101+ "end": 112,
102+ "context": "module",
103+ "content": {
104+ "type": "Program",
105+ "start": 102,
106+ "end": 103,
107+ "loc": {
108+ "start": {
109+ "line": 1,
110+ "column": 0
111+ },
112+ "end": {
113+ "line": 4,
114+ "column": 0
115+ }
116+ },
117+ "body": [],
118+ "sourceType": "module"
119+ },
120+ "attributes": [
121+ {
122+ "type": "Attribute",
123+ "start": 75,
124+ "end": 91,
125+ "name": "context",
126+ "value": [
127+ {
128+ "start": 84,
129+ "end": 90,
130+ "type": "Text",
131+ "raw": "module",
132+ "data": "module"
133+ }
134+ ]
135+ },
136+ {
137+ "type": "Attribute",
138+ "start": 92,
139+ "end": 101,
140+ "name": "lang",
141+ "value": [
142+ {
143+ "start": 98,
144+ "end": 100,
145+ "type": "Text",
146+ "raw": "ts",
147+ "data": "ts"
148+ }
149+ ]
150+ }
151+ ]
152+ },
153+ "instance": {
154+ "type": "Script",
155+ "start": 114,
156+ "end": 142,
157+ "context": "default",
158+ "content": {
159+ "type": "Program",
160+ "start": 132,
161+ "end": 133,
162+ "loc": {
163+ "start": {
164+ "line": 1,
165+ "column": 0
166+ },
167+ "end": {
168+ "line": 7,
169+ "column": 0
170+ }
171+ },
172+ "body": [],
173+ "sourceType": "module"
174+ },
175+ "attributes": [
176+ {
177+ "type": "Attribute",
178+ "start": 122,
179+ "end": 131,
180+ "name": "lang",
181+ "value": [
182+ {
183+ "start": 128,
184+ "end": 130,
185+ "type": "Text",
186+ "raw": "ts",
187+ "data": "ts"
188+ }
189+ ]
190+ }
191+ ]
192+ }
193+ }
Original file line number Diff line number Diff line change @@ -1316,6 +1316,7 @@ declare module 'svelte/compiler' {
13161316 */
13171317 extend?: ArrowFunctionExpression | Identifier;
13181318 };
1319+ attributes: Array<Attribute | SpreadAttribute | Directive>;
13191320 }
13201321
13211322 /** Static text */
You can’t perform that action at this time.
0 commit comments