-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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(turbopack-ecmascript): accept transform plugin in moduleoptioncontext #4721
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
7 Ignored Deployments
|
✅ This change can build |
🟢 CI successful 🟢Thanks |
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
April 27, 2023 22:07
3fc3a54
to
50740b9
Compare
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
April 28, 2023 02:10
50740b9
to
124e880
Compare
kwonoj
commented
Apr 28, 2023
use turbopack_ecmascript::{CustomTransformer, TransformContext}; | ||
|
||
#[derive(Debug)] | ||
pub struct RelayTransformer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decide to move this transform into turbopack side, as it is possible turbopack standalone might need this transform as well.
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
April 28, 2023 18:07
124e880
to
93926c6
Compare
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
May 1, 2023 15:54
93926c6
to
475eb91
Compare
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
May 2, 2023 16:40
475eb91
to
16fbdb8
Compare
sokra
requested changes
May 2, 2023
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
May 2, 2023 18:13
16fbdb8
to
1311b2d
Compare
kwonoj
force-pushed
the
module-option-custom-transform
branch
from
May 9, 2023 00:26
a979895
to
2d430e9
Compare
jridgewell
approved these changes
May 9, 2023
kwonoj
added
pr: automerge
Kodiak will merge these automatically after checks pass
and removed
pr: automerge
Kodiak will merge these automatically after checks pass
labels
May 9, 2023
kwonoj
added
the
pr: automerge
Kodiak will merge these automatically after checks pass
label
May 9, 2023
NicholasLYang
pushed a commit
to NicholasLYang/turbo
that referenced
this pull request
May 9, 2023
…ntext (vercel#4721) ### Description - Relates with WEB-955, WEB-848. This PR is a part of implementing WEB-848, supporting relay graphql transform in next.js. Historically we've been expanding `ModuleOptionContext` to have each own config (`enable_mdx`, `enable_emotion`...) but with new CustomTransformPlugin we can pass actual transforms instead, what WEB-955 aims. PR introduces new config option `custom_ecma_transform_plugins` to the ModuleOptionContext to support it. `custom_ecma_transform_plugins` is a struct have two fields, `before` / `after` which allows to specify order of custom transforms if it should be invoked _before_ any core transform kicks in, or otherwise. This effectively deprecates existing options, notably `custom_ecmascript_transforms` and `custom_ecmascript_app_transforms`. It is currently not actively being used (next-swc have 2 places utilizing `custom_ecmascript_transforms`), we can consolidate to the new option instead. One another notable change is customtransformer's transform is now async fn. It is due to `TransformContext` have couple of `Vc` properties, that cannot be accessed in a sync transform fn. Refer counterpart next.js PR (https://github.com/vercel/next.js/pull/48899/files#diff-c0df3b5a390436575f35365774b078cb5303ef395b064b8992dfdd7dba8f3691) as ref.
ijjk
added a commit
to vercel/next.js
that referenced
this pull request
May 9, 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 Part 1 for WEB-848. This PR implements initial path to enable relay compiler option in Turbopack. PR is based on approach WEB-955, that passing custom plugin transform itself instead of trying to pass down configuration into turbopack. In result, this PR requires counterpart turbopack PR at vercel/turborepo#4721. PR also refactors next-shared's transform bit, as we have grown number of custom transforms. Unfortunately there are some runtime errors with this transforms, so it is not possible to use relay actually yet. WEB-956 tracks this. (swc-project/plugins#179) --------- Co-authored-by: Tobias Koppers <[email protected]> Co-authored-by: JJ Kasper <[email protected]>
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Jul 25, 2024
…ntext (vercel/turborepo#4721) ### Description - Relates with WEB-955, WEB-848. This PR is a part of implementing WEB-848, supporting relay graphql transform in next.js. Historically we've been expanding `ModuleOptionContext` to have each own config (`enable_mdx`, `enable_emotion`...) but with new CustomTransformPlugin we can pass actual transforms instead, what WEB-955 aims. PR introduces new config option `custom_ecma_transform_plugins` to the ModuleOptionContext to support it. `custom_ecma_transform_plugins` is a struct have two fields, `before` / `after` which allows to specify order of custom transforms if it should be invoked _before_ any core transform kicks in, or otherwise. This effectively deprecates existing options, notably `custom_ecmascript_transforms` and `custom_ecmascript_app_transforms`. It is currently not actively being used (next-swc have 2 places utilizing `custom_ecmascript_transforms`), we can consolidate to the new option instead. One another notable change is customtransformer's transform is now async fn. It is due to `TransformContext` have couple of `Vc` properties, that cannot be accessed in a sync transform fn. Refer counterpart next.js PR (https://github.com/vercel/next.js/pull/48899/files#diff-c0df3b5a390436575f35365774b078cb5303ef395b064b8992dfdd7dba8f3691) as ref.
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Jul 29, 2024
…ntext (vercel/turborepo#4721) ### Description - Relates with WEB-955, WEB-848. This PR is a part of implementing WEB-848, supporting relay graphql transform in next.js. Historically we've been expanding `ModuleOptionContext` to have each own config (`enable_mdx`, `enable_emotion`...) but with new CustomTransformPlugin we can pass actual transforms instead, what WEB-955 aims. PR introduces new config option `custom_ecma_transform_plugins` to the ModuleOptionContext to support it. `custom_ecma_transform_plugins` is a struct have two fields, `before` / `after` which allows to specify order of custom transforms if it should be invoked _before_ any core transform kicks in, or otherwise. This effectively deprecates existing options, notably `custom_ecmascript_transforms` and `custom_ecmascript_app_transforms`. It is currently not actively being used (next-swc have 2 places utilizing `custom_ecmascript_transforms`), we can consolidate to the new option instead. One another notable change is customtransformer's transform is now async fn. It is due to `TransformContext` have couple of `Vc` properties, that cannot be accessed in a sync transform fn. Refer counterpart next.js PR (https://github.com/vercel/next.js/pull/48899/files#diff-c0df3b5a390436575f35365774b078cb5303ef395b064b8992dfdd7dba8f3691) as ref.
ForsakenHarmony
pushed a commit
to vercel/next.js
that referenced
this pull request
Aug 1, 2024
…ntext (vercel/turborepo#4721) ### Description - Relates with WEB-955, WEB-848. This PR is a part of implementing WEB-848, supporting relay graphql transform in next.js. Historically we've been expanding `ModuleOptionContext` to have each own config (`enable_mdx`, `enable_emotion`...) but with new CustomTransformPlugin we can pass actual transforms instead, what WEB-955 aims. PR introduces new config option `custom_ecma_transform_plugins` to the ModuleOptionContext to support it. `custom_ecma_transform_plugins` is a struct have two fields, `before` / `after` which allows to specify order of custom transforms if it should be invoked _before_ any core transform kicks in, or otherwise. This effectively deprecates existing options, notably `custom_ecmascript_transforms` and `custom_ecmascript_app_transforms`. It is currently not actively being used (next-swc have 2 places utilizing `custom_ecmascript_transforms`), we can consolidate to the new option instead. One another notable change is customtransformer's transform is now async fn. It is due to `TransformContext` have couple of `Vc` properties, that cannot be accessed in a sync transform fn. Refer counterpart next.js PR (https://github.com/vercel/next.js/pull/48899/files#diff-c0df3b5a390436575f35365774b078cb5303ef395b064b8992dfdd7dba8f3691) as ref.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is a part of implementing WEB-848, supporting relay graphql transform in next.js. Historically we've been expanding
ModuleOptionContext
to have each own config (enable_mdx
,enable_emotion
...) but with new CustomTransformPlugin we can pass actual transforms instead, what WEB-955 aims.PR introduces new config option
custom_ecma_transform_plugins
to the ModuleOptionContext to support it.custom_ecma_transform_plugins
is a struct have two fields,before
/after
which allows to specify order of custom transforms if it should be invoked before any core transform kicks in, or otherwise.This effectively deprecates existing options, notably
custom_ecmascript_transforms
andcustom_ecmascript_app_transforms
. It is currently not actively being used (next-swc have 2 places utilizingcustom_ecmascript_transforms
), we can consolidate to the new option instead.One another notable change is customtransformer's transform is now async fn. It is due to
TransformContext
have couple ofVc
properties, that cannot be accessed in a sync transform fn. Refer counterpart next.js PR (https://github.com/vercel/next.js/pull/48899/files#diff-c0df3b5a390436575f35365774b078cb5303ef395b064b8992dfdd7dba8f3691) as ref.