unbundle
Version:
`require()` and `import`/`export` in the browser, without the bundling
32 lines (21 loc) • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parse = parse;
var _yargs = require('yargs');
var _yargs2 = _interopRequireDefault(_yargs);
var _path = require('path');
var _pkgDir = require('pkg-dir');
var _resolve = require('resolve');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function parse(input) {
var argv = _yargs2.default.usage('Usage: $0 [options]').example('$0 -i src/app.js -o dist', 'Transpiles the app and its dependencies into the "dist" directory.').alias('i', 'entry').describe('entry', 'Starting file for the application. Defaults to package.json "main" field.').alias('o', 'destination').describe('destination', 'Directory to write output. Defaults to "./public". Nonexistent directories are automatically created.').alias('s', 'silent').boolean('silent').default('silent', false).describe('silent', 'Suppress log messages from output').alias('h', 'help').help('help').alias('v', 'version').version().parse(input);
if (!argv.entry) {
argv.entry = (0, _resolve.sync)((0, _pkgDir.sync)());
}
if (!argv.destination) {
argv.destination = (0, _path.resolve)(process.cwd(), 'public');
}
return argv;
}