@stryke/url 0.3.4 → 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.
Files changed (42) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/README.md +18 -9
  3. package/dist/helpers-C8s0XHG1.cjs +1 -0
  4. package/dist/helpers-CcGiwVAN.mjs +2 -0
  5. package/dist/helpers-CcGiwVAN.mjs.map +1 -0
  6. package/dist/helpers.cjs +1 -22
  7. package/dist/helpers.d.cts +12 -0
  8. package/dist/helpers.d.cts.map +1 -0
  9. package/dist/helpers.d.mts +12 -0
  10. package/dist/helpers.d.mts.map +1 -0
  11. package/dist/helpers.mjs +1 -1
  12. package/dist/index.cjs +1 -27
  13. package/dist/index.d.cts +3 -0
  14. package/dist/index.d.mts +3 -0
  15. package/dist/index.mjs +1 -1
  16. package/dist/storm-url-BeaSjjni.d.cts +61 -0
  17. package/dist/storm-url-BeaSjjni.d.cts.map +1 -0
  18. package/dist/storm-url-C44M08EF.d.mts +61 -0
  19. package/dist/storm-url-C44M08EF.d.mts.map +1 -0
  20. package/dist/storm-url-DQn2usO1.mjs +7 -0
  21. package/dist/storm-url-DQn2usO1.mjs.map +1 -0
  22. package/dist/storm-url-t7pdfQNU.cjs +6 -0
  23. package/dist/storm-url.cjs +1 -184
  24. package/dist/storm-url.d.cts +2 -0
  25. package/dist/storm-url.d.mts +2 -0
  26. package/dist/storm-url.mjs +1 -1
  27. package/dist/types-CHTfZzkO.d.cts +94 -0
  28. package/dist/types-CHTfZzkO.d.cts.map +1 -0
  29. package/dist/types-CxnefvtE.cjs +1 -0
  30. package/dist/types-DL1n5nYV.mjs +2 -0
  31. package/dist/types-DL1n5nYV.mjs.map +1 -0
  32. package/dist/types-wUi0ilxL.d.mts +94 -0
  33. package/dist/types-wUi0ilxL.d.mts.map +1 -0
  34. package/dist/types.cjs +1 -7
  35. package/dist/types.d.cts +2 -0
  36. package/dist/types.d.mts +2 -0
  37. package/dist/types.mjs +1 -1
  38. package/package.json +16 -105
  39. package/dist/helpers.d.ts +0 -8
  40. package/dist/index.d.ts +0 -2
  41. package/dist/storm-url.d.ts +0 -55
  42. package/dist/types.d.ts +0 -90
