Skip to content

Commit

Permalink
feat: support yarn pnp
Browse files Browse the repository at this point in the history
  • Loading branch information
hardfist committed Dec 30, 2024
1 parent 2f5cf2f commit d14db9f
Show file tree
Hide file tree
Showing 37 changed files with 21,897 additions and 787 deletions.
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
161 changes: 157 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(enablePnp: boolean)
get(type: string, options?: RawResolveOptionsWithDependencyType): JsResolver
}

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

export interface RawResolveOptionsWithDependencyType {
Expand All @@ -1909,6 +1910,7 @@ export interface RawResolveOptionsWithDependencyType {
roots?: Array<string>
dependencyCategory?: string
resolveToContext?: boolean
enablePnp?: 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(enable_pnp: bool) -> napi::Result<Self> {
let input_filesystem = Arc::new(NativeFileSystem::new(enable_pnp));
Ok(Self {
resolver_factory: None,
loader_resolver_factory: None,
Expand Down
Loading

0 comments on commit d14db9f

Please sign in to comment.