@vercel/build-utils 2.12.3-canary.9 → 2.13.0

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
@@ -7657,6 +7657,476 @@ IconvLiteDecoderStream.prototype.collect = function(cb) {
7657
7657
 
7658
7658
 
7659
7659
 
7660
+ /***/ }),
7661
+
7662
+ /***/ 3556:
7663
+ /***/ ((module) => {
7664
+
7665
+ // A simple implementation of make-array
7666
+ function make_array (subject) {
7667
+ return Array.isArray(subject)
7668
+ ? subject
7669
+ : [subject]
7670
+ }
7671
+
7672
+ const REGEX_BLANK_LINE = /^\s+$/
7673
+ const REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\!/
7674
+ const REGEX_LEADING_EXCAPED_HASH = /^\\#/
7675
+ const SLASH = '/'
7676
+ const KEY_IGNORE = typeof Symbol !== 'undefined'
7677
+ ? Symbol.for('node-ignore')
7678
+ /* istanbul ignore next */
7679
+ : 'node-ignore'
7680
+
7681
+ const define = (object, key, value) =>
7682
+ Object.defineProperty(object, key, {value})
7683
+
7684
+ const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
7685
+
7686
+ // Sanitize the range of a regular expression
7687
+ // The cases are complicated, see test cases for details
7688
+ const sanitizeRange = range => range.replace(
7689
+ REGEX_REGEXP_RANGE,
7690
+ (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
7691
+ ? match
7692
+ // Invalid range (out of order) which is ok for gitignore rules but
7693
+ // fatal for JavaScript regular expression, so eliminate it.
7694
+ : ''
7695
+ )
7696
+
7697
+ // > If the pattern ends with a slash,
7698
+ // > it is removed for the purpose of the following description,
7699
+ // > but it would only find a match with a directory.
7700
+ // > In other words, foo/ will match a directory foo and paths underneath it,
7701
+ // > but will not match a regular file or a symbolic link foo
7702
+ // > (this is consistent with the way how pathspec works in general in Git).
7703
+ // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
7704
+ // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
7705
+ // you could use option `mark: true` with `glob`
7706
+
7707
+ // '`foo/`' should not continue with the '`..`'
7708
+ const DEFAULT_REPLACER_PREFIX = [
7709
+
7710
+ // > Trailing spaces are ignored unless they are quoted with backslash ("\")
7711
+ [
7712
+ // (a\ ) -> (a )
7713
+ // (a ) -> (a)
7714
+ // (a \ ) -> (a )
7715
+ /\\?\s+$/,
7716
+ match => match.indexOf('\\') === 0
7717
+ ? ' '
7718
+ : ''
7719
+ ],
7720
+
7721
+ // replace (\ ) with ' '
7722
+ [
7723
+ /\\\s/g,
7724
+ () => ' '
7725
+ ],
7726
+
7727
+ // Escape metacharacters
7728
+ // which is written down by users but means special for regular expressions.
7729
+
7730
+ // > There are 12 characters with special meanings:
7731
+ // > - the backslash \,
7732
+ // > - the caret ^,
7733
+ // > - the dollar sign $,
7734
+ // > - the period or dot .,
7735
+ // > - the vertical bar or pipe symbol |,
7736
+ // > - the question mark ?,
7737
+ // > - the asterisk or star *,
7738
+ // > - the plus sign +,
7739
+ // > - the opening parenthesis (,
7740
+ // > - the closing parenthesis ),
7741
+ // > - and the opening square bracket [,
7742
+ // > - the opening curly brace {,
7743
+ // > These special characters are often called "metacharacters".
7744
+ [
7745
+ /[\\^$.|*+(){]/g,
7746
+ match => `\\${match}`
7747
+ ],
7748
+
7749
+ [
7750
+ // > [abc] matches any character inside the brackets
7751
+ // > (in this case a, b, or c);
7752
+ /\[([^\]/]*)($|\])/g,
7753
+ (match, p1, p2) => p2 === ']'
7754
+ ? `[${sanitizeRange(p1)}]`
7755
+ : `\\${match}`
7756
+ ],
7757
+
7758
+ [
7759
+ // > a question mark (?) matches a single character
7760
+ /(?!\\)\?/g,
7761
+ () => '[^/]'
7762
+ ],
7763
+
7764
+ // leading slash
7765
+ [
7766
+
7767
+ // > A leading slash matches the beginning of the pathname.
7768
+ // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
7769
+ // A leading slash matches the beginning of the pathname
7770
+ /^\//,
7771
+ () => '^'
7772
+ ],
7773
+
7774
+ // replace special metacharacter slash after the leading slash
7775
+ [
7776
+ /\//g,
7777
+ () => '\\/'
7778
+ ],
7779
+
7780
+ [
7781
+ // > A leading "**" followed by a slash means match in all directories.
7782
+ // > For example, "**/foo" matches file or directory "foo" anywhere,
7783
+ // > the same as pattern "foo".
7784
+ // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
7785
+ // > under directory "foo".
7786
+ // Notice that the '*'s have been replaced as '\\*'
7787
+ /^\^*\\\*\\\*\\\//,
7788
+
7789
+ // '**/foo' <-> 'foo'
7790
+ () => '^(?:.*\\/)?'
7791
+ ]
7792
+ ]
7793
+
7794
+ const DEFAULT_REPLACER_SUFFIX = [
7795
+ // starting
7796
+ [
7797
+ // there will be no leading '/'
7798
+ // (which has been replaced by section "leading slash")
7799
+ // If starts with '**', adding a '^' to the regular expression also works
7800
+ /^(?=[^^])/,
7801
+ function startingReplacer () {
7802
+ return !/\/(?!$)/.test(this)
7803
+ // > If the pattern does not contain a slash /,
7804
+ // > Git treats it as a shell glob pattern
7805
+ // Actually, if there is only a trailing slash,
7806
+ // git also treats it as a shell glob pattern
7807
+ ? '(?:^|\\/)'
7808
+
7809
+ // > Otherwise, Git treats the pattern as a shell glob suitable for
7810
+ // > consumption by fnmatch(3)
7811
+ : '^'
7812
+ }
7813
+ ],
7814
+
7815
+ // two globstars
7816
+ [
7817
+ // Use lookahead assertions so that we could match more than one `'/**'`
7818
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
7819
+
7820
+ // Zero, one or several directories
7821
+ // should not use '*', or it will be replaced by the next replacer
7822
+
7823
+ // Check if it is not the last `'/**'`
7824
+ (match, index, str) => index + 6 < str.length
7825
+
7826
+ // case: /**/
7827
+ // > A slash followed by two consecutive asterisks then a slash matches
7828
+ // > zero or more directories.
7829
+ // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
7830
+ // '/**/'
7831
+ ? '(?:\\/[^\\/]+)*'
7832
+
7833
+ // case: /**
7834
+ // > A trailing `"/**"` matches everything inside.
7835
+
7836
+ // #21: everything inside but it should not include the current folder
7837
+ : '\\/.+'
7838
+ ],
7839
+
7840
+ // intermediate wildcards
7841
+ [
7842
+ // Never replace escaped '*'
7843
+ // ignore rule '\*' will match the path '*'
7844
+
7845
+ // 'abc.*/' -> go
7846
+ // 'abc.*' -> skip this rule
7847
+ /(^|[^\\]+)\\\*(?=.+)/g,
7848
+
7849
+ // '*.js' matches '.js'
7850
+ // '*.js' doesn't match 'abc'
7851
+ (match, p1) => `${p1}[^\\/]*`
7852
+ ],
7853
+
7854
+ // trailing wildcard
7855
+ [
7856
+ /(\^|\\\/)?\\\*$/,
7857
+ (match, p1) => {
7858
+ const prefix = p1
7859
+ // '\^':
7860
+ // '/*' does not match ''
7861
+ // '/*' does not match everything
7862
+
7863
+ // '\\\/':
7864
+ // 'abc/*' does not match 'abc/'
7865
+ ? `${p1}[^/]+`
7866
+
7867
+ // 'a*' matches 'a'
7868
+ // 'a*' matches 'aa'
7869
+ : '[^/]*'
7870
+
7871
+ return `${prefix}(?=$|\\/$)`
7872
+ }
7873
+ ],
7874
+
7875
+ [
7876
+ // unescape
7877
+ /\\\\\\/g,
7878
+ () => '\\'
7879
+ ]
7880
+ ]
7881
+
7882
+ const POSITIVE_REPLACERS = [
7883
+ ...DEFAULT_REPLACER_PREFIX,
7884
+
7885
+ // 'f'
7886
+ // matches
7887
+ // - /f(end)
7888
+ // - /f/
7889
+ // - (start)f(end)
7890
+ // - (start)f/
7891
+ // doesn't match
7892
+ // - oof
7893
+ // - foo
7894
+ // pseudo:
7895
+ // -> (^|/)f(/|$)
7896
+
7897
+ // ending
7898
+ [
7899
+ // 'js' will not match 'js.'
7900
+ // 'ab' will not match 'abc'
7901
+ /(?:[^*/])$/,
7902
+
7903
+ // 'js*' will not match 'a.js'
7904
+ // 'js/' will not match 'a.js'
7905
+ // 'js' will match 'a.js' and 'a.js/'
7906
+ match => `${match}(?=$|\\/)`
7907
+ ],
7908
+
7909
+ ...DEFAULT_REPLACER_SUFFIX
7910
+ ]
7911
+
7912
+ const NEGATIVE_REPLACERS = [
7913
+ ...DEFAULT_REPLACER_PREFIX,
7914
+
7915
+ // #24, #38
7916
+ // The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore)
7917
+ // A negative pattern without a trailing wildcard should not
7918
+ // re-include the things inside that directory.
7919
+
7920
+ // eg:
7921
+ // ['node_modules/*', '!node_modules']
7922
+ // should ignore `node_modules/a.js`
7923
+ [
7924
+ /(?:[^*])$/,
7925
+ match => `${match}(?=$|\\/$)`
7926
+ ],
7927
+
7928
+ ...DEFAULT_REPLACER_SUFFIX
7929
+ ]
7930
+
7931
+ // A simple cache, because an ignore rule only has only one certain meaning
7932
+ const cache = Object.create(null)
7933
+
7934
+ // @param {pattern}
7935
+ const make_regex = (pattern, negative, ignorecase) => {
7936
+ const r = cache[pattern]
7937
+ if (r) {
7938
+ return r
7939
+ }
7940
+
7941
+ const replacers = negative
7942
+ ? NEGATIVE_REPLACERS
7943
+ : POSITIVE_REPLACERS
7944
+
7945
+ const source = replacers.reduce(
7946
+ (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
7947
+ pattern
7948
+ )
7949
+
7950
+ return cache[pattern] = ignorecase
7951
+ ? new RegExp(source, 'i')
7952
+ : new RegExp(source)
7953
+ }
7954
+
7955
+ // > A blank line matches no files, so it can serve as a separator for readability.
7956
+ const checkPattern = pattern => pattern
7957
+ && typeof pattern === 'string'
7958
+ && !REGEX_BLANK_LINE.test(pattern)
7959
+
7960
+ // > A line starting with # serves as a comment.
7961
+ && pattern.indexOf('#') !== 0
7962
+
7963
+ const createRule = (pattern, ignorecase) => {
7964
+ const origin = pattern
7965
+ let negative = false
7966
+
7967
+ // > An optional prefix "!" which negates the pattern;
7968
+ if (pattern.indexOf('!') === 0) {
7969
+ negative = true
7970
+ pattern = pattern.substr(1)
7971
+ }
7972
+
7973
+ pattern = pattern
7974
+ // > Put a backslash ("\") in front of the first "!" for patterns that
7975
+ // > begin with a literal "!", for example, `"\!important!.txt"`.
7976
+ .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!')
7977
+ // > Put a backslash ("\") in front of the first hash for patterns that
7978
+ // > begin with a hash.
7979
+ .replace(REGEX_LEADING_EXCAPED_HASH, '#')
7980
+
7981
+ const regex = make_regex(pattern, negative, ignorecase)
7982
+
7983
+ return {
7984
+ origin,
7985
+ pattern,
7986
+ negative,
7987
+ regex
7988
+ }
7989
+ }
7990
+
7991
+ class IgnoreBase {
7992
+ constructor ({
7993
+ ignorecase = true
7994
+ } = {}) {
7995
+ this._rules = []
7996
+ this._ignorecase = ignorecase
7997
+ define(this, KEY_IGNORE, true)
7998
+ this._initCache()
7999
+ }
8000
+
8001
+ _initCache () {
8002
+ this._cache = Object.create(null)
8003
+ }
8004
+
8005
+ // @param {Array.<string>|string|Ignore} pattern
8006
+ add (pattern) {
8007
+ this._added = false
8008
+
8009
+ if (typeof pattern === 'string') {
8010
+ pattern = pattern.split(/\r?\n/g)
8011
+ }
8012
+
8013
+ make_array(pattern).forEach(this._addPattern, this)
8014
+
8015
+ // Some rules have just added to the ignore,
8016
+ // making the behavior changed.
8017
+ if (this._added) {
8018
+ this._initCache()
8019
+ }
8020
+
8021
+ return this
8022
+ }
8023
+
8024
+ // legacy
8025
+ addPattern (pattern) {
8026
+ return this.add(pattern)
8027
+ }
8028
+
8029
+ _addPattern (pattern) {
8030
+ // #32
8031
+ if (pattern && pattern[KEY_IGNORE]) {
8032
+ this._rules = this._rules.concat(pattern._rules)
8033
+ this._added = true
8034
+ return
8035
+ }
8036
+
8037
+ if (checkPattern(pattern)) {
8038
+ const rule = createRule(pattern, this._ignorecase)
8039
+ this._added = true
8040
+ this._rules.push(rule)
8041
+ }
8042
+ }
8043
+
8044
+ filter (paths) {
8045
+ return make_array(paths).filter(path => this._filter(path))
8046
+ }
8047
+
8048
+ createFilter () {
8049
+ return path => this._filter(path)
8050
+ }
8051
+
8052
+ ignores (path) {
8053
+ return !this._filter(path)
8054
+ }
8055
+
8056
+ // @returns `Boolean` true if the `path` is NOT ignored
8057
+ _filter (path, slices) {
8058
+ if (!path) {
8059
+ return false
8060
+ }
8061
+
8062
+ if (path in this._cache) {
8063
+ return this._cache[path]
8064
+ }
8065
+
8066
+ if (!slices) {
8067
+ // path/to/a.js
8068
+ // ['path', 'to', 'a.js']
8069
+ slices = path.split(SLASH)
8070
+ }
8071
+
8072
+ slices.pop()
8073
+
8074
+ return this._cache[path] = slices.length
8075
+ // > It is not possible to re-include a file if a parent directory of
8076
+ // > that file is excluded.
8077
+ // If the path contains a parent directory, check the parent first
8078
+ ? this._filter(slices.join(SLASH) + SLASH, slices)
8079
+ && this._test(path)
8080
+
8081
+ // Or only test the path
8082
+ : this._test(path)
8083
+ }
8084
+
8085
+ // @returns {Boolean} true if a file is NOT ignored
8086
+ _test (path) {
8087
+ // Explicitly define variable type by setting matched to `0`
8088
+ let matched = 0
8089
+
8090
+ this._rules.forEach(rule => {
8091
+ // if matched = true, then we only test negative rules
8092
+ // if matched = false, then we test non-negative rules
8093
+ if (!(matched ^ rule.negative)) {
8094
+ matched = rule.negative ^ rule.regex.test(path)
8095
+ }
8096
+ })
8097
+
8098
+ return !matched
8099
+ }
8100
+ }
8101
+
8102
+ // Windows
8103
+ // --------------------------------------------------------------
8104
+ /* istanbul ignore if */
8105
+ if (
8106
+ // Detect `process` so that it can run in browsers.
8107
+ typeof process !== 'undefined'
8108
+ && (
8109
+ process.env && process.env.IGNORE_TEST_WIN32
8110
+ || process.platform === 'win32'
8111
+ )
8112
+ ) {
8113
+ const filter = IgnoreBase.prototype._filter
8114
+
8115
+ /* eslint no-control-regex: "off" */
8116
+ const make_posix = str => /^\\\\\?\\/.test(str)
8117
+ || /[^\x00-\x80]+/.test(str)
8118
+ ? str
8119
+ : str.replace(/\\/g, '/')
8120
+
8121
+ IgnoreBase.prototype._filter = function filterWin32 (path, slices) {
8122
+ path = make_posix(path)
8123
+ return filter.call(this, path, slices)
8124
+ }
8125
+ }
8126
+
8127
+ module.exports = options => new IgnoreBase(options)
8128
+
8129
+
7660
8130
  /***/ }),
7661
8131
 
7662
8132
  /***/ 9442:
@@ -8056,147 +8526,6 @@ function sync (path, options) {
8056
8526
  }
8057
8527
 
8058
8528
 
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
8529
  /***/ }),
8201
8530
 
8202
8531
  /***/ 9566:
@@ -14012,39 +14341,6 @@ SafeBuffer.allocUnsafeSlow = function (size) {
14012
14341
  }
14013
14342
 
14014
14343
 
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
14344
  /***/ }),
14049
14345
 
14050
14346
  /***/ 9209:
@@ -16877,14 +17173,13 @@ module.exports = eos;
16877
17173
 
16878
17174
  const fs = __webpack_require__(552)
16879
17175
  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')
17176
+ const mkdirsSync = __webpack_require__(9181).mkdirsSync
17177
+ const utimesMillisSync = __webpack_require__(8605).utimesMillisSync
17178
+ const stat = __webpack_require__(9783)
16884
17179
 
16885
17180
  function copySync (src, dest, opts) {
16886
17181
  if (typeof opts === 'function') {
16887
- opts = {filter: opts}
17182
+ opts = { filter: opts }
16888
17183
  }
16889
17184
 
16890
17185
  opts = opts || {}
@@ -16897,13 +17192,16 @@ function copySync (src, dest, opts) {
16897
17192
  see https://github.com/jprichardson/node-fs-extra/issues/269`)
16898
17193
  }
16899
17194
 
16900
- const destStat = checkPaths(src, dest)
17195
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
17196
+ stat.checkParentPathsSync(src, srcStat, dest, 'copy')
17197
+ return handleFilterAndCopy(destStat, src, dest, opts)
17198
+ }
16901
17199
 
17200
+ function handleFilterAndCopy (destStat, src, dest, opts) {
16902
17201
  if (opts.filter && !opts.filter(src, dest)) return
16903
-
16904
17202
  const destParent = path.dirname(dest)
16905
- if (!fs.existsSync(destParent)) mkdirpSync(destParent)
16906
- return startCopy(destStat, src, dest, opts)
17203
+ if (!fs.existsSync(destParent)) mkdirsSync(destParent)
17204
+ return getStats(destStat, src, dest, opts)
16907
17205
  }
16908
17206
 
16909
17207
  function startCopy (destStat, src, dest, opts) {
@@ -16920,10 +17218,13 @@ function getStats (destStat, src, dest, opts) {
16920
17218
  srcStat.isCharacterDevice() ||
16921
17219
  srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
16922
17220
  else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
17221
+ else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
17222
+ else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
17223
+ throw new Error(`Unknown file: ${src}`)
16923
17224
  }
16924
17225
 
16925
17226
  function onFile (srcStat, destStat, src, dest, opts) {
16926
- if (destStat === notExist) return copyFile(srcStat, src, dest, opts)
17227
+ if (!destStat) return copyFile(srcStat, src, dest, opts)
16927
17228
  return mayCopyFile(srcStat, src, dest, opts)
16928
17229
  }
16929
17230
 
@@ -16937,49 +17238,48 @@ function mayCopyFile (srcStat, src, dest, opts) {
16937
17238
  }
16938
17239
 
16939
17240
  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)
17241
+ fs.copyFileSync(src, dest)
17242
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
17243
+ return setDestMode(dest, srcStat.mode)
16949
17244
  }
16950
17245
 
16951
- function copyFileFallback (srcStat, src, dest, opts) {
16952
- const BUF_LENGTH = 64 * 1024
16953
- const _buff = __webpack_require__(6343)(BUF_LENGTH)
17246
+ function handleTimestamps (srcMode, src, dest) {
17247
+ // Make sure the file is writable before setting the timestamp
17248
+ // otherwise open fails with EPERM when invoked with 'r+'
17249
+ // (through utimes call)
17250
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
17251
+ return setDestTimestamps(src, dest)
17252
+ }
16954
17253
 
16955
- const fdr = fs.openSync(src, 'r')
16956
- const fdw = fs.openSync(dest, 'w', srcStat.mode)
16957
- let pos = 0
17254
+ function fileIsNotWritable (srcMode) {
17255
+ return (srcMode & 0o200) === 0
17256
+ }
16958
17257
 
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
- }
17258
+ function makeFileWritable (dest, srcMode) {
17259
+ return setDestMode(dest, srcMode | 0o200)
17260
+ }
16964
17261
 
16965
- if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime)
17262
+ function setDestMode (dest, srcMode) {
17263
+ return fs.chmodSync(dest, srcMode)
17264
+ }
16966
17265
 
16967
- fs.closeSync(fdr)
16968
- fs.closeSync(fdw)
17266
+ function setDestTimestamps (src, dest) {
17267
+ // The initial srcStat.atime cannot be trusted
17268
+ // because it is modified by the read(2) system call
17269
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
17270
+ const updatedSrcStat = fs.statSync(src)
17271
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
16969
17272
  }
