clutz
clutz copied to clipboard
decrease reliance on internal closure compiler string mangling
This came up during review of https://github.com/angular/tsickle/pull/624. Currently clutz emits module$exports$path$of$module$
as that is how js compiler internally renames module exports into the internal global namespace [1]. Also module$contents$
can make an appearance [2]
As we are having more tools depend on clutz output (tsickle in this case), it could be preferable to expect that scheme from closure, but emit a well-documented clutz renaming.
That's said, I am not sure how different would that be. The following choices need to be made:
- prefix to replace
module$exports
- separator to replace
$
.
Actually, the current choices made by closure are what I would probably have picked.
@mprobst @LucasSloan
[1] https://github.com/angular/clutz/blob/fe74c288ff8b39c1850a36259f26b0ac7ab87583/src/test/java/com/google/javascript/clutz/goog_module_class.d.ts#L9
[2] https://github.com/angular/clutz/blob/master/src/test/java/com/google/javascript/clutz/goog_module_declare_legacy.d.ts#L10
The thing that I'm slightly uncomfortable with is that we have code in Clutz and in tsickle relying on an implementation detail in JSCompiler, which of course could change at any point in time. Agreed that a pattern we'd come up with would likely be similar, but then at least we'd contain all the reliance on JSCompiler internals in Clutz.
Another mitigation would be having an integration test that checks for this, and making sure it's tested against each change to JSCompiler (in google3?) and Clutz.
Even with an integration test, we effectively would be pinning JSCompiler to its current implementation. (Changing it in JSCompiler would require simultaneously modifying it in JSCompiler, clutz, and tsickle.)
Yeah, but if we find that, we could introduce an indirection for the time being or something like that.
2017-10-11 18:16 GMT+02:00 Evan Martin [email protected]:
Even with an integration test, we effectively would be pinning JSCompiler to its current implementation. (Changing it in JSCompiler would require simultaneously modifying it in JSCompiler, clutz, and tsickle.)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/clutz/issues/575#issuecomment-335864218, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcKL3kc39Tiejc3PbUEaJkwy_l6KUjks5srOnDgaJpZM4PzHy6 .