1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-02 12:00:03 +02:00

update modules

This commit is contained in:
s2
2020-07-20 16:16:07 +02:00
parent 783511ce12
commit 2b23424b86
785 changed files with 91905 additions and 56057 deletions

366
node_modules/saxes/CHANGELOG.md generated vendored
View File

@@ -1,366 +0,0 @@
<a name="3.1.11"></a>
## [3.1.11](https://github.com/lddubeau/saxes/compare/v3.1.10...v3.1.11) (2019-06-25)
### Bug Fixes
* pay attention to comments and processing instructions in DTDs ([52ffd90](https://github.com/lddubeau/saxes/commit/52ffd90)), closes [#19](https://github.com/lddubeau/saxes/issues/19)
### Performance Improvements
* check the most common case first ([40a34d5](https://github.com/lddubeau/saxes/commit/40a34d5))
* improve some more the speed of ]]> detection ([a0216cd](https://github.com/lddubeau/saxes/commit/a0216cd))
* move more common/valid cases first ([a65586e](https://github.com/lddubeau/saxes/commit/a65586e))
* split sText into two specialized loops ([732325e](https://github.com/lddubeau/saxes/commit/732325e))
* use specialized code for sAttribValueQuoted ([6c484f3](https://github.com/lddubeau/saxes/commit/6c484f3))
<a name="3.1.10"></a>
## [3.1.10](https://github.com/lddubeau/saxes/compare/v3.1.9...v3.1.10) (2019-06-11)
### Performance Improvements
* improve the check for ]]> in character data ([21df9b5](https://github.com/lddubeau/saxes/commit/21df9b5))
<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
View File

@@ -1,64 +0,0 @@
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.

169
node_modules/saxes/README.md generated vendored
View File

@@ -8,7 +8,7 @@ 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.
Saxes does not support Node versions older than 10.
## Notable Differences from Sax.
@@ -16,11 +16,10 @@ Saxes does not support Node versions older than 8.
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.
Consequently, saxes does not support HTML, or pseudo-XML, or bad XML. Saxes
will report well-formedness errors in all these cases but it won't try to
extract data from malformed documents like sax does.
* 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
@@ -45,46 +44,43 @@ Saxes does not support Node versions older than 8.
* Saxes does not have facilities for limiting the size the data chunks passed to
event handlers. See the FAQ entry for more details.
## Conformance
Saxes supports:
* [XML 1.0 fifth edition](https://www.w3.org/TR/2008/REC-xml-20081126/)
* [XML 1.1 second edition](https://www.w3.org/TR/2006/REC-xml11-20060816/)
* [Namespaces in XML 1.0 (Third Edition)](https://www.w3.org/TR/2009/REC-xml-names-20091208/).
* [Namespaces in XML 1.1 (Second Edition)](https://www.w3.org/TR/2006/REC-xml-names11-20060816/).
## 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
well-formed. We do aim to raise errors for all malformed constructs
encountered. However, this parser does not thorougly parse the contents of
DTDs. So most malformedness errors caused by errors **in DTDs** cannot be
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
## Regarding `<!DOCTYPE` and `<!ENTITY`
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
that. If you want to listen to the `doctype` 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.
The source code contains JSDOC comments. Use them. What follows is a brief
summary of what is available. The final authority is the source code.
**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.
The move to TypeScript makes it so that everything is now formally private,
protected, or public.
If you use anything private, that's at your own peril.
If you use anything not public, 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.
@@ -97,39 +93,39 @@ you may assume incorrectly.
var saxes = require("./lib/saxes"),
parser = new saxes.SaxesParser();
parser.onerror = function (e) {
parser.on("error", function (e) {
// an error happened.
};
parser.ontext = function (t) {
});
parser.on("text", function (t) {
// got some text. t is the string of text.
};
parser.onopentag = function (node) {
});
parser.on("opentag", function (node) {
// opened a tag. node has "name" and "attributes"
};
parser.onend = function () {
});
parser.on("end", 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.
treated as `true`. Default is unset. Currently, setting this to `false` only
results in a cosmetic change: the errors reported do not contain position
information. sax-js would literally turn off the position-computing logic if
this flag was set to false. The notion was that it would optimize
execution. In saxes at least it turns out that continually testing this flag
causes a cost that offsets the benefits of turning off this logic.
* `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`.
when tracking positions. You may leave it unset.
* `fragment` - Boolean. If `true`, parse the XML as an XML fragment. Default is
`false`.
@@ -138,10 +134,32 @@ Settings supported:
namespaces known before parsing the XML file. It is not legal to pass
bindings for the namespaces `"xml"` or `"xmlns"`.
* `defaultXMLVersion` - The default version of the XML specification to use if
the document contains no XML declaration. If the document does contain an XML
declaration, then this setting is ignored. Must be `"1.0"` or `"1.1"`. The
default is `"1.0"`.
* `forceXMLVersion` - Boolean. A flag indicating whether to force the XML
version used for parsing to the value of ``defaultXMLVersion``. When this flag
is ``true``, ``defaultXMLVersion`` must be specified. If unspecified, the
default value of this flag is ``false``.
Example: suppose you are parsing a document that has an XML declaration
specifying XML version 1.1.
If you set ``defaultXMLVersion`` to ``"1.0"`` without setting
``forceXMLVersion`` then the XML declaration will override the value of
``defaultXMLVersion`` and the document will be parsed according to XML 1.1.
If you set ``defaultXMLVersion`` to ``"1.0"`` and set ``forceXMLVersion`` to
``true``, then the XML declaration will be ignored and the document will be
parsed according to XML 1.0.
### 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.
`write` - Write bytes onto the stream. You don't have to pass the whole document
in one `write` call. You can read your source chunk by chunk and call `write`
with each chunk.
`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.
@@ -150,8 +168,10 @@ done processing the buffer, which is signaled by the `end` event.
The parser has the following properties:
`line`, `column`, `position` - Indications of the position in the XML document
where the parser currently is looking.
`line`, `column`, `columnIndex`, `position` - Indications of the position in the
XML document where the parser currently is looking. The `columnIndex` property
counts columns as if indexing into a JavaScript string, whereas the `column`
property counts Unicode characters.
`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.
@@ -168,6 +188,27 @@ 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!
### Error Handling
The parser continues to parse even upon encountering errors, and does its best
to continue reporting errors. You should heed all errors reported. After an
error, however, saxes may interpret your document 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? For the sake of continuing to
provide errors, saxes will continue parsing the document, but the structure it
reports may be incorrect. It is only after the errors are fixed in the document
that saxes can provide a reliable interpretation of the document.
That leaves you with two rules of thumb when using saxes:
* Pay attention to the errors that saxes report. The default `onerror` handler
throws, so by default, you cannot miss errors.
* **ONCE AN ERROR HAS BEEN ENCOUNTERED, STOP RELYING ON THE EVENT HANDLERS OTHER
THAN `onerror`.** As explained above, when saxes runs into a well-formedness
problem, it makes a guess in order to continue reporting more errors. The guess
may be wrong.
### Events
To listen to an event, override `on<eventname>`. The list of supported events
@@ -201,6 +242,42 @@ namespaces is onerous.
Note that you can use `additionalNamespaces` and `resolvePrefix` together if you
want. `additionalNamespaces` applies before `resolvePrefix`.
The options `additionalNamespaces` and `resolvePrefix` are really meant to be
used for parsing fragments. However, saxes won't prevent you from using them
with `fragment: false`. Note that if you do this, your document may parse
without errors and yet be malformed because the document can refer to namespaces
which are not defined *in* the document.
Of course, `additionalNamespaces` and `resolvePrefix` are used only if `xmlns`
is `true`. If you are parsing a fragment that does not use namespaces, there's
no point in setting these options.
### Performance Tips
* saxes works faster on files that use newlines (``\u000A``) as end of line
markers than files that use other end of line markers (like ``\r`` or
``\r\n``). The XML specification requires that conformant applications behave
as if all characters that are to be treated as end of line characters are
converted to ``\u000A`` prior to parsing. The optimal code path for saxes is a
file in which all end of line characters are already ``\u000A``.
* Don't split Unicode strings you feed to saxes across surrogates. When you
naively split a string in JavaScript, you run the risk of splitting a Unicode
character into two surrogates. e.g. In the following example ``a`` and ``b``
each contain half of a single Unicode character: ``const a = "\u{1F4A9}"[0];
const b = "\u{1F4A9}"[1]`` If you feed such split surrogates to versions of
saxes prior to 4, you'd get errors. Saxes version 4 and over are able to
detect when a chunk of data ends with a surrogate and carry over the surrogate
to the next chunk. However this operation entails slicing and concatenating
strings. If you can feed your data in a way that does not split surrogates,
you should do it. (Obviously, feeding all the data at once with a single write
is fastest.)
* Don't set event handlers you don't need. Saxes has always aimed to avoid doing
work that will just be tossed away but future improvements hope to do this
more aggressively. One way saxes knows whether or not some data is needed is
by checking whether a handler has been set for a specific event.
## FAQ
Q. Why has saxes dropped support for limiting the size of data chunks passed to

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

@@ -1,67 +0,0 @@
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;

2065
node_modules/saxes/lib/saxes.js generated vendored

File diff suppressed because it is too large Load Diff

90
node_modules/saxes/package.json generated vendored
View File

@@ -1,27 +1,27 @@
{
"_from": "saxes@^3.1.9",
"_id": "saxes@3.1.11",
"_from": "saxes@^5.0.0",
"_id": "saxes@5.0.1",
"_inBundle": false,
"_integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==",
"_integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==",
"_location": "/saxes",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "saxes@^3.1.9",
"raw": "saxes@^5.0.0",
"name": "saxes",
"escapedName": "saxes",
"rawSpec": "^3.1.9",
"rawSpec": "^5.0.0",
"saveSpec": null,
"fetchSpec": "^3.1.9"
"fetchSpec": "^5.0.0"
},
"_requiredBy": [
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz",
"_shasum": "d59d1fd332ec92ad98a2e0b2ee644702384b1c5b",
"_spec": "saxes@^3.1.9",
"_where": "F:\\projects\\p\\minifyfromhtml\\node_modules\\jsdom",
"_resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz",
"_shasum": "eebab953fa3b7608dbe94e5dadb15c888fa6696d",
"_spec": "saxes@^5.0.0",
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\jsdom",
"author": {
"name": "Louis-Dominique Dubeau",
"email": "ldd@lddubeau.com"
@@ -31,32 +31,46 @@
},
"bundleDependencies": false,
"dependencies": {
"xmlchars": "^2.1.1"
"xmlchars": "^2.2.0"
},
"deprecated": false,
"description": "An evented streaming XML parser in JavaScript",
"devDependencies": {
"@commitlint/cli": "^8.0.0",
"@commitlint/config-angular": "^8.0.0",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-angular": "^8.3.4",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/eslint-plugin-tslint": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"@xml-conformance-suite/js": "^2.0.0",
"@xml-conformance-suite/mocha": "^2.0.0",
"@xml-conformance-suite/test-data": "^2.0.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.21",
"eslint": "^5.16.0",
"eslint-config-lddubeau-base": "^3.0.5",
"husky": "^2.5.0",
"mocha": "^6.1.4",
"conventional-changelog-cli": "^2.0.31",
"eslint": "^6.8.0",
"eslint-config-lddubeau-base": "^5.2.0",
"eslint-config-lddubeau-ts": "^1.1.7",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prefer-arrow": "^1.2.0",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-simple-import-sort": "^5.0.2",
"husky": "^4.2.5",
"mocha": "^7.1.1",
"renovate-config-lddubeau": "^1.0.0",
"xml-conformance-suite": "^1.2.0"
"simple-dist-tag": "^1.0.2",
"ts-node": "^8.8.2",
"tsd": "^0.11.0",
"tslint": "^6.1.1",
"tslint-microsoft-contrib": "^6.2.0",
"typedoc": "^0.17.4",
"typescript": "^3.8.3"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"files": [
"lib/saxes.js",
"lib/saxes.d.ts",
"LICENSE",
"README.md",
"CHANGELOG.md"
],
"homepage": "https://github.com/lddubeau/saxes#readme",
"husky": {
"hooks": {
@@ -64,20 +78,28 @@
}
},
"license": "ISC",
"main": "lib/saxes.js",
"main": "saxes.js",
"name": "saxes",
"repository": {
"type": "git",
"url": "git+https://github.com/lddubeau/saxes.git"
},
"scripts": {
"build": "npm run tsc && npm run copy",
"build-docs": "npm run typedoc",
"copy": "cp -p README.md build/dist && sed -e'/\"private\": true/d' package.json > build/dist/package.json",
"gh-pages": "npm run build-docs && mkdir -p build && (cd build; rm -rf gh-pages; git clone .. --branch gh-pages gh-pages) && mkdir -p build/gh-pages/latest && find build/gh-pages/latest -type f -delete && cp -rp build/docs/* build/gh-pages/latest && find build/gh-pages -type d -empty -delete",
"lint": "eslint --ignore-path .gitignore '**/*.ts' '**/*.js'",
"lint-fix": "npm run lint -- --fix",
"postpublish": "git push origin --follow-tags",
"posttest": "eslint test/*.js lib/*.js",
"postversion": "npm publish",
"preversion": "npm test",
"test": "mocha --delay",
"posttest": "npm run lint",
"postversion": "npm run test && npm run self:publish",
"self:publish": "cd build/dist && npm_config_tag=`simple-dist-tag` npm publish",
"test": "npm run build && mocha --delay",
"tsc": "tsc",
"typedoc": "typedoc --tsconfig tsconfig.json --name saxes --out build/docs/ --listInvalidSymbolLinks --excludePrivate --excludeNotExported",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
},
"types": "lib/saxes.d.ts",
"version": "3.1.11"
"types": "saxes.d.ts",
"version": "5.0.1"
}

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

@@ -0,0 +1,635 @@
/**
* The list of supported events.
*/
export declare const EVENTS: readonly ["xmldecl", "text", "processinginstruction", "doctype", "comment", "opentagstart", "attribute", "opentag", "closetag", "cdata", "error", "end", "ready"];
/**
* Event handler for the
*
* @param text The text data encountered by the parser.
*
*/
export declare type XMLDeclHandler = (decl: XMLDecl) => void;
/**
* Event handler for text data.
*
* @param text The text data encountered by the parser.
*
*/
export declare type TextHandler = (text: string) => void;
/**
* Event handler for processing instructions.
*
* @param data The target and body of the processing instruction.
*/
export declare type PIHandler = (data: {
target: string;
body: string;
}) => void;
/**
* Event handler for doctype.
*
* @param doctype The doctype contents.
*/
export declare type DoctypeHandler = (doctype: string) => void;
/**
* Event handler for comments.
*
* @param comment The comment contents.
*/
export declare type CommentHandler = (comment: string) => void;
/**
* Event handler for the start of an open tag. This is called as soon as we
* have a tag name.
*
* @param tag The tag.
*/
export declare type OpenTagStartHandler<O> = (tag: StartTagForOptions<O>) => void;
export declare type AttributeEventForOptions<O extends SaxesOptions> = O extends {
xmlns: true;
} ? SaxesAttributeNSIncomplete : O extends {
xmlns?: false | undefined;
} ? SaxesAttributePlain : SaxesAttribute;
/**
* Event handler for attributes.
*/
export declare type AttributeHandler<O> = (attribute: AttributeEventForOptions<O>) => void;
/**
* Event handler for an open tag. This is called when the open tag is
* complete. (We've encountered the ">" that ends the open tag.)
*
* @param tag The tag.
*/
export declare type OpenTagHandler<O> = (tag: TagForOptions<O>) => void;
/**
* Event handler for a close tag. Note that for self-closing tags, this is
* called right after ``opentag``.
*
* @param tag The tag.
*/
export declare type CloseTagHandler<O> = (tag: TagForOptions<O>) => void;
/**
* Event handler for a CDATA section. This is called when ending the
* CDATA section.
*
* @param cdata The contents of the CDATA section.
*/
export declare type CDataHandler = (cdata: string) => void;
/**
* Event handler for the stream end. This is called when the stream has been
* closed with ``close`` or by passing ``null`` to ``write``.
*/
export declare type EndHandler = () => void;
/**
* Event handler indicating parser readiness . This is called when the parser
* is ready to parse a new document.
*/
export declare type ReadyHandler = () => void;
/**
* Event handler indicating an error.
*
* @param err The error that occurred.
*/
export declare type ErrorHandler = (err: Error) => void;
export declare type EventName = (typeof EVENTS)[number];
export declare type EventNameToHandler<O, N extends EventName> = {
"xmldecl": XMLDeclHandler;
"text": TextHandler;
"processinginstruction": PIHandler;
"doctype": DoctypeHandler;
"comment": CommentHandler;
"opentagstart": OpenTagStartHandler<O>;
"attribute": AttributeHandler<O>;
"opentag": OpenTagHandler<O>;
"closetag": CloseTagHandler<O>;
"cdata": CDataHandler;
"error": ErrorHandler;
"end": EndHandler;
"ready": ReadyHandler;
}[N];
/**
* This interface defines the structure of attributes when the parser is
* processing namespaces (created with ``xmlns: true``).
*/
export interface SaxesAttributeNS {
/**
* The attribute's name. This is the combination of prefix and local name.
* For instance ``a:b="c"`` would have ``a:b`` for name.
*/
name: string;
/**
* The attribute's prefix. For instance ``a:b="c"`` would have ``"a"`` for
* ``prefix``.
*/
prefix: string;
/**
* The attribute's local name. For instance ``a:b="c"`` would have ``"b"`` for
* ``local``.
*/
local: string;
/** The namespace URI of this attribute. */
uri: string;
/** The attribute's value. */
value: string;
}
/**
* This is an attribute, as recorded by a parser which parses namespaces but
* prior to the URI being resolvable. This is what is passed to the attribute
* event handler.
*/
export declare type SaxesAttributeNSIncomplete = Exclude<SaxesAttributeNS, "uri">;
/**
* This interface defines the structure of attributes when the parser is
* NOT processing namespaces (created with ``xmlns: false``).
*/
export interface SaxesAttributePlain {
/**
* The attribute's name.
*/
name: string;
/** The attribute's value. */
value: string;
}
/**
* A saxes attribute, with or without namespace information.
*/
export declare type SaxesAttribute = SaxesAttributeNS | SaxesAttributePlain;
/**
* This are the fields that MAY be present on a complete tag.
*/
export interface SaxesTag {
/**
* The tag's name. This is the combination of prefix and global name. For
* instance ``<a:b>`` would have ``"a:b"`` for ``name``.
*/
name: string;
/**
* A map of attribute name to attributes. If namespaces are tracked, the
* values in the map are attribute objects. Otherwise, they are strings.
*/
attributes: Record<string, SaxesAttributeNS> | Record<string, string>;
/**
* The namespace bindings in effect.
*/
ns?: Record<string, string>;
/**
* The tag's prefix. For instance ``<a:b>`` would have ``"a"`` for
* ``prefix``. Undefined if we do not track namespaces.
*/
prefix?: string;
/**
* The tag's local name. For instance ``<a:b>`` would
* have ``"b"`` for ``local``. Undefined if we do not track namespaces.
*/
local?: string;
/**
* The namespace URI of this tag. Undefined if we do not track namespaces.
*/
uri?: string;
/** Whether the tag is self-closing (e.g. ``<foo/>``). */
isSelfClosing: boolean;
}
/**
* This type defines the fields that are present on a tag object when
* ``onopentagstart`` is called. This interface is namespace-agnostic.
*/
export declare type SaxesStartTag = Pick<SaxesTag, "name" | "attributes" | "ns">;
/**
* This type defines the fields that are present on a tag object when
* ``onopentagstart`` is called on a parser that does not processes namespaces.
*/
export declare type SaxesStartTagPlain = Pick<SaxesStartTag, "name" | "attributes">;
/**
* This type defines the fields that are present on a tag object when
* ``onopentagstart`` is called on a parser that does process namespaces.
*/
export declare type SaxesStartTagNS = Required<SaxesStartTag>;
/**
* This are the fields that are present on a complete tag produced by a parser
* that does process namespaces.
*/
export declare type SaxesTagNS = Required<SaxesTag> & {
attributes: Record<string, SaxesAttributeNS>;
};
/**
* This are the fields that are present on a complete tag produced by a parser
* that does not process namespaces.
*/
export declare type SaxesTagPlain = Pick<SaxesTag, "name" | "attributes" | "isSelfClosing"> & {
attributes: Record<string, string>;
};
/**
* An XML declaration.
*/
export interface XMLDecl {
/** The version specified by the XML declaration. */
version?: string;
/** The encoding specified by the XML declaration. */
encoding?: string;
/** The value of the standalone parameter */
standalone?: string;
}
/**
* A callback for resolving name prefixes.
*
* @param prefix The prefix to check.
*
* @returns The URI corresponding to the prefix, if any.
*/
export declare type ResolvePrefix = (prefix: string) => string | undefined;
export interface CommonOptions {
/** Whether to accept XML fragments. Unset means ``false``. */
fragment?: boolean;
/** Whether to track positions. Unset means ``true``. */
position?: boolean;
/**
* A file name to use for error reporting. "File name" is a loose concept. You
* could use a URL to some resource, or any descriptive name you like.
*/
fileName?: string;
}
export interface NSOptions {
/** Whether to track namespaces. Unset means ``false``. */
xmlns?: boolean;
/**
* 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"``.
*/
additionalNamespaces?: Record<string, string>;
/**
* A function that will be used if the parser cannot resolve a namespace
* prefix on its own.
*/
resolvePrefix?: ResolvePrefix;
}
export interface NSOptionsWithoutNamespaces extends NSOptions {
xmlns?: false;
additionalNamespaces?: undefined;
resolvePrefix?: undefined;
}
export interface NSOptionsWithNamespaces extends NSOptions {
xmlns: true;
}
export interface XMLVersionOptions {
/**
* The default XML version to use. If unspecified, and there is no XML
* encoding declaration, the default version is "1.0".
*/
defaultXMLVersion?: "1.0" | "1.1";
/**
* A flag indicating whether to force the XML version used for parsing to the
* value of ``defaultXMLVersion``. When this flag is ``true``,
* ``defaultXMLVersion`` must be specified. If unspecified, the default value
* of this flag is ``false``.
*/
forceXMLVersion?: boolean;
}
export interface NoForcedXMLVersion extends XMLVersionOptions {
forceXMLVersion?: false;
}
export interface ForcedXMLVersion extends XMLVersionOptions {
forceXMLVersion: true;
defaultXMLVersion: Exclude<XMLVersionOptions["defaultXMLVersion"], undefined>;
}
/**
* The entire set of options supported by saxes.
*/
export declare type SaxesOptions = CommonOptions & NSOptions & XMLVersionOptions;
export declare type TagForOptions<O extends SaxesOptions> = O extends {
xmlns: true;
} ? SaxesTagNS : O extends {
xmlns?: false | undefined;
} ? SaxesTagPlain : SaxesTag;
export declare type StartTagForOptions<O extends SaxesOptions> = O extends {
xmlns: true;
} ? SaxesStartTagNS : O extends {
xmlns?: false | undefined;
} ? SaxesStartTagPlain : SaxesStartTag;
export declare class SaxesParser<O extends SaxesOptions = {}> {
private readonly fragmentOpt;
private readonly xmlnsOpt;
private readonly trackPosition;
private readonly fileName?;
private readonly nameStartCheck;
private readonly nameCheck;
private readonly isName;
private readonly ns;
private openWakaBang;
private text;
private name;
private piTarget;
private entity;
private q;
private tags;
private tag;
private topNS;
private chunk;
private chunkPosition;
private i;
private prevI;
private carriedFromPrevious?;
private forbiddenState;
private attribList;
private state;
private reportedTextBeforeRoot;
private reportedTextAfterRoot;
private closedRoot;
private sawRoot;
private xmlDeclPossible;
private xmlDeclExpects;
private entityReturnState?;
private processAttribs;
private positionAtNewLine;
private doctype;
private getCode;
private isChar;
private pushAttrib;
private _closed;
private currentXMLVersion;
private readonly stateTable;
private xmldeclHandler?;
private textHandler?;
private piHandler?;
private doctypeHandler?;
private commentHandler?;
private openTagStartHandler?;
private openTagHandler?;
private closeTagHandler?;
private cdataHandler?;
private errorHandler?;
private endHandler?;
private readyHandler?;
private attributeHandler?;
/**
* Indicates whether or not the parser is closed. If ``true``, wait for
* the ``ready`` event to write again.
*/
get closed(): boolean;
readonly opt: SaxesOptions;
/**
* The XML declaration for this document.
*/
xmlDecl: XMLDecl;
/**
* The line number of the next character to be read by the parser. This field
* is one-based. (The first line is numbered 1.)
*/
line: number;
/**
* The column number of the next character to be read by the parser. *
* This field is zero-based. (The first column is 0.)
*
* This field counts columns by *Unicode character*. Note that this *can*
* be different from the index of the character in a JavaScript string due
* to how JavaScript handles astral plane characters.
*
* See [[columnIndex]] for a number that corresponds to the JavaScript index.
*/
column: number;
/**
* A map of entity name to expansion.
*/
ENTITIES: Record<string, string>;
/**
* @param opt The parser options.
*/
constructor(opt?: O);
_init(): void;
/**
* The stream position the parser is currently looking at. This field is
* zero-based.
*
* This field is not based on counting Unicode characters but is to be
* interpreted as a plain index into a JavaScript string.
*/
get position(): number;
/**
* The column number of the next character to be read by the parser. *
* This field is zero-based. (The first column in a line is 0.)
*
* This field reports the index at which the next character would be in the
* line if the line were represented as a JavaScript string. Note that this
* *can* be different to a count based on the number of *Unicode characters*
* due to how JavaScript handles astral plane characters.
*
* See [[column]] for a number that corresponds to a count of Unicode
* characters.
*/
get columnIndex(): number;
/**
* Set an event listener on an event. The parser supports one handler per
* event type. If you try to set an event handler over an existing handler,
* the old handler is silently overwritten.
*
* @param name The event to listen to.
*
* @param handler The handler to set.
*/
on<N extends EventName>(name: N, handler: EventNameToHandler<O, N>): void;
/**
* Unset an event handler.
*
* @parma name The event to stop listening to.
*/
off(name: EventName): void;
/**
* Make an error object. The error object will have a message that contains
* the ``fileName`` option passed at the creation of the parser. If position
* tracking was turned on, it will also have line and column number
* information.
*
* @param message The message describing the error to report.
*
* @returns An error object with a properly formatted message.
*/
makeError(message: string): Error;
/**
* Report a parsing error. This method is made public so that client code may
* check for issues that are outside the scope of this project and can report
* errors.
*
* @param message The error to report.
*
* @returns this
*/
fail(message: string): this;
/**
* Write a XML data to the parser.
*
* @param chunk The XML data to write.
*
* @returns this
*/
write(chunk: string | {} | null): this;
/**
* Close the current stream. Perform final well-formedness checks and reset
* the parser tstate.
*
* @returns this
*/
close(): this;
/**
* Get a single code point out of the current chunk. This updates the current
* position if we do position tracking.
*
* This is the algorithm to use for XML 1.0.
*
* @returns The character read.
*/
private getCode10;
/**
* Get a single code point out of the current chunk. This updates the current
* position if we do position tracking.
*
* This is the algorithm to use for XML 1.1.
*
* @returns {number} The character read.
*/
private getCode11;
/**
* Like ``getCode`` but with the return value normalized so that ``NL`` is
* returned for ``NL_LIKE``.
*/
private getCodeNorm;
private unget;
/**
* Capture characters into a buffer until encountering one of a set of
* characters.
*
* @param chars An array of codepoints. Encountering a character in the array
* ends the capture. (``chars`` may safely contain ``NL``.)
*
* @return The character code that made the capture end, or ``EOC`` if we hit
* the end of the chunk. The return value cannot be NL_LIKE: NL is returned
* instead.
*/
private captureTo;
/**
* Capture characters into a buffer until encountering a character.
*
* @param char The codepoint that ends the capture. **NOTE ``char`` MAY NOT
* CONTAIN ``NL``.** Passing ``NL`` will result in buggy behavior.
*
* @return ``true`` if we ran into the character. Otherwise, we ran into the
* end of the current chunk.
*/
private captureToChar;
/**
* Capture characters that satisfy ``isNameChar`` into the ``name`` field of
* this parser.
*
* @return The character code that made the test fail, or ``EOC`` if we hit
* the end of the chunk. The return value cannot be NL_LIKE: NL is returned
* instead.
*/
private captureNameChars;
/**
* Skip white spaces.
*
* @return The character that ended the skip, or ``EOC`` if we hit
* the end of the chunk. The return value cannot be NL_LIKE: NL is returned
* instead.
*/
private skipSpaces;
private setXMLVersion;
private sBegin;
private sBeginWhitespace;
private sDoctype;
private sDoctypeQuote;
private sDTD;
private sDTDQuoted;
private sDTDOpenWaka;
private sDTDOpenWakaBang;
private sDTDComment;
private sDTDCommentEnding;
private sDTDCommentEnded;
private sDTDPI;
private sDTDPIEnding;
private sText;
private sEntity;
private sOpenWaka;
private sOpenWakaBang;
private sComment;
private sCommentEnding;
private sCommentEnded;
private sCData;
private sCDataEnding;
private sCDataEnding2;
private sPIFirstChar;
private sPIRest;
private sPIBody;
private sPIEnding;
private sXMLDeclNameStart;
private sXMLDeclName;
private sXMLDeclEq;
private sXMLDeclValueStart;
private sXMLDeclValue;
private sXMLDeclSeparator;
private sXMLDeclEnding;
private sOpenTag;
private sOpenTagSlash;
private sAttrib;
private sAttribName;
private sAttribNameSawWhite;
private sAttribValue;
private sAttribValueQuoted;
private sAttribValueClosed;
private sAttribValueUnquoted;
private sCloseTag;
private sCloseTagSawWhite;
private handleTextInRoot;
private handleTextOutsideRoot;
private pushAttribNS;
private pushAttribPlain;
/**
* End parsing. This performs final well-formedness checks and resets the
* parser to a clean state.
*
* @returns this
*/
private end;
/**
* Resolve a namespace prefix.
*
* @param prefix The prefix to resolve.
*
* @returns The namespace URI or ``undefined`` if the prefix is not defined.
*/
resolve(prefix: string): string | undefined;
/**
* Parse a qname into its prefix and local name parts.
*
* @param name The name to parse
*
* @returns
*/
private qname;
private processAttribsNS;
private processAttribsPlain;
/**
* Handle a complete open tag. This parser code calls this once it has seen
* the whole tag. This method checks for well-formeness and then emits
* ``onopentag``.
*/
private openTag;
/**
* Handle a complete self-closing tag. This parser code calls this once it has
* seen the whole tag. This method checks for well-formeness and then emits
* ``onopentag`` and ``onclosetag``.
*/
private openSelfClosingTag;
/**
* Handle a complete close tag. This parser code calls this once it has seen
* the whole tag. This method checks for well-formeness and then emits
* ``onclosetag``.
*/
private closeTag;
/**
* Resolves an entity. Makes any necessary well-formedness checks.
*
* @param entity The entity to resolve.
*
* @returns The parsed entity.
*/
private parseEntity;
}

2064
node_modules/saxes/saxes.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/saxes/saxes.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long