htmljs-parser 5.9.0 → 5.10.0

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type ParserOptions, type Range } from "./internal";
2
2
  export { TagType, ErrorCode, getLines, getLocation, getPosition, type ParserOptions as Handlers, type Position, type Location, type Ranges, type Range, } from "./internal";
3
- export { isValidStatement, isValidAttrValue, Validity, } from "./util/validators";
3
+ export { isValidStatement, isValidScriptlet, isValidAttrValue, Validity, } from "./util/validators";
4
4
  /**
5
5
  * Creates a new Marko parser.
6
6
  */
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ __export(src_exports, {
28
28
  getLocation: () => getLocation,
29
29
  getPosition: () => getPosition,
30
30
  isValidAttrValue: () => isValidAttrValue,
31
+ isValidScriptlet: () => isValidScriptlet,
31
32
  isValidStatement: () => isValidStatement
32
33
  });
33
34
  module.exports = __toCommonJS(src_exports);
@@ -2899,6 +2900,13 @@ function prepareStatement(expr) {
2899
2900
  expr.terminatedByEOL = true;
2900
2901
  expr.consumeIndentedContent = true;
2901
2902
  }
2903
+ function isValidScriptlet(code) {
2904
+ return isValid(code, true, prepareScriptlet);
2905
+ }
2906
+ function prepareScriptlet(expr) {
2907
+ expr.operators = true;
2908
+ expr.terminatedByEOL = true;
2909
+ }
2902
2910
  function isValidAttrValue(code, concise) {
2903
2911
  return isValid(code, concise, prepareAttrValue);
2904
2912
  }
@@ -2990,5 +2998,6 @@ function createParser(handlers) {
2990
2998
  getLocation,
2991
2999
  getPosition,
2992
3000
  isValidAttrValue,
3001
+ isValidScriptlet,
2993
3002
  isValidStatement
2994
3003
  });
package/dist/index.mjs CHANGED
@@ -2871,6 +2871,13 @@ function prepareStatement(expr) {
2871
2871
  expr.terminatedByEOL = true;
2872
2872
  expr.consumeIndentedContent = true;
2873
2873
  }
2874
+ function isValidScriptlet(code) {
2875
+ return isValid(code, true, prepareScriptlet);
2876
+ }
2877
+ function prepareScriptlet(expr) {
2878
+ expr.operators = true;
2879
+ expr.terminatedByEOL = true;
2880
+ }
2874
2881
  function isValidAttrValue(code, concise) {
2875
2882
  return isValid(code, concise, prepareAttrValue);
2876
2883
  }
@@ -2961,5 +2968,6 @@ export {
2961
2968
  getLocation,
2962
2969
  getPosition,
2963
2970
  isValidAttrValue,
2971
+ isValidScriptlet,
2964
2972
  isValidStatement
2965
2973
  };
@@ -4,4 +4,5 @@ export declare enum Validity {
4
4
  enclosed = 2
5
5
  }
6
6
  export declare function isValidStatement(code: string): Validity;
7
+ export declare function isValidScriptlet(code: string): Validity;
7
8
  export declare function isValidAttrValue(code: string, concise: boolean): Validity;
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.9.0",
4
+ "version": "5.10.0",
5
5
  "devDependencies": {
6
6
  "@changesets/changelog-github": "^0.5.0",
7
7
  "@changesets/cli": "^2.27.1",