16970
17273
 
16971
17274
  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
- }
17275
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
16976
17276
  return copyDir(src, dest, opts)
16977
17277
  }
16978
17278
 
16979
- function mkDirAndCopy (srcStat, src, dest, opts) {
17279
+ function mkDirAndCopy (srcMode, src, dest, opts) {
16980
17280
  fs.mkdirSync(dest)
16981
17281
  copyDir(src, dest, opts)
16982
- return fs.chmodSync(dest, srcStat.mode)
17282
+ return setDestMode(dest, srcMode)
16983
17283
  }
16984
17284
 
16985
17285
  function copyDir (src, dest, opts) {
@@ -16989,18 +17289,17 @@ function copyDir (src, dest, opts) {
16989
17289
  function copyDirItem (item, src, dest, opts) {
16990
17290
  const srcItem = path.join(src, item)
16991
17291
  const destItem = path.join(dest, item)
16992
- const destStat = checkPaths(srcItem, destItem)
17292
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
16993
17293
  return startCopy(destStat, srcItem, destItem, opts)
16994
17294
  }
16995
17295
 
16996
17296
  function onLink (destStat, src, dest, opts) {
16997
17297
  let resolvedSrc = fs.readlinkSync(src)
16998
-
16999
17298
  if (opts.dereference) {
17000
17299
  resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
17001
17300
  }
17002
17301
 
17003
- if (destStat === notExist) {
17302
+ if (!destStat) {
17004
17303
  return fs.symlinkSync(resolvedSrc, dest)
17005
17304
  } else {
17006
17305
  let resolvedDest
@@ -17016,14 +17315,14 @@ function onLink (destStat, src, dest, opts) {
17016
17315
  if (opts.dereference) {
17017
17316
  resolvedDest = path.resolve(process.cwd(), resolvedDest)
17018
17317
  }
17019
- if (isSrcSubdir(resolvedSrc, resolvedDest)) {
17318
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
17020
17319
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
17021
17320
  }
17022
17321
 
17023
17322
  // prevent copy if src is a subdir of dest since unlinking
17024
17323
  // dest in this case would result in removing src contents
17025
17324
  // and therefore a broken symlink would be created.
17026
- if (fs.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
17325
+ if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
17027
17326
  throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
17028
17327
  }
17029
17328
  return copyLink(resolvedSrc, dest)
@@ -17035,37 +17334,7 @@ function copyLink (resolvedSrc, dest) {
17035
17334
  return fs.symlinkSync(resolvedSrc, dest)
17036
17335
  }
17037
17336
 
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
- module.exports = copySync
17337
+ module.exports = copySync
17069
17338
 
17070
17339
 
17071
17340
  /***/ }),
@@ -17091,18 +17360,17 @@ module.exports = {
17091
17360
 
17092
17361
  const fs = __webpack_require__(552)
17093
17362
  const path = __webpack_require__(5622)
17094
- const mkdirp = __webpack_require__(9181).mkdirs
17363
+ const mkdirs = __webpack_require__(9181).mkdirs
17095
17364
  const pathExists = __webpack_require__(5516).pathExists
17096
- const utimes = __webpack_require__(8605).utimesMillis
17097
-
17098
- const notExist = Symbol('notExist')
17365
+ const utimesMillis = __webpack_require__(8605).utimesMillis
17366
+ const stat = __webpack_require__(9783)
17099
17367
 
17100
17368
  function copy (src, dest, opts, cb) {
17101
17369
  if (typeof opts === 'function' && !cb) {
17102
17370
  cb = opts
17103
17371
  opts = {}
17104
17372
  } else if (typeof opts === 'function') {
17105
- opts = {filter: opts}
17373
+ opts = { filter: opts }
17106
17374
  }
17107
17375
 
17108
17376
  cb = cb || function () {}
@@ -17117,10 +17385,14 @@ function copy (src, dest, opts, cb) {
17117
17385
  see https://github.com/jprichardson/node-fs-extra/issues/269`)
17118
17386
  }
17119
17387
 
17120
- checkPaths(src, dest, (err, destStat) => {
17388
+ stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {
17121
17389
  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)
17390
+ const { srcStat, destStat } = stats
17391
+ stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
17392
+ if (err) return cb(err)
17393
+ if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)
17394
+ return checkParentDir(destStat, src, dest, opts, cb)
17395
+ })
17124
17396
  })
17125
17397
  }
17126
17398
 
@@ -17128,20 +17400,17 @@ function checkParentDir (destStat, src, dest, opts, cb) {
17128
17400
  const destParent = path.dirname(dest)
17129
17401
  pathExists(destParent, (err, dirExists) => {
17130
17402
  if (err) return cb(err)
17131
- if (dirExists) return startCopy(destStat, src, dest, opts, cb)
17132
- mkdirp(destParent, err => {
17403
+ if (dirExists) return getStats(destStat, src, dest, opts, cb)
17404
+ mkdirs(destParent, err => {
17133
17405
  if (err) return cb(err)
17134
- return startCopy(destStat, src, dest, opts, cb)
17406
+ return getStats(destStat, src, dest, opts, cb)
17135
17407
  })
17136
17408
  })
17137
17409
  }
17138
17410
 
17139
17411
  function handleFilter (onInclude, destStat, src, dest, opts, cb) {
17140
17412
  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
- }
17413
+ if (include) return onInclude(destStat, src, dest, opts, cb)
17145
17414
  return cb()
17146
17415
  }, error => cb(error))
17147
17416
  }
@@ -17161,11 +17430,14 @@ function getStats (destStat, src, dest, opts, cb) {
17161
17430
  srcStat.isCharacterDevice() ||
17162
17431
  srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)
17163
17432
  else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)
17433
+ else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`))
17434
+ else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`))
17435
+ return cb(new Error(`Unknown file: ${src}`))
17164
17436
  })
17165
17437
  }
17166
17438
 
17167
17439
  function onFile (srcStat, destStat, src, dest, opts, cb) {
17168
- if (destStat === notExist) return copyFile(srcStat, src, dest, opts, cb)
17440
+ if (!destStat) return copyFile(srcStat, src, dest, opts, cb)
17169
17441
  return mayCopyFile(srcStat, src, dest, opts, cb)
17170
17442
  }
17171
17443
 
@@ -17181,49 +17453,66 @@ function mayCopyFile (srcStat, src, dest, opts, cb) {
17181
17453
  }
17182
17454
 
17183
17455
  function copyFile (srcStat, src, dest, opts, cb) {
17184
- if (typeof fs.copyFile === 'function') {
17185
- return fs.copyFile(src, dest, err => {
17456
+ fs.copyFile(src, dest, err => {
17457
+ if (err) return cb(err)
17458
+ if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)
17459
+ return setDestMode(dest, srcStat.mode, cb)
17460
+ })
17461
+ }
17462
+
17463
+ function handleTimestampsAndMode (srcMode, src, dest, cb) {
17464
+ // Make sure the file is writable before setting the timestamp
17465
+ // otherwise open fails with EPERM when invoked with 'r+'
17466
+ // (through utimes call)
17467
+ if (fileIsNotWritable(srcMode)) {
17468
+ return makeFileWritable(dest, srcMode, err => {
17186
17469
  if (err) return cb(err)
17187
- return setDestModeAndTimestamps(srcStat, dest, opts, cb)
17470
+ return setDestTimestampsAndMode(srcMode, src, dest, cb)
17188
17471
  })
17189
17472
  }
17190
- return copyFileFallback(srcStat, src, dest, opts, cb)
17473
+ return setDestTimestampsAndMode(srcMode, src, dest, cb)
17191
17474
  }
17192
17475
 
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))
17476
+ function fileIsNotWritable (srcMode) {
17477
+ return (srcMode & 0o200) === 0
17478
+ }
17479
+
17480
+ function makeFileWritable (dest, srcMode, cb) {
17481
+ return setDestMode(dest, srcMode | 0o200, cb)
17482
+ }
17483
+
17484
+ function setDestTimestampsAndMode (srcMode, src, dest, cb) {
17485
+ setDestTimestamps(src, dest, err => {
17486
+ if (err) return cb(err)
17487
+ return setDestMode(dest, srcMode, cb)
17200
17488
  })
17201
17489
  }
17202
17490
 
17203
- function setDestModeAndTimestamps (srcStat, dest, opts, cb) {
17204
- fs.chmod(dest, srcStat.mode, err => {
17491
+ function setDestMode (dest, srcMode, cb) {
17492
+ return fs.chmod(dest, srcMode, cb)
17493
+ }
17494
+
17495
+ function setDestTimestamps (src, dest, cb) {
17496
+ // The initial srcStat.atime cannot be trusted
17497
+ // because it is modified by the read(2) system call
17498
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
17499
+ fs.stat(src, (err, updatedSrcStat) => {
17205
17500
  if (err) return cb(err)
17206
- if (opts.preserveTimestamps) {
17207
- return utimes(dest, srcStat.atime, srcStat.mtime, cb)
17208
- }
17209
- return cb()
17501
+ return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)
17210
17502
  })
17211
17503
  }
17212
17504
 
17213
17505
  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
- }
17506
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)
17218
17507
  return copyDir(src, dest, opts, cb)
17219
17508
  }
17220
17509
 
