Skip to content

Commit b146eb5

Browse files
authored
Replace del with rimraf package (vercel#6411)
1 parent bfb5224 commit b146eb5

File tree

9 files changed

+25
-49
lines changed

9 files changed

+25
-49
lines changed

packages/next/build/webpack/plugins/unlink-file-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join } from 'path'
2-
import promisify from '../../../lib/promisify'
2+
import { promisify } from 'util'
33
import fs from 'fs'
44
import { IS_BUNDLED_PAGE_REGEX } from 'next-server/constants'
55

packages/next/client/source-map-support.js renamed to packages/next/client/source-map-support.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
const filenameRE = /\(([^)]+\.js):(\d+):(\d+)\)$/
22

3-
export function rewriteStacktrace (e, distDir) {
3+
export function rewriteStacktrace(e: Error, distDir: string) {
44
if (!e || typeof e.stack !== 'string') {
55
return
66
}
77

88
const lines = e.stack.split('\n')
99

10-
const result = lines.map((line) => {
10+
const result = lines.map((line: string) => {
1111
return rewriteTraceLine(line, distDir)
1212
})
1313

1414
e.stack = result.join('\n')
1515
}
1616

17-
function rewriteTraceLine (trace, distDir) {
17+
function rewriteTraceLine(trace: string, distDir: string) {
1818
const m = trace.match(filenameRE)
1919
if (m == null) {
2020
return trace

packages/next/export/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import del from 'del'
1+
import rimrafModule from 'rimraf'
22
import { cpus } from 'os'
33
import { fork } from 'child_process'
44
import cp from 'recursive-copy'
@@ -11,6 +11,7 @@ import createProgress from 'tty-aware-progress'
1111
import { promisify } from 'util'
1212

1313
const mkdirp = promisify(mkdirpModule)
14+
const rimraf = promisify(rimrafModule)
1415

1516
export default async function (dir, options, configuration) {
1617
function log (message) {
@@ -52,7 +53,7 @@ export default async function (dir, options, configuration) {
5253

5354
// Initialize the output directory
5455
const outDir = options.outdir
55-
await del(join(outDir, '*'))
56+
await rimraf(join(outDir, '*'))
5657
await mkdirp(join(outDir, '_next', buildId))
5758

5859
// Copy static directory
File renamed without changes.

packages/next/lib/promisify.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"case-sensitive-paths-webpack-plugin": "2.1.2",
6262
"chalk": "2.4.2",
6363
"cross-spawn": "5.1.0",
64-
"del": "3.0.0",
6564
"event-source-polyfill": "0.0.12",
6665
"find-cache-dir": "2.0.0",
6766
"find-up": "2.1.0",
@@ -79,6 +78,7 @@
7978
"react-is": "16.6.3",
8079
"recursive-copy": "2.0.6",
8180
"resolve": "1.5.0",
81+
"rimraf": "2.6.3",
8282
"serialize-javascript": "1.4.0",
8383
"source-map": "0.6.1",
8484
"strip-ansi": "3.0.1",

packages/next/server/hot-reloader.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { join, normalize } from 'path'
22
import WebpackDevMiddleware from 'webpack-dev-middleware'
33
import WebpackHotMiddleware from 'webpack-hot-middleware'
44
import errorOverlayMiddleware from './lib/error-overlay-middleware'
5-
import del from 'del'
5+
import rimrafModule from 'rimraf'
66
import onDemandEntryHandler, { normalizePage } from './on-demand-entry-handler'
77
import webpack from 'webpack'
88
import getBaseWebpackConfig from '../build/webpack-config'
@@ -14,6 +14,7 @@ import { createPagesMapping, createEntrypoints } from '../build/entries'
1414
import { watchCompiler } from '../build/output'
1515

1616
const glob = promisify(globModule)
17+
const rimraf = promisify(rimrafModule)
1718

1819
export async function renderScriptError (res, error) {
1920
// Asks CDNs and others to not to cache the errored page
@@ -161,7 +162,7 @@ export default class HotReloader {
161162
}
162163

163164
async clean () {
164-
return del(join(this.dir, this.config.distDir), { force: true })
165+
return rimraf(join(this.dir, this.config.distDir), { force: true })
165166
}
166167

167168
async getWebpackConfig () {

packages/next/server/on-demand-entry-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events'
33
import { join } from 'path'
44
import { parse } from 'url'
55
import fs from 'fs'
6-
import promisify from '../lib/promisify'
6+
import { promisify } from 'util'
77
import globModule from 'glob'
88
import { pageNotFoundError } from 'next-server/dist/server/require'
99
import { normalizePagePath } from 'next-server/dist/server/normalize-page-path'

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,18 +4207,6 @@ deglob@^2.1.0:
42074207
run-parallel "^1.1.2"
42084208
uniq "^1.0.1"
42094209

4210-
del@3.0.0, del@^3.0.0:
4211-
version "3.0.0"
4212-
resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5"
4213-
integrity sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=
4214-
dependencies:
4215-
globby "^6.1.0"
4216-
is-path-cwd "^1.0.0"
4217-
is-path-in-cwd "^1.0.0"
4218-
p-map "^1.1.1"
4219-
pify "^3.0.0"
4220-
rimraf "^2.2.8"
4221-
42224210
del@^2.2.0:
42234211
version "2.2.2"
42244212
resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
@@ -4232,6 +4220,18 @@ del@^2.2.0:
42324220
pinkie-promise "^2.0.0"
42334221
rimraf "^2.2.8"
42344222

4223+
del@^3.0.0:
4224+
version "3.0.0"
4225+
resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5"
4226+
integrity sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=
4227+
dependencies:
4228+
globby "^6.1.0"
4229+
is-path-cwd "^1.0.0"
4230+
is-path-in-cwd "^1.0.0"
4231+
p-map "^1.1.1"
4232+
pify "^3.0.0"
4233+
rimraf "^2.2.8"
4234+
42354235
delayed-stream@~1.0.0:
42364236
version "1.0.0"
42374237
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
@@ -10539,7 +10539,7 @@ rgba-regex@^1.0.0:
1053910539
resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3"
1054010540
integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=
1054110541

10542-
rimraf@2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@~2.6.2:
10542+
rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@~2.6.2:
1054310543
version "2.6.3"
1054410544
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
1054510545
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==

0 commit comments

Comments
 (0)