Merge pull request #74 from Sparticuz/chromium112

This commit is contained in:
Kyle McNally 2023-03-24 09:42:33 -04:00 committed by GitHub
commit 3b2668d465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 154 additions and 110 deletions

View File

@ -36,7 +36,7 @@ exports.handler = async (event, context) => {
} }
if (job.expected.hasOwnProperty('screenshot') === true) { if (job.expected.hasOwnProperty('screenshot') === true) {
if (job.expected.hasOwnProperty('remove') === true ) { if (job.expected.hasOwnProperty('remove') === true) {
await page.evaluate((selector) => { await page.evaluate((selector) => {
document.getElementById(selector).remove(); document.getElementById(selector).remove();
}, job.expected.remove); }, job.expected.remove);

View File

@ -14,4 +14,4 @@ instance_size=c6i.12xlarge
ansible_connection=ssh ansible_connection=ssh
ansible_python_interpreter=auto_silent ansible_python_interpreter=auto_silent
ansible_ssh_private_key_file=ansible.pem ansible_ssh_private_key_file=ansible.pem
chromium_revision=1095492 chromium_revision=1108766

View File

@ -142,8 +142,7 @@
- name: Checking for Directory Structure - name: Checking for Directory Structure
stat: stat:
path: /srv/source/chromium path: /srv/source/chromium
register: register: structure
structure
- name: Creating Directory Structure - name: Creating Directory Structure
become: true become: true
@ -172,7 +171,7 @@
dest: /srv/source/chromium/.gclient dest: /srv/source/chromium/.gclient
owner: ec2-user owner: ec2-user
group: ec2-user group: ec2-user
mode: '0664' mode: "0664"
- name: Checking for Chromium - name: Checking for Chromium
stat: stat:
@ -187,8 +186,8 @@
- name: Parse Result - name: Parse Result
set_fact: set_fact:
gitsha: > gitsha: >
{{ revision.content | regex_search('"git_sha":"([a-zA-Z0-9_]*)"', '\1') | trim }} {{ revision.content | regex_search('"git_sha":"([a-zA-Z0-9_]*)"', '\1') | trim }}
- name: Checking Out Chromium revision - name: Checking Out Chromium revision
shell: | shell: |
@ -211,22 +210,22 @@
backrefs: yes backrefs: yes
with_items: with_items:
- { - {
path: 'sandbox_ipc_linux.cc', path: "sandbox_ipc_linux.cc",
line: '\1PLOG(WARNING) << "poll"; failed_polls = 0;', line: '\1PLOG(WARNING) << "poll"; failed_polls = 0;',
regexp: '^(\s+)PLOG[(]WARNING[)] << "poll";$', regexp: '^(\s+)PLOG[(]WARNING[)] << "poll";$',
} }
- { - {
path: 'renderer_host/render_process_host_impl.cc', path: "renderer_host/render_process_host_impl.cc",
line: '\1// \2\3', line: '\1// \2\3',
regexp: '^( )(\s*)(CHECK[(]render_process_host->InSameStoragePartition[(])$', regexp: '^( )(\s*)(CHECK[(]render_process_host->InSameStoragePartition[(])$',
} }
- { - {
path: 'renderer_host/render_process_host_impl.cc', path: "renderer_host/render_process_host_impl.cc",
line: '\1// \2\3', line: '\1// \2\3',
regexp: '^( )(\s*)(browser_context->GetStoragePartition[(]site_instance,)$', regexp: '^( )(\s*)(browser_context->GetStoragePartition[(]site_instance,)$',
} }
- { - {
path: 'renderer_host/render_process_host_impl.cc', path: "renderer_host/render_process_host_impl.cc",
line: '\1// \2\3', line: '\1// \2\3',
regexp: '^( )(\s*)(false /[*] can_create [*]/[)][)][)];)$', regexp: '^( )(\s*)(false /[*] can_create [*]/[)][)][)];)$',
} }
@ -340,7 +339,7 @@
amazon.aws.ec2_instance: amazon.aws.ec2_instance:
wait: yes wait: yes
state: absent state: absent
instance_ids: '{{ ec2.instance_ids }}' instance_ids: "{{ ec2.instance_ids }}"
region: "{{ region }}" region: "{{ region }}"
- name: Deleting Security Group - name: Deleting Security Group

Binary file not shown.

Binary file not shown.

8
package-lock.json generated
View File

@ -15,7 +15,7 @@
"devDependencies": { "devDependencies": {
"@tsconfig/node14": "^1.0.3", "@tsconfig/node14": "^1.0.3",
"@types/follow-redirects": "^1.14.1", "@types/follow-redirects": "^1.14.1",
"@types/node": "^18.11.18", "@types/node": "^18.15.7",
"@types/tar-fs": "^2.0.1", "@types/tar-fs": "^2.0.1",
"clean-modules": "^2.0.6", "clean-modules": "^2.0.6",
"typescript": "^5.0.2" "typescript": "^5.0.2"
@ -40,9 +40,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.15.3", "version": "18.15.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.7.tgz",
"integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", "integrity": "sha512-LFmUbFunqmBn26wJZgZPYZPrDR1RwGOu2v79Mgcka1ndO6V0/cwjivPTc4yoK6n9kmw4/ls1r8cLrvh2iMibFA==",
"dev": true "dev": true
}, },
"node_modules/@types/tar-fs": { "node_modules/@types/tar-fs": {

View File

@ -42,7 +42,7 @@
"devDependencies": { "devDependencies": {
"@tsconfig/node14": "^1.0.3", "@tsconfig/node14": "^1.0.3",
"@types/follow-redirects": "^1.14.1", "@types/follow-redirects": "^1.14.1",
"@types/node": "^18.11.18", "@types/node": "^18.15.7",
"@types/tar-fs": "^2.0.1", "@types/tar-fs": "^2.0.1",
"clean-modules": "^2.0.6", "clean-modules": "^2.0.6",
"typescript": "^5.0.2" "typescript": "^5.0.2"

View File

@ -10,27 +10,29 @@ interface FollowRedirOptions extends UrlWithStringQuery {
} }
export const isValidUrl = (input: string) => { export const isValidUrl = (input: string) => {
try { try {
return !!new URL(input); return !!new URL(input);
} catch (err) { } catch (err) {
return false; return false;
} }
} };
export const downloadAndExtract = async (url: string) => export const downloadAndExtract = async (url: string) =>
new Promise<string>((resolve, reject) => { new Promise<string>((resolve, reject) => {
const getOptions = parse(url) as FollowRedirOptions; const getOptions = parse(url) as FollowRedirOptions;
getOptions.maxBodyLength = 60 * 1024 * 1024; // 60mb getOptions.maxBodyLength = 60 * 1024 * 1024; // 60mb
const destDir = `${tmpdir()}/chromium-pack` const destDir = `${tmpdir()}/chromium-pack`;
const extractObj = extract(destDir) const extractObj = extract(destDir);
https.get(url, (response) => { https
response.pipe(extractObj); .get(url, (response) => {
extractObj.on('finish', () => { response.pipe(extractObj);
resolve(destDir); extractObj.on("finish", () => {
}); resolve(destDir);
}).on('error', (err) => {
unlink(destDir, (_) => {
reject(err)
});
}); });
}) })
.on("error", (err) => {
unlink(destDir, (_) => {
reject(err);
});
});
});

View File

@ -1,9 +1,15 @@
import { access, createWriteStream, existsSync, mkdirSync, symlink } from 'node:fs'; import {
import { IncomingMessage } from 'node:http'; access,
import LambdaFS from './lambdafs'; createWriteStream,
import { join } from 'node:path'; existsSync,
import { URL } from 'node:url'; mkdirSync,
import { downloadAndExtract, isValidUrl } from './helper'; symlink,
} from "node:fs";
import { IncomingMessage } from "node:http";
import LambdaFS from "./lambdafs";
import { join } from "node:path";
import { URL } from "node:url";
import { downloadAndExtract, isValidUrl } from "./helper";
/** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */ /** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */
interface Viewport { interface Viewport {
@ -38,15 +44,21 @@ interface Viewport {
hasTouch?: boolean; hasTouch?: boolean;
} }
if ( process.env.AWS_EXECUTION_ENV !== undefined && /^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) { if (
process.env.AWS_EXECUTION_ENV !== undefined &&
/^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) ===
true
) {
if (process.env.FONTCONFIG_PATH === undefined) { if (process.env.FONTCONFIG_PATH === undefined) {
process.env.FONTCONFIG_PATH = '/tmp/aws'; process.env.FONTCONFIG_PATH = "/tmp/aws";
} }
if (process.env.LD_LIBRARY_PATH === undefined) { if (process.env.LD_LIBRARY_PATH === undefined) {
process.env.LD_LIBRARY_PATH = '/tmp/aws/lib'; process.env.LD_LIBRARY_PATH = "/tmp/aws/lib";
} else if (process.env.LD_LIBRARY_PATH.startsWith('/tmp/aws/lib') !== true) { } else if (process.env.LD_LIBRARY_PATH.startsWith("/tmp/aws/lib") !== true) {
process.env.LD_LIBRARY_PATH = [...new Set(['/tmp/aws/lib', ...process.env.LD_LIBRARY_PATH.split(':')])].join(':'); process.env.LD_LIBRARY_PATH = [
...new Set(["/tmp/aws/lib", ...process.env.LD_LIBRARY_PATH.split(":")]),
].join(":");
} }
} }
@ -63,7 +75,7 @@ class Chromium {
} }
if (process.env.HOME === undefined) { if (process.env.HOME === undefined) {
process.env.HOME = '/tmp'; process.env.HOME = "/tmp";
} }
if (existsSync(`${process.env.HOME}/.fonts`) !== true) { if (existsSync(`${process.env.HOME}/.fonts`) !== true) {
@ -76,24 +88,29 @@ class Chromium {
} }
const url = new URL(input); const url = new URL(input);
const output = `${process.env.HOME}/.fonts/${url.pathname.split('/').pop()}`; const output = `${process.env.HOME}/.fonts/${url.pathname
.split("/")
.pop()}`;
if (existsSync(output) === true) { if (existsSync(output) === true) {
return resolve(output.split('/').pop() as string); return resolve(output.split("/").pop() as string);
} }
if (url.protocol === 'file:') { if (url.protocol === "file:") {
access(url.pathname, (error) => { access(url.pathname, (error) => {
if (error != null) { if (error != null) {
return reject(error); return reject(error);
} }
symlink(url.pathname, output, (error) => { symlink(url.pathname, output, (error) => {
return error != null ? reject(error) : resolve(url.pathname.split('/').pop() as string); return error != null
? reject(error)
: resolve(url.pathname.split("/").pop() as string);
}); });
}); });
} else { } else {
let handler = url.protocol === 'http:' ? require('http').get : require('https').get; let handler =
url.protocol === "http:" ? require("http").get : require("https").get;
handler(input, (response: IncomingMessage) => { handler(input, (response: IncomingMessage) => {
if (response.statusCode !== 200) { if (response.statusCode !== 200) {
@ -102,17 +119,17 @@ class Chromium {
const stream = createWriteStream(output); const stream = createWriteStream(output);
stream.once('error', (error) => { stream.once("error", (error) => {
return reject(error); return reject(error);
}); });
response.on('data', (chunk) => { response.on("data", (chunk) => {
stream.write(chunk); stream.write(chunk);
}); });
response.once('end', () => { response.once("end", () => {
stream.end(() => { stream.end(() => {
return resolve(url.pathname.split('/').pop() as string); return resolve(url.pathname.split("/").pop() as string);
}); });
}); });
}); });
@ -126,39 +143,39 @@ class Chromium {
*/ */
static get args(): string[] { static get args(): string[] {
const result = [ const result = [
'--allow-running-insecure-content', // https://source.chromium.org/search?q=lang:cpp+symbol:kAllowRunningInsecureContent&ss=chromium "--allow-running-insecure-content", // https://source.chromium.org/search?q=lang:cpp+symbol:kAllowRunningInsecureContent&ss=chromium
'--autoplay-policy=user-gesture-required', // https://source.chromium.org/search?q=lang:cpp+symbol:kAutoplayPolicy&ss=chromium "--autoplay-policy=user-gesture-required", // https://source.chromium.org/search?q=lang:cpp+symbol:kAutoplayPolicy&ss=chromium
'--disable-background-timer-throttling', "--disable-background-timer-throttling",
'--disable-component-update', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableComponentUpdate&ss=chromium "--disable-component-update", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableComponentUpdate&ss=chromium
'--disable-domain-reliability', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableDomainReliability&ss=chromium "--disable-domain-reliability", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableDomainReliability&ss=chromium
'--disable-features=AudioServiceOutOfProcess,IsolateOrigins,site-per-process', // https://source.chromium.org/search?q=file:content_features.cc&ss=chromium "--disable-features=AudioServiceOutOfProcess,IsolateOrigins,site-per-process", // https://source.chromium.org/search?q=file:content_features.cc&ss=chromium
'--disable-ipc-flooding-protection', "--disable-ipc-flooding-protection",
'--disable-print-preview', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisablePrintPreview&ss=chromium "--disable-print-preview", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisablePrintPreview&ss=chromium
'--disable-dev-shm-usage', "--disable-dev-shm-usage",
'--disable-setuid-sandbox', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableSetuidSandbox&ss=chromium "--disable-setuid-sandbox", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableSetuidSandbox&ss=chromium
'--disable-site-isolation-trials', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableSiteIsolation&ss=chromium "--disable-site-isolation-trials", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableSiteIsolation&ss=chromium
'--disable-speech-api', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableSpeechAPI&ss=chromium "--disable-speech-api", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableSpeechAPI&ss=chromium
'--disable-web-security', // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableWebSecurity&ss=chromium "--disable-web-security", // https://source.chromium.org/search?q=lang:cpp+symbol:kDisableWebSecurity&ss=chromium
'--disk-cache-size=33554432', // https://source.chromium.org/search?q=lang:cpp+symbol:kDiskCacheSize&ss=chromium "--disk-cache-size=33554432", // https://source.chromium.org/search?q=lang:cpp+symbol:kDiskCacheSize&ss=chromium
'--enable-features=SharedArrayBuffer', // https://source.chromium.org/search?q=file:content_features.cc&ss=chromium "--enable-features=SharedArrayBuffer", // https://source.chromium.org/search?q=file:content_features.cc&ss=chromium
'--hide-scrollbars', // https://source.chromium.org/search?q=lang:cpp+symbol:kHideScrollbars&ss=chromium "--hide-scrollbars", // https://source.chromium.org/search?q=lang:cpp+symbol:kHideScrollbars&ss=chromium
'--ignore-gpu-blocklist', // https://source.chromium.org/search?q=lang:cpp+symbol:kIgnoreGpuBlocklist&ss=chromium "--ignore-gpu-blocklist", // https://source.chromium.org/search?q=lang:cpp+symbol:kIgnoreGpuBlocklist&ss=chromium
'--in-process-gpu', // https://source.chromium.org/search?q=lang:cpp+symbol:kInProcessGPU&ss=chromium "--in-process-gpu", // https://source.chromium.org/search?q=lang:cpp+symbol:kInProcessGPU&ss=chromium
'--mute-audio', // https://source.chromium.org/search?q=lang:cpp+symbol:kMuteAudio&ss=chromium "--mute-audio", // https://source.chromium.org/search?q=lang:cpp+symbol:kMuteAudio&ss=chromium
'--no-default-browser-check', // https://source.chromium.org/search?q=lang:cpp+symbol:kNoDefaultBrowserCheck&ss=chromium "--no-default-browser-check", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoDefaultBrowserCheck&ss=chromium
'--no-first-run', "--no-first-run",
'--no-pings', // https://source.chromium.org/search?q=lang:cpp+symbol:kNoPings&ss=chromium "--no-pings", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoPings&ss=chromium
'--no-sandbox', // https://source.chromium.org/search?q=lang:cpp+symbol:kNoSandbox&ss=chromium "--no-sandbox", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoSandbox&ss=chromium
'--no-zygote', // https://source.chromium.org/search?q=lang:cpp+symbol:kNoZygote&ss=chromium "--no-zygote", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoZygote&ss=chromium
'--use-gl=angle', // https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md "--use-gl=angle", // https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md
'--use-angle=swiftshader', // https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md "--use-angle=swiftshader", // https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md
'--window-size=1920,1080', // https://source.chromium.org/search?q=lang:cpp+symbol:kWindowSize&ss=chromium "--window-size=1920,1080", // https://source.chromium.org/search?q=lang:cpp+symbol:kWindowSize&ss=chromium
]; ];
if (Chromium.headless === true) { if (Chromium.headless === true) {
result.push('--single-process'); // https://source.chromium.org/search?q=lang:cpp+symbol:kSingleProcess&ss=chromium result.push("--single-process"); // https://source.chromium.org/search?q=lang:cpp+symbol:kSingleProcess&ss=chromium
} else { } else {
result.push('--start-maximized'); // https://source.chromium.org/search?q=lang:cpp+symbol:kStartMaximized&ss=chromium result.push("--start-maximized"); // https://source.chromium.org/search?q=lang:cpp+symbol:kStartMaximized&ss=chromium
} }
return result; return result;
@ -187,8 +204,8 @@ class Chromium {
/** /**
* If the `chromium` binary already exists in /tmp/chromium, return it. * If the `chromium` binary already exists in /tmp/chromium, return it.
*/ */
if (existsSync('/tmp/chromium') === true) { if (existsSync("/tmp/chromium") === true) {
return Promise.resolve('/tmp/chromium'); return Promise.resolve("/tmp/chromium");
} }
if (input && isValidUrl(input)) { if (input && isValidUrl(input)) {
@ -199,7 +216,7 @@ class Chromium {
* otherwise, the default location is ../bin. * otherwise, the default location is ../bin.
* A custom location is needed for workflows that using custom packaging. * A custom location is needed for workflows that using custom packaging.
*/ */
input ??= join(__dirname, '..', 'bin'); input ??= join(__dirname, "..", "bin");
/** /**
* If the input directory doesn't exist, throw an error. * If the input directory doesn't exist, throw an error.
@ -213,7 +230,12 @@ class Chromium {
LambdaFS.inflate(`${input}/swiftshader.tar.br`), LambdaFS.inflate(`${input}/swiftshader.tar.br`),
]; ];
if (process.env.AWS_EXECUTION_ENV !== undefined && /^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(process.env.AWS_EXECUTION_ENV) === true) { if (
process.env.AWS_EXECUTION_ENV !== undefined &&
/^AWS_Lambda_nodejs(?:14|16|18)[.]x$/.test(
process.env.AWS_EXECUTION_ENV
) === true
) {
promises.push(LambdaFS.inflate(`${input}/aws.tar.br`)); promises.push(LambdaFS.inflate(`${input}/aws.tar.br`));
} }
@ -227,17 +249,20 @@ class Chromium {
* False is returned if Serverless environment variables `IS_LOCAL` or `IS_OFFLINE` are set. * False is returned if Serverless environment variables `IS_LOCAL` or `IS_OFFLINE` are set.
*/ */
static get headless() { static get headless() {
if (process.env.IS_LOCAL !== undefined || process.env.IS_OFFLINE !== undefined) { if (
process.env.IS_LOCAL !== undefined ||
process.env.IS_OFFLINE !== undefined
) {
return false; return false;
} }
if (process.env.NODE_ENV === "test") { if (process.env.NODE_ENV === "test") {
return true; return true;
} }
const environments = [ const environments = [
'AWS_LAMBDA_FUNCTION_NAME', "AWS_LAMBDA_FUNCTION_NAME",
'FUNCTION_NAME', "FUNCTION_NAME",
'FUNCTION_TARGET', "FUNCTION_TARGET",
'FUNCTIONS_EMULATOR', "FUNCTIONS_EMULATOR",
]; ];
return environments.some((key) => process.env[key] !== undefined); return environments.some((key) => process.env[key] !== undefined);

View File

@ -1,8 +1,8 @@
import { createReadStream, createWriteStream, existsSync } from 'node:fs'; import { createReadStream, createWriteStream, existsSync } from "node:fs";
import { tmpdir } from 'node:os'; import { tmpdir } from "node:os";
import { basename, join } from 'node:path'; import { basename, join } from "node:path";
import { extract } from 'tar-fs'; import { extract } from "tar-fs";
import { createBrotliDecompress, createUnzip } from 'node:zlib'; import { createBrotliDecompress, createUnzip } from "node:zlib";
class LambdaFS { class LambdaFS {
/** /**
@ -11,7 +11,15 @@ class LambdaFS {
* @param filePath Path of the file to decompress. * @param filePath Path of the file to decompress.
*/ */
static inflate(filePath: string): Promise<string> { static inflate(filePath: string): Promise<string> {
const output = filePath.includes("swiftshader") ? tmpdir() : join(tmpdir(), basename(filePath).replace(/[.](?:t(?:ar(?:[.](?:br|gz))?|br|gz)|br|gz)$/i, '')); const output = filePath.includes("swiftshader")
? tmpdir()
: join(
tmpdir(),
basename(filePath).replace(
/[.](?:t(?:ar(?:[.](?:br|gz))?|br|gz)|br|gz)$/i,
""
)
);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (filePath.includes("swiftshader")) { if (filePath.includes("swiftshader")) {
@ -30,27 +38,33 @@ class LambdaFS {
if (/[.](?:t(?:ar(?:[.](?:br|gz))?|br|gz))$/i.test(filePath) === true) { if (/[.](?:t(?:ar(?:[.](?:br|gz))?|br|gz))$/i.test(filePath) === true) {
target = extract(output); target = extract(output);
target.once('finish', () => { target.once("finish", () => {
return resolve(output); return resolve(output);
}); });
} else { } else {
target = createWriteStream(output, { mode: 0o700 }); target = createWriteStream(output, { mode: 0o700 });
} }
source.once('error', (error: Error) => { source.once("error", (error: Error) => {
return reject(error); return reject(error);
}); });
target.once('error', (error: Error) => { target.once("error", (error: Error) => {
return reject(error); return reject(error);
}); });
target.once('close', () => { target.once("close", () => {
return resolve(output); return resolve(output);
}); });
if (/(?:br|gz)$/i.test(filePath) === true) { if (/(?:br|gz)$/i.test(filePath) === true) {
source.pipe(/br$/i.test(filePath) ? createBrotliDecompress({ chunkSize: 2 ** 21 }) : createUnzip({ chunkSize: 2 ** 21 })).pipe(target); source
.pipe(
/br$/i.test(filePath)
? createBrotliDecompress({ chunkSize: 2 ** 21 })
: createUnzip({ chunkSize: 2 ** 21 })
)
.pipe(target);
} else { } else {
source.pipe(target); source.pipe(target);
} }

View File

@ -2,8 +2,12 @@
"extends": "@tsconfig/node14/tsconfig.json", "extends": "@tsconfig/node14/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"declaration": true, "declaration": true,
"lib": ["dom"], "lib": [
"dom"
],
"outDir": "build", "outDir": "build",
}, },
"include": ["source"] "include": [
"source"
]
} }