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

feat(ecma-plugins): extract custom emotion transform #4662

Merged
merged 5 commits into from
Apr 26, 2023

Conversation

kwonoj
Copy link
Contributor

@kwonoj kwonoj commented Apr 21, 2023

Description

First step for WEB-940.

Context: https://vercel.slack.com/archives/C03EWR7LGEN/p1681789689115509

Currently all of the ecma transforms are explicitly listed under EcmaInputTransform in turbopack-ecmascript. This makes enum verbose, we have to manually expand it each time adding new transform, as well as turbopack-ecmascript gets larger to contain all of the 3rd party transforms by default.

PR extracts non-core transforms into a new crate, named as ecmascript-plugins then utilize EcmaInputTransform::Custom to invoke transforms instead. EcmaInputTransform::Custom is renamed to EcmaInputTransform::Plugin as well. Goal is extracting all of 3rd party / non-core transforms. This also reduces multiple steps to construct option value between caller (next-*) to actual transform (swcOptions).

vercel/next.js#48671 have corresponding next.js changes.

@vercel
Copy link

vercel bot commented Apr 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-designsystem-docs 🔄 Building (Inspect) Apr 26, 2023 5:49am
examples-tailwind-web 🔄 Building (Inspect) Apr 26, 2023 5:49am
9 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-cra-web ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-gatsby-web ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-native-web ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-nonmonorepo ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-svelte-web ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
examples-vite-web ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am
turbo-site ⬜️ Ignored (Inspect) Apr 26, 2023 5:49am

@github-actions
Copy link
Contributor

✅ This change can build next-swc

@kwonoj kwonoj force-pushed the refactor-custom-transform branch 3 times, most recently from c30db65 to f9be8cc Compare April 21, 2023 03:06
@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2023

🟢 CI successful 🟢

Thanks

@kwonoj kwonoj force-pushed the refactor-custom-transform branch 4 times, most recently from 76012ad to 7f0a798 Compare April 21, 2023 14:47
@kwonoj kwonoj changed the title [DONOTMERGE] WIP feat(ecma-plugins): extract custom emotion transform Apr 21, 2023
@kwonoj kwonoj force-pushed the refactor-custom-transform branch 2 times, most recently from 6af81c1 to 8d6d6fe Compare April 21, 2023 15:20
@kwonoj kwonoj marked this pull request as ready for review April 21, 2023 15:30
@kwonoj kwonoj requested review from a team as code owners April 21, 2023 15:30
Comment on lines +104 to 108
if let Some(transformer) = build_emotion_transformer(enable_emotion).await? {
transforms.push(EcmascriptInputTransform::Plugin(TransformPluginVc::cell(
transformer,
)));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Eventually) enable_emotion should be removed from the ModuleOptionsContext and passed as custom_ecmascript_transforms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes more sense.

@kwonoj kwonoj added the pr: automerge Kodiak will merge these automatically after checks pass label Apr 26, 2023
@kodiakhq kodiakhq bot merged commit bef88f9 into main Apr 26, 2023
45 checks passed
@kodiakhq kodiakhq bot deleted the refactor-custom-transform branch April 26, 2023 06:42
sokra pushed a commit to vercel/next.js that referenced this pull request Apr 26, 2023
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change


### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

This PR is necessary changes to apply
vercel/turbo#4662. Need turbopack bump to make
CI pass.

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants