Skip to content

Commit f3d474e

Browse files
authored
refacotor: refactor code & change to generate snapshots for the construct-tree test (#23)
* Revert "feat: implement templateRanges option (#22)" This reverts commit 2538b1e. * refactor: remove unused codes * refactor: remove unused codes * refactor: implement Pointer * refactor * refactor * refactor
1 parent 2538b1e commit f3d474e

File tree

131 files changed

+8547
-8841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+8547
-8841
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ coverage
33
dist
44
.yarn/*
55
!.yarn/releases
6-
.DS_store
6+
tsconfig.build.tsbuildinfo

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ interface ScriptTagNode extends BaseNode {
470470
openStart: OpenScriptTagStartNode;
471471
openEnd: OpenScriptTagEndNode;
472472
close: CloseScriptTagNode;
473-
children: ScriptTagContentNode[];
473+
value?: ScriptTagContentNode;
474474
}
475475
```
476476

@@ -529,7 +529,7 @@ interface StyleTagNode extends BaseNode {
529529
openStart: OpenStyleTagStartNode;
530530
openEnd: OpenStyleTagEndNode;
531531
close: CloseStyleTagNode;
532-
children: StyleTagContentNode[];
532+
value?: StyleTagContentNode;
533533
}
534534
```
535535

@@ -586,7 +586,7 @@ interface CommentNode extends BaseNode {
586586
type: "Comment";
587587
open: CommentOpenNode;
588588
close: CommentCloseNode;
589-
children: CommentContentNode[];
589+
value: CommentContentNode;
590590
}
591591
```
592592

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@typescript-eslint/parser": "^6.1.0",
2020
"eslint": "^8.23.0",
2121
"jest": "^29.6.1",
22+
"jest-file-snapshot": "0.7.0",
2223
"prettier": "^2.7.1",
2324
"rimraf": "^3.0.2",
2425
"ts-jest": "^29.1.1",

src/parser/__tests__/__snapshots__/token-adapter.spec.ts.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ exports[`parse basic 1`] = `
88
"attributes": [],
99
"children": [
1010
{
11-
"isTemplate": false,
1211
"loc": {
1312
"end": {
1413
"column": 12,
@@ -154,7 +153,6 @@ exports[`parse basic 1`] = `
154153
"value": ">",
155154
},
156155
{
157-
"isTemplate": false,
158156
"loc": {
159157
"end": {
160158
"column": 12,
@@ -202,7 +200,6 @@ exports[`parse token adapter 1`] = `
202200
"attributes": [],
203201
"children": [
204202
{
205-
"isTemplate": false,
206203
"loc": {
207204
"end": {
208205
"column": 12,
@@ -348,7 +345,6 @@ exports[`parse token adapter 1`] = `
348345
"value": ">",
349346
},
350347
{
351-
"isTemplate": false,
352348
"loc": {
353349
"end": {
354350
"column": 12,

src/parser/parse.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { Options } from "../types/parse";
77

88
export function parse(html: string, options?: Options): ParseResult {
99
const tokenAdapter = (options && options.tokenAdapter) || defaultTokenAdapter;
10-
const templateRanges = (options && options.templateRanges) || [];
11-
const { tokens } = tokenize(html, tokenAdapter, templateRanges);
10+
const { tokens } = tokenize(html, tokenAdapter);
1211
const { ast } = constructTree(tokens, undefined);
1312
return {
1413
ast: clearParent(ast),

src/tokenizer/__tests__/__input__/template-syntax-attributes-key-value.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/tokenizer/__tests__/__input__/template-syntax-attributes-key.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/tokenizer/__tests__/__input__/template-syntax-attributes-value-bare.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/tokenizer/__tests__/__input__/template-syntax-attributes-value-quote.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/tokenizer/__tests__/__input__/template-syntax-attributes.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)