Skip to content

Commit

Permalink
fix(config): allow specifying absolute path for patch and fix panic w…
Browse files Browse the repository at this point in the history
…ith exports in package.json (#28279)

Closes #28250
Closes #26031
  • Loading branch information
dsherret authored Feb 24, 2025
1 parent 6ac6e93 commit 234deac
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ deno_ast = { version = "=0.45.1", features = ["transpiling"] }
deno_core = { version = "0.338.0" }

deno_bench_util = { version = "0.186.0", path = "./bench_util" }
deno_config = { version = "=0.49.1", features = ["workspace"] }
deno_config = { version = "=0.50.0", features = ["workspace"] }
deno_lockfile = "=0.24.0"
deno_media_type = { version = "=0.2.6", features = ["module_specifier"] }
deno_npm = "=0.27.2"
Expand Down Expand Up @@ -130,7 +130,7 @@ data-encoding = "2.3.3"
data-url = "=0.3.1"
deno_cache_dir = "=0.18.0"
deno_error = "=0.5.5"
deno_package_json = { version = "=0.4.2", default-features = false }
deno_package_json = { version = "=0.5.0", default-features = false }
deno_unsync = "0.4.2"
dlopen2 = "0.6.1"
ecb = "=0.1.2"
Expand Down
6 changes: 3 additions & 3 deletions cli/rt/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,10 @@ pub async fn run(
.to_file_path()
.unwrap();
let pkg_json =
deno_package_json::PackageJson::load_from_value(path, json);
Arc::new(pkg_json)
deno_package_json::PackageJson::load_from_value(path, json)?;
Ok(Arc::new(pkg_json))
})
.collect();
.collect::<Result<Vec<_>, AnyError>>()?;
WorkspaceResolver::new_raw(
root_dir_url.clone(),
import_map,
Expand Down
15 changes: 10 additions & 5 deletions cli/tools/publish/unfurl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,8 @@ mod tests {
"chalk": 5
}
}),
);
)
.unwrap();
let workspace_resolver = WorkspaceResolver::new_raw(
Arc::new(ModuleSpecifier::from_directory_path(&cwd).unwrap()),
Some(import_map),
Expand Down Expand Up @@ -867,11 +868,13 @@ export type * from "./c.d.ts";
let pkg_json_add = PackageJson::load_from_value(
cwd.join("add/package.json"),
json!({ "name": "add", "version": "0.1.0", }),
);
)
.unwrap();
let pkg_json_subtract = PackageJson::load_from_value(
cwd.join("subtract/package.json"),
json!({ "name": "subtract", "version": "0.2.0", }),
);
)
.unwrap();
let pkg_json_publishing = PackageJson::load_from_value(
cwd.join("publish/package.json"),
json!({
Expand All @@ -883,11 +886,13 @@ export type * from "./c.d.ts";
"non-existent": "workspace:~",
}
}),
);
)
.unwrap();
let root_pkg_json = PackageJson::load_from_value(
cwd.join("package.json"),
json!({ "workspaces": ["./publish", "./subtract", "./add"] }),
);
)
.unwrap();
let sys = CliSys::default();
let workspace_resolver = WorkspaceResolver::new_raw(
Arc::new(ModuleSpecifier::from_directory_path(&cwd).unwrap()),
Expand Down
2 changes: 1 addition & 1 deletion resolvers/deno/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ impl<TSys: FsMetadata + FsRead> WorkspaceResolver<TSys> {
url_to_file_path(&root_dir_url.join(&relative_path).unwrap())
.unwrap();
let pkg_json =
deno_package_json::PackageJson::load_from_value(path, json);
deno_package_json::PackageJson::load_from_value(path, json).unwrap();
PackageJsonRc::new(pkg_json)
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion resolvers/node/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ mod tests {
use super::*;

fn build_package_json(json: Value) -> PackageJson {
PackageJson::load_from_value(PathBuf::from("/package.json"), json)
PackageJson::load_from_value(PathBuf::from("/package.json"), json).unwrap()
}

#[test]
Expand Down

0 comments on commit 234deac

Please sign in to comment.