acorn-import-assertions
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -10,2 +10,4 @@ "use strict"; | ||
var _charcodes = require("charcodes"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -54,8 +56,16 @@ | ||
} | ||
} // ensure that the word is at the correct location | ||
} // ensure that the keyword is at the correct location | ||
// ie `assert{...` or `assert {...` | ||
if (this._codeAt(this.pos + i) !== 32 && this._codeAt(this.pos + i) !== 123) { | ||
return super.readToken(code); | ||
for (;; i++) { | ||
if (this._codeAt(this.pos + i) === _charcodes.leftCurlyBrace) { | ||
// Found '{' | ||
break; | ||
} else if (this._codeAt(this.pos + i) === _charcodes.space) { | ||
// white space is allowed between `assert` and `{`, so continue. | ||
continue; | ||
} else { | ||
return super.readToken(code); | ||
} | ||
} // If we're inside a dynamic import expression we'll parse | ||
@@ -62,0 +72,0 @@ // the `assert` keyword as a standard object property name |
{ | ||
"name": "acorn-import-assertions", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "Support for import assertions in acorn", | ||
@@ -38,3 +38,5 @@ "main": "lib/index.js", | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"charcodes": "^0.2.0" | ||
}, | ||
"browserslist": [ | ||
@@ -41,0 +43,0 @@ "maintained node versions" |
import _acorn from "acorn"; | ||
import { leftCurlyBrace, space } from "charcodes"; | ||
@@ -40,6 +41,14 @@ const keyword = "assert"; | ||
// ensure that the word is at the correct location | ||
// ensure that the keyword is at the correct location | ||
// ie `assert{...` or `assert {...` | ||
if (this._codeAt(this.pos + i) !== 32 && this._codeAt(this.pos + i) !== 123) { | ||
return super.readToken(code); | ||
for (;; i++) { | ||
if (this._codeAt(this.pos + i) === leftCurlyBrace) { | ||
// Found '{' | ||
break; | ||
} else if (this._codeAt(this.pos + i) === space) { | ||
// white space is allowed between `assert` and `{`, so continue. | ||
continue; | ||
} else { | ||
return super.readToken(code); | ||
} | ||
} | ||
@@ -46,0 +55,0 @@ |
Sorry, the diff of this file is not supported yet
24923
647
2
+ Addedcharcodes@^0.2.0
+ Addedcharcodes@0.2.0(transitive)