@@ -0,0 +1,94 @@
1
+ //#region src/types.d.ts
2
+ interface StormURLOptions {
3
+ /**
4
+ * Should the URL be decoded
5
+ *
6
+ * @defaultValue `true`
7
+ */
8
+ decode?: boolean;
9
+ /**
10
+ * Should the URL include a locale path segment
11
+ */
12
+ locale?: string | true;
13
+ /**
14
+ * The default protocol to use
15
+ *
16
+ * @defaultValue "https"
17
+ */
18
+ defaultProtocol?: string;
19
+ }
20
+ declare const PROTOCOL_RELATIVE_SYMBOL: unique symbol;
21
+ interface StormURLInterface extends URL {
22
+ /**
23
+ * A string containing the username and password specified before the domain name.
24
+ */
25
+ auth: string;
26
+ /**
27
+ * A string containing the username specified before the domain name.
28
+ */
29
+ username: string;
30
+ /**
31
+ * A string containing the password specified before the domain name.
32
+ */
33
+ password: string;
34
+ /**
35
+ * A string containing the domain (that is the hostname) followed by (if a port was specified) a `:` and the port of the URL.
36
+ */
37
+ host: string;
38
+ /**
39
+ * A string containing the domain of the URL.
40
+ */
41
+ hostname: string;
42
+ /**
43
+ * A string containing the port number of the URL.
44
+ */
45
+ port: string;
46
+ /**
47
+ * A string containing the protocol scheme of the URL, including the final `:`.
48
+ */
49
+ protocol: string;
50
+ /**
51
+ * A stringified value that returns the whole URL.
52
+ */
53
+ href: string;
54
+ /**
55
+ * A string containing an initial `/` followed by the path of the URL, not including the query string or fragment.
56
+ */
57
+ pathname: string;
58
+ /**
59
+ * The paths of the URL
60
+ */
61
+ paths: any[];
62
+ /**
63
+ * A string containing a `#` followed by the fragment identifier of the URL.
64
+ */
65
+ hash: string;
66
+ /**
67
+ * A string indicating the URL's parameter string; if any parameters are provided, this string includes all of them, beginning with the leading `?` character.
68
+ */
69
+ search: string;
70
+ /**
71
+ * The search parameters of the URL
72
+ *
73
+ * @remarks
74
+ * This is a `URLSearchParams` object that contains the search parameters of the URL.
75
+ */
76
+ searchParams: URLSearchParams;
77
+ /**
78
+ * The search parameters of the URL
79
+ *
80
+ * @remarks
81
+ * This is a Record\<string, any\> object that contains the search parameters of the URL.
82
+ */
83
+ params: Record<string, any>;
84
+ /**
85
+ * An optional symbol to indicate that the URL is protocol-relative
86
+ *
87
+ * @remarks
88
+ * This is used when the URL is protocol-relative (e.g. //example.com)
89
+ */
90
+ [PROTOCOL_RELATIVE_SYMBOL]?: boolean;
91
+ }
92
+ //#endregion
93
+ export { StormURLInterface as n, StormURLOptions as r, PROTOCOL_RELATIVE_SYMBOL as t };
94
+ //# sourceMappingURL=types-wUi0ilxL.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-wUi0ilxL.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";UAkBiB,eAAA;EAAA;AAqBjB;AAGA;;;EAmFG,MAAA,CAAA,EAAA,OAAA;EAnFwC;;;;;;;;;;;cAH9B;UAGI,iBAAA,SAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAmE3B;;;;;;;UAQN;;;;;;;GAQP,wBAAA"}
package/dist/types.cjs CHANGED
@@ -1,7 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PROTOCOL_RELATIVE_SYMBOL = void 0;
7
- const PROTOCOL_RELATIVE_SYMBOL = exports.PROTOCOL_RELATIVE_SYMBOL = Symbol("protocol-relative");
1
+ const e=require(`./types-CxnefvtE.cjs`);exports.PROTOCOL_RELATIVE_SYMBOL=e.t;
@@ -0,0 +1,2 @@
1
+ import { n as StormURLInterface, r as StormURLOptions, t as PROTOCOL_RELATIVE_SYMBOL } from "./types-CHTfZzkO.cjs";
2
+ export { PROTOCOL_RELATIVE_SYMBOL, StormURLInterface, StormURLOptions };
@@ -0,0 +1,2 @@
1
+ import { n as StormURLInterface, r as StormURLOptions, t as PROTOCOL_RELATIVE_SYMBOL } from "./types-wUi0ilxL.mjs";
2
+ export { PROTOCOL_RELATIVE_SYMBOL, StormURLInterface, StormURLOptions };
package/dist/types.mjs CHANGED
@@ -1 +1 @@
1
- export const PROTOCOL_RELATIVE_SYMBOL=Symbol("protocol-relative");
1
+ import{t as e}from"./types-DL1n5nYV.mjs";export{e as PROTOCOL_RELATIVE_SYMBOL};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/url",
3
- "version": "0.3.4",
3
+ "version": "0.3.11",
4
4
  "type": "module",
5
5
  "description": "A package containing the `StormURL` class, which is used to parse and manipulate URLs.",
6
6
  "repository": {
@@ -9,113 +9,24 @@
9
9
  "directory": "packages/url"
10
10
  },
11
11
  "private": false,
