Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating API files causes unexpected babel work in unrelated repos #1439

Open
matthew-blackman opened this issue Apr 22, 2024 · 7 comments

Comments

@matthew-blackman
Copy link
Contributor

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.

@matthew-blackman matthew-blackman assigned samreid and zepumph and unassigned samreid Apr 22, 2024
@zepumph
Copy link
Member

zepumph commented Apr 22, 2024

It is curious why we have any babel code running. I'll take a look.

https://stackoverflow.com/questions/29576341/what-does-the-code-generator-has-deoptimised-the-styling-of-some-file-as-it-e

@samreid
Copy link
Member

samreid commented Apr 23, 2024

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

@zepumph
Copy link
Member

zepumph commented Apr 25, 2024

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

transpiler.transpileAll();

@samreid
Copy link
Member

samreid commented Apr 29, 2024

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.

@samreid samreid closed this as completed Apr 29, 2024
@samreid
Copy link
Member

samreid commented May 8, 2024

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

@samreid
Copy link
Member

samreid commented May 8, 2024

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.

@samreid
Copy link
Member

samreid commented May 13, 2024

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

@samreid samreid removed their assignment May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants