Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lazy-load-xdg-paths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vercel/sandbox": patch
---

Load CLI auth path discovery only when accessing the local auth configuration.
6 changes: 5 additions & 1 deletion packages/vercel-sandbox/src/auth/file.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import path from "node:path";
import fs from "node:fs";
import { createRequire } from "node:module";
import { homedir } from "node:os";
import XDGAppPaths from "xdg-app-paths";
import { z } from "zod";
import { json } from "./zod.js";

type XDGAppPathsFactory = typeof import("xdg-app-paths");

const ZodDate = z.number().transform((seconds) => new Date(seconds * 1000));

const AuthFile = z.object({
Expand Down Expand Up @@ -38,6 +40,8 @@ const getGlobalPathConfig = (): string => {
return process.env.VERCEL_AUTH_CONFIG_DIR;
}

const require = createRequire(import.meta.url);
const XDGAppPaths = require("xdg-app-paths") as XDGAppPathsFactory;
const vercelDirectories = XDGAppPaths("com.vercel.cli").dataDirs();

const possibleConfigPaths = [
Expand Down
Loading