Skip to content

Commit d42f14a

Browse files
committed
Merge branch 'main' into feat/localized-publish-meta
2 parents 2d60e94 + 78d5be6 commit d42f14a

File tree

34 files changed

+430
-128
lines changed

34 files changed

+430
-128
lines changed

docs/plugins/mcp.mdx

Lines changed: 119 additions & 49 deletions
Large diffs are not rendered by default.

packages/db-d1-sqlite/src/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const connect: Connect = async function connect(
5151
this.rejectInitializing()
5252
}
5353
console.error(err)
54-
process.exit(1)
54+
throw new Error(`Error: cannot connect to SQLite: ${message}`)
5555
}
5656

5757
// Only push schema if not in production

packages/db-mongodb/src/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ export const connect: Connect = async function connect(
108108
err,
109109
msg,
110110
})
111-
process.exit(1)
111+
throw new Error(`Error: cannot connect to MongoDB: ${msg}`)
112112
}
113113
}

packages/db-postgres/src/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const connect: Connect = async function connect(
108108
if (typeof this.rejectInitializing === 'function') {
109109
this.rejectInitializing()
110110
}
111-
process.exit(1)
111+
throw new Error(`Error: cannot connect to Postgres: ${err.message}`)
112112
}
113113

114114
await this.createExtensions()

packages/db-sqlite/src/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const connect: Connect = async function connect(
3636
if (typeof this.rejectInitializing === 'function') {
3737
this.rejectInitializing()
3838
}
39-
process.exit(1)
39+
throw new Error(`Error: cannot connect to SQLite: ${message}`)
4040
}
4141

4242
// Only push schema if not in production

packages/db-vercel-postgres/src/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const connect: Connect = async function connect(
9090
if (typeof this.rejectInitializing === 'function') {
9191
this.rejectInitializing()
9292
}
93-
process.exit(1)
93+
throw new Error(`Error: cannot connect to Postgres: ${err.message}`)
9494
}
9595

9696
await this.createExtensions()

packages/drizzle/src/transactions/beginTransaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const beginTransaction: BeginTransaction = async function beginTransactio
5959
}
6060
} catch (err) {
6161
this.payload.logger.error({ err, msg: `Error: cannot begin transaction: ${err.message}` })
62-
process.exit(1)
62+
throw new Error(`Error: cannot begin transaction: ${err.message}`)
6363
}
6464

6565
return id

packages/next/src/withPayload.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,43 @@ export const withPayload = (nextConfig = {}, options = {}) => {
1515
env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'
1616
}
1717

18+
if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
19+
// TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.
20+
// We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
21+
const turbopackWarningText =
22+
'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\nTry to install it into the project directory by running'
23+
24+
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
25+
const turbopackConfigWarningText = "Unrecognized key(s) in object: 'turbopack'"
26+
27+
const consoleWarn = console.warn
28+
console.warn = (...args) => {
29+
// Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
30+
if (
31+
(typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||
32+
(typeof args[0] === 'string' && args[0].includes(turbopackWarningText))
33+
) {
34+
return
35+
}
36+
37+
// Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.
38+
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
39+
const hasTurbopackConfigWarning =
40+
(typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||
41+
(typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))
42+
43+
if (hasTurbopackConfigWarning) {
44+
consoleWarn(...args)
45+
consoleWarn(
46+
'Payload: You can safely ignore the "Invalid next.config" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.',
47+
)
48+
return
49+
}
50+
51+
consoleWarn(...args)
52+
}
53+
}
54+
1855
const poweredByHeader = {
1956
key: 'X-Powered-By',
2057
value: 'Next.js, Payload',

packages/payload/src/admin/RichText.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
Validate,
1313
} from '../fields/config/types.js'
1414
import type { SanitizedGlobalConfig } from '../globals/config/types.js'
15-
import type { RequestContext } from '../index.js'
15+
import type { RequestContext, TypedFallbackLocale } from '../index.js'
1616
import type { JsonObject, PayloadRequest, PopulateType } from '../types/index.js'
1717
import type { RichTextFieldClientProps, RichTextFieldServerProps } from './fields/RichText.js'
1818
import type { FieldDiffClientProps, FieldDiffServerProps, FieldSchemaMap } from './types.js'
@@ -31,7 +31,7 @@ export type AfterReadRichTextHookArgs<
3131

3232
draft?: boolean
3333

34-
fallbackLocale?: string | string[]
34+
fallbackLocale?: TypedFallbackLocale
3535
fieldPromises?: Promise<void>[]
3636

3737
/** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */

packages/payload/src/collections/dataloader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { BatchLoadFn } from 'dataloader'
33
import DataLoader from 'dataloader'
44

55
import type { FindArgs } from '../database/types.js'
6-
import type { Payload } from '../index.js'
6+
import type { Payload, TypedFallbackLocale } from '../index.js'
77
import type { PayloadRequest, PopulateType, SelectType } from '../types/index.js'
88
import type { TypeWithID } from './config/types.js'
99
import type { Options } from './operations/local/find.js'
@@ -225,7 +225,7 @@ type CreateCacheKeyArgs = {
225225
depth: number
226226
docID: number | string
227227
draft: boolean
228-
fallbackLocale: string | string[]
228+
fallbackLocale: TypedFallbackLocale
229229
locale: string | string[]
230230
overrideAccess: boolean
231231
populate?: PopulateType

0 commit comments

Comments
 (0)