Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "move workUnitAsyncStorage into "client/components"" #71058

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/src/server/after/after.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../../server/app-render/work-unit-async-storage.external'
import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'

import { markCurrentScopeAsDynamic } from '../app-render/dynamic-rendering'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/app-render/action-handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'
import type { SizeLimit } from '../../types'
import type { RequestStore } from '../../client/components/work-unit-async-storage.external'
import type { RequestStore } from '../../server/app-render/work-unit-async-storage.external'
import type { AppRenderContext, GenerateFlight } from './app-render'
import type { AppPageModule } from '../../server/route-modules/app-page/module'
import type { BaseNextRequest, BaseNextResponse } from '../base-http'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
InitialRSCPayload,
} from './types'
import type { WorkStore } from '../../client/components/work-async-storage.external'
import type { RequestStore } from '../../client/components/work-unit-async-storage.external'
import type { RequestStore } from '../../server/app-render/work-unit-async-storage.external'
import type { NextParsedUrlQuery } from '../request-meta'
import type { LoaderTree } from '../lib/app-dir-module'
import type { AppPageModule } from '../route-modules/app-page/module'
Expand Down Expand Up @@ -151,7 +151,7 @@ import { waitAtLeastOneReactRenderTask } from '../../lib/scheduler'
import {
workUnitAsyncStorage,
type PrerenderStore,
} from '../../client/components/work-unit-async-storage.external'
} from './work-unit-async-storage.external'
import { CacheSignal } from './cache-signal'
import { getTracedMetadata } from '../lib/trace/utils'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { NextNodeServerSpan } from '../lib/trace/constants'
import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'
import type { LoadingModuleData } from '../../shared/lib/app-router-context.shared-runtime'
import type { Params } from '../request/params'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from './work-unit-async-storage.external'

