{"name":"pac-resolver","version":"6.0.0","description":"Generates an asynchronous resolver function from a PAC file","main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"degenerator":"^4.0.0","ip":"^1.1.5","netmask":"^2.0.2"},"devDependencies":{"@types/ip":"^1.1.0","@types/jest":"^29.5.1","@types/netmask":"^1.0.30","@types/node":"^14.18.43","jest":"^29.5.0","ts-jest":"^29.1.0","typescript":"^5.0.4","tsconfig":"0.0.0"},"repository":{"type":"git","url":"git+https://github.com/TooTallNate/proxy-agents.git","directory":"packages/pac-resolver"},"engines":{"node":">= 14"},"keywords":["pac","file","proxy","resolve","dns"],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io/"},"license":"MIT","scripts":{"build":"tsc","test":"jest --env node --verbose --bail","lint":"eslint . --ext .ts","pack":"node ../../scripts/pack.mjs"},"bugs":{"url":"https://github.com/TooTallNate/proxy-agents/issues"},"homepage":"https://github.com/TooTallNate/proxy-agents#readme","_id":"pac-resolver@6.0.0","_integrity":"sha512-1RjGH42MfLpVN58LRmUz1AOBOTkHy/Z8GT+7zgfqJ7M2KgJdCwjU7hiOnVcw/AYZLbsC32cVvL8O6hnfni3lSA==","_resolved":"/tmp/91de22462b4ff21e799cfef43daefcc9/pac-resolver-6.0.0.tgz","_from":"file:pac-resolver-6.0.0.tgz","_nodeVersion":"20.1.0","_npmVersion":"9.6.4","dist":{"integrity":"sha512-1RjGH42MfLpVN58LRmUz1AOBOTkHy/Z8GT+7zgfqJ7M2KgJdCwjU7hiOnVcw/AYZLbsC32cVvL8O6hnfni3lSA==","shasum":"df1ad3e89b2588460f3d0d55b13e311936bb6ab1","tarball":"http://registry-npm.ywwl.com/pac-resolver/download/pac-resolver-6.0.0.tgz","fileCount":59,"unpackedSize":58174,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHNOBCk5ANUn4hhupVP6PGc2yUoA+UH4iMl7XV3SvV2hAiEAq6C4y/Hg/WnLbeeXM1IPBhYthwJ7grPsJejgMM+TKVc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkVBaPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLpw//dSW1aobMJHt6QpKUkCpSAm7fd07DY3vI0FAHZAbcCvh6SHTX\r\nyRxHRRo/GQFUn/fw6qTOQdKfdvQJrNHJgmdlGJ087qtyodH9UQOTK9qG8O7V\r\n3fzyOz/2b/Y3qQYbp4FpqLttEXd5OIi8UP/UP1zhFaFvK2IS7eWU4PXk6s1J\r\nGsNX9MyxVbkHu4GXKEzimqcANVW1d6p/GVXrQEarUWdXo6z4r4pIdgE5HZZQ\r\ndsFvfMYGMCQFFzOpDyslGUGmYLTU/VJjGIhk9AGeAyuD+jsesCFyqShlAIlY\r\nkXh7ueH8+Wja8HHlpgkw6w3h60x0L07yl1XAJD3tnY+HL7lLUgXM01YitsLL\r\nsZoShYogCwoa5Z04qxxlwA04ZXiv0wiru3sq9nf+BuUUYh4MXQjZE9O0K6RE\r\nYKt6BBLRyeCYEV0+oZPsJzaz0N3EhT60p51GG4Fb16SLrmuqmJWTr7Q3NONL\r\ngoOLQ4hyqdwCxunJJwXN3sFOONrgxLHtzBmXHxyrkIRt7l6USfwqvU8XEmOp\r\nL4qPrLadgM7h55B8QuL6DnGDrThnm/0vToCl6n6/MaHWNujoOBYnJX5sy0/G\r\nOZ4IqhGgV2qpBgQpmsv76TPa/Og9o6y4Tw8nrgongIz5D9EHpvGUtrnFQb/0\r\n/aiFcBmcZHBWuyBxE0D8UqtSB14VNtDyjQA=\r\n=TmB8\r\n-----END PGP SIGNATURE-----\r\n","size":16252,"noattachment":false,"key":"/pac-resolver/-/pac-resolver-6.0.0.tgz"},"_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"directories":{},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pac-resolver_6.0.0_1683232399694_0.5609737294869028"},"_hasShrinkwrap":false,"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":1683232399893,"_cnpm_publish_time":1683232399893,"dist-tags":{"latest":"9.0.2"}}