@powerlines/plugin-automd 0.1.222 → 0.1.224

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 (94) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +0 -2
  2. package/dist/index.cjs +5 -5
  3. package/dist/index.d.cts +2 -1
  4. package/dist/index.d.mts +1 -1
  5. package/dist/index.mjs +7 -7
  6. package/dist/types/plugin.d.cts +3 -3
  7. package/dist/types/plugin.d.mts +3 -3
  8. package/package.json +3 -3
  9. package/dist/_virtual/rolldown_runtime.mjs +0 -32
  10. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -78
  11. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -77
  12. package/dist/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/dist/acorn.cjs +0 -5032
  13. package/dist/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/dist/acorn.mjs +0 -5031
  14. package/dist/node_modules/.pnpm/automd@0.4.2_patch_hash_0fe864a2d6fa1461e144747e5f0fbc0a5fb51435ec6b3217ffb18ff2d7058778_magicast@0.5.1/node_modules/automd/dist/shared/automd.CjwUz8DJ.cjs +0 -593
  15. package/dist/node_modules/.pnpm/automd@0.4.2_patch_hash_0fe864a2d6fa1461e144747e5f0fbc0a5fb51435ec6b3217ffb18ff2d7058778_magicast@0.5.1/node_modules/automd/dist/shared/automd.CjwUz8DJ.mjs +0 -590
  16. package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DA7CpUDY.cjs +0 -23
  17. package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DA7CpUDY.mjs +0 -22
  18. package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DnMsyigM.cjs +0 -405
  19. package/dist/node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs +0 -404
  20. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.cjs +0 -46
  21. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +0 -45
  22. package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.cjs +0 -204
  23. package/dist/node_modules/.pnpm/didyoumean2@7.0.4/node_modules/didyoumean2/dist/index.mjs +0 -202
  24. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.cjs +0 -1013
  25. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +0 -1007
  26. package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.cjs +0 -128
  27. package/dist/node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.mjs +0 -123
  28. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.cjs +0 -41464
  29. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/babel.mjs +0 -41461
  30. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.cjs +0 -4387
  31. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/dist/jiti.mjs +0 -4384
  32. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.cjs +0 -26
  33. package/dist/node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs +0 -26
  34. package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.cjs +0 -370
  35. package/dist/node_modules/.pnpm/lodash.deburr@4.1.0/node_modules/lodash.deburr/index.mjs +0 -367
  36. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -939
  37. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -939
  38. package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.cjs +0 -67
  39. package/dist/node_modules/.pnpm/mdbox@0.1.1/node_modules/mdbox/dist/index.mjs +0 -64
  40. package/dist/node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.cjs +0 -1292
  41. package/dist/node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs +0 -1284
  42. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -179
  43. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -179
  44. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs +0 -20
  45. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +0 -18
  46. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.cjs +0 -3975
  47. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +0 -3961
  48. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.cjs +0 -16
  49. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +0 -14
  50. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.cjs +0 -36
  51. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs +0 -33
  52. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.cjs +0 -227
  53. package/dist/node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs +0 -225
  54. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -139
  55. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -133
  56. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs +0 -77
  57. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +0 -76
  58. package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.cjs +0 -72
  59. package/dist/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs +0 -69
  60. package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.cjs +0 -181
  61. package/dist/node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs +0 -178
  62. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.cjs +0 -12337
  63. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs +0 -12337
  64. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.cjs +0 -19
  65. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs +0 -18
  66. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.cjs +0 -71
  67. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs +0 -71
  68. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.cjs +0 -110
  69. package/dist/node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs +0 -100
  70. package/dist/packages/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  71. package/dist/packages/powerlines/src/types/api.d.mts +0 -104
  72. package/dist/packages/powerlines/src/types/babel.d.mts +0 -2
  73. package/dist/packages/powerlines/src/types/build.d.mts +0 -185
  74. package/dist/packages/powerlines/src/types/commands.d.mts +0 -9
  75. package/dist/packages/powerlines/src/types/config.d.mts +0 -425
  76. package/dist/packages/powerlines/src/types/context.d.mts +0 -514
  77. package/dist/packages/powerlines/src/types/fs.d.mts +0 -486
  78. package/dist/packages/powerlines/src/types/hooks.d.mts +0 -32
  79. package/dist/packages/powerlines/src/types/plugin.d.mts +0 -205
  80. package/dist/packages/powerlines/src/types/resolved.d.mts +0 -93
  81. package/dist/packages/powerlines/src/types/tsconfig.d.mts +0 -69
  82. package/dist/packages/powerlines/src/types/unplugin.d.mts +0 -23
  83. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  84. package/dist/powerlines/src/types/api.d.cts +0 -104
  85. package/dist/powerlines/src/types/build.d.cts +0 -185
  86. package/dist/powerlines/src/types/commands.d.cts +0 -8
  87. package/dist/powerlines/src/types/config.d.cts +0 -424
  88. package/dist/powerlines/src/types/context.d.cts +0 -514
  89. package/dist/powerlines/src/types/fs.d.cts +0 -486
  90. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  91. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  92. package/dist/powerlines/src/types/resolved.d.cts +0 -93
  93. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  94. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
