@loaders.gl/core
Advanced tools
Comparing version 1.2.0-beta.2 to 1.2.0-beta.3
@@ -11,6 +11,10 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _assert = _interopRequireDefault(require("../../utils/assert")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function isLoaderObject(loader) { | ||
@@ -36,4 +40,4 @@ if (!loader) { | ||
options = loader[1]; | ||
loader = (0, _objectSpread2["default"])({}, loader, { | ||
options: (0, _objectSpread2["default"])({}, loader.options, { | ||
loader = _objectSpread({}, loader, { | ||
options: _objectSpread({}, loader.options, { | ||
options: options | ||
@@ -40,0 +44,0 @@ }) |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -17,2 +17,6 @@ var _fs = _interopRequireDefault(require("fs")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var DEFAULT_OPTIONS = { | ||
@@ -38,3 +42,3 @@ dataType: 'arraybuffer', | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
options = (0, _objectSpread2["default"])({}, DEFAULT_OPTIONS, options); | ||
options = _objectSpread({}, DEFAULT_OPTIONS, {}, options); | ||
@@ -41,0 +45,0 @@ if (options.responseType === 'text' || options.dataType === 'text') { |
@@ -1,4 +0,4 @@ | ||
const moduleExports = require('./index'); | ||
var moduleExports = require('./index'); | ||
const _global = typeof window === 'undefined' ? global : window; | ||
var _global = typeof window === 'undefined' ? global : window; | ||
@@ -5,0 +5,0 @@ _global.loaders = _global.loaders || {}; |
@@ -24,4 +24,4 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
export { default as assert } from './utils/assert'; | ||
export const TextEncoder = global.TextEncoder; | ||
export const TextDecoder = global.TextDecoder; | ||
export var TextEncoder = global.TextEncoder; | ||
export var TextDecoder = global.TextDecoder; | ||
export function createReadStream(_x, _x2) { | ||
@@ -35,3 +35,3 @@ return _createReadStream.apply(this, arguments); | ||
url = resolvePath(url); | ||
const response = yield fetchFile(url, options); | ||
var response = yield fetchFile(url, options); | ||
return response.body; | ||
@@ -38,0 +38,0 @@ }); |
@@ -13,3 +13,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
while (true) { | ||
const { | ||
var { | ||
done, | ||
@@ -24,3 +24,3 @@ value | ||
const cancel = visitor(value); | ||
var cancel = visitor(value); | ||
@@ -41,4 +41,4 @@ if (cancel) { | ||
_concatenateAsyncIterator = _asyncToGenerator(function* (asyncIterator) { | ||
let arrayBuffer = new ArrayBuffer(); | ||
let string = ''; | ||
var arrayBuffer = new ArrayBuffer(); | ||
var string = ''; | ||
var _iteratorNormalCompletion = true; | ||
@@ -51,3 +51,3 @@ var _didIteratorError = false; | ||
for (var _iterator = _asyncIterator(asyncIterator), _step, _value; _step = yield _iterator.next(), _iteratorNormalCompletion = _step.done, _value = yield _step.value, !_iteratorNormalCompletion; _iteratorNormalCompletion = true) { | ||
const chunk = _value; | ||
var chunk = _value; | ||
@@ -86,3 +86,3 @@ if (typeof chunk === 'string') { | ||
_textDecoderAsyncIterator = _wrapAsyncGenerator(function* (arrayBufferIterator, options) { | ||
const textDecoder = new TextDecoder(options); | ||
var textDecoder = new TextDecoder(options); | ||
var _iteratorNormalCompletion2 = true; | ||
@@ -95,3 +95,3 @@ var _didIteratorError2 = false; | ||
for (var _iterator2 = _asyncIterator(arrayBufferIterator), _step2, _value2; _step2 = yield _awaitAsyncGenerator(_iterator2.next()), _iteratorNormalCompletion2 = _step2.done, _value2 = yield _awaitAsyncGenerator(_step2.value), !_iteratorNormalCompletion2; _iteratorNormalCompletion2 = true) { | ||
const arrayBuffer = _value2; | ||
var arrayBuffer = _value2; | ||
yield typeof arrayBuffer === 'string' ? arrayBuffer : textDecoder.decode(arrayBuffer, { | ||
@@ -125,3 +125,3 @@ stream: true | ||
_textEncoderAsyncIterator = _wrapAsyncGenerator(function* (textIterator, options) { | ||
const textEncoder = new TextEncoder(); | ||
var textEncoder = new TextEncoder(); | ||
var _iteratorNormalCompletion3 = true; | ||
@@ -134,3 +134,3 @@ var _didIteratorError3 = false; | ||
for (var _iterator3 = _asyncIterator(textIterator), _step3, _value3; _step3 = yield _awaitAsyncGenerator(_iterator3.next()), _iteratorNormalCompletion3 = _step3.done, _value3 = yield _awaitAsyncGenerator(_step3.value), !_iteratorNormalCompletion3; _iteratorNormalCompletion3 = true) { | ||
const text = _value3; | ||
var text = _value3; | ||
yield typeof text === 'string' ? textEncoder.encode(text) : text; | ||
@@ -162,3 +162,3 @@ } | ||
_lineAsyncIterator = _wrapAsyncGenerator(function* (textIterator) { | ||
let previous = ''; | ||
var previous = ''; | ||
var _iteratorNormalCompletion4 = true; | ||
@@ -171,8 +171,8 @@ var _didIteratorError4 = false; | ||
for (var _iterator4 = _asyncIterator(textIterator), _step4, _value4; _step4 = yield _awaitAsyncGenerator(_iterator4.next()), _iteratorNormalCompletion4 = _step4.done, _value4 = yield _awaitAsyncGenerator(_step4.value), !_iteratorNormalCompletion4; _iteratorNormalCompletion4 = true) { | ||
const textChunk = _value4; | ||
var textChunk = _value4; | ||
previous += textChunk; | ||
let eolIndex; | ||
var eolIndex = void 0; | ||
while ((eolIndex = previous.indexOf('\n')) >= 0) { | ||
const line = previous.slice(0, eolIndex + 1); | ||
var line = previous.slice(0, eolIndex + 1); | ||
previous = previous.slice(eolIndex + 1); | ||
@@ -210,3 +210,3 @@ yield line; | ||
_numberedLineAsyncIterator = _wrapAsyncGenerator(function* (lineIterator) { | ||
let counter = 1; | ||
var counter = 1; | ||
var _iteratorNormalCompletion5 = true; | ||
@@ -219,3 +219,3 @@ var _didIteratorError5 = false; | ||
for (var _iterator5 = _asyncIterator(lineIterator), _step5, _value5; _step5 = yield _awaitAsyncGenerator(_iterator5.next()), _iteratorNormalCompletion5 = _step5.done, _value5 = yield _awaitAsyncGenerator(_step5.value), !_iteratorNormalCompletion5; _iteratorNormalCompletion5 = true) { | ||
const line = _value5; | ||
var line = _value5; | ||
yield { | ||
@@ -222,0 +222,0 @@ counter, |
import assert from '../utils/assert'; | ||
export const isArrayBuffer = x => x && x instanceof ArrayBuffer; | ||
export const isBlob = x => x && typeof Blob !== 'undefined' && x instanceof Blob; | ||
export const isBuffer = x => x && x instanceof Buffer; | ||
export var isArrayBuffer = x => x && x instanceof ArrayBuffer; | ||
export var isBlob = x => x && typeof Blob !== 'undefined' && x instanceof Blob; | ||
export var isBuffer = x => x && x instanceof Buffer; | ||
export function toArrayBuffer(data) { | ||
@@ -11,3 +11,3 @@ if (isArrayBuffer(data)) { | ||
if (isBuffer(data)) { | ||
const typedArray = new Uint8Array(data); | ||
var typedArray = new Uint8Array(data); | ||
return typedArray.buffer; | ||
@@ -21,4 +21,4 @@ } | ||
if (typeof data === 'string') { | ||
const text = data; | ||
const uint8Array = new TextEncoder().encode(text); | ||
var text = data; | ||
var uint8Array = new TextEncoder().encode(text); | ||
return uint8Array.buffer; | ||
@@ -31,4 +31,4 @@ } | ||
return new Promise((resolve, reject) => { | ||
let arrayBuffer; | ||
const fileReader = new FileReader(); | ||
var arrayBuffer; | ||
var fileReader = new FileReader(); | ||
@@ -35,0 +35,0 @@ fileReader.onload = event => { |
@@ -1,29 +0,29 @@ | ||
const isBoolean = x => typeof x === 'boolean'; | ||
var isBoolean = x => typeof x === 'boolean'; | ||
const isFunction = x => typeof x === 'function'; | ||
var isFunction = x => typeof x === 'function'; | ||
const isObject = x => x !== null && typeof x === 'object'; | ||
var isObject = x => x !== null && typeof x === 'object'; | ||
export const isPromise = x => isObject(x) && isFunction(x.then); | ||
export const isIterable = x => x && typeof x[Symbol.iterator] === 'function'; | ||
export const isAsyncIterable = x => x && typeof x[Symbol.asyncIterator] === 'function'; | ||
export const isIterator = x => isObject(x) && 'done' in x && 'value' in x; | ||
export const isFetchResponse = x => typeof Response !== 'undefined' && x instanceof Response || x.arrayBuffer && x.text && x.json; | ||
export const isFile = x => typeof File !== 'undefined' && x instanceof File; | ||
export const isBlob = x => typeof Blob !== 'undefined' && x instanceof Blob; | ||
export const isFileReadable = x => isFile(x) || isBlob(x); | ||
export const isWritableDOMStream = x => { | ||
export var isPromise = x => isObject(x) && isFunction(x.then); | ||
export var isIterable = x => x && typeof x[Symbol.iterator] === 'function'; | ||
export var isAsyncIterable = x => x && typeof x[Symbol.asyncIterator] === 'function'; | ||
export var isIterator = x => isObject(x) && 'done' in x && 'value' in x; | ||
export var isFetchResponse = x => typeof Response !== 'undefined' && x instanceof Response || x.arrayBuffer && x.text && x.json; | ||
export var isFile = x => typeof File !== 'undefined' && x instanceof File; | ||
export var isBlob = x => typeof Blob !== 'undefined' && x instanceof Blob; | ||
export var isFileReadable = x => isFile(x) || isBlob(x); | ||
export var isWritableDOMStream = x => { | ||
return isObject(x) && isFunction(x.abort) && isFunction(x.getWriter); | ||
}; | ||
export const isReadableDOMStream = x => { | ||
export var isReadableDOMStream = x => { | ||
return isObject(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.pipeTo) && isFunction(x.getReader); | ||
}; | ||
export const isWritableNodeStream = x => { | ||
export var isWritableNodeStream = x => { | ||
return isObject(x) && isFunction(x.end) && isFunction(x.write) && isBoolean(x.writable); | ||
}; | ||
export const isReadableNodeStream = x => { | ||
export var isReadableNodeStream = x => { | ||
return isObject(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable); | ||
}; | ||
export const isReadableStream = x => isReadableDOMStream(x) || isReadableNodeStream(x); | ||
export const isWritableStream = x => isWritableDOMStream(x) || isWritableNodeStream(x); | ||
export var isReadableStream = x => isReadableDOMStream(x) || isReadableNodeStream(x); | ||
export var isWritableStream = x => isWritableDOMStream(x) || isWritableNodeStream(x); | ||
//# sourceMappingURL=is-type.js.map |
@@ -5,5 +5,5 @@ export function padTo4Bytes(byteLength) { | ||
export function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) { | ||
let byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength; | ||
const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength); | ||
const sourceArray = new Uint8Array(sourceBuffer); | ||
var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength; | ||
var targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength); | ||
var sourceArray = new Uint8Array(sourceBuffer); | ||
targetArray.set(sourceArray); | ||
@@ -13,3 +13,3 @@ return targetBuffer; | ||
export function copyToArray(source, target, targetOffset) { | ||
let sourceArray; | ||
var sourceArray; | ||
@@ -19,4 +19,4 @@ if (source instanceof ArrayBuffer) { | ||
} else { | ||
const srcByteOffset = source.byteOffset; | ||
const srcByteLength = source.byteLength; | ||
var srcByteOffset = source.byteOffset; | ||
var srcByteLength = source.byteLength; | ||
sourceArray = new Uint8Array(source.buffer, srcByteOffset, srcByteLength); | ||
@@ -29,5 +29,5 @@ } | ||
export function concatenateArrayBuffers(source1, source2) { | ||
const sourceArray1 = source1 instanceof ArrayBuffer ? new Uint8Array(source1) : source1; | ||
const sourceArray2 = source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2; | ||
const temp = new Uint8Array(sourceArray1.byteLength + sourceArray2.byteLength); | ||
var sourceArray1 = source1 instanceof ArrayBuffer ? new Uint8Array(source1) : source1; | ||
var sourceArray2 = source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2; | ||
var temp = new Uint8Array(sourceArray1.byteLength + sourceArray2.byteLength); | ||
temp.set(sourceArray1, 0); | ||
@@ -34,0 +34,0 @@ temp.set(sourceArray2, sourceArray1.byteLength); |
@@ -25,7 +25,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
_makeBrowserStreamIterator = _wrapAsyncGenerator(function* (stream) { | ||
const reader = stream.getReader(); | ||
var reader = stream.getReader(); | ||
try { | ||
while (true) { | ||
const { | ||
var { | ||
done, | ||
@@ -57,3 +57,3 @@ value | ||
while (true) { | ||
const data = stream.read(); | ||
var data = stream.read(); | ||
@@ -60,0 +60,0 @@ if (data !== null) { |
@@ -11,6 +11,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
_getErrorMessageFromResponse = _asyncToGenerator(function* (response) { | ||
let message = "Failed to fetch resource ".concat(response.url, " (").concat(response.status, "): "); | ||
var message = "Failed to fetch resource ".concat(response.url, " (").concat(response.status, "): "); | ||
try { | ||
const contentType = response.headers.get('Content-Type'); | ||
var contentType = response.headers.get('Content-Type'); | ||
@@ -17,0 +17,0 @@ if (contentType.includes('application/json')) { |
@@ -25,3 +25,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
return _asyncToGenerator(function* () { | ||
const { | ||
var { | ||
reader, | ||
@@ -40,3 +40,3 @@ promise | ||
return _asyncToGenerator(function* () { | ||
const { | ||
var { | ||
reader, | ||
@@ -55,3 +55,3 @@ promise | ||
return _asyncToGenerator(function* () { | ||
const text = yield _this3.text(); | ||
var text = yield _this3.text(); | ||
return JSON.parse(text); | ||
@@ -64,4 +64,4 @@ })(); | ||
this.bodyUsed = true; | ||
let reader; | ||
const promise = new Promise((resolve, reject) => { | ||
var reader; | ||
var promise = new Promise((resolve, reject) => { | ||
try { | ||
@@ -68,0 +68,0 @@ reader = new FileReader(); |
@@ -1,3 +0,3 @@ | ||
let pathPrefix = ''; | ||
const fileAliases = {}; | ||
var pathPrefix = ''; | ||
var fileAliases = {}; | ||
export function setPathPrefix(prefix) { | ||
@@ -13,5 +13,5 @@ pathPrefix = prefix; | ||
export function resolvePath(filename) { | ||
for (const alias in fileAliases) { | ||
for (var alias in fileAliases) { | ||
if (filename.startsWith(alias)) { | ||
const replacement = fileAliases[alias]; | ||
var replacement = fileAliases[alias]; | ||
return filename.replace(alias, replacement); | ||
@@ -18,0 +18,0 @@ } |
import assert from '../../utils/assert'; | ||
const DEFAULT_OPTIONS = { | ||
var DEFAULT_OPTIONS = { | ||
dataType: 'arraybuffer', | ||
@@ -7,3 +7,3 @@ nothrow: true | ||
const isDataURL = url => url.startsWith('data:'); | ||
var isDataURL = url => url.startsWith('data:'); | ||
@@ -23,3 +23,3 @@ export function readFileSyncBrowser(uri, options) { | ||
function getReadFileOptions() { | ||
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
options = Object.assign({}, DEFAULT_OPTIONS, options); | ||
@@ -26,0 +26,0 @@ options.responseType = options.responseType || options.dataType; |
@@ -6,3 +6,3 @@ import { isBrowser } from '../../utils/globals'; | ||
export function readFileSync(url) { | ||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
url = resolvePath(url); | ||
@@ -9,0 +9,0 @@ |
@@ -15,3 +15,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
_loadInBatches = _asyncToGenerator(function* (url, loaders, options) { | ||
const response = yield fetchFile(url, options); | ||
var response = yield fetchFile(url, options); | ||
return parseInBatches(response, loaders, options, url); | ||
@@ -33,5 +33,5 @@ }); | ||
const autoUrl = isFileReadable(url) ? url.name : url; | ||
var autoUrl = isFileReadable(url) ? url.name : url; | ||
loaders = loaders || getRegisteredLoaders(); | ||
const loader = Array.isArray(loaders) ? autoDetectLoader(null, loaders, { | ||
var loader = Array.isArray(loaders) ? autoDetectLoader(null, loaders, { | ||
url: autoUrl | ||
@@ -45,3 +45,3 @@ }) : loaders; | ||
let data = url; | ||
var data = url; | ||
@@ -48,0 +48,0 @@ if (isFileReadable(data) || typeof data === 'string') { |
import { normalizeLoader } from './normalize-loader'; | ||
const EXT_PATTERN = /[^.]+$/; | ||
var EXT_PATTERN = /[^.]+$/; | ||
export function autoDetectLoader(data, loaders) { | ||
let { | ||
var { | ||
url = '' | ||
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
let loader = null; | ||
var loader = null; | ||
loader = loader || findLoaderByUrl(loaders, url); | ||
@@ -14,5 +14,5 @@ loader = loader || findLoaderByExamingInitialData(loaders, data); | ||
function findLoaderByUrl(loaders, url) { | ||
const match = url.match(EXT_PATTERN); | ||
const extension = match && match[0]; | ||
const loader = extension && findLoaderByExtension(loaders, extension); | ||
var match = url.match(EXT_PATTERN); | ||
var extension = match && match[0]; | ||
var loader = extension && findLoaderByExtension(loaders, extension); | ||
return loader; | ||
@@ -24,6 +24,6 @@ } | ||
for (const loader of loaders) { | ||
for (var loader of loaders) { | ||
normalizeLoader(loader); | ||
for (const loaderExtension of loader.extensions) { | ||
for (var loaderExtension of loader.extensions) { | ||
if (loaderExtension.toLowerCase() === extension) { | ||
@@ -39,3 +39,3 @@ return loader; | ||
function findLoaderByExamingInitialData(loaders, data) { | ||
for (const loader of loaders) { | ||
for (var loader of loaders) { | ||
if (typeof data === 'string') { | ||
@@ -60,3 +60,3 @@ if (testText(data, loader)) { | ||
function testBinary(data, loader) { | ||
const type = Array.isArray(loader.test) ? 'array' : typeof loader.test; | ||
var type = Array.isArray(loader.test) ? 'array' : typeof loader.test; | ||
@@ -69,6 +69,6 @@ switch (type) { | ||
case 'array': | ||
const byteOffset = 0; | ||
const tests = Array.isArray(loader.test) ? loader.test : [loader.test]; | ||
var byteOffset = 0; | ||
var tests = Array.isArray(loader.test) ? loader.test : [loader.test]; | ||
return tests.some(test => { | ||
const magic = getMagicString(data, byteOffset, test.length); | ||
var magic = getMagicString(data, byteOffset, test.length); | ||
return test === magic; | ||
@@ -83,4 +83,4 @@ }); | ||
function getMagicString(arrayBuffer) { | ||
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
let length = arguments.length > 2 ? arguments[2] : undefined; | ||
var byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var length = arguments.length > 2 ? arguments[2] : undefined; | ||
@@ -91,6 +91,6 @@ if (arrayBuffer.byteLength <= byteOffset + length) { | ||
const dataView = new DataView(arrayBuffer); | ||
let magic = ''; | ||
var dataView = new DataView(arrayBuffer); | ||
var magic = ''; | ||
for (let i = 0; i < length; i++) { | ||
for (var i = 0; i < length; i++) { | ||
magic += String.fromCharCode(dataView.getUint8(byteOffset + i)); | ||
@@ -97,0 +97,0 @@ } |
@@ -5,3 +5,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
import fetchFileReadable from '../fetch/fetch-file.browser'; | ||
const ERR_DATA = 'Cannot convert supplied data type'; | ||
var ERR_DATA = 'Cannot convert supplied data type'; | ||
export function getUrlFromData(data) { | ||
@@ -19,6 +19,6 @@ return isFetchResponse(data) ? data.url : null; | ||
if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) { | ||
const arrayBuffer = data.buffer || data; | ||
var arrayBuffer = data.buffer || data; | ||
if (loader.text && !loader.binary) { | ||
const textDecoder = new TextDecoder('utf8'); | ||
var textDecoder = new TextDecoder('utf8'); | ||
return textDecoder.decode(arrayBuffer); | ||
@@ -39,3 +39,3 @@ } | ||
data = yield data; | ||
const isArrayBuffer = data instanceof ArrayBuffer || ArrayBuffer.isView(data); | ||
var isArrayBuffer = data instanceof ArrayBuffer || ArrayBuffer.isView(data); | ||
@@ -42,0 +42,0 @@ if (typeof data === 'string' || isArrayBuffer) { |
@@ -1,2 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import assert from '../../utils/assert'; | ||
@@ -12,3 +17,3 @@ export function isLoaderObject(loader) { | ||
const hasParser = loader.parseTextSync || loader.parseSync || loader.parse || loader.loadAndParse || loader.parseStream || loader.parseInBatches || loader.worker; | ||
var hasParser = loader.parseTextSync || loader.parseSync || loader.parse || loader.loadAndParse || loader.parseStream || loader.parseInBatches || loader.worker; | ||
return hasParser; | ||
@@ -18,3 +23,3 @@ } | ||
assert(isLoaderObject(loader)); | ||
let options; | ||
var options; | ||
@@ -21,0 +26,0 @@ if (Array.isArray(loader)) { |
@@ -56,4 +56,4 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
if (loader.parseInBatches) { | ||
const inputIterator = yield getAsyncIteratorFromData(data); | ||
const outputIterator = loader.parseInBatches(inputIterator, options, url, loader); | ||
var inputIterator = yield getAsyncIteratorFromData(data); | ||
var outputIterator = loader.parseInBatches(inputIterator, options, url, loader); | ||
return outputIterator; | ||
@@ -74,4 +74,4 @@ } | ||
if (loader.parseInBatchesSync) { | ||
const inputIterator = getIteratorFromData(data); | ||
const outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url); | ||
var inputIterator = getIteratorFromData(data); | ||
var outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url); | ||
return outputIterator; | ||
@@ -78,0 +78,0 @@ } |
import { toArrayBuffer } from '../javascript-utils/binary-utils'; | ||
const workerCache = new Map(); | ||
var workerCache = new Map(); | ||
function getWorker(workerSource) { | ||
let workerURL = workerCache.get(workerSource); | ||
var workerURL = workerCache.get(workerSource); | ||
if (!workerURL) { | ||
const blob = new Blob([workerSource], { | ||
var blob = new Blob([workerSource], { | ||
type: 'application/javascript' | ||
@@ -19,6 +19,6 @@ }); | ||
export default function parseWithWorker(workerSource, data, options) { | ||
const worker = getWorker(workerSource); | ||
var worker = getWorker(workerSource); | ||
options = removeNontransferableOptions(options); | ||
const parse = (rawData, opts) => new Promise((resolve, reject) => { | ||
var parse = (rawData, opts) => new Promise((resolve, reject) => { | ||
worker.onmessage = evt => { | ||
@@ -39,3 +39,3 @@ switch (evt.data.type) { | ||
const arraybuffer = toArrayBuffer(rawData); | ||
var arraybuffer = toArrayBuffer(rawData); | ||
worker.postMessage({ | ||
@@ -42,0 +42,0 @@ arraybuffer, |
@@ -20,5 +20,5 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
const autoUrl = isFileReadable(url) ? url.name : url; | ||
var autoUrl = isFileReadable(url) ? url.name : url; | ||
loaders = loaders || getRegisteredLoaders(); | ||
const loader = Array.isArray(loaders) ? autoDetectLoader(data, loaders, { | ||
var loader = Array.isArray(loaders) ? autoDetectLoader(data, loaders, { | ||
url: autoUrl | ||
@@ -46,3 +46,3 @@ }) : loaders; | ||
loaders = loaders || getRegisteredLoaders(); | ||
const loader = Array.isArray(loaders) ? autoDetectLoader(data, loaders, { | ||
var loader = Array.isArray(loaders) ? autoDetectLoader(data, loaders, { | ||
url | ||
@@ -67,3 +67,3 @@ }) : loaders; | ||
loaders = loaders || getRegisteredLoaders(); | ||
const loader = Array.isArray(loaders) ? autoDetectLoader(null, loaders, { | ||
var loader = Array.isArray(loaders) ? autoDetectLoader(null, loaders, { | ||
url | ||
@@ -91,3 +91,3 @@ }) : loaders; | ||
loaders = loaders || getRegisteredLoaders(); | ||
const loader = Array.isArray(loaders) ? autoDetectLoader(null, loaders, { | ||
var loader = Array.isArray(loaders) ? autoDetectLoader(null, loaders, { | ||
url | ||
@@ -94,0 +94,0 @@ }) : loaders; |
import { normalizeLoader } from './loader-utils/normalize-loader'; | ||
const registeredLoaders = {}; | ||
var registeredLoaders = {}; | ||
export function registerLoaders(loaders) { | ||
loaders = Array.isArray(loaders) ? loaders : [loaders]; | ||
for (const loader of loaders) { | ||
for (var loader of loaders) { | ||
normalizeLoader(loader); | ||
for (const extension of loader.extensions) { | ||
for (var extension of loader.extensions) { | ||
registeredLoaders[extension] = loader; | ||
@@ -11,0 +11,0 @@ } |
import { encode, encodeSync } from './encode'; | ||
import { writeFile, writeFileSync } from './fetch/write-file'; | ||
export function save(data, url, writer, options) { | ||
const encodedData = encode(data, writer, options, url); | ||
var encodedData = encode(data, writer, options, url); | ||
return writeFile(url, encodedData); | ||
} | ||
export function saveSync(data, url, writer, options) { | ||
const encodedData = encodeSync(data, writer, options, url); | ||
var encodedData = encodeSync(data, writer, options, url); | ||
return writeFileSync(url, encodedData); | ||
} | ||
//# sourceMappingURL=save.js.map |
@@ -1,5 +0,10 @@ | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import fs from 'fs'; | ||
import { toArrayBuffer } from './utils/to-array-buffer.node'; | ||
const DEFAULT_OPTIONS = { | ||
var DEFAULT_OPTIONS = { | ||
dataType: 'arraybuffer', | ||
@@ -9,3 +14,3 @@ nothrow: true | ||
export function readFileSync(url) { | ||
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
options = getReadFileOptions(options); | ||
@@ -17,3 +22,3 @@ | ||
const buffer = fs.readFileSync(url, options, () => {}); | ||
var buffer = fs.readFileSync(url, options, () => {}); | ||
return buffer instanceof Buffer ? toArrayBuffer(buffer) : buffer; | ||
@@ -23,4 +28,4 @@ } | ||
function getReadFileOptions() { | ||
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
options = _objectSpread({}, DEFAULT_OPTIONS, options); | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
options = _objectSpread({}, DEFAULT_OPTIONS, {}, options); | ||
@@ -27,0 +32,0 @@ if (options.responseType === 'text' || options.dataType === 'text') { |
export function toArrayBuffer(buffer) { | ||
if (Buffer.isBuffer(buffer)) { | ||
const typedArray = new Uint8Array(buffer); | ||
var typedArray = new Uint8Array(buffer); | ||
return typedArray.buffer; | ||
@@ -5,0 +5,0 @@ } |
@@ -8,6 +8,6 @@ import assert from '../../utils/assert'; | ||
if (typeof Buffer !== 'undefined' && binaryData instanceof ArrayBuffer) { | ||
const buffer = new Buffer(binaryData.byteLength); | ||
const view = new Uint8Array(binaryData); | ||
var buffer = new Buffer(binaryData.byteLength); | ||
var view = new Uint8Array(binaryData); | ||
for (let i = 0; i < buffer.length; ++i) { | ||
for (var i = 0; i < buffer.length; ++i) { | ||
buffer[i] = view[i]; | ||
@@ -14,0 +14,0 @@ } |
@@ -1,3 +0,3 @@ | ||
const isBrowser = typeof process !== 'object' || String(process) !== '[object process]' || process.browser; | ||
const globals = { | ||
var isBrowser = typeof process !== 'object' || String(process) !== '[object process]' || process.browser; | ||
var globals = { | ||
self: typeof self !== 'undefined' && self, | ||
@@ -8,9 +8,9 @@ window: typeof window !== 'undefined' && window, | ||
}; | ||
const self_ = globals.self || globals.window || globals.global; | ||
const window_ = globals.window || globals.self || globals.global; | ||
const global_ = globals.global || globals.self || globals.window; | ||
const document_ = globals.document || {}; | ||
var self_ = globals.self || globals.window || globals.global; | ||
var window_ = globals.window || globals.self || globals.global; | ||
var global_ = globals.global || globals.self || globals.window; | ||
var document_ = globals.document || {}; | ||
export { isBrowser, self_ as self, window_ as window, global_ as global, document_ as document }; | ||
const matches = typeof process !== 'undefined' && process.version.match(/v([0-9]*)/); | ||
export const nodeVersion = matches && parseFloat(matches[1]) || 0; | ||
var matches = typeof process !== 'undefined' && process.version.match(/v([0-9]*)/); | ||
export var nodeVersion = matches && parseFloat(matches[1]) || 0; | ||
//# sourceMappingURL=globals.js.map |
@@ -1,2 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import assert from '../../utils/assert'; | ||
@@ -3,0 +8,0 @@ export function isLoaderObject(loader) { |
@@ -1,2 +0,7 @@ | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
import fs from 'fs'; | ||
@@ -22,3 +27,3 @@ import { toArrayBuffer } from './utils/to-array-buffer.node'; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
options = _objectSpread({}, DEFAULT_OPTIONS, options); | ||
options = _objectSpread({}, DEFAULT_OPTIONS, {}, options); | ||
@@ -25,0 +30,0 @@ if (options.responseType === 'text' || options.dataType === 'text') { |
{ | ||
"name": "@loaders.gl/core", | ||
"version": "1.2.0-beta.2", | ||
"version": "1.2.0-beta.3", | ||
"description": "Framework-independent loaders for 3D graphics formats", | ||
@@ -43,3 +43,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "82626f4ecad7c816c70780376d661f267b6c523e" | ||
"gitHead": "39442622efe0e06323db958c53c9805fc9b7699d" | ||
} |
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
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
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
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
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
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
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
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
650396
230
8682