@markuplint/liquid-parser 3.12.0 → 4.0.0-alpha.10

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2019 Yusuke Hirao
3
+ Copyright (c) 2017-2024 Yusuke Hirao
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -53,13 +53,3 @@ If it doesn't nest by quotations.
53
53
  <div attr={{ value }}></div>
54
54
  ```
55
55
  <!-- prettier-ignore-end -->
56
-
57
- If it mixes the tags and spaces.
58
-
59
- ```html
60
- <div attr=" {{ value }} "></div>
61
- ```
62
-
63
- ```html
64
- <div attr="{{ value }} {{ value2 }}"></div>
65
- ```
package/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { parse } from './parse';
1
+ export { parser } from './parser.js';
package/lib/index.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
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 { parser } from './parser.js';
@@ -0,0 +1,6 @@
1
+ import { HtmlParser } from '@markuplint/html-parser';
2
+ declare class LiquidParser extends HtmlParser {
3
+ constructor();
4
+ }
5
+ export declare const parser: LiquidParser;
6
+ export {};
package/lib/parser.js ADDED
@@ -0,0 +1,20 @@
1
+ import { HtmlParser } from '@markuplint/html-parser';
2
+ class LiquidParser extends HtmlParser {
3
+ constructor() {
4
+ super({
5
+ ignoreTags: [
6
+ {
7
+ type: 'liquid-block',
8
+ start: '{%',
9
+ end: '%}',
10
+ },
11
+ {
12
+ type: 'liquid-output',
13
+ start: '{{',
14
+ end: '}}',
15
+ },
16
+ ],
17
+ });
18
+ }
19
+ }
20
+ export const parser = new LiquidParser();
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "@markuplint/liquid-parser",
3
- "version": "3.12.0",
3
+ "version": "4.0.0-alpha.10",
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
- "main": "lib/index.js",
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,10 @@
16
21
  "clean": "tsc --build --clean"
17
22
  },
18
23
  "dependencies": {
19
- "@markuplint/html-parser": "3.13.0",
20
- "@markuplint/ml-ast": "3.2.0",
21
- "@markuplint/parser-utils": "3.13.0"
24
+ "@markuplint/html-parser": "4.0.0-alpha.10"
25
+ },
26
+ "devDependencies": {
27
+ "@markuplint/parser-utils": "4.0.0-alpha.10"
22
28
  },
23
- "gitHead": "b37b749d7ac0f9e6cbd022ee7031bc020c6677d3"
29
+ "gitHead": "b41153ea665aa8f091daf6114a06047f4ccb8350"
24
30
  }
package/lib/parse.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { Parse } from '@markuplint/ml-ast';
2
- export declare const parse: Parse;
package/lib/parse.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parse = void 0;
4
- const html_parser_1 = require("@markuplint/html-parser");
5
- const parser_utils_1 = require("@markuplint/parser-utils");
6
- const parse = (rawCode, options) => {
7
- const blocks = (0, parser_utils_1.ignoreBlock)(rawCode, [
8
- {
9
- type: 'liquid-block',
10
- start: /{%/,
11
- end: /%}/,
12
- },
13
- {
14
- type: 'liquid-output',
15
- start: /{{/,
16
- end: /}}/,
17
- },
18
- ]);
19
- const doc = (0, html_parser_1.parse)(blocks.replaced, options);
20
- doc.nodeList = (0, parser_utils_1.restoreNode)(doc.nodeList, blocks);
21
- return doc;
22
- };
23
- exports.parse = parse;
@@ -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
- });