@loaders.gl/core
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -7,3 +7,3 @@ /** | ||
*/ | ||
export declare function makeResponse(resource: any): Promise<Response>; | ||
export declare function makeResponse(resource: unknown): Promise<Response>; | ||
/** | ||
@@ -10,0 +10,0 @@ * Checks response status (async) and throws a helpful error message if status is not OK. |
@@ -50,3 +50,3 @@ import { isResponse } from "../../javascript-utils/is-type.js"; | ||
let text = response.statusText; | ||
if (contentType.includes('application/json')) { | ||
if (contentType !== null && contentType !== void 0 && contentType.includes('application/json')) { | ||
text += ` ${await response.text()}`; | ||
@@ -53,0 +53,0 @@ } |
@@ -203,3 +203,3 @@ "use strict"; | ||
// src/null-loader.ts | ||
var VERSION = true ? "4.0.0" : "latest"; | ||
var VERSION = true ? "4.0.1" : "latest"; | ||
var NullLoader = { | ||
@@ -206,0 +206,0 @@ name: "Null loader", |
@@ -203,3 +203,3 @@ "use strict"; | ||
// src/null-loader.ts | ||
var VERSION = true ? "4.0.0" : "latest"; | ||
var VERSION = true ? "4.0.1" : "latest"; | ||
var NullLoader = { | ||
@@ -206,0 +206,0 @@ name: "Null loader", |
{ | ||
"name": "@loaders.gl/core", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "The core API for working with loaders.gl loaders and writers", | ||
@@ -34,3 +34,6 @@ "license": "MIT", | ||
"fs": false, | ||
"stream": false | ||
"stream": false, | ||
"./src/iterators/make-stream/make-node-stream.ts": "./src/iterators/make-stream/make-dom-stream.ts", | ||
"./src/iterators/make-stream/make-node-stream.js": "./src/iterators/make-stream/make-dom-stream.js", | ||
"./dist/iterators/make-stream/make-node-stream.js": "./dist/iterators/make-stream/make-dom-stream.js" | ||
}, | ||
@@ -50,7 +53,7 @@ "files": [ | ||
"@babel/runtime": "^7.3.1", | ||
"@loaders.gl/loader-utils": "4.0.0", | ||
"@loaders.gl/worker-utils": "4.0.0", | ||
"@loaders.gl/loader-utils": "4.0.1", | ||
"@loaders.gl/worker-utils": "4.0.1", | ||
"@probe.gl/log": "^4.0.2" | ||
}, | ||
"gitHead": "9b4211dc0ecd4134a1638ac0a29c5ea9008fd971" | ||
"gitHead": "765e5a26a6bf3f2cc02cabffc4a1e3665ec92a53" | ||
} |
@@ -13,5 +13,5 @@ // loaders.gl, MIT license | ||
*/ | ||
export async function makeResponse(resource: any): Promise<Response> { | ||
export async function makeResponse(resource: unknown): Promise<Response> { | ||
if (isResponse(resource)) { | ||
return resource; | ||
return resource as Response; | ||
} | ||
@@ -49,3 +49,3 @@ | ||
// Attempt to create a Response from the resource, adding headers and setting url | ||
const response = new Response(resource, {headers}); | ||
const response = new Response(resource as any, {headers}); | ||
// We can't control `Response.url` via constructor, use a property override to record URL. | ||
@@ -81,3 +81,3 @@ Object.defineProperty(response, 'url', {value: url}); | ||
async function getResponseError(response): Promise<string> { | ||
async function getResponseError(response: Response): Promise<string> { | ||
let message = `Failed to fetch resource ${response.url} (${response.status}): `; | ||
@@ -87,3 +87,3 @@ try { | ||
let text = response.statusText; | ||
if (contentType.includes('application/json')) { | ||
if (contentType?.includes('application/json')) { | ||
text += ` ${await response.text()}`; | ||
@@ -99,3 +99,5 @@ } | ||
async function getInitialDataUrl(resource): Promise<string | null> { | ||
async function getInitialDataUrl( | ||
resource: string | Blob | ArrayBuffer | unknown | ||
): Promise<string | null> { | ||
const INITIAL_DATA_LENGTH = 5; | ||
@@ -122,3 +124,3 @@ if (typeof resource === 'string') { | ||
// https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string | ||
function arrayBufferToBase64(buffer) { | ||
function arrayBufferToBase64(buffer: ArrayBuffer): string { | ||
let binary = ''; | ||
@@ -125,0 +127,0 @@ const bytes = new Uint8Array(buffer); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
572338
10376
+ Added@loaders.gl/loader-utils@4.0.1(transitive)
+ Added@loaders.gl/worker-utils@4.0.1(transitive)
- Removed@loaders.gl/loader-utils@4.0.0(transitive)
- Removed@loaders.gl/worker-utils@4.0.0(transitive)