Refactor Zig imports and file structure (part 1) (#21270)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
taylor.fish
2025-07-22 17:51:38 -07:00
committed by GitHub
parent 73d92c7518
commit 07cd45deae
564 changed files with 9917 additions and 9697 deletions

View File

@@ -1,6 +1,6 @@
const ParsedShellScript = @This();
pub const js = JSC.Codegen.JSParsedShellScript;
pub const js = jsc.Codegen.JSParsedShellScript;
pub const toJS = js.toJS;
pub const fromJS = js.fromJS;
pub const fromJSDirect = js.fromJSDirect;
@@ -15,7 +15,7 @@ this_jsvalue: JSValue = .zero,
pub fn take(
this: *ParsedShellScript,
_: *JSC.JSGlobalObject,
_: *jsc.JSGlobalObject,
out_args: **ShellArgs,
out_jsobjs: *std.ArrayList(JSValue),
out_quiet: *bool,
@@ -48,9 +48,9 @@ pub fn finalize(
bun.destroy(this);
}
pub fn setCwd(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
pub fn setCwd(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
const arguments_ = callframe.arguments_old(2);
var arguments = JSC.CallFrame.ArgumentsSlice.init(globalThis.bunVM(), arguments_.slice());
var arguments = jsc.CallFrame.ArgumentsSlice.init(globalThis.bunVM(), arguments_.slice());
const str_js = arguments.nextEat() orelse {
return globalThis.throw("$`...`.cwd(): expected a string argument", .{});
};
@@ -59,17 +59,17 @@ pub fn setCwd(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe:
return .js_undefined;
}
pub fn setQuiet(this: *ParsedShellScript, _: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSC.JSValue {
pub fn setQuiet(this: *ParsedShellScript, _: *JSGlobalObject, _: *jsc.CallFrame) bun.JSError!jsc.JSValue {
this.quiet = true;
return .js_undefined;
}
pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
const value1 = callframe.argument(0).getObject() orelse {
return globalThis.throwInvalidArguments("env must be an object", .{});
};
var object_iter = try JSC.JSPropertyIterator(.{
var object_iter = try jsc.JSPropertyIterator(.{
.skip_empty_name = false,
.include_value = true,
}).init(globalThis, value1);
@@ -102,7 +102,7 @@ pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe:
return .js_undefined;
}
pub fn createParsedShellScript(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue {
pub fn createParsedShellScript(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!JSValue {
var shargs = ShellArgs.init();
const arguments_ = callframe.arguments_old(2);
@@ -159,9 +159,9 @@ pub fn createParsedShellScript(globalThis: *JSC.JSGlobalObject, callframe: *JSC.
.args = shargs,
.jsobjs = jsobjs,
});
parsed_shell_script.this_jsvalue = JSC.Codegen.JSParsedShellScript.toJS(parsed_shell_script, globalThis);
parsed_shell_script.this_jsvalue = jsc.Codegen.JSParsedShellScript.toJS(parsed_shell_script, globalThis);
bun.Analytics.Features.shell += 1;
bun.analytics.Features.shell += 1;
return parsed_shell_script.this_jsvalue;
}
@@ -173,12 +173,12 @@ const ShellArgs = interpreter.ShellArgs;
const bun = @import("bun");
const assert = bun.assert;
const JSC = bun.JSC;
const JSGlobalObject = JSC.JSGlobalObject;
const JSValue = JSC.JSValue;
const jsc = bun.jsc;
const JSGlobalObject = jsc.JSGlobalObject;
const JSValue = jsc.JSValue;
const CallFrame = JSC.CallFrame;
const ArgumentsSlice = JSC.CallFrame.ArgumentsSlice;
const CallFrame = jsc.CallFrame;
const ArgumentsSlice = jsc.CallFrame.ArgumentsSlice;
const shell = bun.shell;
const EnvMap = shell.EnvMap;