Skip to content
Merged
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
18 changes: 16 additions & 2 deletions packages/edge-bundler/deno/config.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 11 additions & 5 deletions packages/edge-bundler/node/formats/tarball.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading