From 729ff712b7dc971b74c455a46797047a9347bd72 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 14 Sep 2026 09:43:14 +0200 Subject: [PATCH 1/9] refactor(turbopack): drop the generic on `new_atom`, and stop it copying an owned string (#98520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What? Follow-up to the review comments on #98497. `new_atom` loses its generic parameter and takes a `Cow<'_, str>`, which as a side effect stops it copying a string it was handed ownership of. `FileSystemPath`'s `get_relative_request_to` stops hand-rolling a conversion the standard `From` impl already does, and the two tests added for it in `path.rs` are replaced by one that covers what that layer actually adds. ### Why? @bgw noted that `get_relative_request_to` was matching on the `Cow` it gets back only to call `.into()` in both arms, and wondered whether `impl From> for RcStr` was missing a fast path for the owned case. It was not missing one, and it never needed one — but an owned string *was* being copied, for a different reason. `new_atom` was generic over `T: AsRef + Into` and opened with `let text = text.as_ref();`, which shadows the owned value. From that point on only a `&str` was in scope, so building the `Box` allocated a fresh buffer and copied into it, dropping the `String` that a `Cow::Owned` had just handed over. So this is not a fast path being added. It is an accidental pessimisation being removed: the generic plus the `as_ref()` were exactly what stopped the standard conversion from doing the right thing on its own. Whether that copy ever mattered in practice is a separate question, and one this does not attempt to answer. The other two comments were about the tests: they re-ran the case table that already lives in `turbo-unix-path`, which is where the path computation itself is implemented and tested — "60 LOC to test a 3 LOC branch". ### How? `new_atom` takes a `Cow<'_, str>`. All five of its callers already passed one, so nothing else changes, and ownership now survives to where the `Box` is built — `Box`'s own `From>` moves an owned buffer in and copies only a borrowed one. The inline-atom path is untouched, since it reads through a `&str` either way and does not allocate. Contents-based assertions cannot distinguish a moved buffer from a copied one, so the test compares the data pointer before and after the conversion. It uses a string longer than `MAX_INLINE_LEN`, because an inline atom stores its bytes in the tagged value by design and could never preserve a pointer, and it asserts the atom really is dynamic so it cannot pass vacuously if that boundary ever moves. It fails on `canary` today. `get_relative_request_to` collapses to a single `.into()`. Its sibling `get_relative_path_to` keeps its match on purpose: one arm uses `std::ptr::eq` to hand back a clone of the `RcStr` the path already holds, which the blanket conversion cannot do. That arm predates #98497 and is an optimisation rather than the redundancy that was flagged. For the tests, `turbo-unix-path` remains the place where the relative path computation is covered, untouched. What is left here is only what this layer adds on top: that each method reaches for the form it names, and that neither returns a path across filesystems. Keeping the first of those is a judgement call — a method delegating to the wrong free function is precisely the bug #98497 existed to fix, and it is invisible to the lower-level table — so it is asserted with one descendant pair rather than a table. Happy to drop it entirely if you would rather. To check that the smaller test still earns its place, `get_relative_request_to` was temporarily pointed at the plain-path function; the test fails as it should. --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com> --- turbopack/crates/turbo-rcstr/src/dynamic.rs | 13 +-- turbopack/crates/turbo-rcstr/src/lib.rs | 31 +++++++ turbopack/crates/turbo-tasks-fs/src/path.rs | 94 ++++----------------- 3 files changed, 54 insertions(+), 84 deletions(-) diff --git a/turbopack/crates/turbo-rcstr/src/dynamic.rs b/turbopack/crates/turbo-rcstr/src/dynamic.rs index 93bc7a7a07bc..81de8a7838c9 100644 --- a/turbopack/crates/turbo-rcstr/src/dynamic.rs +++ b/turbopack/crates/turbo-rcstr/src/dynamic.rs @@ -1,4 +1,4 @@ -use std::{num::NonZeroU8, ptr::NonNull}; +use std::{borrow::Cow, num::NonZeroU8, ptr::NonNull}; use triomphe::Arc; @@ -47,9 +47,11 @@ pub unsafe fn restore_arc(v: TaggedValue) -> Arc { /// This can create any kind of [Atom], although this lives in the `dynamic` /// module. -pub(crate) fn new_atom + Into>(text: T) -> RcStr { - let text = text.as_ref(); - if is_atom_inlineable(text) { +/// +/// Takes a [`Cow`] rather than a `&str` so that an already-owned string can be moved into the atom +/// instead of being copied into a new allocation. +pub(crate) fn new_atom(text: Cow<'_, str>) -> RcStr { + if is_atom_inlineable(&text) { let len = text.len(); // INLINE_TAG ensures this is never zero let tag = INLINE_TAG_INIT | ((len as u8) << LEN_OFFSET); @@ -64,7 +66,8 @@ pub(crate) fn new_atom + Into>(text: T) -> RcStr { let prehashed = DynamicPrehashedString { // NOTE: This will capture as a Box which will essentially - // `shrink_to_fit` the bytes. + // `shrink_to_fit` the bytes. `Box`'s own `From>` impl already moves an + // owned string's buffer in rather than copying it. value: text.into(), hash, }; diff --git a/turbopack/crates/turbo-rcstr/src/lib.rs b/turbopack/crates/turbo-rcstr/src/lib.rs index 4deda1869c2d..7fd8ae6a878f 100644 --- a/turbopack/crates/turbo-rcstr/src/lib.rs +++ b/turbopack/crates/turbo-rcstr/src/lib.rs @@ -718,6 +718,37 @@ mod tests { use super::*; + /// An `RcStr` built from an owned string takes over its buffer instead of copying it. Only a + /// non-inline string can show this: an inline atom stores its bytes in the tagged value, so it + /// has no buffer to take over. + #[test] + fn from_owned_cow_takes_over_the_buffer() { + let mut string = "a string far too long to be stored inline".to_string(); + // So that `String::into_boxed_str` has no reason to reallocate. + string.shrink_to_fit(); + let ptr = string.as_ptr(); + + let rc_str = RcStr::from(Cow::Owned(string)); + + assert!( + rc_str.tag() == DYNAMIC_TAG, + "the test string must not be inlineable" + ); + assert_eq!( + rc_str.as_str().as_ptr(), + ptr, + "the owned buffer should have been taken over, not copied" + ); + } + + /// There is no buffer to take over here, so this only pins the contents. + #[test] + fn from_borrowed_cow_copies() { + let string = "a string far too long to be stored inline"; + let rc_str = RcStr::from(Cow::Borrowed(string)); + assert_eq!(rc_str.as_str(), string); + } + #[test] fn test_refcount() { fn refcount(str: &RcStr) -> usize { diff --git a/turbopack/crates/turbo-tasks-fs/src/path.rs b/turbopack/crates/turbo-tasks-fs/src/path.rs index 8b28719bb47c..8f76e0efec1c 100644 --- a/turbopack/crates/turbo-tasks-fs/src/path.rs +++ b/turbopack/crates/turbo-tasks-fs/src/path.rs @@ -131,10 +131,7 @@ impl FileSystemPath { return None; } - Some(match get_relative_request_to(&self.path, &other.path) { - Cow::Borrowed(path) => path.into(), - Cow::Owned(path) => path.into(), - }) + Some(get_relative_request_to(&self.path, &other.path).into()) } /// Returns the final component of the FileSystemPath, or an empty string @@ -794,63 +791,11 @@ mod tests { use super::*; use crate::VirtualFileSystem; - /// Builds two paths on the same filesystem and returns them. - fn paths_on_one_fs( - fs: ResolvedVc>, - from: &str, - target: &str, - ) -> (FileSystemPath, FileSystemPath) { - ( - FileSystemPath::new_normalized_unchecked(fs, from.into()), - FileSystemPath::new_normalized_unchecked(fs, target.into()), - ) - } - - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] - async fn test_get_relative_path_to() { - let tt = turbo_tasks::TurboTasks::new(TurboTasksBackend::new( - BackendOptions::default(), - noop_backing_storage(), - )); - tt.run_once(async move { - let fs = Vc::upcast::>(VirtualFileSystem::new()) - .to_resolved() - .await?; - - for (from, target, expected) in [ - ("a/b/c", "a/b/c", "."), - ("a/c/d", "a/b/c", "../../b/c"), - ("", "a/b/c", "a/b/c"), - ("a/b", "a/b/c", "c"), - ("a/b/c", "", "../../.."), - ("a/b/c", "c/b/a", "../../../c/b/a"), - ] { - let (from_path, target_path) = paths_on_one_fs(fs, from, target); - assert_eq!( - from_path.get_relative_path_to(&target_path).as_deref(), - Some(expected), - "{from:?} -> {target:?}" - ); - } - - // A path on another filesystem is not reachable relatively. - let (from_path, _) = paths_on_one_fs(fs, "a/b", "a/b/c"); - let other_fs = Vc::upcast::>(VirtualFileSystem::new()) - .to_resolved() - .await?; - let on_other_fs = FileSystemPath::new_normalized_unchecked(other_fs, rcstr!("a/b/c")); - assert_eq!(from_path.get_relative_path_to(&on_other_fs), None); - - anyhow::Ok(()) - }) - .await - .unwrap(); - } - - /// The cases this covers are the ones `get_relative_path_to` was asserted against before it - /// stopped prefixing `./`, so they pin that the request form still produces them. + /// `turbo-unix-path` covers how the relative path itself is computed, so this only pins what + /// this layer adds: that each method reaches for the form it names, and that neither crosses + /// between filesystems. #[tokio::test(flavor = "multi_thread", worker_threads = 2)] - async fn test_get_relative_request_to() { + async fn get_relative_to() { let tt = turbo_tasks::TurboTasks::new(TurboTasksBackend::new( BackendOptions::default(), noop_backing_storage(), @@ -859,30 +804,21 @@ mod tests { let fs = Vc::upcast::>(VirtualFileSystem::new()) .to_resolved() .await?; + let dir = FileSystemPath::new_normalized_unchecked(fs, rcstr!("a/b")); + let file = FileSystemPath::new_normalized_unchecked(fs, rcstr!("a/b/c.js")); - for (from, target, expected) in [ - ("a/b/c", "a/b/c", "."), - ("a/c/d", "a/b/c", "../../b/c"), - ("", "a/b/c", "./a/b/c"), - ("a/b", "a/b/c", "./c"), - ("a/b/c", "", "../../.."), - ("a/b/c", "c/b/a", "../../../c/b/a"), - ] { - let (from_path, target_path) = paths_on_one_fs(fs, from, target); - assert_eq!( - from_path.get_relative_request_to(&target_path).as_deref(), - Some(expected), - "{from:?} -> {target:?}" - ); - } + assert_eq!(dir.get_relative_path_to(&file).as_deref(), Some("c.js")); + assert_eq!( + dir.get_relative_request_to(&file).as_deref(), + Some("./c.js") + ); - // A path on another filesystem is not reachable relatively. - let (from_path, _) = paths_on_one_fs(fs, "a/b", "a/b/c"); let other_fs = Vc::upcast::>(VirtualFileSystem::new()) .to_resolved() .await?; - let on_other_fs = FileSystemPath::new_normalized_unchecked(other_fs, rcstr!("a/b/c")); - assert_eq!(from_path.get_relative_request_to(&on_other_fs), None); + let elsewhere = FileSystemPath::new_normalized_unchecked(other_fs, rcstr!("a/b/c.js")); + assert_eq!(dir.get_relative_path_to(&elsewhere), None); + assert_eq!(dir.get_relative_request_to(&elsewhere), None); anyhow::Ok(()) }) From 164d9c1900a56c61a314270fe343ec182743a02c Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 14 Sep 2026 11:32:24 +0200 Subject: [PATCH 2/9] Durable use cache: fix runtime env var mutation (#98558) ### Problem 1. Next computes the warmup cache key while `SOME_ENV_VAR` is unset. 2. Rendering ends up setting `SOME_ENV_VAR`. 3. Final prerender expects the cache entry to exist, but the env var changed, so the key changed and it's a miss. 4. Unexpected miss and bailout. This lead to ``` Error: Route "foo": Unexpected cache miss after cache warming phase during prerendering. This is likely caused by non-deterministic arguments that differ between the cache warming phase and the final prerender phase (e.g. unstable array order). Ensure that arguments passed to cached functions are deterministic. Error: Route "foo": Next.js encountered uncached or runtime data during prerendering. ``` ### Solution ~~Instead, snapshot the env vars once at module evaluation time of the `use cache` function. This ensures that the cache key doesn't change over time. This is also how it worked thus far (with deployment id as the cache key): changing the env var over the lifetime of the process didn't lead to a reexecution of the `use cache` function~~ RDC already stores cache entries generated in the previous phase (be it during `next build` multi-phase rendering, or from prerender->resuming at runtime). Root params are already excluded from the cache keys when storing in RDC. Also exclude the env var hash bit, to conform to this system of preventing tearing (at the cost of potential staleness). --- .../src/server/use-cache/use-cache-wrapper.ts | 73 +++++++++++-------- .../app/env-mutation/[slug]/mutate-env.tsx | 4 + .../app/env-mutation/[slug]/page.tsx | 45 ++++++++++++ .../use-cache-cross-deployment.test.ts | 32 ++++++++ 4 files changed, 125 insertions(+), 29 deletions(-) create mode 100644 test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/mutate-env.tsx create mode 100644 test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/page.tsx diff --git a/packages/next/src/server/use-cache/use-cache-wrapper.ts b/packages/next/src/server/use-cache/use-cache-wrapper.ts index 4af9bfe939f4..918f9558393b 100644 --- a/packages/next/src/server/use-cache/use-cache-wrapper.ts +++ b/packages/next/src/server/use-cache/use-cache-wrapper.ts @@ -2122,20 +2122,19 @@ export async function cache( const temporaryReferences = createClientTemporaryReferenceSet() - // The base serialized cache key doesn't include the cookies or headers that - // private caches are allowed to read. In production this is because private - // cache entries aren't stored in a cache handler, only in the Resume Data - // Cache (RDC): private caches are only used during dynamic requests and - // runtime prefetches; for dynamic requests the RDC is immutable and excludes - // private caches, and for runtime prefetches it's mutable but lives only as - // long as the request. In development private caches are persisted across - // requests, so `cacheHandlerKeyBase` (below) additionally scopes the handler - // key by the request's cookies and headers. - const cacheKeyParts: CacheKeyParts = [ - id, - args, - await computeCacheKeyImplementationPart(workStore, workUnitStore, id), - ] + // The base serialized cache key doesn't include runtime env var state or the + // cookies and headers that private caches are allowed to read. Env var state + // only scopes the cache handler because the RDC must reuse entries across + // rendering phases. In production private cache entries aren't stored in a + // cache handler, only in the Resume Data Cache (RDC): private caches are only + // used during dynamic requests and runtime prefetches; for dynamic requests + // the RDC is immutable and excludes private caches, and for runtime prefetches + // it's mutable but lives only as long as the request. In development private + // caches are persisted across requests, so `cacheHandlerKeyBase` (below) + // additionally scopes the handler key by the request's cookies and headers. + const { implementationPart, runtimeEnvVarStateHash } = + await computeCacheKeyImplementationPart(workStore, workUnitStore, id) + const cacheKeyParts: CacheKeyParts = [id, args, implementationPart] const encodeCacheKeyParts = () => encodeReply(cacheKeyParts, { @@ -2270,19 +2269,19 @@ export async function cache( // The coarse cache-handler key. With no root params read, it locates the // entry directly; otherwise it locates a redirect entry from which the - // specific key (this key + root params, computed below) is derived. For - // private caches in development (persisted in the built-in in-memory handler) - // it's additionally scoped by the request's cookies and headers, so entries - // for requests with different request data don't collide; keys derived from - // it inherit that scoping. + // specific key (this key + root params, computed below) is derived. It's + // scoped by runtime env var state and, for private caches in development + // (persisted in the built-in in-memory handler), the request's cookies and + // headers. Keys derived from it inherit that scoping. const cacheHandlerKeyBase = - process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private' - ? serializedCacheKey + - computePrivateCacheKeyRequestSuffix( + serializedCacheKey + + (runtimeEnvVarStateHash ?? '') + + (process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private' + ? computePrivateCacheKeyRequestSuffix( cacheContext.outerWorkUnitStore.cookies, cacheContext.outerWorkUnitStore.headers ) - : serializedCacheKey + : '') // If we already know which root params this function reads, include them in // the cache handler key for a direct hit (skipping the redirect entry). // rootParams is undefined when nested inside unstable_cache. @@ -3672,8 +3671,12 @@ export async function cache( } /** - * This returns a cache key that has to cover everything that can affect the result of the cached - * function (apart from the arguments). So + * This returns cache key parts that cover everything that can affect the result of the cached + * function (apart from the arguments). The implementation part is used by both the RDC and cache + * handler, while the runtime env var state hash is only used by the cache handler. The RDC is + * per-page and must reuse entries across rendering phases even if an env var changes between them. + * + * The parts cover: * - codeHash: the code itself that generates the return value * - Notably, this excludes the following modules. Those are included via the Next.js version anyway: * - react, react-dom, private-next-rsc-server-reference, private-next-rsc-cache-wrapper @@ -3688,7 +3691,10 @@ async function computeCacheKeyImplementationPart( workStore: WorkStore, workUnitStore: WorkUnitStore, id: string -): Promise { +): Promise<{ + implementationPart: unknown + runtimeEnvVarStateHash: string | undefined +}> { let durability = workStore.durableUseCacheEntries ? getServerActionsManifest().node[id].workers?.[ normalizeWorkerPageName(workStore.page) @@ -3715,8 +3721,12 @@ async function computeCacheKeyImplementationPart( ) .digest('hex') - // When more accurate analysis information is available, use codeHash + runtime env vars - return [durability.codeHash, nextVersion, runtimeEnvVarStateHash] + // The env var state is added to the cache handler key separately so it + // doesn't affect RDC lookups between rendering phases. + return { + implementationPart: [durability.codeHash, nextVersion], + runtimeEnvVarStateHash, + } } else { // Because the Action ID is not yet unique per implementation of that Action we can't // safely reuse the results across builds yet. In the meantime we add the buildId to the @@ -3732,7 +3742,12 @@ async function computeCacheKeyImplementationPart( const hmrRefreshHash = getHmrRefreshHash(workUnitStore) // otherwise fall back to buildId and/or the HMR hash. - return hmrRefreshHash ? [buildId, hmrRefreshHash] : [buildId] + return { + implementationPart: hmrRefreshHash + ? [buildId, hmrRefreshHash] + : [buildId], + runtimeEnvVarStateHash: undefined, + } } } diff --git a/test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/mutate-env.tsx b/test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/mutate-env.tsx new file mode 100644 index 000000000000..224f87bb36c6 --- /dev/null +++ b/test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/mutate-env.tsx @@ -0,0 +1,4 @@ +export function MutateEnv() { + process.env.MUTATED_DURING_CACHE_GENERATION = '1' + return null +} diff --git a/test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/page.tsx b/test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/page.tsx new file mode 100644 index 000000000000..1a023dddd559 --- /dev/null +++ b/test/production/app-dir/use-cache-cross-deployment/app/env-mutation/[slug]/page.tsx @@ -0,0 +1,45 @@ +import { cacheLife } from 'next/cache' +import { Suspense } from 'react' +import { cookies } from 'next/headers' +import { MutateEnv } from './mutate-env' + +export const prefetch = 'partial' + +async function CachedValue({ slug }: { slug: string }) { + 'use cache' + cacheLife('days') + + const value = process.env.MUTATED_DURING_CACHE_GENERATION ?? 'unset' + + return ( + <> +

{`${slug}:${value}`}

+ + + ) +} + +async function Content({ slug }: { slug: string }) { + if (slug === 'known') { + await cookies() + } + + return +} + +export default async function Page({ + params, +}: { + params: Promise<{ slug: string }> +}) { + const { slug } = await params + return ( + + + + ) +} + +export function generateStaticParams() { + return [{ slug: 'known' }] +} diff --git a/test/production/app-dir/use-cache-cross-deployment/use-cache-cross-deployment.test.ts b/test/production/app-dir/use-cache-cross-deployment/use-cache-cross-deployment.test.ts index 7a85a690e727..3cb6ffe59f70 100644 --- a/test/production/app-dir/use-cache-cross-deployment/use-cache-cross-deployment.test.ts +++ b/test/production/app-dir/use-cache-cross-deployment/use-cache-cross-deployment.test.ts @@ -220,6 +220,38 @@ describe.each(['NEXT_DEPLOYMENT_ID', 'BUILD_ID', 'default'])( await next.deleteFile('handler-remote-data.json') }) + it('should not miss when an env var changes during cache generation', async () => { + // Regression test for mutating env vars which changes the cache key mid-rendering and breaks + // the multi-phase rendering process (be it within the next build prerendering, or in the + // resume case at runtime). + // RDC stores cache entries, and we should use those entries regardless of whether env vars + // changed in the meantime (among other things, to prevent tearing). + // + // Error: Route "foo": Unexpected cache miss after cache warming phase during prerendering. + // This is likely caused by non-deterministic arguments that differ between the cache warming + // phase and the final prerender phase (e.g. unstable array order). Ensure that arguments + // passed to cached functions are deterministic. + // + // Error: Route "foo": Next.js encountered uncached or runtime data during prerendering. + await next.stop() + delete next.env.MUTATED_DURING_CACHE_GENERATION + + try { + await next.start() + const output = next.getCliOutputFromHere() + const browser = await next.browser('/env-mutation/test') + + expect(output()).not.toContain('Error') + expect(output()).not.toContain( + 'Unexpected cache miss after cache warming phase during prerendering' + ) + expect(await browser.elementById('data').text()).toBe('test:unset') + } finally { + await next.stop() + delete next.env.MUTATED_DURING_CACHE_GENERATION + } + }) + it('should not recompute when nothing changes', async () => { const key1 = await execute(next, 'NEXT_DEPLOYMENT_ID', 'dpl-id-1') const key2 = await execute(next, 'NEXT_DEPLOYMENT_ID', 'dpl-id-2') From 156050f1c41688b7a3d3dedceb0d568073ac9869 Mon Sep 17 00:00:00 2001 From: "next-js-bot[bot]" <279046576+next-js-bot[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2026 10:15:24 +0000 Subject: [PATCH 3/9] v16.4.0-canary.29 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/devlow-bench/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-internal/package.json | 2 +- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-playwright/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-routing/package.json | 2 +- packages/next-rspack/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 22 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lerna.json b/lerna.json index 5c789e98fa56..8a33ac382421 100644 --- a/lerna.json +++ b/lerna.json @@ -15,5 +15,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "16.4.0-canary.28" + "version": "16.4.0-canary.29" } \ No newline at end of file diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 10c361a32366..446678322ef3 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "keywords": [ "react", "next", diff --git a/packages/devlow-bench/package.json b/packages/devlow-bench/package.json index f19244f15e05..a6512c74098e 100644 --- a/packages/devlow-bench/package.json +++ b/packages/devlow-bench/package.json @@ -1,6 +1,6 @@ { "name": "@vercel/devlow-bench", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "Benchmarking tool for the developer workflow", "repository": { "type": "git", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 45be3bf66b61..7159fc02a8ea 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "ESLint configuration used by Next.js.", "license": "MIT", "repository": { @@ -12,7 +12,7 @@ "dist" ], "dependencies": { - "@next/eslint-plugin-next": "16.4.0-canary.28", + "@next/eslint-plugin-next": "16.4.0-canary.29", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 317fb2744403..c9c64325c132 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,7 +1,7 @@ { "name": "@next/eslint-plugin-internal", "private": true, - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "ESLint plugin for working on Next.js.", "exports": { ".": "./src/eslint-plugin-internal.js" diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 08b74e20e1d7..0cc8f492c6b0 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/font/package.json b/packages/font/package.json index 308348cba0cc..c71404deddee 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 683f32225c08..19204551a132 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 20cad814c49c..f8b0bbf8d744 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 38922f79151d..6842c2d461c8 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 815ed6aac63b..2bc5d3c85e38 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-playwright/package.json b/packages/next-playwright/package.json index 7c0833d61824..a8516a44d679 100644 --- a/packages/next-playwright/package.json +++ b/packages/next-playwright/package.json @@ -1,6 +1,6 @@ { "name": "@next/playwright", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/next-playwright" diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 75b1539cb060..c4971c937ce9 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index e07c0ba224f8..2a3530b434c2 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index b9b1caed8ba4..8bda59cef610 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-routing/package.json b/packages/next-routing/package.json index 3668c5dd85c0..91196068bee8 100644 --- a/packages/next-routing/package.json +++ b/packages/next-routing/package.json @@ -1,6 +1,6 @@ { "name": "@next/routing", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "keywords": [ "react", "next", diff --git a/packages/next-rspack/package.json b/packages/next-rspack/package.json index 400cb6cb8019..74d99ac61b80 100644 --- a/packages/next-rspack/package.json +++ b/packages/next-rspack/package.json @@ -1,6 +1,6 @@ { "name": "next-rspack", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/next-rspack" diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 30b1bdcab797..00baff0332ca 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "private": true, "files": [ "native/" diff --git a/packages/next/package.json b/packages/next/package.json index 39a59b33f0b0..7e30103045dc 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -100,7 +100,7 @@ ] }, "dependencies": { - "@next/env": "16.4.0-canary.28", + "@next/env": "16.4.0-canary.29", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", @@ -164,11 +164,11 @@ "@modelcontextprotocol/sdk": "1.18.1", "@mswjs/interceptors": "0.42.0", "@napi-rs/triples": "1.2.0", - "@next/font": "16.4.0-canary.28", - "@next/polyfill-module": "16.4.0-canary.28", - "@next/polyfill-nomodule": "16.4.0-canary.28", - "@next/react-refresh-utils": "16.4.0-canary.28", - "@next/swc": "16.4.0-canary.28", + "@next/font": "16.4.0-canary.29", + "@next/polyfill-module": "16.4.0-canary.29", + "@next/polyfill-nomodule": "16.4.0-canary.29", + "@next/react-refresh-utils": "16.4.0-canary.29", + "@next/swc": "16.4.0-canary.29", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.61.0", "@rspack/core": "1.6.7", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 438155695762..6b5c5acfb7ac 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index d0ac385361e6..0248038d48ce 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "16.4.0-canary.28", + "version": "16.4.0-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "16.4.0-canary.28", + "next": "16.4.0-canary.29", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "6.0.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index be27e4c0863e..e873c53664b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1012,7 +1012,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../eslint-plugin-next eslint: specifier: '>=9.0.0' @@ -1095,7 +1095,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../next-env '@swc/helpers': specifier: 0.5.23 @@ -1216,19 +1216,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../font '@next/polyfill-module': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../react-refresh-utils '@next/swc': - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1971,7 +1971,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 16.4.0-canary.28 + specifier: 16.4.0-canary.29 version: link:../next outdent: specifier: 0.8.0 From df1502c713a7b3ae4ef3c314e3a83daf136e12bb Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 14 Sep 2026 12:34:29 +0200 Subject: [PATCH 4/9] Sort batched chunk items globally by path (#98433) ### What? Globally order all emitted Turbopack ECMAScript chunk items by module path, including items nested inside batches. Browser and Node.js chunk emitters now consume the same flattened, ordered result. ### Why? The previous ordering compared only the first module in each item or batch group. Remaining modules in a batch stayed together even when their paths belonged elsewhere in the global order, reducing locality between similar modules and slightly worsening gzip compression. For `bench/basic-app`, production JavaScript chunk gzip sizes changed as follows while raw bytes and chunk counts stayed unchanged: | Output | Before | After | Change | |---|---:|---:|---:| | Browser chunks | 1,619,643 B | 1,619,314 B | -329 B (-0.020%) | | Server chunks | 792,379 B | 792,186 B | -193 B (-0.024%) | | Combined | 2,412,022 B | 2,411,500 B | -522 B (-0.022%) | ### How? The shared ECMAScript chunk-content accessor now flattens resolved item and batch groups and sorts every module by `(path, module id)`. Keeping this ordering in the shared layer gives browser and Node.js output identical deterministic behavior and removes duplicated emitter-side sorting. ### Verification - `cargo fmt --all -- --check` - `cargo check -p turbopack-browser -p turbopack-nodejs` - `cargo test -p turbopack-browser -p turbopack-nodejs` - `pnpm build-all` - Clean baseline and candidate production builds of `bench/basic-app` --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com> --- .../src/ecmascript/content.rs | 19 +++++----------- .../turbopack-ecmascript/src/chunk/content.rs | 22 ++++++++++++++----- .../src/ecmascript/node/content.rs | 17 +++++--------- ...ting_split-shared_input_02x_50fz-7djz._.js | 18 +++++++-------- ..._split-shared_input_02x_50fz-7djz._.js.map | 6 ++--- 5 files changed, 39 insertions(+), 43 deletions(-) diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/content.rs b/turbopack/crates/turbopack-browser/src/ecmascript/content.rs index 95fc436a1457..bf006187d552 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/content.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/content.rs @@ -102,20 +102,11 @@ impl EcmascriptBrowserChunkContent { )?; let content = this.content.await?; - let mut chunk_items = content.chunk_item_code_module_ids_and_paths().await?; - // Sort items by their module path so that similar modules stay - // together so that the chunks gzips better. - chunk_items.sort_by(|a, b| { - a.first() - .map(|(id, _, path)| (path, id)) - .cmp(&b.first().map(|(id, _, path)| (path, id))) - }); - for item in &chunk_items { - for (id, item_code, _) in &**item { - write!(code, "\n{}, ", StringifyJs(id))?; - code.push_code(item_code); - write!(code, ",")?; - } + let chunk_items = content.chunk_item_code_module_ids_and_paths().await?; + for (id, item_code, _) in &chunk_items { + write!(code, "\n{}, ", StringifyJs(id))?; + code.push_code(item_code); + write!(code, ",")?; } write!(code, "\n]);")?; diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs index a36221777890..1897afa3ec23 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs @@ -2,11 +2,14 @@ use std::future::IntoFuture; use anyhow::Result; use either::Either; +use turbo_rcstr::RcStr; use turbo_tasks::{ReadRef, ResolvedVc, TryJoinIterExt, Vc}; -use turbopack_core::chunk::{ChunkItem, ChunkItems, batch_info}; +use turbopack_core::{ + chunk::{ChunkItem, ChunkItems, ModuleId, batch_info}, + code_builder::Code, +}; use crate::chunk::{ - CodeModuleIdsAndPaths, batch::{EcmascriptChunkItemBatchGroup, EcmascriptChunkItemOrBatchWithAsyncInfo}, batch_group_code_module_ids_and_paths, item_code_module_ids_and_paths, }; @@ -51,13 +54,22 @@ impl EcmascriptChunkContent { impl EcmascriptChunkContent { pub async fn chunk_item_code_module_ids_and_paths( &self, - ) -> Result>> { - batch_info( + ) -> Result, RcStr)>> { + let chunk_item_groups = batch_info( &self.batch_groups, &self.chunk_items, |batch| batch_group_code_module_ids_and_paths(batch).into_future(), |item| item_code_module_ids_and_paths(item.clone()).into_future(), ) - .await + .await?; + let mut chunk_items = chunk_item_groups + .iter() + .flat_map(|items| items.iter().cloned()) + .collect::>(); + // Sort all items by their module path so that similar modules stay + // together and the chunks gzip better. + chunk_items + .sort_by(|(a_id, _, a_path), (b_id, _, b_path)| (a_path, a_id).cmp(&(b_path, b_id))); + Ok(chunk_items) } } diff --git a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs index 063f802e7bda..82d4c72b0c2d 100644 --- a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs +++ b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs @@ -64,18 +64,11 @@ impl EcmascriptNodeChunkContent { write!(code, "module.exports = [")?; let content = self.content.await?; - let mut chunk_items = content.chunk_item_code_module_ids_and_paths().await?; - chunk_items.sort_by(|a, b| { - a.first() - .map(|(id, _, path)| (path, id)) - .cmp(&b.first().map(|(id, _, path)| (path, id))) - }); - for item in &chunk_items { - for (id, item_code, _) in &**item { - write!(code, "\n{}, ", StringifyJs(id))?; - code.push_code(item_code); - write!(code, ",")?; - } + let chunk_items = content.chunk_item_code_module_ids_and_paths().await?; + for (id, item_code, _) in &chunk_items { + write!(code, "\n{}, ", StringifyJs(id))?; + code.push_code(item_code); + write!(code, ",")?; } write!(code, "\n];")?; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js b/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js index 7b5d3e5cceb0..bbe190442179 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js @@ -1,4 +1,13 @@ (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js", +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { +"use strict"; + +__turbopack_context__.s([]); +var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$x$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js [test] (ecmascript)"); +var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$y$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js [test] (ecmascript)"); +; +; +}), "[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { setTimeout(()=>__turbopack_context__.A("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/inner.js [test] (ecmascript, async loader)"), 500); @@ -18,15 +27,6 @@ __turbopack_context__.v((parentImport) => { setTimeout(()=>__turbopack_context__.A("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript, async loader)"), 1000); }), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { -"use strict"; - -__turbopack_context__.s([]); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$x$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js [test] (ecmascript)"); -var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$y$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js [test] (ecmascript)"); -; -; -}), "[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript, async loader)", ((__turbopack_context__) => { __turbopack_context__.v((parentImport) => { diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js.map index 4db6ac973814..201dcd51a727 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/output/0_9x_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_02x_50fz-7djz._.js.map @@ -2,7 +2,7 @@ "version": 3, "sources": [], "sections": [ - {"offset": {"line": 3, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js"],"sourcesContent":["setTimeout(() => import('./inner'), 500)\n"],"names":["setTimeout"],"mappings":"AAAAA,WAAW,yKAAyB"}}, - {"offset": {"line": 18, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js"],"sourcesContent":["setTimeout(() => import('./middle'), 1000)\n"],"names":["setTimeout"],"mappings":"AAAAA,WAAW,0KAA0B"}}, - {"offset": {"line": 23, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js"],"sourcesContent":["import './x/index'\nimport './y/index'\n"],"names":[],"mappings":";AAAA;AACA"}}] + {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js"],"sourcesContent":["import './x/index'\nimport './y/index'\n"],"names":[],"mappings":";AAAA;AACA"}}, + {"offset": {"line": 12, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js"],"sourcesContent":["setTimeout(() => import('./inner'), 500)\n"],"names":["setTimeout"],"mappings":"AAAAA,WAAW,yKAAyB"}}, + {"offset": {"line": 27, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js"],"sourcesContent":["setTimeout(() => import('./middle'), 1000)\n"],"names":["setTimeout"],"mappings":"AAAAA,WAAW,0KAA0B"}}] } \ No newline at end of file From 39f5d797ab8b0bd5ebd3e8acbba03f8a6d6dc0c6 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 14 Sep 2026 12:34:30 +0200 Subject: [PATCH 5/9] Optimize strict module factory chunks (#98421) ### What? Reduce Turbopack ECMAScript chunk size by emitting strict module factories in a shared strict-mode scope instead of repeating `"use strict"` in every factory. The chunk format now chooses among the existing flat representation, a mixed representation with flat non-strict factories plus a nested strict array, and an all-strict representation that wraps the complete chunk in a strict IIFE. Each factory is generated through the existing single code path; the production minimizer removes its redundant directive when the factory is created inside a strict wrapper. Browser and Node.js emitters share the mode selection and serialization implementation, while the runtime remains compatible with the existing flat format. ### Why? ECMAScript modules are always strict, so large chunks currently repeat the same directive across many factories. Moving strictness to the scope where those factories are created removes redundant bytes without copying arrays or changing strict/sloppy execution semantics. For `bench/basic-app`, this reduces total raw JavaScript by 16,831 bytes (0.161%). Partitioning factories changes compression behavior, resulting in a 1,286-byte (0.051%) gzip increase across all JavaScript; format selection therefore remains based on emitted raw bytes. ### How? - Determine each chunk item's strictness from the already-collected chunk metadata. - Generate every factory once with its normal directive, then rely on the minimizer to remove redundant directives inside strict wrappers. - Compare the expected minified directive bytes removed with the exact wrapper bytes added and keep small chunks in the existing flat format. - Keep non-strict factories flat in mixed chunks and append strict factories as an array produced by a strict IIFE. - Wrap the complete registration/export in a strict IIFE when every factory is strict, keeping those factories flat and avoiding a nested array entirely. - Use the shorter arrow IIFE when the target supports it, with a function IIFE fallback for older targets. - Preserve source-map sections, scope-hoisted module IDs, factory naming, and ordering within each partition. - Add focused strict, sloppy, mixed, all-strict, old-target, and below-threshold coverage and update affected Turbopack snapshots. ### Verification - `cargo nextest run -p turbopack-tests -E 'test(snapshot)'` - `cargo clippy -p turbopack-ecmascript -p turbopack-browser -p turbopack-nodejs` - `pnpm build-all` - `pnpm --dir turbopack/crates/turbopack-ecmascript-runtime/js check:nodejs` - `bench/basic-app` production Turbopack build, repeated to confirm deterministic size totals --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com> --- crates/next-api/src/server_actions.rs | 4 +- .../src/ecmascript/content.rs | 38 +++- .../js/src/shared/runtime/runtime-types.d.ts | 10 +- .../js/src/shared/runtime/runtime-utils.ts | 21 ++- .../src/chunk/code_module_ids_and_paths.rs | 51 ++++-- .../turbopack-ecmascript/src/chunk/content.rs | 16 +- .../src/chunk/content_entry.rs | 3 +- .../src/chunk/factory_group.rs | 172 ++++++++++++++++++ .../turbopack-ecmascript/src/chunk/item.rs | 51 ++++-- .../turbopack-ecmascript/src/chunk/mod.rs | 11 +- .../src/ecmascript/node/content.rs | 36 +++- ..._dynamic-import_input_lib_1b34ju5a6z6v3.js | 4 +- ...hake_export-named_input_0xj7cshvyczs_._.js | 4 +- ..._export-namespace_input_1mqgz2-3_b4v8._.js | 4 +- ..._import-named-all_input_1orhvu2sihqe-._.js | 4 +- ...hake_import-named_input_1j9uhcyhqdoze._.js | 4 +- ..._import-namespace_input_1ippwh3yc_l3v._.js | 4 +- ...mport-side-effect_input_1_hdh9its1vdz._.js | 4 +- ...quire-side-effect_input_0fs4qhn32cnvu._.js | 10 +- ...e-side-effect_input_0fs4qhn32cnvu._.js.map | 24 +-- ...-shake-test-1_input_index_07jttq51-r0-b.js | 4 +- ...basic_async_chunk_input_1lkohl-aes1w9._.js | 4 +- ...async_chunk_build_input_0aldykipaj64f._.js | 4 +- ...hot_basic_chunked_input_1_yzgm1kllkx5._.js | 4 +- ...ic_export-default_input_1k9-ja77l7ynd._.js | 4 +- ...hot_basic_shebang_input_02e38zhtmusm6._.js | 4 +- ...c_top-level-await_input_0zs_dr_r82cwm._.js | 4 +- ...c_top-level-await_input_1ih204k-kik67._.js | 4 +- .../basic/use-strict/input/all-strict-a.js | 1 + .../basic/use-strict/input/all-strict-b.js | 1 + .../basic/use-strict/input/all-strict.js | 4 + .../basic/use-strict/input/below-threshold.js | 1 + .../snapshot/basic/use-strict/input/index.js | 15 +- .../basic/use-strict/input/non-strict.js | 3 + .../basic/use-strict/input/strict-a.js | 3 + .../basic/use-strict/input/strict-b.js | 1 + ...ic_use-strict_input_index_0nlvx9556vyf1.js | 10 - ...se-strict_input_index_0nlvx9556vyf1.js.map | 6 - ...e-strict_input_index_0r4xda1wnxaqk.js.map} | 0 ...ic_use-strict_input_index_06b3uhycu7sip.js | 5 - ...ic_use-strict_input_index_0r4xda1wnxaqk.js | 5 + ..._basic_use-strict_input_0czj5szeqd2rf._.js | 22 +++ ...ic_use-strict_input_0czj5szeqd2rf._.js.map | 5 + ..._basic_use-strict_input_1fuq2pc5luz9r._.js | 35 ++++ ...ic_use-strict_input_1fuq2pc5luz9r._.js.map | 8 + ..._basic_use-strict_input_1wmp5yoyw-hht._.js | 41 +++++ ...ic_use-strict_input_1wmp5yoyw-hht._.js.map | 9 + ...ict_input_below-threshold_1my1mnvsmmqb0.js | 13 ++ ...input_below-threshold_1my1mnvsmmqb0.js.map | 6 + ...-module-attribute_input_0scutbfo13k0p._.js | 4 +- ...oss-module-barrel_input_0pg1--73_0gbu._.js | 4 +- ...le-cycle-constant_input_13shj11lx78r9._.js | 4 +- ...ule-cycle-dynamic_input_0y6rllfq_jecq._.js | 4 +- ...s-module-imported_input_1h-za4-_ttkv-._.js | 4 +- ...ule-long-literals_input_1dlt5gz60hx2n._.js | 4 +- ...oss-module-strict_input_0lz7wh6sby-77._.js | 4 +- ...time_early-return_input_00p0fdz0d5nhi._.js | 4 +- ...t_comptime_typeof_input_1y4b353ijz1yk._.js | 52 +++--- ...mptime_typeof_input_1y4b353ijz1yk._.js.map | 10 +- ...s_browser_input_index_0bjegbrfzt05o.js.map | 16 +- ...g-ids_browser_input_index_0bjegbrfzt05o.js | 20 +- .../node/output/[turbopack]_runtime.js | 16 +- .../node/output/[turbopack]_runtime.js.map | 16 +- ...ck-tests_tests_snapshot_1xzb8pohmqk06._.js | 2 + ...ests_tests_snapshot_1xzb8pohmqk06._.js.map | 8 +- ...export-alls_cjs-2_input_212xd9jyjh6hy._.js | 12 +- ...rt-alls_cjs-2_input_212xd9jyjh6hy._.js.map | 8 +- ...meta_esm-multiple_input_0__oir9q6_sm5._.js | 4 +- ...-meta_esm-mutable_input_20u-wgbvzfds9._.js | 4 +- ...t-meta_esm-object_input_0akuaiya2a112._.js | 4 +- ...t_import-meta_esm_input_0m4yc4rpllbvz._.js | 4 +- ...duplicate-binding_input_05k3-r-zlo2y8._.js | 4 +- ...hot_imports_order_input_1wfk3l4bfp2ys._.js | 4 +- ...tatic-and-dynamic_input_0dm2mkcc8iok2._.js | 4 +- ...xport-with-locals_input_0fa40prz2spda._.js | 4 +- ...ffect-free-facade_input_1nl1qrj_-qqwu._.js | 4 +- ...tree-shake-test-1_input_1mlxku40v_-py._.js | 4 +- ...scaping-namespace_input_1ysta134r3dyz._.js | 2 +- ...ing-namespace_input_1ysta134r3dyz._.js.map | 2 +- ...med-and-preserved_input_0pbreftkp_5pc._.js | 2 +- ...and-preserved_input_0pbreftkp_5pc._.js.map | 2 +- ...rts_single-export_input_1mf78g4ogdhgv._.js | 2 +- ...single-export_input_1mf78g4ogdhgv._.js.map | 2 +- ...ode_spawn_dynamic_input_0ow1swaxdiv8b._.js | 4 +- ...e_spawn_node_eval_input_2055vpqzks2dy._.js | 4 +- ...d-imports_exports_input_07rt4kfe5xt7p._.js | 4 +- ...import-string-key_input_03-1fx5_29uet._.js | 2 +- ...rt-string-key_input_03-1fx5_29uet._.js.map | 2 +- .../output/[turbopack]_runtime.js | 16 +- .../output/[turbopack]_runtime.js.map | 10 +- ...t_dev_runtime_input_index_1nyzk54ttnrxp.js | 16 +- ...v_runtime_input_index_1nyzk54ttnrxp.js.map | 14 +- ..._input-source-map_input_0n-g1xc4-d7nb._.js | 4 +- ...ps_merged-unicode_input_1tq4mpj1076n4._.js | 30 +-- ...erged-unicode_input_1tq4mpj1076n4._.js.map | 8 +- ...ck-tests_tests_snapshot_16i0hbsemtixh._.js | 4 +- ...ms_preset_env_input_index_0t5kch25fdgzz.js | 16 +- ...reset_env_input_index_0t5kch25fdgzz.js.map | 8 +- ...preset_env_modern_input_1utkugv09yioo._.js | 4 +- ..._jsconfig-baseurl_input_0qbibqfoqauyh._.js | 4 +- ...ers_basic_input_index_0oed6jwa3wl3l.js.map | 14 +- ...rs_basic_input_worker_0lqk-upqfi2y2.js.map | 14 +- ...workers_basic_input_index_0oed6jwa3wl3l.js | 16 +- ...orkers_basic_input_worker_0lqk-upqfi2y2.js | 16 +- ...rs_shared_input_index_104lg7l6zj4d0.js.map | 14 +- ...s_shared_input_worker_1im1g730qzysb.js.map | 14 +- ...orkers_shared_input_index_104lg7l6zj4d0.js | 16 +- ...rkers_shared_input_worker_1im1g730qzysb.js | 16 +- 108 files changed, 819 insertions(+), 396 deletions(-) create mode 100644 turbopack/crates/turbopack-ecmascript/src/chunk/factory_group.rs create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js.map rename turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/{0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js.map => 0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js.map} (100%) delete mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js.map create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js.map create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js.map create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js create mode 100644 turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js.map diff --git a/crates/next-api/src/server_actions.rs b/crates/next-api/src/server_actions.rs index cd5a58504393..e7f55f8b119c 100644 --- a/crates/next-api/src/server_actions.rs +++ b/crates/next-api/src/server_actions.rs @@ -634,10 +634,10 @@ async fn module_hash( } else { None }; - let code = chunk_item.code(async_info); + let factory = chunk_item.code(async_info).await?; RcStr::from(deterministic_hash( "", - (ident_str, code.source_code_hash().await?), + (ident_str, factory.code.to_code().source_code_hash().await?), HashAlgorithm::Xxh3Hash128Hex, )) } else { diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/content.rs b/turbopack/crates/turbopack-browser/src/ecmascript/content.rs index bf006187d552..53104a180f50 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/content.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/content.rs @@ -14,7 +14,10 @@ use turbopack_core::{ version::{MergeableVersionedContent, Version, VersionedContent, VersionedContentMerger}, }; use turbopack_ecmascript::{ - chunk::{EcmascriptChunkContent, EcmascriptChunkContentEntries}, + chunk::{ + EcmascriptChunkContent, EcmascriptChunkContentEntries, strict_chunk_wrapper, + strict_factory_mode, write_module_factories, + }, hmr::{ EcmascriptHmrChunkContent, merger::EcmascriptChunkContentMerger, version::EcmascriptChunkVersion, @@ -85,6 +88,22 @@ impl EcmascriptBrowserChunkContent { *this.chunking_context.debug_ids_enabled().await?, ); + let supports_arrow_functions = *this + .chunking_context + .environment() + .runtime_versions() + .supports_arrow_functions() + .await?; + let content = this.content.await?; + let chunk_items = content.chunk_item_code_module_ids_and_paths().await?; + let strict_factory_mode = strict_factory_mode(&chunk_items, supports_arrow_functions); + + let strict_chunk_wrapper = + strict_chunk_wrapper(strict_factory_mode, supports_arrow_functions); + if let Some((prefix, _)) = strict_chunk_wrapper { + code += prefix; + } + // When a chunk is executed, it will either register itself with the current // instance of the runtime, or it will push itself onto the list of pending // chunks (using the configured chunk loading global variable). @@ -100,17 +119,18 @@ impl EcmascriptBrowserChunkContent { r#"(globalThis[{chunk_loading_global}] || (globalThis[{chunk_loading_global}] = [])).push([{script_or_path},"#, chunk_loading_global = StringifyJs(&chunk_loading_global), )?; + write_module_factories( + &mut code, + &chunk_items, + strict_factory_mode, + supports_arrow_functions, + )?; + write!(code, "\n]);")?; - let content = this.content.await?; - let chunk_items = content.chunk_item_code_module_ids_and_paths().await?; - for (id, item_code, _) in &chunk_items { - write!(code, "\n{}, ", StringifyJs(id))?; - code.push_code(item_code); - write!(code, ",")?; + if let Some((_, suffix)) = strict_chunk_wrapper { + code += suffix; } - write!(code, "\n]);")?; - let mut code = code.build(); if let MinifyType::Minify { mangle } = *this.chunking_context.minify_type().await? { diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-types.d.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-types.d.ts index ad44d98ebcf7..7fd9bda5343b 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-types.d.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-types.d.ts @@ -88,11 +88,15 @@ type ModuleCache = Record // TODO properly type values here type ModuleFactories = Map /** - * This is an alternating, non-empty arrow of module factory functions and module ids + * This is an alternating, non-empty array of module factory functions and module ids * `[id1, id2..., factory1, id3, factory2, id4, id5, factory3]` - * There can be multiple ids to support scope hoisted merged modules + * There can be multiple ids to support scope hoisted merged modules. + * The strict mode module factories of a chunk can be prepended as a nested array, + * which the chunk creates inside a `"use strict"` IIFE. */ -type CompressedModuleFactories = Array +type CompressedModuleFactories = Array< + ModuleId | Function | Array +> type RelativeURL = (inputUrl: string) => void type ResolvePathFromModule = (moduleId: string) => string diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-utils.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-utils.ts index da41ee1b66e9..ddd1a7389b97 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-utils.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime/runtime-utils.ts @@ -578,12 +578,9 @@ function getChunkPath(chunkData: ChunkData): ChunkPath { return typeof chunkData === 'string' ? chunkData : chunkData.path } -// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map. -// The CompressedModuleFactories format is -// - 1 or more module ids -// - a module factory function -// So walking this is a little complex but the flat structure is also fast to -// traverse, we can use `typeof` operators to distinguish the two cases. +// Load the CompressedModuleFactories of a chunk into the `moduleFactories` Map. +// The flat format alternates one or more module IDs with their factory function. +// Strict factories can be prepended as a nested array. function installCompressedModuleFactories( chunkModules: CompressedModuleFactories, offset: number, @@ -591,6 +588,16 @@ function installCompressedModuleFactories( newModuleId?: (id: ModuleId) => void ) { let i = offset + const strictFactories = chunkModules[i] + if (Array.isArray(strictFactories)) { + installCompressedModuleFactories( + strictFactories, + 0, + moduleFactories, + newModuleId + ) + i++ + } while (i < chunkModules.length) { let end = i + 1 // Find our factory function @@ -634,7 +641,7 @@ function installCompressedModuleFactories( newModuleId?.(id) } } - i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array. + i = end + 1 } } diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/code_module_ids_and_paths.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/code_module_ids_and_paths.rs index 7dececa5fa93..87203039de0a 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/code_module_ids_and_paths.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/code_module_ids_and_paths.rs @@ -2,7 +2,10 @@ use anyhow::Result; use rustc_hash::FxHashMap; use smallvec::{SmallVec, smallvec}; use turbo_rcstr::RcStr; -use turbo_tasks::{ReadRef, TryJoinIterExt, ValueToString, Vc}; +use turbo_tasks::{ + NonLocalValue, ReadRef, TryJoinIterExt, ValueToString, Vc, debug::ValueDebugFormat, + trace::TraceRawVcs, +}; use turbopack_core::{ chunk::{ChunkItem, ChunkItemExt, ModuleId}, code_builder::Code, @@ -13,8 +16,31 @@ use crate::chunk::{ EcmascriptChunkItemWithAsyncInfo, }; +async fn code_module_id_and_path( + item: &EcmascriptChunkItemWithAsyncInfo, +) -> Result { + let factory = item + .chunk_item + .code(item.async_info.map(|info| *info)) + .await?; + Ok(CodeModuleIdAndPath { + id: item.chunk_item.id().await?, + code: factory.code.to_code().await?, + path: item.chunk_item.asset_ident().to_string().owned().await?, + strict: factory.strict, + }) +} + +#[derive(Clone, PartialEq, Eq, TraceRawVcs, ValueDebugFormat, NonLocalValue)] +pub struct CodeModuleIdAndPath { + pub id: ModuleId, + pub code: ReadRef, + pub path: RcStr, + pub strict: bool, +} + #[turbo_tasks::value(transparent, serialization = "skip")] -pub struct CodeModuleIdsAndPaths(SmallVec<[(ModuleId, ReadRef, RcStr); 1]>); +pub struct CodeModuleIdsAndPaths(SmallVec<[CodeModuleIdAndPath; 1]>); #[turbo_tasks::value(transparent, serialization = "skip")] pub struct BatchGroupCodeModuleIdsAndPaths( @@ -48,29 +74,14 @@ pub async fn item_code_module_ids_and_paths( item: EcmascriptChunkItemOrBatchWithAsyncInfo, ) -> Result> { Ok(Vc::cell(match item { - EcmascriptChunkItemOrBatchWithAsyncInfo::ChunkItem(EcmascriptChunkItemWithAsyncInfo { - chunk_item, - async_info, - .. - }) => { - let id = chunk_item.id().await?; - let code = chunk_item.code(async_info.map(|info| *info)); - let path = chunk_item.asset_ident().to_string().owned().await?; - smallvec![(id, code.await?, path)] + EcmascriptChunkItemOrBatchWithAsyncInfo::ChunkItem(item) => { + smallvec![code_module_id_and_path(&item).await?] } EcmascriptChunkItemOrBatchWithAsyncInfo::Batch(batch) => batch .await? .chunk_items .iter() - .map(async |item| { - Ok(( - item.chunk_item.id().await?, - item.chunk_item - .code(item.async_info.map(|info| *info)) - .await?, - item.chunk_item.asset_ident().to_string().owned().await?, - )) - }) + .map(code_module_id_and_path) .try_join() .await? .into(), diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs index 1897afa3ec23..ba816613f606 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/content.rs @@ -2,14 +2,11 @@ use std::future::IntoFuture; use anyhow::Result; use either::Either; -use turbo_rcstr::RcStr; -use turbo_tasks::{ReadRef, ResolvedVc, TryJoinIterExt, Vc}; -use turbopack_core::{ - chunk::{ChunkItem, ChunkItems, ModuleId, batch_info}, - code_builder::Code, -}; +use turbo_tasks::{ResolvedVc, TryJoinIterExt, Vc}; +use turbopack_core::chunk::{ChunkItem, ChunkItems, batch_info}; use crate::chunk::{ + CodeModuleIdAndPath, batch::{EcmascriptChunkItemBatchGroup, EcmascriptChunkItemOrBatchWithAsyncInfo}, batch_group_code_module_ids_and_paths, item_code_module_ids_and_paths, }; @@ -52,9 +49,7 @@ impl EcmascriptChunkContent { } impl EcmascriptChunkContent { - pub async fn chunk_item_code_module_ids_and_paths( - &self, - ) -> Result, RcStr)>> { + pub async fn chunk_item_code_module_ids_and_paths(&self) -> Result> { let chunk_item_groups = batch_info( &self.batch_groups, &self.chunk_items, @@ -68,8 +63,7 @@ impl EcmascriptChunkContent { .collect::>(); // Sort all items by their module path so that similar modules stay // together and the chunks gzip better. - chunk_items - .sort_by(|(a_id, _, a_path), (b_id, _, b_path)| (a_path, a_id).cmp(&(b_path, b_id))); + chunk_items.sort_by(|a, b| (&a.path, &a.id).cmp(&(&b.path, &b.id))); Ok(chunk_items) } } diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/content_entry.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/content_entry.rs index 3abe23600eef..c42bcaaf64ff 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/content_entry.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/content_entry.rs @@ -29,7 +29,8 @@ impl EcmascriptChunkContentEntry { chunk_item: ResolvedVc>, async_module_info: Option>, ) -> Result { - let code = chunk_item.code(async_module_info).to_resolved().await?; + let factory = chunk_item.code(async_module_info).await?; + let code = factory.code.to_code().to_resolved().await?; Ok(EcmascriptChunkContentEntry { code, hash: code.source_code_hash().to_resolved().await?, diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/factory_group.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/factory_group.rs new file mode 100644 index 000000000000..612b1680cae4 --- /dev/null +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/factory_group.rs @@ -0,0 +1,172 @@ +use std::io::Write; + +use anyhow::Result; +use turbopack_core::code_builder::CodeBuilder; + +use crate::{chunk::CodeModuleIdAndPath, utils::StringifyJs}; + +const MIXED_ARROW_PREFIX: &str = "\n(()=>{\"use strict\";return["; +const MIXED_FUNCTION_PREFIX: &str = "\n(function(){\"use strict\";return["; +const MIXED_SUFFIX: &str = "\n]})(),"; +const ALL_STRICT_ARROW_PREFIX: &str = "(()=>{\"use strict\";"; +const ALL_STRICT_FUNCTION_PREFIX: &str = "(function(){\"use strict\";"; +const ALL_STRICT_SUFFIX: &str = "})()"; + +/// Minimum number of strict factories that makes hoisting the directive worth its wrapper. +/// Derived from the minified wrapper sizes and pinned by `strict_thresholds_match_wrapper_sizes`. +/// The mixed wrappers differ in length but land on the same minimum; the all-strict ones do not, +/// which is why arrow support still selects between two constants here. +const MIXED_STRICT_THRESHOLD: usize = 3; +const ALL_STRICT_ARROW_THRESHOLD: usize = 2; +const ALL_STRICT_FUNCTION_THRESHOLD: usize = 3; + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum StrictFactoryMode { + Flat, + Mixed, + AllStrict, +} + +/// Selects the smallest expected minified representation for this chunk's mix of module factories. +pub fn strict_factory_mode( + chunk_items: &[CodeModuleIdAndPath], + supports_arrow_functions: bool, +) -> StrictFactoryMode { + let mut strict = 0; + let mut non_strict = 0; + for item in chunk_items { + if item.strict { + strict += 1; + } else { + non_strict += 1; + } + } + if strict == 0 { + return StrictFactoryMode::Flat; + } + + let mode = if non_strict == 0 { + StrictFactoryMode::AllStrict + } else { + StrictFactoryMode::Mixed + }; + let threshold = match (mode, supports_arrow_functions) { + (StrictFactoryMode::Mixed, _) => MIXED_STRICT_THRESHOLD, + (StrictFactoryMode::AllStrict, true) => ALL_STRICT_ARROW_THRESHOLD, + (StrictFactoryMode::AllStrict, false) => ALL_STRICT_FUNCTION_THRESHOLD, + (StrictFactoryMode::Flat, _) => unreachable!(), + }; + if strict >= threshold { + mode + } else { + StrictFactoryMode::Flat + } +} + +/// Code written around the whole chunk in the all-strict case. +pub fn strict_chunk_wrapper( + mode: StrictFactoryMode, + supports_arrow_functions: bool, +) -> Option<(&'static str, &'static str)> { + (mode == StrictFactoryMode::AllStrict).then(|| { + ( + all_strict_prefix(supports_arrow_functions), + ALL_STRICT_SUFFIX, + ) + }) +} + +const fn mixed_prefix(supports_arrow_functions: bool) -> &'static str { + if supports_arrow_functions { + MIXED_ARROW_PREFIX + } else { + MIXED_FUNCTION_PREFIX + } +} + +const fn all_strict_prefix(supports_arrow_functions: bool) -> &'static str { + if supports_arrow_functions { + ALL_STRICT_ARROW_PREFIX + } else { + ALL_STRICT_FUNCTION_PREFIX + } +} + +/// Writes flat factories, with a strict IIFE prepended to the non-strict factories in mixed chunks. +pub fn write_module_factories( + code: &mut CodeBuilder, + chunk_items: &[CodeModuleIdAndPath], + mode: StrictFactoryMode, + supports_arrow_functions: bool, +) -> Result<()> { + if mode == StrictFactoryMode::Mixed { + *code += mixed_prefix(supports_arrow_functions); + write_factories(code, chunk_items, |strict| strict)?; + *code += MIXED_SUFFIX; + write_factories(code, chunk_items, |strict| !strict)?; + } else { + write_factories(code, chunk_items, |_| true)?; + } + Ok(()) +} + +fn write_factories( + code: &mut CodeBuilder, + chunk_items: &[CodeModuleIdAndPath], + include: impl Fn(bool) -> bool, +) -> Result<()> { + for item in chunk_items { + if include(item.strict) { + write!(code, "\n{}, ", StringifyJs(&item.id))?; + code.push_code(&item.code); + write!(code, ",")?; + } + } + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + /// Minified length of the `"use strict";` directive that + /// `EcmascriptChunkItemContent::module_factory` writes into every strict factory, and that + /// the minimizer removes again inside a strict wrapper. The trailing newlines the factory + /// writes do not survive minification, so they are not counted. Kept here because only these + /// assertions need it. + const STRICT_MODE_DIRECTIVE_LEN: usize = "\"use strict\";".len(); + + fn minified_len(wrapper: &str) -> usize { + // Formatting whitespace is only added at line boundaries. Trim each line rather than all + // whitespace so the space inside the `"use strict"` string literal is preserved. + wrapper.lines().map(str::trim).map(str::len).sum() + } + + /// `threshold` must be the smallest factory count worth grouping: one below it the directives + /// do not outweigh the wrapper, at the threshold they do. + fn assert_threshold(threshold: usize, wrapper: &str) { + let wrapper_len = minified_len(wrapper); + assert!((threshold - 1) * STRICT_MODE_DIRECTIVE_LEN <= wrapper_len); + assert!(threshold * STRICT_MODE_DIRECTIVE_LEN > wrapper_len); + } + + #[test] + fn strict_thresholds_match_wrapper_sizes() { + assert_threshold( + MIXED_STRICT_THRESHOLD, + &format!("{MIXED_ARROW_PREFIX}{MIXED_SUFFIX}"), + ); + assert_threshold( + MIXED_STRICT_THRESHOLD, + &format!("{MIXED_FUNCTION_PREFIX}{MIXED_SUFFIX}"), + ); + assert_threshold( + ALL_STRICT_ARROW_THRESHOLD, + &format!("{ALL_STRICT_ARROW_PREFIX}{ALL_STRICT_SUFFIX}"), + ); + assert_threshold( + ALL_STRICT_FUNCTION_THRESHOLD, + &format!("{ALL_STRICT_FUNCTION_PREFIX}{ALL_STRICT_SUFFIX}"), + ); + } +} diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs index 8ad26c5bb3cd..f5585ffbff36 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs @@ -6,7 +6,8 @@ use bincode::{Decode, Encode}; use smallvec::SmallVec; use turbo_rcstr::{RcStr, rcstr}; use turbo_tasks::{ - NonLocalValue, PrettyPrintError, ResolvedVc, Upcast, ValueToString, Vc, trace::TraceRawVcs, + NonLocalValue, PrettyPrintError, ReadRef, ResolvedVc, Upcast, ValueToString, Vc, + trace::TraceRawVcs, }; use turbo_tasks_fs::{FileSystemPath, rope::Rope}; use turbopack_core::{ @@ -14,7 +15,7 @@ use turbopack_core::{ AsyncModuleInfo, ChunkItem, ChunkItemWithAsyncModuleInfo, ChunkType, ChunkingContext, ChunkingContextExt, ModuleId, SourceMapSourceType, }, - code_builder::{Code, CodeBuilder, PersistedCode}, + code_builder::{CodeBuilder, PersistedCode}, ident::AssetIdent, issue::{IssueExt, IssueSeverity, StyledString, code_gen::CodeGenerationIssue}, module::Module, @@ -256,9 +257,18 @@ pub trait EcmascriptChunkItem: ChunkItem + OutputAssetsReference { ) -> Result>; } +#[turbo_tasks::value] +pub struct EcmascriptChunkItemCode { + pub code: ResolvedVc, + pub strict: bool, +} + pub trait EcmascriptChunkItemExt { - /// Generates the module factory for this chunk item. - fn code(self: Vc, async_module_info: Option>) -> Vc; + /// Generates the module factory and returns whether it must run in strict mode. + fn code( + self: Vc, + async_module_info: Option>, + ) -> Vc; } impl EcmascriptChunkItemExt for T @@ -266,9 +276,11 @@ where T: Upcast>, { /// Generates the module factory for this chunk item. - fn code(self: Vc, async_module_info: Option>) -> Vc { + fn code( + self: Vc, + async_module_info: Option>, + ) -> Vc { module_factory_with_code_generation_issue(Vc::upcast_non_strict(self), async_module_info) - .to_code() } } @@ -276,21 +288,25 @@ where async fn module_factory_with_code_generation_issue( chunk_item: Vc>, async_module_info: Option>, -) -> Result> { +) -> Result> { async fn get_content( chunk_item: Vc>, async_module_info: Option>, - ) -> Result> { - let chunk_item_ref = chunk_item.into_trait_ref().await?; - let content = chunk_item_ref + ) -> Result> { + chunk_item + .into_trait_ref() + .await? .content_with_async_module_info(async_module_info, false) .await? - .await?; - content.module_factory().await + .await } - let content = get_content(chunk_item, async_module_info).await; - Ok(match content { - Ok(factory) => *factory, + + let (code, strict) = match get_content(chunk_item, async_module_info).await { + Ok(content) => (content.module_factory().await, content.options.strict), + Err(error) => (Err(error), false), + }; + let code = match code { + Ok(factory) => factory, Err(error) => { let id = chunk_item.asset_ident().to_string().await; let id = id.as_ref().map_or_else(|_| "unknown", |id| &**id); @@ -315,9 +331,10 @@ async fn module_factory_with_code_generation_issue( code += "(() => {{\n\n"; writeln!(code, "throw new Error({error});", error = js_error_message)?; code += "\n}})"; - *code.build().cell_persisted() + code.build().cell_persisted() } - }) + }; + Ok(EcmascriptChunkItemCode { code, strict }.cell()) } /// Generic chunk item that wraps any EcmascriptChunkPlaceable module. diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs index c229066fda26..7be9a73a2c29 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs @@ -4,6 +4,7 @@ pub(crate) mod code_module_ids_and_paths; pub(crate) mod content; pub(crate) mod content_entry; pub(crate) mod data; +pub(crate) mod factory_group; pub(crate) mod item; pub(crate) mod placeable; @@ -31,15 +32,19 @@ pub use self::{ }, chunk_type::EcmascriptChunkType, code_module_ids_and_paths::{ - BatchGroupCodeModuleIdsAndPaths, CodeModuleIdsAndPaths, + BatchGroupCodeModuleIdsAndPaths, CodeModuleIdAndPath, CodeModuleIdsAndPaths, batch_group_code_module_ids_and_paths, item_code_module_ids_and_paths, }, content::EcmascriptChunkContent, content_entry::{EcmascriptChunkContentEntries, EcmascriptChunkContentEntry}, data::EcmascriptChunkData, + factory_group::{ + StrictFactoryMode, strict_chunk_wrapper, strict_factory_mode, write_module_factories, + }, item::{ - EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkItemExt, - EcmascriptChunkItemOptions, EcmascriptChunkItemWithAsyncInfo, ecmascript_chunk_item, + EcmascriptChunkItem, EcmascriptChunkItemCode, EcmascriptChunkItemContent, + EcmascriptChunkItemExt, EcmascriptChunkItemOptions, EcmascriptChunkItemWithAsyncInfo, + ecmascript_chunk_item, }, placeable::{CjsStaticExports, EcmascriptChunkPlaceable, EcmascriptExports}, }; diff --git a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs index 82d4c72b0c2d..4f068626a33d 100644 --- a/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs +++ b/turbopack/crates/turbopack-nodejs/src/ecmascript/node/content.rs @@ -10,13 +10,15 @@ use turbopack_core::{ version::{MergeableVersionedContent, Version, VersionedContent, VersionedContentMerger}, }; use turbopack_ecmascript::{ - chunk::{EcmascriptChunkContent, EcmascriptChunkContentEntries}, + chunk::{ + EcmascriptChunkContent, EcmascriptChunkContentEntries, strict_chunk_wrapper, + strict_factory_mode, write_module_factories, + }, hmr::{ EcmascriptHmrChunkContent, merger::EcmascriptChunkContentMerger, version::EcmascriptChunkVersion, }, minify::minify, - utils::StringifyJs, }; use super::chunk::EcmascriptBuildNodeChunk; @@ -60,18 +62,32 @@ impl EcmascriptNodeChunkContent { .await?; let mut code = CodeBuilder::new(true, *self.chunking_context.debug_ids_enabled().await?); - - write!(code, "module.exports = [")?; - + let supports_arrow_functions = *self + .chunking_context + .environment() + .runtime_versions() + .supports_arrow_functions() + .await?; let content = self.content.await?; let chunk_items = content.chunk_item_code_module_ids_and_paths().await?; - for (id, item_code, _) in &chunk_items { - write!(code, "\n{}, ", StringifyJs(id))?; - code.push_code(item_code); - write!(code, ",")?; - } + let strict_factory_mode = strict_factory_mode(&chunk_items, supports_arrow_functions); + let strict_chunk_wrapper = + strict_chunk_wrapper(strict_factory_mode, supports_arrow_functions); + if let Some((prefix, _)) = strict_chunk_wrapper { + code += prefix; + } + write!(code, "module.exports = [")?; + write_module_factories( + &mut code, + &chunk_items, + strict_factory_mode, + supports_arrow_functions, + )?; write!(code, "\n];")?; + if let Some((_, suffix)) = strict_chunk_wrapper { + code += suffix; + } let mut code = code.build(); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js index ff91a8209f3d..e71e71fa0373 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -180,6 +180,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_1b34ju5a6z6v3.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js index cc56eb63656b..5c32ec148bb3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -92,6 +92,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_export-named_input_0xj7cshvyczs_._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js index 19b09f16be00..e79a6670f5e3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -187,6 +187,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_export-namespace_input_1mqgz2-3_b4v8._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js index cef624f4916c..1ca05111b11c 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -75,6 +75,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_import-named-all_input_1orhvu2sihqe-._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js index 01a3353f88c5..f1d7357f0a22 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -75,6 +75,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_import-named_input_1j9uhcyhqdoze._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js index c961f16a2299..34ae25dce464 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -171,6 +171,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_import-namespace_input_1ippwh3yc_l3v._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js index e1a674eed97a..f979e4d5d29e 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -51,6 +51,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__["a"] += '!'; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_import-side-effect_input_1_hdh9its1vdz._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js index 3de73b86d67a..ec09065d3887 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js @@ -1,8 +1,5 @@ (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js", -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/index.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { - -const { cat } = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript)"); -}), +(()=>{"use strict";return[ "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -184,6 +181,11 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), +]})(), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/index.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { + +const { cat } = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript)"); +}), ]); //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js.map index 53593d7c0707..94e8bdd3d3cb 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/1jsg_tests_snapshot_basic-tree-shake_require-side-effect_input_0fs4qhn32cnvu._.js.map @@ -2,16 +2,16 @@ "version": 3, "sources": [], "sections": [ - {"offset": {"line": 3, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/index.js"],"sourcesContent":["const { cat } = require('./lib')\n"],"names":["cat"],"mappings":"AAAA,MAAM,EAAEA,GAAG,EAAE"}}, - {"offset": {"line": 8, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, - {"offset": {"line": 26, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, - {"offset": {"line": 48, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["dog"],"mappings":";;;;;AAAA,IAAIA,MAAM"}}, - {"offset": {"line": 59, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":[],"mappings":";;;AAEA,+PAAG,IAAI;AAQP,+PAAG,IAAI"}}, - {"offset": {"line": 68, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["console","log"],"mappings":";;;;;;;AAIAA,QAAQC,GAAG,CAAC,+PAAG;AAQfD,QAAQC,GAAG,CAAC,+PAAG;AAQfD,QAAQC,GAAG,CAAC,+PAAG"}}, - {"offset": {"line": 83, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["getDog","setDog","newDog","dogRef","initial","get","set"],"mappings":";;;;;;;;;;;;;;;;;AAMA,SAASA;IACP,OAAO,+PAAG;AACZ;AAMA,SAASC,OAAOC,MAAM;IACpB,+PAAG,GAAGA;AACR;AAMO,MAAMC,SAAS;IACpBC,SAAS,+PAAG;IACZC,KAAKL;IACLM,KAAKL;AACP"}}, - {"offset": {"line": 119, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":[],"mappings":";;;;;AAkBA,+PAAG,IAAI"}}, - {"offset": {"line": 129, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["cat"],"mappings":";;;;;AA4BO,IAAIA,MAAM"}}, - {"offset": {"line": 140, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["initialCat"],"mappings":";;;;;;;;;AA8BO,MAAMA,aAAa,+PAAG"}}, - {"offset": {"line": 156, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["getChimera"],"mappings":";;;;;;;;;;;;;AAgCO,SAASA;IACd,OAAO,+PAAG,GAAG,+PAAG;AAClB"}}, - {"offset": {"line": 178, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}] + {"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, + {"offset": {"line": 23, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, + {"offset": {"line": 45, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["dog"],"mappings":";;;;;AAAA,IAAIA,MAAM"}}, + {"offset": {"line": 56, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":[],"mappings":";;;AAEA,+PAAG,IAAI;AAQP,+PAAG,IAAI"}}, + {"offset": {"line": 65, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["console","log"],"mappings":";;;;;;;AAIAA,QAAQC,GAAG,CAAC,+PAAG;AAQfD,QAAQC,GAAG,CAAC,+PAAG;AAQfD,QAAQC,GAAG,CAAC,+PAAG"}}, + {"offset": {"line": 80, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["getDog","setDog","newDog","dogRef","initial","get","set"],"mappings":";;;;;;;;;;;;;;;;;AAMA,SAASA;IACP,OAAO,+PAAG;AACZ;AAMA,SAASC,OAAOC,MAAM;IACpB,+PAAG,GAAGA;AACR;AAMO,MAAMC,SAAS;IACpBC,SAAS,+PAAG;IACZC,KAAKL;IACLM,KAAKL;AACP"}}, + {"offset": {"line": 116, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":[],"mappings":";;;;;AAkBA,+PAAG,IAAI"}}, + {"offset": {"line": 126, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["cat"],"mappings":";;;;;AA4BO,IAAIA,MAAM"}}, + {"offset": {"line": 137, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["initialCat"],"mappings":";;;;;;;;;AA8BO,MAAMA,aAAa,+PAAG"}}, + {"offset": {"line": 153, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js"],"sourcesContent":["let dog = 'dog'\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction getDog() {\n return dog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nfunction setDog(newDog) {\n dog = newDog\n}\n\ndog += '!'\n\nconsole.log(dog)\n\nexport const dogRef = {\n initial: dog,\n get: getDog,\n set: setDog,\n}\n\nexport let cat = 'cat'\n\nexport const initialCat = cat\n\nexport function getChimera() {\n return cat + dog\n}\n"],"names":["getChimera"],"mappings":";;;;;;;;;;;;;AAgCO,SAASA;IACd,OAAO,+PAAG,GAAG,+PAAG;AAClB"}}, + {"offset": {"line": 175, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, + {"offset": {"line": 186, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/index.js"],"sourcesContent":["const { cat } = require('./lib')\n"],"names":["cat"],"mappings":"AAAA,MAAM,EAAEA,GAAG,EAAE"}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js index 1a7d7e262ea8..28b46e0d583d 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -180,6 +180,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_07jttq51-r0-b.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js index 169ceef8335e..0bbbf1b51f55 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/input/import.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -23,6 +23,6 @@ function foo(value) { console.assert(value); } }), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_1lkohl-aes1w9._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/0_9x_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_0aldykipaj64f._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/0_9x_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_0aldykipaj64f._.js index a43b7875186b..82ca52e51235 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/0_9x_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_0aldykipaj64f._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/0_9x_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_0aldykipaj64f._.js @@ -1,4 +1,4 @@ -module.exports = [ +(()=>{"use strict";module.exports = [ "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/input/import.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -23,6 +23,6 @@ function foo(value) { console.assert(value); } }), -]; +];})() //# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_0aldykipaj64f._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js index 8be3d678cff1..487bde69bc49 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -18,6 +18,6 @@ function foo(value) { console.assert(value); } }), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1_yzgm1kllkx5._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/export-default/output/1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/export-default/output/1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js index f70fd4688c33..5f84eb8a11eb 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/export-default/output/1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/export-default/output/1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/export-default/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -19,6 +19,6 @@ __turbopack_context__.s([ __TURBOPACK__default__export__ ]); }), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_export-default_input_1k9-ja77l7ynd._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js index 4297bcd714e9..2284f0a4af30 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -18,6 +18,6 @@ function foo(value) { console.assert(value); } }), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_shebang_input_02e38zhtmusm6._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js index e678d043819a..207d8b4e2ff8 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/UserAPI.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -49,6 +49,6 @@ const close = ()=>{ }; __turbopack_async_result__(); } catch(e) { __turbopack_async_result__(e); } }, true);}), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_0zs_dr_r82cwm._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js index 54f64d9b5364..853aa529a2b7 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/Actions.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -34,6 +34,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo console.log('created user John'); })(); }), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_1ih204k-kik67._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js new file mode 100644 index 000000000000..41715495f45f --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js @@ -0,0 +1 @@ +export const a = 1 diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js new file mode 100644 index 000000000000..2e9a7c1c293e --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js @@ -0,0 +1 @@ +export const b = 2 diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js new file mode 100644 index 000000000000..99f649690c4f --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js @@ -0,0 +1,4 @@ +import { a } from './all-strict-a' +import { b } from './all-strict-b' + +export const value = a + b diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js new file mode 100644 index 000000000000..3aee44a1eb39 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js @@ -0,0 +1 @@ +export const value = 2 diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js index ff1fe73ae2b9..750d99f9df02 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js @@ -1,4 +1,15 @@ 'use strict' -console.log('this is CJS') -module.exports = 1234 +const strictA = require('./strict-a') +const strictB = require('./strict-b').default +const sloppy = require('./non-strict') + +import('./below-threshold').then(({ value }) => { + console.log('below threshold', value) +}) +import('./all-strict').then(({ value }) => { + console.log('all strict', value) +}) + +console.log('this is CJS', strictA, strictB, sloppy) +module.exports = strictA + strictB + sloppy diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js new file mode 100644 index 000000000000..916bbf382326 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js @@ -0,0 +1,3 @@ +module.exports = (function () { + return this === globalThis ? 34 : 0 +})() diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js new file mode 100644 index 000000000000..599fe94db7c6 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = 1000 diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js new file mode 100644 index 000000000000..f02c66655596 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js @@ -0,0 +1 @@ +export default 200 diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js deleted file mode 100644 index 5c32047506a0..000000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js +++ /dev/null @@ -1,10 +0,0 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js", -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { -"use strict"; - -console.log('this is CJS'); -module.exports = 1234; -}), -]); - -//# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js.map deleted file mode 100644 index 099ea083cceb..000000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": [], - "sections": [ - {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js"],"sourcesContent":["'use strict'\n\nconsole.log('this is CJS')\nmodule.exports = 1234\n"],"names":["console","log","module","exports"],"mappings":"AAEAA,QAAQC,GAAG,CAAC;AACZC,OAAOC,OAAO,GAAG"}}] -} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js.map similarity index 100% rename from turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js.map rename to turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js.map diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js deleted file mode 100644 index a3916c755aee..000000000000 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js +++ /dev/null @@ -1,5 +0,0 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([ - "output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_06b3uhycu7sip.js", - {"otherChunks":["output/0_9x_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0nlvx9556vyf1.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js [test] (ecmascript)"]} -]); -// Dummy runtime \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js new file mode 100644 index 000000000000..d85518b06021 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js @@ -0,0 +1,5 @@ +(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([ + "output/0rv8_turbopack-tests_tests_snapshot_basic_use-strict_input_index_0r4xda1wnxaqk.js", + {"otherChunks":["output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js","output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js [test] (ecmascript)"]} +]); +// Dummy runtime \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js new file mode 100644 index 000000000000..3d46eee35bdd --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js @@ -0,0 +1,22 @@ +(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js", +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js [test] (ecmascript, async loader)", ((__turbopack_context__) => { + +__turbopack_context__.v((parentImport) => { + return Promise.all([ + "output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js" +].map((chunk) => __turbopack_context__.l(chunk))).then(() => { + return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js [test] (ecmascript)"); + }); +}); +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js [test] (ecmascript, async loader)", ((__turbopack_context__) => { + +__turbopack_context__.v((parentImport) => { + return Promise.all([ + "output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js" +].map((chunk) => __turbopack_context__.l(chunk))).then(() => { + return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js [test] (ecmascript)"); + }); +}); +}), +]); \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js.map new file mode 100644 index 000000000000..c15d7ec00382 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_0czj5szeqd2rf._.js.map @@ -0,0 +1,5 @@ +{ + "version": 3, + "sources": [], + "sections": [] +} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js new file mode 100644 index 000000000000..016f920965c0 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js @@ -0,0 +1,35 @@ +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js", +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js [test] (ecmascript)", ((__turbopack_context__) => { +"use strict"; + +__turbopack_context__.s([ + "a", + ()=>a +]); +const a = 1; +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js [test] (ecmascript)", ((__turbopack_context__) => { +"use strict"; + +__turbopack_context__.s([ + "b", + ()=>b +]); +const b = 2; +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js [test] (ecmascript)", ((__turbopack_context__) => { +"use strict"; + +__turbopack_context__.s([ + "value", + ()=>value +]); +var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$use$2d$strict$2f$input$2f$all$2d$strict$2d$a$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js [test] (ecmascript)"); +var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$use$2d$strict$2f$input$2f$all$2d$strict$2d$b$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js [test] (ecmascript)"); +; +; +const value = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$use$2d$strict$2f$input$2f$all$2d$strict$2d$a$2e$js__$5b$test$5d$__$28$ecmascript$29$__["a"] + __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$use$2d$strict$2f$input$2f$all$2d$strict$2d$b$2e$js__$5b$test$5d$__$28$ecmascript$29$__["b"]; +}), +]);})() + +//# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js.map new file mode 100644 index 000000000000..406799b6fa9c --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1fuq2pc5luz9r._.js.map @@ -0,0 +1,8 @@ +{ + "version": 3, + "sources": [], + "sections": [ + {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-a.js"],"sourcesContent":["export const a = 1\n"],"names":["a"],"mappings":";;;;AAAO,MAAMA,IAAI"}}, + {"offset": {"line": 13, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict-b.js"],"sourcesContent":["export const b = 2\n"],"names":["b"],"mappings":";;;;AAAO,MAAMA,IAAI"}}, + {"offset": {"line": 22, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js"],"sourcesContent":["import { a } from './all-strict-a'\nimport { b } from './all-strict-b'\n\nexport const value = a + b\n"],"names":["value"],"mappings":";;;;AAAA;AACA;;;AAEO,MAAMA,QAAQ,sNAAC,GAAG,sNAAC"}}] +} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js new file mode 100644 index 000000000000..b2f09e1085b7 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js @@ -0,0 +1,41 @@ +(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js", +(()=>{"use strict";return[ +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { +"use strict"; + +const strictA = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js [test] (ecmascript)"); +const strictB = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js [test] (ecmascript)").default; +const sloppy = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js [test] (ecmascript)"); +__turbopack_context__.A("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js [test] (ecmascript, async loader)").then(({ value })=>{ + console.log('below threshold', value); +}); +__turbopack_context__.A("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/all-strict.js [test] (ecmascript, async loader)").then(({ value })=>{ + console.log('all strict', value); +}); +console.log('this is CJS', strictA, strictB, sloppy); +module.exports = strictA + strictB + sloppy; +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { +"use strict"; + +module.exports = 1000; +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js [test] (ecmascript)", ((__turbopack_context__) => { +"use strict"; + +__turbopack_context__.s([ + "default", + ()=>__TURBOPACK__default__export__ +]); +const __TURBOPACK__default__export__ = 200; +}), +]})(), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { + +module.exports = function() { + return this === globalThis ? 34 : 0; +}(); +}), +]); + +//# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js.map new file mode 100644 index 000000000000..4502eb46c08b --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1do3_crates_turbopack-tests_tests_snapshot_basic_use-strict_input_1wmp5yoyw-hht._.js.map @@ -0,0 +1,9 @@ +{ + "version": 3, + "sources": [], + "sections": [ + {"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/index.js"],"sourcesContent":["'use strict'\n\nconst strictA = require('./strict-a')\nconst strictB = require('./strict-b').default\nconst sloppy = require('./non-strict')\n\nimport('./below-threshold').then(({ value }) => {\n console.log('below threshold', value)\n})\nimport('./all-strict').then(({ value }) => {\n console.log('all strict', value)\n})\n\nconsole.log('this is CJS', strictA, strictB, sloppy)\nmodule.exports = strictA + strictB + sloppy\n"],"names":["strictA","strictB","default","sloppy","then","value","console","log","module","exports"],"mappings":"AAEA,MAAMA;AACN,MAAMC,UAAU,4IAAsBC,OAAO;AAC7C,MAAMC;AAEN,iKAA4BC,IAAI,CAAC,CAAC,EAAEC,KAAK,EAAE;IACzCC,QAAQC,GAAG,CAAC,mBAAmBF;AACjC;AACA,4JAAuBD,IAAI,CAAC,CAAC,EAAEC,KAAK,EAAE;IACpCC,QAAQC,GAAG,CAAC,cAAcF;AAC5B;AAEAC,QAAQC,GAAG,CAAC,eAAeP,SAASC,SAASE;AAC7CK,OAAOC,OAAO,GAAGT,UAAUC,UAAUE"}}, + {"offset": {"line": 20, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-a.js"],"sourcesContent":["'use strict'\n\nmodule.exports = 1000\n"],"names":["module","exports"],"mappings":"AAEAA,OAAOC,OAAO,GAAG"}}, + {"offset": {"line": 25, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/strict-b.js"],"sourcesContent":["export default 200\n"],"names":[],"mappings":";;;;uCAAe"}}, + {"offset": {"line": 34, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/non-strict.js"],"sourcesContent":["module.exports = (function () {\n return this === globalThis ? 34 : 0\n})()\n"],"names":["module","exports","globalThis"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AAAC;IAChB,OAAO,IAAI,KAAKC,aAAa,KAAK;AACpC"}}] +} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js new file mode 100644 index 000000000000..8f1aeb5a9e7a --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js @@ -0,0 +1,13 @@ +(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js", +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js [test] (ecmascript)", ((__turbopack_context__) => { +"use strict"; + +__turbopack_context__.s([ + "value", + ()=>value +]); +const value = 2; +}), +]); + +//# sourceMappingURL=1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js.map new file mode 100644 index 000000000000..787f51fd7237 --- /dev/null +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/output/1jsg_tests_snapshot_basic_use-strict_input_below-threshold_1my1mnvsmmqb0.js.map @@ -0,0 +1,6 @@ +{ + "version": 3, + "sources": [], + "sections": [ + {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/use-strict/input/below-threshold.js"],"sourcesContent":["export const value = 2\n"],"names":["value"],"mappings":";;;;AAAO,MAAMA,QAAQ"}}] +} \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-attribute/output/1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-attribute/output/1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js index 105354316776..312adf4a89d5 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-attribute/output/1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-attribute/output/1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-attribute/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -57,6 +57,6 @@ __turbopack_context__.s([ const lower = 'lowercase'; const UPPER = 'UPPER'; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_comptime_cross-module-attribute_input_0scutbfo13k0p._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-barrel/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-barrel/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js index 351f523f15f3..d285fa720f31 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-barrel/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-barrel/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-barrel/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -28,6 +28,6 @@ function foo() { return 123; } }), -]); +]);})() //# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-barrel_input_0pg1--73_0gbu._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-constant/output/1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-constant/output/1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js index 3aa7ed7ecf3f..6b5aa9a3d4e1 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-constant/output/1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-constant/output/1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-constant/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -29,6 +29,6 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; const TWO = '2' + __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$comptime$2f$cross$2d$module$2d$cycle$2d$constant$2f$input$2f$multiple$2d$1$2e$js__$5b$test$5d$__$28$ecmascript$29$__["ONE"]; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_comptime_cross-module-cycle-constant_input_13shj11lx78r9._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-dynamic/output/1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-dynamic/output/1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js index 37b80337ac93..dfd74b0ef09f 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-dynamic/output/1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-dynamic/output/1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-cycle-dynamic/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -54,6 +54,6 @@ function foo1(left, right) { } ; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_comptime_cross-module-cycle-dynamic_input_0y6rllfq_jecq._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-imported/output/1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-imported/output/1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js index 4a5a5d6eec00..78f9bdf02719 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-imported/output/1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-imported/output/1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-imported/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -45,6 +45,6 @@ __turbopack_context__.s([ const REEXPORTED = 'reexported'; const IMPORTED_EXPORTED = 'imported exported'; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_comptime_cross-module-imported_input_1h-za4-_ttkv-._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-long-literals/output/1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-long-literals/output/1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js index efc453e5f2d4..424367ebeabe 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-long-literals/output/1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-long-literals/output/1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-long-literals/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -52,6 +52,6 @@ const REGEX = /ab/i; const NAN = NaN; const INFINITY = Infinity; }), -]); +]);})() //# sourceMappingURL=1jsg_tests_snapshot_comptime_cross-module-long-literals_input_1dlt5gz60hx2n._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-strict/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-strict/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js index 1f752879bc36..1a3ce7bbc2c4 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-strict/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-strict/output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/cross-module-strict/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -51,6 +51,6 @@ const LONG_NUMBER = 21345672345678345678901234567890; const LONG_BIG_NUMBER = 21345672345678345678901234567890n; const LONG_REGEX = /abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789/i; }), -]); +]);})() //# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_comptime_cross-module-strict_input_0lz7wh6sby-77._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js index 1240e19e97d9..3024ea10f23c 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js @@ -1,4 +1,4 @@ -(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js", +(()=>{"use strict";(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js", "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/input/index.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -226,6 +226,6 @@ z1(); return; z2(); }), -]); +]);})() //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_00p0fdz0d5nhi._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js index bf598a8e6dda..682647ba4b7d 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js @@ -1,29 +1,5 @@ (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js", -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/cjs.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { - -var __TURBOPACK__import$2e$meta__ = { - get url () { - return __turbopack_context__.F("turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/cjs.js"); - }, - env: { - DEV: true, - PROD: false, - MODE: "development", - BASE_URL: "/", - SSR: false - } -}; -console.log('typeof require', ("TURBOPACK compile-time value", "function")); -console.log('typeof import.meta', ("TURBOPACK compile-time value", "object")); -// CJS, should be `object` -console.log('typeof module', ("TURBOPACK compile-time value", "object")); -console.log('typeof exports', ("TURBOPACK compile-time value", "object")); -// CJS, should be real require -console.log(/*TURBOPACK member replacement*/ __turbopack_context__.t); -}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/dep.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { - -}), +(()=>{"use strict";return[ "[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/esm-automatic.js [test] (ecmascript)", ((__turbopack_context__) => { "use strict"; @@ -84,6 +60,32 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; ; ; +}), +]})(), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/cjs.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { + +var __TURBOPACK__import$2e$meta__ = { + get url () { + return __turbopack_context__.F("turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/cjs.js"); + }, + env: { + DEV: true, + PROD: false, + MODE: "development", + BASE_URL: "/", + SSR: false + } +}; +console.log('typeof require', ("TURBOPACK compile-time value", "function")); +console.log('typeof import.meta', ("TURBOPACK compile-time value", "object")); +// CJS, should be `object` +console.log('typeof module', ("TURBOPACK compile-time value", "object")); +console.log('typeof exports', ("TURBOPACK compile-time value", "object")); +// CJS, should be real require +console.log(/*TURBOPACK member replacement*/ __turbopack_context__.t); +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/dep.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => { + }), ]); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js.map index 227b5e663a42..5e5d8604722c 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/output/1do3_crates_turbopack-tests_tests_snapshot_comptime_typeof_input_1y4b353ijz1yk._.js.map @@ -2,9 +2,9 @@ "version": 3, "sources": [], "sections": [ - {"offset": {"line": 3, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/cjs.js"],"sourcesContent":["console.log('typeof require', typeof require)\nconsole.log('typeof import.meta', typeof import.meta)\n// CJS, should be `object`\nconsole.log('typeof module', typeof module)\nconsole.log('typeof exports', typeof exports)\n\n// CJS, should be real require\nconsole.log(require)\n"],"names":["console","log"],"mappings":";;;;;;;;;;;;AAAAA,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AACZ,0BAA0B;AAC1BD,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AAEZ,8BAA8B;AAC9BD,QAAQC,GAAG"}}, - {"offset": {"line": 25, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, - {"offset": {"line": 29, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/esm-automatic.js"],"sourcesContent":["import './dep.js'\n\nconsole.log('typeof require', typeof require)\nconsole.log('typeof import.meta', typeof import.meta)\n// ESM, should be `undefined`\nconsole.log('typeof module', typeof module)\nconsole.log('typeof exports', typeof exports)\n\n// ESM, should be require stub\nconsole.log(require)\n"],"names":["console","log"],"mappings":";AAAA;;;;;;;;;;;;;;AAEAA,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AACZ,6BAA6B;AAC7BD,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AAEZ,8BAA8B;AAC9BD,QAAQC,GAAG"}}, - {"offset": {"line": 55, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/esm-specified.mjs"],"sourcesContent":["console.log('typeof require', typeof require)\nconsole.log('typeof import.meta', typeof import.meta)\n// ESM, should be `undefined`\nconsole.log('typeof module', typeof module)\nconsole.log('typeof exports', typeof exports)\n\n// ESM, should be require stub\nconsole.log(require)\n"],"names":["console","log"],"mappings":";;;;;;;;;;;;;AAAAA,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AACZ,6BAA6B;AAC7BD,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AAEZ,8BAA8B;AAC9BD,QAAQC,GAAG"}}, - {"offset": {"line": 79, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/index.js"],"sourcesContent":["import './cjs.js'\nimport './esm-automatic.js'\nimport './esm-specified.mjs'\n"],"names":[],"mappings":";AAAA;AACA;AACA"}}] + {"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/esm-automatic.js"],"sourcesContent":["import './dep.js'\n\nconsole.log('typeof require', typeof require)\nconsole.log('typeof import.meta', typeof import.meta)\n// ESM, should be `undefined`\nconsole.log('typeof module', typeof module)\nconsole.log('typeof exports', typeof exports)\n\n// ESM, should be require stub\nconsole.log(require)\n"],"names":["console","log"],"mappings":";AAAA;;;;;;;;;;;;;;AAEAA,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AACZ,6BAA6B;AAC7BD,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AAEZ,8BAA8B;AAC9BD,QAAQC,GAAG"}}, + {"offset": {"line": 31, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/esm-specified.mjs"],"sourcesContent":["console.log('typeof require', typeof require)\nconsole.log('typeof import.meta', typeof import.meta)\n// ESM, should be `undefined`\nconsole.log('typeof module', typeof module)\nconsole.log('typeof exports', typeof exports)\n\n// ESM, should be require stub\nconsole.log(require)\n"],"names":["console","log"],"mappings":";;;;;;;;;;;;;AAAAA,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AACZ,6BAA6B;AAC7BD,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AAEZ,8BAA8B;AAC9BD,QAAQC,GAAG"}}, + {"offset": {"line": 55, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/index.js"],"sourcesContent":["import './cjs.js'\nimport './esm-automatic.js'\nimport './esm-specified.mjs'\n"],"names":[],"mappings":";AAAA;AACA;AACA"}}, + {"offset": {"line": 66, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/comptime/typeof/input/cjs.js"],"sourcesContent":["console.log('typeof require', typeof require)\nconsole.log('typeof import.meta', typeof import.meta)\n// CJS, should be `object`\nconsole.log('typeof module', typeof module)\nconsole.log('typeof exports', typeof exports)\n\n// CJS, should be real require\nconsole.log(require)\n"],"names":["console","log"],"mappings":";;;;;;;;;;;;AAAAA,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AACZ,0BAA0B;AAC1BD,QAAQC,GAAG,CAAC;AACZD,QAAQC,GAAG,CAAC;AAEZ,8BAA8B;AAC9BD,QAAQC,GAAG"}}, + {"offset": {"line": 88, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/0_9x_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0bjegbrfzt05o.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/0_9x_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0bjegbrfzt05o.js.map index 3430c53be6f0..58a97bfc130e 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/0_9x_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0bjegbrfzt05o.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/0_9x_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0bjegbrfzt05o.js.map @@ -1,13 +1,13 @@ { "version": 3, "sources": [], - "debugId": "37ea5bcf-f259-1cd1-a144-361dcb52f06f", + "debugId": "77867742-97a1-7739-5b4e-e0fc46a40a42", "sections": [ - {"offset": {"line": 26, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\ntype EsmNamespaceObject = Record\n\n/**\n * Describes why a module was instantiated.\n * Shared between browser and Node.js runtimes.\n */\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\n/**\n * Flag indicating which module object type to create when a module is merged. Set to `true`\n * by each runtime that uses ModuleWithDirection (browser dev-base.ts, nodejs dev-base.ts,\n * nodejs build-base.ts). Browser production (build-base.ts) leaves it as `false` since it\n * uses plain Module objects.\n */\nlet createModuleWithDirectionFlag = false\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n if (createModuleWithDirectionFlag) {\n // set in development modes for hmr support\n module = createModuleWithDirection(id)\n } else {\n module = createModuleObject(id)\n }\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\nfunction createModuleWithDirection(id: ModuleId): ModuleWithDirection {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n parents: [],\n children: [],\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings, dynamic?: boolean) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n // The properties defined above are already non-configurable and\n // non-writable, so the namespace's existing exports are effectively\n // immutable. Sealing additionally makes the object non-extensible, matching\n // real ESM-namespace semantics. Modules with dynamic re-exports\n // (`export *` from a CommonJS module) must stay extensible so the dynamic\n // export proxy can surface keys discovered at runtime, so skip the seal for\n // them.\n if (!dynamic) Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined,\n dynamic?: boolean\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings, dynamic)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n // Returns the re-exported object that provides `prop` as an own property,\n // or `undefined` if none does. The traps share this logic so they always\n // agree on which keys are synthesized from `reexportedObjects`. `default`\n // is never re-exported by `export *`, so it is never synthesized.\n const reexportOwning = (prop: PropertyKey) => {\n if (prop !== 'default') {\n for (const obj of reexportedObjects!) {\n if (hasOwnProperty.call(obj, prop)) return obj\n }\n }\n return undefined\n }\n // Modules with dynamic re-exports are not sealed by `esm()`, so the\n // target beneath the namespace stays extensible. That is what lets the\n // `ownKeys` and `getOwnPropertyDescriptor` traps legally report keys that\n // exist on `reexportedObjects` but not on the target itself.\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n const obj = reexportOwning(prop)\n return obj && Reflect.get(obj, prop)\n },\n // The namespace is read-only, like a real esm namespace object. The\n // re-exported modules can still mutate their own exports (exposed live\n // via `get`), but mutating the namespace itself is rejected. Refusing\n // here, rather than forwarding to the extensible target, also prevents an\n // assignment/definition from shadowing a dynamic re-export. It also\n // prevents delete from removing a static export.\n set() {\n return false\n },\n defineProperty() {\n return false\n },\n deleteProperty() {\n return false\n },\n // The `has` trap ensures that `'exportName' in starImports` will reflect\n // the truth of whether a key is exported.\n has(target, prop) {\n if (Reflect.has(target, prop)) return true\n if (prop === 'default' || prop === '__esModule') return false\n return reexportOwning(prop) !== undefined\n },\n // ownKeys and getOwnPropertyDescriptor together make the keys enumerable.\n // If a value is returned from `ownKeys` but its property descriptor is\n // not enumerable, it will not be visible to iterator methods.\n // Collectively, they allow code like the following:\n //\n // ```\n // // module.js re-exports dynamic CJS exports\n // export * from './legacyModule.cjs'\n //\n // // from another JS file, reference the re-exported dynamic values\n // import * as Namespace from './module.js'\n // Object.keys(Namespace)\n // ```\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n getOwnPropertyDescriptor(target, prop) {\n const own = Reflect.getOwnPropertyDescriptor(target, prop)\n if (own || prop === 'default' || prop === '__esModule') return own\n const obj = reexportOwning(prop)\n if (obj) {\n // Synthetic keys don't exist on the target, so they MUST be\n // reported as configurable. However the set/delete traps above will\n // prevent them from actually being changed\n return {\n enumerable: true,\n configurable: true,\n get: () => Reflect.get(obj, prop),\n }\n }\n return undefined\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\n// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.\n// The CompressedModuleFactories format is\n// - 1 or more module ids\n// - a module factory function\n// So walking this is a little complex but the flat structure is also fast to\n// traverse, we can use `typeof` operators to distinguish the two cases.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n while (i < chunkModules.length) {\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n\n // Install the factory for each module ID that doesn't already have one.\n // When some IDs in this group already have a factory, reuse that existing\n // group factory for the missing IDs to keep all IDs in the group consistent.\n // Otherwise, install the factory from this chunk.\n const moduleFactoryFn = chunkModules[end] as Function\n let existingGroupFactory: Function | undefined = undefined\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n const existingFactory = moduleFactories.get(id)\n if (existingFactory) {\n existingGroupFactory = existingFactory\n break\n }\n }\n const factoryToInstall = existingGroupFactory ?? moduleFactoryFn\n\n let didInstallFactory = false\n for (let j = i; j < end; j++) {\n const id = chunkModules[j] as ModuleId\n if (!moduleFactories.has(id)) {\n if (!didInstallFactory) {\n if (factoryToInstall === moduleFactoryFn) {\n applyModuleFactoryName(moduleFactoryFn)\n }\n didInstallFactory = true\n }\n moduleFactories.set(id, factoryToInstall)\n newModuleId?.(id)\n }\n }\n i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array.\n }\n}\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * Constructs an error message for when a module factory is not available.\n */\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["SourceType","createModuleWithDirectionFlag","REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleWithDirection","createModuleObject","error","undefined","namespaceObject","parents","children","BindingTag_Value","esm","bindings","dynamic","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","reexportOwning","prop","Proxy","target","Reflect","deleteProperty","has","ownKeys","keys","key","includes","push","getOwnPropertyDescriptor","own","configurable","dynamicExport","object","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","end","moduleFactoryFn","existingGroupFactory","existingFactory","factoryToInstall","didInstallFactory","applyModuleFactoryName","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","U","invariant","never","computeMessage","factoryNotAvailableMessage","sourceType","sourceData","instantiationReason","requireStub","_moduleId","z","g","globalThis","factory"],"mappings":"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","ignoreList":[0]}}, - {"offset": {"line": 551, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime/async-module.ts"],"sourcesContent":["/// \n/// \n\n/**\n * Top-level-await / async-module machinery. This is only included in the runtime\n * when the module graph actually contains an async module (a module with\n * top-level await, or one that transitively depends on one). When no async\n * module is present, the chunk items never reference `__turbopack_context__.a`,\n * so this whole file can be omitted.\n *\n * everything below is adapted from webpack\n * https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n */\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n"],"names":["turbopackQueues","Symbol","turbopackExports","turbopackError","isPromise","maybePromise","then","isAsyncModuleExt","obj","createPromise","resolve","reject","promise","Promise","res","rej","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","map","dep","Object","assign","err","asyncModule","body","hasAwait","module","m","undefined","depQueues","Set","rawPromise","exports","attributes","get","set","v","defineProperty","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","has","add","push","asyncResult","contextPrototype","a"],"mappings":"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","ignoreList":[0]}}, - {"offset": {"line": 683, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_ASSET_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it\n// can't be detected via `document.currentScript`. Note it's stored in reversed\n// order to use `push` and `pop`\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n// Used in WebWorkers to override the regular chunk base path with the base\n// used for the worker entrypoint and its initial chunks.\ndeclare var TURBOPACK_CHUNK_BASE_PATH: string | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var ASSET_SUFFIX: string\ndeclare var CROSS_ORIGIN: 'anonymous' | 'use-credentials' | null\ndeclare var CHUNK_LOAD_RETRY_MAX_ATTEMPTS: number\ndeclare var CHUNK_LOAD_RETRY_BASE_DELAY_MS: number\ndeclare var CHUNK_LOAD_RETRY_MAX_JITTER_MS: number\ndeclare const SUPPORT_COMPONENT_CHUNKS: boolean\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\nconst RUNTIME_CHUNK_BASE_PATH =\n typeof TURBOPACK_CHUNK_BASE_PATH === 'string'\n ? TURBOPACK_CHUNK_BASE_PATH\n : CHUNK_BASE_PATH\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistrationChunk =\n | ChunkPath\n | { getAttribute: (name: string) => string | null }\n | undefined\n\ntype ChunkRegistration = [\n chunkPath: ChunkRegistrationChunk,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkRegistrationChunk\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\ninterface RuntimeBackend {\n /**\n * Registers a chunk. `chunk` is `undefined` for an inlined entry-only registration\n * (no source chunk): the params' other chunks are loaded and its runtime modules run\n * with no self chunk identity.\n */\n registerChunk: (\n chunk: ChunkPath | ChunkScript | undefined,\n params?: RuntimeParams\n ) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\n// Registry mapping a merged chunk's path to its constituent component chunk paths.\nconst chunkComponents: Map = new Map()\n\n// Registry mapping a component chunk's path to its size in bytes, used by the\n// split-vs-whole cost heuristic.\nconst componentChunkSizes: Map = new Map()\n\nfunction registerComponentChunkSizes(\n componentChunks: ChunkPath[],\n sizes: number[]\n): void {\n for (let i = 0; i < componentChunks.length; i++) {\n const size = sizes[i]\n if (size !== undefined) {\n componentChunkSizes.set(componentChunks[i], size)\n }\n }\n}\n\ntype ChunkUrlOrMerged = ChunkUrl | [ChunkUrl, ChunkPath[], number[]]\n\n// Memoizes the composite promise returned for a merged chunk loaded by URL, keyed by URL.\nconst splitChunkPromises: Map> = new Map()\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\n// `chunkPath` is the source chunk; it is `undefined` for entry-only registrations,\n// which have no self chunk.\nfunction loadInitialChunk(\n chunkPath: ChunkPath | undefined,\n chunkData: ChunkData\n) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n let promise: Promise\n if (SUPPORT_COMPONENT_CHUNKS) {\n const componentChunks = chunkData.moduleChunks || []\n // We already have this chunk's component list inline (chunkData.moduleChunks) and split on it\n // here, so the whole-chunk fallback uses loadChunkByUrlWhole to skip loadChunkByUrlInternal's\n // chunkComponents-registry lookup, which would just repeat the same split decision.\n promise = loadComponentChunksOrWhole(\n sourceType,\n sourceData,\n componentChunks,\n getChunkRelativeUrl(chunkData.path)\n )\n } else {\n promise = loadChunkByUrlWhole(\n sourceType,\n sourceData,\n getChunkRelativeUrl(chunkData.path)\n )\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\n/**\n * Approximate cost of an extra HTTP request, expressed in emitted (minified, uncompressed) chunk\n * bytes, used to decide whether splitting a merged chunk into individually-cached component\n * chunks is worthwhile.\n */\nconst REQUEST_COST_BYTES = 20_000\n\n/**\n * Decides whether to load a merged chunk's component chunks individually instead of the whole\n * merged chunk, weighing the bytes saved (the available components we avoid re-downloading)\n * against the extra network requests splitting incurs.\n *\n * Splitting issues one request per unavailable component vs. a single request for the merged\n * chunk, so it adds `unavailableCount - 1` extra requests. When at most one component needs the\n * network, splitting never costs more requests than the merged load (and transfers fewer bytes),\n * so it always wins. Otherwise it's only worth it when the available bytes exceed the extra\n * request cost.\n */\nfunction shouldLoadComponentChunks(\n availableBytes: number,\n unavailableCount: number\n): boolean {\n if (unavailableCount <= 1) {\n return true\n }\n return availableBytes > REQUEST_COST_BYTES * (unavailableCount - 1)\n}\n\n/**\n * Loads a chunk's component chunks individually when enough of them are already available\n * in memory (avoiding re-downloading the ones we have, per `shouldLoadComponentChunks`),\n * otherwise loads the whole chunk from `chunkUrl` and records its component chunks as available.\n */\nfunction loadComponentChunksOrWhole(\n sourceType: SourceType,\n sourceData: SourceData,\n componentChunks: ChunkPath[],\n chunkUrl: ChunkUrl\n): Promise {\n const componentChunkPromises: Array | true> = []\n let availableBytes = 0\n let unavailableCount = 0\n for (const componentChunk of componentChunks) {\n const available = availableModuleChunks.get(componentChunk)\n if (available) {\n componentChunkPromises.push(available)\n availableBytes += componentChunkSizes.get(componentChunk) ?? 0\n } else {\n unavailableCount++\n }\n }\n\n if (\n componentChunkPromises.length > 0 &&\n shouldLoadComponentChunks(availableBytes, unavailableCount)\n ) {\n // Enough component chunks are already loaded or loading that splitting saves more\n // bytes than the extra requests cost.\n for (const componentChunk of componentChunks) {\n if (!availableModuleChunks.has(componentChunk)) {\n const promise = loadChunkPath(sourceType, sourceData, componentChunk)\n availableModuleChunks.set(componentChunk, promise)\n componentChunkPromises.push(promise)\n }\n }\n return Promise.all(componentChunkPromises)\n }\n\n // Not enough is available in memory for splitting to pay off. Load the\n // whole chunk in a single request and record its component chunks as available.\n const promise = loadChunkByUrlWhole(sourceType, sourceData, chunkUrl)\n for (const componentChunk of componentChunks) {\n if (!availableModuleChunks.has(componentChunk)) {\n availableModuleChunks.set(componentChunk, promise)\n }\n }\n return promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkEntry: ChunkUrlOrMerged\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkEntry)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkEntry: ChunkUrlOrMerged\n): Promise {\n if (SUPPORT_COMPONENT_CHUNKS) {\n // A merged chunk arrives as a `[url, componentChunkPaths, componentChunkSizes]` array. Register\n // the components so a by-URL load of this merged chunk — now or from a later navigation — can\n // be split, and so `registerChunk` can mark them available when the whole chunk loads.\n let chunkUrl: ChunkUrl\n let components: ChunkPath[] | undefined\n if (typeof chunkEntry === 'string') {\n chunkUrl = chunkEntry\n } else {\n let componentSizes: number[]\n ;[chunkUrl, components, componentSizes] = chunkEntry\n registerComponentChunkSizes(components, componentSizes)\n }\n const chunkPath = chunkUrlToPath(chunkUrl)\n if (components !== undefined) {\n chunkComponents.set(chunkPath, components)\n } else {\n // A plain URL may still be a merged chunk we already registered from its array.\n components = chunkComponents.get(chunkPath)\n }\n\n // If we have component chunks for this merged chunk, load only the ones we don't already have\n // instead of the whole merged chunk.\n if (components !== undefined) {\n let promise = splitChunkPromises.get(chunkUrl)\n if (promise === undefined) {\n promise = loadComponentChunksOrWhole(\n sourceType,\n sourceData,\n components,\n chunkUrl\n )\n splitChunkPromises.set(chunkUrl, promise)\n }\n return promise\n }\n\n // This is a non-merged chunk. If its modules were already loaded — e.g. this chunk is a\n // component of a merged chunk fetched on a previous navigation — reuse that load instead of\n // re-downloading.\n const existing = availableModuleChunks.get(chunkPath)\n if (existing !== undefined) {\n return existing === true ? loadedChunk : existing\n }\n const promise = loadChunkByUrlWhole(sourceType, sourceData, chunkUrl)\n availableModuleChunks.set(chunkPath, promise)\n return promise\n }\n\n // Component chunks are disabled, so the chunking context never emits merged arrays and every\n // entry is a plain chunk URL. Load it whole; the backend dedupes repeated URLs.\n return loadChunkByUrlWhole(sourceType, sourceData, chunkEntry as ChunkUrl)\n}\n\n// Convert a chunk URL back to its ChunkPath (strip base path, query/hash, decode), to\n// match the keys stored in `chunkComponents`.\nfunction chunkUrlToPath(chunkUrl: ChunkUrl): ChunkPath {\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n return (\n src.startsWith(RUNTIME_CHUNK_BASE_PATH)\n ? src.slice(RUNTIME_CHUNK_BASE_PATH.length)\n : src\n ) as ChunkPath\n}\n\n/**\n * When a merged chunk finishes registering (e.g. an initial-load `