17221
- function mkDirAndCopy (srcStat, src, dest, opts, cb) {
17510
+ function mkDirAndCopy (srcMode, src, dest, opts, cb) {
17222
17511
  fs.mkdir(dest, err => {
17223
17512
  if (err) return cb(err)
17224
17513
  copyDir(src, dest, opts, err => {
17225
17514
  if (err) return cb(err)
17226
- return fs.chmod(dest, srcStat.mode, cb)
17515
+ return setDestMode(dest, srcMode, cb)
17227
17516
  })
17228
17517
  })
17229
17518
  }
@@ -17244,8 +17533,9 @@ function copyDirItems (items, src, dest, opts, cb) {
17244
17533
  function copyDirItem (items, item, src, dest, opts, cb) {
17245
17534
  const srcItem = path.join(src, item)
17246
17535
  const destItem = path.join(dest, item)
17247
- checkPaths(srcItem, destItem, (err, destStat) => {
17536
+ stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
17248
17537
  if (err) return cb(err)
17538
+ const { destStat } = stats
17249
17539
  startCopy(destStat, srcItem, destItem, opts, err => {
17250
17540
  if (err) return cb(err)
17251
17541
  return copyDirItems(items, src, dest, opts, cb)
@@ -17256,12 +17546,11 @@ function copyDirItem (items, item, src, dest, opts, cb) {
17256
17546
  function onLink (destStat, src, dest, opts, cb) {
17257
17547
  fs.readlink(src, (err, resolvedSrc) => {
17258
17548
  if (err) return cb(err)
17259
-
17260
17549
  if (opts.dereference) {
17261
17550
  resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
17262
17551
  }
17263
17552
 
17264
- if (destStat === notExist) {
17553
+ if (!destStat) {
17265
17554
  return fs.symlink(resolvedSrc, dest, cb)
17266
17555
  } else {
17267
17556
  fs.readlink(dest, (err, resolvedDest) => {
@@ -17275,14 +17564,14 @@ function onLink (destStat, src, dest, opts, cb) {
17275
17564
  if (opts.dereference) {
17276
17565
  resolvedDest = path.resolve(process.cwd(), resolvedDest)
17277
17566
  }
17278
- if (isSrcSubdir(resolvedSrc, resolvedDest)) {
17567
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
17279
17568
  return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
17280
17569
  }
17281
17570
 
17282
17571
  // do not copy if src is a subdir of dest since unlinking
17283
17572
  // dest in this case would result in removing src contents
17284
17573
  // and therefore a broken symlink would be created.
17285
- if (destStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) {
17574
+ if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
17286
17575
  return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
17287
17576
  }
17288
17577
  return copyLink(resolvedSrc, dest, cb)
@@ -17298,40 +17587,6 @@ function copyLink (resolvedSrc, dest, cb) {
17298
17587
  })
17299
17588
  }
17300
17589
 
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
17590
  module.exports = copy
17336
17591
 
17337
17592
 
@@ -17343,7 +17598,7 @@ module.exports = copy
17343
17598
  "use strict";
17344
17599
 
17345
17600
 
17346
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17601
+ const u = __webpack_require__(7500).fromCallback
17347
17602
  module.exports = {
17348
17603
  copy: u(__webpack_require__(4487))
17349
17604
  }
@@ -17357,37 +17612,28 @@ module.exports = {
17357
17612
  "use strict";
17358
17613
 
17359
17614
 
17360
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17361
- const fs = __webpack_require__(5747)
17615
+ const u = __webpack_require__(7500).fromPromise
17616
+ const fs = __webpack_require__(893)
17362
17617
  const path = __webpack_require__(5622)
17363
17618
  const mkdir = __webpack_require__(9181)
17364
17619
  const remove = __webpack_require__(4879)
17365
17620
 
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()
17621
+ const emptyDir = u(async function emptyDir (dir) {
17622
+ let items
17623
+ try {
17624
+ items = await fs.readdir(dir)
17625
+ } catch {
17626
+ return mkdir.mkdirs(dir)
17627
+ }
17374
17628
 
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
- })
17629
+ return Promise.all(items.map(item => remove.remove(path.join(dir, item))))
17384
17630
  })
17385
17631
 
17386
17632
  function emptyDirSync (dir) {
17387
17633
  let items
17388
17634
  try {
17389
17635
  items = fs.readdirSync(dir)
17390
- } catch (err) {
17636
+ } catch {
17391
17637
  return mkdir.mkdirsSync(dir)
17392
17638
  }
17393
17639
 
@@ -17413,11 +17659,10 @@ module.exports = {
17413
17659
  "use strict";
17414
17660
 
17415
17661
 
17416
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17662
+ const u = __webpack_require__(7500).fromCallback
17417
17663
  const path = __webpack_require__(5622)
17418
17664
  const fs = __webpack_require__(552)
17419
17665
  const mkdir = __webpack_require__(9181)
17420
- const pathExists = __webpack_require__(5516).pathExists
17421
17666
 
17422
17667
  function createFile (file, callback) {
17423
17668
  function makeFile () {
@@ -17430,13 +17675,26 @@ function createFile (file, callback) {
17430
17675
  fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
17431
17676
  if (!err && stats.isFile()) return callback()
17432
17677
  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
- })
17678
+ fs.stat(dir, (err, stats) => {
17679
+ if (err) {
17680
+ // if the directory doesn't exist, make it
17681
+ if (err.code === 'ENOENT') {
17682
+ return mkdir.mkdirs(dir, err => {
17683
+ if (err) return callback(err)
17684
+ makeFile()
17685
+ })
17686
+ }
17687
+ return callback(err)
17688
+ }
17689
+
17690
+ if (stats.isDirectory()) makeFile()
17691
+ else {
17692
+ // parent is not a directory
17693
+ // This is just to cause an internal ENOTDIR error to be thrown
17694
+ fs.readdir(dir, err => {
17695
+ if (err) return callback(err)
17696
+ })
17697
+ }
17440
17698
  })
17441
17699
  })
17442
17700
  }
@@ -17445,12 +17703,20 @@ function createFileSync (file) {
17445
17703
  let stats
17446
17704
  try {
17447
17705
  stats = fs.statSync(file)
17448
- } catch (e) {}
17706
+ } catch {}
17449
17707
  if (stats && stats.isFile()) return
17450
17708
 
17451
17709
  const dir = path.dirname(file)
17452
- if (!fs.existsSync(dir)) {
17453
- mkdir.mkdirsSync(dir)
17710
+ try {
17711
+ if (!fs.statSync(dir).isDirectory()) {
17712
+ // parent is not a directory
17713
+ // This is just to cause an internal ENOTDIR error to be thrown
17714
+ fs.readdirSync(dir)
17715
+ }
17716
+ } catch (err) {
17717
+ // If the stat call above failed because the directory doesn't exist, create it
17718
+ if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
17719
+ else throw err
17454
17720
  }
17455
17721
 
17456
17722
  fs.writeFileSync(file, '')
@@ -17501,11 +17767,12 @@ module.exports = {
17501
17767
  "use strict";
17502
17768
 
17503
17769
 
17504
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17770
+ const u = __webpack_require__(7500).fromCallback
17505
17771
  const path = __webpack_require__(5622)
17506
17772
  const fs = __webpack_require__(552)
17507
17773
  const mkdir = __webpack_require__(9181)
17508
17774
  const pathExists = __webpack_require__(5516).pathExists
17775
+ const { areIdentical } = __webpack_require__(9783)
17509
17776
 
17510
17777
  function createLink (srcpath, dstpath, callback) {
17511
17778
  function makeLink (srcpath, dstpath) {
@@ -17515,14 +17782,13 @@ function createLink (srcpath, dstpath, callback) {
17515
17782
  })
17516
17783
  }
17517
17784
 
17518
- pathExists(dstpath, (err, destinationExists) => {
17519
- if (err) return callback(err)
17520
- if (destinationExists) return callback(null)
17521
- fs.lstat(srcpath, (err) => {
17785
+ fs.lstat(dstpath, (_, dstStat) => {
17786
+ fs.lstat(srcpath, (err, srcStat) => {
17522
17787
  if (err) {
17523
17788
  err.message = err.message.replace('lstat', 'ensureLink')
17524
17789
  return callback(err)
17525
17790
  }
17791
+ if (dstStat && areIdentical(srcStat, dstStat)) return callback(null)
17526
17792
 
17527
17793
  const dir = path.dirname(dstpath)
17528
17794
  pathExists(dir, (err, dirExists) => {
@@ -17538,11 +17804,14 @@ function createLink (srcpath, dstpath, callback) {
17538
17804
  }
17539
17805
 
17540
17806
  function createLinkSync (srcpath, dstpath) {
17541
- const destinationExists = fs.existsSync(dstpath)
17542
- if (destinationExists) return undefined
17807
+ let dstStat
17808
+ try {
17809
+ dstStat = fs.lstatSync(dstpath)
17810
+ } catch {}
17543
17811
 
17544
17812
  try {
17545
- fs.lstatSync(srcpath)
17813
+ const srcStat = fs.lstatSync(srcpath)
17814
+ if (dstStat && areIdentical(srcStat, dstStat)) return
17546
17815
  } catch (err) {
17547
17816
  err.message = err.message.replace('lstat', 'ensureLink')
17548
17817
  throw err
@@ -17604,8 +17873,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
17604
17873
  return callback(err)
17605
17874
  }
17606
17875
  return callback(null, {
17607
- 'toCwd': srcpath,
17608
- 'toDst': srcpath
17876
+ toCwd: srcpath,
17877
+ toDst: srcpath
17609
17878
  })
17610
17879
  })
17611
17880
  } else {
@@ -17615,8 +17884,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
17615
17884
  if (err) return callback(err)
17616
17885
  if (exists) {
17617
17886
  return callback(null, {
17618
- 'toCwd': relativeToDst,
17619
- 'toDst': srcpath
17887
+ toCwd: relativeToDst,
17888
+ toDst: srcpath
17620
17889
  })
17621
17890
  } else {
17622
17891
  return fs.lstat(srcpath, (err) => {
@@ -17625,8 +17894,8 @@ function symlinkPaths (srcpath, dstpath, callback) {
17625
17894
  return callback(err)
17626
17895
  }
17627
17896
  return callback(null, {
17628
- 'toCwd': srcpath,
17629
- 'toDst': path.relative(dstdir, srcpath)
17897
+ toCwd: srcpath,
17898
+ toDst: path.relative(dstdir, srcpath)
17630
17899
  })
17631
17900
  })
17632
17901
  }
@@ -17640,8 +17909,8 @@ function symlinkPathsSync (srcpath, dstpath) {
17640
17909
  exists = fs.existsSync(srcpath)
17641
17910
  if (!exists) throw new Error('absolute srcpath does not exist')
17642
17911
  return {
17643
- 'toCwd': srcpath,
17644
- 'toDst': srcpath
17912
+ toCwd: srcpath,
17913
+ toDst: srcpath
17645
17914
  }
17646
17915
  } else {
17647
17916
  const dstdir = path.dirname(dstpath)
@@ -17649,15 +17918,15 @@ function symlinkPathsSync (srcpath, dstpath) {
17649
17918
  exists = fs.existsSync(relativeToDst)
17650
17919
  if (exists) {
17651
17920
  return {
17652
- 'toCwd': relativeToDst,
17653
- 'toDst': srcpath
17921
+ toCwd: relativeToDst,
17922
+ toDst: srcpath
17654
17923
  }
17655
17924
  } else {
17656
17925
  exists = fs.existsSync(srcpath)
17657
17926
  if (!exists) throw new Error('relative srcpath does not exist')
17658
17927
  return {
17659
- 'toCwd': srcpath,
17660
- 'toDst': path.relative(dstdir, srcpath)
17928
+ toCwd: srcpath,
17929
+ toDst: path.relative(dstdir, srcpath)
17661
17930
  }
17662
17931
  }
17663
17932
  }
@@ -17696,7 +17965,7 @@ function symlinkTypeSync (srcpath, type) {
17696
17965
  if (type) return type
17697
17966
  try {
17698
17967
  stats = fs.lstatSync(srcpath)
17699
- } catch (e) {
17968
+ } catch {
17700
17969
  return 'file'
17701
17970
  }
17702
17971
  return (stats && stats.isDirectory()) ? 'dir' : 'file'
@@ -17716,9 +17985,9 @@ module.exports = {
17716
17985
  "use strict";
17717
17986
 
17718
17987
 
17719
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17988
+ const u = __webpack_require__(7500).fromCallback
17720
17989
  const path = __webpack_require__(5622)
17721
- const fs = __webpack_require__(552)
17990
+ const fs = __webpack_require__(893)
17722
17991
  const _mkdirs = __webpack_require__(9181)
17723
17992
  const mkdirs = _mkdirs.mkdirs
17724
17993
  const mkdirsSync = _mkdirs.mkdirsSync
@@ -17733,26 +18002,38 @@ const symlinkTypeSync = _symlinkType.symlinkTypeSync
17733
18002
 
17734
18003
  const pathExists = __webpack_require__(5516).pathExists
17735
18004
 
18005
+ const { areIdentical } = __webpack_require__(9783)
18006
+
17736
18007
  function createSymlink (srcpath, dstpath, type, callback) {
17737
18008
  callback = (typeof type === 'function') ? type : callback
17738
18009
  type = (typeof type === 'function') ? false : type
17739
18010
 
17740
- pathExists(dstpath, (err, destinationExists) => {
18011
+ fs.lstat(dstpath, (err, stats) => {
18012
+ if (!err && stats.isSymbolicLink()) {
18013
+ Promise.all([
18014
+ fs.stat(srcpath),
18015
+ fs.stat(dstpath)
18016
+ ]).then(([srcStat, dstStat]) => {
18017
+ if (areIdentical(srcStat, dstStat)) return callback(null)
18018
+ _createSymlink(srcpath, dstpath, type, callback)
18019
+ })
18020
+ } else _createSymlink(srcpath, dstpath, type, callback)
18021
+ })
18022
+ }
18023
+
18024
+ function _createSymlink (srcpath, dstpath, type, callback) {
18025
+ symlinkPaths(srcpath, dstpath, (err, relative) => {
17741
18026
  if (err) return callback(err)
17742
- if (destinationExists) return callback(null)
17743
- symlinkPaths(srcpath, dstpath, (err, relative) => {
18027
+ srcpath = relative.toDst
18028
+ symlinkType(relative.toCwd, type, (err, type) => {
17744
18029
  if (err) return callback(err)
17745
- srcpath = relative.toDst
17746
- symlinkType(relative.toCwd, type, (err, type) => {
18030
+ const dir = path.dirname(dstpath)
18031
+ pathExists(dir, (err, dirExists) => {
17747
18032
  if (err) return callback(err)
17748
- const dir = path.dirname(dstpath)
17749
- pathExists(dir, (err, dirExists) => {
18033
+ if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
18034
+ mkdirs(dir, err => {
17750
18035
  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
- })
18036
+ fs.symlink(srcpath, dstpath, type, callback)
17756
18037
  })
17757
18038
  })
17758
18039
  })
@@ -17760,8 +18041,15 @@ function createSymlink (srcpath, dstpath, type, callback) {
17760
18041
  }
17761
18042
 
17762
18043
  function createSymlinkSync (srcpath, dstpath, type) {
17763
- const destinationExists = fs.existsSync(dstpath)
17764
- if (destinationExists) return undefined
18044
+ let stats
18045
+ try {
18046
+ stats = fs.lstatSync(dstpath)
18047
+ } catch {}
18048
+ if (stats && stats.isSymbolicLink()) {
18049
+ const srcStat = fs.statSync(srcpath)
18050
+ const dstStat = fs.statSync(dstpath)
18051
+ if (areIdentical(srcStat, dstStat)) return
18052
+ }
17765
18053
 
17766
18054
  const relative = symlinkPathsSync(srcpath, dstpath)
17767
18055
  srcpath = relative.toDst
@@ -17788,7 +18076,7 @@ module.exports = {
17788
18076
 
17789
18077
  // This is adapted from https://github.com/normalize/mz
17790
18078
  // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
17791
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18079
+ const u = __webpack_require__(7500).fromCallback
17792
18080
  const fs = __webpack_require__(552)
17793
18081
 
17794
18082
  const api = [
@@ -17805,18 +18093,20 @@ const api = [
17805
18093
  'fsync',
17806
18094
  'ftruncate',
17807
18095
  'futimes',
17808
- 'lchown',
17809
18096
  'lchmod',
18097
+ 'lchown',
17810
18098
  'link',
17811
18099
  'lstat',
17812
18100
  'mkdir',
17813
18101
  'mkdtemp',
17814
18102
  'open',
17815
- 'readFile',
18103
+ 'opendir',
17816
18104
  'readdir',
18105
+ 'readFile',
17817
18106
  'readlink',
17818
18107
  'realpath',
17819
18108
  'rename',
18109
+ 'rm',
17820
18110
  'rmdir',
17821
18111
  'stat',
17822
18112
  'symlink',
@@ -17826,26 +18116,20 @@ const api = [
17826
18116
  'writeFile'
17827
18117
  ].filter(key => {
17828
18118
  // 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
18119
+ // fs.opendir was added in Node.js v12.12.0
18120
+ // fs.rm was added in Node.js v14.14.0
17831
18121
  // fs.lchown is not available on at least some Linux
17832
18122
  return typeof fs[key] === 'function'
17833
18123
  })
17834
18124
 
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
- })
18125
+ // Export cloned fs:
18126
+ Object.assign(exports, fs)
17844
18127
 
17845
18128
  // Universalify async methods:
17846
18129
  api.forEach(method => {
17847
18130
  exports[method] = u(fs[method])
17848
18131
  })
18132
+ exports.realpath.native = u(fs.realpath.native)
17849
18133
 
17850
18134
  // We differ from mz/fs in that we still ship the old, broken, fs.exists()
17851
18135
  // since we are a drop-in replacement for the native module
@@ -17858,7 +18142,7 @@ exports.exists = function (filename, callback) {
17858
18142
  })
17859
18143
  }
17860
18144
 
17861
- // fs.read() & fs.write need special treatment due to multiple callback args
18145
+ // fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args
17862
18146
 
17863
18147
  exports.read = function (fd, buffer, offset, length, position, callback) {
17864
18148
  if (typeof callback === 'function') {
@@ -17890,6 +18174,25 @@ exports.write = function (fd, buffer, ...args) {
17890
18174
  })
17891
18175
  }
17892
18176
 
18177
+ // fs.writev only available in Node v12.9.0+
18178
+ if (typeof fs.writev === 'function') {
18179
+ // Function signature is
18180
+ // s.writev(fd, buffers[, position], callback)
18181
+ // We need to handle the optional arg, so we use ...args
18182
+ exports.writev = function (fd, buffers, ...args) {
18183
+ if (typeof args[args.length - 1] === 'function') {
18184
+ return fs.writev(fd, buffers, ...args)
18185
+ }
18186
+
18187
+ return new Promise((resolve, reject) => {
18188
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
18189
+ if (err) return reject(err)
18190
+ resolve({ bytesWritten, buffers })
18191
+ })
18192
+ })
18193
+ }
18194
+ }
18195
+
17893
18196
 
17894
18197
  /***/ }),
17895
18198
 
@@ -17899,31 +18202,21 @@ exports.write = function (fd, buffer, ...args) {
17899
18202
  "use strict";
17900
18203
 
17901
18204
 
17902
- module.exports = Object.assign(
17903
- {},
18205
+ module.exports = {
17904
18206
  // Export promiseified graceful-fs:
17905
- __webpack_require__(893),
18207
+ ...__webpack_require__(893),
17906
18208
  // 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
- }))
18209
+ ...__webpack_require__(9567),
18210
+ ...__webpack_require__(8852),
18211
+ ...__webpack_require__(2677),
18212
+ ...__webpack_require__(6004),
18213
+ ...__webpack_require__(3960),
18214
+ ...__webpack_require__(9181),
18215
+ ...__webpack_require__(4168),
18216
+ ...__webpack_require__(7819),
18217
+ ...__webpack_require__(3849),
18218
+ ...__webpack_require__(5516),
18219
+ ...__webpack_require__(4879)
17927
18220
  }
17928
18221
 
17929
18222
 
@@ -17935,7 +18228,7 @@ if (Object.getOwnPropertyDescriptor(fs, 'promises')) {
17935
18228
  "use strict";
17936
18229
 
17937
18230
 
17938
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18231
+ const u = __webpack_require__(7500).fromPromise
17939
18232
  const jsonFile = __webpack_require__(4003)
17940
18233
 
17941
18234
  jsonFile.outputJson = u(__webpack_require__(7583))
@@ -17959,14 +18252,13 @@ module.exports = jsonFile
17959
18252
  "use strict";
17960
18253
 
17961
18254
 
17962
- const u = __webpack_require__(2703)/* .fromCallback */ .E
17963
- const jsonFile = __webpack_require__(1215)
18255
+ const jsonFile = __webpack_require__(4862)
17964
18256
 
17965
18257
  module.exports = {
17966
18258
  // jsonfile exports
17967
- readJson: u(jsonFile.readFile),
18259
+ readJson: jsonFile.readFile,
17968
18260
  readJsonSync: jsonFile.readFileSync,
17969
- writeJson: u(jsonFile.writeFile),
18261
+ writeJson: jsonFile.writeFile,
17970
18262
  writeJsonSync: jsonFile.writeFileSync
17971
18263
  }
17972
18264
 
@@ -17979,19 +18271,13 @@ module.exports = {
17979
18271
  "use strict";
17980
18272
 
17981
18273
 
17982
- const fs = __webpack_require__(552)
17983
- const path = __webpack_require__(5622)
17984
- const mkdir = __webpack_require__(9181)
17985
- const jsonFile = __webpack_require__(4003)
18274
+ const { stringify } = __webpack_require__(7653)
18275
+ const { outputFileSync } = __webpack_require__(3849)
17986
18276
 
17987
18277
  function outputJsonSync (file, data, options) {
17988
- const dir = path.dirname(file)
17989
-
17990
- if (!fs.existsSync(dir)) {
17991
- mkdir.mkdirsSync(dir)
17992
- }
18278
+ const str = stringify(data, options)
17993
18279
 
17994
- jsonFile.writeJsonSync(file, data, options)
18280
+ outputFileSync(file, str, options)
17995
18281
  }
17996
18282
 
17997
18283
  module.exports = outputJsonSync
@@ -18005,28 +18291,13 @@ module.exports = outputJsonSync
18005
18291
  "use strict";
18006
18292
 
18007
18293
 
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)
18012
-
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)
18294
+ const { stringify } = __webpack_require__(7653)
18295
+ const { outputFile } = __webpack_require__(3849)
18020
18296
 
18021
- pathExists(dir, (err, itDoes) => {
18022
- if (err) return callback(err)
18023
- if (itDoes) return jsonFile.writeJson(file, data, options, callback)
18297
+ async function outputJson (file, data, options = {}) {
18298
+ const str = stringify(data, options)
18024
18299
 
18025
- mkdir.mkdirs(dir, err => {
18026
- if (err) return callback(err)
18027
- jsonFile.writeJson(file, data, options, callback)
18028
- })
18029
- })
18300
+ await outputFile(file, str, options)
18030
18301
  }
18031
18302
 
18032
18303
  module.exports = outputJson
@@ -18039,190 +18310,101 @@ module.exports = outputJson
18039
18310
 
18040
18311
  "use strict";
18041
18312
 
18042
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18043
- const mkdirs = u(__webpack_require__(7718))
18044
- const mkdirsSync = __webpack_require__(1275)
18313
+ const u = __webpack_require__(7500).fromPromise
18314
+ const { makeDir: _makeDir, makeDirSync } = __webpack_require__(511)
18315
+ const makeDir = u(_makeDir)
18045
18316
 
18046
18317
  module.exports = {
18047
- mkdirs,
18048
- mkdirsSync,
18318
+ mkdirs: makeDir,
18319
+ mkdirsSync: makeDirSync,
18049
18320
  // alias
18050
- mkdirp: mkdirs,
18051
- mkdirpSync: mkdirsSync,
18052
- ensureDir: mkdirs,
18053
- ensureDirSync: mkdirsSync
18321
+ mkdirp: makeDir,
18322
+ mkdirpSync: makeDirSync,
18323
+ ensureDir: makeDir,
18324
+ ensureDirSync: makeDirSync
18054
18325
  }
18055
18326
 
18056
18327
 
18057
18328
  /***/ }),
18058
18329
 
18059
- /***/ 1275:
18330
+ /***/ 511:
18060
18331
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18061
18332
 
18062
18333
  "use strict";
18063
18334
 
18335
+ const fs = __webpack_require__(893)
18336
+ const { checkPath } = __webpack_require__(1176)
18064
18337
 
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
- }
18338
+ const getMode = options => {
18339
+ const defaults = { mode: 0o777 }
18340
+ if (typeof options === 'number') return options
18341
+ return ({ ...defaults, ...options }).mode
18342
+ }
18084
18343
 
18085
- if (mode === undefined) {
18086
- mode = o777 & (~process.umask())
18087
- }
18088
- if (!made) made = null
18344
+ module.exports.makeDir = async (dir, options) => {
18345
+ checkPath(dir)
18089
18346
 
18090
- p = path.resolve(p)
18347
+ return fs.mkdir(dir, {
18348
+ mode: getMode(options),
18349
+ recursive: true
18350
+ })
18351
+ }
18091
18352
 
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
- }
18353
+ module.exports.makeDirSync = (dir, options) => {
18354
+ checkPath(dir)
18112
18355
 
18113
- return made
18356
+ return fs.mkdirSync(dir, {
18357
+ mode: getMode(options),
18358
+ recursive: true
18359
+ })
18114
18360
  }
18115
18361
 
18116
- module.exports = mkdirsSync
18117
-
18118
18362
 
18119
18363
  /***/ }),
18120
18364
 
18121
- /***/ 7718:
18365
+ /***/ 1176:
18122
18366
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18123
18367
 
18124
18368
  "use strict";
18369
+ // Adapted from https://github.com/sindresorhus/make-dir
18370
+ // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
18371
+ // 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:
18372
+ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
18373
+ // 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
18374
 
18126
-
18127
- const fs = __webpack_require__(552)
18128
18375
  const path = __webpack_require__(5622)
18129
- const invalidWin32Path = __webpack_require__(3727).invalidWin32Path
18130
18376
 
18131
- const o777 = parseInt('0777', 8)
18377
+ // https://github.com/nodejs/node/issues/8987
18378
+ // https://github.com/libuv/libuv/pull/1088
18379
+ module.exports.checkPath = function checkPath (pth) {
18380
+ if (process.platform === 'win32') {
18381
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
18132
18382
 
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
-
18147
- let mode = opts.mode
18148
- const xfs = opts.fs || fs
18149
-
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)
18383
+ if (pathHasInvalidWinCharacters) {
18384
+ const error = new Error(`Path contains invalid characters: ${pth}`)
18385
+ error.code = 'EINVAL'
18386
+ throw error
18162
18387
  }
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
18183
- }
18184
- })
18388
+ }
18185
18389
  }
18186
18390
 
18187
- module.exports = mkdirs
18188
-
18189
18391
 
18190
18392
  /***/ }),
18191
18393
 
18192
- /***/ 3727:
18394
+ /***/ 4168:
18193
18395
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18194
18396
 
18195
18397
  "use strict";
18196
18398
 
18197
18399
 
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
18400
  module.exports = {
18218
- getRootPath,
18219
- invalidWin32Path
18401
+ moveSync: __webpack_require__(6776)
18220
18402
  }
18221
18403
 
18222
18404
 
18223
18405
  /***/ }),
18224
18406
 
18225
- /***/ 4168:
18407
+ /***/ 6776:
18226
18408
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18227
18409
 
18228
18410
  "use strict";
@@ -18232,134 +18414,85 @@ const fs = __webpack_require__(552)
18232
18414
  const path = __webpack_require__(5622)
18233
18415
  const copySync = __webpack_require__(9567).copySync
18234
18416
  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)
18417
+ const mkdirpSync = __webpack_require__(9181).mkdirpSync
18418
+ const stat = __webpack_require__(9783)
18244
18419
 
18245
- if (src === dest) return fs.accessSync(src)
18246
-
18247
- if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`)
18420
+ function moveSync (src, dest, opts) {
18421
+ opts = opts || {}
18422
+ const overwrite = opts.overwrite || opts.clobber || false
18248
18423
 
18249
- mkdirpSync(path.dirname(dest))
18250
- tryRenameSync()
18424
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
18425
+ stat.checkParentPathsSync(src, srcStat, dest, 'move')
18426
+ if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
18427
+ return doRename(src, dest, overwrite, isChangingCase)
18428
+ }
18251
18429
 
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
- }
18430
+ function isParentRoot (dest) {
18431
+ const parent = path.dirname(dest)
18432
+ const parsedPath = path.parse(parent)
18433
+ return parsedPath.root === parent
18434
+ }
18262
18435
 
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
- }
18436
+ function doRename (src, dest, overwrite, isChangingCase) {
18437
+ if (isChangingCase) return rename(src, dest, overwrite)
18438
+ if (overwrite) {
18439
+ removeSync(dest)
18440
+ return rename(src, dest, overwrite)
18277
18441
  }
18442
+ if (fs.existsSync(dest)) throw new Error('dest already exists.')
18443
+ return rename(src, dest, overwrite)
18278
18444
  }
18279
18445
 
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)
18446
+ function rename (src, dest, overwrite) {
18447
+ try {
18448
+ fs.renameSync(src, dest)
18449
+ } catch (err) {
18450
+ if (err.code !== 'EXDEV') throw err
18451
+ return moveAcrossDevice(src, dest, overwrite)
18287
18452
  }
18288
18453
  }
18289
18454
 
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
18300
-
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
18455
+ function moveAcrossDevice (src, dest, overwrite) {
18456
+ const opts = {
18457
+ overwrite,
18458
+ errorOnExist: true
18305
18459
  }
18306
-
18307
- fs.closeSync(fdr)
18308
- fs.closeSync(fdw)
18309
- return fs.unlinkSync(src)
18460
+ copySync(src, dest, opts)
18461
+ return removeSync(src)
18310
18462
  }
18311
18463
 
18312
- function moveDirSyncAcrossDevice (src, dest, overwrite) {
18313
- const options = {
18314
- overwrite: false
18315
- }
18464
+ module.exports = moveSync
18316
18465
 
18317
- if (overwrite) {
18318
- removeSync(dest)
18319
- tryCopySync()
18320
- } else {
18321
- tryCopySync()
18322
- }
18323
18466
 
18324
- function tryCopySync () {
18325
- copySync(src, dest, options)
18326
- return removeSync(src)
18327
- }
18328
- }
18467
+ /***/ }),
18329
18468
 
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
18340
- }
18341
- }
18469
+ /***/ 7819:
18470
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18471
+
18472
+ "use strict";
18342
18473
 
18474
+
18475
+ const u = __webpack_require__(7500).fromCallback
18343
18476
  module.exports = {
18344
- moveSync
18477
+ move: u(__webpack_require__(4064))
18345
18478
  }
18346
18479
 
18347
18480
 
18348
18481
  /***/ }),
18349
18482
 
18350
- /***/ 7819:
18483
+ /***/ 4064:
18351
18484
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18352
18485
 
18353
18486
  "use strict";
18354
18487
 
18355
18488
 
18356
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18357
18489
  const fs = __webpack_require__(552)
18358
18490
  const path = __webpack_require__(5622)
18359
18491
  const copy = __webpack_require__(8852).copy
18360
18492
  const remove = __webpack_require__(4879).remove
18361
18493
  const mkdirp = __webpack_require__(9181).mkdirp
18362
18494
  const pathExists = __webpack_require__(5516).pathExists
18495
+ const stat = __webpack_require__(9783)
18363
18496
 
18364
18497
  function move (src, dest, opts, cb) {
18365
18498
  if (typeof opts === 'function') {
@@ -18369,25 +18502,28 @@ function move (src, dest, opts, cb) {
18369
18502
 
18370
18503
  const overwrite = opts.overwrite || opts.clobber || false
18371
18504
 
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) => {
18505
+ stat.checkPaths(src, dest, 'move', opts, (err, stats) => {
18378
18506
  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 => {
18507
+ const { srcStat, isChangingCase = false } = stats
18508
+ stat.checkParentPaths(src, srcStat, dest, 'move', err => {
18384
18509
  if (err) return cb(err)
18385
- return doRename(src, dest, overwrite, cb)
18510
+ if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb)
18511
+ mkdirp(path.dirname(dest), err => {
18512
+ if (err) return cb(err)
18513
+ return doRename(src, dest, overwrite, isChangingCase, cb)
18514
+ })
18386
18515
  })
18387
18516
  })
18388
18517
  }
18389
18518
 
18390
- function doRename (src, dest, overwrite, cb) {
18519
+ function isParentRoot (dest) {
18520
+ const parent = path.dirname(dest)
18521
+ const parsedPath = path.parse(parent)
18522
+ return parsedPath.root === parent
18523
+ }
18524
+
18525
+ function doRename (src, dest, overwrite, isChangingCase, cb) {
18526
+ if (isChangingCase) return rename(src, dest, overwrite, cb)
18391
18527
  if (overwrite) {
18392
18528
  return remove(dest, err => {
18393
18529
  if (err) return cb(err)
@@ -18414,25 +18550,13 @@ function moveAcrossDevice (src, dest, overwrite, cb) {
18414
18550
  overwrite,
18415
18551
  errorOnExist: true
18416
18552
  }
18417
-
18418
18553
  copy(src, dest, opts, err => {
18419
18554
  if (err) return cb(err)
18420
18555
  return remove(src, cb)
18421
18556
  })
18422
18557
  }
18423
18558
 
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
- }
18559
+ module.exports = move
18436
18560
 
18437
18561
 
18438
18562
  /***/ }),
@@ -18443,7 +18567,7 @@ module.exports = {
18443
18567
  "use strict";
18444
18568
 
18445
18569
 
18446
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18570
+ const u = __webpack_require__(7500).fromCallback
18447
18571
  const fs = __webpack_require__(552)
18448
18572
  const path = __webpack_require__(5622)
18449
18573
  const mkdir = __webpack_require__(9181)
@@ -18490,7 +18614,7 @@ module.exports = {
18490
18614
 
18491
18615
  "use strict";
18492
18616
 
18493
- const u = __webpack_require__(2703)/* .fromPromise */ .p
18617
+ const u = __webpack_require__(7500).fromPromise
18494
18618
  const fs = __webpack_require__(893)
18495
18619
 
18496
18620
  function pathExists (path) {
@@ -18511,12 +18635,25 @@ module.exports = {
18511
18635
  "use strict";
18512
18636
 
18513
18637
 
18514
- const u = __webpack_require__(2703)/* .fromCallback */ .E
18638
+ const fs = __webpack_require__(552)
18639
+ const u = __webpack_require__(7500).fromCallback
18515
18640
  const rimraf = __webpack_require__(7137)
18516
18641
 
18642
+ function remove (path, callback) {
18643
+ // Node 14.14.0+
18644
+ if (fs.rm) return fs.rm(path, { recursive: true, force: true }, callback)
18645
+ rimraf(path, callback)
18646
+ }
18647
+
18648
+ function removeSync (path) {
18649
+ // Node 14.14.0+
18650
+ if (fs.rmSync) return fs.rmSync(path, { recursive: true, force: true })
18651
+ rimraf.sync(path)
18652
+ }
18653
+
18517
18654
  module.exports = {
18518
- remove: u(rimraf),
18519
- removeSync: rimraf.sync
18655
+ remove: u(remove),
18656
+ removeSync
18520
18657
  }
18521
18658
 
18522
18659
 
@@ -18641,9 +18778,6 @@ function fixWinEPERM (p, options, er, cb) {
18641
18778
  assert(p)
18642
18779
  assert(options)
18643
18780
  assert(typeof cb === 'function')
18644
- if (er) {
18645
- assert(er instanceof Error)
18646
- }
18647
18781
 
18648
18782
  options.chmod(p, 0o666, er2 => {
18649
18783
  if (er2) {
@@ -18667,9 +18801,6 @@ function fixWinEPERMSync (p, options, er) {
18667
18801
 
18668
18802
  assert(p)
18669
18803
  assert(options)
18670
- if (er) {
18671
- assert(er instanceof Error)
18672
- }
18673
18804
 
18674
18805
  try {
18675
18806
  options.chmodSync(p, 0o666)
@@ -18701,9 +18832,6 @@ function fixWinEPERMSync (p, options, er) {
18701
18832
  function rmdir (p, options, originalEr, cb) {
18702
18833
  assert(p)
18703
18834
  assert(options)
18704
- if (originalEr) {
18705
- assert(originalEr instanceof Error)
18706
- }
18707
18835
  assert(typeof cb === 'function')
18708
18836
 
18709
18837
  // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
@@ -18796,9 +18924,6 @@ function rimrafSync (p, options) {
18796
18924
  function rmdirSync (p, options, originalEr) {
18797
18925
  assert(p)
18798
18926
  assert(options)
18799
- if (originalEr) {
18800
- assert(originalEr instanceof Error)
18801
- }
18802
18927
 
18803
18928
  try {
18804
18929
  options.rmdirSync(p)
@@ -18818,24 +18943,24 @@ function rmkidsSync (p, options) {
18818
18943
  assert(options)
18819
18944
  options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
18820
18945
 
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)
18946
+ if (isWindows) {
18947
+ // We only end up here once we got ENOTEMPTY at least once, and
18948
+ // at this point, we are guaranteed to have removed all the kids.
18949
+ // So, we know that it won't be ENOENT or ENOTDIR or anything else.
18950
+ // try really hard to delete stuff on windows, because it has a
18951
+ // PROFOUNDLY annoying habit of not closing handles promptly when
18952
+ // files are deleted, resulting in spurious ENOTEMPTY errors.
18953
+ const startTime = Date.now()
18954
+ do {
18955
+ try {
18956
+ const ret = options.rmdirSync(p, options)
18957
+ return ret
18958
+ } catch {}
18959
+ } while (Date.now() - startTime < 500) // give up after 500ms
18960
+ } else {
18961
+ const ret = options.rmdirSync(p, options)
18962
+ return ret
18963
+ }
18839
18964
  }
18840
18965
 
18841
18966
  module.exports = rimraf
@@ -18844,83 +18969,175 @@ rimraf.sync = rimrafSync
18844
18969
 
18845
18970
  /***/ }),
18846
18971
 
18847
- /***/ 6343:
18848
- /***/ ((module) => {
18972
+ /***/ 9783:
18973
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
18849
18974
 
18850
18975
  "use strict";
18851
18976
 
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
- }
18977
+
18978
+ const fs = __webpack_require__(893)
18979
+ const path = __webpack_require__(5622)
18980
+ const util = __webpack_require__(1669)
18981
+
18982
+ function getStats (src, dest, opts) {
18983
+ const statFunc = opts.dereference
18984
+ ? (file) => fs.stat(file, { bigint: true })
18985
+ : (file) => fs.lstat(file, { bigint: true })
18986
+ return Promise.all([
18987
+ statFunc(src),
18988
+ statFunc(dest).catch(err => {
18989
+ if (err.code === 'ENOENT') return null
18990
+ throw err
18991
+ })
18992
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
18993
+ }
18994
+
18995
+ function getStatsSync (src, dest, opts) {
18996
+ let destStat
18997
+ const statFunc = opts.dereference
18998
+ ? (file) => fs.statSync(file, { bigint: true })
18999
+ : (file) => fs.lstatSync(file, { bigint: true })
19000
+ const srcStat = statFunc(src)
19001
+ try {
19002
+ destStat = statFunc(dest)
19003
+ } catch (err) {
19004
+ if (err.code === 'ENOENT') return { srcStat, destStat: null }
19005
+ throw err
18860
19006
  }
18861
- return new Buffer(size)
19007
+ return { srcStat, destStat }
18862
19008
  }
18863
19009
 
19010
+ function checkPaths (src, dest, funcName, opts, cb) {
19011
+ util.callbackify(getStats)(src, dest, opts, (err, stats) => {
19012
+ if (err) return cb(err)
19013
+ const { srcStat, destStat } = stats
18864
19014
 
18865
- /***/ }),
19015
+ if (destStat) {
19016
+ if (areIdentical(srcStat, destStat)) {
19017
+ const srcBaseName = path.basename(src)
19018
+ const destBaseName = path.basename(dest)
19019
+ if (funcName === 'move' &&
19020
+ srcBaseName !== destBaseName &&
19021
+ srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
19022
+ return cb(null, { srcStat, destStat, isChangingCase: true })
19023
+ }
19024
+ return cb(new Error('Source and destination must not be the same.'))
19025
+ }
19026
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
19027
+ return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`))
19028
+ }
19029
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
19030
+ return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`))
19031
+ }
19032
+ }
18866
19033
 
18867
- /***/ 8605:
18868
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19034
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
19035
+ return cb(new Error(errMsg(src, dest, funcName)))
19036
+ }
19037
+ return cb(null, { srcStat, destStat })
19038
+ })
19039
+ }
18869
19040
 
18870
- "use strict";
19041
+ function checkPathsSync (src, dest, funcName, opts) {
19042
+ const { srcStat, destStat } = getStatsSync(src, dest, opts)
18871
19043
 
19044
+ if (destStat) {
19045
+ if (areIdentical(srcStat, destStat)) {
19046
+ const srcBaseName = path.basename(src)
19047
+ const destBaseName = path.basename(dest)
19048
+ if (funcName === 'move' &&
19049
+ srcBaseName !== destBaseName &&
19050
+ srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
19051
+ return { srcStat, destStat, isChangingCase: true }
19052
+ }
19053
+ throw new Error('Source and destination must not be the same.')
19054
+ }
19055
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
19056
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
19057
+ }
19058
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
19059
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
19060
+ }
19061
+ }
18872
19062
 
18873
- const fs = __webpack_require__(552)
18874
- const os = __webpack_require__(2087)
18875
- const path = __webpack_require__(5622)
19063
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
19064
+ throw new Error(errMsg(src, dest, funcName))
19065
+ }
19066
+ return { srcStat, destStat }
19067
+ }
18876
19068
 
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)
19069
+ // recursively check if dest parent is a subdirectory of src.
19070
+ // It works for all file types including symlinks since it
19071
+ // checks the src and dest inodes. It starts from the deepest
19072
+ // parent and stops once it reaches the src parent or the root path.
19073
+ function checkParentPaths (src, srcStat, dest, funcName, cb) {
19074
+ const srcParent = path.resolve(path.dirname(src))
19075
+ const destParent = path.resolve(path.dirname(dest))
19076
+ if (destParent === srcParent || destParent === path.parse(destParent).root) return cb()
19077
+ fs.stat(destParent, { bigint: true }, (err, destStat) => {
19078
+ if (err) {
19079
+ if (err.code === 'ENOENT') return cb()
19080
+ return cb(err)
19081
+ }
19082
+ if (areIdentical(srcStat, destStat)) {
19083
+ return cb(new Error(errMsg(src, dest, funcName)))
19084
+ }
19085
+ return checkParentPaths(src, srcStat, destParent, funcName, cb)
19086
+ })
19087
+ }
18881
19088
 
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
19089
+ function checkParentPathsSync (src, srcStat, dest, funcName) {
19090
+ const srcParent = path.resolve(path.dirname(src))
19091
+ const destParent = path.resolve(path.dirname(dest))
19092
+ if (destParent === srcParent || destParent === path.parse(destParent).root) return
19093
+ let destStat
19094
+ try {
19095
+ destStat = fs.statSync(destParent, { bigint: true })
19096
+ } catch (err) {
19097
+ if (err.code === 'ENOENT') return
19098
+ throw err
19099
+ }
19100
+ if (areIdentical(srcStat, destStat)) {
19101
+ throw new Error(errMsg(src, dest, funcName))
19102
+ }
19103
+ return checkParentPathsSync(src, srcStat, destParent, funcName)
18889
19104
  }
18890
19105
 
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)
19106
+ function areIdentical (srcStat, destStat) {
19107
+ return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
19108
+ }
18894
19109
 
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
- })
19110
+ // return true if dest is a subdir of src, otherwise false.
19111
+ // It only checks the path strings.
19112
+ function isSrcSubdir (src, dest) {
19113
+ const srcArr = path.resolve(src).split(path.sep).filter(i => i)
19114
+ const destArr = path.resolve(dest).split(path.sep).filter(i => i)
19115
+ return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true)
18913
19116
  }
18914
19117
 
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
- }
18923
- }
19118
+ function errMsg (src, dest, funcName) {
19119
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
19120
+ }
19121
+
19122
+ module.exports = {
19123
+ checkPaths,
19124
+ checkPathsSync,
19125
+ checkParentPaths,
19126
+ checkParentPathsSync,
19127
+ isSrcSubdir,
19128
+ areIdentical
19129
+ }
19130
+
19131
+
19132
+ /***/ }),
19133
+
19134
+ /***/ 8605:
19135
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19136
+
19137
+ "use strict";
19138
+
19139
+
19140
+ const fs = __webpack_require__(552)
18924
19141
 
18925
19142
  function utimesMillis (path, atime, mtime, callback) {
18926
19143
  // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
@@ -18941,9 +19158,6 @@ function utimesMillisSync (path, atime, mtime) {
18941
19158
  }
18942
19159
 
18943
19160
  module.exports = {
18944
- hasMillisRes,
18945
- hasMillisResSync,
18946
- timeRemoveMillis,
18947
19161
  utimesMillis,
18948
19162
  utimesMillisSync
18949
19163
  }
@@ -24610,6 +24824,122 @@ module.exports = new Type('tag:yaml.org,2002:timestamp', {
24610
24824
  });
24611
24825
 
24612
24826
 
24827
+ /***/ }),
24828
+
24829
+ /***/ 4862:
24830
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24831
+
24832
+ let _fs
24833
+ try {
24834
+ _fs = __webpack_require__(552)
24835
+ } catch (_) {
24836
+ _fs = __webpack_require__(5747)
24837
+ }
24838
+ const universalify = __webpack_require__(7500)
24839
+ const { stringify, stripBom } = __webpack_require__(7653)
24840
+
24841
+ async function _readFile (file, options = {}) {
24842
+ if (typeof options === 'string') {
24843
+ options = { encoding: options }
24844
+ }
24845
+
24846
+ const fs = options.fs || _fs
24847
+
24848
+ const shouldThrow = 'throws' in options ? options.throws : true
24849
+
24850
+ let data = await universalify.fromCallback(fs.readFile)(file, options)
24851
+
24852
+ data = stripBom(data)
24853
+
24854
+ let obj
24855
+ try {
24856
+ obj = JSON.parse(data, options ? options.reviver : null)
24857
+ } catch (err) {
24858
+ if (shouldThrow) {
24859
+ err.message = `${file}: ${err.message}`
24860
+ throw err
24861
+ } else {
24862
+ return null
24863
+ }
24864
+ }
24865
+
24866
+ return obj
24867
+ }
24868
+
24869
+ const readFile = universalify.fromPromise(_readFile)
24870
+
24871
+ function readFileSync (file, options = {}) {
24872
+ if (typeof options === 'string') {
24873
+ options = { encoding: options }
24874
+ }
24875
+
24876
+ const fs = options.fs || _fs
24877
+
24878
+ const shouldThrow = 'throws' in options ? options.throws : true
24879
+
24880
+ try {
24881
+ let content = fs.readFileSync(file, options)
24882
+ content = stripBom(content)
24883
+ return JSON.parse(content, options.reviver)
24884
+ } catch (err) {
24885
+ if (shouldThrow) {
24886
+ err.message = `${file}: ${err.message}`
24887
+ throw err
24888
+ } else {
24889
+ return null
24890
+ }
24891
+ }
24892
+ }
24893
+
24894
+ async function _writeFile (file, obj, options = {}) {
24895
+ const fs = options.fs || _fs
24896
+
24897
+ const str = stringify(obj, options)
24898
+
24899
+ await universalify.fromCallback(fs.writeFile)(file, str, options)
24900
+ }
24901
+
24902
+ const writeFile = universalify.fromPromise(_writeFile)
24903
+
24904
+ function writeFileSync (file, obj, options = {}) {
24905
+ const fs = options.fs || _fs
24906
+
24907
+ const str = stringify(obj, options)
24908
+ // not sure if fs.writeFileSync returns anything, but just in case
24909
+ return fs.writeFileSync(file, str, options)
24910
+ }
24911
+
24912
+ const jsonfile = {
24913
+ readFile,
24914
+ readFileSync,
24915
+ writeFile,
24916
+ writeFileSync
24917
+ }
24918
+
24919
+ module.exports = jsonfile
24920
+
24921
+
24922
+ /***/ }),
24923
+
24924
+ /***/ 7653:
24925
+ /***/ ((module) => {
24926
+
24927
+ function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
24928
+ const EOF = finalEOL ? EOL : ''
24929
+ const str = JSON.stringify(obj, replacer, spaces)
24930
+
24931
+ return str.replace(/\n/g, EOL) + EOF
24932
+ }
24933
+
24934
+ function stripBom (content) {
24935
+ // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
24936
+ if (Buffer.isBuffer(content)) content = content.toString('utf8')
24937
+ return content.replace(/^\uFEFF/, '')
24938
+ }
24939
+
24940
+ module.exports = { stringify, stripBom }
24941
+
24942
+
24613
24943
  /***/ }),
24614
24944
 
24615
24945
  /***/ 4725:
@@ -26182,6 +26512,38 @@ function coerce (version, options) {
26182
26512
  }
26183
26513
 
26184
26514
 
26515
+ /***/ }),
26516
+
26517
+ /***/ 7500:
26518
+ /***/ ((__unused_webpack_module, exports) => {
26519
+
26520
+ "use strict";
26521
+
26522
+
26523
+ exports.fromCallback = function (fn) {
26524
+ return Object.defineProperty(function (...args) {
26525
+ if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
26526
+ else {
26527
+ return new Promise((resolve, reject) => {
26528
+ fn.call(
26529
+ this,
26530
+ ...args,
26531
+ (err, res) => (err != null) ? reject(err) : resolve(res)
26532
+ )
26533
+ })
26534
+ }
26535
+ }, 'name', { value: fn.name })
26536
+ }
26537
+
26538
+ exports.fromPromise = function (fn) {
26539
+ return Object.defineProperty(function (...args) {
26540
+ const cb = args[args.length - 1]
26541
+ if (typeof cb !== 'function') return fn.apply(this, args)
26542
+ else fn.apply(this, args.slice(0, -1)).then(r => cb(null, r), cb)
26543
+ }, 'name', { value: fn.name })
26544
+ }
26545
+
26546
+
26185
26547
  /***/ }),
26186
26548
 
26187
26549
  /***/ 8438:
@@ -26238,6 +26600,7 @@ exports.frameworks = [
26238
26600
  },
26239
26601
  buildCommand: {
26240
26602
  placeholder: '`npm run build` or `blitz build`',
26603
+ value: 'blitz build',
26241
26604
  },
26242
26605
  devCommand: {
26243
26606
  value: 'blitz start',
@@ -26246,8 +26609,7 @@ exports.frameworks = [
26246
26609
  placeholder: 'Next.js default',
26247
26610
  },
26248
26611
  },
26249
- devCommand: 'blitz start',
26250
- buildCommand: 'blitz build',
26612
+ getFsOutputDir: async () => '.next',
26251
26613
  getOutputDirName: async () => 'public',
26252
26614
  },
26253
26615
  {
@@ -26275,6 +26637,7 @@ exports.frameworks = [
26275
26637
  },
26276
26638
  buildCommand: {
26277
26639
  placeholder: '`npm run build` or `next build`',
26640
+ value: 'next build',
26278
26641
  },
26279
26642
  devCommand: {
26280
26643
  value: 'next dev --port $PORT',
@@ -26290,8 +26653,7 @@ exports.frameworks = [
26290
26653
  dependencies: ['next-plugin-sentry', 'next-sentry-source-maps'],
26291
26654
  },
26292
26655
  ],
26293
- devCommand: 'next dev --port $PORT',
26294
- buildCommand: 'next build',
26656
+ getFsOutputDir: async () => '.next',
26295
26657
  getOutputDirName: async () => 'public',
26296
26658
  cachePattern: '.next/cache/**',
26297
26659
  },
@@ -26303,7 +26665,7 @@ exports.frameworks = [
26303
26665
  tagline: 'Gatsby helps developers build blazing fast websites and apps with React.',
26304
26666
  description: 'A Gatsby app, using the default starter theme and a Serverless Function API.',
26305
26667
  website: 'https://gatsbyjs.org',
26306
- sort: 2,
26668
+ sort: 5,
26307
26669
  envPrefix: 'GATSBY_',
26308
26670
  detectors: {
26309
26671
  every: [
@@ -26319,6 +26681,7 @@ exports.frameworks = [
26319
26681
  },
26320
26682
  buildCommand: {
26321
26683
  placeholder: '`npm run build` or `gatsby build`',
26684
+ value: 'gatsby build',
26322
26685
  },
26323
26686
  devCommand: {
26324
26687
  value: 'gatsby develop --port $PORT',
@@ -26329,8 +26692,6 @@ exports.frameworks = [
26329
26692
  },
26330
26693
  },
26331
26694
  dependency: 'gatsby',
26332
- devCommand: 'gatsby develop --port $PORT',
26333
- buildCommand: 'gatsby build',
26334
26695
  getOutputDirName: async () => 'public',
26335
26696
  defaultRoutes: async (dirPrefix) => {
26336
26697
  // This file could be generated by gatsby-plugin-now or gatsby-plugin-zeit-now
@@ -26378,6 +26739,75 @@ exports.frameworks = [
26378
26739
  },
26379
26740
  cachePattern: '{.cache,public}/**',
26380
26741
  },
26742
+ {
26743
+ name: 'Remix',
26744
+ slug: 'remix',
26745
+ demo: 'https://remix.examples.vercel.com',
26746
+ logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/remix-no-shadow.svg',
26747
+ tagline: 'Build Better Websites',
26748
+ description: 'A new Remix app — the result of running `npx create-remix`.',
26749
+ website: 'https://remix.run',
26750
+ sort: 6,
26751
+ detectors: {
26752
+ every: [
26753
+ {
26754
+ path: 'package.json',
26755
+ matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"remix":\\s*".+?"[^}]*}',
26756
+ },
26757
+ ],
26758
+ },
26759
+ settings: {
26760
+ installCommand: {
26761
+ placeholder: '`yarn install` or `npm install`',
26762
+ },
26763
+ buildCommand: {
26764
+ value: 'remix build',
26765
+ placeholder: '`npm run build` or `remix build`',
26766
+ },
26767
+ devCommand: {
26768
+ value: 'remix dev',
26769
+ placeholder: 'remix dev',
26770
+ },
26771
+ outputDirectory: {
26772
+ value: 'public',
26773
+ },
26774
+ },
26775
+ dependency: 'remix',
26776
+ getOutputDirName: async () => 'public',
26777
+ defaultRoutes: [
26778
+ {
26779
+ src: '^/build/(.*)$',
26780
+ headers: { 'cache-control': 'public, max-age=31536000, immutable' },
26781
+ continue: true,
26782
+ },
26783
+ {
26784
+ handle: 'filesystem',
26785
+ },
26786
+ {
26787
+ src: '/(.*)',
26788
+ dest: '/api',
26789
+ },
26790
+ ],
26791
+ defaultRewrites: [
26792
+ {
26793
+ source: '/(.*)',
26794
+ regex: '/(.*)',
26795
+ destination: '/api',
26796
+ },
26797
+ ],
26798
+ defaultHeaders: [
26799
+ {
26800
+ source: '/build/(.*)',
26801
+ regex: '/build/(.*)',
26802
+ headers: [
26803
+ {
26804
+ key: 'cache-control',
26805
+ value: 'public, max-age=31536000, immutable',
26806
+ },
26807
+ ],
26808
+ },
26809
+ ],
26810
+ },
26381
26811
  {
26382
26812
  name: 'Hexo',
26383
26813
  slug: 'hexo',
@@ -26386,7 +26816,6 @@ exports.frameworks = [
26386
26816
  tagline: 'Hexo is a fast, simple & powerful blog framework powered by Node.js.',
26387
26817
  description: 'A Hexo site, created with the Hexo CLI.',
26388
26818
  website: 'https://hexo.io',
26389
- sort: 3,
26390
26819
  detectors: {
26391
26820
  every: [
26392
26821
  {
@@ -26401,6 +26830,7 @@ exports.frameworks = [
26401
26830
  },
26402
26831
  buildCommand: {
26403
26832
  placeholder: '`npm run build` or `hexo generate`',
26833
+ value: 'hexo generate',
26404
26834
  },
26405
26835
  devCommand: {
26406
26836
  value: 'hexo server --port $PORT',
@@ -26411,8 +26841,6 @@ exports.frameworks = [
26411
26841
  },
26412
26842
  },
26413
26843
  dependency: 'hexo',
26414
- devCommand: 'hexo server --port $PORT',
26415
- buildCommand: 'hexo generate',
26416
26844
  getOutputDirName: async () => 'public',
26417
26845
  },
26418
26846
  {
@@ -26423,7 +26851,6 @@ exports.frameworks = [
26423
26851
  tagline: '11ty is a simpler static site generator written in JavaScript, created to be an alternative to Jekyll.',
26424
26852
  description: 'An Eleventy site, created with npm init.',
26425
26853
  website: 'https://www.11ty.dev',
26426
- sort: 4,
26427
26854
  detectors: {
26428
26855
  every: [
26429
26856
  {
@@ -26438,6 +26865,7 @@ exports.frameworks = [
26438
26865
  },
26439
26866
  buildCommand: {
26440
26867
  placeholder: '`npm run build` or `npx @11ty/eleventy`',
26868
+ value: 'npx @11ty/eleventy',
26441
26869
  },
26442
26870
  devCommand: {
26443
26871
  value: 'npx @11ty/eleventy --serve --watch --port $PORT',
@@ -26448,8 +26876,6 @@ exports.frameworks = [
26448
26876
  },
26449
26877
  },
26450
26878
  dependency: '@11ty/eleventy',
26451
- devCommand: 'npx @11ty/eleventy --serve --watch --port $PORT',
26452
- buildCommand: 'npx @11ty/eleventy',
26453
26879
  getOutputDirName: async () => '_site',
26454
26880
  cachePattern: '.cache/**',
26455
26881
  },
@@ -26475,6 +26901,7 @@ exports.frameworks = [
26475
26901
  },
26476
26902
  buildCommand: {
26477
26903
  placeholder: '`npm run build` or `docusaurus build`',
26904
+ value: 'docusaurus build',
26478
26905
  },
26479
26906
  devCommand: {
26480
26907
  value: 'docusaurus start --port $PORT',
@@ -26485,8 +26912,6 @@ exports.frameworks = [
26485
26912
  },
26486
26913
  },
26487
26914
  dependency: '@docusaurus/core',
26488
- devCommand: 'docusaurus start --port $PORT',
26489
- buildCommand: 'docusaurus build',
26490
26915
  getOutputDirName: async (dirPrefix) => {
26491
26916
  const base = 'build';
26492
26917
  try {
@@ -26502,6 +26927,51 @@ exports.frameworks = [
26502
26927
  }
26503
26928
  return base;
26504
26929
  },
26930
+ defaultHeaders: [
26931
+ {
26932
+ source: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
26933
+ regex: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
26934
+ headers: [
26935
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
26936
+ ],
26937
+ },
26938
+ {
26939
+ source: '^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
26940
+ regex: '^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
26941
+ headers: [
26942
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
26943
+ ],
26944
+ },
26945
+ {
26946
+ source: '^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
26947
+ regex: '^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
26948
+ headers: [
26949
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
26950
+ ],
26951
+ },
26952
+ {
26953
+ source: '^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
26954
+ regex: '^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
26955
+ headers: [
26956
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
26957
+ ],
26958
+ },
26959
+ {
26960
+ source: '^/ideal-img/[^/]+\\.[0-9a-f]{7}\\.\\d+\\.(png|jpe?g|gif)$',
26961
+ regex: '^/ideal-img/[^/]+\\.[0-9a-f]{7}\\.\\d+\\.(png|jpe?g|gif)$',
26962
+ headers: [
26963
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
26964
+ ],
26965
+ },
26966
+ ],
26967
+ defaultRedirects: [
26968
+ {
26969
+ source: '.*',
26970
+ regex: '.*',
26971
+ statusCode: 404,
26972
+ destination: '404.html',
26973
+ },
26974
+ ],
26505
26975
  defaultRoutes: [
26506
26976
  {
26507
26977
  src: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
@@ -26560,6 +27030,7 @@ exports.frameworks = [
26560
27030
  },
26561
27031
  buildCommand: {
26562
27032
  placeholder: '`npm run build` or `docusaurus-build`',
27033
+ value: 'docusaurus-build',
26563
27034
  },
26564
27035
  devCommand: {
26565
27036
  value: 'docusaurus-start --port $PORT',
@@ -26570,8 +27041,6 @@ exports.frameworks = [
26570
27041
  },
26571
27042
  },
26572
27043
  dependency: 'docusaurus',
26573
- devCommand: 'docusaurus-start --port $PORT',
26574
- buildCommand: 'docusaurus-build',
26575
27044
  getOutputDirName: async (dirPrefix) => {
26576
27045
  const base = 'build';
26577
27046
  try {
@@ -26610,6 +27079,7 @@ exports.frameworks = [
26610
27079
  },
26611
27080
  buildCommand: {
26612
27081
  placeholder: '`npm run build` or `preact build`',
27082
+ value: 'preact build',
26613
27083
  },
26614
27084
  devCommand: {
26615
27085
  value: 'preact watch --port $PORT',
@@ -26620,8 +27090,6 @@ exports.frameworks = [
26620
27090
  },
26621
27091
  },
26622
27092
  dependency: 'preact-cli',
26623
- devCommand: 'preact watch --port $PORT',
26624
- buildCommand: 'preact build',
26625
27093
  getOutputDirName: async () => 'build',
26626
27094
  defaultRoutes: [
26627
27095
  {
@@ -26632,6 +27100,51 @@ exports.frameworks = [
26632
27100
  dest: '/index.html',
26633
27101
  },
26634
27102
  ],
27103
+ defaultRewrites: [
27104
+ {
27105
+ source: '/(.*)',
27106
+ regex: '/(.*)',
27107
+ destination: '/index.html',
27108
+ },
27109
+ ],
27110
+ },
27111
+ {
27112
+ name: 'SolidStart',
27113
+ slug: 'solidstart',
27114
+ demo: 'https://solidstart.examples.vercel.com',
27115
+ logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/solid.svg',
27116
+ tagline: 'Simple and performant reactivity for building user interfaces.',
27117
+ description: 'A Solid app, created with SolidStart.',
27118
+ website: 'https://solidjs.com',
27119
+ envPrefix: 'VITE_',
27120
+ detectors: {
27121
+ every: [
27122
+ {
27123
+ path: 'package.json',
27124
+ matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"solid-js":\\s*".+?"[^}]*}',
27125
+ },
27126
+ {
27127
+ path: 'package.json',
27128
+ matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"solid-start":\\s*".+?"[^}]*}',
27129
+ },
27130
+ ],
27131
+ },
27132
+ settings: {
27133
+ installCommand: {
27134
+ placeholder: '`yarn install` or `npm install`',
27135
+ },
27136
+ buildCommand: {
27137
+ placeholder: '`npm run build` or `solid-start build`',
27138
+ value: 'solid-start build',
27139
+ },
27140
+ devCommand: {
27141
+ value: 'solid-start dev',
27142
+ },
27143
+ outputDirectory: {
27144
+ value: '.output',
27145
+ },
27146
+ },
27147
+ getOutputDirName: async () => '.output',
26635
27148
  },
26636
27149
  {
26637
27150
  name: 'Dojo',
@@ -26658,6 +27171,7 @@ exports.frameworks = [
26658
27171
  },
26659
27172
  buildCommand: {
26660
27173
  placeholder: '`npm run build` or `dojo build`',
27174
+ value: 'dojo build',
26661
27175
  },
26662
27176
  devCommand: {
26663
27177
  value: 'dojo build -m dev -w -s -p $PORT',
@@ -26668,8 +27182,6 @@ exports.frameworks = [
26668
27182
  },
26669
27183
  },
26670
27184
  dependency: '@dojo/cli',
26671
- devCommand: 'dojo build -m dev -w -s -p $PORT',
26672
- buildCommand: 'dojo build',
26673
27185
  getOutputDirName: async () => path_1.join('output', 'dist'),
26674
27186
  defaultRoutes: [
26675
27187
  {
@@ -26685,6 +27197,21 @@ exports.frameworks = [
26685
27197
  dest: '/index.html',
26686
27198
  },
26687
27199
  ],
27200
+ defaulHeaders: [
27201
+ {
27202
+ source: '/service-worker.js',
27203
+ regex: '/service-worker.js',
27204
+ headers: { 'cache-control': 's-maxage=0' },
27205
+ continue: true,
27206
+ },
27207
+ ],
27208
+ defaultRewrites: [
27209
+ {
27210
+ source: '/(.*)',
27211
+ regex: '/(.*)',
27212
+ destination: '/index.html',
27213
+ },
27214
+ ],
26688
27215
  },
26689
27216
  {
26690
27217
  name: 'Ember.js',
@@ -26708,6 +27235,7 @@ exports.frameworks = [
26708
27235
  },
26709
27236
  buildCommand: {
26710
27237
  placeholder: '`npm run build` or `ember build`',
27238
+ value: 'ember build',
26711
27239
  },
26712
27240
  devCommand: {
26713
27241
  value: 'ember serve --port $PORT',
@@ -26718,8 +27246,6 @@ exports.frameworks = [
26718
27246
  },
26719
27247
  },
26720
27248
  dependency: 'ember-cli',
26721
- devCommand: 'ember serve --port $PORT',
26722
- buildCommand: 'ember build',
26723
27249
  getOutputDirName: async () => 'dist',
26724
27250
  defaultRoutes: [
26725
27251
  {
@@ -26730,6 +27256,13 @@ exports.frameworks = [
26730
27256
  dest: '/index.html',
26731
27257
  },
26732
27258
  ],
27259
+ defaultRewrites: [
27260
+ {
27261
+ source: '/(.*)',
27262
+ regex: '/(.*)',
27263
+ destination: '/index.html',
27264
+ },
27265
+ ],
26733
27266
  },
26734
27267
  {
26735
27268
  name: 'Vue.js',
@@ -26754,6 +27287,7 @@ exports.frameworks = [
26754
27287
  },
26755
27288
  buildCommand: {
26756
27289
  placeholder: '`npm run build` or `vue-cli-service build`',
27290
+ value: 'vue-cli-service build',
26757
27291
  },
26758
27292
  devCommand: {
26759
27293
  value: 'vue-cli-service serve --port $PORT',
@@ -26764,8 +27298,6 @@ exports.frameworks = [
26764
27298
  },
26765
27299
  },
26766
27300
  dependency: '@vue/cli-service',
26767
- devCommand: 'vue-cli-service serve --port $PORT',
26768
- buildCommand: 'vue-cli-service build',
26769
27301
  getOutputDirName: async () => 'dist',
26770
27302
  defaultRoutes: [
26771
27303
  {
@@ -26786,6 +27318,27 @@ exports.frameworks = [
26786
27318
  dest: '/index.html',
26787
27319
  },
26788
27320
  ],
27321
+ defaultHeaders: [
27322
+ {
27323
+ source: '^/[^/]*\\.(js|txt|ico|json)',
27324
+ regex: '^/[^/]*\\.(js|txt|ico|json)',
27325
+ headers: [{ key: 'cache-control', value: 'max-age=300' }],
27326
+ },
27327
+ {
27328
+ source: '^/(img|js|css|fonts|media)/[^/]+\\.[0-9a-f]{8}\\.*',
27329
+ regex: '^/(img|js|css|fonts|media)/[^/]+\\.[0-9a-f]{8}\\.*',
27330
+ headers: [
27331
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
27332
+ ],
27333
+ },
27334
+ ],
27335
+ defaultRewrites: [
27336
+ {
27337
+ source: '^.*',
27338
+ regex: '^.*',
27339
+ destination: '/index.html',
27340
+ },
27341
+ ],
26789
27342
  },
26790
27343
  {
26791
27344
  name: 'Scully',
@@ -26809,6 +27362,7 @@ exports.frameworks = [
26809
27362
  },
26810
27363
  buildCommand: {
26811
27364
  placeholder: '`npm run build` or `ng build && scully`',
27365
+ value: 'ng build && scully',
26812
27366
  },
26813
27367
  devCommand: {
26814
27368
  value: 'ng serve --port $PORT',
@@ -26819,8 +27373,6 @@ exports.frameworks = [
26819
27373
  },
26820
27374
  },
26821
27375
  dependency: '@scullyio/init',
26822
- devCommand: 'ng serve --port $PORT',
26823
- buildCommand: 'ng build && scully',
26824
27376
  getOutputDirName: async () => 'dist/static',
26825
27377
  },
26826
27378
  {
@@ -26845,17 +27397,16 @@ exports.frameworks = [
26845
27397
  },
26846
27398
  buildCommand: {
26847
27399
  placeholder: '`npm run build` or `ng build`',
27400
+ value: 'ng build',
26848
27401
  },
26849
27402
  devCommand: {
26850
- value: 'ng serve',
27403
+ value: 'ng serve --port $PORT',
26851
27404
  },
26852
27405
  outputDirectory: {
26853
27406
  value: 'www',
26854
27407
  },
26855
27408
  },
26856
27409
  dependency: '@ionic/angular',
26857
- devCommand: 'ng serve',
26858
- buildCommand: 'ng build',
26859
27410
  getOutputDirName: async () => 'www',
26860
27411
  defaultRoutes: [
26861
27412
  {
@@ -26866,6 +27417,13 @@ exports.frameworks = [
26866
27417
  dest: '/index.html',
26867
27418
  },
26868
27419
  ],
27420
+ defaultRewrites: [
27421
+ {
27422
+ source: '/(.*)',
27423
+ regex: '/(.*)',
27424
+ destination: '/index.html',
27425
+ },
27426
+ ],
26869
27427
  },
26870
27428
  {
26871
27429
  name: 'Angular',
@@ -26889,6 +27447,7 @@ exports.frameworks = [
26889
27447
  },
26890
27448
  buildCommand: {
26891
27449
  placeholder: '`npm run build` or `ng build`',
27450
+ value: 'ng build',
26892
27451
  },
26893
27452
  devCommand: {
26894
27453
  value: 'ng serve --port $PORT',
@@ -26899,8 +27458,6 @@ exports.frameworks = [
26899
27458
  },
26900
27459
  },
26901
27460
  dependency: '@angular/cli',
26902
- devCommand: 'ng serve --port $PORT',
26903
- buildCommand: 'ng build',
26904
27461
  getOutputDirName: async (dirPrefix) => {
26905
27462
  const base = 'dist';
26906
27463
  try {
@@ -26925,6 +27482,13 @@ exports.frameworks = [
26925
27482
  dest: '/index.html',
26926
27483
  },
26927
27484
  ],
27485
+ defaultRewrites: [
27486
+ {
27487
+ source: '/(.*)',
27488
+ regex: '/(.*)',
27489
+ destination: '/index.html',
27490
+ },
27491
+ ],
26928
27492
  },
26929
27493
  {
26930
27494
  name: 'Polymer',
@@ -26948,6 +27512,7 @@ exports.frameworks = [
26948
27512
  },
26949
27513
  buildCommand: {
26950
27514
  placeholder: '`npm run build` or `polymer build`',
27515
+ value: 'polymer build',
26951
27516
  },
26952
27517
  devCommand: {
26953
27518
  value: 'polymer serve --port $PORT',
@@ -26958,8 +27523,6 @@ exports.frameworks = [
26958
27523
  },
26959
27524
  },
26960
27525
  dependency: 'polymer-cli',
26961
- devCommand: 'polymer serve --port $PORT',
26962
- buildCommand: 'polymer build',
26963
27526
  getOutputDirName: async (dirPrefix) => {
26964
27527
  const base = 'build';
26965
27528
  try {
@@ -26982,6 +27545,13 @@ exports.frameworks = [
26982
27545
  dest: '/index.html',
26983
27546
  },
26984
27547
  ],
27548
+ defaultRewrites: [
27549
+ {
27550
+ source: '/(.*)',
27551
+ regex: '/(.*)',
27552
+ destination: '/index.html',
27553
+ },
27554
+ ],
26985
27555
  },
26986
27556
  {
26987
27557
  name: 'Svelte',
@@ -26991,6 +27561,7 @@ exports.frameworks = [
26991
27561
  tagline: 'Svelte lets you write high performance reactive apps with significantly less boilerplate.',
26992
27562
  description: 'A basic Svelte app using the default template.',
26993
27563
  website: 'https://svelte.dev',
27564
+ sort: 3,
26994
27565
  detectors: {
26995
27566
  every: [
26996
27567
  {
@@ -27009,6 +27580,7 @@ exports.frameworks = [
27009
27580
  },
27010
27581
  buildCommand: {
27011
27582
  placeholder: '`npm run build` or `rollup -c`',
27583
+ value: 'rollup -c',
27012
27584
  },
27013
27585
  devCommand: {
27014
27586
  value: 'rollup -c -w',
@@ -27018,8 +27590,6 @@ exports.frameworks = [
27018
27590
  },
27019
27591
  },
27020
27592
  dependency: 'sirv-cli',
27021
- devCommand: 'rollup -c -w',
27022
- buildCommand: 'rollup -c',
27023
27593
  getOutputDirName: async () => 'public',
27024
27594
  defaultRoutes: [
27025
27595
  {
@@ -27030,6 +27600,13 @@ exports.frameworks = [
27030
27600
  dest: '/index.html',
27031
27601
  },
27032
27602
  ],
27603
+ defaultRewrites: [
27604
+ {
27605
+ source: '/(.*)',
27606
+ regex: '/(.*)',
27607
+ destination: '/index.html',
27608
+ },
27609
+ ],
27033
27610
  },
27034
27611
  {
27035
27612
  name: 'SvelteKit',
@@ -27039,6 +27616,7 @@ exports.frameworks = [
27039
27616
  tagline: 'SvelteKit is a framework for building web applications of all sizes.',
27040
27617
  description: 'A SvelteKit app optimized to work for serverless.',
27041
27618
  website: 'https://kit.svelte.dev',
27619
+ envPrefix: 'VITE_',
27042
27620
  detectors: {
27043
27621
  every: [
27044
27622
  {
@@ -27053,17 +27631,16 @@ exports.frameworks = [
27053
27631
  },
27054
27632
  buildCommand: {
27055
27633
  placeholder: '`npm run build` or `svelte-kit build`',
27634
+ value: 'svelte-kit build',
27056
27635
  },
27057
27636
  devCommand: {
27058
27637
  value: 'svelte-kit dev --port $PORT',
27059
27638
  placeholder: 'svelte-kit dev',
27060
27639
  },
27061
27640
  outputDirectory: {
27062
- placeholder: 'public',
27641
+ value: 'public',
27063
27642
  },
27064
27643
  },
27065
- devCommand: 'svelte-kit dev --port $PORT',
27066
- buildCommand: 'svelte-kit build',
27067
27644
  getOutputDirName: async () => 'public',
27068
27645
  },
27069
27646
  {
@@ -27088,6 +27665,7 @@ exports.frameworks = [
27088
27665
  },
27089
27666
  buildCommand: {
27090
27667
  placeholder: '`npm run build` or `react-scripts build`',
27668
+ value: 'react-scripts build',
27091
27669
  },
27092
27670
  devCommand: {
27093
27671
  value: 'react-scripts start',
@@ -27097,8 +27675,6 @@ exports.frameworks = [
27097
27675
  },
27098
27676
  },
27099
27677
  dependency: '@ionic/react',
27100
- devCommand: 'react-scripts start',
27101
- buildCommand: 'react-scripts build',
27102
27678
  getOutputDirName: async () => 'build',
27103
27679
  defaultRoutes: [
27104
27680
  {
@@ -27125,6 +27701,45 @@ exports.frameworks = [
27125
27701
  dest: '/index.html',
27126
27702
  },
27127
27703
  ],
27704
+ defaultHeaders: [
27705
+ {
27706
+ source: '/static/(.*)',
27707
+ regex: '/static/(.*)',
27708
+ headers: [
27709
+ { key: 'cache-control', value: 's-maxage=31536000, immutable' },
27710
+ ],
27711
+ },
27712
+ {
27713
+ source: '/service-worker.js',
27714
+ regex: '/service-worker.js',
27715
+ headers: [{ key: 'cache-control', value: 's-maxage=0' }],
27716
+ },
27717
+ {
27718
+ source: '/(.*)',
27719
+ regex: '/(.*)',
27720
+ headers: [{ key: 'cache-control', value: 's-maxage=0' }],
27721
+ },
27722
+ ],
27723
+ defaultRedirects: [
27724
+ {
27725
+ source: '/static/(.*)',
27726
+ destination: '/404.html',
27727
+ statusCode: 404,
27728
+ regex: '/static/(.*)',
27729
+ },
27730
+ ],
27731
+ defaultRewrites: [
27732
+ {
27733
+ source: '/sockjs-node/(.*)',
27734
+ destination: '/sockjs-node/$1',
27735
+ regex: '/sockjs-node/(.*)',
27736
+ },
27737
+ {
27738
+ source: '/(.*)',
27739
+ destination: '/index.html',
27740
+ regex: '/(.*)',
27741
+ },
27742
+ ],
27128
27743
  },
27129
27744
  {
27130
27745
  name: 'Create React App',
@@ -27134,6 +27749,7 @@ exports.frameworks = [
27134
27749
  tagline: 'Create React App allows you to get going with React in no time.',
27135
27750
  description: 'A React app, bootstrapped with create-react-app, and a Serverless Function API.',
27136
27751
  website: 'https://create-react-app.dev',
27752
+ sort: 4,
27137
27753
  envPrefix: 'REACT_APP_',
27138
27754
  detectors: {
27139
27755
  some: [
@@ -27153,6 +27769,7 @@ exports.frameworks = [
27153
27769
  },
27154
27770
  buildCommand: {
27155
27771
  placeholder: '`npm run build` or `react-scripts build`',
27772
+ value: 'react-scripts build',
27156
27773
  },
27157
27774
  devCommand: {
27158
27775
  value: 'react-scripts start',
@@ -27162,8 +27779,6 @@ exports.frameworks = [
27162
27779
  },
27163
27780
  },
27164
27781
  dependency: 'react-scripts',
27165
- devCommand: 'react-scripts start',
27166
- buildCommand: 'react-scripts build',
27167
27782
  getOutputDirName: async () => 'build',
27168
27783
  defaultRoutes: [
27169
27784
  {
@@ -27190,6 +27805,45 @@ exports.frameworks = [
27190
27805
  dest: '/index.html',
27191
27806
  },
27192
27807
  ],
27808
+ defaultHeaders: [
27809
+ {
27810
+ source: '/static/(.*)',
27811
+ regex: '/static/(.*)',
27812
+ headers: [
27813
+ { key: 'cache-control', value: 's-maxage=31536000, immutable' },
27814
+ ],
27815
+ },
27816
+ {
27817
+ source: '/service-worker.js',
27818
+ regex: '/service-worker.js',
27819
+ headers: [{ key: 'cache-control', value: 's-maxage=0' }],
27820
+ },
27821
+ {
27822
+ source: '/(.*)',
27823
+ regex: '/(.*)',
27824
+ headers: [{ key: 'cache-control', value: 's-maxage=0' }],
27825
+ },
27826
+ ],
27827
+ defaultRedirects: [
27828
+ {
27829
+ source: '/static/(.*)',
27830
+ destination: '/404.html',
27831
+ statusCode: 404,
27832
+ regex: '/static/(.*)',
27833
+ },
27834
+ ],
27835
+ defaultRewrites: [
27836
+ {
27837
+ source: '/sockjs-node/(.*)',
27838
+ destination: '/sockjs-node/$1',
27839
+ regex: '/sockjs-node/(.*)',
27840
+ },
27841
+ {
27842
+ source: '/(.*)',
27843
+ destination: '/index.html',
27844
+ regex: '/(.*)',
27845
+ },
27846
+ ],
27193
27847
  },
27194
27848
  {
27195
27849
  name: 'Gridsome',
@@ -27213,6 +27867,7 @@ exports.frameworks = [
27213
27867
  },
27214
27868
  buildCommand: {
27215
27869
  placeholder: '`npm run build` or `gridsome build`',
27870
+ value: 'gridsome build',
27216
27871
  },
27217
27872
  devCommand: {
27218
27873
  value: 'gridsome develop -p $PORT',
@@ -27223,8 +27878,6 @@ exports.frameworks = [
27223
27878
  },
27224
27879
  },
27225
27880
  dependency: 'gridsome',
27226
- devCommand: 'gridsome develop -p $PORT',
27227
- buildCommand: 'gridsome build',
27228
27881
  getOutputDirName: async () => 'dist',
27229
27882
  },
27230
27883
  {
@@ -27249,6 +27902,7 @@ exports.frameworks = [
27249
27902
  },
27250
27903
  buildCommand: {
27251
27904
  placeholder: '`npm run build` or `umi build`',
27905
+ value: 'umi build',
27252
27906
  },
27253
27907
  devCommand: {
27254
27908
  value: 'umi dev --port $PORT',
@@ -27259,8 +27913,6 @@ exports.frameworks = [
27259
27913
  },
27260
27914
  },
27261
27915
  dependency: 'umi',
27262
- devCommand: 'umi dev --port $PORT',
27263
- buildCommand: 'umi build',
27264
27916
  getOutputDirName: async () => 'dist',
27265
27917
  defaultRoutes: [
27266
27918
  {
@@ -27271,6 +27923,13 @@ exports.frameworks = [
27271
27923
  dest: '/index.html',
27272
27924
  },
27273
27925
  ],
27926
+ defaultRewrites: [
27927
+ {
27928
+ source: '/(.*)',
27929
+ destination: '/index.html',
27930
+ regex: '/(.*)',
27931
+ },
27932
+ ],
27274
27933
  },
27275
27934
  {
27276
27935
  name: 'Sapper',
@@ -27294,6 +27953,7 @@ exports.frameworks = [
27294
27953
  },
27295
27954
  buildCommand: {
27296
27955
  placeholder: '`npm run build` or `sapper export`',
27956
+ value: 'sapper export',
27297
27957
  },
27298
27958
  devCommand: {
27299
27959
  value: 'sapper dev --port $PORT',
@@ -27304,8 +27964,6 @@ exports.frameworks = [
27304
27964
  },
27305
27965
  },
27306
27966
  dependency: 'sapper',
27307
- devCommand: 'sapper dev --port $PORT',
27308
- buildCommand: 'sapper export',
27309
27967
  getOutputDirName: async () => '__sapper__/export',
27310
27968
  },
27311
27969
  {
@@ -27330,6 +27988,7 @@ exports.frameworks = [
27330
27988
  },
27331
27989
  buildCommand: {
27332
27990
  placeholder: '`npm run build` or `saber build`',
27991
+ value: 'saber build',
27333
27992
  },
27334
27993
  devCommand: {
27335
27994
  value: 'saber --port $PORT',
@@ -27340,8 +27999,6 @@ exports.frameworks = [
27340
27999
  },
27341
28000
  },
27342
28001
  dependency: 'saber',
27343
- devCommand: 'saber --port $PORT',
27344
- buildCommand: 'saber build',
27345
28002
  getOutputDirName: async () => 'public',
27346
28003
  defaultRoutes: [
27347
28004
  {
@@ -27357,6 +28014,23 @@ exports.frameworks = [
27357
28014
  dest: '404.html',
27358
28015
  },
27359
28016
  ],
28017
+ defaultHeaders: [
28018
+ {
28019
+ source: '/_saber/.*',
28020
+ regex: '/_saber/.*',
28021
+ headers: [
28022
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
28023
+ ],
28024
+ },
28025
+ ],
28026
+ defaultRedirects: [
28027
+ {
28028
+ source: '.*',
28029
+ statusCode: 404,
28030
+ destination: '404.html',
28031
+ regex: '.*',
28032
+ },
28033
+ ],
27360
28034
  },
27361
28035
  {
27362
28036
  name: 'Stencil',
@@ -27380,6 +28054,7 @@ exports.frameworks = [
27380
28054
  },
27381
28055
  buildCommand: {
27382
28056
  placeholder: '`npm run build` or `stencil build`',
28057
+ value: 'stencil build',
27383
28058
  },
27384
28059
  devCommand: {
27385
28060
  value: 'stencil build --dev --watch --serve --port $PORT',
@@ -27390,8 +28065,6 @@ exports.frameworks = [
27390
28065
  },
27391
28066
  },
27392
28067
  dependency: '@stencil/core',
27393
- devCommand: 'stencil build --dev --watch --serve --port $PORT',
27394
- buildCommand: 'stencil build',
27395
28068
  getOutputDirName: async () => 'www',
27396
28069
  defaultRoutes: [
27397
28070
  {
@@ -27417,6 +28090,32 @@ exports.frameworks = [
27417
28090
  dest: '/index.html',
27418
28091
  },
27419
28092
  ],
28093
+ defaultHeaders: [
28094
+ {
28095
+ source: '/assets/(.*)',
28096
+ regex: '/assets/(.*)',
28097
+ headers: [{ key: 'cache-control', value: 'max-age=2592000' }],
28098
+ },
28099
+ {
28100
+ source: '/build/p-.*',
28101
+ regex: '/build/p-.*',
28102
+ headers: [
28103
+ { key: 'cache-control', value: 'max-age=31536000, immutable' },
28104
+ ],
28105
+ },
28106
+ {
28107
+ source: '/sw.js',
28108
+ regex: '/sw.js',
28109
+ headers: [{ key: 'cache-control', value: 'no-cache' }],
28110
+ },
28111
+ ],
28112
+ defaultRewrites: [
28113
+ {
28114
+ source: '/(.*)',
28115
+ destination: '/index.html',
28116
+ regex: '/(.*)',
28117
+ },
28118
+ ],
27420
28119
  },
27421
28120
  {
27422
28121
  name: 'Nuxt.js',
@@ -27426,6 +28125,7 @@ exports.frameworks = [
27426
28125
  tagline: 'Nuxt.js is the web comprehensive framework that lets you dream big with Vue.js.',
27427
28126
  description: 'A Nuxt.js app, bootstrapped with create-nuxt-app.',
27428
28127
  website: 'https://nuxtjs.org',
28128
+ sort: 2,
27429
28129
  envPrefix: 'NUXT_ENV_',
27430
28130
  detectors: {
27431
28131
  every: [
@@ -27441,6 +28141,7 @@ exports.frameworks = [
27441
28141
  },
27442
28142
  buildCommand: {
27443
28143
  placeholder: '`npm run build` or `nuxt generate`',
28144
+ value: 'nuxt generate',
27444
28145
  },
27445
28146
  devCommand: {
27446
28147
  value: 'nuxt',
@@ -27450,8 +28151,6 @@ exports.frameworks = [
27450
28151
  },
27451
28152
  },
27452
28153
  dependency: 'nuxt',
27453
- devCommand: 'nuxt',
27454
- buildCommand: 'nuxt generate',
27455
28154
  getOutputDirName: async () => 'dist',
27456
28155
  cachePattern: '.nuxt/**',
27457
28156
  defaultRoutes: [
@@ -27508,8 +28207,6 @@ exports.frameworks = [
27508
28207
  placeholder: 'RedwoodJS default',
27509
28208
  },
27510
28209
  },
27511
- devCommand: 'yarn rw dev --fwd="--port=$PORT --open=false',
27512
- buildCommand: 'yarn rw deploy vercel',
27513
28210
  getOutputDirName: async () => 'public',
27514
28211
  },
27515
28212
  {
@@ -27520,7 +28217,6 @@ exports.frameworks = [
27520
28217
  tagline: 'Hugo is the world’s fastest framework for building websites, written in Go.',
27521
28218
  description: 'A Hugo site, created with the Hugo CLI.',
27522
28219
  website: 'https://gohugo.io',
27523
- sort: 5,
27524
28220
  detectors: {
27525
28221
  some: [
27526
28222
  {
@@ -27543,6 +28239,7 @@ exports.frameworks = [
27543
28239
  },
27544
28240
  buildCommand: {
27545
28241
  placeholder: '`npm run build` or `hugo -D --gc`',
28242
+ value: 'hugo -D --gc',
27546
28243
  },
27547
28244
  devCommand: {
27548
28245
  value: 'hugo server -D -w -p $PORT',
@@ -27552,8 +28249,6 @@ exports.frameworks = [
27552
28249
  placeholder: '`public` or `publishDir` from the `config` file',
27553
28250
  },
27554
28251
  },
27555
- devCommand: 'hugo server -D -w -p $PORT',
27556
- buildCommand: 'hugo -D --gc',
27557
28252
  getOutputDirName: async (dirPrefix) => {
27558
28253
  const config = await read_config_file_1.readConfigFile(['config.json', 'config.yaml', 'config.toml'].map(fileName => {
27559
28254
  return path_1.join(dirPrefix, fileName);
@@ -27583,6 +28278,7 @@ exports.frameworks = [
27583
28278
  },
27584
28279
  buildCommand: {
27585
28280
  placeholder: '`npm run build` or `jekyll build`',
28281
+ value: 'jekyll build',
27586
28282
  },
27587
28283
  devCommand: {
27588
28284
  value: 'bundle exec jekyll serve --watch --port $PORT',
@@ -27592,8 +28288,6 @@ exports.frameworks = [
27592
28288
  placeholder: '`_site` or `destination` from `_config.yml`',
27593
28289
  },
27594
28290
  },
27595
- devCommand: 'bundle exec jekyll serve --watch --port $PORT',
27596
- buildCommand: 'jekyll build',
27597
28291
  getOutputDirName: async (dirPrefix) => {
27598
28292
  const config = await read_config_file_1.readConfigFile(path_1.join(dirPrefix, '_config.yml'));
27599
28293
  return (config && config.destination) || '_site';
@@ -27621,6 +28315,7 @@ exports.frameworks = [
27621
28315
  },
27622
28316
  buildCommand: {
27623
28317
  placeholder: '`npm run build` or `brunch build --production`',
28318
+ value: 'brunch build --production',
27624
28319
  },
27625
28320
  devCommand: {
27626
28321
  value: 'brunch watch --server --port $PORT',
@@ -27630,8 +28325,6 @@ exports.frameworks = [
27630
28325
  value: 'public',
27631
28326
  },
27632
28327
  },
27633
- devCommand: 'brunch watch --server --port $PORT',
27634
- buildCommand: 'brunch build --production',
27635
28328
  getOutputDirName: async () => 'public',
27636
28329
  },
27637
28330
  {
@@ -27654,18 +28347,17 @@ exports.frameworks = [
27654
28347
  value: 'bundle install',
27655
28348
  },
27656
28349
  buildCommand: {
27657
- value: '`npm run build` or `bundle exec middleman build`',
28350
+ placeholder: '`npm run build` or `bundle exec middleman build`',
28351
+ value: 'bundle exec middleman build',
27658
28352
  },
27659
28353
  devCommand: {
27660
- value: 'bundle exec middleman server -p $PORT',
27661
28354
  placeholder: 'bundle exec middleman server',
28355
+ value: 'bundle exec middleman server -p $PORT',
27662
28356
  },
27663
28357
  outputDirectory: {
27664
28358
  value: 'build',
27665
28359
  },
27666
28360
  },
27667
- devCommand: 'bundle exec middleman server -p $PORT',
27668
- buildCommand: 'bundle exec middleman build',
27669
28361
  getOutputDirName: async () => 'build',
27670
28362
  cachePattern: '{vendor/bin,vendor/cache,vendor/bundle}/**',
27671
28363
  },
@@ -27693,15 +28385,13 @@ exports.frameworks = [
27693
28385
  value: 'zola build',
27694
28386
  },
27695
28387
  devCommand: {
27696
- value: 'zola serve --port $PORT',
27697
28388
  placeholder: 'zola serve',
28389
+ value: 'zola serve --port $PORT',
27698
28390
  },
27699
28391
  outputDirectory: {
27700
28392
  value: 'public',
27701
28393
  },
27702
28394
  },
27703
- devCommand: 'zola serve --port $PORT',
27704
- buildCommand: 'zola build',
27705
28395
  getOutputDirName: async () => 'public',
27706
28396
  defaultVersion: '0.13.0',
27707
28397
  },
@@ -27728,40 +28418,110 @@ exports.frameworks = [
27728
28418
  },
27729
28419
  buildCommand: {
27730
28420
  placeholder: '`npm run build` or `vite build`',
28421
+ value: 'vite build',
27731
28422
  },
27732
28423
  devCommand: {
27733
28424
  placeholder: 'vite',
28425
+ value: 'vite',
27734
28426
  },
27735
28427
  outputDirectory: {
27736
28428
  value: 'dist',
27737
28429
  },
27738
28430
  },
27739
28431
  dependency: 'vite',
27740
- devCommand: 'vite',
27741
- buildCommand: 'vite build',
27742
28432
  getOutputDirName: async () => 'dist',
27743
28433
  },
28434
+ {
28435
+ name: 'Parcel',
28436
+ slug: 'parcel',
28437
+ demo: 'https://parcel.examples.vercel.com',
28438
+ logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/parcel.png',
28439
+ tagline: 'Parcel is a zero configuration build tool for the web that scales to projects of any size and complexity.',
28440
+ description: 'A vanilla web app built with Parcel.',
28441
+ website: 'https://parceljs.org',
28442
+ detectors: {
28443
+ every: [
28444
+ {
28445
+ path: 'package.json',
28446
+ matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"parcel":\\s*".+?"[^}]*}',
28447
+ },
28448
+ ],
28449
+ },
28450
+ settings: {
28451
+ installCommand: {
28452
+ placeholder: '`yarn install` or `npm install`',
28453
+ },
28454
+ buildCommand: {
28455
+ placeholder: '`npm run build` or `parcel build`',
28456
+ value: 'parcel build',
28457
+ },
28458
+ devCommand: {
28459
+ placeholder: 'parcel',
28460
+ value: 'parcel',
28461
+ },
28462
+ outputDirectory: {
28463
+ value: 'dist',
28464
+ },
28465
+ },
28466
+ dependency: 'parcel',
28467
+ getOutputDirName: async () => 'dist',
28468
+ defaultRoutes: [
28469
+ {
28470
+ src: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js|png|jpg|webp|avif|svg)$',
28471
+ headers: { 'cache-control': 's-maxage=31536000, immutable' },
28472
+ continue: true,
28473
+ },
28474
+ {
28475
+ handle: 'filesystem',
28476
+ },
28477
+ ],
28478
+ defaultHeaders: [
28479
+ {
28480
+ source: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js|png|jpg|webp|avif|svg)$',
28481
+ regex: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js|png|jpg|webp|avif|svg)$',
28482
+ headers: [
28483
+ { key: 'cache-control', value: 's-maxage=31536000, immutable' },
28484
+ ],
28485
+ },
28486
+ ],
28487
+ },
27744
28488
  {
27745
28489
  name: 'Other',
27746
28490
  slug: null,
27747
28491
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/other.svg',
27748
- description: 'No framework or a unoptimized framework.',
28492
+ description: 'No framework or an unoptimized framework.',
27749
28493
  settings: {
27750
28494
  installCommand: {
27751
28495
  placeholder: '`yarn install` or `npm install`',
27752
28496
  },
27753
28497
  buildCommand: {
27754
28498
  placeholder: '`npm run vercel-build` or `npm run build`',
28499
+ value: null,
27755
28500
  },
27756
28501
  devCommand: {
27757
28502
  placeholder: 'None',
28503
+ value: null,
27758
28504
  },
27759
28505
  outputDirectory: {
27760
28506
  placeholder: '`public` if it exists, or `.`',
27761
28507
  },
27762
28508
  },
27763
- devCommand: null,
27764
- buildCommand: null,
28509
+ getFsOutputDir: async (dirPrefix) => {
28510
+ // Public if it exists or `.`
28511
+ let base = 'public';
28512
+ try {
28513
+ const location = path_1.join(dirPrefix, base);
28514
+ const content = await readdir(location, { withFileTypes: true });
28515
+ // If there is only one file in it that is a dir we'll use it as dist dir
28516
+ if (content.length === 1 && content[0].isDirectory()) {
28517
+ return path_1.join(base, content[0].name);
28518
+ }
28519
+ }
28520
+ catch (_error) {
28521
+ base = '.';
28522
+ }
28523
+ return base;
28524
+ },
27765
28525
  getOutputDirName: async () => 'public',
27766
28526
  },
27767
28527
  ];
@@ -31953,6 +32713,312 @@ module.exports = new Type('tag:yaml.org,2002:timestamp', {
31953
32713
  });
31954
32714
 
31955
32715
 
32716
+ /***/ }),
32717
+
32718
+ /***/ 7276:
32719
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
32720
+
32721
+ "use strict";
32722
+
32723
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32724
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32725
+ };
32726
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
32727
+ exports._experimental_updateRoutesManifest = exports._experimental_updateFunctionsManifest = exports._experimental_convertRuntimeToPlugin = void 0;
32728
+ const fs_extra_1 = __importDefault(__webpack_require__(5392));
32729
+ const path_1 = __webpack_require__(5622);
32730
+ const glob_1 = __importDefault(__webpack_require__(4240));
32731
+ const normalize_path_1 = __webpack_require__(6261);
32732
+ const lambda_1 = __webpack_require__(6721);
32733
+ const _1 = __webpack_require__(2855);
32734
+ // `.output` was already created by the Build Command, so we have
32735
+ // to ensure its contents don't get bundled into the Lambda. Similarily,
32736
+ // we don't want to bundle anything from `.vercel` either. Lastly,
32737
+ // Builders/Runtimes didn't have `vercel.json` or `now.json`.
32738
+ const ignoredPaths = ['.output', '.vercel', 'vercel.json', 'now.json'];
32739
+ const shouldIgnorePath = (file, ignoreFilter, ignoreFile) => {
32740
+ const isNative = ignoredPaths.some(item => {
32741
+ return file.startsWith(item);
32742
+ });
32743
+ if (!ignoreFile) {
32744
+ return isNative;
32745
+ }
32746
+ return isNative || ignoreFilter(file);
32747
+ };
32748
+ const getSourceFiles = async (workPath, ignoreFilter) => {
32749
+ const list = await glob_1.default('**', {
32750
+ cwd: workPath,
32751
+ });
32752
+ // We're not passing this as an `ignore` filter to the `glob` function above,
32753
+ // so that we can re-use exactly the same `getIgnoreFilter` method that the
32754
+ // Build Step uses (literally the same code). Note that this exclusion only applies
32755
+ // when deploying. Locally, another exclusion is needed, which is handled
32756
+ // further below in the `convertRuntimeToPlugin` function.
32757
+ for (const file in list) {
32758
+ if (shouldIgnorePath(file, ignoreFilter, true)) {
32759
+ delete list[file];
32760
+ }
32761
+ }
32762
+ return list;
32763
+ };
32764
+ /**
32765
+ * Convert legacy Runtime to a Plugin.
32766
+ * @param buildRuntime - a legacy build() function from a Runtime
32767
+ * @param packageName - the name of the package, for example `vercel-plugin-python`
32768
+ * @param ext - the file extension, for example `.py`
32769
+ */
32770
+ function _experimental_convertRuntimeToPlugin(buildRuntime, packageName, ext) {
32771
+ // This `build()` signature should match `plugin.build()` signature in `vercel build`.
32772
+ return async function build({ workPath }) {
32773
+ // We also don't want to provide any files to Runtimes that were ignored
32774
+ // through `.vercelignore` or `.nowignore`, because the Build Step does the same.
32775
+ const ignoreFilter = await _1.getIgnoreFilter(workPath);
32776
+ // Retrieve the files that are currently available on the File System,
32777
+ // before the Legacy Runtime has even started to build.
32778
+ const sourceFilesPreBuild = await getSourceFiles(workPath, ignoreFilter);
32779
+ // Instead of doing another `glob` to get all the matching source files,
32780
+ // we'll filter the list of existing files down to only the ones
32781
+ // that are matching the entrypoint pattern, so we're first creating
32782
+ // a clean new list to begin.
32783
+ const entrypoints = Object.assign({}, sourceFilesPreBuild);
32784
+ const entrypointMatch = new RegExp(`^api/.*${ext}$`);
32785
+ // Up next, we'll strip out the files from the list of entrypoints
32786
+ // that aren't actually considered entrypoints.
32787
+ for (const file in entrypoints) {
32788
+ if (!entrypointMatch.test(file)) {
32789
+ delete entrypoints[file];
32790
+ }
32791
+ }
32792
+ const pages = {};
32793
+ const pluginName = packageName.replace('vercel-plugin-', '');
32794
+ const outputPath = path_1.join(workPath, '.output');
32795
+ const traceDir = path_1.join(outputPath, `inputs`,
32796
+ // Legacy Runtimes can only provide API Routes, so that's
32797
+ // why we can use this prefix for all of them. Here, we have to
32798
+ // make sure to not use a cryptic hash name, because people
32799
+ // need to be able to easily inspect the output.
32800
+ `api-routes-${pluginName}`);
32801
+ await fs_extra_1.default.ensureDir(traceDir);
32802
+ const entryRoot = path_1.join(outputPath, 'server', 'pages');
32803
+ for (const entrypoint of Object.keys(entrypoints)) {
32804
+ const { output } = await buildRuntime({
32805
+ files: sourceFilesPreBuild,
32806
+ entrypoint,
32807
+ workPath,
32808
+ config: {
32809
+ zeroConfig: true,
32810
+ },
32811
+ meta: {
32812
+ avoidTopLevelInstall: true,
32813
+ skipDownload: true,
32814
+ },
32815
+ });
32816
+ // @ts-ignore This symbol is a private API
32817
+ const lambdaFiles = output[lambda_1.FILES_SYMBOL];
32818
+ // When deploying, the `files` that are passed to the Legacy Runtimes already
32819
+ // have certain files that are ignored stripped, but locally, that list of
32820
+ // files isn't used by the Legacy Runtimes, so we need to apply the filters
32821
+ // to the outputs that they are returning instead.
32822
+ for (const file in lambdaFiles) {
32823
+ if (shouldIgnorePath(file, ignoreFilter, false)) {
32824
+ delete lambdaFiles[file];
32825
+ }
32826
+ }
32827
+ let handlerFileBase = output.handler;
32828
+ let handlerFile = lambdaFiles[handlerFileBase];
32829
+ let handlerHasImport = false;
32830
+ const { handler } = output;
32831
+ const handlerMethod = handler.split('.').pop();
32832
+ const handlerFileName = handler.replace(`.${handlerMethod}`, '');
32833
+ // For compiled languages, the launcher file for the Lambda generated
32834
+ // by the Legacy Runtime matches the `handler` defined for it, but for
32835
+ // interpreted languages, the `handler` consists of the launcher file name
32836
+ // without an extension, plus the name of the method inside of that file
32837
+ // that should be invoked, so we have to construct the file path explicitly.
32838
+ if (!handlerFile) {
32839
+ handlerFileBase = handlerFileName + ext;
32840
+ handlerFile = lambdaFiles[handlerFileBase];
32841
+ handlerHasImport = true;
32842
+ }
32843
+ if (!handlerFile || !handlerFile.fsPath) {
32844
+ throw new Error(`Could not find a handler file. Please ensure that \`files\` for the returned \`Lambda\` contains an \`FileFsRef\` named "${handlerFileBase}" with a valid \`fsPath\`.`);
32845
+ }
32846
+ const handlerExtName = path_1.extname(handlerFile.fsPath);
32847
+ const entryBase = path_1.basename(entrypoint).replace(ext, handlerExtName);
32848
+ const entryPath = path_1.join(path_1.dirname(entrypoint), entryBase);
32849
+ const entry = path_1.join(entryRoot, entryPath);
32850
+ // Create the parent directory of the API Route that will be created
32851
+ // for the current entrypoint inside of `.output/server/pages/api`.
32852
+ await fs_extra_1.default.ensureDir(path_1.dirname(entry));
32853
+ // For compiled languages, the launcher file will be binary and therefore
32854
+ // won't try to import a user-provided request handler (instead, it will
32855
+ // contain it). But for interpreted languages, the launcher might try to
32856
+ // load a user-provided request handler from the source file instead of bundling
32857
+ // it, so we have to adjust the import statement inside the launcher to point
32858
+ // to the respective source file. Previously, Legacy Runtimes simply expected
32859
+ // the user-provided request-handler to be copied right next to the launcher,
32860
+ // but with the new File System API, files won't be moved around unnecessarily.
32861
+ if (handlerHasImport) {
32862
+ const { fsPath } = handlerFile;
32863
+ const encoding = 'utf-8';
32864
+ // This is the true directory of the user-provided request handler in the
32865
+ // source files, so that's what we will use as an import path in the launcher.
32866
+ const locationPrefix = path_1.relative(entry, outputPath);
32867
+ let handlerContent = await fs_extra_1.default.readFile(fsPath, encoding);
32868
+ const importPaths = [
32869
+ // This is the full entrypoint path, like `./api/test.py`. In our tests
32870
+ // Python didn't support importing from a parent directory without using different
32871
+ // code in the launcher that registers it as a location for modules and then changing
32872
+ // the importing syntax, but continuing to import it like before seems to work. If
32873
+ // other languages need this, we should consider excluding Python explicitly.
32874
+ // `./${entrypoint}`,
32875
+ // This is the entrypoint path without extension, like `api/test`
32876
+ entrypoint.slice(0, -ext.length),
32877
+ ];
32878
+ // Generate a list of regular expressions that we can use for
32879
+ // finding matches, but only allow matches if the import path is
32880
+ // wrapped inside single (') or double quotes (").
32881
+ const patterns = importPaths.map(path => {
32882
+ // eslint-disable-next-line no-useless-escape
32883
+ return new RegExp(`('|")(${path.replace(/\./g, '\\.')})('|")`, 'g');
32884
+ });
32885
+ let replacedMatch = null;
32886
+ for (const pattern of patterns) {
32887
+ const newContent = handlerContent.replace(pattern, (_, p1, p2, p3) => {
32888
+ return `${p1}${path_1.join(locationPrefix, p2)}${p3}`;
32889
+ });
32890
+ if (newContent !== handlerContent) {
32891
+ _1.debug(`Replaced "${pattern}" inside "${entry}" to ensure correct import of user-provided request handler`);
32892
+ handlerContent = newContent;
32893
+ replacedMatch = true;
32894
+ }
32895
+ }
32896
+ if (!replacedMatch) {
32897
+ new Error(`No replacable matches for "${importPaths[0]}" or "${importPaths[1]}" found in "${fsPath}"`);
32898
+ }
32899
+ await fs_extra_1.default.writeFile(entry, handlerContent, encoding);
32900
+ }
32901
+ else {
32902
+ await fs_extra_1.default.copy(handlerFile.fsPath, entry);
32903
+ }
32904
+ // Legacy Runtimes based on interpreted languages will create a new launcher file
32905
+ // for every entrypoint, but they will create each one inside `workPath`, which means that
32906
+ // the launcher for one entrypoint will overwrite the launcher provided for the previous
32907
+ // entrypoint. That's why, above, we copy the file contents into the new destination (and
32908
+ // optionally transform them along the way), instead of linking. We then also want to remove
32909
+ // the copy origin right here, so that the `workPath` doesn't contain a useless launcher file
32910
+ // once the build has finished running.
32911
+ await fs_extra_1.default.remove(handlerFile.fsPath);
32912
+ _1.debug(`Removed temporary file "${handlerFile.fsPath}"`);
32913
+ const nft = `${entry}.nft.json`;
32914
+ const json = JSON.stringify({
32915
+ version: 2,
32916
+ files: Object.keys(lambdaFiles)
32917
+ .map(file => {
32918
+ const { fsPath } = lambdaFiles[file];
32919
+ if (!fsPath) {
32920
+ throw new Error(`File "${file}" is missing valid \`fsPath\` property`);
32921
+ }
32922
+ // The handler was already moved into position above.
32923
+ if (file === handlerFileBase) {
32924
+ return;
32925
+ }
32926
+ return normalize_path_1.normalizePath(path_1.relative(path_1.dirname(nft), fsPath));
32927
+ })
32928
+ .filter(Boolean),
32929
+ });
32930
+ await fs_extra_1.default.writeFile(nft, json);
32931
+ // Add an entry that will later on be added to the `functions-manifest.json`
32932
+ // file that is placed inside of the `.output` directory.
32933
+ pages[normalize_path_1.normalizePath(entryPath)] = {
32934
+ // Because the underlying file used as a handler was placed
32935
+ // inside `.output/server/pages/api`, it no longer has the name it originally
32936
+ // had and is now named after the API Route that it's responsible for,
32937
+ // so we have to adjust the name of the Lambda handler accordingly.
32938
+ handler: handler.replace(handlerFileName, path_1.parse(entry).name),
32939
+ runtime: output.runtime,
32940
+ memory: output.memory,
32941
+ maxDuration: output.maxDuration,
32942
+ environment: output.environment,
32943
+ allowQuery: output.allowQuery,
32944
+ };
32945
+ }
32946
+ // Add any Serverless Functions that were exposed by the Legacy Runtime
32947
+ // to the `functions-manifest.json` file provided in `.output`.
32948
+ await _experimental_updateFunctionsManifest({ workPath, pages });
32949
+ };
32950
+ }
32951
+ exports._experimental_convertRuntimeToPlugin = _experimental_convertRuntimeToPlugin;
32952
+ async function readJson(filePath) {
32953
+ try {
32954
+ const str = await fs_extra_1.default.readFile(filePath, 'utf8');
32955
+ return JSON.parse(str);
32956
+ }
32957
+ catch (err) {
32958
+ if (err.code === 'ENOENT') {
32959
+ return {};
32960
+ }
32961
+ throw err;
32962
+ }
32963
+ }
32964
+ /**
32965
+ * If `.output/functions-manifest.json` exists, append to the pages
32966
+ * property. Otherwise write a new file.
32967
+ */
32968
+ async function _experimental_updateFunctionsManifest({ workPath, pages, }) {
32969
+ const functionsManifestPath = path_1.join(workPath, '.output', 'functions-manifest.json');
32970
+ const functionsManifest = await readJson(functionsManifestPath);
32971
+ if (!functionsManifest.version)
32972
+ functionsManifest.version = 2;
32973
+ if (!functionsManifest.pages)
32974
+ functionsManifest.pages = {};
32975
+ for (const [pageKey, pageConfig] of Object.entries(pages)) {
32976
+ functionsManifest.pages[pageKey] = { ...pageConfig };
32977
+ }
32978
+ await fs_extra_1.default.writeFile(functionsManifestPath, JSON.stringify(functionsManifest));
32979
+ }
32980
+ exports._experimental_updateFunctionsManifest = _experimental_updateFunctionsManifest;
32981
+ /**
32982
+ * Append routes to the `routes-manifest.json` file.
32983
+ * If the file does not exist, it will be created.
32984
+ */
32985
+ async function _experimental_updateRoutesManifest({ workPath, redirects, rewrites, headers, dynamicRoutes, staticRoutes, }) {
32986
+ const routesManifestPath = path_1.join(workPath, '.output', 'routes-manifest.json');
32987
+ const routesManifest = await readJson(routesManifestPath);
32988
+ if (!routesManifest.version)
32989
+ routesManifest.version = 3;
32990
+ if (routesManifest.pages404 === undefined)
32991
+ routesManifest.pages404 = true;
32992
+ if (redirects) {
32993
+ if (!routesManifest.redirects)
32994
+ routesManifest.redirects = [];
32995
+ routesManifest.redirects.push(...redirects);
32996
+ }
32997
+ if (rewrites) {
32998
+ if (!routesManifest.rewrites)
32999
+ routesManifest.rewrites = [];
33000
+ routesManifest.rewrites.push(...rewrites);
33001
+ }
33002
+ if (headers) {
33003
+ if (!routesManifest.headers)
33004
+ routesManifest.headers = [];
33005
+ routesManifest.headers.push(...headers);
33006
+ }
33007
+ if (dynamicRoutes) {
33008
+ if (!routesManifest.dynamicRoutes)
33009
+ routesManifest.dynamicRoutes = [];
33010
+ routesManifest.dynamicRoutes.push(...dynamicRoutes);
33011
+ }
33012
+ if (staticRoutes) {
33013
+ if (!routesManifest.staticRoutes)
33014
+ routesManifest.staticRoutes = [];
33015
+ routesManifest.staticRoutes.push(...staticRoutes);
33016
+ }
33017
+ await fs_extra_1.default.writeFile(routesManifestPath, JSON.stringify(routesManifest));
33018
+ }
33019
+ exports._experimental_updateRoutesManifest = _experimental_updateRoutesManifest;
33020
+
33021
+
31956
33022
  /***/ }),
31957
33023
 
31958
33024
  /***/ 1868:
@@ -32044,6 +33110,7 @@ async function detectBuilders(files, pkg, options = {}) {
32044
33110
  redirectRoutes: null,
32045
33111
  rewriteRoutes: null,
32046
33112
  errorRoutes: null,
33113
+ limitedRoutes: null,
32047
33114
  };
32048
33115
  }
32049
33116
  const sortedFiles = files.sort(sortFiles);
@@ -32091,6 +33158,7 @@ async function detectBuilders(files, pkg, options = {}) {
32091
33158
  redirectRoutes: null,
32092
33159
  rewriteRoutes: null,
32093
33160
  errorRoutes: null,
33161
+ limitedRoutes: null,
32094
33162
  };
32095
33163
  }
32096
33164
  if (apiRoute) {
@@ -32145,6 +33213,7 @@ async function detectBuilders(files, pkg, options = {}) {
32145
33213
  defaultRoutes: null,
32146
33214
  rewriteRoutes: null,
32147
33215
  errorRoutes: null,
33216
+ limitedRoutes: null,
32148
33217
  };
32149
33218
  }
32150
33219
  // If `outputDirectory` is an empty string,
@@ -32181,6 +33250,7 @@ async function detectBuilders(files, pkg, options = {}) {
32181
33250
  defaultRoutes: null,
32182
33251
  rewriteRoutes: null,
32183
33252
  errorRoutes: null,
33253
+ limitedRoutes: null,
32184
33254
  };
32185
33255
  }
32186
33256
  const builders = [];
@@ -32199,7 +33269,7 @@ async function detectBuilders(files, pkg, options = {}) {
32199
33269
  });
32200
33270
  }
32201
33271
  }
