@vercel/build-utils 12.2.2 → 12.2.4
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/CHANGELOG.md +12 -0
- package/dist/framework-helpers.d.ts +4 -1
- package/dist/framework-helpers.js +20 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 12.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add helper for detecting backend builders ([#14182](https://github.com/vercel/vercel/pull/14182))
|
|
8
|
+
|
|
9
|
+
## 12.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Add Elysia framework ([#14164](https://github.com/vercel/vercel/pull/14164))
|
|
14
|
+
|
|
3
15
|
## 12.2.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Builder } from '.';
|
|
1
2
|
/**
|
|
2
3
|
* List of backend frameworks supported by the experimental backends feature
|
|
3
4
|
*/
|
|
4
|
-
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "nestjs", "fastify"];
|
|
5
|
+
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "nestjs", "fastify", "elysia"];
|
|
6
|
+
export declare const BACKEND_BUILDERS: readonly ["@vercel/express", "@vercel/hono", "@vercel/h3", "@vercel/nestjs", "@vercel/fastify", "@vercel/elysia"];
|
|
5
7
|
export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
|
|
6
8
|
/**
|
|
7
9
|
* Checks if the given framework is a backend framework
|
|
@@ -11,6 +13,7 @@ export declare function isBackendFramework(framework: string | null | undefined)
|
|
|
11
13
|
* Checks if experimental backends are enabled via environment variable
|
|
12
14
|
*/
|
|
13
15
|
export declare function isExperimentalBackendsEnabled(): boolean;
|
|
16
|
+
export declare function isBackendBuilder(builder: Builder | null | undefined): boolean;
|
|
14
17
|
/**
|
|
15
18
|
* Checks if experimental backends are enabled AND the framework is a backend framework
|
|
16
19
|
*/
|
|
@@ -18,7 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var framework_helpers_exports = {};
|
|
20
20
|
__export(framework_helpers_exports, {
|
|
21
|
+
BACKEND_BUILDERS: () => BACKEND_BUILDERS,
|
|
21
22
|
BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
|
|
23
|
+
isBackendBuilder: () => isBackendBuilder,
|
|
22
24
|
isBackendFramework: () => isBackendFramework,
|
|
23
25
|
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
|
|
24
26
|
shouldUseExperimentalBackends: () => shouldUseExperimentalBackends
|
|
@@ -29,7 +31,16 @@ const BACKEND_FRAMEWORKS = [
|
|
|
29
31
|
"hono",
|
|
30
32
|
"h3",
|
|
31
33
|
"nestjs",
|
|
32
|
-
"fastify"
|
|
34
|
+
"fastify",
|
|
35
|
+
"elysia"
|
|
36
|
+
];
|
|
37
|
+
const BACKEND_BUILDERS = [
|
|
38
|
+
"@vercel/express",
|
|
39
|
+
"@vercel/hono",
|
|
40
|
+
"@vercel/h3",
|
|
41
|
+
"@vercel/nestjs",
|
|
42
|
+
"@vercel/fastify",
|
|
43
|
+
"@vercel/elysia"
|
|
33
44
|
];
|
|
34
45
|
function isBackendFramework(framework) {
|
|
35
46
|
if (!framework)
|
|
@@ -40,12 +51,20 @@ function isExperimentalBackendsEnabled() {
|
|
|
40
51
|
return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
|
|
41
52
|
process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
|
|
42
53
|
}
|
|
54
|
+
function isBackendBuilder(builder) {
|
|
55
|
+
if (!builder)
|
|
56
|
+
return false;
|
|
57
|
+
const use = builder.use;
|
|
58
|
+
return BACKEND_BUILDERS.includes(use);
|
|
59
|
+
}
|
|
43
60
|
function shouldUseExperimentalBackends(framework) {
|
|
44
61
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
45
62
|
}
|
|
46
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
64
|
0 && (module.exports = {
|
|
65
|
+
BACKEND_BUILDERS,
|
|
48
66
|
BACKEND_FRAMEWORKS,
|
|
67
|
+
isBackendBuilder,
|
|
49
68
|
isBackendFramework,
|
|
50
69
|
isExperimentalBackendsEnabled,
|
|
51
70
|
shouldUseExperimentalBackends
|
package/dist/index.d.ts
CHANGED
|
@@ -32,4 +32,4 @@ export { NODE_VERSIONS } from './fs/node-version';
|
|
|
32
32
|
export { getInstalledPackageVersion } from './get-installed-package-version';
|
|
33
33
|
export { defaultCachePathGlob } from './default-cache-path-glob';
|
|
34
34
|
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
|
|
35
|
-
export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isExperimentalBackendsEnabled, shouldUseExperimentalBackends, } from './framework-helpers';
|
|
35
|
+
export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, shouldUseExperimentalBackends, } from './framework-helpers';
|
package/dist/index.js
CHANGED
|
@@ -21867,6 +21867,7 @@ __export(src_exports, {
|
|
|
21867
21867
|
glob: () => glob,
|
|
21868
21868
|
hardLinkDir: () => hardLinkDir,
|
|
21869
21869
|
installDependencies: () => installDependencies,
|
|
21870
|
+
isBackendBuilder: () => isBackendBuilder,
|
|
21870
21871
|
isBackendFramework: () => isBackendFramework,
|
|
21871
21872
|
isBunVersion: () => isBunVersion,
|
|
21872
21873
|
isDirectory: () => isDirectory,
|
|
@@ -24782,7 +24783,16 @@ var BACKEND_FRAMEWORKS = [
|
|
|
24782
24783
|
"hono",
|
|
24783
24784
|
"h3",
|
|
24784
24785
|
"nestjs",
|
|
24785
|
-
"fastify"
|
|
24786
|
+
"fastify",
|
|
24787
|
+
"elysia"
|
|
24788
|
+
];
|
|
24789
|
+
var BACKEND_BUILDERS = [
|
|
24790
|
+
"@vercel/express",
|
|
24791
|
+
"@vercel/hono",
|
|
24792
|
+
"@vercel/h3",
|
|
24793
|
+
"@vercel/nestjs",
|
|
24794
|
+
"@vercel/fastify",
|
|
24795
|
+
"@vercel/elysia"
|
|
24786
24796
|
];
|
|
24787
24797
|
function isBackendFramework(framework) {
|
|
24788
24798
|
if (!framework)
|
|
@@ -24793,6 +24803,12 @@ function isExperimentalBackendsEnabled() {
|
|
|
24793
24803
|
return process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
|
|
24794
24804
|
process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
|
|
24795
24805
|
}
|
|
24806
|
+
function isBackendBuilder(builder) {
|
|
24807
|
+
if (!builder)
|
|
24808
|
+
return false;
|
|
24809
|
+
const use = builder.use;
|
|
24810
|
+
return BACKEND_BUILDERS.includes(use);
|
|
24811
|
+
}
|
|
24796
24812
|
function shouldUseExperimentalBackends(framework) {
|
|
24797
24813
|
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
|
|
24798
24814
|
}
|
|
@@ -24848,6 +24864,7 @@ function shouldUseExperimentalBackends(framework) {
|
|
|
24848
24864
|
glob,
|
|
24849
24865
|
hardLinkDir,
|
|
24850
24866
|
installDependencies,
|
|
24867
|
+
isBackendBuilder,
|
|
24851
24868
|
isBackendFramework,
|
|
24852
24869
|
isBunVersion,
|
|
24853
24870
|
isDirectory,
|