diff --git a/packages/edge-bundler/deno/config.ts b/packages/edge-bundler/deno/config.ts index 9377184e93..0fb247b981 100644 --- a/packages/edge-bundler/deno/config.ts +++ b/packages/edge-bundler/deno/config.ts @@ -1,9 +1,23 @@ -// this needs to be updated whenever there's a change to globalThis.Netlify in bootstrap -import { Netlify } from "https://64e8753eae24930008fac6d9--edge.netlify.app/bootstrap/index-combined.ts" +import { type NetlifyGlobal } from 'https://edge.netlify.com/bootstrap/globals/types.ts' const [functionURL, collectorURL, rawExitCodes] = Deno.args const exitCodes = JSON.parse(rawExitCodes) +const env = { + delete: Deno.env.delete, + get: Deno.env.get, + has: Deno.env.has, + set: Deno.env.set, + toObject: Deno.env.toObject, +}; + +const Netlify: NetlifyGlobal = { + get context() { + return null; + }, + env, +}; + globalThis.Netlify = Netlify let func diff --git a/packages/edge-bundler/node/formats/tarball.ts b/packages/edge-bundler/node/formats/tarball.ts index f831a4675b..792a689ba5 100644 --- a/packages/edge-bundler/node/formats/tarball.ts +++ b/packages/edge-bundler/node/formats/tarball.ts @@ -107,20 +107,26 @@ export const bundle = async ({ const tarballPath = path.join(distDirectory, buildID + TARBALL_EXTENSION) await fs.mkdir(path.dirname(tarballPath), { recursive: true }) + // List files to include in the tarball as paths relative to the bundle dir. + // Using absolute paths here leads to platform-specific quirks (notably on Windows), + // where entries can include drive letters and break extraction/imports. + const files = (await listRecursively(bundleDir.path)) + .map((p) => path.relative(bundleDir.path, p)) + .map((p) => getUnixPath(p)) + .sort() + await tar.create( { cwd: bundleDir.path, file: tarballPath, gzip: true, noDirRecurse: true, + // Ensure forward slashes inside the tarball for cross-platform consistency. onWriteEntry(entry) { - const relativePath = path.relative(bundleDir.path, path.join('/', entry.path)) - const normalizedPath = getUnixPath(relativePath) - - entry.path = normalizedPath + entry.path = getUnixPath(entry.path) }, }, - await listRecursively(bundleDir.path), + files, ) const hash = await getFileHash(tarballPath)