rsnext/packages/next-swc/crates/next-custom-transforms
Jiachi Liu ed893fa0d3
Use SWC to valid client next/navigation hooks usage in server components (#63160)
### What

Use SWC to check invalid client hooks of `next/navigation` imports in
server components.
Follow up of #62456 

Remove the runtime error APIs for `next/navigation` rsc version.
Add `next/navigation` react-server version alias in turbopack.

This PR also refactored the invalid server layer APIs detection into a
map, where key is import path and value is an array of client APIs.
During the traversing we will get the import source easily, this makes
extending the logic much easier

### Why

Previously we're using the runtime error to check it, but it has to run
first then the error will be thrown. If we error first in build time
with this check it's much faster and we this align on both side between
webpack and turbopack.
2024-03-13 16:37:36 +01:00
..
src Use SWC to valid client next/navigation hooks usage in server components (#63160) 2024-03-13 16:37:36 +01:00
tests fix(next-swc): Fix span for invalid 'use server' directives (#62259) 2024-02-22 08:51:45 +01:00
Cargo.toml Revert "refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc" (#62838) 2024-03-04 21:43:56 +00:00