@loaders.gl/loader-utils
Advanced tools
Comparing version 2.2.1 to 2.2.2-alpha.0
@@ -1,4 +0,8 @@ | ||
export {LoaderObject, WriterObject} from './types/types'; | ||
// LOADERS.GL-SPECIFIC TYPES | ||
export {LoaderObject, WriterObject, LoaderContext, DataType, SyncDataType, BatchableDataType, | ||
IFileSystem, IRandomAccessReadFileSystem} from './types'; | ||
export {default as createWorker} from './lib/create-worker'; | ||
// LOADERS.GL-SPECIFIC WORKER UTILS | ||
export {default as createWorker} from './lib/worker-loader-utils/create-worker'; | ||
export {validateLoaderVersion} from './lib/worker-loader-utils/validate-loader-version'; | ||
@@ -17,4 +21,7 @@ // GENERAL UTILS | ||
// LOADER UTILS | ||
export {validateLoaderVersion} from './lib/validate-loader-version'; | ||
// WORKER UTILS | ||
export {default as _WorkerFarm} from './lib/worker-utils/worker-farm'; | ||
export {default as _WorkerPool} from './lib/worker-utils/worker-pool'; | ||
export {default as _WorkerThread} from './lib/worker-utils/worker-thread'; | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
@@ -24,5 +31,2 @@ // LIBRARY UTILS | ||
// WORKER UTILS | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
// PARSER UTILS | ||
@@ -32,2 +36,3 @@ export {parseJSON} from './lib/parser-utils/parse-json'; | ||
// MEMORY COPY UTILS | ||
export {toArrayBuffer, toBuffer} from './lib/binary-utils/binary-utils'; | ||
export { | ||
@@ -64,4 +69,4 @@ padTo4Bytes, | ||
} from './lib/iterator-utils/text-iterators'; | ||
export {forEach, concatenateChunksAsync} from './lib/iterator-utils/async-iteration'; | ||
// REQUEST UTILS | ||
@@ -68,0 +73,0 @@ export {default as RequestScheduler} from './lib/request-utils/request-scheduler'; |
@@ -10,8 +10,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "createWorker", { | ||
enumerable: true, | ||
get: function get() { | ||
return _createWorker["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "assert", { | ||
@@ -65,2 +59,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "createWorker", { | ||
enumerable: true, | ||
get: function get() { | ||
return _createWorker["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "validateLoaderVersion", { | ||
@@ -72,2 +72,26 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "getTransferList", { | ||
enumerable: true, | ||
get: function get() { | ||
return _getTransferList.getTransferList; | ||
} | ||
}); | ||
Object.defineProperty(exports, "_WorkerFarm", { | ||
enumerable: true, | ||
get: function get() { | ||
return _workerFarm["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "_WorkerPool", { | ||
enumerable: true, | ||
get: function get() { | ||
return _workerPool["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "_WorkerThread", { | ||
enumerable: true, | ||
get: function get() { | ||
return _workerThread["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "getLibraryUrl", { | ||
@@ -85,14 +109,20 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "getTransferList", { | ||
Object.defineProperty(exports, "parseJSON", { | ||
enumerable: true, | ||
get: function get() { | ||
return _getTransferList.getTransferList; | ||
return _parseJson.parseJSON; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseJSON", { | ||
Object.defineProperty(exports, "toArrayBuffer", { | ||
enumerable: true, | ||
get: function get() { | ||
return _parseJson.parseJSON; | ||
return _binaryUtils.toArrayBuffer; | ||
} | ||
}); | ||
Object.defineProperty(exports, "toBuffer", { | ||
enumerable: true, | ||
get: function get() { | ||
return _binaryUtils.toBuffer; | ||
} | ||
}); | ||
Object.defineProperty(exports, "padTo4Bytes", { | ||
@@ -212,2 +242,14 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "forEach", { | ||
enumerable: true, | ||
get: function get() { | ||
return _asyncIteration.forEach; | ||
} | ||
}); | ||
Object.defineProperty(exports, "concatenateChunksAsync", { | ||
enumerable: true, | ||
get: function get() { | ||
return _asyncIteration.concatenateChunksAsync; | ||
} | ||
}); | ||
Object.defineProperty(exports, "RequestScheduler", { | ||
@@ -233,4 +275,2 @@ enumerable: true, | ||
var _createWorker = _interopRequireDefault(require("./lib/create-worker")); | ||
var _assert = _interopRequireDefault(require("./lib/env-utils/assert")); | ||
@@ -240,10 +280,20 @@ | ||
var _validateLoaderVersion = require("./lib/validate-loader-version"); | ||
var _createWorker = _interopRequireDefault(require("./lib/worker-loader-utils/create-worker")); | ||
var _libraryUtils = require("./lib/library-utils/library-utils"); | ||
var _validateLoaderVersion = require("./lib/worker-loader-utils/validate-loader-version"); | ||
var _getTransferList = require("./lib/worker-utils/get-transfer-list"); | ||
var _workerFarm = _interopRequireDefault(require("./lib/worker-utils/worker-farm")); | ||
var _workerPool = _interopRequireDefault(require("./lib/worker-utils/worker-pool")); | ||
var _workerThread = _interopRequireDefault(require("./lib/worker-utils/worker-thread")); | ||
var _libraryUtils = require("./lib/library-utils/library-utils"); | ||
var _parseJson = require("./lib/parser-utils/parse-json"); | ||
var _binaryUtils = require("./lib/binary-utils/binary-utils"); | ||
var _memoryCopyUtils = require("./lib/binary-utils/memory-copy-utils"); | ||
@@ -267,2 +317,4 @@ | ||
var _asyncIteration = require("./lib/iterator-utils/async-iteration"); | ||
var _requestScheduler = _interopRequireDefault(require("./lib/request-utils/request-scheduler")); | ||
@@ -269,0 +321,0 @@ |
/** | ||
* | ||
* @param byteLength | ||
* | ||
* @param byteLength | ||
*/ | ||
@@ -9,5 +9,5 @@ export function padTo4Bytes(byteLength); | ||
* Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0 | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
*/ | ||
@@ -17,2 +17,13 @@ export function getZeroOffsetArrayBuffer(arrayBuffer, byteOffset, byteLength); | ||
/** | ||
* Concatenate two ArrayBuffers | ||
* @param source1 The first ArrayBuffer. | ||
* @param source2 The second ArrayBuffer. | ||
* @return A concatenated ArrayBuffer | ||
*/ | ||
export function concatenateArrayBuffers( | ||
source1: ArrayBuffer | Uint8Array, | ||
source2: ArrayBuffer | Uint8Array | ||
): ArrayBuffer; | ||
/** | ||
* Creates a new Uint8Array based on two different ArrayBuffers | ||
@@ -39,2 +50,2 @@ * @param targetBuffer The first buffer. | ||
*/ | ||
export function copyToArray(source: ArrayBuffer|any, target: any, targetOffset: number): number; | ||
export function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number; |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.getZeroOffsetArrayBuffer = getZeroOffsetArrayBuffer; | ||
exports.concatenateArrayBuffers = concatenateArrayBuffers; | ||
exports.copyArrayBuffer = copyArrayBuffer; | ||
@@ -22,2 +23,11 @@ exports.copyToArray = copyToArray; | ||
function concatenateArrayBuffers(source1, source2) { | ||
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); | ||
temp.set(sourceArray2, sourceArray1.byteLength); | ||
return temp.buffer; | ||
} | ||
function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) { | ||
@@ -24,0 +34,0 @@ var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength; |
@@ -22,3 +22,3 @@ "use strict"; | ||
var LATEST = 'beta'; | ||
var VERSION = typeof "2.2.1" !== 'undefined' ? "2.2.1" : LATEST; | ||
var VERSION = typeof "2.2.2-alpha.0" !== 'undefined' ? "2.2.2-alpha.0" : LATEST; | ||
var loadLibraryPromises = {}; | ||
@@ -25,0 +25,0 @@ |
@@ -12,3 +12,3 @@ "use strict"; | ||
var VERSION = typeof "2.2.1" !== 'undefined' ? "2.2.1" : ''; | ||
var VERSION = typeof "2.2.2-alpha.0" !== 'undefined' ? "2.2.2-alpha.0" : ''; | ||
@@ -15,0 +15,0 @@ function validateLoaderVersion(loader) { |
@@ -36,1 +36,24 @@ /** | ||
}; | ||
export type LoaderContext = { | ||
fetch?: any; | ||
loaders?: LoaderObject[]; | ||
url?: string; | ||
parse?: (data: ArrayBuffer, options?: object) => Promise<any>; | ||
parseSync?: (data: ArrayBuffer, options?: object) => any; | ||
parseInBatches?: (data: AsyncIterator<any>, options?: object) => AsyncIterator<any>; | ||
}; | ||
/** Types that can be synchronously parsed */ | ||
export type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously... | ||
/** Types that can be parsed async */ | ||
export type DataType = string | ArrayBuffer | File | Blob | Response | ReadableStream; | ||
/** Types that can be parsed in batches */ | ||
export type BatchableDataType = | ||
DataType | | ||
Iterable<ArrayBuffer> | | ||
AsyncIterable<ArrayBuffer> | | ||
Promise<AsyncIterable<ArrayBuffer>>; |
@@ -1,4 +0,8 @@ | ||
export {LoaderObject, WriterObject} from './types/types'; | ||
// LOADERS.GL-SPECIFIC TYPES | ||
export {LoaderObject, WriterObject, LoaderContext, DataType, SyncDataType, BatchableDataType, | ||
IFileSystem, IRandomAccessReadFileSystem} from './types'; | ||
export {default as createWorker} from './lib/create-worker'; | ||
// LOADERS.GL-SPECIFIC WORKER UTILS | ||
export {default as createWorker} from './lib/worker-loader-utils/create-worker'; | ||
export {validateLoaderVersion} from './lib/worker-loader-utils/validate-loader-version'; | ||
@@ -17,4 +21,7 @@ // GENERAL UTILS | ||
// LOADER UTILS | ||
export {validateLoaderVersion} from './lib/validate-loader-version'; | ||
// WORKER UTILS | ||
export {default as _WorkerFarm} from './lib/worker-utils/worker-farm'; | ||
export {default as _WorkerPool} from './lib/worker-utils/worker-pool'; | ||
export {default as _WorkerThread} from './lib/worker-utils/worker-thread'; | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
@@ -24,5 +31,2 @@ // LIBRARY UTILS | ||
// WORKER UTILS | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
// PARSER UTILS | ||
@@ -32,2 +36,3 @@ export {parseJSON} from './lib/parser-utils/parse-json'; | ||
// MEMORY COPY UTILS | ||
export {toArrayBuffer, toBuffer} from './lib/binary-utils/binary-utils'; | ||
export { | ||
@@ -64,4 +69,4 @@ padTo4Bytes, | ||
} from './lib/iterator-utils/text-iterators'; | ||
export {forEach, concatenateChunksAsync} from './lib/iterator-utils/async-iteration'; | ||
// REQUEST UTILS | ||
@@ -68,0 +73,0 @@ export {default as RequestScheduler} from './lib/request-utils/request-scheduler'; |
@@ -1,8 +0,12 @@ | ||
export { default as createWorker } from './lib/create-worker'; | ||
export { default as assert } from './lib/env-utils/assert'; | ||
export { isBrowser, isWorker, nodeVersion, self, window, global, document } from './lib/env-utils/globals'; | ||
export { validateLoaderVersion } from './lib/validate-loader-version'; | ||
export { default as createWorker } from './lib/worker-loader-utils/create-worker'; | ||
export { validateLoaderVersion } from './lib/worker-loader-utils/validate-loader-version'; | ||
export { getTransferList } from './lib/worker-utils/get-transfer-list'; | ||
export { default as _WorkerFarm } from './lib/worker-utils/worker-farm'; | ||
export { default as _WorkerPool } from './lib/worker-utils/worker-pool'; | ||
export { default as _WorkerThread } from './lib/worker-utils/worker-thread'; | ||
export { getLibraryUrl, loadLibrary } from './lib/library-utils/library-utils'; | ||
export { getTransferList } from './lib/worker-utils/get-transfer-list'; | ||
export { parseJSON } from './lib/parser-utils/parse-json'; | ||
export { toArrayBuffer, toBuffer } from './lib/binary-utils/binary-utils'; | ||
export { padTo4Bytes, copyToArray, copyArrayBuffer, getZeroOffsetArrayBuffer } from './lib/binary-utils/memory-copy-utils'; | ||
@@ -17,4 +21,5 @@ export { copyPaddedArrayBufferToDataView, copyPaddedStringToDataView } from './lib/binary-utils/binary-copy-utils'; | ||
export { makeTextEncoderIterator, makeTextDecoderIterator, makeLineIterator, makeNumberedLineIterator } from './lib/iterator-utils/text-iterators'; | ||
export { forEach, concatenateChunksAsync } from './lib/iterator-utils/async-iteration'; | ||
export { default as RequestScheduler } from './lib/request-utils/request-scheduler'; | ||
export { getMeshSize as _getMeshSize, getMeshBoundingBox } from './categories/mesh/mesh-utils'; | ||
//# sourceMappingURL=index.js.map |
/** | ||
* | ||
* @param byteLength | ||
* | ||
* @param byteLength | ||
*/ | ||
@@ -9,5 +9,5 @@ export function padTo4Bytes(byteLength); | ||
* Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0 | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
*/ | ||
@@ -17,2 +17,13 @@ export function getZeroOffsetArrayBuffer(arrayBuffer, byteOffset, byteLength); | ||
/** | ||
* Concatenate two ArrayBuffers | ||
* @param source1 The first ArrayBuffer. | ||
* @param source2 The second ArrayBuffer. | ||
* @return A concatenated ArrayBuffer | ||
*/ | ||
export function concatenateArrayBuffers( | ||
source1: ArrayBuffer | Uint8Array, | ||
source2: ArrayBuffer | Uint8Array | ||
): ArrayBuffer; | ||
/** | ||
* Creates a new Uint8Array based on two different ArrayBuffers | ||
@@ -39,2 +50,2 @@ * @param targetBuffer The first buffer. | ||
*/ | ||
export function copyToArray(source: ArrayBuffer|any, target: any, targetOffset: number): number; | ||
export function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number; |
@@ -9,2 +9,10 @@ export function padTo4Bytes(byteLength) { | ||
} | ||
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); | ||
temp.set(sourceArray1, 0); | ||
temp.set(sourceArray2, sourceArray1.byteLength); | ||
return temp.buffer; | ||
} | ||
export function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset, byteLength = sourceBuffer.byteLength) { | ||
@@ -11,0 +19,0 @@ const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength); |
@@ -5,3 +5,3 @@ import { global, isBrowser, isWorker } from '../env-utils/globals'; | ||
const LATEST = 'beta'; | ||
const VERSION = typeof "2.2.1" !== 'undefined' ? "2.2.1" : LATEST; | ||
const VERSION = typeof "2.2.2-alpha.0" !== 'undefined' ? "2.2.2-alpha.0" : LATEST; | ||
const loadLibraryPromises = {}; | ||
@@ -8,0 +8,0 @@ export async function loadLibrary(libraryUrl, moduleName = null, options = {}) { |
import assert from './env-utils/assert'; | ||
const VERSION = typeof "2.2.1" !== 'undefined' ? "2.2.1" : ''; | ||
const VERSION = typeof "2.2.2-alpha.0" !== 'undefined' ? "2.2.2-alpha.0" : ''; | ||
export function validateLoaderVersion(loader, coreVersion = VERSION) { | ||
@@ -4,0 +4,0 @@ assert(loader, 'no loader provided'); |
@@ -36,1 +36,24 @@ /** | ||
}; | ||
export type LoaderContext = { | ||
fetch?: any; | ||
loaders?: LoaderObject[]; | ||
url?: string; | ||
parse?: (data: ArrayBuffer, options?: object) => Promise<any>; | ||
parseSync?: (data: ArrayBuffer, options?: object) => any; | ||
parseInBatches?: (data: AsyncIterator<any>, options?: object) => AsyncIterator<any>; | ||
}; | ||
/** Types that can be synchronously parsed */ | ||
export type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously... | ||
/** Types that can be parsed async */ | ||
export type DataType = string | ArrayBuffer | File | Blob | Response | ReadableStream; | ||
/** Types that can be parsed in batches */ | ||
export type BatchableDataType = | ||
DataType | | ||
Iterable<ArrayBuffer> | | ||
AsyncIterable<ArrayBuffer> | | ||
Promise<AsyncIterable<ArrayBuffer>>; |
@@ -1,4 +0,8 @@ | ||
export {LoaderObject, WriterObject} from './types/types'; | ||
// LOADERS.GL-SPECIFIC TYPES | ||
export {LoaderObject, WriterObject, LoaderContext, DataType, SyncDataType, BatchableDataType, | ||
IFileSystem, IRandomAccessReadFileSystem} from './types'; | ||
export {default as createWorker} from './lib/create-worker'; | ||
// LOADERS.GL-SPECIFIC WORKER UTILS | ||
export {default as createWorker} from './lib/worker-loader-utils/create-worker'; | ||
export {validateLoaderVersion} from './lib/worker-loader-utils/validate-loader-version'; | ||
@@ -17,4 +21,7 @@ // GENERAL UTILS | ||
// LOADER UTILS | ||
export {validateLoaderVersion} from './lib/validate-loader-version'; | ||
// WORKER UTILS | ||
export {default as _WorkerFarm} from './lib/worker-utils/worker-farm'; | ||
export {default as _WorkerPool} from './lib/worker-utils/worker-pool'; | ||
export {default as _WorkerThread} from './lib/worker-utils/worker-thread'; | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
@@ -24,5 +31,2 @@ // LIBRARY UTILS | ||
// WORKER UTILS | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
// PARSER UTILS | ||
@@ -32,2 +36,3 @@ export {parseJSON} from './lib/parser-utils/parse-json'; | ||
// MEMORY COPY UTILS | ||
export {toArrayBuffer, toBuffer} from './lib/binary-utils/binary-utils'; | ||
export { | ||
@@ -64,4 +69,4 @@ padTo4Bytes, | ||
} from './lib/iterator-utils/text-iterators'; | ||
export {forEach, concatenateChunksAsync} from './lib/iterator-utils/async-iteration'; | ||
// REQUEST UTILS | ||
@@ -68,0 +73,0 @@ export {default as RequestScheduler} from './lib/request-utils/request-scheduler'; |
@@ -1,8 +0,12 @@ | ||
export { default as createWorker } from './lib/create-worker'; | ||
export { default as assert } from './lib/env-utils/assert'; | ||
export { isBrowser, isWorker, nodeVersion, self, window, global, document } from './lib/env-utils/globals'; | ||
export { validateLoaderVersion } from './lib/validate-loader-version'; | ||
export { default as createWorker } from './lib/worker-loader-utils/create-worker'; | ||
export { validateLoaderVersion } from './lib/worker-loader-utils/validate-loader-version'; | ||
export { getTransferList } from './lib/worker-utils/get-transfer-list'; | ||
export { default as _WorkerFarm } from './lib/worker-utils/worker-farm'; | ||
export { default as _WorkerPool } from './lib/worker-utils/worker-pool'; | ||
export { default as _WorkerThread } from './lib/worker-utils/worker-thread'; | ||
export { getLibraryUrl, loadLibrary } from './lib/library-utils/library-utils'; | ||
export { getTransferList } from './lib/worker-utils/get-transfer-list'; | ||
export { parseJSON } from './lib/parser-utils/parse-json'; | ||
export { toArrayBuffer, toBuffer } from './lib/binary-utils/binary-utils'; | ||
export { padTo4Bytes, copyToArray, copyArrayBuffer, getZeroOffsetArrayBuffer } from './lib/binary-utils/memory-copy-utils'; | ||
@@ -17,4 +21,5 @@ export { copyPaddedArrayBufferToDataView, copyPaddedStringToDataView } from './lib/binary-utils/binary-copy-utils'; | ||
export { makeTextEncoderIterator, makeTextDecoderIterator, makeLineIterator, makeNumberedLineIterator } from './lib/iterator-utils/text-iterators'; | ||
export { forEach, concatenateChunksAsync } from './lib/iterator-utils/async-iteration'; | ||
export { default as RequestScheduler } from './lib/request-utils/request-scheduler'; | ||
export { getMeshSize as _getMeshSize, getMeshBoundingBox } from './categories/mesh/mesh-utils'; | ||
//# sourceMappingURL=index.js.map |
/** | ||
* | ||
* @param byteLength | ||
* | ||
* @param byteLength | ||
*/ | ||
@@ -9,5 +9,5 @@ export function padTo4Bytes(byteLength); | ||
* Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0 | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
*/ | ||
@@ -17,2 +17,13 @@ export function getZeroOffsetArrayBuffer(arrayBuffer, byteOffset, byteLength); | ||
/** | ||
* Concatenate two ArrayBuffers | ||
* @param source1 The first ArrayBuffer. | ||
* @param source2 The second ArrayBuffer. | ||
* @return A concatenated ArrayBuffer | ||
*/ | ||
export function concatenateArrayBuffers( | ||
source1: ArrayBuffer | Uint8Array, | ||
source2: ArrayBuffer | Uint8Array | ||
): ArrayBuffer; | ||
/** | ||
* Creates a new Uint8Array based on two different ArrayBuffers | ||
@@ -39,2 +50,2 @@ * @param targetBuffer The first buffer. | ||
*/ | ||
export function copyToArray(source: ArrayBuffer|any, target: any, targetOffset: number): number; | ||
export function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number; |
@@ -9,2 +9,10 @@ export function padTo4Bytes(byteLength) { | ||
} | ||
export function concatenateArrayBuffers(source1, source2) { | ||
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); | ||
temp.set(sourceArray2, sourceArray1.byteLength); | ||
return temp.buffer; | ||
} | ||
export function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) { | ||
@@ -11,0 +19,0 @@ var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength; |
@@ -7,3 +7,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var LATEST = 'beta'; | ||
var VERSION = typeof "2.2.1" !== 'undefined' ? "2.2.1" : LATEST; | ||
var VERSION = typeof "2.2.2-alpha.0" !== 'undefined' ? "2.2.2-alpha.0" : LATEST; | ||
var loadLibraryPromises = {}; | ||
@@ -10,0 +10,0 @@ export function loadLibrary(_x) { |
import assert from './env-utils/assert'; | ||
var VERSION = typeof "2.2.1" !== 'undefined' ? "2.2.1" : ''; | ||
var VERSION = typeof "2.2.2-alpha.0" !== 'undefined' ? "2.2.2-alpha.0" : ''; | ||
export function validateLoaderVersion(loader) { | ||
@@ -4,0 +4,0 @@ var coreVersion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : VERSION; |
@@ -36,1 +36,24 @@ /** | ||
}; | ||
export type LoaderContext = { | ||
fetch?: any; | ||
loaders?: LoaderObject[]; | ||
url?: string; | ||
parse?: (data: ArrayBuffer, options?: object) => Promise<any>; | ||
parseSync?: (data: ArrayBuffer, options?: object) => any; | ||
parseInBatches?: (data: AsyncIterator<any>, options?: object) => AsyncIterator<any>; | ||
}; | ||
/** Types that can be synchronously parsed */ | ||
export type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously... | ||
/** Types that can be parsed async */ | ||
export type DataType = string | ArrayBuffer | File | Blob | Response | ReadableStream; | ||
/** Types that can be parsed in batches */ | ||
export type BatchableDataType = | ||
DataType | | ||
Iterable<ArrayBuffer> | | ||
AsyncIterable<ArrayBuffer> | | ||
Promise<AsyncIterable<ArrayBuffer>>; |
{ | ||
"name": "@loaders.gl/loader-utils", | ||
"version": "2.2.1", | ||
"version": "2.2.2-alpha.0", | ||
"description": "Framework-independent loaders for 3D graphics formats", | ||
@@ -31,2 +31,10 @@ "license": "MIT", | ||
"browser": { | ||
"./src/node/to-array-buffer.node.js": false, | ||
"./dist/es5/node/to-array-buffer.node.js": false, | ||
"./dist/esm/node/to-array-buffer.node.js": false, | ||
"./dist/es6/node/to-array-buffer.node.js": false, | ||
"./src/node/to-buffer.node.js": false, | ||
"./dist/es5/node/to-buffer.node.js": false, | ||
"./dist/esm/node/to-buffer.node.js": false, | ||
"./dist/es6/node/to-buffer.node.js": false, | ||
"./src/lib/library-utils/require-utils.node.js": false, | ||
@@ -45,3 +53,3 @@ "./dist/es5/lib/library-utils/require-utils.node.js": false, | ||
}, | ||
"gitHead": "1e303aebbc5af09741d25da2b08d15a941aa609f" | ||
"gitHead": "367b7626664e86bdc2fa57b388312ddc8b6e25ed" | ||
} |
@@ -1,4 +0,8 @@ | ||
export {LoaderObject, WriterObject} from './types/types'; | ||
// LOADERS.GL-SPECIFIC TYPES | ||
export {LoaderObject, WriterObject, LoaderContext, DataType, SyncDataType, BatchableDataType, | ||
IFileSystem, IRandomAccessReadFileSystem} from './types'; | ||
export {default as createWorker} from './lib/create-worker'; | ||
// LOADERS.GL-SPECIFIC WORKER UTILS | ||
export {default as createWorker} from './lib/worker-loader-utils/create-worker'; | ||
export {validateLoaderVersion} from './lib/worker-loader-utils/validate-loader-version'; | ||
@@ -17,4 +21,7 @@ // GENERAL UTILS | ||
// LOADER UTILS | ||
export {validateLoaderVersion} from './lib/validate-loader-version'; | ||
// WORKER UTILS | ||
export {default as _WorkerFarm} from './lib/worker-utils/worker-farm'; | ||
export {default as _WorkerPool} from './lib/worker-utils/worker-pool'; | ||
export {default as _WorkerThread} from './lib/worker-utils/worker-thread'; | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
@@ -24,5 +31,2 @@ // LIBRARY UTILS | ||
// WORKER UTILS | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
// PARSER UTILS | ||
@@ -32,2 +36,3 @@ export {parseJSON} from './lib/parser-utils/parse-json'; | ||
// MEMORY COPY UTILS | ||
export {toArrayBuffer, toBuffer} from './lib/binary-utils/binary-utils'; | ||
export { | ||
@@ -64,4 +69,4 @@ padTo4Bytes, | ||
} from './lib/iterator-utils/text-iterators'; | ||
export {forEach, concatenateChunksAsync} from './lib/iterator-utils/async-iteration'; | ||
// REQUEST UTILS | ||
@@ -68,0 +73,0 @@ export {default as RequestScheduler} from './lib/request-utils/request-scheduler'; |
@@ -1,3 +0,1 @@ | ||
export {default as createWorker} from './lib/create-worker'; | ||
// GENERAL UTILS | ||
@@ -15,11 +13,15 @@ export {default as assert} from './lib/env-utils/assert'; | ||
// LOADER UTILS | ||
export {validateLoaderVersion} from './lib/validate-loader-version'; | ||
// WORKER LOADER UTILS | ||
export {default as createWorker} from './lib/worker-loader-utils/create-worker'; | ||
export {validateLoaderVersion} from './lib/worker-loader-utils/validate-loader-version'; | ||
// WORKER UTILS | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
export {default as _WorkerFarm} from './lib/worker-utils/worker-farm'; | ||
export {default as _WorkerPool} from './lib/worker-utils/worker-pool'; | ||
export {default as _WorkerThread} from './lib/worker-utils/worker-thread'; | ||
// LIBRARY UTILS | ||
export {getLibraryUrl, loadLibrary} from './lib/library-utils/library-utils'; | ||
// WORKER UTILS | ||
export {getTransferList} from './lib/worker-utils/get-transfer-list'; | ||
// PARSER UTILS | ||
@@ -29,2 +31,4 @@ export {parseJSON} from './lib/parser-utils/parse-json'; | ||
// MEMORY COPY UTILS | ||
export {toArrayBuffer, toBuffer} from './lib/binary-utils/binary-utils'; | ||
export { | ||
@@ -62,2 +66,3 @@ padTo4Bytes, | ||
} from './lib/iterator-utils/text-iterators'; | ||
export {forEach, concatenateChunksAsync} from './lib/iterator-utils/async-iteration'; | ||
@@ -64,0 +69,0 @@ // REQUEST UTILS |
/** | ||
* | ||
* @param byteLength | ||
* | ||
* @param byteLength | ||
*/ | ||
@@ -9,5 +9,5 @@ export function padTo4Bytes(byteLength); | ||
* Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0 | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
* @param arrayBuffer | ||
* @param byteOffset | ||
* @param byteLength | ||
*/ | ||
@@ -17,2 +17,13 @@ export function getZeroOffsetArrayBuffer(arrayBuffer, byteOffset, byteLength); | ||
/** | ||
* Concatenate two ArrayBuffers | ||
* @param source1 The first ArrayBuffer. | ||
* @param source2 The second ArrayBuffer. | ||
* @return A concatenated ArrayBuffer | ||
*/ | ||
export function concatenateArrayBuffers( | ||
source1: ArrayBuffer | Uint8Array, | ||
source2: ArrayBuffer | Uint8Array | ||
): ArrayBuffer; | ||
/** | ||
* Creates a new Uint8Array based on two different ArrayBuffers | ||
@@ -39,2 +50,2 @@ * @param targetBuffer The first buffer. | ||
*/ | ||
export function copyToArray(source: ArrayBuffer|any, target: any, targetOffset: number): number; | ||
export function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number; |
@@ -14,2 +14,12 @@ export function padTo4Bytes(byteLength) { | ||
// Concatenate two ArrayBuffers | ||
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); | ||
temp.set(sourceArray1, 0); | ||
temp.set(sourceArray2, sourceArray1.byteLength); | ||
return temp.buffer; | ||
} | ||
/* Creates a new Uint8Array based on two different ArrayBuffers | ||
@@ -16,0 +26,0 @@ * @private |
@@ -36,1 +36,24 @@ /** | ||
}; | ||
export type LoaderContext = { | ||
fetch?: any; | ||
loaders?: LoaderObject[]; | ||
url?: string; | ||
parse?: (data: ArrayBuffer, options?: object) => Promise<any>; | ||
parseSync?: (data: ArrayBuffer, options?: object) => any; | ||
parseInBatches?: (data: AsyncIterator<any>, options?: object) => AsyncIterator<any>; | ||
}; | ||
/** Types that can be synchronously parsed */ | ||
export type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously... | ||
/** Types that can be parsed async */ | ||
export type DataType = string | ArrayBuffer | File | Blob | Response | ReadableStream; | ||
/** Types that can be parsed in batches */ | ||
export type BatchableDataType = | ||
DataType | | ||
Iterable<ArrayBuffer> | | ||
AsyncIterable<ArrayBuffer> | | ||
Promise<AsyncIterable<ArrayBuffer>>; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
607682
310
8390
2