Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add Yarn PnP support #7639

Merged
merged 20 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 13 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
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"**/CVS": true,
"**/.DS_Store": true,
"**/*.bk": true,
"/target": true,
"**/.yarn": true
"/target": true
},
"[typescript]": {
"editor.formatOnSave": true
Expand Down
160 changes: 156 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ quote = { version = "1.0.38" }
rayon = { version = "1.10.0" }
regex = { version = "1.11.1" }
ropey = "1.6.1"
rspack_resolver = { version = "0.3.6", features = ["package_json_raw_json_api"] }
rspack_resolver = { features = ["package_json_raw_json_api"], version = "0.4.1" }
rspack_sources = { version = "0.4.1" }
rustc-hash = { version = "2.1.0" }
serde = { version = "1.0.216" }
Expand Down Expand Up @@ -101,6 +101,7 @@ swc_html = { version = "=6.0.0" }
swc_html_minifier = { version = "=6.0.0", default-features = false }
swc_node_comments = { version = "=5.0.0" }

pnp = { version = "0.9.0" }

rspack_dojang = { version = "0.1.9" }

Expand Down
4 changes: 3 additions & 1 deletion crates/node_binding/binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export declare class JsResolver {
}

export declare class JsResolverFactory {
constructor()
constructor(pnp: boolean)
get(type: string, options?: RawResolveOptionsWithDependencyType): JsResolver
}

Expand Down Expand Up @@ -1884,6 +1884,7 @@ export interface RawResolveOptions {
aliasFields?: Array<string>
restrictions?: Array<string>
roots?: Array<string>
pnp?: boolean
}

export interface RawResolveOptionsWithDependencyType {
Expand All @@ -1910,6 +1911,7 @@ export interface RawResolveOptionsWithDependencyType {
roots?: Array<string>
dependencyCategory?: string
resolveToContext?: boolean
pnp?: boolean
}

export interface RawResolveTsconfigOptions {
Expand Down
4 changes: 2 additions & 2 deletions crates/node_binding/src/resolver_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pub struct JsResolverFactory {
#[napi]
impl JsResolverFactory {
#[napi(constructor)]
pub fn new() -> napi::Result<Self> {
let input_filesystem = Arc::new(NativeFileSystem {});
pub fn new(pnp: bool) -> napi::Result<Self> {
let input_filesystem = Arc::new(NativeFileSystem::new(pnp));
Ok(Self {
resolver_factory: None,
loader_resolver_factory: None,
Expand Down
Loading
Loading