ipx 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,7 +124,12 @@ const createHTTPSource = (options) => {
124
124
  if (typeof _domains === "string") {
125
125
  _domains = _domains.split(",").map((s) => s.trim());
126
126
  }
127
- const domains = _domains.map((d) => new URL(d).hostname || new URL("http://" + d).hostname).filter(Boolean);
127
+ const domains = _domains.map((d) => {
128
+ if (!d.startsWith("http")) {
129
+ d = "http://" + d;
130
+ }
131
+ return new URL(d).hostname;
132
+ }).filter(Boolean);
128
133
  return async (id, reqOptions) => {
129
134
  const hostname = new URL(id).hostname;
130
135
  if (!hostname) {
@@ -113,7 +113,12 @@ const createHTTPSource = (options) => {
113
113
  if (typeof _domains === "string") {
114
114
  _domains = _domains.split(",").map((s) => s.trim());
115
115
  }
116
- const domains = _domains.map((d) => new URL(d).hostname || new URL("http://" + d).hostname).filter(Boolean);
116
+ const domains = _domains.map((d) => {
117
+ if (!d.startsWith("http")) {
118
+ d = "http://" + d;
119
+ }
120
+ return new URL(d).hostname;
121
+ }).filter(Boolean);
117
122
  return async (id, reqOptions) => {
118
123
  const hostname = new URL(id).hostname;
119
124
  if (!hostname) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipx",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "repository": "unjs/ipx",
5
5
  "license": "MIT",
6
6
  "exports": {