Skip to content

Commit bf586c9

Browse files
refactor(package): remove path-is-absolute dependency (dependencies) (#335)
1 parent 610e260 commit bf586c9

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

lib/fs.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const fs = require('fs');
44
const path = require('path');
55
const MemoryFileSystem = require('memory-fs');
6-
const pathabs = require('path-is-absolute');
76
const { colors } = require('webpack-log');
87
const NodeOutputFileSystem = require('webpack/lib/node/NodeOutputFileSystem');
98
const DevMiddlewareError = require('./DevMiddlewareError');
@@ -27,7 +26,7 @@ module.exports = {
2726
for (const assetPath of Object.keys(assets)) {
2827
const asset = assets[assetPath];
2928
const source = asset.source();
30-
const isAbsolute = pathabs(assetPath);
29+
const isAbsolute = path.isAbsolute(assetPath);
3130
const writePath = isAbsolute ? assetPath : path.join(outputPath, assetPath);
3231
const relativePath = path.relative(process.cwd(), writePath);
3332
const allowWrite = filter && typeof filter === 'function' ? filter(writePath) : true;
@@ -54,7 +53,7 @@ module.exports = {
5453
},
5554

5655
setFs(context, compiler) {
57-
if (typeof compiler.outputPath === 'string' && !pathabs.posix(compiler.outputPath) && !pathabs.win32(compiler.outputPath)) {
56+
if (typeof compiler.outputPath === 'string' && !path.posix.isAbsolute(compiler.outputPath) && !path.win32.isAbsolute(compiler.outputPath)) {
5857
throw new DevMiddlewareError('`output.path` needs to be an absolute path or `/`.');
5958
}
6059

lib/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3+
const path = require('path');
34
const { parse } = require('url');
45
const querystring = require('querystring');
5-
const pathabs = require('path-is-absolute');
66
const parseRange = require('range-parser');
77
const urlJoin = require('url-join');
88

@@ -94,7 +94,7 @@ module.exports = {
9494
if (filename) {
9595
uri = urlJoin((outputPath || ''), querystring.unescape(filename));
9696

97-
if (!pathabs.win32(uri)) {
97+
if (!path.win32.isAbsolute(uri)) {
9898
uri = `/${uri}`;
9999
}
100100
}
@@ -106,7 +106,7 @@ module.exports = {
106106
if (filename) {
107107
uri = urlJoin((outputPath || ''), filename);
108108

109-
if (!pathabs.posix(uri)) {
109+
if (!path.posix.isAbsolute(uri)) {
110110
uri = `/${uri}`;
111111
}
112112
}

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"loud-rejection": "^1.6.0",
2020
"memory-fs": "~0.4.1",
2121
"mime": "^2.3.1",
22-
"path-is-absolute": "^1.0.0",
2322
"range-parser": "^1.0.3",
2423
"url-join": "^4.0.0",
2524
"webpack-log": "^2.0.0"

0 commit comments

Comments
 (0)