@vercel/build-utils 2.12.3-canary.21 → 2.12.3-canary.25
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.
@@ -30,11 +30,30 @@ export declare function updateFunctionsManifest({ vercelConfig, workPath, pages,
|
|
30
30
|
};
|
31
31
|
}): Promise<void>;
|
32
32
|
/**
|
33
|
-
*
|
34
|
-
* If the file does not exist, it
|
33
|
+
* Append routes to the `routes-manifest.json` file.
|
34
|
+
* If the file does not exist, it will be created.
|
35
35
|
*/
|
36
|
-
export declare function updateRoutesManifest({ workPath, dynamicRoutes, }: {
|
36
|
+
export declare function updateRoutesManifest({ workPath, redirects, rewrites, headers, dynamicRoutes, staticRoutes, }: {
|
37
37
|
workPath: string;
|
38
|
+
redirects?: {
|
39
|
+
source: string;
|
40
|
+
destination: string;
|
41
|
+
statusCode: number;
|
42
|
+
regex: string;
|
43
|
+
}[];
|
44
|
+
rewrites?: {
|
45
|
+
source: string;
|
46
|
+
destination: string;
|
47
|
+
regex: string;
|
48
|
+
}[];
|
49
|
+
headers?: {
|
50
|
+
source: string;
|
51
|
+
headers: {
|
52
|
+
key: string;
|
53
|
+
value: string;
|
54
|
+
}[];
|
55
|
+
regex: string;
|
56
|
+
}[];
|
38
57
|
dynamicRoutes?: {
|
39
58
|
page: string;
|
40
59
|
regex: string;
|
@@ -43,4 +62,12 @@ export declare function updateRoutesManifest({ workPath, dynamicRoutes, }: {
|
|
43
62
|
[named: string]: string;
|
44
63
|
};
|
45
64
|
}[];
|
65
|
+
staticRoutes?: {
|
66
|
+
page: string;
|
67
|
+
regex: string;
|
68
|
+
namedRegex?: string;
|
69
|
+
routeKeys?: {
|
70
|
+
[named: string]: string;
|
71
|
+
};
|
72
|
+
}[];
|
46
73
|
}): Promise<void>;
|
@@ -46,7 +46,7 @@ function convertRuntimeToPlugin(buildRuntime, ext) {
|
|
46
46
|
maxDuration: output.maxDuration,
|
47
47
|
environment: output.environment,
|
48
48
|
allowQuery: output.allowQuery,
|
49
|
-
regions: output.regions,
|
49
|
+
//regions: output.regions,
|
50
50
|
};
|
51
51
|
// @ts-ignore This symbol is a private API
|
52
52
|
const lambdaFiles = output[lambda_1.FILES_SYMBOL];
|
@@ -133,21 +133,41 @@ async function updateFunctionsManifest({ vercelConfig, workPath, pages, }) {
|
|
133
133
|
}
|
134
134
|
exports.updateFunctionsManifest = updateFunctionsManifest;
|
135
135
|
/**
|
136
|
-
*
|
137
|
-
* If the file does not exist, it
|
136
|
+
* Append routes to the `routes-manifest.json` file.
|
137
|
+
* If the file does not exist, it will be created.
|
138
138
|
*/
|
139
|
-
async function updateRoutesManifest({ workPath, dynamicRoutes, }) {
|
139
|
+
async function updateRoutesManifest({ workPath, redirects, rewrites, headers, dynamicRoutes, staticRoutes, }) {
|
140
140
|
const routesManifestPath = path_1.join(workPath, '.output', 'routes-manifest.json');
|
141
141
|
const routesManifest = await readJson(routesManifestPath);
|
142
142
|
if (!routesManifest.version)
|
143
|
-
routesManifest.version =
|
143
|
+
routesManifest.version = 3;
|
144
144
|
if (routesManifest.pages404 === undefined)
|
145
145
|
routesManifest.pages404 = true;
|
146
|
+
if (redirects) {
|
147
|
+
if (!routesManifest.redirects)
|
148
|
+
routesManifest.redirects = [];
|
149
|
+
routesManifest.redirects.push(...redirects);
|
150
|
+
}
|
151
|
+
if (rewrites) {
|
152
|
+
if (!routesManifest.rewrites)
|
153
|
+
routesManifest.rewrites = [];
|
154
|
+
routesManifest.rewrites.push(...rewrites);
|
155
|
+
}
|
156
|
+
if (headers) {
|
157
|
+
if (!routesManifest.headers)
|
158
|
+
routesManifest.headers = [];
|
159
|
+
routesManifest.headers.push(...headers);
|
160
|
+
}
|
146
161
|
if (dynamicRoutes) {
|
147
162
|
if (!routesManifest.dynamicRoutes)
|
148
163
|
routesManifest.dynamicRoutes = [];
|
149
164
|
routesManifest.dynamicRoutes.push(...dynamicRoutes);
|
150
165
|
}
|
166
|
+
if (staticRoutes) {
|
167
|
+
if (!routesManifest.staticRoutes)
|
168
|
+
routesManifest.staticRoutes = [];
|
169
|
+
routesManifest.staticRoutes.push(...staticRoutes);
|
170
|
+
}
|
151
171
|
await fs_extra_1.default.writeFile(routesManifestPath, JSON.stringify(routesManifest));
|
152
172
|
}
|
153
173
|
exports.updateRoutesManifest = updateRoutesManifest;
|
@@ -34,5 +34,11 @@ export declare function detectBuilders(files: string[], pkg?: PackageJson | unde
|
|
34
34
|
redirectRoutes: Route[] | null;
|
35
35
|
rewriteRoutes: Route[] | null;
|
36
36
|
errorRoutes: Route[] | null;
|
37
|
+
limitedRoutes: LimitedRoutes | null;
|
37
38
|
}>;
|
39
|
+
interface LimitedRoutes {
|
40
|
+
defaultRoutes: Route[];
|
41
|
+
redirectRoutes: Route[];
|
42
|
+
rewriteRoutes: Route[];
|
43
|
+
}
|
38
44
|
export {};
|
package/dist/detect-builders.js
CHANGED
@@ -66,6 +66,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
66
66
|
redirectRoutes: null,
|
67
67
|
rewriteRoutes: null,
|
68
68
|
errorRoutes: null,
|
69
|
+
limitedRoutes: null,
|
69
70
|
};
|
70
71
|
}
|
71
72
|
const sortedFiles = files.sort(sortFiles);
|
@@ -113,6 +114,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
113
114
|
redirectRoutes: null,
|
114
115
|
rewriteRoutes: null,
|
115
116
|
errorRoutes: null,
|
117
|
+
limitedRoutes: null,
|
116
118
|
};
|
117
119
|
}
|
118
120
|
if (apiRoute) {
|
@@ -167,6 +169,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
167
169
|
defaultRoutes: null,
|
168
170
|
rewriteRoutes: null,
|
169
171
|
errorRoutes: null,
|
172
|
+
limitedRoutes: null,
|
170
173
|
};
|
171
174
|
}
|
172
175
|
// If `outputDirectory` is an empty string,
|
@@ -203,6 +206,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
203
206
|
defaultRoutes: null,
|
204
207
|
rewriteRoutes: null,
|
205
208
|
errorRoutes: null,
|
209
|
+
limitedRoutes: null,
|
206
210
|
};
|
207
211
|
}
|
208
212
|
const builders = [];
|
@@ -221,7 +225,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
221
225
|
});
|
222
226
|
}
|
223
227
|
}
|
224
|
-
const routesResult = getRouteResult(apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
|
228
|
+
const routesResult = getRouteResult(pkg, apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
|
225
229
|
return {
|
226
230
|
warnings,
|
227
231
|
builders: builders.length ? builders : null,
|
@@ -230,6 +234,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
230
234
|
defaultRoutes: routesResult.defaultRoutes,
|
231
235
|
rewriteRoutes: routesResult.rewriteRoutes,
|
232
236
|
errorRoutes: routesResult.errorRoutes,
|
237
|
+
limitedRoutes: routesResult.limitedRoutes,
|
233
238
|
};
|
234
239
|
}
|
235
240
|
exports.detectBuilders = detectBuilders;
|
@@ -670,23 +675,51 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
670
675
|
}
|
671
676
|
return { route, isDynamic };
|
672
677
|
}
|
673
|
-
function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
678
|
+
function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
674
679
|
var _a, _b;
|
680
|
+
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
675
681
|
const defaultRoutes = [];
|
676
682
|
const redirectRoutes = [];
|
677
683
|
const rewriteRoutes = [];
|
678
684
|
const errorRoutes = [];
|
685
|
+
const limitedRoutes = {
|
686
|
+
defaultRoutes: [],
|
687
|
+
redirectRoutes: [],
|
688
|
+
rewriteRoutes: [],
|
689
|
+
};
|
679
690
|
const framework = ((_a = frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) === null || _a === void 0 ? void 0 : _a.framework) || '';
|
680
691
|
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.use);
|
681
692
|
const ignoreRuntimes = (_b = slugToFramework.get(framework)) === null || _b === void 0 ? void 0 : _b.ignoreRuntimes;
|
682
693
|
if (apiRoutes && apiRoutes.length > 0) {
|
683
694
|
if (options.featHandleMiss) {
|
695
|
+
// Exclude extension names if the corresponding plugin is not found in package.json
|
696
|
+
// detectBuilders({ignoreRoutesForBuilders: ['@vercel/python']})
|
697
|
+
// return a copy of routes.
|
698
|
+
// We should exclud errorRoutes and
|
684
699
|
const extSet = detectApiExtensions(apiBuilders);
|
700
|
+
const withTag = options.tag ? `@${options.tag}` : '';
|
701
|
+
const extSetLimited = detectApiExtensions(apiBuilders.filter(b => {
|
702
|
+
if (b.use === `@vercel/python${withTag}` &&
|
703
|
+
!('vercel-plugin-python' in deps)) {
|
704
|
+
return false;
|
705
|
+
}
|
706
|
+
if (b.use === `@vercel/go${withTag}` &&
|
707
|
+
!('vercel-plugin-go' in deps)) {
|
708
|
+
return false;
|
709
|
+
}
|
710
|
+
if (b.use === `@vercel/ruby${withTag}` &&
|
711
|
+
!('vercel-plugin-ruby' in deps)) {
|
712
|
+
return false;
|
713
|
+
}
|
714
|
+
return true;
|
715
|
+
}));
|
685
716
|
if (extSet.size > 0) {
|
686
|
-
const
|
717
|
+
const extGroup = `(?:\\.(?:${Array.from(extSet)
|
687
718
|
.map(ext => ext.slice(1))
|
688
|
-
.join('|')
|
689
|
-
const
|
719
|
+
.join('|')}))`;
|
720
|
+
const extGroupLimited = `(?:\\.(?:${Array.from(extSetLimited)
|
721
|
+
.map(ext => ext.slice(1))
|
722
|
+
.join('|')}))`;
|
690
723
|
if (options.cleanUrls) {
|
691
724
|
redirectRoutes.push({
|
692
725
|
src: `^/(api(?:.+)?)/index${extGroup}?/?$`,
|
@@ -700,6 +733,18 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
700
733
|
},
|
701
734
|
status: 308,
|
702
735
|
});
|
736
|
+
limitedRoutes.redirectRoutes.push({
|
737
|
+
src: `^/(api(?:.+)?)/index${extGroupLimited}?/?$`,
|
738
|
+
headers: { Location: options.trailingSlash ? '/$1/' : '/$1' },
|
739
|
+
status: 308,
|
740
|
+
});
|
741
|
+
limitedRoutes.redirectRoutes.push({
|
742
|
+
src: `^/api/(.+)${extGroupLimited}/?$`,
|
743
|
+
headers: {
|
744
|
+
Location: options.trailingSlash ? '/api/$1/' : '/api/$1',
|
745
|
+
},
|
746
|
+
status: 308,
|
747
|
+
});
|
703
748
|
}
|
704
749
|
else {
|
705
750
|
defaultRoutes.push({ handle: 'miss' });
|
@@ -708,9 +753,16 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
708
753
|
dest: '/api/$1',
|
709
754
|
check: true,
|
710
755
|
});
|
756
|
+
limitedRoutes.defaultRoutes.push({ handle: 'miss' });
|
757
|
+
limitedRoutes.defaultRoutes.push({
|
758
|
+
src: `^/api/(.+)${extGroupLimited}$`,
|
759
|
+
dest: '/api/$1',
|
760
|
+
check: true,
|
761
|
+
});
|
711
762
|
}
|
712
763
|
}
|
713
764
|
rewriteRoutes.push(...dynamicRoutes);
|
765
|
+
limitedRoutes.rewriteRoutes.push(...dynamicRoutes);
|
714
766
|
if (typeof ignoreRuntimes === 'undefined') {
|
715
767
|
// This route is only necessary to hide the directory listing
|
716
768
|
// to avoid enumerating serverless function names.
|
@@ -755,6 +807,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
755
807
|
redirectRoutes,
|
756
808
|
rewriteRoutes,
|
757
809
|
errorRoutes,
|
810
|
+
limitedRoutes,
|
758
811
|
};
|
759
812
|
}
|
760
813
|
function sortFilesBySegmentCount(fileA, fileB) {
|
package/dist/index.js
CHANGED
@@ -26274,7 +26274,7 @@ exports.frameworks = [
|
|
26274
26274
|
name: 'Remix',
|
26275
26275
|
slug: 'remix',
|
26276
26276
|
demo: 'https://remix.examples.vercel.com',
|
26277
|
-
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/remix.svg',
|
26277
|
+
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/remix-no-shadow.svg',
|
26278
26278
|
tagline: 'Build Better Websites',
|
26279
26279
|
description: 'A new Remix app — the result of running `npx create-remix`.',
|
26280
26280
|
website: 'https://remix.run',
|
@@ -26329,8 +26329,8 @@ exports.frameworks = [
|
|
26329
26329
|
],
|
26330
26330
|
defaultHeaders: [
|
26331
26331
|
{
|
26332
|
-
source: '
|
26333
|
-
regex: '
|
26332
|
+
source: '/build/(.*)',
|
26333
|
+
regex: '/build/(.*)',
|
26334
26334
|
headers: [
|
26335
26335
|
{ key: 'cache-control', value: 'public, max-age=31536000, immutable' },
|
26336
26336
|
],
|
@@ -32323,7 +32323,7 @@ function convertRuntimeToPlugin(buildRuntime, ext) {
|
|
32323
32323
|
maxDuration: output.maxDuration,
|
32324
32324
|
environment: output.environment,
|
32325
32325
|
allowQuery: output.allowQuery,
|
32326
|
-
regions: output.regions,
|
32326
|
+
//regions: output.regions,
|
32327
32327
|
};
|
32328
32328
|
// @ts-ignore This symbol is a private API
|
32329
32329
|
const lambdaFiles = output[lambda_1.FILES_SYMBOL];
|
@@ -32410,21 +32410,41 @@ async function updateFunctionsManifest({ vercelConfig, workPath, pages, }) {
|
|
32410
32410
|
}
|
32411
32411
|
exports.updateFunctionsManifest = updateFunctionsManifest;
|
32412
32412
|
/**
|
32413
|
-
*
|
32414
|
-
* If the file does not exist, it
|
32413
|
+
* Append routes to the `routes-manifest.json` file.
|
32414
|
+
* If the file does not exist, it will be created.
|
32415
32415
|
*/
|
32416
|
-
async function updateRoutesManifest({ workPath, dynamicRoutes, }) {
|
32416
|
+
async function updateRoutesManifest({ workPath, redirects, rewrites, headers, dynamicRoutes, staticRoutes, }) {
|
32417
32417
|
const routesManifestPath = path_1.join(workPath, '.output', 'routes-manifest.json');
|
32418
32418
|
const routesManifest = await readJson(routesManifestPath);
|
32419
32419
|
if (!routesManifest.version)
|
32420
|
-
routesManifest.version =
|
32420
|
+
routesManifest.version = 3;
|
32421
32421
|
if (routesManifest.pages404 === undefined)
|
32422
32422
|
routesManifest.pages404 = true;
|
32423
|
+
if (redirects) {
|
32424
|
+
if (!routesManifest.redirects)
|
32425
|
+
routesManifest.redirects = [];
|
32426
|
+
routesManifest.redirects.push(...redirects);
|
32427
|
+
}
|
32428
|
+
if (rewrites) {
|
32429
|
+
if (!routesManifest.rewrites)
|
32430
|
+
routesManifest.rewrites = [];
|
32431
|
+
routesManifest.rewrites.push(...rewrites);
|
32432
|
+
}
|
32433
|
+
if (headers) {
|
32434
|
+
if (!routesManifest.headers)
|
32435
|
+
routesManifest.headers = [];
|
32436
|
+
routesManifest.headers.push(...headers);
|
32437
|
+
}
|
32423
32438
|
if (dynamicRoutes) {
|
32424
32439
|
if (!routesManifest.dynamicRoutes)
|
32425
32440
|
routesManifest.dynamicRoutes = [];
|
32426
32441
|
routesManifest.dynamicRoutes.push(...dynamicRoutes);
|
32427
32442
|
}
|
32443
|
+
if (staticRoutes) {
|
32444
|
+
if (!routesManifest.staticRoutes)
|
32445
|
+
routesManifest.staticRoutes = [];
|
32446
|
+
routesManifest.staticRoutes.push(...staticRoutes);
|
32447
|
+
}
|
32428
32448
|
await fs_extra_1.default.writeFile(routesManifestPath, JSON.stringify(routesManifest));
|
32429
32449
|
}
|
32430
32450
|
exports.updateRoutesManifest = updateRoutesManifest;
|
@@ -32521,6 +32541,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32521
32541
|
redirectRoutes: null,
|
32522
32542
|
rewriteRoutes: null,
|
32523
32543
|
errorRoutes: null,
|
32544
|
+
limitedRoutes: null,
|
32524
32545
|
};
|
32525
32546
|
}
|
32526
32547
|
const sortedFiles = files.sort(sortFiles);
|
@@ -32568,6 +32589,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32568
32589
|
redirectRoutes: null,
|
32569
32590
|
rewriteRoutes: null,
|
32570
32591
|
errorRoutes: null,
|
32592
|
+
limitedRoutes: null,
|
32571
32593
|
};
|
32572
32594
|
}
|
32573
32595
|
if (apiRoute) {
|
@@ -32622,6 +32644,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32622
32644
|
defaultRoutes: null,
|
32623
32645
|
rewriteRoutes: null,
|
32624
32646
|
errorRoutes: null,
|
32647
|
+
limitedRoutes: null,
|
32625
32648
|
};
|
32626
32649
|
}
|
32627
32650
|
// If `outputDirectory` is an empty string,
|
@@ -32658,6 +32681,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32658
32681
|
defaultRoutes: null,
|
32659
32682
|
rewriteRoutes: null,
|
32660
32683
|
errorRoutes: null,
|
32684
|
+
limitedRoutes: null,
|
32661
32685
|
};
|
32662
32686
|
}
|
32663
32687
|
const builders = [];
|
@@ -32676,7 +32700,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32676
32700
|
});
|
32677
32701
|
}
|
32678
32702
|
}
|
32679
|
-
const routesResult = getRouteResult(apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
|
32703
|
+
const routesResult = getRouteResult(pkg, apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
|
32680
32704
|
return {
|
32681
32705
|
warnings,
|
32682
32706
|
builders: builders.length ? builders : null,
|
@@ -32685,6 +32709,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32685
32709
|
defaultRoutes: routesResult.defaultRoutes,
|
32686
32710
|
rewriteRoutes: routesResult.rewriteRoutes,
|
32687
32711
|
errorRoutes: routesResult.errorRoutes,
|
32712
|
+
limitedRoutes: routesResult.limitedRoutes,
|
32688
32713
|
};
|
32689
32714
|
}
|
32690
32715
|
exports.detectBuilders = detectBuilders;
|
@@ -33125,23 +33150,51 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
33125
33150
|
}
|
33126
33151
|
return { route, isDynamic };
|
33127
33152
|
}
|
33128
|
-
function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
33153
|
+
function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
33129
33154
|
var _a, _b;
|
33155
|
+
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
33130
33156
|
const defaultRoutes = [];
|
33131
33157
|
const redirectRoutes = [];
|
33132
33158
|
const rewriteRoutes = [];
|
33133
33159
|
const errorRoutes = [];
|
33160
|
+
const limitedRoutes = {
|
33161
|
+
defaultRoutes: [],
|
33162
|
+
redirectRoutes: [],
|
33163
|
+
rewriteRoutes: [],
|
33164
|
+
};
|
33134
33165
|
const framework = ((_a = frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) === null || _a === void 0 ? void 0 : _a.framework) || '';
|
33135
33166
|
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.use);
|
33136
33167
|
const ignoreRuntimes = (_b = slugToFramework.get(framework)) === null || _b === void 0 ? void 0 : _b.ignoreRuntimes;
|
33137
33168
|
if (apiRoutes && apiRoutes.length > 0) {
|
33138
33169
|
if (options.featHandleMiss) {
|
33170
|
+
// Exclude extension names if the corresponding plugin is not found in package.json
|
33171
|
+
// detectBuilders({ignoreRoutesForBuilders: ['@vercel/python']})
|
33172
|
+
// return a copy of routes.
|
33173
|
+
// We should exclud errorRoutes and
|
33139
33174
|
const extSet = detectApiExtensions(apiBuilders);
|
33175
|
+
const withTag = options.tag ? `@${options.tag}` : '';
|
33176
|
+
const extSetLimited = detectApiExtensions(apiBuilders.filter(b => {
|
33177
|
+
if (b.use === `@vercel/python${withTag}` &&
|
33178
|
+
!('vercel-plugin-python' in deps)) {
|
33179
|
+
return false;
|
33180
|
+
}
|
33181
|
+
if (b.use === `@vercel/go${withTag}` &&
|
33182
|
+
!('vercel-plugin-go' in deps)) {
|
33183
|
+
return false;
|
33184
|
+
}
|
33185
|
+
if (b.use === `@vercel/ruby${withTag}` &&
|
33186
|
+
!('vercel-plugin-ruby' in deps)) {
|
33187
|
+
return false;
|
33188
|
+
}
|
33189
|
+
return true;
|
33190
|
+
}));
|
33140
33191
|
if (extSet.size > 0) {
|
33141
|
-
const
|
33192
|
+
const extGroup = `(?:\\.(?:${Array.from(extSet)
|
33142
33193
|
.map(ext => ext.slice(1))
|
33143
|
-
.join('|')
|
33144
|
-
const
|
33194
|
+
.join('|')}))`;
|
33195
|
+
const extGroupLimited = `(?:\\.(?:${Array.from(extSetLimited)
|
33196
|
+
.map(ext => ext.slice(1))
|
33197
|
+
.join('|')}))`;
|
33145
33198
|
if (options.cleanUrls) {
|
33146
33199
|
redirectRoutes.push({
|
33147
33200
|
src: `^/(api(?:.+)?)/index${extGroup}?/?$`,
|
@@ -33155,6 +33208,18 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
33155
33208
|
},
|
33156
33209
|
status: 308,
|
33157
33210
|
});
|
33211
|
+
limitedRoutes.redirectRoutes.push({
|
33212
|
+
src: `^/(api(?:.+)?)/index${extGroupLimited}?/?$`,
|
33213
|
+
headers: { Location: options.trailingSlash ? '/$1/' : '/$1' },
|
33214
|
+
status: 308,
|
33215
|
+
});
|
33216
|
+
limitedRoutes.redirectRoutes.push({
|
33217
|
+
src: `^/api/(.+)${extGroupLimited}/?$`,
|
33218
|
+
headers: {
|
33219
|
+
Location: options.trailingSlash ? '/api/$1/' : '/api/$1',
|
33220
|
+
},
|
33221
|
+
status: 308,
|
33222
|
+
});
|
33158
33223
|
}
|
33159
33224
|
else {
|
33160
33225
|
defaultRoutes.push({ handle: 'miss' });
|
@@ -33163,9 +33228,16 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
33163
33228
|
dest: '/api/$1',
|
33164
33229
|
check: true,
|
33165
33230
|
});
|
33231
|
+
limitedRoutes.defaultRoutes.push({ handle: 'miss' });
|
33232
|
+
limitedRoutes.defaultRoutes.push({
|
33233
|
+
src: `^/api/(.+)${extGroupLimited}$`,
|
33234
|
+
dest: '/api/$1',
|
33235
|
+
check: true,
|
33236
|
+
});
|
33166
33237
|
}
|
33167
33238
|
}
|
33168
33239
|
rewriteRoutes.push(...dynamicRoutes);
|
33240
|
+
limitedRoutes.rewriteRoutes.push(...dynamicRoutes);
|
33169
33241
|
if (typeof ignoreRuntimes === 'undefined') {
|
33170
33242
|
// This route is only necessary to hide the directory listing
|
33171
33243
|
// to avoid enumerating serverless function names.
|
@@ -33210,6 +33282,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
33210
33282
|
redirectRoutes,
|
33211
33283
|
rewriteRoutes,
|
33212
33284
|
errorRoutes,
|
33285
|
+
limitedRoutes,
|
33213
33286
|
};
|
33214
33287
|
}
|
33215
33288
|
function sortFilesBySegmentCount(fileA, fileB) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.12.3-canary.
|
3
|
+
"version": "2.12.3-canary.25",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@types/node-fetch": "^2.1.6",
|
31
31
|
"@types/semver": "6.0.0",
|
32
32
|
"@types/yazl": "^2.4.1",
|
33
|
-
"@vercel/frameworks": "0.5.1-canary.
|
33
|
+
"@vercel/frameworks": "0.5.1-canary.15",
|
34
34
|
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.4.3"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "6b865ff753ad0e51b284dac173e7e32953de3298"
|
53
53
|
}
|