@loaders.gl/core 4.0.0-alpha.16 → 4.0.0-alpha.17
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.
- package/dist/dist.min.js +4 -8
- package/dist/es5/lib/fetch/fetch-file.js +11 -15
- package/dist/es5/lib/fetch/fetch-file.js.map +1 -1
- package/dist/es5/lib/init.js +1 -1
- package/dist/es5/null-loader.js +1 -1
- package/dist/esm/lib/fetch/fetch-file.js +4 -8
- package/dist/esm/lib/fetch/fetch-file.js.map +1 -1
- package/dist/esm/lib/init.js +1 -1
- package/dist/esm/null-loader.js +1 -1
- package/dist/lib/fetch/fetch-file.d.ts +4 -10
- package/dist/lib/fetch/fetch-file.d.ts.map +1 -1
- package/dist/lib/fetch/fetch-file.js +10 -16
- package/dist/lib/loader-utils/get-fetch-function.d.ts +1 -2
- package/dist/lib/loader-utils/get-fetch-function.d.ts.map +1 -1
- package/dist/null-worker-node.js +1 -1
- package/dist/null-worker.js +1 -1
- package/package.json +4 -4
- package/src/lib/fetch/fetch-file.ts +12 -18
package/dist/dist.min.js
CHANGED
|
@@ -1742,16 +1742,12 @@
|
|
|
1742
1742
|
});
|
|
1743
1743
|
|
|
1744
1744
|
// src/lib/fetch/fetch-file.ts
|
|
1745
|
-
async function fetchFile(
|
|
1746
|
-
if (typeof
|
|
1747
|
-
url = resolvePath(
|
|
1748
|
-
let fetchOptions = options;
|
|
1749
|
-
if (options?.fetch && typeof options?.fetch !== "function") {
|
|
1750
|
-
fetchOptions = options.fetch;
|
|
1751
|
-
}
|
|
1745
|
+
async function fetchFile(urlOrData, fetchOptions) {
|
|
1746
|
+
if (typeof urlOrData === "string") {
|
|
1747
|
+
const url = resolvePath(urlOrData);
|
|
1752
1748
|
return await fetch(url, fetchOptions);
|
|
1753
1749
|
}
|
|
1754
|
-
return await makeResponse(
|
|
1750
|
+
return await makeResponse(urlOrData);
|
|
1755
1751
|
}
|
|
1756
1752
|
var init_fetch_file = __esm({
|
|
1757
1753
|
"src/lib/fetch/fetch-file.ts"() {
|
|
@@ -13,30 +13,26 @@ function fetchFile(_x, _x2) {
|
|
|
13
13
|
return _fetchFile.apply(this, arguments);
|
|
14
14
|
}
|
|
15
15
|
function _fetchFile() {
|
|
16
|
-
_fetchFile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(
|
|
17
|
-
var
|
|
16
|
+
_fetchFile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(urlOrData, fetchOptions) {
|
|
17
|
+
var url;
|
|
18
18
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
19
19
|
while (1) switch (_context.prev = _context.next) {
|
|
20
20
|
case 0:
|
|
21
|
-
if (!(typeof
|
|
22
|
-
_context.next =
|
|
21
|
+
if (!(typeof urlOrData === 'string')) {
|
|
22
|
+
_context.next = 5;
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
|
-
url = (0, _loaderUtils.resolvePath)(
|
|
26
|
-
|
|
27
|
-
if (options !== null && options !== void 0 && options.fetch && typeof (options === null || options === void 0 ? void 0 : options.fetch) !== 'function') {
|
|
28
|
-
fetchOptions = options.fetch;
|
|
29
|
-
}
|
|
30
|
-
_context.next = 6;
|
|
25
|
+
url = (0, _loaderUtils.resolvePath)(urlOrData);
|
|
26
|
+
_context.next = 4;
|
|
31
27
|
return fetch(url, fetchOptions);
|
|
32
|
-
case
|
|
28
|
+
case 4:
|
|
33
29
|
return _context.abrupt("return", _context.sent);
|
|
30
|
+
case 5:
|
|
31
|
+
_context.next = 7;
|
|
32
|
+
return (0, _responseUtils.makeResponse)(urlOrData);
|
|
34
33
|
case 7:
|
|
35
|
-
_context.next = 9;
|
|
36
|
-
return (0, _responseUtils.makeResponse)(url);
|
|
37
|
-
case 9:
|
|
38
34
|
return _context.abrupt("return", _context.sent);
|
|
39
|
-
case
|
|
35
|
+
case 8:
|
|
40
36
|
case "end":
|
|
41
37
|
return _context.stop();
|
|
42
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-file.js","names":["_loaderUtils","require","_responseUtils","fetchFile","_x","_x2","_fetchFile","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","
|
|
1
|
+
{"version":3,"file":"fetch-file.js","names":["_loaderUtils","require","_responseUtils","fetchFile","_x","_x2","_fetchFile","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","urlOrData","fetchOptions","url","wrap","_callee$","_context","prev","next","resolvePath","fetch","abrupt","sent","makeResponse","stop"],"sources":["../../../../src/lib/fetch/fetch-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {resolvePath} from '@loaders.gl/loader-utils';\nimport {makeResponse} from '../utils/response-utils';\n\n/**\n * fetch API compatible function\n * - Supports fetching from Node.js local file system paths\n * - Respects pathPrefix and file aliases\n */\nexport async function fetchFile(\n urlOrData: string | Blob,\n fetchOptions?: RequestInit\n): Promise<Response> {\n if (typeof urlOrData === 'string') {\n const url = resolvePath(urlOrData);\n\n // Call global fetch\n return await fetch(url, fetchOptions);\n }\n\n // TODO - should we still call fetch on non-URL inputs?\n return await makeResponse(urlOrData);\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAAqD,SAO/BE,SAASA,CAAAC,EAAA,EAAAC,GAAA;EAAA,OAAAC,UAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,WAAA;EAAAA,UAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAxB,SAAAC,QACLC,SAAwB,EACxBC,YAA0B;IAAA,IAAAC,GAAA;IAAA,OAAAL,YAAA,CAAAD,OAAA,CAAAO,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,MAEtB,OAAOP,SAAS,KAAK,QAAQ;YAAAK,QAAA,CAAAE,IAAA;YAAA;UAAA;UACzBL,GAAG,GAAG,IAAAM,wBAAW,EAACR,SAAS,CAAC;UAAAK,QAAA,CAAAE,IAAA;UAAA,OAGrBE,KAAK,CAACP,GAAG,EAAED,YAAY,CAAC;QAAA;UAAA,OAAAI,QAAA,CAAAK,MAAA,WAAAL,QAAA,CAAAM,IAAA;QAAA;UAAAN,QAAA,CAAAE,IAAA;UAAA,OAI1B,IAAAK,2BAAY,EAACZ,SAAS,CAAC;QAAA;UAAA,OAAAK,QAAA,CAAAK,MAAA,WAAAL,QAAA,CAAAM,IAAA;QAAA;QAAA;UAAA,OAAAN,QAAA,CAAAQ,IAAA;MAAA;IAAA,GAAAd,OAAA;EAAA,CACrC;EAAA,OAAAP,UAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
|
package/dist/es5/lib/init.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _log = require("./utils/log");
|
|
8
|
-
var version = typeof "4.0.0-alpha.
|
|
8
|
+
var version = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : '';
|
|
9
9
|
if (!globalThis.loaders) {
|
|
10
10
|
_log.log.log(1, "loaders.gl ".concat(version))();
|
|
11
11
|
globalThis.loaders = Object.assign(globalThis.loaders || {}, {
|
package/dist/es5/null-loader.js
CHANGED
|
@@ -11,7 +11,7 @@ var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpe
|
|
|
11
11
|
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
12
12
|
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
13
13
|
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function _throw(value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
14
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
14
|
+
var VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
|
|
15
15
|
var NullWorkerLoader = {
|
|
16
16
|
name: 'Null loader',
|
|
17
17
|
id: 'null',
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { resolvePath } from '@loaders.gl/loader-utils';
|
|
2
2
|
import { makeResponse } from '../utils/response-utils';
|
|
3
|
-
export async function fetchFile(
|
|
4
|
-
if (typeof
|
|
5
|
-
url = resolvePath(
|
|
6
|
-
let fetchOptions = options;
|
|
7
|
-
if (options !== null && options !== void 0 && options.fetch && typeof (options === null || options === void 0 ? void 0 : options.fetch) !== 'function') {
|
|
8
|
-
fetchOptions = options.fetch;
|
|
9
|
-
}
|
|
3
|
+
export async function fetchFile(urlOrData, fetchOptions) {
|
|
4
|
+
if (typeof urlOrData === 'string') {
|
|
5
|
+
const url = resolvePath(urlOrData);
|
|
10
6
|
return await fetch(url, fetchOptions);
|
|
11
7
|
}
|
|
12
|
-
return await makeResponse(
|
|
8
|
+
return await makeResponse(urlOrData);
|
|
13
9
|
}
|
|
14
10
|
//# sourceMappingURL=fetch-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-file.js","names":["resolvePath","makeResponse","fetchFile","
|
|
1
|
+
{"version":3,"file":"fetch-file.js","names":["resolvePath","makeResponse","fetchFile","urlOrData","fetchOptions","url","fetch"],"sources":["../../../../src/lib/fetch/fetch-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {resolvePath} from '@loaders.gl/loader-utils';\nimport {makeResponse} from '../utils/response-utils';\n\n/**\n * fetch API compatible function\n * - Supports fetching from Node.js local file system paths\n * - Respects pathPrefix and file aliases\n */\nexport async function fetchFile(\n urlOrData: string | Blob,\n fetchOptions?: RequestInit\n): Promise<Response> {\n if (typeof urlOrData === 'string') {\n const url = resolvePath(urlOrData);\n\n // Call global fetch\n return await fetch(url, fetchOptions);\n }\n\n // TODO - should we still call fetch on non-URL inputs?\n return await makeResponse(urlOrData);\n}\n"],"mappings":"AAEA,SAAQA,WAAW,QAAO,0BAA0B;AACpD,SAAQC,YAAY,QAAO,yBAAyB;AAOpD,OAAO,eAAeC,SAASA,CAC7BC,SAAwB,EACxBC,YAA0B,EACP;EACnB,IAAI,OAAOD,SAAS,KAAK,QAAQ,EAAE;IACjC,MAAME,GAAG,GAAGL,WAAW,CAACG,SAAS,CAAC;IAGlC,OAAO,MAAMG,KAAK,CAACD,GAAG,EAAED,YAAY,CAAC;EACvC;EAGA,OAAO,MAAMH,YAAY,CAACE,SAAS,CAAC;AACtC"}
|
package/dist/esm/lib/init.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from './utils/log';
|
|
2
|
-
const version = typeof "4.0.0-alpha.
|
|
2
|
+
const version = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : '';
|
|
3
3
|
if (!globalThis.loaders) {
|
|
4
4
|
log.log(1, "loaders.gl ".concat(version))();
|
|
5
5
|
globalThis.loaders = Object.assign(globalThis.loaders || {}, {
|
package/dist/esm/null-loader.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* fetch compatible function
|
|
3
|
-
*
|
|
4
|
-
* -
|
|
5
|
-
* - data urls
|
|
6
|
-
* - File/Blob objects
|
|
7
|
-
* Leverages `@loaders.gl/polyfills` for Node.js support
|
|
8
|
-
* Respects pathPrefix and file aliases
|
|
2
|
+
* fetch API compatible function
|
|
3
|
+
* - Supports fetching from Node.js local file system paths
|
|
4
|
+
* - Respects pathPrefix and file aliases
|
|
9
5
|
*/
|
|
10
|
-
export declare function fetchFile(
|
|
11
|
-
fetch?: RequestInit | Function;
|
|
12
|
-
}): Promise<Response>;
|
|
6
|
+
export declare function fetchFile(urlOrData: string | Blob, fetchOptions?: RequestInit): Promise<Response>;
|
|
13
7
|
//# sourceMappingURL=fetch-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-file.d.ts","sourceRoot":"","sources":["../../../src/lib/fetch/fetch-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-file.d.ts","sourceRoot":"","sources":["../../../src/lib/fetch/fetch-file.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,YAAY,CAAC,EAAE,WAAW,GACzB,OAAO,CAAC,QAAQ,CAAC,CAUnB"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.fetchFile = void 0;
|
|
4
5
|
const loader_utils_1 = require("@loaders.gl/loader-utils");
|
|
5
6
|
const response_utils_1 = require("../utils/response-utils");
|
|
6
|
-
// import {getErrorMessageFromResponse} from './fetch-error-message';
|
|
7
7
|
/**
|
|
8
|
-
* fetch compatible function
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
* - data urls
|
|
12
|
-
* - File/Blob objects
|
|
13
|
-
* Leverages `@loaders.gl/polyfills` for Node.js support
|
|
14
|
-
* Respects pathPrefix and file aliases
|
|
8
|
+
* fetch API compatible function
|
|
9
|
+
* - Supports fetching from Node.js local file system paths
|
|
10
|
+
* - Respects pathPrefix and file aliases
|
|
15
11
|
*/
|
|
16
|
-
async function fetchFile(
|
|
17
|
-
if (typeof
|
|
18
|
-
url = (0, loader_utils_1.resolvePath)(
|
|
19
|
-
|
|
20
|
-
if (options?.fetch && typeof options?.fetch !== 'function') {
|
|
21
|
-
fetchOptions = options.fetch;
|
|
22
|
-
}
|
|
12
|
+
async function fetchFile(urlOrData, fetchOptions) {
|
|
13
|
+
if (typeof urlOrData === 'string') {
|
|
14
|
+
const url = (0, loader_utils_1.resolvePath)(urlOrData);
|
|
15
|
+
// Call global fetch
|
|
23
16
|
return await fetch(url, fetchOptions);
|
|
24
17
|
}
|
|
25
|
-
|
|
18
|
+
// TODO - should we still call fetch on non-URL inputs?
|
|
19
|
+
return await (0, response_utils_1.makeResponse)(urlOrData);
|
|
26
20
|
}
|
|
27
21
|
exports.fetchFile = fetchFile;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { LoaderContext, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
-
import { fetchFile } from '../fetch/fetch-file';
|
|
3
2
|
/**
|
|
4
3
|
* Gets the current fetch function from options and context
|
|
5
4
|
* @param options
|
|
6
5
|
* @param context
|
|
7
6
|
*/
|
|
8
|
-
export declare function getFetchFunction(options?: LoaderOptions, context?: Omit<LoaderContext, 'fetch'> & Partial<Pick<LoaderContext, 'fetch'>>): (
|
|
7
|
+
export declare function getFetchFunction(options?: LoaderOptions, context?: Omit<LoaderContext, 'fetch'> & Partial<Pick<LoaderContext, 'fetch'>>): (url: string, options?: RequestInit | undefined) => Promise<Response>;
|
|
9
8
|
//# sourceMappingURL=get-fetch-function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-fetch-function.d.ts","sourceRoot":"","sources":["../../../src/lib/loader-utils/get-fetch-function.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-fetch-function.d.ts","sourceRoot":"","sources":["../../../src/lib/loader-utils/get-fetch-function.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAK3E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,yEAuB/E"}
|
package/dist/null-worker-node.js
CHANGED
|
@@ -201,7 +201,7 @@ async function parseData({ loader, arrayBuffer, options, context }) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
// src/null-loader.ts
|
|
204
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
204
|
+
var VERSION = true ? "4.0.0-alpha.17" : "latest";
|
|
205
205
|
function parseSync(arrayBuffer, options, context) {
|
|
206
206
|
if (!options.null.echoParameters)
|
|
207
207
|
return null;
|
package/dist/null-worker.js
CHANGED
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// src/null-loader.ts
|
|
187
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
187
|
+
var VERSION = true ? "4.0.0-alpha.17" : "latest";
|
|
188
188
|
function parseSync(arrayBuffer, options, context) {
|
|
189
189
|
if (!options.null.echoParameters)
|
|
190
190
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.17",
|
|
4
4
|
"description": "The core API for working with loaders.gl loaders and writers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@babel/runtime": "^7.3.1",
|
|
46
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
47
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
46
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.17",
|
|
47
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.17",
|
|
48
48
|
"@probe.gl/log": "^4.0.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "68a743e2460cc89bf89edabfd08b395380d7d10c"
|
|
51
51
|
}
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
1
3
|
import {resolvePath} from '@loaders.gl/loader-utils';
|
|
2
4
|
import {makeResponse} from '../utils/response-utils';
|
|
3
|
-
// import {getErrorMessageFromResponse} from './fetch-error-message';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* fetch compatible function
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* - data urls
|
|
10
|
-
* - File/Blob objects
|
|
11
|
-
* Leverages `@loaders.gl/polyfills` for Node.js support
|
|
12
|
-
* Respects pathPrefix and file aliases
|
|
7
|
+
* fetch API compatible function
|
|
8
|
+
* - Supports fetching from Node.js local file system paths
|
|
9
|
+
* - Respects pathPrefix and file aliases
|
|
13
10
|
*/
|
|
14
11
|
export async function fetchFile(
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
urlOrData: string | Blob,
|
|
13
|
+
fetchOptions?: RequestInit
|
|
17
14
|
): Promise<Response> {
|
|
18
|
-
if (typeof
|
|
19
|
-
url = resolvePath(
|
|
20
|
-
|
|
21
|
-
let fetchOptions: RequestInit = options as RequestInit;
|
|
22
|
-
if (options?.fetch && typeof options?.fetch !== 'function') {
|
|
23
|
-
fetchOptions = options.fetch;
|
|
24
|
-
}
|
|
15
|
+
if (typeof urlOrData === 'string') {
|
|
16
|
+
const url = resolvePath(urlOrData);
|
|
25
17
|
|
|
18
|
+
// Call global fetch
|
|
26
19
|
return await fetch(url, fetchOptions);
|
|
27
20
|
}
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
// TODO - should we still call fetch on non-URL inputs?
|
|
23
|
+
return await makeResponse(urlOrData);
|
|
30
24
|
}
|