print
Rich Harris 3 months ago
parent e904753ecc
commit 7bf7f5672a

@ -98,9 +98,7 @@ function run() {
.readFileSync(new URL(`./templates/${name}.js`, import.meta.url), 'utf-8') .readFileSync(new URL(`./templates/${name}.js`, import.meta.url), 'utf-8')
.replace(/\r\n/g, '\n'); .replace(/\r\n/g, '\n');
/** /** @type {import('acorn').Comment[]} */
* @type {any[]}
*/
const comments = []; const comments = [];
let ast = acorn.parse(source, { let ast = acorn.parse(source, {
@ -143,7 +141,9 @@ function run() {
const template_node = ast.body[index]; const template_node = ast.body[index];
ast.body.splice(index, 1); ast.body.splice(index, 1);
const jsdoc = comments.findLast((comment) => comment.start < template_node.start); const jsdoc = /** @type {import('acorn').Comment} */ (
comments.findLast((comment) => comment.start < template_node.start)
);
const printed = esrap.print( const printed = esrap.print(
ast, ast,

Loading…
Cancel
Save