Skip to content

Commit 75e80bc

Browse files
authored
Update: support ?? operator, import.meta, and export * as ns (#441)
* fix existing tests * add tests for new syntax * update acorn * update eslint-visitor-keys
1 parent ad0543c commit 75e80bc

31 files changed

+2111
-10
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
},
1919
"license": "BSD-2-Clause",
2020
"dependencies": {
21-
"acorn": "^7.1.1",
21+
"acorn": "^7.2.0",
2222
"acorn-jsx": "^5.2.0",
23-
"eslint-visitor-keys": "^1.1.0"
23+
"eslint-visitor-keys": "^1.2.0"
2424
},
2525
"devDependencies": {
2626
"browserify": "^16.5.0",
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
2-
"index": 16,
2+
"index": 17,
33
"lineNumber": 1,
4-
"column": 17,
5-
"message": "Unexpected token ."
4+
"column": 18,
5+
"message": "The only valid meta property for import is 'import.meta'"
66
};

tests/fixtures/ecma-version/11/dynamic-import/invalid-new-import.result.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ module.exports = {
33
"lineNumber": 1,
44
"column": 5,
55
"message": "Cannot use new with import()"
6-
};
6+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
module.exports = {
2+
"type": "Program",
3+
"loc": {
4+
"start": {
5+
"line": 1,
6+
"column": 0
7+
},
8+
"end": {
9+
"line": 1,
10+
"column": 28
11+
}
12+
},
13+
"range": [
14+
0,
15+
28
16+
],
17+
"body": [
18+
{
19+
"type": "ExportAllDeclaration",
20+
"loc": {
21+
"start": {
22+
"line": 1,
23+
"column": 0
24+
},
25+
"end": {
26+
"line": 1,
27+
"column": 28
28+
}
29+
},
30+
"range": [
31+
0,
32+
28
33+
],
34+
"exported": {
35+
"type": "Identifier",
36+
"loc": {
37+
"start": {
38+
"line": 1,
39+
"column": 12
40+
},
41+
"end": {
42+
"line": 1,
43+
"column": 14
44+
}
45+
},
46+
"range": [
47+
12,
48+
14
49+
],
50+
"name": "ns"
51+
},
52+
"source": {
53+
"type": "Literal",
54+
"loc": {
55+
"start": {
56+
"line": 1,
57+
"column": 20
58+
},
59+
"end": {
60+
"line": 1,
61+
"column": 28
62+
}
63+
},
64+
"range": [
65+
20,
66+
28
67+
],
68+
"value": "source",
69+
"raw": "\"source\""
70+
}
71+
}
72+
],
73+
"sourceType": "module",
74+
"tokens": [
75+
{
76+
"type": "Keyword",
77+
"value": "export",
78+
"loc": {
79+
"start": {
80+
"line": 1,
81+
"column": 0
82+
},
83+
"end": {
84+
"line": 1,
85+
"column": 6
86+
}
87+
},
88+
"range": [
89+
0,
90+
6
91+
]
92+
},
93+
{
94+
"type": "Punctuator",
95+
"value": "*",
96+
"loc": {
97+
"start": {
98+
"line": 1,
99+
"column": 7
100+
},
101+
"end": {
102+
"line": 1,
103+
"column": 8
104+
}
105+
},
106+
"range": [
107+
7,
108+
8
109+
]
110+
},
111+
{
112+
"type": "Identifier",
113+
"value": "as",
114+
"loc": {
115+
"start": {
116+
"line": 1,
117+
"column": 9
118+
},
119+
"end": {
120+
"line": 1,
121+
"column": 11
122+
}
123+
},
124+
"range": [
125+
9,
126+
11
127+
]
128+
},
129+
{
130+
"type": "Identifier",
131+
"value": "ns",
132+
"loc": {
133+
"start": {
134+
"line": 1,
135+
"column": 12
136+
},
137+
"end": {
138+
"line": 1,
139+
"column": 14
140+
}
141+
},
142+
"range": [
143+
12,
144+
14
145+
]
146+
},
147+
{
148+
"type": "Identifier",
149+
"value": "from",
150+
"loc": {
151+
"start": {
152+
"line": 1,
153+
"column": 15
154+
},
155+
"end": {
156+
"line": 1,
157+
"column": 19
158+
}
159+
},
160+
"range": [
161+
15,
162+
19
163+
]
164+
},
165+
{
166+
"type": "String",
167+
"value": "\"source\"",
168+
"loc": {
169+
"start": {
170+
"line": 1,
171+
"column": 20
172+
},
173+
"end": {
174+
"line": 1,
175+
"column": 28
176+
}
177+
},
178+
"range": [
179+
20,
180+
28
181+
]
182+
}
183+
]
184+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as ns from "source"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
module.exports = {
2+
"type": "Program",
3+
"loc": {
4+
"start": {
5+
"line": 1,
6+
"column": 0
7+
},
8+
"end": {
9+
"line": 1,
10+
"column": 22
11+
}
12+
},
13+
"range": [
14+
0,
15+
22
16+
],
17+
"body": [
18+
{
19+
"type": "ExportAllDeclaration",
20+
"loc": {
21+
"start": {
22+
"line": 1,
23+
"column": 0
24+
},
25+
"end": {
26+
"line": 1,
27+
"column": 22
28+
}
29+
},
30+
"range": [
31+
0,
32+
22
33+
],
34+
"exported": null,
35+
"source": {
36+
"type": "Literal",
37+
"loc": {
38+
"start": {
39+
"line": 1,
40+
"column": 14
41+
},
42+
"end": {
43+
"line": 1,
44+
"column": 22
45+
}
46+
},
47+
"range": [
48+
14,
49+
22
50+
],
51+
"value": "source",
52+
"raw": "\"source\""
53+
}
54+
}
55+
],
56+
"sourceType": "module",
57+
"tokens": [
58+
{
59+
"type": "Keyword",
60+
"value": "export",
61+
"loc": {
62+
"start": {
63+
"line": 1,
64+
"column": 0
65+
},
66+
"end": {
67+
"line": 1,
68+
"column": 6
69+
}
70+
},
71+
"range": [
72+
0,
73+
6
74+
]
75+
},
76+
{
77+
"type": "Punctuator",
78+
"value": "*",
79+
"loc": {
80+
"start": {
81+
"line": 1,
82+
"column": 7
83+
},
84+
"end": {
85+
"line": 1,
86+
"column": 8
87+
}
88+
},
89+
"range": [
90+
7,
91+
8
92+
]
93+
},
94+
{
95+
"type": "Identifier",
96+
"value": "from",
97+
"loc": {
98+
"start": {
99+
"line": 1,
100+
"column": 9
101+
},
102+
"end": {
103+
"line": 1,
104+
"column": 13
105+
}
106+
},
107+
"range": [
108+
9,
109+
13
110+
]
111+
},
112+
{
113+
"type": "String",
114+
"value": "\"source\"",
115+
"loc": {
116+
"start": {
117+
"line": 1,
118+
"column": 14
119+
},
120+
"end": {
121+
"line": 1,
122+
"column": 22
123+
}
124+
},
125+
"range": [
126+
14,
127+
22
128+
]
129+
}
130+
]
131+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "source"

0 commit comments

Comments
 (0)