Comparing version 2.0.1 to 2.1.0
@@ -30,3 +30,8 @@ export declare class SaxEventType { | ||
} | ||
export declare class Attribute extends Reader<Text> { | ||
export declare enum AttributeType { | ||
Normal = 0, | ||
JSX = 1 | ||
} | ||
export declare class Attribute extends Reader<Text | AttributeType> { | ||
type: AttributeType; | ||
name: Text; | ||
@@ -36,3 +41,3 @@ value: Text; | ||
toJSON(): { | ||
[prop: string]: Text; | ||
[prop: string]: Text | AttributeType; | ||
}; | ||
@@ -75,2 +80,8 @@ toString(): string; | ||
} | ||
interface WasmSaxParser extends WebAssembly.Exports { | ||
memory: WebAssembly.Memory; | ||
parser: (events: number) => void; | ||
write: (pointer: number, length: number) => void; | ||
end: () => void; | ||
} | ||
export interface SaxParserOptions { | ||
@@ -87,5 +98,5 @@ highWaterMark: number; | ||
events: number; | ||
wasmSaxParser?: WasmSaxParser; | ||
eventHandler: (type: SaxEventType, detail: Detail) => void; | ||
private readonly options; | ||
private wasmSaxParser; | ||
private writeBuffer; | ||
@@ -96,4 +107,4 @@ constructor(events?: number, options?: SaxParserOptions); | ||
prepareWasm(saxWasm: Uint8Array): Promise<boolean>; | ||
protected eventTrap: (event: number, ptr: number, len: number) => void; | ||
eventTrap: (event: number, ptr: number, len: number) => void; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SAXParser = exports.Tag = exports.Text = exports.ProcInst = exports.Attribute = exports.Position = exports.Reader = exports.SaxEventType = void 0; | ||
exports.SAXParser = exports.Tag = exports.Text = exports.ProcInst = exports.Attribute = exports.AttributeType = exports.Position = exports.Reader = exports.SaxEventType = void 0; | ||
class SaxEventType { | ||
@@ -42,5 +42,12 @@ } | ||
exports.Position = Position; | ||
var AttributeType; | ||
(function (AttributeType) { | ||
AttributeType[AttributeType["Normal"] = 0] = "Normal"; | ||
AttributeType[AttributeType["JSX"] = 1] = "JSX"; | ||
})(AttributeType = exports.AttributeType || (exports.AttributeType = {})); | ||
class Attribute extends Reader { | ||
constructor(buffer, ptr = 0) { | ||
super(buffer, ptr); | ||
this.type = buffer[ptr]; | ||
ptr += 1; | ||
const len = readU32(buffer, ptr); | ||
@@ -53,4 +60,4 @@ ptr += 4; | ||
toJSON() { | ||
const { name, value } = this; | ||
return { name, value }; | ||
const { name, value, type } = this; | ||
return { name, value, type }; | ||
} | ||
@@ -57,0 +64,0 @@ toString() { |
{ | ||
"name": "sax-wasm", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"repository": "https://github.com/justinwilaby/sax-wasm", | ||
@@ -5,0 +5,0 @@ "description": "An extremely fast JSX, HTML and XML parser written in Rust compiled to WebAssembly for Node and the Web", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63671
404