@php-wasm/universal 2.0.8 → 2.0.9

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/index.js CHANGED
@@ -2134,7 +2134,7 @@ const SupportedPHPVersions = [
2134
2134
  "7.2"
2135
2135
  ], LatestSupportedPHPVersion = SupportedPHPVersions[0], SupportedPHPVersionsList = SupportedPHPVersions, DEFAULT_BASE_URL = "http://example.com";
2136
2136
  function toRelativeUrl(t) {
2137
- return t.toString().substring(t.origin.length);
2137
+ return t.origin === "null" ? t.toString() : t.toString().substring(t.origin.length);
2138
2138
  }
2139
2139
  function removePathPrefix(t, e) {
2140
2140
  return !e || !t.startsWith(e) ? t : t.substring(e.length);
@@ -2323,7 +2323,7 @@ class PHPRequestHandler {
2323
2323
  * @returns The absolute URL.
2324
2324
  */
2325
2325
  pathToInternalUrl(e) {
2326
- return `${this.absoluteUrl}${e}`;
2326
+ return e.startsWith("/") || (e = `/${e}`), `${this.absoluteUrl}${e}`;
2327
2327
  }
2328
2328
  /**
2329
2329
  * Converts an absolute URL based at the PHPRequestHandler to a relative path
@@ -2333,7 +2333,7 @@ class PHPRequestHandler {
2333
2333
  * @returns The relative path.
2334
2334
  */
2335
2335
  internalUrlToPath(e) {
2336
- const r = new URL(e);
2336
+ const r = new URL(e, "https://playground.internal");
2337
2337
  return r.pathname.startsWith(u(this, P)) && (r.pathname = r.pathname.slice(u(this, P).length)), toRelativeUrl(r);
2338
2338
  }
2339
2339
  /**