mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-18 14:53:14 +00:00
correct System.register regex (#1071)
This commit is contained in:
parent
7ea9734098
commit
e472ecce1a
@ -51,7 +51,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var leadingCommentAndMetaRegEx = /^\s*(\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)*\s*/;
|
||||
var leadingCommentAndMetaRegEx = /^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)*\s*/;
|
||||
function detectRegisterFormat(source) {
|
||||
var leadingCommentAndMeta = source.match(leadingCommentAndMetaRegEx);
|
||||
return leadingCommentAndMeta && source.substr(leadingCommentAndMeta[0].length, 15) == 'System.register';
|
||||
|
||||
@ -514,6 +514,13 @@ asyncTest('System.register regex test', function() {
|
||||
}, err);
|
||||
});
|
||||
|
||||
asyncTest('System.register regex test 2', function() {
|
||||
System['import']('tests/register-regex-2.js').then(function(m) {
|
||||
ok(m);
|
||||
start();
|
||||
}, err);
|
||||
});
|
||||
|
||||
asyncTest('System.register module name arg', function() {
|
||||
System['import']('tests/module-name.js').then(function(m) {
|
||||
ok(m.name == System.baseURL + 'tests/module-name.js');
|
||||
|
||||
15
test/tests/register-regex-2.js
Normal file
15
test/tests/register-regex-2.js
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @file file comment
|
||||
* ...
|
||||
*/
|
||||
|
||||
/**
|
||||
* module comment
|
||||
* ...
|
||||
*/
|
||||
System.register([], function() {
|
||||
return {
|
||||
setters: [],
|
||||
execute: function() {}
|
||||
};
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user