@vercel/static-build 1.3.20 → 1.3.22

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
@@ -3288,7 +3288,7 @@ exports.libFiles = libFiles;
3288
3288
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3289
3289
 
3290
3290
  var ts = __webpack_require__(11);
3291
- var minimatch = __webpack_require__(7767);
3291
+ var minimatch = __webpack_require__(7345);
3292
3292
  var fastGlob = __webpack_require__(4910);
3293
3293
  var fs$1 = __webpack_require__(5747);
3294
3294
  var mkdirp = __webpack_require__(7981);
@@ -196366,16 +196366,16 @@ module.exports = micromatch;
196366
196366
 
196367
196367
  /***/ }),
196368
196368
 
196369
- /***/ 7767:
196369
+ /***/ 7345:
196370
196370
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
196371
196371
 
196372
196372
  module.exports = minimatch
196373
196373
  minimatch.Minimatch = Minimatch
196374
196374
 
196375
- var path = { sep: '/' }
196376
- try {
196377
- path = __webpack_require__(5622)
196378
- } catch (er) {}
196375
+ var path = (function () { try { return __webpack_require__(5622) } catch (e) {}}()) || {
196376
+ sep: '/'
196377
+ }
196378
+ minimatch.sep = path.sep
196379
196379
 
196380
196380
  var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
196381
196381
  var expand = __webpack_require__(490)
@@ -196427,43 +196427,64 @@ function filter (pattern, options) {
196427
196427
  }
196428
196428
 
196429
196429
  function ext (a, b) {
196430
- a = a || {}
196431
196430
  b = b || {}
196432
196431
  var t = {}
196433
- Object.keys(b).forEach(function (k) {
196434
- t[k] = b[k]
196435
- })
196436
196432
  Object.keys(a).forEach(function (k) {
196437
196433
  t[k] = a[k]
196438
196434
  })
196435
+ Object.keys(b).forEach(function (k) {
196436
+ t[k] = b[k]
196437
+ })
196439
196438
  return t
196440
196439
  }
196441
196440
 
196442
196441
  minimatch.defaults = function (def) {
196443
- if (!def || !Object.keys(def).length) return minimatch
196442
+ if (!def || typeof def !== 'object' || !Object.keys(def).length) {
196443
+ return minimatch
196444
+ }
196444
196445
 
196445
196446
  var orig = minimatch
196446
196447
 
196447
196448
  var m = function minimatch (p, pattern, options) {
196448
- return orig.minimatch(p, pattern, ext(def, options))
196449
+ return orig(p, pattern, ext(def, options))
196449
196450
  }
196450
196451
 
196451
196452
  m.Minimatch = function Minimatch (pattern, options) {
196452
196453
  return new orig.Minimatch(pattern, ext(def, options))
196453
196454
  }
196455
+ m.Minimatch.defaults = function defaults (options) {
196456
+ return orig.defaults(ext(def, options)).Minimatch
196457
+ }
196458
+
196459
+ m.filter = function filter (pattern, options) {
196460
+ return orig.filter(pattern, ext(def, options))
196461
+ }
196462
+
196463
+ m.defaults = function defaults (options) {
196464
+ return orig.defaults(ext(def, options))
196465
+ }
196466
+
196467
+ m.makeRe = function makeRe (pattern, options) {
196468
+ return orig.makeRe(pattern, ext(def, options))
196469
+ }
196470
+
196471
+ m.braceExpand = function braceExpand (pattern, options) {
196472
+ return orig.braceExpand(pattern, ext(def, options))
196473
+ }
196474
+
196475
+ m.match = function (list, pattern, options) {
196476
+ return orig.match(list, pattern, ext(def, options))
196477
+ }
196454
196478
 
196455
196479
  return m
196456
196480
  }
196457
196481
 
196458
196482
  Minimatch.defaults = function (def) {
196459
- if (!def || !Object.keys(def).length) return Minimatch
196460
196483
  return minimatch.defaults(def).Minimatch
196461
196484
  }
196462
196485
 
196463
196486
  function minimatch (p, pattern, options) {
196464
- if (typeof pattern !== 'string') {
196465
- throw new TypeError('glob pattern string required')
196466
- }
196487
+ assertValidPattern(pattern)
196467
196488
 
196468
196489
  if (!options) options = {}
196469
196490
 
@@ -196472,9 +196493,6 @@ function minimatch (p, pattern, options) {
196472
196493
  return false
196473
196494
  }
196474
196495
 
196475
- // "" only matches ""
196476
- if (pattern.trim() === '') return p === ''
196477
-
196478
196496
  return new Minimatch(pattern, options).match(p)
196479
196497
  }