32202
- const routesResult = getRouteResult(apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
33272
+ const routesResult = getRouteResult(pkg, apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
32203
33273
  return {
32204
33274
  warnings,
32205
33275
  builders: builders.length ? builders : null,
@@ -32208,6 +33278,7 @@ async function detectBuilders(files, pkg, options = {}) {
32208
33278
  defaultRoutes: routesResult.defaultRoutes,
32209
33279
  rewriteRoutes: routesResult.rewriteRoutes,
32210
33280
  errorRoutes: routesResult.errorRoutes,
33281
+ limitedRoutes: routesResult.limitedRoutes,
32211
33282
  };
32212
33283
  }
32213
33284
  exports.detectBuilders = detectBuilders;
@@ -32648,23 +33719,51 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
32648
33719
  }
32649
33720
  return { route, isDynamic };
32650
33721
  }
32651
- function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
33722
+ function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
32652
33723
  var _a, _b;
33724
+ const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
32653
33725
  const defaultRoutes = [];
32654
33726
  const redirectRoutes = [];
32655
33727
  const rewriteRoutes = [];
32656
33728
  const errorRoutes = [];
33729
+ const limitedRoutes = {
33730
+ defaultRoutes: [],
33731
+ redirectRoutes: [],
33732
+ rewriteRoutes: [],
33733
+ };
32657
33734
  const framework = ((_a = frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) === null || _a === void 0 ? void 0 : _a.framework) || '';
