@small-web/kitten-types 1.1.3 → 2.0.0

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 (80) hide show
  1. package/README.md +9 -2
  2. package/fragments.d.ts +13 -14
  3. package/global.d.ts +6 -1081
  4. package/index.d.ts +7 -27
  5. package/kitten/src/AppDatabase.d.ts +10 -0
  6. package/kitten/src/AppRepository.d.ts +101 -0
  7. package/kitten/src/AutomaticUpdates.d.ts +21 -0
  8. package/kitten/src/Files.d.ts +61 -0
  9. package/kitten/src/GlobalInternalDatabase.d.ts +22 -0
  10. package/kitten/src/InternalDatabase.d.ts +7 -0
  11. package/kitten/src/REPL.d.ts +5 -0
  12. package/kitten/src/Routes.d.ts +41 -0
  13. package/kitten/src/Server.d.ts +76 -0
  14. package/kitten/src/ServerError.d.ts +6 -0
  15. package/kitten/src/Sessions.d.ts +32 -0
  16. package/kitten/src/Uploads.d.ts +20 -0
  17. package/kitten/src/Utils.d.ts +79 -0
  18. package/kitten/src/cli/commands/db.d.ts +48 -0
  19. package/kitten/src/cli/commands/deploy.d.ts +16 -0
  20. package/kitten/src/cli/commands/disable.d.ts +9 -0
  21. package/kitten/src/cli/commands/enable.d.ts +9 -0
  22. package/kitten/src/cli/commands/logs.d.ts +15 -0
  23. package/kitten/src/cli/commands/restart.d.ts +11 -0
  24. package/kitten/src/cli/commands/run.d.ts +15 -0
  25. package/kitten/src/cli/commands/serve.d.ts +13 -0
  26. package/kitten/src/cli/commands/shell.d.ts +1 -0
  27. package/kitten/src/cli/commands/start.d.ts +9 -0
  28. package/kitten/src/cli/commands/status.d.ts +15 -0
  29. package/kitten/src/cli/commands/stop.d.ts +9 -0
  30. package/kitten/src/cli/commands/uninstall.d.ts +9 -0
  31. package/kitten/src/cli/commands/update.d.ts +7 -0
  32. package/kitten/src/cli/index.d.ts +55 -0
  33. package/kitten/src/cli/lib/WarningBox.d.ts +8 -0
  34. package/kitten/src/cli/lib/header.d.ts +10 -0
  35. package/kitten/src/components/SvgSpinner.component.d.ts +9 -0
  36. package/kitten/src/lib/KittenComponent.d.ts +340 -0
  37. package/kitten/src/lib/KittenMoji.d.ts +35 -0
  38. package/kitten/src/lib/KittenPackage.d.ts +56 -0
  39. package/kitten/src/lib/KittenPage.d.ts +202 -0
  40. package/kitten/src/lib/Version.d.ts +49 -0
  41. package/kitten/src/lib/ansi-highlight-html.d.ts +5 -0
  42. package/kitten/src/lib/components/stateful/CopyButton.component.d.ts +14 -0
  43. package/kitten/src/lib/components/stateless/copyButton.component.d.ts +21 -0
  44. package/kitten/src/lib/crypto.d.ts +95 -0
  45. package/kitten/src/lib/deploy.d.ts +20 -0
  46. package/kitten/src/lib/ensure.d.ts +28 -0
  47. package/kitten/src/lib/fragments.d.ts +1 -0
  48. package/kitten/src/lib/globals.d.ts +10 -0
  49. package/kitten/src/lib/html.d.ts +61 -0
  50. package/kitten/src/lib/markdown.d.ts +16 -0
  51. package/kitten/src/lib/paths.d.ts +25 -0
  52. package/kitten/src/lib/service-status.d.ts +14 -0
  53. package/kitten/src/lib/system-exit-codes.d.ts +39 -0
  54. package/kitten/src/lib/terminal-link.d.ts +24 -0
  55. package/kitten/src/middleware/authentication.d.ts +8 -0
  56. package/kitten/src/middleware/index.d.ts +5 -0
  57. package/kitten/src/middleware/request-and-response-helpers.d.ts +6 -0
  58. package/kitten/src/middleware/request-log.d.ts +10 -0
  59. package/kitten/src/middleware/sessions.d.ts +3 -0
  60. package/kitten/src/middleware/stats.d.ts +8 -0
  61. package/kitten/src/middleware/trailing-slashes.d.ts +11 -0
  62. package/kitten/src/middleware/websocket.d.ts +14 -0
  63. package/kitten/src/routes/HttpRoute.d.ts +16 -0
  64. package/kitten/src/routes/LazilyLoadedRoute.d.ts +15 -0
  65. package/kitten/src/routes/PageRoute.d.ts +54 -0
  66. package/kitten/src/routes/PageSocketRoute.d.ts +42 -0
  67. package/kitten/src/routes/PostRoute.d.ts +64 -0
  68. package/kitten/src/routes/StaticRoute.d.ts +17 -0
  69. package/kitten/src/routes/WebSocketRoute.d.ts +21 -0
  70. package/kitten/src/routes/lib/validator.d.ts +18 -0
  71. package/kitten/src/types/fragments.d.ts +14 -0
  72. package/kitten/src/types/globals.d.ts +1239 -0
  73. package/kitten/src/types/index.d.ts +12 -0
  74. package/kitten/src/types/types.d.ts +476 -0
  75. package/kitten/third-party-libraries-with-missing-type-information/index.d.ts +37 -0
  76. package/package.json +18 -5
  77. package/types.d.ts +5 -712
  78. package/polka/index.d.ts +0 -111
  79. package/slugify/index.d.ts +0 -246
  80. /package/{ws → kitten/third-party-libraries-with-missing-type-information/ws}/index.d.ts +0 -0
