mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(node): conditional exports edge case (#19082)
Fixes https://github.com/denoland/deno/issues/18743
This commit is contained in:
parent
72512c95c1
commit
610936f5b2
5 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,7 @@ import foo from "npm:@denotest/conditional-exports/foo.js";
|
|||
import client from "npm:@denotest/conditional-exports/client";
|
||||
import clientFoo from "npm:@denotest/conditional-exports/client/foo";
|
||||
import clientBar from "npm:@denotest/conditional-exports/client/bar";
|
||||
import clientM from "npm:@denotest/conditional-exports/client/m";
|
||||
import supportsESM from "npm:supports-esm";
|
||||
|
||||
console.log(mod);
|
||||
|
@ -10,4 +11,5 @@ console.log(foo);
|
|||
console.log(client);
|
||||
console.log(clientFoo);
|
||||
console.log(clientBar);
|
||||
console.log(clientM);
|
||||
console.log(supportsESM);
|
||||
|
|
|
@ -11,4 +11,5 @@ Download http://localhost:4545/npm/registry/supports-esm/supports-esm-1.0.0.tgz
|
|||
{ hello: "from esm client" }
|
||||
{ hello: "from esm client foo" }
|
||||
{ hello: "from esm client bar" }
|
||||
{ hello: "from esm client m" }
|
||||
true
|
||||
|
|
|
@ -15,4 +15,5 @@ Initialize supports-esm@1.0.0
|
|||
{ hello: "from esm client" }
|
||||
{ hello: "from esm client foo" }
|
||||
{ hello: "from esm client bar" }
|
||||
{ hello: "from esm client m" }
|
||||
true
|
||||
|
|
3
cli/tests/testdata/npm/registry/@denotest/conditional-exports/1.0.0/esm/client/m.js
vendored
Normal file
3
cli/tests/testdata/npm/registry/@denotest/conditional-exports/1.0.0/esm/client/m.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default {
|
||||
hello: "from esm client m",
|
||||
}
|
|
@ -922,7 +922,7 @@ impl NodeResolver {
|
|||
// emitTrailingSlashPatternDeprecation();
|
||||
}
|
||||
let pattern_trailer = &key[pattern_index + 1..];
|
||||
if package_subpath.len() > key.len()
|
||||
if package_subpath.len() >= key.len()
|
||||
&& package_subpath.ends_with(&pattern_trailer)
|
||||
&& pattern_key_compare(best_match, key) == 1
|
||||
&& key.rfind('*') == Some(pattern_index)
|
||||
|
|
Loading…
Reference in a new issue