Skip to content

[dynamicIO] cache tracking for bundler globals#75397

Draft
lubieowoce wants to merge 2 commits into
lubieowoce/dynamic-io-top-level-awaitfrom
lubieowoce/bundler-global-cache-tracking
Draft

[dynamicIO] cache tracking for bundler globals#75397
lubieowoce wants to merge 2 commits into
lubieowoce/dynamic-io-top-level-awaitfrom
lubieowoce/bundler-global-cache-tracking

Conversation

@lubieowoce
Copy link
Copy Markdown
Member

@lubieowoce lubieowoce commented Jan 28, 2025

adds a transform that wraps calls to bundler globals like __turbopack_load__ in a cache signal

@ijjk ijjk added created-by: Next.js team PRs by the Next.js team. Turbopack Related to Turbopack with Next.js. type: next labels Jan 28, 2025
Copy link
Copy Markdown
Member Author

lubieowoce commented Jan 28, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lubieowoce lubieowoce changed the title wip transform: cache signal tracking for bundler globals Jan 28, 2025
@lubieowoce lubieowoce changed the title transform: cache signal tracking for bundler globals transform: cache tracking for bundler globals Jan 28, 2025
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-import-cache-tracking branch from aa83dee to 0fb433f Compare February 3, 2025 12:11
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from bf85998 to 94d16d8 Compare February 3, 2025 12:12
@lubieowoce lubieowoce changed the base branch from lubieowoce/dynamic-import-cache-tracking to graphite-base/75397 April 24, 2025 15:52
@lubieowoce lubieowoce force-pushed the graphite-base/75397 branch from 0fb433f to 766f45a Compare April 24, 2025 15:52
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from 94d16d8 to 85e88af Compare April 24, 2025 15:52
@lubieowoce lubieowoce changed the base branch from graphite-base/75397 to lubieowoce/top-level-dynamic-import-cache-tracking April 24, 2025 15:52
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from 766f45a to d2aff4b Compare April 24, 2025 15:57
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from 85e88af to bcb2385 Compare April 24, 2025 15:57
@ijjk
Copy link
Copy Markdown
Member

ijjk commented Apr 24, 2025

Failing test suites

Commit: d9fe969

pnpm test-start test/e2e/app-dir/dynamic-io-dynamic-imports/dynamic-io-dynamic-imports.test.ts

  • async imports in dynamicIO > does not cause any routes to become (partially) dynamic
Expand output

● async imports in dynamicIO › does not cause any routes to become (partially) dynamic

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `async imports in dynamicIO does not cause any routes to become (partially) dynamic 1`

- Snapshot  - 0
+ Received  + 1

@@ -10,8 +10,9 @@
    "/inside-render/server/sync-module",
    "/outside-of-render/client/async-module",
    "/outside-of-render/client/sync-module",
    "/outside-of-render/server/async-module",
    "/outside-of-render/server/sync-module",
+   "/top-level-await-in-segment",
    "/top-level-await-in-segment/client",
    "/top-level-await-in-segment/server",
  ]

  40 |       }
  41 |
