Consolidate JavaScript Flavors #1433

Closed
NickGerleman wants to merge 14 commits from consolidate-js-flavors into main
NickGerleman commented 2023-10-19 05:00:03 -07:00 (Migrated from github.com)

Fixes https://github.com/facebook/yoga/issues/1417

This dramatically simplifies the matrix of Node vs web, ASM vs WASM, sync vs async compilation, or CommonJS vs ES Modules. We have one variant, using wasm, with ESModule top-level await to do async compilation. Web/node share the same binary, and we base64 encode the WASM into a wrapper JS file for compatibility with Node and bundlers.

This has some downsides, like requiring an environment with top level await, but also has upsides, like a consistent, sync looking API compatible with older Yoga, and mitigating TypeScript issues with package exports and typings resolution.

As part of this work I also removed ts-node from the toolchain (at the cost of a couple of config files needing to be vanilla JS).

Test Plan

  1. yarn test
  2. yarn lint
  3. yarn tsc
  4. yarn benchmark
  5. yarn build website-next
  6. yarn lint website-next
  7. Locally test website-next
  8. Examine package artifact created by GitHub
  9. All Automation passes
Fixes https://github.com/facebook/yoga/issues/1417 This dramatically simplifies the matrix of Node vs web, ASM vs WASM, sync vs async compilation, or CommonJS vs ES Modules. We have one variant, using wasm, with ESModule top-level await to do async compilation. Web/node share the same binary, and we base64 encode the WASM into a wrapper JS file for compatibility with Node and bundlers. This has some downsides, like requiring an environment with top level await, but also has upsides, like a consistent, sync looking API compatible with older Yoga, and mitigating TypeScript issues with package exports and typings resolution. As part of this work I also removed `ts-node` from the toolchain (at the cost of a couple of config files needing to be vanilla JS). ## Test Plan 1. `yarn test` 2. `yarn lint` 3. `yarn tsc` 4. `yarn benchmark` 5. `yarn build` website-next 6. `yarn lint` website-next 7. Locally test website-next 8. Examine package artifact created by GitHub 9. All Automation passes
facebook-github-bot commented 2023-10-19 05:11:25 -07:00 (Migrated from github.com)

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D50453324).
facebook-github-bot commented 2023-10-19 05:15:59 -07:00 (Migrated from github.com)

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D50453324).
facebook-github-bot commented 2023-10-19 18:38:11 -07:00 (Migrated from github.com)

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D50453324).
facebook-github-bot commented 2023-10-19 19:28:31 -07:00 (Migrated from github.com)

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D50453324).
facebook-github-bot commented 2023-10-20 17:03:21 -07:00 (Migrated from github.com)

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D50453324).
facebook-github-bot commented 2023-10-31 20:45:01 -07:00 (Migrated from github.com)

@NickGerleman merged this pull request in facebook/yoga@ef1d772447.

@NickGerleman merged this pull request in facebook/yoga@ef1d772447c53266f57263e96420e24536b38d5d.

Pull request closed

Sign in to join this conversation.
No description provided.