From 0f6ff6341a46f6e04f4d18a6690d496226f2b123 Mon Sep 17 00:00:00 2001 From: BrewedSys <16honest_belle@icloud.com> Date: Sun, 29 Mar 2026 17:01:22 -0600 Subject: [PATCH] chore: restructure project file layout (fixes #25) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reorganize repository for clear separation of concerns: - rust-native/ → rsrc/ (Pure Rust compilation) - Cargo.toml + build.rs moved to root level - bench/ → .github/bench/ - test/ → .github/tests/ - src/ stays as independent NPM module - Updated all path references across scripts, CI, and source files Co-Authored-By: Claude Opus 4.6 (1M context) --- {bench => .github/bench}/ci.js | 14 ++--- .../bench}/fiber-server/fiber-server | Bin {bench => .github/bench}/fiber-server/go.mod | 0 {bench => .github/bench}/fiber-server/go.sum | 0 {bench => .github/bench}/fiber-server/main.go | 0 {bench => .github/bench}/run.js | 16 +++--- {bench => .github/bench}/target.js | 4 +- {bench => .github/bench}/test-http-bun.js | 0 {bench => .github/bench}/test-http.js | 2 +- {bench => .github/bench}/test.js | 2 +- .github/examples/README.md | 12 ++-- .github/tests/test-hot-app.js | 18 ++++++ {test => .github/tests}/test.js | 4 +- .github/workflows/main.yml | 29 +++++----- .gitignore | 4 +- rust-native/Cargo.lock => Cargo.lock | 0 rust-native/Cargo.toml => Cargo.toml | 1 + rust-native/build.rs => build.rs | 0 package.json | 54 +++++++++--------- {rust-native => rsrc}/src/analyzer.rs | 0 {rust-native => rsrc}/src/lib.rs | 0 {rust-native => rsrc}/src/manifest.rs | 0 {rust-native => rsrc}/src/router.rs | 0 {rust-native => rsrc}/src/session.rs | 0 {rust-native => rsrc}/src/websocket.rs | 0 rust-native/build.log | 20 ------- scripts/build-native.mjs | 4 +- src/dev/hot-reload.js | 4 +- src/index.d.ts | 2 +- 29 files changed, 93 insertions(+), 97 deletions(-) rename {bench => .github/bench}/ci.js (96%) rename {bench => .github/bench}/fiber-server/fiber-server (100%) rename {bench => .github/bench}/fiber-server/go.mod (100%) rename {bench => .github/bench}/fiber-server/go.sum (100%) rename {bench => .github/bench}/fiber-server/main.go (100%) rename {bench => .github/bench}/run.js (84%) rename {bench => .github/bench}/target.js (96%) rename {bench => .github/bench}/test-http-bun.js (100%) rename {bench => .github/bench}/test-http.js (92%) rename {bench => .github/bench}/test.js (97%) create mode 100644 .github/tests/test-hot-app.js rename {test => .github/tests}/test.js (99%) rename rust-native/Cargo.lock => Cargo.lock (100%) rename rust-native/Cargo.toml => Cargo.toml (97%) rename rust-native/build.rs => build.rs (100%) rename {rust-native => rsrc}/src/analyzer.rs (100%) rename {rust-native => rsrc}/src/lib.rs (100%) rename {rust-native => rsrc}/src/manifest.rs (100%) rename {rust-native => rsrc}/src/router.rs (100%) rename {rust-native => rsrc}/src/session.rs (100%) rename {rust-native => rsrc}/src/websocket.rs (100%) delete mode 100644 rust-native/build.log diff --git a/bench/ci.js b/.github/bench/ci.js similarity index 96% rename from bench/ci.js rename to .github/bench/ci.js index c9c07ff..5aebe41 100644 --- a/bench/ci.js +++ b/.github/bench/ci.js @@ -10,7 +10,7 @@ const DEFAULT_SCENARIOS = ["static", "dynamic", "opt"]; const DEFAULT_CONNECTIONS = 200; const DEFAULT_DURATION = "10s"; const DEFAULT_TIMEOUT = "2s"; -const DEFAULT_OUTPUT_DIR = "bench/results"; +const DEFAULT_OUTPUT_DIR = ".github/bench/results"; const DEFAULT_HTTP_NATIVE_RUNTIME = "bun"; const DEFAULT_BOMBARDIER_BIN = resolveBombardierBin(); const SUPPORTED_HTTP_NATIVE_RUNTIMES = new Set(["bun", "node"]); @@ -155,7 +155,7 @@ function parseArgs(argv) { } function printUsage() { - console.log("Usage: bun bench/ci.js [options]"); + console.log("Usage: bun .github/bench/ci.js [options]"); console.log(""); console.log("Options:"); console.log(` --engines=http-native,bun Comma-separated list. Default: ${DEFAULT_ENGINES.join(",")}`); @@ -327,7 +327,7 @@ async function runBenchmarkCase(testCase, options) { function spawnServer(testCase, options) { if (testCase.engine === "bun" || testCase.engine === "http-native" || testCase.engine === "old") { const runtime = testCase.engine === "bun" ? "bun" : options.httpNativeRuntime; - return spawn(runtime, ["bench/target.js", testCase.engine, testCase.scenario, String(testCase.port)], { + return spawn(runtime, [".github/bench/target.js", testCase.engine, testCase.scenario, String(testCase.port)], { cwd: process.cwd(), detached: process.platform !== "win32", stdio: ["ignore", "pipe", "pipe"], @@ -335,7 +335,7 @@ function spawnServer(testCase, options) { } if (testCase.engine === "fiber") { - const cwd = resolve(process.cwd(), "bench/fiber-server"); + const cwd = resolve(process.cwd(), ".github/bench/fiber-server"); if (!existsSync(resolve(cwd, "go.mod"))) { throw new Error(`Missing Fiber benchmark target at ${cwd}`); } @@ -348,7 +348,7 @@ function spawnServer(testCase, options) { } if (testCase.engine === "zig") { - const cwd = resolve(process.cwd(), "bench/zig-httpz"); + const cwd = resolve(process.cwd(), ".github/bench/zig-httpz"); if (!existsSync(cwd)) { throw new Error(`Missing Zig benchmark target at ${cwd}`); } @@ -362,8 +362,8 @@ function spawnServer(testCase, options) { if (testCase.engine === "xitca" || testCase.engine === "monoio") { const manifestPath = testCase.engine === "xitca" - ? resolve(process.cwd(), "bench/xitca-server/Cargo.toml") - : resolve(process.cwd(), "bench/monoio-server/Cargo.toml"); + ? resolve(process.cwd(), ".github/bench/xitca-server/Cargo.toml") + : resolve(process.cwd(), ".github/bench/monoio-server/Cargo.toml"); if (!existsSync(manifestPath)) { throw new Error(`Missing Rust benchmark target at ${manifestPath}`); diff --git a/bench/fiber-server/fiber-server b/.github/bench/fiber-server/fiber-server similarity index 100% rename from bench/fiber-server/fiber-server rename to .github/bench/fiber-server/fiber-server diff --git a/bench/fiber-server/go.mod b/.github/bench/fiber-server/go.mod similarity index 100% rename from bench/fiber-server/go.mod rename to .github/bench/fiber-server/go.mod diff --git a/bench/fiber-server/go.sum b/.github/bench/fiber-server/go.sum similarity index 100% rename from bench/fiber-server/go.sum rename to .github/bench/fiber-server/go.sum diff --git a/bench/fiber-server/main.go b/.github/bench/fiber-server/main.go similarity index 100% rename from bench/fiber-server/main.go rename to .github/bench/fiber-server/main.go diff --git a/bench/run.js b/.github/bench/run.js similarity index 84% rename from bench/run.js rename to .github/bench/run.js index cd81d59..768e1da 100644 --- a/bench/run.js +++ b/.github/bench/run.js @@ -9,14 +9,14 @@ const port = Number(portArg ?? 3001); const httpNativeRuntime = runtimeArg ?? "bun"; function printUsage() { - console.log("Usage: bun bench/run.js [httpNativeRuntime]"); + console.log("Usage: bun .github/bench/run.js [httpNativeRuntime]"); console.log("Engines: http-native | bun | fiber | xitca | monoio | zig"); console.log("Scenarios: static | dynamic | opt"); console.log("httpNativeRuntime: bun | node (only applies to http-native and old)"); console.log(""); console.log("Example:"); - console.log(" bun bench/run.js http-native static 3001 bun"); - console.log(" bun bench/run.js http-native static 3001 node"); + console.log(" bun .github/bench/run.js http-native static 3001 bun"); + console.log(" bun .github/bench/run.js http-native static 3001 node"); console.log(" bombardier -c 200 -d 10s http://127.0.0.1:3001/"); } @@ -59,8 +59,8 @@ async function main() { "--release", "--manifest-path", engine === "xitca" - ? "bench/xitca-server/Cargo.toml" - : "bench/monoio-server/Cargo.toml", + ? ".github/bench/xitca-server/Cargo.toml" + : ".github/bench/monoio-server/Cargo.toml", "--", scenario, String(port), @@ -75,16 +75,16 @@ async function main() { "zig", ["build", "run", "-Doptimize=ReleaseFast", "--", scenario, String(port)], { - cwd: `${process.cwd()}/bench/zig-httpz`, + cwd: `${process.cwd()}/.github/bench/zig-httpz`, stdio: ["ignore", "pipe", "inherit"], }, ) : engine === "fiber" - ? spawn("go", ["run", "./bench/fiber-server", scenario, String(port)], { + ? spawn("go", ["run", "./.github/bench/fiber-server", scenario, String(port)], { cwd: process.cwd(), stdio: ["ignore", "pipe", "inherit"], }) - : spawn(targetRuntime, ["bench/target.js", engine, scenario, String(port)], { + : spawn(targetRuntime, [".github/bench/target.js", engine, scenario, String(port)], { cwd: process.cwd(), stdio: ["ignore", "pipe", "inherit"], }); diff --git a/bench/target.js b/.github/bench/target.js similarity index 96% rename from bench/target.js rename to .github/bench/target.js index 6c88a48..e2b9f87 100644 --- a/bench/target.js +++ b/.github/bench/target.js @@ -3,7 +3,7 @@ import { resolve } from "node:path"; process.env.HTTP_NATIVE_NODE_PATH ??= resolve(process.cwd(), "http-native.release.node"); process.env.HTTP_NATIVE_NATIVE_PATH ??= process.env.HTTP_NATIVE_NODE_PATH; -const { createApp: createHttpNativeApp } = await import("../src/index.js"); +const { createApp: createHttpNativeApp } = await import("../../src/index.js"); const [, , engine, scenario, portArg] = process.argv; const port = Number(portArg ?? 0); @@ -160,7 +160,7 @@ if (engine === "bun") { } else if (engine === "http-native") { await startFrameworkServer(createHttpNativeApp, "http-native", scenario); } else if (engine === "old") { - const { createApp: createOldApp } = await import("../old/src/index.js"); + const { createApp: createOldApp } = await import("../../old/src/index.js"); await startFrameworkServer(createOldApp, "old", scenario); } else { throw new Error(`Unsupported benchmark engine: ${engine}`); diff --git a/bench/test-http-bun.js b/.github/bench/test-http-bun.js similarity index 100% rename from bench/test-http-bun.js rename to .github/bench/test-http-bun.js diff --git a/bench/test-http.js b/.github/bench/test-http.js similarity index 92% rename from bench/test-http.js rename to .github/bench/test-http.js index ece4aa2..b2e9f95 100644 --- a/bench/test-http.js +++ b/.github/bench/test-http.js @@ -2,7 +2,7 @@ import { resolve } from "node:path"; process.env.HTTP_NATIVE_NODE_PATH ??= resolve(process.cwd(), "http-native.release.node"); -const { createApp } = await import("../src/index.js"); +const { createApp } = await import("../../src/index.js"); const db = { async getUser(id) { diff --git a/bench/test.js b/.github/bench/test.js similarity index 97% rename from bench/test.js rename to .github/bench/test.js index fa7ffb7..6ea8457 100644 --- a/bench/test.js +++ b/.github/bench/test.js @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; -import { createApp } from "../src/index.js"; +import { createApp } from "../../src/index.js"; const db = { async getUser(id) { diff --git a/.github/examples/README.md b/.github/examples/README.md index 56010df..fd3bf9d 100644 --- a/.github/examples/README.md +++ b/.github/examples/README.md @@ -7,12 +7,12 @@ Each folder contains a self-contained example you can run with `bun`: bun run build # Then run any example -bun examples/basic/server.js -bun examples/cors/server.js -bun examples/middleware/server.js -bun examples/rest-api/server.js -bun examples/validation/server.js -bun examples/error-handling/server.js +bun .github/examples/basic/server.js +bun .github/examples/cors/server.js +bun .github/examples/middleware/server.js +bun .github/examples/rest-api/server.js +bun .github/examples/validation/server.js +bun .github/examples/error-handling/server.js ``` ## Examples diff --git a/.github/tests/test-hot-app.js b/.github/tests/test-hot-app.js new file mode 100644 index 0000000..ff94660 --- /dev/null +++ b/.github/tests/test-hot-app.js @@ -0,0 +1,18 @@ +import { createApp } from "../../src/index.js"; + +const app = createApp(); + +/** [Auto generated by http-native] + * [http-native optimization] static-fast-path + * This route is served by the static fast path and avoids generic bridge dispatch. + */ +/** [Auto generated by http-native] + * [http-native optimization] static-fast-path + * This route is served by the static fast path and avoids generic bridge dispatch. + */ +app.get("/", (req, res) => { + res.json({ hello: "world", time: Date.now() }); +}); + +const server = await app.listen({ port: 3000 }); +console.log("Server running at " + server.url); diff --git a/test/test.js b/.github/tests/test.js similarity index 99% rename from test/test.js rename to .github/tests/test.js index 3c2f042..0c2430a 100644 --- a/test/test.js +++ b/.github/tests/test.js @@ -2,8 +2,8 @@ import assert from "node:assert/strict"; import { Buffer } from "node:buffer"; import net from "node:net"; -import httpServerConfig from "../src/http-server.config.js"; -import { createApp } from "../src/index.js"; +import httpServerConfig from "../../src/http-server.config.js"; +import { createApp } from "../../src/index.js"; const stablePayload = { ok: true, diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a75351c..e452d8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,8 +68,8 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - rust-native/target - key: ${{ runner.os }}-cargo-${{ hashFiles('rust-native/Cargo.lock', 'rust-native/Cargo.toml') }} + target + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock', 'Cargo.toml') }} restore-keys: | ${{ runner.os }}-cargo- @@ -77,7 +77,6 @@ jobs: run: bun install - name: Build Rust native module - working-directory: rust-native run: | cargo build --release echo "Rust native module built successfully" @@ -104,39 +103,39 @@ jobs: - name: Create output directories run: | - mkdir -p bench/results/bun - mkdir -p bench/results/node + mkdir -p .github/bench/results/bun + mkdir -p .github/bench/results/node - name: Run benchmarks (http-native on Bun + selected engines) run: | - bun bench/ci.js \ + bun .github/bench/ci.js \ --engines="${{ inputs.engines || 'http-native,bun' }}" \ --scenarios="${{ inputs.scenarios || 'static,dynamic,opt' }}" \ --connections="${{ inputs.connections || '200' }}" \ --duration="${{ inputs.duration || '10s' }}" \ --timeout="${{ inputs.timeout || '2s' }}" \ --http-native-runtime="bun" \ - --output-dir="bench/results/bun" + --output-dir=".github/bench/results/bun" - name: Run benchmarks (http-native on Node) run: | - bun bench/ci.js \ + bun .github/bench/ci.js \ --engines="http-native" \ --scenarios="${{ inputs.scenarios || 'static,dynamic,opt' }}" \ --connections="${{ inputs.connections || '200' }}" \ --duration="${{ inputs.duration || '10s' }}" \ --timeout="${{ inputs.timeout || '2s' }}" \ --http-native-runtime="node" \ - --output-dir="bench/results/node" + --output-dir=".github/bench/results/node" - name: Display results if: always() run: | echo "=== Bun Runtime Results ===" - cat bench/results/bun/summary.md 2>/dev/null || echo "No Bun results" + cat .github/bench/results/bun/summary.md 2>/dev/null || echo "No Bun results" echo "" echo "=== Node Runtime Results ===" - cat bench/results/node/summary.md 2>/dev/null || echo "No Node results" + cat .github/bench/results/node/summary.md 2>/dev/null || echo "No Node results" - name: Upload benchmark artifacts if: always() @@ -144,8 +143,8 @@ jobs: with: name: benchmark-results path: | - bench/results/bun/results.json - bench/results/bun/summary.md - bench/results/node/results.json - bench/results/node/summary.md + .github/bench/results/bun/results.json + .github/bench/results/bun/summary.md + .github/bench/results/node/results.json + .github/bench/results/node/summary.md if-no-files-found: ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore index 09b26c1..2c69dc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ node_modules/ target/ -rust-native/target/ -old/native/target/ .DS_Store http-native.node http-native.debug.node @@ -13,5 +11,5 @@ old/ #opt/ .zig-cache zig-httpz -bench/results/ +.github/bench/results/ testing/ diff --git a/rust-native/Cargo.lock b/Cargo.lock similarity index 100% rename from rust-native/Cargo.lock rename to Cargo.lock diff --git a/rust-native/Cargo.toml b/Cargo.toml similarity index 97% rename from rust-native/Cargo.toml rename to Cargo.toml index 91e1854..8a47694 100644 --- a/rust-native/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [lib] crate-type = ["cdylib"] +path = "rsrc/src/lib.rs" [dependencies] anyhow = "1.0" diff --git a/rust-native/build.rs b/build.rs similarity index 100% rename from rust-native/build.rs rename to build.rs diff --git a/package.json b/package.json index 73431da..1864601 100644 --- a/package.json +++ b/package.json @@ -25,34 +25,34 @@ "scripts": { "build": "bun scripts/build-native.mjs", "build:release": "bun scripts/build-native.mjs --release", - "dev:hot": "HTTP_NATIVE_HOT_RELOAD=1 bun test/app.ts", + "dev:hot": "HTTP_NATIVE_HOT_RELOAD=1 bun .github/tests/app.ts", "dev": "bun src/hot.js", - "test": "bun run build && bun test/test.js", - "bench": "bun run build:release && bun bench/run.js", - "bench:http-native:static": "bun run build:release && bun bench/run.js http-native static 3001", - "bench:http-native:bun:static": "bun run build:release && bun bench/run.js http-native static 3001 bun", - "bench:http-native:node:static": "bun run build:release && bun bench/run.js http-native static 3001 node", - "bench:bun:static": "bun bench/run.js bun static 3000", - "bench:fiber:static": "bun bench/run.js fiber static 3009", - "bench:xitca:static": "bun bench/run.js xitca static 3003", - "bench:monoio:static": "bun bench/run.js monoio static 3004", - "bench:zig:static": "bun bench/run.js zig static 3005", - "bench:http-native:dynamic": "bun run build:release && bun bench/run.js http-native dynamic 3011", - "bench:http-native:bun:dynamic": "bun run build:release && bun bench/run.js http-native dynamic 3011 bun", - "bench:http-native:node:dynamic": "bun run build:release && bun bench/run.js http-native dynamic 3011 node", - "bench:bun:dynamic": "bun bench/run.js bun dynamic 3010", - "bench:fiber:dynamic": "bun bench/run.js fiber dynamic 3019", - "bench:xitca:dynamic": "bun bench/run.js xitca dynamic 3013", - "bench:monoio:dynamic": "bun bench/run.js monoio dynamic 3014", - "bench:zig:dynamic": "bun bench/run.js zig dynamic 3015", - "bench:http-native:opt": "bun run build:release && bun bench/run.js http-native opt 3021", - "bench:http-native:bun:opt": "bun run build:release && bun bench/run.js http-native opt 3021 bun", - "bench:http-native:node:opt": "bun run build:release && bun bench/run.js http-native opt 3021 node", - "bench:bun:opt": "bun bench/run.js bun opt 3020", - "bench:fiber:opt": "bun bench/run.js fiber opt 3029", - "bench:xitca:opt": "bun bench/run.js xitca opt 3023", - "bench:monoio:opt": "bun bench/run.js monoio opt 3024", - "bench:zig:opt": "bun bench/run.js zig opt 3025" + "test": "bun run build && bun .github/tests/test.js", + "bench": "bun run build:release && bun .github/bench/run.js", + "bench:http-native:static": "bun run build:release && bun .github/bench/run.js http-native static 3001", + "bench:http-native:bun:static": "bun run build:release && bun .github/bench/run.js http-native static 3001 bun", + "bench:http-native:node:static": "bun run build:release && bun .github/bench/run.js http-native static 3001 node", + "bench:bun:static": "bun .github/bench/run.js bun static 3000", + "bench:fiber:static": "bun .github/bench/run.js fiber static 3009", + "bench:xitca:static": "bun .github/bench/run.js xitca static 3003", + "bench:monoio:static": "bun .github/bench/run.js monoio static 3004", + "bench:zig:static": "bun .github/bench/run.js zig static 3005", + "bench:http-native:dynamic": "bun run build:release && bun .github/bench/run.js http-native dynamic 3011", + "bench:http-native:bun:dynamic": "bun run build:release && bun .github/bench/run.js http-native dynamic 3011 bun", + "bench:http-native:node:dynamic": "bun run build:release && bun .github/bench/run.js http-native dynamic 3011 node", + "bench:bun:dynamic": "bun .github/bench/run.js bun dynamic 3010", + "bench:fiber:dynamic": "bun .github/bench/run.js fiber dynamic 3019", + "bench:xitca:dynamic": "bun .github/bench/run.js xitca dynamic 3013", + "bench:monoio:dynamic": "bun .github/bench/run.js monoio dynamic 3014", + "bench:zig:dynamic": "bun .github/bench/run.js zig dynamic 3015", + "bench:http-native:opt": "bun run build:release && bun .github/bench/run.js http-native opt 3021", + "bench:http-native:bun:opt": "bun run build:release && bun .github/bench/run.js http-native opt 3021 bun", + "bench:http-native:node:opt": "bun run build:release && bun .github/bench/run.js http-native opt 3021 node", + "bench:bun:opt": "bun .github/bench/run.js bun opt 3020", + "bench:fiber:opt": "bun .github/bench/run.js fiber opt 3029", + "bench:xitca:opt": "bun .github/bench/run.js xitca opt 3023", + "bench:monoio:opt": "bun .github/bench/run.js monoio opt 3024", + "bench:zig:opt": "bun .github/bench/run.js zig opt 3025" }, "dependencies": { "@http-native/core": "^0.0.1" diff --git a/rust-native/src/analyzer.rs b/rsrc/src/analyzer.rs similarity index 100% rename from rust-native/src/analyzer.rs rename to rsrc/src/analyzer.rs diff --git a/rust-native/src/lib.rs b/rsrc/src/lib.rs similarity index 100% rename from rust-native/src/lib.rs rename to rsrc/src/lib.rs diff --git a/rust-native/src/manifest.rs b/rsrc/src/manifest.rs similarity index 100% rename from rust-native/src/manifest.rs rename to rsrc/src/manifest.rs diff --git a/rust-native/src/router.rs b/rsrc/src/router.rs similarity index 100% rename from rust-native/src/router.rs rename to rsrc/src/router.rs diff --git a/rust-native/src/session.rs b/rsrc/src/session.rs similarity index 100% rename from rust-native/src/session.rs rename to rsrc/src/session.rs diff --git a/rust-native/src/websocket.rs b/rsrc/src/websocket.rs similarity index 100% rename from rust-native/src/websocket.rs rename to rsrc/src/websocket.rs diff --git a/rust-native/build.log b/rust-native/build.log deleted file mode 100644 index 9c03a8e..0000000 --- a/rust-native/build.log +++ /dev/null @@ -1,20 +0,0 @@ -warning: variable does not need to be mutable - --> src/lib.rs:1638:9 - | -1638 | let mut total_size = - | ----^^^^^^^^^^ - | | - | help: remove this `mut` - | - = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default - -warning: function `build_response_bytes` is never used - --> src/lib.rs:1657:4 - | -1657 | fn build_response_bytes( - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default - -warning: `http_native_napi` (lib) generated 2 warnings (run `cargo fix --lib -p http_native_napi` to apply 1 suggestion) - Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s diff --git a/scripts/build-native.mjs b/scripts/build-native.mjs index c028ff8..c0f4f7b 100644 --- a/scripts/build-native.mjs +++ b/scripts/build-native.mjs @@ -11,7 +11,7 @@ const cargoArgs = ["build"]; if (release) { cargoArgs.push("--release"); } -cargoArgs.push("--manifest-path", "rust-native/Cargo.toml"); +cargoArgs.push("--manifest-path", "Cargo.toml"); const result = Bun.spawnSync({ cmd: ["cargo", ...cargoArgs], @@ -32,7 +32,7 @@ const platformArtifact = ? "http_native_napi.dll" : "libhttp_native_napi.so"; -const source = resolve(`rust-native/target/${profile}/${platformArtifact}`); +const source = resolve(`target/${profile}/${platformArtifact}`); const profileTarget = resolve(`http-native.${profile}.node`); const defaultTarget = resolve("http-native.node"); diff --git a/src/dev/hot-reload.js b/src/dev/hot-reload.js index 646b810..857b0df 100644 --- a/src/dev/hot-reload.js +++ b/src/dev/hot-reload.js @@ -2,7 +2,7 @@ import { spawn } from "node:child_process"; import { existsSync, watch } from "node:fs"; import path from "node:path"; -const DEFAULT_WATCH_ROOTS = ["src", "rust-native/src", "test"]; +const DEFAULT_WATCH_ROOTS = ["src", "rsrc/src", ".github/tests"]; const DEFAULT_DEBOUNCE_MS = 120; const WATCHED_EXTENSIONS = new Set([ ".js", @@ -19,7 +19,7 @@ const IGNORED_SEGMENTS = new Set([ "node_modules", ".git", "target", - "bench/results", + ".github/bench/results", ".http-native", ]); diff --git a/src/index.d.ts b/src/index.d.ts index 694b411..8e0e3b5 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -176,7 +176,7 @@ export interface RuntimeOptimizationOptions { cache?: boolean; /** Restart process on JS/Rust source changes (dev only, default: false) */ hotReload?: boolean; - /** Watch roots for hot reload (default: ["src", "rust-native/src", "test"]) */ + /** Watch roots for hot reload (default: ["src", "rsrc/src", ".github/tests"]) */ hotReloadPaths?: string[]; /** Debounce window for restart triggers in ms (default: 120) */ hotReloadDebounceMs?: number;