@loaders.gl/xml 4.2.0-alpha.5 → 4.2.0-beta.1
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 +143 -121
- package/dist/dist.min.js +8 -8
- package/dist/html-loader.d.ts +1 -2
- package/dist/html-loader.d.ts.map +1 -1
- package/dist/index.cjs +144 -121
- package/dist/index.cjs.map +2 -2
- package/dist/lib/parsers/streaming-xml-parser.js +4 -3
- package/dist/sax-ts/sax.js +100 -85
- package/dist/xml-loader.d.ts +2 -2
- package/dist/xml-loader.d.ts.map +1 -1
- package/dist/xml-loader.js +3 -1
- package/package.json +4 -4
- package/src/html-loader.ts +2 -2
- package/src/xml-loader.ts +4 -2
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
return to;
|
|
17
18
|
};
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
19
24
|
|
|
20
25
|
// dist/index.js
|
|
21
26
|
var dist_exports = {};
|
|
@@ -380,124 +385,140 @@ Object.keys(ENTITIES).forEach((key) => {
|
|
|
380
385
|
ENTITIES[key] = typeof e === "number" ? String.fromCharCode(e) : e;
|
|
381
386
|
});
|
|
382
387
|
var SAX = class {
|
|
388
|
+
EVENTS = EVENTS;
|
|
389
|
+
ENTITIES = {
|
|
390
|
+
// TODO: make it readonly, needed for entity-mega test
|
|
391
|
+
// amp, gt, lt, quot and apos are resolved to strings instead of numerical
|
|
392
|
+
// codes, IDK why
|
|
393
|
+
...ENTITIES
|
|
394
|
+
};
|
|
395
|
+
XML_ENTITIES = {
|
|
396
|
+
amp: "&",
|
|
397
|
+
gt: ">",
|
|
398
|
+
lt: "<",
|
|
399
|
+
quot: '"',
|
|
400
|
+
apos: "'"
|
|
401
|
+
};
|
|
402
|
+
S = 0;
|
|
403
|
+
opt;
|
|
404
|
+
trackPosition = false;
|
|
405
|
+
column = 0;
|
|
406
|
+
line = 0;
|
|
407
|
+
c = "";
|
|
408
|
+
error;
|
|
409
|
+
q = "";
|
|
410
|
+
bufferCheckPosition;
|
|
411
|
+
closed = false;
|
|
412
|
+
tags = [];
|
|
413
|
+
looseCase = "";
|
|
414
|
+
closedRoot = false;
|
|
415
|
+
sawRoot = false;
|
|
416
|
+
strict = false;
|
|
417
|
+
tag;
|
|
418
|
+
strictEntities;
|
|
419
|
+
state;
|
|
420
|
+
noscript = false;
|
|
421
|
+
attribList = [];
|
|
422
|
+
ns;
|
|
423
|
+
position = 0;
|
|
424
|
+
STATE = {
|
|
425
|
+
BEGIN: this.S++,
|
|
426
|
+
// leading byte order mark or whitespace
|
|
427
|
+
BEGIN_WHITESPACE: this.S++,
|
|
428
|
+
// leading whitespace
|
|
429
|
+
TEXT: this.S++,
|
|
430
|
+
// general stuff
|
|
431
|
+
TEXT_ENTITY: this.S++,
|
|
432
|
+
// & and such.
|
|
433
|
+
OPEN_WAKA: this.S++,
|
|
434
|
+
// <
|
|
435
|
+
SGML_DECL: this.S++,
|
|
436
|
+
// <!BLARG
|
|
437
|
+
SGML_DECL_QUOTED: this.S++,
|
|
438
|
+
// <!BLARG foo "bar
|
|
439
|
+
DOCTYPE: this.S++,
|
|
440
|
+
// <!DOCTYPE
|
|
441
|
+
DOCTYPE_QUOTED: this.S++,
|
|
442
|
+
// <!DOCTYPE "//blah
|
|
443
|
+
DOCTYPE_DTD: this.S++,
|
|
444
|
+
// <!DOCTYPE "//blah" [ ...
|
|
445
|
+
DOCTYPE_DTD_QUOTED: this.S++,
|
|
446
|
+
// <!DOCTYPE "//blah" [ "foo
|
|
447
|
+
COMMENT_STARTING: this.S++,
|
|
448
|
+
// <!-
|
|
449
|
+
COMMENT: this.S++,
|
|
450
|
+
// <!--
|
|
451
|
+
COMMENT_ENDING: this.S++,
|
|
452
|
+
// <!-- blah -
|
|
453
|
+
COMMENT_ENDED: this.S++,
|
|
454
|
+
// <!-- blah --
|
|
455
|
+
CDATA: this.S++,
|
|
456
|
+
// <![CDATA[ something
|
|
457
|
+
CDATA_ENDING: this.S++,
|
|
458
|
+
// ]
|
|
459
|
+
CDATA_ENDING_2: this.S++,
|
|
460
|
+
// ]]
|
|
461
|
+
PROC_INST: this.S++,
|
|
462
|
+
// <?hi
|
|
463
|
+
PROC_INST_BODY: this.S++,
|
|
464
|
+
// <?hi there
|
|
465
|
+
PROC_INST_ENDING: this.S++,
|
|
466
|
+
// <?hi "there" ?
|
|
467
|
+
OPEN_TAG: this.S++,
|
|
468
|
+
// <strong
|
|
469
|
+
OPEN_TAG_SLASH: this.S++,
|
|
470
|
+
// <strong /
|
|
471
|
+
ATTRIB: this.S++,
|
|
472
|
+
// <a
|
|
473
|
+
ATTRIB_NAME: this.S++,
|
|
474
|
+
// <a foo
|
|
475
|
+
ATTRIB_NAME_SAW_WHITE: this.S++,
|
|
476
|
+
// <a foo _
|
|
477
|
+
ATTRIB_VALUE: this.S++,
|
|
478
|
+
// <a foo=
|
|
479
|
+
ATTRIB_VALUE_QUOTED: this.S++,
|
|
480
|
+
// <a foo="bar
|
|
481
|
+
ATTRIB_VALUE_CLOSED: this.S++,
|
|
482
|
+
// <a foo="bar"
|
|
483
|
+
ATTRIB_VALUE_UNQUOTED: this.S++,
|
|
484
|
+
// <a foo=bar
|
|
485
|
+
ATTRIB_VALUE_ENTITY_Q: this.S++,
|
|
486
|
+
// <foo bar="""
|
|
487
|
+
ATTRIB_VALUE_ENTITY_U: this.S++,
|
|
488
|
+
// <foo bar="
|
|
489
|
+
CLOSE_TAG: this.S++,
|
|
490
|
+
// </a
|
|
491
|
+
CLOSE_TAG_SAW_WHITE: this.S++,
|
|
492
|
+
// </a >
|
|
493
|
+
SCRIPT: this.S++,
|
|
494
|
+
// <script> ...
|
|
495
|
+
SCRIPT_ENDING: this.S++
|
|
496
|
+
// <script> ... <
|
|
497
|
+
};
|
|
498
|
+
BUFFERS = BUFFERS;
|
|
499
|
+
// private parser: (strict: boolean, opt: any) => SAXParser;
|
|
500
|
+
CDATA = "[CDATA[";
|
|
501
|
+
DOCTYPE = "DOCTYPE";
|
|
502
|
+
XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
|
|
503
|
+
XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
|
|
504
|
+
rootNS = {
|
|
505
|
+
xml: this.XML_NAMESPACE,
|
|
506
|
+
xmlns: this.XMLNS_NAMESPACE
|
|
507
|
+
};
|
|
508
|
+
comment;
|
|
509
|
+
sgmlDecl;
|
|
510
|
+
textNode = "";
|
|
511
|
+
tagName;
|
|
512
|
+
doctype;
|
|
513
|
+
procInstName;
|
|
514
|
+
procInstBody;
|
|
515
|
+
entity = "";
|
|
516
|
+
attribName;
|
|
517
|
+
attribValue;
|
|
518
|
+
cdata = "";
|
|
519
|
+
script = "";
|
|
520
|
+
startTagPosition = 0;
|
|
383
521
|
constructor() {
|
|
384
|
-
this.EVENTS = EVENTS;
|
|
385
|
-
this.ENTITIES = {
|
|
386
|
-
// TODO: make it readonly, needed for entity-mega test
|
|
387
|
-
// amp, gt, lt, quot and apos are resolved to strings instead of numerical
|
|
388
|
-
// codes, IDK why
|
|
389
|
-
...ENTITIES
|
|
390
|
-
};
|
|
391
|
-
this.XML_ENTITIES = {
|
|
392
|
-
amp: "&",
|
|
393
|
-
gt: ">",
|
|
394
|
-
lt: "<",
|
|
395
|
-
quot: '"',
|
|
396
|
-
apos: "'"
|
|
397
|
-
};
|
|
398
|
-
this.S = 0;
|
|
399
|
-
this.trackPosition = false;
|
|
400
|
-
this.column = 0;
|
|
401
|
-
this.line = 0;
|
|
402
|
-
this.c = "";
|
|
403
|
-
this.q = "";
|
|
404
|
-
this.closed = false;
|
|
405
|
-
this.tags = [];
|
|
406
|
-
this.looseCase = "";
|
|
407
|
-
this.closedRoot = false;
|
|
408
|
-
this.sawRoot = false;
|
|
409
|
-
this.strict = false;
|
|
410
|
-
this.noscript = false;
|
|
411
|
-
this.attribList = [];
|
|
412
|
-
this.position = 0;
|
|
413
|
-
this.STATE = {
|
|
414
|
-
BEGIN: this.S++,
|
|
415
|
-
// leading byte order mark or whitespace
|
|
416
|
-
BEGIN_WHITESPACE: this.S++,
|
|
417
|
-
// leading whitespace
|
|
418
|
-
TEXT: this.S++,
|
|
419
|
-
// general stuff
|
|
420
|
-
TEXT_ENTITY: this.S++,
|
|
421
|
-
// & and such.
|
|
422
|
-
OPEN_WAKA: this.S++,
|
|
423
|
-
// <
|
|
424
|
-
SGML_DECL: this.S++,
|
|
425
|
-
// <!BLARG
|
|
426
|
-
SGML_DECL_QUOTED: this.S++,
|
|
427
|
-
// <!BLARG foo "bar
|
|
428
|
-
DOCTYPE: this.S++,
|
|
429
|
-
// <!DOCTYPE
|
|
430
|
-
DOCTYPE_QUOTED: this.S++,
|
|
431
|
-
// <!DOCTYPE "//blah
|
|
432
|
-
DOCTYPE_DTD: this.S++,
|
|
433
|
-
// <!DOCTYPE "//blah" [ ...
|
|
434
|
-
DOCTYPE_DTD_QUOTED: this.S++,
|
|
435
|
-
// <!DOCTYPE "//blah" [ "foo
|
|
436
|
-
COMMENT_STARTING: this.S++,
|
|
437
|
-
// <!-
|
|
438
|
-
COMMENT: this.S++,
|
|
439
|
-
// <!--
|
|
440
|
-
COMMENT_ENDING: this.S++,
|
|
441
|
-
// <!-- blah -
|
|
442
|
-
COMMENT_ENDED: this.S++,
|
|
443
|
-
// <!-- blah --
|
|
444
|
-
CDATA: this.S++,
|
|
445
|
-
// <![CDATA[ something
|
|
446
|
-
CDATA_ENDING: this.S++,
|
|
447
|
-
// ]
|
|
448
|
-
CDATA_ENDING_2: this.S++,
|
|
449
|
-
// ]]
|
|
450
|
-
PROC_INST: this.S++,
|
|
451
|
-
// <?hi
|
|
452
|
-
PROC_INST_BODY: this.S++,
|
|
453
|
-
// <?hi there
|
|
454
|
-
PROC_INST_ENDING: this.S++,
|
|
455
|
-
// <?hi "there" ?
|
|
456
|
-
OPEN_TAG: this.S++,
|
|
457
|
-
// <strong
|
|
458
|
-
OPEN_TAG_SLASH: this.S++,
|
|
459
|
-
// <strong /
|
|
460
|
-
ATTRIB: this.S++,
|
|
461
|
-
// <a
|
|
462
|
-
ATTRIB_NAME: this.S++,
|
|
463
|
-
// <a foo
|
|
464
|
-
ATTRIB_NAME_SAW_WHITE: this.S++,
|
|
465
|
-
// <a foo _
|
|
466
|
-
ATTRIB_VALUE: this.S++,
|
|
467
|
-
// <a foo=
|
|
468
|
-
ATTRIB_VALUE_QUOTED: this.S++,
|
|
469
|
-
// <a foo="bar
|
|
470
|
-
ATTRIB_VALUE_CLOSED: this.S++,
|
|
471
|
-
// <a foo="bar"
|
|
472
|
-
ATTRIB_VALUE_UNQUOTED: this.S++,
|
|
473
|
-
// <a foo=bar
|
|
474
|
-
ATTRIB_VALUE_ENTITY_Q: this.S++,
|
|
475
|
-
// <foo bar="""
|
|
476
|
-
ATTRIB_VALUE_ENTITY_U: this.S++,
|
|
477
|
-
// <foo bar="
|
|
478
|
-
CLOSE_TAG: this.S++,
|
|
479
|
-
// </a
|
|
480
|
-
CLOSE_TAG_SAW_WHITE: this.S++,
|
|
481
|
-
// </a >
|
|
482
|
-
SCRIPT: this.S++,
|
|
483
|
-
// <script> ...
|
|
484
|
-
SCRIPT_ENDING: this.S++
|
|
485
|
-
// <script> ... <
|
|
486
|
-
};
|
|
487
|
-
this.BUFFERS = BUFFERS;
|
|
488
|
-
this.CDATA = "[CDATA[";
|
|
489
|
-
this.DOCTYPE = "DOCTYPE";
|
|
490
|
-
this.XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
|
|
491
|
-
this.XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
|
|
492
|
-
this.rootNS = {
|
|
493
|
-
xml: this.XML_NAMESPACE,
|
|
494
|
-
xmlns: this.XMLNS_NAMESPACE
|
|
495
|
-
};
|
|
496
|
-
this.textNode = "";
|
|
497
|
-
this.entity = "";
|
|
498
|
-
this.cdata = "";
|
|
499
|
-
this.script = "";
|
|
500
|
-
this.startTagPosition = 0;
|
|
501
522
|
this.S = 0;
|
|
502
523
|
for (const s in this.STATE) {
|
|
503
524
|
if (this.STATE.hasOwnProperty(s)) {
|
|
@@ -1352,10 +1373,10 @@ Actual: ${this.attribValue}`);
|
|
|
1352
1373
|
}
|
|
1353
1374
|
};
|
|
1354
1375
|
var SAXParser = class extends SAX {
|
|
1376
|
+
opt = DEFAULT_SAX_PARSER_OPTIONS;
|
|
1377
|
+
events = DEFAULT_SAX_EVENTS;
|
|
1355
1378
|
constructor(opt) {
|
|
1356
1379
|
super();
|
|
1357
|
-
this.opt = DEFAULT_SAX_PARSER_OPTIONS;
|
|
1358
|
-
this.events = DEFAULT_SAX_EVENTS;
|
|
1359
1380
|
this.clearBuffers();
|
|
1360
1381
|
this.opt = opt = { ...this.opt, ...opt };
|
|
1361
1382
|
this.events = { ...this.events, ...opt };
|
|
@@ -1392,7 +1413,7 @@ var SAXParser = class extends SAX {
|
|
|
1392
1413
|
this.flushBuffers();
|
|
1393
1414
|
}
|
|
1394
1415
|
};
|
|
1395
|
-
SAXParser
|
|
1416
|
+
__publicField(SAXParser, "ENTITIES", ENTITIES);
|
|
1396
1417
|
|
|
1397
1418
|
// dist/lib/xml-utils/uncapitalize.js
|
|
1398
1419
|
function uncapitalize(str) {
|
|
@@ -1451,8 +1472,10 @@ function fastParseXML(text, options) {
|
|
|
1451
1472
|
}
|
|
1452
1473
|
|
|
1453
1474
|
// dist/xml-loader.js
|
|
1454
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
1475
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
1455
1476
|
var XMLLoader = {
|
|
1477
|
+
dataType: null,
|
|
1478
|
+
batchType: null,
|
|
1456
1479
|
name: "XML",
|
|
1457
1480
|
id: "xml",
|
|
1458
1481
|
module: "xml",
|