32658
33735
  const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.use);
32659
33736
  const ignoreRuntimes = (_b = slugToFramework.get(framework)) === null || _b === void 0 ? void 0 : _b.ignoreRuntimes;
32660
33737
  if (apiRoutes && apiRoutes.length > 0) {
32661
33738
  if (options.featHandleMiss) {
33739
+ // Exclude extension names if the corresponding plugin is not found in package.json
33740
+ // detectBuilders({ignoreRoutesForBuilders: ['@vercel/python']})
33741
+ // return a copy of routes.
33742
+ // We should exclud errorRoutes and
32662
33743
  const extSet = detectApiExtensions(apiBuilders);
33744
+ const withTag = options.tag ? `@${options.tag}` : '';
33745
+ const extSetLimited = detectApiExtensions(apiBuilders.filter(b => {
33746
+ if (b.use === `@vercel/python${withTag}` &&
33747
+ !('vercel-plugin-python' in deps)) {
33748
+ return false;
33749
+ }
33750
+ if (b.use === `@vercel/go${withTag}` &&
33751
+ !('vercel-plugin-go' in deps)) {
33752
+ return false;
33753
+ }
33754
+ if (b.use === `@vercel/ruby${withTag}` &&
33755
+ !('vercel-plugin-ruby' in deps)) {
33756
+ return false;
33757
+ }
33758
+ return true;
33759
+ }));
32663
33760
  if (extSet.size > 0) {
32664
- const exts = Array.from(extSet)
33761
+ const extGroup = `(?:\\.(?:${Array.from(extSet)
33762
+ .map(ext => ext.slice(1))
33763
+ .join('|')}))`;
33764
+ const extGroupLimited = `(?:\\.(?:${Array.from(extSetLimited)
32665
33765
  .map(ext => ext.slice(1))
32666
- .join('|');
32667
- const extGroup = `(?:\\.(?:${exts}))`;
33766
+ .join('|')}))`;
32668
33767
  if (options.cleanUrls) {
32669
33768
  redirectRoutes.push({
32670
33769
  src: `^/(api(?:.+)?)/index${extGroup}?/?$`,
@@ -32678,6 +33777,18 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
32678
33777
  },
32679
33778
  status: 308,
32680
33779
  });
33780
+ limitedRoutes.redirectRoutes.push({
33781
+ src: `^/(api(?:.+)?)/index${extGroupLimited}?/?$`,
33782
+ headers: { Location: options.trailingSlash ? '/$1/' : '/$1' },
33783
+ status: 308,
33784
+ });
33785
+ limitedRoutes.redirectRoutes.push({
33786
+ src: `^/api/(.+)${extGroupLimited}/?$`,
33787
+ headers: {
33788
+ Location: options.trailingSlash ? '/api/$1/' : '/api/$1',
33789
+ },
33790
+ status: 308,
33791
+ });
32681
33792
  }
32682
33793
  else {
32683
33794
  defaultRoutes.push({ handle: 'miss' });
@@ -32686,9 +33797,16 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
32686
33797
  dest: '/api/$1',
32687
33798
  check: true,
32688
33799
  });
33800
+ limitedRoutes.defaultRoutes.push({ handle: 'miss' });
33801
+ limitedRoutes.defaultRoutes.push({
33802
+ src: `^/api/(.+)${extGroupLimited}$`,
33803
+ dest: '/api/$1',
33804
+ check: true,
33805
+ });
32689
33806
  }
