@vercel/build-utils 3.1.1-canary.0 → 3.1.1

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.
@@ -1,7 +1,12 @@
1
1
  import { Framework } from '@vercel/frameworks';
2
2
  import { DetectorFilesystem } from './detectors/filesystem';
3
+ interface BaseFramework {
4
+ slug: Framework['slug'];
5
+ detectors?: Framework['detectors'];
6
+ }
3
7
  export interface DetectFrameworkOptions {
4
8
  fs: DetectorFilesystem;
5
- frameworkList: readonly Framework[];
9
+ frameworkList: readonly BaseFramework[];
6
10
  }
7
11
  export declare function detectFramework({ fs, frameworkList, }: DetectFrameworkOptions): Promise<string | null>;
12
+ export {};
@@ -125,7 +125,7 @@ function getSpawnOptions(meta, nodeVersion) {
125
125
  };
126
126
  if (!meta.isDev) {
127
127
  // Ensure that the selected Node version is at the beginning of the `$PATH`
128
- opts.env.PATH = `/node${nodeVersion.major}/bin:${opts.env.PATH}`;
128
+ opts.env.PATH = `/node${nodeVersion.major}/bin${path_1.default.delimiter}${opts.env.PATH || process.env.PATH}`;
129
129
  }
130
130
  return opts;
131
131
  }
@@ -304,14 +304,14 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
304
304
  lockfileVersion >= 2 &&
305
305
  ((nodeVersion === null || nodeVersion === void 0 ? void 0 : nodeVersion.major) || 0) < 16) {
306
306
  // Ensure that npm 7 is at the beginning of the `$PATH`
307
- newEnv.PATH = `/node16/bin-npm7:${env.PATH}`;
307
+ newEnv.PATH = `/node16/bin-npm7${path_1.default.delimiter}${env.PATH}`;
308
308
  console.log('Detected `package-lock.json` generated by npm 7...');
309
309
  }
310
310
  }
311
311
  else if (cliType === 'pnpm') {
312
312
  if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
313
313
  // Ensure that pnpm 7 is at the beginning of the `$PATH`
314
- newEnv.PATH = `/pnpm7/node_modules/.bin:${env.PATH}`;
314
+ newEnv.PATH = `/pnpm7/node_modules/.bin${path_1.default.delimiter}${env.PATH}`;
315
315
  console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
316
316
  }
317
317
  }
package/dist/index.d.ts CHANGED
@@ -32,3 +32,5 @@ export * from './errors';
32
32
  export declare const isOfficialRuntime: (desired: string, name?: string | undefined) => boolean;
33
33
  export declare const isStaticRuntime: (name?: string | undefined) => boolean;
34
34
  export { workspaceManagers } from './workspaces/workspace-managers';
35
+ export { getWorkspaces } from './workspaces/get-workspaces';
36
+ export { monorepoManagers } from './monorepos/monorepo-managers';
package/dist/index.js CHANGED
@@ -26857,7 +26857,6 @@ exports.frameworks = [
26857
26857
  placeholder: 'Next.js default',
26858
26858
  },
26859
26859
  },
26860
- getFsOutputDir: async () => '.next',
26861
26860
  getOutputDirName: async () => 'public',
26862
26861
  },
26863
26862
  {
@@ -26903,7 +26902,6 @@ exports.frameworks = [
26903
26902
  dependencies: ['next-plugin-sentry', 'next-sentry-source-maps'],
26904
26903
  },
26905
26904
  ],
26906
- getFsOutputDir: async () => '.next',
26907
26905
  getOutputDirName: async () => 'public',
26908
26906
  cachePattern: '.next/cache/**',
26909
26907
  },
