Socket
Socket
Sign inDemoInstall

acorn

Package Overview
Dependencies
Maintainers
2
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn - npm Package Compare versions

Comparing version 3.0.4 to 3.1.0

16

CHANGELOG.md

@@ -0,1 +1,17 @@

## 3.1.0 (2015-04-18)
### Bug fixes
Fix issue where the loose parser created invalid TemplateElement nodes
for unclosed template literals.
Properly tokenize the division operator directly after a function
expression.
Allow trailing comma in destructuring arrays.
### New features
The walker now allows defining handlers for `CatchClause` nodes.
## 3.0.4 (2016-02-25)

@@ -2,0 +18,0 @@

1

dist/acorn_loose.js

@@ -333,2 +333,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).loose = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

curElt.tail = true;
this.finishNode(curElt, "TemplateElement");
}

@@ -335,0 +336,0 @@ node.quasis.push(curElt);

9

dist/walk.js

@@ -219,8 +219,9 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).walk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

c(node.block, st, "Statement");
if (node.handler) {
c(node.handler.param, st, "Pattern");
c(node.handler.body, st, "ScopeBody");
}
if (node.handler) c(node.handler, st);
if (node.finalizer) c(node.finalizer, st, "Statement");
};
base.CatchClause = function (node, st, c) {
c(node.param, st, "Pattern");
c(node.body, st, "ScopeBody");
};
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {

@@ -227,0 +228,0 @@ c(node.test, st, "Expression");

@@ -6,3 +6,3 @@ {

"main": "dist/acorn.js",
"version": "3.0.4",
"version": "3.1.0",
"engines": {

@@ -9,0 +9,0 @@ "node": ">=0.4.0"

@@ -68,2 +68,6 @@ # Acorn

**NOTE**: Only 'stage 4' (finalized) ECMAScript 7 features are being
implemented by Acorn. That means that most of the draft standard is
not yet being parsed.
- **sourceType**: Indicate the mode the code should be parsed in. Can be

@@ -169,3 +173,4 @@ either `"script"` or `"module"`.

- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
will be added directly to the nodes, rather than the `loc` object.
will be added (regardless of the `location` option) directly to the
nodes, rather than the `loc` object.

@@ -172,0 +177,0 @@ - **preserveParens**: If this option is `true`, parenthesized expressions

@@ -640,5 +640,2 @@ // A recursive descent parser operates by defining functions for all

this.expect(tt.comma)
if (this.type === close && refDestructuringErrors && !refDestructuringErrors.trailingComma) {
refDestructuringErrors.trailingComma = this.lastTokStart
}
if (allowTrailingComma && this.afterTrailingComma(close)) break

@@ -650,5 +647,8 @@ } else first = false

elt = null
else if (this.type === tt.ellipsis)
else if (this.type === tt.ellipsis) {
elt = this.parseSpread(refDestructuringErrors)
else
if (this.type === tt.comma && refDestructuringErrors && !refDestructuringErrors.trailingComma) {
refDestructuringErrors.trailingComma = this.lastTokStart
}
} else
elt = this.parseMaybeAssign(false, refDestructuringErrors)

@@ -655,0 +655,0 @@ elts.push(elt)

@@ -39,3 +39,3 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript.

export const version = "3.0.4"
export const version = "3.1.0"

@@ -42,0 +42,0 @@ // The main exported interface (under `self.acorn` when in the

@@ -324,2 +324,3 @@ import {LooseParser} from "./state"

curElt.tail = true
this.finishNode(curElt, "TemplateElement")
}

@@ -326,0 +327,0 @@ node.quasis.push(curElt)

@@ -143,2 +143,3 @@ import {types as tt} from "./tokentype"

elts.push(rest)
if (this.type === tt.comma) this.raise(this.start, "Comma is not permitted after the rest element")
this.expect(close)

@@ -145,0 +146,0 @@ break

@@ -95,3 +95,3 @@ import {types as tt} from "./tokentype"

if (!andThrow) return !!pos
if (pos) this.raise(pos, "Trailing comma is not permitted in destructuring patterns")
if (pos) this.raise(pos, "Comma is not permitted after the rest element")
}

@@ -98,0 +98,0 @@

@@ -97,4 +97,5 @@ // The algorithm used to determine whether a regexp can appear at a

tt._function.updateContext = function() {
if (this.curContext() !== types.b_stat)
tt._function.updateContext = function(prevType) {
if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&
(prevType !== tt.colon || this.curContext() !== types.b_stat))
this.context.push(types.f_expr)

@@ -101,0 +102,0 @@ this.exprAllowed = false

@@ -194,8 +194,9 @@ // AST walker module for Mozilla Parser API compatible trees

c(node.block, st, "Statement")
if (node.handler) {
c(node.handler.param, st, "Pattern")
c(node.handler.body, st, "ScopeBody")
}
if (node.handler) c(node.handler, st)
if (node.finalizer) c(node.finalizer, st, "Statement")
}
base.CatchClause = (node, st, c) => {
c(node.param, st, "Pattern")
c(node.body, st, "ScopeBody")
}
base.WhileStatement = base.DoWhileStatement = (node, st, c) => {

@@ -202,0 +203,0 @@ c(node.test, st, "Expression")

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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