Socket
Socket
Sign inDemoInstall

acorn-class-fields

Package Overview
Dependencies
2
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.6 to 0.3.7

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.3.7 (2020-08-13)
* Don't break methods with line break after name
* Mark as compatible with acorn@8
* Support await in field initializers
## 0.3.6 (2020-06-11)

@@ -2,0 +8,0 @@

10

index.js

@@ -15,3 +15,5 @@ "use strict"

this._inFieldValue = true
field.value = this.parseExpression()
if (this.type === tt.name && this.value === "await" && (this.inAsync || this.options.allowAwaitOutsideFunction)) {
field.value = this.parseAwait()
} else field.value = this.parseExpression()
this._inFieldValue = oldInFieldValue

@@ -33,3 +35,7 @@ } else field.value = null

} else branch.next(true)
if (branch.type == tt.eq || branch.canInsertSemicolon() || branch.type == tt.semi) {
let isField = branch.type == tt.eq || branch.type == tt.semi
if (!isField && branch.canInsertSemicolon()) {
isField = branch.type != tt.parenL
}
if (isField) {
const node = this.startNode()

@@ -36,0 +42,0 @@ if (this.type == this.privateNameToken) {

10

package.json

@@ -22,16 +22,16 @@ {

"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0"
"acorn": "^6 || ^7 || ^8"
},
"version": "0.3.6",
"version": "0.3.7",
"devDependencies": {
"acorn": "^6.0.0 || ^7.0.0",
"acorn": "^8",
"eslint": "^7.2",
"eslint-plugin-node": "^11",
"mocha": "^8",
"test262": "git+https://github.com/tc39/test262.git#adf2cf4204a748463cacb68f07d0d006b00c3821",
"test262": "git+https://github.com/tc39/test262.git#e0758bbeacac7776dae2a69f88eb4742f0930d7c",
"test262-parser-runner": "^0.5.0"
},
"dependencies": {
"acorn-private-class-elements": "^0.2.6"
"acorn-private-class-elements": "^0.2.7"
}
}
"use strict"
const fs = require("fs")
const path = require("path")

@@ -13,4 +12,3 @@ const run = require("test262-parser-runner")

"class-static-fields-private",
"class-static-methods-private",
"optional-chaining"
"class-static-methods-private"
]

@@ -25,4 +23,3 @@

skip: test => (!test.attrs.features || !implementedFeatures.some(f => test.attrs.features.includes(f)) || unsupportedFeatures.some(f => test.attrs.features.includes(f))),
whitelist: fs.readFileSync("./test262.whitelist", "utf8").split("\n").filter(v => v && v[0] !== "#")
}
)

@@ -9,3 +9,3 @@ "use strict"

it(text, function () {
const result = Parser.parse(text, Object.assign({ ecmaVersion: 9 }, additionalOptions))
const result = Parser.parse(text, Object.assign({ ecmaVersion: 9, allowAwaitOutsideFunction: true }, additionalOptions))
if (expectedResult) {

@@ -62,2 +62,8 @@ assert.deepStrictEqual(result.body[0], expectedResult)

test(`
class Class {
value = await getValue();
}
`)
test(`class Counter extends HTMLElement {

@@ -368,3 +374,19 @@ #x = 0;

test("var C = class { bre\\u0061k() { return 42; }}")
test(`class X {
x
() {}
}`)
test(`class X {
static x
() {}
}`)
test(`class X {
get
y() {}
}`)
test(`class X {
static;
async;
y() {}
}`)
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc