@@ -109,7 +109,7 @@ pub const JSBundler = struct {
109
109
return error .JSError ;
110
110
}
111
111
112
- if (plugin .getOwnOptional (globalThis , "name" , ZigString .Slice ) catch null ) | slice | {
112
+ if (plugin .getOptional (globalThis , "name" , ZigString .Slice ) catch null ) | slice | {
113
113
defer slice .deinit ();
114
114
if (slice .len == 0 ) {
115
115
globalThis .throwInvalidArguments ("Expected plugin to have a non-empty name" , .{});
@@ -153,13 +153,13 @@ pub const JSBundler = struct {
153
153
}
154
154
}
155
155
156
- if (config .getOwnTruthy (globalThis , "macros" )) | macros_flag | {
156
+ if (config .getTruthy (globalThis , "macros" )) | macros_flag | {
157
157
if (! macros_flag .coerce (bool , globalThis )) {
158
158
this .no_macros = true ;
159
159
}
160
160
}
161
161
162
- if (try config .getOwnOptional (globalThis , "bytecode" , bool )) | bytecode | {
162
+ if (try config .getOptional (globalThis , "bytecode" , bool )) | bytecode | {
163
163
this .bytecode = bytecode ;
164
164
165
165
if (bytecode ) {
@@ -169,7 +169,7 @@ pub const JSBundler = struct {
169
169
}
170
170
}
171
171
172
- if (try config .getOwnOptionalEnum (globalThis , "target" , options .Target )) | target | {
172
+ if (try config .getOptionalEnum (globalThis , "target" , options .Target )) | target | {
173
173
this .target = target ;
174
174
175
175
if (target != .bun and this .bytecode ) {
@@ -179,18 +179,18 @@ pub const JSBundler = struct {
179
179
}
180
180
181
181
var has_out_dir = false ;
182
- if (try config .getOwnOptional (globalThis , "outdir" , ZigString .Slice )) | slice | {
182
+ if (try config .getOptional (globalThis , "outdir" , ZigString .Slice )) | slice | {
183
183
defer slice .deinit ();
184
184
try this .outdir .appendSliceExact (slice .slice ());
185
185
has_out_dir = true ;
186
186
}
187
187
188
- if (try config .getOwnOptional (globalThis , "banner" , ZigString .Slice )) | slice | {
188
+ if (try config .getOptional (globalThis , "banner" , ZigString .Slice )) | slice | {
189
189
defer slice .deinit ();
190
190
try this .banner .appendSliceExact (slice .slice ());
191
191
}
192
192
193
- if (config .getOwnTruthy (globalThis , "sourcemap" )) | source_map_js | {
193
+ if (config .getTruthy (globalThis , "sourcemap" )) | source_map_js | {
194
194
if (bun .FeatureFlags .breaking_changes_1_2 and config .isBoolean ()) {
195
195
if (source_map_js == .true ) {
196
196
this .source_map = if (has_out_dir )
@@ -207,11 +207,11 @@ pub const JSBundler = struct {
207
207
}
208
208
}
209
209
210
- if (try config .getOwnOptionalEnum (globalThis , "packages" , options .PackagesOption )) | packages | {
210
+ if (try config .getOptionalEnum (globalThis , "packages" , options .PackagesOption )) | packages | {
211
211
this .packages = packages ;
212
212
}
213
213
214
- if (try config .getOwnOptionalEnum (globalThis , "format" , options .Format )) | format | {
214
+ if (try config .getOptionalEnum (globalThis , "format" , options .Format )) | format | {
215
215
this .format = format ;
216
216
217
217
if (this .bytecode and format != .cjs ) {
@@ -220,28 +220,28 @@ pub const JSBundler = struct {
220
220
}
221
221
}
222
222
223
- // if (try config.getOwnOptional (globalThis, "hot", bool)) |hot| {
223
+ // if (try config.getOptional (globalThis, "hot", bool)) |hot| {
224
224
// this.hot = hot;
225
225
// }
226
226
227
- if (try config .getOwnOptional (globalThis , "splitting" , bool )) | hot | {
227
+ if (try config .getOptional (globalThis , "splitting" , bool )) | hot | {
228
228
this .code_splitting = hot ;
229
229
}
230
230
231
- if (config .getOwnTruthy (globalThis , "minify" )) | hot | {
231
+ if (config .getTruthy (globalThis , "minify" )) | hot | {
232
232
if (hot .isBoolean ()) {
233
233
const value = hot .coerce (bool , globalThis );
234
234
this .minify .whitespace = value ;
235
235
this .minify .syntax = value ;
236
236
this .minify .identifiers = value ;
237
237
} else if (hot .isObject ()) {
238
- if (try hot .getOwnOptional (globalThis , "whitespace" , bool )) | whitespace | {
238
+ if (try hot .getOptional (globalThis , "whitespace" , bool )) | whitespace | {
239
239
this .minify .whitespace = whitespace ;
240
240
}
241
- if (try hot .getOwnOptional (globalThis , "syntax" , bool )) | syntax | {
241
+ if (try hot .getOptional (globalThis , "syntax" , bool )) | syntax | {
242
242
this .minify .syntax = syntax ;
243
243
}
244
- if (try hot .getOwnOptional (globalThis , "identifiers" , bool )) | syntax | {
244
+ if (try hot .getOptional (globalThis , "identifiers" , bool )) | syntax | {
245
245
this .minify .identifiers = syntax ;
246
246
}
247
247
} else {
@@ -265,19 +265,19 @@ pub const JSBundler = struct {
265
265
return error .JSError ;
266
266
}
267
267
268
- if (config .getOwnTruthy (globalThis , "emitDCEAnnotations" )) | flag | {
268
+ if (config .getTruthy (globalThis , "emitDCEAnnotations" )) | flag | {
269
269
if (flag .coerce (bool , globalThis )) {
270
270
this .emit_dce_annotations = true ;
271
271
}
272
272
}
273
273
274
- if (config .getOwnTruthy (globalThis , "ignoreDCEAnnotations" )) | flag | {
274
+ if (config .getTruthy (globalThis , "ignoreDCEAnnotations" )) | flag | {
275
275
if (flag .coerce (bool , globalThis )) {
276
276
this .ignore_dce_annotations = true ;
277
277
}
278
278
}
279
279
280
- if (config .getOwnTruthy (globalThis , "conditions" )) | conditions_value | {
280
+ if (config .getTruthy (globalThis , "conditions" )) | conditions_value | {
281
281
if (conditions_value .isString ()) {
282
282
var slice = conditions_value .toSliceOrNull (globalThis ) orelse {
283
283
globalThis .throwInvalidArguments ("Expected conditions to be an array of strings" , .{});
@@ -303,7 +303,7 @@ pub const JSBundler = struct {
303
303
304
304
{
305
305
const path : ZigString.Slice = brk : {
306
- if (try config .getOwnOptional (globalThis , "root" , ZigString .Slice )) | slice | {
306
+ if (try config .getOptional (globalThis , "root" , ZigString .Slice )) | slice | {
307
307
break :brk slice ;
308
308
}
309
309
@@ -344,21 +344,21 @@ pub const JSBundler = struct {
344
344
}
345
345
}
346
346
347
- // if (try config.getOwnOptional (globalThis, "dir", ZigString.Slice)) |slice| {
347
+ // if (try config.getOptional (globalThis, "dir", ZigString.Slice)) |slice| {
348
348
// defer slice.deinit();
349
349
// this.appendSliceExact(slice.slice()) catch unreachable;
350
350
// } else {
351
351
// this.appendSliceExact(globalThis.bunVM().bundler.fs.top_level_dir) catch unreachable;
352
352
// }
353
353
354
- if (try config .getOwnOptional (globalThis , "publicPath" , ZigString .Slice )) | slice | {
354
+ if (try config .getOptional (globalThis , "publicPath" , ZigString .Slice )) | slice | {
355
355
defer slice .deinit ();
356
356
try this .public_path .appendSliceExact (slice .slice ());
357
357
}
358
358
359
- if (config .getOwnTruthy (globalThis , "naming" )) | naming | {
359
+ if (config .getTruthy (globalThis , "naming" )) | naming | {
360
360
if (naming .isString ()) {
361
- if (try config .getOwnOptional (globalThis , "naming" , ZigString .Slice )) | slice | {
361
+ if (try config .getOptional (globalThis , "naming" , ZigString .Slice )) | slice | {
362
362
defer slice .deinit ();
363
363
if (! strings .hasPrefixComptime (slice .slice (), "./" )) {
364
364
try this .names .owned_entry_point .appendSliceExact ("./" );
@@ -367,7 +367,7 @@ pub const JSBundler = struct {
367
367
this .names .entry_point .data = this .names .owned_entry_point .list .items ;
368
368
}
369
369
} else if (naming .isObject ()) {
370
- if (try naming .getOwnOptional (globalThis , "entry" , ZigString .Slice )) | slice | {
370
+ if (try naming .getOptional (globalThis , "entry" , ZigString .Slice )) | slice | {
371
371
defer slice .deinit ();
372
372
if (! strings .hasPrefixComptime (slice .slice (), "./" )) {
373
373
try this .names .owned_entry_point .appendSliceExact ("./" );
@@ -376,7 +376,7 @@ pub const JSBundler = struct {
376
376
this .names .entry_point .data = this .names .owned_entry_point .list .items ;
377
377
}
378
378
379
- if (try naming .getOwnOptional (globalThis , "chunk" , ZigString .Slice )) | slice | {
379
+ if (try naming .getOptional (globalThis , "chunk" , ZigString .Slice )) | slice | {
380
380
defer slice .deinit ();
381
381
if (! strings .hasPrefixComptime (slice .slice (), "./" )) {
382
382
try this .names .owned_chunk .appendSliceExact ("./" );
@@ -385,7 +385,7 @@ pub const JSBundler = struct {
385
385
this .names .chunk .data = this .names .owned_chunk .list .items ;
386
386
}
387
387
388
- if (try naming .getOwnOptional (globalThis , "asset" , ZigString .Slice )) | slice | {
388
+ if (try naming .getOptional (globalThis , "asset" , ZigString .Slice )) | slice | {
389
389
defer slice .deinit ();
390
390
if (! strings .hasPrefixComptime (slice .slice (), "./" )) {
391
391
try this .names .owned_asset .appendSliceExact ("./" );
0 commit comments