@@ -26998,6 +26996,8 @@ exports.frameworks = [
26998
26996
  description: 'A new Remix app — the result of running `npx create-remix`.',
26999
26997
  website: 'https://remix.run',
27000
26998
  sort: 6,
26999
+ useRuntime: { src: 'package.json', use: '@vercel/remix' },
27000
+ ignoreRuntimes: ['@vercel/node'],
27001
27001
  detectors: {
27002
27002
  every: [
27003
27003
  {
@@ -27023,39 +27023,6 @@ exports.frameworks = [
27023
27023
  },
27024
27024
  dependency: 'remix',
27025
27025
  getOutputDirName: async () => 'public',
27026
- defaultRoutes: [
27027
- {
27028
- src: '^/build/(.*)$',
27029
- headers: { 'cache-control': 'public, max-age=31536000, immutable' },
27030
- continue: true,
27031
- },
27032
- {
27033
- handle: 'filesystem',
27034
- },
27035
- {
27036
- src: '/(.*)',
27037
- dest: '/api',
27038
- },
27039
- ],
27040
- defaultRewrites: [
27041
- {
27042
- source: '/(.*)',
27043
- regex: '/(.*)',
27044
- destination: '/api',
27045
- },
27046
- ],
27047
- defaultHeaders: [
27048
- {
27049
- source: '/build/(.*)',
27050
- regex: '/build/(.*)',
27051
- headers: [
27052
- {
27053
- key: 'cache-control',
27054
- value: 'public, max-age=31536000, immutable',
27055
- },
27056
- ],
27057
- },
27058
- ],
27059
27026
  },
27060
27027
  {
27061
27028
  name: 'Astro',
@@ -27092,7 +27059,6 @@ exports.frameworks = [
27092
27059
  },
27093
27060
  },
27094
27061
  dependency: 'astro',
27095
- getFsOutputDir: async () => 'dist',
27096
27062
  getOutputDirName: async () => 'dist',
27097
27063
  defaultRoutes: [
27098
27064
  {
@@ -27108,18 +27074,6 @@ exports.frameworks = [
27108
27074
  dest: '/index.html',
27109
27075
  },
27110
27076
  ],
27111
- defaultHeaders: [
27112
- {
27113
- source: '^/dist/(.*)$',
27114
- regex: '^/dist/(.*)$',
27115
- headers: [
27116
- {
27117
- key: 'cache-control',
27118
- value: 'public, max-age=31536000, immutable',
27119
- },
27120
- ],
27121
- },
27122
- ],
27123
27077
  },
27124
27078
  {
27125
27079
  name: 'Hexo',
@@ -27240,51 +27194,6 @@ exports.frameworks = [
27240
27194
  }
27241
27195
  return base;
27242
27196
  },
27243
- defaultHeaders: [
27244
- {
27245
- source: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
27246
- regex: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
27247
- headers: [
27248
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
27249
- ],
27250
- },
27251
- {
27252
- source: '^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
27253
- regex: '^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
27254
- headers: [
27255
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
27256
- ],
27257
- },
27258
- {
27259
- source: '^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
27260
- regex: '^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
27261
- headers: [
27262
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
27263
- ],
27264
- },
27265
- {
27266
- source: '^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
27267
- regex: '^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
27268
- headers: [
27269
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
27270
- ],
27271
- },
27272
- {
27273
- source: '^/ideal-img/[^/]+\\.[0-9a-f]{7}\\.\\d+\\.(png|jpe?g|gif)$',
27274
- regex: '^/ideal-img/[^/]+\\.[0-9a-f]{7}\\.\\d+\\.(png|jpe?g|gif)$',
27275
- headers: [
27276
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
27277
- ],
27278
- },
27279
- ],
27280
- defaultRedirects: [
27281
- {
27282
- source: '.*',
27283
- regex: '.*',
27284
- statusCode: 404,
27285
- destination: '404.html',
27286
- },
27287
- ],
27288
27197
  defaultRoutes: [
27289
27198
  {
27290
27199
  src: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js)$',
@@ -27413,13 +27322,6 @@ exports.frameworks = [
27413
27322
  dest: '/index.html',
27414
27323
  },
27415
27324
  ],
27416
- defaultRewrites: [
27417
- {
27418
- source: '/(.*)',
27419
- regex: '/(.*)',
27420
- destination: '/index.html',
27421
- },
27422
- ],
27423
27325
  },
27424
27326
  {
27425
27327
  name: 'SolidStart',
@@ -27518,13 +27420,6 @@ exports.frameworks = [
27518
27420
  continue: true,
27519
27421
  },
27520
27422
  ],
27521
- defaultRewrites: [
27522
- {
27523
- source: '/(.*)',
27524
- regex: '/(.*)',
27525
- destination: '/index.html',
27526
- },
27527
- ],
27528
27423
  },
27529
27424
  {
27530
27425
  name: 'Ember.js',
@@ -27569,13 +27464,6 @@ exports.frameworks = [
27569
27464
  dest: '/index.html',
27570
27465
  },
27571
27466
  ],
27572
- defaultRewrites: [
27573
- {
27574
- source: '/(.*)',
27575
- regex: '/(.*)',
27576
- destination: '/index.html',
27577
- },
27578
- ],
27579
27467
  },
27580
27468
  {
27581
27469
  name: 'Vue.js',
@@ -27631,27 +27519,6 @@ exports.frameworks = [
27631
27519
  dest: '/index.html',
27632
27520
  },
27633
27521
  ],
