perf(apple): reuse scalar schema during plist projection

This commit is contained in:
morluto committed 2026-10-24 09:37:20 +08:00
1 parent 33f384120a
commit 85e38ac199
1 file changed
+8 -1
+8 -1
View File
@@ -5,6 +5,13 @@ import type { JsonValue } from "../jsonValue.js";
import { copyPlistUidIdentity } from "./plistUid.js";
import { UnknownPlistScalar } from "./unknownPlistScalar.js";
const jsonScalarSchema = z.union([
z.string(),
z.number(),
z.boolean(),
z.null(),
]);
/**
* Maximum plist value nesting the JSON projection supports. The XML decode
* preflight shares this limit so oversized documents are rejected before any
@@ -145,7 +152,7 @@ export const projectPlistValue = (
copyPlistUidIdentity(item, result);
return result;
}
return z.union([z.string(), z.number(), z.boolean(), z.null()]).parse(item);
return jsonScalarSchema.parse(item);
};
const projected = project(value, 0);
return {