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(turbopack_ecmascript): support partial tsconfig for the transform #3995

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

kwonoj
Copy link
Contributor

@kwonoj kwonoj commented Feb 28, 2023

Resolves WEB-667, WEB-659.

This PR allows to specify partial tsconfig (specifically, useDefineForClassFields / legacy decorators for now) into ecmatransform. There are few tsconfig options affect to the runtime output of typescript need to be specified when performing transform, useDefineForClassFields is one of them.

For now, PR attempts to fix test/development/basic/define-class-fields.test.ts / test/development/basic/legacy-decorators.test.ts by enabling one options. .swcrc is still not being honored in this changes.

@vercel
Copy link

vercel bot commented Feb 28, 2023

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

Name Status Preview Comments Updated
turbo-site 🔄 Building (Inspect) Visit Preview Mar 7, 2023 at 6:34PM (UTC)
9 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)
examples-vite-web ⬜️ Ignored (Inspect) Mar 7, 2023 at 6:34PM (UTC)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Go e2e tests

See workflow summary for details

@github-actions
Copy link
Contributor

Benchmark for 6b964fe

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.75ms ± 0.11ms 11.70ms ± 0.04ms -0.39%
bench_hmr_to_commit/Turbopack RCC/1000 modules 14.68ms ± 0.46ms 14.58ms ± 0.18ms -0.70%
bench_hmr_to_commit/Turbopack RSC/1000 modules 514.04ms ± 1.45ms 517.85ms ± 1.64ms +0.74%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.68ms ± 0.12ms 11.65ms ± 0.09ms -0.25%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.73ms ± 0.07ms 10.77ms ± 0.09ms +0.40%
bench_hmr_to_eval/Turbopack RCC/1000 modules 12.96ms ± 0.16ms 13.44ms ± 0.14ms +3.70%
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.69ms ± 0.09ms 10.66ms ± 0.09ms -0.22%
bench_hydration/Turbopack RCC/1000 modules 3888.03ms ± 12.35ms 3871.45ms ± 8.91ms -0.43%
bench_hydration/Turbopack RSC/1000 modules 3524.29ms ± 7.93ms 3543.60ms ± 14.66ms +0.55%
bench_hydration/Turbopack SSR/1000 modules 3407.43ms ± 11.49ms 3401.93ms ± 15.68ms -0.16%
bench_startup/Turbopack CSR/1000 modules 2601.59ms ± 9.01ms 2587.41ms ± 11.60ms -0.54%
bench_startup/Turbopack RCC/1000 modules 2369.77ms ± 8.11ms 2374.46ms ± 7.07ms +0.20%
bench_startup/Turbopack RSC/1000 modules 2329.98ms ± 14.68ms 2317.24ms ± 6.46ms -0.55%
bench_startup/Turbopack SSR/1000 modules 2070.39ms ± 2.47ms 2077.46ms ± 5.02ms +0.34%

@github-actions
Copy link
Contributor

Benchmark for 1eae1dc

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack SSR/1000 modules 9566.05µs ± 102.80µs 10.01ms ± 0.07ms +4.67% +1.12%
bench_hmr_to_eval/Turbopack RCC/1000 modules 11.07ms ± 0.07ms 11.71ms ± 0.22ms +5.77% +0.45%
bench_hydration/Turbopack RCC/1000 modules 3888.74ms ± 17.47ms 3958.60ms ± 10.35ms +1.80% +0.36%
bench_startup/Turbopack CSR/1000 modules 2620.19ms ± 7.95ms 2661.59ms ± 7.28ms +1.58% +0.41%
bench_startup/Turbopack SSR/1000 modules 2091.65ms ± 3.88ms 2118.15ms ± 5.93ms +1.27% +0.33%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 10.05ms ± 0.06ms 9973.20µs ± 28.17µs -0.78%
bench_hmr_to_commit/Turbopack RCC/1000 modules 14.25ms ± 1.01ms 12.93ms ± 0.27ms -9.21%
bench_hmr_to_commit/Turbopack RSC/1000 modules 508.81ms ± 1.65ms 513.60ms ± 2.79ms +0.94%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9566.05µs ± 102.80µs 10.01ms ± 0.07ms +4.67% +1.12%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8799.07µs ± 40.89µs 8696.82µs ± 57.04µs -1.16%
bench_hmr_to_eval/Turbopack RCC/1000 modules 11.07ms ± 0.07ms 11.71ms ± 0.22ms +5.77% +0.45%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8734.44µs ± 59.75µs 8756.78µs ± 50.94µs +0.26%
bench_hydration/Turbopack RCC/1000 modules 3888.74ms ± 17.47ms 3958.60ms ± 10.35ms +1.80% +0.36%
bench_hydration/Turbopack RSC/1000 modules 3611.55ms ± 13.97ms 3631.68ms ± 16.12ms +0.56%
bench_hydration/Turbopack SSR/1000 modules 3419.66ms ± 12.56ms 3451.45ms ± 13.36ms +0.93%
bench_startup/Turbopack CSR/1000 modules 2620.19ms ± 7.95ms 2661.59ms ± 7.28ms +1.58% +0.41%
bench_startup/Turbopack RCC/1000 modules 2393.86ms ± 10.97ms 2415.47ms ± 9.74ms +0.90%
bench_startup/Turbopack RSC/1000 modules 2340.49ms ± 9.51ms 2363.12ms ± 9.30ms +0.97%
bench_startup/Turbopack SSR/1000 modules 2091.65ms ± 3.88ms 2118.15ms ± 5.93ms +1.27% +0.33%

