Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
[compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' [compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); [compiler] Update for Zod v3/v4 compatibility (#34717) · react/react@d6eb735 · GitHub
Skip to content

Commit d6eb735

Browse files
[compiler] Update for Zod v3/v4 compatibility (#34717)
Partial redo of #34710. The changes there tried to use `z.function(args, return)` to be compatible across Zod v3 and v4, but Zod 4's function API has completely changed. Instead, I've updated to just use `z.any()` where we expect a function, and manually validate that it's a function before we call the value. We already have validation of the return type (also using Zod). Co-authored-by: kolvian <eliot@pontarelli.com>
1 parent 71753ac commit d6eb735

8 files changed

Lines changed: 31 additions & 50 deletions

File tree

‎compiler/packages/babel-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"react-dom": "0.0.0-experimental-4beb1fd8-20241118",
5353
"ts-jest": "^29.1.1",
5454
"ts-node": "^10.9.2",
55-
"zod": "^3.22.4",
56-
"zod-validation-error": "^2.1.0"
55+
"zod": "^3.22.4 || ^4.0.0",
56+
"zod-validation-error": "^3.0.3 || ^4.0.0"
5757
},
5858
"resolutions": {
5959
"./**/@babel/parser": "7.7.4",

‎compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const EnvironmentConfigSchema = z.object({
159159
* A function that, given the name of a module, can optionally return a description
160160
* of that module's type signature.
161161
*/
162-
moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
162+
moduleTypeProvider: z.nullable(z.any()).default(null),
163163

164164
/**
165165
* A list of functions which the application compiles as macros, where
@@ -249,7 +249,7 @@ export const EnvironmentConfigSchema = z.object({
249249
* Allows specifying a function that can populate HIR with type information from
250250
* Flow
251251
*/
252-
flowTypeProvider: z.nullable(z.function().args(z.string())).default(null),
252+
flowTypeProvider: z.nullable(z.any()).default(null),
253253

254254
/**
255255
* Enables inference of optional dependency chains. Without this flag
@@ -906,6 +906,12 @@ export class Environment {
906906
if(moduleTypeProvider==null){
907907
returnnull;
908908
}
909+
if(typeofmoduleTypeProvider!=='function'){
910+
CompilerError.throwInvalidConfig({
911+
reason: `Expected a function for \`moduleTypeProvider\``,
912+
loc,
913+
});
914+
}
909915
constunparsedModuleConfig=moduleTypeProvider(moduleName);
910916
if(unparsedModuleConfig!=null){
911917
constparsedModuleConfig=TypeSchema.safeParse(unparsedModuleConfig);

‎compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('parseConfigPragma()', () => {
2020
validateHooksUsage: 1,
2121
}asany);
2222
}).toThrowErrorMatchingInlineSnapshot(
23-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Expected boolean, received number at "validateHooksUsage"."`,
23+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
2424
);
2525
});
2626

@@ -38,7 +38,7 @@ describe('parseConfigPragma()', () => {
3838
],
3939
}asany);
4040
}).toThrowErrorMatchingInlineSnapshot(
41-
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: autodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
41+
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
4242
);
4343
});
4444

‎compiler/packages/eslint-plugin-react-compiler/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@babel/core": "^7.24.4",
1616
"@babel/parser": "^7.24.4",
1717
"hermes-parser": "^0.25.1",
18-
"zod": "^3.22.4",
19-
"zod-validation-error": "^3.0.3"
18+
"zod": "^3.22.4 || ^4.0.0",
19+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/preset-env": "^7.22.4",

‎compiler/packages/react-compiler-healthcheck/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fast-glob": "^3.3.2",
1818
"ora": "5.4.1",
1919
"yargs": "^17.7.2",
20-
"zod": "^3.22.4",
21-
"zod-validation-error": "^3.0.3"
20+
"zod": "^3.22.4 || ^4.0.0",
21+
"zod-validation-error": "^3.0.3 || ^4.0.0"
2222
},
2323
"devDependencies": {},
2424
"engines": {

‎compiler/packages/react-mcp-server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"html-to-text": "^9.0.5",
2525
"prettier": "^3.3.3",
2626
"puppeteer": "^24.7.2",
27-
"zod": "^3.23.8"
27+
"zod": "^3.22.4 || ^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@types/html-to-text": "^9.0.4",

‎compiler/yarn.lock‎

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10486,16 +10486,7 @@ string-length@^4.0.1:
1048610486
char-regex "^1.0.2"
1048710487
strip-ansi "^6.0.0"
1048810488

10489-
"string-width-cjs@npm:string-width@^4.2.0":
10490-
version "4.2.3"
10491-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
10492-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10493-
dependencies:
10494-
emoji-regex "^8.0.0"
10495-
is-fullwidth-code-point "^3.0.0"
10496-
strip-ansi "^6.0.1"
10497-
10498-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10489+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1049910490
version "4.2.3"
1050010491
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
1050110492
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10568,14 +10559,7 @@ string_decoder@~1.1.1:
1056810559
dependencies:
1056910560
safe-buffer "~5.1.0"
1057010561

10571-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10572-
version "6.0.1"
10573-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
10574-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10575-
dependencies:
10576-
ansi-regex "^5.0.1"
10577-
10578-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10562+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1057910563
version "6.0.1"
1058010564
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
1058110565
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11352,7 +11336,7 @@ workerpool@^6.5.1:
1135211336
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz"
1135311337
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
1135411338

11355-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11339+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1135611340
version "7.0.0"
1135711341
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
1135811342
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11370,15 +11354,6 @@ wrap-ansi@^6.2.0:
1137011354
string-width "^4.1.0"
1137111355
strip-ansi "^6.0.0"
1137211356

11373-
wrap-ansi@^7.0.0:
11374-
version "7.0.0"
11375-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
11376-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11377-
dependencies:
11378-
ansi-styles "^4.0.0"
11379-
string-width "^4.1.0"
11380-
strip-ansi "^6.0.0"
11381-
1138211357
wrap-ansi@^8.1.0:
1138311358
version "8.1.0"
1138411359
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
@@ -11530,17 +11505,17 @@ zod-to-json-schema@^3.24.1:
1153011505
resolved "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz"
1153111506
integrity sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==
1153211507

11533-
zod-validation-error@^2.1.0:
11534-
version "2.1.0"
11535-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-2.1.0.tgz"
11536-
integrity sha512-VJh93e2wb4c3tWtGgTa0OF/dTt/zoPCPzXq4V11ZjxmEAFaPi/Zss1xIZdEB5RD8GD00U0/iVXgqkF77RV7pdQ==
11508+
"zod-validation-error@^3.0.3 || ^4.0.0":
11509+
version "4.0.2"
11510+
resolved "https://registry.yarnpkg.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz#bc605eba49ce0fcd598c127fee1c236be3f22918"
11511+
integrity sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==
1153711512

11538-
zod-validation-error@^3.0.3:
11539-
version "3.0.3"
11540-
resolved "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-3.0.3.tgz"
11541-
integrity sha512-cETTrcMq3Ze58vhdR0zD37uJm/694I6mAxcf/ei5bl89cC++fBNxrC2z8lkFze/8hVMPwrbtrwXHR2LB50fpHw==
11513+
"zod@^3.22.4 || ^4.0.0":
11514+
version "4.1.11"
11515+
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
11516+
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==
1154211517

11543-
zod@^3.22.4, zod@^3.23.8, zod@^3.24.1:
11518+
zod@^3.23.8, zod@^3.24.1:
1154411519
version "3.24.3"
1154511520
resolved "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz"
1154611521
integrity sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==

‎packages/eslint-plugin-react-hooks/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"dependencies": {
4242
"@babel/core": "^7.24.4",
4343
"@babel/parser": "^7.24.4",
44-
"zod": "^3.22.4",
45-
"zod-validation-error": "^3.0.3"
44+
"zod": "^3.22.4 || ^4.0.0",
45+
"zod-validation-error": "^3.0.3 || ^4.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/eslint-parser": "^7.11.4",

0 commit comments

Comments
 (0)