> 42 |       expect(prerenderedRoutes).toMatchInlineSnapshot(`
     |                                 ^
  43 |        [
  44 |          "/inside-render/client/async-module",
  45 |          "/inside-render/client/sync-module",

  at Object.toMatchInlineSnapshot (e2e/app-dir/dynamic-io-dynamic-imports/dynamic-io-dynamic-imports.test.ts:42:33)

Read more about building and testing Next.js in contributing.md.

pnpm test-dev-turbo test/e2e/app-dir/actions/app-action-node-middleware.test.ts (turbopack)

  • app-dir action handling > should forward action request to a worker that contains the action handler (node)
  • app-dir action handling > should forward action request to a worker that contains the action handler (edge)
Expand output

● app-dir action handling › should forward action request to a worker that contains the action handler (node)

page.waitForSelector: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('#other-page')

  454 |   waitForElementByCss(selector: string, timeout = 10_000) {
  455 |     return this.startChain(async () => {
> 456 |       const el = await page.waitForSelector(selector, {
      |                             ^
  457 |         timeout,
  458 |         state: 'attached',
  459 |       })

  at waitForSelector (lib/browsers/playwright.ts:456:29)
  at e2e/app-dir/actions/app-action.test.ts:897:7
  at Proxy._chain (lib/browsers/playwright.ts:568:23)
  at Proxy._chain (lib/browsers/playwright.ts:549:17)
  at Proxy.startChain (lib/browsers/playwright.ts:455:17)
  at waitForElementByCss (e2e/app-dir/actions/app-action.test.ts:900:10)

● app-dir action handling › should forward action request to a worker that contains the action handler (edge)

page.waitForSelector: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('#other-page')

  454 |   waitForElementByCss(selector: string, timeout = 10_000) {
  455 |     return this.startChain(async () => {
> 456 |       const el = await page.waitForSelector(selector, {
      |                             ^
  457 |         timeout,
  458 |         state: 'attached',
  459 |       })

  at waitForSelector (lib/browsers/playwright.ts:456:29)
  at e2e/app-dir/actions/app-action.test.ts:897:7
  at Proxy._chain (lib/browsers/playwright.ts:568:23)
  at Proxy._chain (lib/browsers/playwright.ts:549:17)
  at Proxy.startChain (lib/browsers/playwright.ts:455:17)
  at waitForElementByCss (e2e/app-dir/actions/app-action.test.ts:900:10)

Read more about building and testing Next.js in contributing.md.

pnpm test-start-turbo test/e2e/app-dir/segment-cache/client-only-opt-in/client-only-opt-in.test.ts (turbopack)

  • segment cache prefetch scheduling > prefetches a dynamic page (without PPR enabled)
Expand output

● segment cache prefetch scheduling › prefetches a dynamic page (without PPR enabled)

thrown: "Exceeded timeout of 120000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

  89 |   })
  90 |
> 91 |   it('prefetches a dynamic page (without PPR enabled)', async () => {
     |   ^
  92 |     let act: ReturnType<typeof createRouterAct>
  93 |     const browser = await next.browser('/', {
  94 |       beforePageLoad(p: Playwright.Page) {

  at it (e2e/app-dir/segment-cache/client-only-opt-in/client-only-opt-in.test.ts:91:3)
  at Object.describe (e2e/app-dir/segment-cache/client-only-opt-in/client-only-opt-in.test.ts:5:1)

Read more about building and testing Next.js in contributing.md.

pnpm test-dev test/e2e/persistent-caching/persistent-caching.test.ts

  • persistent-caching > should persistent cache loaders
Expand output

● persistent-caching › should persistent cache loaders

expect(received).toBe(expected) // Object.is equality

Expected: "Timestamp = 1746566531596"
Received: "Timestamp = 1746566552579"

  69 |       const browser = await next.browser('/pages')
  70 |       // TODO Persistent Caching for webpack dev server is broken
> 71 |       expect(await browser.elementByCss('main').text()).toBe(pagesTimestamp)
     |                                                         ^
  72 |       await browser.close()
  73 |     }
  74 |   })

  at Object.toBe (e2e/persistent-caching/persistent-caching.test.ts:71:57)

Read more about building and testing Next.js in contributing.md.

@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from d2aff4b to d753caa Compare April 25, 2025 03:24
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from bcb2385 to 2b2bb8f Compare April 25, 2025 03:24
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from d753caa to 0531ed9 Compare April 25, 2025 03:29
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch 2 times, most recently from 23382f3 to 392c24e Compare April 25, 2025 12:57
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from 0531ed9 to 66d8cea Compare April 25, 2025 12:57
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from 392c24e to 630d7ee Compare April 25, 2025 14:04
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch 2 times, most recently from 2dd25f7 to 921b310 Compare April 25, 2025 18:22
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from 630d7ee to 518857e Compare April 25, 2025 18:22
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from 921b310 to d406e1f Compare April 25, 2025 19:00
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch 2 times, most recently from bac0093 to ae22c86 Compare April 25, 2025 19:53
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from 2b8e9c3 to 28f6648 Compare April 29, 2025 05:53
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch 2 times, most recently from 6e759aa to b58b256 Compare April 29, 2025 06:00
@lubieowoce lubieowoce force-pushed the lubieowoce/top-level-dynamic-import-cache-tracking branch from 029e54c to 7879090 Compare April 29, 2025 06:00
@lubieowoce lubieowoce changed the base branch from lubieowoce/top-level-dynamic-import-cache-tracking to graphite-base/75397 April 29, 2025 13:40
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from b58b256 to 8b8a957 Compare April 29, 2025 13:40
@lubieowoce lubieowoce force-pushed the graphite-base/75397 branch from 7879090 to 55b4b9f Compare April 29, 2025 13:40
@lubieowoce lubieowoce changed the base branch from graphite-base/75397 to lubieowoce/dynamic-io-top-level-await April 29, 2025 13:41
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from 55b4b9f to b32c5a8 Compare April 29, 2025 13:46
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch 2 times, most recently from 1c82281 to b470646 Compare April 29, 2025 15:46
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch 2 times, most recently from 451fe97 to ff35d80 Compare April 29, 2025 16:26
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from b470646 to a71b9bc Compare April 29, 2025 16:26
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from ff35d80 to f698b51 Compare April 29, 2025 16:52
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch 2 times, most recently from 3234e06 to 22c7800 Compare April 29, 2025 17:19
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch 2 times, most recently from db920c6 to c15290a Compare April 29, 2025 18:55
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from 22c7800 to 2210225 Compare April 29, 2025 18:55
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from c15290a to 18d0a3b Compare April 29, 2025 19:01
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch 2 times, most recently from 5110551 to 90d7c9f Compare April 30, 2025 00:39
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch from 18d0a3b to 46fa3fb Compare April 30, 2025 00:39
@lubieowoce lubieowoce force-pushed the lubieowoce/bundler-global-cache-tracking branch from 90d7c9f to e79cec1 Compare May 5, 2025 09:53
@lubieowoce lubieowoce force-pushed the lubieowoce/dynamic-io-top-level-await branch 2 times, most recently from ff0c5d7 to ef0072a Compare May 5, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by: Next.js team PRs by the Next.js team. Turbopack Related to Turbopack with Next.js. type: next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants