Skip to content

Commit 379e8ee

Browse files
committed
Update acorn-import-meta
1 parent a2d69b7 commit 379e8ee

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

lib/import-meta/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ module.exports = function(Parser) {
3737
if (node.property.name !== "meta") {
3838
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta")
3939
}
40+
if (this.containsEsc) {
41+
this.raiseRecoverable(node.property.start, "\"meta\" in import.meta must not contain escape sequences")
42+
}
4043
return this.finishNode(node, "MetaProperty")
4144
};
4245

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"acorn-bigint": "^0.4.0",
1616
"acorn-class-fields": "^0.3.1",
1717
"acorn-export-ns-from": "^0.1.0",
18-
"acorn-import-meta": "^0.3.0",
18+
"acorn-import-meta": "^1.0.0",
1919
"acorn-numeric-separator": "^0.3.0",
2020
"acorn-private-class-elements": "^0.1.1",
2121
"acorn-static-class-features": "^0.2.0",

test/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ test('supports import.meta with sourceType: module', function (t) {
8484
t.doesNotThrow(function () {
8585
acorn.parse('console.log(import.meta.url)', { sourceType: 'module' })
8686
})
87+
t.throws(function () {
88+
acorn.parse('console.log(import.m\\u0065ta.ul)', { sourceType: 'module' })
89+
}, /must not contain escape sequences/)
8790
t.end()
8891
})
8992

0 commit comments

Comments
 (0)