mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
parent
87e72744ea
commit
74d14ecf0c
1 changed files with 7 additions and 0 deletions
|
@ -22,6 +22,7 @@ Base.exports.PaperScript = (function() {
|
||||||
scope = this;
|
scope = this;
|
||||||
/*#*/ include('../../bower_components/acorn/acorn.min.js', { exports: false });
|
/*#*/ include('../../bower_components/acorn/acorn.min.js', { exports: false });
|
||||||
|
|
||||||
|
/*#*/ if (__options.environment == 'browser') {
|
||||||
// We need some browser info for dealing with source maps and code offsets
|
// We need some browser info for dealing with source maps and code offsets
|
||||||
var ua = navigator.userAgent,
|
var ua = navigator.userAgent,
|
||||||
match = ua.match(/(opera|chrome|safari|firefox|msie|trident)\/?\s*([.\d]+)(?:.*rv\:([.\d]+))?/i) || [],
|
match = ua.match(/(opera|chrome|safari|firefox|msie|trident)\/?\s*([.\d]+)(?:.*rv\:([.\d]+))?/i) || [],
|
||||||
|
@ -35,6 +36,7 @@ Base.exports.PaperScript = (function() {
|
||||||
}
|
}
|
||||||
var browser = { name: name, version: parseFloat(version) };
|
var browser = { name: name, version: parseFloat(version) };
|
||||||
browser[name] = true;
|
browser[name] = true;
|
||||||
|
/*#*/ } // __options.environment == 'browser'
|
||||||
|
|
||||||
// Operators to overload
|
// Operators to overload
|
||||||
|
|
||||||
|
@ -242,6 +244,7 @@ Base.exports.PaperScript = (function() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*#*/ if (__options.environment == 'browser') {
|
||||||
// Source-map support:
|
// Source-map support:
|
||||||
var sourceMap = null,
|
var sourceMap = null,
|
||||||
version = browser.version,
|
version = browser.version,
|
||||||
|
@ -301,6 +304,10 @@ Base.exports.PaperScript = (function() {
|
||||||
JSON.stringify(sourceMap)))))
|
JSON.stringify(sourceMap)))))
|
||||||
+ "\n//# sourceURL=" + (url || 'paperscript');
|
+ "\n//# sourceURL=" + (url || 'paperscript');
|
||||||
}
|
}
|
||||||
|
/*#*/ } else { // !__options.environment == 'browser'
|
||||||
|
// Now do the parsing magic
|
||||||
|
walkAST(parse(code, { ranges: true }));
|
||||||
|
/*#*/ } // !__options.environment == 'browser'
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue