htmljs-parser 3.1.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +343 -537
- package/dist/core/Parser.d.ts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +149 -140
- package/dist/index.mjs +147 -139
- package/dist/states/OPEN_TAG.d.ts +3 -3
- package/dist/util/constants.d.ts +37 -13
- package/dist/util/util.d.ts +1 -1
- package/package.json +2 -2
package/dist/core/Parser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STATE, Range,
|
|
1
|
+
import { STATE, Range, ParserOptions as Options, ErrorCode } from "../internal";
|
|
2
2
|
export interface Meta extends Range {
|
|
3
3
|
parent: Meta;
|
|
4
4
|
state: StateDefinition;
|
|
@@ -15,7 +15,7 @@ export interface StateDefinition<P extends Meta = Meta> {
|
|
|
15
15
|
return: (this: Parser, child: Meta, activeRange: P) => void;
|
|
16
16
|
}
|
|
17
17
|
export declare class Parser {
|
|
18
|
-
|
|
18
|
+
options: Options;
|
|
19
19
|
pos: number;
|
|
20
20
|
maxPos: number;
|
|
21
21
|
data: string;
|
|
@@ -30,7 +30,7 @@ export declare class Parser {
|
|
|
30
30
|
endingMixedModeAtEOL?: boolean;
|
|
31
31
|
textPos: number;
|
|
32
32
|
lines: undefined | number[];
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(options: Options);
|
|
34
34
|
read(range: Range): string;
|
|
35
35
|
positionAt(index: number): import("../internal").Position;
|
|
36
36
|
locationAt(range: Range): import("../internal").Location;
|
|
@@ -56,7 +56,7 @@ export declare class Parser {
|
|
|
56
56
|
* tags within a block are properly closed.
|
|
57
57
|
*/
|
|
58
58
|
beginHtmlBlock(delimiter: string | undefined, singleLine: boolean): void;
|
|
59
|
-
emitError(range: number | Range, code:
|
|
59
|
+
emitError(range: number | Range, code: ErrorCode, message: string): void;
|
|
60
60
|
closeTag(start: number, end: number, value: Range | undefined): void;
|
|
61
61
|
consumeWhitespaceIfBefore(str: string, start?: number): boolean;
|
|
62
62
|
getPreviousNonWhitespaceCharCode(start?: number): number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export {
|
|
1
|
+
import { type ParserOptions, type Range } from "./internal";
|
|
2
|
+
export { TagType, ErrorCode, type ParserOptions as Handlers, type Position, type Location, type Ranges, type Range, } from "./internal";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new Marko parser.
|
|
5
5
|
*/
|
|
6
|
-
export declare function createParser(handlers:
|
|
6
|
+
export declare function createParser(handlers: ParserOptions): {
|
|
7
7
|
/**
|
|
8
8
|
* Parses code and calls the provided handlers.
|
|
9
9
|
*/
|
|
@@ -15,7 +15,7 @@ export declare function createParser(handlers: Handlers): {
|
|
|
15
15
|
/**
|
|
16
16
|
* Given a offset in the current source code, returns a Position object with line & character information.
|
|
17
17
|
*/
|
|
18
|
-
positionAt(
|
|
18
|
+
positionAt(offset: number): import("./internal").Position;
|
|
19
19
|
/**
|
|
20
20
|
* Given a offset range in the current source code, returns a Location object with a start & end position information.
|
|
21
21
|
*/
|