{"_id":"pac-resolver@9.0.2","bugs":{"url":"https://github.com/TooTallNate/proxy-agents/issues"},"dist":{"shasum":"1e846d279f56b077a7cb0579bfc0f992d6efee69","tarball":"http://registry-npm.ywwl.com/pac-resolver/download/pac-resolver-9.0.2.tgz","fileCount":63,"integrity":"sha512-FyLebKd2X1SzQAc6P+AAgWRGnAgEAYEwn1oJucBIdQivJ50dV3Lndjqso4mebnHiLaYeHtVaDfSL33BJYLi7QA==","signatures":[{"sig":"MEYCIQDPSxBObesoho478TDNbXIN+cPFQhjbQKlC+t+7IZSRZAIhAK0Fj0RwdRhjeY5rb3PvKibWHTLCwKNwfC6RHvuyEwdF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDgMFGJih7dxFZLI3gZqzaQchO6Cz1ljM9Hb1JkAc1DwQIhAO4ToJqa0l8s/2ernxqVtKk4XbgdKo+NyF8RiAZZDmcf"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/pac-resolver@9.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56277,"size":16678,"noattachment":false,"key":"/pac-resolver/-/pac-resolver-9.0.2.tgz"},"name":"pac-resolver","type":"module","_from":"file:pac-resolver-9.0.2.tgz","author":{"url":"http://n8.io/","name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"engines":{"node":">= 20"},"exports":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"license":"MIT","scripts":{"lint":"eslint . --ext .ts","pack":"node ../../scripts/pack.mjs","test":"vitest","build":"tsc"},"version":"9.0.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"106b6536-4d79-4c36-a281-d768b2f5bdb5"}},"homepage":"https://github.com/TooTallNate/proxy-agents#readme","keywords":["pac","file","proxy","resolve","dns"],"_resolved":"/tmp/4c14f89b7acf4565bed009661f0832a2/pac-resolver-9.0.2.tgz","_integrity":"sha512-FyLebKd2X1SzQAc6P+AAgWRGnAgEAYEwn1oJucBIdQivJ50dV3Lndjqso4mebnHiLaYeHtVaDfSL33BJYLi7QA==","repository":{"url":"git+https://github.com/TooTallNate/proxy-agents.git","type":"git","directory":"packages/pac-resolver"},"_npmVersion":"12.2.2","description":"Generates an asynchronous resolver function from a PAC file","directories":{},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_nodeVersion":"24.22.2","dependencies":{"netmask":"^2.0.2","degenerator":"7.0.2"},"_hasShrinkwrap":false,"devDependencies":{"tsconfig":"0.0.0","typescript":"^5.1.6","@types/node":"^22.13.0","quickjs-wasi":"^3.0.0","@types/netmask":"^1.0.30"},"peerDependencies":{"quickjs-wasi":"^3.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pac-resolver_9.0.2_1794854156988_0.6265022747440693"},"readme":"pac-resolver\n============\n### Generates an asynchronous resolver function from a [PAC file][pac-wikipedia]\n\n\nThis module accepts a JavaScript String of code, which is meant to be a\n[PAC proxy file][pac-wikipedia], and returns a generated asynchronous\n`FindProxyForURL()` function.\n\nExample\n-------\n\nGiven the PAC proxy file named `proxy.pac`:\n\n```js\nfunction FindProxyForURL(url, host) {\n  if (isInNet(myIpAddress(), \"10.1.10.0\", \"255.255.255.0\")) {\n    return \"PROXY 1.2.3.4:8080\";\n  } else {\n    return \"DIRECT\";\n  }\n}\n```\n\nYou can consume this PAC file with `pac-resolver` like so:\n\n```ts\nimport { readFileSync } from 'fs';\nimport { createPacResolver } from 'pac-resolver';\n\nconst FindProxyForURL = createPacResolver(readFileSync('proxy.pac'));\n\nconst res = await FindProxyForURL('http://foo.com/');\nconsole.log(res);\n// \"DIRECT\"\n```\n\n\nAPI\n---\n\n### pac(qjs: QuickJSWASMModule, pacFileContents: string | Buffer, options?: PacResolverOptions) → Function\n\nReturns an asynchronous `FindProxyForURL()` function based off of the given JS\nstring `pacFileContents` PAC proxy file. An optional `options` object may be\npassed in which respects the following options:\n\n * `filename` - String - the filename to use in error stack traces. Defaults to `proxy.pac`.\n * `sandbox` - Object - a map of functions to include in the sandbox of the\n JavaScript environment where the JS code will be executed. i.e. if you wanted to\n include the common `alert` function you could pass `alert: console.log`. For\n async functions, you must set the `async = true` property on the function\n instance, and the JS code will be able to invoke the function as if it were\n synchronous.\n\n The `qjs` parameter is a QuickJS module instance as returned from `getQuickJS()` from the `quickjs-emscripten` module.\n\n[pac-file-docs]: https://web.archive.org/web/20070602031929/http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html\n[pac-wikipedia]: http://wikipedia.org/wiki/Proxy_auto-config\n","publish_time":1794854157097,"_cnpm_publish_time":1794854157097,"dist-tags":{"latest":"9.0.2"}}