Socket
Socket
Sign inDemoInstall

acorn

Package Overview
Dependencies
0
Maintainers
2
Versions
131
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 2.4.0

24

bin/build-acorn.js

@@ -17,3 +17,4 @@ var fs = require("fs"), path = require("path")

function acornShim(file) {
var ACORN_PLACEHOLDER = "this_function_call_should_be_replaced_with_a_call_to_load_acorn()";
function acornShimPrepare(file) {
var tr = new stream.Transform

@@ -25,3 +26,3 @@ if (file == path.resolve(__dirname, "../src/index.js")) {

sent = true
callback(null, "module.exports = typeof acorn != 'undefined' ? acorn : _dereq_(\"./acorn\")")
callback(null, ACORN_PLACEHOLDER);
} else {

@@ -36,6 +37,19 @@ callback()

}
function acornShimComplete() {
var tr = new stream.Transform
var buffer = "";
tr._transform = function(chunk, _, callback) {
buffer += chunk.toString("utf8");
callback();
};
tr._flush = function (callback) {
tr.push(buffer.replace(ACORN_PLACEHOLDER, "module.exports = typeof acorn != 'undefined' ? acorn : require(\"./acorn\")"));
callback(null);
};
return tr;
}
browserify({standalone: "acorn.loose"})
.plugin(require('browserify-derequire'))
.transform(acornShim)
.transform(acornShimPrepare)
.transform(babelify)

@@ -45,2 +59,3 @@ .require("./src/loose/index.js", {entry: true})

.on("error", function (err) { console.log("Error: " + err.message) })
.pipe(acornShimComplete())
.pipe(fs.createWriteStream("dist/acorn_loose.js"))

@@ -50,3 +65,3 @@

.plugin(require('browserify-derequire'))
.transform(acornShim)
.transform(acornShimPrepare)
.transform(babelify)

@@ -56,2 +71,3 @@ .require("./src/walk/index.js", {entry: true})

.on("error", function (err) { console.log("Error: " + err.message) })
.pipe(acornShimComplete())
.pipe(fs.createWriteStream("dist/walk.js"))

10

dist/acorn_loose.js
(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){
"use strict";
module.exports = typeof acorn != "undefined" ? acorn : _dereq_("./acorn");
module.exports = typeof acorn != 'undefined' ? acorn : require("./acorn");

@@ -661,2 +661,8 @@ },{}],2:[function(_dereq_,module,exports){

LooseParser.prototype.dummyString = function dummyString() {
var dummy = this.startNode();
dummy.value = dummy.raw = "✖";
return this.finishNode(dummy, "Literal");
};
LooseParser.prototype.eat = function eat(type) {

@@ -1103,3 +1109,3 @@ if (this.tok.type === type) {

node.specifiers = this.parseImportSpecifierList();
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString();
if (elt) node.specifiers.unshift(elt);

@@ -1106,0 +1112,0 @@ }

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

"main": "dist/acorn.js",
"version": "2.3.0",
"version": "2.4.0",
"engines": {

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

@@ -120,4 +120,11 @@ # Acorn

"value": "comment text",
"range": ...,
"loc": ...
"start": Number,
"end": Number,
// If `locations` option is on:
"loc": {
"start": {line: Number, column: Number}
"end": {line: Number, column: Number}
},
// If `ranges` option is on:
"range": [Number, Number]
}

@@ -305,2 +312,4 @@ ```

- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
- `--locations`: Attaches a "loc" object to each node with "start" and

@@ -307,0 +316,0 @@ "end" subobjects, each of which contains the one-based line and

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

export const version = "2.3.0"
export const version = "2.4.0"

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

@@ -52,2 +52,8 @@ import {tokenizer, SourceLocation, tokTypes as tt, Node, lineBreak, isNewLine} from ".."

dummyString() {
let dummy = this.startNode()
dummy.value = dummy.raw = "✖"
return this.finishNode(dummy, "Literal")
}
eat(type) {

@@ -54,0 +60,0 @@ if (this.tok.type === type) {

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

node.specifiers = this.parseImportSpecifierList()
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
node.source = this.eatContextual("from") ? this.parseExprAtom() : this.dummyString()
if (elt) node.specifiers.unshift(elt)

@@ -365,0 +365,0 @@ }

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

left = left || this.parseBindingAtom()
if (!this.eat(tt.eq)) return left
if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left
let node = this.startNodeAt(startPos, startLoc)

@@ -154,0 +154,0 @@ node.left = left

Sorry, the diff of this file is not supported yet

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

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

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