acorn-import-assertions
Advanced tools
+13
-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 |
+12
-3
| 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 @@ |
+4
-2
| { | ||
| "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" |
+12
-3
| 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 @@ |
24923
3.58%647
4.35%2
100%+ Added
+ Added