Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
90
my-app/node_modules/parse5-html-rewriting-stream/dist/index.d.ts
generated
vendored
Executable file
90
my-app/node_modules/parse5-html-rewriting-stream/dist/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,90 @@
|
|||
import { SAXParser, type EndTag, type StartTag, type Doctype, type Text, type Comment, type SaxToken } from 'parse5-sax-parser';
|
||||
/**
|
||||
* Streaming [SAX](https://en.wikipedia.org/wiki/Simple_API_for_XML)-style HTML rewriter.
|
||||
* A [transform stream](https://nodejs.org/api/stream.html#stream_class_stream_transform) (which means you can pipe _through_ it, see example).
|
||||
*
|
||||
* The rewriter uses the raw source representation of tokens if they are not modified by the user. Therefore, the resulting
|
||||
* HTML is not affected by parser error-recovery mechanisms as in a classical parsing-serialization roundtrip.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const RewritingStream = require('parse5-html-rewriting-stream');
|
||||
* const http = require('http');
|
||||
* const fs = require('fs');
|
||||
*
|
||||
* const file = fs.createWriteStream('/home/google.com.html');
|
||||
* const rewriter = new RewritingStream();
|
||||
*
|
||||
* // Replace divs with spans
|
||||
* rewriter.on('startTag', startTag => {
|
||||
* if (startTag.tagName === 'span') {
|
||||
* startTag.tagName = 'div';
|
||||
* }
|
||||
*
|
||||
* rewriter.emitStartTag(startTag);
|
||||
* });
|
||||
*
|
||||
* rewriter.on('endTag', endTag => {
|
||||
* if (endTag.tagName === 'span') {
|
||||
* endTag.tagName = 'div';
|
||||
* }
|
||||
*
|
||||
* rewriter.emitEndTag(endTag);
|
||||
* });
|
||||
*
|
||||
* // Wrap all text nodes with an <i> tag
|
||||
* rewriter.on('text', (_, raw) => {
|
||||
* // Use the raw representation of text without HTML entities decoding
|
||||
* rewriter.emitRaw(`<i>${raw}</i>`);
|
||||
* });
|
||||
*
|
||||
* http.get('http://google.com', res => {
|
||||
* // Assumes response is UTF-8.
|
||||
* res.setEncoding('utf8');
|
||||
* // `RewritingStream` is a `Transform` stream, which means you can pipe
|
||||
* // through it.
|
||||
* res.pipe(rewriter).pipe(file);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export declare class RewritingStream extends SAXParser {
|
||||
/** Note: `sourceCodeLocationInfo` is always enabled. */
|
||||
constructor();
|
||||
_transformChunk(chunk: string): string;
|
||||
private _getRawHtml;
|
||||
protected emitIfListenerExists(eventName: string, token: SaxToken): boolean;
|
||||
protected _emitToken(eventName: string, token: SaxToken): void;
|
||||
/** Emits a serialized document type token into the output stream. */
|
||||
emitDoctype(token: Doctype): void;
|
||||
/** Emits a serialized start tag token into the output stream. */
|
||||
emitStartTag(token: StartTag): void;
|
||||
/** Emits a serialized end tag token into the output stream. */
|
||||
emitEndTag(token: EndTag): void;
|
||||
/** Emits a serialized text token into the output stream. */
|
||||
emitText({ text }: Text): void;
|
||||
/** Emits a serialized comment token into the output stream. */
|
||||
emitComment(token: Comment): void;
|
||||
/** Emits a raw HTML string into the output stream. */
|
||||
emitRaw(html: string): void;
|
||||
}
|
||||
export interface RewritingStream {
|
||||
/** Raised when the rewriter encounters a start tag. */
|
||||
on(event: 'startTag', listener: (startTag: StartTag, rawHtml: string) => void): this;
|
||||
/** Raised when rewriter encounters an end tag. */
|
||||
on(event: 'endTag', listener: (endTag: EndTag, rawHtml: string) => void): this;
|
||||
/** Raised when rewriter encounters a comment. */
|
||||
on(event: 'comment', listener: (comment: Comment, rawHtml: string) => void): this;
|
||||
/** Raised when rewriter encounters text content. */
|
||||
on(event: 'text', listener: (text: Text, rawHtml: string) => void): this;
|
||||
/** Raised when rewriter encounters a [document type declaration](https://en.wikipedia.org/wiki/Document_type_declaration). */
|
||||
on(event: 'doctype', listener: (doctype: Doctype, rawHtml: string) => void): this;
|
||||
/**
|
||||
* Base event handler.
|
||||
*
|
||||
* @param event Name of the event
|
||||
* @param handler Event handler
|
||||
*/
|
||||
on(event: string, handler: (...args: any[]) => void): this;
|
||||
}
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
my-app/node_modules/parse5-html-rewriting-stream/dist/index.d.ts.map
generated
vendored
Executable file
1
my-app/node_modules/parse5-html-rewriting-stream/dist/index.d.ts.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,SAAS,EACT,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,QAAQ,EAChB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,qBAAa,eAAgB,SAAQ,SAAS;IAC1C,wDAAwD;;IAK/C,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO/C,OAAO,CAAC,WAAW;cASA,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO;cAYjE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAIvE,qEAAqE;IAC9D,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAkBxC,iEAAiE;IAC1D,YAAY,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAY1C,+DAA+D;IACxD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAItC,4DAA4D;IACrD,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,GAAG,IAAI;IASrC,+DAA+D;IACxD,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAIxC,sDAAsD;IAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGrC;AAED,MAAM,WAAW,eAAe;IAC5B,uDAAuD;IACvD,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACrF,kDAAkD;IAClD,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAC/E,iDAAiD;IACjD,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAClF,oDAAoD;IACpD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACzE,8HAA8H;IAC9H,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAElF;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9D"}
|
128
my-app/node_modules/parse5-html-rewriting-stream/dist/index.js
generated
vendored
Executable file
128
my-app/node_modules/parse5-html-rewriting-stream/dist/index.js
generated
vendored
Executable file
|
@ -0,0 +1,128 @@
|
|||
import { html } from 'parse5';
|
||||
import { SAXParser, } from 'parse5-sax-parser';
|
||||
import { escapeText, escapeAttribute } from 'entities/lib/escape.js';
|
||||
/**
|
||||
* Streaming [SAX](https://en.wikipedia.org/wiki/Simple_API_for_XML)-style HTML rewriter.
|
||||
* A [transform stream](https://nodejs.org/api/stream.html#stream_class_stream_transform) (which means you can pipe _through_ it, see example).
|
||||
*
|
||||
* The rewriter uses the raw source representation of tokens if they are not modified by the user. Therefore, the resulting
|
||||
* HTML is not affected by parser error-recovery mechanisms as in a classical parsing-serialization roundtrip.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const RewritingStream = require('parse5-html-rewriting-stream');
|
||||
* const http = require('http');
|
||||
* const fs = require('fs');
|
||||
*
|
||||
* const file = fs.createWriteStream('/home/google.com.html');
|
||||
* const rewriter = new RewritingStream();
|
||||
*
|
||||
* // Replace divs with spans
|
||||
* rewriter.on('startTag', startTag => {
|
||||
* if (startTag.tagName === 'span') {
|
||||
* startTag.tagName = 'div';
|
||||
* }
|
||||
*
|
||||
* rewriter.emitStartTag(startTag);
|
||||
* });
|
||||
*
|
||||
* rewriter.on('endTag', endTag => {
|
||||
* if (endTag.tagName === 'span') {
|
||||
* endTag.tagName = 'div';
|
||||
* }
|
||||
*
|
||||
* rewriter.emitEndTag(endTag);
|
||||
* });
|
||||
*
|
||||
* // Wrap all text nodes with an <i> tag
|
||||
* rewriter.on('text', (_, raw) => {
|
||||
* // Use the raw representation of text without HTML entities decoding
|
||||
* rewriter.emitRaw(`<i>${raw}</i>`);
|
||||
* });
|
||||
*
|
||||
* http.get('http://google.com', res => {
|
||||
* // Assumes response is UTF-8.
|
||||
* res.setEncoding('utf8');
|
||||
* // `RewritingStream` is a `Transform` stream, which means you can pipe
|
||||
* // through it.
|
||||
* res.pipe(rewriter).pipe(file);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export class RewritingStream extends SAXParser {
|
||||
/** Note: `sourceCodeLocationInfo` is always enabled. */
|
||||
constructor() {
|
||||
super({ sourceCodeLocationInfo: true });
|
||||
}
|
||||
_transformChunk(chunk) {
|
||||
// NOTE: ignore upstream return values as we want to push to
|
||||
// the `Writable` part of the `Transform` stream ourselves.
|
||||
super._transformChunk(chunk);
|
||||
return '';
|
||||
}
|
||||
_getRawHtml(location) {
|
||||
const { droppedBufferSize, html } = this.tokenizer.preprocessor;
|
||||
const start = location.startOffset - droppedBufferSize;
|
||||
const end = location.endOffset - droppedBufferSize;
|
||||
return html.slice(start, end);
|
||||
}
|
||||
// Events
|
||||
emitIfListenerExists(eventName, token) {
|
||||
if (!super.emitIfListenerExists(eventName, token)) {
|
||||
this.emitRaw(this._getRawHtml(token.sourceCodeLocation));
|
||||
}
|
||||
// NOTE: don't skip new lines after `<pre>` and other tags,
|
||||
// otherwise we'll have incorrect raw data.
|
||||
this.parserFeedbackSimulator.skipNextNewLine = false;
|
||||
return true;
|
||||
}
|
||||
// Emitter API
|
||||
_emitToken(eventName, token) {
|
||||
this.emit(eventName, token, this._getRawHtml(token.sourceCodeLocation));
|
||||
}
|
||||
/** Emits a serialized document type token into the output stream. */
|
||||
emitDoctype(token) {
|
||||
let res = `<!DOCTYPE ${token.name}`;
|
||||
if (token.publicId !== null) {
|
||||
res += ` PUBLIC "${token.publicId}"`;
|
||||
}
|
||||
else if (token.systemId !== null) {
|
||||
res += ' SYSTEM';
|
||||
}
|
||||
if (token.systemId !== null) {
|
||||
res += ` "${token.systemId}"`;
|
||||
}
|
||||
res += '>';
|
||||
this.push(res);
|
||||
}
|
||||
/** Emits a serialized start tag token into the output stream. */
|
||||
emitStartTag(token) {
|
||||
let res = `<${token.tagName}`;
|
||||
for (const attr of token.attrs) {
|
||||
res += ` ${attr.name}="${escapeAttribute(attr.value)}"`;
|
||||
}
|
||||
res += token.selfClosing ? '/>' : '>';
|
||||
this.push(res);
|
||||
}
|
||||
/** Emits a serialized end tag token into the output stream. */
|
||||
emitEndTag(token) {
|
||||
this.push(`</${token.tagName}>`);
|
||||
}
|
||||
/** Emits a serialized text token into the output stream. */
|
||||
emitText({ text }) {
|
||||
this.push(!this.parserFeedbackSimulator.inForeignContent &&
|
||||
html.hasUnescapedText(this.tokenizer.lastStartTagName, true)
|
||||
? text
|
||||
: escapeText(text));
|
||||
}
|
||||
/** Emits a serialized comment token into the output stream. */
|
||||
emitComment(token) {
|
||||
this.push(`<!--${token.text}-->`);
|
||||
}
|
||||
/** Emits a raw HTML string into the output stream. */
|
||||
emitRaw(html) {
|
||||
this.push(html);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
my-app/node_modules/parse5-html-rewriting-stream/dist/index.js.map
generated
vendored
Executable file
1
my-app/node_modules/parse5-html-rewriting-stream/dist/index.js.map
generated
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACH,SAAS,GAOZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC1C,wDAAwD;IACxD;QACI,KAAK,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAEQ,eAAe,CAAC,KAAa;QAClC,4DAA4D;QAC5D,2DAA2D;QAC3D,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,EAAE,CAAC;IACd,CAAC;IAEO,WAAW,CAAC,QAAwB;QACxC,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QAChE,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,GAAG,iBAAiB,CAAC;QACvD,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,GAAG,iBAAiB,CAAC;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,SAAS;IACU,oBAAoB,CAAC,SAAiB,EAAE,KAAe;QACtE,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YAC/C,I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