Comment on lines +213 to +214
// Selectively picks up tsconfig.json values to construct
// swc transform's stripconfig. It doesn't account .swcrc config currently.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy paste comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh you're right 🤦

@kwonoj kwonoj added the pr: automerge Kodiak will merge these automatically after checks pass label Mar 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2023

Benchmark for 489e4e3

Test Base PR % Significant %
bench_hydration/Turbopack RCC/1000 modules 3766.03ms ± 10.48ms 3845.48ms ± 10.96ms +2.11% +0.97%
bench_hydration/Turbopack RSC/1000 modules 3416.80ms ± 12.28ms 3469.01ms ± 10.39ms +1.53% +0.20%
bench_startup/Turbopack CSR/1000 modules 2544.52ms ± 6.20ms 2590.31ms ± 7.69ms +1.80% +0.70%
bench_startup/Turbopack SSR/1000 modules 2041.76ms ± 2.85ms 2061.69ms ± 2.33ms +0.98% +0.47%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9068.32µs ± 39.10µs 9065.72µs ± 57.10µs -0.03%
bench_hmr_to_commit/Turbopack RCC/1000 modules 12.94ms ± 0.18ms 12.62ms ± 0.19ms -2.48%
bench_hmr_to_commit/Turbopack RSC/1000 modules 497.54ms ± 1.15ms 498.55ms ± 1.01ms +0.20%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9179.18µs ± 45.88µs 9236.60µs ± 39.24µs +0.63%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8131.86µs ± 25.87µs 8113.13µs ± 25.66µs -0.23%
bench_hmr_to_eval/Turbopack RCC/1000 modules 11.54ms ± 0.20ms 11.37ms ± 0.28ms -1.51%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8207.03µs ± 39.12µs 8281.67µs ± 21.83µs +0.91%
bench_hydration/Turbopack RCC/1000 modules 3766.03ms ± 10.48ms 3845.48ms ± 10.96ms +2.11% +0.97%
bench_hydration/Turbopack RSC/1000 modules 3416.80ms ± 12.28ms 3469.01ms ± 10.39ms +1.53% +0.20%
bench_hydration/Turbopack SSR/1000 modules 3323.12ms ± 12.38ms 3372.52ms ± 13.98ms +1.49%
bench_startup/Turbopack CSR/1000 modules 2544.52ms ± 6.20ms 2590.31ms ± 7.69ms +1.80% +0.70%
bench_startup/Turbopack RCC/1000 modules 2326.44ms ± 7.37ms 2350.05ms ± 10.05ms +1.01%
bench_startup/Turbopack RSC/1000 modules 2282.44ms ± 8.83ms 2292.52ms ± 10.81ms +0.44%
bench_startup/Turbopack SSR/1000 modules 2041.76ms ± 2.85ms 2061.69ms ± 2.33ms +0.98% +0.47%

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2023