27634
- defaultHeaders: [
27635
- {
27636
- source: '^/[^/]*\\.(js|txt|ico|json)',
27637
- regex: '^/[^/]*\\.(js|txt|ico|json)',
27638
- headers: [{ key: 'cache-control', value: 'max-age=300' }],
27639
- },
27640
- {
27641
- source: '^/(img|js|css|fonts|media)/[^/]+\\.[0-9a-f]{8}\\.*',
27642
- regex: '^/(img|js|css|fonts|media)/[^/]+\\.[0-9a-f]{8}\\.*',
27643
- headers: [
27644
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
27645
- ],
27646
- },
27647
- ],
27648
- defaultRewrites: [
27649
- {
27650
- source: '^.*',
27651
- regex: '^.*',
27652
- destination: '/index.html',
27653
- },
27654
- ],
27655
27522
  },
27656
27523
  {
27657
27524
  name: 'Scully',
@@ -27730,13 +27597,6 @@ exports.frameworks = [
27730
27597
  dest: '/index.html',
27731
27598
  },
27732
27599
  ],
27733
- defaultRewrites: [
27734
- {
27735
- source: '/(.*)',
27736
- regex: '/(.*)',
27737
- destination: '/index.html',
27738
- },
27739
- ],
27740
27600
  },
27741
27601
  {
27742
27602
  name: 'Angular',
@@ -27795,13 +27655,6 @@ exports.frameworks = [
27795
27655
  dest: '/index.html',
27796
27656
  },
27797
27657
  ],
27798
- defaultRewrites: [
27799
- {
27800
- source: '/(.*)',
27801
- regex: '/(.*)',
27802
- destination: '/index.html',
27803
- },
27804
- ],
27805
27658
  },
27806
27659
  {
27807
27660
  name: 'Polymer',
@@ -27858,13 +27711,6 @@ exports.frameworks = [
27858
27711
  dest: '/index.html',
27859
27712
  },
27860
27713
  ],
27861
- defaultRewrites: [
27862
- {
27863
- source: '/(.*)',
27864
- regex: '/(.*)',
27865
- destination: '/index.html',
27866
- },
27867
- ],
27868
27714
  },
27869
27715
  {
27870
27716
  name: 'Svelte',
@@ -27913,13 +27759,6 @@ exports.frameworks = [
27913
27759
  dest: '/index.html',
27914
27760
  },
27915
27761
  ],
27916
- defaultRewrites: [
27917
- {
27918
- source: '/(.*)',
27919
- regex: '/(.*)',
27920
- destination: '/index.html',
27921
- },
27922
- ],
27923
27762
  },
27924
27763
  {
27925
27764
  name: 'SvelteKit',
@@ -28015,45 +27854,6 @@ exports.frameworks = [
28015
27854
  dest: '/index.html',
28016
27855
  },
28017
27856
  ],
28018
- defaultHeaders: [
28019
- {
28020
- source: '/static/(.*)',
28021
- regex: '/static/(.*)',
28022
- headers: [
28023
- { key: 'cache-control', value: 's-maxage=31536000, immutable' },
28024
- ],
28025
- },
28026
- {
28027
- source: '/service-worker.js',
28028
- regex: '/service-worker.js',
28029
- headers: [{ key: 'cache-control', value: 's-maxage=0' }],
28030
- },
28031
- {
28032
- source: '/(.*)',
28033
- regex: '/(.*)',
28034
- headers: [{ key: 'cache-control', value: 's-maxage=0' }],
28035
- },
28036
- ],
28037
- defaultRedirects: [
28038
- {
28039
- source: '/static/(.*)',
28040
- destination: '/404.html',
28041
- statusCode: 404,
28042
- regex: '/static/(.*)',
28043
- },
28044
- ],
28045
- defaultRewrites: [
28046
- {
28047
- source: '/sockjs-node/(.*)',
28048
- destination: '/sockjs-node/$1',
28049
- regex: '/sockjs-node/(.*)',
28050
- },
28051
- {
28052
- source: '/(.*)',
28053
- destination: '/index.html',
28054
- regex: '/(.*)',
28055
- },
28056
- ],
28057
27857
  },
28058
27858
  {
28059
27859
  name: 'Create React App',
@@ -28119,45 +27919,6 @@ exports.frameworks = [
28119
27919
  dest: '/index.html',
28120
27920
  },
28121
27921
  ],
28122
- defaultHeaders: [
28123
- {
28124
- source: '/static/(.*)',
28125
- regex: '/static/(.*)',
28126
- headers: [
28127
- { key: 'cache-control', value: 's-maxage=31536000, immutable' },
28128
- ],
28129
- },
28130
- {
28131
- source: '/service-worker.js',
28132
- regex: '/service-worker.js',
28133
- headers: [{ key: 'cache-control', value: 's-maxage=0' }],
28134
- },
28135
- {
28136
- source: '/(.*)',
28137
- regex: '/(.*)',
28138
- headers: [{ key: 'cache-control', value: 's-maxage=0' }],
28139
- },
28140
- ],
28141
- defaultRedirects: [
28142
- {
28143
- source: '/static/(.*)',
28144
- destination: '/404.html',
28145
- statusCode: 404,
28146
- regex: '/static/(.*)',
28147
- },
28148
- ],
28149
- defaultRewrites: [
28150
- {
28151
- source: '/sockjs-node/(.*)',
28152
- destination: '/sockjs-node/$1',
28153
- regex: '/sockjs-node/(.*)',
28154
- },
28155
- {
28156
- source: '/(.*)',
28157
- destination: '/index.html',
28158
- regex: '/(.*)',
28159
- },
28160
- ],
28161
27922
  },
