allow a["b"] = require(...) in bundler

This commit is contained in:
Leo Horie 2016-11-16 00:09:41 -05:00
parent 5552ef31b1
commit c3d856e139
2 changed files with 27 additions and 1 deletions

View file

@ -20,7 +20,7 @@ function run(input, output) {
var modules = {}
var bindings = {}
var declaration = /^\s*(?:var|let|const|function)[\t ]+([\w_$]+)/gm
var include = /(?:((?:var|let|const|,|)[\t ]*)([\w_$\.]+)(\s*=\s*))?require\(([^\)]+)\)(\s*[`\.\(\[])?/gm
var include = /(?:((?:var|let|const|,|)[\t ]*)([\w_$\.\[\]"'`]+)(\s*=\s*))?require\(([^\)]+)\)(\s*[`\.\(\[])?/gm
var uuid = 0
var process = function(filepath, data) {
data.replace(declaration, function(match, binding) {bindings[binding] = 0})