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 crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2508,6 +2508,7 @@ pub struct ExportNamedDeclaration<'a> {
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
#[estree(add_fields(exportKind = TsValue))]
pub struct ExportDefaultDeclaration<'a> {
pub span: Span,
#[estree(skip)]
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_ast/src/generated/derive_estree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,7 @@ impl ESTree for ExportDefaultDeclaration<'_> {
state.serialize_field("start", &self.span.start);
state.serialize_field("end", &self.span.end);
state.serialize_field("declaration", &self.declaration);
state.serialize_ts_field("exportKind", &crate::serialize::TsValue(self));
state.end();
}
}
Expand Down
12 changes: 12 additions & 0 deletions crates/oxc_ast/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ impl<T> ESTree for TsFalse<'_, T> {
}
}

/// Serialized as `"value"`.
#[ast_meta]
#[estree(ts_type = "'value'", raw_deser = "'value'")]
#[ts]
pub struct TsValue<'b, T>(#[expect(dead_code)] pub &'b T);

impl<T> ESTree for TsValue<'_, T> {
fn serialize<S: Serializer>(&self, serializer: S) {
JsonSafeString("value").serialize(serializer);
}
}

/// Serialized as `"in"`.
#[ast_meta]
#[estree(ts_type = "'in'", raw_deser = "'in'")]
Expand Down
1 change: 1 addition & 0 deletions napi/parser/deserialize-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ function deserializeExportDefaultDeclaration(pos) {
start: deserializeU32(pos),
end: deserializeU32(pos + 4),
declaration: deserializeExportDefaultDeclarationKind(pos + 64),
exportKind: 'value',
};
}

Expand Down
1 change: 1 addition & 0 deletions npm/oxc-types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ export interface ExportNamedDeclaration extends Span {
export interface ExportDefaultDeclaration extends Span {
type: 'ExportDefaultDeclaration';
declaration: ExportDefaultDeclarationKind;
exportKind?: 'value';
}

export interface ExportAllDeclaration extends Span {
Expand Down
Loading
Loading