@ai-sdk/provider-utils 5.0.43 → 5.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/safe-node-fetch.ts +9 -6
package/package.json
CHANGED
package/src/safe-node-fetch.ts
CHANGED
|
@@ -134,13 +134,16 @@ export async function getDefaultDownloadFetch(): Promise<FetchFunction> {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
function createSafeNodeFetch(): FetchFunction {
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
|
|
137
|
+
// @vercel/nft (node file trace) only recognizes an indirectly loaded createRequire when its receiver
|
|
138
|
+
// is named `module` and the returned require function is assigned.
|
|
139
|
+
// eslint-disable-next-line @next/next/no-assign-module-variable
|
|
140
|
+
const module = loadBuiltinModule<NodeModule>('node:module');
|
|
140
141
|
const { lookup } = loadBuiltinModule<NodeDns>('node:dns');
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
|
|
143
|
+
// Assign the created require function so deployment tracers can recognize
|
|
144
|
+
// the static dependency without bundlers inlining undici.
|
|
145
|
+
const nodeRequire = module.createRequire(getCurrentModulePath());
|
|
146
|
+
const { Agent, fetch } = nodeRequire('undici') as Undici;
|
|
144
147
|
|
|
145
148
|
const dispatcher = new Agent({
|
|
146
149
|
connect: {
|