Skip to content

Commit

Permalink
Updat TS types
Browse files Browse the repository at this point in the history
  • Loading branch information
codedread committed Jan 26, 2024
1 parent b00dc80 commit 08a0fd8
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 40 deletions.
38 changes: 37 additions & 1 deletion types/archive/common.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
/**
* common.js
*
* Provides common functionality for compressing and decompressing.
* Provides common definitions or functionality needed by multiple modules.
*
* Licensed under the MIT License
*
* Copyright(c) 2023 Google Inc.
*/
/**
* @typedef FileInfo An object that is sent to the implementation representing a file to compress.
* @property {string} fileName The name of the file. TODO: Includes the path?
* @property {number} lastModTime The number of ms since the Unix epoch (1970-01-01 at midnight).
* @property {Uint8Array} fileData The bytes of the file.
*/
/**
* @typedef Implementation
* @property {MessagePort} hostPort The port the host uses to communicate with the implementation.
Expand All @@ -24,6 +30,36 @@
* MessagePort connected to the implementation that the host should use.
*/
export function getConnectedPort(implFilename: string): Promise<Implementation>;
export const LOCAL_FILE_HEADER_SIG: 67324752;
export const CENTRAL_FILE_HEADER_SIG: 33639248;
export const END_OF_CENTRAL_DIR_SIG: 101010256;
export const CRC32_MAGIC_NUMBER: 3988292384;
export const ARCHIVE_EXTRA_DATA_SIG: 134630224;
export const DIGITAL_SIGNATURE_SIG: 84233040;
export const END_OF_CENTRAL_DIR_LOCATOR_SIG: 117853008;
export const DATA_DESCRIPTOR_SIG: 134695760;
export type ZipCompressionMethod = number;
export namespace ZipCompressionMethod {
const STORE: number;
const DEFLATE: number;
}
/**
* An object that is sent to the implementation representing a file to compress.
*/
export type FileInfo = {
/**
* The name of the file. TODO: Includes the path?
*/
fileName: string;
/**
* The number of ms since the Unix epoch (1970-01-01 at midnight).
*/
lastModTime: number;
/**
* The bytes of the file.
*/
fileData: Uint8Array;
};
export type Implementation = {
/**
* The port the host uses to communicate with the implementation.
Expand Down
2 changes: 1 addition & 1 deletion types/archive/common.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion types/archive/decompress.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 8 additions & 24 deletions types/archive/events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@ export namespace UnarchiveEventType {
const INFO: string;
const ERROR: string;
}
/**
* An unarchive event.
*/
/** An unarchive event. */
export class UnarchiveEvent extends Event {
/**
* @param {string} type The event type.
*/
constructor(type: string);
}
/**
* Updates all Archiver listeners that an append has occurred.
*/
/** Updates all Unarchiver listeners that an append has occurred. */
export class UnarchiveAppendEvent extends UnarchiveEvent {
/**
* @param {number} numBytes The number of bytes appended.
Expand All @@ -30,45 +26,35 @@ export class UnarchiveAppendEvent extends UnarchiveEvent {
*/
numBytes: number;
}
/**
* Useful for passing info up to the client (for debugging).
*/
/** Useful for passing info up to the client (for debugging). */
export class UnarchiveInfoEvent extends UnarchiveEvent {
/**
* The information message.
* @type {string}
*/
msg: string;
}
/**
* An unrecoverable error has occured.
*/
/** An unrecoverable error has occured. */
export class UnarchiveErrorEvent extends UnarchiveEvent {
/**
* The information message.
* @type {string}
*/
msg: string;
}
/**
* Start event.
*/
/** Start event. */
export class UnarchiveStartEvent extends UnarchiveEvent {
constructor();
}
/**
* Finish event.
*/
/** Finish event. */
export class UnarchiveFinishEvent extends UnarchiveEvent {
/**
* @param {Object} metadata A collection fo metadata about the archive file.
*/
constructor(metadata?: any);
metadata: any;
}
/**
* Progress event.
*/
/** Progress event. */
export class UnarchiveProgressEvent extends UnarchiveEvent {
/**
* @param {string} currentFilename
Expand All @@ -88,9 +74,7 @@ export class UnarchiveProgressEvent extends UnarchiveEvent {
totalUncompressedBytesInArchive: number;
totalCompressedBytesRead: number;
}
/**
* Extract event.
*/
/** Extract event. */
export class UnarchiveExtractEvent extends UnarchiveEvent {
/**
* @param {UnarchivedFile} unarchivedFile
Expand Down
2 changes: 1 addition & 1 deletion types/archive/events.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion types/file/sniffer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion types/image/parsers/parsers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @template T
* @param {string} type The event type.
* @param {T} data The event data.
* @return {CustomEvent<T>} The new event.
* @returns {CustomEvent<T>} The new event.
*/
export function createEvent<T>(type: string, data: T): CustomEvent<T>;
//# sourceMappingURL=parsers.d.ts.map
4 changes: 2 additions & 2 deletions types/image/parsers/png.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ export class PngParser extends EventTarget {
onSuggestedPalette(listener: (arg0: CustomEvent<PngSuggestedPalette>) => void): PngParser;
/**
* Type-safe way to bind a listener for a PngTextualData.
* @param {function(PngTextualData): void} listener
* @param {function(CustomEvent<PngTextualData>): void} listener
* @returns {PngParser} for chaining
*/
onTextualData(listener: (arg0: PngTextualData) => void): PngParser;
onTextualData(listener: (arg0: CustomEvent<PngTextualData>) => void): PngParser;
/**
* Type-safe way to bind a listener for a PngTransparency.
* @param {function(CustomEvent<PngTransparency>): void} listener
Expand Down
2 changes: 1 addition & 1 deletion types/image/parsers/png.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion types/image/webp-shim/webp-shim.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type JpegStartOfFrame = import('./image/parsers/jpeg.js').JpegStartOfFram
export type JpegStartOfScan = import('./image/parsers/jpeg.js').JpegStartOfScan;
export type PngBackgroundColor = import('./image/parsers/png.js').PngBackgroundColor;
export type PngChromaticies = import('./image/parsers/png.js').PngChromaticities;
export type PngColor = import('./image/parsers/png.js').PngColor;
export type PngCompressedTextualData = import('./image/parsers/png.js').PngCompressedTextualData;
export type PngHistogram = import('./image/parsers/png.js').PngHistogram;
export type PngImageData = import('./image/parsers/png.js').PngImageData;
Expand All @@ -34,12 +35,13 @@ export type PngPalette = import('./image/parsers/png.js').PngPalette;
export type PngPhysicalPixelDimensions = import('./image/parsers/png.js').PngPhysicalPixelDimensions;
export type PngSignificantBits = import('./image/parsers/png.js').PngSignificantBits;
export type PngSuggestedPalette = import('./image/parsers/png.js').PngSuggestedPalette;
export type PngSuggestedPaletteEntry = import('./image/parsers/png.js').PngSuggestedPaletteEntry;
export type PngTextualData = import('./image/parsers/png.js').PngTextualData;
export type PngTransparency = import('./image/parsers/png.js').PngTransparency;
export { UnarchiveEvent, UnarchiveEventType, UnarchiveInfoEvent, UnarchiveErrorEvent, UnarchiveStartEvent, UnarchiveFinishEvent, UnarchiveProgressEvent, UnarchiveExtractEvent, Unarchiver, Unzipper, Unrarrer, Untarrer, getUnarchiver } from "./archive/decompress.js";
export { getFullMIMEString, getShortMIMEString } from "./codecs/codecs.js";
export { GifParseEventType, GifParser } from "./image/parsers/gif.js";
export { JpegComponentType, JpegDctType, JpegDensityUnits, JpegExtensionThumbnailFormat, JpegHuffmanTableType, JpegParseEventType, JpegParser, JpegSegmentType } from "./image/parsers/jpeg.js";
export { PngParseEventType, PngParser } from "./image/parsers/png.js";
export { PngColorType, PngInterlaceMethod, PngParseEventType, PngParser, PngUnitSpecifier } from "./image/parsers/png.js";
export { convertWebPtoPNG, convertWebPtoJPG } from "./image/webp-shim/webp-shim.js";
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion types/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 08a0fd8

Please sign in to comment.