add getModuleName option - fixes #844

This commit is contained in:
Sebastian McKenzie 2015-02-20 23:23:50 +11:00
parent 15f1978cae
commit f2c5accab3
2 changed files with 5 additions and 1 deletions

View File

@ -86,10 +86,12 @@ File.validOptions = [
"format",
"playground",
"experimental",
"resolveModuleSource",
"externalHelpers",
"auxiliaryComment",
"resolveModuleSource",
"getModuleName",
// these are used by plugins
"ignore",
"only",

View File

@ -146,6 +146,8 @@ DefaultFormatter.prototype.isLocalReference = function (node, scope) {
DefaultFormatter.prototype.getModuleName = function () {
var opts = this.file.opts;
if (opts.getModuleName) return opts.getModuleName(opts.filename);
var filenameRelative = opts.filenameRelative;
var moduleName = "";