28162
27923
  {
28163
27924
  name: 'Gridsome',
@@ -28237,13 +27998,6 @@ exports.frameworks = [
28237
27998
  dest: '/index.html',
28238
27999
  },
28239
28000
  ],
28240
- defaultRewrites: [
28241
- {
28242
- source: '/(.*)',
28243
- destination: '/index.html',
28244
- regex: '/(.*)',
28245
- },
28246
- ],
28247
28001
  },
28248
28002
  {
28249
28003
  name: 'Sapper',
@@ -28328,23 +28082,6 @@ exports.frameworks = [
28328
28082
  dest: '404.html',
28329
28083
  },
28330
28084
  ],
28331
- defaultHeaders: [
28332
- {
28333
- source: '/_saber/.*',
28334
- regex: '/_saber/.*',
28335
- headers: [
28336
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
28337
- ],
28338
- },
28339
- ],
28340
- defaultRedirects: [
28341
- {
28342
- source: '.*',
28343
- statusCode: 404,
28344
- destination: '404.html',
28345
- regex: '.*',
28346
- },
28347
- ],
28348
28085
  },
28349
28086
  {
28350
28087
  name: 'Stencil',
@@ -28404,32 +28141,6 @@ exports.frameworks = [
28404
28141
  dest: '/index.html',
28405
28142
  },
28406
28143
  ],
28407
- defaultHeaders: [
28408
- {
28409
- source: '/assets/(.*)',
28410
- regex: '/assets/(.*)',
28411
- headers: [{ key: 'cache-control', value: 'max-age=2592000' }],
28412
- },
28413
- {
28414
- source: '/build/p-.*',
28415
- regex: '/build/p-.*',
28416
- headers: [
28417
- { key: 'cache-control', value: 'max-age=31536000, immutable' },
28418
- ],
28419
- },
28420
- {
28421
- source: '/sw.js',
28422
- regex: '/sw.js',
28423
- headers: [{ key: 'cache-control', value: 'no-cache' }],
28424
- },
28425
- ],
28426
- defaultRewrites: [
28427
- {
28428
- source: '/(.*)',
28429
- destination: '/index.html',
28430
- regex: '/(.*)',
28431
- },
28432
- ],
28433
28144
  },
28434
28145
  {
28435
28146
  name: 'Nuxt.js',
@@ -28790,15 +28501,6 @@ exports.frameworks = [
28790
28501
  handle: 'filesystem',
28791
28502
  },
28792
28503
  ],
28793
- defaultHeaders: [
28794
- {
28795
- source: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js|png|jpg|webp|avif|svg)$',
28796
- regex: '^/[^./]+\\.[0-9a-f]{8}\\.(css|js|png|jpg|webp|avif|svg)$',
28797
- headers: [
28798
- { key: 'cache-control', value: 's-maxage=31536000, immutable' },
28799
- ],
28800
- },
28801
- ],
28802
28504
  },
28803
28505
  {
28804
28506
  name: 'Sanity',
@@ -28864,22 +28566,6 @@ exports.frameworks = [
28864
28566
  placeholder: '`public` if it exists, or `.`',
28865
28567
  },
28866
28568
  },
28867
- getFsOutputDir: async (dirPrefix) => {
28868
- // Public if it exists or `.`
28869
- let base = 'public';
28870
- try {
28871
- const location = path_1.join(dirPrefix, base);
28872
- const content = await readdir(location, { withFileTypes: true });
28873
- // If there is only one file in it that is a dir we'll use it as dist dir
28874
- if (content.length === 1 && content[0].isDirectory()) {
28875
- return path_1.join(base, content[0].name);
28876
- }
28877
- }
28878
- catch (_error) {
28879
- base = '.';
28880
- }
28881
- return base;
28882
- },
28883
28569
  getOutputDirName: async () => 'public',
28884
28570
  },
28885
28571
  ];
@@ -35075,7 +34761,7 @@ function getSpawnOptions(meta, nodeVersion) {
35075
34761
  };
35076
34762
  if (!meta.isDev) {
35077
34763
  // Ensure that the selected Node version is at the beginning of the `$PATH`
35078
- opts.env.PATH = `/node${nodeVersion.major}/bin:${opts.env.PATH}`;
34764
+ opts.env.PATH = `/node${nodeVersion.major}/bin${path_1.default.delimiter}${opts.env.PATH || process.env.PATH}`;
35079
34765
  }
