Comparing version 0.4.1 to 0.4.2
@@ -13,2 +13,3 @@ #!/usr/bin/env node | ||
const fsExtra = require('fs-extra'); | ||
const http2 = require('http'); | ||
const https2 = require('https'); | ||
@@ -26,2 +27,3 @@ const fetch = require('node-fetch'); | ||
const isValidPath__default = /*#__PURE__*/_interopDefaultLegacy(isValidPath); | ||
const http2__default = /*#__PURE__*/_interopDefaultLegacy(http2); | ||
const https2__default = /*#__PURE__*/_interopDefaultLegacy(https2); | ||
@@ -209,10 +211,17 @@ const fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch); | ||
super(...arguments); | ||
this.agent = void 0; | ||
this.httpsAgent = void 0; | ||
this.httpAgent = void 0; | ||
} | ||
init() { | ||
this.agent = new https2__default['default'].Agent({ | ||
this.httpsAgent = new https2__default['default'].Agent({ | ||
keepAlive: true | ||
}); | ||
this.httpAgent = new http2__default['default'].Agent({ | ||
keepAlive: true | ||
}); | ||
this.options.accept = this.options.accept || [".*"]; | ||
} | ||
getAgent(src) { | ||
return src.startsWith("https") ? this.httpsAgent : this.httpAgent; | ||
} | ||
async _retrive(src) { | ||
@@ -229,3 +238,3 @@ var _a, _b, _c, _d; | ||
const response = await fetch__default['default'](src, { | ||
agent: this.agent | ||
agent: this.getAgent(src) | ||
}); | ||
@@ -232,0 +241,0 @@ const buffer = await response.buffer(); |
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.4.2](https://github.com/nuxt-contrib/ipx/compare/v0.4.1...v0.4.2) (2020-11-18) | ||
### Bug Fixes | ||
* support `HttpAgent` with `remote` input ([#14](https://github.com/nuxt-contrib/ipx/issues/14)) ([699b671](https://github.com/nuxt-contrib/ipx/commit/699b6717d1b6f817edb784d50cd5f2ce8da5d21a)) | ||
### [0.4.1](https://github.com/nuxt-contrib/ipx/compare/v0.4.0...v0.4.1) (2020-11-12) | ||
@@ -7,0 +14,0 @@ |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const fsExtra = require('fs-extra'); | ||
const http2 = require('http'); | ||
const https2 = require('https'); | ||
@@ -24,2 +25,3 @@ const fetch = require('node-fetch'); | ||
const isValidPath__default = /*#__PURE__*/_interopDefaultLegacy(isValidPath); | ||
const http2__default = /*#__PURE__*/_interopDefaultLegacy(http2); | ||
const https2__default = /*#__PURE__*/_interopDefaultLegacy(https2); | ||
@@ -207,10 +209,17 @@ const fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch); | ||
super(...arguments); | ||
this.agent = void 0; | ||
this.httpsAgent = void 0; | ||
this.httpAgent = void 0; | ||
} | ||
init() { | ||
this.agent = new https2__default['default'].Agent({ | ||
this.httpsAgent = new https2__default['default'].Agent({ | ||
keepAlive: true | ||
}); | ||
this.httpAgent = new http2__default['default'].Agent({ | ||
keepAlive: true | ||
}); | ||
this.options.accept = this.options.accept || [".*"]; | ||
} | ||
getAgent(src) { | ||
return src.startsWith("https") ? this.httpsAgent : this.httpAgent; | ||
} | ||
async _retrive(src) { | ||
@@ -227,3 +236,3 @@ var _a, _b, _c, _d; | ||
const response = await fetch__default['default'](src, { | ||
agent: this.agent | ||
agent: this.getAgent(src) | ||
}); | ||
@@ -230,0 +239,0 @@ const buffer = await response.buffer(); |
@@ -8,2 +8,3 @@ import { resolve, posix, relative, dirname, extname } from 'path'; | ||
import { stat, readFile, mkdirpSync, remove, exists, mkdirp, writeFile } from 'fs-extra'; | ||
import http2 from 'http'; | ||
import https2 from 'https'; | ||
@@ -191,10 +192,17 @@ import fetch from 'node-fetch'; | ||
super(...arguments); | ||
this.agent = void 0; | ||
this.httpsAgent = void 0; | ||
this.httpAgent = void 0; | ||
} | ||
init() { | ||
this.agent = new https2.Agent({ | ||
this.httpsAgent = new https2.Agent({ | ||
keepAlive: true | ||
}); | ||
this.httpAgent = new http2.Agent({ | ||
keepAlive: true | ||
}); | ||
this.options.accept = this.options.accept || [".*"]; | ||
} | ||
getAgent(src) { | ||
return src.startsWith("https") ? this.httpsAgent : this.httpAgent; | ||
} | ||
async _retrive(src) { | ||
@@ -211,3 +219,3 @@ var _a, _b, _c, _d; | ||
const response = await fetch(src, { | ||
agent: this.agent | ||
agent: this.getAgent(src) | ||
}); | ||
@@ -214,0 +222,0 @@ const buffer = await response.buffer(); |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const fsExtra = require('fs-extra'); | ||
const http2 = require('http'); | ||
const https2 = require('https'); | ||
@@ -24,2 +25,3 @@ const fetch = require('node-fetch'); | ||
const isValidPath__default = /*#__PURE__*/_interopDefaultLegacy(isValidPath); | ||
const http2__default = /*#__PURE__*/_interopDefaultLegacy(http2); | ||
const https2__default = /*#__PURE__*/_interopDefaultLegacy(https2); | ||
@@ -207,10 +209,17 @@ const fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch); | ||
super(...arguments); | ||
this.agent = void 0; | ||
this.httpsAgent = void 0; | ||
this.httpAgent = void 0; | ||
} | ||
init() { | ||
this.agent = new https2__default['default'].Agent({ | ||
this.httpsAgent = new https2__default['default'].Agent({ | ||
keepAlive: true | ||
}); | ||
this.httpAgent = new http2__default['default'].Agent({ | ||
keepAlive: true | ||
}); | ||
this.options.accept = this.options.accept || [".*"]; | ||
} | ||
getAgent(src) { | ||
return src.startsWith("https") ? this.httpsAgent : this.httpAgent; | ||
} | ||
async _retrive(src) { | ||
@@ -227,3 +236,3 @@ var _a, _b, _c, _d; | ||
const response = await fetch__default['default'](src, { | ||
agent: this.agent | ||
agent: this.getAgent(src) | ||
}); | ||
@@ -230,0 +239,0 @@ const buffer = await response.buffer(); |
{ | ||
"name": "ipx", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"repository": "nuxt-contrib/ipx", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79627
2502
12