@vercel/build-utils 2.12.3-canary.14 → 2.12.3-canary.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8056,147 +8056,6 @@ function sync (path, options) {
8056
8056
  }
8057
8057
 
8058
8058
 
8059
- /***/ }),
8060
-
8061
- /***/ 1215:
8062
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
8063
-
8064
- var _fs
8065
- try {
8066
- _fs = __webpack_require__(552)
8067
- } catch (_) {
8068
- _fs = __webpack_require__(5747)
8069
- }
8070
-
8071
- function readFile (file, options, callback) {
8072
- if (callback == null) {
8073
- callback = options
8074
- options = {}
8075
- }
8076
-
8077
- if (typeof options === 'string') {
8078
- options = {encoding: options}
8079
- }
8080
-
8081
- options = options || {}
8082
- var fs = options.fs || _fs
8083
-
8084
- var shouldThrow = true
8085
- if ('throws' in options) {
8086
- shouldThrow = options.throws
8087
- }
8088
-
8089
- fs.readFile(file, options, function (err, data) {
8090
- if (err) return callback(err)
8091
-
8092
- data = stripBom(data)
8093
-
8094
- var obj
8095
- try {
8096
- obj = JSON.parse(data, options ? options.reviver : null)
8097
- } catch (err2) {
8098
- if (shouldThrow) {
8099
- err2.message = file + ': ' + err2.message
8100
- return callback(err2)
8101
- } else {
8102
- return callback(null, null)
8103
- }
8104
- }
8105
-
8106
- callback(null, obj)
8107
- })
8108
- }
8109
-
8110
- function readFileSync (file, options) {
8111
- options = options || {}
8112
- if (typeof options === 'string') {
8113
- options = {encoding: options}
8114
- }
8115
-
8116
- var fs = options.fs || _fs
8117
-
8118
- var shouldThrow = true
8119
- if ('throws' in options) {
8120
- shouldThrow = options.throws
8121
- }
8122
-
8123
- try {
8124
- var content = fs.readFileSync(file, options)
8125
- content = stripBom(content)
8126
- return JSON.parse(content, options.reviver)
8127
- } catch (err) {
8128
- if (shouldThrow) {
8129
- err.message = file + ': ' + err.message
8130
- throw err
8131
- } else {
8132
- return null
8133
- }
8134
- }
8135
- }
8136
-
8137
- function stringify (obj, options) {
8138
- var spaces
8139
- var EOL = '\n'
8140
- if (typeof options === 'object' && options !== null) {
8141
- if (options.spaces) {
8142
- spaces = options.spaces
8143
- }
8144
- if (options.EOL) {
8145
- EOL = options.EOL
8146
- }
8147
- }
8148
-
8149
- var str = JSON.stringify(obj, options ? options.replacer : null, spaces)
8150
-
8151
- return str.replace(/\n/g, EOL) + EOL
8152
- }
8153
-
8154
- function writeFile (file, obj, options, callback) {
8155
- if (callback == null) {
8156
- callback = options
8157
- options = {}
8158
- }
8159
- options = options || {}
8160
- var fs = options.fs || _fs
8161
-
8162
- var str = ''
8163
- try {
8164
- str = stringify(obj, options)
8165
- } catch (err) {
8166
- // Need to return whether a callback was passed or not
8167
- if (callback) callback(err, null)
8168
- return
8169
- }
8170
-
8171
- fs.writeFile(file, str, options, callback)
8172
- }
8173
-
8174
- function writeFileSync (file, obj, options) {
8175
- options = options || {}
8176
- var fs = options.fs || _fs
8177
-
8178
- var str = stringify(obj, options)
8179
- // not sure if fs.writeFileSync returns anything, but just in case
8180
- return fs.writeFileSync(file, str, options)
8181
- }
8182
-
8183
- function stripBom (content) {
8184
- // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
8185
- if (Buffer.isBuffer(content)) content = content.toString('utf8')
8186
- content = content.replace(/^\uFEFF/, '')
8187
- return content
8188
- }
8189
-
8190
- var jsonfile = {
8191
- readFile: readFile,
8192
- readFileSync: readFileSync,
8193
- writeFile: writeFile,
8194
- writeFileSync: writeFileSync
8195
- }
8196
-
8197
- module.exports = jsonfile
8198
-
8199
-
8200
8059
  /***/ }),
8201
8060
 
8202
8061
  /***/ 9566:
@@ -14012,39 +13871,6 @@ SafeBuffer.allocUnsafeSlow = function (size) {
14012
13871
  }
14013
13872
 
14014
13873
 
14015
- /***/ }),
14016
-
14017
- /***/ 2703:
14018
- /***/ ((__unused_webpack_module, exports) => {
14019
-
14020
- "use strict";
14021
-
14022
-
14023
- exports.E = function (fn) {
14024
- return Object.defineProperty(function () {
14025
- if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)
14026
- else {
14027
- return new Promise((resolve, reject) => {
14028
- arguments[arguments.length] = (err, res) => {
14029
- if (err) return reject(err)
14030
- resolve(res)
14031
- }
14032
- arguments.length++
14033
- fn.apply(this, arguments)
14034
- })
14035
- }
14036
- }, 'name', { value: fn.name })
14037
- }
14038
-
14039
- exports.p = function (fn) {
14040
- return Object.defineProperty(function () {
14041
- const cb = arguments[arguments.length - 1]
14042
- if (typeof cb !== 'function') return fn.apply(this, arguments)
14043
- else fn.apply(this, arguments).then(r => cb(null, r), cb)
14044
- }, 'name', { value: fn.name })
14045
- }
14046
-
14047
-
14048
13874
  /***/ }),
14049
13875
 
14050
13876
  /***/ 9209:
@@ -16877,14 +16703,13 @@ module.exports = eos;
16877
16703
 
16878
16704
  const fs = __webpack_require__(552)
16879
16705
  const path = __webpack_require__(5622)
16880
- const mkdirpSync = __webpack_require__(9181).mkdirsSync
16881
- const utimesSync = __webpack_require__(8605).utimesMillisSync
16882
-
16883
- const notExist = Symbol('notExist')
16706
+ const mkdirsSync = __webpack_require__(9181).mkdirsSync
16707
+ const utimesMillisSync = __webpack_require__(8605).utimesMillisSync
16708
+ const stat = __webpack_require__(9783)
16884
16709
 
16885
16710
  function copySync (src, dest, opts) {
16886
16711
  if (typeof opts === 'function') {
16887
- opts = {filter: opts}
16712
+ opts = { filter: opts }
16888
16713
  }
16889
16714
 
16890
16715
  opts = opts || {}
@@ -16897,13 +16722,16 @@ function copySync (src, dest, opts) {
16897
16722
  see https://github.com/jprichardson/node-fs-extra/issues/269`)
16898
16723
  }
16899
16724
 
16900
- const destStat = checkPaths(src, dest)
16725
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
16726
+ stat.checkParentPathsSync(src, srcStat, dest, 'copy')
16727
+ return handleFilterAndCopy(destStat, src, dest, opts)
16728
+ }
16901
16729
 
16730
+ function handleFilterAndCopy (destStat, src, dest, opts) {
16902
16731
  if (opts.filter && !opts.filter(src, dest)) return
16903
-
16904
16732
  const destParent = path.dirname(dest)
16905
- if (!fs.existsSync(destParent)) mkdirpSync(destParent)
16906
- return startCopy(destStat, src, dest, opts)
16733
+ if (!fs.existsSync(destParent)) mkdirsSync(destParent)
16734
+ return getStats(destStat, src, dest, opts)
16907
16735
  }
16908
16736
 
16909
16737
  function startCopy (destStat, src, dest, opts) {
@@ -16920,10 +16748,13 @@ function getStats (destStat, src, dest, opts) {
16920
16748
  srcStat.isCharacterDevice() ||
16921
16749
  srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
16922
16750
  else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
16751
+ else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
16752
+ else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
16753
+ throw new Error(`Unknown file: ${src}`)
16923
16754
  }
16924
16755
 
16925
16756
  function onFile (srcStat, destStat, src, dest, opts) {
16926
- if (destStat === notExist) return copyFile(srcStat, src, dest, opts)
16757
+ if (!destStat) return copyFile(srcStat, src, dest, opts)
16927
16758
  return mayCopyFile(srcStat, src, dest, opts)
16928
16759
  }
16929
16760
 
@@ -16937,49 +16768,48 @@ function mayCopyFile (srcStat, src, dest, opts) {
16937
16768
  }
16938
16769
 
16939
16770
  function copyFile (srcStat, src, dest, opts) {
16940
- if (typeof fs.copyFileSync === 'function') {
16941
- fs.copyFileSync(src, dest)
16942
- fs.chmodSync(dest, srcStat.mode)
16943
- if (opts.preserveTimestamps) {
16944
- return utimesSync(dest, srcStat.atime, srcStat.mtime)
16945
- }
16946
- return
16947
- }
16948
- return copyFileFallback(srcStat, src, dest, opts)
16771
+ fs.copyFileSync(src, dest)
16772
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
16773
+ return setDestMode(dest, srcStat.mode)
16949
16774
  }
16950
16775
 
16951
- function copyFileFallback (srcStat, src, dest, opts) {
16952
- const BUF_LENGTH = 64 * 1024
16953
- const _buff = __webpack_require__(6343)(BUF_LENGTH)
16776
+ function handleTimestamps (srcMode, src, dest) {
16777
+ // Make sure the file is writable before setting the timestamp
16778
+ // otherwise open fails with EPERM when invoked with 'r+'
16779
+ // (through utimes call)
16780
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
16781
+ return setDestTimestamps(src, dest)
16782
+ }
16954
16783
 
16955
- const fdr = fs.openSync(src, 'r')
16956
- const fdw = fs.openSync(dest, 'w', srcStat.mode)
16957
- let pos = 0
16784
+ function fileIsNotWritable (srcMode) {
16785
+ return (srcMode & 0o200) === 0
16786
+ }
16958
16787
 
16959
- while (pos < srcStat.size) {
16960
- const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
16961
- fs.writeSync(fdw, _buff, 0, bytesRead)
16962
- pos += bytesRead
16963
- }
16788
+ function makeFileWritable (dest, srcMode) {
16789
+ return setDestMode(dest, srcMode | 0o200)
16790
+ }
16964
16791
 
16965
- if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime)
16792
+ function setDestMode (dest, srcMode) {
16793
+ return fs.chmodSync(dest, srcMode)
16794
+ }
16966
16795
 
16967
- fs.closeSync(fdr)
16968
- fs.closeSync(fdw)
16796
+ function setDestTimestamps (src, dest) {
16797
+ // The initial srcStat.atime cannot be trusted
16798
+ // because it is modified by the read(2) system call
16799
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
16800
+ const updatedSrcStat = fs.statSync(src)
16801
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
16969
16802
  }
16970
16803
 
16971
16804
  function onDir (srcStat, destStat, src, dest, opts) {
16972
- if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts)
16973
- if (destStat && !destStat.isDirectory()) {
16974
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
16975
- }
16805
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
16976
16806
  return copyDir(src, dest, opts)
16977
16807
  }
16978
16808
 
16979
- function mkDirAndCopy (srcStat, src, dest, opts) {
16809
+ function mkDirAndCopy (srcMode, src, dest, opts) {
16980
16810
  fs.mkdirSync(dest)
16981
16811
  copyDir(src, dest, opts)
16982
- return fs.chmodSync(dest, srcStat.mode)
16812
+ return setDestMode(dest, srcMode)
16983
16813
  }
16984
16814
 
16985
16815
  function copyDir (src, dest, opts) {
@@ -16989,18 +16819,17 @@ function copyDir (src, dest, opts) {
16989
16819
  function copyDirItem (item, src, dest, opts) {
16990
16820
  const srcItem = path.join(src, item)
16991
16821
  const destItem = path.join(dest, item)
16992
- const destStat = checkPaths(srcItem, destItem)
16822
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
16993
16823
  return startCopy(destStat, srcItem, destItem, opts)
16994
16824
  }
16995
16825
 
16996
16826
  function onLink (destStat, src, dest, opts) {
16997
16827
  let resolvedSrc = fs.readlinkSync(src)
16998
-
16999
16828
  if (opts.dereference) {
17000
16829
  resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
17001
16830
  }
17002
16831
 
17003
- if (destStat === notExist) {
16832
+ if (!destStat) {
17004
16833
  return fs.symlinkSync(resolvedSrc, dest)
17005
16834
  } else {
17006
16835
  let resolvedDest
@@ -17016,14 +16845,14 @@ function onLink (destStat, src, dest, opts) {
17016
16845
  if (opts.dereference) {
17017
16846
  resolvedDest = path.resolve(process.cwd(), resolvedDest)
17018
16847
  }
17019
- if (isSrcSubdir(resolvedSrc, resolvedDest)) {
16848
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
17020
16849
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
17021
16850
  }
17022
16851
 
17023
16852
  // prevent copy if src is a subdir of dest since unlinking
17024
16853
  // dest in this case would result in removing src contents
17025
16854
  // and therefore a broken symlink would be created.
17026
- if (fs.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
16855
+ if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
17027
16856
  throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
17028
16857
  }
17029
16858
  return copyLink(resolvedSrc, dest)
@@ -17035,36 +16864,6 @@ function copyLink (resolvedSrc, dest) {
17035
16864
  return fs.symlinkSync(resolvedSrc, dest)
17036
16865
  }
17037
16866
 
17038
- // return true if dest is a subdir of src, otherwise false.
17039
- function isSrcSubdir (src, dest) {
17040
- const srcArray = path.resolve(src).split(path.sep)
17041
- const destArray = path.resolve(dest).split(path.sep)
17042
- return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true)
17043
- }
17044
-
17045
- function checkStats (src, dest) {
17046
- const srcStat = fs.statSync(src)
17047
- let destStat
17048
- try {
17049
- destStat = fs.statSync(dest)
17050
- } catch (err) {
17051
- if (err.code === 'ENOENT') return {srcStat, destStat: notExist}
17052
- throw err
17053
- }
17054
- return {srcStat, destStat}
17055
- }
17056
-
17057
- function checkPaths (src, dest) {
17058
- const {srcStat, destStat} = checkStats(src, dest)
17059
- if (destStat.ino && destStat.ino === srcStat.ino) {
17060
- throw new Error('Source and destination must not be the same.')
17061
- }
17062
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
17063
- throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`)
17064
- }
17065
- return destStat
17066
- }
17067
-
17068
16867
  module.exports = copySync
17069
16868
 
17070
16869
 
@@ -17091,18 +16890,17 @@ module.exports = {
17091
16890
 
17092
16891
  const fs = __webpack_require__(552)
17093
16892
  const path = __webpack_require__(5622)
17094
- const mkdirp = __webpack_require__(9181).mkdirs
16893
+ const mkdirs = __webpack_require__(9181).mkdirs
17095
16894
  const pathExists = __webpack_require__(5516).pathExists
17096
- const utimes = __webpack_require__(8605).utimesMillis
17097
-
17098
- const notExist = Symbol('notExist')
16895
+ const utimesMillis = __webpack_require__(8605).utimesMillis
16896
+ const stat = __webpack_require__(9783)
17099
16897
 
17100
16898
  function copy (src, dest, opts, cb) {
17101
16899
  if (typeof opts === 'function' && !cb) {
17102
16900
  cb = opts
17103
16901
  opts = {}
17104
16902
  } else if (typeof opts === 'function') {
17105
- opts = {filter: opts}
16903
+ opts = { filter: opts }
17106
16904
  }
17107
16905
 
17108
16906
  cb = cb || function () {}
@@ -17117,10 +16915,14 @@ function copy (src, dest, opts, cb) {
17117
16915
  see https://github.com/jprichardson/node-fs-extra/issues/269`)
17118
16916
  }
17119
16917
 
17120
- checkPaths(src, dest, (err, destStat) => {
16918
+ stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {
17121
16919
  if (err) return cb(err)
17122
- if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)
17123
- return checkParentDir(destStat, src, dest, opts, cb)
16920
+ const { srcStat, destStat } = stats
16921
+ stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
16922
+ if (err) return cb(err)
16923
+ if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)
16924
+ return checkParentDir(destStat, src, dest, opts, cb)
16925
+ })
17124
16926
  })
17125
16927
  }
17126
16928
 
@@ -17128,20 +16930,17 @@ function checkParentDir (destStat, src, dest, opts, cb) {
17128
16930
  const destParent = path.dirname(dest)
17129
16931
  pathExists(destParent, (err, dirExists) => {
17130
16932
  if (err) return cb(err)
17131
- if (dirExists) return startCopy(destStat, src, dest, opts, cb)
17132
- mkdirp(destParent, err => {
16933
+ if (dirExists) return getStats(destStat, src, dest, opts, cb)
16934
+ mkdirs(destParent, err => {
17133
16935
  if (err) return cb(err)
17134
- return startCopy(destStat, src, dest, opts, cb)
16936
+ return getStats(destStat, src, dest, opts, cb)
17135
16937
  })
17136
16938
  })
17137
16939
  }
17138
16940
 
17139
16941
  function handleFilter (onInclude, destStat, src, dest, opts, cb) {
17140
16942
  Promise.resolve(opts.filter(src, dest)).then(include => {
17141
- if (include) {
17142
- if (destStat) return onInclude(destStat, src, dest, opts, cb)
17143
- return onInclude(src, dest, opts, cb)
17144
- }
16943
+ if (include) return onInclude(destStat, src, dest, opts, cb)
17145
16944
  return cb()
17146
16945
  }, error => cb(error))
17147
16946
  }
@@ -17161,11 +16960,14 @@ function getStats (destStat, src, dest, opts, cb) {
17161
16960
  srcStat.isCharacterDevice() ||
17162
16961
  srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)
17163
16962
  else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)
16963
+ else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`))
16964
+ else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`))
16965
+ return cb(new Error(`Unknown file: ${src}`))
17164
16966
  })
17165
16967
  }
17166
16968
 
17167
16969
  function onFile (srcStat, destStat, src, dest, opts, cb) {
17168
- if (destStat === notExist) return copyFile(srcStat, src, dest, opts, cb)
16970
+ if (!destStat) return copyFile(srcStat, src, dest, opts, cb)
17169
16971
  return mayCopyFile(srcStat, src, dest, opts, cb)
17170
16972
  }
17171
16973
 
@@ -17181,49 +16983,66 @@ function mayCopyFile (srcStat, src, dest, opts, cb) {
17181
16983
  }
17182
16984
 
17183
16985
  function copyFile (srcStat, src, dest, opts, cb) {
17184
- if (typeof fs.copyFile === 'function') {
17185
- return fs.copyFile(src, dest, err => {
16986
+ fs.copyFile(src, dest, err => {
16987
+ if (err) return cb(err)
16988
+ if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)
16989
+ return setDestMode(dest, srcStat.mode, cb)
16990
+ })
16991
+ }
16992
+
16993
+ function handleTimestampsAndMode (srcMode, src, dest, cb) {
16994
+ // Make sure the file is writable before setting the timestamp
16995
+ // otherwise open fails with EPERM when invoked with 'r+'
16996
+ // (through utimes call)
16997
+ if (fileIsNotWritable(srcMode)) {
16998
+ return makeFileWritable(dest, srcMode, err => {
17186
16999
  if (err) return cb(err)
17187
- return setDestModeAndTimestamps(srcStat, dest, opts, cb)
17000
+ return setDestTimestampsAndMode(srcMode, src, dest, cb)
17188
17001
  })
17189
17002
  }
17190
- return copyFileFallback(srcStat, src, dest, opts, cb)
17003
+ return setDestTimestampsAndMode(srcMode, src, dest, cb)
17004
+ }
17005
+
17006
+ function fileIsNotWritable (srcMode) {
17007
+ return (srcMode & 0o200) === 0
17191
17008
  }
17192
17009
 
17193
- function copyFileFallback (srcStat, src, dest, opts, cb) {
17194
- const rs = fs.createReadStream(src)
17195
- rs.on('error', err => cb(err)).once('open', () => {
17196
- const ws = fs.createWriteStream(dest, { mode: srcStat.mode })
17197
- ws.on('error', err => cb(err))
17198
- .on('open', () => rs.pipe(ws))
17199
- .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb))
17010
+ function makeFileWritable (dest, srcMode, cb) {
17011
+ return setDestMode(dest, srcMode | 0o200, cb)
17012
+ }
17013
+
17014
+ function setDestTimestampsAndMode (srcMode, src, dest, cb) {
17015
+ setDestTimestamps(src, dest, err => {
17016
+ if (err) return cb(err)
17017
+ return setDestMode(dest, srcMode, cb)
17200
17018
  })
17201
17019
  }
17202
17020
 
17203
- function setDestModeAndTimestamps (srcStat, dest, opts, cb) {
17204
- fs.chmod(dest, srcStat.mode, err => {
17021
+ function setDestMode (dest, srcMode, cb) {
17022
+ return fs.chmod(dest, srcMode, cb)
17023
+ }
17024
+
17025
+ function setDestTimestamps (src, dest, cb) {
17026
+ // The initial srcStat.atime cannot be trusted
17027
+ // because it is modified by the read(2) system call
17028
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
17029
+ fs.stat(src, (err, updatedSrcStat) => {
17205
17030
  if (err) return cb(err)
17206
- if (opts.preserveTimestamps) {
17207
- return utimes(dest, srcStat.atime, srcStat.mtime, cb)
17208
- }
17209
- return cb()
17031
+ return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)
17210
17032
  })
17211
17033
  }
17212
17034
 
17213
17035
  function onDir (srcStat, destStat, src, dest, opts, cb) {
17214
- if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts, cb)
17215
- if (destStat && !destStat.isDirectory()) {
17216
- return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`))
17217
- }
17036
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)
17218
17037
  return copyDir(src, dest, opts, cb)
17219
17038
  }
17220
17039
 
17221
- function mkDirAndCopy (srcStat, src, dest, opts, cb) {
17040
+ function mkDirAndCopy (srcMode, src, dest, opts, cb) {
17222
17041
  fs.mkdir(dest, err => {
17223
17042
  if (err) return cb(err)
17224
17043
  copyDir(src, dest, opts, err => {
17225
17044
  if (err) return cb(err)
17226
- return fs.chmod(dest, srcStat.mode, cb)
17045
+ return setDestMode(dest, srcMode, cb)
17227
17046
  })
17228
17047
  })
17229
17048
  }
@@ -17244,8 +17063,9 @@ function copyDirItems (items, src, dest, opts, cb) {
17244
17063
  function copyDirItem (items, item, src, dest, opts, cb) {
17245
17064
  const srcItem = path.join(src, item)
17246
17065
  const destItem = path.join(dest, item)
17247
- checkPaths(srcItem, destItem, (err, destStat) => {
17066
+ stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
17248
17067
  if (err) return cb(err)
17068
+ const { destStat } = stats
17249
17069
  startCopy(destStat, srcItem, destItem, opts, err => {
17250
17070
  if (err) return cb(err)
17251
17071
  return copyDirItems(items, src, dest, opts, cb)
@@ -17256,12 +17076,11 @@ function copyDirItem (items, item, src, dest, opts, cb) {
17256
17076
  function onLink (destStat, src, dest, opts, cb) {
17257
17077
  fs.readlink(src, (err, resolvedSrc) => {
17258
17078
  if (err) return cb(err)
17259
-
17260
17079
  if (opts.dereference) {
17261
17080
  resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
17262
17081
  }
17263
17082
 
17264
- if (destStat === notExist) {
17083
+ if (!destStat) {
17265
17084
  return fs.symlink(resolvedSrc, dest, cb)
17266
17085
  } else {
17267
17086
  fs.readlink(dest, (err, resolvedDest) => {
@@ -17275,14 +17094,14 @@ function onLink (destStat, src, dest, opts, cb) {
17275
17094
  if (opts.dereference) {
17276
17095
  resolvedDest = path.resolve(process.cwd(), resolvedDest)
17277
17096
  }
17278
- if (isSrcSubdir(resolvedSrc, resolvedDest)) {
17097
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
17279
17098
  return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
17280
17099
  }
17281
17100
 
17282
17101
  // do not copy if src is a subdir of dest since unlinking
17283
17102
  // dest in this case would result in removing src contents
17284
17103
  // and therefore a broken symlink would be created.
17285
- if (destStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
17104
+ if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
17286
17105
  return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
17287
17106
  }
17288
17107
  return copyLink(resolvedSrc, dest, cb)
@@ -17298,40 +17117,6 @@ function copyLink (resolvedSrc, dest, cb) {
17298
17117
  })
17299
17118
  }
17300
17119
 
17301
- // return true if dest is a subdir of src, otherwise false.
17302
- function isSrcSubdir (src, dest) {
17303
- const srcArray = path.resolve(src).split(path.sep)
17304
- const destArray = path.resolve(dest).split(path.sep)
17305
- return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true)
17306
- }
17307
-
17308
- function checkStats (src, dest, cb) {
17309
- fs.stat(src, (err, srcStat) => {
17310
- if (err) return cb(err)
17311
- fs.stat(dest, (err, destStat) => {
17312
- if (err) {
17313
- if (err.code === 'ENOENT') return cb(null, {srcStat, destStat: notExist})
17314
- return cb(err)
17315
- }
17316
- return cb(null, {srcStat, destStat})
17317
- })
17318
- })
17319
- }
17320
-
17321
- function checkPaths (src, dest, cb) {
17322
- checkStats(src, dest, (err, stats) => {
17323
- if (err) return cb(err)
17324
- const {srcStat, destStat} = stats
17325
- if (destStat.ino && destStat.ino === srcStat.ino) {
17326
- return cb(new Error('Source and destination must not be the same.'))
17327
- }
17328
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
17329
- return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`))
17330
- }
17331
- return cb(null, destStat)
17332
- })
17333
- }
17334
-
17335
17120
  module.exports = copy
17336
17121
 
17337
17122
 
@@ -17343,7 +17128,7 @@ module.exports = copy
17343
17128
  "use strict";
17344
17129
 
17345
17130
 
17346
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17131
+ const u = __webpack_require__(7500).fromCallback
17347
17132
  module.exports = {
17348
17133
  copy: u(__webpack_require__(4487))
17349
17134
  }
@@ -17357,37 +17142,28 @@ module.exports = {
17357
17142
  "use strict";
17358
17143
 
17359
17144
 
17360
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17361
- const fs = __webpack_require__(5747)
17145
+ const u = __webpack_require__(7500).fromPromise
17146
+ const fs = __webpack_require__(893)
17362
17147
  const path = __webpack_require__(5622)
17363
17148
  const mkdir = __webpack_require__(9181)
17364
17149
  const remove = __webpack_require__(4879)
17365
17150
 
17366
- const emptyDir = u(function emptyDir (dir, callback) {
17367
- callback = callback || function () {}
17368
- fs.readdir(dir, (err, items) => {
17369
- if (err) return mkdir.mkdirs(dir, callback)
17370
-
17371
- items = items.map(item => path.join(dir, item))
17372
-
17373
- deleteItem()
17151
+ const emptyDir = u(async function emptyDir (dir) {
17152
+ let items
17153
+ try {
17154
+ items = await fs.readdir(dir)
17155
+ } catch {
17156
+ return mkdir.mkdirs(dir)
17157
+ }
17374
17158
 
17375
- function deleteItem () {
17376
- const item = items.pop()
17377
- if (!item) return callback()
17378
- remove.remove(item, err => {
17379
- if (err) return callback(err)
17380
- deleteItem()
17381
- })
17382
- }
17383
- })
17159
+ return Promise.all(items.map(item => remove.remove(path.join(dir, item))))
17384
17160
  })
17385
17161
 
17386
17162
  function emptyDirSync (dir) {
17387
17163
  let items
17388
17164
  try {
17389
17165
  items = fs.readdirSync(dir)
17390
- } catch (err) {
17166
+ } catch {
17391
17167
  return mkdir.mkdirsSync(dir)
17392
17168
  }
17393
17169
 
@@ -17413,11 +17189,10 @@ module.exports = {
17413
17189
  "use strict";
17414
17190
 
17415
17191
 
17416
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17192
+ const u = __webpack_require__(7500).fromCallback
17417
17193
  const path = __webpack_require__(5622)
17418
17194
  const fs = __webpack_require__(552)
17419
17195
  const mkdir = __webpack_require__(9181)
17420
- const pathExists = __webpack_require__(5516).pathExists
17421
17196
 
17422
17197
  function createFile (file, callback) {
17423
17198
  function makeFile () {
@@ -17430,13 +17205,26 @@ function createFile (file, callback) {
17430
17205
  fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
17431
17206
  if (!err && stats.isFile()) return callback()
17432
17207
  const dir = path.dirname(file)
17433
- pathExists(dir, (err, dirExists) => {
17434
- if (err) return callback(err)
17435
- if (dirExists) return makeFile()
17436
- mkdir.mkdirs(dir, err => {
17437
- if (err) return callback(err)
17438
- makeFile()
17439
- })
17208
+ fs.stat(dir, (err, stats) => {
17209
+ if (err) {
17210
+ // if the directory doesn't exist, make it
17211
+ if (err.code === 'ENOENT') {
17212
+ return mkdir.mkdirs(dir, err => {
17213
+ if (err) return callback(err)
17214
+ makeFile()
17215
+ })
17216
+ }
17217
+ return callback(err)
17218
+ }
17219
+
17220
+ if (stats.isDirectory()) makeFile()
17221
+ else {
17222
+ // parent is not a directory
17223
+ // This is just to cause an internal ENOTDIR error to be thrown
17224
+ fs.readdir(dir, err => {
17225
+ if (err) return callback(err)
17226
+ })
17227
+ }
17440
17228
  })
17441
17229
  })
17442
17230
  }
@@ -17445,12 +17233,20 @@ function createFileSync (file) {
17445
17233
  let stats
17446
17234
  try {
17447
17235
  stats = fs.statSync(file)
17448
- } catch (e) {}
17236
+ } catch {}
17449
17237
  if (stats && stats.isFile()) return
17450
17238
 
17451
17239
  const dir = path.dirname(file)
17452
- if (!fs.existsSync(dir)) {
17453
- mkdir.mkdirsSync(dir)
17240
+ try {
17241
+ if (!fs.statSync(dir).isDirectory()) {
17242
+ // parent is not a directory
17243
+ // This is just to cause an internal ENOTDIR error to be thrown
17244
+ fs.readdirSync(dir)
17245
+ }
17246
+ } catch (err) {
17247
+ // If the stat call above failed because the directory doesn't exist, create it
17248
+ if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
17249
+ else throw err
17454
17250
  }
17455
17251
 
17456
17252
  fs.writeFileSync(file, '')
@@ -17501,11 +17297,12 @@ module.exports = {
17501
17297
  "use strict";
17502
17298
 
17503
17299
 
17504
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17300
+ const u = __webpack_require__(7500).fromCallback
17505
17301
  const path = __webpack_require__(5622)
17506
17302
  const fs = __webpack_require__(552)
17507
17303
  const mkdir = __webpack_require__(9181)
17508
17304
  const pathExists = __webpack_require__(5516).pathExists
17305
+ const { areIdentical } = __webpack_require__(9783)
17509
17306
 
17510
17307
  function createLink (srcpath, dstpath, callback) {
17511
17308
  function makeLink (srcpath, dstpath) {
@@ -17515,14 +17312,13 @@ function createLink (srcpath, dstpath, callback) {
17515
17312
  })
17516
17313
  }
17517
17314
 
17518
- pathExists(dstpath, (err, destinationExists) => {
17519
- if (err) return callback(err)
17520
- if (destinationExists) return callback(null)
17521
- fs.lstat(srcpath, (err) => {
17315
+ fs.lstat(dstpath, (_, dstStat) => {
17316
+ fs.lstat(srcpath, (err, srcStat) => {
17522
17317
  if (err) {
17523
17318
  err.message = err.message.replace('lstat', 'ensureLink')
17524
17319
  return callback(err)
17525
17320
  }
17321
+ if (dstStat && areIdentical(srcStat, dstStat)) return callback(null)
17526
17322
 
17527
17323
  const dir = path.dirname(dstpath)
17528
17324
  pathExists(dir, (err, dirExists) => {
@@ -17538,11 +17334,14 @@ function createLink (srcpath, dstpath, callback) {
17538
17334
  }
17539
17335
 
17540
17336
  function createLinkSync (srcpath, dstpath) {
17541
- const destinationExists = fs.existsSync(dstpath)
17542
- if (destinationExists) return undefined
17337
+ let dstStat
17338
+ try {
17339
+ dstStat = fs.lstatSync(dstpath)
17340
+ } catch {}
17543
17341
 
17544
17342
  try {
17545
- fs.lstatSync(srcpath)
17343
+ const srcStat = fs.lstatSync(srcpath)
17344
+ if (dstStat && areIdentical(srcStat, dstStat)) return
17546
17345
  } catch (err) {
17547
17346
  err.message = err.message.replace('lstat', 'ensureLink')
17548
17347
  throw err
@@ -17604,8 +17403,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
17604
17403
  return callback(err)
17605
17404
  }
17606
17405
  return callback(null, {
17607
- 'toCwd': srcpath,
17608
- 'toDst': srcpath
17406
+ toCwd: srcpath,
17407
+ toDst: srcpath
17609
17408
  })
17610
17409
  })
17611
17410
  } else {
@@ -17615,8 +17414,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
17615
17414
  if (err) return callback(err)
17616
17415
  if (exists) {
17617
17416
  return callback(null, {
17618
- 'toCwd': relativeToDst,
17619
- 'toDst': srcpath
17417
+ toCwd: relativeToDst,
17418
+ toDst: srcpath
17620
17419
  })
17621
17420
  } else {
17622
17421
  return fs.lstat(srcpath, (err) => {
@@ -17625,8 +17424,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
17625
17424
  return callback(err)
17626
17425
  }
17627
17426
  return callback(null, {
17628
- 'toCwd': srcpath,
17629
- 'toDst': path.relative(dstdir, srcpath)
17427
+ toCwd: srcpath,
17428
+ toDst: path.relative(dstdir, srcpath)
17630
17429
  })
17631
17430
  })
17632
17431
  }
@@ -17640,8 +17439,8 @@ function symlinkPathsSync (srcpath, dstpath) {
17640
17439
  exists = fs.existsSync(srcpath)
17641
17440
  if (!exists) throw new Error('absolute srcpath does not exist')
17642
17441
  return {
17643
- 'toCwd': srcpath,
17644
- 'toDst': srcpath
17442
+ toCwd: srcpath,
17443
+ toDst: srcpath
17645
17444
  }
17646
17445
  } else {
17647
17446
  const dstdir = path.dirname(dstpath)
@@ -17649,15 +17448,15 @@ function symlinkPathsSync (srcpath, dstpath) {
17649
17448
  exists = fs.existsSync(relativeToDst)
17650
17449
  if (exists) {
17651
17450
  return {
17652
- 'toCwd': relativeToDst,
17653
- 'toDst': srcpath
17451
+ toCwd: relativeToDst,
17452
+ toDst: srcpath
17654
17453
  }
17655
17454
  } else {
17656
17455
  exists = fs.existsSync(srcpath)
17657
17456
  if (!exists) throw new Error('relative srcpath does not exist')
17658
17457
  return {
17659
- 'toCwd': srcpath,
17660
- 'toDst': path.relative(dstdir, srcpath)
17458
+ toCwd: srcpath,
17459
+ toDst: path.relative(dstdir, srcpath)
17661
17460
  }
17662
17461
  }
17663
17462
  }
@@ -17696,7 +17495,7 @@ function symlinkTypeSync (srcpath, type) {
17696
17495
  if (type) return type
17697
17496
  try {
17698
17497
  stats = fs.lstatSync(srcpath)
17699
- } catch (e) {
17498
+ } catch {
17700
17499
  return 'file'
17701
17500
  }
17702
17501
  return (stats && stats.isDirectory()) ? 'dir' : 'file'
@@ -17716,9 +17515,9 @@ module.exports = {
17716
17515
  "use strict";
17717
17516
 
17718
17517
 
17719
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17518
+ const u = __webpack_require__(7500).fromCallback
17720
17519
  const path = __webpack_require__(5622)
17721
- const fs = __webpack_require__(552)
17520
+ const fs = __webpack_require__(893)
17722
17521
  const _mkdirs = __webpack_require__(9181)
17723
17522
  const mkdirs = _mkdirs.mkdirs
17724
17523
  const mkdirsSync = _mkdirs.mkdirsSync
@@ -17733,26 +17532,38 @@ const symlinkTypeSync = _symlinkType.symlinkTypeSync
17733
17532
 
17734
17533
  const pathExists = __webpack_require__(5516).pathExists
17735
17534
 
17535
+ const { areIdentical } = __webpack_require__(9783)
17536
+
17736
17537
  function createSymlink (srcpath, dstpath, type, callback) {
17737
17538
  callback = (typeof type === 'function') ? type : callback
17738
17539
  type = (typeof type === 'function') ? false : type
17739
17540
 
17740
- pathExists(dstpath, (err, destinationExists) => {
17541
+ fs.lstat(dstpath, (err, stats) => {
17542
+ if (!err && stats.isSymbolicLink()) {
17543
+ Promise.all([
17544
+ fs.stat(srcpath),
17545
+ fs.stat(dstpath)
17546
+ ]).then(([srcStat, dstStat]) => {
17547
+ if (areIdentical(srcStat, dstStat)) return callback(null)
17548
+ _createSymlink(srcpath, dstpath, type, callback)
17549
+ })
17550
+ } else _createSymlink(srcpath, dstpath, type, callback)
17551
+ })
17552
+ }
17553
+
17554
+ function _createSymlink (srcpath, dstpath, type, callback) {
17555
+ symlinkPaths(srcpath, dstpath, (err, relative) => {
17741
17556
  if (err) return callback(err)
17742
- if (destinationExists) return callback(null)
17743
- symlinkPaths(srcpath, dstpath, (err, relative) => {
17557
+ srcpath = relative.toDst
17558
+ symlinkType(relative.toCwd, type, (err, type) => {
17744
17559
  if (err) return callback(err)
17745
- srcpath = relative.toDst
17746
- symlinkType(relative.toCwd, type, (err, type) => {
17560
+ const dir = path.dirname(dstpath)
17561
+ pathExists(dir, (err, dirExists) => {
17747
17562
  if (err) return callback(err)
17748
- const dir = path.dirname(dstpath)
17749
- pathExists(dir, (err, dirExists) => {
17563
+ if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
17564
+ mkdirs(dir, err => {
17750
17565
  if (err) return callback(err)
17751
- if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
17752
- mkdirs(dir, err => {
17753
- if (err) return callback(err)
17754
- fs.symlink(srcpath, dstpath, type, callback)
17755
- })
17566
+ fs.symlink(srcpath, dstpath, type, callback)
17756
17567
  })
17757
17568
  })
17758
17569
  })
@@ -17760,8 +17571,15 @@ function createSymlink (srcpath, dstpath, type, callback) {
17760
17571
  }
17761
17572
 
17762
17573
  function createSymlinkSync (srcpath, dstpath, type) {
17763
- const destinationExists = fs.existsSync(dstpath)
17764
- if (destinationExists) return undefined
17574
+ let stats
17575
+ try {
17576
+ stats = fs.lstatSync(dstpath)
17577
+ } catch {}
17578
+ if (stats && stats.isSymbolicLink()) {
17579
+ const srcStat = fs.statSync(srcpath)
17580
+ const dstStat = fs.statSync(dstpath)
17581
+ if (areIdentical(srcStat, dstStat)) return
17582
+ }
17765
17583
 
17766
17584
  const relative = symlinkPathsSync(srcpath, dstpath)
17767
17585
  srcpath = relative.toDst
@@ -17788,7 +17606,7 @@ module.exports = {
17788
17606
 
17789
17607
  // This is adapted from https://github.com/normalize/mz
17790
17608
  // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
17791
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17609
+ const u = __webpack_require__(7500).fromCallback
17792
17610
  const fs = __webpack_require__(552)
17793
17611
 
17794
17612
  const api = [
@@ -17805,18 +17623,20 @@ const api = [
17805
17623
  'fsync',
17806
17624
  'ftruncate',
17807
17625
  'futimes',
17808
- 'lchown',
17809
17626
  'lchmod',
17627
+ 'lchown',
17810
17628
  'link',
17811
17629
  'lstat',
17812
17630
  'mkdir',
17813
17631
  'mkdtemp',
17814
17632
  'open',
17815
- 'readFile',
17633
+ 'opendir',
17816
17634
  'readdir',
17635
+ 'readFile',
17817
17636
  'readlink',
17818
17637
  'realpath',
17819
17638
  'rename',
17639
+ 'rm',
17820
17640
  'rmdir',
17821
17641
  'stat',
17822
17642
  'symlink',
@@ -17826,26 +17646,20 @@ const api = [
17826
17646
  'writeFile'
17827
17647
  ].filter(key => {
17828
17648
  // Some commands are not available on some systems. Ex:
17829
- // fs.copyFile was added in Node.js v8.5.0
17830
- // fs.mkdtemp was added in Node.js v5.10.0
17649
+ // fs.opendir was added in Node.js v12.12.0
17650
+ // fs.rm was added in Node.js v14.14.0
17831
17651
  // fs.lchown is not available on at least some Linux
17832
17652
  return typeof fs[key] === 'function'
17833
17653
  })
17834
17654
 
17835
- // Export all keys:
17836
- Object.keys(fs).forEach(key => {
17837
- if (key === 'promises') {
17838
- // fs.promises is a getter property that triggers ExperimentalWarning
17839
- // Don't re-export it here, the getter is defined in "lib/index.js"
17840
- return
17841
- }
17842
- exports[key] = fs[key]
17843
- })
17655
+ // Export cloned fs:
17656
+ Object.assign(exports, fs)
17844
17657
 
17845
17658
  // Universalify async methods:
17846
17659
  api.forEach(method => {
17847
17660
  exports[method] = u(fs[method])
17848
17661
  })
17662
+ exports.realpath.native = u(fs.realpath.native)
17849
17663
 
17850
17664
  // We differ from mz/fs in that we still ship the old, broken, fs.exists()
17851
17665
  // since we are a drop-in replacement for the native module
@@ -17858,7 +17672,7 @@ exports.exists = function (filename, callback) {
17858
17672
  })
17859
17673
  }
17860
17674
 
17861
- // fs.read() & fs.write need special treatment due to multiple callback args
17675
+ // fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args
17862
17676
 
17863
17677
  exports.read = function (fd, buffer, offset, length, position, callback) {
17864
17678
  if (typeof callback === 'function') {
@@ -17890,6 +17704,25 @@ exports.write = function (fd, buffer, ...args) {
17890
17704
  })
17891
17705
  }
17892
17706
 
17707
+ // fs.writev only available in Node v12.9.0+
17708
+ if (typeof fs.writev === 'function') {
17709
+ // Function signature is
17710
+ // s.writev(fd, buffers[, position], callback)
17711
+ // We need to handle the optional arg, so we use ...args
17712
+ exports.writev = function (fd, buffers, ...args) {
17713
+ if (typeof args[args.length - 1] === 'function') {
17714
+ return fs.writev(fd, buffers, ...args)
17715
+ }
17716
+
17717
+ return new Promise((resolve, reject) => {
17718
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
17719
+ if (err) return reject(err)
17720
+ resolve({ bytesWritten, buffers })
17721
+ })
17722
+ })
17723
+ }
17724
+ }
17725
+
17893
17726
 
17894
17727
  /***/ }),
17895
17728
 
@@ -17899,31 +17732,21 @@ exports.write = function (fd, buffer, ...args) {
17899
17732
  "use strict";
17900
17733
 
17901
17734
 
17902
- module.exports = Object.assign(
17903
- {},
17735
+ module.exports = {
17904
17736
  // Export promiseified graceful-fs:
17905
- __webpack_require__(893),
17737
+ ...__webpack_require__(893),
17906
17738
  // Export extra methods:
17907
- __webpack_require__(9567),
17908
- __webpack_require__(8852),
17909
- __webpack_require__(2677),
17910
- __webpack_require__(6004),
17911
- __webpack_require__(3960),
17912
- __webpack_require__(9181),
17913
- __webpack_require__(4168),
17914
- __webpack_require__(7819),
17915
- __webpack_require__(3849),
17916
- __webpack_require__(5516),
17917
- __webpack_require__(4879)
17918
- )
17919
-
17920
- // Export fs.promises as a getter property so that we don't trigger
17921
- // ExperimentalWarning before fs.promises is actually accessed.
17922
- const fs = __webpack_require__(5747)
17923
- if (Object.getOwnPropertyDescriptor(fs, 'promises')) {
17924
- Object.defineProperty(module.exports, "promises", ({
17925
- get () { return fs.promises }
17926
- }))
17739
+ ...__webpack_require__(9567),
17740
+ ...__webpack_require__(8852),
17741
+ ...__webpack_require__(2677),
17742
+ ...__webpack_require__(6004),
17743
+ ...__webpack_require__(3960),
17744
+ ...__webpack_require__(9181),
17745
+ ...__webpack_require__(4168),
17746
+ ...__webpack_require__(7819),
17747
+ ...__webpack_require__(3849),
17748
+ ...__webpack_require__(5516),
17749
+ ...__webpack_require__(4879)
17927
17750
  }
17928
17751
 
17929
17752
 
@@ -17935,7 +17758,7 @@ if (Object.getOwnPropertyDescriptor(fs, 'promises')) {
17935
17758
  "use strict";
17936
17759
 
17937
17760
 
17938
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17761
+ const u = __webpack_require__(7500).fromPromise
17939
17762
  const jsonFile = __webpack_require__(4003)
17940
17763
 
17941
17764
  jsonFile.outputJson = u(__webpack_require__(7583))
@@ -17959,14 +17782,13 @@ module.exports = jsonFile
17959
17782
  "use strict";
17960
17783
 
17961
17784
 
17962
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17963
- const jsonFile = __webpack_require__(1215)
17785
+ const jsonFile = __webpack_require__(4862)
17964
17786
 
17965
17787
  module.exports = {
17966
17788
  // jsonfile exports
17967
- readJson: u(jsonFile.readFile),
17789
+ readJson: jsonFile.readFile,
17968
17790
  readJsonSync: jsonFile.readFileSync,
17969
- writeJson: u(jsonFile.writeFile),
17791
+ writeJson: jsonFile.writeFile,
17970
17792
  writeJsonSync: jsonFile.writeFileSync
17971
17793
  }
17972
17794
 
@@ -17979,19 +17801,13 @@ module.exports = {
17979
17801
  "use strict";
17980
17802
 
17981
17803
 
17982
- const fs = __webpack_require__(552)
17983
- const path = __webpack_require__(5622)
17984
- const mkdir = __webpack_require__(9181)
17985
- const jsonFile = __webpack_require__(4003)
17804
+ const { stringify } = __webpack_require__(7653)
17805
+ const { outputFileSync } = __webpack_require__(3849)
17986
17806
 
17987
17807
  function outputJsonSync (file, data, options) {
17988
- const dir = path.dirname(file)
17808
+ const str = stringify(data, options)
17989
17809
 
17990
- if (!fs.existsSync(dir)) {
17991
- mkdir.mkdirsSync(dir)
17992
- }
17993
-
17994
- jsonFile.writeJsonSync(file, data, options)
17810
+ outputFileSync(file, str, options)
17995
17811
  }
17996
17812
 
17997
17813
  module.exports = outputJsonSync
@@ -18005,28 +17821,13 @@ module.exports = outputJsonSync
18005
17821
  "use strict";
18006
17822
 
18007
17823
 
18008
- const path = __webpack_require__(5622)
18009
- const mkdir = __webpack_require__(9181)
18010
- const pathExists = __webpack_require__(5516).pathExists
18011
- const jsonFile = __webpack_require__(4003)
17824
+ const { stringify } = __webpack_require__(7653)
17825
+ const { outputFile } = __webpack_require__(3849)
18012
17826
 
18013
- function outputJson (file, data, options, callback) {
18014
- if (typeof options === 'function') {
18015
- callback = options
18016
- options = {}
18017
- }
18018
-
18019
- const dir = path.dirname(file)
17827
+ async function outputJson (file, data, options = {}) {
17828
+ const str = stringify(data, options)
18020
17829
 
18021
- pathExists(dir, (err, itDoes) => {
18022
- if (err) return callback(err)
18023
- if (itDoes) return jsonFile.writeJson(file, data, options, callback)
18024
-
18025
- mkdir.mkdirs(dir, err => {
18026
- if (err) return callback(err)
18027
- jsonFile.writeJson(file, data, options, callback)
18028
- })
18029
- })
17830
+ await outputFile(file, str, options)
18030
17831
  }
18031
17832
 
18032
17833
  module.exports = outputJson
@@ -18039,190 +17840,101 @@ module.exports = outputJson
18039
17840
 
18040
17841
  "use strict";
18041
17842
 
18042
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18043
- const mkdirs = u(__webpack_require__(7718))
18044
- const mkdirsSync = __webpack_require__(1275)
17843
+ const u = __webpack_require__(7500).fromPromise
17844
+ const { makeDir: _makeDir, makeDirSync } = __webpack_require__(511)
17845
+ const makeDir = u(_makeDir)
18045
17846
 
18046
17847
  module.exports = {
18047
- mkdirs,
18048
- mkdirsSync,
17848
+ mkdirs: makeDir,
17849
+ mkdirsSync: makeDirSync,
18049
17850
  // alias
18050
- mkdirp: mkdirs,
18051
- mkdirpSync: mkdirsSync,
18052
- ensureDir: mkdirs,
18053
- ensureDirSync: mkdirsSync
17851
+ mkdirp: makeDir,
17852
+ mkdirpSync: makeDirSync,
17853
+ ensureDir: makeDir,
17854
+ ensureDirSync: makeDirSync
18054
17855
  }
18055
17856
 
18056
17857
 
18057
17858
  /***/ }),
18058
17859
 
18059
- /***/ 1275:
17860
+ /***/ 511:
18060
17861
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18061
17862
 
18062
17863
  "use strict";
18063
17864
 
17865
+ const fs = __webpack_require__(893)
17866
+ const { checkPath } = __webpack_require__(1176)
18064
17867
 
18065
- const fs = __webpack_require__(552)
18066
- const path = __webpack_require__(5622)
18067
- const invalidWin32Path = __webpack_require__(3727).invalidWin32Path
18068
-
18069
- const o777 = parseInt('0777', 8)
18070
-
18071
- function mkdirsSync (p, opts, made) {
18072
- if (!opts || typeof opts !== 'object') {
18073
- opts = { mode: opts }
18074
- }
18075
-
18076
- let mode = opts.mode
18077
- const xfs = opts.fs || fs
18078
-
18079
- if (process.platform === 'win32' && invalidWin32Path(p)) {
18080
- const errInval = new Error(p + ' contains invalid WIN32 path characters.')
18081
- errInval.code = 'EINVAL'
18082
- throw errInval
18083
- }
17868
+ const getMode = options => {
17869
+ const defaults = { mode: 0o777 }
17870
+ if (typeof options === 'number') return options
17871
+ return ({ ...defaults, ...options }).mode
17872
+ }
18084
17873
 
18085
- if (mode === undefined) {
18086
- mode = o777 & (~process.umask())
18087
- }
18088
- if (!made) made = null
17874
+ module.exports.makeDir = async (dir, options) => {
17875
+ checkPath(dir)
18089
17876
 
18090
- p = path.resolve(p)
17877
+ return fs.mkdir(dir, {
17878
+ mode: getMode(options),
17879
+ recursive: true
17880
+ })
17881
+ }
18091
17882
 
18092
- try {
18093
- xfs.mkdirSync(p, mode)
18094
- made = made || p
18095
- } catch (err0) {
18096
- if (err0.code === 'ENOENT') {
18097
- if (path.dirname(p) === p) throw err0
18098
- made = mkdirsSync(path.dirname(p), opts, made)
18099
- mkdirsSync(p, opts, made)
18100
- } else {
18101
- // In the case of any other error, just see if there's a dir there
18102
- // already. If so, then hooray! If not, then something is borked.
18103
- let stat
18104
- try {
18105
- stat = xfs.statSync(p)
18106
- } catch (err1) {
18107
- throw err0
18108
- }
18109
- if (!stat.isDirectory()) throw err0
18110
- }
18111
- }
17883
+ module.exports.makeDirSync = (dir, options) => {
17884
+ checkPath(dir)
18112
17885
 
18113
- return made
17886
+ return fs.mkdirSync(dir, {
17887
+ mode: getMode(options),
17888
+ recursive: true
17889
+ })
18114
17890
  }
18115
17891
 
18116
- module.exports = mkdirsSync
18117
-
18118
17892
 
18119
17893
  /***/ }),
18120
17894
 
18121
- /***/ 7718:
17895
+ /***/ 1176:
18122
17896
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18123
17897
 
18124
17898
  "use strict";
17899
+ // Adapted from https://github.com/sindresorhus/make-dir
17900
+ // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
17901
+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
17902
+ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
17903
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18125
17904
 
18126
-
18127
- const fs = __webpack_require__(552)
18128
17905
  const path = __webpack_require__(5622)
18129
- const invalidWin32Path = __webpack_require__(3727).invalidWin32Path
18130
-
18131
- const o777 = parseInt('0777', 8)
18132
-
18133
- function mkdirs (p, opts, callback, made) {
18134
- if (typeof opts === 'function') {
18135
- callback = opts
18136
- opts = {}
18137
- } else if (!opts || typeof opts !== 'object') {
18138
- opts = { mode: opts }
18139
- }
18140
-
18141
- if (process.platform === 'win32' && invalidWin32Path(p)) {
18142
- const errInval = new Error(p + ' contains invalid WIN32 path characters.')
18143
- errInval.code = 'EINVAL'
18144
- return callback(errInval)
18145
- }
18146
17906
 
18147
- let mode = opts.mode
18148
- const xfs = opts.fs || fs
17907
+ // https://github.com/nodejs/node/issues/8987
17908
+ // https://github.com/libuv/libuv/pull/1088
17909
+ module.exports.checkPath = function checkPath (pth) {
17910
+ if (process.platform === 'win32') {
17911
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
18149
17912
 
18150
- if (mode === undefined) {
18151
- mode = o777 & (~process.umask())
18152
- }
18153
- if (!made) made = null
18154
-
18155
- callback = callback || function () {}
18156
- p = path.resolve(p)
18157
-
18158
- xfs.mkdir(p, mode, er => {
18159
- if (!er) {
18160
- made = made || p
18161
- return callback(null, made)
18162
- }
18163
- switch (er.code) {
18164
- case 'ENOENT':
18165
- if (path.dirname(p) === p) return callback(er)
18166
- mkdirs(path.dirname(p), opts, (er, made) => {
18167
- if (er) callback(er, made)
18168
- else mkdirs(p, opts, callback, made)
18169
- })
18170
- break
18171
-
18172
- // In the case of any other error, just see if there's a dir
18173
- // there already. If so, then hooray! If not, then something
18174
- // is borked.
18175
- default:
18176
- xfs.stat(p, (er2, stat) => {
18177
- // if the stat fails, then that's super weird.
18178
- // let the original error be the failure reason.
18179
- if (er2 || !stat.isDirectory()) callback(er, made)
18180
- else callback(null, made)
18181
- })
18182
- break
17913
+ if (pathHasInvalidWinCharacters) {
17914
+ const error = new Error(`Path contains invalid characters: ${pth}`)
17915
+ error.code = 'EINVAL'
17916
+ throw error
18183
17917
  }
18184
- })
17918
+ }
18185
17919
  }
18186
17920
 
18187
- module.exports = mkdirs
18188
-
18189
17921
 
18190
17922
  /***/ }),
18191
17923
 
18192
- /***/ 3727:
17924
+ /***/ 4168:
18193
17925
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18194
17926
 
18195
17927
  "use strict";
18196
17928
 
18197
17929
 
18198
- const path = __webpack_require__(5622)
18199
-
18200
- // get drive on windows
18201
- function getRootPath (p) {
18202
- p = path.normalize(path.resolve(p)).split(path.sep)
18203
- if (p.length > 0) return p[0]
18204
- return null
18205
- }
18206
-
18207
- // http://stackoverflow.com/a/62888/10333 contains more accurate
18208
- // TODO: expand to include the rest
18209
- const INVALID_PATH_CHARS = /[<>:"|?*]/
18210
-
18211
- function invalidWin32Path (p) {
18212
- const rp = getRootPath(p)
18213
- p = p.replace(rp, '')
18214
- return INVALID_PATH_CHARS.test(p)
18215
- }
18216
-
18217
17930
  module.exports = {
18218
- getRootPath,
18219
- invalidWin32Path
17931
+ moveSync: __webpack_require__(6776)
18220
17932
  }
18221
17933
 
18222
17934
 
18223
17935
  /***/ }),
18224
17936
 
18225
- /***/ 4168:
17937
+ /***/ 6776:
18226
17938
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18227
17939
 
18228
17940
  "use strict";
@@ -18231,135 +17943,86 @@ module.exports = {
18231
17943
  const fs = __webpack_require__(552)
18232
17944
  const path = __webpack_require__(5622)
18233
17945
  const copySync = __webpack_require__(9567).copySync
18234
- const removeSync = __webpack_require__(4879).removeSync
18235
- const mkdirpSync = __webpack_require__(9181).mkdirsSync
18236
- const buffer = __webpack_require__(6343)
18237
-
18238
- function moveSync (src, dest, options) {
18239
- options = options || {}
18240
- const overwrite = options.overwrite || options.clobber || false
18241
-
18242
- src = path.resolve(src)
18243
- dest = path.resolve(dest)
18244
-
18245
- if (src === dest) return fs.accessSync(src)
18246
-
18247
- if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`)
18248
-
18249
- mkdirpSync(path.dirname(dest))
18250
- tryRenameSync()
18251
-
18252
- function tryRenameSync () {
18253
- if (overwrite) {
18254
- try {
18255
- return fs.renameSync(src, dest)
18256
- } catch (err) {
18257
- if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST' || err.code === 'EPERM') {
18258
- removeSync(dest)
18259
- options.overwrite = false // just overwriteed it, no need to do it again
18260
- return moveSync(src, dest, options)
18261
- }
18262
-
18263
- if (err.code !== 'EXDEV') throw err
18264
- return moveSyncAcrossDevice(src, dest, overwrite)
18265
- }
18266
- } else {
18267
- try {
18268
- fs.linkSync(src, dest)
18269
- return fs.unlinkSync(src)
18270
- } catch (err) {
18271
- if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
18272
- return moveSyncAcrossDevice(src, dest, overwrite)
18273
- }
18274
- throw err
18275
- }
18276
- }
18277
- }
18278
- }
18279
-
18280
- function moveSyncAcrossDevice (src, dest, overwrite) {
18281
- const stat = fs.statSync(src)
18282
-
18283
- if (stat.isDirectory()) {
18284
- return moveDirSyncAcrossDevice(src, dest, overwrite)
18285
- } else {
18286
- return moveFileSyncAcrossDevice(src, dest, overwrite)
18287
- }
18288
- }
18289
-
18290
- function moveFileSyncAcrossDevice (src, dest, overwrite) {
18291
- const BUF_LENGTH = 64 * 1024
18292
- const _buff = buffer(BUF_LENGTH)
18293
-
18294
- const flags = overwrite ? 'w' : 'wx'
18295
-
18296
- const fdr = fs.openSync(src, 'r')
18297
- const stat = fs.fstatSync(fdr)
18298
- const fdw = fs.openSync(dest, flags, stat.mode)
18299
- let pos = 0
17946
+ const removeSync = __webpack_require__(4879).removeSync
17947
+ const mkdirpSync = __webpack_require__(9181).mkdirpSync
17948
+ const stat = __webpack_require__(9783)
18300
17949
 
18301
- while (pos < stat.size) {
18302
- const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
18303
- fs.writeSync(fdw, _buff, 0, bytesRead)
18304
- pos += bytesRead
18305
- }
17950
+ function moveSync (src, dest, opts) {
17951
+ opts = opts || {}
17952
+ const overwrite = opts.overwrite || opts.clobber || false
18306
17953
 
18307
- fs.closeSync(fdr)
18308
- fs.closeSync(fdw)
18309
- return fs.unlinkSync(src)
17954
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
17955
+ stat.checkParentPathsSync(src, srcStat, dest, 'move')
17956
+ if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
17957
+ return doRename(src, dest, overwrite, isChangingCase)
18310
17958
  }
18311
17959
 
18312
- function moveDirSyncAcrossDevice (src, dest, overwrite) {
18313
- const options = {
18314
- overwrite: false
18315
- }
17960
+ function isParentRoot (dest) {
17961
+ const parent = path.dirname(dest)
17962
+ const parsedPath = path.parse(parent)
17963
+ return parsedPath.root === parent
17964
+ }
18316
17965
 
17966
+ function doRename (src, dest, overwrite, isChangingCase) {
17967
+ if (isChangingCase) return rename(src, dest, overwrite)
18317
17968
  if (overwrite) {
18318
17969
  removeSync(dest)
18319
- tryCopySync()
18320
- } else {
18321
- tryCopySync()
17970
+ return rename(src, dest, overwrite)
18322
17971
  }
17972
+ if (fs.existsSync(dest)) throw new Error('dest already exists.')
17973
+ return rename(src, dest, overwrite)
17974
+ }
18323
17975
 
18324
- function tryCopySync () {
18325
- copySync(src, dest, options)
18326
- return removeSync(src)
17976
+ function rename (src, dest, overwrite) {
17977
+ try {
17978
+ fs.renameSync(src, dest)
17979
+ } catch (err) {
17980
+ if (err.code !== 'EXDEV') throw err
17981
+ return moveAcrossDevice(src, dest, overwrite)
18327
17982
  }
18328
17983
  }
18329
17984
 
18330
- // return true if dest is a subdir of src, otherwise false.
18331
- // extract dest base dir and check if that is the same as src basename
18332
- function isSrcSubdir (src, dest) {
18333
- try {
18334
- return fs.statSync(src).isDirectory() &&
18335
- src !== dest &&
18336
- dest.indexOf(src) > -1 &&
18337
- dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src)
18338
- } catch (e) {
18339
- return false
17985
+ function moveAcrossDevice (src, dest, overwrite) {
17986
+ const opts = {
17987
+ overwrite,
17988
+ errorOnExist: true
18340
17989
  }
17990
+ copySync(src, dest, opts)
17991
+ return removeSync(src)
18341
17992
  }
18342
17993
 
17994
+ module.exports = moveSync
17995
+
17996
+
17997
+ /***/ }),
17998
+
17999
+ /***/ 7819:
18000
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18001
+
18002
+ "use strict";
18003
+
18004
+
18005
+ const u = __webpack_require__(7500).fromCallback
18343
18006
  module.exports = {
18344
- moveSync
18007
+ move: u(__webpack_require__(4064))
18345
18008
  }
18346
18009
 
18347
18010
 
18348
18011
  /***/ }),
18349
18012
 
18350
- /***/ 7819:
18013
+ /***/ 4064:
18351
18014
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18352
18015
 
18353
18016
  "use strict";
18354
18017
 
18355
18018
 
18356
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18357
18019
  const fs = __webpack_require__(552)
18358
18020
  const path = __webpack_require__(5622)
18359
18021
  const copy = __webpack_require__(8852).copy
18360
18022
  const remove = __webpack_require__(4879).remove
18361
18023
  const mkdirp = __webpack_require__(9181).mkdirp
18362
18024
  const pathExists = __webpack_require__(5516).pathExists
18025
+ const stat = __webpack_require__(9783)
18363
18026
 
18364
18027
  function move (src, dest, opts, cb) {
18365
18028
  if (typeof opts === 'function') {
@@ -18369,25 +18032,28 @@ function move (src, dest, opts, cb) {
18369
18032
 
18370
18033
  const overwrite = opts.overwrite || opts.clobber || false
18371
18034
 
18372
- src = path.resolve(src)
18373
- dest = path.resolve(dest)
18374
-
18375
- if (src === dest) return fs.access(src, cb)
18376
-
18377
- fs.stat(src, (err, st) => {
18035
+ stat.checkPaths(src, dest, 'move', opts, (err, stats) => {
18378
18036
  if (err) return cb(err)
18379
-
18380
- if (st.isDirectory() && isSrcSubdir(src, dest)) {
18381
- return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`))
18382
- }
18383
- mkdirp(path.dirname(dest), err => {
18037
+ const { srcStat, isChangingCase = false } = stats
18038
+ stat.checkParentPaths(src, srcStat, dest, 'move', err => {
18384
18039
  if (err) return cb(err)
18385
- return doRename(src, dest, overwrite, cb)
18040
+ if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb)
18041
+ mkdirp(path.dirname(dest), err => {
18042
+ if (err) return cb(err)
18043
+ return doRename(src, dest, overwrite, isChangingCase, cb)
18044
+ })
18386
18045
  })
18387
18046
  })
18388
18047
  }
18389
18048
 
18390
- function doRename (src, dest, overwrite, cb) {
18049
+ function isParentRoot (dest) {
18050
+ const parent = path.dirname(dest)
18051
+ const parsedPath = path.parse(parent)
18052
+ return parsedPath.root === parent
18053
+ }
18054
+
18055
+ function doRename (src, dest, overwrite, isChangingCase, cb) {
18056
+ if (isChangingCase) return rename(src, dest, overwrite, cb)
18391
18057
  if (overwrite) {
18392
18058
  return remove(dest, err => {
18393
18059
  if (err) return cb(err)
@@ -18414,25 +18080,13 @@ function moveAcrossDevice (src, dest, overwrite, cb) {
18414
18080
  overwrite,
18415
18081
  errorOnExist: true
18416
18082
  }
18417
-
18418
18083
  copy(src, dest, opts, err => {
18419
18084
  if (err) return cb(err)
18420
18085
  return remove(src, cb)
18421
18086
  })
18422
18087
  }
18423
18088
 
18424
- function isSrcSubdir (src, dest) {
18425
- const srcArray = src.split(path.sep)
18426
- const destArray = dest.split(path.sep)
18427
-
18428
- return srcArray.reduce((acc, current, i) => {
18429
- return acc && destArray[i] === current
18430
- }, true)
18431
- }
18432
-
18433
- module.exports = {
18434
- move: u(move)
18435
- }
18089
+ module.exports = move
18436
18090
 
18437
18091
 
18438
18092
  /***/ }),
@@ -18443,7 +18097,7 @@ module.exports = {
18443
18097
  "use strict";
18444
18098
 
18445
18099
 
18446
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18100
+ const u = __webpack_require__(7500).fromCallback
18447
18101
  const fs = __webpack_require__(552)
18448
18102
  const path = __webpack_require__(5622)
18449
18103
  const mkdir = __webpack_require__(9181)
@@ -18490,7 +18144,7 @@ module.exports = {
18490
18144
 
18491
18145
  "use strict";
18492
18146
 
18493
- const u = __webpack_require__(2703)/* .fromPromise */ .p
18147
+ const u = __webpack_require__(7500).fromPromise
18494
18148
  const fs = __webpack_require__(893)
18495
18149
 
18496
18150
  function pathExists (path) {
@@ -18511,12 +18165,25 @@ module.exports = {
18511
18165
  "use strict";
18512
18166
 
18513
18167
 
18514
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18168
+ const fs = __webpack_require__(552)
18169
+ const u = __webpack_require__(7500).fromCallback
18515
18170
  const rimraf = __webpack_require__(7137)
18516
18171
 
18172
+ function remove (path, callback) {
18173
+ // Node 14.14.0+
18174
+ if (fs.rm) return fs.rm(path, { recursive: true, force: true }, callback)
18175
+ rimraf(path, callback)
18176
+ }
18177
+
18178
+ function removeSync (path) {
18179
+ // Node 14.14.0+
18180
+ if (fs.rmSync) return fs.rmSync(path, { recursive: true, force: true })
18181
+ rimraf.sync(path)
18182
+ }
18183
+
18517
18184
  module.exports = {
18518
- remove: u(rimraf),
18519
- removeSync: rimraf.sync
18185
+ remove: u(remove),
18186
+ removeSync
18520
18187
  }
18521
18188
 
18522
18189
 
@@ -18641,9 +18308,6 @@ function fixWinEPERM (p, options, er, cb) {
18641
18308
  assert(p)
18642
18309
  assert(options)
18643
18310
  assert(typeof cb === 'function')
18644
- if (er) {
18645
- assert(er instanceof Error)
18646
- }
18647
18311
 
18648
18312
  options.chmod(p, 0o666, er2 => {
18649
18313
  if (er2) {
@@ -18667,9 +18331,6 @@ function fixWinEPERMSync (p, options, er) {
18667
18331
 
18668
18332
  assert(p)
18669
18333
  assert(options)
18670
- if (er) {
18671
- assert(er instanceof Error)
18672
- }
18673
18334
 
18674
18335
  try {
18675
18336
  options.chmodSync(p, 0o666)
@@ -18701,9 +18362,6 @@ function fixWinEPERMSync (p, options, er) {
18701
18362
  function rmdir (p, options, originalEr, cb) {
18702
18363
  assert(p)
18703
18364
  assert(options)
18704
- if (originalEr) {
18705
- assert(originalEr instanceof Error)
18706
- }
18707
18365
  assert(typeof cb === 'function')
18708
18366
 
18709
18367
  // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
@@ -18796,9 +18454,6 @@ function rimrafSync (p, options) {
18796
18454
  function rmdirSync (p, options, originalEr) {
18797
18455
  assert(p)
18798
18456
  assert(options)
18799
- if (originalEr) {
18800
- assert(originalEr instanceof Error)
18801
- }
18802
18457
 
18803
18458
  try {
18804
18459
  options.rmdirSync(p)
@@ -18818,24 +18473,24 @@ function rmkidsSync (p, options) {
18818
18473
  assert(options)
18819
18474
  options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
18820
18475
 
18821
- // We only end up here once we got ENOTEMPTY at least once, and
18822
- // at this point, we are guaranteed to have removed all the kids.
18823
- // So, we know that it won't be ENOENT or ENOTDIR or anything else.
18824
- // try really hard to delete stuff on windows, because it has a
18825
- // PROFOUNDLY annoying habit of not closing handles promptly when
18826
- // files are deleted, resulting in spurious ENOTEMPTY errors.
18827
- const retries = isWindows ? 100 : 1
18828
- let i = 0
18829
- do {
18830
- let threw = true
18831
- try {
18832
- const ret = options.rmdirSync(p, options)
18833
- threw = false
18834
- return ret
18835
- } finally {
18836
- if (++i < retries && threw) continue // eslint-disable-line
18837
- }
18838
- } while (true)
18476
+ if (isWindows) {
18477
+ // We only end up here once we got ENOTEMPTY at least once, and
18478
+ // at this point, we are guaranteed to have removed all the kids.
18479
+ // So, we know that it won't be ENOENT or ENOTDIR or anything else.
18480
+ // try really hard to delete stuff on windows, because it has a
18481
+ // PROFOUNDLY annoying habit of not closing handles promptly when
18482
+ // files are deleted, resulting in spurious ENOTEMPTY errors.
18483
+ const startTime = Date.now()
18484
+ do {
18485
+ try {
18486
+ const ret = options.rmdirSync(p, options)
18487
+ return ret
18488
+ } catch {}
18489
+ } while (Date.now() - startTime < 500) // give up after 500ms
18490
+ } else {
18491
+ const ret = options.rmdirSync(p, options)
18492
+ return ret
18493
+ }
18839
18494
  }
18840
18495
 
18841
18496
  module.exports = rimraf
@@ -18844,84 +18499,176 @@ rimraf.sync = rimrafSync
18844
18499
 
18845
18500
  /***/ }),
18846
18501
 
18847
- /***/ 6343:
18848
- /***/ ((module) => {
18502
+ /***/ 9783:
18503
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18849
18504
 
18850
18505
  "use strict";
18851
18506
 
18852
- /* eslint-disable node/no-deprecated-api */
18853
- module.exports = function (size) {
18854
- if (typeof Buffer.allocUnsafe === 'function') {
18855
- try {
18856
- return Buffer.allocUnsafe(size)
18857
- } catch (e) {
18858
- return new Buffer(size)
18859
- }
18507
+
18508
+ const fs = __webpack_require__(893)
18509
+ const path = __webpack_require__(5622)
18510
+ const util = __webpack_require__(1669)
18511
+
18512
+ function getStats (src, dest, opts) {
18513
+ const statFunc = opts.dereference
18514
+ ? (file) => fs.stat(file, { bigint: true })
18515
+ : (file) => fs.lstat(file, { bigint: true })
18516
+ return Promise.all([
18517
+ statFunc(src),
18518
+ statFunc(dest).catch(err => {
18519
+ if (err.code === 'ENOENT') return null
18520
+ throw err
18521
+ })
18522
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
18523
+ }
18524
+
18525
+ function getStatsSync (src, dest, opts) {
18526
+ let destStat
18527
+ const statFunc = opts.dereference
18528
+ ? (file) => fs.statSync(file, { bigint: true })
18529
+ : (file) => fs.lstatSync(file, { bigint: true })
18530
+ const srcStat = statFunc(src)
18531
+ try {
18532
+ destStat = statFunc(dest)
18533
+ } catch (err) {
18534
+ if (err.code === 'ENOENT') return { srcStat, destStat: null }
18535
+ throw err
18860
18536
  }
18861
- return new Buffer(size)
18537
+ return { srcStat, destStat }
18862
18538
  }
18863
18539
 
18540
+ function checkPaths (src, dest, funcName, opts, cb) {
18541
+ util.callbackify(getStats)(src, dest, opts, (err, stats) => {
18542
+ if (err) return cb(err)
18543
+ const { srcStat, destStat } = stats
18864
18544
 
18865
- /***/ }),
18545
+ if (destStat) {
18546
+ if (areIdentical(srcStat, destStat)) {
18547
+ const srcBaseName = path.basename(src)
18548
+ const destBaseName = path.basename(dest)
18549
+ if (funcName === 'move' &&
18550
+ srcBaseName !== destBaseName &&
18551
+ srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
18552
+ return cb(null, { srcStat, destStat, isChangingCase: true })
18553
+ }
18554
+ return cb(new Error('Source and destination must not be the same.'))
18555
+ }
18556
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
18557
+ return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`))
18558
+ }
18559
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
18560
+ return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`))
18561
+ }
18562
+ }
18866
18563
 
18867
- /***/ 8605:
18868
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18564
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
18565
+ return cb(new Error(errMsg(src, dest, funcName)))
18566
+ }
18567
+ return cb(null, { srcStat, destStat })
18568
+ })
18569
+ }
18869
18570
 
18870
- "use strict";
18571
+ function checkPathsSync (src, dest, funcName, opts) {
18572
+ const { srcStat, destStat } = getStatsSync(src, dest, opts)
18871
18573
 
18574
+ if (destStat) {
18575
+ if (areIdentical(srcStat, destStat)) {
18576
+ const srcBaseName = path.basename(src)
18577
+ const destBaseName = path.basename(dest)
18578
+ if (funcName === 'move' &&
18579
+ srcBaseName !== destBaseName &&
18580
+ srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
18581
+ return { srcStat, destStat, isChangingCase: true }
18582
+ }
18583
+ throw new Error('Source and destination must not be the same.')
18584
+ }
18585
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
18586
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
18587
+ }
18588
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
18589
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
18590
+ }
18591
+ }
18872
18592
 
18873
- const fs = __webpack_require__(552)
18874
- const os = __webpack_require__(2087)
18875
- const path = __webpack_require__(5622)
18593
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
18594
+ throw new Error(errMsg(src, dest, funcName))
18595
+ }
18596
+ return { srcStat, destStat }
18597
+ }
18876
18598
 
18877
- // HFS, ext{2,3}, FAT do not, Node.js v0.10 does not
18878
- function hasMillisResSync () {
18879
- let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2))
18880
- tmpfile = path.join(os.tmpdir(), tmpfile)
18599
+ // recursively check if dest parent is a subdirectory of src.
18600
+ // It works for all file types including symlinks since it
18601
+ // checks the src and dest inodes. It starts from the deepest
18602
+ // parent and stops once it reaches the src parent or the root path.
18603
+ function checkParentPaths (src, srcStat, dest, funcName, cb) {
18604
+ const srcParent = path.resolve(path.dirname(src))
18605
+ const destParent = path.resolve(path.dirname(dest))
18606
+ if (destParent === srcParent || destParent === path.parse(destParent).root) return cb()
18607
+ fs.stat(destParent, { bigint: true }, (err, destStat) => {
18608
+ if (err) {
18609
+ if (err.code === 'ENOENT') return cb()
18610
+ return cb(err)
18611
+ }
18612
+ if (areIdentical(srcStat, destStat)) {
18613
+ return cb(new Error(errMsg(src, dest, funcName)))
18614
+ }
18615
+ return checkParentPaths(src, srcStat, destParent, funcName, cb)
18616
+ })
18617
+ }
18881
18618
 
18882
- // 550 millis past UNIX epoch
18883
- const d = new Date(1435410243862)
18884
- fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141')
18885
- const fd = fs.openSync(tmpfile, 'r+')
18886
- fs.futimesSync(fd, d, d)
18887
- fs.closeSync(fd)
18888
- return fs.statSync(tmpfile).mtime > 1435410243000
18619
+ function checkParentPathsSync (src, srcStat, dest, funcName) {
18620
+ const srcParent = path.resolve(path.dirname(src))
18621
+ const destParent = path.resolve(path.dirname(dest))
18622
+ if (destParent === srcParent || destParent === path.parse(destParent).root) return
18623
+ let destStat
18624
+ try {
18625
+ destStat = fs.statSync(destParent, { bigint: true })
18626
+ } catch (err) {
18627
+ if (err.code === 'ENOENT') return
18628
+ throw err
18629
+ }
18630
+ if (areIdentical(srcStat, destStat)) {
18631
+ throw new Error(errMsg(src, dest, funcName))
18632
+ }
18633
+ return checkParentPathsSync(src, srcStat, destParent, funcName)
18889
18634
  }
18890
18635
 
18891
- function hasMillisRes (callback) {
18892
- let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2))
18893
- tmpfile = path.join(os.tmpdir(), tmpfile)
18636
+ function areIdentical (srcStat, destStat) {
18637
+ return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
18638
+ }
18894
18639
 
18895
- // 550 millis past UNIX epoch
18896
- const d = new Date(1435410243862)
18897
- fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => {
18898
- if (err) return callback(err)
18899
- fs.open(tmpfile, 'r+', (err, fd) => {
18900
- if (err) return callback(err)
18901
- fs.futimes(fd, d, d, err => {
18902
- if (err) return callback(err)
18903
- fs.close(fd, err => {
18904
- if (err) return callback(err)
18905
- fs.stat(tmpfile, (err, stats) => {
18906
- if (err) return callback(err)
18907
- callback(null, stats.mtime > 1435410243000)
18908
- })
18909
- })
18910
- })
18911
- })
18912
- })
18640
+ // return true if dest is a subdir of src, otherwise false.
18641
+ // It only checks the path strings.
18642
+ function isSrcSubdir (src, dest) {
18643
+ const srcArr = path.resolve(src).split(path.sep).filter(i => i)
18644
+ const destArr = path.resolve(dest).split(path.sep).filter(i => i)
18645
+ return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true)
18913
18646
  }
18914
18647
 
18915
- function timeRemoveMillis (timestamp) {
18916
- if (typeof timestamp === 'number') {
18917
- return Math.floor(timestamp / 1000) * 1000
18918
- } else if (timestamp instanceof Date) {
18919
- return new Date(Math.floor(timestamp.getTime() / 1000) * 1000)
18920
- } else {
18921
- throw new Error('fs-extra: timeRemoveMillis() unknown parameter type')
18922
- }
18648
+ function errMsg (src, dest, funcName) {
18649
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
18650
+ }
18651
+
18652
+ module.exports = {
18653
+ checkPaths,
18654
+ checkPathsSync,
18655
+ checkParentPaths,
18656
+ checkParentPathsSync,
18657
+ isSrcSubdir,
18658
+ areIdentical
18923
18659
  }
18924
18660
 
18661
+
18662
+ /***/ }),
18663
+
18664
+ /***/ 8605:
18665
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18666
+
18667
+ "use strict";
18668
+
18669
+
18670
+ const fs = __webpack_require__(552)
18671
+
18925
18672
  function utimesMillis (path, atime, mtime, callback) {
18926
18673
  // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
18927
18674
  fs.open(path, 'r+', (err, fd) => {
@@ -18941,9 +18688,6 @@ function utimesMillisSync (path, atime, mtime) {
18941
18688
  }
18942
18689
 
18943
18690
  module.exports = {
18944
- hasMillisRes,
18945
- hasMillisResSync,
18946
- timeRemoveMillis,
18947
18691
  utimesMillis,
18948
18692
  utimesMillisSync
18949
18693
  }
@@ -24610,6 +24354,122 @@ module.exports = new Type('tag:yaml.org,2002:timestamp', {
24610
24354
  });
24611
24355
 
24612
24356
 
24357
+ /***/ }),
24358
+
24359
+ /***/ 4862:
24360
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24361
+
24362
+ let _fs
24363
+ try {
24364
+ _fs = __webpack_require__(552)
24365
+ } catch (_) {
24366
+ _fs = __webpack_require__(5747)
24367
+ }
24368
+ const universalify = __webpack_require__(7500)
24369
+ const { stringify, stripBom } = __webpack_require__(7653)
24370
+
24371
+ async function _readFile (file, options = {}) {
24372
+ if (typeof options === 'string') {
24373
+ options = { encoding: options }
24374
+ }
24375
+
24376
+ const fs = options.fs || _fs
24377
+
24378
+ const shouldThrow = 'throws' in options ? options.throws : true
24379
+
24380
+ let data = await universalify.fromCallback(fs.readFile)(file, options)
24381
+
24382
+ data = stripBom(data)
24383
+
24384
+ let obj
24385
+ try {
24386
+ obj = JSON.parse(data, options ? options.reviver : null)
24387
+ } catch (err) {
24388
+ if (shouldThrow) {
24389
+ err.message = `${file}: ${err.message}`
24390
+ throw err
24391
+ } else {
24392
+ return null
24393
+ }
24394
+ }
24395
+
24396
+ return obj
24397
+ }
24398
+
24399
+ const readFile = universalify.fromPromise(_readFile)
24400
+
24401
+ function readFileSync (file, options = {}) {
24402
+ if (typeof options === 'string') {
24403
+ options = { encoding: options }
24404
+ }
24405
+
24406
+ const fs = options.fs || _fs
24407
+
24408
+ const shouldThrow = 'throws' in options ? options.throws : true
24409
+
24410
+ try {
24411
+ let content = fs.readFileSync(file, options)
24412
+ content = stripBom(content)
24413
+ return JSON.parse(content, options.reviver)
24414
+ } catch (err) {
24415
+ if (shouldThrow) {
24416
+ err.message = `${file}: ${err.message}`
24417
+ throw err
24418
+ } else {
24419
+ return null
24420
+ }
24421
+ }
24422
+ }
24423
+
24424
+ async function _writeFile (file, obj, options = {}) {
24425
+ const fs = options.fs || _fs
24426
+
24427
+ const str = stringify(obj, options)
24428
+
24429
+ await universalify.fromCallback(fs.writeFile)(file, str, options)
24430
+ }
24431
+
24432
+ const writeFile = universalify.fromPromise(_writeFile)
24433
+
24434
+ function writeFileSync (file, obj, options = {}) {
24435
+ const fs = options.fs || _fs
24436
+
24437
+ const str = stringify(obj, options)
24438
+ // not sure if fs.writeFileSync returns anything, but just in case
24439
+ return fs.writeFileSync(file, str, options)
24440
+ }
24441
+
24442
+ const jsonfile = {
24443
+ readFile,
24444
+ readFileSync,
24445
+ writeFile,
24446
+ writeFileSync
24447
+ }
24448
+
24449
+ module.exports = jsonfile
24450
+
24451
+
24452
+ /***/ }),
24453
+
24454
+ /***/ 7653:
24455
+ /***/ ((module) => {
24456
+
24457
+ function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
24458
+ const EOF = finalEOL ? EOL : ''
24459
+ const str = JSON.stringify(obj, replacer, spaces)
24460
+
24461
+ return str.replace(/\n/g, EOL) + EOF
24462
+ }
24463
+
24464
+ function stripBom (content) {
24465
+ // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
24466
+ if (Buffer.isBuffer(content)) content = content.toString('utf8')
24467
+ return content.replace(/^\uFEFF/, '')
24468
+ }
24469
+
24470
+ module.exports = { stringify, stripBom }
24471
+
24472
+
24613
24473
  /***/ }),
24614
24474
 
24615
24475
  /***/ 4725:
@@ -26182,6 +26042,38 @@ function coerce (version, options) {
26182
26042
  }
26183
26043
 
26184
26044
 
26045
+ /***/ }),
26046
+
26047
+ /***/ 7500:
26048
+ /***/ ((__unused_webpack_module, exports) => {
26049
+
26050
+ "use strict";
26051
+
26052
+
26053
+ exports.fromCallback = function (fn) {
26054
+ return Object.defineProperty(function (...args) {
26055
+ if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
26056
+ else {
26057
+ return new Promise((resolve, reject) => {
26058
+ fn.call(
26059
+ this,
26060
+ ...args,
26061
+ (err, res) => (err != null) ? reject(err) : resolve(res)
26062
+ )
26063
+ })
26064
+ }
26065
+ }, 'name', { value: fn.name })
26066
+ }
26067
+
26068
+ exports.fromPromise = function (fn) {
26069
+ return Object.defineProperty(function (...args) {
26070
+ const cb = args[args.length - 1]
26071
+ if (typeof cb !== 'function') return fn.apply(this, args)
26072
+ else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb)
26073
+ }, 'name', { value: fn.name })
26074
+ }
26075
+
26076
+
26185
26077
  /***/ }),
26186
26078
 
26187
26079
  /***/ 8438:
@@ -33701,6 +33593,7 @@ const assert_1 = __importDefault(__webpack_require__(2357));
33701
33593
  const glob_1 = __importDefault(__webpack_require__(1104));
33702
33594
  const util_1 = __webpack_require__(1669);
33703
33595
  const fs_extra_1 = __webpack_require__(5392);
33596
+ const normalize_path_1 = __webpack_require__(6261);
33704
33597
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
33705
33598
  const vanillaGlob = util_1.promisify(glob_1.default);
33706
33599
  async function glob(pattern, opts, mountpoint) {
@@ -33724,7 +33617,7 @@ async function glob(pattern, opts, mountpoint) {
33724
33617
  options.dot = true;
33725
33618
  const files = await vanillaGlob(pattern, options);
33726
33619
  for (const relativePath of files) {
33727
- const fsPath = path_1.default.join(options.cwd, relativePath).replace(/\\/g, '/');
33620
+ const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath));
33728
33621
  let stat = options.statCache[fsPath];
33729
33622
  assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
33730
33623
  const isSymlink = options.symlinks[fsPath];
@@ -33830,6 +33723,25 @@ function isDiscontinued({ discontinueDate }) {
33830
33723
  }
33831
33724
 
33832
33725
 
33726
+ /***/ }),
33727
+
33728
+ /***/ 6261:
33729
+ /***/ ((__unused_webpack_module, exports) => {
33730
+
33731
+ "use strict";
33732
+
33733
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33734
+ exports.normalizePath = void 0;
33735
+ const isWin = process.platform === 'win32';
33736
+ /**
33737
+ * Convert Windows separators to Unix separators.
33738
+ */
33739
+ function normalizePath(p) {
33740
+ return isWin ? p.replace(/\\/g, '/') : p;
33741
+ }
33742
+ exports.normalizePath = normalizePath;
33743
+
33744
+
33833
33745
  /***/ }),
33834
33746
 
33835
33747
  /***/ 7792:
@@ -34293,7 +34205,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34293
34205
  return (mod && mod.__esModule) ? mod : { "default": mod };
34294
34206
  };
34295
34207
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34296
- exports.getPlatformEnv = exports.isStaticRuntime = exports.isOfficialRuntime = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = exports.streamToBuffer = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.download = exports.Prerender = exports.createLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
34208
+ exports.getPlatformEnv = exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = exports.streamToBuffer = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.download = exports.Prerender = exports.createLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
34297
34209
  const file_blob_1 = __importDefault(__webpack_require__(2397));
34298
34210
  exports.FileBlob = file_blob_1.default;
34299
34211
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -34353,6 +34265,8 @@ var filesystem_1 = __webpack_require__(461);
34353
34265
  Object.defineProperty(exports, "DetectorFilesystem", ({ enumerable: true, get: function () { return filesystem_1.DetectorFilesystem; } }));
34354
34266
  var read_config_file_1 = __webpack_require__(7792);
34355
34267
  Object.defineProperty(exports, "readConfigFile", ({ enumerable: true, get: function () { return read_config_file_1.readConfigFile; } }));
34268
+ var normalize_path_1 = __webpack_require__(6261);
34269
+ Object.defineProperty(exports, "normalizePath", ({ enumerable: true, get: function () { return normalize_path_1.normalizePath; } }));
34356
34270
  __exportStar(__webpack_require__(2416), exports);
34357
34271
  __exportStar(__webpack_require__(5748), exports);
34358
34272
  __exportStar(__webpack_require__(3983), exports);
@@ -34408,7 +34322,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34408
34322
  return (mod && mod.__esModule) ? mod : { "default": mod };
34409
34323
  };
34410
34324
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34411
- exports.getLambdaOptionsFromFunction = exports.createZip = exports.createLambda = exports.Lambda = void 0;
34325
+ exports.getLambdaOptionsFromFunction = exports.createZip = exports.createLambda = exports.Lambda = exports.FILES_SYMBOL = void 0;
34412
34326
  const assert_1 = __importDefault(__webpack_require__(2357));
34413
34327
  const async_sema_1 = __importDefault(__webpack_require__(5758));
34414
34328
  const yazl_1 = __webpack_require__(1223);
@@ -34416,6 +34330,7 @@ const minimatch_1 = __importDefault(__webpack_require__(9566));
34416
34330
  const fs_extra_1 = __webpack_require__(5392);
34417
34331
  const download_1 = __webpack_require__(1611);
34418
34332
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
34333
+ exports.FILES_SYMBOL = Symbol('files');
34419
34334
  class Lambda {
34420
34335
  constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }) {
34421
34336
  this.type = 'Lambda';
@@ -34454,7 +34369,7 @@ async function createLambda({ files, handler, runtime, memory, maxDuration, envi
34454
34369
  await sema.acquire();
34455
34370
  try {
34456
34371
  const zipBuffer = await createZip(files);
34457
- return new Lambda({
34372
+ const lambda = new Lambda({
34458
34373
  zipBuffer,
34459
34374
  handler,
34460
34375
  runtime,
@@ -34463,6 +34378,9 @@ async function createLambda({ files, handler, runtime, memory, maxDuration, envi
34463
34378
  environment,
34464
34379
  regions,
34465
34380
  });
34381
+ // @ts-ignore This symbol is a private API
34382
+ lambda[exports.FILES_SYMBOL] = files;
34383
+ return lambda;
34466
34384
  }
34467
34385
  finally {
34468
34386
  sema.release();