package/polka/index.d.ts DELETED
@@ -1,111 +0,0 @@
1
- import type { IncomingMessage, ServerResponse } from 'http';
2
- import type { ListenOptions, Server } from 'net';
3
-
4
- // Parsed URL
5
-
6
- declare interface ParsedURL {
7
- pathname: string;
8
- search: string;
9
- query: Record<string, string | string[]> | void;
10
- raw: string;
11
- }
12
-
13
- declare function parse(req: IncomingMessage): ParsedURL;
14
-
15
-
16
- // Trouter
17
-
18
- // Thank you: @fwilkerson, @stahlstift
19
- // ---
20
-
21
- /** @type {import('http').METHODS} */
22
- type Methods = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' |'M-SEARCH' | 'MERGE' | 'MKACTIVITY' |'MKCALENDAR' | 'MKCOL' | 'MOVE' |'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' | 'PRI' | 'PROPFIND' | 'PROPPATCH' | 'PURGE' | 'PUT' | 'REBIND' | 'REPORT' | 'SEARCH' | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' | 'UNSUBSCRIBE';
23
-
24
- type Pattern = RegExp | string;
25
-
26
- declare class Trouter<T = Function> {
27
- find(method: Methods, url: string): {
28
- params: Record<string, string>;
29
- handlers: T[];
30
- };
31
- add(method: Methods, pattern: Pattern, ...handlers: T[]): this;
32
- use(pattern: Pattern, ...handlers: T[]): this;
33
- all(pattern: Pattern, ...handlers: T[]): this;
34
- get(pattern: Pattern, ...handlers: T[]): this;
35
- head(pattern: Pattern, ...handlers: T[]): this;
36
- patch(pattern: Pattern, ...handlers: T[]): this;
37
- options(pattern: Pattern, ...handlers: T[]): this;
38
- connect(pattern: Pattern, ...handlers: T[]): this;
39
- delete(pattern: Pattern, ...handlers: T[]): this;
40
- trace(pattern: Pattern, ...handlers: T[]): this;
41
- post(pattern: Pattern, ...handlers: T[]): this;
42
- put(pattern: Pattern, ...handlers: T[]): this;
43
- }
44
-
45
- // Polka
46
-
47
- type Promisable<T> = Promise<T> | T;
48
- type ListenCallback = () => Promisable<void>;
49
-
50
- declare namespace polka {
51
- export interface IError extends Error {
52
- code?: number;
53
- status?: number;
54
- details?: any;
55
- }
56
-
57
- export type NextHandler = (err?: string | IError) => Promisable<void>;
58
- export type ErrorHandler<T extends Request = Request> = (err: string | IError, req: T, res: Response, next: NextHandler) => Promisable<void>;
59
- export type Middleware<T extends IncomingMessage = Request> = (req: T & Request, res: Response, next: NextHandler) => Promisable<void>;
60
-
61
- export interface IOptions<T extends Request = Request> {
62
- server?: Server;
63
- onNoMatch?: Middleware<T>;
64
- onError?: ErrorHandler<T>;
65
- }
66
-
67
- export type Response = ServerResponse;
68
-
69
- export interface Request extends IncomingMessage {
70
- url: string;
71
- method: string;
72
- originalUrl: string;
73
- params: Record<string, string>;
74
- path: string;
75
- search: string;
76
- query: Record<string,string>;
77
- body?: any;
78
- _decoded?: true;
79
- _parsedUrl: ParsedURL;
80
- }
81
-
82
- export interface Polka<T extends Request = Request> extends Trouter<Middleware<T>> {
83
- readonly server: Server;
84
- readonly wares: Middleware<T>[];
85
-
86
- readonly onError: ErrorHandler<T>;
87
- readonly onNoMatch: Middleware<T>;
88
-
89
- readonly handler: Middleware<T>;
90
- parse: (req: IncomingMessage) => ParsedURL;
91
-
92
- use(pattern: RegExp|string, ...handlers: (Polka<T> | Middleware<T>)[]): this;
93
- use(...handlers: (Polka<T> | Middleware<T>)[]): this;
94
-
95
- listen(port?: number, hostname?: string, backlog?: number, callback?: ListenCallback): this;
96
- listen(port?: number, hostname?: string, callback?: ListenCallback): this;
97
- listen(port?: number, backlog?: number, callback?: ListenCallback): this;
98
- listen(port?: number, callback?: ListenCallback): this;
99
- listen(path: string, backlog?: number, callback?: ListenCallback): this;
100
- listen(path: string, callback?: ListenCallback): this;
101
- listen(options: ListenOptions, callback?: ListenCallback): this;
102
- listen(handle: any, backlog?: number, callback?: ListenCallback): this;
103
- listen(handle: any, callback?: ListenCallback): this;
104
- }
105
- }
106
-
107
- declare function polka<T extends polka.Request = polka.Request>(
108
- options?: polka.IOptions<T>
109
- ): polka.Polka<T>;
110
-
111
- export default polka;
@@ -1,246 +0,0 @@
1
- export interface Options {
2
- /**
3
- @default '-'
4
-
5
- @example
6
- ```
7
- import slugify from '@sindresorhus/slugify';
8
-
9
- slugify('BAR and baz');
10
- //=> 'bar-and-baz'
11
-
12
- slugify('BAR and baz', {separator: '_'});
13
- //=> 'bar_and_baz'
14
-
15
- slugify('BAR and baz', {separator: ''});
16
- //=> 'barandbaz'
17
- ```
18
- */
19
- readonly separator?: string;
20
-
21
- /**
22
- Make the slug lowercase.
23
-
24
- @default true
25
-
26
- @example
27
- ```
28
- import slugify from '@sindresorhus/slugify';
29
-
30
- slugify('Déjà Vu!');
31
- //=> 'deja-vu'
32
-
33
- slugify('Déjà Vu!', {lowercase: false});
34
- //=> 'Deja-Vu'
35
- ```
36
- */
37
- readonly lowercase?: boolean;
38
-
39
- /**
40
- Convert camelcase to separate words. Internally it does `fooBar` → `foo bar`.
41
-
42
- @default true
43
-
44
- @example
45
- ```
46
- import slugify from '@sindresorhus/slugify';
47
-
48
- slugify('fooBar');
49
- //=> 'foo-bar'
50
-
51
- slugify('fooBar', {decamelize: false});
52
- //=> 'foobar'
53
- ```
54
- */
55
- readonly decamelize?: boolean;
56
-
57
- /**
58
- Add your own custom replacements.
59
-
60
- The replacements are run on the original string before any other transformations.
61
-
62
- This only overrides a default replacement if you set an item with the same key, like `&`.
63
-
64
- Add a leading and trailing space to the replacement to have it separated by dashes.
65
-
66
- @default [ ['&', ' and '], ['🦄', ' unicorn '], ['♥', ' love '] ]
67
-
68
- @example
69
- ```
70
- import slugify from '@sindresorhus/slugify';
71
-
72
- slugify('Foo@unicorn', {
73
- customReplacements: [
74
- ['@', 'at']
75
- ]
76
- });
77
- //=> 'fooatunicorn'
78
-
79
- slugify('foo@unicorn', {
80
- customReplacements: [
81
- ['@', ' at ']
82
- ]
83
- });
84
- //=> 'foo-at-unicorn'
85
-
86
- slugify('I love 🐶', {
87
- customReplacements: [
88
- ['🐶', 'dogs']
89
- ]
90
- });
91
- //=> 'i-love-dogs'
92
- ```
93
- */
94
- readonly customReplacements?: ReadonlyArray<[string, string]>;
95
-
96
- /**
97
- If your string starts with an underscore, it will be preserved in the slugified string.
98
-
99
- Sometimes leading underscores are intentional, for example, filenames representing hidden paths on a website.
100
-
101
- @default false
102
-
103
- @example
104
- ```
105
- import slugify from '@sindresorhus/slugify';
106
-
107
- slugify('_foo_bar');
108
- //=> 'foo-bar'
109
-
110
- slugify('_foo_bar', {preserveLeadingUnderscore: true});
111
- //=> '_foo-bar'
112
- ```
113
- */
114
- readonly preserveLeadingUnderscore?: boolean;
115
-
116
- /**
117
- If your string ends with a dash, it will be preserved in the slugified string.
118
-
119
- For example, using slugify on an input field would allow for validation while not preventing the user from writing a slug.
120
-
121
- @default false
122
-
123
- @example
124
- ```
125
- import slugify from '@sindresorhus/slugify';
126
-
127
- slugify('foo-bar-');
128
- //=> 'foo-bar'
129
-
130
- slugify('foo-bar-', {preserveTrailingDash: true});
131
- //=> 'foo-bar-'
132
- ```
133
- */
134
- readonly preserveTrailingDash?: boolean;
135
-
136
- /**
137
- Preserve certain characters.
138
-
139
- It cannot contain the `separator`.
140
-
141
- For example, if you want to slugify URLs, but preserve the HTML fragment `#` character, you could set `preserveCharacters: ['#']`.
142
-
143
- @default []
144
-
145
- @example
146
- ```
147
- import slugify from '@sindresorhus/slugify';
148
-
149
- slugify('foo_bar#baz', {preserveCharacters: ['#']});
150
- //=> 'foo-bar#baz'
151
- ```
152
- */
153
- readonly preserveCharacters?: string[];
154
- }
155
-
156
- /**
157
- Slugify a string.
158
-
159
- @param string - String to slugify.
160
-
161
- @example
162
- ```
163
- import slugify from '@sindresorhus/slugify';
164
-
165
- slugify('I ♥ Dogs');
166
- //=> 'i-love-dogs'
167
-
168
- slugify(' Déjà Vu! ');
169
- //=> 'deja-vu'
170
-
171
- slugify('fooBar 123 $#%');
172
- //=> 'foo-bar-123'
173
-
174
- slugify('я люблю единорогов');
175
- //=> 'ya-lyublyu-edinorogov'
176
- ```
177
- */
178
- export default function slugify(string: string, options?: Options): string;
179
-
180
- export interface CountableSlugify {
181
- /**
182
- Reset the counter.
183
-
184
- @example
185
- ```
186
- import {slugifyWithCounter} from '@sindresorhus/slugify';
187
-
188
- const slugify = slugifyWithCounter();
189
-
190
- slugify('foo bar');
191
- //=> 'foo-bar'
192
-
193
- slugify('foo bar');
194
- //=> 'foo-bar-2'
195
-
196
- slugify.reset();
197
-
198
- slugify('foo bar');
199
- //=> 'foo-bar'
200
- ```
201
- */
202
- reset: () => void;
203
-
204
- /**
205
- Returns a new instance of `slugify(string, options?)` with a counter to handle multiple occurrences of the same string.
206
-
207
- @param string - String to slugify.
208
-
209
- @example
210
- ```
211
- import {slugifyWithCounter} from '@sindresorhus/slugify';
212
-
213
- const slugify = slugifyWithCounter();
214
-
215
- slugify('foo bar');
216
- //=> 'foo-bar'
217
-
218
- slugify('foo bar');
219
- //=> 'foo-bar-2'
220
-
221
- slugify.reset();
222
-
223
- slugify('foo bar');
224
- //=> 'foo-bar'
225
- ```
226
-
227
- __Use case example of counter__
228
-
229
- If, for example, you have a document with multiple sections where each subsection has an example.
230
-
231
- ```
232
- ## Section 1
233
-
234
- ### Example
235
-
236
- ## Section 2
237
-
238
- ### Example
239
- ```
240
-
241
- You can then use `slugifyWithCounter()` to generate unique HTML `id`'s to ensure anchors will link to the right headline.
242
- */
243
- (string: string, options?: Options): string;
244
- }
245
-
246
- export function slugifyWithCounter(): CountableSlugify;