diff options
author | 2021-06-02 20:37:04 -0700 | |
---|---|---|
committer | 2021-06-02 20:37:04 -0700 | |
commit | 21a1134de36e25b3559fac88243d1a9e1c7ca273 (patch) | |
tree | 2f50d15a05ce3bf0fcce8430878840ce9dd31565 | |
parent | 3bd725d80b9b3892e42a2c9e549b9a90b084252e (diff) | |
download | bun-21a1134de36e25b3559fac88243d1a9e1c7ca273.tar.gz bun-21a1134de36e25b3559fac88243d1a9e1c7ca273.tar.zst bun-21a1134de36e25b3559fac88243d1a9e1c7ca273.zip |
okl
Former-commit-id: 0fb2584f15e15a2ba59dea62eeae89eea216a0c7
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .vscode/launch.json | 19 | ||||
-rw-r--r-- | src/cli.zig | 2 | ||||
-rw-r--r-- | src/global.zig | 14 | ||||
-rw-r--r-- | src/main.zig | 14 |
5 files changed, 39 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore index 8386349cc..d04a67697 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,5 @@ coverv bench github out.* -out
\ No newline at end of file +out +.parcel-cache
\ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index a8aa87970..1bd5de4e9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,13 +25,28 @@ { "type": "lldb", "request": "launch", + "name": "Demo Serve", + "program": "${workspaceFolder}/build/debug/macos-x86_64/esdev", + "args": [ + "./src/index.tsx", + "--resolve=lazy", + "--outdir=public", + "--serve", + "--public-url=http://localhost:9000/" + ], + "cwd": "${workspaceFolder}/demos/simple-react", + "console": "internalConsole" + }, + { + "type": "lldb", + "request": "launch", "name": "Demo Build", "program": "${workspaceFolder}/build/debug/macos-x86_64/esdev", "args": [ "./src/index.tsx", "--resolve=dev", - "--outdir=public", - "--public-url=http://localhost:8080/" + "--outdir=out", + "--public-url=http://localhost:9000/" ], "cwd": "${workspaceFolder}/demos/simple-react", "console": "internalConsole" diff --git a/src/cli.zig b/src/cli.zig index 0ab04eaa3..34a00d285 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -418,7 +418,7 @@ pub const Cli = struct { if (!did_write) { for (result.output_files) |file, i| { - try stdout.unbuffered_writer.writeAll(file.contents); + try stdout.writeAll(file.contents); if (i > 0) { _ = try writer.write("\n\n"); } diff --git a/src/global.zig b/src/global.zig index 7ef18d25c..96ce1b447 100644 --- a/src/global.zig +++ b/src/global.zig @@ -44,6 +44,8 @@ pub const FeatureFlags = struct { pub const jsx_runtime_is_cjs = true; + pub const cache_node_module_output_in_memory = true; + pub const CSSModulePolyfill = enum { // When you import a .css file and you reference the import in JavaScript // Just return whatever the property key they referenced was @@ -63,8 +65,9 @@ pub const Output = struct { if (isWasm) { return std.io.FixedBufferStream([]u8); } else { - var stdin = std.io.getStdIn(); - return @TypeOf(std.io.bufferedWriter(stdin.writer())); + return std.fs.File; + // var stdout = std.io.getStdOut(); + // return @TypeOf(std.io.bufferedWriter(stdout.writer())); } }; stream: StreamType, @@ -92,6 +95,13 @@ pub const Output = struct { return source.stream.writer(); } + pub fn flush() void { + if (isNative) { + // source.stream.flush() catch {}; + // source.error_stream.flush() catch {}; + } + } + pub fn printErrorable(comptime fmt: string, args: anytype) !void { if (isWasm) { try source.stream.seekTo(0); diff --git a/src/main.zig b/src/main.zig index d212bf3a7..e8ad2c282 100644 --- a/src/main.zig +++ b/src/main.zig @@ -30,14 +30,14 @@ pub fn main() anyerror!void { // var root_alloc = std.heap.ArenaAllocator.init(std.heap.raw_c_allocator); // var root_alloc_ = &root_alloc.allocator; try alloc.setup(std.heap.c_allocator); - var stdout_file = std.io.getStdIn(); - var stdout = std.io.bufferedWriter(stdout_file.writer()); - var stderr_file = std.io.getStdErr(); - var stderr = std.io.bufferedWriter(stderr_file.writer()); + var stdout = std.io.getStdOut(); + // var stdout = std.io.bufferedWriter(stdout_file.writer()); + var stderr = std.io.getStdErr(); + // var stderr = std.io.bufferedWriter(stderr_file.writer()); var output_source = Output.Source.init(stdout, stderr); - defer stdout.flush() catch {}; - defer stderr.flush() catch {}; + // defer stdout.flush() catch {}; + // defer stderr.flush() catch {}; Output.Source.set(&output_source); - try cli.Cli.start(std.heap.c_allocator, &stdout, &stderr, MainPanicHandler); + try cli.Cli.start(std.heap.c_allocator, stdout, stderr, MainPanicHandler); } |