Skip to content

Commit

Permalink
Merge pull request #1049 from stealjs/greenkeeper/steal-systemjs-0.19.4
Browse files Browse the repository at this point in the history
Update steal-systemjs to the latest version 🚀
  • Loading branch information
matthewp authored Feb 7, 2017
2 parents ecba685 + 59b552b commit 05d5de3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"process": "~0.11.9",
"punycode": "~2.0.1",
"resolve": "^1.1.7",
"steal-systemjs": "0.19.2",
"steal-systemjs": "0.19.4",
"string_decoder": "~0.10.31",
"tty-browserify": "~0.0.0",
"vm-browserify": "~0.0.4",
Expand Down
32 changes: 18 additions & 14 deletions steal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4271,15 +4271,17 @@ function amd(loader) {
var commentRegEx = /(\/\*([\s\S]*?)\*\/|([^:(?!\\)]|^)\/\/(.*)$)/mg;
var stringRegEx = /("[^"\\\n\r]*(\\.[^"\\\n\r]*)*"|'[^'\\\n\r]*(\\.[^'\\\n\r]*)*')/g;
var beforeRegEx = /(function|var|let|const|return|export|\"|\'|\(|\=)$/i
var cjsRequirePre = "(?:^|[^$_a-zA-Z\\xA0-\\uFFFF.])";
var cjsRequirePost = "\\s*\\(\\s*(\"([^\"]+)\"|'([^']+)')\\s*\\)";
var cjsRequirePre = "(?:^\\uFEFF?|[^$_a-zA-Z\\xA0-\\uFFFF.\"\'])";
var cjsRequirePost = "\\s*\\(\\s*(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\')\\s*\\)";

var fnBracketRegEx = /\(([^\)]*)\)/;
var wsRegEx = /^\s+|\s+$/g;

var requireRegExs = {};

function getCJSDeps(source, requireIndex) {
var stringLocations = [];
commentRegEx.lastIndex = stringRegEx.lastIndex = 0;
var stringLocations = [], commentLocations = [];

var match;

Expand All @@ -4293,14 +4295,11 @@ function amd(loader) {
while (match = stringRegEx.exec(source))
stringLocations.push([match.index, match.index + match[0].length]);

// remove comments
source = source.replace(commentRegEx, function(match, a, b, c, d, offset){
if(inLocation(stringLocations, offset + 1)) {
return match;
} else {
return '';
}
});
while (match = commentRegEx.exec(source)) {
// only track comments not starting in strings
if (!inLocation(stringLocations, match.index + 1))
commentLocations.push([match.index, match.index + match[0].length]);
}

// determine the require alias
var params = source.match(fnBracketRegEx);
Expand All @@ -4313,9 +4312,14 @@ function amd(loader) {

var deps = [];

var match;
while (match = requireRegEx.exec(source))
deps.push(match[2] || match[3]);
while (match = requireRegEx.exec(source)) {
if(!inLocation(stringLocations, match.index) &&
!inLocation(commentLocations, match.index)) {
var dep = match[1].substr(1, match[1].length - 2);
if(dep)
deps.push(dep);
}
}

return deps;
}
Expand Down
Loading

0 comments on commit 05d5de3

Please sign in to comment.