Skip to content

Commit

Permalink
Remove mkdirp (#21365)
Browse files Browse the repository at this point in the history
Closes #17042

I removed mkdirp from package.json taskfil.js, and ran `yarn && ./check-pre-compiled.sh `. Please let me know if anything else is needed!

(Extracted from #20411)

Note that now compiled webpack has mkdirP function
  • Loading branch information
chulkilee committed Jan 26, 2021
1 parent 3368fdd commit f6cc0de
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 51 deletions.
2 changes: 1 addition & 1 deletion packages/next/compiled/cacache/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/compiled/cache-loader/cjs.js

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions packages/next/compiled/mkdirp/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion packages/next/compiled/mkdirp/index.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/next/compiled/mkdirp/package.json

This file was deleted.

118 changes: 108 additions & 10 deletions packages/next/compiled/webpack/bundle4.js
Expand Up @@ -36452,6 +36452,112 @@ module.exports = function isExtendable(val) {
};


/***/ }),

/***/ 50998:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

var path = __webpack_require__(85622);
var fs = __webpack_require__(35747);
var _0777 = parseInt('0777', 8);

module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;

function mkdirP (p, opts, f, made) {
if (typeof opts === 'function') {
f = opts;
opts = {};
}
else if (!opts || typeof opts !== 'object') {
opts = { mode: opts };
}

var mode = opts.mode;
var xfs = opts.fs || fs;

if (mode === undefined) {
mode = _0777
}
if (!made) made = null;

var cb = f || function () {};
p = path.resolve(p);

xfs.mkdir(p, mode, function (er) {
if (!er) {
made = made || p;
return cb(null, made);
}
switch (er.code) {
case 'ENOENT':
if (path.dirname(p) === p) return cb(er);
mkdirP(path.dirname(p), opts, function (er, made) {
if (er) cb(er, made);
else mkdirP(p, opts, cb, made);
});
break;

// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
xfs.stat(p, function (er2, stat) {
// if the stat fails, then that's super weird.
// let the original error be the failure reason.
if (er2 || !stat.isDirectory()) cb(er, made)
else cb(null, made);
});
break;
}
});
}

mkdirP.sync = function sync (p, opts, made) {
if (!opts || typeof opts !== 'object') {
opts = { mode: opts };
}

var mode = opts.mode;
var xfs = opts.fs || fs;

if (mode === undefined) {
mode = _0777
}
if (!made) made = null;

p = path.resolve(p);

try {
xfs.mkdirSync(p, mode);
made = made || p;
}
catch (err0) {
switch (err0.code) {
case 'ENOENT' :
made = sync(path.dirname(p), opts, made);
sync(p, opts, made);
break;

// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
var stat;
try {
stat = xfs.statSync(p);
}
catch (err1) {
throw err0;
}
if (!stat.isDirectory()) throw err0;
break;
}
}

return made;
};


/***/ }),

/***/ 57925:
Expand Down Expand Up @@ -78593,7 +78699,7 @@ module.exports = (a, b) => {

const fs = __webpack_require__(35747);
const path = __webpack_require__(85622);
const mkdirp = __webpack_require__(94327);
const mkdirp = __webpack_require__(50998);
const { Tracer } = __webpack_require__(92430);
const validateOptions = __webpack_require__(33225);
const schema = __webpack_require__(49049);
Expand Down Expand Up @@ -86946,7 +87052,7 @@ module.exports = class NodeMainTemplatePlugin {

const fs = __webpack_require__(35747);
const path = __webpack_require__(85622);
const mkdirp = __webpack_require__(94327);
const mkdirp = __webpack_require__(50998);

class NodeOutputFileSystem {
constructor() {
Expand Down Expand Up @@ -105954,14 +106060,6 @@ module.exports = require("next/dist/compiled/is-wsl");;

/***/ }),

/***/ 94327:
/***/ (function(module) {

"use strict";
module.exports = require("next/dist/compiled/mkdirp");;

/***/ }),

/***/ 36386:
/***/ (function(module) {

Expand Down
1 change: 0 additions & 1 deletion packages/next/package.json
Expand Up @@ -204,7 +204,6 @@
"loader-utils": "2.0.0",
"lodash.curry": "4.1.1",
"lru-cache": "5.1.1",
"mkdirp": "0.5.3",
"nanoid": "3.1.20",
"neo-async": "2.6.1",
"ora": "4.0.4",
Expand Down
9 changes: 0 additions & 9 deletions packages/next/taskfile.js
Expand Up @@ -368,14 +368,6 @@ export async function ncc_lru_cache(task, opts) {
.target('compiled/lru-cache')
}
// eslint-disable-next-line camelcase
externals['mkdirp'] = 'next/dist/compiled/mkdirp'
export async function ncc_mkdirp(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('mkdirp')))
.ncc({ packageName: 'mkdirp', externals })
.target('compiled/mkdirp')
}
// eslint-disable-next-line camelcase
externals['nanoid'] = 'next/dist/compiled/nanoid'
export async function ncc_nanoid(task, opts) {
await task
Expand Down Expand Up @@ -707,7 +699,6 @@ export async function ncc(task) {
'ncc_loader_utils',
'ncc_lodash_curry',
'ncc_lru_cache',
'ncc_mkdirp',
'ncc_nanoid',
'ncc_neo_async',
'ncc_ora',
Expand Down
6 changes: 0 additions & 6 deletions yarn.lock
Expand Up @@ -10764,12 +10764,6 @@ mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3:
resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113"
integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==

mkdirp@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.3.tgz#5a514b7179259287952881e94410ec5465659f8c"
dependencies:
minimist "^1.2.5"

mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.0, mkdirp@~0.5.1:
version "0.5.5"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
Expand Down

0 comments on commit f6cc0de

Please sign in to comment.