Benchmark for 42bb845

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack RSC/1000 modules 492.26ms ± 0.78ms 496.73ms ± 1.13ms +0.91% +0.13%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9256.53µs ± 31.48µs 9479.77µs ± 41.95µs +2.41% +0.82%
bench_hydration/Turbopack RCC/1000 modules 3554.69ms ± 9.48ms 3597.11ms ± 6.17ms +1.19% +0.31%
bench_hydration/Turbopack SSR/1000 modules 3265.88ms ± 6.46ms 3299.10ms ± 6.44ms +1.02% +0.23%
bench_startup/Turbopack CSR/1000 modules 2532.27ms ± 7.42ms 2586.11ms ± 6.01ms +2.13% +1.06%
bench_startup/Turbopack SSR/1000 modules 1997.64ms ± 4.05ms 2019.44ms ± 4.95ms +1.09% +0.19%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9062.03µs ± 42.03µs 9013.09µs ± 35.61µs -0.54%
bench_hmr_to_commit/Turbopack RCC/1000 modules 13.16ms ± 0.13ms 13.31ms ± 0.11ms +1.13%
bench_hmr_to_commit/Turbopack RSC/1000 modules 492.26ms ± 0.78ms 496.73ms ± 1.13ms +0.91% +0.13%
bench_hmr_to_commit/Turbopack SSR/1000 modules 9256.53µs ± 31.48µs 9479.77µs ± 41.95µs +2.41% +0.82%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8024.42µs ± 43.27µs 8027.63µs ± 38.32µs +0.04%
bench_hmr_to_eval/Turbopack RCC/1000 modules 11.77ms ± 0.16ms 11.80ms ± 0.19ms +0.21%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8228.83µs ± 62.83µs 8351.81µs ± 29.81µs +1.49%
bench_hydration/Turbopack RCC/1000 modules 3554.69ms ± 9.48ms 3597.11ms ± 6.17ms +1.19% +0.31%
bench_hydration/Turbopack RSC/1000 modules 3169.82ms ± 14.68ms 3217.84ms ± 14.73ms +1.51%
bench_hydration/Turbopack SSR/1000 modules 3265.88ms ± 6.46ms 3299.10ms ± 6.44ms +1.02% +0.23%
bench_startup/Turbopack CSR/1000 modules 2532.27ms ± 7.42ms 2586.11ms ± 6.01ms +2.13% +1.06%
bench_startup/Turbopack RCC/1000 modules 2075.83ms ± 3.75ms 2082.04ms ± 5.01ms +0.30%
bench_startup/Turbopack RSC/1000 modules 1997.74ms ± 5.54ms 2004.88ms ± 9.71ms +0.36%
bench_startup/Turbopack SSR/1000 modules 1997.64ms ± 4.05ms 2019.44ms ± 4.95ms +1.09% +0.19%

@kwonoj kwonoj merged commit f25752b into main Mar 7, 2023
@kwonoj kwonoj deleted the feat-ts-config-transform branch March 7, 2023 20:15
mehulkar pushed a commit that referenced this pull request Mar 7, 2023
#3995)

Resolves WEB-667, WEB-659.

This PR allows to specify partial tsconfig (specifically,
`useDefineForClassFields` / legacy decorators for now) into
ecmatransform. There are few tsconfig options affect to the runtime
output of typescript need to be specified when performing transform,
useDefineForClassFields is one of them.

For now, PR attempts to fix
`test/development/basic/define-class-fields.test.ts` /
`test/development/basic/legacy-decorators.test.ts` by enabling one
options. .swcrc is still not being honored in this changes.
Comment on lines +144 to +155
let tsconfig = find_context_file(source.ident().path(), tsconfig());
let tsconfig = match *tsconfig.await? {
FindContextFileResult::Found(path, _) => Some(
read_tsconfigs(
path.read(),
SourceAssetVc::new(path).into(),
node_cjs_resolve_options(path.root()),
)
.await?,
),
FindContextFileResult::NotFound(_) => None,
};
Copy link
Member

Choose a reason for hiding this comment

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

This causes a lot of errors in front as tsconfig in node_modules is read:

  C:\Repos\front\apps\vercel-site\node_modules\.pnpm\@vercel+analytics@0.1.9-beta.3_react@18.2.0\node_modules\@vercel\analytics\tsconfig.json
    An issue occurred while parsing a tsconfig.json file.
    extends doesn't resolve correctly

A tsconfig shouldn't be read in parse

kwonoj added a commit that referenced this pull request Mar 7, 2023
kwonoj added a commit that referenced this pull request Mar 8, 2023
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
vercel/turborepo#3995)

Resolves WEB-667, WEB-659.

This PR allows to specify partial tsconfig (specifically,
`useDefineForClassFields` / legacy decorators for now) into
ecmatransform. There are few tsconfig options affect to the runtime
output of typescript need to be specified when performing transform,
useDefineForClassFields is one of them.

For now, PR attempts to fix
`test/development/basic/define-class-fields.test.ts` /
`test/development/basic/legacy-decorators.test.ts` by enabling one
options. .swcrc is still not being honored in this changes.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
vercel/turborepo#3995)

Resolves WEB-667, WEB-659.

This PR allows to specify partial tsconfig (specifically,
`useDefineForClassFields` / legacy decorators for now) into
ecmatransform. There are few tsconfig options affect to the runtime
output of typescript need to be specified when performing transform,
useDefineForClassFields is one of them.

For now, PR attempts to fix
`test/development/basic/define-class-fields.test.ts` /
`test/development/basic/legacy-decorators.test.ts` by enabling one
options. .swcrc is still not being honored in this changes.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
vercel/turborepo#3995)

Resolves WEB-667, WEB-659.

This PR allows to specify partial tsconfig (specifically,
`useDefineForClassFields` / legacy decorators for now) into
ecmatransform. There are few tsconfig options affect to the runtime
output of typescript need to be specified when performing transform,
useDefineForClassFields is one of them.

For now, PR attempts to fix
`test/development/basic/define-class-fields.test.ts` /
`test/development/basic/legacy-decorators.test.ts` by enabling one
options. .swcrc is still not being honored in this changes.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
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.

3 participants