@loaders.gl/loader-utils 3.4.0-alpha.1 → 3.4.0-alpha.3
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/es5/index.js +43 -22
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/json-loader.js +7 -11
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/lib/binary-utils/array-buffer-utils.js +1 -38
- package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +1 -1
- package/dist/es5/lib/binary-utils/{binary-copy-utils.js → dataview-copy-utils.js} +30 -3
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +1 -0
- package/dist/es5/lib/binary-utils/get-first-characters.js.map +1 -1
- package/dist/es5/lib/binary-utils/{buffer-utils.js → memory-conversion-utils.js} +23 -9
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +1 -0
- package/dist/es5/lib/binary-utils/memory-copy-utils.js +0 -3
- package/dist/es5/lib/binary-utils/memory-copy-utils.js.map +1 -1
- package/dist/es5/lib/env-utils/assert.js.map +1 -1
- package/dist/es5/lib/env-utils/globals.js +1 -5
- package/dist/es5/lib/env-utils/globals.js.map +1 -1
- package/dist/es5/lib/filesystems/node-filesystem.js +86 -100
- package/dist/es5/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/es5/lib/filesystems/readable-file.js +91 -0
- package/dist/es5/lib/filesystems/readable-file.js.map +1 -0
- package/dist/es5/lib/filesystems/writable-file.js +82 -0
- package/dist/es5/lib/filesystems/writable-file.js.map +1 -0
- package/dist/es5/lib/iterators/async-iteration.js +134 -140
- package/dist/es5/lib/iterators/async-iteration.js.map +1 -1
- package/dist/es5/lib/iterators/text-iterators.js +207 -221
- package/dist/es5/lib/iterators/text-iterators.js.map +1 -1
- package/dist/es5/lib/node/buffer.browser.js +14 -0
- package/dist/es5/lib/node/buffer.browser.js.map +1 -0
- package/dist/es5/lib/node/buffer.js +5 -10
- package/dist/es5/lib/node/buffer.js.map +1 -1
- package/dist/es5/lib/node/fs.js +38 -40
- package/dist/es5/lib/node/fs.js.map +1 -1
- package/dist/es5/lib/node/promisify.js +36 -0
- package/dist/es5/lib/node/promisify.js.map +1 -0
- package/dist/es5/lib/node/stream.js +16 -0
- package/dist/es5/lib/node/stream.js.map +1 -0
- package/dist/es5/lib/option-utils/merge-loader-options.js +28 -0
- package/dist/es5/lib/option-utils/merge-loader-options.js.map +1 -0
- package/dist/es5/lib/parser-utils/parse-json.js.map +1 -1
- package/dist/es5/lib/path-utils/file-aliases.js +0 -5
- package/dist/es5/lib/path-utils/file-aliases.js.map +1 -1
- package/dist/es5/lib/path-utils/get-cwd.js +15 -0
- package/dist/es5/lib/path-utils/get-cwd.js.map +1 -0
- package/dist/es5/lib/path-utils/path.js +105 -5
- package/dist/es5/lib/path-utils/path.js.map +1 -1
- package/dist/es5/lib/request-utils/request-scheduler.js +6 -29
- package/dist/es5/lib/request-utils/request-scheduler.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +69 -79
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js +0 -1
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js +70 -77
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/workers/json-worker.js.map +1 -1
- package/dist/esm/index.js +9 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-loader.js +1 -4
- package/dist/esm/json-loader.js.map +1 -1
- package/dist/esm/lib/binary-utils/array-buffer-utils.js +0 -35
- package/dist/esm/lib/binary-utils/array-buffer-utils.js.map +1 -1
- package/dist/esm/lib/binary-utils/{binary-copy-utils.js → dataview-copy-utils.js} +27 -4
- package/dist/esm/lib/binary-utils/dataview-copy-utils.js.map +1 -0
- package/dist/esm/lib/binary-utils/get-first-characters.js.map +1 -1
- package/dist/esm/lib/binary-utils/memory-conversion-utils.js +31 -0
- package/dist/esm/lib/binary-utils/memory-conversion-utils.js.map +1 -0
- package/dist/esm/lib/binary-utils/memory-copy-utils.js +0 -4
- package/dist/esm/lib/binary-utils/memory-copy-utils.js.map +1 -1
- package/dist/esm/lib/env-utils/assert.js +0 -1
- package/dist/esm/lib/env-utils/assert.js.map +1 -1
- package/dist/esm/lib/env-utils/globals.js +1 -7
- package/dist/esm/lib/env-utils/globals.js.map +1 -1
- package/dist/esm/lib/filesystems/node-filesystem.js +0 -1
- package/dist/esm/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/esm/lib/filesystems/readable-file.js +20 -0
- package/dist/esm/lib/filesystems/readable-file.js.map +1 -0
- package/dist/esm/lib/filesystems/writable-file.js +20 -0
- package/dist/esm/lib/filesystems/writable-file.js.map +1 -0
- package/dist/esm/lib/iterators/async-iteration.js +0 -2
- package/dist/esm/lib/iterators/async-iteration.js.map +1 -1
- package/dist/esm/lib/iterators/text-iterators.js +13 -12
- package/dist/esm/lib/iterators/text-iterators.js.map +1 -1
- package/dist/esm/lib/node/buffer.browser.js +7 -0
- package/dist/esm/lib/node/buffer.browser.js.map +1 -0
- package/dist/esm/lib/node/buffer.js +5 -12
- package/dist/esm/lib/node/buffer.js.map +1 -1
- package/dist/esm/lib/node/fs.js +12 -17
- package/dist/esm/lib/node/fs.js.map +1 -1
- package/dist/esm/lib/node/promisify.js +10 -0
- package/dist/esm/lib/node/promisify.js.map +1 -0
- package/dist/esm/lib/node/stream.js +7 -0
- package/dist/esm/lib/node/stream.js.map +1 -0
- package/dist/esm/lib/option-utils/merge-loader-options.js +15 -0
- package/dist/esm/lib/option-utils/merge-loader-options.js.map +1 -0
- package/dist/esm/lib/parser-utils/parse-json.js +0 -1
- package/dist/esm/lib/parser-utils/parse-json.js.map +1 -1
- package/dist/esm/lib/path-utils/file-aliases.js +0 -6
- package/dist/esm/lib/path-utils/file-aliases.js.map +1 -1
- package/dist/esm/lib/path-utils/get-cwd.js +9 -0
- package/dist/esm/lib/path-utils/get-cwd.js.map +1 -0
- package/dist/esm/lib/path-utils/path.js +104 -6
- package/dist/esm/lib/path-utils/path.js.map +1 -1
- package/dist/esm/lib/request-utils/request-scheduler.js +0 -16
- package/dist/esm/lib/request-utils/request-scheduler.js.map +1 -1
- package/dist/esm/lib/worker-loader-utils/create-loader-worker.js +0 -10
- package/dist/esm/lib/worker-loader-utils/create-loader-worker.js.map +1 -1
- package/dist/esm/lib/worker-loader-utils/encode-with-worker.js +0 -2
- package/dist/esm/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/esm/lib/worker-loader-utils/parse-with-worker.js +1 -8
- package/dist/esm/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.d.ts +11 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -23
- package/dist/lib/binary-utils/array-buffer-utils.d.ts +4 -8
- package/dist/lib/binary-utils/array-buffer-utils.d.ts.map +1 -1
- package/dist/lib/binary-utils/array-buffer-utils.js +5 -36
- package/dist/lib/binary-utils/dataview-copy-utils.d.ts +43 -0
- package/dist/lib/binary-utils/dataview-copy-utils.d.ts.map +1 -0
- package/dist/lib/binary-utils/{binary-copy-utils.js → dataview-copy-utils.js} +51 -5
- package/dist/lib/binary-utils/get-first-characters.d.ts +15 -1
- package/dist/lib/binary-utils/get-first-characters.d.ts.map +1 -1
- package/dist/lib/binary-utils/get-first-characters.js +15 -0
- package/dist/lib/binary-utils/{buffer-utils.d.ts → memory-conversion-utils.d.ts} +3 -4
- package/dist/lib/binary-utils/memory-conversion-utils.d.ts.map +1 -0
- package/dist/lib/binary-utils/{buffer-utils.js → memory-conversion-utils.js} +28 -9
- package/dist/lib/filesystems/readable-file.d.ts +10 -0
- package/dist/lib/filesystems/readable-file.d.ts.map +1 -0
- package/dist/lib/filesystems/readable-file.js +25 -0
- package/dist/lib/filesystems/writable-file.d.ts +18 -0
- package/dist/lib/filesystems/writable-file.d.ts.map +1 -0
- package/dist/lib/{node/util.js → filesystems/writable-file.js} +23 -4
- package/dist/lib/node/buffer.browser.d.ts +12 -0
- package/dist/lib/node/buffer.browser.d.ts.map +1 -0
- package/dist/lib/node/buffer.browser.js +22 -0
- package/dist/lib/node/buffer.d.ts +3 -1
- package/dist/lib/node/buffer.d.ts.map +1 -1
- package/dist/lib/node/buffer.js +10 -10
- package/dist/lib/node/fs.d.ts +4 -2
- package/dist/lib/node/fs.d.ts.map +1 -1
- package/dist/lib/node/fs.js +11 -10
- package/dist/lib/node/promisify.d.ts +13 -0
- package/dist/lib/node/promisify.d.ts.map +1 -0
- package/dist/lib/node/promisify.js +22 -0
- package/dist/lib/node/stream.d.ts +4 -0
- package/dist/lib/node/stream.d.ts.map +1 -0
- package/dist/lib/node/stream.js +17 -0
- package/dist/lib/option-utils/merge-loader-options.d.ts +9 -0
- package/dist/lib/option-utils/merge-loader-options.d.ts.map +1 -0
- package/dist/lib/option-utils/merge-loader-options.js +24 -0
- package/dist/lib/path-utils/get-cwd.d.ts +2 -0
- package/dist/lib/path-utils/get-cwd.d.ts.map +1 -0
- package/dist/lib/path-utils/get-cwd.js +12 -0
- package/dist/lib/path-utils/path.d.ts +8 -0
- package/dist/lib/path-utils/path.d.ts.map +1 -1
- package/dist/lib/path-utils/path.js +141 -3
- package/dist/lib/worker-loader-utils/create-loader-worker.js +1 -1
- package/dist/types.d.ts +26 -26
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -17
- package/src/index.ts +24 -18
- package/src/lib/binary-utils/array-buffer-utils.ts +4 -40
- package/src/lib/binary-utils/{binary-copy-utils.ts → dataview-copy-utils.ts} +57 -5
- package/src/lib/binary-utils/get-first-characters.ts +17 -1
- package/src/lib/binary-utils/memory-conversion-utils.ts +53 -0
- package/src/lib/filesystems/readable-file.ts +30 -0
- package/src/lib/filesystems/writable-file.ts +44 -0
- package/src/lib/node/buffer.browser.ts +20 -0
- package/src/lib/node/buffer.ts +12 -11
- package/src/lib/node/fs.ts +16 -11
- package/src/lib/node/promisify.ts +70 -0
- package/src/lib/node/stream.ts +18 -0
- package/src/lib/option-utils/merge-loader-options.ts +25 -0
- package/src/lib/path-utils/get-cwd.ts +9 -0
- package/src/lib/path-utils/path.ts +138 -4
- package/src/types.ts +26 -26
- package/dist/es5/lib/binary-utils/binary-copy-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/buffer-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/encode-utils.js +0 -36
- package/dist/es5/lib/binary-utils/encode-utils.js.map +0 -1
- package/dist/es5/lib/node/util.js +0 -13
- package/dist/es5/lib/node/util.js.map +0 -1
- package/dist/esm/lib/binary-utils/binary-copy-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/buffer-utils.js +0 -18
- package/dist/esm/lib/binary-utils/buffer-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/encode-utils.js +0 -29
- package/dist/esm/lib/binary-utils/encode-utils.js.map +0 -1
- package/dist/esm/lib/node/util.js +0 -4
- package/dist/esm/lib/node/util.js.map +0 -1
- package/dist/lib/binary-utils/binary-copy-utils.d.ts +0 -24
- package/dist/lib/binary-utils/binary-copy-utils.d.ts.map +0 -1
- package/dist/lib/binary-utils/buffer-utils.d.ts.map +0 -1
- package/dist/lib/binary-utils/encode-utils.d.ts +0 -4
- package/dist/lib/binary-utils/encode-utils.d.ts.map +0 -1
- package/dist/lib/binary-utils/encode-utils.js +0 -35
- package/dist/lib/node/util.d.ts +0 -5
- package/dist/lib/node/util.d.ts.map +0 -1
- package/src/lib/binary-utils/buffer-utils.ts +0 -28
- package/src/lib/binary-utils/encode-utils.ts +0 -32
- package/src/lib/node/util.ts +0 -4
package/dist/es5/index.js
CHANGED
|
@@ -35,12 +35,6 @@ Object.defineProperty(exports, "assert", {
|
|
|
35
35
|
return _assert.assert;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
Object.defineProperty(exports, "bufferToArrayBuffer", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function get() {
|
|
41
|
-
return _bufferUtils.bufferToArrayBuffer;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
38
|
Object.defineProperty(exports, "canEncodeWithWorker", {
|
|
45
39
|
enumerable: true,
|
|
46
40
|
get: function get() {
|
|
@@ -86,25 +80,25 @@ Object.defineProperty(exports, "copyArrayBuffer", {
|
|
|
86
80
|
Object.defineProperty(exports, "copyBinaryToDataView", {
|
|
87
81
|
enumerable: true,
|
|
88
82
|
get: function get() {
|
|
89
|
-
return
|
|
83
|
+
return _dataviewCopyUtils.copyBinaryToDataView;
|
|
90
84
|
}
|
|
91
85
|
});
|
|
92
86
|
Object.defineProperty(exports, "copyPaddedArrayBufferToDataView", {
|
|
93
87
|
enumerable: true,
|
|
94
88
|
get: function get() {
|
|
95
|
-
return
|
|
89
|
+
return _dataviewCopyUtils.copyPaddedArrayBufferToDataView;
|
|
96
90
|
}
|
|
97
91
|
});
|
|
98
92
|
Object.defineProperty(exports, "copyPaddedStringToDataView", {
|
|
99
93
|
enumerable: true,
|
|
100
94
|
get: function get() {
|
|
101
|
-
return
|
|
95
|
+
return _dataviewCopyUtils.copyPaddedStringToDataView;
|
|
102
96
|
}
|
|
103
97
|
});
|
|
104
98
|
Object.defineProperty(exports, "copyStringToDataView", {
|
|
105
99
|
enumerable: true,
|
|
106
100
|
get: function get() {
|
|
107
|
-
return
|
|
101
|
+
return _dataviewCopyUtils.copyStringToDataView;
|
|
108
102
|
}
|
|
109
103
|
});
|
|
110
104
|
Object.defineProperty(exports, "copyToArray", {
|
|
@@ -165,7 +159,7 @@ Object.defineProperty(exports, "isBrowser", {
|
|
|
165
159
|
Object.defineProperty(exports, "isBuffer", {
|
|
166
160
|
enumerable: true,
|
|
167
161
|
get: function get() {
|
|
168
|
-
return
|
|
162
|
+
return _memoryConversionUtils.isBuffer;
|
|
169
163
|
}
|
|
170
164
|
});
|
|
171
165
|
Object.defineProperty(exports, "isWorker", {
|
|
@@ -186,6 +180,12 @@ Object.defineProperty(exports, "makeNumberedLineIterator", {
|
|
|
186
180
|
return _textIterators.makeNumberedLineIterator;
|
|
187
181
|
}
|
|
188
182
|
});
|
|
183
|
+
Object.defineProperty(exports, "makeReadableFile", {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
get: function get() {
|
|
186
|
+
return _readableFile.makeReadableFile;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
189
|
Object.defineProperty(exports, "makeTextDecoderIterator", {
|
|
190
190
|
enumerable: true,
|
|
191
191
|
get: function get() {
|
|
@@ -198,6 +198,18 @@ Object.defineProperty(exports, "makeTextEncoderIterator", {
|
|
|
198
198
|
return _textIterators.makeTextEncoderIterator;
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
|
+
Object.defineProperty(exports, "makeWritableFile", {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
get: function get() {
|
|
204
|
+
return _writableFile.makeWritableFile;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(exports, "mergeLoaderOptions", {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
get: function get() {
|
|
210
|
+
return _mergeLoaderOptions.mergeLoaderOptions;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
201
213
|
Object.defineProperty(exports, "nodeVersion", {
|
|
202
214
|
enumerable: true,
|
|
203
215
|
get: function get() {
|
|
@@ -207,7 +219,7 @@ Object.defineProperty(exports, "nodeVersion", {
|
|
|
207
219
|
Object.defineProperty(exports, "padStringToByteAlignment", {
|
|
208
220
|
enumerable: true,
|
|
209
221
|
get: function get() {
|
|
210
|
-
return
|
|
222
|
+
return _dataviewCopyUtils.padStringToByteAlignment;
|
|
211
223
|
}
|
|
212
224
|
});
|
|
213
225
|
Object.defineProperty(exports, "padToNBytes", {
|
|
@@ -229,10 +241,16 @@ Object.defineProperty(exports, "parseWithWorker", {
|
|
|
229
241
|
}
|
|
230
242
|
});
|
|
231
243
|
exports.path = void 0;
|
|
232
|
-
Object.defineProperty(exports, "
|
|
244
|
+
Object.defineProperty(exports, "promisify1", {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
get: function get() {
|
|
247
|
+
return _promisify.promisify1;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(exports, "promisify2", {
|
|
233
251
|
enumerable: true,
|
|
234
252
|
get: function get() {
|
|
235
|
-
return
|
|
253
|
+
return _promisify.promisify2;
|
|
236
254
|
}
|
|
237
255
|
});
|
|
238
256
|
Object.defineProperty(exports, "resolvePath", {
|
|
@@ -259,19 +277,19 @@ Object.defineProperty(exports, "sliceArrayBuffer", {
|
|
|
259
277
|
return _arrayBufferUtils.sliceArrayBuffer;
|
|
260
278
|
}
|
|
261
279
|
});
|
|
280
|
+
exports.stream = void 0;
|
|
262
281
|
Object.defineProperty(exports, "toArrayBuffer", {
|
|
263
282
|
enumerable: true,
|
|
264
283
|
get: function get() {
|
|
265
|
-
return
|
|
284
|
+
return _memoryConversionUtils.toArrayBuffer;
|
|
266
285
|
}
|
|
267
286
|
});
|
|
268
287
|
Object.defineProperty(exports, "toBuffer", {
|
|
269
288
|
enumerable: true,
|
|
270
289
|
get: function get() {
|
|
271
|
-
return
|
|
290
|
+
return _memoryConversionUtils.toBuffer;
|
|
272
291
|
}
|
|
273
292
|
});
|
|
274
|
-
exports.util = void 0;
|
|
275
293
|
Object.defineProperty(exports, "window", {
|
|
276
294
|
enumerable: true,
|
|
277
295
|
get: function get() {
|
|
@@ -280,27 +298,30 @@ Object.defineProperty(exports, "window", {
|
|
|
280
298
|
});
|
|
281
299
|
var _assert = require("./lib/env-utils/assert");
|
|
282
300
|
var _globals = require("./lib/env-utils/globals");
|
|
301
|
+
var _mergeLoaderOptions = require("./lib/option-utils/merge-loader-options");
|
|
283
302
|
var _createLoaderWorker = require("./lib/worker-loader-utils/create-loader-worker");
|
|
284
303
|
var _parseWithWorker = require("./lib/worker-loader-utils/parse-with-worker");
|
|
285
304
|
var _encodeWithWorker = require("./lib/worker-loader-utils/encode-with-worker");
|
|
286
305
|
var _parseJson = require("./lib/parser-utils/parse-json");
|
|
287
306
|
var _arrayBufferUtils = require("./lib/binary-utils/array-buffer-utils");
|
|
288
307
|
var _memoryCopyUtils = require("./lib/binary-utils/memory-copy-utils");
|
|
289
|
-
var
|
|
290
|
-
var _encodeUtils = require("./lib/binary-utils/encode-utils");
|
|
308
|
+
var _dataviewCopyUtils = require("./lib/binary-utils/dataview-copy-utils");
|
|
291
309
|
var _getFirstCharacters = require("./lib/binary-utils/get-first-characters");
|
|
292
310
|
var _textIterators = require("./lib/iterators/text-iterators");
|
|
293
311
|
var _asyncIteration = require("./lib/iterators/async-iteration");
|
|
294
312
|
var _requestScheduler = _interopRequireDefault(require("./lib/request-utils/request-scheduler"));
|
|
295
313
|
var _fileAliases = require("./lib/path-utils/file-aliases");
|
|
296
314
|
var _jsonLoader = require("./json-loader");
|
|
315
|
+
var _memoryConversionUtils = require("./lib/binary-utils/memory-conversion-utils");
|
|
316
|
+
var _promisify = require("./lib/node/promisify");
|
|
297
317
|
var path = _interopRequireWildcard(require("./lib/path-utils/path"));
|
|
298
318
|
exports.path = path;
|
|
299
|
-
var _bufferUtils = require("./lib/binary-utils/buffer-utils");
|
|
300
|
-
var util = _interopRequireWildcard(require("./lib/node/util"));
|
|
301
|
-
exports.util = util;
|
|
302
319
|
var fs = _interopRequireWildcard(require("./lib/node/fs"));
|
|
303
320
|
exports.fs = fs;
|
|
321
|
+
var stream = _interopRequireWildcard(require("./lib/node/stream"));
|
|
322
|
+
exports.stream = stream;
|
|
323
|
+
var _readableFile = require("./lib/filesystems/readable-file");
|
|
324
|
+
var _writableFile = require("./lib/filesystems/writable-file");
|
|
304
325
|
var _nodeFilesystem = _interopRequireDefault(require("./lib/filesystems/node-filesystem"));
|
|
305
326
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
306
327
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["// TYPES\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n Writer,\n WriterOptions,\n DataType,\n SyncDataType,\n BatchableDataType,\n IFileSystem,\n IRandomAccessReadFileSystem\n} from './types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["_assert","require","_globals","_mergeLoaderOptions","_createLoaderWorker","_parseWithWorker","_encodeWithWorker","_parseJson","_arrayBufferUtils","_memoryCopyUtils","_dataviewCopyUtils","_getFirstCharacters","_textIterators","_asyncIteration","_requestScheduler","_interopRequireDefault","_fileAliases","_jsonLoader","_memoryConversionUtils","_promisify","path","_interopRequireWildcard","exports","fs","stream","_readableFile","_writableFile","_nodeFilesystem","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sources":["../../src/index.ts"],"sourcesContent":["// TYPES\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n Writer,\n WriterOptions,\n DataType,\n SyncDataType,\n BatchableDataType,\n IFileSystem,\n IRandomAccessReadFileSystem\n} from './types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\nexport {mergeLoaderOptions} from './lib/option-utils/merge-loader-options';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n sliceArrayBuffer,\n concatenateArrayBuffers,\n concatenateTypedArrays,\n compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n padStringToByteAlignment,\n copyStringToDataView,\n copyBinaryToDataView,\n copyPaddedArrayBufferToDataView,\n copyPaddedStringToDataView\n} from './lib/binary-utils/dataview-copy-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n makeTextEncoderIterator,\n makeTextDecoderIterator,\n makeLineIterator,\n makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {forEach, concatenateArrayBuffersAsync} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {isBuffer, toBuffer, toArrayBuffer} from './lib/binary-utils/memory-conversion-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util' to avoid node dependencies\nexport {promisify1, promisify2} from './lib/node/promisify';\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Use instead of importing 'fs' to avoid node dependencies`\nimport * as fs from './lib/node/fs';\nexport {fs};\n\n// Use instead of importing 'stream' to avoid node dependencies`\nimport * as stream from './lib/node/stream';\nexport {stream};\n\n// EXPERIMENTAL\nexport type {ReadableFile} from './lib/filesystems/readable-file';\nexport {makeReadableFile} from './lib/filesystems/readable-file';\n\nexport type {WritableFile} from './lib/filesystems/writable-file';\nexport {makeWritableFile} from './lib/filesystems/writable-file';\n\nexport {default as _NodeFileSystem} from './lib/filesystems/node-filesystem';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAR,wBAAAY,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,4BAAAG,OAAA,EAAAH,GAAA,UAAAI,KAAA,GAAAT,wBAAA,CAAAC,WAAA,OAAAQ,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAL,GAAA,YAAAI,KAAA,CAAAE,GAAA,CAAAN,GAAA,SAAAO,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAZ,GAAA,QAAAY,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAf,GAAA,EAAAY,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAX,GAAA,EAAAY,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAZ,GAAA,CAAAY,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAH,GAAA,MAAAI,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAjB,GAAA,EAAAO,MAAA,YAAAA,MAAA"}
|
package/dist/es5/json-loader.js
CHANGED
|
@@ -7,8 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports._typecheckJSONLoader = exports.JSONLoader = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var VERSION = typeof "3.4.0-alpha.
|
|
11
|
-
|
|
10
|
+
var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'latest';
|
|
12
11
|
var JSONLoader = {
|
|
13
12
|
name: 'JSON',
|
|
14
13
|
id: 'json',
|
|
@@ -22,14 +21,12 @@ var JSONLoader = {
|
|
|
22
21
|
parse: function () {
|
|
23
22
|
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
24
23
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
25
|
-
while (1) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return _context.stop();
|
|
32
|
-
}
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer)));
|
|
27
|
+
case 1:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
33
30
|
}
|
|
34
31
|
}, _callee);
|
|
35
32
|
}));
|
|
@@ -40,7 +37,6 @@ var JSONLoader = {
|
|
|
40
37
|
}(),
|
|
41
38
|
options: {}
|
|
42
39
|
};
|
|
43
|
-
|
|
44
40
|
exports.JSONLoader = JSONLoader;
|
|
45
41
|
function parseTextSync(text) {
|
|
46
42
|
return JSON.parse(text);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-loader.js","names":["VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","arrayBuffer","TextDecoder","decode","options","JSON","_typecheckJSONLoader"],"sources":["../../src/json-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * A JSON Micro loader (minimal bundle size)\n * Alternative to `@loaders.gl/json`\n */\nexport const JSONLoader = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'json',\n text: true,\n parseTextSync,\n parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),\n options: {}\n};\n\n// TODO - deprecated\nfunction parseTextSync(text) {\n return JSON.parse(text);\n}\n\nexport const _typecheckJSONLoader: LoaderWithParser = JSONLoader;\n"],"mappings":";;;;;;;;;AAIA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ
|
|
1
|
+
{"version":3,"file":"json-loader.js","names":["VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","TextDecoder","decode","stop","_x","apply","arguments","options","exports","JSON","_typecheckJSONLoader"],"sources":["../../src/json-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * A JSON Micro loader (minimal bundle size)\n * Alternative to `@loaders.gl/json`\n */\nexport const JSONLoader = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'json',\n text: true,\n parseTextSync,\n parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),\n options: {}\n};\n\n// TODO - deprecated\nfunction parseTextSync(text) {\n return JSON.parse(text);\n}\n\nexport const _typecheckJSONLoader: LoaderWithParser = JSONLoader;\n"],"mappings":";;;;;;;;;AAIA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAA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ineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,38 +7,9 @@ exports.compareArrayBuffers = compareArrayBuffers;
|
|
|
8
7
|
exports.concatenateArrayBuffers = concatenateArrayBuffers;
|
|
9
8
|
exports.concatenateTypedArrays = concatenateTypedArrays;
|
|
10
9
|
exports.sliceArrayBuffer = sliceArrayBuffer;
|
|
11
|
-
exports.toArrayBuffer = toArrayBuffer;
|
|
12
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
var _bufferUtils = require("./buffer-utils");
|
|
14
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
17
|
-
function toArrayBuffer(data) {
|
|
18
|
-
if ((0, _bufferUtils.isBuffer)(data)) {
|
|
19
|
-
return (0, _bufferUtils.bufferToArrayBuffer)(data);
|
|
20
|
-
}
|
|
21
|
-
if (data instanceof ArrayBuffer) {
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (ArrayBuffer.isView(data)) {
|
|
26
|
-
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
27
|
-
return data.buffer;
|
|
28
|
-
}
|
|
29
|
-
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
30
|
-
}
|
|
31
|
-
if (typeof data === 'string') {
|
|
32
|
-
var text = data;
|
|
33
|
-
var uint8Array = new TextEncoder().encode(text);
|
|
34
|
-
return uint8Array.buffer;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (data && (0, _typeof2.default)(data) === 'object' && data._toArrayBuffer) {
|
|
38
|
-
return data._toArrayBuffer();
|
|
39
|
-
}
|
|
40
|
-
throw new Error('toArrayBuffer');
|
|
41
|
-
}
|
|
42
|
-
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
43
13
|
function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
44
14
|
byteLength = byteLength || arrayBuffer1.byteLength;
|
|
45
15
|
if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
|
|
@@ -54,7 +24,6 @@ function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
|
54
24
|
}
|
|
55
25
|
return true;
|
|
56
26
|
}
|
|
57
|
-
|
|
58
27
|
function concatenateArrayBuffers() {
|
|
59
28
|
for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
29
|
sources[_key] = arguments[_key];
|
|
@@ -62,13 +31,10 @@ function concatenateArrayBuffers() {
|
|
|
62
31
|
var sourceArrays = sources.map(function (source2) {
|
|
63
32
|
return source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2;
|
|
64
33
|
});
|
|
65
|
-
|
|
66
34
|
var byteLength = sourceArrays.reduce(function (length, typedArray) {
|
|
67
35
|
return length + typedArray.byteLength;
|
|
68
36
|
}, 0);
|
|
69
|
-
|
|
70
37
|
var result = new Uint8Array(byteLength);
|
|
71
|
-
|
|
72
38
|
var offset = 0;
|
|
73
39
|
var _iterator = _createForOfIteratorHelper(sourceArrays),
|
|
74
40
|
_step;
|
|
@@ -78,7 +44,6 @@ function concatenateArrayBuffers() {
|
|
|
78
44
|
result.set(sourceArray, offset);
|
|
79
45
|
offset += sourceArray.byteLength;
|
|
80
46
|
}
|
|
81
|
-
|
|
82
47
|
} catch (err) {
|
|
83
48
|
_iterator.e(err);
|
|
84
49
|
} finally {
|
|
@@ -86,7 +51,6 @@ function concatenateArrayBuffers() {
|
|
|
86
51
|
}
|
|
87
52
|
return result.buffer;
|
|
88
53
|
}
|
|
89
|
-
|
|
90
54
|
function concatenateTypedArrays() {
|
|
91
55
|
for (var _len2 = arguments.length, typedArrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
92
56
|
typedArrays[_key2] = arguments[_key2];
|
|
@@ -108,7 +72,6 @@ function concatenateTypedArrays() {
|
|
|
108
72
|
}
|
|
109
73
|
return result;
|
|
110
74
|
}
|
|
111
|
-
|
|
112
75
|
function sliceArrayBuffer(arrayBuffer, byteOffset, byteLength) {
|
|
113
76
|
var subArray = byteLength !== undefined ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength) : new Uint8Array(arrayBuffer).subarray(byteOffset);
|
|
114
77
|
var arrayCopy = new Uint8Array(subArray);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-buffer-utils.js","names":["
|
|
1
|
+
{"version":3,"file":"array-buffer-utils.js","names":["compareArrayBuffers","arrayBuffer1","arrayBuffer2","byteLength","array1","Uint8Array","array2","i","length","concatenateArrayBuffers","_len","arguments","sources","Array","_key","sourceArrays","map","source2","ArrayBuffer","reduce","typedArray","result","offset","_iterator","_createForOfIteratorHelper","_step","s","n","done","sourceArray","value","set","err","e","f","buffer","concatenateTypedArrays","_len2","typedArrays","_key2","arrays","TypedArrayConstructor","constructor","Error","sumLength","acc","_i","_arrays","array","sliceArrayBuffer","arrayBuffer","byteOffset","subArray","undefined","subarray","arrayCopy"],"sources":["../../../../src/lib/binary-utils/array-buffer-utils.ts"],"sourcesContent":["import {TypedArray} from '../../types';\n\n/**\n * compare two binary arrays for equality\n * @param a\n * @param b\n * @param byteLength\n */\nexport function compareArrayBuffers(\n arrayBuffer1: ArrayBuffer,\n arrayBuffer2: ArrayBuffer,\n byteLength?: number\n): boolean {\n byteLength = byteLength || arrayBuffer1.byteLength;\n if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {\n return false;\n }\n const array1 = new Uint8Array(arrayBuffer1);\n const array2 = new Uint8Array(arrayBuffer2);\n for (let i = 0; i < array1.length; ++i) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]): ArrayBuffer {\n // Make sure all inputs are wrapped in typed arrays\n const sourceArrays = sources.map((source2) =>\n source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2\n );\n\n // Get length of all inputs\n const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);\n\n // Allocate array with space for all inputs\n const result = new Uint8Array(byteLength);\n\n // Copy the subarrays\n let offset = 0;\n for (const sourceArray of sourceArrays) {\n result.set(sourceArray, offset);\n offset += sourceArray.byteLength;\n }\n\n // We work with ArrayBuffers, discard the typed array wrapper\n return result.buffer;\n}\n\n/**\n * Concatenate arbitrary count of typed arrays\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays\n * @param - list of arrays. All arrays should be the same type\n * @return A concatenated TypedArray\n */\nexport function concatenateTypedArrays<T>(...typedArrays: T[]): T {\n // @ts-ignore\n const arrays = typedArrays as TypedArray[];\n // @ts-ignore\n const TypedArrayConstructor = (arrays && arrays.length > 1 && arrays[0].constructor) || null;\n if (!TypedArrayConstructor) {\n throw new Error(\n '\"concatenateTypedArrays\" - incorrect quantity of arguments or arguments have incompatible data types'\n );\n }\n\n const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);\n // @ts-ignore typescript does not like dynamic constructors\n const result = new TypedArrayConstructor(sumLength);\n let offset = 0;\n for (const array of arrays) {\n result.set(array, offset);\n offset += array.length;\n }\n return result;\n}\n\n/**\n * Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0\n * @param arrayBuffer\n * @param byteOffset\n * @param byteLength\n */\nexport function sliceArrayBuffer(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength?: number\n): ArrayBuffer {\n const subArray =\n byteLength !== undefined\n ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength)\n : new Uint8Array(arrayBuffer).subarray(byteOffset);\n const arrayCopy = new Uint8Array(subArray);\n return arrayCopy.buffer;\n}\n"],"mappings":";;;;;;;;;;;;AAQO,SAASA,mBAAmBA,CACjCC,YAAyB,EACzBC,YAAyB,EACzBC,UAAmB,EACV;EACTA,UAAU,GAAGA,UAAU,IAAIF,YAAY,CAACE,UAAU;EAClD,IAAIF,YAAY,CAACE,UAAU,GAAGA,UAAU,IAAID,YAAY,CAACC,UAAU,GAAGA,UAAU,EAAE;IAChF,OAAO,KAAK;EACd;EACA,IAAMC,MAAM,GAAG,IAAIC,UAAU,CAACJ,YAAY,CAAC;EAC3C,IAAMK,MAAM,GAAG,IAAID,UAAU,CAACH,YAAY,CAAC;EAC3C,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,MAAM,CAACI,MAA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AC,GACzE,IAAIE,UAAU,CAAC6C,WAAW,CAAC,CAACI,QAAQ,CAACH,UAAU,CAAC;EACtD,IAAMI,SAAS,GAAG,IAAIlD,UAAU,CAAC+C,QAAQ,CAAC;EAC1C,OAAOG,SAAS,CAACpB,MAAM;AACzB"}
|
|
@@ -3,9 +3,38 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.copyBinaryToDataView = copyBinaryToDataView;
|
|
6
7
|
exports.copyPaddedArrayBufferToDataView = copyPaddedArrayBufferToDataView;
|
|
7
8
|
exports.copyPaddedStringToDataView = copyPaddedStringToDataView;
|
|
9
|
+
exports.copyStringToDataView = copyStringToDataView;
|
|
10
|
+
exports.padStringToByteAlignment = padStringToByteAlignment;
|
|
8
11
|
var _memoryCopyUtils = require("./memory-copy-utils");
|
|
12
|
+
function padStringToByteAlignment(string, byteAlignment) {
|
|
13
|
+
var length = string.length;
|
|
14
|
+
var paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
|
|
15
|
+
var padding = paddedLength - length;
|
|
16
|
+
var whitespace = '';
|
|
17
|
+
for (var i = 0; i < padding; ++i) {
|
|
18
|
+
whitespace += ' ';
|
|
19
|
+
}
|
|
20
|
+
return string + whitespace;
|
|
21
|
+
}
|
|
22
|
+
function copyStringToDataView(dataView, byteOffset, string, byteLength) {
|
|
23
|
+
if (dataView) {
|
|
24
|
+
for (var i = 0; i < byteLength; i++) {
|
|
25
|
+
dataView.setUint8(byteOffset + i, string.charCodeAt(i));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return byteOffset + byteLength;
|
|
29
|
+
}
|
|
30
|
+
function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
|
|
31
|
+
if (dataView) {
|
|
32
|
+
for (var i = 0; i < byteLength; i++) {
|
|
33
|
+
dataView.setUint8(byteOffset + i, binary[i]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return byteOffset + byteLength;
|
|
37
|
+
}
|
|
9
38
|
function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
|
|
10
39
|
var paddedLength = (0, _memoryCopyUtils.padToNBytes)(sourceBuffer.byteLength, padding);
|
|
11
40
|
var padLength = paddedLength - sourceBuffer.byteLength;
|
|
@@ -13,7 +42,6 @@ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, pad
|
|
|
13
42
|
var targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
|
|
14
43
|
var sourceArray = new Uint8Array(sourceBuffer);
|
|
15
44
|
targetArray.set(sourceArray);
|
|
16
|
-
|
|
17
45
|
for (var i = 0; i < padLength; ++i) {
|
|
18
46
|
dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);
|
|
19
47
|
}
|
|
@@ -21,11 +49,10 @@ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, pad
|
|
|
21
49
|
byteOffset += paddedLength;
|
|
22
50
|
return byteOffset;
|
|
23
51
|
}
|
|
24
|
-
|
|
25
52
|
function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
|
|
26
53
|
var textEncoder = new TextEncoder();
|
|
27
54
|
var stringBuffer = textEncoder.encode(string);
|
|
28
55
|
byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
|
|
29
56
|
return byteOffset;
|
|
30
57
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=dataview-copy-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataview-copy-utils.js","names":["_memoryCopyUtils","require","padStringToByteAlignment","string","byteAlignment","length","paddedLength","Math","ceil","padding","whitespace","i","copyStringToDataView","dataView","byteOffset","byteLength","setUint8","charCodeAt","copyBinaryToDataView","binary","copyPaddedArrayBufferToDataView","sourceBuffer","padToNBytes","padLength","targetArray","Uint8Array","buffer","sourceArray","set","copyPaddedStringToDataView","textEncoder","TextEncoder","stringBuffer","encode"],"sources":["../../../../src/lib/binary-utils/dataview-copy-utils.ts"],"sourcesContent":["// loaders./gl, MIT license\n\nimport {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Helper function that pads a string with spaces to fit a certain byte alignment\n * @param string\n * @param byteAlignment\n * @returns\n *\n * @todo PERFORMANCE IDEA: No need to copy string twice...\n */\nexport function padStringToByteAlignment(string: string, byteAlignment: number): string {\n const length = string.length;\n const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n const padding = paddedLength - length;\n let whitespace = '';\n for (let i = 0; i < padding; ++i) {\n whitespace += ' ';\n }\n return string + whitespace;\n}\n\n/**\n *\n * @param dataView\n * @param byteOffset\n * @param string\n * @param byteLength\n * @returns\n */\nexport function copyStringToDataView(\n dataView: DataView,\n byteOffset: number,\n string: string,\n byteLength: number\n): number {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n }\n }\n return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, binary[i]);\n }\n }\n return byteOffset + byteLength;\n}\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param dataView - destination data container. If null - only new offset is calculated\n * @param byteOffset - destination byte offset to copy to\n * @param sourceBuffer - source data buffer\n * @param padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n dataView: DataView | null,\n byteOffset: number,\n sourceBuffer: TypedArray,\n padding: number\n): number {\n const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n const padLength = paddedLength - sourceBuffer.byteLength;\n\n if (dataView) {\n // Copy array\n const targetArray = new Uint8Array(\n dataView.buffer,\n dataView.byteOffset + byteOffset,\n sourceBuffer.byteLength\n );\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n\n // Add PADDING\n for (let i = 0; i < padLength; ++i) {\n // json chunk is padded with spaces (ASCII 0x20)\n dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n }\n }\n byteOffset += paddedLength;\n return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n dataView: DataView | null,\n byteOffset: number,\n string: string,\n padding: number\n): number {\n const textEncoder = new TextEncoder();\n // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n const stringBuffer = textEncoder.encode(string);\n\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n return byteOffset;\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAUO,SAASC,wBAAwBA,CAACC,MAAc,EAAEC,aAAqB,EAAU;EACtF,IAAMC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC5B,IAAMC,YAAY,GAAGC,IAAI,CAACC,IAAI,CAACH,MAAM,GAAGD,aAAa,CAAC,GAAGA,aAAa;EACtE,IAAMK,OAAO,GAAGH,YAAY,GAAGD,MAAM;EACrC,IAAIK,UAAU,GAAG,EAAE;EACnB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,EAAE,EAAEE,CAAC,EAAE;IAChCD,UAAU,IAAI,GAAG;EACnB;EACA,OAAOP,MAAM,GAAGO,UAAU;AAC5B;AAUO,SAASE,oBAAoBA,CAClC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CAAC,EAAE;MAElCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGO,YAAY,CAACN,UAAU,GAAGJ,CAAC,EAAE,IAAI,CAAC;IACnE;EACF;EACAG,UAAU,IAAIR,YAAY;EAC1B,OAAOQ,UAAU;AACnB;AAYO,SAASe,0BAA0BA,CACxChB,QAAyB,EACzBC,UAAkB,EAClBX,MAAc,EACdM,OAAe,EACP;EACR,IAAMqB,WAAW,GAAG,IAAIC,WAAW,EAAE;EAGrC,IAAMC,YAAY,GAAGF,WAAW,CAACG,MAAM,CAAC9B,MAAM,CAAC;EAE/CW,UAAU,GAAGM,+BAA+B,CAACP,QAAQ,EAAEC,UAAU,EAAEkB,YAAY,EAAEvB,OAAO,CAAC;EAEzF,OAAOK,UAAU;AACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-first-characters.js","names":["getFirstCharacters","data","length","slice","ArrayBuffer","isView","getMagicString","buffer","byteOffset","arrayBuffer","byteLength","dataView","DataView","magic","i","String","fromCharCode","getUint8"],"sources":["../../../../src/lib/binary-utils/get-first-characters.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"get-first-characters.js","names":["getFirstCharacters","data","length","arguments","undefined","slice","ArrayBuffer","isView","getMagicString","buffer","byteOffset","arrayBuffer","byteLength","dataView","DataView","magic","i","String","fromCharCode","getUint8"],"sources":["../../../../src/lib/binary-utils/get-first-characters.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/**\n * Get the first characters from a binary file (interpret the first bytes as an ASCII string)\n * @param data\n * @param length\n * @returns\n */\nexport function getFirstCharacters(data: string | ArrayBuffer, length: number = 5): string {\n if (typeof data === 'string') {\n return data.slice(0, length);\n } else if (ArrayBuffer.isView(data)) {\n // Typed Arrays can have offsets into underlying buffer\n return getMagicString(data.buffer, data.byteOffset, length);\n } else if (data instanceof ArrayBuffer) {\n const byteOffset = 0;\n return getMagicString(data, byteOffset, length);\n }\n return '';\n}\n\n/**\n * Gets a magic string from a \"file\"\n * Typically used to check or detect file format\n * @param arrayBuffer\n * @param byteOffset\n * @param length\n * @returns\n */\nexport function getMagicString(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n length: number\n): string {\n if (arrayBuffer.byteLength <= byteOffset + length) {\n return '';\n }\n const dataView = new DataView(arrayBuffer);\n let magic = '';\n for (let i = 0; i < length; i++) {\n magic += String.fromCharCode(dataView.getUint8(byteOffset + i));\n }\n return magic;\n}\n"],"mappings":";;;;;;;AAQO,SAASA,kBAAkBA,CAACC,IAA0B,EAA8B;EAAA,IAA5BC,MAAc,GAAAC,SAAA,CAAAD,MAAA,QAAAC,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC;EAC/E,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACI,KAAK,CAAC,CAAC,EAAEH,MAAM,CAAC;EAC9B,CAAC,MAAM,IAAII,WAAW,CAACC,MAAM,CAACN,IAAI,CAAC,EAAE;IAEnC,OAAOO,cAAc,CAACP,IAAI,CAACQ,MAAM,EAAER,IAAI,CAACS,UAAU,EAAER,MAAM,CAAC;EAC7D,CAAC,MAAM,IAAID,IAAI,YAAYK,WAAW,EAAE;IACtC,IAAMI,UAAU,GAAG,CAAC;IACpB,OAAOF,cAAc,CAACP,IAAI,EAAES,UAAU,EAAER,MAAM,CAAC;EACjD;EACA,OAAO,EAAE;AACX;AAUO,SAASM,cAAcA,CAC5BG,WAAwB,EACxBD,UAAkB,EAClBR,MAAc,EACN;EACR,IAAIS,WAAW,CAACC,UAAU,IAAIF,UAAU,GAAGR,MAAM,EAAE;IACjD,OAAO,EAAE;EACX;EACA,IAAMW,QAAQ,GAAG,IAAIC,QAAQ,CAACH,WAAW,CAAC;EAC1C,IAAII,KAAK,GAAG,EAAE;EACd,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGd,MAAM,EAAEc,CAAC,EAAE,EAAE;IAC/BD,KAAK,IAAIE,MAAM,CAACC,YAAY,CAACL,QAAQ,CAACM,QAAQ,CAACT,UAAU,GAAGM,CAAC,CAAC,CAAC;EACjE;EACA,OAAOD,KAAK;AACd"}
|
|
@@ -5,8 +5,8 @@ var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.bufferToArrayBuffer = bufferToArrayBuffer;
|
|
9
8
|
exports.isBuffer = isBuffer;
|
|
9
|
+
exports.toArrayBuffer = toArrayBuffer;
|
|
10
10
|
exports.toBuffer = toBuffer;
|
|
11
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
12
|
var node = _interopRequireWildcard(require("../node/buffer"));
|
|
@@ -15,16 +15,30 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
15
15
|
function isBuffer(value) {
|
|
16
16
|
return value && (0, _typeof2.default)(value) === 'object' && value.isBuffer;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
function toBuffer(data) {
|
|
20
19
|
return node.toBuffer ? node.toBuffer(data) : data;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
function toArrayBuffer(data) {
|
|
22
|
+
if (isBuffer(data)) {
|
|
23
|
+
return node.toArrayBuffer(data);
|
|
24
|
+
}
|
|
25
|
+
if (data instanceof ArrayBuffer) {
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
if (ArrayBuffer.isView(data)) {
|
|
29
|
+
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
30
|
+
return data.buffer;
|
|
31
|
+
}
|
|
32
|
+
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
33
|
+
}
|
|
34
|
+
if (typeof data === 'string') {
|
|
35
|
+
var text = data;
|
|
36
|
+
var uint8Array = new TextEncoder().encode(text);
|
|
37
|
+
return uint8Array.buffer;
|
|
38
|
+
}
|
|
39
|
+
if (data && (0, _typeof2.default)(data) === 'object' && data._toArrayBuffer) {
|
|
40
|
+
return data._toArrayBuffer();
|
|
27
41
|
}
|
|
28
|
-
|
|
42
|
+
throw new Error('toArrayBuffer');
|
|
29
43
|
}
|
|
30
|
-
//# sourceMappingURL=
|
|
44
|
+
//# sourceMappingURL=memory-conversion-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-conversion-utils.js","names":["node","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof3","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","isBuffer","value","_typeof2","toBuffer","data","toArrayBuffer","ArrayBuffer","isView","byteOffset","byteLength","buffer","slice","text","uint8Array","TextEncoder","encode","_toArrayBuffer","Error"],"sources":["../../../../src/lib/binary-utils/memory-conversion-utils.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): boolean {\n return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: any): Buffer {\n return node.toBuffer ? node.toBuffer(data) : data;\n}\n\n/**\n * Convert an object to an array buffer\n */\nexport function toArrayBuffer(data: unknown): ArrayBuffer {\n // Note: Should be called first, Buffers can trigger other detections below\n if (isBuffer(data)) {\n return node.toArrayBuffer(data);\n }\n\n if (data instanceof ArrayBuffer) {\n return data;\n }\n\n // Careful - Node Buffers look like Uint8Arrays (keep after isBuffer)\n if (ArrayBuffer.isView(data)) {\n if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n }\n\n if (typeof data === 'string') {\n const text = data;\n const uint8Array = new TextEncoder().encode(text);\n return uint8Array.buffer;\n }\n\n // HACK to support Blob polyfill\n if (data && typeof data === 'object' && (data as any)._toArrayBuffer) {\n return (data as any)._toArrayBuffer();\n }\n\n throw new Error('toArrayBuffer');\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAuC,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,QAAA,CAAAF,GAAA,yBAAAA,GAAA,4BAAAG,OAAA,EAAAH,GAAA,UAAAI,KAAA,GAAAT,wBAAA,CAAAC,WAAA,OAAAQ,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAL,GAAA,YAAAI,KAAA,CAAAE,GAAA,CAAAN,GAAA,SAAAO,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAZ,GAAA,QAAAY,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAf,GAAA,EAAAY,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAX,GAAA,EAAAY,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,I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IAAI,IAAAF,QAAA,CAAAjB,OAAA,EAAOmB,IAAI,MAAK,QAAQ,IAAKA,IAAI,CAASY,cAAc,EAAE;IACpE,OAAQZ,IAAI,CAASY,cAAc,EAAE;EACvC;EAEA,MAAM,IAAIC,KAAK,CAAC,eAAe,CAAC;AAClC"}
|
|
@@ -12,7 +12,6 @@ function padToNBytes(byteLength, padding) {
|
|
|
12
12
|
(0, _assert.assert)(padding > 0);
|
|
13
13
|
return byteLength + (padding - 1) & ~(padding - 1);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) {
|
|
17
16
|
var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength;
|
|
18
17
|
var targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);
|
|
@@ -20,7 +19,6 @@ function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) {
|
|
|
20
19
|
targetArray.set(sourceArray);
|
|
21
20
|
return targetBuffer;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
function copyToArray(source, target, targetOffset) {
|
|
25
23
|
var sourceArray;
|
|
26
24
|
if (source instanceof ArrayBuffer) {
|
|
@@ -30,7 +28,6 @@ function copyToArray(source, target, targetOffset) {
|
|
|
30
28
|
var srcByteLength = source.byteLength;
|
|
31
29
|
sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
target.set(sourceArray, targetOffset);
|
|
35
32
|
return targetOffset + padToNBytes(sourceArray.byteLength, 4);
|
|
36
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-copy-utils.js","names":["padToNBytes","byteLength","padding","assert","copyArrayBuffer","targetBuffer","sourceBuffer","byteOffset","targetArray","Uint8Array","sourceArray","set","copyToArray","source","target","targetOffset","ArrayBuffer","srcByteOffset","srcByteLength","buffer","arrayBuffer"],"sources":["../../../../src/lib/binary-utils/memory-copy-utils.ts"],"sourcesContent":["import {assert} from '../env-utils/assert';\n\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength: number, padding: number): number {\n assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(\n targetBuffer: ArrayBuffer,\n sourceBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number = sourceBuffer.byteLength\n): ArrayBuffer {\n const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n return targetBuffer;\n}\n\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number {\n let sourceArray;\n\n if (source instanceof ArrayBuffer) {\n sourceArray = new Uint8Array(source);\n } else {\n // Pack buffer onto the big target array\n //\n // 'source.data.buffer' could be a view onto a larger buffer.\n // We MUST use this constructor to ensure the byteOffset and byteLength is\n // set to correct values from 'source.data' and not the underlying\n // buffer for target.set() to work properly.\n const srcByteOffset = source.byteOffset;\n const srcByteLength = source.byteLength;\n // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n }\n\n // Pack buffer onto the big target array\n target.set(sourceArray, targetOffset);\n\n return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n"],"mappings":";;;;;;;;AAAA;AASO,
|
|
1
|
+
{"version":3,"file":"memory-copy-utils.js","names":["_assert","require","padToNBytes","byteLength","padding","assert","copyArrayBuffer","targetBuffer","sourceBuffer","byteOffset","arguments","length","undefined","targetArray","Uint8Array","sourceArray","set","copyToArray","source","target","targetOffset","ArrayBuffer","srcByteOffset","srcByteLength","buffer","arrayBuffer"],"sources":["../../../../src/lib/binary-utils/memory-copy-utils.ts"],"sourcesContent":["import {assert} from '../env-utils/assert';\n\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength: number, padding: number): number {\n assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(\n targetBuffer: ArrayBuffer,\n sourceBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number = sourceBuffer.byteLength\n): ArrayBuffer {\n const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n return targetBuffer;\n}\n\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number {\n let sourceArray;\n\n if (source instanceof ArrayBuffer) {\n sourceArray = new Uint8Array(source);\n } else {\n // Pack buffer onto the big target array\n //\n // 'source.data.buffer' could be a view onto a larger buffer.\n // We MUST use this constructor to ensure the byteOffset and byteLength is\n // set to correct values from 'source.data' and not the underlying\n // buffer for target.set() to work properly.\n const srcByteOffset = source.byteOffset;\n const srcByteLength = source.byteLength;\n // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n }\n\n // Pack buffer onto the big target array\n target.set(sourceArray, targetOffset);\n\n return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AASO,SAASC,WAAWA,CAACC,UAAkB,EAAEC,OAAe,EAAU;EACvE,IAAAC,cAAM,EAACF,UAAU,IAAI,CAAC,CAAC;EACvB,IAAAE,cAAM,EAACD,OAAO,GAAG,CAAC,CAAC;EACnB,OAAQD,UAAU,IAAIC,OAAO,GAAG,CAAC,CAAC,GAAI,EAAEA,OAAO,GAAG,CAAC,CAAC;AACtD;AAQO,SAASE,eAAeA,CAC7BC,YAAyB,EACzBC,YAAyB,EACzBC,UAAkB,EAEL;EAAA,IADbN,UAAkB,GAAAO,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGF,YAAY,CAACL,UAAU;EAE5C,IAAMU,WAAW,GAAG,IAAIC,UAAU,CAACP,YAAY,EAAEE,UAAU,EAAEN,UAAU,CAAC;EACxE,IAAMY,WAAW,GAAG,IAAID,UAAU,CAACN,YAAY,CAAC;EAChDK,WAAW,CAACG,GAAG,CAACD,WAAW,CAAC;EAC5B,OAAOR,YAAY;AACrB;AAUO,SAASU,WAAWA,CAACC,MAAyB,EAAEC,MAAW,EAAEC,YAAoB,EAAU;EAChG,IAAIL,WAAW;EAEf,IAAIG,MAAM,YAAYG,WAAW,EAAE;IACjCN,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAAC;EACtC,CAAC,MAAM;IAOL,IAAMI,aAAa,GAAGJ,MAAM,CAACT,UAAU;IACvC,IAAMc,aAAa,GAAGL,MAAM,CAACf,UAAU;IAGvCY,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAACM,MAAM,IAAIN,MAAM,CAACO,WAAW,EAAEH,aAAa,EAAEC,aAAa,CAAC;EACjG;EAGAJ,MAAM,CAACH,GAAG,CAACD,WAAW,EAAEK,YAAY,CAAC;EAErC,OAAOA,YAAY,GAAGlB,WAAW,CAACa,WAAW,CAACZ,UAAU,EAAE,CAAC,CAAC;AAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../../src/lib/env-utils/assert.ts"],"sourcesContent":["/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n"],"mappings":";;;;;;AAIO,SAASA,
|
|
1
|
+
{"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../../src/lib/env-utils/assert.ts"],"sourcesContent":["/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n"],"mappings":";;;;;;AAIO,SAASA,MAAMA,CAACC,SAAc,EAAEC,OAAgB,EAAQ;EAC7D,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,0BAA0B,CAAC;EACxD;AACF"}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.window = exports.self = exports.nodeVersion = exports.isWorker = exports.isBrowser = exports.global = exports.document = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
|
|
10
9
|
var globals = {
|
|
11
10
|
self: typeof self !== 'undefined' && self,
|
|
12
11
|
window: typeof window !== 'undefined' && window,
|
|
@@ -21,12 +20,9 @@ var global_ = globals.global || globals.self || globals.window || {};
|
|
|
21
20
|
exports.global = global_;
|
|
22
21
|
var document_ = globals.document || {};
|
|
23
22
|
exports.document = document_;
|
|
24
|
-
var isBrowser =
|
|
25
|
-
Boolean((typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) !== 'object' || String(process) !== '[object process]' || process.browser);
|
|
26
|
-
|
|
23
|
+
var isBrowser = Boolean((typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) !== 'object' || String(process) !== '[object process]' || process.browser);
|
|
27
24
|
exports.isBrowser = isBrowser;
|
|
28
25
|
var isWorker = typeof importScripts === 'function';
|
|
29
|
-
|
|
30
26
|
exports.isWorker = isWorker;
|
|
31
27
|
var matches = typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);
|
|
32
28
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|