browser-ava 2.2.6 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/resolver.mjs +13 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ava",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
package/src/resolver.mjs CHANGED
@@ -31,8 +31,8 @@ export function resolveExports(parts, pkg) {
31
31
  case "string":
32
32
  return value;
33
33
  case "object":
34
- if(value['.']) {
35
- return matchingCondition(value['.']);
34
+ if (value["."]) {
35
+ return matchingCondition(value["."]);
36
36
  }
37
37
  for (const condition of exportsConditionOrder) {
38
38
  if (value[condition]) {
@@ -50,6 +50,10 @@ export function resolveExports(parts, pkg) {
50
50
  return matchingCondition(pkg.exports["./" + parts.slice(1).join("/")]);
51
51
  }
52
52
  }
53
+
54
+ /*if(parts.join('/') === pkg.name) {
55
+ return matchingCondition(pkg.exports) || pkg.main || "index.js";
56
+ }*/
53
57
  }
54
58
 
55
59
  export function resolveImports(name, pkg) {
@@ -100,14 +104,20 @@ export async function resolveImport(name, base) {
100
104
  if (name.match(/^[\/\.]/)) {
101
105
  return resolve(dirname(base), name);
102
106
  }
103
- let { pkg, path } = await findPackage(base);
104
107
 
105
108
  let parts = name.split(/\//);
106
109
 
107
110
  if (parts[0][0] === "@") {
111
+ const i = base.indexOf(parts[0]);
112
+ if (i > 0) {
113
+ base = base.substring(0, i);
114
+ }
115
+
108
116
  parts = [parts[0] + "/" + parts[1], ...parts.slice(2)];
109
117
  }
110
118
 
119
+ let { pkg, path } = await findPackage(base);
120
+
111
121
  const e = resolveExports(parts, pkg) || resolveImports(name, pkg);
112
122
 
113
123
  if (e) {