@platformatic/react-router 0.0.1 → 3.29.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.
package/config.d.ts ADDED
@@ -0,0 +1,613 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export interface PlatformaticReactRouterConfig {
9
+ $schema?: string;
10
+ logger?: {
11
+ level: (
12
+ | ("fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent")
13
+ | {
14
+ [k: string]: unknown;
15
+ }
16
+ ) &
17
+ string;
18
+ transport?:
19
+ | {
20
+ target?: string;
21
+ options?: {
22
+ [k: string]: unknown;
23
+ };
24
+ }
25
+ | {
26
+ targets?: {
27
+ target?: string;
28
+ options?: {
29
+ [k: string]: unknown;
30
+ };
31
+ level?: string;
32
+ }[];
33
+ options?: {
34
+ [k: string]: unknown;
35
+ };
36
+ };
37
+ pipeline?: {
38
+ target?: string;
39
+ options?: {
40
+ [k: string]: unknown;
41
+ };
42
+ };
43
+ formatters?: {
44
+ path: string;
45
+ };
46
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
47
+ redact?: {
48
+ paths: string[];
49
+ censor?: string;
50
+ };
51
+ base?: {
52
+ [k: string]: unknown;
53
+ } | null;
54
+ messageKey?: string;
55
+ customLevels?: {
56
+ [k: string]: unknown;
57
+ };
58
+ [k: string]: unknown;
59
+ };
60
+ server?: {
61
+ hostname?: string;
62
+ port?: number | string;
63
+ /**
64
+ * The maximum length of the queue of pending connections
65
+ */
66
+ backlog?: number;
67
+ http2?: boolean;
68
+ https?: {
69
+ allowHTTP1?: boolean;
70
+ key:
71
+ | string
72
+ | {
73
+ path?: string;
74
+ }
75
+ | (
76
+ | string
77
+ | {
78
+ path?: string;
79
+ }
80
+ )[];
81
+ cert:
82
+ | string
83
+ | {
84
+ path?: string;
85
+ }
86
+ | (
87
+ | string
88
+ | {
89
+ path?: string;
90
+ }
91
+ )[];
92
+ requestCert?: boolean;
93
+ rejectUnauthorized?: boolean;
94
+ };
95
+ };
96
+ watch?:
97
+ | {
98
+ enabled?: boolean | string;
99
+ /**
100
+ * @minItems 1
101
+ */
102
+ allow?: [string, ...string[]];
103
+ ignore?: string[];
104
+ }
105
+ | boolean
106
+ | string;
107
+ application?: {
108
+ basePath?: string;
109
+ outputDirectory?: string;
110
+ include?: string[];
111
+ commands?: {
112
+ install?: string;
113
+ build?: string;
114
+ development?: string;
115
+ production?: string;
116
+ };
117
+ };
118
+ runtime?: {
119
+ preload?: string | string[];
120
+ basePath?: string;
121
+ services?: {
122
+ [k: string]: unknown;
123
+ }[];
124
+ workers?:
125
+ | number
126
+ | string
127
+ | {
128
+ static?: number;
129
+ dynamic?: boolean;
130
+ minimum?: number;
131
+ maximum?: number;
132
+ total?: number;
133
+ maxMemory?: number;
134
+ cooldown?: number;
135
+ gracePeriod?: number;
136
+ [k: string]: unknown;
137
+ };
138
+ workersRestartDelay?: number | string;
139
+ logger?: {
140
+ level: (
141
+ | ("fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent")
142
+ | {
143
+ [k: string]: unknown;
144
+ }
145
+ ) &
146
+ string;
147
+ transport?:
148
+ | {
149
+ target?: string;
150
+ options?: {
151
+ [k: string]: unknown;
152
+ };
153
+ }
154
+ | {
155
+ targets?: {
156
+ target?: string;
157
+ options?: {
158
+ [k: string]: unknown;
159
+ };
160
+ level?: string;
161
+ }[];
162
+ options?: {
163
+ [k: string]: unknown;
164
+ };
165
+ };
166
+ pipeline?: {
167
+ target?: string;
168
+ options?: {
169
+ [k: string]: unknown;
170
+ };
171
+ };
172
+ formatters?: {
173
+ path: string;
174
+ };
175
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
176
+ redact?: {
177
+ paths: string[];
178
+ censor?: string;
179
+ };
180
+ base?: {
181
+ [k: string]: unknown;
182
+ } | null;
183
+ messageKey?: string;
184
+ customLevels?: {
185
+ [k: string]: unknown;
186
+ };
187
+ [k: string]: unknown;
188
+ };
189
+ server?: {
190
+ hostname?: string;
191
+ port?: number | string;
192
+ /**
193
+ * The maximum length of the queue of pending connections
194
+ */
195
+ backlog?: number;
196
+ http2?: boolean;
197
+ https?: {
198
+ allowHTTP1?: boolean;
199
+ key:
200
+ | string
201
+ | {
202
+ path?: string;
203
+ }
204
+ | (
205
+ | string
206
+ | {
207
+ path?: string;
208
+ }
209
+ )[];
210
+ cert:
211
+ | string
212
+ | {
213
+ path?: string;
214
+ }
215
+ | (
216
+ | string
217
+ | {
218
+ path?: string;
219
+ }
220
+ )[];
221
+ requestCert?: boolean;
222
+ rejectUnauthorized?: boolean;
223
+ };
224
+ };
225
+ reuseTcpPorts?: boolean;
226
+ startTimeout?: number;
227
+ restartOnError?: boolean | number;
228
+ exitOnUnhandledErrors?: boolean;
229
+ gracefulShutdown?: {
230
+ runtime: number | string;
231
+ application: number | string;
232
+ };
233
+ health?: {
234
+ enabled?: boolean | string;
235
+ interval?: number | string;
236
+ gracePeriod?: number | string;
237
+ maxUnhealthyChecks?: number | string;
238
+ maxELU?: number | string;
239
+ maxHeapUsed?: number | string;
240
+ maxHeapTotal?: number | string;
241
+ maxYoungGeneration?: number | string;
242
+ codeRangeSize?: number | string;
243
+ };
244
+ undici?: {
245
+ agentOptions?: {
246
+ [k: string]: unknown;
247
+ };
248
+ interceptors?:
249
+ | {
250
+ module: string;
251
+ options: {
252
+ [k: string]: unknown;
253
+ };
254
+ [k: string]: unknown;
255
+ }[]
256
+ | {
257
+ Client?: {
258
+ module: string;
259
+ options: {
260
+ [k: string]: unknown;
261
+ };
262
+ [k: string]: unknown;
263
+ }[];
264
+ Pool?: {
265
+ module: string;
266
+ options: {
267
+ [k: string]: unknown;
268
+ };
269
+ [k: string]: unknown;
270
+ }[];
271
+ Agent?: {
272
+ module: string;
273
+ options: {
274
+ [k: string]: unknown;
275
+ };
276
+ [k: string]: unknown;
277
+ }[];
278
+ [k: string]: unknown;
279
+ };
280
+ [k: string]: unknown;
281
+ };
282
+ httpCache?:
283
+ | boolean
284
+ | {
285
+ store?: string;
286
+ /**
287
+ * @minItems 1
288
+ */
289
+ methods?: [string, ...string[]];
290
+ cacheTagsHeader?: string;
291
+ maxSize?: number;
292
+ maxEntrySize?: number;
293
+ maxCount?: number;
294
+ [k: string]: unknown;
295
+ };
296
+ watch?: boolean | string;
297
+ managementApi?:
298
+ | boolean
299
+ | string
300
+ | {
301
+ logs?: {
302
+ maxSize?: number;
303
+ };
304
+ };
305
+ metrics?:
306
+ | boolean
307
+ | {
308
+ port?: number | string;
309
+ enabled?: boolean | string;
310
+ hostname?: string;
311
+ endpoint?: string;
312
+ auth?: {
313
+ username: string;
314
+ password: string;
315
+ };
316
+ labels?: {
317
+ [k: string]: string;
318
+ };
319
+ /**
320
+ * The label name to use for the application identifier in metrics (e.g., applicationId, serviceId)
321
+ */
322
+ applicationLabel?: string;
323
+ readiness?:
324
+ | boolean
325
+ | {
326
+ endpoint?: string;
327
+ success?: {
328
+ statusCode?: number;
329
+ body?: string;
330
+ };
331
+ fail?: {
332
+ statusCode?: number;
333
+ body?: string;
334
+ };
335
+ };
336
+ liveness?:
337
+ | boolean
338
+ | {
339
+ endpoint?: string;
340
+ success?: {
341
+ statusCode?: number;
342
+ body?: string;
343
+ };
344
+ fail?: {
345
+ statusCode?: number;
346
+ body?: string;
347
+ };
348
+ };
349
+ healthChecksTimeouts?: number | string;
350
+ plugins?: string[];
351
+ timeout?: number | string;
352
+ /**
353
+ * Configuration for exporting metrics to an OTLP endpoint
354
+ */
355
+ otlpExporter?: {
356
+ /**
357
+ * Enable or disable OTLP metrics export
358
+ */
359
+ enabled?: boolean | string;
360
+ /**
361
+ * OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)
362
+ */
363
+ endpoint: string;
364
+ /**
365
+ * Interval in milliseconds between metric pushes
366
+ */
367
+ interval?: number | string;
368
+ /**
369
+ * Additional HTTP headers for authentication
370
+ */
371
+ headers?: {
372
+ [k: string]: string;
373
+ };
374
+ /**
375
+ * Service name for OTLP resource attributes
376
+ */
377
+ serviceName?: string;
378
+ /**
379
+ * Service version for OTLP resource attributes
380
+ */
381
+ serviceVersion?: string;
382
+ };
383
+ };
384
+ telemetry?: {
385
+ enabled?: boolean | string;
386
+ /**
387
+ * The name of the application. Defaults to the folder name if not specified.
388
+ */
389
+ applicationName: string;
390
+ /**
391
+ * The version of the application (optional)
392
+ */
393
+ version?: string;
394
+ /**
395
+ * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
396
+ */
397
+ skip?: {
398
+ /**
399
+ * The path to skip. Can be a string or a regex.
400
+ */
401
+ path?: string;
402
+ /**
403
+ * HTTP method to skip
404
+ */
405
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
406
+ [k: string]: unknown;
407
+ }[];
408
+ exporter?:
409
+ | {
410
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
411
+ /**
412
+ * Options for the exporter. These are passed directly to the exporter.
413
+ */
414
+ options?: {
415
+ /**
416
+ * The URL to send the traces to. Not used for console or memory exporters.
417
+ */
418
+ url?: string;
419
+ /**
420
+ * Headers to send to the exporter. Not used for console or memory exporters.
421
+ */
422
+ headers?: {
423
+ [k: string]: unknown;
424
+ };
425
+ /**
426
+ * The path to write the traces to. Only for file exporter.
427
+ */
428
+ path?: string;
429
+ [k: string]: unknown;
430
+ };
431
+ additionalProperties?: never;
432
+ [k: string]: unknown;
433
+ }[]
434
+ | {
435
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
436
+ /**
437
+ * Options for the exporter. These are passed directly to the exporter.
438
+ */
439
+ options?: {
440
+ /**
441
+ * The URL to send the traces to. Not used for console or memory exporters.
442
+ */
443
+ url?: string;
444
+ /**
445
+ * Headers to send to the exporter. Not used for console or memory exporters.
446
+ */
447
+ headers?: {
448
+ [k: string]: unknown;
449
+ };
450
+ /**
451
+ * The path to write the traces to. Only for file exporter.
452
+ */
453
+ path?: string;
454
+ [k: string]: unknown;
455
+ };
456
+ additionalProperties?: never;
457
+ [k: string]: unknown;
458
+ };
459
+ };
460
+ verticalScaler?: {
461
+ enabled?: boolean;
462
+ maxTotalWorkers?: number;
463
+ maxTotalMemory?: number;
464
+ minWorkers?: number;
465
+ maxWorkers?: number;
466
+ cooldownSec?: number;
467
+ gracePeriod?: number;
468
+ /**
469
+ * @deprecated
470
+ */
471
+ scaleUpELU?: number;
472
+ /**
473
+ * @deprecated
474
+ */
475
+ scaleDownELU?: number;
476
+ /**
477
+ * @deprecated
478
+ */
479
+ timeWindowSec?: number;
480
+ /**
481
+ * @deprecated
482
+ */
483
+ scaleDownTimeWindowSec?: number;
484
+ /**
485
+ * @deprecated
486
+ */
487
+ scaleIntervalSec?: number;
488
+ };
489
+ inspectorOptions?: {
490
+ host?: string;
491
+ port?: number;
492
+ breakFirstLine?: boolean;
493
+ watchDisabled?: boolean;
494
+ [k: string]: unknown;
495
+ };
496
+ applicationTimeout?: number | string;
497
+ messagingTimeout?: number | string;
498
+ env?: {
499
+ [k: string]: string;
500
+ };
501
+ sourceMaps?: boolean;
502
+ nodeModulesSourceMaps?: string[];
503
+ scheduler?: {
504
+ enabled?: boolean | string;
505
+ name: string;
506
+ cron: string;
507
+ callbackUrl: string;
508
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
509
+ headers?: {
510
+ [k: string]: string;
511
+ };
512
+ body?:
513
+ | string
514
+ | {
515
+ [k: string]: unknown;
516
+ };
517
+ maxRetries?: number;
518
+ [k: string]: unknown;
519
+ }[];
520
+ policies?: {
521
+ deny: {
522
+ /**
523
+ * This interface was referenced by `undefined`'s JSON-Schema definition
524
+ * via the `patternProperty` "^.*$".
525
+ */
526
+ [k: string]: string | [string, ...string[]];
527
+ };
528
+ };
529
+ application?: {
530
+ reuseTcpPorts?: boolean;
531
+ workers?:
532
+ | number
533
+ | string
534
+ | {
535
+ static?: number;
536
+ minimum?: number;
537
+ maximum?: number;
538
+ [k: string]: unknown;
539
+ };
540
+ health?: {
541
+ enabled?: boolean | string;
542
+ interval?: number | string;
543
+ gracePeriod?: number | string;
544
+ maxUnhealthyChecks?: number | string;
545
+ maxELU?: number | string;
546
+ maxHeapUsed?: number | string;
547
+ maxHeapTotal?: number | string;
548
+ maxYoungGeneration?: number | string;
549
+ codeRangeSize?: number | string;
550
+ };
551
+ arguments?: string[];
552
+ env?: {
553
+ [k: string]: string;
554
+ };
555
+ envfile?: string;
556
+ sourceMaps?: boolean;
557
+ nodeModulesSourceMaps?: string[];
558
+ packageManager?: "npm" | "pnpm" | "yarn";
559
+ preload?: string | string[];
560
+ nodeOptions?: string;
561
+ execArgv?: string[];
562
+ permissions?: {
563
+ fs?: {
564
+ read?: string[];
565
+ write?: string[];
566
+ };
567
+ };
568
+ telemetry?: {
569
+ /**
570
+ * An array of instrumentations loaded if telemetry is enabled
571
+ */
572
+ instrumentations?: (
573
+ | string
574
+ | {
575
+ package: string;
576
+ exportName?: string;
577
+ options?: {
578
+ [k: string]: unknown;
579
+ };
580
+ [k: string]: unknown;
581
+ }
582
+ )[];
583
+ [k: string]: unknown;
584
+ };
585
+ };
586
+ };
587
+ vite?: {
588
+ configFile?: string | boolean;
589
+ devServer?: {
590
+ strict?: boolean;
591
+ };
592
+ ssr?:
593
+ | {
594
+ enabled?: boolean;
595
+ entrypoint: string;
596
+ clientDirectory?: string;
597
+ serverDirectory?: string;
598
+ }
599
+ | boolean;
600
+ notFoundHandler?:
601
+ | boolean
602
+ | string
603
+ | {
604
+ enabled?: boolean;
605
+ path?: string;
606
+ contentType?: string;
607
+ statusCode?: number;
608
+ };
609
+ };
610
+ reactRouter?: {
611
+ outputDirectory?: string;
612
+ };
613
+ }
@@ -0,0 +1,5 @@
1
+ import neostandard from 'neostandard'
2
+
3
+ export default neostandard({
4
+ ignores: ['**/.vite', '**/tmp']
5
+ })
package/index.js ADDED
@@ -0,0 +1,31 @@
1
+ import { transform as basicTransform, resolve, validationOptions } from '@platformatic/basic'
2
+ import { kMetadata, loadConfiguration as utilsLoadConfiguration } from '@platformatic/foundation'
3
+ import { ReactRouterCapability } from './lib/capability.js'
4
+ import { schema } from './lib/schema.js'
5
+
6
+ /* c8 ignore next 5 */
7
+ export async function transform (config, schema, options) {
8
+ config = await basicTransform(config, schema, options)
9
+ config.watch = { enabled: false }
10
+ return config
11
+ }
12
+
13
+ export async function loadConfiguration (configOrRoot, sourceOrConfig, context) {
14
+ const { root, source } = await resolve(configOrRoot, sourceOrConfig, 'application')
15
+
16
+ return utilsLoadConfiguration(source, context?.schema ?? schema, {
17
+ validationOptions,
18
+ transform,
19
+ replaceEnv: true,
20
+ root,
21
+ ...context
22
+ })
23
+ }
24
+
25
+ export async function create (configOrRoot, sourceOrConfig, context) {
26
+ const config = await loadConfiguration(configOrRoot, sourceOrConfig, context)
27
+ return new ReactRouterCapability(config[kMetadata].root, config, context)
28
+ }
29
+
30
+ export * from './lib/capability.js'
31
+ export { packageJson, schema, schemaComponents, version } from './lib/schema.js'