@vercel/build-utils 2.12.3-canary.41 → 2.12.3-canary.45
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/convert-runtime-to-plugin.js +6 -2
- 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 +228 -3
- package/dist/types.d.ts +16 -2
- package/package.json +4 -4
@@ -145,8 +145,12 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
145
145
|
const locationPrefix = path_1.relative(entry, outputPath);
|
146
146
|
let handlerContent = await fs_extra_1.default.readFile(fsPath, encoding);
|
147
147
|
const importPaths = [
|
148
|
-
// This is the full entrypoint path, like `./api/test.py
|
149
|
-
|
148
|
+
// This is the full entrypoint path, like `./api/test.py`. In our tests
|
149
|
+
// Python didn't support importing from a parent directory without using different
|
150
|
+
// code in the launcher that registers it as a location for modules and then changing
|
151
|
+
// the importing syntax, but continuing to import it like before seems to work. If
|
152
|
+
// other languages need this, we should consider excluding Python explicitly.
|
153
|
+
// `./${entrypoint}`,
|
150
154
|
// This is the entrypoint path without extension, like `api/test`
|
151
155
|
entrypoint.slice(0, -ext.length),
|
152
156
|
];
|
@@ -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',
|
@@ -32827,8 +32865,12 @@ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
|
|
32827
32865
|
const locationPrefix = path_1.relative(entry, outputPath);
|
32828
32866
|
let handlerContent = await fs_extra_1.default.readFile(fsPath, encoding);
|
32829
32867
|
const importPaths = [
|
32830
|
-
// This is the full entrypoint path, like `./api/test.py
|
32831
|
-
|
32868
|
+
// This is the full entrypoint path, like `./api/test.py`. In our tests
|
32869
|
+
// Python didn't support importing from a parent directory without using different
|
32870
|
+
// code in the launcher that registers it as a location for modules and then changing
|
32871
|
+
// the importing syntax, but continuing to import it like before seems to work. If
|
32872
|
+
// other languages need this, we should consider excluding Python explicitly.
|
32873
|
+
// `./${entrypoint}`,
|
32832
32874
|
// This is the entrypoint path without extension, like `api/test`
|
32833
32875
|
entrypoint.slice(0, -ext.length),
|
32834
32876
|
];
|
@@ -33835,6 +33877,187 @@ function sortFilesBySegmentCount(fileA, fileB) {
|
|
33835
33877
|
}
|
33836
33878
|
|
33837
33879
|
|
33880
|
+
/***/ }),
|
33881
|
+
|
33882
|
+
/***/ 1182:
|
33883
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
33884
|
+
|
33885
|
+
"use strict";
|
33886
|
+
|
33887
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
33888
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
33889
|
+
};
|
33890
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
33891
|
+
exports.detectFileSystemAPI = void 0;
|
33892
|
+
const semver_1 = __importDefault(__webpack_require__(2879));
|
33893
|
+
const _1 = __webpack_require__(2855);
|
33894
|
+
const enableFileSystemApiFrameworks = new Set(['solidstart']);
|
33895
|
+
/**
|
33896
|
+
* If the Deployment can be built with the new File System API,
|
33897
|
+
* return the new Builder. Otherwise an "Exclusion Condition"
|
33898
|
+
* was hit so return `null` builder with a `reason` for exclusion.
|
33899
|
+
*/
|
33900
|
+
async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
|
33901
|
+
const framework = projectSettings.framework || '';
|
33902
|
+
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
33903
|
+
const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
|
33904
|
+
const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
|
33905
|
+
const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
|
33906
|
+
const metadata = {
|
33907
|
+
plugins,
|
33908
|
+
hasDotOutput,
|
33909
|
+
hasMiddleware,
|
33910
|
+
};
|
33911
|
+
const isEnabled = enableFlag ||
|
33912
|
+
hasMiddleware ||
|
33913
|
+
hasDotOutput ||
|
33914
|
+
enableFileSystemApiFrameworks.has(framework);
|
33915
|
+
if (!isEnabled) {
|
33916
|
+
return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
|
33917
|
+
}
|
33918
|
+
if ((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.builds) && vercelConfig.builds.length > 0) {
|
33919
|
+
return {
|
33920
|
+
metadata,
|
33921
|
+
fsApiBuilder: null,
|
33922
|
+
reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
|
33923
|
+
};
|
33924
|
+
}
|
33925
|
+
if (Object.values((vercelConfig === null || vercelConfig === void 0 ? void 0 : vercelConfig.functions) || {}).some(fn => !!fn.runtime)) {
|
33926
|
+
return {
|
33927
|
+
metadata,
|
33928
|
+
fsApiBuilder: null,
|
33929
|
+
reason: 'Detected `functions.runtime` in vercel.json. Please remove it in favor of CLI plugins.',
|
33930
|
+
};
|
33931
|
+
}
|
33932
|
+
if (process.env.HUGO_VERSION) {
|
33933
|
+
return {
|
33934
|
+
metadata,
|
33935
|
+
fsApiBuilder: null,
|
33936
|
+
reason: 'Detected `HUGO_VERSION` environment variable. Please remove it.',
|
33937
|
+
};
|
33938
|
+
}
|
33939
|
+
if (process.env.ZOLA_VERSION) {
|
33940
|
+
return {
|
33941
|
+
metadata,
|
33942
|
+
fsApiBuilder: null,
|
33943
|
+
reason: 'Detected `ZOLA_VERSION` environment variable. Please remove it.',
|
33944
|
+
};
|
33945
|
+
}
|
33946
|
+
if (process.env.GUTENBERG_VERSION) {
|
33947
|
+
return {
|
33948
|
+
metadata,
|
33949
|
+
fsApiBuilder: null,
|
33950
|
+
reason: 'Detected `GUTENBERG_VERSION` environment variable. Please remove it.',
|
33951
|
+
};
|
33952
|
+
}
|
33953
|
+
const invalidBuilder = builders.find(({ use }) => {
|
33954
|
+
const valid = _1.isOfficialRuntime('go', use) ||
|
33955
|
+
_1.isOfficialRuntime('python', use) ||
|
33956
|
+
_1.isOfficialRuntime('ruby', use) ||
|
33957
|
+
_1.isOfficialRuntime('node', use) ||
|
33958
|
+
_1.isOfficialRuntime('next', use) ||
|
33959
|
+
_1.isOfficialRuntime('static', use) ||
|
33960
|
+
_1.isOfficialRuntime('static-build', use);
|
33961
|
+
return !valid;
|
33962
|
+
});
|
33963
|
+
if (invalidBuilder) {
|
33964
|
+
return {
|
33965
|
+
metadata,
|
33966
|
+
fsApiBuilder: null,
|
33967
|
+
reason: `Detected \`${invalidBuilder.use}\` in vercel.json. Please remove it in favor of CLI plugins.`,
|
33968
|
+
};
|
33969
|
+
}
|
33970
|
+
for (const lang of ['go', 'python', 'ruby']) {
|
33971
|
+
for (const { use } of builders) {
|
33972
|
+
const plugin = 'vercel-plugin-' + lang;
|
33973
|
+
if (_1.isOfficialRuntime(lang, use) && !deps[plugin]) {
|
33974
|
+
return {
|
33975
|
+
metadata,
|
33976
|
+
fsApiBuilder: null,
|
33977
|
+
reason: `Detected \`${lang}\` Serverless Function usage without plugin \`${plugin}\`. Please run \`npm i ${plugin}\`.`,
|
33978
|
+
};
|
33979
|
+
}
|
33980
|
+
}
|
33981
|
+
}
|
33982
|
+
if (framework === 'nuxtjs' ||
|
33983
|
+
framework === 'sveltekit' ||
|
33984
|
+
framework === 'redwoodjs') {
|
33985
|
+
return {
|
33986
|
+
metadata,
|
33987
|
+
fsApiBuilder: null,
|
33988
|
+
reason: `Detected framework \`${framework}\` that only supports legacy File System API. Please contact the framework author.`,
|
33989
|
+
};
|
33990
|
+
}
|
33991
|
+
if (framework === 'nextjs' && !hasDotOutput) {
|
33992
|
+
// Use the old pipeline if a custom output directory was specified for Next.js
|
33993
|
+
// because `vercel build` cannot ensure that the directory will be in the same
|
33994
|
+
// location as `.output`, which can break imports (not just nft.json files).
|
33995
|
+
if (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.outputDirectory) {
|
33996
|
+
return {
|
33997
|
+
metadata,
|
33998
|
+
fsApiBuilder: null,
|
33999
|
+
reason: `Detected Next.js with Output Directory \`${projectSettings.outputDirectory}\` override. Please change it back to the default.`,
|
34000
|
+
};
|
34001
|
+
}
|
34002
|
+
const nextVersion = deps['next'];
|
34003
|
+
if (!nextVersion) {
|
34004
|
+
return {
|
34005
|
+
metadata,
|
34006
|
+
fsApiBuilder: null,
|
34007
|
+
reason: `Detected Next.js in Project Settings but missing \`next\` package.json dependencies. Please run \`npm i next\`.`,
|
34008
|
+
};
|
34009
|
+
}
|
34010
|
+
// TODO: Read version from lockfile instead of package.json
|
34011
|
+
if (nextVersion !== 'latest' && nextVersion !== 'canary') {
|
34012
|
+
const fixedVersion = semver_1.default.valid(semver_1.default.coerce(nextVersion) || '');
|
34013
|
+
if (!fixedVersion || !semver_1.default.gte(fixedVersion, '12.0.0')) {
|
34014
|
+
return {
|
34015
|
+
metadata,
|
34016
|
+
fsApiBuilder: null,
|
34017
|
+
reason: `Detected legacy Next.js version "${nextVersion}" in package.json. Please run \`npm i next@latest\` to upgrade.`,
|
34018
|
+
};
|
34019
|
+
}
|
34020
|
+
}
|
34021
|
+
}
|
34022
|
+
if (!hasDotOutput) {
|
34023
|
+
// TODO: Read version from lockfile instead of package.json
|
34024
|
+
const vercelCliVersion = deps['vercel'];
|
34025
|
+
if (vercelCliVersion &&
|
34026
|
+
vercelCliVersion !== 'latest' &&
|
34027
|
+
vercelCliVersion !== 'canary') {
|
34028
|
+
const fixedVersion = semver_1.default.valid(semver_1.default.coerce(vercelCliVersion) || '');
|
34029
|
+
// TODO: we might want to use '24.0.0' once its released
|
34030
|
+
if (!fixedVersion || !semver_1.default.gte(fixedVersion, '23.1.3-canary.68')) {
|
34031
|
+
return {
|
34032
|
+
metadata,
|
34033
|
+
fsApiBuilder: null,
|
34034
|
+
reason: `Detected legacy Vercel CLI version "${vercelCliVersion}" in package.json. Please run \`npm i vercel@latest\` to upgrade.`,
|
34035
|
+
};
|
34036
|
+
}
|
34037
|
+
}
|
34038
|
+
}
|
34039
|
+
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
34040
|
+
_1.isOfficialRuntime('static', use) ||
|
34041
|
+
_1.isOfficialRuntime('static-build', use));
|
34042
|
+
const config = (frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) || {};
|
34043
|
+
const withTag = tag ? `@${tag}` : '';
|
34044
|
+
const fsApiBuilder = {
|
34045
|
+
use: `@vercelruntimes/file-system-api${withTag}`,
|
34046
|
+
src: '**',
|
34047
|
+
config: {
|
34048
|
+
...config,
|
34049
|
+
fileSystemAPI: true,
|
34050
|
+
framework: config.framework || framework || null,
|
34051
|
+
projectSettings,
|
34052
|
+
hasMiddleware,
|
34053
|
+
hasDotOutput,
|
34054
|
+
},
|
34055
|
+
};
|
34056
|
+
return { metadata, fsApiBuilder, reason: null };
|
34057
|
+
}
|
34058
|
+
exports.detectFileSystemAPI = detectFileSystemAPI;
|
34059
|
+
|
34060
|
+
|
33838
34061
|
/***/ }),
|
33839
34062
|
|
33840
34063
|
/***/ 5224:
|
@@ -35066,7 +35289,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35066
35289
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
35067
35290
|
};
|
35068
35291
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35069
|
-
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;
|
35292
|
+
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;
|
35070
35293
|
const crypto_1 = __webpack_require__(6417);
|
35071
35294
|
const file_blob_1 = __importDefault(__webpack_require__(2397));
|
35072
35295
|
exports.FileBlob = file_blob_1.default;
|
@@ -35123,6 +35346,8 @@ Object.defineProperty(exports, "detectBuilders", ({ enumerable: true, get: funct
|
|
35123
35346
|
Object.defineProperty(exports, "detectOutputDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectOutputDirectory; } }));
|
35124
35347
|
Object.defineProperty(exports, "detectApiDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectApiDirectory; } }));
|
35125
35348
|
Object.defineProperty(exports, "detectApiExtensions", ({ enumerable: true, get: function () { return detect_builders_1.detectApiExtensions; } }));
|
35349
|
+
var detect_file_system_api_1 = __webpack_require__(1182);
|
35350
|
+
Object.defineProperty(exports, "detectFileSystemAPI", ({ enumerable: true, get: function () { return detect_file_system_api_1.detectFileSystemAPI; } }));
|
35126
35351
|
var detect_framework_1 = __webpack_require__(5224);
|
35127
35352
|
Object.defineProperty(exports, "detectFramework", ({ enumerable: true, get: function () { return detect_framework_1.detectFramework; } }));
|
35128
35353
|
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.45",
|
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.18",
|
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": "ca433a467956e29b3e206034b68bd9de681145fe"
|
53
53
|
}
|