@@ -1,181 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
3
- const r = String.fromCharCode;
4
- const HASH_RE = /#/g;
5
- const AMPERSAND_RE = /&/g;
6
- const SLASH_RE = /\//g;
7
- const EQUAL_RE = /=/g;
8
- const PLUS_RE = /\+/g;
9
- const ENC_CARET_RE = /%5e/gi;
10
- const ENC_BACKTICK_RE = /%60/gi;
11
- const ENC_PIPE_RE = /%7c/gi;
12
- const ENC_SPACE_RE = /%20/gi;
13
- function encode(text) {
14
- return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
15
- }
16
- function encodeQueryValue(input) {
17
- 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");
18
- }
19
- function encodeQueryKey(text) {
20
- return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
21
- }
22
- function decode(text = "") {
23
- try {
24
- return decodeURIComponent("" + text);
25
- } catch {
26
- return "" + text;
27
- }
28
- }
29
- function decodeQueryKey(text) {
30
- return decode(text.replace(PLUS_RE, " "));
31
- }
32
- function decodeQueryValue(text) {
33
- return decode(text.replace(PLUS_RE, " "));
34
- }
35
- function parseQuery(parametersString = "") {
36
- const object = /* @__PURE__ */ Object.create(null);
37
- if (parametersString[0] === "?") parametersString = parametersString.slice(1);
38
- for (const parameter of parametersString.split("&")) {
39
- const s = parameter.match(/([^=]+)=?(.*)/) || [];
40
- if (s.length < 2) continue;
41
- const key = decodeQueryKey(s[1]);
42
- if (key === "__proto__" || key === "constructor") continue;
43
- const value = decodeQueryValue(s[2] || "");
44
- if (object[key] === void 0) object[key] = value;
45
- else if (Array.isArray(object[key])) object[key].push(value);
46
- else object[key] = [object[key], value];
47
- }
48
- return object;
49
- }
50
- function encodeQueryItem(key, value) {
51
- if (typeof value === "number" || typeof value === "boolean") value = String(value);
52
- if (!value) return encodeQueryKey(key);
53
- if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
54
- return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
55
- }
56
- function stringifyQuery(query) {
57
- return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
58
- }
59
- const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
60
- const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
61
- const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
62
- const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
63
- const JOIN_LEADING_SLASH_RE = /^\.?\//;
64
- function hasProtocol(inputString, opts = {}) {
65
- if (typeof opts === "boolean") opts = { acceptRelative: opts };
66
- if (opts.strict) return PROTOCOL_STRICT_REGEX.test(inputString);
67
- return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
68
- }
69
- function hasTrailingSlash(input = "", respectQueryAndFragment) {
70
- if (!respectQueryAndFragment) return input.endsWith("/");
71
- return TRAILING_SLASH_RE.test(input);
72
- }
73
- function withoutTrailingSlash(input = "", respectQueryAndFragment) {
74
- if (!respectQueryAndFragment) return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
75
- if (!hasTrailingSlash(input, true)) return input || "/";
76
- let path = input;
77
- let fragment = "";
78
- const fragmentIndex = input.indexOf("#");
79
- if (fragmentIndex !== -1) {
80
- path = input.slice(0, fragmentIndex);
81
- fragment = input.slice(fragmentIndex);
82
- }
83
- const [s0, ...s] = path.split("?");
84
- return ((s0.endsWith("/") ? s0.slice(0, -1) : s0) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
85
- }
86
- function withTrailingSlash(input = "", respectQueryAndFragment) {
87
- if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
88
- if (hasTrailingSlash(input, true)) return input || "/";
89
- let path = input;
90
- let fragment = "";
91
- const fragmentIndex = input.indexOf("#");
92
- if (fragmentIndex !== -1) {
93
- path = input.slice(0, fragmentIndex);
94
- fragment = input.slice(fragmentIndex);
95
- if (!path) return fragment;
96
- }
97
- const [s0, ...s] = path.split("?");
98
- return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
99
- }
100
- function withBase(input, base) {
101
- if (isEmptyURL(base) || hasProtocol(input)) return input;
102
- const _base = withoutTrailingSlash(base);
103
- if (input.startsWith(_base)) {
104
- const nextChar = input[_base.length];
105
- if (!nextChar || nextChar === "/" || nextChar === "?") return input;
106
- }
107
- return joinURL(_base, input);
108
- }
109
- function withQuery(input, query) {
110
- const parsed = parseURL(input);
111
- parsed.search = stringifyQuery({
112
- ...parseQuery(parsed.search),
113
- ...query
114
- });
115
- return stringifyParsedURL(parsed);
116
- }
117
- function isEmptyURL(url) {
118
- return !url || url === "/";
119
- }
120
- function isNonEmptyURL(url) {
121
- return url && url !== "/";
122
- }
123
- function joinURL(base, ...input) {
124
- let url = base || "";
125
- for (const segment of input.filter((url2) => isNonEmptyURL(url2))) if (url) {
126
- const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
127
- url = withTrailingSlash(url) + _segment;
128
- } else url = segment;
129
- return url;
130
- }
131
- const protocolRelative = Symbol.for("ufo:protocolRelative");
132
- function parseURL(input = "", defaultProto) {
133
- const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
134
- if (_specialProtoMatch) {
135
- const [, _proto, _pathname = ""] = _specialProtoMatch;
136
- return {
137
- protocol: _proto.toLowerCase(),
138
- pathname: _pathname,
139
- href: _proto + _pathname,
140
- auth: "",
141
- host: "",
142
- search: "",
143
- hash: ""
144
- };
145
- }
146
- if (!hasProtocol(input, { acceptRelative: true })) return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
147
- const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
148
- let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
149
- if (protocol === "file:") path = path.replace(/\/(?=[A-Za-z]:)/, "");
150
- const { pathname, search, hash } = parsePath(path);
151
- return {
152
- protocol: protocol.toLowerCase(),
153
- auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
154
- host,
155
- pathname,
156
- search,
157
- hash,
158
- [protocolRelative]: !protocol
159
- };
160
- }
161
- function parsePath(input = "") {
162
- const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
163
- return {
164
- pathname,
165
- search,
166
- hash
167
- };
168
- }
169
- function stringifyParsedURL(parsed) {
170
- const pathname = parsed.pathname || "";
171
- const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
172
- const hash = parsed.hash || "";
173
- const auth = parsed.auth ? parsed.auth + "@" : "";
174
- const host = parsed.host || "";
175
- return (parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "") + auth + host + pathname + search + hash;
176
- }
177
-
178
- //#endregion
179
- exports.joinURL = joinURL;
180
- exports.withBase = withBase;
181
- exports.withQuery = withQuery;
@@ -1,178 +0,0 @@
1
- //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
2
- const r = String.fromCharCode;
3
- const HASH_RE = /#/g;
4
- const AMPERSAND_RE = /&/g;
5
- const SLASH_RE = /\//g;
6
- const EQUAL_RE = /=/g;
7
- const PLUS_RE = /\+/g;
8
- const ENC_CARET_RE = /%5e/gi;
9
- const ENC_BACKTICK_RE = /%60/gi;
10
- const ENC_PIPE_RE = /%7c/gi;
11
- const ENC_SPACE_RE = /%20/gi;
12
- function encode(text) {
13
- return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
14
- }
15
- function encodeQueryValue(input) {
16
- 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");
17
- }
18
- function encodeQueryKey(text) {
19
- return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
20
- }
21
- function decode(text = "") {
22
- try {
23
- return decodeURIComponent("" + text);
24
- } catch {
25
- return "" + text;
26
- }
27
- }
28
- function decodeQueryKey(text) {
29
- return decode(text.replace(PLUS_RE, " "));
30
- }
31
- function decodeQueryValue(text) {
32
- return decode(text.replace(PLUS_RE, " "));
33
- }
34
- function parseQuery(parametersString = "") {
35
- const object = /* @__PURE__ */ Object.create(null);
36
- if (parametersString[0] === "?") parametersString = parametersString.slice(1);
37
- for (const parameter of parametersString.split("&")) {
38
- const s = parameter.match(/([^=]+)=?(.*)/) || [];
39
- if (s.length < 2) continue;
40
- const key = decodeQueryKey(s[1]);
41
- if (key === "__proto__" || key === "constructor") continue;
42
- const value = decodeQueryValue(s[2] || "");
43
- if (object[key] === void 0) object[key] = value;
44
- else if (Array.isArray(object[key])) object[key].push(value);
45
- else object[key] = [object[key], value];
46
- }
47
- return object;
48
- }
49
- function encodeQueryItem(key, value) {
50
- if (typeof value === "number" || typeof value === "boolean") value = String(value);
51
- if (!value) return encodeQueryKey(key);
52
- if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
53
- return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
54
- }
55
- function stringifyQuery(query) {
56
- return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
57
- }
58
- const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
59
- const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
60
- const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
61
- const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
62
- const JOIN_LEADING_SLASH_RE = /^\.?\//;
63
- function hasProtocol(inputString, opts = {}) {
64
- if (typeof opts === "boolean") opts = { acceptRelative: opts };
65
- if (opts.strict) return PROTOCOL_STRICT_REGEX.test(inputString);
66
- return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
67
- }
68
- function hasTrailingSlash(input = "", respectQueryAndFragment) {
69
- if (!respectQueryAndFragment) return input.endsWith("/");
70
- return TRAILING_SLASH_RE.test(input);
71
- }
72
- function withoutTrailingSlash(input = "", respectQueryAndFragment) {
73
- if (!respectQueryAndFragment) return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
74
- if (!hasTrailingSlash(input, true)) return input || "/";
75
- let path = input;
76
- let fragment = "";
77
- const fragmentIndex = input.indexOf("#");
78
- if (fragmentIndex !== -1) {
79
- path = input.slice(0, fragmentIndex);
80
- fragment = input.slice(fragmentIndex);
81
- }
82
- const [s0, ...s] = path.split("?");
83
- return ((s0.endsWith("/") ? s0.slice(0, -1) : s0) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
84
- }
85
- function withTrailingSlash(input = "", respectQueryAndFragment) {
86
- if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
87
- if (hasTrailingSlash(input, true)) return input || "/";
88
- let path = input;
89
- let fragment = "";
90
- const fragmentIndex = input.indexOf("#");
91
- if (fragmentIndex !== -1) {
92
- path = input.slice(0, fragmentIndex);
93
- fragment = input.slice(fragmentIndex);
94
- if (!path) return fragment;
95
- }
96
- const [s0, ...s] = path.split("?");
97
- return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
98
- }
99
- function withBase(input, base) {
100
- if (isEmptyURL(base) || hasProtocol(input)) return input;
101
- const _base = withoutTrailingSlash(base);
102
- if (input.startsWith(_base)) {
103
- const nextChar = input[_base.length];
104
- if (!nextChar || nextChar === "/" || nextChar === "?") return input;
105
- }
106
- return joinURL(_base, input);
107
- }
108
- function withQuery(input, query) {
109
- const parsed = parseURL(input);
110
- parsed.search = stringifyQuery({
111
- ...parseQuery(parsed.search),
112
- ...query
113
- });
114
- return stringifyParsedURL(parsed);
115
- }
116
- function isEmptyURL(url) {
117
- return !url || url === "/";
118
- }
119
- function isNonEmptyURL(url) {
120
- return url && url !== "/";
121
- }
122
- function joinURL(base, ...input) {
123
- let url = base || "";
124
- for (const segment of input.filter((url2) => isNonEmptyURL(url2))) if (url) {
125
- const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
126
- url = withTrailingSlash(url) + _segment;
127
- } else url = segment;
128
- return url;
129
- }
130
- const protocolRelative = Symbol.for("ufo:protocolRelative");
131
- function parseURL(input = "", defaultProto) {
132
- const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
133
- if (_specialProtoMatch) {
134
- const [, _proto, _pathname = ""] = _specialProtoMatch;
135
- return {
136
- protocol: _proto.toLowerCase(),
137
- pathname: _pathname,
138
- href: _proto + _pathname,
139
- auth: "",
140
- host: "",
141
- search: "",
142
- hash: ""
143
- };
144
- }
145
- if (!hasProtocol(input, { acceptRelative: true })) return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
146
- const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
147
- let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
148
- if (protocol === "file:") path = path.replace(/\/(?=[A-Za-z]:)/, "");
149
- const { pathname, search, hash } = parsePath(path);
150
- return {
151
- protocol: protocol.toLowerCase(),
152
- auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
153
- host,
154
- pathname,
155
- search,
156
- hash,
157
- [protocolRelative]: !protocol
158
- };
159
- }
160
- function parsePath(input = "") {
161
- const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
162
- return {
163
- pathname,
164
- search,
165
- hash
166
- };
167
- }
168
- function stringifyParsedURL(parsed) {
169
- const pathname = parsed.pathname || "";
170
- const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
171
- const hash = parsed.hash || "";
172
- const auth = parsed.auth ? parsed.auth + "@" : "";
173
- const host = parsed.host || "";
174
- return (parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "") + auth + host + pathname + search + hash;
175
- }
176
-
177
- //#endregion
178
- export { joinURL, withBase, withQuery };