196480
196498
 
@@ -196483,15 +196501,14 @@ function Minimatch (pattern, options) {
196483
196501
  return new Minimatch(pattern, options)
196484
196502
  }
196485
196503
 
196486
- if (typeof pattern !== 'string') {
196487
- throw new TypeError('glob pattern string required')
196488
- }
196504
+ assertValidPattern(pattern)
196489
196505
 
196490
196506
  if (!options) options = {}
196507
+
196491
196508
  pattern = pattern.trim()
196492
196509
 
196493
196510
  // windows support: need to use /, not \
196494
- if (path.sep !== '/') {
196511
+ if (!options.allowWindowsEscape && path.sep !== '/') {
196495
196512
  pattern = pattern.split(path.sep).join('/')
196496
196513
  }
196497
196514
 
@@ -196502,6 +196519,7 @@ function Minimatch (pattern, options) {
196502
196519
  this.negate = false
196503
196520
  this.comment = false
196504
196521
  this.empty = false
196522
+ this.partial = !!options.partial
196505
196523
 
196506
196524
  // make the set of regexps etc.
196507
196525
  this.make()
@@ -196511,9 +196529,6 @@ Minimatch.prototype.debug = function () {}
196511
196529
 
196512
196530
  Minimatch.prototype.make = make
196513
196531
  function make () {
196514
- // don't do it more than once.
196515
- if (this._made) return
196516
-
196517
196532
  var pattern = this.pattern
196518
196533
  var options = this.options
196519
196534
 
@@ -196533,7 +196548,7 @@ function make () {
196533
196548
  // step 2: expand braces
196534
196549
  var set = this.globSet = this.braceExpand()
196535
196550
 
196536
- if (options.debug) this.debug = console.error
196551
+ if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
196537
196552
 
196538
196553
  this.debug(this.pattern, set)
196539
196554
 
@@ -196613,12 +196628,11 @@ function braceExpand (pattern, options) {
196613
196628
  pattern = typeof pattern === 'undefined'
196614
196629
  ? this.pattern : pattern
196615
196630
 
196616
- if (typeof pattern === 'undefined') {
196617
- throw new TypeError('undefined pattern')
196618
- }
196631
+ assertValidPattern(pattern)
196619
196632
 
196620
- if (options.nobrace ||
196621
- !pattern.match(/\{.*\}/)) {
196633
+ // Thanks to Yeting Li <https://github.com/yetingli> for
196634
+ // improving this regexp to avoid a ReDOS vulnerability.
196635
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
196622
196636
  // shortcut. no need to expand.
196623
196637
  return [pattern]
196624
196638
  }
@@ -196626,6 +196640,17 @@ function braceExpand (pattern, options) {
196626
196640
  return expand(pattern)
196627
196641
  }
196628
196642
 
196643
+ var MAX_PATTERN_LENGTH = 1024 * 64
196644
+ var assertValidPattern = function (pattern) {
196645
+ if (typeof pattern !== 'string') {
196646
+ throw new TypeError('invalid pattern')
196647
+ }
196648
+
196649
+ if (pattern.length > MAX_PATTERN_LENGTH) {
196650
+ throw new TypeError('pattern is too long')
196651
+ }
196652
+ }
196653
+
196629
196654
  // parse a component of the expanded set.
196630
196655
  // At this point, no pattern may contain "/" in it
196631
196656
  // so we're going to return a 2d array, where each entry is the full
@@ -196640,14 +196665,17 @@ function braceExpand (pattern, options) {
196640
196665
  Minimatch.prototype.parse = parse
196641
196666
  var SUBPARSE = {}
196642
196667
  function parse (pattern, isSub) {
196643
- if (pattern.length > 1024 * 64) {
196644
- throw new TypeError('pattern is too long')
196645
- }
196668
+ assertValidPattern(pattern)
196646
196669
 
196647
196670
  var options = this.options
196648
196671
 
196649
196672
  // shortcuts
196650
- if (!options.noglobstar && pattern === '**') return GLOBSTAR
196673
+ if (pattern === '**') {
196674
+ if (!options.noglobstar)
196675
+ return GLOBSTAR
196676
+ else
196677
+ pattern = '*'
196678
+ }
196651
196679
  if (pattern === '') return ''
196652
196680
 
196653
196681
  var re = ''
@@ -196703,10 +196731,12 @@ function parse (pattern, isSub) {
196703
196731
  }
196704
196732
 
196705
196733
  switch (c) {
196706
- case '/':
196734
+ /* istanbul ignore next */
196735
+ case '/': {
196707
196736
  // completely not allowed, even escaped.
196708
196737
  // Should already be path-split by now.
196709
196738
  return false
196739
+ }
196710
196740
 
196711
196741
  case '\\':
196712
196742
  clearStateChar()
@@ -196825,25 +196855,23 @@ function parse (pattern, isSub) {
196825
196855
 
196826
196856
  // handle the case where we left a class open.
196827
196857
  // "[z-a]" is valid, equivalent to "\[z-a\]"
196828
- if (inClass) {
196829
- // split where the last [ was, make sure we don't have
196830
- // an invalid re. if so, re-walk the contents of the
196831
- // would-be class to re-translate any characters that
196832
- // were passed through as-is
196833
- // TODO: It would probably be faster to determine this
196834
- // without a try/catch and a new RegExp, but it's tricky
196835
- // to do safely. For now, this is safe and works.
196836
- var cs = pattern.substring(classStart + 1, i)
196837
- try {
196838
- RegExp('[' + cs + ']')
196839
- } catch (er) {
196840
- // not a valid class!
196841
- var sp = this.parse(cs, SUBPARSE)
196842
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
196843
- hasMagic = hasMagic || sp[1]
196844
- inClass = false
196845
- continue
196846
- }
196858
+ // split where the last [ was, make sure we don't have
196859
+ // an invalid re. if so, re-walk the contents of the
196860
+ // would-be class to re-translate any characters that
196861
+ // were passed through as-is
196862
+ // TODO: It would probably be faster to determine this
196863
+ // without a try/catch and a new RegExp, but it's tricky
196864
+ // to do safely. For now, this is safe and works.
196865
+ var cs = pattern.substring(classStart + 1, i)
196866
+ try {
196867
+ RegExp('[' + cs + ']')
196868
+ } catch (er) {
196869
+ // not a valid class!
196870
+ var sp = this.parse(cs, SUBPARSE)
196871
+ re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
196872
+ hasMagic = hasMagic || sp[1]
196873
+ inClass = false
196874
+ continue
196847
196875
  }
196848
196876
 
196849
196877
  // finish up the class.
@@ -196927,9 +196955,7 @@ function parse (pattern, isSub) {
196927
196955
  // something that could conceivably capture a dot
196928
196956
  var addPatternStart = false
196929
196957
  switch (re.charAt(0)) {
196930
- case '.':
196931
- case '[':
196932
- case '(': addPatternStart = true
196958
+ case '[': case '.': case '(': addPatternStart = true
196933
196959
  }
196934
196960
 
196935
196961
  // Hack to work around lack of negative lookbehind in JS
@@ -196991,7 +197017,7 @@ function parse (pattern, isSub) {
196991
197017
  var flags = options.nocase ? 'i' : ''
196992
197018
  try {
196993
197019
  var regExp = new RegExp('^' + re + '$', flags)
196994
- } catch (er) {
197020
+ } catch (er) /* istanbul ignore next - should be impossible */ {
196995
197021
  // If it was an invalid regular expression, then it can't match
196996
197022
  // anything. This trick looks for a character after the end of
196997
197023
  // the string, which is of course impossible, except in multi-line
@@ -197049,7 +197075,7 @@ function makeRe () {
197049
197075
 
197050
197076
  try {
197051
197077
  this.regexp = new RegExp(re, flags)
197052
- } catch (ex) {
197078
+ } catch (ex) /* istanbul ignore next - should be impossible */ {
197053
197079
  this.regexp = false
197054
197080
  }
197055
197081
  return this.regexp
@@ -197067,8 +197093,8 @@ minimatch.match = function (list, pattern, options) {
197067
197093
  return list
197068
197094
  }
197069
197095
 
197070
- Minimatch.prototype.match = match
197071
- function match (f, partial) {
197096
+ Minimatch.prototype.match = function match (f, partial) {
197097
+ if (typeof partial === 'undefined') partial = this.partial
197072
197098
  this.debug('match', f, this.pattern)
197073
197099
  // short-circuit in the case of busted things.
197074
197100
  // comments, etc.
@@ -197150,6 +197176,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
197150
197176
 
197151
197177
  // should be impossible.
197152
197178
  // some invalid regexp stuff in the set.
197179
+ /* istanbul ignore if */
197153
197180
  if (p === false) return false
197154
197181
 
197155
197182
  if (p === GLOBSTAR) {
@@ -197223,6 +197250,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
197223
197250
  // no match was found.
197224
197251
  // However, in partial mode, we can't say this is necessarily over.
197225
197252
  // If there's more *pattern* left, then
197253
+ /* istanbul ignore if */
197226
197254
  if (partial) {
197227
197255
  // ran out of file
197228
197256
  this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
@@ -197236,11 +197264,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
197236
197264
  // patterns with magic have been turned into regexps.
197237
197265
  var hit
197238
197266
  if (typeof p === 'string') {
197239
- if (options.nocase) {
197240
- hit = f.toLowerCase() === p.toLowerCase()
197241
- } else {
197242
- hit = f === p
197243
- }
197267
+ hit = f === p
197244
197268
  this.debug('string match', p, f, hit)
197245
197269
  } else {
197246
197270
  hit = f.match(p)
@@ -197271,16 +197295,16 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
197271
197295
  // this is ok if we're doing the match as part of
197272
197296
  // a glob fs traversal.
197273
197297
  return partial
197274
- } else if (pi === pl) {
197298
+ } else /* istanbul ignore else */ if (pi === pl) {
197275
197299
  // ran out of pattern, still have file left.
197276
197300
  // this is only acceptable if we're on the very last
197277
197301
  // empty segment of a file with a trailing slash.
197278
197302
  // a/* should match a/b/
197279
- var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
197280
- return emptyFileEnd
197303
+ return (fi === fl - 1) && (file[fi] === '')
197281
197304
  }
197282
197305
 
197283
197306
  // should be unreachable.
197307
+ /* istanbul ignore next */
197284
197308
  throw new Error('wtf?')
197285
197309
  }
197286
197310
 
@@ -238273,7 +238297,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
238273
238297
  };
238274
238298
  Object.defineProperty(exports, "__esModule", ({ value: true }));
238275
238299
  exports.detectBuilders = exports.detectOutputDirectory = exports.detectApiDirectory = exports.detectApiExtensions = exports.sortFiles = void 0;
238276
- const minimatch_1 = __importDefault(__webpack_require__(7767));
238300
+ const minimatch_1 = __importDefault(__webpack_require__(7345));
238277
238301
  const semver_1 = __webpack_require__(1039);
238278
238302
  const path_1 = __webpack_require__(5622);
238279
238303
  const frameworks_1 = __importDefault(__webpack_require__(6678));
@@ -239730,6 +239754,7 @@ const monorepo_managers_1 = __webpack_require__(3315);
239730
239754
  const package_managers_1 = __webpack_require__(4501);
239731
239755
  const detect_framework_1 = __webpack_require__(7244);
239732
239756
  const json5_1 = __importDefault(__webpack_require__(3406));
239757
+ const semver_1 = __importDefault(__webpack_require__(1039));
239733
239758
  class MissingBuildPipeline extends Error {
239734
239759
  constructor() {
239735
239760
  super('Missing required `build` pipeline in turbo.json or package.json Turbo configuration.');
@@ -239759,17 +239784,22 @@ async function getMonorepoDefaultSettings(projectName, projectPath, relativeToRo
239759
239784
  detectorFilesystem.readFile('package.json').catch(() => null),
239760
239785
  ]);
239761
239786
  let hasBuildPipeline = false;
239787
+ let turboSemVer = null;
239762
239788
  if (turboJSONBuf !== null) {
239763
239789
  const turboJSON = json5_1.default.parse(turboJSONBuf.toString('utf-8'));
239764
239790
  if (turboJSON?.pipeline?.build) {
239765
239791
  hasBuildPipeline = true;
239766
239792
  }
239767
239793
  }
239768
- else if (packageJSONBuf !== null) {
239794
+ if (packageJSONBuf !== null) {
239769
239795
  const packageJSON = JSON.parse(packageJSONBuf.toString('utf-8'));
239770
239796
  if (packageJSON?.turbo?.pipeline?.build) {
239771
239797
  hasBuildPipeline = true;
239772
239798
  }
239799
+ turboSemVer =
239800
+ packageJSON?.dependencies?.turbo ||
239801
+ packageJSON?.devDependencies?.turbo ||
239802
+ null;
239773
239803
  }
239774
239804
  if (!hasBuildPipeline) {
239775
239805
  throw new MissingBuildPipeline();
@@ -239777,16 +239807,24 @@ async function getMonorepoDefaultSettings(projectName, projectPath, relativeToRo
239777
239807
  if (projectPath === '/') {
239778
239808
  return {
239779
239809
  monorepoManager: 'turbo',
239780
- buildCommand: 'npx turbo run build',
239810
+ buildCommand: 'turbo run build',
239781
239811
  installCommand: packageManager ? `${packageManager} install` : null,
239782
239812
  commandForIgnoringBuildStep: 'npx turbo-ignore',
239783
239813
  };
239784
239814
  }
239815
+ let buildCommand = null;
239816
+ if (projectPath) {
239817
+ if (turboSemVer && !semver_1.default.intersects(turboSemVer, '<1.8.0')) {
239818
+ buildCommand = `turbo run build`;
239819
+ }
239820
+ else {
239821
+ // We don't know for sure if the local `turbo` supports inference.
239822
+ buildCommand = `cd ${relativeToRoot} && turbo run build --filter={${projectPath}}...`;
239823
+ }
239824
+ }
239785
239825
  return {
239786
239826
  monorepoManager: 'turbo',
239787
- buildCommand: projectPath
239788
- ? `cd ${relativeToRoot} && npx turbo run build --filter={${projectPath}}...`
239789
- : null,
239827
+ buildCommand,
239790
239828
  installCommand: packageManager === 'npm'
239791
239829
  ? `${packageManager} install --prefix=${relativeToRoot}`
239792
239830
  : packageManager
@@ -241626,7 +241664,7 @@ const PLUGIN_PATHS = {
241626
241664
  };
241627
241665
  async function injectPlugins(detectedVersion, dir) {
241628
241666
  const plugins = new Set();
241629
- if (process.env.VERCEL_GATSBY_BUILDER_PLUGIN === '1' && detectedVersion) {
241667
+ if (detectedVersion) {
241630
241668
  const version = semver_1.default.coerce(detectedVersion);
241631
241669
  if (version && semver_1.default.satisfies(version, '>=4.0.0')) {
241632
241670
  plugins.add('@vercel/gatsby-plugin-vercel-builder');
@@ -39,7 +39,7 @@ const PLUGIN_PATHS = {
39
39
  };
40
40
  async function injectPlugins(detectedVersion, dir) {
41
41
  const plugins = new Set();
42
- if (process.env.VERCEL_GATSBY_BUILDER_PLUGIN === '1' && detectedVersion) {
42
+ if (detectedVersion) {
43
43
  const version = semver_1.default.coerce(detectedVersion);
44
44
  if (version && semver_1.default.satisfies(version, '>=4.0.0')) {
45
45
  plugins.add('@vercel/gatsby-plugin-vercel-builder');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "1.3.20",
4
- "license": "MIT",
3
+ "version": "1.3.22",
4
+ "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
7
7
  "files": [
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@vercel/gatsby-plugin-vercel-analytics": "1.0.8",
33
- "@vercel/gatsby-plugin-vercel-builder": "1.2.5"
32
+ "@vercel/gatsby-plugin-vercel-analytics": "1.0.9",
33
+ "@vercel/gatsby-plugin-vercel-builder": "1.2.7"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/aws-lambda": "8.10.64",
@@ -42,12 +42,12 @@
42
42
  "@types/node-fetch": "2.5.4",
43
43
  "@types/promise-timeout": "1.3.0",
44
44
  "@types/semver": "7.3.13",
45
- "@vercel/build-utils": "6.6.0",
46
- "@vercel/frameworks": "1.3.3",
47
- "@vercel/fs-detectors": "3.8.7",
45
+ "@vercel/build-utils": "6.7.1",
46
+ "@vercel/frameworks": "1.3.4",
47
+ "@vercel/fs-detectors": "3.8.9",
48
48
  "@vercel/ncc": "0.24.0",
49
- "@vercel/routing-utils": "2.1.11",
50
- "@vercel/static-config": "2.0.14",
49
+ "@vercel/routing-utils": "2.2.0",
50
+ "@vercel/static-config": "2.0.15",
51
51
  "execa": "3.2.0",
52
52
  "fs-extra": "10.0.0",
53
53
  "get-port": "5.0.0",
@@ -60,5 +60,5 @@
60
60
  "ts-morph": "12.0.0",
61
61
  "typescript": "4.3.4"
62
62
  },
63
- "gitHead": "54514a44afef48726220bc8be8d20f4fda8e8b4f"
63
+ "gitHead": "925c8ba18ceec80174d9440cd2cad0e725ed4f56"
64
64
  }