32690
33807
  }
32691
33808
  rewriteRoutes.push(...dynamicRoutes);
33809
+ limitedRoutes.rewriteRoutes.push(...dynamicRoutes);
32692
33810
  if (typeof ignoreRuntimes === 'undefined') {
32693
33811
  // This route is only necessary to hide the directory listing
32694
33812
  // to avoid enumerating serverless function names.
@@ -32733,6 +33851,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
32733
33851
  redirectRoutes,
32734
33852
  rewriteRoutes,
32735
33853
  errorRoutes,
33854
+ limitedRoutes,
32736
33855
  };
32737
33856
  }
32738
33857
  function sortFilesBySegmentCount(fileA, fileB) {
@@ -32759,6 +33878,187 @@ function sortFilesBySegmentCount(fileA, fileB) {
32759
33878
  }
32760
33879
 
32761
33880
 
33881
+ /***/ }),
33882
+
33883
+ /***/ 1182:
33884
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
33885
+
33886
+ "use strict";
33887
+
33888
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33889
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33890
+ };
33891
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33892
+ exports.detectFileSystemAPI = void 0;
33893
+ const semver_1 = __importDefault(__webpack_require__(2879));
33894
+ const _1 = __webpack_require__(2855);
33895
+ const enableFileSystemApiFrameworks = new Set(['solidstart']);
33896
+ /**
33897
+ * If the Deployment can be built with the new File System API,
33898
+ * return the new Builder. Otherwise an "Exclusion Condition"
33899
+ * was hit so return `null` builder with a `reason` for exclusion.
33900
+ */
33901
+ async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
33902
+ const framework = projectSettings.framework || '';
33903
+ const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
33904
+ const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
33905
+ const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
33906
+ const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
33907
+ const metadata = {
33908
+ plugins,
33909
+ hasDotOutput,
33910
+ hasMiddleware,
33911
+ };
33912
+ const isEnabled = enableFlag ||
33913
+ hasMiddleware ||
33914
+ hasDotOutput ||
33915
+ enableFileSystemApiFrameworks.has(framework);
33916
+ if (!isEnabled) {
33917
+ return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
33918
+ }
33919
+ if ((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.builds) && vercelConfig.builds.length > 0) {
33920
+ return {
33921
+ metadata,
33922
+ fsApiBuilder: null,
33923
+ reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
33924
+ };
33925
+ }
33926
+ if (Object.values((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.functions) || {}).some(fn => !!fn.runtime)) {
33927
+ return {
33928
+ metadata,
33929
+ fsApiBuilder: null,
33930
+ reason: 'Detected `functions.runtime` in vercel.json. Please remove it in favor of CLI plugins.',
33931
+ };
33932
+ }
33933
+ if (process.env.HUGO_VERSION) {
33934
+ return {
33935
+ metadata,
33936
+ fsApiBuilder: null,
33937
+ reason: 'Detected `HUGO_VERSION` environment variable. Please remove it.',
33938
+ };
33939
+ }
33940
+ if (process.env.ZOLA_VERSION) {
33941
+ return {
33942
+ metadata,
33943
+ fsApiBuilder: null,
33944
+ reason: 'Detected `ZOLA_VERSION` environment variable. Please remove it.',
33945
+ };
33946
+ }
33947
+ if (process.env.GUTENBERG_VERSION) {
33948
+ return {
33949
+ metadata,
33950
+ fsApiBuilder: null,
33951
+ reason: 'Detected `GUTENBERG_VERSION` environment variable. Please remove it.',
33952
+ };
33953
+ }
33954
+ const invalidBuilder = builders.find(({ use }) => {
33955
+ const valid = _1.isOfficialRuntime('go', use) ||
33956
+ _1.isOfficialRuntime('python', use) ||
33957
+ _1.isOfficialRuntime('ruby', use) ||
33958
+ _1.isOfficialRuntime('node', use) ||
33959
+ _1.isOfficialRuntime('next', use) ||
33960
+ _1.isOfficialRuntime('static', use) ||
33961
+ _1.isOfficialRuntime('static-build', use);
33962
+ return !valid;
33963
+ });
33964
+ if (invalidBuilder) {
33965
+ return {
33966
+ metadata,
33967
+ fsApiBuilder: null,
33968
+ reason: `Detected \`${invalidBuilder.use}\` in vercel.json. Please remove it in favor of CLI plugins.`,
33969
+ };
33970
+ }
33971
+ for (const lang of ['go', 'python', 'ruby']) {
33972
+ for (const { use } of builders) {
33973
+ const plugin = 'vercel-plugin-' + lang;
33974
+ if (_1.isOfficialRuntime(lang, use) && !deps[plugin]) {
33975
+ return {
33976
+ metadata,
33977
+ fsApiBuilder: null,
33978
+ reason: `Detected \`${lang}\` Serverless Function usage without plugin \`${plugin}\`. Please run \`npm i ${plugin}\`.`,
33979
+ };
33980
+ }
33981
+ }
33982
+ }
33983
+ if (framework === 'nuxtjs' ||
33984
+ framework === 'sveltekit' ||
33985
+ framework === 'redwoodjs') {
33986
+ return {
33987
+ metadata,
33988
+ fsApiBuilder: null,
33989
+ reason: `Detected framework \`${framework}\` that only supports legacy File System API. Please contact the framework author.`,
33990
+ };
33991
+ }
33992
+ if (framework === 'nextjs' && !hasDotOutput) {
33993
+ // Use the old pipeline if a custom output directory was specified for Next.js
33994
+ // because `vercel build` cannot ensure that the directory will be in the same
33995
+ // location as `.output`, which can break imports (not just nft.json files).
33996
+ if (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.outputDirectory) {
33997
+ return {
33998
+ metadata,
33999
+ fsApiBuilder: null,
34000
+ reason: `Detected Next.js with Output Directory \`${projectSettings.outputDirectory}\` override. Please change it back to the default.`,
34001
+ };
34002
+ }
34003
+ const nextVersion = deps['next'];
34004
+ if (!nextVersion) {
34005
+ return {
34006
+ metadata,
34007
+ fsApiBuilder: null,
34008
+ reason: `Detected Next.js in Project Settings but missing \`next\` package.json dependencies. Please run \`npm i next\`.`,
34009
+ };
34010
+ }
34011
+ // TODO: Read version from lockfile instead of package.json
34012
+ if (nextVersion !== 'latest' && nextVersion !== 'canary') {
34013
+ const fixedVersion = semver_1.default.valid(semver_1.default.coerce(nextVersion) || '');
34014
+ if (!fixedVersion || !semver_1.default.gte(fixedVersion, '12.0.0')) {
34015
+ return {
34016
+ metadata,
34017
+ fsApiBuilder: null,
34018
+ reason: `Detected legacy Next.js version "${nextVersion}" in package.json. Please run \`npm i next@latest\` to upgrade.`,
34019
+ };
34020
+ }
34021
+ }
34022
+ }
34023
+ if (!hasDotOutput) {
34024
+ // TODO: Read version from lockfile instead of package.json
34025
+ const vercelCliVersion = deps['vercel'];
34026
+ if (vercelCliVersion &&
34027
+ vercelCliVersion !== 'latest' &&
34028
+ vercelCliVersion !== 'canary') {
34029
+ const fixedVersion = semver_1.default.valid(semver_1.default.coerce(vercelCliVersion) || '');
34030
+ // TODO: we might want to use '24.0.0' once its released
34031
+ if (!fixedVersion || !semver_1.default.gte(fixedVersion, '23.1.3-canary.68')) {
34032
+ return {
34033
+ metadata,
34034
+ fsApiBuilder: null,
34035
+ reason: `Detected legacy Vercel CLI version "${vercelCliVersion}" in package.json. Please run \`npm i vercel@latest\` to upgrade.`,
34036
+ };
34037
+ }
34038
+ }
34039
+ }
34040
+ const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
34041
+ _1.isOfficialRuntime('static', use) ||
34042
+ _1.isOfficialRuntime('static-build', use));
34043
+ const config = (frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) || {};
34044
+ const withTag = tag ? `@${tag}` : '';
34045
+ const fsApiBuilder = {
34046
+ use: `@vercelruntimes/file-system-api${withTag}`,
34047
+ src: '**',
34048
+ config: {
34049
+ ...config,
34050
+ fileSystemAPI: true,
34051
+ framework: config.framework || framework || null,
34052
+ projectSettings,
34053
+ hasMiddleware,
34054
+ hasDotOutput,
34055
+ },
34056
+ };
34057
+ return { metadata, fsApiBuilder, reason: null };
34058
+ }
34059
+ exports.detectFileSystemAPI = detectFileSystemAPI;
34060
+
34061
+
32762
34062
  /***/ }),
