[turbopack] Discover service workers in the Turbopack analyzer (#94923)
This PR is the PR that "turns on" the service worker feature, this is
because in the analyzer we are now looking for code like:
```
await navigator.serviceWorker.register(new URL('../lib/service-workers/1.js', import.meta.url), ...)
```
And transforms it into registering the URL that Next.js will now serve
based on scope.
URL scheme is:
```
scope: "/" -> `sw.js`
scope: "/offline/mode" -> `sw-offline-mode.js`
```
etc.
It also inserts the `ServiceWorkerEntryModule`s so they can be
discovered by `next-api` (see
https://github.com/vercel/next.js/pull/94922).
Showing
Please
register
or
sign in
to comment