@vercel/build-utils
Advanced tools
Comparing version 2.4.3-canary.3 to 2.4.3-canary.4
@@ -10,3 +10,6 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const frameworks_1 = __importDefault(require("@vercel/frameworks")); | ||
const _1 = require("./"); | ||
const frameworkList = frameworks_1.default; | ||
const slugToFramework = new Map(frameworkList.map(f => [f.slug, f])); | ||
// We need to sort the file paths by alphabet to make | ||
@@ -48,2 +51,3 @@ // sure the routes stay in the same order e.g. for deduping | ||
async function detectBuilders(files, pkg, options = {}) { | ||
var _a; | ||
const errors = []; | ||
@@ -65,3 +69,2 @@ const warnings = []; | ||
} | ||
const apiMatches = getApiMatches(options); | ||
const sortedFiles = files.sort(sortFiles); | ||
@@ -79,2 +82,10 @@ const apiSortedFiles = files.sort(sortFilesBySegmentCount); | ||
const { buildCommand, outputDirectory, framework } = projectSettings; | ||
const ignoreRuntimes = new Set((_a = slugToFramework.get(framework || '')) === null || _a === void 0 ? void 0 : _a.ignoreRuntimes); | ||
const withTag = options.tag ? `@${options.tag}` : ''; | ||
const apiMatches = getApiMatches() | ||
.filter(b => !ignoreRuntimes.has(b.use)) | ||
.map(b => { | ||
b.use = `${b.use}${withTag}`; | ||
return b; | ||
}); | ||
// If either is missing we'll make the frontend static | ||
@@ -211,8 +222,2 @@ const makeFrontendStatic = buildCommand === '' || outputDirectory === ''; | ||
const routesResult = getRouteResult(apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options); | ||
if (frontendBuilder && framework === 'redwoodjs') { | ||
// RedwoodJS uses the /api directory differently so we must | ||
// clear any existing builders and only use `@vercel/redwood`. | ||
builders.length = 0; | ||
builders.push(frontendBuilder); | ||
} | ||
return { | ||
@@ -280,11 +285,10 @@ warnings, | ||
} | ||
function getApiMatches({ tag } = {}) { | ||
const withTag = tag ? `@${tag}` : ''; | ||
function getApiMatches() { | ||
const config = { zeroConfig: true }; | ||
return [ | ||
{ src: 'api/**/*.js', use: `@vercel/node${withTag}`, config }, | ||
{ src: 'api/**/*.ts', use: `@vercel/node${withTag}`, config }, | ||
{ src: 'api/**/!(*_test).go', use: `@vercel/go${withTag}`, config }, | ||
{ src: 'api/**/*.py', use: `@vercel/python${withTag}`, config }, | ||
{ src: 'api/**/*.rb', use: `@vercel/ruby${withTag}`, config }, | ||
{ src: 'api/**/*.js', use: `@vercel/node`, config }, | ||
{ src: 'api/**/*.ts', use: `@vercel/node`, config }, | ||
{ src: 'api/**/!(*_test).go', use: `@vercel/go`, config }, | ||
{ src: 'api/**/*.py', use: `@vercel/python`, config }, | ||
{ src: 'api/**/*.rb', use: `@vercel/ruby`, config }, | ||
]; | ||
@@ -334,8 +338,7 @@ } | ||
} | ||
if (framework === 'nextjs' || framework === 'blitzjs') { | ||
return { src: 'package.json', use: `@vercel/next${withTag}`, config }; | ||
const f = slugToFramework.get(framework || ''); | ||
if (f && f.useRuntime) { | ||
const { src, use } = f.useRuntime; | ||
return { src, use: `${use}${withTag}`, config }; | ||
} | ||
if (framework === 'redwoodjs') { | ||
return { src: 'package.json', use: `@vercel/redwood${withTag}`, config }; | ||
} | ||
// Entrypoints for other frameworks | ||
@@ -766,3 +769,3 @@ // TODO - What if just a build script is provided, but no entrypoint. | ||
} | ||
return 0; | ||
return fileA.localeCompare(fileB); | ||
} |
{ | ||
"name": "@vercel/build-utils", | ||
"version": "2.4.3-canary.3", | ||
"version": "2.4.3-canary.4", | ||
"license": "MIT", | ||
@@ -32,2 +32,3 @@ "main": "./dist/index.js", | ||
"@types/yazl": "^2.4.1", | ||
"@vercel/frameworks": "0.0.18-canary.5", | ||
"aggregate-error": "3.0.1", | ||
@@ -52,3 +53,3 @@ "async-retry": "1.2.3", | ||
}, | ||
"gitHead": "23dce48b23ac4dd3f0baac97c83eb63ee9016afc" | ||
"gitHead": "828244293934439370463b050eec5514323c1c32" | ||
} |
@@ -16,3 +16,3 @@ { | ||
"strict": true, | ||
"target": "esnext" | ||
"target": "es2019" | ||
}, | ||
@@ -19,0 +19,0 @@ "include": ["src/**/*"], |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1254617
30579
31