@markuplint/liquid-parser 3.9.0 → 4.0.0-alpha.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/lib/index.d.ts +1 -1
- package/lib/index.js +1 -5
- package/lib/parse.js +6 -10
- package/package.json +11 -6
- package/test/index.spec.js +0 -11
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { parse } from './parse';
|
|
1
|
+
export { parse } from './parse.js';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parse = void 0;
|
|
4
|
-
var parse_1 = require("./parse");
|
|
5
|
-
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
|
|
1
|
+
export { parse } from './parse.js';
|
package/lib/parse.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const parser_utils_1 = require("@markuplint/parser-utils");
|
|
6
|
-
const parse = (rawCode, options) => {
|
|
7
|
-
const blocks = (0, parser_utils_1.ignoreBlock)(rawCode, [
|
|
1
|
+
import { parse as htmlParse } from '@markuplint/html-parser';
|
|
2
|
+
import { ignoreBlock, restoreNode } from '@markuplint/parser-utils';
|
|
3
|
+
export const parse = (rawCode, options) => {
|
|
4
|
+
const blocks = ignoreBlock(rawCode, [
|
|
8
5
|
{
|
|
9
6
|
type: 'liquid-block',
|
|
10
7
|
start: /{%/,
|
|
@@ -16,8 +13,7 @@ const parse = (rawCode, options) => {
|
|
|
16
13
|
end: /}}/,
|
|
17
14
|
},
|
|
18
15
|
]);
|
|
19
|
-
const doc = (
|
|
20
|
-
doc.nodeList =
|
|
16
|
+
const doc = htmlParse(blocks.replaced, options);
|
|
17
|
+
doc.nodeList = restoreNode(doc.nodeList, blocks);
|
|
21
18
|
return doc;
|
|
22
19
|
};
|
|
23
|
-
exports.parse = parse;
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/liquid-parser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "Liquid template parser for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
|
-
"
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./lib/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
10
15
|
"types": "lib/index.d.ts",
|
|
11
16
|
"publishConfig": {
|
|
12
17
|
"access": "public"
|
|
@@ -16,9 +21,9 @@
|
|
|
16
21
|
"clean": "tsc --build --clean"
|
|
17
22
|
},
|
|
18
23
|
"dependencies": {
|
|
19
|
-
"@markuplint/html-parser": "
|
|
20
|
-
"@markuplint/ml-ast": "
|
|
21
|
-
"@markuplint/parser-utils": "
|
|
24
|
+
"@markuplint/html-parser": "4.0.0-alpha.1",
|
|
25
|
+
"@markuplint/ml-ast": "4.0.0-alpha.1",
|
|
26
|
+
"@markuplint/parser-utils": "4.0.0-alpha.1"
|
|
22
27
|
},
|
|
23
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "22502ee22a378ae766033d687dbc0443e5ed35dc"
|
|
24
29
|
}
|
package/test/index.spec.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const { parse } = require('../lib/');
|
|
2
|
-
|
|
3
|
-
describe('Tags', () => {
|
|
4
|
-
it('liquid-block', () => {
|
|
5
|
-
expect(parse('{% any %}').nodeList[0].nodeName).toBe('#ps:liquid-block');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
it('liquid-output', () => {
|
|
9
|
-
expect(parse('{{ any }}').nodeList[0].nodeName).toBe('#ps:liquid-output');
|
|
10
|
-
});
|
|
11
|
-
});
|