@stacksjs/api 0.58.57 → 0.58.59

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/index.js +6 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ var encode = function(text) {
72
72
  return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
73
73
  };
74
74
  var encodeQueryValue = function(input) {
75
- return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^");
75
+ return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
76
76
  };
77
77
  var encodeQueryKey = function(text) {
78
78
  return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
@@ -242,7 +242,8 @@ var parseURL = function(input = "", defaultProto) {
242
242
  host,
243
243
  pathname,
244
244
  search,
245
- hash
245
+ hash,
246
+ [protocolRelative]: !protocol
246
247
  };
247
248
  };
248
249
  var parsePath = function(input = "") {
@@ -259,12 +260,13 @@ var stringifyParsedURL = function(parsed) {
259
260
  const hash = parsed.hash || "";
260
261
  const auth = parsed.auth ? parsed.auth + "@" : "";
261
262
  const host = parsed.host || "";
262
- const proto = parsed.protocol ? parsed.protocol + "//" : "";
263
+ const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
263
264
  return proto + auth + host + pathname + search + hash;
264
265
  };
265
266
  var r = String.fromCharCode;
266
267
  var HASH_RE = /#/g;
267
268
  var AMPERSAND_RE = /&/g;
269
+ var SLASH_RE = /\//g;
268
270
  var EQUAL_RE = /=/g;
269
271
  var PLUS_RE = /\+/g;
270
272
  var ENC_CARET_RE = /%5e/gi;
@@ -276,6 +278,7 @@ var PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
276
278
  var PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
277
279
  var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
278
280
  var JOIN_LEADING_SLASH_RE = /^\.?\//;
281
+ var protocolRelative = Symbol.for("ufo:protocolRelative");
279
282
 
280
283
  // /home/runner/work/stacks/stacks/node_modules/ofetch/dist/shared/ofetch.00501375.mjs
281
284
  var createFetchError = function(ctx) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/api",
3
3
  "type": "module",
4
- "version": "0.58.57",
4
+ "version": "0.58.59",
5
5
  "description": "The Stacks array utilities.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",