-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ts/fast-strip): Handle unsupported
module
keyword (#10022)
**Related issue:** - Closes #10017
- Loading branch information
1 parent
6dab49a
commit 308f5d0
Showing
17 changed files
with
407 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
swc_core: patch | ||
swc_fast_ts_strip: patch | ||
--- | ||
|
||
fix(es/ts_strip): Handle unsupported `module` keyword |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
x TypeScript namespace declaration is not supported in strip-only mode | ||
x `module` keyword is not supported. Use `namespace` instead. | ||
,---- | ||
1 | module aModuleKeywordNamespace { export const m = 1; } | ||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
1 | module aModuleKeywordNamespace { } | ||
: ^^^^^^ | ||
`---- | ||
x TypeScript namespace declaration is not supported in strip-only mode | ||
x `module` keyword is not supported. Use `namespace` instead. | ||
,-[3:1] | ||
2 | | ||
3 | export module aModuleKeywordExportedNamespace { export const m = 1; } | ||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
3 | declare module aModuleKeywordDeclareNamespace { } | ||
: ^^^^^^ | ||
`---- | ||
x `module` keyword is not supported. Use `namespace` instead. | ||
,-[5:1] | ||
4 | | ||
5 | export module aModuleKeywordExportedNamespace { } | ||
: ^^^^^^ | ||
`---- | ||
x `module` keyword is not supported. Use `namespace` instead. | ||
,-[7:1] | ||
6 | | ||
7 | export declare module aModuleKeywordExportedDeclareNamespace { } | ||
: ^^^^^^ | ||
`---- | ||
x `module` keyword is not supported. Use `namespace` instead. | ||
,-[10:1] | ||
9 | namespace foo { | ||
10 | export module aModuleKeywordExportedNamespaceInNamespace { } | ||
: ^^^^^^ | ||
11 | } | ||
`---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
module aModuleKeywordNamespace { export const m = 1; } | ||
module aModuleKeywordNamespace { } | ||
|
||
export module aModuleKeywordExportedNamespace { export const m = 1; } | ||
declare module aModuleKeywordDeclareNamespace { } | ||
|
||
export module aModuleKeywordExportedNamespace { } | ||
|
||
export declare module aModuleKeywordExportedDeclareNamespace { } | ||
|
||
namespace foo { | ||
export module aModuleKeywordExportedNamespaceInNamespace { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
|
||
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules | ||
export { }; | ||
|
||
|
||
|
||
|
||
|
||
|
||
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#global-augmentation | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
module 'myAmbientModuleDeclaration' { } | ||
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules | ||
export { }; | ||
declare module "path" { | ||
export function normalize(p: string): string; | ||
export function join(...paths: any[]): string; | ||
export var sep: string; | ||
} | ||
|
||
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#global-augmentation | ||
declare global { | ||
interface Array<T> { | ||
toObservable(): Observable<T>; | ||
} | ||
} |
Oops, something went wrong.