Skip to content

v2.0.0

Choose a tag to compare

@Kaciras Kaciras released this 25 Oct 14:56
· 394 commits to master since this release
3ffd6b4

New Features

add support for proxy Node 18+ builtin fetch with PAC, example:

import { readFileSync } from "fs";
import { PACDispatcher } from "pac-maker";

// Only needed if your Node < 18.1.0
// import { fetch } from "undici";

const pac = readFileSync("proxy.pac", "utf8");
const dispatcher = new PACDispatcher(pac);

const response = await fetch("https://example.com", { dispatcher });

Also add dispatcher parameter to builtin hostname sources which need fetch data from network.

import { readFileSync } from "fs";
import { gfwlist, PACDispatcher } from "pac-maker";

const pac = readFileSync("proxy.pac", "utf8");
const dispatcher = new PACDispatcher(pac);

const source = gfwlist({ dispatcher });