-
Notifications
You must be signed in to change notification settings - Fork 66
/
index.js
30 lines (27 loc) · 888 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
var path = require('path');
var normalize = path.normalize;
var resolve = path.resolve;
var dirname = path.dirname;
var stat = require('fs').statSync;
exports = module.exports = browserify;
function browserify(path, options) {
if (Array.isArray(path)) {
return exports.modules(path, options);
}
path = resolve(path);
options = exports.settings.normalize(options);
options.noParse = options.noParse.map(function (path) {
if (path[0] != '.') return path; //support `['jquery']` as well as `['./src/jquery.js']`
return resolve(path);
});
if (stat(path).isDirectory()) {
return exports.directory(path, options);
} else {
return exports.file(path, options);
}
}
exports.directory = require('./lib/directory');
exports.file = require('./lib/file');
exports.modules = require('./lib/modules');
exports.settings = require('./lib/settings');