File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 1
- // this needs to be updated whenever there's a change to globalThis.Netlify in bootstrap
2
- import { Netlify } from "https://64e8753eae24930008fac6d9--edge.netlify.app/bootstrap/index-combined.ts"
1
+ import { type NetlifyGlobal } from 'https://edge.netlify.com/bootstrap/globals/types.ts'
3
2
4
3
const [ functionURL , collectorURL , rawExitCodes ] = Deno . args
5
4
const exitCodes = JSON . parse ( rawExitCodes )
6
5
6
+ const env = {
7
+ delete : Deno . env . delete ,
8
+ get : Deno . env . get ,
9
+ has : Deno . env . has ,
10
+ set : Deno . env . set ,
11
+ toObject : Deno . env . toObject ,
12
+ } ;
13
+
14
+ const Netlify : NetlifyGlobal = {
15
+ get context ( ) {
16
+ return null ;
17
+ } ,
18
+ env,
19
+ } ;
20
+
7
21
globalThis . Netlify = Netlify
8
22
9
23
let func
Original file line number Diff line number Diff line change @@ -107,20 +107,26 @@ export const bundle = async ({
107
107
const tarballPath = path . join ( distDirectory , buildID + TARBALL_EXTENSION )
108
108
await fs . mkdir ( path . dirname ( tarballPath ) , { recursive : true } )
109
109
110
+ // List files to include in the tarball as paths relative to the bundle dir.
111
+ // Using absolute paths here leads to platform-specific quirks (notably on Windows),
112
+ // where entries can include drive letters and break extraction/imports.
113
+ const files = ( await listRecursively ( bundleDir . path ) )
114
+ . map ( ( p ) => path . relative ( bundleDir . path , p ) )
115
+ . map ( ( p ) => getUnixPath ( p ) )
116
+ . sort ( )
117
+
110
118
await tar . create (
111
119
{
112
120
cwd : bundleDir . path ,
113
121
file : tarballPath ,
114
122
gzip : true ,
115
123
noDirRecurse : true ,
124
+ // Ensure forward slashes inside the tarball for cross-platform consistency.
116
125
onWriteEntry ( entry ) {
117
- const relativePath = path . relative ( bundleDir . path , path . join ( '/' , entry . path ) )
118
- const normalizedPath = getUnixPath ( relativePath )
119
-
120
- entry . path = normalizedPath
126
+ entry . path = getUnixPath ( entry . path )
121
127
} ,
122
128
} ,
123
- await listRecursively ( bundleDir . path ) ,
129
+ files ,
124
130
)
125
131
126
132
const hash = await getFileHash ( tarballPath )
You can’t perform that action at this time.
0 commit comments