add babel transformation to the multipass build#22839
add babel transformation to the multipass build#22839erwinmombay merged 30 commits intoampproject:masterfrom
Conversation
f86dcb9 to
a774bc0
Compare
| retainLines: true, | ||
| }); | ||
| const name = `${tmp}${file.replace(process.cwd(), '')}`; | ||
| fs.outputFileSync(name, code); |
There was a problem hiding this comment.
since this is just the preprocess step, we shouldnt need sourcemaps here. we'll still want to rely on CC for the sourcemaps for multipass correct?
There was a problem hiding this comment.
You have to combine the source-maps (which closure will do). But to do that, you have to output sourcemaps for CC to consume.
There was a problem hiding this comment.
LMK, if my statement is correct. Also PTAL when you can. Thanks!
rsimha
left a comment
There was a problem hiding this comment.
Two preliminary comments. Will do a full review after this is ready.
8b2721b to
620c70b
Compare
9d85950 to
4510ec5
Compare
|
@rsimha @jridgewell this is ready for review |
13e3ae0 to
4f5cb26
Compare
rsimha
left a comment
There was a problem hiding this comment.
A few comments below. Will review again once this is rebased.
84796b0 to
9c33500
Compare
ea2b4bf to
c96d922
Compare
|
i had to leave the assert/log transformation in java/closure compiler for now. (I'll follow up in a separate PR) There is currently a weird interaction where when we do the transform in babel when we leave a bare "string", Closure Compiler does not remove the dead string expression statements. We cannot just outright remove the argument of the assert/log calls since we would need to inspect if the arguments have any method calls (which might have side effects). |
|
@rsimha Please take another look. Thanks! |
|
some additional notes:
|
996d611 to
d7ba090
Compare
rsimha
left a comment
There was a problem hiding this comment.
This is looking good! A few comments below.
3dfa4b3 to
ff45682
Compare
|
@rsimha resolved last round of comments. PTAL |
7dd1b80 to
ff7503e
Compare
ff7503e to
9e2e260
Compare
add babel transformation to the multipass build
to accomplish the task we move all the source files to babel preprocess into a temp directory. This is so that we can preprocess only once instead of once per compilation unit (which would turn into an n squared operation)
There were some complications with
buildExperiments,buildLoginDone, andbuildWebPushPublisherFilescalls since they move they're files into thebuilddirectory to be processed by closure way later into the process (in their individual methods) so i had to separate this file move step into apre${method}invocation that needed to be executed before the babel preprocessing. InbuildWebPushPublisherFilescase it also had a post process step.