From 7bf2dcde1cf92b71f95074670e56c6e299539a1a Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Tue, 2 Jul 2024 14:45:53 +0200 Subject: [PATCH] Revert "Fix exports (#82)" This reverts commit b9435de01a6d899622c532800eb96976d6d1302e. --- src/create-module-declaration.js | 23 +++++++++++++------ src/types.d.ts | 1 + src/utils.js | 1 + .../samples/ambient-imports/output/index.d.ts | 4 +--- .../ambient-imports/output/index.d.ts.map | 2 +- test/samples/basic/output/index.d.ts | 12 ++++------ test/samples/basic/output/index.d.ts.map | 2 +- .../const-namespace/output 5.0/index.d.ts | 4 +--- .../samples/const-namespace/output/index.d.ts | 6 ++--- test/samples/declare-module/output/index.d.ts | 4 +--- .../declare-module/output/index.d.ts.map | 2 +- .../deconflict-priority/output/index.d.ts | 4 +--- .../deconflict-priority/output/index.d.ts.map | 2 +- test/samples/enum/output/index.d.ts | 6 ++--- test/samples/enum/output/index.d.ts.map | 4 ++-- .../export-default-as/output/index.d.ts | 4 +--- .../export-default-as/output/index.d.ts.map | 2 +- .../export-default-function/output/index.d.ts | 2 -- .../export-default-value/output/index.d.ts | 2 -- test/samples/export-from/output/index.d.ts | 4 +--- .../samples/export-from/output/index.d.ts.map | 2 +- .../samples/export-named-as/output/index.d.ts | 4 +--- test/samples/export-type/output/index.d.ts | 8 +++---- .../samples/export-type/output/index.d.ts.map | 2 +- test/samples/generics/output/index.d.ts | 4 +--- test/samples/generics/output/index.d.ts.map | 2 +- .../output 5.0/index.d.ts | 6 ++--- .../output 5.0/index.d.ts.map | 4 ++-- .../output/index.d.ts | 8 +++---- .../output/index.d.ts.map | 2 +- .../import-external-default/output/index.d.ts | 6 ++--- .../output/index.d.ts.map | 4 ++-- .../output/index.d.ts | 6 ++--- .../output/index.d.ts.map | 4 ++-- .../output/index.d.ts | 4 +--- .../import-external-named/output/index.d.ts | 4 +--- .../namespace-exports/output/index.d.ts | 6 ++--- .../namespace-exports/output/index.d.ts.map | 4 ++-- test/samples/overloads/output/index.d.ts | 8 +++---- test/samples/overloads/output/index.d.ts.map | 4 ++-- .../path-config/output 5.0 - 5.1/index.d.ts | 16 ++++++------- .../output 5.0 - 5.1/index.d.ts.map | 4 ++-- test/samples/path-config/output/index.d.ts | 14 +++++------ .../samples/path-config/output/index.d.ts.map | 4 ++-- .../preserve-comments/output/index.d.ts | 4 +--- .../preserve-comments/output/index.d.ts.map | 2 +- .../preserved-jsdoc-tags/output/index.d.ts | 4 +--- .../output/index.d.ts.map | 2 +- test/samples/throws/output/index.d.ts | 4 +--- test/samples/throws/output/index.d.ts.map | 2 +- .../output/index.d.ts | 4 +--- .../output/index.d.ts.map | 2 +- test/samples/ts/output/index.d.ts | 12 ++++------ test/samples/ts/output/index.d.ts.map | 2 +- 54 files changed, 104 insertions(+), 155 deletions(-) diff --git a/src/create-module-declaration.js b/src/create-module-declaration.js index 9538e4f..8b23514 100644 --- a/src/create-module-declaration.js +++ b/src/create-module-declaration.js @@ -167,9 +167,11 @@ export function create_module_declaration(id, entry, created, resolve) { declaration.alias = get_name(globals.has(name) ? declaration.name : name); mark(declaration); - export_specifiers.push( - declaration.alias === name ? name : `${declaration.alias} as ${name}` - ); + if (declaration.alias !== name) { + export_specifiers.push(`${declaration.alias} as ${name}`); + } else { + declaration.exported = true; + } } else { throw new Error('Something strange happened'); } @@ -323,10 +325,15 @@ export function create_module_declaration(id, entry, created, resolve) { } } - let b = export_modifier.end; - const a = b - 6; - while (/\s/.test(module.dts[b])) b += 1; - result.remove(a, b); + if (!exports.has(declaration.alias)) { + // remove all export keywords in the initial pass; reinstate as necessary later + let b = export_modifier.end; + const a = b - 6; + while (/\s/.test(module.dts[b])) b += 1; + result.remove(a, b); + } + } else if (declaration.exported) { + export_specifiers.push(declaration.alias); } } @@ -500,6 +507,7 @@ export function create_module_declaration(id, entry, created, resolve) { module: '', external: false, included: true, + exported: false, name, alias: name, dependencies: [], @@ -527,6 +535,7 @@ function create_external_declaration(binding, alias) { module: binding.id, name: binding.name, alias: '', + exported: false, external: true, included: false, dependencies: [], diff --git a/src/types.d.ts b/src/types.d.ts index 398d424..ab4a6c2 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -11,6 +11,7 @@ interface Declaration { module: string; name: string; alias: string; + exported: boolean; external: boolean; included: boolean; dependencies: Reference[]; diff --git a/src/utils.js b/src/utils.js index 0582b9a..4c257fa 100644 --- a/src/utils.js +++ b/src/utils.js @@ -342,6 +342,7 @@ export function get_dts(file, created, resolve) { module: file, name, alias: '', + exported: false, included: false, external: false, dependencies: [], diff --git a/test/samples/ambient-imports/output/index.d.ts b/test/samples/ambient-imports/output/index.d.ts index f738c97..358f4f0 100644 --- a/test/samples/ambient-imports/output/index.d.ts +++ b/test/samples/ambient-imports/output/index.d.ts @@ -1,9 +1,7 @@ /// declare module 'ambient-imports' { - interface Foo {} - - export { Foo }; + export interface Foo {} } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/ambient-imports/output/index.d.ts.map b/test/samples/ambient-imports/output/index.d.ts.map index 6c8a32c..ff6baf1 100644 --- a/test/samples/ambient-imports/output/index.d.ts.map +++ b/test/samples/ambient-imports/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;;WAEiBA,GAAGA" + "mappings": ";;;kBAEiBA,GAAGA" } \ No newline at end of file diff --git a/test/samples/basic/output/index.d.ts b/test/samples/basic/output/index.d.ts index 743d48d..46c336a 100644 --- a/test/samples/basic/output/index.d.ts +++ b/test/samples/basic/output/index.d.ts @@ -1,6 +1,6 @@ declare module 'basic' { /** A vector with two components */ - interface Vector2 { + export interface Vector2 { /** The x component */ x: number; /** The y component */ @@ -11,18 +11,14 @@ declare module 'basic' { * @param a the first vector * @param b the second vector * */ - function add(a: Vector2, b: Vector2): Vector2; - - export { Vector2, add }; + export function add(a: Vector2, b: Vector2): Vector2; } declare module 'basic/subpackage' { /** * Multiply two vectors * */ - function multiply(a: import('basic').Vector2, b: import('basic').Vector2): import('basic').Vector2; - - export { multiply }; + export function multiply(a: import('basic').Vector2, b: import('basic').Vector2): import('basic').Vector2; } -//# sourceMappingURL=index.d.ts.map +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/basic/output/index.d.ts.map b/test/samples/basic/output/index.d.ts.map index 1cfa890..32d1263 100644 --- a/test/samples/basic/output/index.d.ts.map +++ b/test/samples/basic/output/index.d.ts.map @@ -16,5 +16,5 @@ null, null ], - "mappings": ";;WACiBA,OAAOA;;;;;;;;;;;UCKRC,GAAGA;;;;;;;;;UCAHC,QAAQA" + "mappings": ";;kBACiBA,OAAOA;;;;;;;;;;;iBCKRC,GAAGA;;;;;;;iBCAHC,QAAQA" } \ No newline at end of file diff --git a/test/samples/const-namespace/output 5.0/index.d.ts b/test/samples/const-namespace/output 5.0/index.d.ts index ebb55cc..b8c7939 100644 --- a/test/samples/const-namespace/output 5.0/index.d.ts +++ b/test/samples/const-namespace/output 5.0/index.d.ts @@ -1,9 +1,7 @@ declare module 'const-namespace' { - namespace a { + export namespace a { const x: number; } - - export { a }; } //# sourceMappingURL=index.d.ts.map diff --git a/test/samples/const-namespace/output/index.d.ts b/test/samples/const-namespace/output/index.d.ts index 42c5af2..ed28fa8 100644 --- a/test/samples/const-namespace/output/index.d.ts +++ b/test/samples/const-namespace/output/index.d.ts @@ -1,9 +1,7 @@ declare module 'const-namespace' { - namespace a { + export namespace a { let x: number; } - - export { a }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/declare-module/output/index.d.ts b/test/samples/declare-module/output/index.d.ts index 409ee5a..97c7f66 100644 --- a/test/samples/declare-module/output/index.d.ts +++ b/test/samples/declare-module/output/index.d.ts @@ -1,7 +1,5 @@ declare module 'declare-module' { - interface Foo {} - - export { Foo }; + export interface Foo {} } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/declare-module/output/index.d.ts.map b/test/samples/declare-module/output/index.d.ts.map index 490a511..5e02c16 100644 --- a/test/samples/declare-module/output/index.d.ts.map +++ b/test/samples/declare-module/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";WAOiBA,GAAGA" + "mappings": ";kBAOiBA,GAAGA" } \ No newline at end of file diff --git a/test/samples/deconflict-priority/output/index.d.ts b/test/samples/deconflict-priority/output/index.d.ts index fd7e0e3..fc5f215 100644 --- a/test/samples/deconflict-priority/output/index.d.ts +++ b/test/samples/deconflict-priority/output/index.d.ts @@ -1,9 +1,7 @@ declare module 'deconflict-priority' { - function x(foo: Foo, bar: Bar): void; + export function x(foo: Foo, bar: Bar): void; interface Foo {} interface Bar {} - - export { x }; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/deconflict-priority/output/index.d.ts.map b/test/samples/deconflict-priority/output/index.d.ts.map index 8d95e46..cd3dac6 100644 --- a/test/samples/deconflict-priority/output/index.d.ts.map +++ b/test/samples/deconflict-priority/output/index.d.ts.map @@ -16,5 +16,5 @@ null, null ], - "mappings": ";UAIgBA,CAACA;WCJAC,GAAGA;WCCHC,GAAGA" + "mappings": ";iBAIgBA,CAACA;WCJAC,GAAGA;WCCHC,GAAGA" } \ No newline at end of file diff --git a/test/samples/enum/output/index.d.ts b/test/samples/enum/output/index.d.ts index 5dbd302..de458d9 100644 --- a/test/samples/enum/output/index.d.ts +++ b/test/samples/enum/output/index.d.ts @@ -1,11 +1,9 @@ declare module 'enum' { - enum categories { + export enum categories { ANIMAL = 0, VEGETABLE = 1, MINERAL = 2 } - - export { categories }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/enum/output/index.d.ts.map b/test/samples/enum/output/index.d.ts.map index 3c3a945..e8a9023 100644 --- a/test/samples/enum/output/index.d.ts.map +++ b/test/samples/enum/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";MAAYA,UAAUA" -} \ No newline at end of file + "mappings": ";aAAYA,UAAUA" +} diff --git a/test/samples/export-default-as/output/index.d.ts b/test/samples/export-default-as/output/index.d.ts index 9e62f4e..4beb443 100644 --- a/test/samples/export-default-as/output/index.d.ts +++ b/test/samples/export-default-as/output/index.d.ts @@ -2,9 +2,7 @@ declare module 'export-default-as' { /** * Add two numbers * */ - function add(a: number, b: number): number; - - export { add }; + export function add(a: number, b: number): number; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/export-default-as/output/index.d.ts.map b/test/samples/export-default-as/output/index.d.ts.map index 4101c9d..975a5d5 100644 --- a/test/samples/export-default-as/output/index.d.ts.map +++ b/test/samples/export-default-as/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;;;UAMwBA,GAAGA" + "mappings": ";;;;iBAMwBA,GAAGA" } \ No newline at end of file diff --git a/test/samples/export-default-function/output/index.d.ts b/test/samples/export-default-function/output/index.d.ts index 31e690f..dc78626 100644 --- a/test/samples/export-default-function/output/index.d.ts +++ b/test/samples/export-default-function/output/index.d.ts @@ -1,7 +1,5 @@ declare module 'export-default-function' { export default function foo(): void; - - export { default }; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/export-default-value/output/index.d.ts b/test/samples/export-default-value/output/index.d.ts index f4ed322..5ef499e 100644 --- a/test/samples/export-default-value/output/index.d.ts +++ b/test/samples/export-default-value/output/index.d.ts @@ -1,8 +1,6 @@ declare module 'export-default-value' { const _default: 42; export default _default; - - export { default }; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/export-from/output/index.d.ts b/test/samples/export-from/output/index.d.ts index 4da8f13..05f2123 100644 --- a/test/samples/export-from/output/index.d.ts +++ b/test/samples/export-from/output/index.d.ts @@ -1,7 +1,5 @@ declare module 'export-from' { - const foo: "hello"; - - export { foo }; + export const foo: "hello"; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/export-from/output/index.d.ts.map b/test/samples/export-from/output/index.d.ts.map index fd32c89..d556af0 100644 --- a/test/samples/export-from/output/index.d.ts.map +++ b/test/samples/export-from/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";OAAaA,GAAGA" + "mappings": ";cAAaA,GAAGA" } \ No newline at end of file diff --git a/test/samples/export-named-as/output/index.d.ts b/test/samples/export-named-as/output/index.d.ts index 59382a7..808a3b2 100644 --- a/test/samples/export-named-as/output/index.d.ts +++ b/test/samples/export-named-as/output/index.d.ts @@ -2,9 +2,7 @@ declare module 'export-named-as' { /** * Add two numbers * */ - function plus(a: number, b: number): number; - - export { plus }; + export function plus(a: number, b: number): number; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/export-type/output/index.d.ts b/test/samples/export-type/output/index.d.ts index 6f3431e..da8fc45 100644 --- a/test/samples/export-type/output/index.d.ts +++ b/test/samples/export-type/output/index.d.ts @@ -1,8 +1,6 @@ declare module 'export-type' { - type D = {}; - class B {} - - export { B, D }; + export type D = {}; + export class B {} } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/export-type/output/index.d.ts.map b/test/samples/export-type/output/index.d.ts.map index c6b7375..2fd1ead 100644 --- a/test/samples/export-type/output/index.d.ts.map +++ b/test/samples/export-type/output/index.d.ts.map @@ -5,4 +5,4 @@ "sources": [], "sourcesContent": [], "mappings": "" -} \ No newline at end of file +} diff --git a/test/samples/generics/output/index.d.ts b/test/samples/generics/output/index.d.ts index 586a9dc..5912672 100644 --- a/test/samples/generics/output/index.d.ts +++ b/test/samples/generics/output/index.d.ts @@ -1,9 +1,7 @@ declare module 'generics' { - interface Foo { + export interface Foo { bar: T; } - - export { Foo }; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/generics/output/index.d.ts.map b/test/samples/generics/output/index.d.ts.map index 0099d44..8e32b8b 100644 --- a/test/samples/generics/output/index.d.ts.map +++ b/test/samples/generics/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";WAAiBA,GAAGA" + "mappings": ";kBAAiBA,GAAGA" } \ No newline at end of file diff --git a/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts b/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts index 9677ab3..cf27525 100644 --- a/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts +++ b/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts @@ -1,10 +1,8 @@ declare module 'ignores-missing-sourcemap-segments' { - function hello(): void; - namespace object { + export function hello(): void; + export namespace object { const answer: number; } - - export { hello, object }; } //# sourceMappingURL=index.d.ts.map diff --git a/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts.map b/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts.map index f5773e6..e1bbe17 100644 --- a/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts.map +++ b/test/samples/ignores-missing-sourcemap-segments/output 5.0/index.d.ts.map @@ -13,5 +13,5 @@ null, null ], - "mappings": ";UAIgBA,KAAKA;WCHJC,MAAMA" -} + "mappings": ";iBAIgBA,KAAKA;kBCHJC,MAAMA" +} \ No newline at end of file diff --git a/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts b/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts index 3868210..ba6510f 100644 --- a/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts +++ b/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts @@ -1,10 +1,8 @@ declare module 'ignores-missing-sourcemap-segments' { - function hello(): void; - namespace object { + export function hello(): void; + export namespace object { let answer: number; } - - export { hello, object }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts.map b/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts.map index f11f04f..e1bbe17 100644 --- a/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts.map +++ b/test/samples/ignores-missing-sourcemap-segments/output/index.d.ts.map @@ -13,5 +13,5 @@ null, null ], - "mappings": ";UAIgBA,KAAKA;WCHJC,MAAMA" + "mappings": ";iBAIgBA,KAAKA;kBCHJC,MAAMA" } \ No newline at end of file diff --git a/test/samples/import-external-default/output/index.d.ts b/test/samples/import-external-default/output/index.d.ts index 639ec5d..784438d 100644 --- a/test/samples/import-external-default/output/index.d.ts +++ b/test/samples/import-external-default/output/index.d.ts @@ -1,8 +1,6 @@ declare module 'import-external-default' { import type { default as x } from 'external'; - function foo(input: x): x; - - export { foo }; + export function foo(input: x): x; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/import-external-default/output/index.d.ts.map b/test/samples/import-external-default/output/index.d.ts.map index 9e59a8e..4c842cb 100644 --- a/test/samples/import-external-default/output/index.d.ts.map +++ b/test/samples/import-external-default/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;UAEgBA,GAAGA" -} \ No newline at end of file + "mappings": ";;iBAEgBA,GAAGA" +} diff --git a/test/samples/import-external-named-as-conflict/output/index.d.ts b/test/samples/import-external-named-as-conflict/output/index.d.ts index c30f8a0..316f087 100644 --- a/test/samples/import-external-named-as-conflict/output/index.d.ts +++ b/test/samples/import-external-named-as-conflict/output/index.d.ts @@ -1,9 +1,7 @@ declare module 'import-external-named-as-conflict' { import type { foo as f } from 'external'; - function foo(): void; - - export { foo, f }; + export function foo(): void; export { f }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/import-external-named-as-conflict/output/index.d.ts.map b/test/samples/import-external-named-as-conflict/output/index.d.ts.map index 7a8aa3a..8813318 100644 --- a/test/samples/import-external-named-as-conflict/output/index.d.ts.map +++ b/test/samples/import-external-named-as-conflict/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;UAIgBA,GAAGA" -} \ No newline at end of file + "mappings": ";;iBAIgBA,GAAGA" +} diff --git a/test/samples/import-external-named-as/output/index.d.ts b/test/samples/import-external-named-as/output/index.d.ts index 7dedc3d..ce7b2fb 100644 --- a/test/samples/import-external-named-as/output/index.d.ts +++ b/test/samples/import-external-named-as/output/index.d.ts @@ -1,8 +1,6 @@ declare module 'import-external-named-as' { import type { foo as f } from 'external'; - - export { f }; export { f }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/import-external-named/output/index.d.ts b/test/samples/import-external-named/output/index.d.ts index 1c4a24c..2c9a23f 100644 --- a/test/samples/import-external-named/output/index.d.ts +++ b/test/samples/import-external-named/output/index.d.ts @@ -1,8 +1,6 @@ declare module 'import-external-named' { import type { foo } from 'external'; - - export { foo }; export { foo }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/namespace-exports/output/index.d.ts b/test/samples/namespace-exports/output/index.d.ts index 847fb55..a64874c 100644 --- a/test/samples/namespace-exports/output/index.d.ts +++ b/test/samples/namespace-exports/output/index.d.ts @@ -1,5 +1,5 @@ declare module 'namespace-exports' { - type X = Namespace.X; + export type X = Namespace.X; namespace Namespace { interface X { x: string; @@ -8,8 +8,6 @@ declare module 'namespace-exports' { y: string; } } - - export { X }; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/namespace-exports/output/index.d.ts.map b/test/samples/namespace-exports/output/index.d.ts.map index cd6b925..d534ceb 100644 --- a/test/samples/namespace-exports/output/index.d.ts.map +++ b/test/samples/namespace-exports/output/index.d.ts.map @@ -13,5 +13,5 @@ null, null ], - "mappings": ";MAEYA,CAACA;WCFIC,SAASA" -} \ No newline at end of file + "mappings": ";aAEYA,CAACA;WCFIC,SAASA" +} diff --git a/test/samples/overloads/output/index.d.ts b/test/samples/overloads/output/index.d.ts index 0c79519..d6cf3c6 100644 --- a/test/samples/overloads/output/index.d.ts +++ b/test/samples/overloads/output/index.d.ts @@ -3,10 +3,8 @@ declare module 'overloads' { } interface Bar { } - function baz(input: Foo): Foo; - function baz(input: Bar): Bar; - - export { baz }; + export function baz(input: Foo): Foo; + export function baz(input: Bar): Bar; } -//# sourceMappingURL=index.d.ts.map \ No newline at end of file +//# sourceMappingURL=index.d.ts.map diff --git a/test/samples/overloads/output/index.d.ts.map b/test/samples/overloads/output/index.d.ts.map index 47fb239..3a5528d 100644 --- a/test/samples/overloads/output/index.d.ts.map +++ b/test/samples/overloads/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;;;;UAIgBA,GAAGA;UAAHA,GAAGA" -} \ No newline at end of file + "mappings": ";;;;;iBAIgBA,GAAGA;iBAAHA,GAAGA" +} diff --git a/test/samples/path-config/output 5.0 - 5.1/index.d.ts b/test/samples/path-config/output 5.0 - 5.1/index.d.ts index 0dbc729..3b5734d 100644 --- a/test/samples/path-config/output 5.0 - 5.1/index.d.ts +++ b/test/samples/path-config/output 5.0 - 5.1/index.d.ts @@ -1,17 +1,15 @@ declare module 'path-config' { - function foo(input: Input): Output; - function overload(input: Input): Output; - function overload(input: string): Output; + export function foo(input: Input): Output; + export function overload(input: Input): Output; + export function overload(input: string): Output; - function foo2(foo: Foo): void; - type Foo = { + export function foo2(foo: Foo): void; + export type Foo = { foo: Input; }; type Input = number; type Output = number; - function foo_nested(input: Input): Output; - - export { foo, overload, foo2, Foo, foo_nested }; + export function foo_nested(input: Input): Output; } -//# sourceMappingURL=index.d.ts.map +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/path-config/output 5.0 - 5.1/index.d.ts.map b/test/samples/path-config/output 5.0 - 5.1/index.d.ts.map index 6df81c7..95cd82d 100644 --- a/test/samples/path-config/output 5.0 - 5.1/index.d.ts.map +++ b/test/samples/path-config/output 5.0 - 5.1/index.d.ts.map @@ -19,5 +19,5 @@ null, null ], - "mappings": ";UAMgBA,GAAGA;UASfC,QAAQA;UAARA,QAAQA;;UAgBIC,IAAIA;;;;MC/BRC,KAAKA;MACLC,MAAMA;UCGFC,UAAUA" -} + "mappings": ";iBAMgBA,GAAGA;iBASfC,QAAQA;iBAARA,QAAQA;;iBAgBIC,IAAIA;;;;MC/BRC,KAAKA;MACLC,MAAMA;iBCGFC,UAAUA" +} \ No newline at end of file diff --git a/test/samples/path-config/output/index.d.ts b/test/samples/path-config/output/index.d.ts index 94c2821..aa38551 100644 --- a/test/samples/path-config/output/index.d.ts +++ b/test/samples/path-config/output/index.d.ts @@ -1,19 +1,17 @@ declare module 'path-config' { - function foo(input: Input): Output; + export function foo(input: Input): Output; - function overload(input: Input): Output; + export function overload(input: Input): Output; - function overload(input: string): Output; + export function overload(input: string): Output; - function foo2(foo: Foo): void; - type Foo = { + export function foo2(foo: Foo): void; + export type Foo = { foo: Input; }; type Input = number; type Output = number; - function foo_nested(input: Input): Output; - - export { foo, overload, foo2, Foo, foo_nested }; + export function foo_nested(input: Input): Output; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/path-config/output/index.d.ts.map b/test/samples/path-config/output/index.d.ts.map index a62b5ba..419cf24 100644 --- a/test/samples/path-config/output/index.d.ts.map +++ b/test/samples/path-config/output/index.d.ts.map @@ -19,5 +19,5 @@ null, null ], - "mappings": ";UAMgBA,GAAGA;;UASfC,QAAQA;;UAARA,QAAQA;;UAgBIC,IAAIA;;;;MC/BRC,KAAKA;MACLC,MAAMA;UCGFC,UAAUA" -} \ No newline at end of file + "mappings": ";iBAMgBA,GAAGA;;iBASfC,QAAQA;;iBAARA,QAAQA;;iBAgBIC,IAAIA;;;;MC/BRC,KAAKA;MACLC,MAAMA;iBCGFC,UAAUA" +} diff --git a/test/samples/preserve-comments/output/index.d.ts b/test/samples/preserve-comments/output/index.d.ts index cf669f9..c71bb69 100644 --- a/test/samples/preserve-comments/output/index.d.ts +++ b/test/samples/preserve-comments/output/index.d.ts @@ -2,9 +2,7 @@ declare module 'preserve-comments' { /** * @deprecated */ - function a(): number; - - export { a }; + export function a(): number; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/preserve-comments/output/index.d.ts.map b/test/samples/preserve-comments/output/index.d.ts.map index a4d25c7..8e8d869 100644 --- a/test/samples/preserve-comments/output/index.d.ts.map +++ b/test/samples/preserve-comments/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;;;UAGgBA,CAACA" + "mappings": ";;;;iBAGgBA,CAACA" } \ No newline at end of file diff --git a/test/samples/preserved-jsdoc-tags/output/index.d.ts b/test/samples/preserved-jsdoc-tags/output/index.d.ts index 06e5721..6a8a452 100644 --- a/test/samples/preserved-jsdoc-tags/output/index.d.ts +++ b/test/samples/preserved-jsdoc-tags/output/index.d.ts @@ -5,9 +5,7 @@ declare module 'preserved-jsdoc-tags' { * @example * const three = add(1, 2); * */ - function add(a: number, b: number): number; - - export { add }; + export function add(a: number, b: number): number; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/preserved-jsdoc-tags/output/index.d.ts.map b/test/samples/preserved-jsdoc-tags/output/index.d.ts.map index 95b40bc..12863e8 100644 --- a/test/samples/preserved-jsdoc-tags/output/index.d.ts.map +++ b/test/samples/preserved-jsdoc-tags/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;;;;;;UAQgBA,GAAGA" + "mappings": ";;;;;;;iBAQgBA,GAAGA" } \ No newline at end of file diff --git a/test/samples/throws/output/index.d.ts b/test/samples/throws/output/index.d.ts index 6267099..77c3843 100644 --- a/test/samples/throws/output/index.d.ts +++ b/test/samples/throws/output/index.d.ts @@ -2,9 +2,7 @@ declare module 'throws' { /** * @throws {Error} nope * */ - function nope(): never; - - export { nope }; + export function nope(): never; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/throws/output/index.d.ts.map b/test/samples/throws/output/index.d.ts.map index bd72f09..3c74d21 100644 --- a/test/samples/throws/output/index.d.ts.map +++ b/test/samples/throws/output/index.d.ts.map @@ -10,5 +10,5 @@ "sourcesContent": [ null ], - "mappings": ";;;;UAIgBA,IAAIA" + "mappings": ";;;;iBAIgBA,IAAIA" } \ No newline at end of file diff --git a/test/samples/treeshaking-inline-import/output/index.d.ts b/test/samples/treeshaking-inline-import/output/index.d.ts index a3956aa..5d9875f 100644 --- a/test/samples/treeshaking-inline-import/output/index.d.ts +++ b/test/samples/treeshaking-inline-import/output/index.d.ts @@ -2,7 +2,7 @@ declare module 'treeshaking-inline-import' { /** * Add two vectors * */ - function add(a: Vector2, b: Vector2): Vector2; + export function add(a: Vector2, b: Vector2): Vector2; /** A vector with two components */ interface Vector2 { /** The x component */ @@ -10,8 +10,6 @@ declare module 'treeshaking-inline-import' { /** The y component */ y: number; } - - export { add }; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/treeshaking-inline-import/output/index.d.ts.map b/test/samples/treeshaking-inline-import/output/index.d.ts.map index 04f37ae..780ab2a 100644 --- a/test/samples/treeshaking-inline-import/output/index.d.ts.map +++ b/test/samples/treeshaking-inline-import/output/index.d.ts.map @@ -13,5 +13,5 @@ null, null ], - "mappings": ";;;;UAMgBA,GAAGA;;WCLFC,OAAOA" + "mappings": ";;;;iBAMgBA,GAAGA;;WCLFC,OAAOA" } \ No newline at end of file diff --git a/test/samples/ts/output/index.d.ts b/test/samples/ts/output/index.d.ts index 3f3b94c..8615bd9 100644 --- a/test/samples/ts/output/index.d.ts +++ b/test/samples/ts/output/index.d.ts @@ -1,22 +1,20 @@ declare module 'ts' { /** A vector with two components */ - interface Vector2 { + export interface Vector2 { /** The x component */ x: number; /** The y component */ y: number; } /** A vector with three components */ - interface Vector3 extends Vector2 { + export interface Vector3 extends Vector2 { /** The z component */ z: number; } /** * Add two vectors */ - function add(a: Vector2, b: Vector2): Vector2; - - export { Vector2, Vector3, add }; + export function add(a: Vector2, b: Vector2): Vector2; } declare module 'ts/subpackage' { @@ -24,9 +22,7 @@ declare module 'ts/subpackage' { /** * Multiply two vectors */ - function multiply(a: Vector2, b: Vector2): Vector2; - - export { multiply }; + export function multiply(a: Vector2, b: Vector2): Vector2; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/test/samples/ts/output/index.d.ts.map b/test/samples/ts/output/index.d.ts.map index a196ef8..2bf5834 100644 --- a/test/samples/ts/output/index.d.ts.map +++ b/test/samples/ts/output/index.d.ts.map @@ -15,5 +15,5 @@ null, null ], - "mappings": ";;WACiBA,OAAOA;;;;;;;WAQPC,OAAOA;;;;;;;UAQRC,GAAGA;;;;;;;;;;UCZHC,QAAQA" + "mappings": ";;kBACiBA,OAAOA;;;;;;;kBAQPC,OAAOA;;;;;;;iBAQRC,GAAGA;;;;;;;;iBCZHC,QAAQA" } \ No newline at end of file