35080
34766
  return opts;
35081
34767
  }
@@ -35254,14 +34940,14 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
35254
34940
  lockfileVersion >= 2 &&
35255
34941
  ((nodeVersion === null || nodeVersion === void 0 ? void 0 : nodeVersion.major) || 0) < 16) {
35256
34942
  // Ensure that npm 7 is at the beginning of the `$PATH`
35257
- newEnv.PATH = `/node16/bin-npm7:${env.PATH}`;
34943
+ newEnv.PATH = `/node16/bin-npm7${path_1.default.delimiter}${env.PATH}`;
35258
34944
  console.log('Detected `package-lock.json` generated by npm 7...');
35259
34945
  }
35260
34946
  }
35261
34947
  else if (cliType === 'pnpm') {
35262
34948
  if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
35263
34949
  // Ensure that pnpm 7 is at the beginning of the `$PATH`
35264
- newEnv.PATH = `/pnpm7/node_modules/.bin:${env.PATH}`;
34950
+ newEnv.PATH = `/pnpm7/node_modules/.bin${path_1.default.delimiter}${env.PATH}`;
35265
34951
  console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
35266
34952
  }
35267
34953
  }
@@ -35537,6 +35223,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35537
35223
  };
35538
35224
  Object.defineProperty(exports, "__esModule", ({ value: true }));
35539
35225
  exports.workspaceManagers = exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = 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.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
35226
+ exports.monorepoManagers = exports.getWorkspaces = void 0;
35540
35227
  const file_blob_1 = __importDefault(__webpack_require__(2397));
35541
35228
  exports.FileBlob = file_blob_1.default;
35542
35229
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -35630,6 +35317,10 @@ const isStaticRuntime = (name) => {
35630
35317
  exports.isStaticRuntime = isStaticRuntime;
35631
35318
  var workspace_managers_1 = __webpack_require__(4896);
35632
35319
  Object.defineProperty(exports, "workspaceManagers", ({ enumerable: true, get: function () { return workspace_managers_1.workspaceManagers; } }));
35320
+ var get_workspaces_1 = __webpack_require__(9740);
35321
+ Object.defineProperty(exports, "getWorkspaces", ({ enumerable: true, get: function () { return get_workspaces_1.getWorkspaces; } }));
35322
+ var monorepo_managers_1 = __webpack_require__(6418);
35323
+ Object.defineProperty(exports, "monorepoManagers", ({ enumerable: true, get: function () { return monorepo_managers_1.monorepoManagers; } }));
35633
35324
 
35634
35325
 
35635
35326
  /***/ }),
@@ -35769,6 +35460,48 @@ async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
35769
35460
  exports.getLambdaOptionsFromFunction = getLambdaOptionsFromFunction;
35770
35461
 
35771
35462
 
35463
+ /***/ }),
35464
+
35465
+ /***/ 6418:
35466
+ /***/ ((__unused_webpack_module, exports) => {
35467
+
35468
+ "use strict";
35469
+
35470
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35471
+ exports.monorepoManagers = void 0;
35472
+ /**
35473
+ * The supported list of monorepo managers.
35474
+ *
35475
+ * This list is designed to work with the @see {@link detectFramework} function.
35476
+ *
35477
+ * @example
35478
+ * import { monorepoManagers as frameworkList } from '@vercel/build-utils'
35479
+ * import { detectFramework } from '@vercel/build-utils'
35480
+ *
35481
+ * const fs = new GitDetectorFilesystem(...)
35482
+ * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
35483
+ *
35484
+ */
35485
+ exports.monorepoManagers = [
35486
+ {
35487
+ name: 'Turborepo',
35488
+ slug: 'turbo',
35489
+ detectors: {
35490
+ some: [
35491
+ {
35492
+ path: 'turbo.json',
35493
+ },
35494
+ {
35495
+ path: 'package.json',
35496
+ matchContent: '"turbo":\\s*{[^}]*.+[^}]*}',
35497
+ },
35498
+ ],
35499
+ },
35500
+ },
35501
+ ];
35502
+ exports.default = exports.monorepoManagers;
35503
+
35504
+
35772
35505
  /***/ }),
35773
35506
 
35774
35507
  /***/ 7049:
