@loaders.gl/loader-utils 3.4.14 → 3.4.15
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 +50 -51
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/json-loader.js +5 -24
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/lib/binary-utils/array-buffer-utils.js +18 -37
- package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +1 -1
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js +14 -14
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +1 -1
- package/dist/es5/lib/binary-utils/get-first-characters.js +5 -5
- package/dist/es5/lib/binary-utils/get-first-characters.js.map +1 -1
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js +6 -9
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +1 -1
- package/dist/es5/lib/binary-utils/memory-copy-utils.js +6 -6
- package/dist/es5/lib/binary-utils/memory-copy-utils.js.map +1 -1
- package/dist/es5/lib/env-utils/globals.js +9 -11
- package/dist/es5/lib/env-utils/globals.js.map +1 -1
- package/dist/es5/lib/filesystems/node-filesystem.js +51 -199
- package/dist/es5/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/es5/lib/filesystems/readable-file.js +9 -74
- package/dist/es5/lib/filesystems/readable-file.js.map +1 -1
- package/dist/es5/lib/filesystems/writable-file.js +11 -65
- package/dist/es5/lib/filesystems/writable-file.js.map +1 -1
- package/dist/es5/lib/iterators/async-iteration.js +27 -177
- package/dist/es5/lib/iterators/async-iteration.js.map +1 -1
- package/dist/es5/lib/iterators/text-iterators.js +44 -293
- package/dist/es5/lib/iterators/text-iterators.js.map +1 -1
- package/dist/es5/lib/node/buffer.js +1 -1
- package/dist/es5/lib/node/buffer.js.map +1 -1
- package/dist/es5/lib/node/fs.browser.js +13 -13
- package/dist/es5/lib/node/fs.browser.js.map +1 -1
- package/dist/es5/lib/node/fs.js +21 -49
- package/dist/es5/lib/node/fs.js.map +1 -1
- package/dist/es5/lib/node/promisify.js +3 -21
- package/dist/es5/lib/node/promisify.js.map +1 -1
- package/dist/es5/lib/node/stream.browser.js +2 -2
- package/dist/es5/lib/node/stream.browser.js.map +1 -1
- package/dist/es5/lib/node/stream.js +2 -2
- package/dist/es5/lib/node/stream.js.map +1 -1
- package/dist/es5/lib/option-utils/merge-loader-options.js +5 -12
- package/dist/es5/lib/option-utils/merge-loader-options.js.map +1 -1
- package/dist/es5/lib/path-utils/file-aliases.js +4 -4
- package/dist/es5/lib/path-utils/file-aliases.js.map +1 -1
- package/dist/es5/lib/path-utils/get-cwd.js +1 -1
- package/dist/es5/lib/path-utils/get-cwd.js.map +1 -1
- package/dist/es5/lib/path-utils/path.js +22 -22
- package/dist/es5/lib/path-utils/path.js.map +1 -1
- package/dist/es5/lib/request-utils/request-scheduler.js +88 -110
- package/dist/es5/lib/request-utils/request-scheduler.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +64 -105
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js +48 -94
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/esm/json-loader.js +1 -1
- package/package.json +4 -4
package/dist/es5/index.js
CHANGED
|
@@ -1,298 +1,297 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
Object.defineProperty(exports, "JSONLoader", {
|
|
9
8
|
enumerable: true,
|
|
10
|
-
get: function
|
|
9
|
+
get: function () {
|
|
11
10
|
return _jsonLoader.JSONLoader;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
Object.defineProperty(exports, "RequestScheduler", {
|
|
15
14
|
enumerable: true,
|
|
16
|
-
get: function
|
|
15
|
+
get: function () {
|
|
17
16
|
return _requestScheduler.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
19
|
Object.defineProperty(exports, "_NodeFileSystem", {
|
|
21
20
|
enumerable: true,
|
|
22
|
-
get: function
|
|
21
|
+
get: function () {
|
|
23
22
|
return _nodeFilesystem.default;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
Object.defineProperty(exports, "_addAliases", {
|
|
27
26
|
enumerable: true,
|
|
28
|
-
get: function
|
|
27
|
+
get: function () {
|
|
29
28
|
return _fileAliases.addAliases;
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
31
|
Object.defineProperty(exports, "assert", {
|
|
33
32
|
enumerable: true,
|
|
34
|
-
get: function
|
|
33
|
+
get: function () {
|
|
35
34
|
return _assert.assert;
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
Object.defineProperty(exports, "canEncodeWithWorker", {
|
|
39
38
|
enumerable: true,
|
|
40
|
-
get: function
|
|
39
|
+
get: function () {
|
|
41
40
|
return _encodeWithWorker.canEncodeWithWorker;
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
Object.defineProperty(exports, "canParseWithWorker", {
|
|
45
44
|
enumerable: true,
|
|
46
|
-
get: function
|
|
45
|
+
get: function () {
|
|
47
46
|
return _parseWithWorker.canParseWithWorker;
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
Object.defineProperty(exports, "compareArrayBuffers", {
|
|
51
50
|
enumerable: true,
|
|
52
|
-
get: function
|
|
51
|
+
get: function () {
|
|
53
52
|
return _arrayBufferUtils.compareArrayBuffers;
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
Object.defineProperty(exports, "concatenateArrayBuffers", {
|
|
57
56
|
enumerable: true,
|
|
58
|
-
get: function
|
|
57
|
+
get: function () {
|
|
59
58
|
return _arrayBufferUtils.concatenateArrayBuffers;
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
61
|
Object.defineProperty(exports, "concatenateArrayBuffersAsync", {
|
|
63
62
|
enumerable: true,
|
|
64
|
-
get: function
|
|
63
|
+
get: function () {
|
|
65
64
|
return _asyncIteration.concatenateArrayBuffersAsync;
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
67
|
Object.defineProperty(exports, "concatenateTypedArrays", {
|
|
69
68
|
enumerable: true,
|
|
70
|
-
get: function
|
|
69
|
+
get: function () {
|
|
71
70
|
return _arrayBufferUtils.concatenateTypedArrays;
|
|
72
71
|
}
|
|
73
72
|
});
|
|
74
73
|
Object.defineProperty(exports, "copyArrayBuffer", {
|
|
75
74
|
enumerable: true,
|
|
76
|
-
get: function
|
|
75
|
+
get: function () {
|
|
77
76
|
return _memoryCopyUtils.copyArrayBuffer;
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
Object.defineProperty(exports, "copyBinaryToDataView", {
|
|
81
80
|
enumerable: true,
|
|
82
|
-
get: function
|
|
81
|
+
get: function () {
|
|
83
82
|
return _dataviewCopyUtils.copyBinaryToDataView;
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
85
|
Object.defineProperty(exports, "copyPaddedArrayBufferToDataView", {
|
|
87
86
|
enumerable: true,
|
|
88
|
-
get: function
|
|
87
|
+
get: function () {
|
|
89
88
|
return _dataviewCopyUtils.copyPaddedArrayBufferToDataView;
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
Object.defineProperty(exports, "copyPaddedStringToDataView", {
|
|
93
92
|
enumerable: true,
|
|
94
|
-
get: function
|
|
93
|
+
get: function () {
|
|
95
94
|
return _dataviewCopyUtils.copyPaddedStringToDataView;
|
|
96
95
|
}
|
|
97
96
|
});
|
|
98
97
|
Object.defineProperty(exports, "copyStringToDataView", {
|
|
99
98
|
enumerable: true,
|
|
100
|
-
get: function
|
|
99
|
+
get: function () {
|
|
101
100
|
return _dataviewCopyUtils.copyStringToDataView;
|
|
102
101
|
}
|
|
103
102
|
});
|
|
104
103
|
Object.defineProperty(exports, "copyToArray", {
|
|
105
104
|
enumerable: true,
|
|
106
|
-
get: function
|
|
105
|
+
get: function () {
|
|
107
106
|
return _memoryCopyUtils.copyToArray;
|
|
108
107
|
}
|
|
109
108
|
});
|
|
110
109
|
Object.defineProperty(exports, "createLoaderWorker", {
|
|
111
110
|
enumerable: true,
|
|
112
|
-
get: function
|
|
111
|
+
get: function () {
|
|
113
112
|
return _createLoaderWorker.createLoaderWorker;
|
|
114
113
|
}
|
|
115
114
|
});
|
|
116
115
|
Object.defineProperty(exports, "document", {
|
|
117
116
|
enumerable: true,
|
|
118
|
-
get: function
|
|
117
|
+
get: function () {
|
|
119
118
|
return _globals.document;
|
|
120
119
|
}
|
|
121
120
|
});
|
|
122
121
|
Object.defineProperty(exports, "forEach", {
|
|
123
122
|
enumerable: true,
|
|
124
|
-
get: function
|
|
123
|
+
get: function () {
|
|
125
124
|
return _asyncIteration.forEach;
|
|
126
125
|
}
|
|
127
126
|
});
|
|
128
127
|
exports.fs = void 0;
|
|
129
128
|
Object.defineProperty(exports, "getFirstCharacters", {
|
|
130
129
|
enumerable: true,
|
|
131
|
-
get: function
|
|
130
|
+
get: function () {
|
|
132
131
|
return _getFirstCharacters.getFirstCharacters;
|
|
133
132
|
}
|
|
134
133
|
});
|
|
135
134
|
Object.defineProperty(exports, "getMagicString", {
|
|
136
135
|
enumerable: true,
|
|
137
|
-
get: function
|
|
136
|
+
get: function () {
|
|
138
137
|
return _getFirstCharacters.getMagicString;
|
|
139
138
|
}
|
|
140
139
|
});
|
|
141
140
|
Object.defineProperty(exports, "getPathPrefix", {
|
|
142
141
|
enumerable: true,
|
|
143
|
-
get: function
|
|
142
|
+
get: function () {
|
|
144
143
|
return _fileAliases.getPathPrefix;
|
|
145
144
|
}
|
|
146
145
|
});
|
|
147
146
|
Object.defineProperty(exports, "global", {
|
|
148
147
|
enumerable: true,
|
|
149
|
-
get: function
|
|
148
|
+
get: function () {
|
|
150
149
|
return _globals.global;
|
|
151
150
|
}
|
|
152
151
|
});
|
|
153
152
|
Object.defineProperty(exports, "isBrowser", {
|
|
154
153
|
enumerable: true,
|
|
155
|
-
get: function
|
|
154
|
+
get: function () {
|
|
156
155
|
return _globals.isBrowser;
|
|
157
156
|
}
|
|
158
157
|
});
|
|
159
158
|
Object.defineProperty(exports, "isBuffer", {
|
|
160
159
|
enumerable: true,
|
|
161
|
-
get: function
|
|
160
|
+
get: function () {
|
|
162
161
|
return _memoryConversionUtils.isBuffer;
|
|
163
162
|
}
|
|
164
163
|
});
|
|
165
164
|
Object.defineProperty(exports, "isWorker", {
|
|
166
165
|
enumerable: true,
|
|
167
|
-
get: function
|
|
166
|
+
get: function () {
|
|
168
167
|
return _globals.isWorker;
|
|
169
168
|
}
|
|
170
169
|
});
|
|
171
170
|
Object.defineProperty(exports, "makeLineIterator", {
|
|
172
171
|
enumerable: true,
|
|
173
|
-
get: function
|
|
172
|
+
get: function () {
|
|
174
173
|
return _textIterators.makeLineIterator;
|
|
175
174
|
}
|
|
176
175
|
});
|
|
177
176
|
Object.defineProperty(exports, "makeNumberedLineIterator", {
|
|
178
177
|
enumerable: true,
|
|
179
|
-
get: function
|
|
178
|
+
get: function () {
|
|
180
179
|
return _textIterators.makeNumberedLineIterator;
|
|
181
180
|
}
|
|
182
181
|
});
|
|
183
182
|
Object.defineProperty(exports, "makeReadableFile", {
|
|
184
183
|
enumerable: true,
|
|
185
|
-
get: function
|
|
184
|
+
get: function () {
|
|
186
185
|
return _readableFile.makeReadableFile;
|
|
187
186
|
}
|
|
188
187
|
});
|
|
189
188
|
Object.defineProperty(exports, "makeTextDecoderIterator", {
|
|
190
189
|
enumerable: true,
|
|
191
|
-
get: function
|
|
190
|
+
get: function () {
|
|
192
191
|
return _textIterators.makeTextDecoderIterator;
|
|
193
192
|
}
|
|
194
193
|
});
|
|
195
194
|
Object.defineProperty(exports, "makeTextEncoderIterator", {
|
|
196
195
|
enumerable: true,
|
|
197
|
-
get: function
|
|
196
|
+
get: function () {
|
|
198
197
|
return _textIterators.makeTextEncoderIterator;
|
|
199
198
|
}
|
|
200
199
|
});
|
|
201
200
|
Object.defineProperty(exports, "makeWritableFile", {
|
|
202
201
|
enumerable: true,
|
|
203
|
-
get: function
|
|
202
|
+
get: function () {
|
|
204
203
|
return _writableFile.makeWritableFile;
|
|
205
204
|
}
|
|
206
205
|
});
|
|
207
206
|
Object.defineProperty(exports, "mergeLoaderOptions", {
|
|
208
207
|
enumerable: true,
|
|
209
|
-
get: function
|
|
208
|
+
get: function () {
|
|
210
209
|
return _mergeLoaderOptions.mergeLoaderOptions;
|
|
211
210
|
}
|
|
212
211
|
});
|
|
213
212
|
Object.defineProperty(exports, "nodeVersion", {
|
|
214
213
|
enumerable: true,
|
|
215
|
-
get: function
|
|
214
|
+
get: function () {
|
|
216
215
|
return _globals.nodeVersion;
|
|
217
216
|
}
|
|
218
217
|
});
|
|
219
218
|
Object.defineProperty(exports, "padStringToByteAlignment", {
|
|
220
219
|
enumerable: true,
|
|
221
|
-
get: function
|
|
220
|
+
get: function () {
|
|
222
221
|
return _dataviewCopyUtils.padStringToByteAlignment;
|
|
223
222
|
}
|
|
224
223
|
});
|
|
225
224
|
Object.defineProperty(exports, "padToNBytes", {
|
|
226
225
|
enumerable: true,
|
|
227
|
-
get: function
|
|
226
|
+
get: function () {
|
|
228
227
|
return _memoryCopyUtils.padToNBytes;
|
|
229
228
|
}
|
|
230
229
|
});
|
|
231
230
|
Object.defineProperty(exports, "parseJSON", {
|
|
232
231
|
enumerable: true,
|
|
233
|
-
get: function
|
|
232
|
+
get: function () {
|
|
234
233
|
return _parseJson.parseJSON;
|
|
235
234
|
}
|
|
236
235
|
});
|
|
237
236
|
Object.defineProperty(exports, "parseWithWorker", {
|
|
238
237
|
enumerable: true,
|
|
239
|
-
get: function
|
|
238
|
+
get: function () {
|
|
240
239
|
return _parseWithWorker.parseWithWorker;
|
|
241
240
|
}
|
|
242
241
|
});
|
|
243
242
|
exports.path = void 0;
|
|
244
243
|
Object.defineProperty(exports, "promisify1", {
|
|
245
244
|
enumerable: true,
|
|
246
|
-
get: function
|
|
245
|
+
get: function () {
|
|
247
246
|
return _promisify.promisify1;
|
|
248
247
|
}
|
|
249
248
|
});
|
|
250
249
|
Object.defineProperty(exports, "promisify2", {
|
|
251
250
|
enumerable: true,
|
|
252
|
-
get: function
|
|
251
|
+
get: function () {
|
|
253
252
|
return _promisify.promisify2;
|
|
254
253
|
}
|
|
255
254
|
});
|
|
256
255
|
Object.defineProperty(exports, "resolvePath", {
|
|
257
256
|
enumerable: true,
|
|
258
|
-
get: function
|
|
257
|
+
get: function () {
|
|
259
258
|
return _fileAliases.resolvePath;
|
|
260
259
|
}
|
|
261
260
|
});
|
|
262
261
|
Object.defineProperty(exports, "self", {
|
|
263
262
|
enumerable: true,
|
|
264
|
-
get: function
|
|
263
|
+
get: function () {
|
|
265
264
|
return _globals.self;
|
|
266
265
|
}
|
|
267
266
|
});
|
|
268
267
|
Object.defineProperty(exports, "setPathPrefix", {
|
|
269
268
|
enumerable: true,
|
|
270
|
-
get: function
|
|
269
|
+
get: function () {
|
|
271
270
|
return _fileAliases.setPathPrefix;
|
|
272
271
|
}
|
|
273
272
|
});
|
|
274
273
|
Object.defineProperty(exports, "sliceArrayBuffer", {
|
|
275
274
|
enumerable: true,
|
|
276
|
-
get: function
|
|
275
|
+
get: function () {
|
|
277
276
|
return _arrayBufferUtils.sliceArrayBuffer;
|
|
278
277
|
}
|
|
279
278
|
});
|
|
280
279
|
exports.stream = void 0;
|
|
281
280
|
Object.defineProperty(exports, "toArrayBuffer", {
|
|
282
281
|
enumerable: true,
|
|
283
|
-
get: function
|
|
282
|
+
get: function () {
|
|
284
283
|
return _memoryConversionUtils.toArrayBuffer;
|
|
285
284
|
}
|
|
286
285
|
});
|
|
287
286
|
Object.defineProperty(exports, "toBuffer", {
|
|
288
287
|
enumerable: true,
|
|
289
|
-
get: function
|
|
288
|
+
get: function () {
|
|
290
289
|
return _memoryConversionUtils.toBuffer;
|
|
291
290
|
}
|
|
292
291
|
});
|
|
293
292
|
Object.defineProperty(exports, "window", {
|
|
294
293
|
enumerable: true,
|
|
295
|
-
get: function
|
|
294
|
+
get: function () {
|
|
296
295
|
return _globals.window;
|
|
297
296
|
}
|
|
298
297
|
});
|
|
@@ -323,6 +322,6 @@ exports.stream = stream;
|
|
|
323
322
|
var _readableFile = require("./lib/filesystems/readable-file");
|
|
324
323
|
var _writableFile = require("./lib/filesystems/writable-file");
|
|
325
324
|
var _nodeFilesystem = _interopRequireDefault(require("./lib/filesystems/node-filesystem"));
|
|
326
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
327
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
325
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
326
|
+
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; }
|
|
328
327
|
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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","
|
|
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","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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"}
|
package/dist/es5/json-loader.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports._typecheckJSONLoader = exports.JSONLoader = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var VERSION = typeof "3.4.14" !== 'undefined' ? "3.4.14" : 'latest';
|
|
11
|
-
var JSONLoader = {
|
|
7
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
8
|
+
const JSONLoader = {
|
|
12
9
|
name: 'JSON',
|
|
13
10
|
id: 'json',
|
|
14
11
|
module: 'json',
|
|
@@ -17,30 +14,14 @@ var JSONLoader = {
|
|
|
17
14
|
mimeTypes: ['application/json'],
|
|
18
15
|
category: 'json',
|
|
19
16
|
text: true,
|
|
20
|
-
parseTextSync
|
|
21
|
-
parse:
|
|
22
|
-
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
23
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
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();
|
|
30
|
-
}
|
|
31
|
-
}, _callee);
|
|
32
|
-
}));
|
|
33
|
-
function parse(_x) {
|
|
34
|
-
return _parse.apply(this, arguments);
|
|
35
|
-
}
|
|
36
|
-
return parse;
|
|
37
|
-
}(),
|
|
17
|
+
parseTextSync,
|
|
18
|
+
parse: async arrayBuffer => parseTextSync(new TextDecoder().decode(arrayBuffer)),
|
|
38
19
|
options: {}
|
|
39
20
|
};
|
|
40
21
|
exports.JSONLoader = JSONLoader;
|
|
41
22
|
function parseTextSync(text) {
|
|
42
23
|
return JSON.parse(text);
|
|
43
24
|
}
|
|
44
|
-
|
|
25
|
+
const _typecheckJSONLoader = JSONLoader;
|
|
45
26
|
exports._typecheckJSONLoader = _typecheckJSONLoader;
|
|
46
27
|
//# sourceMappingURL=json-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-loader.js","names":["VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","
|
|
1
|
+
{"version":3,"file":"json-loader.js","names":["VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","arrayBuffer","TextDecoder","decode","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,MAAMA,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAMpE,MAAMC,UAAU,GAAG;EACxBC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,MAAM;EAChBC,IAAI,EAAE,IAAI;EACVC,aAAa;EACbC,KAAK,EAAE,MAAOC,WAAW,IAAKF,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EAClFG,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAf,UAAA,GAAAA,UAAA;AAGF,SAASS,aAAaA,CAACD,IAAI,EAAE;EAC3B,OAAOQ,IAAI,CAACN,KAAK,CAACF,IAAI,CAAC;AACzB;AAEO,MAAMS,oBAAsC,GAAGjB,UAAU;AAACe,OAAA,CAAAE,oBAAA,GAAAA,oBAAA"}
|
|
@@ -7,17 +7,14 @@ exports.compareArrayBuffers = compareArrayBuffers;
|
|
|
7
7
|
exports.concatenateArrayBuffers = concatenateArrayBuffers;
|
|
8
8
|
exports.concatenateTypedArrays = concatenateTypedArrays;
|
|
9
9
|
exports.sliceArrayBuffer = sliceArrayBuffer;
|
|
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; } } }; }
|
|
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); }
|
|
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; }
|
|
13
10
|
function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
14
11
|
byteLength = byteLength || arrayBuffer1.byteLength;
|
|
15
12
|
if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
|
|
16
13
|
return false;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
for (
|
|
15
|
+
const array1 = new Uint8Array(arrayBuffer1);
|
|
16
|
+
const array2 = new Uint8Array(arrayBuffer2);
|
|
17
|
+
for (let i = 0; i < array1.length; ++i) {
|
|
21
18
|
if (array1[i] !== array2[i]) {
|
|
22
19
|
return false;
|
|
23
20
|
}
|
|
@@ -28,26 +25,13 @@ function concatenateArrayBuffers() {
|
|
|
28
25
|
for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
26
|
sources[_key] = arguments[_key];
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var offset = 0;
|
|
39
|
-
var _iterator = _createForOfIteratorHelper(sourceArrays),
|
|
40
|
-
_step;
|
|
41
|
-
try {
|
|
42
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
43
|
-
var sourceArray = _step.value;
|
|
44
|
-
result.set(sourceArray, offset);
|
|
45
|
-
offset += sourceArray.byteLength;
|
|
46
|
-
}
|
|
47
|
-
} catch (err) {
|
|
48
|
-
_iterator.e(err);
|
|
49
|
-
} finally {
|
|
50
|
-
_iterator.f();
|
|
28
|
+
const sourceArrays = sources.map(source2 => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
|
|
29
|
+
const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);
|
|
30
|
+
const result = new Uint8Array(byteLength);
|
|
31
|
+
let offset = 0;
|
|
32
|
+
for (const sourceArray of sourceArrays) {
|
|
33
|
+
result.set(sourceArray, offset);
|
|
34
|
+
offset += sourceArray.byteLength;
|
|
51
35
|
}
|
|
52
36
|
return result.buffer;
|
|
53
37
|
}
|
|
@@ -55,26 +39,23 @@ function concatenateTypedArrays() {
|
|
|
55
39
|
for (var _len2 = arguments.length, typedArrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
56
40
|
typedArrays[_key2] = arguments[_key2];
|
|
57
41
|
}
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
const arrays = typedArrays;
|
|
43
|
+
const TypedArrayConstructor = arrays && arrays.length > 1 && arrays[0].constructor || null;
|
|
60
44
|
if (!TypedArrayConstructor) {
|
|
61
45
|
throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');
|
|
62
46
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var offset = 0;
|
|
68
|
-
for (var _i = 0, _arrays = arrays; _i < _arrays.length; _i++) {
|
|
69
|
-
var array = _arrays[_i];
|
|
47
|
+
const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
|
48
|
+
const result = new TypedArrayConstructor(sumLength);
|
|
49
|
+
let offset = 0;
|
|
50
|
+
for (const array of arrays) {
|
|
70
51
|
result.set(array, offset);
|
|
71
52
|
offset += array.length;
|
|
72
53
|
}
|
|
73
54
|
return result;
|
|
74
55
|
}
|
|
75
56
|
function sliceArrayBuffer(arrayBuffer, byteOffset, byteLength) {
|
|
76
|
-
|
|
77
|
-
|
|
57
|
+
const subArray = byteLength !== undefined ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength) : new Uint8Array(arrayBuffer).subarray(byteOffset);
|
|
58
|
+
const arrayCopy = new Uint8Array(subArray);
|
|
78
59
|
return arrayCopy.buffer;
|
|
79
60
|
}
|
|
80
61
|
//# sourceMappingURL=array-buffer-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
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","sourceArray","set","buffer","concatenateTypedArrays","_len2","typedArrays","_key2","arrays","TypedArrayConstructor","constructor","Error","sumLength","acc","value","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":"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"}
|
|
@@ -10,18 +10,18 @@ exports.copyStringToDataView = copyStringToDataView;
|
|
|
10
10
|
exports.padStringToByteAlignment = padStringToByteAlignment;
|
|
11
11
|
var _memoryCopyUtils = require("./memory-copy-utils");
|
|
12
12
|
function padStringToByteAlignment(string, byteAlignment) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
for (
|
|
13
|
+
const length = string.length;
|
|
14
|
+
const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
|
|
15
|
+
const padding = paddedLength - length;
|
|
16
|
+
let whitespace = '';
|
|
17
|
+
for (let i = 0; i < padding; ++i) {
|
|
18
18
|
whitespace += ' ';
|
|
19
19
|
}
|
|
20
20
|
return string + whitespace;
|
|
21
21
|
}
|
|
22
22
|
function copyStringToDataView(dataView, byteOffset, string, byteLength) {
|
|
23
23
|
if (dataView) {
|
|
24
|
-
for (
|
|
24
|
+
for (let i = 0; i < byteLength; i++) {
|
|
25
25
|
dataView.setUint8(byteOffset + i, string.charCodeAt(i));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -29,20 +29,20 @@ function copyStringToDataView(dataView, byteOffset, string, byteLength) {
|
|
|
29
29
|
}
|
|
30
30
|
function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {
|
|
31
31
|
if (dataView) {
|
|
32
|
-
for (
|
|
32
|
+
for (let i = 0; i < byteLength; i++) {
|
|
33
33
|
dataView.setUint8(byteOffset + i, binary[i]);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return byteOffset + byteLength;
|
|
37
37
|
}
|
|
38
38
|
function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const paddedLength = (0, _memoryCopyUtils.padToNBytes)(sourceBuffer.byteLength, padding);
|
|
40
|
+
const padLength = paddedLength - sourceBuffer.byteLength;
|
|
41
41
|
if (dataView) {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
|
|
43
|
+
const sourceArray = new Uint8Array(sourceBuffer);
|
|
44
44
|
targetArray.set(sourceArray);
|
|
45
|
-
for (
|
|
45
|
+
for (let i = 0; i < padLength; ++i) {
|
|
46
46
|
dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -50,8 +50,8 @@ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, pad
|
|
|
50
50
|
return byteOffset;
|
|
51
51
|
}
|
|
52
52
|
function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const textEncoder = new TextEncoder();
|
|
54
|
+
const stringBuffer = textEncoder.encode(string);
|
|
55
55
|
byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
|
|
56
56
|
return byteOffset;
|
|
57
57
|
}
|