mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Make built version of paper.js for node work and work towards using that in NPM.
This commit is contained in:
parent
5245a30930
commit
899ec1d360
6 changed files with 20 additions and 10 deletions
|
@ -32,7 +32,7 @@ fi
|
|||
|
||||
./preprocess.sh $MODE ../src/paper.js "-o '{ \"browser\": true }' -i '../src/constants.js'" ../dist/paper-full.js
|
||||
./preprocess.sh $MODE ../src/paper.js "-o '{ \"browser\": true, \"paperscript\": false }' -i '../src/constants.js'" ../dist/paper-core.js
|
||||
#./preprocess.sh $MODE ../src/paper.js "-o '{ \"node\": true }' -i '../src/constants.js'" ../dist/paper-node.js
|
||||
./preprocess.sh $MODE ../src/paper.js "-o '{ \"browser\": false, \"node\": true }' -i '../src/constants.js'" ../dist/paper-node.js
|
||||
|
||||
# Remove the existing file and copy paper-full.js to paper.js now
|
||||
if [ -f ../dist/paper.js ]
|
||||
|
|
11
package.json
11
package.json
|
@ -6,7 +6,14 @@
|
|||
"Jürg Lehni <juerg@lehni.org> (http://lehni.org)",
|
||||
"Jonathan Puckey <jonathan@studiomoniker.com> (http://studiomoniker.com)"
|
||||
],
|
||||
"main": "./src/load.js",
|
||||
"main": "./dist/paper-node.js",
|
||||
"files": [
|
||||
"AUTHORS.md",
|
||||
"dist/paper-node.js",
|
||||
"examples/Node.js",
|
||||
"LICENSE.txt",
|
||||
"README.md"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
},
|
||||
|
@ -29,7 +36,7 @@
|
|||
],
|
||||
"devDependencies": {
|
||||
"uglify-js": "~2.3.6",
|
||||
"prepro": "~0.7.0",
|
||||
"prepro": "~0.7.1",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib-uglify": "~0.2.2"
|
||||
}
|
||||
|
|
|
@ -19,10 +19,13 @@
|
|||
// better minification and the future use of strict mode once it makes sense
|
||||
// in terms of performance.
|
||||
paper.PaperScope.prototype.PaperScript = new function() {
|
||||
var PaperScope = paper.PaperScope,
|
||||
// Locally turn of exporst for inlined acorn / esprima.
|
||||
exports = undefined;
|
||||
/*#*/ if (options.parser == 'acorn') {
|
||||
/*#*/ include('../../components/acorn/acorn.min.js');
|
||||
/*#*/ include('../../components/acorn/acorn.min.js', { exports: false });
|
||||
/*#*/ } else if (options.parser == 'esprima') {
|
||||
/*#*/ include('../../components/esprima/esprima.min.js');
|
||||
/*#*/ include('../../components/esprima/esprima.min.js', { exports: false });
|
||||
/*#*/ }
|
||||
|
||||
// Operators to overload
|
||||
|
@ -273,8 +276,7 @@ paper.PaperScope.prototype.PaperScript = new function() {
|
|||
}
|
||||
|
||||
function load() {
|
||||
var scripts = document.getElementsByTagName('script'),
|
||||
PaperScope = paper.PaperScope;
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
for (var i = 0, l = scripts.length; i < l; i++) {
|
||||
var script = scripts[i];
|
||||
// Only load this script if it not loaded already.
|
||||
|
|
|
@ -43,4 +43,7 @@ paper = new (PaperScope.inject(Base.merge(Base.exports, {
|
|||
Canvas: Canvas
|
||||
})))();
|
||||
|
||||
// Export the paper scope.
|
||||
module.exports = paper;
|
||||
|
||||
/*#*/ } // options.node
|
||||
|
|
|
@ -48,6 +48,4 @@ if (typeof window !== 'undefined') {
|
|||
});
|
||||
// Load Paper.js library files.
|
||||
prepro.include('paper.js');
|
||||
// Export the paper scope.
|
||||
module.exports = prepro.context.paper;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
var paper = new function() {
|
||||
// Inline Bootstrap core (the Base class) inside the paper scope first:
|
||||
/*#*/ include('../components/straps/straps.js');
|
||||
/*#*/ include('../components/straps/straps.js', { exports: false });
|
||||
|
||||
/*#*/ if (options.stats) {
|
||||
/*#*/ include('../components/stats.js/build/stats.min.js');
|
||||
|
|
Loading…
Reference in a new issue