Remove unused files from repository

- Delete unused libtcc1.a.macos-aarch64 archive (never referenced, ARM64 doesn't need x64 compiler runtime)
- Remove misctools/publish-examples.js (references non-existent examples/ directory)
- Remove misctools/headers-cleaner.js (no references in codebase or build scripts)

The libtcc1.a.macos-aarch64 file was never used because:
- FFI code only compiles libtcc1.c on x64 platforms (Environment.isX64 check)
- ARM64 has native 64-bit operations and doesn't need these compiler runtime functions
- No equivalent files exist for other platforms

The misctools scripts were last modified in 2022 and are no longer used.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-09-08 05:39:26 +00:00
parent 73f0594704
commit 34f8ad90ab
3 changed files with 0 additions and 227 deletions

View File

@@ -1,90 +0,0 @@
// this file is intended to be runnable both from node and bun
var { readFileSync, writeFileSync } = require("fs");
var { join } = require("path");
const destination = join(__dirname, "../src/bun.js/bindings/headers.zig");
const replacements = join(__dirname, "../src/bun.js/bindings/headers-replacements.zig");
console.log("Writing to", destination);
var output = "// GENERATED CODE - DO NOT MODIFY BY HAND\n\n";
var input = readFileSync(destination, "utf8");
const first_extern = input.indexOf("extern fn");
const first_extern_line = input.indexOf("\n", first_extern - 128);
const last_extern_fn = input.lastIndexOf("extern");
const last_extern_fn_line = input.indexOf("\n", last_extern_fn);
const keep = (input.substring(0, first_extern_line) + input.substring(last_extern_fn_line))
.split("\n")
.filter(a => /const (JSC|WTF|Web)_/gi.test(a) && !a.includes("JSValue") && !a.includes("CatchScope"))
.join("\n")
.trim();
input = keep + input.slice(first_extern_line, last_extern_fn_line);
input = input.replaceAll("*WebCore__", "*bindings.");
input = input.replaceAll("*JSC__", "*bindings.");
input = input.replaceAll("[*c] JSC__", "[*c]bindings.");
input = input.replaceAll("[*c]JSC__", "[*c]bindings.");
input = input.replaceAll("[*c]bindings.JSGlobalObject", "*bindings.JSGlobalObject");
input = input.replaceAll("[*c]bindings.JSPromise", "?*bindings.JSPromise");
input = input.replaceAll("[*c]const bindings.JSPromise", "?*const bindings.JSPromise");
input = input.replaceAll("[*c] const JSC__", "[*c]const bindings.");
input = input.replaceAll("[*c]Inspector__ScriptArguments", "[*c]bindings.ScriptArguments");
input = input
.replaceAll("VirtualMachine", "bindings.VirtualMachine")
.replaceAll("bindings.bindings.VirtualMachine", "bindings.VirtualMachine");
input = input.replaceAll("?*JSC__JSGlobalObject", "*bindings.JSGlobalObject");
input = input.replaceAll("?*bindings.CallFrame", "*bindings.CallFrame");
input = input.replaceAll("[*c]bindings.VM", "*bindings.VM");
const hardcode = {
"[*c][*c]JSC__Exception": "*?*JSC__Exception ",
"[*c]?*anyopaque": "[*c]*anyopaque",
"[*c]JSC__JSGlobalObject": "?*JSC__JSGlobalObject",
};
for (let key in hardcode) {
const value = hardcode[key];
input = input.replaceAll(key, value);
}
const remove = [
"pub const __darwin",
"pub const _",
"pub const __builtin",
"pub const int",
"pub const INT",
"pub const uint",
"pub const UINT",
"pub const WCHAR",
"pub const wchar",
"pub const intmax",
"pub const INTMAX",
"pub const uintmax",
"pub const UINTMAX",
"pub const max_align_t",
"pub const ZigErrorCode",
"pub const JSClassRef",
"pub const __",
];
var lines = input.split("\n");
for (let prefix of remove) {
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (line.startsWith(prefix)) {
lines[i] = "";
}
}
}
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (line.includes("struct_")) {
lines[i] = "";
continue;
}
}
input = lines.filter(a => a.length > 0).join("\n");
writeFileSync(destination, output + "\n" + readFileSync(replacements, "utf8").trim() + "\n" + input.trim() + "\n");