/**
* Use the provided loader tree to create the React Component tree.
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/app-render/dynamic-rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import type { WorkStore } from '../../client/components/work-async-storage.external'
import type { WorkUnitStore } from '../../client/components/work-unit-async-storage.external'
import type { WorkUnitStore } from '../../server/app-render/work-unit-async-storage.external'

// Once postpone is in stable we should switch to importing the postpone export directly
import React from 'react'
Expand All @@ -32,7 +32,7 @@ import {
workUnitAsyncStorage,
type PrerenderStoreLegacy,
type PrerenderStoreModern,
} from '../../client/components/work-unit-async-storage.external'
} from './work-unit-async-storage.external'
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { makeHangingPromise } from '../dynamic-rendering-utils'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/app-render/entry-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export { prerender } from 'react-server-dom-webpack/static.edge'
import LayoutRouter from '../../client/components/layout-router'
import RenderFromTemplateContext from '../../client/components/render-from-template-context'
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from './work-unit-async-storage.external'
import { actionAsyncStorage } from '../../client/components/action-async-storage.external'
import { ClientPageRoot } from '../../client/components/client-page'
import { ClientSegmentRoot } from '../../client/components/client-segment'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAsyncLocalStorage } from './async-local-storage'
import { createAsyncLocalStorage } from '../../client/components/async-local-storage'
import type { WorkUnitAsyncStorage } from './work-unit-async-storage.external'

export const workUnitAsyncStorage: WorkUnitAsyncStorage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { DraftModeProvider } from '../../server/async-storage/draft-mode-pr
import type { ResponseCookies } from '../../server/web/spec-extension/cookies'
import type { ReadonlyHeaders } from '../../server/web/spec-extension/adapters/headers'
import type { ReadonlyRequestCookies } from '../../server/web/spec-extension/adapters/request-cookies'
import type { CacheSignal } from '../../server/app-render/cache-signal'
import type { DynamicTrackingState } from '../../server/app-render/dynamic-rendering'
import type { CacheSignal } from './cache-signal'
import type { DynamicTrackingState } from './dynamic-rendering'

// Share the instance module in the next-shared layer
import { workUnitAsyncStorage } from './work-unit-async-storage-instance' with { 'turbopack-transition': 'next-shared' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { AsyncLocalStorage } from 'async_hooks'
import type {
RequestStore,
WorkUnitStore,
} from '../../client/components/work-unit-async-storage.external'
} from '../../server/app-render/work-unit-async-storage.external'
import type { RenderOpts } from '../app-render/types'
import type { WithStore } from './with-store'
import type { NextRequest } from '../web/spec-extension/request'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/lib/patch-fetch.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AsyncLocalStorage } from 'node:async_hooks'
import type { WorkUnitStore } from '../../client/components/work-unit-async-storage.external'
import type { WorkUnitStore } from '../../server/app-render/work-unit-async-storage.external'
import type { WorkStore } from '../../client/components/work-async-storage.external'
import type { IncrementalCache } from './incremental-cache'
import { createPatchedFetcher } from './patch-fetch'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/lib/patch-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
WorkUnitAsyncStorage,
WorkUnitStore,
RequestStore,
} from '../../client/components/work-unit-async-storage.external'
} from '../../server/app-render/work-unit-async-storage.external'
import {
CachedRouteKind,
IncrementalCacheKind,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'
import { abortOnSynchronousDynamicDataAccess } from '../app-render/dynamic-rendering'

export function io(expression: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/request/connection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'
import {
postponeWithTracking,
throwToInterruptStaticGeneration,
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/request/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { workAsyncStorage } from '../../client/components/work-async-storage.ext
import {
workUnitAsyncStorage,
type PrerenderStoreModern,
} from '../../client/components/work-unit-async-storage.external'
} from '../app-render/work-unit-async-storage.external'
import {
postponeWithTracking,
abortAndThrowOnSynchronousDynamicDataAccess,
throwToInterruptStaticGeneration,
trackDynamicDataInDynamicRender,
} from '../../server/app-render/dynamic-rendering'
import { getExpectedRequestStore } from '../../client/components/work-unit-async-storage.external'
import { getExpectedRequestStore } from '../../server/app-render/work-unit-async-storage.external'
import { actionAsyncStorage } from '../../client/components/action-async-storage.external'
import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'
import { makeResolvedReactPromise } from './utils'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/request/draft-mode.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getExpectedRequestStore } from '../../client/components/work-unit-async-storage.external'
import { getExpectedRequestStore } from '../../server/app-render/work-unit-async-storage.external'

import type { DraftModeProvider } from '../../server/async-storage/draft-mode-provider'

import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'
import { trackDynamicDataAccessed } from '../app-render/dynamic-rendering'
import { createDedupedByCallsiteServerErrorLoggerDev } from '../create-deduped-by-callsite-server-error-loger'

Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/request/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import {
type ReadonlyHeaders,
} from '../../server/web/spec-extension/adapters/headers'
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { getExpectedRequestStore } from '../../client/components/work-unit-async-storage.external'
import { getExpectedRequestStore } from '../app-render/work-unit-async-storage.external'
import {
workUnitAsyncStorage,
type PrerenderStoreModern,
} from '../../client/components/work-unit-async-storage.external'
} from '../app-render/work-unit-async-storage.external'
import {
postponeWithTracking,
abortAndThrowOnSynchronousDynamicDataAccess,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/request/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
type PrerenderStorePPR,
type PrerenderStoreLegacy,
type PrerenderStoreModern,
} from '../../client/components/work-unit-async-storage.external'
} from '../app-render/work-unit-async-storage.external'
import { InvariantError } from '../../shared/lib/invariant-error'
import { makeResolvedReactPromise, describeStringPropertyAccess } from './utils'
import { makeHangingPromise } from '../dynamic-rendering-utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/request/search-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
type PrerenderStoreLegacy,
type PrerenderStorePPR,
type PrerenderStoreModern,
} from '../../client/components/work-unit-async-storage.external'
} from '../app-render/work-unit-async-storage.external'
import { InvariantError } from '../../shared/lib/invariant-error'
import { makeHangingPromise } from '../dynamic-rendering-utils'
import { createDedupedByCallsiteServerErrorLoggerDev } from '../create-deduped-by-callsite-server-error-loger'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/route-modules/app-route/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
workUnitAsyncStorage,
type WorkUnitStore,
type PrerenderStore,
} from '../../../client/components/work-unit-async-storage.external'
} from '../../app-render/work-unit-async-storage.external'
import {
actionAsyncStorage,
type ActionStore,
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/use-cache/use-cache-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {

import type { WorkStore } from '../../client/components/work-async-storage.external'
import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import type { UseCacheStore } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import type { UseCacheStore } from '../app-render/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'
import { runInCleanSnapshot } from '../app-render/clean-async-snapshot.external'

import type { ClientReferenceManifest } from '../../build/webpack/plugins/flight-manifest-plugin'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/web/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { normalizeRscURL } from '../../shared/lib/router/utils/app-paths'
import { FLIGHT_HEADERS } from '../../client/components/app-router-headers'
import { ensureInstrumentationRegistered } from './globals'
import { withRequestStore } from '../async-storage/with-request-store'
import { workUnitAsyncStorage } from '../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../../server/app-render/work-unit-async-storage.external'
import {
withWorkStore,
type WorkStoreContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/web/spec-extension/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
NEXT_CACHE_SOFT_TAG_MAX_LENGTH,
} from '../../../lib/constants'
import { workAsyncStorage } from '../../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../../../server/app-render/work-unit-async-storage.external'

/**
* This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/web/spec-extension/unstable-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
validateTags,
} from '../../lib/patch-fetch'
import { workAsyncStorage } from '../../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'
import {
CachedRouteKind,
IncrementalCacheKind,
type CachedFetchData,
} from '../../response-cache'
import type { UnstableCacheStore } from '../../../client/components/work-unit-async-storage.external'
import type { UnstableCacheStore } from '../../app-render/work-unit-async-storage.external'

type Callback = (...args: any[]) => Promise<any>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { workAsyncStorage } from '../../../client/components/work-async-storage.external'
import { workUnitAsyncStorage } from '../../../client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from '../../../server/app-render/work-unit-async-storage.external'
import { markCurrentScopeAsDynamic } from '../../app-render/dynamic-rendering'

/**
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/app-dir/app-external/app/async-storage/page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { workUnitAsyncStorage } from 'next/dist/client/components/work-unit-async-storage.external'
import { workUnitAsyncStorage } from 'next/dist/server/app-render/work-unit-async-storage.external'

export default async function Page() {
// cookies is undefined if not set
Expand Down
Loading