htmljs-parser 5.9.0 → 5.10.1
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 +1 -1
- package/dist/index.js +11 -0
- package/dist/index.mjs +10 -0
- package/dist/util/validators.d.ts +1 -0
- package/package.json +1 -1
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);
|
|
@@ -1249,6 +1250,8 @@ function handleDelimitedBlockEOL(parser, first, newLineLength, {
|
|
|
1249
1250
|
parser.pos = pos;
|
|
1250
1251
|
parser.exitState();
|
|
1251
1252
|
parser.exitState();
|
|
1253
|
+
} else if (!first && parser.pos + newLineLength !== parser.maxPos) {
|
|
1254
|
+
parser.startText();
|
|
1252
1255
|
}
|
|
1253
1256
|
}
|
|
1254
1257
|
|
|
@@ -2899,6 +2902,13 @@ function prepareStatement(expr) {
|
|
|
2899
2902
|
expr.terminatedByEOL = true;
|
|
2900
2903
|
expr.consumeIndentedContent = true;
|
|
2901
2904
|
}
|
|
2905
|
+
function isValidScriptlet(code) {
|
|
2906
|
+
return isValid(code, true, prepareScriptlet);
|
|
2907
|
+
}
|
|
2908
|
+
function prepareScriptlet(expr) {
|
|
2909
|
+
expr.operators = true;
|
|
2910
|
+
expr.terminatedByEOL = true;
|
|
2911
|
+
}
|
|
2902
2912
|
function isValidAttrValue(code, concise) {
|
|
2903
2913
|
return isValid(code, concise, prepareAttrValue);
|
|
2904
2914
|
}
|
|
@@ -2990,5 +3000,6 @@ function createParser(handlers) {
|
|
|
2990
3000
|
getLocation,
|
|
2991
3001
|
getPosition,
|
|
2992
3002
|
isValidAttrValue,
|
|
3003
|
+
isValidScriptlet,
|
|
2993
3004
|
isValidStatement
|
|
2994
3005
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1221,6 +1221,8 @@ function handleDelimitedBlockEOL(parser, first, newLineLength, {
|
|
|
1221
1221
|
parser.pos = pos;
|
|
1222
1222
|
parser.exitState();
|
|
1223
1223
|
parser.exitState();
|
|
1224
|
+
} else if (!first && parser.pos + newLineLength !== parser.maxPos) {
|
|
1225
|
+
parser.startText();
|
|
1224
1226
|
}
|
|
1225
1227
|
}
|
|
1226
1228
|
|
|
@@ -2871,6 +2873,13 @@ function prepareStatement(expr) {
|
|
|
2871
2873
|
expr.terminatedByEOL = true;
|
|
2872
2874
|
expr.consumeIndentedContent = true;
|
|
2873
2875
|
}
|
|
2876
|
+
function isValidScriptlet(code) {
|
|
2877
|
+
return isValid(code, true, prepareScriptlet);
|
|
2878
|
+
}
|
|
2879
|
+
function prepareScriptlet(expr) {
|
|
2880
|
+
expr.operators = true;
|
|
2881
|
+
expr.terminatedByEOL = true;
|
|
2882
|
+
}
|
|
2874
2883
|
function isValidAttrValue(code, concise) {
|
|
2875
2884
|
return isValid(code, concise, prepareAttrValue);
|
|
2876
2885
|
}
|
|
@@ -2961,5 +2970,6 @@ export {
|
|
|
2961
2970
|
getLocation,
|
|
2962
2971
|
getPosition,
|
|
2963
2972
|
isValidAttrValue,
|
|
2973
|
+
isValidScriptlet,
|
|
2964
2974
|
isValidStatement
|
|
2965
2975
|
};
|
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
|
+
"version": "5.10.1",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@changesets/changelog-github": "^0.5.0",
|
|
7
7
|
"@changesets/cli": "^2.27.1",
|