Turbopack: return StaticImageData for images imported from node_modules (#102389)
### What?
With Turbopack, a static image imported from a dependency in
`node_modules` now gives the same `StaticImageData` object (`src`,
`width`, `height`, …) as an image in the app itself. This matches
webpack and the `next/image` typings.
### Why?
Before this change, Turbopack returned a plain URL string for images in
`node_modules`. TypeScript accepted `.src`, but at runtime it was
`undefined`, and passing the import to `next/image` failed because
`width` and `height` were missing.
Credit to @marcoshernanz, who found in the issue thread that adding the
package to `transpilePackages` works around the problem. That pointed to
the dependency-only module rules as the cause.
### How?
Turbopack only added the structured-image module rule for project code,
and code in `node_modules` uses a separate rule set. This PR adds the
image rule to both the client and server transform rules regardless of
where the module lives.
The rule still skips URL references, so CSS `url(...)` and `new URL(...,
import.meta.url)` keep producing URLs.
This means a dependency's JavaScript image import that used to get a
string now gets the same metadata object webpack already returns.
Turbopack's handling of `images.disableStaticImages` is unchanged by
this PR.
Fixes #81964
### Verification
- The new regression cases failed before the fix in Turbopack dev: the
dependency image import was a URL string and `next/image` threw a
missing `width` error. The project-image control passed.
- Rebuilt the native bindings, then the extended suite passed in dev and
start mode with both Turbopack and webpack.
- `__NEXT_CACHE_COMPONENTS=true pnpm test-start-turbo
test/e2e/next-image-new/app-dir-image-from-node-modules/`
- Checked by hand: in a production Turbopack build, a dependency CSS
`url(./marker.png)` still produced a plain URL to the emitted asset.
- `cargo check -p next-core`
- `cargo clippy -p next-core -- -D warnings -A deprecated`
- `pnpm lint-typescript`
<!-- NEXT_JS_LLM -->
<!-- fleet 23305c94-aaa5-41b4-8a98-f6d4ad9e48a0 -->
---------
Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: Fleet Dev Agent <fleet-dev-agent@users.noreply.github.com>