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
1 change: 1 addition & 0 deletions apps/oxlint/src-js/generated/deserialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen, parent = null, getLoc;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String,
Expand Down
1 change: 1 addition & 0 deletions apps/oxlint/src-js/generated/walk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
export { walkProgram };

export const ancestors = [];

const { isArray } = Array;

function walkNode(node, visitors) {
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/js_parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen, parent = null;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/js_range.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/js_range_parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen, parent = null;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/ts_parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen, parent = null;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/ts_range.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/deserialize/ts_range_parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.

let uint8, uint32, float64, sourceText, sourceIsAscii, sourceByteLen, parent = null;

const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
{ fromCodePoint } = String;
Expand Down
1 change: 1 addition & 0 deletions napi/parser/generated/visit/walk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/estree_visit.rs`.

export { walkProgram };

const { isArray } = Array;

function walkNode(node, visitors) {
Expand Down
10 changes: 8 additions & 2 deletions tasks/ast_tools/src/output/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,18 @@ pub fn print_minified<'a>(program: &mut Program<'a>, allocator: &'a Allocator) -

// Add back line breaks between function declarations and exports, to aid readability
#[expect(clippy::items_after_statements)]
static REGEX: Lazy<Regex> = lazy_regex!(r"\n(function|export) ");
static REGEX: Lazy<Regex> = lazy_regex!(r"\n(export|function|class|const|let) ");

REGEX
.replace_all(&code, |caps: &Captures| {
// `format!("\n\n{} ", &caps[1])` would be simpler, but this avoids allocations
if &caps[1] == "function" { "\n\nfunction " } else { "\n\nexport " }
match &caps[1] {
"export" => "\n\nexport ",
"function" => "\n\nfunction ",
"class" => "\n\nclass ",
"const" => "\n\nconst ",
_ => "\n\nlet ",
}
})
.into_owned()
}
Expand Down
Loading