@loaders.gl/json 4.2.0-alpha.4 → 4.2.0-alpha.6
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 +319 -366
- 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 +78 -54
- package/dist/geojson-writer.js +23 -20
- package/dist/index.cjs +155 -121
- 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 +513 -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 +26 -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 +86 -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 +87 -63
- package/dist/lib/jsonpath/jsonpath.js +78 -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
|
|
@@ -150,34 +177,36 @@ var DEFAULT_OPTIONS = {
|
|
|
150
177
|
}
|
|
151
178
|
};
|
|
152
179
|
var ClarinetParser = class {
|
|
180
|
+
options = DEFAULT_OPTIONS;
|
|
181
|
+
bufferCheckPosition = MAX_BUFFER_LENGTH;
|
|
182
|
+
q = "";
|
|
183
|
+
c = "";
|
|
184
|
+
p = "";
|
|
185
|
+
closed = false;
|
|
186
|
+
closedRoot = false;
|
|
187
|
+
sawRoot = false;
|
|
188
|
+
// tag = null;
|
|
189
|
+
error = null;
|
|
190
|
+
state = STATE.BEGIN;
|
|
191
|
+
stack = [];
|
|
192
|
+
// mostly just for error reporting
|
|
193
|
+
position = 0;
|
|
194
|
+
column = 0;
|
|
195
|
+
line = 1;
|
|
196
|
+
slashed = false;
|
|
197
|
+
unicodeI = 0;
|
|
198
|
+
unicodeS = null;
|
|
199
|
+
depth = 0;
|
|
200
|
+
textNode;
|
|
201
|
+
numberNode;
|
|
153
202
|
constructor(options = {}) {
|
|
154
|
-
this.options = DEFAULT_OPTIONS;
|
|
155
|
-
this.bufferCheckPosition = MAX_BUFFER_LENGTH;
|
|
156
|
-
this.q = "";
|
|
157
|
-
this.c = "";
|
|
158
|
-
this.p = "";
|
|
159
|
-
this.closed = false;
|
|
160
|
-
this.closedRoot = false;
|
|
161
|
-
this.sawRoot = false;
|
|
162
|
-
// tag = null;
|
|
163
|
-
this.error = null;
|
|
164
|
-
this.state = 0 /* BEGIN */;
|
|
165
|
-
this.stack = [];
|
|
166
|
-
// mostly just for error reporting
|
|
167
|
-
this.position = 0;
|
|
168
|
-
this.column = 0;
|
|
169
|
-
this.line = 1;
|
|
170
|
-
this.slashed = false;
|
|
171
|
-
this.unicodeI = 0;
|
|
172
|
-
this.unicodeS = null;
|
|
173
|
-
this.depth = 0;
|
|
174
203
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
175
204
|
this.textNode = void 0;
|
|
176
205
|
this.numberNode = "";
|
|
177
206
|
this.emit("onready");
|
|
178
207
|
}
|
|
179
208
|
end() {
|
|
180
|
-
if (this.state !==
|
|
209
|
+
if (this.state !== STATE.VALUE || this.depth !== 0)
|
|
181
210
|
this._error("Unexpected end");
|
|
182
211
|
this._closeValue();
|
|
183
212
|
this.c = "";
|
|
@@ -233,111 +262,111 @@ var ClarinetParser = class {
|
|
|
233
262
|
} else
|
|
234
263
|
this.column++;
|
|
235
264
|
switch (this.state) {
|
|
236
|
-
case
|
|
265
|
+
case STATE.BEGIN:
|
|
237
266
|
if (c === Char.openBrace)
|
|
238
|
-
this.state =
|
|
267
|
+
this.state = STATE.OPEN_OBJECT;
|
|
239
268
|
else if (c === Char.openBracket)
|
|
240
|
-
this.state =
|
|
269
|
+
this.state = STATE.OPEN_ARRAY;
|
|
241
270
|
else if (!isWhitespace(c)) {
|
|
242
271
|
this._error("Non-whitespace before {[.");
|
|
243
272
|
}
|
|
244
273
|
continue;
|
|
245
|
-
case
|
|
246
|
-
case
|
|
274
|
+
case STATE.OPEN_KEY:
|
|
275
|
+
case STATE.OPEN_OBJECT:
|
|
247
276
|
if (isWhitespace(c))
|
|
248
277
|
continue;
|
|
249
|
-
if (this.state ===
|
|
250
|
-
this.stack.push(
|
|
278
|
+
if (this.state === STATE.OPEN_KEY)
|
|
279
|
+
this.stack.push(STATE.CLOSE_KEY);
|
|
251
280
|
else if (c === Char.closeBrace) {
|
|
252
281
|
this.emit("onopenobject");
|
|
253
282
|
this.depth++;
|
|
254
283
|
this.emit("oncloseobject");
|
|
255
284
|
this.depth--;
|
|
256
|
-
this.state = this.stack.pop() ||
|
|
285
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
257
286
|
continue;
|
|
258
287
|
} else
|
|
259
|
-
this.stack.push(
|
|
288
|
+
this.stack.push(STATE.CLOSE_OBJECT);
|
|
260
289
|
if (c === Char.doubleQuote)
|
|
261
|
-
this.state =
|
|
290
|
+
this.state = STATE.STRING;
|
|
262
291
|
else
|
|
263
292
|
this._error('Malformed object key should start with "');
|
|
264
293
|
continue;
|
|
265
|
-
case
|
|
266
|
-
case
|
|
294
|
+
case STATE.CLOSE_KEY:
|
|
295
|
+
case STATE.CLOSE_OBJECT:
|
|
267
296
|
if (isWhitespace(c))
|
|
268
297
|
continue;
|
|
269
298
|
if (c === Char.colon) {
|
|
270
|
-
if (this.state ===
|
|
271
|
-
this.stack.push(
|
|
299
|
+
if (this.state === STATE.CLOSE_OBJECT) {
|
|
300
|
+
this.stack.push(STATE.CLOSE_OBJECT);
|
|
272
301
|
this._closeValue("onopenobject");
|
|
273
302
|
this.depth++;
|
|
274
303
|
} else
|
|
275
304
|
this._closeValue("onkey");
|
|
276
|
-
this.state =
|
|
305
|
+
this.state = STATE.VALUE;
|
|
277
306
|
} else if (c === Char.closeBrace) {
|
|
278
307
|
this.emitNode("oncloseobject");
|
|
279
308
|
this.depth--;
|
|
280
|
-
this.state = this.stack.pop() ||
|
|
309
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
281
310
|
} else if (c === Char.comma) {
|
|
282
|
-
if (this.state ===
|
|
283
|
-
this.stack.push(
|
|
311
|
+
if (this.state === STATE.CLOSE_OBJECT)
|
|
312
|
+
this.stack.push(STATE.CLOSE_OBJECT);
|
|
284
313
|
this._closeValue();
|
|
285
|
-
this.state =
|
|
314
|
+
this.state = STATE.OPEN_KEY;
|
|
286
315
|
} else
|
|
287
316
|
this._error("Bad object");
|
|
288
317
|
continue;
|
|
289
|
-
case
|
|
290
|
-
case
|
|
318
|
+
case STATE.OPEN_ARRAY:
|
|
319
|
+
case STATE.VALUE:
|
|
291
320
|
if (isWhitespace(c))
|
|
292
321
|
continue;
|
|
293
|
-
if (this.state ===
|
|
322
|
+
if (this.state === STATE.OPEN_ARRAY) {
|
|
294
323
|
this.emit("onopenarray");
|
|
295
324
|
this.depth++;
|
|
296
|
-
this.state =
|
|
325
|
+
this.state = STATE.VALUE;
|
|
297
326
|
if (c === Char.closeBracket) {
|
|
298
327
|
this.emit("onclosearray");
|
|
299
328
|
this.depth--;
|
|
300
|
-
this.state = this.stack.pop() ||
|
|
329
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
301
330
|
continue;
|
|
302
331
|
} else {
|
|
303
|
-
this.stack.push(
|
|
332
|
+
this.stack.push(STATE.CLOSE_ARRAY);
|
|
304
333
|
}
|
|
305
334
|
}
|
|
306
335
|
if (c === Char.doubleQuote)
|
|
307
|
-
this.state =
|
|
336
|
+
this.state = STATE.STRING;
|
|
308
337
|
else if (c === Char.openBrace)
|
|
309
|
-
this.state =
|
|
338
|
+
this.state = STATE.OPEN_OBJECT;
|
|
310
339
|
else if (c === Char.openBracket)
|
|
311
|
-
this.state =
|
|
340
|
+
this.state = STATE.OPEN_ARRAY;
|
|
312
341
|
else if (c === Char.t)
|
|
313
|
-
this.state =
|
|
342
|
+
this.state = STATE.TRUE;
|
|
314
343
|
else if (c === Char.f)
|
|
315
|
-
this.state =
|
|
344
|
+
this.state = STATE.FALSE;
|
|
316
345
|
else if (c === Char.n)
|
|
317
|
-
this.state =
|
|
346
|
+
this.state = STATE.NULL;
|
|
318
347
|
else if (c === Char.minus) {
|
|
319
348
|
this.numberNode += "-";
|
|
320
349
|
} else if (Char._0 <= c && c <= Char._9) {
|
|
321
350
|
this.numberNode += String.fromCharCode(c);
|
|
322
|
-
this.state =
|
|
351
|
+
this.state = STATE.NUMBER_DIGIT;
|
|
323
352
|
} else
|
|
324
353
|
this._error("Bad value");
|
|
325
354
|
continue;
|
|
326
|
-
case
|
|
355
|
+
case STATE.CLOSE_ARRAY:
|
|
327
356
|
if (c === Char.comma) {
|
|
328
|
-
this.stack.push(
|
|
357
|
+
this.stack.push(STATE.CLOSE_ARRAY);
|
|
329
358
|
this._closeValue("onvalue");
|
|
330
|
-
this.state =
|
|
359
|
+
this.state = STATE.VALUE;
|
|
331
360
|
} else if (c === Char.closeBracket) {
|
|
332
361
|
this.emitNode("onclosearray");
|
|
333
362
|
this.depth--;
|
|
334
|
-
this.state = this.stack.pop() ||
|
|
363
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
335
364
|
} else if (isWhitespace(c))
|
|
336
365
|
continue;
|
|
337
366
|
else
|
|
338
367
|
this._error("Bad array");
|
|
339
368
|
continue;
|
|
340
|
-
case
|
|
369
|
+
case STATE.STRING:
|
|
341
370
|
if (this.textNode === void 0) {
|
|
342
371
|
this.textNode = "";
|
|
343
372
|
}
|
|
@@ -361,7 +390,7 @@ var ClarinetParser = class {
|
|
|
361
390
|
break STRING_BIGLOOP;
|
|
362
391
|
}
|
|
363
392
|
if (c === Char.doubleQuote && !slashed) {
|
|
364
|
-
this.state = this.stack.pop() ||
|
|
393
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
365
394
|
this.textNode += chunk.substring(starti, i - 1);
|
|
366
395
|
this.position += i - 1 - starti;
|
|
367
396
|
break;
|
|
@@ -420,77 +449,77 @@ var ClarinetParser = class {
|
|
|
420
449
|
this.slashed = slashed;
|
|
421
450
|
this.unicodeI = unicodeI;
|
|
422
451
|
continue;
|
|
423
|
-
case
|
|
452
|
+
case STATE.TRUE:
|
|
424
453
|
if (c === Char.r)
|
|
425
|
-
this.state =
|
|
454
|
+
this.state = STATE.TRUE2;
|
|
426
455
|
else
|
|
427
456
|
this._error(`Invalid true started with t${c}`);
|
|
428
457
|
continue;
|
|
429
|
-
case
|
|
458
|
+
case STATE.TRUE2:
|
|
430
459
|
if (c === Char.u)
|
|
431
|
-
this.state =
|
|
460
|
+
this.state = STATE.TRUE3;
|
|
432
461
|
else
|
|
433
462
|
this._error(`Invalid true started with tr${c}`);
|
|
434
463
|
continue;
|
|
435
|
-
case
|
|
464
|
+
case STATE.TRUE3:
|
|
436
465
|
if (c === Char.e) {
|
|
437
466
|
this.emit("onvalue", true);
|
|
438
|
-
this.state = this.stack.pop() ||
|
|
467
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
439
468
|
} else
|
|
440
469
|
this._error(`Invalid true started with tru${c}`);
|
|
441
470
|
continue;
|
|
442
|
-
case
|
|
471
|
+
case STATE.FALSE:
|
|
443
472
|
if (c === Char.a)
|
|
444
|
-
this.state =
|
|
473
|
+
this.state = STATE.FALSE2;
|
|
445
474
|
else
|
|
446
475
|
this._error(`Invalid false started with f${c}`);
|
|
447
476
|
continue;
|
|
448
|
-
case
|
|
477
|
+
case STATE.FALSE2:
|
|
449
478
|
if (c === Char.l)
|
|
450
|
-
this.state =
|
|
479
|
+
this.state = STATE.FALSE3;
|
|
451
480
|
else
|
|
452
481
|
this._error(`Invalid false started with fa${c}`);
|
|
453
482
|
continue;
|
|
454
|
-
case
|
|
483
|
+
case STATE.FALSE3:
|
|
455
484
|
if (c === Char.s)
|
|
456
|
-
this.state =
|
|
485
|
+
this.state = STATE.FALSE4;
|
|
457
486
|
else
|
|
458
487
|
this._error(`Invalid false started with fal${c}`);
|
|
459
488
|
continue;
|
|
460
|
-
case
|
|
489
|
+
case STATE.FALSE4:
|
|
461
490
|
if (c === Char.e) {
|
|
462
491
|
this.emit("onvalue", false);
|
|
463
|
-
this.state = this.stack.pop() ||
|
|
492
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
464
493
|
} else
|
|
465
494
|
this._error(`Invalid false started with fals${c}`);
|
|
466
495
|
continue;
|
|
467
|
-
case
|
|
496
|
+
case STATE.NULL:
|
|
468
497
|
if (c === Char.u)
|
|
469
|
-
this.state =
|
|
498
|
+
this.state = STATE.NULL2;
|
|
470
499
|
else
|
|
471
500
|
this._error(`Invalid null started with n${c}`);
|
|
472
501
|
continue;
|
|
473
|
-
case
|
|
502
|
+
case STATE.NULL2:
|
|
474
503
|
if (c === Char.l)
|
|
475
|
-
this.state =
|
|
504
|
+
this.state = STATE.NULL3;
|
|
476
505
|
else
|
|
477
506
|
this._error(`Invalid null started with nu${c}`);
|
|
478
507
|
continue;
|
|
479
|
-
case
|
|
508
|
+
case STATE.NULL3:
|
|
480
509
|
if (c === Char.l) {
|
|
481
510
|
this.emit("onvalue", null);
|
|
482
|
-
this.state = this.stack.pop() ||
|
|
511
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
483
512
|
} else
|
|
484
513
|
this._error(`Invalid null started with nul${c}`);
|
|
485
514
|
continue;
|
|
486
|
-
case
|
|
515
|
+
case STATE.NUMBER_DECIMAL_POINT:
|
|
487
516
|
if (c === Char.period) {
|
|
488
517
|
this.numberNode += ".";
|
|
489
|
-
this.state =
|
|
518
|
+
this.state = STATE.NUMBER_DIGIT;
|
|
490
519
|
} else
|
|
491
520
|
this._error("Leading zero not followed by .");
|
|
492
521
|
continue;
|
|
493
|
-
case
|
|
522
|
+
case STATE.NUMBER_DIGIT:
|
|
494
523
|
if (Char._0 <= c && c <= Char._9)
|
|
495
524
|
this.numberNode += String.fromCharCode(c);
|
|
496
525
|
else if (c === Char.period) {
|
|
@@ -508,7 +537,7 @@ var ClarinetParser = class {
|
|
|
508
537
|
} else {
|
|
509
538
|
this._closeNumber();
|
|
510
539
|
i--;
|
|
511
|
-
this.state = this.stack.pop() ||
|
|
540
|
+
this.state = this.stack.pop() || STATE.VALUE;
|
|
512
541
|
}
|
|
513
542
|
continue;
|
|
514
543
|
default:
|
|
@@ -564,8 +593,9 @@ function checkBufferLength(parser) {
|
|
|
564
593
|
parser.bufferCheckPosition = MAX_BUFFER_LENGTH - maxActual + parser.position;
|
|
565
594
|
}
|
|
566
595
|
|
|
567
|
-
//
|
|
596
|
+
// dist/lib/jsonpath/jsonpath.js
|
|
568
597
|
var JSONPath = class {
|
|
598
|
+
path;
|
|
569
599
|
constructor(path = null) {
|
|
570
600
|
this.path = ["$"];
|
|
571
601
|
if (path instanceof JSONPath) {
|
|
@@ -640,13 +670,14 @@ var JSONPath = class {
|
|
|
640
670
|
}
|
|
641
671
|
};
|
|
642
672
|
|
|
643
|
-
//
|
|
673
|
+
// dist/lib/json-parser/json-parser.js
|
|
644
674
|
var JSONParser = class {
|
|
675
|
+
parser;
|
|
676
|
+
result = void 0;
|
|
677
|
+
previousStates = [];
|
|
678
|
+
currentState = Object.freeze({ container: [], key: null });
|
|
679
|
+
jsonpath = new JSONPath();
|
|
645
680
|
constructor(options) {
|
|
646
|
-
this.result = void 0;
|
|
647
|
-
this.previousStates = [];
|
|
648
|
-
this.currentState = Object.freeze({ container: [], key: null });
|
|
649
|
-
this.jsonpath = new JSONPath();
|
|
650
681
|
this.reset();
|
|
651
682
|
this.parser = new ClarinetParser({
|
|
652
683
|
onready: () => {
|
|
@@ -729,8 +760,12 @@ var JSONParser = class {
|
|
|
729
760
|
}
|
|
730
761
|
};
|
|
731
762
|
|
|
732
|
-
//
|
|
763
|
+
// dist/lib/json-parser/streaming-json-parser.js
|
|
733
764
|
var StreamingJSONParser = class extends JSONParser {
|
|
765
|
+
jsonPaths;
|
|
766
|
+
streamingJsonPath = null;
|
|
767
|
+
streamingArray = null;
|
|
768
|
+
topLevelObject = null;
|
|
734
769
|
constructor(options = {}) {
|
|
735
770
|
super({
|
|
736
771
|
onopenarray: () => {
|
|
@@ -757,9 +792,6 @@ var StreamingJSONParser = class extends JSONParser {
|
|
|
757
792
|
}
|
|
758
793
|
}
|
|
759
794
|
});
|
|
760
|
-
this.streamingJsonPath = null;
|
|
761
|
-
this.streamingArray = null;
|
|
762
|
-
this.topLevelObject = null;
|
|
763
795
|
const jsonpaths = options.jsonpaths || [];
|
|
764
796
|
this.jsonPaths = jsonpaths.map((jsonpath) => new JSONPath(jsonpath));
|
|
765
797
|
}
|
|
@@ -814,7 +846,7 @@ var StreamingJSONParser = class extends JSONParser {
|
|
|
814
846
|
}
|
|
815
847
|
};
|
|
816
848
|
|
|
817
|
-
//
|
|
849
|
+
// dist/lib/parsers/parse-json-in-batches.js
|
|
818
850
|
async function* parseJSONInBatches(binaryAsyncIterator, options) {
|
|
819
851
|
var _a;
|
|
820
852
|
const asyncIterator = (0, import_loader_utils.makeTextDecoderIterator)(binaryAsyncIterator);
|
|
@@ -890,8 +922,8 @@ function rebuildJsonObject(batch, data) {
|
|
|
890
922
|
return batch.container;
|
|
891
923
|
}
|
|
892
924
|
|
|
893
|
-
//
|
|
894
|
-
var VERSION =
|
|
925
|
+
// dist/json-loader.js
|
|
926
|
+
var VERSION = true ? "4.2.0-alpha.5" : "latest";
|
|
895
927
|
var JSONLoader = {
|
|
896
928
|
name: "JSON",
|
|
897
929
|
id: "json",
|
|
@@ -925,7 +957,7 @@ function parseInBatches(asyncIterator, options) {
|
|
|
925
957
|
return parseJSONInBatches(asyncIterator, jsonOptions);
|
|
926
958
|
}
|
|
927
959
|
|
|
928
|
-
//
|
|
960
|
+
// dist/lib/parsers/parse-ndjson.js
|
|
929
961
|
var import_schema3 = require("@loaders.gl/schema");
|
|
930
962
|
function parseNDJSONSync(ndjsonText) {
|
|
931
963
|
const lines = ndjsonText.trim().split("\n");
|
|
@@ -939,7 +971,7 @@ function parseNDJSONSync(ndjsonText) {
|
|
|
939
971
|
return (0, import_schema3.makeTableFromData)(parsedLines);
|
|
940
972
|
}
|
|
941
973
|
|
|
942
|
-
//
|
|
974
|
+
// dist/lib/parsers/parse-ndjson-in-batches.js
|
|
943
975
|
var import_schema4 = require("@loaders.gl/schema");
|
|
944
976
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
945
977
|
async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
@@ -971,8 +1003,8 @@ async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
|
971
1003
|
}
|
|
972
1004
|
}
|
|
973
1005
|
|
|
974
|
-
//
|
|
975
|
-
var VERSION2 =
|
|
1006
|
+
// dist/ndjson-loader.js
|
|
1007
|
+
var VERSION2 = true ? "4.2.0-alpha.5" : "latest";
|
|
976
1008
|
var NDJSONLoader = {
|
|
977
1009
|
name: "NDJSON",
|
|
978
1010
|
id: "ndjson",
|
|
@@ -993,7 +1025,7 @@ var NDJSONLoader = {
|
|
|
993
1025
|
options: {}
|
|
994
1026
|
};
|
|
995
1027
|
|
|
996
|
-
//
|
|
1028
|
+
// dist/lib/encoders/json-encoder.js
|
|
997
1029
|
var import_schema5 = require("@loaders.gl/schema");
|
|
998
1030
|
function encodeTableAsJSON(table, options) {
|
|
999
1031
|
var _a;
|
|
@@ -1006,7 +1038,7 @@ function encodeTableAsJSON(table, options) {
|
|
|
1006
1038
|
return `[${strings.join(",")}]`;
|
|
1007
1039
|
}
|
|
1008
1040
|
|
|
1009
|
-
//
|
|
1041
|
+
// dist/json-writer.js
|
|
1010
1042
|
var JSONWriter = {
|
|
1011
1043
|
id: "json",
|
|
1012
1044
|
version: "latest",
|
|
@@ -1020,9 +1052,9 @@ var JSONWriter = {
|
|
|
1020
1052
|
encodeTextSync: (table, options) => encodeTableAsJSON(table, options)
|
|
1021
1053
|
};
|
|
1022
1054
|
|
|
1023
|
-
//
|
|
1055
|
+
// dist/geojson-loader.js
|
|
1024
1056
|
var import_gis = require("@loaders.gl/gis");
|
|
1025
|
-
var VERSION3 =
|
|
1057
|
+
var VERSION3 = true ? "4.2.0-alpha.5" : "latest";
|
|
1026
1058
|
var GeoJSONWorkerLoader = {
|
|
1027
1059
|
name: "GeoJSON",
|
|
1028
1060
|
id: "geojson",
|
|
@@ -1099,13 +1131,13 @@ async function* makeBinaryGeometryIterator(geojsonIterator) {
|
|
|
1099
1131
|
}
|
|
1100
1132
|
}
|
|
1101
1133
|
|
|
1102
|
-
//
|
|
1134
|
+
// dist/geojson-writer.js
|
|
1103
1135
|
var import_loader_utils3 = require("@loaders.gl/loader-utils");
|
|
1104
1136
|
|
|
1105
|
-
//
|
|
1137
|
+
// dist/lib/encoders/geojson-encoder.js
|
|
1106
1138
|
var import_schema8 = require("@loaders.gl/schema");
|
|
1107
1139
|
|
|
1108
|
-
//
|
|
1140
|
+
// dist/lib/encoder-utils/encode-utils.js
|
|
1109
1141
|
var import_schema6 = require("@loaders.gl/schema");
|
|
1110
1142
|
function detectGeometryColumnIndex(table) {
|
|
1111
1143
|
var _a;
|
|
@@ -1136,7 +1168,7 @@ function getRowPropertyObject(table, row, excludeColumnIndices = []) {
|
|
|
1136
1168
|
return properties;
|
|
1137
1169
|
}
|
|
1138
1170
|
|
|
1139
|
-
//
|
|
1171
|
+
// dist/lib/encoder-utils/encode-table-row.js
|
|
1140
1172
|
var import_schema7 = require("@loaders.gl/schema");
|
|
1141
1173
|
function encodeTableRow(table, rowIndex, geometryColumnIndex, utf8Encoder) {
|
|
1142
1174
|
const row = (0, import_schema7.getTableRowAsObject)(table, rowIndex);
|
|
@@ -1170,12 +1202,13 @@ function getFeatureFromRow(table, row, geometryColumnIndex) {
|
|
|
1170
1202
|
return { type: "Feature", geometry: featureOrGeometry, properties };
|
|
1171
1203
|
}
|
|
1172
1204
|
|
|
1173
|
-
//
|
|
1205
|
+
// dist/lib/encoder-utils/utf8-encoder.js
|
|
1174
1206
|
var Utf8ArrayBufferEncoder = class {
|
|
1207
|
+
chunkSize;
|
|
1208
|
+
strings = [];
|
|
1209
|
+
totalLength = 0;
|
|
1210
|
+
textEncoder = new TextEncoder();
|
|
1175
1211
|
constructor(chunkSize) {
|
|
1176
|
-
this.strings = [];
|
|
1177
|
-
this.totalLength = 0;
|
|
1178
|
-
this.textEncoder = new TextEncoder();
|
|
1179
1212
|
this.chunkSize = chunkSize;
|
|
1180
1213
|
}
|
|
1181
1214
|
push(...strings) {
|
|
@@ -1198,7 +1231,7 @@ var Utf8ArrayBufferEncoder = class {
|
|
|
1198
1231
|
}
|
|
1199
1232
|
};
|
|
1200
1233
|
|
|
1201
|
-
//
|
|
1234
|
+
// dist/lib/encoders/geojson-encoder.js
|
|
1202
1235
|
async function* encodeTableAsGeojsonInBatches(batchIterator, inputOpts = {}) {
|
|
1203
1236
|
const options = { geojson: {}, chunkSize: 1e4, ...inputOpts };
|
|
1204
1237
|
const utf8Encoder = new Utf8ArrayBufferEncoder(options.chunkSize);
|
|
@@ -1239,7 +1272,7 @@ async function* encodeTableAsGeojsonInBatches(batchIterator, inputOpts = {}) {
|
|
|
1239
1272
|
yield utf8Encoder.getArrayBufferBatch();
|
|
1240
1273
|
}
|
|
1241
1274
|
|
|
1242
|
-
//
|
|
1275
|
+
// dist/geojson-writer.js
|
|
1243
1276
|
var GeoJSONWriter = {
|
|
1244
1277
|
id: "geojson",
|
|
1245
1278
|
version: "latest",
|
|
@@ -1261,3 +1294,4 @@ var GeoJSONWriter = {
|
|
|
1261
1294
|
},
|
|
1262
1295
|
encodeInBatches: (tableIterator, options) => encodeTableAsGeojsonInBatches(tableIterator, options)
|
|
1263
1296
|
};
|
|
1297
|
+
//# sourceMappingURL=index.cjs.map
|