|
|
@ -285,12 +285,11 @@ THE SOFTWARE. |
|
|
|
editor.getSession().clearAnnotations(); |
|
|
|
editor.getSession().clearAnnotations(); |
|
|
|
sourceAnnotations = []; |
|
|
|
sourceAnnotations = []; |
|
|
|
editor.getSession().removeMarker(errMarkerId); |
|
|
|
editor.getSession().removeMarker(errMarkerId); |
|
|
|
$('#output').empty(); |
|
|
|
$('#output').empty(); |
|
|
|
var input = editor.getValue(); |
|
|
|
var input = editor.getValue(); |
|
|
|
var inputIncludingImports = includeLocalImports( input ); |
|
|
|
var inputIncludingImports = includeLocalImports( input ); |
|
|
|
console.log( inputIncludingImports ) |
|
|
|
var optimize = document.querySelector('#optimize').checked; |
|
|
|
var optimize = document.querySelector('#optimize').checked; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
var data = $.parseJSON(compileJSON(inputIncludingImports, optimize ? 1 : 0)); |
|
|
|
var data = $.parseJSON(compileJSON(inputIncludingImports, optimize ? 1 : 0)); |
|
|
|
} catch (exception) { |
|
|
|
} catch (exception) { |
|
|
|
renderError("Uncaught JavaScript Exception:\n" + exception); |
|
|
|
renderError("Uncaught JavaScript Exception:\n" + exception); |
|
|
@ -325,15 +324,14 @@ THE SOFTWARE. |
|
|
|
$('#version').text(Module.cwrap("version", "string", [])()); |
|
|
|
$('#version').text(Module.cwrap("version", "string", [])()); |
|
|
|
previousInput = ''; |
|
|
|
previousInput = ''; |
|
|
|
onChange(); |
|
|
|
onChange(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function includeLocalImports( input ) { |
|
|
|
function includeLocalImports( input ) { |
|
|
|
var importRegex = /import\s[\'\"]([^\'\"]+)[\'\"]/g |
|
|
|
var importRegex = /import\s[\'\"]([^\'\"]+)[\'\"];/g |
|
|
|
var imports = []; |
|
|
|
var imports = []; |
|
|
|
var matches = []; |
|
|
|
var matches = []; |
|
|
|
var match; |
|
|
|
var match; |
|
|
|
while ((match = importRegex.exec(input)) !== null) { |
|
|
|
while ((match = importRegex.exec(input)) !== null) { |
|
|
|
console.log("match:", match[0]) |
|
|
|
|
|
|
|
if (match[1] && solFiles.indexOf(match[1]) !== -1) { |
|
|
|
if (match[1] && solFiles.indexOf(match[1]) !== -1) { |
|
|
|
imports.push( match[1] ) |
|
|
|
imports.push( match[1] ) |
|
|
|
matches.push( match[0] ) |
|
|
|
matches.push( match[0] ) |
|
|
|