32763
34063
 
32764
34064
  /***/ 5224:
@@ -33311,6 +34611,7 @@ const assert_1 = __importDefault(__webpack_require__(2357));
33311
34611
  const glob_1 = __importDefault(__webpack_require__(1104));
33312
34612
  const util_1 = __webpack_require__(1669);
33313
34613
  const fs_extra_1 = __webpack_require__(5392);
34614
+ const normalize_path_1 = __webpack_require__(6261);
33314
34615
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
33315
34616
  const vanillaGlob = util_1.promisify(glob_1.default);
33316
34617
  async function glob(pattern, opts, mountpoint) {
@@ -33334,7 +34635,7 @@ async function glob(pattern, opts, mountpoint) {
33334
34635
  options.dot = true;
33335
34636
  const files = await vanillaGlob(pattern, options);
33336
34637
  for (const relativePath of files) {
33337
- const fsPath = path_1.default.join(options.cwd, relativePath).replace(/\\/g, '/');
34638
+ const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath));
33338
34639
  let stat = options.statCache[fsPath];
33339
34640
  assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
33340
34641
  const isSymlink = options.symlinks[fsPath];
@@ -33440,6 +34741,25 @@ function isDiscontinued({ discontinueDate }) {
33440
34741
  }
33441
34742
 
33442
34743
 
34744
+ /***/ }),
34745
+
34746
+ /***/ 6261:
34747
+ /***/ ((__unused_webpack_module, exports) => {
34748
+
34749
+ "use strict";
34750
+
34751
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34752
+ exports.normalizePath = void 0;
34753
+ const isWin = process.platform === 'win32';
34754
+ /**
34755
+ * Convert Windows separators to Unix separators.
34756
+ */
34757
+ function normalizePath(p) {
34758
+ return isWin ? p.replace(/\\/g, '/') : p;
34759
+ }
34760
+ exports.normalizePath = normalizePath;
34761
+
34762
+
33443
34763
  /***/ }),
