include attributes of script tags in ast

pull/11241/head
Jeremiasz Major 2 years ago
parent 516cd22686
commit 1c67ebea59
No known key found for this signature in database
GPG Key ID: 482514409C7EBE01

@ -86,11 +86,15 @@ export function convert(source, ast) {
if (instance) {
// @ts-ignore
delete instance.parent;
// @ts-ignore
delete instance.attributes;
}
if (module) {
// @ts-ignore
delete module.parent;
// @ts-ignore
delete module.attributes;
}
return {

@ -63,6 +63,7 @@ export function read_script(parser, start, attributes) {
end: parser.index,
context: get_context(attributes),
content: ast,
parent: null
parent: null,
attributes: attributes
};
}

@ -467,6 +467,7 @@ export interface Script extends BaseNode {
type: 'Script';
context: string;
content: Program;
attributes: Array<Attribute | SpreadAttribute | Directive>;
}
declare module 'estree' {

@ -133,6 +133,23 @@
"value": "should not error out"
}
]
}
},
"attributes": [
{
"type": "Attribute",
"start": 36,
"end": 45,
"name": "lang",
"value": [
{
"start": 42,
"end": 44,
"type": "Text",
"raw": "ts",
"data": "ts"
}
]
}
]
}
}

@ -206,6 +206,23 @@
},
"body": [],
"sourceType": "module"
}
},
"attributes": [
{
"type": "Attribute",
"start": 8,
"end": 17,
"name": "lang",
"value": [
{
"start": 14,
"end": 16,
"type": "Text",
"raw": "ts",
"data": "ts"
}
]
}
]
}
}

@ -477,6 +477,23 @@
}
],
"sourceType": "module"
}
},
"attributes": [
{
"type": "Attribute",
"start": 8,
"end": 17,
"name": "lang",
"value": [
{
"start": 14,
"end": 16,
"type": "Text",
"raw": "ts",
"data": "ts"
}
]
}
]
}
}

@ -1690,6 +1690,7 @@ declare module 'svelte/compiler' {
type: 'Script';
context: string;
content: Program;
attributes: Array<Attribute | SpreadAttribute | Directive>;
}
/**
* The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged.

Loading…
Cancel
Save