Skip to content

Commit

Permalink
cli message improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
paperclover committed Sep 7, 2023
1 parent 581fe7b commit 91ec7e9
Show file tree
Hide file tree
Showing 21 changed files with 236 additions and 195 deletions.
12 changes: 3 additions & 9 deletions .vscode/launch.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@
"regex": "cpp",
"span": "cpp",
"valarray": "cpp",
"codecvt": "cpp",
"internal.h": "c",
"libusockets.h": "c"
"codecvt": "cpp"
},
"cmake.configureOnOpen": false,
"C_Cpp.errorSquiggles": "enabled",
Expand Down
2 changes: 1 addition & 1 deletion bench/expect-to-equal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To run in Bun:

```bash
# so it doesn't run the vitest one
bun wiptest expect-to-equal.test.js
bun test expect-to-equal.test.js
```

To run in Jest:
Expand Down
2 changes: 1 addition & 1 deletion docs/bundler/executables.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ All imported files and packages are bundled into the executable, along with a co
- `--outdir` — use `outfile` instead.
- `--external`
- `--splitting`
- `--publicPath`
- `--public-path`

{% /callout %}

Expand Down
2 changes: 1 addition & 1 deletion docs/bundler/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ By specifying `.` as `root`, the generated file structure will look like this:

A prefix to be appended to any import paths in bundled code.

<!-- $ bun build ./index.tsx --outdir ./out --publicPath https://cdn.example.com -->
<!-- $ bun build ./index.tsx --outdir ./out --public-path https://cdn.example.com -->

In many cases, generated bundles will contain no `import` statements. After all, the goal of bundling is to combine all of the code into a single file. However there are a number of cases with the generated bundles will contain `import` statements.

Expand Down
2 changes: 1 addition & 1 deletion packages/bun-ecosystem/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function loadPackage(pkg: Package, cwd?: string): Promise<void> {
}
await spawn({
cwd: dir,
cmd: ["bun", "wiptest", path],
cmd: ["bun", "test", path],
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/bun.js/module_loader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,10 @@ pub const HardcodedModule = enum {
.{ "_stream_wrap", .{ .path = "stream" } },
.{ "_tls_wrap", .{ .path = "tls" } },
.{ "_tls_common", .{ .path = "tls" } },

.{ "next/dist/compiled/ws", .{ .path = "ws" } },
.{ "next/dist/compiled/node-fetch", .{ .path = "node-fetch" } },
.{ "next/dist/compiled/undici", .{ .path = "undici" } },
};

const bun_extra_alias_kvs = .{
Expand Down
7 changes: 7 additions & 0 deletions src/bun.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,9 @@ pub const posix = struct {
pub inline fn argv() [][*:0]u8 {
return std.os.argv;
}
pub inline fn setArgv(new_ptr: [][*:0]u8) void {
std.os.argv = new_ptr;
}

pub fn stdio(i: anytype) FileDescriptor {
return switch (i) {
Expand All @@ -1722,6 +1725,10 @@ pub const win32 = struct {
return argv_;
}

pub inline fn setArgv(new_ptr: [][*:0]u8) void {
argv_ = new_ptr;
}

pub fn stdio(i: anytype) FileDescriptor {
return switch (i) {
0 => STDIN_FD,
Expand Down
24 changes: 2 additions & 22 deletions src/bunfig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,6 @@ pub const Bunfig = struct {
}
}

if (comptime cmd == .DevCommand or cmd == .AutoCommand) {
if (json.get("dev")) |expr| {
if (expr.get("disableBunJS")) |disable| {
this.ctx.debug.fallback_only = disable.asBool() orelse false;
}

if (expr.get("logLevel")) |expr2| {
try this.loadLogLevel(expr2);
}

if (expr.get("port")) |port| {
try this.expect(port, .e_number);
this.bunfig.port = port.data.e_number.toU16();
if (this.bunfig.port.? == 0) {
this.bunfig.port = 3000;
}
}
}
}

if (comptime cmd == .TestCommand) {
if (json.get("test")) |test_| {
if (test_.get("root")) |root| {
Expand Down Expand Up @@ -501,7 +481,7 @@ pub const Bunfig = struct {
}

if (json.get("bundle")) |_bun| {
if (comptime cmd == .DevCommand or cmd == .BuildCommand or cmd == .RunCommand or cmd == .AutoCommand or cmd == .BuildCommand) {
if (comptime cmd == .BuildCommand or cmd == .RunCommand or cmd == .AutoCommand or cmd == .BuildCommand) {
if (_bun.get("outdir")) |dir| {
try this.expect(dir, .e_string);
this.bunfig.output_dir = try dir.data.e_string.string(allocator);
Expand Down Expand Up @@ -623,7 +603,7 @@ pub const Bunfig = struct {
}

switch (comptime cmd) {
.AutoCommand, .DevCommand, .BuildCommand => {
.AutoCommand, .BuildCommand => {
if (json.get("publicDir")) |public_dir| {
try this.expect(public_dir, .e_string);
this.bunfig.router = Api.RouteConfig{
Expand Down
Loading

0 comments on commit 91ec7e9

Please sign in to comment.