@@ -132,7 +132,7 @@ struct Bundle: AsyncParsableCommand {
132
132
wasmOutputFilePath: wasmOutputFilePath,
133
133
buildDirectory: buildDirectory,
134
134
bundleDirectory: bundleDirectory,
135
- resourcesPaths : resources
135
+ topLevelResourcePaths : resources
136
136
)
137
137
138
138
terminal. write ( " Bundle generation finished successfully \n " , inColor: . green, bold: true )
@@ -166,7 +166,7 @@ struct Bundle: AsyncParsableCommand {
166
166
wasmOutputFilePath: AbsolutePath ,
167
167
buildDirectory: AbsolutePath ,
168
168
bundleDirectory: AbsolutePath ,
169
- resourcesPaths : [ String ]
169
+ topLevelResourcePaths : [ String ]
170
170
) throws {
171
171
// Rename the final binary to use a part of its hash to bust browsers and CDN caches.
172
172
let wasmFileHash = try localFileSystem. readFileContents ( wasmOutputFilePath) . hexChecksum
@@ -208,18 +208,19 @@ struct Bundle: AsyncParsableCommand {
208
208
try localFileSystem. copy ( from: resourcesPath, to: targetDirectory)
209
209
}
210
210
211
- for resourcesPath in resourcesPaths {
211
+ for resourcesPath in topLevelResourcePaths {
212
212
let resourcesPath = try AbsolutePath (
213
213
validating: resourcesPath, relativeTo: localFileSystem. currentWorkingDirectory!)
214
214
for file in try localFileSystem. traverseRecursively ( resourcesPath) {
215
215
let targetPath = bundleDirectory. appending ( component: file. basename)
216
+ let sourcePath = bundleDirectory. appending ( component: resourcesPath. basename) . appending ( component: file. basename)
216
217
217
- guard localFileSystem. exists ( resourcesPath , followSymlink: true ) ,
218
+ guard localFileSystem. exists ( sourcePath , followSymlink: true ) ,
218
219
!localFileSystem. exists ( targetPath, followSymlink: true )
219
220
else { continue }
220
221
221
- terminal. logLookup ( " Copying this resource to the root bundle directory " , file )
222
- try localFileSystem. copy ( from : file , to : targetPath )
222
+ terminal. logLookup ( " Creating symlink " , targetPath )
223
+ try localFileSystem. createSymbolicLink ( targetPath , pointingAt : sourcePath , relative : true )
223
224
}
224
225
}
225
226
}
0 commit comments