@stryke/url 0.3.3 → 0.3.11
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/CHANGELOG.md +241 -0
- package/README.md +18 -9
- package/dist/helpers-C8s0XHG1.cjs +1 -0
- package/dist/helpers-CcGiwVAN.mjs +2 -0
- package/dist/helpers-CcGiwVAN.mjs.map +1 -0
- package/dist/helpers.cjs +1 -22
- package/dist/helpers.d.cts +12 -0
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +12 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +1 -1
- package/dist/index.cjs +1 -27
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +1 -1
- package/dist/storm-url-BeaSjjni.d.cts +61 -0
- package/dist/storm-url-BeaSjjni.d.cts.map +1 -0
- package/dist/storm-url-C44M08EF.d.mts +61 -0
- package/dist/storm-url-C44M08EF.d.mts.map +1 -0
- package/dist/storm-url-DQn2usO1.mjs +7 -0
- package/dist/storm-url-DQn2usO1.mjs.map +1 -0
- package/dist/storm-url-t7pdfQNU.cjs +6 -0
- package/dist/storm-url.cjs +1 -184
- package/dist/storm-url.d.cts +2 -0
- package/dist/storm-url.d.mts +2 -0
- package/dist/storm-url.mjs +1 -1
- package/dist/types-CHTfZzkO.d.cts +94 -0
- package/dist/types-CHTfZzkO.d.cts.map +1 -0
- package/dist/types-CxnefvtE.cjs +1 -0
- package/dist/types-DL1n5nYV.mjs +2 -0
- package/dist/types-DL1n5nYV.mjs.map +1 -0
- package/dist/types-wUi0ilxL.d.mts +94 -0
- package/dist/types-wUi0ilxL.d.mts.map +1 -0
- package/dist/types.cjs +1 -7
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -1
- package/package.json +16 -105
- package/dist/helpers.d.ts +0 -8
- package/dist/index.d.ts +0 -2
- package/dist/storm-url.d.ts +0 -55
- package/dist/types.d.ts +0 -90
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Changelog for Stryke - URL
|
|
4
|
+
|
|
5
|
+
## [0.3.10](https://github.com/storm-software/stryke/releases/tag/url%400.3.10) (12/07/2025)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **type-checks** to **v0.5.4**
|
|
10
|
+
- Updated **json** to **v0.9.22**
|
|
11
|
+
- Updated **path** to **v0.22.6**
|
|
12
|
+
|
|
13
|
+
## [0.3.9](https://github.com/storm-software/stryke/releases/tag/url%400.3.9) (12/07/2025)
|
|
14
|
+
|
|
15
|
+
### Miscellaneous
|
|
16
|
+
|
|
17
|
+
- **monorepo:** Format monorepo source files
|
|
18
|
+
([9428936](https://github.com/storm-software/stryke/commit/9428936))
|
|
19
|
+
|
|
20
|
+
### Updated Dependencies
|
|
21
|
+
|
|
22
|
+
- Updated **type-checks** to **v0.5.3**
|
|
23
|
+
- Updated **json** to **v0.9.21**
|
|
24
|
+
- Updated **path** to **v0.22.5**
|
|
25
|
+
|
|
26
|
+
## [0.3.8](https://github.com/storm-software/stryke/releases/tag/url%400.3.8) (12/06/2025)
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
- **tools-nx:** Resolved issue inferring build command-line arguments for local
|
|
31
|
+
packages ([de00278](https://github.com/storm-software/stryke/commit/de00278))
|
|
32
|
+
|
|
33
|
+
### Updated Dependencies
|
|
34
|
+
|
|
35
|
+
- Updated **type-checks** to **v0.5.2**
|
|
36
|
+
- Updated **json** to **v0.9.20**
|
|
37
|
+
- Updated **path** to **v0.22.4**
|
|
38
|
+
|
|
39
|
+
## [0.3.7](https://github.com/storm-software/stryke/releases/tag/url%400.3.7) (12/06/2025)
|
|
40
|
+
|
|
41
|
+
### Updated Dependencies
|
|
42
|
+
|
|
43
|
+
- Updated **type-checks** to **v0.5.1**
|
|
44
|
+
- Updated **json** to **v0.9.19**
|
|
45
|
+
- Updated **path** to **v0.22.3**
|
|
46
|
+
|
|
47
|
+
## [0.3.6](https://github.com/storm-software/stryke/releases/tag/url%400.3.6) (12/05/2025)
|
|
48
|
+
|
|
49
|
+
### Updated Dependencies
|
|
50
|
+
|
|
51
|
+
- Updated **type-checks** to **v0.5.0**
|
|
52
|
+
- Updated **json** to **v0.9.18**
|
|
53
|
+
- Updated **path** to **v0.22.2**
|
|
54
|
+
|
|
55
|
+
## [0.3.5](https://github.com/storm-software/stryke/releases/tag/url%400.3.5) (12/05/2025)
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
- **monorepo:** Update repository to use `tsdown` to build/bundle packages
|
|
60
|
+
([8ceb909](https://github.com/storm-software/stryke/commit/8ceb909))
|
|
61
|
+
|
|
62
|
+
### Updated Dependencies
|
|
63
|
+
|
|
64
|
+
- Updated **type-checks** to **v0.4.5**
|
|
65
|
+
- Updated **json** to **v0.9.17**
|
|
66
|
+
- Updated **path** to **v0.22.1**
|
|
67
|
+
|
|
68
|
+
## [0.3.4](https://github.com/storm-software/stryke/releases/tag/url%400.3.4) (12/01/2025)
|
|
69
|
+
|
|
70
|
+
### Updated Dependencies
|
|
71
|
+
|
|
72
|
+
- Updated **type-checks** to **v0.4.4**
|
|
73
|
+
- Updated **json** to **v0.9.16**
|
|
74
|
+
- Updated **path** to **v0.22.0**
|
|
75
|
+
|
|
76
|
+
## [0.3.3](https://github.com/storm-software/stryke/releases/tag/url%400.3.3) (11/30/2025)
|
|
77
|
+
|
|
78
|
+
### Updated Dependencies
|
|
79
|
+
|
|
80
|
+
- Updated **type-checks** to **v0.4.3**
|
|
81
|
+
- Updated **json** to **v0.9.15**
|
|
82
|
+
- Updated **path** to **v0.21.6**
|
|
83
|
+
|
|
84
|
+
## [0.3.2](https://github.com/storm-software/stryke/releases/tag/url%400.3.2) (11/30/2025)
|
|
85
|
+
|
|
86
|
+
### Updated Dependencies
|
|
87
|
+
|
|
88
|
+
- Updated **type-checks** to **v0.4.2**
|
|
89
|
+
- Updated **json** to **v0.9.14**
|
|
90
|
+
- Updated **path** to **v0.21.5**
|
|
91
|
+
|
|
92
|
+
## [0.3.1](https://github.com/storm-software/stryke/releases/tag/url%400.3.1) (11/30/2025)
|
|
93
|
+
|
|
94
|
+
### Updated Dependencies
|
|
95
|
+
|
|
96
|
+
- Updated **type-checks** to **v0.4.1**
|
|
97
|
+
- Updated **json** to **v0.9.13**
|
|
98
|
+
- Updated **path** to **v0.21.4**
|
|
99
|
+
|
|
100
|
+
## [0.3.0](https://github.com/storm-software/stryke/releases/tag/url%400.3.0) (11/30/2025)
|
|
101
|
+
|
|
102
|
+
### Features
|
|
103
|
+
|
|
104
|
+
- **url:** Added the `isValidURL` helper function
|
|
105
|
+
([8d39b6c](https://github.com/storm-software/stryke/commit/8d39b6c))
|
|
106
|
+
|
|
107
|
+
### Updated Dependencies
|
|
108
|
+
|
|
109
|
+
- Updated **type-checks** to **v0.4.0**
|
|
110
|
+
- Updated **json** to **v0.9.12**
|
|
111
|
+
- Updated **path** to **v0.21.3**
|
|
112
|
+
|
|
113
|
+
## [0.2.13](https://github.com/storm-software/stryke/releases/tag/url%400.2.13) (11/24/2025)
|
|
114
|
+
|
|
115
|
+
### Updated Dependencies
|
|
116
|
+
|
|
117
|
+
- Updated **type-checks** to **v0.3.18**
|
|
118
|
+
- Updated **json** to **v0.9.11**
|
|
119
|
+
- Updated **path** to **v0.21.2**
|
|
120
|
+
|
|
121
|
+
## [0.2.12](https://github.com/storm-software/stryke/releases/tag/url%400.2.12) (11/21/2025)
|
|
122
|
+
|
|
123
|
+
### Updated Dependencies
|
|
124
|
+
|
|
125
|
+
- Updated **type-checks** to **v0.3.17**
|
|
126
|
+
- Updated **json** to **v0.9.10**
|
|
127
|
+
- Updated **path** to **v0.21.1**
|
|
128
|
+
|
|
129
|
+
## [0.2.11](https://github.com/storm-software/stryke/releases/tag/url%400.2.11) (11/21/2025)
|
|
130
|
+
|
|
131
|
+
### Updated Dependencies
|
|
132
|
+
|
|
133
|
+
- Updated **type-checks** to **v0.3.16**
|
|
134
|
+
- Updated **json** to **v0.9.9**
|
|
135
|
+
- Updated **path** to **v0.21.0**
|
|
136
|
+
|
|
137
|
+
## [0.2.10](https://github.com/storm-software/stryke/releases/tag/url%400.2.10) (11/21/2025)
|
|
138
|
+
|
|
139
|
+
### Updated Dependencies
|
|
140
|
+
|
|
141
|
+
- Updated **type-checks** to **v0.3.15**
|
|
142
|
+
- Updated **json** to **v0.9.8**
|
|
143
|
+
- Updated **path** to **v0.20.0**
|
|
144
|
+
|
|
145
|
+
## [0.2.9](https://github.com/storm-software/stryke/releases/tag/url%400.2.9) (11/21/2025)
|
|
146
|
+
|
|
147
|
+
### Updated Dependencies
|
|
148
|
+
|
|
149
|
+
- Updated **type-checks** to **v0.3.14**
|
|
150
|
+
- Updated **json** to **v0.9.7**
|
|
151
|
+
- Updated **path** to **v0.19.4**
|
|
152
|
+
|
|
153
|
+
## [0.2.8](https://github.com/storm-software/stryke/releases/tag/url%400.2.8) (11/21/2025)
|
|
154
|
+
|
|
155
|
+
### Updated Dependencies
|
|
156
|
+
|
|
157
|
+
- Updated **type-checks** to **v0.3.13**
|
|
158
|
+
- Updated **json** to **v0.9.6**
|
|
159
|
+
- Updated **path** to **v0.19.3**
|
|
160
|
+
|
|
161
|
+
## [0.2.7](https://github.com/storm-software/stryke/releases/tag/url%400.2.7) (11/16/2025)
|
|
162
|
+
|
|
163
|
+
### Updated Dependencies
|
|
164
|
+
|
|
165
|
+
- Updated **path** to **v0.19.2**
|
|
166
|
+
|
|
167
|
+
## [0.2.6](https://github.com/storm-software/stryke/releases/tag/url%400.2.6) (11/16/2025)
|
|
168
|
+
|
|
169
|
+
### Updated Dependencies
|
|
170
|
+
|
|
171
|
+
- Updated **type-checks** to **v0.3.12**
|
|
172
|
+
- Updated **json** to **v0.9.5**
|
|
173
|
+
- Updated **path** to **v0.19.1**
|
|
174
|
+
|
|
175
|
+
## [0.2.5](https://github.com/storm-software/stryke/releases/tag/url%400.2.5) (11/08/2025)
|
|
176
|
+
|
|
177
|
+
### Updated Dependencies
|
|
178
|
+
|
|
179
|
+
- Updated **type-checks** to **v0.3.11**
|
|
180
|
+
- Updated **json** to **v0.9.4**
|
|
181
|
+
- Updated **path** to **v0.19.0**
|
|
182
|
+
|
|
183
|
+

|
|
184
|
+
|
|
185
|
+
# Changelog for Stryke - URL
|
|
186
|
+
|
|
187
|
+
## [0.2.4](https://github.com/storm-software/stryke/releases/tag/url%400.2.4) (2025-08-04)
|
|
188
|
+
|
|
189
|
+
### Bug Fixes
|
|
190
|
+
|
|
191
|
+
- **monorepo:** Resolved repository type-check failures
|
|
192
|
+
([d196ace](https://github.com/storm-software/stryke/commit/d196ace))
|
|
193
|
+
|
|
194
|
+
## [0.2.3](https://github.com/storm-software/stryke/releases/tag/url%400.2.3) (2025-07-02)
|
|
195
|
+
|
|
196
|
+
### Miscellaneous
|
|
197
|
+
|
|
198
|
+
- **url:** Format package source code
|
|
199
|
+
([388a8d0](https://github.com/storm-software/stryke/commit/388a8d0))
|
|
200
|
+
|
|
201
|
+

|
|
202
|
+
|
|
203
|
+
# Changelog for Stryke - Url
|
|
204
|
+
|
|
205
|
+
## [0.2.2](https://github.com/storm-software/stryke/releases/tag/url%400.2.2) (2025-06-17)
|
|
206
|
+
|
|
207
|
+
### Miscellaneous
|
|
208
|
+
|
|
209
|
+
- **monorepo:** Format file banner
|
|
210
|
+
- **monorepo:** Reformat repository packages
|
|
211
|
+
|
|
212
|
+
## [0.2.1](https://github.com/storm-software/stryke/releases/tag/url%400.2.1) (2025-06-12)
|
|
213
|
+
|
|
214
|
+
### Miscellaneous
|
|
215
|
+
|
|
216
|
+
- **monorepo:** Reformat the repository's README markdown files
|
|
217
|
+
- **monorepo:** Run format script on repository
|
|
218
|
+
|
|
219
|
+
## [0.2.0](https://github.com/storm-software/stryke/releases/tag/url%400.2.0) (2025-05-16)
|
|
220
|
+
|
|
221
|
+
### Features
|
|
222
|
+
|
|
223
|
+
- **convert:** Added node typings to convert helpers
|
|
224
|
+
|
|
225
|
+
## [0.1.1](https://github.com/storm-software/stryke/releases/tag/url%400.1.1) (2025-05-12)
|
|
226
|
+
|
|
227
|
+
### Miscellaneous
|
|
228
|
+
|
|
229
|
+
- **monorepo:** Reformat monorepo source code
|
|
230
|
+
|
|
231
|
+
## [0.1.0](https://github.com/storm-software/stryke/releases/tag/url%400.1.0) (2025-04-23)
|
|
232
|
+
|
|
233
|
+
### Features
|
|
234
|
+
|
|
235
|
+
- **url:** Added a separate package for `StormURL` wrapper class
|
|
236
|
+
([ea60cd5](https://github.com/storm-software/stryke/commit/ea60cd5))
|
|
237
|
+
|
|
238
|
+
### Documentation
|
|
239
|
+
|
|
240
|
+
- **url:** Update the README markdown file
|
|
241
|
+
([de7b842](https://github.com/storm-software/stryke/commit/de7b842))
|
package/README.md
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
<!-- markdownlint-disable -->
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div align="center"
|
|
6
|
+
<div align="center">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif">
|
|
9
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-light-optimized.gif">
|
|
10
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif" width="100%" alt="Storm Software" />
|
|
11
|
+
</picture>
|
|
12
|
+
</div>
|
|
7
13
|
<br />
|
|
8
14
|
|
|
9
15
|
<div align="center">
|
|
@@ -16,13 +22,13 @@
|
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
24
|
<br />
|
|
19
|
-
This package is part of Storm Software's
|
|
25
|
+
This package is part of Storm Software's **💥 Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
|
|
20
26
|
|
|
21
27
|
<br />
|
|
22
28
|
|
|
23
29
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
30
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
32
|
|
|
27
33
|
> [!IMPORTANT] Important
|
|
28
34
|
> This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
|
|
@@ -93,10 +99,10 @@ yarn add -D @stryke/url
|
|
|
93
99
|
|
|
94
100
|
## Reduced Package Size
|
|
95
101
|
|
|
96
|
-
This project uses [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
This project uses [tsdown](https://tsdown.dev) to package the source code due to
|
|
103
|
+
its ability to remove unused code and ship smaller javascript files thanks to
|
|
104
|
+
code splitting. This helps to greatly reduce the size of the package and to make
|
|
105
|
+
it easier to use in other projects.
|
|
100
106
|
|
|
101
107
|
## Development
|
|
102
108
|
|
|
@@ -237,10 +243,13 @@ specification. Contributions of any kind welcome!
|
|
|
237
243
|
<br />
|
|
238
244
|
|
|
239
245
|
<hr />
|
|
240
|
-
<br />
|
|
241
246
|
|
|
242
247
|
<div align="center">
|
|
243
|
-
<
|
|
248
|
+
<picture>
|
|
249
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
|
|
250
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
|
|
251
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
|
|
252
|
+
</picture>
|
|
244
253
|
</div>
|
|
245
254
|
<br />
|
|
246
255
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=e;if(t.includes(`_`)&&(t=t.replace(/_/g,`-`)),t.includes(`-`)){let e=t.split(`-`);if(e.length>1){let n=e[0],r=e[1];n&&r&&(t=`${n}-${r}`)}}return t.toLowerCase()}function t(e){return/(?:https?:\/\/.)?(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=]*/.test(e)}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){let t=e;if(t.includes(`_`)&&(t=t.replace(/_/g,`-`)),t.includes(`-`)){let e=t.split(`-`);if(e.length>1){let n=e[0],r=e[1];n&&r&&(t=`${n}-${r}`)}}return t.toLowerCase()}function t(e){return/(?:https?:\/\/.)?(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=]*/.test(e)}export{t as n,e as t};
|
|
2
|
+
//# sourceMappingURL=helpers-CcGiwVAN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-CcGiwVAN.mjs","names":[],"sources":["../src/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport function formatLocalePath(locale: string) {\n let result = locale;\n if (result.includes(\"_\")) {\n result = result.replace(/_/g, \"-\");\n }\n\n if (result.includes(\"-\")) {\n const parts = result.split(\"-\");\n if (parts.length > 1) {\n const lang = parts[0];\n const region = parts[1];\n if (lang && region) {\n result = `${lang}-${region}`;\n }\n }\n }\n\n return result.toLowerCase();\n}\n\n/**\n * Check if a string has a valid URL format.\n *\n * @param str - The string to check.\n * @returns `true` if the string is a valid URL, otherwise `false`.\n */\nexport function isValidURL(str: string): boolean {\n return /(?:https?:\\/\\/.)?(?:www\\.)?[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b[-\\w@:%+.~#?&/=]*/.test(\n str\n );\n}\n"],"mappings":"AAkBA,SAAgB,EAAiB,EAAgB,CAC/C,IAAI,EAAS,EAKb,GAJI,EAAO,SAAS,IAAI,GACtB,EAAS,EAAO,QAAQ,KAAM,IAAI,EAGhC,EAAO,SAAS,IAAI,CAAE,CACxB,IAAM,EAAQ,EAAO,MAAM,IAAI,CAC/B,GAAI,EAAM,OAAS,EAAG,CACpB,IAAM,EAAO,EAAM,GACb,EAAS,EAAM,GACjB,GAAQ,IACV,EAAS,GAAG,EAAK,GAAG,MAK1B,OAAO,EAAO,aAAa,CAS7B,SAAgB,EAAW,EAAsB,CAC/C,MAAO,iFAAiF,KACtF,EACD"}
|
package/dist/helpers.cjs
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatLocalePath = formatLocalePath;
|
|
7
|
-
exports.isValidURL = isValidURL;
|
|
8
|
-
function formatLocalePath(e) {
|
|
9
|
-
let t = e;
|
|
10
|
-
if (t.includes("_") && (t = t.replace(/_/g, "-")), t.includes("-")) {
|
|
11
|
-
const n = t.split("-");
|
|
12
|
-
if (n.length > 1) {
|
|
13
|
-
const i = n[0],
|
|
14
|
-
o = n[1];
|
|
15
|
-
i && o && (t = `${i}-${o}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return t.toLowerCase();
|
|
19
|
-
}
|
|
20
|
-
function isValidURL(e) {
|
|
21
|
-
return /(?:https?:\/\/.)?(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=]*/.test(e);
|
|
22
|
-
}
|
|
1
|
+
const e=require(`./helpers-C8s0XHG1.cjs`);exports.formatLocalePath=e.t,exports.isValidURL=e.n;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/helpers.d.ts
|
|
2
|
+
declare function formatLocalePath(locale: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Check if a string has a valid URL format.
|
|
5
|
+
*
|
|
6
|
+
* @param str - The string to check.
|
|
7
|
+
* @returns `true` if the string is a valid URL, otherwise `false`.
|
|
8
|
+
*/
|
|
9
|
+
declare function isValidURL(str: string): boolean;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { formatLocalePath, isValidURL };
|
|
12
|
+
//# sourceMappingURL=helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../src/helpers.ts"],"sourcesContent":[],"mappings":";iBAkBgB,gBAAA;AAAhB;AA0BA;;;;;iBAAgB,UAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/helpers.d.ts
|
|
2
|
+
declare function formatLocalePath(locale: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Check if a string has a valid URL format.
|
|
5
|
+
*
|
|
6
|
+
* @param str - The string to check.
|
|
7
|
+
* @returns `true` if the string is a valid URL, otherwise `false`.
|
|
8
|
+
*/
|
|
9
|
+
declare function isValidURL(str: string): boolean;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { formatLocalePath, isValidURL };
|
|
12
|
+
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../src/helpers.ts"],"sourcesContent":[],"mappings":";iBAkBgB,gBAAA;AAAhB;AA0BA;;;;;iBAAgB,UAAA"}
|
package/dist/helpers.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{n as e,t}from"./helpers-CcGiwVAN.mjs";export{t as formatLocalePath,e as isValidURL};
|
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _stormUrl = require("./storm-url.cjs");
|
|
7
|
-
Object.keys(_stormUrl).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _stormUrl[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _stormUrl[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _types = require("./types.cjs");
|
|
18
|
-
Object.keys(_types).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _types[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
const e=require(`./storm-url-t7pdfQNU.cjs`),t=require(`./types-CxnefvtE.cjs`);exports.PROTOCOL_RELATIVE_SYMBOL=t.t,exports.StormURL=e.t;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{t as e}from"./storm-url-DQn2usO1.mjs";import{t}from"./types-DL1n5nYV.mjs";export{t as PROTOCOL_RELATIVE_SYMBOL,e as StormURL};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { n as StormURLInterface, r as StormURLOptions } from "./types-CHTfZzkO.cjs";
|
|
2
|
+
import { ParsedURL } from "ufo";
|
|
3
|
+
|
|
4
|
+
//#region src/storm-url.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A class used to build URLs
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class is used to build URLs with a fluent API.
|
|
11
|
+
*
|
|
12
|
+
* The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.
|
|
13
|
+
*/
|
|
14
|
+
declare class StormURL implements StormURLInterface, URL {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(initialURL: string, options?: StormURLOptions);
|
|
17
|
+
set params(value: Record<string, any>);
|
|
18
|
+
get params(): Record<string, any>;
|
|
19
|
+
get searchParams(): URLSearchParams;
|
|
20
|
+
set searchParams(value: URLSearchParams);
|
|
21
|
+
set search(value: string);
|
|
22
|
+
get search(): string;
|
|
23
|
+
set hash(value: string);
|
|
24
|
+
get hash(): string;
|
|
25
|
+
set port(value: string | number);
|
|
26
|
+
get port(): string;
|
|
27
|
+
set username(value: string);
|
|
28
|
+
get username(): string;
|
|
29
|
+
set password(value: string);
|
|
30
|
+
get password(): string;
|
|
31
|
+
set auth(value: string | undefined);
|
|
32
|
+
get auth(): string;
|
|
33
|
+
set protocol(value: string);
|
|
34
|
+
get protocol(): string;
|
|
35
|
+
set hostname(value: string);
|
|
36
|
+
get hostname(): string;
|
|
37
|
+
set host(value: string | undefined);
|
|
38
|
+
get host(): string;
|
|
39
|
+
set paths(value: any[]);
|
|
40
|
+
get paths(): any[];
|
|
41
|
+
set pathname(value: string);
|
|
42
|
+
get pathname(): string;
|
|
43
|
+
set path(value: string);
|
|
44
|
+
get path(): string;
|
|
45
|
+
get href(): string;
|
|
46
|
+
set href(value: string);
|
|
47
|
+
get origin(): string;
|
|
48
|
+
get isScriptProtocol(): boolean;
|
|
49
|
+
get isRelative(): boolean;
|
|
50
|
+
get isNonEmptyURL(): boolean;
|
|
51
|
+
get __typename(): string;
|
|
52
|
+
isSamePath(path: string): boolean;
|
|
53
|
+
isEqual(url: string | ParsedURL | StormURL): boolean;
|
|
54
|
+
toParsed(): ParsedURL;
|
|
55
|
+
toString(): string;
|
|
56
|
+
toEncoded(): string;
|
|
57
|
+
toJSON(): string;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { StormURL as t };
|
|
61
|
+
//# sourceMappingURL=storm-url-BeaSjjni.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storm-url-BeaSjjni.d.cts","names":[],"sources":["../src/storm-url.ts"],"sourcesContent":[],"mappings":";;;;;;;AAoDA;;;;;;AAyQ+B,cAzQlB,QAAA,YAAoB,iBAyQF,EAzQqB,GAyQrB,CAAA;EAAY,CAAA,OAAA;EAWtB,WAAA,CAAA,UAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAzOsB,eAyOtB;EApRY,IAAA,MAAA,CAAA,KAAA,EAgFN,MAhFM,CAAA,MAAA,EAAA,GAAA,CAAA;EAAmB,IAAA,MAAA,CAAA,CAAA,EAoF7B,MApF6B,CAAA,MAAA,EAAA,GAAA,CAAA;EAAG,IAAA,YAAA,CAAA,CAAA,EAwF1B,eAxF0B;0BAgGtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyKF,YAAY;cAWtB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { n as StormURLInterface, r as StormURLOptions } from "./types-wUi0ilxL.mjs";
|
|
2
|
+
import { ParsedURL } from "ufo";
|
|
3
|
+
|
|
4
|
+
//#region src/storm-url.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A class used to build URLs
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class is used to build URLs with a fluent API.
|
|
11
|
+
*
|
|
12
|
+
* The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.
|
|
13
|
+
*/
|
|
14
|
+
declare class StormURL implements StormURLInterface, URL {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(initialURL: string, options?: StormURLOptions);
|
|
17
|
+
set params(value: Record<string, any>);
|
|
18
|
+
get params(): Record<string, any>;
|
|
19
|
+
get searchParams(): URLSearchParams;
|
|
20
|
+
set searchParams(value: URLSearchParams);
|
|
21
|
+
set search(value: string);
|
|
22
|
+
get search(): string;
|
|
23
|
+
set hash(value: string);
|
|
24
|
+
get hash(): string;
|
|
25
|
+
set port(value: string | number);
|
|
26
|
+
get port(): string;
|
|
27
|
+
set username(value: string);
|
|
28
|
+
get username(): string;
|
|
29
|
+
set password(value: string);
|
|
30
|
+
get password(): string;
|
|
31
|
+
set auth(value: string | undefined);
|
|
32
|
+
get auth(): string;
|
|
33
|
+
set protocol(value: string);
|
|
34
|
+
get protocol(): string;
|
|
35
|
+
set hostname(value: string);
|
|
36
|
+
get hostname(): string;
|
|
37
|
+
set host(value: string | undefined);
|
|
38
|
+
get host(): string;
|
|
39
|
+
set paths(value: any[]);
|
|
40
|
+
get paths(): any[];
|
|
41
|
+
set pathname(value: string);
|
|
42
|
+
get pathname(): string;
|
|
43
|
+
set path(value: string);
|
|
44
|
+
get path(): string;
|
|
45
|
+
get href(): string;
|
|
46
|
+
set href(value: string);
|
|
47
|
+
get origin(): string;
|
|
48
|
+
get isScriptProtocol(): boolean;
|
|
49
|
+
get isRelative(): boolean;
|
|
50
|
+
get isNonEmptyURL(): boolean;
|
|
51
|
+
get __typename(): string;
|
|
52
|
+
isSamePath(path: string): boolean;
|
|
53
|
+
isEqual(url: string | ParsedURL | StormURL): boolean;
|
|
54
|
+
toParsed(): ParsedURL;
|
|
55
|
+
toString(): string;
|
|
56
|
+
toEncoded(): string;
|
|
57
|
+
toJSON(): string;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { StormURL as t };
|
|
61
|
+
//# sourceMappingURL=storm-url-C44M08EF.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storm-url-C44M08EF.d.mts","names":[],"sources":["../src/storm-url.ts"],"sourcesContent":[],"mappings":";;;;;;;AAoDA;;;;;;AAyQ+B,cAzQlB,QAAA,YAAoB,iBAyQF,EAzQqB,GAyQrB,CAAA;EAAY,CAAA,OAAA;EAWtB,WAAA,CAAA,UAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAzOsB,eAyOtB;EApRY,IAAA,MAAA,CAAA,KAAA,EAgFN,MAhFM,CAAA,MAAA,EAAA,GAAA,CAAA;EAAmB,IAAA,MAAA,CAAA,CAAA,EAoF7B,MApF6B,CAAA,MAAA,EAAA,GAAA,CAAA;EAAG,IAAA,YAAA,CAAA,CAAA,EAwF1B,eAxF0B;0BAgGtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyKF,YAAY;cAWtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{n as e,t}from"./helpers-CcGiwVAN.mjs";import{parse as n,printParseErrorCode as r}from"jsonc-parser";import{Buffer as i}from"node:buffer";import a from"superjson";import{LinesAndColumns as o}from"lines-and-columns";import{cleanDoubleSlashes as s,decode as c,isEqual as l,isNonEmptyURL as u,isRelative as d,isSamePath as f,isScriptProtocol as p,normalizeURL as m,parseAuth as h,parseHost as g,parsePath as _,parseQuery as v,parseURL as y,stringifyParsedURL as b,stringifyQuery as x}from"ufo";const S=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),C=e=>typeof e==`object`&&!!e,w=e=>{if(!C(e)||S(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},T=e=>{try{return typeof e==`object`||!!e&&e?.constructor===Object||w(e)}catch{return!1}},E=e=>{try{return typeof e==`string`}catch{return!1}},D=Symbol(`singleComment`),O=Symbol(`multiComment`);function ee(){return``}function te(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}function k(e,t){let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)}function A(e,{whitespace:t=!0,trailingCommas:n=!1}={}){if(typeof e!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);let r=t?te:ee,i=!1,a=!1,o=0,s=``,c=``,l=-1;for(let t=0;t<e.length;t++){let u=e[t],d=e[t+1];!a&&u===`"`&&(k(e,t)||(i=!i)),!i&&(!a&&u+(d??``)===`//`?(s+=e.slice(o,t),o=t,a=D,t++):a===D&&u+(d??``)===`\r
|
|
2
|
+
`?(t++,a=!1,s+=r(e,o,t),o=t):a===D&&u===`
|
|
3
|
+
`?(a=!1,s+=r(e,o,t),o=t):!a&&u+(d??``)===`/*`?(s+=e.slice(o,t),o=t,a=O,t++):a===O&&u+(d??``)===`*/`?(t++,a=!1,s+=r(e,o,t+1),o=t+1):n&&!a&&(l===-1?u===`,`&&(c+=s+e.slice(o,t),s=``,o=t,l=t):u===`}`||u===`]`?(s+=e.slice(o,t),c+=r(s,0,1)+s.slice(1),s=``,o=t,l=-1):u!==` `&&u!==` `&&u!==`\r`&&u!==`
|
|
4
|
+
`&&(s+=e.slice(o,t),o=t,l=-1)))}return c+s+(a?r(e.slice(o)):e.slice(o))}const j=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,M=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,N=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function P(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function F(e,t={}){if(typeof e!=`string`)return e;let n=A(e);if(n[0]===`"`&&n[n.length-1]===`"`&&!n.includes(`\\`))return n.slice(1,-1);if(n=n.trim(),n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!N.test(n)){if(t.strict)throw Error(`Invalid JSON`);return n}try{if(j.test(n)||M.test(n)){if(t.strict)throw Error(`Possible prototype pollution`);return JSON.parse(n,P)}return JSON.parse(n)}catch(n){if(t.strict)throw n;return e}}const I=/\r\n|[\n\r\u2028\u2029]/;function L(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function R(e,t,n={}){let{start:r,end:i,markerLines:a}=L(t,e.split(I),n),o=String(i).length;return(n.highlight?n.highlight(e):e).split(I).slice(r,i).map((e,t)=>{let n=r+1+t,i=` ${` ${n}`.slice(-o)} | `,s=!!(a[n]??!1);if(s){let t=``;if(Array.isArray(s)){let n=e.slice(0,Math.max(s[0]-1,0)).replace(/[^\t]/g,` `),r=s[1]||1;t=[`
|
|
5
|
+
`,i.replace(/\d/g,` `),n,`^`.repeat(r)].join(``)}return[`>`,i,e,t].join(``)}return` ${i}${e}`}).join(`
|
|
6
|
+
`)}function z(e,t){let{error:n,offset:i,length:a}=t,s=new o(e).locationForIndex(i),c=s?.line??0,l=s?.column??0;return c++,l++,`${r(n)} in JSON at ${c}:${l}\n${R(e,{start:{line:c,column:l},end:{line:c,column:l+a}})}\n`}const B=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}},V=e=>e===void 0,H=`@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``),U=(e,t=2)=>{let n=B(t)?` `.repeat(t):t;switch(e){case null:return`null`;case void 0:return`"undefined"`;case!0:return`true`;case!1:return`false`;case 1/0:return`infinity`;case-1/0:return`-infinity`}if(Array.isArray(e))return`[${n}${e.map(e=>U(e,n)).join(`,${n}`)}${n}]`;if(e instanceof Uint8Array)return e.toString();switch(typeof e){case`number`:return`${e}`;case`string`:return JSON.stringify(e);case`object`:return`{${n}${Object.keys(e).filter(t=>!V(e[t])).map(t=>`${H.some(e=>t.includes(e))?`"${t}"`:t}: ${n}${U(e[t],n)}`).join(`,${n}`)}${n}}`;default:return`null`}};var W=class e extends a{static#e;static get instance(){return e.#e||=new e,e.#e}static deserialize(t){return e.instance.deserialize(t)}static serialize(t){return e.instance.serialize(t)}static parse(e){return F(e)}static stringify(t,n){let r=e.instance.customTransformerRegistry.findApplicable(t),i=t;return r&&r.isApplicable(t)&&(i=r.serialize(i)),U(i)}static parseJson(t,r){try{if(r?.expectComments===!1)return e.instance.parse(t)}catch{}let i=[],a=n(t,i,{allowTrailingComma:!0,...r});if(i.length>0&&i[0])throw Error(z(t,i[0]));return a}static register(t,n,r,i){e.instance.registerCustom({isApplicable:i,serialize:n,deserialize:r},t)}static registerClass(t,n){e.instance.registerClass(t,{identifier:E(n)?n:n?.identifier||t.name,allowProps:n&&T(n)&&n?.allowProps&&Array.isArray(n.allowProps)?n.allowProps:[`__typename`]})}constructor(){super({dedupe:!0})}};W.instance.registerCustom({isApplicable:e=>i.isBuffer(e),serialize:e=>e.toString(`base64`),deserialize:e=>i.from(e,`base64`)},`Bytes`);const ne=/^[A-Z]:\//i,G=/^[A-Z]:$/i,K=/^[/\\]{2}/,q=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;function J(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}function Y(e){return q.test(J(e))}function X(e){return Y(e)}function Z(e=``){return e&&e.replace(/\\/g,`/`).replace(ne,e=>e.toUpperCase())}function re(e){if(!e||e.length===0)return`.`;e=Z(e);let t=e.match(K),n=X(e),r=e[e.length-1]===`/`;return e=ae(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),G.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!X(e)?`/${e}`:e)}function ie(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return re(t)}function ae(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const oe=e=>!E(e)&&B(e)&&e%1==0,se=e=>{try{return e===null}catch{return!1}},Q=e=>{try{return V(e)||se(e)}catch{return!1}},ce=e=>{try{return!Q(e)}catch{return!1}},le=e=>{try{return ce(e)&&E(e)&&e.length>0}catch{return!1}};var $=class n{#e;#t;#n;#r;#i;#a;#o=[];#s;#c;constructor(n,r={decode:!0}){if(n&&!e(n))throw TypeError(`Invalid URL: ${n}`);this.#e=r;let i=y(this.#e.decode?c(n):n),a=h(i.auth);this.#t=a.username,this.#n=a.password;let o=g(i.host);this.#r=o.hostname,this.#i=o.port,this.#a=i.protocol,this.#s=i.hash||``,this.#c=v(i.search),this.#o=i.pathname?i.pathname.split(`/`).filter(Boolean):[],r.locale&&this.#o.unshift(t((le(r.locale)?r.locale:process.env.DEFAULT_LOCALE)||`en-us`))}set params(e){this.#c=e}get params(){return this.#c}get searchParams(){let e=new URLSearchParams;for(let[t,n]of Object.entries(this.params))e.append(t,n);return e}set searchParams(e){this.params=Object.fromEntries(e.entries())}set search(e){this.params=v(e)}get search(){let e=x(this.params);return e?e.startsWith(`?`)?e:`?${e}`:``}set hash(e){this.#s=e.startsWith(`#`)?e:`#${e}`}get hash(){return this.#s}set port(e){this.#i=!V(e)&&oe(e)?`${e}`:``}get port(){return this.#i||``}set username(e){this.auth=`${e}:${this.#n}`}get username(){return this.#t||``}set password(e){this.auth=`${this.#t}:${e}`}get password(){return this.#n||``}set auth(e){let t=h(e);this.#t=t.username,this.#n=t.password}get auth(){return this.#t&&this.#n?`${this.#t}:${this.#n}`:this.#t?this.#t:this.#n?this.#n:``}set protocol(e){this.#a=e.endsWith(`:`)?e:e.endsWith(`://`)?e.slice(0,-2):`${e}:`}get protocol(){return this.#a||this.#e.defaultProtocol||`https:`}set hostname(e){this.#r=e}get hostname(){return this.#r}set host(e){let t=g(e);this.#r=t.hostname,this.#i=t.port}get host(){return this.#r&&this.#i?`${this.#r}:${this.#i}`:this.#r?this.#r:this.#i?this.#i:``}set paths(e){this.#o=e.filter(Boolean)}get paths(){return this.#o}set pathname(e){this.paths=s(e).split(`/`)}get pathname(){return`/${this.paths?ie(...this.paths.map(e=>W.stringify(e))):``}`}set path(e){let t=_(e);this.pathname=t.pathname,this.search=t.search,this.#s=t.hash}get path(){return b({pathname:this.pathname,search:this.search,hash:this.hash})}get href(){return this.toString()}set href(e){let t=y(e);this.protocol=t.protocol||this.protocol,this.auth=t.auth||this.auth,this.host=t.host||this.host,this.pathname=t.pathname||this.pathname,this.search=t.search||this.search,this.hash=t.hash||this.hash}get origin(){return`${this.protocol}//${this.host}`}get isScriptProtocol(){return p(this.protocol)}get isRelative(){return d(this.toString())}get isNonEmptyURL(){return u(this.toString())}get __typename(){return`StormURL`}isSamePath(e){return f(this.path,e)}isEqual(e){return l(this.toString(),typeof e==`string`?e:e instanceof n?e.toString():b(e))}toParsed(){return{protocol:this.protocol,auth:this.auth,host:this.host,pathname:this.pathname,search:this.search,hash:this.hash}}toString(){return b(this.toParsed())}toEncoded(){return m(this.toString())}toJSON(){return W.stringify(this.toParsed())}};W.instance.registerCustom({isApplicable:e=>e.__typename===`StormURL`,serialize:e=>e.toEncoded(),deserialize:e=>new $(e,{decode:!0})},`StormURL`);export{$ as t};
|
|
7
|
+
//# sourceMappingURL=storm-url-DQn2usO1.mjs.map
|