Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional acorn options. #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var fs = require('fs');
var path = require('path');
var relativePath = require('cached-path-relative')
var relativePath = require('cached-path-relative');

var browserResolve = require('browser-resolve');
var nodeResolve = require('resolve');
Expand Down Expand Up @@ -33,6 +33,7 @@ function Deps (opts) {
});
};
this.cache = opts.cache;
this.acorn = {parse: {acorn: opts.acorn}};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @jvanveen, thanks for the contribution! is acorn the best name for this option? and why is it nested in parse? your answer is as good as any, so just wondering your thoughts.

this.fileCache = opts.fileCache;
this.pkgCache = opts.packageCache || {};
this.pkgFileCache = {};
Expand Down Expand Up @@ -475,7 +476,7 @@ Deps.prototype.parseDeps = function (file, src, cb) {
return [];
}

try { var deps = detective(src) }
try { var deps = detective(src, this.acorn) }
catch (ex) {
var message = ex && ex.message ? ex.message : ex;
this.emit('error', new Error(
Expand Down