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
5 changes: 1 addition & 4 deletions crates/oxc_parser/src/module_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,8 @@ impl<'a> ModuleRecordBuilder<'a> {
}

fn visit_export_named_declaration(&mut self, decl: &ExportNamedDeclaration<'a>) {
if decl.export_kind.is_type() {
return;
}
// ignore all TypeScript syntax as they overload
if decl.is_typescript_syntax() {
if decl.declaration.as_ref().is_some_and(Declaration::is_typescript_syntax) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions crates/oxc_syntax/src/generated/derive_estree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl ESTree for ExportEntry<'_> {
state.serialize_field("importName", &self.import_name);
state.serialize_field("exportName", &self.export_name);
state.serialize_field("localName", &self.local_name);
state.serialize_field("isType", &self.is_type);
state.end();
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_syntax/src/module_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ pub struct ExportEntry<'a> {
/// export { type foo }
/// export type { foo } from 'mod'
/// ```
#[estree(skip)]
pub is_type: bool,
}

Expand Down
1 change: 1 addition & 0 deletions napi/parser/deserialize-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -2039,6 +2039,7 @@ function deserializeExportEntry(pos) {
importName: deserializeExportImportName(pos + 40),
exportName: deserializeExportExportName(pos + 72),
localName: deserializeExportLocalName(pos + 104),
isType: deserializeBool(pos + 136),
};
}

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 @@ -2166,6 +2166,7 @@ function deserializeExportEntry(pos) {
importName: deserializeExportImportName(pos + 40),
exportName: deserializeExportExportName(pos + 72),
localName: deserializeExportLocalName(pos + 104),
isType: deserializeBool(pos + 136),
};
}

Expand Down
14 changes: 14 additions & 0 deletions napi/parser/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,20 @@ export interface StaticExportEntry {
exportName: ExportExportName
/** The name that is used to locally access the exported value from within the importing module. */
localName: ExportLocalName
/**
* Whether the export is a TypeScript `export type`.
*
* Examples:
*
* ```ts
* export type * from 'mod';
* export type * as ns from 'mod';
* export type { foo };
* export { type foo }:
* export type { foo } from 'mod';
* ```
*/
isType: boolean
}

export interface StaticImport {
Expand Down
1 change: 1 addition & 0 deletions napi/parser/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ impl From<&module_record::ExportEntry<'_>> for StaticExportEntry {
import_name: ExportImportName::from(&e.import_name),
export_name: ExportExportName::from(&e.export_name),
local_name: ExportLocalName::from(&e.local_name),
is_type: e.is_type,
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions napi/parser/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ pub struct StaticExportEntry {
pub export_name: ExportExportName,
/// The name that is used to locally access the exported value from within the importing module.
pub local_name: ExportLocalName,
/// Whether the export is a TypeScript `export type`.
///
/// Examples:
///
/// ```ts
/// export type * from 'mod';
/// export type * as ns from 'mod';
/// export type { foo };
/// export { type foo }:
/// export type { foo } from 'mod';
/// ```
pub is_type: bool,
}

#[napi(object)]
Expand Down
Loading
Loading