Skip to content

Commit ab0ec0e

Browse files
authored
fix(cms): strip "use strict" prologue in plugin-mcp patch (#45)
1 parent c65eb9f commit ab0ec0e

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/dist/utils/schemaConversion/convertCollectionSchemaToZod.js b/dist/utils/schemaConversion/convertCollectionSchemaToZod.js
2+
index 07a2628fdc987d663885c7e918152539ca7c1766..ba4728dd7bff808eefb5ffca11596e4cbe6efc90 100644
3+
--- a/dist/utils/schemaConversion/convertCollectionSchemaToZod.js
4+
+++ b/dist/utils/schemaConversion/convertCollectionSchemaToZod.js
5+
@@ -28,7 +28,8 @@ export const convertCollectionSchemaToZod = (schema)=>{
6+
* 4. The resulting Zod schema is used only for parameter validation in MCP tools, not for data processing
7+
* 5. No user input or external data is involved in the schema generation process
8+
*/ // eslint-disable-next-line @typescript-eslint/no-implied-eval
9+
- return new Function('z', `return ${transpileResult.outputText}`)(z);
10+
+ const output = transpileResult.outputText.replace(/^"use strict";\s*/, '');
11+
+ return new Function('z', `return ${output}`)(z);
12+
} catch (error) {
13+
// If schema conversion fails (e.g., due to Zod v4 toJSONSchema null-check bug
14+
// with record schemas that have undefined valueType, or bundler transforms

pnpm-lock.yaml

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

pnpm-workspace.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ allowBuilds:
1212
esbuild: true
1313
sharp: true
1414
unrs-resolver: true
15+
16+
patchedDependencies:
17+
'@payloadcms/plugin-mcp@3.85.0': patches/@payloadcms__plugin-mcp@3.85.0.patch

0 commit comments

Comments
 (0)