diff options
Diffstat (limited to 'node_modules/posthtml-parser/dist')
5 files changed, 47 insertions, 0 deletions
diff --git a/node_modules/posthtml-parser/dist/chunk.2UQLUWPH.js b/node_modules/posthtml-parser/dist/chunk.2UQLUWPH.js new file mode 100644 index 0000000..e3e2f6d --- /dev/null +++ b/node_modules/posthtml-parser/dist/chunk.2UQLUWPH.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var i=class{constructor(t){this.source=t,this.lastPosition={line:1,column:1},this.lastIndex=0}getPosition(t){if(t<this.lastIndex)throw new Error("Source indices must be monotonic");for(;this.lastIndex<t;)this.source.charCodeAt(this.lastIndex)===10?(this.lastPosition.line++,this.lastPosition.column=1):this.lastPosition.column++,this.lastIndex++;return{line:this.lastPosition.line,column:this.lastPosition.column}}};exports.a = i; diff --git a/node_modules/posthtml-parser/dist/index.d.ts b/node_modules/posthtml-parser/dist/index.d.ts new file mode 100644 index 0000000..339f8d6 --- /dev/null +++ b/node_modules/posthtml-parser/dist/index.d.ts @@ -0,0 +1,27 @@ +import { ParserOptions } from 'htmlparser2'; +import { SourceLocation } from './location-tracker'; + +declare type Directive = { + name: string | RegExp; + start: string; + end: string; +}; +declare type Options = { + directives?: Directive[]; + sourceLocations?: boolean; + recognizeNoValueAttribute?: boolean; +} & ParserOptions; +declare type Tag = string | boolean; +declare type Attributes = Record<string, string | number | boolean>; +declare type Content = NodeText | Array<Node | Node[]>; +declare type NodeText = string | number; +declare type NodeTag = { + tag?: Tag; + attrs?: Attributes; + content?: Content; + location?: SourceLocation; +}; +declare type Node = NodeText | NodeTag; +declare const parser: (html: string, options?: Options) => Node[]; + +export { Attributes, Content, Directive, Node, NodeTag, NodeText, Options, Tag, parser }; diff --git a/node_modules/posthtml-parser/dist/index.js b/node_modules/posthtml-parser/dist/index.js new file mode 100644 index 0000000..0111a8b --- /dev/null +++ b/node_modules/posthtml-parser/dist/index.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2UQLUWPHjs = require('./chunk.2UQLUWPH.js');var _htmlparser2 = require('htmlparser2');var I={lowerCaseTags:!1,lowerCaseAttributeNames:!1,decodeEntities:!1},P=[{name:"!doctype",start:"<",end:">"}],w= exports.parser =(g,c={})=>{let a=new (0, _chunk2UQLUWPHjs.a)(g),i=[],s=[],p=0,f={};function u(){return i[i.length-1]}function y(n,t){return n.name instanceof RegExp?new RegExp(n.name.source,"i").test(t):t===n.name}function x(n){let t={};return Object.keys(n).forEach(e=>{let o={};o[e]=String(n[e]).replace(/"/g,'"'),c.recognizeNoValueAttribute&&f[e]&&(o[e]=!0),Object.assign(t,o)}),t}function A(n,t){var l;let e=P.concat((l=c.directives)!=null?l:[]),o=u();for(let d of e){let b=d.start+t+d.end;if(y(d,n.toLowerCase())){if(o===void 0){s.push(b);return}typeof o=="object"&&(o.content===void 0&&(o.content=[]),Array.isArray(o.content)&&o.content.push(b))}}}function N(n){let t=u(),e=`<!--${n}-->`;if(t===void 0){s.push(e);return}typeof t=="object"&&(t.content===void 0&&(t.content=[]),Array.isArray(t.content)&&t.content.push(e))}function m(n,t,e){e===void 0&&(f[n]=!0)}function h(n,t){let e={tag:n};c.sourceLocations&&(e.location={start:a.getPosition(r.startIndex),end:a.getPosition(r.endIndex)},p=r.endIndex),Object.keys(t).length>0&&(e.attrs=x(t)),f={},i.push(e)}function T(n,t){let e=i.pop();if(e&&typeof e=="object"&&e.location&&r.endIndex!==null&&(t?p<r.startIndex&&(e.location.end=a.getPosition(r.startIndex-1)):e.location.end=a.getPosition(r.endIndex)),e){let o=u();if(i.length<=0){s.push(e);return}typeof o=="object"&&(o.content===void 0&&(o.content=[]),Array.isArray(o.content)&&o.content.push(e))}}function v(n){let t=u();if(t===void 0){s.push(n);return}if(typeof t=="object"){if(t.content&&Array.isArray(t.content)&&t.content.length>0){let e=t.content[t.content.length-1];if(typeof e=="string"&&!e.startsWith("<!--")){t.content[t.content.length-1]=`${e}${n}`;return}}t.content===void 0&&(t.content=[]),Array.isArray(t.content)&&t.content.push(n)}}let r=new (0, _htmlparser2.Parser)({onprocessinginstruction:A,oncomment:N,onattribute:m,onopentag:h,onclosetag:T,ontext:v},{...I,...c});return r.write(g),r.end(),s};exports.parser = w; diff --git a/node_modules/posthtml-parser/dist/location-tracker.d.ts b/node_modules/posthtml-parser/dist/location-tracker.d.ts new file mode 100644 index 0000000..96dfc14 --- /dev/null +++ b/node_modules/posthtml-parser/dist/location-tracker.d.ts @@ -0,0 +1,17 @@ +declare type SourceLocation = { + start: Position; + end: Position; +}; +declare type Position = { + line: number; + column: number; +}; +declare class LocationTracker { + private readonly source; + private lastPosition; + private lastIndex; + constructor(source: string); + getPosition(index: number): Position; +} + +export { LocationTracker, Position, SourceLocation }; diff --git a/node_modules/posthtml-parser/dist/location-tracker.js b/node_modules/posthtml-parser/dist/location-tracker.js new file mode 100644 index 0000000..0fb1f0c --- /dev/null +++ b/node_modules/posthtml-parser/dist/location-tracker.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2UQLUWPHjs = require('./chunk.2UQLUWPH.js');exports.LocationTracker = _chunk2UQLUWPHjs.a; |
