-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(type): refactor typeName embedding
Previously Type.typeName was detected based on actual symbol names in JS (var __Ωxy). This had a several issues. First, we used forward refs like `() => __Ωxy` and then use toString() on it to get the symbol name. This is slow as it uses fn.toString() and regexp. Second, since we expect __Ω as prefix, this is unstable since some minifier entirely replace `__Ωxy` into something entirely different like `abc`. Third, __Ω is not always preserved in runtimes. It was often replaced with `__\uxxx` (bun, esbuild) this would make parsing even more complex. Runtime types should work with any bundler and runtime, whether minification is enabled or not. Thus, this commit removes this approach entirely and emits for TypeAliasDeclaration, InterfaceDeclaration, EnumDeclaration, and ClassDeclaration now always `Op.typename` with the real type name as string. This means type names will survive all minification processes.
- Loading branch information
Showing
10 changed files
with
203 additions
and
126 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
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
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
Oops, something went wrong.