source: trip-planner-front/node_modules/adjust-sourcemap-loader/codec/utility/get-output-directory.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 825 bytes
RevLine 
[6a3a178]1'use strict';
2
3var path = require('path'),
4 fs = require('fs');
5
6var getContextDirectory = require('./get-context-directory');
7
8/**
9 * Infer the compilation output directory from options.
10 * Relative paths are resolved against the compilation context (or process.cwd() where not specified).
11 * @this {{options: object}} A loader or compilation
12 * @returns {undefined|string} The output path string, where defined
13 */
14function getOutputDirectory() {
15 /* jshint validthis:true */
16 var base = this.options && this.options.output ? this.options.output.directory : null,
17 absBase = !!base && path.resolve(getContextDirectory.call(this), base),
18 isValid = !!absBase && fs.existsSync(absBase) && fs.statSync(absBase).isDirectory();
19 return isValid ? absBase : undefined;
20}
21
22module.exports = getOutputDirectory;
Note: See TracBrowser for help on using the repository browser.