12
- "dependencies": {
13
- "ufo": "1.5.4",
14
- "@stryke/json": "^0.9.16",
15
- "@stryke/path": "^0.22.0",
16
- "@stryke/type-checks": "^0.4.4"
17
- },
18
- "devDependencies": { "@types/node": "^24.10.1" },
19
- "publishConfig": { "access": "public" },
20
- "sideEffects": false,
21
- "files": ["dist/**/*"],
22
- "homepage": "https://stormsoftware.com",
23
- "bugs": {
24
- "url": "https://stormsoftware.com/support",
25
- "email": "support@stormsoftware.com"
26
- },
27
- "license": "Apache-2.0",
28
- "keywords": [
29
- "stryke",
30
- "typescript",
31
- "utilities",
32
- "storm-software",
33
- "storm",
34
- "storm-ops",
35
- "cyclone-ui",
36
- "sullivanpj",
37
- "monorepo"
38
- ],
39
- "funding": {
40
- "type": "github",
41
- "url": "https://github.com/sponsors/storm-software"
42
- },
43
- "author": {
44
- "name": "Storm Software",
45
- "email": "contact@stormsoftware.com",
46
- "url": "https://stormsoftware.com"
47
- },
48
- "maintainers": [
49
- {
50
- "name": "Storm Software",
51
- "email": "contact@stormsoftware.com",
52
- "url": "https://stormsoftware.com"
53
- }
54
- ],
55
- "contributors": [
56
- {
57
- "name": "Storm Software",
58
- "email": "contact@stormsoftware.com",
59
- "url": "https://stormsoftware.com"
60
- }
61
- ],
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.mjs",
62
14
  "exports": {
63
- "./types": {
64
- "import": { "types": "./dist/types.d.ts", "default": "./dist/types.mjs" },
65
- "require": {
66
- "types": "./dist/types.d.ts",
67
- "default": "./dist/types.cjs"
68
- },
69
- "default": { "types": "./dist/types.d.ts", "default": "./dist/types.mjs" }
70
- },
71
- "./storm-url": {
72
- "import": {
73
- "types": "./dist/storm-url.d.ts",
74
- "default": "./dist/storm-url.mjs"
75
- },
76
- "require": {
77
- "types": "./dist/storm-url.d.ts",
78
- "default": "./dist/storm-url.cjs"
79
- },
80
- "default": {
81
- "types": "./dist/storm-url.d.ts",
82
- "default": "./dist/storm-url.mjs"
83
- }
84
- },
85
- "./index": {
86
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
87
- "require": {
88
- "types": "./dist/index.d.ts",
89
- "default": "./dist/index.cjs"
90
- },
91
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
92
- },
15
+ ".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
93
16
  "./helpers": {
94
- "import": {
95
- "types": "./dist/helpers.d.ts",
96
- "default": "./dist/helpers.mjs"
97
- },
98
- "require": {
99
- "types": "./dist/helpers.d.ts",
100
- "default": "./dist/helpers.cjs"
101
- },
102
- "default": {
103
- "types": "./dist/helpers.d.ts",
104
- "default": "./dist/helpers.mjs"
105
- }
17
+ "require": "./dist/helpers.cjs",
18
+ "import": "./dist/helpers.mjs"
106
19
  },
107
- ".": {
108
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
109
- "require": {
110
- "types": "./dist/index.d.ts",
111
- "default": "./dist/index.cjs"
112
- },
113
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
20
+ "./storm-url": {
21
+ "require": "./dist/storm-url.cjs",
22
+ "import": "./dist/storm-url.mjs"
114
23
  },
115
- "./package.json": "./package.json"
24
+ "./types": { "require": "./dist/types.cjs", "import": "./dist/types.mjs" },
25
+ "./*": "./*"
116
26
  },
117
- "main": "./dist/index.cjs",
118
- "module": "./dist/index.mjs",
119
- "types": "./dist/index.d.ts",
120
- "gitHead": "eb28313b3230b7ea654c87586ca07773e2e57f52"
27
+ "types": "./dist/index.d.cts",
28
+ "dependencies": { "ufo": "^1.6.1" },
29
+ "devDependencies": { "@types/node": "^24.10.1", "tsdown": "^0.17.1" },
30
+ "publishConfig": { "access": "public" },
31
+ "gitHead": "5c645896466d1f6a26fb9cf9748ba226dd4d1f07"
121
32
  }