33444
34764
 
33445
34765
  /***/ 7792:
@@ -33870,6 +35190,73 @@ function streamToBuffer(stream) {
33870
35190
  exports.default = streamToBuffer;
33871
35191
 
33872
35192
 
35193
+ /***/ }),
35194
+
35195
+ /***/ 1148:
35196
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
35197
+
35198
+ "use strict";
35199
+
35200
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35201
+ return (mod && mod.__esModule) ? mod : { "default": mod };
35202
+ };
35203
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35204
+ const path_1 = __importDefault(__webpack_require__(5622));
35205
+ const fs_extra_1 = __importDefault(__webpack_require__(5392));
35206
+ const ignore_1 = __importDefault(__webpack_require__(3556));
35207
+ function isCodedError(error) {
35208
+ return (error !== null &&
35209
+ error !== undefined &&
35210
+ error.code !== undefined);
35211
+ }
35212
+ function clearRelative(s) {
35213
+ return s.replace(/(\n|^)\.\//g, '$1');
35214
+ }
35215
+ async function default_1(downloadPath, rootDirectory) {
35216
+ const readFile = async (p) => {
35217
+ try {
35218
+ return await fs_extra_1.default.readFile(p, 'utf8');
35219
+ }
35220
+ catch (error) {
35221
+ if (error.code === 'ENOENT' ||
35222
+ (error instanceof Error && error.message.includes('ENOENT'))) {
35223
+ return undefined;
35224
+ }
35225
+ throw error;
35226
+ }
35227
+ };
35228
+ const vercelIgnorePath = path_1.default.join(downloadPath, rootDirectory || '', '.vercelignore');
35229
+ const nowIgnorePath = path_1.default.join(downloadPath, rootDirectory || '', '.nowignore');
35230
+ const ignoreContents = [];
35231
+ try {
35232
+ ignoreContents.push(...(await Promise.all([readFile(vercelIgnorePath), readFile(nowIgnorePath)])).filter(Boolean));
35233
+ }
35234
+ catch (error) {
35235
+ if (isCodedError(error) && error.code === 'ENOTDIR') {
35236
+ console.log(`Warning: Cannot read ignore file from ${vercelIgnorePath}`);
35237
+ }
35238
+ else {
35239
+ throw error;
35240
+ }
35241
+ }
35242
+ if (ignoreContents.length === 2) {
35243
+ throw new Error('Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.');
35244
+ }
35245
+ if (ignoreContents.length === 0) {
35246
+ return () => false;
35247
+ }
35248
+ const ignoreFilter = ignore_1.default().add(clearRelative(ignoreContents[0]));
35249
+ return function (p) {
35250
+ // we should not ignore now.json and vercel.json if it asked to.
35251
+ // we depend on these files for building the app with sourceless
35252
+ if (p === 'now.json' || p === 'vercel.json')
35253
+ return false;
35254
+ return ignoreFilter.test(p).ignored;
35255
+ };
35256
+ }
35257
+ exports.default = default_1;
35258
+
35259
+
33873
35260
  /***/ }),
33874
35261
 
33875
35262
  /***/ 2855:
@@ -33903,7 +35290,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33903
35290
  return (mod && mod.__esModule) ? mod : { "default": mod };
33904
35291
  };
33905
35292
  Object.defineProperty(exports, "__esModule", ({ value: true }));
33906
- 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;
35293
+ exports.getPlatformEnv = exports.isStaticRuntime = exports.isOfficialRuntime = exports._experimental_updateRoutesManifest = exports._experimental_updateFunctionsManifest = exports._experimental_convertRuntimeToPlugin = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.getIgnoreFilter = 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;
33907
35294
  const file_blob_1 = __importDefault(__webpack_require__(2397));
33908
35295
  exports.FileBlob = file_blob_1.default;
33909
35296
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -33952,17 +35339,27 @@ const should_serve_1 = __importDefault(__webpack_require__(2564));
33952
35339
  exports.shouldServe = should_serve_1.default;
33953
35340
  const debug_1 = __importDefault(__webpack_require__(1868));
33954
35341
  exports.debug = debug_1.default;
35342
+ const get_ignore_filter_1 = __importDefault(__webpack_require__(1148));
35343
+ exports.getIgnoreFilter = get_ignore_filter_1.default;
33955
35344
  var detect_builders_1 = __webpack_require__(4246);
33956
35345
  Object.defineProperty(exports, "detectBuilders", ({ enumerable: true, get: function () { return detect_builders_1.detectBuilders; } }));
33957
35346
  Object.defineProperty(exports, "detectOutputDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectOutputDirectory; } }));
33958
35347
  Object.defineProperty(exports, "detectApiDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectApiDirectory; } }));
33959
35348
  Object.defineProperty(exports, "detectApiExtensions", ({ enumerable: true, get: function () { return detect_builders_1.detectApiExtensions; } }));
35349
+ var detect_file_system_api_1 = __webpack_require__(1182);
35350
+ Object.defineProperty(exports, "detectFileSystemAPI", ({ enumerable: true, get: function () { return detect_file_system_api_1.detectFileSystemAPI; } }));
33960
35351
  var detect_framework_1 = __webpack_require__(5224);
33961
35352
  Object.defineProperty(exports, "detectFramework", ({ enumerable: true, get: function () { return detect_framework_1.detectFramework; } }));
33962
35353
  var filesystem_1 = __webpack_require__(461);
33963
35354
  Object.defineProperty(exports, "DetectorFilesystem", ({ enumerable: true, get: function () { return filesystem_1.DetectorFilesystem; } }));
33964
35355
  var read_config_file_1 = __webpack_require__(7792);
33965
35356
  Object.defineProperty(exports, "readConfigFile", ({ enumerable: true, get: function () { return read_config_file_1.readConfigFile; } }));
35357
+ var normalize_path_1 = __webpack_require__(6261);
35358
+ Object.defineProperty(exports, "normalizePath", ({ enumerable: true, get: function () { return normalize_path_1.normalizePath; } }));
35359
+ var convert_runtime_to_plugin_1 = __webpack_require__(7276);
35360
+ Object.defineProperty(exports, "_experimental_convertRuntimeToPlugin", ({ enumerable: true, get: function () { return convert_runtime_to_plugin_1._experimental_convertRuntimeToPlugin; } }));
35361
+ Object.defineProperty(exports, "_experimental_updateFunctionsManifest", ({ enumerable: true, get: function () { return convert_runtime_to_plugin_1._experimental_updateFunctionsManifest; } }));
35362
+ Object.defineProperty(exports, "_experimental_updateRoutesManifest", ({ enumerable: true, get: function () { return convert_runtime_to_plugin_1._experimental_updateRoutesManifest; } }));
33966
35363
  __exportStar(__webpack_require__(2416), exports);
33967
35364
  __exportStar(__webpack_require__(5748), exports);
33968
35365
  __exportStar(__webpack_require__(3983), exports);
@@ -34018,7 +35415,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34018
35415
  return (mod && mod.__esModule) ? mod : { "default": mod };
34019
35416
  };
34020
35417
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34021
- exports.getLambdaOptionsFromFunction = exports.createZip = exports.createLambda = exports.Lambda = void 0;
35418
+ exports.getLambdaOptionsFromFunction = exports.createZip = exports.createLambda = exports.Lambda = exports.FILES_SYMBOL = void 0;
34022
35419
  const assert_1 = __importDefault(__webpack_require__(2357));
34023
35420
  const async_sema_1 = __importDefault(__webpack_require__(5758));
34024
35421
  const yazl_1 = __webpack_require__(1223);
@@ -34026,8 +35423,9 @@ const minimatch_1 = __importDefault(__webpack_require__(9566));
34026
35423
  const fs_extra_1 = __webpack_require__(5392);
34027
35424
  const download_1 = __webpack_require__(1611);
34028
35425
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
35426
+ exports.FILES_SYMBOL = Symbol('files');
34029
35427
  class Lambda {
34030
- constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, }) {
35428
+ constructor({ zipBuffer, handler, runtime, maxDuration, memory, environment, allowQuery, regions, }) {
34031
35429
  this.type = 'Lambda';
34032
35430
  this.zipBuffer = zipBuffer;
34033
35431
  this.handler = handler;
@@ -34036,12 +35434,13 @@ class Lambda {
34036
35434
  this.maxDuration = maxDuration;
34037
35435
  this.environment = environment;
34038
35436
  this.allowQuery = allowQuery;
35437
+ this.regions = regions;
34039
35438
  }
34040
35439
  }
34041
35440
  exports.Lambda = Lambda;
34042
35441
  const sema = new async_sema_1.default(10);
34043
35442
  const mtime = new Date(1540000000000);
34044
- async function createLambda({ files, handler, runtime, memory, maxDuration, environment = {}, allowQuery, }) {
35443
+ async function createLambda({ files, handler, runtime, memory, maxDuration, environment = {}, allowQuery, regions, }) {
34045
35444
  assert_1.default(typeof files === 'object', '"files" must be an object');
34046
35445
  assert_1.default(typeof handler === 'string', '"handler" is not a string');
34047
35446
  assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
@@ -34056,17 +35455,25 @@ async function createLambda({ files, handler, runtime, memory, maxDuration, envi
34056
35455
  assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
34057
35456
  assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
34058
35457
  }
35458
+ if (regions !== undefined) {
35459
+ assert_1.default(Array.isArray(regions), '"regions" is not an Array');
35460
+ assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
35461
+ }
34059
35462
  await sema.acquire();
34060
35463
  try {
34061
35464
  const zipBuffer = await createZip(files);
34062
- return new Lambda({
35465
+ const lambda = new Lambda({
34063
35466
  zipBuffer,
34064
35467
  handler,
34065
35468
  runtime,
34066
35469
  memory,
34067
35470
  maxDuration,
34068
35471
  environment,
35472
+ regions,
34069
35473
  });
35474
+ // @ts-ignore This symbol is a private API
35475
+ lambda[exports.FILES_SYMBOL] = files;
35476
+ return lambda;
34070
35477
  }
34071
35478
  finally {
34072
35479
  sema.release();