Skip to content

Commit

Permalink
Drop object-path
Browse files Browse the repository at this point in the history
Ref #16

A good reason to drop this package since it's not used for any magic and
the fix is pretty straightforward. Later can be simplified with optional
chaining syntax.
  • Loading branch information
TrySound committed Sep 29, 2020
1 parent 8557f80 commit 4b12ee3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
7 changes: 3 additions & 4 deletions codec/utility/get-context-directory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var path = require('path'),
objectPath = require('object-path');
var path = require('path');

/**
* Infer the compilation context directory from options.
Expand All @@ -11,8 +10,8 @@ var path = require('path'),
*/
function getContextDirectory() {
/* jshint validthis:true */
var context = objectPath.get(this, 'options.context');
var context = this.options ? this.options.context : null;
return !!context && path.resolve(context) || process.cwd();
}

module.exports = getContextDirectory;
module.exports = getContextDirectory;
7 changes: 3 additions & 4 deletions codec/utility/get-output-directory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

var path = require('path'),
fs = require('fs'),
objectPath = require('object-path');
fs = require('fs');

var getContextDirectory = require('./get-context-directory');

Expand All @@ -14,10 +13,10 @@ var getContextDirectory = require('./get-context-directory');
*/
function getOutputDirectory() {
/* jshint validthis:true */
var base = objectPath.get(this, 'options.output.directory'),
var base = this.options && this.options.output ? this.options.output.directory : null,
absBase = !!base && path.resolve(getContextDirectory.call(this), base),
isValid = !!absBase && fs.existsSync(absBase) && fs.statSync(absBase).isDirectory();
return isValid ? absBase : undefined;
}

module.exports = getOutputDirectory;
module.exports = getOutputDirectory;
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"homepage": "https://github.com/bholloway/adjust-sourcemap-loader",
"dependencies": {
"loader-utils": "1.2.3",
"object-path": "0.11.4",
"regex-parser": "2.2.10"
},
"devDependencies": {
Expand Down

0 comments on commit 4b12ee3

Please sign in to comment.