htmljs-parser 5.4.1 → 5.4.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/dist/index.js CHANGED
@@ -382,6 +382,7 @@ __export(states_exports, {
382
382
  JS_COMMENT_BLOCK: () => JS_COMMENT_BLOCK,
383
383
  JS_COMMENT_LINE: () => JS_COMMENT_LINE,
384
384
  OPEN_TAG: () => OPEN_TAG,
385
+ PARSED_STRING: () => PARSED_STRING,
385
386
  PARSED_TEXT_CONTENT: () => PARSED_TEXT_CONTENT,
386
387
  PLACEHOLDER: () => PLACEHOLDER,
387
388
  REGULAR_EXPRESSION: () => REGULAR_EXPRESSION,
@@ -2259,6 +2260,11 @@ var PARSED_TEXT_CONTENT = {
2259
2260
  this.startText();
2260
2261
  this.enterState(states_exports.TEMPLATE_STRING);
2261
2262
  break;
2263
+ case 34 /* DOUBLE_QUOTE */:
2264
+ case 39 /* SINGLE_QUOTE */:
2265
+ this.startText();
2266
+ this.enterState(states_exports.PARSED_STRING).quoteCharCode = code;
2267
+ break;
2262
2268
  default:
2263
2269
  if (!states_exports.checkForPlaceholder(this, code))
2264
2270
  this.startText();
@@ -2624,6 +2630,41 @@ var TEMPLATE_STRING = {
2624
2630
  }
2625
2631
  };
2626
2632
 
2633
+ // src/states/PARSED_STRING.ts
2634
+ var PARSED_STRING = {
2635
+ name: "PARSED_STRING",
2636
+ enter(parent, start) {
2637
+ return {
2638
+ state: PARSED_STRING,
2639
+ parent,
2640
+ start,
2641
+ end: start,
2642
+ quoteCharCode: 34 /* DOUBLE_QUOTE */
2643
+ };
2644
+ },
2645
+ exit() {
2646
+ },
2647
+ char(code, str) {
2648
+ if (code === str.quoteCharCode) {
2649
+ this.pos++;
2650
+ this.exitState();
2651
+ } else if (!states_exports.checkForPlaceholder(this, code)) {
2652
+ this.startText();
2653
+ }
2654
+ },
2655
+ eof(str) {
2656
+ this.emitError(
2657
+ str,
2658
+ 13 /* INVALID_TEMPLATE_STRING */,
2659
+ "EOF reached while parsing string expression"
2660
+ );
2661
+ },
2662
+ eol() {
2663
+ },
2664
+ return() {
2665
+ }
2666
+ };
2667
+
2627
2668
  // src/index.ts
2628
2669
  function createParser(handlers) {
2629
2670
  const parser = new Parser(handlers);
package/dist/index.mjs CHANGED
@@ -357,6 +357,7 @@ __export(states_exports, {
357
357
  JS_COMMENT_BLOCK: () => JS_COMMENT_BLOCK,
358
358
  JS_COMMENT_LINE: () => JS_COMMENT_LINE,
359
359
  OPEN_TAG: () => OPEN_TAG,
360
+ PARSED_STRING: () => PARSED_STRING,
360
361
  PARSED_TEXT_CONTENT: () => PARSED_TEXT_CONTENT,
361
362
  PLACEHOLDER: () => PLACEHOLDER,
362
363
  REGULAR_EXPRESSION: () => REGULAR_EXPRESSION,
@@ -2234,6 +2235,11 @@ var PARSED_TEXT_CONTENT = {
2234
2235
  this.startText();
2235
2236
  this.enterState(states_exports.TEMPLATE_STRING);
2236
2237
  break;
2238
+ case 34 /* DOUBLE_QUOTE */:
2239
+ case 39 /* SINGLE_QUOTE */:
2240
+ this.startText();
2241
+ this.enterState(states_exports.PARSED_STRING).quoteCharCode = code;
2242
+ break;
2237
2243
  default:
2238
2244
  if (!states_exports.checkForPlaceholder(this, code))
2239
2245
  this.startText();
@@ -2599,6 +2605,41 @@ var TEMPLATE_STRING = {
2599
2605
  }
2600
2606
  };
2601
2607
 
2608
+ // src/states/PARSED_STRING.ts
2609
+ var PARSED_STRING = {
2610
+ name: "PARSED_STRING",
2611
+ enter(parent, start) {
2612
+ return {
2613
+ state: PARSED_STRING,
2614
+ parent,
2615
+ start,
2616
+ end: start,
2617
+ quoteCharCode: 34 /* DOUBLE_QUOTE */
2618
+ };
2619
+ },
2620
+ exit() {
2621
+ },
2622
+ char(code, str) {
2623
+ if (code === str.quoteCharCode) {
2624
+ this.pos++;
2625
+ this.exitState();
2626
+ } else if (!states_exports.checkForPlaceholder(this, code)) {
2627
+ this.startText();
2628
+ }
2629
+ },
2630
+ eof(str) {
2631
+ this.emitError(
2632
+ str,
2633
+ 13 /* INVALID_TEMPLATE_STRING */,
2634
+ "EOF reached while parsing string expression"
2635
+ );
2636
+ },
2637
+ eol() {
2638
+ },
2639
+ return() {
2640
+ }
2641
+ };
2642
+
2602
2643
  // src/index.ts
2603
2644
  function createParser(handlers) {
2604
2645
  const parser = new Parser(handlers);
@@ -0,0 +1,6 @@
1
+ import { StateDefinition, Meta } from "../internal";
2
+ interface ParsedStringMeta extends Meta {
3
+ quoteCharCode: number;
4
+ }
5
+ export declare const PARSED_STRING: StateDefinition<ParsedStringMeta>;
6
+ export {};
@@ -17,4 +17,5 @@ export * from "./REGULAR_EXPRESSION";
17
17
  export * from "./STRING";
18
18
  export * from "./TAG_NAME";
19
19
  export * from "./TEMPLATE_STRING";
20
+ export * from "./PARSED_STRING";
20
21
  export * from "./OPEN_TAG";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "htmljs-parser",
3
3
  "description": "An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values",
4
- "version": "5.4.1",
4
+ "version": "5.4.2",
5
5
  "devDependencies": {
6
6
  "@changesets/changelog-github": "^0.4.7",
7
7
  "@changesets/cli": "^2.25.2",