feat(artifacts): support MSIX and AppX packages
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Readable } from "node:stream";
|
||||
import type { ArtifactCommand } from "../domain/artifactGraph.js";
|
||||
import type { ZipPackageFormat } from "../domain/zipPackageFormat.js";
|
||||
|
||||
/** Archive-neutral entry metadata. Reader adapters never choose output paths. */
|
||||
export interface ArtifactEntry {
|
||||
@@ -23,7 +24,7 @@ export interface ArtifactEntry {
|
||||
|
||||
/** Read-only adapter over one directory, archive, or virtual container. */
|
||||
export interface ArtifactReader {
|
||||
readonly format: "directory" | "zip" | "ipa" | "apk" | "asar" | "file";
|
||||
readonly format: "directory" | ZipPackageFormat | "asar" | "file";
|
||||
entries(signal?: AbortSignal): AsyncIterable<ArtifactEntry>;
|
||||
open(entry: ArtifactEntry, signal?: AbortSignal): Promise<Readable>;
|
||||
provenance(): readonly ArtifactCommand[];
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
type ArtifactEntry,
|
||||
type ArtifactReader,
|
||||
} from "./ArtifactReader.js";
|
||||
import type { ZipPackageFormat } from "../domain/zipPackageFormat.js";
|
||||
|
||||
class NodeFileReader extends Reader<string> {
|
||||
#handle: FileHandle | undefined;
|
||||
@@ -41,12 +42,12 @@ class NodeFileReader extends Reader<string> {
|
||||
|
||||
/** Lazy Zip64-capable reader with CRC and overlap verification on every read. */
|
||||
export class ZipArtifactReader implements ArtifactReader {
|
||||
readonly format: "zip" | "ipa" | "apk";
|
||||
readonly format: ZipPackageFormat;
|
||||
readonly #source: NodeFileReader;
|
||||
readonly #reader: ZipReader<string>;
|
||||
readonly #entries = new Map<string, Entry>();
|
||||
|
||||
constructor(path: string, format: "zip" | "ipa" | "apk") {
|
||||
constructor(path: string, format: ZipPackageFormat) {
|
||||
this.format = format;
|
||||
this.#source = new NodeFileReader(path);
|
||||
this.#reader = new ZipReader(this.#source, {
|
||||
|
||||
Reference in New Issue
Block a user