browser-ava 1.3.38 → 1.3.39
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.
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/resolver.mjs +12 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/browser-ava)
|
|
2
2
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
3
|
-
[](https://bundlejs.com/?q=browser-ava)
|
|
4
4
|
[](https://npmjs.org/package/browser-ava)
|
|
5
5
|
[](https://github.com/arlac77/browser-ava/issues)
|
|
6
6
|
[](https://actions-badge.atrox.dev/arlac77/browser-ava/goto)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-ava",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.39",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"ava": "^5.2.0",
|
|
42
42
|
"c8": "^7.13.0",
|
|
43
43
|
"execa": "^7.1.1",
|
|
44
|
-
"semantic-release": "^21.0.
|
|
44
|
+
"semantic-release": "^21.0.2"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=16.20.0"
|
package/src/resolver.mjs
CHANGED
|
@@ -16,8 +16,8 @@ const importsConditionOrder = ["browser", "default"];
|
|
|
16
16
|
const exportsConditionOrder = ["browser", "module", "import", ".", "default"];
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {string} parts
|
|
19
|
+
* Find module inside a package.
|
|
20
|
+
* @param {string[]} parts
|
|
21
21
|
* @param {Object} pkg package.json content
|
|
22
22
|
* @returns {string|undefined} module file name relative to package
|
|
23
23
|
*/
|
|
@@ -84,18 +84,22 @@ async function findPackage(path) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Maps import url from node to browser view.
|
|
87
|
+
* Maps import url from node to browser view.
|
|
88
88
|
* @param {string} name module to resolve
|
|
89
|
-
* @param {string}
|
|
89
|
+
* @param {string} base where to start resolving
|
|
90
90
|
* @returns {Promise<string>} resolved import url
|
|
91
91
|
*/
|
|
92
|
-
export async function resolveImport(name,
|
|
92
|
+
export async function resolveImport(name, base) {
|
|
93
93
|
if (name.match(/^[\/\.]/)) {
|
|
94
|
-
return resolve(dirname(
|
|
94
|
+
return resolve(dirname(base), name);
|
|
95
95
|
}
|
|
96
|
-
let { pkg, path } = await findPackage(
|
|
96
|
+
let { pkg, path } = await findPackage(base);
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
let parts = name.split(/\//);
|
|
99
|
+
|
|
100
|
+
if (parts[0][0] === "@") {
|
|
101
|
+
parts = [parts[0] + "/" + parts[1], ...parts.slice(2)];
|
|
102
|
+
}
|
|
99
103
|
|
|
100
104
|
const e = resolveExports(parts, pkg) || resolveImports(name, pkg);
|
|
101
105
|
|