@@ -35950,6 +35683,49 @@ function hasProp(obj, key) {
35950
35683
  Object.defineProperty(exports, "__esModule", ({ value: true }));
35951
35684
 
35952
35685
 
35686
+ /***/ }),
35687
+
35688
+ /***/ 9740:
35689
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
35690
+
35691
+ "use strict";
35692
+
35693
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35694
+ return (mod && mod.__esModule) ? mod : { "default": mod };
35695
+ };
35696
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35697
+ exports.getWorkspaces = void 0;
35698
+ const path_1 = __importDefault(__webpack_require__(5622));
35699
+ const workspace_managers_1 = __webpack_require__(4896);
35700
+ const detect_framework_1 = __webpack_require__(5224);
35701
+ const MAX_DEPTH_TRAVERSE = 3;
35702
+ const posixPath = path_1.default.posix;
35703
+ async function getWorkspaces({ fs, depth = MAX_DEPTH_TRAVERSE, cwd = '/', }) {
35704
+ if (depth === 0)
35705
+ return [];
35706
+ const workspaceType = await detect_framework_1.detectFramework({
35707
+ fs,
35708
+ frameworkList: workspace_managers_1.workspaceManagers,
35709
+ });
35710
+ if (workspaceType === null) {
35711
+ const directoryContents = await fs.readdir('./');
35712
+ const childDirectories = directoryContents.filter(stat => stat.type === 'dir');
35713
+ return (await Promise.all(childDirectories.map(childDirectory => getWorkspaces({
35714
+ fs: fs.chdir(childDirectory.path),
35715
+ depth: depth - 1,
35716
+ cwd: posixPath.join(cwd, childDirectory.path),
35717
+ })))).flat();
35718
+ }
35719
+ return [
35720
+ {
35721
+ type: workspaceType,
35722
+ rootPath: cwd,
35723
+ },
35724
+ ];
35725
+ }
35726
+ exports.getWorkspaces = getWorkspaces;
35727
+
35728
+
35953
35729
  /***/ }),
35954
35730
 
35955
35731
  /***/ 4896:
@@ -35965,13 +35741,12 @@ exports.workspaceManagers = void 0;
35965
35741
  * This list is designed to work with the @see {@link detectFramework} function.
35966
35742
  *
35967
35743
  * @example
35968
- * import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
35744
+ * import { workspaceManagers as frameworkList } from '@vercel/build-utils'
35969
35745
  * import { detectFramework } from '@vercel/build-utils'
35970
35746
  *
35971
35747
  * const fs = new GitDetectorFilesystem(...)
35972
35748
  * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
35973
35749
  *
35974
- * @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
35975
35750
  */
35976
35751
  exports.workspaceManagers = [
35977
35752
  {
@@ -35988,28 +35763,6 @@ exports.workspaceManagers = [
35988
35763
  },
35989
35764
  ],
35990
35765
  },
35991
- // unused props - needed for typescript
35992
- description: '',
35993
- logo: '',
35994
- settings: {
35995
- buildCommand: {
35996
- value: '',
35997
- placeholder: '',
35998
- },
35999
- devCommand: {
36000
- value: '',
36001
- placeholder: '',
36002
- },
36003
- installCommand: {
36004
- value: '',
36005
- placeholder: '',
36006
- },
36007
- outputDirectory: {
36008
- value: '',
36009
- placeholder: '',
36010
- },
36011
- },
36012
- getOutputDirName: () => Promise.resolve(''),
36013
35766
  },
36014
35767
  {
36015
35768
  name: 'pnpm',
@@ -36021,28 +35774,6 @@ exports.workspaceManagers = [
36021
35774
  },
36022
35775
  ],
36023
35776
  },
36024
- // unused props - needed for typescript
36025
- description: '',
36026
- logo: '',
36027
- settings: {
36028
- buildCommand: {
36029
- value: '',
36030
- placeholder: '',
36031
- },
36032
- devCommand: {
36033
- value: '',
36034
- placeholder: '',
36035
- },
36036
- installCommand: {
36037
- value: '',
36038
- placeholder: '',
36039
- },
36040
- outputDirectory: {
36041
- value: '',
36042
- placeholder: '',
36043
- },
36044
- },
36045
- getOutputDirName: () => Promise.resolve(''),
36046
35777
  },
36047
35778
  {
36048
35779
  name: 'npm',
@@ -36058,28 +35789,6 @@ exports.workspaceManagers = [
36058
35789
  },
36059
35790
  ],
36060
35791
  },
36061
- // unused props - needed for typescript
36062
- description: '',
36063
- logo: '',
36064
- settings: {
36065
- buildCommand: {
36066
- value: '',
36067
- placeholder: '',
36068
- },
36069
- devCommand: {
36070
- value: '',
36071
- placeholder: '',
36072
- },
36073
- installCommand: {
36074
- value: '',
36075
- placeholder: '',
36076
- },
36077
- outputDirectory: {
36078
- value: '',
36079
- placeholder: '',
36080
- },
36081
- },
36082
- getOutputDirName: () => Promise.resolve(''),
36083
35792
  },
36084
35793
  ];
36085
35794
  exports.default = exports.workspaceManagers;
@@ -0,0 +1,16 @@
1
+ import type { Framework } from '@vercel/frameworks';
2
+ /**
3
+ * The supported list of monorepo managers.
4
+ *
5
+ * This list is designed to work with the @see {@link detectFramework} function.
6
+ *
7
+ * @example
8
+ * import { monorepoManagers as frameworkList } from '@vercel/build-utils'
9
+ * import { detectFramework } from '@vercel/build-utils'
10
+ *
11
+ * const fs = new GitDetectorFilesystem(...)
12
+ * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
13
+ *
14
+ */
15
+ export declare const monorepoManagers: Array<Omit<Framework, 'description' | 'logo' | 'settings' | 'getOutputDirName'>>;
16
+ export default monorepoManagers;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.monorepoManagers = void 0;
4
+ /**
5
+ * The supported list of monorepo managers.
6
+ *
7
+ * This list is designed to work with the @see {@link detectFramework} function.
8
+ *
9
+ * @example
10
+ * import { monorepoManagers as frameworkList } from '@vercel/build-utils'
11
+ * import { detectFramework } from '@vercel/build-utils'
12
+ *
13
+ * const fs = new GitDetectorFilesystem(...)
14
+ * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
15
+ *
16
+ */
17
+ exports.monorepoManagers = [
18
+ {
19
+ name: 'Turborepo',
20
+ slug: 'turbo',
21
+ detectors: {
22
+ some: [
23
+ {
24
+ path: 'turbo.json',
25
+ },
26
+ {
27
+ path: 'package.json',
28
+ matchContent: '"turbo":\\s*{[^}]*.+[^}]*}',
29
+ },
30
+ ],
31
+ },
32
+ },
33
+ ];
34
+ exports.default = exports.monorepoManagers;
package/dist/types.d.ts CHANGED
@@ -310,11 +310,37 @@ export interface BuilderV3 {
310
310
  startDevServer?: StartDevServer;
311
311
  }
312
312
  declare type ImageFormat = 'image/avif' | 'image/webp';
313
+ export declare type RemotePattern = {
314
+ /**
315
+ * Must be `http` or `https`.
316
+ */
317
+ protocol?: 'http' | 'https';
318
+ /**
319
+ * Can be literal or wildcard.
320
+ * Single `*` matches a single subdomain.
321
+ * Double `**` matches any number of subdomains.
322
+ */
323
+ hostname: string;
324
+ /**
325
+ * Can be literal port such as `8080` or empty string
326
+ * meaning no port.
327
+ */
328
+ port?: string;
329
+ /**
330
+ * Can be literal or wildcard.
331
+ * Single `*` matches a single path segment.
332
+ * Double `**` matches any number of path segments.
333
+ */
334
+ pathname?: string;
335
+ };
313
336
  export interface Images {
314
337
  domains: string[];
338
+ remotePatterns?: RemotePattern[];
315
339
  sizes: number[];
316
340
  minimumCacheTTL?: number;
317
341
  formats?: ImageFormat[];
342
+ dangerouslyAllowSVG?: boolean;
343
+ contentSecurityPolicy?: string;
318
344
  }
319
345
  /**
320
346
  * If a Builder ends up creating filesystem outputs conforming to
@@ -0,0 +1,12 @@
1
+ import { DetectorFilesystem } from '../detectors/filesystem';
2
+ export interface GetWorkspaceOptions {
3
+ fs: DetectorFilesystem;
4
+ depth?: number;
5
+ cwd?: string;
6
+ }
7
+ export declare type WorkspaceType = 'yarn' | 'pnpm' | 'npm';
8
+ export declare type Workspace = {
9
+ type: WorkspaceType;
10
+ rootPath: string;
11
+ };
12
+ export declare function getWorkspaces({ fs, depth, cwd, }: GetWorkspaceOptions): Promise<Workspace[]>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWorkspaces = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const workspace_managers_1 = require("./workspace-managers");
9
+ const detect_framework_1 = require("../detect-framework");
10
+ const MAX_DEPTH_TRAVERSE = 3;
11
+ const posixPath = path_1.default.posix;
12
+ async function getWorkspaces({ fs, depth = MAX_DEPTH_TRAVERSE, cwd = '/', }) {
13
+ if (depth === 0)
14
+ return [];
15
+ const workspaceType = await detect_framework_1.detectFramework({
16
+ fs,
17
+ frameworkList: workspace_managers_1.workspaceManagers,
18
+ });
19
+ if (workspaceType === null) {
20
+ const directoryContents = await fs.readdir('./');
21
+ const childDirectories = directoryContents.filter(stat => stat.type === 'dir');
22
+ return (await Promise.all(childDirectories.map(childDirectory => getWorkspaces({
23
+ fs: fs.chdir(childDirectory.path),
24
+ depth: depth - 1,
25
+ cwd: posixPath.join(cwd, childDirectory.path),
26
+ })))).flat();
27
+ }
28
+ return [
29
+ {
30
+ type: workspaceType,
31
+ rootPath: cwd,
32
+ },
33
+ ];
34
+ }
35
+ exports.getWorkspaces = getWorkspaces;
@@ -5,13 +5,12 @@ import type { Framework } from '@vercel/frameworks';
5
5
  * This list is designed to work with the @see {@link detectFramework} function.
6
6
  *
7
7
  * @example
8
- * import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
8
+ * import { workspaceManagers as frameworkList } from '@vercel/build-utils'
9
9
  * import { detectFramework } from '@vercel/build-utils'
10
10
  *
11
11
  * const fs = new GitDetectorFilesystem(...)
12
12
  * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
13
13
  *
14
- * @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
15
14
  */
16
- export declare const workspaceManagers: Array<Framework>;
15
+ export declare const workspaceManagers: Array<Omit<Framework, 'description' | 'logo' | 'settings' | 'getOutputDirName'>>;
17
16
  export default workspaceManagers;
@@ -7,13 +7,12 @@ exports.workspaceManagers = void 0;
7
7
  * This list is designed to work with the @see {@link detectFramework} function.
8
8
  *
9
9
  * @example
10
- * import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
10
+ * import { workspaceManagers as frameworkList } from '@vercel/build-utils'
11
11
  * import { detectFramework } from '@vercel/build-utils'
12
12
  *
13
13
  * const fs = new GitDetectorFilesystem(...)
14
14
  * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
15
15
  *
16
- * @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
17
16
  */
18
17
  exports.workspaceManagers = [
19
18
  {
@@ -30,28 +29,6 @@ exports.workspaceManagers = [
30
29
  },
31
30
  ],
32
31
  },
33
- // unused props - needed for typescript
34
- description: '',
35
- logo: '',
36
- settings: {
37
- buildCommand: {
38
- value: '',
39
- placeholder: '',
40
- },
41
- devCommand: {
42
- value: '',
43
- placeholder: '',
44
- },
45
- installCommand: {
46
- value: '',
47
- placeholder: '',
48
- },
49
- outputDirectory: {
50
- value: '',
51
- placeholder: '',
52
- },
53
- },
54
- getOutputDirName: () => Promise.resolve(''),
55
32
  },
56
33
  {
57
34
  name: 'pnpm',
@@ -63,28 +40,6 @@ exports.workspaceManagers = [
63
40
  },
64
41
  ],
65
42
  },
66
- // unused props - needed for typescript
67
- description: '',
68
- logo: '',
69
- settings: {
70
- buildCommand: {
71
- value: '',
72
- placeholder: '',
73
- },
74
- devCommand: {
75
- value: '',
76
- placeholder: '',
77
- },
78
- installCommand: {
79
- value: '',
80
- placeholder: '',
81
- },
82
- outputDirectory: {
83
- value: '',
84
- placeholder: '',
85
- },
86
- },
87
- getOutputDirName: () => Promise.resolve(''),
88
43
  },
89
44
  {
90
45
  name: 'npm',
@@ -100,28 +55,6 @@ exports.workspaceManagers = [
100
55
  },
101
56
  ],
102
57
  },
103
- // unused props - needed for typescript
104
- description: '',
105
- logo: '',
106
- settings: {
107
- buildCommand: {
108
- value: '',
109
- placeholder: '',
110
- },
111
- devCommand: {
112
- value: '',
113
- placeholder: '',
114
- },
115
- installCommand: {
116
- value: '',
117
- placeholder: '',
118
- },
119
- outputDirectory: {
120
- value: '',
121
- placeholder: '',
122
- },
123
- },
124
- getOutputDirName: () => Promise.resolve(''),
125
58
  },
126
59
  ];
127
60
  exports.default = exports.workspaceManagers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "3.1.1-canary.0",
3
+ "version": "3.1.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -31,7 +31,7 @@
31
31
  "@types/node-fetch": "^2.1.6",
32
32
  "@types/semver": "6.0.0",
33
33
  "@types/yazl": "2.4.2",
34
- "@vercel/frameworks": "0.9.1",
34
+ "@vercel/frameworks": "1.0.0",
35
35
  "@vercel/ncc": "0.24.0",
36
36
  "aggregate-error": "3.0.1",
37
37
  "async-retry": "1.2.3",
@@ -50,5 +50,5 @@
50
50
  "typescript": "4.3.4",
51
51
  "yazl": "2.5.1"
52
52
  },
53
- "gitHead": "e829ce47c356a06564551349e771b457ea95ac74"
53
+ "gitHead": "ad436313e155b0e07cb14475e11c5c12e1b36f75"
54
54
  }