package/dist/helpers.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare function formatLocalePath(locale: string): string;
2
- /**
3
- * Check if a string has a valid URL format.
4
- *
5
- * @param str - The string to check.
6
- * @returns `true` if the string is a valid URL, otherwise `false`.
7
- */
8
- export declare function isValidURL(str: string): boolean;
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./storm-url";
2
- export * from "./types";
@@ -1,55 +0,0 @@
1
- import type { ParsedURL } from "ufo";
2
- import type { StormURLInterface, StormURLOptions } from "./types";
3
- /**
4
- * A class used to build URLs
5
- *
6
- * @remarks
7
- * This class is used to build URLs with a fluent API.
8
- *
9
- * The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.
10
- */
11
- export declare class StormURL implements StormURLInterface, URL {
12
- #private;
13
- constructor(initialURL: string, options?: StormURLOptions);
14
- set params(value: Record<string, any>);
15
- get params(): Record<string, any>;
16
- get searchParams(): URLSearchParams;
17
- set searchParams(value: URLSearchParams);
18
- set search(value: string);
19
- get search(): string;
20
- set hash(value: string);
21
- get hash(): string;
22
- set port(value: string | number);
23
- get port(): string;
24
- set username(value: string);
25
- get username(): string;
26
- set password(value: string);
27
- get password(): string;
28
- set auth(value: string | undefined);
29
- get auth(): string;
30
- set protocol(value: string);
31
- get protocol(): string;
32
- set hostname(value: string);
33
- get hostname(): string;
34
- set host(value: string | undefined);
35
- get host(): string;
36
- set paths(value: any[]);
37
- get paths(): any[];
38
- set pathname(value: string);
39
- get pathname(): string;
40
- set path(value: string);
41
- get path(): string;
42
- get href(): string;
43
- set href(value: string);
44
- get origin(): string;
45
- get isScriptProtocol(): boolean;
46
- get isRelative(): boolean;
47
- get isNonEmptyURL(): boolean;
48
- get __typename(): string;
49
- isSamePath(path: string): boolean;
50
- isEqual(url: string | ParsedURL | StormURL): boolean;
51
- toParsed(): ParsedURL;
52
- toString(): string;
53
- toEncoded(): string;
54
- toJSON(): string;
55
- }
package/dist/types.d.ts DELETED
@@ -1,90 +0,0 @@
1
- export interface StormURLOptions {
2
- /**
3
- * Should the URL be decoded
4
- *
5
- * @defaultValue `true`
6
- */
7
- decode?: boolean;
8
- /**
9
- * Should the URL include a locale path segment
10
- */
11
- locale?: string | true;
12
- /**
13
- * The default protocol to use
14
- *
15
- * @defaultValue "https"
16
- */
17
- defaultProtocol?: string;
18
- }
19
- export declare const PROTOCOL_RELATIVE_SYMBOL: unique symbol;
20
- export interface StormURLInterface extends URL {
21
- /**
22
- * A string containing the username and password specified before the domain name.
23
- */
24
- auth: string;
25
- /**
26
- * A string containing the username specified before the domain name.
27
- */
28
- username: string;
29
- /**
30
- * A string containing the password specified before the domain name.
31
- */
32
- password: string;
33
- /**
34
- * A string containing the domain (that is the hostname) followed by (if a port was specified) a `:` and the port of the URL.
35
- */
36
- host: string;
37
- /**
38
- * A string containing the domain of the URL.
39
- */
40
- hostname: string;
41
- /**
42
- * A string containing the port number of the URL.
43
- */
44
- port: string;
45
- /**
46
- * A string containing the protocol scheme of the URL, including the final `:`.
47
- */
48
- protocol: string;
49
- /**
50
- * A stringified value that returns the whole URL.
51
- */
52
- href: string;
53
- /**
54
- * A string containing an initial `/` followed by the path of the URL, not including the query string or fragment.
55
- */
56
- pathname: string;
57
- /**
58
- * The paths of the URL
59
- */
60
- paths: any[];
61
- /**
62
- * A string containing a `#` followed by the fragment identifier of the URL.
63
- */
64
- hash: string;
65
- /**
66
- * A string indicating the URL's parameter string; if any parameters are provided, this string includes all of them, beginning with the leading `?` character.
67
- */
68
- search: string;
69
- /**
70
- * The search parameters of the URL
71
- *
72
- * @remarks
73
- * This is a `URLSearchParams` object that contains the search parameters of the URL.
74
- */
75
- searchParams: URLSearchParams;
76
- /**
77
- * The search parameters of the URL
78
- *
79
- * @remarks
80
- * This is a Record\<string, any\> object that contains the search parameters of the URL.
81
- */
82
- params: Record<string, any>;
83
- /**
84
- * An optional symbol to indicate that the URL is protocol-relative
85
- *
86
- * @remarks
87
- * This is used when the URL is protocol-relative (e.g. //example.com)
88
- */
89
- [PROTOCOL_RELATIVE_SYMBOL]?: boolean;
90
- }