mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
move detectVm() so it isn't global
This commit is contained in:
parent
6b95d8b29d
commit
e7b28b6dc2
34
jsdoc.js
34
jsdoc.js
@ -126,23 +126,6 @@ function exit(n) {
|
||||
java.lang.System.exit(n);
|
||||
}
|
||||
|
||||
/**
|
||||
Detect the type of VM running jsdoc.
|
||||
**Note**: Rhino is the only VM that is currently supported.
|
||||
@return {string} rhino|node
|
||||
*/
|
||||
function detectVm() {
|
||||
if (typeof Packages === "object" &&
|
||||
Object.prototype.toString.call(Packages) === "[object JavaPackage]") {
|
||||
return "rhino";
|
||||
} else if ( require && require.main && module && (require.main === module) ) {
|
||||
return "node";
|
||||
} else {
|
||||
// unknown VM
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function installPlugins(plugins, p) {
|
||||
var dictionary = require('jsdoc/tag/dictionary'),
|
||||
parser = p || app.jsdoc.parser;
|
||||
@ -217,6 +200,23 @@ function main() {
|
||||
fs = require('fs'),
|
||||
Config = require('jsdoc/config');
|
||||
|
||||
/**
|
||||
Detect the type of VM running jsdoc.
|
||||
**Note**: Rhino is the only VM that is currently supported.
|
||||
@return {string} rhino|node
|
||||
*/
|
||||
function detectVm() {
|
||||
if (typeof Packages === "object" &&
|
||||
Object.prototype.toString.call(Packages) === "[object JavaPackage]") {
|
||||
return "rhino";
|
||||
} else if ( require && require.main && module && (require.main === module) ) {
|
||||
return "node";
|
||||
} else {
|
||||
// unknown VM
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
env.opts = jsdoc.opts.parser.parse(env.args);
|
||||
|
||||
env.vm = detectVm();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user