add build

This commit is contained in:
s2
2019-04-15 11:34:09 +02:00
parent 9d3cd7ec4f
commit 224b6828c7
2948 changed files with 348000 additions and 35 deletions

337
node_modules/saxes/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,337 @@
<a name="3.1.9"></a>
## [3.1.9](https://github.com/lddubeau/saxes/compare/v3.1.7...v3.1.9) (2019-02-25)
### Bug Fixes
* move eslint to devDependencies ([d747538](https://github.com/lddubeau/saxes/commit/d747538))
<a name="3.1.8"></a>
## [3.1.8](https://github.com/lddubeau/saxes/compare/v3.1.7...v3.1.8) (2019-02-25)
<a name="3.1.7"></a>
## [3.1.7](https://github.com/lddubeau/saxes/compare/v3.1.6...v3.1.7) (2019-02-22)
### Bug Fixes
* npm audit warning ([a6c9ba8](https://github.com/lddubeau/saxes/commit/a6c9ba8))
* **typings:** "selfClosing" => "isSelfClosing" ([d96a2bd](https://github.com/lddubeau/saxes/commit/d96a2bd))
<a name="3.1.6"></a>
## [3.1.6](https://github.com/lddubeau/saxes/compare/v3.1.5...v3.1.6) (2019-01-17)
### Bug Fixes
* detect unclosed tags in fragments ([5642f36](https://github.com/lddubeau/saxes/commit/5642f36))
<a name="3.1.5"></a>
## [3.1.5](https://github.com/lddubeau/saxes/compare/v3.1.4...v3.1.5) (2019-01-08)
### Bug Fixes
* generate an error on prefix with empty local name ([89a3b86](https://github.com/lddubeau/saxes/commit/89a3b86)), closes [#5](https://github.com/lddubeau/saxes/issues/5)
<a name="3.1.4"></a>
## [3.1.4](https://github.com/lddubeau/saxes/compare/v3.1.3...v3.1.4) (2018-12-03)
### Bug Fixes
* add fragment and additionalNamespaces to SaxesOption typing ([02d8275](https://github.com/lddubeau/saxes/commit/02d8275))
<a name="3.1.3"></a>
## [3.1.3](https://github.com/lddubeau/saxes/compare/v3.1.2...v3.1.3) (2018-10-01)
### Bug Fixes
* use the latest xmlchars ([b30a714](https://github.com/lddubeau/saxes/commit/b30a714))
### Performance Improvements
* don't check twice if this.textNode is set ([00536cc](https://github.com/lddubeau/saxes/commit/00536cc))
* reduce the frequency at which we clear attribValue ([1570615](https://github.com/lddubeau/saxes/commit/1570615))
<a name="3.1.2"></a>
## [3.1.2](https://github.com/lddubeau/saxes/compare/v3.1.1...v3.1.2) (2018-08-31)
### Bug Fixes
* CDATA end in attributes must not cause an error ([a7495ac](https://github.com/lddubeau/saxes/commit/a7495ac))
* normalize \r\n and \r followed by something else to \n ([d7b1abe](https://github.com/lddubeau/saxes/commit/d7b1abe)), closes [#2](https://github.com/lddubeau/saxes/issues/2)
<a name="3.1.1"></a>
## [3.1.1](https://github.com/lddubeau/saxes/compare/v3.1.0...v3.1.1) (2018-08-29)
### Bug Fixes
* resolve is now part of the public API ([bb4bed5](https://github.com/lddubeau/saxes/commit/bb4bed5))
<a name="3.1.0"></a>
# [3.1.0](https://github.com/lddubeau/saxes/compare/v3.0.0...v3.1.0) (2018-08-28)
### Bug Fixes
* correct typo ([97bc5da](https://github.com/lddubeau/saxes/commit/97bc5da))
### Performance Improvements
* add emitNodes to skip checking text buffer more than needed ([9d5e357](https://github.com/lddubeau/saxes/commit/9d5e357))
* capture names in the ``name`` field ([c7dffd5](https://github.com/lddubeau/saxes/commit/c7dffd5))
* introduce a specialized version of captureWhile ([04855d6](https://github.com/lddubeau/saxes/commit/04855d6))
* introduce captureTo and captureToChar ([76eb95a](https://github.com/lddubeau/saxes/commit/76eb95a))
* remove skipWhitespace ([c8b7ae2](https://github.com/lddubeau/saxes/commit/c8b7ae2))
* remove some redundant buffer resets ([5ded326](https://github.com/lddubeau/saxes/commit/5ded326))
* use charCodeAt and handle surrogates ourselves ([b8ec232](https://github.com/lddubeau/saxes/commit/b8ec232))
<a name="3.0.0"></a>
# [3.0.0](https://github.com/lddubeau/saxes/compare/v2.2.1...v3.0.0) (2018-08-21)
### Features
* process the xmlns attribute the customary way ([2c9672a](https://github.com/lddubeau/saxes/commit/2c9672a))
### BREAKING CHANGES
* In previous versions the attribute `xmlns` (as in `<foo xmlns="some-uri">` would
be reported as having the prefix `"xmlns"` and the local name `""`. This
behavior was inherited from sax. There was some logic to it, but this behavior
was surprising to users of the library. The principle of least surprise favors
eliminating that surprising behavior in favor of something less surprising.
This commit makes it so that `xmlns` is not reported as having a prefix of `""`
and a local name of `"xmlns"`. This accords with how people interpret attribute
names like `foo`, `bar`, `moo` which all have no prefix and a local name.
Code that deals with namespace bindings or cares about `xmlns` probably needs to
be changed.
<a name="2.2.1"></a>
## [2.2.1](https://github.com/lddubeau/saxes/compare/v2.2.0...v2.2.1) (2018-08-20)
### Bug Fixes
* use `isNameChar` for later chars in PI target ([83d2b61](https://github.com/lddubeau/saxes/commit/83d2b61))
<a name="2.2.0"></a>
# [2.2.0](https://github.com/lddubeau/saxes/compare/v2.1.0...v2.2.0) (2018-08-20)
### Features
* add the `resolvePrefix` option ([90301fb](https://github.com/lddubeau/saxes/commit/90301fb))
<a name="2.1.0"></a>
# [2.1.0](https://github.com/lddubeau/saxes/compare/v2.0.0...v2.1.0) (2018-08-20)
### Features
* add support for parsing fragments ([1ff2d6a](https://github.com/lddubeau/saxes/commit/1ff2d6a))
* stronger check on bad cdata closure ([d416760](https://github.com/lddubeau/saxes/commit/d416760))
### Performance Improvements
* concatenate openWakaBang just once ([07345bf](https://github.com/lddubeau/saxes/commit/07345bf))
* improve text node checking speed ([f270e8b](https://github.com/lddubeau/saxes/commit/f270e8b))
* minor optimizations ([c7e36bf](https://github.com/lddubeau/saxes/commit/c7e36bf))
* remove an unnecessary variable ([ac03a1c](https://github.com/lddubeau/saxes/commit/ac03a1c))
* remove handler check ([fbe35ff](https://github.com/lddubeau/saxes/commit/fbe35ff))
* simplify captureWhile ([bb2085c](https://github.com/lddubeau/saxes/commit/bb2085c))
* simplify the skip functions ([c7b8c3b](https://github.com/lddubeau/saxes/commit/c7b8c3b))
* the c field has been unused for a while: remove it ([9ca0246](https://github.com/lddubeau/saxes/commit/9ca0246))
* use strings for the general states ([3869908](https://github.com/lddubeau/saxes/commit/3869908))
<a name="2.0.0"></a>
# [2.0.0](https://github.com/lddubeau/saxes/compare/v1.2.4...v2.0.0) (2018-07-23)
### Bug Fixes
* "X" is not a valid hex prefix for char references ([465038b](https://github.com/lddubeau/saxes/commit/465038b))
* add namespace checks ([9f94c4b](https://github.com/lddubeau/saxes/commit/9f94c4b))
* always run in strict mode ([ed8b0b1](https://github.com/lddubeau/saxes/commit/ed8b0b1))
* check that the characters we read are valid char data ([7611a85](https://github.com/lddubeau/saxes/commit/7611a85))
* disallow spaces after open waka ([da7f76d](https://github.com/lddubeau/saxes/commit/da7f76d))
* drop the lowercase option ([987d4bf](https://github.com/lddubeau/saxes/commit/987d4bf))
* emit CDATA on empty CDATA section too ([95d192f](https://github.com/lddubeau/saxes/commit/95d192f))
* emit empty comment ([b3db392](https://github.com/lddubeau/saxes/commit/b3db392))
* entities are always strict ([0f6a30e](https://github.com/lddubeau/saxes/commit/0f6a30e))
* fail on colon at start of QName ([507addd](https://github.com/lddubeau/saxes/commit/507addd))
* harmonize error messages and initialize flags ([9a20cad](https://github.com/lddubeau/saxes/commit/9a20cad))
* just one error for text before the root, and text after ([101ea50](https://github.com/lddubeau/saxes/commit/101ea50))
* more namespace checks ([a1add21](https://github.com/lddubeau/saxes/commit/a1add21))
* move namespace checks to their proper place ([4a1c99f](https://github.com/lddubeau/saxes/commit/4a1c99f))
* only accept uppercase CDATA to mark the start of CDATA ([e86534d](https://github.com/lddubeau/saxes/commit/e86534d))
* prevent colons in pi and entity names when xmlns is true ([4327eec](https://github.com/lddubeau/saxes/commit/4327eec))
* prevent empty entities ([04e1593](https://github.com/lddubeau/saxes/commit/04e1593))
* raise an error if the document does not have a root ([f2de520](https://github.com/lddubeau/saxes/commit/f2de520))
* raise an error on ]]> in character data ([2964381](https://github.com/lddubeau/saxes/commit/2964381))
* raise an error on < in attribute values ([4fd67a1](https://github.com/lddubeau/saxes/commit/4fd67a1))
* raise an error on multiple root elements ([45047ae](https://github.com/lddubeau/saxes/commit/45047ae))
* raise error on CDATA before or after root ([604241f](https://github.com/lddubeau/saxes/commit/604241f))
* raise error on character reference outside CHAR production ([30fb540](https://github.com/lddubeau/saxes/commit/30fb540))
* remove broken or pointless examples ([1a5b642](https://github.com/lddubeau/saxes/commit/1a5b642))
* report an error on duplicate attributes ([ee4e340](https://github.com/lddubeau/saxes/commit/ee4e340))
* report an error on whitespace at the start of end tag ([c13b122](https://github.com/lddubeau/saxes/commit/c13b122))
* report processing instructions that do not have a target ([c007e39](https://github.com/lddubeau/saxes/commit/c007e39))
* treat ?? in processing instructions correctly ([bc1e1d4](https://github.com/lddubeau/saxes/commit/bc1e1d4))
* trim URIs ([78cc6f3](https://github.com/lddubeau/saxes/commit/78cc6f3))
* use xmlchars for checking names ([2c939fe](https://github.com/lddubeau/saxes/commit/2c939fe))
* verify that character references match the CHAR production ([369afde](https://github.com/lddubeau/saxes/commit/369afde))
### Code Refactoring
* adjust the names used for processing instructions ([3b508e9](https://github.com/lddubeau/saxes/commit/3b508e9))
* convert code to ES6 ([fe81170](https://github.com/lddubeau/saxes/commit/fe81170))
* drop attribute event ([c7c2e80](https://github.com/lddubeau/saxes/commit/c7c2e80))
* drop buffer size checks ([9ce2f7a](https://github.com/lddubeau/saxes/commit/9ce2f7a))
* drop normalize ([9c6d84c](https://github.com/lddubeau/saxes/commit/9c6d84c))
* drop opencdata and on closecdata ([3287d2c](https://github.com/lddubeau/saxes/commit/3287d2c))
* drop SGML declaration parsing ([4aaf2d9](https://github.com/lddubeau/saxes/commit/4aaf2d9))
* drop the ``parser`` function, rename SAXParser ([0878a6c](https://github.com/lddubeau/saxes/commit/0878a6c))
* drop trim ([c03c7d0](https://github.com/lddubeau/saxes/commit/c03c7d0))
* pass the actual tag to onclosetag ([7020e64](https://github.com/lddubeau/saxes/commit/7020e64))
* provide default no-op implementation for events ([a94687f](https://github.com/lddubeau/saxes/commit/a94687f))
* remove the API based on Stream ([ebb659a](https://github.com/lddubeau/saxes/commit/ebb659a))
* simplify namespace processing ([2d4ce0f](https://github.com/lddubeau/saxes/commit/2d4ce0f))
### Features
* drop the resume() method; and have onerror() throw ([ac601e5](https://github.com/lddubeau/saxes/commit/ac601e5))
* handle XML declarations ([5258939](https://github.com/lddubeau/saxes/commit/5258939))
* revamped error messages ([cf9c589](https://github.com/lddubeau/saxes/commit/cf9c589))
* the flush method returns its parser ([68c2020](https://github.com/lddubeau/saxes/commit/68c2020))
### BREAKING CHANGES
* Sax was only passing the tag name. We pass the whole object.
* The API no longer takes a ``strict`` argument anywhere. This also
effectively removes support for HTML processing, or allow processing
without errors anything which is less than full XML. It also removes
special processing of ``script`` elements.
* ``attribute`` is not a particularly useful event for parsing XML. The only thing
it adds over looking at attributes on tag objects is that you get the order of
the attributes from the source, but attribute order in XML is irrelevant.
* The opencdata and closecdata events became redundant once we removed the buffer
size limitations. So we remove these events.
* The ``parser`` function is removed. Just create a new instance with
``new``.
``SAXParser`` is now ``SaxesParser.`` So ``new
require("saxes").SaxesParser(...)``.
* The API based on Stream is gone. There were multiple issues with it. It was
Node-specific. It used an ancient Node API (the so-called "classic
streams"). Its behavior was idiosyncratic.
* Sax had no default error handler but if you wanted to continue calling
``write()`` after an error you had to call ``resume()``. We do away with
``resume()`` and instead install a default ``onerror`` which throws. Replace
with a no-op handler if you want to continue after errors.
* The "processinginstruction" now produces a "target" field instead of a "name"
field. The nomenclature "target" is the one used in the XML literature.
* * The ``ns`` field is no longer using the prototype trick that sax used. The
``ns`` field of a tag contains only those namespaces that the tag declares.
* We no longer have ``opennamespace`` and ``closenamespace`` events. The
information they provide can be obtained by examining the tags passed to tag
events.
* SGML declaration is not supported by XML. This is an XML parser. So we
remove support for SGML declarations. They now cause errors.
* We removed support for the code that checked buffer sizes and would
raise errors if a buffer was close to an arbitrary limit or emitted
multiple ``text`` or ``cdata`` events in order avoid passing strings
greater than an arbitrary size. So ``MAX_BUFFER_LENGTH`` is gone.
The feature always seemed a bit awkward. Client code could limit the
size of buffers to 1024K, for instance, and not get a ``text`` event
with a text payload greater than 1024K... so far so good but if the
same document contained a comment with more than 1024K that would
result in an error. Hmm.... why? The distinction seems entirely
arbitrary.
The upshot is that client code needs to be ready to handle strings of
any length supported by the platform.
If there's a clear need to reintroduce it, we'll reassess.
* It is no longer possible to load the library as-is through a
``script`` element. It needs building.
The library now assumes a modern runtime. It no longer contains any
code to polyfill what's missing. It is up to developers using this
code to deal with polyfills as needed.
* We drop the ``trim`` option. It is up to client code to trip text if
it needs it.
* We no longer support the ``normalize`` option. It is up to client code
to perform whatever normalization it wants.
* The ``lowercase`` option makes no sense for XML. It is removed.
* Remove support for strictEntities. Entities are now always strict, as
required by the XML specification.
* By default parsers now have a default no-op implementation for each
event it supports. This would break code that determines whether a
custom handler was added by checking whether there's any handler at
all. This removes the necessity for the parser implementation to check
whether there is a handler before calling it.
In the process of making this change, we've removed support for the
``on...`` properties on streams objects. Their existence was not
warranted by any standard API provided by Node. (``EventEmitter`` does
not have ``on...`` properties for events it supports, nor does
``Stream``.) Their existence was also undocumented. And their
functioning was awkward. For instance, with sax, this:
```
const s = sax.createStream();
const handler = () => console.log("moo");
s.on("cdata", handler);
console.log(s.oncdata === handler);
```
would print ``false``. If you examine ``s.oncdata`` you see it is glue
code instead of the handler assigned. This is just bizarre, so we
removed it.

64
node_modules/saxes/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,64 @@
The ISC License
Copyright (c) Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
====
The following license is the one that governed sax, from which saxes
was forked. Isaac Schlueter is not *directly* involved with saxes so
don't go bugging him for saxes issues.
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
====
`String.fromCodePoint` by Mathias Bynens is no longer used, but it can
still be found in old commits. It was once used according to terms of
MIT License, as follows:
Copyright Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

246
node_modules/saxes/README.md generated vendored Normal file
View File

@@ -0,0 +1,246 @@
# saxes
A sax-style non-validating parser for XML.
Saxes is a fork of [sax](https://github.com/isaacs/sax-js) 1.2.4. All mentions
of sax in this project's documentation are references to sax 1.2.4.
Designed with [node](http://nodejs.org/) in mind, but should work fine in the
browser or other CommonJS implementations.
Saxes does not support Node versions older than 8.
## Notable Differences from Sax.
* Saxes aims to be much stricter than sax with regards to XML
well-formedness. Sax, even in its so-called "strict mode", is not strict. It
silently accepts structures that are not well-formed XML. Projects that need
better compliance with well-formedness constraints cannot use sax as-is.
Saxes aims for conformance with [XML 1.0 fifth
edition](https://www.w3.org/TR/2008/REC-xml-20081126/) and [XML Namespaces 1.0
third edition](http://www.w3.org/TR/2009/REC-xml-names-20091208/).
Consequently, saxes does not support HTML, or pseudo-XML, or bad XML.
* Saxes is much much faster than sax, mostly because of a substantial redesign
of the internal parsing logic. The speed improvement is not merely due to
removing features that were supported by sax. That helped a bit, but saxes
adds some expensive checks in its aim for conformance with the XML
specification. Redesigning the parsing logic is what accounts for most of the
performance improvement.
* Saxes does not aim to support antiquated platforms. We will not pollute the
source or the default build with support for antiquated platforms. If you want
support for IE 11, you are welcome to produce a PR that adds a *new build*
transpiled to ES5.
* Saxes handles errors differently from sax: it provides a default onerror
handler which throws. You can replace it with your own handler if you want. If
your handler does nothing, there is no `resume` method to call.
* There's no `Stream` API. A revamped API may be introduced later. (It is still
a "streaming parser" in the general sense that you write a character stream to
it.)
* Saxes does not have facilities for limiting the size the data chunks passed to
event handlers. See the FAQ entry for more details.
## Limitations
This is a non-validating parser so it only verifies whether the document is
well-formed. We do aim to raise errors for all malformed constructs encountered.
However, this parser does not parse the contents of DTDs. So malformedness
errors caused by errors in DTDs cannot be reported.
Also, the parser continues to parse even upon encountering errors, and does its
best to continue reporting errors. You should heed all errors
reported.
**HOWEVER, ONCE AN ERROR HAS BEEN ENCOUNTERED YOU CANNOT RELY ON THE DATA
PROVIDED THROUGH THE OTHER EVENT HANDLERS.**
After an error, saxes tries to make sense of your document, but it may interpret
it incorrectly. For instance ``<foo a=bc="d"/>`` is invalid XML. Did you mean to
have ``<foo a="bc=d"/>`` or ``<foo a="b" c="d"/>`` or some other variation?
Saxes takes an honest stab at figuring out your mangled XML. That's as good as
it gets.
## Regarding `<!DOCTYPE`s and `<!ENTITY`s
The parser will handle the basic XML entities in text nodes and attribute
values: `&amp; &lt; &gt; &apos; &quot;`. It's possible to define additional
entities in XML by putting them in the DTD. This parser doesn't do anything with
that. If you want to listen to the `ondoctype` event, and then fetch the
doctypes, and read the entities and add them to `parser.ENTITIES`, then be my
guest.
## Documentation
The source code contains JSDOC comments. Use them.
**PAY CLOSE ATTENTION TO WHAT IS PUBLIC AND WHAT IS PRIVATE.**
The elements of code that do not have JSDOC documentation, or have documentation
with the ``@private`` tag, are private.
If you use anything private, that's at your own peril.
If there's a mistake in the documentation, raise an issue. If you just assume,
you may assume incorrectly.
## Summary Usage Information
### Example
```javascript
var saxes = require("./lib/saxes"),
parser = new saxes.SaxesParser();
parser.onerror = function (e) {
// an error happened.
};
parser.ontext = function (t) {
// got some text. t is the string of text.
};
parser.onopentag = function (node) {
// opened a tag. node has "name" and "attributes"
};
parser.onend = function () {
// parser stream is done, and ready to have more stuff written to it.
};
parser.write('<xml>Hello, <who name="world">world</who>!</xml>').close();
```
### Constructor Arguments
Pass the following arguments to the parser function. All are optional.
`opt` - Object bag of settings regarding string formatting.
Settings supported:
* `xmlns` - Boolean. If `true`, then namespaces are supported. Default
is `false`.
* `position` - Boolean. If `false`, then don't track line/col/position. Unset is
treated as `true`. Default is unset.
* `fileName` - String. Set a file name for error reporting. This is useful only
when tracking positions. You may leave it unset, in which case the file name
in error messages will be `undefined`.
* `fragment` - Boolean. If `true`, parse the XML as an XML fragment. Default is
`false`.
* `additionalNamespaces` - A plain object whose key, value pairs define
namespaces known before parsing the XML file. It is not legal to pass
bindings for the namespaces `"xml"` or `"xmlns"`.
### Methods
`write` - Write bytes onto the stream. You don't have to do this all at
once. You can keep writing as much as you want.
`close` - Close the stream. Once closed, no more data may be written until it is
done processing the buffer, which is signaled by the `end` event.
### Properties
The parser has the following properties:
`line`, `column`, `position` - Indications of the position in the XML document
where the parser currently is looking.
`closed` - Boolean indicating whether or not the parser can be written to. If
it's `true`, then wait for the `ready` event to write again.
`opt` - Any options passed into the constructor.
`xmlDecl` - The XML declaration for this document. It contains the fields
`version`, `encoding` and `standalone`. They are all `undefined` before
encountering the XML declaration. If they are undefined after the XML
declaration, the corresponding value was not set by the declaration. There is no
event associated with the XML declaration. In a well-formed document, the XML
declaration may be preceded only by an optional BOM. So by the time any event
generated by the parser happens, the declaration has been processed if present
at all. Otherwise, you have a malformed document, and as stated above, you
cannot rely on the parser data!
### Events
To listen to an event, override `on<eventname>`. The list of supported events
are also in the exported `EVENTS` array.
See the JSDOC comments in the source code for a description of each supported
event.
### Parsing XML Fragments
The XML specification does not define any method by which to parse XML
fragments. However, there are usage scenarios in which it is desirable to parse
fragments. In order to allow this, saxes provides three initialization options.
If you pass the option `fragment: true` to the parser constructor, the parser
will expect an XML fragment. It essentially starts with a parsing state
equivalent to the one it would be in if `parser.write("<foo">)` had been called
right after initialization. In other words, it expects content which is
acceptable inside an element. This also turns off well-formedness checks that
are inappropriate when parsing a fragment.
The option `additionalNamespaces` allows you to define additional prefix-to-URI
bindings known before parsing starts. You would use this over `resolvePrefix` if
you have at the ready a series of namespaces bindings to use.
The option `resolvePrefix` allows you to pass a function which saxes will use if
it is unable to resolve a namespace prefix by itself. You would use this over
`additionalNamespaces` in a context where getting a complete list of defined
namespaces is onerous.
Note that you can use `additionalNamespaces` and `resolvePrefix` together if you
want. `additionalNamespaces` applies before `resolvePrefix`.
## FAQ
Q. Why has saxes dropped support for limiting the size of data chunks passed to
event handlers?
A. With sax you could set ``MAX_BUFFER_LENGTH`` to cause the parser to limit the
size of data chunks passed to event handlers. So if you ran into a span of text
above the limit, multiple ``text`` events with smaller data chunks were fired
instead of a single event with a large chunk.
However, that functionality had some problematic characteristics. It had an
arbitrary default value. It was library-wide so all parsers created from a
single instance of the ``sax`` library shared it. This could potentially cause
conflicts among libraries running in the same VM but using sax for different
purposes.
These issues could have been easily fixed, but there were larger issues. The
buffer limit arbitrarily applied to some events but not others. It would split
``text``, ``cdata`` and ``script`` events. However, if a ``comment``,
``doctype``, ``attribute`` or ``processing instruction`` were more than the
limit, the parser would generate an error and you were left picking up the
pieces.
It was not intuitive to use. You'd think setting the limit to 1K would prevent
chunks bigger than 1K to be passed to event handlers. But that was not the
case. A comment in the source code told you that you might go over the limit if
you passed large chunks to ``write``. So if you want a 1K limit, don't pass 64K
chunks to ``write``. Fair enough. You know what limit you want so you can
control the size of the data you pass to ``write``. So you limit the chunks to
``write`` to 1K at a time. Even if you do this, your event handlers may get data
chunks that are 2K in size. Suppose on the previous ``write`` the parser has
just finished processing an open tag, so it is ready for text. Your ``write``
passes 1K of text. You are not above the limit yet, so no event is generated
yet. The next ``write`` passes another 1K of text. It so happens that sax checks
buffer limits only once per ``write``, after the chunk of data has been
processed. Now you've hit the limit and you get a ``text`` event with 2K of
data. So even if you limit your ``write`` calls to the buffer limit you've set,
you may still get events with chunks at twice the buffer size limit you've
specified.
We may consider reinstating an equivalent functionality, provided that it
addresses the issues above and does not cause a huge performance drop for
use-case scenarios that don't need it.

67
node_modules/saxes/lib/saxes.d.ts generated vendored Normal file
View File

@@ -0,0 +1,67 @@
declare namespace saxes {
export const EVENTS: ReadonlyArray<string>;
export interface SaxesOptions {
xmlns?: boolean;
position?: boolean;
fragment?: boolean;
fileName?: string;
additionalNamespaces?: Record<string, string>;
}
export interface XMLDecl {
version?: string;
encoding?: string;
standalone?: string;
}
export interface SaxesAttribute {
name: string;
prefix: string;
local: string;
uri: string;
value: string;
}
export interface SaxesTag {
name: string;
prefix: string;
local: string;
uri: string;
attributes: Record<string, SaxesAttribute> | Record<string, string>;
ns: Record<string, string>;
isSelfClosing: boolean;
}
export class SaxesParser {
constructor(opt: SaxesOptions);
readonly opt: SaxesOptions;
readonly closed: boolean;
readonly xmlDecl: XMLDecl;
readonly line: number;
readonly column: number;
readonly position: number;
readonly ENTITIES: Record<string, string>;
ontext(text: string): void;
onprocessinginstruction(pi: { target: string, body: string }): void;
ondoctype(doctype: string): void;
oncomment(comment: string): void;
onopentagstart(tag: SaxesTag): void;
onopentag(tag: SaxesTag): void;
onclosetag(tag: SaxesTag): void;
oncdata(cdata: string): void;
onend(): void;
onready(): void;
onerror(err: Error): void;
fail(er: Error): this;
write(chunk: string | null): this;
close(): this;
resolve(prefix: string): string | undefined;
}
}
export = saxes;

1879
node_modules/saxes/lib/saxes.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

83
node_modules/saxes/package.json generated vendored Normal file
View File

@@ -0,0 +1,83 @@
{
"_from": "saxes@^3.1.5",
"_id": "saxes@3.1.9",
"_inBundle": false,
"_integrity": "sha512-FZeKhJglhJHk7eWG5YM0z46VHmI3KJpMBAQm3xa9meDvd+wevB5GuBB0wc0exPInZiBBHqi00DbS8AcvCGCFMw==",
"_location": "/saxes",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "saxes@^3.1.5",
"name": "saxes",
"escapedName": "saxes",
"rawSpec": "^3.1.5",
"saveSpec": null,
"fetchSpec": "^3.1.5"
},
"_requiredBy": [
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.9.tgz",
"_shasum": "c1c197cd54956d88c09f960254b999e192d7058b",
"_spec": "saxes@^3.1.5",
"_where": "F:\\projects\\vanillajs-seed\\node_modules\\jsdom",
"author": {
"name": "Louis-Dominique Dubeau",
"email": "ldd@lddubeau.com"
},
"bugs": {
"url": "https://github.com/lddubeau/saxes/issues"
},
"bundleDependencies": false,
"dependencies": {
"xmlchars": "^1.3.1"
},
"deprecated": false,
"description": "An evented streaming XML parser in JavaScript",
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-angular": "^7.5.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.12",
"eslint": "^5.14.1",
"eslint-config-lddubeau-base": "^3.0.1",
"husky": "^1.3.1",
"mocha": "^6.0.1",
"renovate-config-lddubeau": "^1.0.0",
"xml-conformance-suite": "^1.1.0"
},
"engines": {
"node": ">=8"
},
"files": [
"lib/saxes.js",
"lib/saxes.d.ts",
"LICENSE",
"README.md",
"CHANGELOG.md"
],
"homepage": "https://github.com/lddubeau/saxes#readme",
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"license": "ISC",
"main": "lib/saxes.js",
"name": "saxes",
"repository": {
"type": "git",
"url": "git+https://github.com/lddubeau/saxes.git"
},
"scripts": {
"postpublish": "git push origin --follow-tags",
"posttest": "eslint test/*.js lib/*.js",
"postversion": "npm publish",
"preversion": "npm test",
"test": "mocha --delay",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
},
"types": "lib/saxes.d.ts",
"version": "3.1.9"
}