Comparing version 0.10.0 to 0.11.0
@@ -13,3 +13,4 @@ // modulr.sync.js (c) 2010 Tobie Langel | ||
modules: {} | ||
}; | ||
}, | ||
_pos = 1; | ||
} | ||
@@ -28,6 +29,3 @@ | ||
if (__PERF__) { | ||
var _p = _perf.modules[id] = _perf.modules[id] || { | ||
count: 0, | ||
start: t0 | ||
}; | ||
var _p = _perf.modules[id]; | ||
_p.count++; | ||
@@ -37,3 +35,6 @@ } | ||
if (!mod) { | ||
if (__PERF__) { | ||
_p.left = _pos++; | ||
_p.start = t0; | ||
} | ||
var fn = _factories[key]; | ||
@@ -59,3 +60,6 @@ delete _factories[key]; // no longer needed. | ||
fn(r, mod.exports, mod); | ||
if (__PERF__) { _p.end = Date.now(); } | ||
if (__PERF__) { | ||
_p.right = _pos++; | ||
_p.end = Date.now(); | ||
} | ||
} | ||
@@ -100,2 +104,3 @@ return mod.exports; | ||
function define(id, factory) { | ||
_perf.modules[id] = { count: 0 }; | ||
_factories[PREFIX + id] = factory; | ||
@@ -102,0 +107,0 @@ } |
@@ -12,3 +12,4 @@ // modulr.sync.js (c) 2010 Tobie Langel | ||
modules: {} | ||
}; | ||
}, | ||
_pos = 1; | ||
} | ||
@@ -21,6 +22,3 @@ | ||
if (__PERF__) { | ||
var _p = _perf.modules[id] = _perf.modules[id] || { | ||
count: 0, | ||
start: Date.now() | ||
}; | ||
var _p = _perf.modules[id]; | ||
_p.count++; | ||
@@ -31,2 +29,7 @@ } | ||
if (__PERF__) { | ||
_p.left = _pos++; | ||
_p.start = Date.now(); | ||
} | ||
var fn = _factories[key]; | ||
@@ -49,3 +52,6 @@ delete _factories[key]; | ||
fn(require, mod.exports, mod); | ||
if (__PERF__) { _p.end = Date.now(); } | ||
if (__PERF__) { | ||
_p.right = _pos++; | ||
_p.end = Date.now(); | ||
} | ||
return mod.exports; | ||
@@ -55,2 +61,3 @@ } | ||
function define(id, factory) { | ||
_perf.modules[id] = { count: 0 }; | ||
_factories[PREFIX + id] = factory; | ||
@@ -57,0 +64,0 @@ } |
@@ -80,4 +80,4 @@ var util = require('util'), | ||
function generateCode(ast) { | ||
ast = toAstRoot(ast); | ||
if (this.config.minify) { | ||
ast = toAstRoot(ast); | ||
ast = processor.ast_mangle(ast, { | ||
@@ -89,2 +89,9 @@ toplevel: false, | ||
ast = processor.ast_squeeze(ast); | ||
} else { | ||
ast = toAstBody(ast); | ||
var constants = this.getConstants(); | ||
for (var k in constants) { | ||
ast.unshift(getVarAssignmentAst(k, constants[k])) | ||
} | ||
ast = toAstRoot(ast); | ||
} | ||
@@ -134,6 +141,12 @@ return processor.gen_code(ast, { | ||
function expressionToAst(exp) { | ||
var ast = parser.parse('(' + exp + ')'); | ||
var ast = parser.parse('(' + JSON.stringify(exp) + ')'); | ||
return toAstBody(ast)[0][1]; | ||
} | ||
exports.getVarAssignmentAst = getVarAssignmentAst; | ||
function getVarAssignmentAst(identifier, value) { | ||
var ast = parser.parse('var ' + identifier + ' = ' + JSON.stringify(value) + ';'); | ||
return toAstBody(ast)[0]; | ||
} | ||
exports.getFunctionCallAst = getFunctionCallAst; | ||
@@ -140,0 +153,0 @@ function getFunctionCallAst(name, args) { |
@@ -5,3 +5,3 @@ { | ||
"main": "./main", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"dependencies": { | ||
@@ -8,0 +8,0 @@ "module-grapher": ">=0.10.4", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70871
23
1737