-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick Balestra
committed
Jan 11, 2017
1 parent
b7461f3
commit 14acc12
Showing
4 changed files
with
79 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/cli/domain/package-server-script/bundle/webpack.server.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*jshint camelcase:false */ | ||
'use strict'; | ||
var webpack = require('webpack'); | ||
|
||
var config = { | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.json$/, | ||
loader: 'json-loader', | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.jsx?$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
query: { | ||
'presets': [ | ||
['env', { | ||
'targets': { | ||
'node': 0.10 | ||
} | ||
}] | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compressor: { | ||
warnings: false, | ||
screw_ie8: true | ||
}, | ||
sourceMap: false | ||
}), | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) | ||
}) | ||
] | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
var CONST_MAX_ITERATIONS = 10000; | ||
|
||
var wrapLoops = function(node){ | ||
var loopKeywords = ['WhileStatement', 'ForStatement', 'DoWhileStatement']; | ||
|
||
if(loopKeywords.indexOf(node.type) > -1){ | ||
node.update('{ var __ITER = ' + CONST_MAX_ITERATIONS + ';' | ||
+ node.source() + '}'); | ||
} | ||
|
||
if(!node.parent){ | ||
return; | ||
} | ||
|
||
if(loopKeywords.indexOf(node.parent.type) > -1 && node.type === 'BlockStatement') { | ||
node.update('{ if(__ITER <=0){ throw new Error("loop exceeded maximum allowed iterations"); } ' | ||
+ node.source() + ' __ITER--; }'); | ||
} | ||
}; | ||
|
||
module.exports = wrapLoops; |
24 changes: 0 additions & 24 deletions
24
src/cli/domain/package-server-script/getSandBoxedJs/wrapLoops.js
This file was deleted.
Oops, something went wrong.