Skip to content

Commit db1975e

Browse files
committed
use patch.crates-io for next-taskless
1 parent 6b6a225 commit db1975e

File tree

7 files changed

+46
-28
lines changed

7 files changed

+46
-28
lines changed

rspack/.rustfmt.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
max_width = 100
2+
3+
comment_width = 100
4+
wrap_comments = true
5+
6+
tab_spaces = 4
7+
hard_tabs = false
8+
9+
format_strings = true
10+
use_field_init_shorthand = true
11+
12+
imports_granularity = "Crate"
13+
group_imports = "StdExternalCrate"

rspack/crates/binding/Cargo.lock renamed to rspack/Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rspack/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[workspace]
2+
resolver = "2"
3+
4+
members = [
5+
"crates/binding"
6+
]
7+
8+
[patch.crates-io]
9+
next-taskless = { path = "../crates/next-taskless" }
10+
11+
# Copied from https://github.com/web-infra-dev/rspack/blob/main/Cargo.toml
12+
13+
[profile.dev]
14+
codegen-units = 16
15+
debug = 2
16+
incremental = true
17+
panic = "abort"
18+
19+
[profile.release]
20+
codegen-units = 1
21+
debug = false
22+
# Performs “fat” LTO which attempts to perform optimizations across all crates within the dependency graph.
23+
lto = "fat"
24+
opt-level = 3
25+
panic = "abort"
26+
strip = true

rspack/crates/binding/Cargo.toml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ napi-derive = { version = "=3.2.2" }
2626
anyhow = { version = "1.0.95" }
2727
serde_json = { version = "1.0.134" }
2828

29-
next-taskless = { path = "../../../crates/next-taskless" }
29+
next-taskless = { version = "0.0.1" }
3030

3131
# Enable SWC plugin feature for targets that support it
3232
# Skip: wasm32-wasip1-threads, i686-pc-windows-msvc, aarch64-pc-windows-msvc, armv7-linux-androideabi, armv7-unknown-linux-gnueabihf
@@ -36,20 +36,3 @@ rspack_binding_builder = { version = "=0.5.4", features = ["plugin"] }
3636
[build-dependencies]
3737
rspack_binding_build = { version = "=0.5.4" }
3838

39-
# Copied from https://github.com/web-infra-dev/rspack/blob/main/Cargo.toml
40-
41-
[profile.dev]
42-
codegen-units = 16
43-
debug = 2
44-
incremental = true
45-
panic = "abort"
46-
47-
[profile.release]
48-
codegen-units = 1
49-
debug = false
50-
# Performs “fat” LTO which attempts to perform optimizations across all crates within the dependency graph.
51-
lto = "fat"
52-
opt-level = 3
53-
panic = "abort"
54-
strip = true
55-

rspack/crates/binding/src/handle_externals.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static NODE_RESOLVE_OPTIONS: LazyLock<ResolveOptionsWithDependencyType> =
9494
description_files: Some(vec!["package.json".to_string()]),
9595
enforce_extension: Some(false),
9696
pnp: None,
97+
builtin_modules: false,
9798
})),
9899
resolve_to_context: false,
99100
dependency_category: DependencyCategory::CommonJS,

rspack/crates/binding/src/next_externals_plugin.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55

66
use next_taskless::{BUN_EXTERNALS, EDGE_NODE_EXTERNALS, NODE_EXTERNALS};
77
use rspack_core::{
8-
ApplyContext, CompilerOptions, DependencyCategory, ExternalItem, ExternalItemFnCtx,
8+
ApplyContext, DependencyCategory, ExternalItem, ExternalItemFnCtx,
99
ExternalItemFnResult, ExternalItemObject, ExternalItemValue, Plugin,
1010
ResolveOptionsWithDependencyType, ResolveResult,
1111
};
@@ -138,11 +138,7 @@ impl Plugin for NextExternalsPlugin {
138138
"NextExternalsPlugin"
139139
}
140140

141-
fn apply(
142-
&self,
143-
ctx: &mut ApplyContext<'_>,
144-
options: &CompilerOptions,
145-
) -> rspack_error::Result<()> {
141+
fn apply(&self, ctx: &mut ApplyContext<'_>) -> rspack_error::Result<()> {
146142
let is_client = self.compiler_type == "client";
147143
let is_edge_server = self.compiler_type == "edge-server";
148144

@@ -266,7 +262,7 @@ impl Plugin for NextExternalsPlugin {
266262
.collect::<Vec<_>>()
267263
};
268264

269-
ExternalsPlugin::new(external_type, externals).apply(&mut ctx, options)?;
265+
ExternalsPlugin::new(external_type, externals, false).apply(ctx)?;
270266

271267
Ok(())
272268
}

rspack/crates/binding/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"compilerOptions": {
33
"module": "NodeNext",
44
"allowJs": true,
5-
"strict": true
5+
"strict": true,
6+
"outDir": "dist"
67
}
78
}

0 commit comments

Comments
 (0)