Compare commits

...

1 Commits

Author SHA1 Message Date
Meghan Denny
454c7b666a Bun.build: remove throw option and add todo to remove test wrapper 2025-01-21 15:40:05 -08:00
5 changed files with 2 additions and 33 deletions

View File

@@ -2742,13 +2742,6 @@ declare module "bun" {
* Drop function calls to matching property accesses.
*/
drop?: string[];
/**
* When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
* When set to `false`, the `success` property of the returned object will be `false` when a build failure happens.
* This defaults to `true`.
*/
throw?: boolean;
}
namespace Password {

View File

@@ -78,7 +78,6 @@ pub const JSBundler = struct {
css_chunking: bool = false,
drop: bun.StringSet = bun.StringSet.init(bun.default_allocator),
has_any_on_before_parse: bool = false,
throw_on_error: bool = true,
env_behavior: Api.DotEnvBehavior = .disable,
env_prefix: OwnedString = OwnedString.initEmpty(bun.default_allocator),
@@ -494,10 +493,6 @@ pub const JSBundler = struct {
};
}
if (try config.getBooleanStrict(globalThis, "throw")) |flag| {
this.throw_on_error = flag;
}
return this;
}

View File

@@ -1828,26 +1828,7 @@ pub const BundleV2 = struct {
switch (this.result) {
.pending => unreachable,
.err => brk: {
if (this.config.throw_on_error) {
promise.reject(globalThis, this.log.toJSAggregateError(globalThis, bun.String.static("Bundle failed")));
break :brk;
}
const root_obj = JSC.JSValue.createEmptyObject(globalThis, 3);
root_obj.put(globalThis, JSC.ZigString.static("outputs"), JSC.JSValue.createEmptyArray(globalThis, 0));
root_obj.put(
globalThis,
JSC.ZigString.static("success"),
JSC.JSValue.jsBoolean(false),
);
root_obj.put(
globalThis,
JSC.ZigString.static("logs"),
this.log.toJSArray(globalThis, bun.default_allocator),
);
promise.resolve(globalThis, root_obj);
},
.err => promise.reject(globalThis, this.log.toJSAggregateError(globalThis, bun.String.static("Bundle failed"))),
.value => |*build| {
const root_obj = JSC.JSValue.createEmptyObject(globalThis, 3);
const output_files: []options.OutputFile = build.output_files.items;

View File

@@ -2,6 +2,7 @@ import { BuildOutput, BuildConfig } from "bun";
/**
* Like Bun.build but doesn't throw like the old way because all the tests break and we have to ship bun 1.2 in 4 hours lol hahaha
* TODO: todo so this comes up in search. refactor tests that use this function to not need it
*/
export async function buildNoThrow(config: BuildConfig): Promise<BuildOutput> {
let build: BuildOutput;

View File

@@ -1030,7 +1030,6 @@ function expectBundled(
ignoreDCEAnnotations,
drop,
define: define ?? {},
throw: false,
} as BuildConfig;
if (dotenv) {