@jsenv/test 3.3.18 → 3.3.20

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/dist/jsenv_test.js +12 -8
  2. package/package.json +7 -7
@@ -1675,11 +1675,12 @@ const pathnameToExtension = (pathname) => {
1675
1675
  return extension;
1676
1676
  };
1677
1677
 
1678
- const ensurePathnameTrailingSlash = (url) => {
1678
+ const transformUrlPathname = (url, transformer) => {
1679
1679
  if (typeof url === "string") {
1680
1680
  const urlObject = new URL(url);
1681
1681
  const { pathname } = urlObject;
1682
- if (pathname.endsWith("/")) {
1682
+ const pathnameTransformed = transformer(pathname);
1683
+ if (pathnameTransformed === pathname) {
1683
1684
  return url;
1684
1685
  }
1685
1686
  let { origin } = urlObject;
@@ -1688,15 +1689,18 @@ const ensurePathnameTrailingSlash = (url) => {
1688
1689
  origin = "file://";
1689
1690
  }
1690
1691
  const { search, hash } = urlObject;
1691
- const urlWithTrailingSlash = `${origin}${pathname}/${search}${hash}`;
1692
- return urlWithTrailingSlash;
1693
- }
1694
- if (url.pathname.endsWith("/")) {
1695
- return url;
1692
+ const urlWithPathnameTransformed = `${origin}${pathnameTransformed}${search}${hash}`;
1693
+ return urlWithPathnameTransformed;
1696
1694
  }
1697
- url.pathname += "/";
1695
+ const pathnameTransformed = transformer(url.pathname);
1696
+ url.pathname = pathnameTransformed;
1698
1697
  return url;
1699
1698
  };
1699
+ const ensurePathnameTrailingSlash = (url) => {
1700
+ return transformUrlPathname(url, (pathname) => {
1701
+ return pathname.endsWith("/") ? pathname : `${pathname}/`;
1702
+ });
1703
+ };
1700
1704
 
1701
1705
  const isFileSystemPath = (value) => {
1702
1706
  if (typeof value !== "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.3.18",
3
+ "version": "3.3.20",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,15 +38,15 @@
38
38
  "dependencies": {
39
39
  "@c88/v8-coverage": "0.1.1",
40
40
  "@jsenv/abort": "4.3.0",
41
- "@jsenv/ast": "6.2.6",
41
+ "@jsenv/ast": "6.2.8",
42
42
  "@jsenv/exception": "1.0.0",
43
- "@jsenv/filesystem": "4.9.3",
44
- "@jsenv/github-check-run": "0.1.25",
43
+ "@jsenv/filesystem": "4.9.4",
44
+ "@jsenv/github-check-run": "0.1.26",
45
45
  "@jsenv/humanize": "1.2.5",
46
- "@jsenv/plugin-supervisor": "1.5.7",
47
- "@jsenv/sourcemap": "1.2.17",
46
+ "@jsenv/plugin-supervisor": "1.5.9",
47
+ "@jsenv/sourcemap": "1.2.18",
48
48
  "@jsenv/url-meta": "8.4.2",
49
- "@jsenv/urls": "2.3.2",
49
+ "@jsenv/urls": "2.4.0",
50
50
  "@jsenv/utils": "2.1.2",
51
51
  "he": "1.2.0",
52
52
  "istanbul-lib-coverage": "3.2.2",