refactor(xar): reuse the signature recognizer (#17011)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-05 17:22:58 +08:00
1 parent 3f9f6fce6c
commit b17cd21c01
3 files changed
+2 -9

No files matched your search

+1 -1
View File
@@ -8,13 +8,13 @@ import type {
MacosPkgRefusal,
} from "../domain/formatMetadata/macosPkgMetadata.js";
import { artifactExpansionBudgetBytes } from "../domain/artifactExpansionBudget.js";
import { hasXarMagic } from "../domain/binaryContainer.js";
import {
MACOS_PKG_FORMAT,
MACOS_PKG_MAX_TOC_UNCOMPRESSED_BYTES,
XAR_HEADER_MIN_BYTES,
XAR_MAGIC_TEXT,
XAR_VERSION,
hasXarMagic,
macosPkgCpioBudget,
macosPkgLimitFailure,
macosPkgMetadataBudget,
+1 -1
View File
@@ -1,10 +1,10 @@
import { expect, it } from "vitest";
import { hasXarMagic } from "./binaryContainer.js";
import {
MACOS_PKG_MAX_CPIO_ARCHIVE_BYTES,
MACOS_PKG_MAX_CPIO_MEMBERS,
MACOS_PKG_MAX_TOC_PATH_BYTES,
hasXarMagic,
macosPkgCpioBudget,
} from "./macosPkgFormat.js";
-7
View File
@@ -146,13 +146,6 @@ export interface XarHeader {
readonly heapOffset: number;
}
export const hasXarMagic = (prefix: Uint8Array): boolean =>
prefix.length >= 4 &&
prefix[0] === 0x78 &&
prefix[1] === 0x61 &&
prefix[2] === 0x72 &&
prefix[3] === 0x21;
export const macosPkgLimitFailure = (
message: string,
limit: {