Commit Graph

1409 Commits

Author SHA1 Message Date
Donny/강동윤 adc94b49d4 feat: Report correct errors for missing use client in global-errors.ts (#69583)
### What?

Adjust regex for file name which is used for linting.


### Why?

We should apply same validation as `error.ts` to `global-error.ts`

### How?

Closes PACK-2977
Fixes https://github.com/vercel/next.js/issues/64452
2024-09-03 18:29:46 +09:00
Tim Neutkens 66e4477182 Rename trace.log -> trace-turbopack to match .next/trace (#69447)
This matches the Turbopack trace file naming and location with the
Next.js trace file.

Uses the `trace-` format to ensure the files get grouped together.

<!-- 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

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating 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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2024-08-29 19:55:49 +02:00
lichu acuña 9720d0adc0 Add module id strategy option to next config (#69319)
Adds a `experimental.turbo.moduleIdStrategy` field to `next.config.js`
to configure what module ID generation strategy to use.

`'named'` assigns readable module IDs based on the module's path and
functionality.

`'deterministic'` assigns small hashed numeric module IDs.

If not set, Turbopack will use `'named'` for development builds and
`'deterministic'` for production builds.
2024-08-28 17:24:45 -07:00
Josh Story b305c2d309 Introduce dynamicIO experiment (#67571)
`nextConfig.experimental.dynamicIO: boolean` is a new experimental flag
that changes the static generation bailout heuristic and PPR postpone
heuristic to exclude async work that is not resolvable in the current
Task's microtask queue from prerenders. functionally it means that in
this mode fetches and db queries will now not be prerenderable unless
you opt into it with a caching API like `unstable_cache()` or the fetch
`cache: 'force-cache'` option.
2024-08-28 17:18:30 -07:00
Donny/강동윤 992103fc0f build: Update swc_core to v0.102.0 (#69389)
### What?

Update `swc_core`.

### Why?

This update is required to use the name mangler cache, which was
recently implemented in SWC.



### How?

Closes PACK-3222
2024-08-28 19:43:00 +00:00
lichu acuña 69c2d0c4f7 Fix next server component modules in graph traversal (#69157)
Next entry modules with the "client modules" or "client modules ssr" modifiers were not being reached by graph traversal. Now they are.
2024-08-27 16:07:59 -07:00
Benjamin Woodruff 0e0fc718c4 chore(turbopack): Delete dead code in next_core::{app,pages}_structure (#69387)
These functions were either public and/or mutually recursive, preventing
rustc's dead code analysis from finding them.

```
cargo check
cargo check --tests
```
2024-08-27 15:26:43 -07:00
Benjamin Woodruff 169c8fed7b fix(turbopack): Store minimumCacheTTL as a u64 (#69379)
Fixes (part of) #69330

We were using a `u32` here instead of a `u64` for no good reason.

The workaround if you're encountering this is to just use `u32::MAX`
instead, which should be large enough for all practical purposes:
`4294967295`.

## Test Plan

Build turbopack in the next.js repo:

```
pnpm pack-next
```

Follow the repro in #69330:

```
git clone https://github.com/Enkratia/css-reload-show-2.git
# edit the package.json following the instructions from `pnpm pack-next` above
rm package-lock.json
pnpm i
pnpm dev --turbo
```

## Integration Testing?

There are some tests in
`test/integration/image-optimizer/test/index.test.ts`, but I didn't see
the obviously best way to test this, as most of those tests are looking
for errors by scanning stderr, and this is about not generating any
error.

Either way, I think this is very unlikely to regress.
2024-08-27 11:25:20 -07:00
Jiachi Liu d21fc56940 Revert "Fix action loader modules in graph traversal" (#69359) 2024-08-27 12:56:13 +02:00
lichu acuña 7a5b0083b5 Fix action loader modules in graph traversal (#69154)
Action loader modules were not being reached by the module graph traversal. Now they are.
2024-08-26 22:53:17 -07:00
Donny/강동윤 5888bb902b fix: Allow guarded usage of node.js APIs from edge runtime (#69283)
### What?

Improve the node.js linter

### Why?

It should not warn for _safe_ usage.

x-ref: https://vercel.slack.com/archives/C04DUD7EB1B/p1724522593235339

### How?
2024-08-26 18:25:58 +09:00
Niklas Mischkulnig b1e32c5d1f Turbopack: reapply typeof module replacement (#69158)
Reapply #68842 after it was reverted in
https://github.com/vercel/next.js/pull/69156

Now it should really only do it if it's really not an ESM module (= CJS)

The replacement now has the same condition as used when Turbopack
determines whether a given module should get access to `module`:


https://github.com/vercel/next.js/blob/161cd00c7bc91e9dc29842427af0cc6f810267bb/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs#L51


https://github.com/vercel/next.js/blob/161cd00c7bc91e9dc29842427af0cc6f810267bb/turbopack/crates/turbopack-ecmascript/src/lib.rs#L880-L881
2024-08-24 10:10:55 +02:00
lichu acuña 15c086c120 Moved global_module_id_strategy.rs to turbopack-ecmascript crate to avoid circularities (#69075)
<!-- 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

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Adding or Updating 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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2024-08-23 16:51:02 -07:00
lichu acuña de9a00d2d6 Add support for Instrumentation and Middleware in global module ID optimization (#68993)
<!-- 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

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Adding or Updating 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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2024-08-23 15:12:37 -07:00
lichu acuña 957b5fb5fa Exhaustive modules graph traversal (#68865)
### What?
Improves the traversal of the module graph by doing a more exhaustive search of the children modules, thus increasing the "hit rate" for optimized module IDs (which should be 100%).

### Why?
Some structs that implement the `Module` trait return an empty list in the `references` method, but still "own" some child modules. This is the case of `EcmascriptClientReferenceModule`, for example, which returns empty in `references` but owns a `client_module` and an `ssr_module`. These modules are ignored when traversing the module graph with the `get_referenced_modules` function we used before, so neither they nor their children are ever assigned an optimized ID.

### How?
To solve this, a `children_modules` method is added to the `Module` trait, which should exhaustively return all direct children of the module. The function defaults to `primary_referenced_modules`, which simply calls `references`, but structs like `EcmascriptClientReferenceModule` can reimplement it and return "hidden" children modules like the aforementioned `client_module` and `ssr_module`.
2024-08-23 14:55:35 -07:00
lichu acuña 9ecd1a2b2f Refactored module IDs optimization (#68846)
### What?

Refactored module ID strategies implementation to walk modules graph individually for each endpoint.

Based on feedback from [next.js#68408](https://github.com/vercel/next.js/pull/68408) and [turbo#8912](https://github.com/vercel/turbo/pull/8912).

Comments marked with `NOTE(LichuAcu)` are intended to make reviewing easier and will be removed before merging.
2024-08-23 14:33:39 -07:00
Donny/강동윤 0a2449e5b7 feat(turbopack): Add lint for node.js imports from edge (#69171)
### What?

Implement a lint for imports from node.js internal modules.

### Why?

It will not work on runtime because edge runtime does not have such
modules.

x-ref:
https://vercel.slack.com/archives/C04KC8A53T7/p1724310187996899?thread_ts=1723669243.397119&cid=C04KC8A53T7

### How?


Closes PACK-3216
2024-08-23 09:54:30 +02:00
Shu Ding 1face6e6e0 Improve SWC transform ID generation (#69183)
This adds an extra `hash_salt` option to the Server Actions transform's
`generate_action_id` method which defaults to empty for now (so no
actual behavior changes). When set, the salt will be used to prefix the
payload.
2024-08-22 23:07:05 +02:00
Niklas Mischkulnig a8ab74ad9a Revert "Add Effect:TypeOf and give typeofs ... #68842)" (#69156)
Reverts https://github.com/vercel/next.js/pull/68842
2024-08-21 18:57:25 +00:00
Niklas Mischkulnig 0ac10d7972 Turbopack: fix issue source location for special exports (#69132)
Before:
```
 ✓ Compiled / in 2.4s
 ⚠ ./bench/basic-app/app/page.js:7:25
Unable to parse config export in source file1
  5 | }
  6 |
> 7 | export const dynamic = 'force-dynamicc'
    |                         ^^^^^^^^^^^^^^^
> 8 |
    | ^
```

After:
```
 ⚠ ./bench/basic-app/app/page.js:7:24
Unable to parse config export in source file1
  5 | }
  6 |
> 7 | export const dynamic = 'force-dynamicc'
    |                        ^^^^^^^^^^^^^^^^
  8 |
```
2024-08-21 10:47:37 +02:00
Donny/강동윤 0a3fa759a9 build: Update swc_core to v0.101.3 (#69039)
This reverts commit 4c33361f4c.


### What?

 - Reverts https://github.com/vercel/next.js/pull/68978
 - Re-apply https://github.com/vercel/next.js/pull/68560

### Why?

The bug of `Evaluator` is fixed.

### How?
2024-08-20 22:44:27 +02:00
hrmny aa90fe9bb7 fix(turbopack): correctly handle catchall specificity (#68800)
(generated by graphite)

### What?

Introduce `get_specificity` method to determine the specificity of
routes.
This facilitates more accurate route matching for catchall routes by
comparing route specificity.
Modify existing route matching logic to incorporate specificity checks
and avoid route conflicts.
Add corresponding tests to validate the new specificity handling
mechanism.

Fixes #67045
Closes PACK-3154
2024-08-20 18:07:28 +02:00
Donny/강동윤 2524ae035e fix: Move tree shaking config to experimental.turbo (#69050)
### What?

Move `experimental.treeShaking` to `experimental.turbo.treeShaking` in Rust code.

### Why?

To disable it, we need to keep config schema and Rust types in sync.

### How?
2024-08-20 19:01:31 +09:00
hrmny be0c32835b fix(turbopack): don't error on dynamic imports in postcss config (#68795)
### What?
We should still serve pages even if we can't statically analyze all
imports.

### Why?

### How?


Closes PACK-3116
Fixes #66602
2024-08-19 22:02:03 +02:00
Donny/강동윤 cc079c822d feat: Port edge assert plugin to turbopack (#69041)
### What?

Port `MiddlewarePlugin` to turbopack

### Why?

To make turbopack behave identically to webpack mode.

### How?

Closes PACK-3196
2024-08-19 12:52:09 +00:00
Niklas Mischkulnig 6266149474 Add Effect:TypeOf and give typeofs user-defineable names (#68842)
This is effectively an optimization to make Webpack UMD modules work
better by short circuiting and not even looking at the unused branches
(e.g. AMD)

Closes PACK-2983
2024-08-19 10:07:58 +02:00
hrmny 74b8943ee3 perf(turbopack): improve app structure performance (#67397)
### What?

Improves the performance of loader tree creation.

The main change is `directory_tree_to_loader_tree` now being completely
synchronous (ignoring the setup).
This improves performance a lot (at least for the initial build), as
it's a recursive function, which was cached at every level before.
It also makes querying the loader tree easier, as not everything needs
to be an async turbo tasks function now.


#### `get_entrypoints` Performance
|                | Initial         | Update |
| --------- | ---------- | ------- |
| `canary` | `1300ms` | `20ms` |
| PR           | `260ms`  | `50ms` |
2024-08-16 17:00:29 +02:00
Niklas Mischkulnig b06c2e0c71 Lookup alias and import maps using Pattern instead of String (#68274)
Including https://github.com/vercel/turbo/pull/8852
Fixes https://github.com/vercel/next.js/issues/63372
Fixes PACK-2801

- [x] Change `RequestKey` handling:
https://github.com/vercel/turbo/pull/8852#issuecomment-2258241284
- [x] Fix lookup for alternatives:
https://github.com/vercel/turbo/pull/8852#discussion_r1698143881
2024-08-16 16:45:02 +02:00
Donny/강동윤 4c33361f4c Revert "Update swc_core to v0.100.6 (#68560)" (#68978)
### What?

Revert swc_core upgrade, as it has a bug related to `styled_jsx`
transform.

Wasm plugin version runs after the TypeScript pass so it works, but
custom transform (next-swc) runs before the typescript pass so it
breaks.

### Why?

It broke some apps.

### How?
2024-08-16 13:17:14 +00:00
Donny/강동윤 c823dd09c7 Update swc_core to v0.100.6 (#68560)
### What?

Update SWC crates to
https://github.com/swc-project/swc/commit/ed635ce91086f2eb00644bbca036ca686f035dbe

### Why?

To keep in sync.

### How?
2024-08-16 16:17:59 +09:00
Benjamin Woodruff be94eda356 refactor(turbo-tasks): Use an enum for strongly_consistent/ReadConsistency instead of a bool (#68913)
This should be completely equivalent. Double checked the diff and made sure that the conversions from `true`/`false` to `ReadConsistency::Strong`/`ReadConsistency::Eventual` are correct.

## Why?

Without keyword arguments in the language, boolean arguments can be hard to read. Inlay hints and type-signature-on-hover with rust-analyzer help, but it's more obvious what these do if they use a clearly labeled enum.

E.g. discussion: https://www.reddit.com/r/rust/comments/bm6s3t/rust_patterns_enums_instead_of_booleans/

Unlike my other change from a bool to an enum in #68866, I don't expect that we'd ever introduce more levels of read consistency than eventual and strong, so this PR is only about readability.
2024-08-15 16:44:19 -07:00
rubyisrust 8d6632ccfa chore: fix typos in code comments (#68792)
Signed-off-by: rubyisrust <rustrover@icloud.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2024-08-15 10:53:37 -05:00
Shu Ding 4b47e00ec8 Generic typo detection in RSC directives (#68890)
This PR changes the Server Actions SWC transform, to instead of having a
hard coded list of
`"use server"` directive typos we use a O(len) algorithm to detect
possible mistakes in the directive name. Note that the previous
`.iter()` approach is also theoretically slower O(n * len).

This was cherry-picked from a larger change which will later make this
transform more general and support different directive names (via
configurations).
2024-08-14 14:29:11 +00:00
Niklas Mischkulnig ff339bbfb0 Include versions in externals error message (#68871)
Now the expected and actual version numbers are included in the error
message:
```
Package @libsql/client (serverExternalPackages or default list) can't be external
The request @libsql/client matches serverExternalPackages (or the default list), but it can't be external:
The package resolves to a different version when requested from the project directory (0.9.0) compared to the package requested from the importing module (0.6.2).
Make sure to install the same version of the package in both locations.
```
2024-08-14 13:24:58 +02:00
Tim Neutkens fa620e2f16 Turbopack dev/build: Ensure serverExternalPackages applies to instrumentation.ts (#68835)
## What?

After the fix in #68788 there was a report that the change doesn't
resolve the problem, turns out that's because it was importing the
package in `instrumentation.ts`.

I found that `serverExternalPackages` didn't apply to
`instrumentation.ts` in Turbopack, this PR fixes that.

Fixes
https://github.com/vercel/next.js/issues/68101#issuecomment-2285814582

<!-- 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

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating 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

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2024-08-13 12:53:30 +02:00
Hendrik Liebau abf12f851a Use proper react release channel for react-dom/static aliases (#68663)
Now that `react-dom/static` is also available outside of the
experimental channel, we don't need to hard-code the react release
channel in the bundle aliases anymore.

Without this fix, `react-dom` would end up twice in our non-experimental
server runtime bundles with the changes in #68637.

<img width="1479" alt="react-dom twice in bundle"
src="https://github.com/user-attachments/assets/ed50e9ec-b984-496b-92e1-69515f2afbc8">
2024-08-08 12:40:49 +02:00
Donny/강동윤 2cee0de01f feat(turbopack): Allow type-only import of usePathname (#68643)
### What?

Type-only imports of `usePathaname` from server components are fine.

### How?

Closes PACK-3186
2024-08-08 16:23:47 +09:00
Jiachi Liu 9568a4f876 Fix favicon merging with customized icons (#67982)
### What

Support merging the static metadata file conventions `favicon.ico` with
other customized metadata icon from the module export.


### Why

`favicon.ico` should be displayed everywhere as it's the icon
representative of the website for all pages. Any customized `icon` in
metadata export `export const metadata` or `export function
generateMetadata()` shouldn't override the `favicon.ico` file
convention.


Fixes #55767

---------

Co-authored-by: hrmny <8845940+ForsakenHarmony@users.noreply.github.com>
2024-08-07 18:36:23 +02:00
Donny/강동윤 fe4797ea00 refactor(turbopack): Remove cast to EcmascriptModuleAsset (#68427)
### What?

Now we have tree shaking implementation but it uses
`EcmascriptModulePartAsset` as the module type. So casting to
`EcmascriptModuleAsset` can break the tree shaking.

This PR also removes `special exports` of turbopack, which is
cumbersome. The previous analysis logic for those special exports may
depend on the value being `EcmascriptModuleAsset`, which is resolved in
this PR.

### Why?

Clean code & for future woork.


### How?

Closes PACK-3175
2024-08-06 10:36:26 +00:00
Will Binns-Smith dc61b7c8ae ast-grep lint fix: don’t call variables context (#68550)
This updates the remaining cases where we were using the generic
`context` name for variables, field names, etc.

It also adds an `.ignore` file to prevent files like the non-text
`broken.js` from being read by these kinds of tools. This is separate
from `.gitignore`.
2024-08-06 11:57:46 +02:00
Niklas Mischkulnig b679ac8fa7 Don't throw TurbopackInternalError if there are issues (#68529)
Previously, the error message shown here was `An unexpected Turbopack
error occurred. Please report the content of ...`

Closes PACK-3182
2024-08-06 11:28:23 +02:00
Alexander Lyon cc7b9e6e0b only perform VersionedContentMap bookkeeping in dev (#68445)
### What?

We have a data structure VersionedContentMap that is used in dev mode to manage hmr and source maps. This is irrelevant in prod so we can just short circuit it altogether and bail when attempting to call these during builds.

### Why?

VersionedContentMap does a lot of hashing to account for files changing during development. In production, this is pointless as we assume a static snapshot of the repo.

### How?

Replace it with an Option and bail in the case of not being configured.
2024-08-06 09:00:33 +01:00
Will Binns-Smith db7033085f Move turbopack panic log to tmpdir (#67930)
Previously we used $CWD, which is not reliably the user’s app directory. This also updates the error box text to instruct the user to reference the terminal output.

Test Plan: Added a panic in Turbo and verified stderr and error box.
2024-08-05 16:48:19 -07:00
Benjamin Woodruff 0f0cfe5f23 chore(turbopack): Add comment_width = 100 to rustfmt.toml (#68541)
The default `comment_width` is `80`, which is a mismatch with the
`max_width` of `100`.

Previous discussion:
https://vercel.slack.com/archives/C03EWR7LGEN/p1716332166435329

Ran `cargo fmt` after making this change. It seems to mostly just fix
bullet points. Other places it likely can't differentiate between
wrapped text and intentional newlines.

I don't plan on going through and manually re-wrapping of all of the
comments, but over time this should get fixed as people change comments.
2024-08-05 13:30:40 -04:00
hrmny 9dc685edea chore: remove turbopack-binding and other unused crates (#68456)
### What?

Removes the `turbopack-binding` crate which is unnecessary now that we
have everything in one repo.
This should improve compile times a bit.

Closes PACK-3162
2024-08-05 16:50:45 +00:00
Niklas Mischkulnig 0a33a924e8 Refactor ModuleOptionsContext API (#67864)
Includes https://github.com/vercel/turbo/pull/8774

Closes PACK-3160
2024-08-05 17:03:39 +02:00
Niklas Mischkulnig 37df9ab243 Upgrade to rustc nightly-2024-08-01 (#68452)
1. Upgrade to `nightly-2024-08-01`
2. Fix lints
3. Remove some unused structs
4. Bump `regex` because of https://github.com/rust-lang/regex/pull/1219

Closes PACK-3178
2024-08-05 09:59:44 +02:00
Niklas Mischkulnig 237defc727 Support @next/mdx with Turbopack (#68397)
Closes PACK-3153
2024-08-02 14:57:16 +02:00
Sebastian Silbermann 6c522df226 Remove remaining uses of removed swcMinify config option (#68389) 2024-08-02 12:00:41 +02:00
Donny/강동윤 c979ef36ae feat: Enable tree shaking of turbopack (#66689)
### What?

Enable tree shaking of turbopack.

### Why?

Verify the implementation and improve the bundle size.

### How?

Closes PACK-3111

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-08-02 07:07:12 +02:00