@vercel/build-utils 2.12.3-canary.42 → 2.12.3-canary.46
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/detect-builders.d.ts +2 -9
- package/dist/detect-file-system-api.d.ts +34 -0
- package/dist/detect-file-system-api.js +173 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +223 -1
- package/dist/types.d.ts +16 -2
- package/package.json +4 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Route } from '@vercel/routing-utils';
|
2
|
-
import { PackageJson, Builder, BuilderFunctions } from './types';
|
2
|
+
import { PackageJson, Builder, BuilderFunctions, ProjectSettings } from './types';
|
3
3
|
interface ErrorResponse {
|
4
4
|
code: string;
|
5
5
|
message: string;
|
@@ -10,14 +10,7 @@ interface Options {
|
|
10
10
|
tag?: 'canary' | 'latest' | string;
|
11
11
|
functions?: BuilderFunctions;
|
12
12
|
ignoreBuildScript?: boolean;
|
13
|
-
projectSettings?:
|
14
|
-
framework?: string | null;
|
15
|
-
devCommand?: string | null;
|
16
|
-
installCommand?: string | null;
|
17
|
-
buildCommand?: string | null;
|
18
|
-
outputDirectory?: string | null;
|
19
|
-
createdAt?: number;
|
20
|
-
};
|
13
|
+
projectSettings?: ProjectSettings;
|
21
14
|
cleanUrls?: boolean;
|
22
15
|
trailingSlash?: boolean;
|
23
16
|
featHandleMiss?: boolean;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { Builder, BuilderFunctions, PackageJson, ProjectSettings } from './types';
|
2
|
+
interface Metadata {
|
3
|
+
plugins: string[];
|
4
|
+
hasDotOutput: boolean;
|
5
|
+
hasMiddleware: boolean;
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* If the Deployment can be built with the new File System API,
|
9
|
+
* return the new Builder. Otherwise an "Exclusion Condition"
|
10
|
+
* was hit so return `null` builder with a `reason` for exclusion.
|
11
|
+
*/
|
12
|
+
export declare function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag, }: {
|
13
|
+
files: {
|
14
|
+
[relPath: string]: any;
|
15
|
+
};
|
16
|
+
projectSettings: ProjectSettings;
|
17
|
+
builders: Builder[];
|
18
|
+
vercelConfig: {
|
19
|
+
builds?: Builder[];
|
20
|
+
functions?: BuilderFunctions;
|
21
|
+
} | null | undefined;
|
22
|
+
pkg: PackageJson | null | undefined;
|
23
|
+
tag: string | undefined;
|
24
|
+
enableFlag: boolean | undefined;
|
25
|
+
}): Promise<{
|
26
|
+
metadata: Metadata;
|
27
|
+
fsApiBuilder: Builder;
|
28
|
+
reason: null;
|
29
|
+
} | {
|
30
|
+
metadata: Metadata;
|
31
|
+
fsApiBuilder: null;
|
32
|
+
reason: string;
|
33
|
+
}>;
|
34
|
+
export {};
|
@@ -0,0 +1,173 @@
|
|
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.detectFileSystemAPI = void 0;
|
7
|
+
const semver_1 = __importDefault(require("semver"));
|
8
|
+
const _1 = require("./");
|
9
|
+
const enableFileSystemApiFrameworks = new Set(['solidstart']);
|
10
|
+
/**
|
11
|
+
* If the Deployment can be built with the new File System API,
|
12
|
+
* return the new Builder. Otherwise an "Exclusion Condition"
|
13
|
+
* was hit so return `null` builder with a `reason` for exclusion.
|
14
|
+
*/
|
15
|
+
async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
|
16
|
+
const framework = projectSettings.framework || '';
|
17
|
+
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
18
|
+
const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
|
19
|
+
const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
|
20
|
+
const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
|
21
|
+
const metadata = {
|
22
|
+
plugins,
|
23
|
+
hasDotOutput,
|
24
|
+
hasMiddleware,
|
25
|
+
};
|
26
|
+
const isEnabled = enableFlag ||
|
27
|
+
hasMiddleware ||
|
28
|
+
hasDotOutput ||
|
29
|
+
enableFileSystemApiFrameworks.has(framework);
|
30
|
+
if (!isEnabled) {
|
31
|
+
return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
|
32
|
+
}
|
33
|
+
if ((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.builds) && vercelConfig.builds.length > 0) {
|
34
|
+
return {
|
35
|
+
metadata,
|
36
|
+
fsApiBuilder: null,
|
37
|
+
reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
|
38
|
+
};
|
39
|
+
}
|
40
|
+
if (Object.values((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.functions) || {}).some(fn => !!fn.runtime)) {
|
41
|
+
return {
|
42
|
+
metadata,
|
43
|
+
fsApiBuilder: null,
|
44
|
+
reason: 'Detected `functions.runtime` in vercel.json. Please remove it in favor of CLI plugins.',
|
45
|
+
};
|
46
|
+
}
|
47
|
+
if (process.env.HUGO_VERSION) {
|
48
|
+
return {
|
49
|
+
metadata,
|
50
|
+
fsApiBuilder: null,
|
51
|
+
reason: 'Detected `HUGO_VERSION` environment variable. Please remove it.',
|
52
|
+
};
|
53
|
+
}
|
54
|
+
if (process.env.ZOLA_VERSION) {
|
55
|
+
return {
|
56
|
+
metadata,
|
57
|
+
fsApiBuilder: null,
|
58
|
+
reason: 'Detected `ZOLA_VERSION` environment variable. Please remove it.',
|
59
|
+
};
|
60
|
+
}
|
61
|
+
if (process.env.GUTENBERG_VERSION) {
|
62
|
+
return {
|
63
|
+
metadata,
|
64
|
+
fsApiBuilder: null,
|
65
|
+
reason: 'Detected `GUTENBERG_VERSION` environment variable. Please remove it.',
|
66
|
+
};
|
67
|
+
}
|
68
|
+
const invalidBuilder = builders.find(({ use }) => {
|
69
|
+
const valid = _1.isOfficialRuntime('go', use) ||
|
70
|
+
_1.isOfficialRuntime('python', use) ||
|
71
|
+
_1.isOfficialRuntime('ruby', use) ||
|
72
|
+
_1.isOfficialRuntime('node', use) ||
|
73
|
+
_1.isOfficialRuntime('next', use) ||
|
74
|
+
_1.isOfficialRuntime('static', use) ||
|
75
|
+
_1.isOfficialRuntime('static-build', use);
|
76
|
+
return !valid;
|
77
|
+
});
|
78
|
+
if (invalidBuilder) {
|
79
|
+
return {
|
80
|
+
metadata,
|
81
|
+
fsApiBuilder: null,
|
82
|
+
reason: `Detected \`${invalidBuilder.use}\` in vercel.json. Please remove it in favor of CLI plugins.`,
|
83
|
+
};
|
84
|
+
}
|
85
|
+
for (const lang of ['go', 'python', 'ruby']) {
|
86
|
+
for (const { use } of builders) {
|
87
|
+
const plugin = 'vercel-plugin-' + lang;
|
88
|
+
if (_1.isOfficialRuntime(lang, use) && !deps[plugin]) {
|
89
|
+
return {
|
90
|
+
metadata,
|
91
|
+
fsApiBuilder: null,
|
92
|
+
reason: `Detected \`${lang}\` Serverless Function usage without plugin \`${plugin}\`. Please run \`npm i ${plugin}\`.`,
|
93
|
+
};
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
if (framework === 'nuxtjs' ||
|
98
|
+
framework === 'sveltekit' ||
|
99
|
+
framework === 'redwoodjs') {
|
100
|
+
return {
|
101
|
+
metadata,
|
102
|
+
fsApiBuilder: null,
|
103
|
+
reason: `Detected framework \`${framework}\` that only supports legacy File System API. Please contact the framework author.`,
|
104
|
+
};
|
105
|
+
}
|
106
|
+
if (framework === 'nextjs' && !hasDotOutput) {
|
107
|
+
// Use the old pipeline if a custom output directory was specified for Next.js
|
108
|
+
// because `vercel build` cannot ensure that the directory will be in the same
|
109
|
+
// location as `.output`, which can break imports (not just nft.json files).
|
110
|
+
if (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.outputDirectory) {
|
111
|
+
return {
|
112
|
+
metadata,
|
113
|
+
fsApiBuilder: null,
|
114
|
+
reason: `Detected Next.js with Output Directory \`${projectSettings.outputDirectory}\` override. Please change it back to the default.`,
|
115
|
+
};
|
116
|
+
}
|
117
|
+
const nextVersion = deps['next'];
|
118
|
+
if (!nextVersion) {
|
119
|
+
return {
|
120
|
+
metadata,
|
121
|
+
fsApiBuilder: null,
|
122
|
+
reason: `Detected Next.js in Project Settings but missing \`next\` package.json dependencies. Please run \`npm i next\`.`,
|
123
|
+
};
|
124
|
+
}
|
125
|
+
// TODO: Read version from lockfile instead of package.json
|
126
|
+
if (nextVersion !== 'latest' && nextVersion !== 'canary') {
|
127
|
+
const fixedVersion = semver_1.default.valid(semver_1.default.coerce(nextVersion) || '');
|
128
|
+
if (!fixedVersion || !semver_1.default.gte(fixedVersion, '12.0.0')) {
|
129
|
+
return {
|
130
|
+
metadata,
|
131
|
+
fsApiBuilder: null,
|
132
|
+
reason: `Detected legacy Next.js version "${nextVersion}" in package.json. Please run \`npm i next@latest\` to upgrade.`,
|
133
|
+
};
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
if (!hasDotOutput) {
|
138
|
+
// TODO: Read version from lockfile instead of package.json
|
139
|
+
const vercelCliVersion = deps['vercel'];
|
140
|
+
if (vercelCliVersion &&
|
141
|
+
vercelCliVersion !== 'latest' &&
|
142
|
+
vercelCliVersion !== 'canary') {
|
143
|
+
const fixedVersion = semver_1.default.valid(semver_1.default.coerce(vercelCliVersion) || '');
|
144
|
+
// TODO: we might want to use '24.0.0' once its released
|
145
|
+
if (!fixedVersion || !semver_1.default.gte(fixedVersion, '23.1.3-canary.68')) {
|
146
|
+
return {
|
147
|
+
metadata,
|
148
|
+
fsApiBuilder: null,
|
149
|
+
reason: `Detected legacy Vercel CLI version "${vercelCliVersion}" in package.json. Please run \`npm i vercel@latest\` to upgrade.`,
|
150
|
+
};
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
155
|
+
_1.isOfficialRuntime('static', use) ||
|
156
|
+
_1.isOfficialRuntime('static-build', use));
|
157
|
+
const config = (frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) || {};
|
158
|
+
const withTag = tag ? `@${tag}` : '';
|
159
|
+
const fsApiBuilder = {
|
160
|
+
use: `@vercelruntimes/file-system-api${withTag}`,
|
161
|
+
src: '**',
|
162
|
+
config: {
|
163
|
+
...config,
|
164
|
+
fileSystemAPI: true,
|
165
|
+
framework: config.framework || framework || null,
|
166
|
+
projectSettings,
|
167
|
+
hasMiddleware,
|
168
|
+
hasDotOutput,
|
169
|
+
},
|
170
|
+
};
|
171
|
+
return { metadata, fsApiBuilder, reason: null };
|
172
|
+
}
|
173
|
+
exports.detectFileSystemAPI = detectFileSystemAPI;
|
package/dist/index.d.ts
CHANGED
@@ -16,6 +16,7 @@ import debug from './debug';
|
|
16
16
|
import getIgnoreFilter from './get-ignore-filter';
|
17
17
|
export { FileBlob, FileFsRef, FileRef, Lambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, streamToBuffer, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
|
18
18
|
export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, } from './detect-builders';
|
19
|
+
export { detectFileSystemAPI } from './detect-file-system-api';
|
19
20
|
export { detectFramework } from './detect-framework';
|
20
21
|
export { DetectorFilesystem } from './detectors/filesystem';
|
21
22
|
export { readConfigFile } from './fs/read-config-file';
|
package/dist/index.js
CHANGED
@@ -27108,6 +27108,44 @@ exports.frameworks = [
|
|
27108
27108
|
},
|
27109
27109
|
],
|
27110
27110
|
},
|
27111
|
+
{
|
27112
|
+
name: 'SolidStart',
|
27113
|
+
slug: 'solidstart',
|
27114
|
+
demo: 'https://solidstart.examples.vercel.com',
|
27115
|
+
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/solid.svg',
|
27116
|
+
tagline: 'Simple and performant reactivity for building user interfaces.',
|
27117
|
+
description: 'A Solid app, created with SolidStart.',
|
27118
|
+
website: 'https://solidjs.com',
|
27119
|
+
envPrefix: 'VITE_',
|
27120
|
+
detectors: {
|
27121
|
+
every: [
|
27122
|
+
{
|
27123
|
+
path: 'package.json',
|
27124
|
+
matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"solid-js":\\s*".+?"[^}]*}',
|
27125
|
+
},
|
27126
|
+
{
|
27127
|
+
path: 'package.json',
|
27128
|
+
matchContent: '"(dev)?(d|D)ependencies":\\s*{[^}]*"solid-start":\\s*".+?"[^}]*}',
|
27129
|
+
},
|
27130
|
+
],
|
27131
|
+
},
|
27132
|
+
settings: {
|
27133
|
+
installCommand: {
|
27134
|
+
placeholder: '`yarn install` or `npm install`',
|
27135
|
+
},
|
27136
|
+
buildCommand: {
|
27137
|
+
placeholder: '`npm run build` or `solid-start build`',
|
27138
|
+
value: 'solid-start build',
|
27139
|
+
},
|
27140
|
+
devCommand: {
|
27141
|
+
value: 'solid-start dev',
|
27142
|
+
},
|
27143
|
+
outputDirectory: {
|
27144
|
+
value: '.output',
|
27145
|
+
},
|
27146
|
+
},
|
27147
|
+
getOutputDirName: async () => '.output',
|
27148
|
+
},
|
27111
27149
|
{
|
27112
27150
|
name: 'Dojo',
|
27113
27151
|
slug: 'dojo',
|
@@ -27578,6 +27616,7 @@ exports.frameworks = [
|
|
27578
27616
|
tagline: 'SvelteKit is a framework for building web applications of all sizes.',
|
27579
27617
|
description: 'A SvelteKit app optimized to work for serverless.',
|
27580
27618
|
website: 'https://kit.svelte.dev',
|
27619
|
+
envPrefix: 'VITE_',
|
27581
27620
|
detectors: {
|
27582
27621
|
every: [
|
27583
27622
|
{
|
@@ -33839,6 +33878,187 @@ function sortFilesBySegmentCount(fileA, fileB) {
|
|
33839
33878
|
}
|
33840
33879
|
|
33841
33880
|
|
33881
|
+
/***/ }),
|
33882
|
+
|
33883
|
+
/***/ 1182:
|
33884
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
33885
|
+
|
33886
|
+
"use strict";
|
33887
|
+
|
33888
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
33889
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
33890
|
+
};
|
33891
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
33892
|
+
exports.detectFileSystemAPI = void 0;
|
33893
|
+
const semver_1 = __importDefault(__webpack_require__(2879));
|
33894
|
+
const _1 = __webpack_require__(2855);
|
33895
|
+
const enableFileSystemApiFrameworks = new Set(['solidstart']);
|
33896
|
+
/**
|
33897
|
+
* If the Deployment can be built with the new File System API,
|
33898
|
+
* return the new Builder. Otherwise an "Exclusion Condition"
|
33899
|
+
* was hit so return `null` builder with a `reason` for exclusion.
|
33900
|
+
*/
|
33901
|
+
async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
|
33902
|
+
const framework = projectSettings.framework || '';
|
33903
|
+
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
33904
|
+
const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
|
33905
|
+
const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
|
33906
|
+
const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
|
33907
|
+
const metadata = {
|
33908
|
+
plugins,
|
33909
|
+
hasDotOutput,
|
33910
|
+
hasMiddleware,
|
33911
|
+
};
|
33912
|
+
const isEnabled = enableFlag ||
|
33913
|
+
hasMiddleware ||
|
33914
|
+
hasDotOutput ||
|
33915
|
+
enableFileSystemApiFrameworks.has(framework);
|
33916
|
+
if (!isEnabled) {
|
33917
|
+
return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
|
33918
|
+
}
|
33919
|
+
if ((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.builds) && vercelConfig.builds.length > 0) {
|
33920
|
+
return {
|
33921
|
+
metadata,
|
33922
|
+
fsApiBuilder: null,
|
33923
|
+
reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
|
33924
|
+
};
|
33925
|
+
}
|
33926
|
+
if (Object.values((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.functions) || {}).some(fn => !!fn.runtime)) {
|
33927
|
+
return {
|
33928
|
+
metadata,
|
33929
|
+
fsApiBuilder: null,
|
33930
|
+
reason: 'Detected `functions.runtime` in vercel.json. Please remove it in favor of CLI plugins.',
|
33931
|
+
};
|
33932
|
+
}
|
33933
|
+
if (process.env.HUGO_VERSION) {
|
33934
|
+
return {
|
33935
|
+
metadata,
|
33936
|
+
fsApiBuilder: null,
|
33937
|
+
reason: 'Detected `HUGO_VERSION` environment variable. Please remove it.',
|
33938
|
+
};
|
33939
|
+
}
|
33940
|
+
if (process.env.ZOLA_VERSION) {
|
33941
|
+
return {
|
33942
|
+
metadata,
|
33943
|
+
fsApiBuilder: null,
|
33944
|
+
reason: 'Detected `ZOLA_VERSION` environment variable. Please remove it.',
|
33945
|
+
};
|
33946
|
+
}
|
33947
|
+
if (process.env.GUTENBERG_VERSION) {
|
33948
|
+
return {
|
33949
|
+
metadata,
|
33950
|
+
fsApiBuilder: null,
|
33951
|
+
reason: 'Detected `GUTENBERG_VERSION` environment variable. Please remove it.',
|
33952
|
+
};
|
33953
|
+
}
|
33954
|
+
const invalidBuilder = builders.find(({ use }) => {
|
33955
|
+
const valid = _1.isOfficialRuntime('go', use) ||
|
33956
|
+
_1.isOfficialRuntime('python', use) ||
|
33957
|
+
_1.isOfficialRuntime('ruby', use) ||
|
33958
|
+
_1.isOfficialRuntime('node', use) ||
|
33959
|
+
_1.isOfficialRuntime('next', use) ||
|
33960
|
+
_1.isOfficialRuntime('static', use) ||
|
33961
|
+
_1.isOfficialRuntime('static-build', use);
|
33962
|
+
return !valid;
|
33963
|
+
});
|
33964
|
+
if (invalidBuilder) {
|
33965
|
+
return {
|
33966
|
+
metadata,
|
33967
|
+
fsApiBuilder: null,
|
33968
|
+
reason: `Detected \`${invalidBuilder.use}\` in vercel.json. Please remove it in favor of CLI plugins.`,
|
33969
|
+
};
|
33970
|
+
}
|
33971
|
+
for (const lang of ['go', 'python', 'ruby']) {
|
33972
|
+
for (const { use } of builders) {
|
33973
|
+
const plugin = 'vercel-plugin-' + lang;
|
33974
|
+
if (_1.isOfficialRuntime(lang, use) && !deps[plugin]) {
|
33975
|
+
return {
|
33976
|
+
metadata,
|
33977
|
+
fsApiBuilder: null,
|
33978
|
+
reason: `Detected \`${lang}\` Serverless Function usage without plugin \`${plugin}\`. Please run \`npm i ${plugin}\`.`,
|
33979
|
+
};
|
33980
|
+
}
|
33981
|
+
}
|
33982
|
+
}
|
33983
|
+
if (framework === 'nuxtjs' ||
|
33984
|
+
framework === 'sveltekit' ||
|
33985
|
+
framework === 'redwoodjs') {
|
33986
|
+
return {
|
33987
|
+
metadata,
|
33988
|
+
fsApiBuilder: null,
|
33989
|
+
reason: `Detected framework \`${framework}\` that only supports legacy File System API. Please contact the framework author.`,
|
33990
|
+
};
|
33991
|
+
}
|
33992
|
+
if (framework === 'nextjs' && !hasDotOutput) {
|
33993
|
+
// Use the old pipeline if a custom output directory was specified for Next.js
|
33994
|
+
// because `vercel build` cannot ensure that the directory will be in the same
|
33995
|
+
// location as `.output`, which can break imports (not just nft.json files).
|
33996
|
+
if (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.outputDirectory) {
|
33997
|
+
return {
|
33998
|
+
metadata,
|
33999
|
+
fsApiBuilder: null,
|
34000
|
+
reason: `Detected Next.js with Output Directory \`${projectSettings.outputDirectory}\` override. Please change it back to the default.`,
|
34001
|
+
};
|
34002
|
+
}
|
34003
|
+
const nextVersion = deps['next'];
|
34004
|
+
if (!nextVersion) {
|
34005
|
+
return {
|
34006
|
+
metadata,
|
34007
|
+
fsApiBuilder: null,
|
34008
|
+
reason: `Detected Next.js in Project Settings but missing \`next\` package.json dependencies. Please run \`npm i next\`.`,
|
34009
|
+
};
|
34010
|
+
}
|
34011
|
+
// TODO: Read version from lockfile instead of package.json
|
34012
|
+
if (nextVersion !== 'latest' && nextVersion !== 'canary') {
|
34013
|
+
const fixedVersion = semver_1.default.valid(semver_1.default.coerce(nextVersion) || '');
|
34014
|
+
if (!fixedVersion || !semver_1.default.gte(fixedVersion, '12.0.0')) {
|
34015
|
+
return {
|
34016
|
+
metadata,
|
34017
|
+
fsApiBuilder: null,
|
34018
|
+
reason: `Detected legacy Next.js version "${nextVersion}" in package.json. Please run \`npm i next@latest\` to upgrade.`,
|
34019
|
+
};
|
34020
|
+
}
|
34021
|
+
}
|
34022
|
+
}
|
34023
|
+
if (!hasDotOutput) {
|
34024
|
+
// TODO: Read version from lockfile instead of package.json
|
34025
|
+
const vercelCliVersion = deps['vercel'];
|
34026
|
+
if (vercelCliVersion &&
|
34027
|
+
vercelCliVersion !== 'latest' &&
|
34028
|
+
vercelCliVersion !== 'canary') {
|
34029
|
+
const fixedVersion = semver_1.default.valid(semver_1.default.coerce(vercelCliVersion) || '');
|
34030
|
+
// TODO: we might want to use '24.0.0' once its released
|
34031
|
+
if (!fixedVersion || !semver_1.default.gte(fixedVersion, '23.1.3-canary.68')) {
|
34032
|
+
return {
|
34033
|
+
metadata,
|
34034
|
+
fsApiBuilder: null,
|
34035
|
+
reason: `Detected legacy Vercel CLI version "${vercelCliVersion}" in package.json. Please run \`npm i vercel@latest\` to upgrade.`,
|
34036
|
+
};
|
34037
|
+
}
|
34038
|
+
}
|
34039
|
+
}
|
34040
|
+
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
34041
|
+
_1.isOfficialRuntime('static', use) ||
|
34042
|
+
_1.isOfficialRuntime('static-build', use));
|
34043
|
+
const config = (frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) || {};
|
34044
|
+
const withTag = tag ? `@${tag}` : '';
|
34045
|
+
const fsApiBuilder = {
|
34046
|
+
use: `@vercelruntimes/file-system-api${withTag}`,
|
34047
|
+
src: '**',
|
34048
|
+
config: {
|
34049
|
+
...config,
|
34050
|
+
fileSystemAPI: true,
|
34051
|
+
framework: config.framework || framework || null,
|
34052
|
+
projectSettings,
|
34053
|
+
hasMiddleware,
|
34054
|
+
hasDotOutput,
|
34055
|
+
},
|
34056
|
+
};
|
34057
|
+
return { metadata, fsApiBuilder, reason: null };
|
34058
|
+
}
|
34059
|
+
exports.detectFileSystemAPI = detectFileSystemAPI;
|
34060
|
+
|
34061
|
+
|
33842
34062
|
/***/ }),
|
33843
34063
|
|
33844
34064
|
/***/ 5224:
|
@@ -35070,7 +35290,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35070
35290
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
35071
35291
|
};
|
35072
35292
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35073
|
-
exports.getInputHash = exports.getPlatformEnv = exports.isStaticRuntime = exports.isOfficialRuntime = exports.updateRoutesManifest = exports.updateFunctionsManifest = exports.convertRuntimeToPlugin = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = exports.streamToBuffer = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = 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.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
|
35293
|
+
exports.getInputHash = exports.getPlatformEnv = exports.isStaticRuntime = exports.isOfficialRuntime = exports.updateRoutesManifest = exports.updateFunctionsManifest = exports.convertRuntimeToPlugin = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = exports.streamToBuffer = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = 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.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
|
35074
35294
|
const crypto_1 = __webpack_require__(6417);
|
35075
35295
|
const file_blob_1 = __importDefault(__webpack_require__(2397));
|
35076
35296
|
exports.FileBlob = file_blob_1.default;
|
@@ -35127,6 +35347,8 @@ Object.defineProperty(exports, "detectBuilders", ({ enumerable: true, get: funct
|
|
35127
35347
|
Object.defineProperty(exports, "detectOutputDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectOutputDirectory; } }));
|
35128
35348
|
Object.defineProperty(exports, "detectApiDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectApiDirectory; } }));
|
35129
35349
|
Object.defineProperty(exports, "detectApiExtensions", ({ enumerable: true, get: function () { return detect_builders_1.detectApiExtensions; } }));
|
35350
|
+
var detect_file_system_api_1 = __webpack_require__(1182);
|
35351
|
+
Object.defineProperty(exports, "detectFileSystemAPI", ({ enumerable: true, get: function () { return detect_file_system_api_1.detectFileSystemAPI; } }));
|
35130
35352
|
var detect_framework_1 = __webpack_require__(5224);
|
35131
35353
|
Object.defineProperty(exports, "detectFramework", ({ enumerable: true, get: function () { return detect_framework_1.detectFramework; } }));
|
35132
35354
|
var filesystem_1 = __webpack_require__(461);
|
package/dist/types.d.ts
CHANGED
@@ -21,7 +21,7 @@ export interface Files {
|
|
21
21
|
export interface Config {
|
22
22
|
[key: string]: string | string[] | boolean | number | {
|
23
23
|
[key: string]: string;
|
24
|
-
} | BuilderFunctions | undefined;
|
24
|
+
} | BuilderFunctions | ProjectSettings | undefined | null;
|
25
25
|
maxLambdaSize?: string;
|
26
26
|
includeFiles?: string | string[];
|
27
27
|
excludeFiles?: string | string[];
|
@@ -35,11 +35,12 @@ export interface Config {
|
|
35
35
|
[key: string]: string;
|
36
36
|
};
|
37
37
|
functions?: BuilderFunctions;
|
38
|
+
projectSettings?: ProjectSettings;
|
38
39
|
outputDirectory?: string;
|
39
40
|
installCommand?: string;
|
40
41
|
buildCommand?: string;
|
41
42
|
devCommand?: string;
|
42
|
-
framework?: string;
|
43
|
+
framework?: string | null;
|
43
44
|
nodeVersion?: string;
|
44
45
|
}
|
45
46
|
export interface Meta {
|
@@ -305,3 +306,16 @@ export interface BuilderFunctions {
|
|
305
306
|
excludeFiles?: string;
|
306
307
|
};
|
307
308
|
}
|
309
|
+
export interface ProjectSettings {
|
310
|
+
framework?: string | null;
|
311
|
+
devCommand?: string | null;
|
312
|
+
installCommand?: string | null;
|
313
|
+
buildCommand?: string | null;
|
314
|
+
outputDirectory?: string | null;
|
315
|
+
rootDirectory?: string | null;
|
316
|
+
createdAt?: number;
|
317
|
+
autoExposeSystemEnvs?: boolean;
|
318
|
+
sourceFilesOutsideRootDirectory?: boolean;
|
319
|
+
directoryListing?: boolean;
|
320
|
+
gitForkProtection?: boolean;
|
321
|
+
}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.12.3-canary.
|
3
|
+
"version": "2.12.3-canary.46",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
7
|
-
"homepage": "https://github.com/vercel/vercel/blob/
|
7
|
+
"homepage": "https://github.com/vercel/vercel/blob/main/DEVELOPING_A_RUNTIME.md",
|
8
8
|
"repository": {
|
9
9
|
"type": "git",
|
10
10
|
"url": "https://github.com/vercel/vercel.git",
|
@@ -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.19",
|
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": "b620c5343a60039f86188d4667e4dc71baf4f505"
|
53
53
|
}
|