fix turbopack invalidations (#57362)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
parent
18d797e3fd
commit
c80fb27446
2 changed files with 5 additions and 31 deletions
|
@ -366,7 +366,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
const serverPathState = new Map<string, string>()
|
const serverPathState = new Map<string, string>()
|
||||||
|
|
||||||
async function processResult(
|
async function processResult(
|
||||||
id: string,
|
|
||||||
result: TurbopackResult<WrittenEndpoint>
|
result: TurbopackResult<WrittenEndpoint>
|
||||||
): Promise<TurbopackResult<WrittenEndpoint>> {
|
): Promise<TurbopackResult<WrittenEndpoint>> {
|
||||||
// Figure out if the server files have changed
|
// Figure out if the server files have changed
|
||||||
|
@ -374,23 +373,10 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
for (const { path: p, contentHash } of result.serverPaths) {
|
for (const { path: p, contentHash } of result.serverPaths) {
|
||||||
// We ignore source maps
|
// We ignore source maps
|
||||||
if (p.endsWith('.map')) continue
|
if (p.endsWith('.map')) continue
|
||||||
let key = `${id}:${p}`
|
const previousHash = serverPathState.get(p)
|
||||||
const localHash = serverPathState.get(key)
|
if (previousHash !== contentHash) {
|
||||||
const globaHash = serverPathState.get(p)
|
|
||||||
if (
|
|
||||||
(localHash && localHash !== contentHash) ||
|
|
||||||
(globaHash && globaHash !== contentHash)
|
|
||||||
) {
|
|
||||||
hasChange = true
|
hasChange = true
|
||||||
serverPathState.set(key, contentHash)
|
|
||||||
serverPathState.set(p, contentHash)
|
serverPathState.set(p, contentHash)
|
||||||
} else {
|
|
||||||
if (!localHash) {
|
|
||||||
serverPathState.set(key, contentHash)
|
|
||||||
}
|
|
||||||
if (!globaHash) {
|
|
||||||
serverPathState.set(p, contentHash)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,7 +1073,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
if (middleware) {
|
if (middleware) {
|
||||||
const processMiddleware = async () => {
|
const processMiddleware = async () => {
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
'middleware',
|
|
||||||
await middleware.endpoint.writeToDisk()
|
await middleware.endpoint.writeToDisk()
|
||||||
)
|
)
|
||||||
processIssues('middleware', 'middleware', writtenEndpoint)
|
processIssues('middleware', 'middleware', writtenEndpoint)
|
||||||
|
@ -1313,7 +1298,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
try {
|
try {
|
||||||
if (globalEntries.app) {
|
if (globalEntries.app) {
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
'_app',
|
|
||||||
await globalEntries.app.writeToDisk()
|
await globalEntries.app.writeToDisk()
|
||||||
)
|
)
|
||||||
processIssues('_app', '_app', writtenEndpoint)
|
processIssues('_app', '_app', writtenEndpoint)
|
||||||
|
@ -1323,7 +1307,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
|
|
||||||
if (globalEntries.document) {
|
if (globalEntries.document) {
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
'_document',
|
|
||||||
await globalEntries.document.writeToDisk()
|
await globalEntries.document.writeToDisk()
|
||||||
)
|
)
|
||||||
changeSubscription(
|
changeSubscription(
|
||||||
|
@ -1341,7 +1324,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
|
|
||||||
if (globalEntries.error) {
|
if (globalEntries.error) {
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
'_error',
|
|
||||||
await globalEntries.error.writeToDisk()
|
await globalEntries.error.writeToDisk()
|
||||||
)
|
)
|
||||||
processIssues(page, page, writtenEndpoint)
|
processIssues(page, page, writtenEndpoint)
|
||||||
|
@ -1411,7 +1393,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
try {
|
try {
|
||||||
if (globalEntries.app) {
|
if (globalEntries.app) {
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
'_app',
|
|
||||||
await globalEntries.app.writeToDisk()
|
await globalEntries.app.writeToDisk()
|
||||||
)
|
)
|
||||||
processIssues('_app', '_app', writtenEndpoint)
|
processIssues('_app', '_app', writtenEndpoint)
|
||||||
|
@ -1421,7 +1402,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
|
|
||||||
if (globalEntries.document) {
|
if (globalEntries.document) {
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
'_document',
|
|
||||||
await globalEntries.document.writeToDisk()
|
await globalEntries.document.writeToDisk()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1439,7 +1419,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
await loadPagesManifest('_document')
|
await loadPagesManifest('_document')
|
||||||
|
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
page,
|
|
||||||
await route.htmlEndpoint.writeToDisk()
|
await route.htmlEndpoint.writeToDisk()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1497,7 +1476,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
|
|
||||||
finishBuilding = startBuilding(buildingKey)
|
finishBuilding = startBuilding(buildingKey)
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
page,
|
|
||||||
await route.endpoint.writeToDisk()
|
await route.endpoint.writeToDisk()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1522,7 +1500,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
case 'app-page': {
|
case 'app-page': {
|
||||||
finishBuilding = startBuilding(buildingKey)
|
finishBuilding = startBuilding(buildingKey)
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
page,
|
|
||||||
await route.htmlEndpoint.writeToDisk()
|
await route.htmlEndpoint.writeToDisk()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1573,7 +1550,6 @@ async function startWatcher(opts: SetupOpts) {
|
||||||
case 'app-route': {
|
case 'app-route': {
|
||||||
finishBuilding = startBuilding(buildingKey)
|
finishBuilding = startBuilding(buildingKey)
|
||||||
const writtenEndpoint = await processResult(
|
const writtenEndpoint = await processResult(
|
||||||
page,
|
|
||||||
await route.endpoint.writeToDisk()
|
await route.endpoint.writeToDisk()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3197,11 +3197,9 @@
|
||||||
"app dir - hooks from pages should have the correct hooks",
|
"app dir - hooks from pages should have the correct hooks",
|
||||||
"app dir - hooks useDraftMode should genenerate rand when draft mode enabled",
|
"app dir - hooks useDraftMode should genenerate rand when draft mode enabled",
|
||||||
"app dir - hooks useDraftMode should use initial rand when draft mode be disabled",
|
"app dir - hooks useDraftMode should use initial rand when draft mode be disabled",
|
||||||
"app dir - hooks useRouter should allow access to the router"
|
|
||||||
],
|
|
||||||
"failed": [
|
|
||||||
"app dir - hooks usePathname should have the canonical url pathname on rewrite",
|
"app dir - hooks usePathname should have the canonical url pathname on rewrite",
|
||||||
"app dir - hooks usePathname should have the correct pathname",
|
"app dir - hooks usePathname should have the correct pathname",
|
||||||
|
"app dir - hooks useRouter should allow access to the router",
|
||||||
"app dir - hooks useSearchParams should have the canonical url search params on rewrite",
|
"app dir - hooks useSearchParams should have the canonical url search params on rewrite",
|
||||||
"app dir - hooks useSearchParams should have the correct search params",
|
"app dir - hooks useSearchParams should have the correct search params",
|
||||||
"app dir - hooks useSelectedLayoutSegment should have the correct layout segment at /hooks/use-selected-layout-segment/first",
|
"app dir - hooks useSelectedLayoutSegment should have the correct layout segment at /hooks/use-selected-layout-segment/first",
|
||||||
|
@ -3216,6 +3214,7 @@
|
||||||
"app dir - hooks useSelectedLayoutSegments should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten-middleware",
|
"app dir - hooks useSelectedLayoutSegments should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten-middleware",
|
||||||
"app dir - hooks useSelectedLayoutSegments should return an empty array in pages"
|
"app dir - hooks useSelectedLayoutSegments should return an empty array in pages"
|
||||||
],
|
],
|
||||||
|
"failed": [],
|
||||||
"pending": [],
|
"pending": [],
|
||||||
"flakey": [],
|
"flakey": [],
|
||||||
"runtimeError": false
|
"runtimeError": false
|
||||||
|
@ -13519,7 +13518,6 @@
|
||||||
"test/integration/react-streaming/test/index.test.js": {
|
"test/integration/react-streaming/test/index.test.js": {
|
||||||
"passed": [
|
"passed": [
|
||||||
"streaming dev dev should not stream to crawlers or google pagerender bot",
|
"streaming dev dev should not stream to crawlers or google pagerender bot",
|
||||||
"streaming dev dev should render 500 error correctly",
|
|
||||||
"streaming dev dev should render fallback if error raised from suspense during streaming",
|
"streaming dev dev should render fallback if error raised from suspense during streaming",
|
||||||
"streaming dev dev should support streaming for fizz response"
|
"streaming dev dev should support streaming for fizz response"
|
||||||
],
|
],
|
||||||
|
@ -13530,7 +13528,7 @@
|
||||||
"production mode streaming prod prod should render fallback if error raised from suspense during streaming",
|
"production mode streaming prod prod should render fallback if error raised from suspense during streaming",
|
||||||
"production mode streaming prod prod should support streaming for fizz response"
|
"production mode streaming prod prod should support streaming for fizz response"
|
||||||
],
|
],
|
||||||
"flakey": [],
|
"flakey": ["streaming dev dev should render 500 error correctly"],
|
||||||
"runtimeError": false
|
"runtimeError": false
|
||||||
},
|
},
|
||||||
"test/integration/read-only-source-hmr/test/index.test.js": {
|
"test/integration/read-only-source-hmr/test/index.test.js": {
|
||||||
|
|
Loading…
Reference in a new issue