Mangle exported symbols (#182935)

* Mangle exported functions

For #180461

This prototype tries to mangle exported functions, saving a further 440kb from the bundle size

* Fix missing call

* Also try mangling top level exported consts too

* Fixing errors

* Don't run on build files

* Skip a few more manglings and revert change to namespace

* Skip a few more monaco files

* Also mangle consts that shadow types

This increases savings up to 3325

* Also mangle exported classes

* Skip mangling more localization functions for now

* Opt out pfs

* Update build script

* Run find locations task in parallel

This should speed up compile

* Cleanup before close

* Limit workers to avoid hitting memory limit

* Limit pool size

* Skip one more mangling

* Exclude entrypoints from mangling

* Try to fix web build and clean up code

* Exempt a few more projects

* Exempt another file

* Also exempt html

* Skip mangling ext entrypoints

* Use prefix that can't be confused with rpc calls

* Fix max call stack error

* Switch prefixes

* Don't mangle ambient declarations

* Use correct way of checking modifier flags

* Workaround getCombinedModifierFlags not doing what I'd expect

Maybe needs the checker to be enabled too? Just check parent chain instead for now

* Clean up code and add logic showing how enum mangling could work

* Remove a few more skipMangles

Use entrypoints instead

* Fix entrypoint name
This commit is contained in:
Matt Bierner
2023-06-12 23:18:05 -07:00
committed by GitHub
parent 79c4092768
commit debcf16fcd
22 changed files with 1338 additions and 134 deletions

View File

@@ -38,6 +38,7 @@
"@types/through2": "^2.0.36",
"@types/tmp": "^0.2.1",
"@types/underscore": "^1.8.9",
"@types/workerpool": "^6.4.0",
"@types/xml2js": "0.0.33",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/vsce": "^2.16.0",
@@ -70,5 +71,8 @@
"tree-sitter": "https://github.com/joaomoreno/node-tree-sitter/releases/download/v0.20.0/tree-sitter-0.20.0.tgz",
"tree-sitter-typescript": "^0.20.1",
"vscode-gulp-watch": "^5.0.3"
},
"dependencies": {
"workerpool": "^6.4.0"
}
}