Socket
Socket
Sign inDemoInstall

acorn-private-class-elements

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn-private-class-elements - npm Package Compare versions

Comparing version 0.2.0 to 0.2.3

2

.eslintrc.json

@@ -84,3 +84,3 @@ {

"getter-return": "error",
"global-require": "error",
"global-require": "warn",
"guard-for-in": "error",

@@ -87,0 +87,0 @@ "handle-callback-err": "error",

@@ -0,1 +1,8 @@

## 0.2.3 (2020-04-22)
(Skipped 0.2.1 and 0.2.2 because I accidentally called 0.2.0 0.2.2 in git)
* Use injected acorn instance if available
* Uses `Object.getPrototypeOf` if available instead of `__proto__`
## 0.2.0 (2020-03-07)

@@ -2,0 +9,0 @@

"use strict"
const acorn = require("acorn")
if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
const getPrototype = Object.getPrototypeOf || (o => o.__proto__)
const getAcorn = Parser => {
if (Parser.acorn) return Parser.acorn
const acorn = require("acorn")
if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
}
// Make sure `Parser` comes from the same acorn as we `require`d,
// otherwise the comparisons fail.
for (let cur = Parser; cur && cur !== acorn.Parser; cur = getPrototype(cur)) {
if (cur !== acorn.Parser) {
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
}
}
return acorn
}
const tt = acorn.tokTypes
const TokenType = acorn.TokenType

@@ -16,11 +30,3 @@ module.exports = function(Parser) {

// Make sure `Parser` comes from the same acorn as our `tt`,
// otherwise the comparisons fail.
let cur = Parser
while (cur && cur !== acorn.Parser) {
cur = cur.__proto__
}
if (cur !== acorn.Parser) {
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
}
const acorn = getAcorn(Parser)

@@ -94,3 +100,3 @@ Parser = class extends Parser {

parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
if (!this.eat(tt.dot)) {
if (!this.eat(acorn.tokTypes.dot)) {
return super.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow)

@@ -123,4 +129,4 @@ }

}
Parser.prototype.privateNameToken = new TokenType("privateName")
Parser.prototype.privateNameToken = new acorn.TokenType("privateName")
return Parser
}

@@ -23,3 +23,3 @@ {

},
"version": "0.2.0",
"version": "0.2.3",
"devDependencies": {

@@ -26,0 +26,0 @@ "acorn": "^7.0.0",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc