phetsims/chipper

Generating API files causes unexpected babel work in unrelated repos

Opened this issue · 7 comments

While regenerating the API for Projectile Data Lab, @samreid and I encountered the following console errors in WebStorm:

matthewblackman@Matthews-MacBook-Pro-2 projectile-data-lab % grunt generate-phet-io-api 
Running "generate-phet-io-api" task
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/balloons-and-static-electricity/images/sweater_png.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/build-a-molecule/js/common/model/data/otherMoleculesData.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/build-a-molecule/js/common/model/data/structuresData.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Metal002_col_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Metal002_nrm_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Metal002_rgh_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Metal007_col_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Metal007_nrm_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Metal007_rgh_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Plastic018B_col_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Plastic018B_nrm_jpg.ts as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/matthewblackman/Documents/PhET/phetsims/density-buoyancy-common/images/Plastic018B_rgh_jpg.ts as it exceeds the max of 500KB.

We aren't sure why running grunt generate-phet-io-api from the projectile-data-lab repo would trigger this Babel work, and would like to investigate further.

Maybe grunt generate-phet-io-api invokes the transpiler once? Is the API generated from a built artifact?

That's what it is! Good find. Anything else for this issue?

transpiler.transpileAll();

That seems good. I think we were surprised that it needed to re-transpile things at an unexpected time. If it keeps happening we can investigate. Closing.

Something is wrong with this process, because my transpiler watch process is up to date, yet the transpileAll in the generate API is taking 50+ seconds:

~/phet/root/buoyancy$ time grunt generate-phet-io-api --sims=buoyancy,density,buoyancy-basics
Running "generate-phet-io-api" task
Transpilation took 54388 ms
Generating PhET-iO API for repos: buoyancy, density, buoyancy-basics
[........................................] 100.00%

Done.

real	1m8.232s
user	1m12.295s
sys	0m11.239s
~/phet/root/buoyancy$ time grunt generate-phet-io-api --sims=buoyancy,density,buoyancy-basics
Running "generate-phet-io-api" task
started generate-phet-io-api
starting transpilation
^CTranspilation took 50921 ms

Something appears to be interfering with the caching mechanism. It thinks it needs to re-transpile things that it shouldn't. I'm going to add a Band-Aid, a flag to that tells grunt generate-phet-io-api that it can skip transpiling.

Hasn't happened for a while. Unassigning and hoping to remember this issue next time it's in a buggy state.