Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(deno): use denoflate instead of compress #1482

Merged
merged 1 commit into from
Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions lib/deno/external.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
declare module 'https://deno.land/x/[email protected]/mod.ts' {
export interface InflateOptions {
windowBits?: number;
dictionary?: Uint8Array;
chunkSize?: number;
to?: string;
raw?: boolean;
}

export function gunzip(input: Uint8Array, options?: InflateOptions): Uint8Array
declare module "https://deno.land/x/[email protected]/mod.ts" {
export function gunzip(input: Uint8Array): Uint8Array;
}
4 changes: 2 additions & 2 deletions lib/deno/mod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as types from "../shared/types"
import * as common from "../shared/common"
import * as compress from "https://deno.land/x/[email protected]/mod.ts"
import * as denoflate from "https://deno.land/x/[email protected]/mod.ts"

declare const ESBUILD_VERSION: string

Expand Down Expand Up @@ -108,7 +108,7 @@ function getCachePath(name: string): { finalPath: string, finalDir: string } {

function extractFileFromTarGzip(buffer: Uint8Array, file: string): Uint8Array {
try {
buffer = compress.gunzip(buffer)
buffer = denoflate.gunzip(buffer)
} catch (err) {
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`)
}
Expand Down