aboutsummaryrefslogtreecommitdiff
path: root/src/cli/build_command.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/build_command.zig')
-rw-r--r--src/cli/build_command.zig23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/cli/build_command.zig b/src/cli/build_command.zig
index e419b649c..6609facac 100644
--- a/src/cli/build_command.zig
+++ b/src/cli/build_command.zig
@@ -53,6 +53,9 @@ pub const BuildCommand = struct {
this_bundler.options.source_map = options.SourceMapOption.fromApi(ctx.args.source_map);
this_bundler.resolver.opts.source_map = options.SourceMapOption.fromApi(ctx.args.source_map);
+ this_bundler.options.compile = ctx.bundler_options.compile;
+ this_bundler.resolver.opts.compile = ctx.bundler_options.compile;
+
if (this_bundler.options.source_map == .external and ctx.bundler_options.outdir.len == 0 and !ctx.bundler_options.compile) {
Output.prettyErrorln("<r><red>error<r><d>:<r> cannot use an external source map without --outdir", .{});
Global.exit(1);
@@ -274,7 +277,7 @@ pub const BuildCommand = struct {
var output_dir = this_bundler.options.output_dir;
if (outfile.len > 0 and output_files.len == 1 and output_files[0].value == .buffer) {
output_dir = std.fs.path.dirname(outfile) orelse ".";
- output_files[0].path = std.fs.path.basename(outfile);
+ output_files[0].dest_path = std.fs.path.basename(outfile);
}
if (!ctx.bundler_options.compile) {
@@ -302,14 +305,14 @@ pub const BuildCommand = struct {
var all_paths = try ctx.allocator.alloc([]const u8, output_files.len);
var max_path_len: usize = 0;
for (all_paths, output_files) |*dest, src| {
- dest.* = src.path;
+ dest.* = src.dest_path;
}
var from_path = resolve_path.longestCommonPath(all_paths);
for (output_files) |f| {
max_path_len = std.math.max(
- std.math.max(from_path.len, f.path.len) + 2 - from_path.len,
+ std.math.max(from_path.len, f.dest_path.len) + 2 - from_path.len,
max_path_len,
);
}
@@ -367,17 +370,17 @@ pub const BuildCommand = struct {
switch (f.value) {
// Nothing to do in this case
.saved => {
- rel_path = f.path;
- if (f.path.len > from_path.len) {
- rel_path = resolve_path.relative(from_path, f.path);
+ rel_path = f.dest_path;
+ if (f.dest_path.len > from_path.len) {
+ rel_path = resolve_path.relative(from_path, f.dest_path);
}
},
// easy mode: write the buffer
.buffer => |value| {
- rel_path = f.path;
- if (f.path.len > from_path.len) {
- rel_path = resolve_path.relative(from_path, f.path);
+ rel_path = f.dest_path;
+ if (f.dest_path.len > from_path.len) {
+ rel_path = resolve_path.relative(from_path, f.dest_path);
if (std.fs.path.dirname(rel_path)) |parent| {
if (parent.len > root_path.len) {
try root_dir.dir.makePath(parent);
@@ -416,7 +419,7 @@ pub const BuildCommand = struct {
}
},
.move => |value| {
- const primary = f.path[from_path.len..];
+ const primary = f.dest_path[from_path.len..];
bun.copy(u8, filepath_buf[2..], primary);
rel_path = filepath_buf[0 .. primary.len + 2];
rel_path = value.pathname;