chore: upgrade zig to 0.13.0 (#9965)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Grigory <grigory.orlov.set@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Kenta Iwasaki <63115601+lithdew@users.noreply.github.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Dale Seo <5466341+DaleSeo@users.noreply.github.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
This commit is contained in:
dave caruso
2024-06-20 13:48:39 -07:00
committed by GitHub
parent e58cf69f94
commit b76376f8a6
179 changed files with 3993 additions and 3929 deletions

View File

@@ -9,6 +9,7 @@ const stringZ = bun.stringZ;
const default_allocator = bun.default_allocator;
const C = bun.C;
const std = @import("std");
const Progress = bun.Progress;
const lex = bun.js_lexer;
const logger = bun.logger;
@@ -43,7 +44,6 @@ const Headers = bun.http.Headers;
const CopyFile = @import("../copy_file.zig");
var bun_path_buf: bun.PathBuffer = undefined;
const Futex = @import("../futex.zig");
const ComptimeStringMap = @import("../comptime_string_map.zig").ComptimeStringMap;
const target_nextjs_version = "12.2.3";
pub var initialized_store = false;
@@ -270,7 +270,7 @@ pub const CreateCommand = struct {
const destination = try filesystem.dirname_store.append([]const u8, resolve_path.joinAbs(filesystem.top_level_dir, .auto, dirname));
var progress = std.Progress{};
var progress = Progress{};
progress.supports_ansi_escape_codes = Output.enable_ansi_colors_stderr;
var node = progress.start(try ProgressBuf.print("Loading {s}", .{template}), 0);
@@ -502,8 +502,8 @@ pub const CreateCommand = struct {
pub fn copy(
destination_dir_: std.fs.Dir,
walker: *Walker,
node_: *std.Progress.Node,
progress_: *std.Progress,
node_: *Progress.Node,
progress_: *Progress,
dst_base_len: if (Environment.isWindows) usize else void,
dst_buf: if (Environment.isWindows) *bun.WPathBuffer else void,
src_base_len: if (Environment.isWindows) usize else void,
@@ -650,7 +650,7 @@ pub const CreateCommand = struct {
};
if (comptime Environment.isWindows) try pkg.seekTo(prev_file_pos);
// The printer doesn't truncate, so we must do so manually
std.os.ftruncate(pkg.handle, 0) catch {};
std.posix.ftruncate(pkg.handle, 0) catch {};
initializeStore();
}
@@ -676,15 +676,15 @@ pub const CreateCommand = struct {
if (comptime Environment.isWindows) {
parent_dir.copyFile("gitignore", parent_dir, ".gitignore", .{}) catch {};
} else {
std.os.linkat(parent_dir.fd, "gitignore", parent_dir.fd, ".gitignore", 0) catch {};
std.posix.linkat(parent_dir.fd, "gitignore", parent_dir.fd, ".gitignore", 0) catch {};
}
std.os.unlinkat(
std.posix.unlinkat(
parent_dir.fd,
"gitignore",
0,
) catch {};
std.os.unlinkat(
std.posix.unlinkat(
parent_dir.fd,
".npmignore",
0,
@@ -1304,7 +1304,7 @@ pub const CreateCommand = struct {
// // }
// public_index_html_file.pwriteAll(outfile, 0) catch break :bail;
// std.os.ftruncate(public_index_html_file.handle, outfile.len + 1) catch break :bail;
// std.posix.ftruncate(public_index_html_file.handle, outfile.len + 1) catch break :bail;
// bun_bun_for_react_scripts = true;
// is_create_react_app = true;
// Output.prettyln("<r><d>[package.json] Added entry point {s} to public/index.html", .{create_react_app_entry_point_path});
@@ -1442,7 +1442,7 @@ pub const CreateCommand = struct {
break :process_package_json;
};
std.os.ftruncate(package_json_file.?.handle, written + 1) catch {};
std.posix.ftruncate(package_json_file.?.handle, written + 1) catch {};
// if (!create_options.skip_install) {
// if (needs.bun_bun_for_nextjs) {
@@ -1659,7 +1659,7 @@ pub const CreateCommand = struct {
if (create_options.open) {
if (which(&bun_path_buf, PATH, destination, "bun")) |bin| {
var argv = [_]string{bun.asByteSlice(bin)};
var child = std.ChildProcess.init(&argv, ctx.allocator);
var child = std.process.Child.init(&argv, ctx.allocator);
child.cwd = destination;
child.stdin_behavior = .Inherit;
child.stdout_behavior = .Inherit;
@@ -1833,7 +1833,7 @@ pub const Example = struct {
}
}
pub fn fetchAllLocalAndRemote(ctx: Command.Context, node: ?*std.Progress.Node, env_loader: *DotEnv.Loader, filesystem: *fs.FileSystem) !std.ArrayList(Example) {
pub fn fetchAllLocalAndRemote(ctx: Command.Context, node: ?*Progress.Node, env_loader: *DotEnv.Loader, filesystem: *fs.FileSystem) !std.ArrayList(Example) {
const remote_examples = try Example.fetchAll(ctx, env_loader, node);
if (node) |node_| node_.end();
@@ -1912,8 +1912,8 @@ pub const Example = struct {
ctx: Command.Context,
env_loader: *DotEnv.Loader,
name: string,
refresher: *std.Progress,
progress: *std.Progress.Node,
refresher: *Progress,
progress: *Progress.Node,
) !MutableString {
const owner_i = std.mem.indexOfScalar(u8, name, '/').?;
const owner = name[0..owner_i];
@@ -2033,7 +2033,7 @@ pub const Example = struct {
return mutable.*;
}
pub fn fetch(ctx: Command.Context, env_loader: *DotEnv.Loader, name: string, refresher: *std.Progress, progress: *std.Progress.Node) !MutableString {
pub fn fetch(ctx: Command.Context, env_loader: *DotEnv.Loader, name: string, refresher: *Progress, progress: *Progress.Node) !MutableString {
progress.name = "Fetching package.json";
refresher.refresh();
@@ -2171,7 +2171,7 @@ pub const Example = struct {
return mutable.*;
}
pub fn fetchAll(ctx: Command.Context, env_loader: *DotEnv.Loader, progress_node: ?*std.Progress.Node) ![]Example {
pub fn fetchAll(ctx: Command.Context, env_loader: *DotEnv.Loader, progress_node: ?*Progress.Node) ![]Example {
url = URL.parse(examples_url);
const http_proxy: ?URL = env_loader.getHttpProxy(url);
@@ -2279,7 +2279,7 @@ pub const CreateListExamplesCommand = struct {
env_loader.loadProcess();
var progress = std.Progress{};
var progress = Progress{};
progress.supports_ansi_escape_codes = Output.enable_ansi_colors_stderr;
const node = progress.start("Fetching manifest", 0);
progress.refresh();
@@ -2336,25 +2336,25 @@ const GitHandler = struct {
else
run(destination, PATH, false) catch false;
@fence(.Acquire);
@fence(.acquire);
success.store(
if (outcome)
1
else
2,
.Release,
.release,
);
Futex.wake(&success, 1);
}
pub fn wait() bool {
@fence(.Release);
@fence(.release);
while (success.load(.Acquire) == 0) {
while (success.load(.acquire) == 0) {
Futex.wait(&success, 0, 1000) catch continue;
}
const outcome = success.load(.Acquire) == 1;
const outcome = success.load(.acquire) == 1;
thread.join();
return outcome;
}
@@ -2400,7 +2400,7 @@ const GitHandler = struct {
inline for (comptime std.meta.fieldNames(@TypeOf(Commands))) |command_field| {
const command: []const string = @field(git_commands, command_field);
var process = std.ChildProcess.init(command, default_allocator);
var process = std.process.Child.init(command, default_allocator);
process.cwd = destination;
process.stdin_behavior = .Inherit;
process.stdout_behavior = .Inherit;