fix(plugins): align package path contract validation

This commit is contained in:
ryan-wong-coder committed 2026-07-17 19:47:16 +08:00
1 parent 2a8dba4818
commit ce3bde5ee4
7 files changed
+52 -12

No files matched your search

+5
View File
@@ -11,6 +11,11 @@ export function assertSafePackagePath(input: string): string {
if (!input || input !== input.normalize("NFC")) {
throw new Error(`Package path must be non-empty NFC text: ${JSON.stringify(input)}`);
}
if ([...input].length > PACKAGE_LIMITS.pathCharacters) {
throw new Error(
`Package path exceeds ${PACKAGE_LIMITS.pathCharacters} Unicode characters: ${input}`,
);
}
if (Buffer.byteLength(input, "utf8") > PACKAGE_LIMITS.pathBytes) {
throw new Error(`Package path exceeds ${PACKAGE_LIMITS.pathBytes} UTF-8 bytes: ${input}`);
}