oxc/crates
Dunqing b22b59ae12 feat(transformer-dts): transform namespace support (#3683)
This PR implements namespace transform:

Look at this example

```ts
let internal = 0;
export namespace ns {
    namespace internal {
        export class Foo {}
    }
    export namespace nested {
        export import inner = internal;
    }
}

// to

export declare namespace ns {
    namespace internal {
        class Foo {
        }
    }
    export namespace nested {
        export import inner = internal;
    }
    export {};
}

```

The `let internal = 0` is unexported, and is unreferenced in other types. So we need to remove it.

I refactored `scope` because the previous implementation could not correctly remove unexported and unreferenced declarations.

For example, in this case
```ts
type T = string;
export function foo<T>(): T {
}
// to
type T = string;
export declare function foo<T>(): T;
```
The `type T = string` should be deleted, Because the `T` is not used in the function return type.
2024-06-15 09:45:58 +00:00
..
oxc Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_allocator feat(linter): add eslint/no-useless-constructor (#3594) 2024-06-13 13:12:18 +08:00
oxc_ast feat(transformer-dts): transform namespace support (#3683) 2024-06-15 09:45:58 +00:00
oxc_ast_macros Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_codegen refactor(codegen): move gen_ts into gen to make searching things easier (#3680) 2024-06-15 06:44:14 +00:00
oxc_diagnostics Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_index chore(deps): update dependency rust to v1.79.0 (#3661) 2024-06-14 02:28:06 +00:00
oxc_js_regex chore: crates should only publish src and examples directory 2024-06-08 16:35:16 +08:00
oxc_language_server feat!(ast): make Trivias clonable by adding Arc (#3638) 2024-06-12 13:16:10 +08:00
oxc_linter fix(linter): edge case with infinite loops. (#3672) 2024-06-14 08:37:16 +00:00
oxc_macros chore: crates should only publish src and examples directory 2024-06-08 16:35:16 +08:00
oxc_minifier feat(codegen)!: remove CodegenOptions::enable_typescript (#3674) 2024-06-14 21:56:00 +08:00
oxc_module_lexer Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_parser chore: change all usages of static_assertions to dev-dependencies (#3654) 2024-06-13 13:18:53 +08:00
oxc_prettier refactor(ast)!: remove ExportDefaultDeclarationKind::TSEnumDeclaration (#3666) 2024-06-14 14:40:37 +08:00
oxc_semantic perf(semantic/cfg): lower the visits in neighbors_filtered_by_edge_weight. (#3676) 2024-06-14 16:48:01 +00:00
oxc_sourcemap Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_span Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_syntax Release crates v0.14.0 (#3643) 2024-06-12 17:52:41 +08:00
oxc_transformer feat(transformer-dts): --isolatedDeclarations dts transform (#3664) 2024-06-14 12:44:10 +00:00
oxc_transformer_dts feat(transformer-dts): transform namespace support (#3683) 2024-06-15 09:45:58 +00:00
oxc_traverse refactor(ast)!: remove ExportDefaultDeclarationKind::TSEnumDeclaration (#3666) 2024-06-14 14:40:37 +08:00
oxc_wasm feat(codegen)!: remove CodegenOptions::enable_typescript (#3674) 2024-06-14 21:56:00 +08:00