@vercel/build-utils 2.15.2-canary.3 → 2.15.2-canary.6
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/fs/node-version.js +0 -3
- package/dist/fs/run-user-scripts.js +4 -0
- package/dist/index.js +440 -191
- package/package.json +6 -6
package/dist/fs/node-version.js
CHANGED
@@ -40,9 +40,6 @@ function getDiscontinuedNodeVersions() {
|
|
40
40
|
exports.getDiscontinuedNodeVersions = getDiscontinuedNodeVersions;
|
41
41
|
async function getSupportedNodeVersion(engineRange, isAuto = false) {
|
42
42
|
let selection = getLatestNodeVersion();
|
43
|
-
if (process.env.ENABLE_EXPERIMENTAL_NODE16 === '1') {
|
44
|
-
return { major: 16, range: '16.x', runtime: 'nodejs16.x' };
|
45
|
-
}
|
46
43
|
if (engineRange) {
|
47
44
|
const found = semver_1.validRange(engineRange) &&
|
48
45
|
allOptions.some(o => {
|
@@ -136,6 +136,10 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
|
136
136
|
const latest = node_version_1.getLatestNodeVersion();
|
137
137
|
return { ...latest, runtime: 'nodejs' };
|
138
138
|
}
|
139
|
+
if (process.env.ENABLE_EXPERIMENTAL_NODE16 === '1') {
|
140
|
+
console.warn('Warning: Using experimental Node.js 16.x due to ENABLE_EXPERIMENTAL_NODE16=1');
|
141
|
+
return { major: 16, range: '16.x', runtime: 'nodejs16.x' };
|
142
|
+
}
|
139
143
|
const { packageJson } = await scanParentDirs(destPath, true);
|
140
144
|
let { nodeVersion } = config;
|
141
145
|
let isAuto = true;
|
package/dist/index.js
CHANGED
@@ -7663,15 +7663,26 @@ IconvLiteDecoderStream.prototype.collect = function(cb) {
|
|
7663
7663
|
/***/ ((module) => {
|
7664
7664
|
|
7665
7665
|
// A simple implementation of make-array
|
7666
|
-
function
|
7666
|
+
function makeArray (subject) {
|
7667
7667
|
return Array.isArray(subject)
|
7668
7668
|
? subject
|
7669
7669
|
: [subject]
|
7670
7670
|
}
|
7671
7671
|
|
7672
|
-
const
|
7673
|
-
const
|
7674
|
-
const
|
7672
|
+
const EMPTY = ''
|
7673
|
+
const SPACE = ' '
|
7674
|
+
const ESCAPE = '\\'
|
7675
|
+
const REGEX_TEST_BLANK_LINE = /^\s+$/
|
7676
|
+
const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
|
7677
|
+
const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
|
7678
|
+
const REGEX_SPLITALL_CRLF = /\r?\n/g
|
7679
|
+
// /foo,
|
7680
|
+
// ./foo,
|
7681
|
+
// ../foo,
|
7682
|
+
// .
|
7683
|
+
// ..
|
7684
|
+
const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
|
7685
|
+
|
7675
7686
|
const SLASH = '/'
|
7676
7687
|
const KEY_IGNORE = typeof Symbol !== 'undefined'
|
7677
7688
|
? Symbol.for('node-ignore')
|
@@ -7683,6 +7694,8 @@ const define = (object, key, value) =>
|
|
7683
7694
|
|
7684
7695
|
const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
|
7685
7696
|
|
7697
|
+
const RETURN_FALSE = () => false
|
7698
|
+
|
7686
7699
|
// Sanitize the range of a regular expression
|
7687
7700
|
// The cases are complicated, see test cases for details
|
7688
7701
|
const sanitizeRange = range => range.replace(
|
@@ -7691,9 +7704,15 @@ const sanitizeRange = range => range.replace(
|
|
7691
7704
|
? match
|
7692
7705
|
// Invalid range (out of order) which is ok for gitignore rules but
|
7693
7706
|
// fatal for JavaScript regular expression, so eliminate it.
|
7694
|
-
:
|
7707
|
+
: EMPTY
|
7695
7708
|
)
|
7696
7709
|
|
7710
|
+
// See fixtures #59
|
7711
|
+
const cleanRangeBackSlash = slashes => {
|
7712
|
+
const {length} = slashes
|
7713
|
+
return slashes.slice(0, length - length % 2)
|
7714
|
+
}
|
7715
|
+
|
7697
7716
|
// > If the pattern ends with a slash,
|
7698
7717
|
// > it is removed for the purpose of the following description,
|
7699
7718
|
// > but it would only find a match with a directory.
|
@@ -7705,7 +7724,7 @@ const sanitizeRange = range => range.replace(
|
|
7705
7724
|
// you could use option `mark: true` with `glob`
|
7706
7725
|
|
7707
7726
|
// '`foo/`' should not continue with the '`..`'
|
7708
|
-
const
|
7727
|
+
const REPLACERS = [
|
7709
7728
|
|
7710
7729
|
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
7711
7730
|
[
|
@@ -7714,14 +7733,14 @@ const DEFAULT_REPLACER_PREFIX = [
|
|
7714
7733
|
// (a \ ) -> (a )
|
7715
7734
|
/\\?\s+$/,
|
7716
7735
|
match => match.indexOf('\\') === 0
|
7717
|
-
?
|
7718
|
-
:
|
7736
|
+
? SPACE
|
7737
|
+
: EMPTY
|
7719
7738
|
],
|
7720
7739
|
|
7721
7740
|
// replace (\ ) with ' '
|
7722
7741
|
[
|
7723
7742
|
/\\\s/g,
|
7724
|
-
() =>
|
7743
|
+
() => SPACE
|
7725
7744
|
],
|
7726
7745
|
|
7727
7746
|
// Escape metacharacters
|
@@ -7742,19 +7761,10 @@ const DEFAULT_REPLACER_PREFIX = [
|
|
7742
7761
|
// > - the opening curly brace {,
|
7743
7762
|
// > These special characters are often called "metacharacters".
|
7744
7763
|
[
|
7745
|
-
/[
|
7764
|
+
/[\\$.|*+(){^]/g,
|
7746
7765
|
match => `\\${match}`
|
7747
7766
|
],
|
7748
7767
|
|
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
7768
|
[
|
7759
7769
|
// > a question mark (?) matches a single character
|
7760
7770
|
/(?!\\)\?/g,
|
@@ -7788,10 +7798,8 @@ const DEFAULT_REPLACER_PREFIX = [
|
|
7788
7798
|
|
7789
7799
|
// '**/foo' <-> 'foo'
|
7790
7800
|
() => '^(?:.*\\/)?'
|
7791
|
-
]
|
7792
|
-
]
|
7801
|
+
],
|
7793
7802
|
|
7794
|
-
const DEFAULT_REPLACER_SUFFIX = [
|
7795
7803
|
// starting
|
7796
7804
|
[
|
7797
7805
|
// there will be no leading '/'
|
@@ -7799,11 +7807,20 @@ const DEFAULT_REPLACER_SUFFIX = [
|
|
7799
7807
|
// If starts with '**', adding a '^' to the regular expression also works
|
7800
7808
|
/^(?=[^^])/,
|
7801
7809
|
function startingReplacer () {
|
7810
|
+
// If has a slash `/` at the beginning or middle
|
7802
7811
|
return !/\/(?!$)/.test(this)
|
7812
|
+
// > Prior to 2.22.1
|
7803
7813
|
// > If the pattern does not contain a slash /,
|
7804
7814
|
// > Git treats it as a shell glob pattern
|
7805
7815
|
// Actually, if there is only a trailing slash,
|
7806
7816
|
// git also treats it as a shell glob pattern
|
7817
|
+
|
7818
|
+
// After 2.22.1 (compatible but clearer)
|
7819
|
+
// > If there is a separator at the beginning or middle (or both)
|
7820
|
+
// > of the pattern, then the pattern is relative to the directory
|
7821
|
+
// > level of the particular .gitignore file itself.
|
7822
|
+
// > Otherwise the pattern may also match at any level below
|
7823
|
+
// > the .gitignore level.
|
7807
7824
|
? '(?:^|\\/)'
|
7808
7825
|
|
7809
7826
|
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
@@ -7821,7 +7838,7 @@ const DEFAULT_REPLACER_SUFFIX = [
|
|
7821
7838
|
// should not use '*', or it will be replaced by the next replacer
|
7822
7839
|
|
7823
7840
|
// Check if it is not the last `'/**'`
|
7824
|
-
(
|
7841
|
+
(_, index, str) => index + 6 < str.length
|
7825
7842
|
|
7826
7843
|
// case: /**/
|
7827
7844
|
// > A slash followed by two consecutive asterisks then a slash matches
|
@@ -7848,119 +7865,138 @@ const DEFAULT_REPLACER_SUFFIX = [
|
|
7848
7865
|
|
7849
7866
|
// '*.js' matches '.js'
|
7850
7867
|
// '*.js' doesn't match 'abc'
|
7851
|
-
(
|
7868
|
+
(_, p1) => `${p1}[^\\/]*`
|
7852
7869
|
],
|
7853
7870
|
|
7854
|
-
// trailing wildcard
|
7855
7871
|
[
|
7856
|
-
|
7857
|
-
|
7858
|
-
|
7859
|
-
|
7860
|
-
|
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
|
-
}
|
7872
|
+
// unescape, revert step 3 except for back slash
|
7873
|
+
// For example, if a user escape a '\\*',
|
7874
|
+
// after step 3, the result will be '\\\\\\*'
|
7875
|
+
/\\\\\\(?=[$.|*+(){^])/g,
|
7876
|
+
() => ESCAPE
|
7873
7877
|
],
|
7874
7878
|
|
7875
7879
|
[
|
7876
|
-
//
|
7877
|
-
|
7878
|
-
() =>
|
7879
|
-
]
|
7880
|
-
]
|
7880
|
+
// '\\\\' -> '\\'
|
7881
|
+
/\\\\/g,
|
7882
|
+
() => ESCAPE
|
7883
|
+
],
|
7881
7884
|
|
7882
|
-
|
7883
|
-
|
7884
|
-
|
7885
|
-
|
7886
|
-
|
7887
|
-
|
7888
|
-
|
7889
|
-
|
7890
|
-
|
7891
|
-
|
7892
|
-
|
7893
|
-
|
7894
|
-
|
7895
|
-
|
7885
|
+
[
|
7886
|
+
// > The range notation, e.g. [a-zA-Z],
|
7887
|
+
// > can be used to match one of the characters in a range.
|
7888
|
+
|
7889
|
+
// `\` is escaped by step 3
|
7890
|
+
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
7891
|
+
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
|
7892
|
+
// '\\[bar]' -> '\\\\[bar\\]'
|
7893
|
+
? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
|
7894
|
+
: close === ']'
|
7895
|
+
? endEscape.length % 2 === 0
|
7896
|
+
// A normal case, and it is a range notation
|
7897
|
+
// '[bar]'
|
7898
|
+
// '[bar\\\\]'
|
7899
|
+
? `[${sanitizeRange(range)}${endEscape}]`
|
7900
|
+
// Invalid range notaton
|
7901
|
+
// '[bar\\]' -> '[bar\\\\]'
|
7902
|
+
: '[]'
|
7903
|
+
: '[]'
|
7904
|
+
],
|
7896
7905
|
|
7897
7906
|
// ending
|
7898
7907
|
[
|
7899
7908
|
// 'js' will not match 'js.'
|
7900
7909
|
// 'ab' will not match 'abc'
|
7901
|
-
/(?:[
|
7910
|
+
/(?:[^*])$/,
|
7911
|
+
|
7912
|
+
// WTF!
|
7913
|
+
// https://git-scm.com/docs/gitignore
|
7914
|
+
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
7915
|
+
// which re-fixes #24, #38
|
7916
|
+
|
7917
|
+
// > If there is a separator at the end of the pattern then the pattern
|
7918
|
+
// > will only match directories, otherwise the pattern can match both
|
7919
|
+
// > files and directories.
|
7902
7920
|
|
7903
7921
|
// 'js*' will not match 'a.js'
|
7904
7922
|
// 'js/' will not match 'a.js'
|
7905
7923
|
// 'js' will match 'a.js' and 'a.js/'
|
7906
|
-
match =>
|
7924
|
+
match => /\/$/.test(match)
|
7925
|
+
// foo/ will not match 'foo'
|
7926
|
+
? `${match}$`
|
7927
|
+
// foo matches 'foo' and 'foo/'
|
7928
|
+
: `${match}(?=$|\\/$)`
|
7907
7929
|
],
|
7908
7930
|
|
7909
|
-
|
7910
|
-
|
7931
|
+
// trailing wildcard
|
7932
|
+
[
|
7933
|
+
/(\^|\\\/)?\\\*$/,
|
7934
|
+
(_, p1) => {
|
7935
|
+
const prefix = p1
|
7936
|
+
// '\^':
|
7937
|
+
// '/*' does not match EMPTY
|
7938
|
+
// '/*' does not match everything
|
7911
7939
|
|
7912
|
-
|
7913
|
-
|
7940
|
+
// '\\\/':
|
7941
|
+
// 'abc/*' does not match 'abc/'
|
7942
|
+
? `${p1}[^/]+`
|
7914
7943
|
|
7915
|
-
|
7916
|
-
|
7917
|
-
|
7918
|
-
// re-include the things inside that directory.
|
7944
|
+
// 'a*' matches 'a'
|
7945
|
+
// 'a*' matches 'aa'
|
7946
|
+
: '[^/]*'
|
7919
7947
|
|
7920
|
-
|
7921
|
-
|
7922
|
-
// should ignore `node_modules/a.js`
|
7923
|
-
[
|
7924
|
-
/(?:[^*])$/,
|
7925
|
-
match => `${match}(?=$|\\/$)`
|
7948
|
+
return `${prefix}(?=$|\\/$)`
|
7949
|
+
}
|
7926
7950
|
],
|
7927
|
-
|
7928
|
-
...DEFAULT_REPLACER_SUFFIX
|
7929
7951
|
]
|
7930
7952
|
|
7931
7953
|
// A simple cache, because an ignore rule only has only one certain meaning
|
7932
|
-
const
|
7954
|
+
const regexCache = Object.create(null)
|
7933
7955
|
|
7934
7956
|
// @param {pattern}
|
7935
|
-
const
|
7936
|
-
|
7937
|
-
if (r) {
|
7938
|
-
return r
|
7939
|
-
}
|
7940
|
-
|
7941
|
-
const replacers = negative
|
7942
|
-
? NEGATIVE_REPLACERS
|
7943
|
-
: POSITIVE_REPLACERS
|
7957
|
+
const makeRegex = (pattern, ignoreCase) => {
|
7958
|
+
let source = regexCache[pattern]
|
7944
7959
|
|
7945
|
-
|
7946
|
-
|
7947
|
-
|
7948
|
-
|
7960
|
+
if (!source) {
|
7961
|
+
source = REPLACERS.reduce(
|
7962
|
+
(prev, current) => prev.replace(current[0], current[1].bind(pattern)),
|
7963
|
+
pattern
|
7964
|
+
)
|
7965
|
+
regexCache[pattern] = source
|
7966
|
+
}
|
7949
7967
|
|
7950
|
-
return
|
7968
|
+
return ignoreCase
|
7951
7969
|
? new RegExp(source, 'i')
|
7952
7970
|
: new RegExp(source)
|
7953
7971
|
}
|
7954
7972
|
|
7973
|
+
const isString = subject => typeof subject === 'string'
|
7974
|
+
|
7955
7975
|
// > A blank line matches no files, so it can serve as a separator for readability.
|
7956
7976
|
const checkPattern = pattern => pattern
|
7957
|
-
&&
|
7958
|
-
&& !
|
7977
|
+
&& isString(pattern)
|
7978
|
+
&& !REGEX_TEST_BLANK_LINE.test(pattern)
|
7959
7979
|
|
7960
7980
|
// > A line starting with # serves as a comment.
|
7961
7981
|
&& pattern.indexOf('#') !== 0
|
7962
7982
|
|
7963
|
-
const
|
7983
|
+
const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
|
7984
|
+
|
7985
|
+
class IgnoreRule {
|
7986
|
+
constructor (
|
7987
|
+
origin,
|
7988
|
+
pattern,
|
7989
|
+
negative,
|
7990
|
+
regex
|
7991
|
+
) {
|
7992
|
+
this.origin = origin
|
7993
|
+
this.pattern = pattern
|
7994
|
+
this.negative = negative
|
7995
|
+
this.regex = regex
|
7996
|
+
}
|
7997
|
+
}
|
7998
|
+
|
7999
|
+
const createRule = (pattern, ignoreCase) => {
|
7964
8000
|
const origin = pattern
|
7965
8001
|
let negative = false
|
7966
8002
|
|
@@ -7973,44 +8009,98 @@ const createRule = (pattern, ignorecase) => {
|
|
7973
8009
|
pattern = pattern
|
7974
8010
|
// > Put a backslash ("\") in front of the first "!" for patterns that
|
7975
8011
|
// > begin with a literal "!", for example, `"\!important!.txt"`.
|
7976
|
-
.replace(
|
8012
|
+
.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
|
7977
8013
|
// > Put a backslash ("\") in front of the first hash for patterns that
|
7978
8014
|
// > begin with a hash.
|
7979
|
-
.replace(
|
8015
|
+
.replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
|
7980
8016
|
|
7981
|
-
const regex =
|
8017
|
+
const regex = makeRegex(pattern, ignoreCase)
|
7982
8018
|
|
7983
|
-
return
|
8019
|
+
return new IgnoreRule(
|
7984
8020
|
origin,
|
7985
8021
|
pattern,
|
7986
8022
|
negative,
|
7987
8023
|
regex
|
8024
|
+
)
|
8025
|
+
}
|
8026
|
+
|
8027
|
+
const throwError = (message, Ctor) => {
|
8028
|
+
throw new Ctor(message)
|
8029
|
+
}
|
8030
|
+
|
8031
|
+
const checkPath = (path, originalPath, doThrow) => {
|
8032
|
+
if (!isString(path)) {
|
8033
|
+
return doThrow(
|
8034
|
+
`path must be a string, but got \`${originalPath}\``,
|
8035
|
+
TypeError
|
8036
|
+
)
|
7988
8037
|
}
|
8038
|
+
|
8039
|
+
// We don't know if we should ignore EMPTY, so throw
|
8040
|
+
if (!path) {
|
8041
|
+
return doThrow(`path must not be empty`, TypeError)
|
8042
|
+
}
|
8043
|
+
|
8044
|
+
// Check if it is a relative path
|
8045
|
+
if (checkPath.isNotRelative(path)) {
|
8046
|
+
const r = '`path.relative()`d'
|
8047
|
+
return doThrow(
|
8048
|
+
`path should be a ${r} string, but got "${originalPath}"`,
|
8049
|
+
RangeError
|
8050
|
+
)
|
8051
|
+
}
|
8052
|
+
|
8053
|
+
return true
|
7989
8054
|
}
|
7990
8055
|
|
7991
|
-
|
8056
|
+
const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
|
8057
|
+
|
8058
|
+
checkPath.isNotRelative = isNotRelative
|
8059
|
+
checkPath.convert = p => p
|
8060
|
+
|
8061
|
+
class Ignore {
|
7992
8062
|
constructor ({
|
7993
|
-
ignorecase = true
|
8063
|
+
ignorecase = true,
|
8064
|
+
ignoreCase = ignorecase,
|
8065
|
+
allowRelativePaths = false
|
7994
8066
|
} = {}) {
|
7995
|
-
this._rules = []
|
7996
|
-
this._ignorecase = ignorecase
|
7997
8067
|
define(this, KEY_IGNORE, true)
|
8068
|
+
|
8069
|
+
this._rules = []
|
8070
|
+
this._ignoreCase = ignoreCase
|
8071
|
+
this._allowRelativePaths = allowRelativePaths
|
7998
8072
|
this._initCache()
|
7999
8073
|
}
|
8000
8074
|
|
8001
8075
|
_initCache () {
|
8002
|
-
this.
|
8076
|
+
this._ignoreCache = Object.create(null)
|
8077
|
+
this._testCache = Object.create(null)
|
8003
8078
|
}
|
8004
8079
|
|
8005
|
-
|
8006
|
-
|
8007
|
-
|
8080
|
+
_addPattern (pattern) {
|
8081
|
+
// #32
|
8082
|
+
if (pattern && pattern[KEY_IGNORE]) {
|
8083
|
+
this._rules = this._rules.concat(pattern._rules)
|
8084
|
+
this._added = true
|
8085
|
+
return
|
8086
|
+
}
|
8008
8087
|
|
8009
|
-
if (
|
8010
|
-
|
8088
|
+
if (checkPattern(pattern)) {
|
8089
|
+
const rule = createRule(pattern, this._ignoreCase)
|
8090
|
+
this._added = true
|
8091
|
+
this._rules.push(rule)
|
8011
8092
|
}
|
8093
|
+
}
|
8094
|
+
|
8095
|
+
// @param {Array<string> | string | Ignore} pattern
|
8096
|
+
add (pattern) {
|
8097
|
+
this._added = false
|
8012
8098
|
|
8013
|
-
|
8099
|
+
makeArray(
|
8100
|
+
isString(pattern)
|
8101
|
+
? splitPattern(pattern)
|
8102
|
+
: pattern
|
8103
|
+
).forEach(this._addPattern, this)
|
8014
8104
|
|
8015
8105
|
// Some rules have just added to the ignore,
|
8016
8106
|
// making the behavior changed.
|
@@ -8026,41 +8116,69 @@ class IgnoreBase {
|
|
8026
8116
|
return this.add(pattern)
|
8027
8117
|
}
|
8028
8118
|
|
8029
|
-
|
8030
|
-
|
8031
|
-
|
8032
|
-
|
8033
|
-
|
8034
|
-
return
|
8035
|
-
}
|
8119
|
+
// | ignored : unignored
|
8120
|
+
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
8121
|
+
// -------- | ------- | ------- | ------- | --------
|
8122
|
+
// 0 | TEST | TEST | SKIP | X
|
8123
|
+
// 1 | TESTIF | SKIP | TEST | X
|
8036
8124
|
|
8037
|
-
|
8038
|
-
|
8039
|
-
|
8040
|
-
|
8125
|
+
// - SKIP: always skip
|
8126
|
+
// - TEST: always test
|
8127
|
+
// - TESTIF: only test if checkUnignored
|
8128
|
+
// - X: that never happen
|
8129
|
+
|
8130
|
+
// @param {boolean} whether should check if the path is unignored,
|
8131
|
+
// setting `checkUnignored` to `false` could reduce additional
|
8132
|
+
// path matching.
|
8133
|
+
|
8134
|
+
// @returns {TestResult} true if a file is ignored
|
8135
|
+
_testOne (path, checkUnignored) {
|
8136
|
+
let ignored = false
|
8137
|
+
let unignored = false
|
8138
|
+
|
8139
|
+
this._rules.forEach(rule => {
|
8140
|
+
const {negative} = rule
|
8141
|
+
if (
|
8142
|
+
unignored === negative && ignored !== unignored
|
8143
|
+
|| negative && !ignored && !unignored && !checkUnignored
|
8144
|
+
) {
|
8145
|
+
return
|
8146
|
+
}
|
8147
|
+
|
8148
|
+
const matched = rule.regex.test(path)
|
8149
|
+
|
8150
|
+
if (matched) {
|
8151
|
+
ignored = !negative
|
8152
|
+
unignored = negative
|
8153
|
+
}
|
8154
|
+
})
|
8155
|
+
|
8156
|
+
return {
|
8157
|
+
ignored,
|
8158
|
+
unignored
|
8041
8159
|
}
|
8042
8160
|
}
|
8043
8161
|
|
8044
|
-
|
8045
|
-
|
8046
|
-
|
8162
|
+
// @returns {TestResult}
|
8163
|
+
_test (originalPath, cache, checkUnignored, slices) {
|
8164
|
+
const path = originalPath
|
8165
|
+
// Supports nullable path
|
8166
|
+
&& checkPath.convert(originalPath)
|
8047
8167
|
|
8048
|
-
|
8049
|
-
|
8050
|
-
|
8168
|
+
checkPath(
|
8169
|
+
path,
|
8170
|
+
originalPath,
|
8171
|
+
this._allowRelativePaths
|
8172
|
+
? RETURN_FALSE
|
8173
|
+
: throwError
|
8174
|
+
)
|
8051
8175
|
|
8052
|
-
|
8053
|
-
return !this._filter(path)
|
8176
|
+
return this._t(path, cache, checkUnignored, slices)
|
8054
8177
|
}
|
8055
8178
|
|
8056
|
-
|
8057
|
-
|
8058
|
-
|
8059
|
-
return false
|
8060
|
-
}
|
8061
|
-
|
8062
|
-
if (path in this._cache) {
|
8063
|
-
return this._cache[path]
|
8179
|
+
_t (path, cache, checkUnignored, slices) {
|
8180
|
+
if (path in cache) {
|
8181
|
+
return cache[path]
|
8064
8182
|
}
|
8065
8183
|
|
8066
8184
|
if (!slices) {
|
@@ -8071,34 +8189,56 @@ class IgnoreBase {
|
|
8071
8189
|
|
8072
8190
|
slices.pop()
|
8073
8191
|
|
8074
|
-
|
8192
|
+
// If the path has no parent directory, just test it
|
8193
|
+
if (!slices.length) {
|
8194
|
+
return cache[path] = this._testOne(path, checkUnignored)
|
8195
|
+
}
|
8196
|
+
|
8197
|
+
const parent = this._t(
|
8198
|
+
slices.join(SLASH) + SLASH,
|
8199
|
+
cache,
|
8200
|
+
checkUnignored,
|
8201
|
+
slices
|
8202
|
+
)
|
8203
|
+
|
8204
|
+
// If the path contains a parent directory, check the parent first
|
8205
|
+
return cache[path] = parent.ignored
|
8075
8206
|
// > It is not possible to re-include a file if a parent directory of
|
8076
8207
|
// > that file is excluded.
|
8077
|
-
|
8078
|
-
|
8079
|
-
|
8208
|
+
? parent
|
8209
|
+
: this._testOne(path, checkUnignored)
|
8210
|
+
}
|
8080
8211
|
|
8081
|
-
|
8082
|
-
|
8212
|
+
ignores (path) {
|
8213
|
+
return this._test(path, this._ignoreCache, false).ignored
|
8083
8214
|
}
|
8084
8215
|
|
8085
|
-
|
8086
|
-
|
8087
|
-
|
8088
|
-
let matched = 0
|
8216
|
+
createFilter () {
|
8217
|
+
return path => !this.ignores(path)
|
8218
|
+
}
|
8089
8219
|
|
8090
|
-
|
8091
|
-
|
8092
|
-
|
8093
|
-
if (!(matched ^ rule.negative)) {
|
8094
|
-
matched = rule.negative ^ rule.regex.test(path)
|
8095
|
-
}
|
8096
|
-
})
|
8220
|
+
filter (paths) {
|
8221
|
+
return makeArray(paths).filter(this.createFilter())
|
8222
|
+
}
|
8097
8223
|
|
8098
|
-
|
8224
|
+
// @returns {TestResult}
|
8225
|
+
test (path) {
|
8226
|
+
return this._test(path, this._testCache, true)
|
8099
8227
|
}
|
8100
8228
|
}
|
8101
8229
|
|
8230
|
+
const factory = options => new Ignore(options)
|
8231
|
+
|
8232
|
+
const isPathValid = path =>
|
8233
|
+
checkPath(path && checkPath.convert(path), path, RETURN_FALSE)
|
8234
|
+
|
8235
|
+
factory.isPathValid = isPathValid
|
8236
|
+
|
8237
|
+
// Fixes typescript
|
8238
|
+
factory.default = factory
|
8239
|
+
|
8240
|
+
module.exports = factory
|
8241
|
+
|
8102
8242
|
// Windows
|
8103
8243
|
// --------------------------------------------------------------
|
8104
8244
|
/* istanbul ignore if */
|
@@ -8110,21 +8250,21 @@ if (
|
|
8110
8250
|
|| process.platform === 'win32'
|
8111
8251
|
)
|
8112
8252
|
) {
|
8113
|
-
const filter = IgnoreBase.prototype._filter
|
8114
|
-
|
8115
8253
|
/* eslint no-control-regex: "off" */
|
8116
|
-
const
|
8117
|
-
|| /[
|
8254
|
+
const makePosix = str => /^\\\\\?\\/.test(str)
|
8255
|
+
|| /["<>|\u0000-\u001F]+/u.test(str)
|
8118
8256
|
? str
|
8119
8257
|
: str.replace(/\\/g, '/')
|
8120
8258
|
|
8121
|
-
|
8122
|
-
path = make_posix(path)
|
8123
|
-
return filter.call(this, path, slices)
|
8124
|
-
}
|
8125
|
-
}
|
8259
|
+
checkPath.convert = makePosix
|
8126
8260
|
|
8127
|
-
|
8261
|
+
// 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
|
8262
|
+
// 'd:\\foo'
|
8263
|
+
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
|
8264
|
+
checkPath.isNotRelative = path =>
|
8265
|
+
REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
|
8266
|
+
|| isNotRelative(path)
|
8267
|
+
}
|
8128
8268
|
|
8129
8269
|
|
8130
8270
|
/***/ }),
|
@@ -14651,6 +14791,8 @@ ZipFile.prototype.addEmptyDirectory = function(metadataPath, options) {
|
|
14651
14791
|
pumpEntries(self);
|
14652
14792
|
};
|
14653
14793
|
|
14794
|
+
var eocdrSignatureBuffer = bufferFrom([0x50, 0x4b, 0x05, 0x06]);
|
14795
|
+
|
14654
14796
|
ZipFile.prototype.end = function(options, finalSizeCallback) {
|
14655
14797
|
if (typeof options === "function") {
|
14656
14798
|
finalSizeCallback = options;
|
@@ -14661,6 +14803,20 @@ ZipFile.prototype.end = function(options, finalSizeCallback) {
|
|
14661
14803
|
this.ended = true;
|
14662
14804
|
this.finalSizeCallback = finalSizeCallback;
|
14663
14805
|
this.forceZip64Eocd = !!options.forceZip64Format;
|
14806
|
+
if (options.comment) {
|
14807
|
+
if (typeof options.comment === "string") {
|
14808
|
+
this.comment = encodeCp437(options.comment);
|
14809
|
+
} else {
|
14810
|
+
// It should be a Buffer
|
14811
|
+
this.comment = options.comment;
|
14812
|
+
}
|
14813
|
+
if (this.comment.length > 0xffff) throw new Error("comment is too large");
|
14814
|
+
// gotta check for this, because the zipfile format is actually ambiguous.
|
14815
|
+
if (bufferIncludes(this.comment, eocdrSignatureBuffer)) throw new Error("comment contains end of central directory record signature");
|
14816
|
+
} else {
|
14817
|
+
// no comment.
|
14818
|
+
this.comment = EMPTY_BUFFER;
|
14819
|
+
}
|
14664
14820
|
pumpEntries(this);
|
14665
14821
|
};
|
14666
14822
|
|
@@ -14769,7 +14925,7 @@ function calculateFinalSize(self) {
|
|
14769
14925
|
}
|
14770
14926
|
}
|
14771
14927
|
|
14772
|
-
centralDirectorySize += CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length;
|
14928
|
+
centralDirectorySize += CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length + entry.fileComment.length;
|
14773
14929
|
if (useZip64Format) {
|
14774
14930
|
centralDirectorySize += ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE;
|
14775
14931
|
}
|
@@ -14783,7 +14939,7 @@ function calculateFinalSize(self) {
|
|
14783
14939
|
// use zip64 end of central directory stuff
|
14784
14940
|
endOfCentralDirectorySize += ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE;
|
14785
14941
|
}
|
14786
|
-
endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
|
14942
|
+
endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length;
|
14787
14943
|
return pretendOutputCursor + centralDirectorySize + endOfCentralDirectorySize;
|
14788
14944
|
}
|
14789
14945
|
|
@@ -14820,7 +14976,7 @@ function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe
|
|
14820
14976
|
}
|
14821
14977
|
}
|
14822
14978
|
|
14823
|
-
var eocdrBuffer =
|
14979
|
+
var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length);
|
14824
14980
|
// end of central dir signature 4 bytes (0x06054b50)
|
14825
14981
|
eocdrBuffer.writeUInt32LE(0x06054b50, 0);
|
14826
14982
|
// number of this disk 2 bytes
|
@@ -14836,15 +14992,15 @@ function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe
|
|
14836
14992
|
// offset of start of central directory with respect to the starting disk number 4 bytes
|
14837
14993
|
eocdrBuffer.writeUInt32LE(normalOffsetOfStartOfCentralDirectory, 16);
|
14838
14994
|
// .ZIP file comment length 2 bytes
|
14839
|
-
eocdrBuffer.writeUInt16LE(
|
14995
|
+
eocdrBuffer.writeUInt16LE(self.comment.length, 20);
|
14840
14996
|
// .ZIP file comment (variable size)
|
14841
|
-
|
14997
|
+
self.comment.copy(eocdrBuffer, 22);
|
14842
14998
|
|
14843
14999
|
if (!needZip64Format) return eocdrBuffer;
|
14844
15000
|
|
14845
15001
|
// ZIP64 format
|
14846
15002
|
// ZIP64 End of Central Directory Record
|
14847
|
-
var zip64EocdrBuffer =
|
15003
|
+
var zip64EocdrBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE);
|
14848
15004
|
// zip64 end of central dir signature 4 bytes (0x06064b50)
|
14849
15005
|
zip64EocdrBuffer.writeUInt32LE(0x06064b50, 0);
|
14850
15006
|
// size of zip64 end of central directory record 8 bytes
|
@@ -14870,7 +15026,7 @@ function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe
|
|
14870
15026
|
|
14871
15027
|
|
14872
15028
|
// ZIP64 End of Central Directory Locator
|
14873
|
-
var zip64EocdlBuffer =
|
15029
|
+
var zip64EocdlBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE);
|
14874
15030
|
// zip64 end of central dir locator signature 4 bytes (0x07064b50)
|
14875
15031
|
zip64EocdlBuffer.writeUInt32LE(0x07064b50, 0);
|
14876
15032
|
// number of the disk with the start of the zip64 end of central directory 4 bytes
|
@@ -14903,12 +15059,11 @@ function validateMetadataPath(metadataPath, isDirectory) {
|
|
14903
15059
|
return metadataPath;
|
14904
15060
|
}
|
14905
15061
|
|
14906
|
-
var
|
14907
|
-
var defaultDirectoryMode = parseInt("040775", 8);
|
15062
|
+
var EMPTY_BUFFER = bufferAlloc(0);
|
14908
15063
|
|
14909
15064
|
// this class is not part of the public API
|
14910
15065
|
function Entry(metadataPath, isDirectory, options) {
|
14911
|
-
this.utf8FileName =
|
15066
|
+
this.utf8FileName = bufferFrom(metadataPath);
|
14912
15067
|
if (this.utf8FileName.length > 0xffff) throw new Error("utf8 file name too long. " + utf8FileName.length + " > " + 0xffff);
|
14913
15068
|
this.isDirectory = isDirectory;
|
14914
15069
|
this.state = Entry.WAITING_FOR_METADATA;
|
@@ -14916,7 +15071,7 @@ function Entry(metadataPath, isDirectory, options) {
|
|
14916
15071
|
if (options.mode != null) {
|
14917
15072
|
this.setFileAttributesMode(options.mode);
|
14918
15073
|
} else {
|
14919
|
-
this.setFileAttributesMode(isDirectory ?
|
15074
|
+
this.setFileAttributesMode(isDirectory ? 0o40775 : 0o100664);
|
14920
15075
|
}
|
14921
15076
|
if (isDirectory) {
|
14922
15077
|
this.crcAndFileSizeKnown = true;
|
@@ -14938,6 +15093,18 @@ function Entry(metadataPath, isDirectory, options) {
|
|
14938
15093
|
if (options.compress != null) this.compress = !!options.compress;
|
14939
15094
|
}
|
14940
15095
|
this.forceZip64Format = !!options.forceZip64Format;
|
15096
|
+
if (options.fileComment) {
|
15097
|
+
if (typeof options.fileComment === "string") {
|
15098
|
+
this.fileComment = bufferFrom(options.fileComment, "utf-8");
|
15099
|
+
} else {
|
15100
|
+
// It should be a Buffer
|
15101
|
+
this.fileComment = options.fileComment;
|
15102
|
+
}
|
15103
|
+
if (this.fileComment.length > 0xffff) throw new Error("fileComment is too large");
|
15104
|
+
} else {
|
15105
|
+
// no comment.
|
15106
|
+
this.fileComment = EMPTY_BUFFER;
|
15107
|
+
}
|
14941
15108
|
}
|
14942
15109
|
Entry.WAITING_FOR_METADATA = 0;
|
14943
15110
|
Entry.READY_TO_PUMP_FILE_DATA = 1;
|
@@ -14983,7 +15150,7 @@ Entry.prototype.getLocalFileHeader = function() {
|
|
14983
15150
|
uncompressedSize = this.uncompressedSize;
|
14984
15151
|
}
|
14985
15152
|
|
14986
|
-
var fixedSizeStuff =
|
15153
|
+
var fixedSizeStuff = bufferAlloc(LOCAL_FILE_HEADER_FIXED_SIZE);
|
14987
15154
|
var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
|
14988
15155
|
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
|
14989
15156
|
|
@@ -15022,10 +15189,10 @@ var ZIP64_DATA_DESCRIPTOR_SIZE = 24;
|
|
15022
15189
|
Entry.prototype.getDataDescriptor = function() {
|
15023
15190
|
if (this.crcAndFileSizeKnown) {
|
15024
15191
|
// the Mac Archive Utility requires this not be present unless we set general purpose bit 3
|
15025
|
-
return
|
15192
|
+
return EMPTY_BUFFER;
|
15026
15193
|
}
|
15027
15194
|
if (!this.useZip64Format()) {
|
15028
|
-
var buffer =
|
15195
|
+
var buffer = bufferAlloc(DATA_DESCRIPTOR_SIZE);
|
15029
15196
|
// optional signature (required according to Archive Utility)
|
15030
15197
|
buffer.writeUInt32LE(0x08074b50, 0);
|
15031
15198
|
// crc-32 4 bytes
|
@@ -15037,7 +15204,7 @@ Entry.prototype.getDataDescriptor = function() {
|
|
15037
15204
|
return buffer;
|
15038
15205
|
} else {
|
15039
15206
|
// ZIP64 format
|
15040
|
-
var buffer =
|
15207
|
+
var buffer = bufferAlloc(ZIP64_DATA_DESCRIPTOR_SIZE);
|
15041
15208
|
// optional signature (unknown if anyone cares about this)
|
15042
15209
|
buffer.writeUInt32LE(0x08074b50, 0);
|
15043
15210
|
// crc-32 4 bytes
|
@@ -15052,7 +15219,7 @@ Entry.prototype.getDataDescriptor = function() {
|
|
15052
15219
|
var CENTRAL_DIRECTORY_RECORD_FIXED_SIZE = 46;
|
15053
15220
|
var ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE = 28;
|
15054
15221
|
Entry.prototype.getCentralDirectoryRecord = function() {
|
15055
|
-
var fixedSizeStuff =
|
15222
|
+
var fixedSizeStuff = bufferAlloc(CENTRAL_DIRECTORY_RECORD_FIXED_SIZE);
|
15056
15223
|
var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
|
15057
15224
|
if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
|
15058
15225
|
|
@@ -15068,7 +15235,7 @@ Entry.prototype.getCentralDirectoryRecord = function() {
|
|
15068
15235
|
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_ZIP64;
|
15069
15236
|
|
15070
15237
|
// ZIP64 extended information extra field
|
15071
|
-
zeiefBuffer =
|
15238
|
+
zeiefBuffer = bufferAlloc(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE);
|
15072
15239
|
// 0x0001 2 bytes Tag for this "extra" block type
|
15073
15240
|
zeiefBuffer.writeUInt16LE(0x0001, 0);
|
15074
15241
|
// Size 2 bytes Size of this "extra" block
|
@@ -15083,7 +15250,7 @@ Entry.prototype.getCentralDirectoryRecord = function() {
|
|
15083
15250
|
// (omit)
|
15084
15251
|
} else {
|
15085
15252
|
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_UTF8;
|
15086
|
-
zeiefBuffer =
|
15253
|
+
zeiefBuffer = EMPTY_BUFFER;
|
15087
15254
|
}
|
15088
15255
|
|
15089
15256
|
// central file header signature 4 bytes (0x02014b50)
|
@@ -15111,7 +15278,7 @@ Entry.prototype.getCentralDirectoryRecord = function() {
|
|
15111
15278
|
// extra field length 2 bytes
|
15112
15279
|
fixedSizeStuff.writeUInt16LE(zeiefBuffer.length, 30);
|
15113
15280
|
// file comment length 2 bytes
|
15114
|
-
fixedSizeStuff.writeUInt16LE(
|
15281
|
+
fixedSizeStuff.writeUInt16LE(this.fileComment.length, 32);
|
15115
15282
|
// disk number start 2 bytes
|
15116
15283
|
fixedSizeStuff.writeUInt16LE(0, 34);
|
15117
15284
|
// internal file attributes 2 bytes
|
@@ -15128,7 +15295,7 @@ Entry.prototype.getCentralDirectoryRecord = function() {
|
|
15128
15295
|
// extra field (variable size)
|
15129
15296
|
zeiefBuffer,
|
15130
15297
|
// file comment (variable size)
|
15131
|
-
|
15298
|
+
this.fileComment,
|
15132
15299
|
]);
|
15133
15300
|
};
|
15134
15301
|
Entry.prototype.getCompressionMethod = function() {
|
@@ -15152,7 +15319,7 @@ function dateToDosDateTime(jsDate) {
|
|
15152
15319
|
}
|
15153
15320
|
|
15154
15321
|
function writeUInt64LE(buffer, n, offset) {
|
15155
|
-
// can't use bitshift here, because JavaScript only allows
|
15322
|
+
// can't use bitshift here, because JavaScript only allows bitshifting on 32-bit integers.
|
15156
15323
|
var high = Math.floor(n / 0x100000000);
|
15157
15324
|
var low = n % 0x100000000;
|
15158
15325
|
buffer.writeUInt32LE(low, offset);
|
@@ -15183,6 +15350,87 @@ Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
|
|
15183
15350
|
cb(null, chunk);
|
15184
15351
|
};
|
15185
15352
|
|
15353
|
+
var cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ';
|
15354
|
+
if (cp437.length !== 256) throw new Error("assertion failure");
|
15355
|
+
var reverseCp437 = null;
|
15356
|
+
|
15357
|
+
function encodeCp437(string) {
|
15358
|
+
if (/^[\x20-\x7e]*$/.test(string)) {
|
15359
|
+
// CP437, ASCII, and UTF-8 overlap in this range.
|
15360
|
+
return bufferFrom(string, "utf-8");
|
15361
|
+
}
|
15362
|
+
|
15363
|
+
// This is the slow path.
|
15364
|
+
if (reverseCp437 == null) {
|
15365
|
+
// cache this once
|
15366
|
+
reverseCp437 = {};
|
15367
|
+
for (var i = 0; i < cp437.length; i++) {
|
15368
|
+
reverseCp437[cp437[i]] = i;
|
15369
|
+
}
|
15370
|
+
}
|
15371
|
+
|
15372
|
+
var result = bufferAlloc(string.length);
|
15373
|
+
for (var i = 0; i < string.length; i++) {
|
15374
|
+
var b = reverseCp437[string[i]];
|
15375
|
+
if (b == null) throw new Error("character not encodable in CP437: " + JSON.stringify(string[i]));
|
15376
|
+
result[i] = b;
|
15377
|
+
}
|
15378
|
+
|
15379
|
+
return result;
|
15380
|
+
}
|
15381
|
+
|
15382
|
+
function bufferAlloc(size) {
|
15383
|
+
bufferAlloc = modern;
|
15384
|
+
try {
|
15385
|
+
return bufferAlloc(size);
|
15386
|
+
} catch (e) {
|
15387
|
+
bufferAlloc = legacy;
|
15388
|
+
return bufferAlloc(size);
|
15389
|
+
}
|
15390
|
+
function modern(size) {
|
15391
|
+
return Buffer.allocUnsafe(size);
|
15392
|
+
}
|
15393
|
+
function legacy(size) {
|
15394
|
+
return new Buffer(size);
|
15395
|
+
}
|
15396
|
+
}
|
15397
|
+
function bufferFrom(something, encoding) {
|
15398
|
+
bufferFrom = modern;
|
15399
|
+
try {
|
15400
|
+
return bufferFrom(something, encoding);
|
15401
|
+
} catch (e) {
|
15402
|
+
bufferFrom = legacy;
|
15403
|
+
return bufferFrom(something, encoding);
|
15404
|
+
}
|
15405
|
+
function modern(something, encoding) {
|
15406
|
+
return Buffer.from(something, encoding);
|
15407
|
+
}
|
15408
|
+
function legacy(something, encoding) {
|
15409
|
+
return new Buffer(something, encoding);
|
15410
|
+
}
|
15411
|
+
}
|
15412
|
+
function bufferIncludes(buffer, content) {
|
15413
|
+
bufferIncludes = modern;
|
15414
|
+
try {
|
15415
|
+
return bufferIncludes(buffer, content);
|
15416
|
+
} catch (e) {
|
15417
|
+
bufferIncludes = legacy;
|
15418
|
+
return bufferIncludes(buffer, content);
|
15419
|
+
}
|
15420
|
+
function modern(buffer, content) {
|
15421
|
+
return buffer.includes(content);
|
15422
|
+
}
|
15423
|
+
function legacy(buffer, content) {
|
15424
|
+
for (var i = 0; i <= buffer.length - content.length; i++) {
|
15425
|
+
for (var j = 0;; j++) {
|
15426
|
+
if (j === content.length) return true;
|
15427
|
+
if (buffer[i + j] !== content[j]) break;
|
15428
|
+
}
|
15429
|
+
}
|
15430
|
+
return false;
|
15431
|
+
}
|
15432
|
+
}
|
15433
|
+
|
15186
15434
|
|
15187
15435
|
/***/ }),
|
15188
15436
|
|
@@ -34484,9 +34732,6 @@ function getDiscontinuedNodeVersions() {
|
|
34484
34732
|
exports.getDiscontinuedNodeVersions = getDiscontinuedNodeVersions;
|
34485
34733
|
async function getSupportedNodeVersion(engineRange, isAuto = false) {
|
34486
34734
|
let selection = getLatestNodeVersion();
|
34487
|
-
if (process.env.ENABLE_EXPERIMENTAL_NODE16 === '1') {
|
34488
|
-
return { major: 16, range: '16.x', runtime: 'nodejs16.x' };
|
34489
|
-
}
|
34490
34735
|
if (engineRange) {
|
34491
34736
|
const found = semver_1.validRange(engineRange) &&
|
34492
34737
|
allOptions.some(o => {
|
@@ -34754,6 +34999,10 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
|
34754
34999
|
const latest = node_version_1.getLatestNodeVersion();
|
34755
35000
|
return { ...latest, runtime: 'nodejs' };
|
34756
35001
|
}
|
35002
|
+
if (process.env.ENABLE_EXPERIMENTAL_NODE16 === '1') {
|
35003
|
+
console.warn('Warning: Using experimental Node.js 16.x due to ENABLE_EXPERIMENTAL_NODE16=1');
|
35004
|
+
return { major: 16, range: '16.x', runtime: 'nodejs16.x' };
|
35005
|
+
}
|
34757
35006
|
const { packageJson } = await scanParentDirs(destPath, true);
|
34758
35007
|
let { nodeVersion } = config;
|
34759
35008
|
let isAuto = true;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.15.2-canary.
|
3
|
+
"version": "2.15.2-canary.6",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -23,14 +23,14 @@
|
|
23
23
|
"@types/end-of-stream": "^1.4.0",
|
24
24
|
"@types/fs-extra": "9.0.13",
|
25
25
|
"@types/glob": "^7.1.1",
|
26
|
-
"@types/jest": "27.
|
26
|
+
"@types/jest": "27.4.1",
|
27
27
|
"@types/js-yaml": "3.12.1",
|
28
28
|
"@types/ms": "0.7.31",
|
29
29
|
"@types/multistream": "2.1.1",
|
30
30
|
"@types/node-fetch": "^2.1.6",
|
31
31
|
"@types/semver": "6.0.0",
|
32
|
-
"@types/yazl": "
|
33
|
-
"@vercel/frameworks": "0.7.2-canary.
|
32
|
+
"@types/yazl": "2.4.2",
|
33
|
+
"@vercel/frameworks": "0.7.2-canary.1",
|
34
34
|
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"node-fetch": "2.6.1",
|
48
48
|
"semver": "6.1.1",
|
49
49
|
"typescript": "4.3.4",
|
50
|
-
"yazl": "2.
|
50
|
+
"yazl": "2.5.1"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "30d5e64291c8a82be9de7d32e3df4860ecc63b5c"
|
53
53
|
}
|