Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@loaders.gl/core

Package Overview
Dependencies
Maintainers
9
Versions
336
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/core - npm Package Compare versions

Comparing version 4.0.0-alpha.16 to 4.0.0-alpha.17

26

dist/es5/lib/fetch/fetch-file.js

@@ -16,26 +16,22 @@ "use strict";

function _fetchFile() {
_fetchFile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(url, options) {
var fetchOptions;
_fetchFile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(urlOrData, fetchOptions) {
var url;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!(typeof url === 'string')) {
_context.next = 7;
if (!(typeof urlOrData === 'string')) {
_context.next = 5;
break;
}
url = (0, _loaderUtils.resolvePath)(url);
fetchOptions = options;
if (options !== null && options !== void 0 && options.fetch && typeof (options === null || options === void 0 ? void 0 : options.fetch) !== 'function') {
fetchOptions = options.fetch;
}
_context.next = 6;
url = (0, _loaderUtils.resolvePath)(urlOrData);
_context.next = 4;
return fetch(url, fetchOptions);
case 6:
case 4:
return _context.abrupt("return", _context.sent);
case 5:
_context.next = 7;
return (0, _responseUtils.makeResponse)(urlOrData);
case 7:
_context.next = 9;
return (0, _responseUtils.makeResponse)(url);
case 9:
return _context.abrupt("return", _context.sent);
case 10:
case 8:
case "end":

@@ -42,0 +38,0 @@ return _context.stop();

@@ -8,3 +8,3 @@ "use strict";

var _log = require("./utils/log");
var version = typeof "4.0.0-alpha.16" !== 'undefined' ? "4.0.0-alpha.16" : '';
var version = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : '';
if (!globalThis.loaders) {

@@ -11,0 +11,0 @@ _log.log.log(1, "loaders.gl ".concat(version))();

@@ -14,3 +14,3 @@ "use strict";

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); }
var VERSION = typeof "4.0.0-alpha.16" !== 'undefined' ? "4.0.0-alpha.16" : 'latest';
var VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
var NullWorkerLoader = {

@@ -17,0 +17,0 @@ name: 'Null loader',

import { resolvePath } from '@loaders.gl/loader-utils';
import { makeResponse } from '../utils/response-utils';
export async function fetchFile(url, options) {
if (typeof url === 'string') {
url = resolvePath(url);
let fetchOptions = options;
if (options !== null && options !== void 0 && options.fetch && typeof (options === null || options === void 0 ? void 0 : options.fetch) !== 'function') {
fetchOptions = options.fetch;
}
export async function fetchFile(urlOrData, fetchOptions) {
if (typeof urlOrData === 'string') {
const url = resolvePath(urlOrData);
return await fetch(url, fetchOptions);
}
return await makeResponse(url);
return await makeResponse(urlOrData);
}
//# sourceMappingURL=fetch-file.js.map
import { log } from './utils/log';
const version = typeof "4.0.0-alpha.16" !== 'undefined' ? "4.0.0-alpha.16" : '';
const version = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : '';
if (!globalThis.loaders) {

@@ -4,0 +4,0 @@ log.log(1, "loaders.gl ".concat(version))();

@@ -1,2 +0,2 @@

const VERSION = typeof "4.0.0-alpha.16" !== 'undefined' ? "4.0.0-alpha.16" : 'latest';
const VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : 'latest';
export const NullWorkerLoader = {

@@ -3,0 +3,0 @@ name: 'Null loader',

/**
* fetch compatible function
* Reads file data from:
* - http/http urls
* - data urls
* - File/Blob objects
* Leverages `@loaders.gl/polyfills` for Node.js support
* Respects pathPrefix and file aliases
* fetch API compatible function
* - Supports fetching from Node.js local file system paths
* - Respects pathPrefix and file aliases
*/
export declare function fetchFile(url: string | Blob, options?: RequestInit & {
fetch?: RequestInit | Function;
}): Promise<Response>;
export declare function fetchFile(urlOrData: string | Blob, fetchOptions?: RequestInit): Promise<Response>;
//# sourceMappingURL=fetch-file.d.ts.map
"use strict";
// loaders.gl, MIT license
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,23 +7,16 @@ exports.fetchFile = void 0;

const response_utils_1 = require("../utils/response-utils");
// import {getErrorMessageFromResponse} from './fetch-error-message';
/**
* fetch compatible function
* Reads file data from:
* - http/http urls
* - data urls
* - File/Blob objects
* Leverages `@loaders.gl/polyfills` for Node.js support
* Respects pathPrefix and file aliases
* fetch API compatible function
* - Supports fetching from Node.js local file system paths
* - Respects pathPrefix and file aliases
*/
async function fetchFile(url, options) {
if (typeof url === 'string') {
url = (0, loader_utils_1.resolvePath)(url);
let fetchOptions = options;
if (options?.fetch && typeof options?.fetch !== 'function') {
fetchOptions = options.fetch;
}
async function fetchFile(urlOrData, fetchOptions) {
if (typeof urlOrData === 'string') {
const url = (0, loader_utils_1.resolvePath)(urlOrData);
// Call global fetch
return await fetch(url, fetchOptions);
}
return await (0, response_utils_1.makeResponse)(url);
// TODO - should we still call fetch on non-URL inputs?
return await (0, response_utils_1.makeResponse)(urlOrData);
}
exports.fetchFile = fetchFile;
import type { LoaderContext, LoaderOptions } from '@loaders.gl/loader-utils';
import { fetchFile } from '../fetch/fetch-file';
/**

@@ -8,3 +7,3 @@ * Gets the current fetch function from options and context

*/
export declare function getFetchFunction(options?: LoaderOptions, context?: Omit<LoaderContext, 'fetch'> & Partial<Pick<LoaderContext, 'fetch'>>): ((url: string, options?: RequestInit | undefined) => Promise<Response>) | typeof fetchFile;
export declare function getFetchFunction(options?: LoaderOptions, context?: Omit<LoaderContext, 'fetch'> & Partial<Pick<LoaderContext, 'fetch'>>): (url: string, options?: RequestInit | undefined) => Promise<Response>;
//# sourceMappingURL=get-fetch-function.d.ts.map

@@ -204,3 +204,3 @@ var __defProp = Object.defineProperty;

// src/null-loader.ts
var VERSION = true ? "4.0.0-alpha.16" : "latest";
var VERSION = true ? "4.0.0-alpha.17" : "latest";
function parseSync(arrayBuffer, options, context) {

@@ -207,0 +207,0 @@ if (!options.null.echoParameters)

@@ -187,3 +187,3 @@ (() => {

// src/null-loader.ts
var VERSION = true ? "4.0.0-alpha.16" : "latest";
var VERSION = true ? "4.0.0-alpha.17" : "latest";
function parseSync(arrayBuffer, options, context) {

@@ -190,0 +190,0 @@ if (!options.null.echoParameters)

{
"name": "@loaders.gl/core",
"version": "4.0.0-alpha.16",
"version": "4.0.0-alpha.17",
"description": "The core API for working with loaders.gl loaders and writers",

@@ -46,7 +46,7 @@ "license": "MIT",

"@babel/runtime": "^7.3.1",
"@loaders.gl/loader-utils": "4.0.0-alpha.16",
"@loaders.gl/worker-utils": "4.0.0-alpha.16",
"@loaders.gl/loader-utils": "4.0.0-alpha.17",
"@loaders.gl/worker-utils": "4.0.0-alpha.17",
"@probe.gl/log": "^4.0.2"
},
"gitHead": "87e9714165c3ce143a04ac45bbd9d922006f1b63"
"gitHead": "68a743e2460cc89bf89edabfd08b395380d7d10c"
}

@@ -0,30 +1,24 @@

// loaders.gl, MIT license
import {resolvePath} from '@loaders.gl/loader-utils';
import {makeResponse} from '../utils/response-utils';
// import {getErrorMessageFromResponse} from './fetch-error-message';
/**
* fetch compatible function
* Reads file data from:
* - http/http urls
* - data urls
* - File/Blob objects
* Leverages `@loaders.gl/polyfills` for Node.js support
* Respects pathPrefix and file aliases
* fetch API compatible function
* - Supports fetching from Node.js local file system paths
* - Respects pathPrefix and file aliases
*/
export async function fetchFile(
url: string | Blob,
options?: RequestInit & {fetch?: RequestInit | Function}
urlOrData: string | Blob,
fetchOptions?: RequestInit
): Promise<Response> {
if (typeof url === 'string') {
url = resolvePath(url);
if (typeof urlOrData === 'string') {
const url = resolvePath(urlOrData);
let fetchOptions: RequestInit = options as RequestInit;
if (options?.fetch && typeof options?.fetch !== 'function') {
fetchOptions = options.fetch;
}
// Call global fetch
return await fetch(url, fetchOptions);
}
return await makeResponse(url);
// TODO - should we still call fetch on non-URL inputs?
return await makeResponse(urlOrData);
}

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc