@regardio/js 1.1.0 → 1.1.1
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/dist/intl/index.d.mts +240 -2
- package/dist/text/index.mjs +1 -1
- package/package.json +10 -5
package/dist/intl/index.d.mts
CHANGED
|
@@ -1,5 +1,243 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region ../../node_modules/.pnpm/cookie@1.1.1/node_modules/cookie/dist/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Parse options.
|
|
4
|
+
*/
|
|
5
|
+
interface ParseOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
|
|
8
|
+
* Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
|
|
9
|
+
* a previously-encoded cookie value into a JavaScript string.
|
|
10
|
+
*
|
|
11
|
+
* The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
|
|
12
|
+
* is thrown it will return the cookie's original value. If you provide your own encode/decode
|
|
13
|
+
* scheme you must ensure errors are appropriately handled.
|
|
14
|
+
*
|
|
15
|
+
* @default decode
|
|
16
|
+
*/
|
|
17
|
+
decode?: (str: string) => string | undefined;
|
|
18
|
+
}
|
|
19
|
+
interface StringifyOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
|
|
22
|
+
* Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
|
|
23
|
+
* a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
|
|
24
|
+
*
|
|
25
|
+
* @default encodeURIComponent
|
|
26
|
+
*/
|
|
27
|
+
encode?: (str: string) => string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Set-Cookie object.
|
|
31
|
+
*/
|
|
32
|
+
interface SetCookie {
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the name of the cookie.
|
|
35
|
+
*/
|
|
36
|
+
name: string;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the string to be the value for the cookie.
|
|
39
|
+
*/
|
|
40
|
+
value: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
|
|
43
|
+
*
|
|
44
|
+
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
|
|
45
|
+
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
|
|
46
|
+
* so if both are set, they should point to the same date and time.
|
|
47
|
+
*/
|
|
48
|
+
maxAge?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
|
|
51
|
+
* When no expiration is set, clients consider this a "non-persistent cookie" and delete it when the current session is over.
|
|
52
|
+
*
|
|
53
|
+
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
|
|
54
|
+
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
|
|
55
|
+
* so if both are set, they should point to the same date and time.
|
|
56
|
+
*/
|
|
57
|
+
expires?: Date;
|
|
58
|
+
/**
|
|
59
|
+
* Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
|
|
60
|
+
* When no domain is set, clients consider the cookie to apply to the current domain only.
|
|
61
|
+
*/
|
|
62
|
+
domain?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
|
|
65
|
+
* When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
|
|
66
|
+
*/
|
|
67
|
+
path?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
|
|
70
|
+
* When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
|
|
71
|
+
*/
|
|
72
|
+
httpOnly?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
|
|
75
|
+
* When enabled, clients will only send the cookie back if the browser has an HTTPS connection.
|
|
76
|
+
*/
|
|
77
|
+
secure?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
|
|
80
|
+
* When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
|
|
81
|
+
*
|
|
82
|
+
* This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
83
|
+
* This also means clients may ignore this attribute until they understand it. More information
|
|
84
|
+
* about can be found in [the proposal](https://github.com/privacycg/CHIPS).
|
|
85
|
+
*/
|
|
86
|
+
partitioned?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
|
|
89
|
+
*
|
|
90
|
+
* - `'low'` will set the `Priority` attribute to `Low`.
|
|
91
|
+
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
|
|
92
|
+
* - `'high'` will set the `Priority` attribute to `High`.
|
|
93
|
+
*
|
|
94
|
+
* More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
|
|
95
|
+
*/
|
|
96
|
+
priority?: "low" | "medium" | "high";
|
|
97
|
+
/**
|
|
98
|
+
* Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
|
|
99
|
+
*
|
|
100
|
+
* - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
|
|
101
|
+
* - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
|
|
102
|
+
* - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
|
|
103
|
+
* - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
|
|
104
|
+
*
|
|
105
|
+
* More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
|
|
106
|
+
*/
|
|
107
|
+
sameSite?: boolean | "lax" | "strict" | "none";
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Backward compatibility serialize options.
|
|
111
|
+
*/
|
|
112
|
+
type SerializeOptions = StringifyOptions & Omit<SetCookie, "name" | "value">;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region ../../node_modules/.pnpm/react-router@7.15.0_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/react-router/dist/development/index.d.mts
|
|
115
|
+
/**
|
|
116
|
+
* A HTTP cookie.
|
|
117
|
+
*
|
|
118
|
+
* A Cookie is a logical container for metadata about a HTTP cookie; its name
|
|
119
|
+
* and options. But it doesn't contain a value. Instead, it has `parse()` and
|
|
120
|
+
* `serialize()` methods that allow a single instance to be reused for
|
|
121
|
+
* parsing/encoding multiple different values.
|
|
122
|
+
*
|
|
123
|
+
* @see https://remix.run/utils/cookies#cookie-api
|
|
124
|
+
*/
|
|
125
|
+
interface Cookie {
|
|
126
|
+
/**
|
|
127
|
+
* The name of the cookie, used in the `Cookie` and `Set-Cookie` headers.
|
|
128
|
+
*/
|
|
129
|
+
readonly name: string;
|
|
130
|
+
/**
|
|
131
|
+
* True if this cookie uses one or more secrets for verification.
|
|
132
|
+
*/
|
|
133
|
+
readonly isSigned: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* The Date this cookie expires.
|
|
136
|
+
*
|
|
137
|
+
* Note: This is calculated at access time using `maxAge` when no `expires`
|
|
138
|
+
* option is provided to `createCookie()`.
|
|
139
|
+
*/
|
|
140
|
+
readonly expires?: Date;
|
|
141
|
+
/**
|
|
142
|
+
* Parses a raw `Cookie` header and returns the value of this cookie or
|
|
143
|
+
* `null` if it's not present.
|
|
144
|
+
*/
|
|
145
|
+
parse(cookieHeader: string | null, options?: ParseOptions): Promise<any>;
|
|
146
|
+
/**
|
|
147
|
+
* Serializes the given value to a string and returns the `Set-Cookie`
|
|
148
|
+
* header.
|
|
149
|
+
*/
|
|
150
|
+
serialize(value: any, options?: SerializeOptions): Promise<string>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Creates a logical container for managing a browser cookie from the server.
|
|
154
|
+
*/
|
|
155
|
+
/**
|
|
156
|
+
* An object of name/value pairs to be used in the session.
|
|
157
|
+
*/
|
|
158
|
+
interface SessionData {
|
|
159
|
+
[name: string]: any;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Session persists data across HTTP requests.
|
|
163
|
+
*
|
|
164
|
+
* @see https://reactrouter.com/explanation/sessions-and-cookies#sessions
|
|
165
|
+
*/
|
|
166
|
+
interface Session<Data = SessionData, FlashData = Data> {
|
|
167
|
+
/**
|
|
168
|
+
* A unique identifier for this session.
|
|
169
|
+
*
|
|
170
|
+
* Note: This will be the empty string for newly created sessions and
|
|
171
|
+
* sessions that are not backed by a database (i.e. cookie-based sessions).
|
|
172
|
+
*/
|
|
173
|
+
readonly id: string;
|
|
174
|
+
/**
|
|
175
|
+
* The raw data contained in this session.
|
|
176
|
+
*
|
|
177
|
+
* This is useful mostly for SessionStorage internally to access the raw
|
|
178
|
+
* session data to persist.
|
|
179
|
+
*/
|
|
180
|
+
readonly data: FlashSessionData<Data, FlashData>;
|
|
181
|
+
/**
|
|
182
|
+
* Returns `true` if the session has a value for the given `name`, `false`
|
|
183
|
+
* otherwise.
|
|
184
|
+
*/
|
|
185
|
+
has(name: (keyof Data | keyof FlashData) & string): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the value for the given `name` in this session.
|
|
188
|
+
*/
|
|
189
|
+
get<Key extends (keyof Data | keyof FlashData) & string>(name: Key): (Key extends keyof Data ? Data[Key] : undefined) | (Key extends keyof FlashData ? FlashData[Key] : undefined) | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Sets a value in the session for the given `name`.
|
|
192
|
+
*/
|
|
193
|
+
set<Key extends keyof Data & string>(name: Key, value: Data[Key]): void;
|
|
194
|
+
/**
|
|
195
|
+
* Sets a value in the session that is only valid until the next `get()`.
|
|
196
|
+
* This can be useful for temporary values, like error messages.
|
|
197
|
+
*/
|
|
198
|
+
flash<Key extends keyof FlashData & string>(name: Key, value: FlashData[Key]): void;
|
|
199
|
+
/**
|
|
200
|
+
* Removes a value from the session.
|
|
201
|
+
*/
|
|
202
|
+
unset(name: keyof Data & string): void;
|
|
203
|
+
}
|
|
204
|
+
type FlashSessionData<Data, FlashData> = Partial<Data & { [Key in keyof FlashData as FlashDataKey<Key & string>]: FlashData[Key] }>;
|
|
205
|
+
type FlashDataKey<Key extends string> = `__flash_${Key}__`;
|
|
206
|
+
/**
|
|
207
|
+
* SessionStorage stores session data between HTTP requests and knows how to
|
|
208
|
+
* parse and create cookies.
|
|
209
|
+
*
|
|
210
|
+
* A SessionStorage creates Session objects using a `Cookie` header as input.
|
|
211
|
+
* Then, later it generates the `Set-Cookie` header to be used in the response.
|
|
212
|
+
*/
|
|
213
|
+
interface SessionStorage<Data = SessionData, FlashData = Data> {
|
|
214
|
+
/**
|
|
215
|
+
* Parses a Cookie header from a HTTP request and returns the associated
|
|
216
|
+
* Session. If there is no session associated with the cookie, this will
|
|
217
|
+
* return a new Session with no data.
|
|
218
|
+
*/
|
|
219
|
+
getSession: (cookieHeader?: string | null, options?: ParseOptions) => Promise<Session<Data, FlashData>>;
|
|
220
|
+
/**
|
|
221
|
+
* Stores all data in the Session and returns the Set-Cookie header to be
|
|
222
|
+
* used in the HTTP response.
|
|
223
|
+
*/
|
|
224
|
+
commitSession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
|
|
225
|
+
/**
|
|
226
|
+
* Deletes all data associated with the Session and returns the Set-Cookie
|
|
227
|
+
* header to be used in the HTTP response.
|
|
228
|
+
*/
|
|
229
|
+
destroySession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* SessionIdStorageStrategy is designed to allow anyone to easily build their
|
|
233
|
+
* own SessionStorage using `createSessionStorage(strategy)`.
|
|
234
|
+
*
|
|
235
|
+
* This strategy describes a common scenario where the session id is stored in
|
|
236
|
+
* a cookie but the actual session data is stored elsewhere, usually in a
|
|
237
|
+
* database or on disk. A set of create, read, update, and delete operations
|
|
238
|
+
* are provided for managing the session data.
|
|
239
|
+
*/
|
|
240
|
+
//#endregion
|
|
3
241
|
//#region src/intl/language-detector.d.ts
|
|
4
242
|
interface LanguageDetectorOption {
|
|
5
243
|
/**
|
package/dist/text/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package.json",
|
|
3
3
|
"name": "@regardio/js",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Regardio JavaScript utilities",
|
|
7
7
|
"keywords": [
|
|
@@ -54,27 +54,32 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
57
|
-
"dist"
|
|
57
|
+
"dist",
|
|
58
|
+
"pnpm-lock.yaml"
|
|
58
59
|
],
|
|
59
60
|
"dependencies": {
|
|
60
61
|
"cookie-es": "3.1.1",
|
|
61
|
-
"intl-parse-accept-language": "1.0.0"
|
|
62
|
-
"react-router": "7.14.2"
|
|
62
|
+
"intl-parse-accept-language": "1.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
+
"react-router": "7.15.0",
|
|
65
66
|
"@total-typescript/ts-reset": "0.6.1",
|
|
66
67
|
"@types/node": "25.6.0",
|
|
67
68
|
"@vitest/coverage-v8": "4.1.5",
|
|
68
69
|
"@vitest/ui": "4.1.5",
|
|
69
70
|
"tsdown": "0.21.10",
|
|
70
71
|
"vitest": "4.1.5",
|
|
71
|
-
"@regardio/dev": "2.
|
|
72
|
+
"@regardio/dev": "2.3.0"
|
|
72
73
|
},
|
|
73
74
|
"scripts": {
|
|
74
75
|
"build": "tsdown",
|
|
75
76
|
"clean": "rimraf .turbo dist",
|
|
76
77
|
"dev": "tsdown --watch",
|
|
77
78
|
"fix": "run-s fix:pkg fix:md fix:biome",
|
|
79
|
+
"release": "commit-and-tag-version",
|
|
80
|
+
"release:major": "commit-and-tag-version --release-as major",
|
|
81
|
+
"release:minor": "commit-and-tag-version --release-as minor",
|
|
82
|
+
"release:patch": "commit-and-tag-version --release-as patch",
|
|
78
83
|
"fix:biome": "biome check --write --unsafe .",
|
|
79
84
|
"fix:md": "markdownlint-cli2 --config ../../.markdownlint-cli2.jsonc --fix",
|
|
80
85
|
"fix:pkg": "sort-package-json",
|