Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 187 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,15 @@ swc_html_minifier = { version = "35.0.0", default-features = false }
swc_node_comments = { version = "16.0.0", default-features = false }
swc_plugin_runner = { version = "21.0.0", default-features = false }

wasi-common = { version = "35.0.0", default-features = false }
wasmtime = { version = "35.0.0", default-features = false }

rspack_dojang = { version = "0.1.11", default-features = false }
tracy-client = { version = "=0.18.2", default-features = false, features = [
"enable",
"sampling",
"demangle",
"system-tracing",
] }
wasi-common = { version = "35.0.0", default-features = false }
wasmtime = { version = "35.0.0", default-features = false }


# all rspack workspace dependencies
Expand Down Expand Up @@ -251,10 +256,11 @@ opt-level = 0

# This is for local development
[profile.dev]
codegen-units = 16
debug = 2 # debug build will cause runtime panic if codegen-unints is default
incremental = true
panic = "abort"
codegen-units = 16
debug = 2 # debug build will cause runtime panic if codegen-unints is default
incremental = true
panic = "abort"
split-debuginfo = "unpacked"

[profile.release-debug]
codegen-units = 16
Expand Down
3 changes: 2 additions & 1 deletion crates/node_binding/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/*.node
/*.wasm
/*.wasm
/*.dSYM
3 changes: 2 additions & 1 deletion crates/node_binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ version.workspace = true
crate-type = ["cdylib"]

[features]
allocative = ["rspack_binding_api/allocative"]
browser = ["rspack_binding_api/browser"]
color-backtrace = ["rspack_binding_api/color-backtrace"]
debug_tool = ["rspack_binding_api/debug_tool"]
info-level = ["tracing/release_max_level_info"]
plugin = ["rspack_binding_api/plugin"]
sftrace-setup = ["rspack_binding_api/sftrace-setup"]
allocative = ["rspack_binding_api/allocative"]
tracy-client = ["rspack_binding_api/tracy-client"]

[package.metadata.cargo-shear]
# Adding napi-derive as a dependency to workaround an issue where `dts` will no longer work without it.
Expand Down
15 changes: 14 additions & 1 deletion crates/node_binding/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { values, positionals } = require("util").parseArgs({
allowPositionals: true
});

const { spawn } = require("child_process");
const { spawn, spawnSync } = require("child_process");

const NAPI_BINDING_DTS = "napi-binding.d.ts"
const CARGO_SAFELY_EXIT_CODE = 0;
Expand Down Expand Up @@ -82,6 +82,9 @@ async function build() {
features.push("allocative");
rustflags.push("--cfg=allocative");
}
if (process.env.TRACY) {
features.push("tracy-client");
}
if (values.profile === "release") {
features.push("info-level");
}
Expand Down Expand Up @@ -138,6 +141,16 @@ async function build() {
renameSync("rspack.wasm32-wasi.debug.wasm", "rspack.browser.debug.wasm")
renameSync("rspack.wasm32-wasi.wasm", "rspack.browser.wasm")
}

if(process.env.TRACY){
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after if keyword. JavaScript style conventions typically require a space between if and the opening parenthesis.

Suggestion:

if (process.env.TRACY) {
Suggested change
if(process.env.TRACY){
if (process.env.TRACY){

Copilot uses AI. Check for mistakes.
// split debug symbols for tracy
spawnSync('dsymutil', [
path.resolve(__dirname, "..", "rspack.darwin-arm64.node")
], {
stdio: "inherit",
shell: true,
})
}
Comment on lines +145 to +153
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dsymutil command and hardcoded path rspack.darwin-arm64.node are macOS-specific. This code will fail on other platforms (Linux, Windows) when TRACY is set. Consider adding a platform check or making the artifact path dynamic based on the build target.

Suggestion:

if(process.env.TRACY && process.platform === 'darwin'){
  // split debug symbols for tracy
  const target = process.env.RUST_TARGET || 'darwin-arm64';
  const artifactPath = path.resolve(__dirname, "..", `rspack.${target}.node`);
  spawnSync('dsymutil', [artifactPath], {
    stdio: "inherit",
    shell: true,
  })
}

Copilot uses AI. Check for mistakes.
}
resolve(code);
});
Expand Down
8 changes: 7 additions & 1 deletion crates/rspack_allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ name = "rspack_allocator"
repository = "https://github.com/web-infra-dev/rspack"
version.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

[target.'cfg(not(target_family = "wasm"))'.dependencies]
sftrace-setup = { workspace = true, optional = true }
sftrace-setup = { workspace = true, optional = true }
tracy-client = { workspace = true, optional = true }
tracy-client-sys = { version = "=0.26.0" }
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tracy-client-sys dependency should be marked as optional to avoid unnecessarily building it when the tracy-client feature is not enabled. This dependency is only needed when the tracy-client feature is active.

Suggestion:

tracy-client-sys = { version = "=0.26.0", optional = true }
Suggested change
tracy-client-sys = { version = "=0.26.0" }
tracy-client-sys = { version = "=0.26.0", optional = true }

Copilot uses AI. Check for mistakes.

[target.'cfg(target_os = "linux")'.dependencies]
# Turned on `local_dynamic_tls` to avoid issue: https://github.com/microsoft/mimalloc/issues/147
Expand All @@ -19,3 +22,6 @@ mimalloc = { workspace = true, features = ["v3"] }

[target.'cfg(all(not(target_os = "linux"), not(target_os = "macos"), not(target_family = "wasm")))'.dependencies]
mimalloc = { workspace = true }

[package.metadata.cargo-shear]
ignored = ["tracy-client-sys"]
Loading
Loading