mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 10:33:54 +00:00
feat(npm): require --unstable for npm specifiers in remote modules (#16612)
This commit is contained in:
parent
f81ad0b7c2
commit
2063ed7385
7 changed files with 29 additions and 15 deletions
|
@ -35,10 +35,9 @@ impl NpmPackageReference {
|
|||
let specifier = match specifier.strip_prefix("npm:") {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
return Err(generic_error(format!(
|
||||
"Not an npm specifier: {}",
|
||||
specifier
|
||||
)));
|
||||
// don't allocate a string here and instead use a static string
|
||||
// because this is hit a lot when a url is not an npm specifier
|
||||
return Err(generic_error("Not an npm specifier"));
|
||||
}
|
||||
};
|
||||
let parts = specifier.split('/').collect::<Vec<_>>();
|
||||
|
@ -244,11 +243,8 @@ pub fn resolve_npm_package_reqs(graph: &ModuleGraph) -> Vec<NpmPackageReq> {
|
|||
|
||||
// fill this leaf's information
|
||||
for specifier in &specifiers {
|
||||
if specifier.scheme() == "npm" {
|
||||
// this will error elsewhere if not the case
|
||||
if let Ok(npm_ref) = NpmPackageReference::from_specifier(specifier) {
|
||||
leaf.reqs.insert(npm_ref.req);
|
||||
}
|
||||
if let Ok(npm_ref) = NpmPackageReference::from_specifier(specifier) {
|
||||
leaf.reqs.insert(npm_ref.req);
|
||||
} else if !specifier.as_str().starts_with(&parent_specifier.as_str()) {
|
||||
leaf
|
||||
.dependencies
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue