Skip to content

Commit 0d2dec0

Browse files
authored
chore: zod 4 (#38809)
1 parent 5c45053 commit 0d2dec0

38 files changed

+654
-129
lines changed

package-lock.json

Lines changed: 13 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
"ws": "^8.17.1",
9999
"xml2js": "^0.5.0",
100100
"yaml": "2.6.0",
101-
"zod": "^3.25.76",
102-
"zod-to-json-schema": "^3.25.1"
101+
"zod": "^4.3.5"
103102
}
104103
}

packages/playwright-client/types/types.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ type ElementHandleWaitForSelectorOptionsNotHidden = ElementHandleWaitForSelector
2828
};
2929

3030
// @ts-ignore this will be any if zod is not installed
31-
type ZodTypeAny = import('zod').ZodTypeAny;
31+
import { ZodTypeAny, z } from 'zod';
3232
// @ts-ignore this will be any if zod is not installed
33-
type ZodInfer<T extends ZodTypeAny> = import('zod').infer<T>;
33+
import * as z3 from 'zod/v3';
34+
type ZodSchema = ZodTypeAny | z3.ZodTypeAny;
35+
type InferZodSchema<T extends ZodSchema> = T extends z3.ZodTypeAny ? z3.infer<T> : T extends ZodTypeAny ? z.infer<T> : never;
3436

3537
/**
3638
* Page provides methods to interact with a single tab in a [Browser](https://playwright.dev/docs/api/class-browser),
@@ -5305,7 +5307,7 @@ export interface PageAgent {
53055307
* @param schema
53065308
* @param options
53075309
*/
5308-
extract<Schema extends ZodTypeAny>(query: string, schema: Schema): Promise<{ result: ZodInfer<Schema>, usage: { turns: number, inputTokens: number, outputTokens: number } }>;
5310+
extract<Schema extends ZodSchema>(query: string, schema: Schema): Promise<{ result: InferZodSchema<Schema>, usage: { turns: number, inputTokens: number, outputTokens: number } }>;
53095311
/**
53105312
* Emitted when the agent makes a turn.
53115313
*/

packages/playwright-core/ThirdPartyNotices.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ This project incorporates components from the projects listed below. The origina
136136
- [email protected] (https://github.com/thejoshwolfe/yauzl)
137137
- [email protected] (https://github.com/thejoshwolfe/yazl)
138138
- [email protected] (https://github.com/StefanTerdell/zod-to-json-schema)
139-
- zod@3.25.76 (https://github.com/colinhacks/zod)
139+
- zod@4.3.5 (https://github.com/colinhacks/zod)
140140

141141
%% @hono/[email protected] NOTICES AND INFORMATION BEGIN HERE
142142
=========================================
@@ -4043,7 +4043,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40434043
=========================================
40444044
END OF [email protected] AND INFORMATION
40454045

4046-
%% zod@3.25.76 NOTICES AND INFORMATION BEGIN HERE
4046+
%% zod@4.3.5 NOTICES AND INFORMATION BEGIN HERE
40474047
=========================================
40484048
MIT License
40494049

@@ -4067,7 +4067,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40674067
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40684068
SOFTWARE.
40694069
=========================================
4070-
END OF zod@3.25.76 AND INFORMATION
4070+
END OF zod@4.3.5 AND INFORMATION
40714071

40724072
SUMMARY BEGIN HERE
40734073
=========================================

packages/playwright-core/bundles/mcp/package-lock.json

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/playwright-core/bundles/mcp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"@lowire/loop": "^0.0.23",
77
"@modelcontextprotocol/sdk": "^1.25.2",
8-
"zod": "^3.25.76",
8+
"zod": "^4.3.5",
99
"zod-to-json-schema": "^3.25.1"
1010
}
1111
}

packages/playwright-core/bundles/mcp/src/mcpBundleImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
2424
export { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
2525
export { CallToolRequestSchema, ListRootsRequestSchema, ListToolsRequestSchema, PingRequestSchema, ProgressNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
2626
export { Loop } from '@lowire/loop';
27-
export { z } from 'zod';
27+
export * as z from 'zod';
2828
export { zodToJsonSchema } from 'zod-to-json-schema';

packages/playwright-core/bundles/utils/package-lock.json

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/playwright-core/bundles/utils/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"signal-exit": "3.0.7",
2222
"socks-proxy-agent": "8.0.5",
2323
"ws": "8.17.1",
24-
"yaml": "^2.6.0",
25-
"zod": "^3.25.76"
24+
"yaml": "^2.6.0"
2625
},
2726
"devDependencies": {
2827
"@types/debug": "^4.1.7",

packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,3 @@ export const wsSender = Sender;
6666

6767
import yamlLibrary from 'yaml';
6868
export const yaml = yamlLibrary;
69-
70-
import zodLibrary from 'zod';
71-
export const zod = zodLibrary;

0 commit comments

Comments
 (0)