@vercel/backends 0.0.28 → 0.0.30

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/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { builtinModules, createRequire } from "node:module";
2
2
  import { delimiter, dirname, extname, join } from "path";
3
- import { FileBlob, FileFsRef, NodejsLambda, Span, debug, defaultCachePathGlob, download, execCommand, getEnvForPackageManager, getNodeBinPaths, getNodeVersion, glob, isBackendFramework, isExperimentalBackendsWithoutIntrospectionEnabled, runNpmInstall, runPackageJsonScript, scanParentDirs } from "@vercel/build-utils";
3
+ import { FileBlob, FileFsRef, NodejsLambda, Span, debug, defaultCachePathGlob, download, execCommand, getEnvForPackageManager, getNodeBinPaths, getNodeVersion, glob, isBackendFramework, isBunVersion, isExperimentalBackendsWithoutIntrospectionEnabled, runNpmInstall, runPackageJsonScript, scanParentDirs } from "@vercel/build-utils";
4
4
  import { createWriteStream, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { lstat, readFile, rm } from "node:fs/promises";
6
6
  import { dirname as dirname$1, extname as extname$1, isAbsolute, join as join$1, relative } from "node:path";
@@ -683,6 +683,7 @@ const nft = async (args) => {
683
683
  processCwd: args.workPath,
684
684
  ts: true,
685
685
  mixedModules: true,
686
+ conditions: args.conditions,
686
687
  ignore: args.ignoreNodeModules ? (path) => path.includes("node_modules") : void 0,
687
688
  async readFile(fsPath) {
688
689
  try {
@@ -903,6 +904,7 @@ module.exports = requireFromContext('${pkgName}');
903
904
  ignoreNodeModules: true
904
905
  });
905
906
  if (!handler) throw new Error(`Unable to resolve build handler for entrypoint: ${args.entrypoint}`);
907
+ console.log(Colors.gray(`${Colors.bold(Colors.cyan("✓"))} Build complete`));
906
908
  return {
907
909
  files,
908
910
  handler,
@@ -1408,7 +1410,8 @@ const getFramework = (args) => {
1408
1410
  const version = 2;
1409
1411
  const build = async (args) => {
1410
1412
  const downloadResult = await downloadInstallAndBundle(args);
1411
- const nodeVersion = await getNodeVersion(args.workPath);
1413
+ const nodeVersion = await getNodeVersion(args.workPath, void 0, args.config, args.meta);
1414
+ const isBun = isBunVersion(nodeVersion);
1412
1415
  const builderName = "@vercel/backends";
1413
1416
  const span = args.span ?? new Span({ name: builderName });
1414
1417
  span.setAttributes({ "builder.name": builderName });
@@ -1443,6 +1446,7 @@ const build = async (args) => {
1443
1446
  localBuildFiles,
1444
1447
  files,
1445
1448
  ignoreNodeModules: false,
1449
+ conditions: isBun ? ["bun"] : void 0,
1446
1450
  span: buildSpan
1447
1451
  });
1448
1452
  const introspectionResult = await introspectionPromise;
@@ -9,6 +9,35 @@ import { isNativeError } from "node:util/types";
9
9
  import { transform } from "oxc-transform";
10
10
  import { exports } from "resolve.exports";
11
11
 
12
+ //#region src/cervel/utils.ts
13
+ const noColor = globalThis.process?.env?.NO_COLOR === "1" || globalThis.process?.env?.TERM === "dumb";
14
+ const resets = {
15
+ 1: 22,
16
+ 31: 39,
17
+ 32: 39,
18
+ 33: 39,
19
+ 34: 39,
20
+ 35: 39,
21
+ 36: 39,
22
+ 90: 39
23
+ };
24
+ const _c = (c) => (text) => {
25
+ if (noColor) return text;
26
+ return `\u001B[${c}m${text}\u001B[${resets[c] ?? 0}m`;
27
+ };
28
+ const Colors = {
29
+ bold: _c(1),
30
+ red: _c(31),
31
+ green: _c(32),
32
+ yellow: _c(33),
33
+ blue: _c(34),
34
+ magenta: _c(35),
35
+ cyan: _c(36),
36
+ gray: _c(90),
37
+ url: (title, url) => noColor ? `[${title}](${url})` : `\u001B]8;;${url}\u001B\\${title}\u001B]8;;\u001B\\`
38
+ };
39
+
40
+ //#endregion
12
41
  //#region src/rolldown/resolve-format.ts
13
42
  const resolveEntrypointAndFormat = async (args) => {
14
43
  const extension = extname(args.entrypoint);
@@ -69,6 +98,7 @@ const nft = async (args) => {
69
98
  processCwd: args.workPath,
70
99
  ts: true,
71
100
  mixedModules: true,
101
+ conditions: args.conditions,
72
102
  ignore: args.ignoreNodeModules ? (path) => path.includes("node_modules") : void 0,
73
103
  async readFile(fsPath) {
74
104
  try {
@@ -289,6 +319,7 @@ module.exports = requireFromContext('${pkgName}');
289
319
  ignoreNodeModules: true
290
320
  });
291
321
  if (!handler) throw new Error(`Unable to resolve build handler for entrypoint: ${args.entrypoint}`);
322
+ console.log(Colors.gray(`${Colors.bold(Colors.cyan("✓"))} Build complete`));
292
323
  return {
293
324
  files,
294
325
  handler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/backends",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "homepage": "https://vercel.com/docs",
@@ -34,7 +34,7 @@
34
34
  "srvx": "0.8.9",
35
35
  "tsx": "4.21.0",
36
36
  "zod": "3.22.4",
37
- "@vercel/build-utils": "13.3.1"
37
+ "@vercel/build-utils": "13.3.3"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "typescript": "^4.0.0 || ^5.0.0"