View File

@@ -1,137 +0,0 @@
const fs = require("fs");
const path = require("path");
const { execSync } = require("child_process");
const exec = (cmd, opts = {}) => {
console.log("$", cmd);
return execSync(cmd, {
...opts,
env: { CI: "true", ...process.env, ...(opts.env || {}) },
});
};
const DRY_RUN = !!process.env.DRY_RUN;
var count = 0;
const examplesFolderEntries = fs.readdirSync(path.join(process.cwd(), "examples"), { withFileTypes: true });
const packageNames = [];
for (let folder of examplesFolderEntries) {
if (!folder.isDirectory()) continue;
const absolute = path.resolve(process.cwd(), "examples", folder.name);
let packageJSONText;
try {
packageJSONText = fs.readFileSync(path.join(absolute, "package.json"), "utf8");
} catch {
continue;
}
let packageJSON = JSON.parse(packageJSONText);
if (!packageJSON.name) continue;
if (!packageJSON.name.startsWith("@bun-examples")) continue;
var version = "0.0.1";
try {
const _versions = exec(`npm view ${packageJSON.name} versions --json`).toString().trim();
if (_versions.length > 0) {
const versionsArray = JSON.parse(_versions);
version = versionsArray[versionsArray.length - 1];
}
} catch (exception) {
console.error(exception);
}
var retryCount = 5;
// Never commit lockfiles
try {
fs.rmSync(path.join(absolute, "package-lock.json"));
} catch (exception) {}
try {
fs.rmSync(path.join(absolute, "yarn.lock"));
} catch (exception) {}
try {
fs.rmSync(path.join(absolute, "pnpm-lock.yaml"));
} catch (exception) {}
try {
fs.copyFileSync(path.join(absolute, ".gitignore"), path.join(absolute, "gitignore"));
} catch (exception) {}
restart: while (retryCount-- > 0) {
packageJSON.version = require("semver").inc(packageJSON.version, "patch");
if ("private" in packageJSON) delete packageJSON.private;
if ("license" in packageJSON) delete packageJSON.license;
if ("main" in packageJSON && !("module" in packageJSON)) {
packageJSON.module = packageJSON.main;
delete packageJSON.main;
}
fs.writeFileSync(path.join(absolute, "package.json"), JSON.stringify(packageJSON, null, 2));
try {
exec(`npm version patch --force --no-commit-hooks --no-git-tag-version`, {
cwd: absolute,
});
packageJSON = JSON.parse(fs.readFileSync(path.join(absolute, "package.json"), "utf8"));
version = packageJSON.version;
} catch (e) {
if (e.code !== "E404") {
throw e;
}
}
try {
exec(`npm publish ${DRY_RUN ? "--dry-run" : ""} --access public --registry https://registry.npmjs.org/`, {
cwd: absolute,
});
packageNames.push([
packageJSON.name,
{
version: packageJSON.version,
description: packageJSON.description || "",
},
]);
count++;
break;
} catch (exception) {
continue restart;
}
}
}
if (packageNames.length > 0) {
const packageJSON = {
name: "bun-examples-all",
private: false,
version: `0.0.${Date.now()}`,
description: "All bun-examples",
examples: Object.fromEntries(packageNames),
};
const dir = path.join(process.cwd(), "examples/bun-examples-all");
try {
fs.rmSync(dir, {
recursive: true,
force: true,
});
} catch (exception) {}
try {
fs.mkdirSync(dir, {
recursive: true,
});
} catch (exception) {}
fs.writeFileSync(path.join(dir, "package.json"), JSON.stringify(packageJSON, null, 2));
exec(`npm publish ${DRY_RUN ? "--dry-run" : ""} --access public --registry https://registry.npmjs.org/`, {
cwd: dir,
});
}
console.log(`Published ${count} packages`);