@loaders.gl/json 4.2.0-alpha.3 → 4.2.0-alpha.5
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/dist.dev.js +341 -409
- package/dist/dist.min.js +21 -0
- package/dist/geojson-loader.d.ts +1 -1
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-loader.js +75 -73
- package/dist/geojson-worker.js +1 -1
- package/dist/geojson-writer.js +23 -20
- package/dist/index.cjs +120 -94
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/json-loader.js +30 -37
- package/dist/json-writer.js +14 -11
- package/dist/lib/clarinet/clarinet.js +511 -391
- package/dist/lib/encoder-utils/encode-table-row.d.ts +1 -1
- package/dist/lib/encoder-utils/encode-table-row.d.ts.map +1 -1
- package/dist/lib/encoder-utils/encode-table-row.js +46 -37
- package/dist/lib/encoder-utils/encode-utils.js +38 -25
- package/dist/lib/encoder-utils/utf8-encoder.js +25 -27
- package/dist/lib/encoders/geojson-encoder.d.ts +1 -1
- package/dist/lib/encoders/geojson-encoder.d.ts.map +1 -1
- package/dist/lib/encoders/geojson-encoder.js +43 -40
- package/dist/lib/encoders/json-encoder.d.ts +1 -1
- package/dist/lib/encoders/json-encoder.d.ts.map +1 -1
- package/dist/lib/encoders/json-encoder.js +17 -9
- package/dist/lib/json-parser/json-parser.d.ts +2 -2
- package/dist/lib/json-parser/json-parser.d.ts.map +1 -1
- package/dist/lib/json-parser/json-parser.js +85 -102
- package/dist/lib/json-parser/streaming-json-parser.d.ts +2 -2
- package/dist/lib/json-parser/streaming-json-parser.d.ts.map +1 -1
- package/dist/lib/json-parser/streaming-json-parser.js +86 -63
- package/dist/lib/jsonpath/jsonpath.js +77 -57
- package/dist/lib/parsers/parse-json-in-batches.d.ts +1 -1
- package/dist/lib/parsers/parse-json-in-batches.d.ts.map +1 -1
- package/dist/lib/parsers/parse-json-in-batches.js +76 -75
- package/dist/lib/parsers/parse-json.d.ts +1 -1
- package/dist/lib/parsers/parse-json.d.ts.map +1 -1
- package/dist/lib/parsers/parse-json.js +21 -22
- package/dist/lib/parsers/parse-ndjson-in-batches.js +26 -28
- package/dist/lib/parsers/parse-ndjson.js +10 -10
- package/dist/ndgeoson-loader.js +28 -20
- package/dist/ndjson-loader.js +22 -14
- package/dist/workers/geojson-worker.js +0 -1
- package/package.json +11 -7
- package/dist/geojson-loader.js.map +0 -1
- package/dist/geojson-writer.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json-loader.js.map +0 -1
- package/dist/json-writer.js.map +0 -1
- package/dist/lib/clarinet/LICENSE +0 -28
- package/dist/lib/clarinet/clarinet.js.map +0 -1
- package/dist/lib/encoder-utils/encode-table-row.js.map +0 -1
- package/dist/lib/encoder-utils/encode-utils.js.map +0 -1
- package/dist/lib/encoder-utils/utf8-encoder.js.map +0 -1
- package/dist/lib/encoders/geojson-encoder.js.map +0 -1
- package/dist/lib/encoders/json-encoder.js.map +0 -1
- package/dist/lib/json-parser/json-parser.js.map +0 -1
- package/dist/lib/json-parser/streaming-json-parser.js.map +0 -1
- package/dist/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/lib/parsers/parse-json-in-batches.js.map +0 -1
- package/dist/lib/parsers/parse-json.js.map +0 -1
- package/dist/lib/parsers/parse-ndjson-in-batches.js.map +0 -1
- package/dist/lib/parsers/parse-ndjson.js.map +0 -1
- package/dist/ndgeoson-loader.js.map +0 -1
- package/dist/ndjson-loader.js.map +0 -1
- package/dist/workers/geojson-worker.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
20
|
+
// dist/index.js
|
|
21
|
+
var dist_exports = {};
|
|
22
|
+
__export(dist_exports, {
|
|
23
23
|
JSONLoader: () => JSONLoader,
|
|
24
24
|
JSONWriter: () => JSONWriter,
|
|
25
25
|
NDJSONLoader: () => NDJSONLoader,
|
|
@@ -30,9 +30,9 @@ __export(src_exports, {
|
|
|
30
30
|
_JSONPath: () => JSONPath,
|
|
31
31
|
_rebuildJsonObject: () => rebuildJsonObject
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(dist_exports);
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// dist/lib/parsers/parse-json.js
|
|
36
36
|
var import_schema = require("@loaders.gl/schema");
|
|
37
37
|
function parseJSONSync(jsonText, options) {
|
|
38
38
|
var _a;
|
|
@@ -62,12 +62,39 @@ function getFirstArray(json) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
//
|
|
65
|
+
// dist/lib/parsers/parse-json-in-batches.js
|
|
66
66
|
var import_schema2 = require("@loaders.gl/schema");
|
|
67
67
|
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// dist/lib/clarinet/clarinet.js
|
|
70
70
|
var MAX_BUFFER_LENGTH = Number.MAX_SAFE_INTEGER;
|
|
71
|
+
var STATE;
|
|
72
|
+
(function(STATE2) {
|
|
73
|
+
STATE2[STATE2["BEGIN"] = 0] = "BEGIN";
|
|
74
|
+
STATE2[STATE2["VALUE"] = 1] = "VALUE";
|
|
75
|
+
STATE2[STATE2["OPEN_OBJECT"] = 2] = "OPEN_OBJECT";
|
|
76
|
+
STATE2[STATE2["CLOSE_OBJECT"] = 3] = "CLOSE_OBJECT";
|
|
77
|
+
STATE2[STATE2["OPEN_ARRAY"] = 4] = "OPEN_ARRAY";
|
|
78
|
+
STATE2[STATE2["CLOSE_ARRAY"] = 5] = "CLOSE_ARRAY";
|
|
79
|
+
STATE2[STATE2["TEXT_ESCAPE"] = 6] = "TEXT_ESCAPE";
|
|
80
|
+
STATE2[STATE2["STRING"] = 7] = "STRING";
|
|
81
|
+
STATE2[STATE2["BACKSLASH"] = 8] = "BACKSLASH";
|
|
82
|
+
STATE2[STATE2["END"] = 9] = "END";
|
|
83
|
+
STATE2[STATE2["OPEN_KEY"] = 10] = "OPEN_KEY";
|
|
84
|
+
STATE2[STATE2["CLOSE_KEY"] = 11] = "CLOSE_KEY";
|
|
85
|
+
STATE2[STATE2["TRUE"] = 12] = "TRUE";
|
|
86
|
+
STATE2[STATE2["TRUE2"] = 13] = "TRUE2";
|
|
87
|
+
STATE2[STATE2["TRUE3"] = 14] = "TRUE3";
|
|
88
|
+
STATE2[STATE2["FALSE"] = 15] = "FALSE";
|
|
89
|
+
STATE2[STATE2["FALSE2"] = 16] = "FALSE2";
|
|
90
|
+
STATE2[STATE2["FALSE3"] = 17] = "FALSE3";
|
|
91
|
+
STATE2[STATE2["FALSE4"] = 18] = "FALSE4";
|
|
92
|
+
STATE2[STATE2["NULL"] = 19] = "NULL";
|
|
93
|
+
STATE2[STATE2["NULL2"] = 20] = "NULL2";
|
|
94
|
+
STATE2[STATE2["NULL3"] = 21] = "NULL3";
|
|
95
|
+
STATE2[STATE2["NUMBER_DECIMAL_POINT"] = 22] = "NUMBER_DECIMAL_POINT";
|
|
96
|
+
STATE2[STATE2["NUMBER_DIGIT"] = 23] = "NUMBER_DIGIT";
|
|
97
|
+
})(STATE || (STATE = {}));
|
|
71
98
|
var Char = {
|
|
72
99
|
tab: 9,
|
|
73
100
|
// \t
|
|
@@ -159,11 +186,9 @@ var ClarinetParser = class {
|
|
|
159
186
|
this.closed = false;
|
|
160
187
|
this.closedRoot = false;
|
|
161
188
|
this.sawRoot = false;
|
|
162
|
-
// tag = null;
|
|
163
189
|
this.error = null;
|
|
164
|
-
this.state =
|
|
190
|
+
this.state = STATE.BEGIN;
|
|
165
191
|
this.stack = [];
|
|
166
|
-
// mostly just for error reporting
|
|
167
192
|
this.position = 0;
|
|
168
193
|
this.column = 0;
|
|
169
194
|
this.line = 1;
|
|
@@ -177,7 +202,7 @@ var ClarinetParser = class {
|
|
|
177
202
|
this.emit("onready");
|
|
178
203
|
}
|
|
179
204
|
end() {
|
|
180
|
-
if (this.state !==
|
|
205
|
+
if (this.state !== STATE.VALUE || this.depth !== 0)
|
|
181
206
|
this._error("Unexpected end");
|
|
182
207
|
this._closeValue();
|
|
183
208
|
this.c = "";
|
|
@@ -233,111 +258,111 @@ var ClarinetParser = class {
|
|
|
233
258
|
} else
|
|
234
259
|
this.column++;
|
|
235
260
|
switch (this.state) {
|
|
236
|
-
case
|
|
261
|
+
case STATE.BEGIN:
|
|
237
262
|
if (c === Char.openBrace)
|
|
238
|
-
this.state =
|
|
263
|
+
this.state = STATE.OPEN_OBJECT;
|
|
239
264
|
else if (c === Char.openBracket)
|
|
240
|
-
this.state =
|
|
265
|
+
this.state = STATE.OPEN_ARRAY;
|
|
241
266
|
else if (!isWhitespace(c)) {
|
|
242
267
|
this._error("Non-whitespace before {[.");
|
|
243
268
|
}
|
|
244
269
|
continue;
|
|
245
|
-
case
|
|
246
|
-
case
|
|
270
|
+
case STATE.OPEN_KEY:
|
|
271
|
+
case STATE.OPEN_OBJECT:
|
|
247
272
|
if (isWhitespace(c))
|
|
248
273
|
continue;
|
|
249
|
-
if (this.state ===
|
|
250
|
-
this.stack.push(
|
|
274
|
+
if (this.state === STATE.OPEN_KEY)
|
|
275
|
+
this.stack.push(STATE.CLOSE_KEY);
|
|
251
276
|
else if (c === Char.closeBrace) {
|
|
252
277
|
this.emit("onopenobject");
|
|
253
278
|
this.depth++;
|
|
254
279
|
this.emit("oncloseobject");
|
|
255
280
|
this.depth--;
|
|
256
|
-
this.state = this.stack.pop() ||
|
|
281
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
257
282
|
continue;
|
|
258
283
|
} else
|
|
259
|
-
this.stack.push(
|
|
284
|
+
this.stack.push(STATE.CLOSE_OBJECT);
|
|
260
285
|
if (c === Char.doubleQuote)
|
|
261
|
-
this.state =
|
|
286
|
+
this.state = STATE.STRING;
|
|
262
287
|
else
|
|
263
288
|
this._error('Malformed object key should start with "');
|
|
264
289
|
continue;
|
|
265
|
-
case
|
|
266
|
-
case
|
|
290
|
+
case STATE.CLOSE_KEY:
|
|
291
|
+
case STATE.CLOSE_OBJECT:
|
|
267
292
|
if (isWhitespace(c))
|
|
268
293
|
continue;
|
|
269
294
|
if (c === Char.colon) {
|
|
270
|
-
if (this.state ===
|
|
271
|
-
this.stack.push(
|
|
295
|
+
if (this.state === STATE.CLOSE_OBJECT) {
|
|
296
|
+
this.stack.push(STATE.CLOSE_OBJECT);
|
|
272
297
|
this._closeValue("onopenobject");
|
|
273
298
|
this.depth++;
|
|
274
299
|
} else
|
|
275
300
|
this._closeValue("onkey");
|
|
276
|
-
this.state =
|
|
301
|
+
this.state = STATE.VALUE;
|
|
277
302
|
} else if (c === Char.closeBrace) {
|
|
278
303
|
this.emitNode("oncloseobject");
|
|
279
304
|
this.depth--;
|
|
280
|
-
this.state = this.stack.pop() ||
|
|
305
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
281
306
|
} else if (c === Char.comma) {
|
|
282
|
-
if (this.state ===
|
|
283
|
-
this.stack.push(
|
|
307
|
+
if (this.state === STATE.CLOSE_OBJECT)
|
|
308
|
+
this.stack.push(STATE.CLOSE_OBJECT);
|
|
284
309
|
this._closeValue();
|
|
285
|
-
this.state =
|
|
310
|
+
this.state = STATE.OPEN_KEY;
|
|
286
311
|
} else
|
|
287
312
|
this._error("Bad object");
|
|
288
313
|
continue;
|
|
289
|
-
case
|
|
290
|
-
case
|
|
314
|
+
case STATE.OPEN_ARRAY:
|
|
315
|
+
case STATE.VALUE:
|
|
291
316
|
if (isWhitespace(c))
|
|
292
317
|
continue;
|
|
293
|
-
if (this.state ===
|
|
318
|
+
if (this.state === STATE.OPEN_ARRAY) {
|
|
294
319
|
this.emit("onopenarray");
|
|
295
320
|
this.depth++;
|
|
296
|
-
this.state =
|
|
321
|
+
this.state = STATE.VALUE;
|
|
297
322
|
if (c === Char.closeBracket) {
|
|
298
323
|
this.emit("onclosearray");
|
|
299
324
|
this.depth--;
|
|
300
|
-
this.state = this.stack.pop() ||
|
|
325
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
301
326
|
continue;
|
|
302
327
|
} else {
|
|
303
|
-
this.stack.push(
|
|
328
|
+
this.stack.push(STATE.CLOSE_ARRAY);
|
|
304
329
|
}
|
|
305
330
|
}
|
|
306
331
|
if (c === Char.doubleQuote)
|
|
307
|
-
this.state =
|
|
332
|
+
this.state = STATE.STRING;
|
|
308
333
|
else if (c === Char.openBrace)
|
|
309
|
-
this.state =
|
|
334
|
+
this.state = STATE.OPEN_OBJECT;
|
|
310
335
|
else if (c === Char.openBracket)
|
|
311
|
-
this.state =
|
|
336
|
+
this.state = STATE.OPEN_ARRAY;
|
|
312
337
|
else if (c === Char.t)
|
|
313
|
-
this.state =
|
|
338
|
+
this.state = STATE.TRUE;
|
|
314
339
|
else if (c === Char.f)
|
|
315
|
-
this.state =
|
|
340
|
+
this.state = STATE.FALSE;
|
|
316
341
|
else if (c === Char.n)
|
|
317
|
-
this.state =
|
|
342
|
+
this.state = STATE.NULL;
|
|
318
343
|
else if (c === Char.minus) {
|
|
319
344
|
this.numberNode += "-";
|
|
320
345
|
} else if (Char._0 <= c && c <= Char._9) {
|
|
321
346
|
this.numberNode += String.fromCharCode(c);
|
|
322
|
-
this.state =
|
|
347
|
+
this.state = STATE.NUMBER_DIGIT;
|
|
323
348
|
} else
|
|
324
349
|
this._error("Bad value");
|
|
325
350
|
continue;
|
|
326
|
-
case
|
|
351
|
+
case STATE.CLOSE_ARRAY:
|
|
327
352
|
if (c === Char.comma) {
|
|
328
|
-
this.stack.push(
|
|
353
|
+
this.stack.push(STATE.CLOSE_ARRAY);
|
|
329
354
|
this._closeValue("onvalue");
|
|
330
|
-
this.state =
|
|
355
|
+
this.state = STATE.VALUE;
|
|
331
356
|
} else if (c === Char.closeBracket) {
|
|
332
357
|
this.emitNode("onclosearray");
|
|
333
358
|
this.depth--;
|
|
334
|
-
this.state = this.stack.pop() ||
|
|
359
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
335
360
|
} else if (isWhitespace(c))
|
|
336
361
|
continue;
|
|
337
362
|
else
|
|
338
363
|
this._error("Bad array");
|
|
339
364
|
continue;
|
|
340
|
-
case
|
|
365
|
+
case STATE.STRING:
|
|
341
366
|
if (this.textNode === void 0) {
|
|
342
367
|
this.textNode = "";
|
|
343
368
|
}
|
|
@@ -361,7 +386,7 @@ var ClarinetParser = class {
|
|
|
361
386
|
break STRING_BIGLOOP;
|
|
362
387
|
}
|
|
363
388
|
if (c === Char.doubleQuote && !slashed) {
|
|
364
|
-
this.state = this.stack.pop() ||
|
|
389
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
365
390
|
this.textNode += chunk.substring(starti, i - 1);
|
|
366
391
|
this.position += i - 1 - starti;
|
|
367
392
|
break;
|
|
@@ -420,77 +445,77 @@ var ClarinetParser = class {
|
|
|
420
445
|
this.slashed = slashed;
|
|
421
446
|
this.unicodeI = unicodeI;
|
|
422
447
|
continue;
|
|
423
|
-
case
|
|
448
|
+
case STATE.TRUE:
|
|
424
449
|
if (c === Char.r)
|
|
425
|
-
this.state =
|
|
450
|
+
this.state = STATE.TRUE2;
|
|
426
451
|
else
|
|
427
452
|
this._error(`Invalid true started with t${c}`);
|
|
428
453
|
continue;
|
|
429
|
-
case
|
|
454
|
+
case STATE.TRUE2:
|
|
430
455
|
if (c === Char.u)
|
|
431
|
-
this.state =
|
|
456
|
+
this.state = STATE.TRUE3;
|
|
432
457
|
else
|
|
433
458
|
this._error(`Invalid true started with tr${c}`);
|
|
434
459
|
continue;
|
|
435
|
-
case
|
|
460
|
+
case STATE.TRUE3:
|
|
436
461
|
if (c === Char.e) {
|
|
437
462
|
this.emit("onvalue", true);
|
|
438
|
-
this.state = this.stack.pop() ||
|
|
463
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
439
464
|
} else
|
|
440
465
|
this._error(`Invalid true started with tru${c}`);
|
|
441
466
|
continue;
|
|
442
|
-
case
|
|
467
|
+
case STATE.FALSE:
|
|
443
468
|
if (c === Char.a)
|
|
444
|
-
this.state =
|
|
469
|
+
this.state = STATE.FALSE2;
|
|
445
470
|
else
|
|
446
471
|
this._error(`Invalid false started with f${c}`);
|
|
447
472
|
continue;
|
|
448
|
-
case
|
|
473
|
+
case STATE.FALSE2:
|
|
449
474
|
if (c === Char.l)
|
|
450
|
-
this.state =
|
|
475
|
+
this.state = STATE.FALSE3;
|
|
451
476
|
else
|
|
452
477
|
this._error(`Invalid false started with fa${c}`);
|
|
453
478
|
continue;
|
|
454
|
-
case
|
|
479
|
+
case STATE.FALSE3:
|
|
455
480
|
if (c === Char.s)
|
|
456
|
-
this.state =
|
|
481
|
+
this.state = STATE.FALSE4;
|
|
457
482
|
else
|
|
458
483
|
this._error(`Invalid false started with fal${c}`);
|
|
459
484
|
continue;
|
|
460
|
-
case
|
|
485
|
+
case STATE.FALSE4:
|
|
461
486
|
if (c === Char.e) {
|
|
462
487
|
this.emit("onvalue", false);
|
|
463
|
-
this.state = this.stack.pop() ||
|
|
488
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
464
489
|
} else
|
|
465
490
|
this._error(`Invalid false started with fals${c}`);
|
|
466
491
|
continue;
|
|
467
|
-
case
|
|
492
|
+
case STATE.NULL:
|
|
468
493
|
if (c === Char.u)
|
|
469
|
-
this.state =
|
|
494
|
+
this.state = STATE.NULL2;
|
|
470
495
|
else
|
|
471
496
|
this._error(`Invalid null started with n${c}`);
|
|
472
497
|
continue;
|
|
473
|
-
case
|
|
498
|
+
case STATE.NULL2:
|
|
474
499
|
if (c === Char.l)
|
|
475
|
-
this.state =
|
|
500
|
+
this.state = STATE.NULL3;
|
|
476
501
|
else
|
|
477
502
|
this._error(`Invalid null started with nu${c}`);
|
|
478
503
|
continue;
|
|
479
|
-
case
|
|
504
|
+
case STATE.NULL3:
|
|
480
505
|
if (c === Char.l) {
|
|
481
506
|
this.emit("onvalue", null);
|
|
482
|
-
this.state = this.stack.pop() ||
|
|
507
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
483
508
|
} else
|
|
484
509
|
this._error(`Invalid null started with nul${c}`);
|
|
485
510
|
continue;
|
|
486
|
-
case
|
|
511
|
+
case STATE.NUMBER_DECIMAL_POINT:
|
|
487
512
|
if (c === Char.period) {
|
|
488
513
|
this.numberNode += ".";
|
|
489
|
-
this.state =
|
|
514
|
+
this.state = STATE.NUMBER_DIGIT;
|
|
490
515
|
} else
|
|
491
516
|
this._error("Leading zero not followed by .");
|
|
492
517
|
continue;
|
|
493
|
-
case
|
|
518
|
+
case STATE.NUMBER_DIGIT:
|
|
494
519
|
if (Char._0 <= c && c <= Char._9)
|
|
495
520
|
this.numberNode += String.fromCharCode(c);
|
|
496
521
|
else if (c === Char.period) {
|
|
@@ -508,7 +533,7 @@ var ClarinetParser = class {
|
|
|
508
533
|
} else {
|
|
509
534
|
this._closeNumber();
|
|
510
535
|
i--;
|
|
511
|
-
this.state = this.stack.pop() ||
|
|
536
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
512
537
|
}
|
|
513
538
|
continue;
|
|
514
539
|
default:
|
|
@@ -564,7 +589,7 @@ function checkBufferLength(parser) {
|
|
|
564
589
|
parser.bufferCheckPosition = MAX_BUFFER_LENGTH - maxActual + parser.position;
|
|
565
590
|
}
|
|
566
591
|
|
|
567
|
-
//
|
|
592
|
+
// dist/lib/jsonpath/jsonpath.js
|
|
568
593
|
var JSONPath = class {
|
|
569
594
|
constructor(path = null) {
|
|
570
595
|
this.path = ["$"];
|
|
@@ -640,7 +665,7 @@ var JSONPath = class {
|
|
|
640
665
|
}
|
|
641
666
|
};
|
|
642
667
|
|
|
643
|
-
//
|
|
668
|
+
// dist/lib/json-parser/json-parser.js
|
|
644
669
|
var JSONParser = class {
|
|
645
670
|
constructor(options) {
|
|
646
671
|
this.result = void 0;
|
|
@@ -729,7 +754,7 @@ var JSONParser = class {
|
|
|
729
754
|
}
|
|
730
755
|
};
|
|
731
756
|
|
|
732
|
-
//
|
|
757
|
+
// dist/lib/json-parser/streaming-json-parser.js
|
|
733
758
|
var StreamingJSONParser = class extends JSONParser {
|
|
734
759
|
constructor(options = {}) {
|
|
735
760
|
super({
|
|
@@ -814,7 +839,7 @@ var StreamingJSONParser = class extends JSONParser {
|
|
|
814
839
|
}
|
|
815
840
|
};
|
|
816
841
|
|
|
817
|
-
//
|
|
842
|
+
// dist/lib/parsers/parse-json-in-batches.js
|
|
818
843
|
async function* parseJSONInBatches(binaryAsyncIterator, options) {
|
|
819
844
|
var _a;
|
|
820
845
|
const asyncIterator = (0, import_loader_utils.makeTextDecoderIterator)(binaryAsyncIterator);
|
|
@@ -890,8 +915,8 @@ function rebuildJsonObject(batch, data) {
|
|
|
890
915
|
return batch.container;
|
|
891
916
|
}
|
|
892
917
|
|
|
893
|
-
//
|
|
894
|
-
var VERSION =
|
|
918
|
+
// dist/json-loader.js
|
|
919
|
+
var VERSION = true ? "4.2.0-alpha.4" : "latest";
|
|
895
920
|
var JSONLoader = {
|
|
896
921
|
name: "JSON",
|
|
897
922
|
id: "json",
|
|
@@ -925,7 +950,7 @@ function parseInBatches(asyncIterator, options) {
|
|
|
925
950
|
return parseJSONInBatches(asyncIterator, jsonOptions);
|
|
926
951
|
}
|
|
927
952
|
|
|
928
|
-
//
|
|
953
|
+
// dist/lib/parsers/parse-ndjson.js
|
|
929
954
|
var import_schema3 = require("@loaders.gl/schema");
|
|
930
955
|
function parseNDJSONSync(ndjsonText) {
|
|
931
956
|
const lines = ndjsonText.trim().split("\n");
|
|
@@ -939,7 +964,7 @@ function parseNDJSONSync(ndjsonText) {
|
|
|
939
964
|
return (0, import_schema3.makeTableFromData)(parsedLines);
|
|
940
965
|
}
|
|
941
966
|
|
|
942
|
-
//
|
|
967
|
+
// dist/lib/parsers/parse-ndjson-in-batches.js
|
|
943
968
|
var import_schema4 = require("@loaders.gl/schema");
|
|
944
969
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
945
970
|
async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
@@ -971,8 +996,8 @@ async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
|
971
996
|
}
|
|
972
997
|
}
|
|
973
998
|
|
|
974
|
-
//
|
|
975
|
-
var VERSION2 =
|
|
999
|
+
// dist/ndjson-loader.js
|
|
1000
|
+
var VERSION2 = true ? "4.2.0-alpha.4" : "latest";
|
|
976
1001
|
var NDJSONLoader = {
|
|
977
1002
|
name: "NDJSON",
|
|
978
1003
|
id: "ndjson",
|
|
@@ -993,7 +1018,7 @@ var NDJSONLoader = {
|
|
|
993
1018
|
options: {}
|
|
994
1019
|
};
|
|
995
1020
|
|
|
996
|
-
//
|
|
1021
|
+
// dist/lib/encoders/json-encoder.js
|
|
997
1022
|
var import_schema5 = require("@loaders.gl/schema");
|
|
998
1023
|
function encodeTableAsJSON(table, options) {
|
|
999
1024
|
var _a;
|
|
@@ -1006,7 +1031,7 @@ function encodeTableAsJSON(table, options) {
|
|
|
1006
1031
|
return `[${strings.join(",")}]`;
|
|
1007
1032
|
}
|
|
1008
1033
|
|
|
1009
|
-
//
|
|
1034
|
+
// dist/json-writer.js
|
|
1010
1035
|
var JSONWriter = {
|
|
1011
1036
|
id: "json",
|
|
1012
1037
|
version: "latest",
|
|
@@ -1020,9 +1045,9 @@ var JSONWriter = {
|
|
|
1020
1045
|
encodeTextSync: (table, options) => encodeTableAsJSON(table, options)
|
|
1021
1046
|
};
|
|
1022
1047
|
|
|
1023
|
-
//
|
|
1048
|
+
// dist/geojson-loader.js
|
|
1024
1049
|
var import_gis = require("@loaders.gl/gis");
|
|
1025
|
-
var VERSION3 =
|
|
1050
|
+
var VERSION3 = true ? "4.2.0-alpha.4" : "latest";
|
|
1026
1051
|
var GeoJSONWorkerLoader = {
|
|
1027
1052
|
name: "GeoJSON",
|
|
1028
1053
|
id: "geojson",
|
|
@@ -1099,13 +1124,13 @@ async function* makeBinaryGeometryIterator(geojsonIterator) {
|
|
|
1099
1124
|
}
|
|
1100
1125
|
}
|
|
1101
1126
|
|
|
1102
|
-
//
|
|
1127
|
+
// dist/geojson-writer.js
|
|
1103
1128
|
var import_loader_utils3 = require("@loaders.gl/loader-utils");
|
|
1104
1129
|
|
|
1105
|
-
//
|
|
1130
|
+
// dist/lib/encoders/geojson-encoder.js
|
|
1106
1131
|
var import_schema8 = require("@loaders.gl/schema");
|
|
1107
1132
|
|
|
1108
|
-
//
|
|
1133
|
+
// dist/lib/encoder-utils/encode-utils.js
|
|
1109
1134
|
var import_schema6 = require("@loaders.gl/schema");
|
|
1110
1135
|
function detectGeometryColumnIndex(table) {
|
|
1111
1136
|
var _a;
|
|
@@ -1136,7 +1161,7 @@ function getRowPropertyObject(table, row, excludeColumnIndices = []) {
|
|
|
1136
1161
|
return properties;
|
|
1137
1162
|
}
|
|
1138
1163
|
|
|
1139
|
-
//
|
|
1164
|
+
// dist/lib/encoder-utils/encode-table-row.js
|
|
1140
1165
|
var import_schema7 = require("@loaders.gl/schema");
|
|
1141
1166
|
function encodeTableRow(table, rowIndex, geometryColumnIndex, utf8Encoder) {
|
|
1142
1167
|
const row = (0, import_schema7.getTableRowAsObject)(table, rowIndex);
|
|
@@ -1170,7 +1195,7 @@ function getFeatureFromRow(table, row, geometryColumnIndex) {
|
|
|
1170
1195
|
return { type: "Feature", geometry: featureOrGeometry, properties };
|
|
1171
1196
|
}
|
|
1172
1197
|
|
|
1173
|
-
//
|
|
1198
|
+
// dist/lib/encoder-utils/utf8-encoder.js
|
|
1174
1199
|
var Utf8ArrayBufferEncoder = class {
|
|
1175
1200
|
constructor(chunkSize) {
|
|
1176
1201
|
this.strings = [];
|
|
@@ -1198,7 +1223,7 @@ var Utf8ArrayBufferEncoder = class {
|
|
|
1198
1223
|
}
|
|
1199
1224
|
};
|
|
1200
1225
|
|
|
1201
|
-
//
|
|
1226
|
+
// dist/lib/encoders/geojson-encoder.js
|
|
1202
1227
|
async function* encodeTableAsGeojsonInBatches(batchIterator, inputOpts = {}) {
|
|
1203
1228
|
const options = { geojson: {}, chunkSize: 1e4, ...inputOpts };
|
|
1204
1229
|
const utf8Encoder = new Utf8ArrayBufferEncoder(options.chunkSize);
|
|
@@ -1239,7 +1264,7 @@ async function* encodeTableAsGeojsonInBatches(batchIterator, inputOpts = {}) {
|
|
|
1239
1264
|
yield utf8Encoder.getArrayBufferBatch();
|
|
1240
1265
|
}
|
|
1241
1266
|
|
|
1242
|
-
//
|
|
1267
|
+
// dist/geojson-writer.js
|
|
1243
1268
|
var GeoJSONWriter = {
|
|
1244
1269
|
id: "geojson",
|
|
1245
1270
|
version: "latest",
|
|
@@ -1261,3 +1286,4 @@ var GeoJSONWriter = {
|
|
|
1261
1286
|
},
|
|
1262
1287
|
encodeInBatches: (tableIterator, options) => encodeTableAsGeojsonInBatches(tableIterator, options)
|
|
1263
1288
|
};
|
|
1289
|
+
//# sourceMappingURL=index.cjs.map
|