website
git clone https://git.pyrossh.dev/website
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
1e1dc9d
— pyrossh
2026-07-07T12:19:44+05:30
feat: add dev router worker
packages/workers/dev-router/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pyrossh/dev-router",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@pyrossh/assets": "workspace:*",
|
|
9
|
+
"@pyrossh/cv": "workspace:*",
|
|
10
|
+
"@pyrossh/home": "workspace:*",
|
|
11
|
+
"@pyrossh/not-found": "workspace:*",
|
|
12
|
+
"@pyrossh/only-bible-app-index": "workspace:*",
|
|
13
|
+
"@pyrossh/only-bible-app-privacy": "workspace:*",
|
|
14
|
+
"@pyrossh/only-bible-app-terms": "workspace:*",
|
|
15
|
+
"@pyrossh/posts": "workspace:*",
|
|
16
|
+
"@pyrossh/posts-detail": "workspace:*",
|
|
17
|
+
"@pyrossh/repos-commits-detail": "workspace:*",
|
|
18
|
+
"@pyrossh/repos-commits-index": "workspace:*",
|
|
19
|
+
"@pyrossh/repos-files-blame": "workspace:*",
|
|
20
|
+
"@pyrossh/repos-files-detail": "workspace:*",
|
|
21
|
+
"@pyrossh/repos-files-history": "workspace:*",
|
|
22
|
+
"@pyrossh/repos-files-index": "workspace:*",
|
|
23
|
+
"@pyrossh/repos-issues-detail": "workspace:*",
|
|
24
|
+
"@pyrossh/repos-issues-index": "workspace:*",
|
|
25
|
+
"@pyrossh/repos-readme": "workspace:*",
|
|
26
|
+
"@pyrossh/robots": "workspace:*",
|
|
27
|
+
"@pyrossh/rss": "workspace:*",
|
|
28
|
+
"@pyrossh/server-error": "workspace:*"
|
|
29
|
+
}
|
|
30
|
+
}
|
packages/workers/dev-router/src/index.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import home from "@pyrossh/home";
|
|
2
|
+
import cv from "@pyrossh/cv";
|
|
3
|
+
import blogList from "@pyrossh/posts";
|
|
4
|
+
import blogDetail from "@pyrossh/posts-detail";
|
|
5
|
+
import repoReadme from "@pyrossh/repos-readme";
|
|
6
|
+
import repoCommits from "@pyrossh/repos-commits-index";
|
|
7
|
+
import repoCommitDetail from "@pyrossh/repos-commits-detail";
|
|
8
|
+
import repoFiles from "@pyrossh/repos-files-index";
|
|
9
|
+
import repoFileDetail from "@pyrossh/repos-files-detail";
|
|
10
|
+
import repoFileHistory from "@pyrossh/repos-files-history";
|
|
11
|
+
import repoFileBlame from "@pyrossh/repos-files-blame";
|
|
12
|
+
import repoIssues from "@pyrossh/repos-issues-index";
|
|
13
|
+
import repoIssueDetail from "@pyrossh/repos-issues-detail";
|
|
14
|
+
import onlyBible from "@pyrossh/only-bible-app-index";
|
|
15
|
+
import onlyBiblePrivacy from "@pyrossh/only-bible-app-privacy";
|
|
16
|
+
import onlyBibleTerms from "@pyrossh/only-bible-app-terms";
|
|
17
|
+
import assetsWorker from "@pyrossh/assets";
|
|
18
|
+
import robots from "@pyrossh/robots";
|
|
19
|
+
import rss from "@pyrossh/rss";
|
|
20
|
+
import notFound from "@pyrossh/not-found";
|
|
21
|
+
import serverError from "@pyrossh/server-error";
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
type WorkerModule = { fetch: (...args: any[]) => Promise<Response> };
|
|
25
|
+
|
|
26
|
+
interface Route {
|
|
27
|
+
pattern: RegExp;
|
|
28
|
+
worker: WorkerModule;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const routes: Route[] = [
|
|
32
|
+
{ pattern: /^\/robots\.txt$/, worker: robots },
|
|
33
|
+
{ pattern: /^\/rss\.xml$/, worker: rss },
|
|
34
|
+
{ pattern: /^\/$/, worker: home },
|
|
35
|
+
{ pattern: /^\/cv$/, worker: cv },
|
|
36
|
+
{ pattern: /^\/posts\/(.+)$/, worker: blogDetail },
|
|
37
|
+
{ pattern: /^\/posts$/, worker: blogList },
|
|
38
|
+
{ pattern: /^\/repos\/[^/]+\/issues\/[^/]+$/, worker: repoIssueDetail },
|
|
39
|
+
{ pattern: /^\/repos\/[^/]+\/issues$/, worker: repoIssues },
|
|
40
|
+
{ pattern: /^\/repos\/[^/]+\/commits\/[^/]+$/, worker: repoCommitDetail },
|
|
41
|
+
{ pattern: /^\/repos\/[^/]+\/commits$/, worker: repoCommits },
|
|
42
|
+
{ pattern: /^\/repos\/[^/]+\/files\/.+\/history$/, worker: repoFileHistory },
|
|
43
|
+
{ pattern: /^\/repos\/[^/]+\/files\/.+\/blame$/, worker: repoFileBlame },
|
|
44
|
+
{ pattern: /^\/repos\/[^/]+\/files\/.+$/, worker: repoFileDetail },
|
|
45
|
+
{ pattern: /^\/repos\/[^/]+\/files$/, worker: repoFiles },
|
|
46
|
+
{ pattern: /^\/repos\/.+$/, worker: repoReadme },
|
|
47
|
+
{ pattern: /^\/only-bible-app\/privacy-policy$/, worker: onlyBiblePrivacy },
|
|
48
|
+
{ pattern: /^\/only-bible-app\/terms-and-conditions$/, worker: onlyBibleTerms },
|
|
49
|
+
{ pattern: /^\/only-bible-app/, worker: onlyBible },
|
|
50
|
+
{ pattern: /^\/assets\/.+$/, worker: assetsWorker },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
async fetch(request: Request, env: unknown, ctx: ExecutionContext): Promise<Response> {
|
|
55
|
+
const url = new URL(request.url);
|
|
56
|
+
for (const route of routes) {
|
|
57
|
+
if (route.pattern.test(url.pathname)) {
|
|
58
|
+
try {
|
|
59
|
+
return await route.worker.fetch(request, env, ctx);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
console.error("dev-router error:", err);
|
|
62
|
+
return await serverError.fetch(request);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return await notFound.fetch(request);
|
|
67
|
+
},
|
|
68
|
+
};
|
packages/workers/dev-router/tsconfig.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"include": ["src"]
|
|
4
|
+
}
|
packages/workers/dev-router/wrangler.jsonc
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pyrossh-dev",
|
|
3
|
+
"main": "src/index.ts",
|
|
4
|
+
"compatibility_date": "2026-07-07",
|
|
5
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
6
|
+
"workers_dev": true,
|
|
7
|
+
"r2_buckets": [{ "binding": "REPOS", "bucket_name": "pyrossh-repos-prd" }],
|
|
8
|
+
}
|
pnpm-lock.yaml
CHANGED
|
@@ -375,6 +375,301 @@ importers:
|
|
|
375
375
|
specifier: ^0.3.1
|
|
376
376
|
version: 0.3.1
|
|
377
377
|
|
|
378
|
+
packages/workers/assets: {}
|
|
379
|
+
|
|
380
|
+
packages/workers/cv:
|
|
381
|
+
dependencies:
|
|
382
|
+
'@pyrossh/config':
|
|
383
|
+
specifier: workspace:*
|
|
384
|
+
version: link:../../shared/config
|
|
385
|
+
'@pyrossh/ui':
|
|
386
|
+
specifier: workspace:*
|
|
387
|
+
version: link:../../shared/ui
|
|
388
|
+
|
|
389
|
+
packages/workers/dev-router:
|
|
390
|
+
dependencies:
|
|
391
|
+
'@pyrossh/assets':
|
|
392
|
+
specifier: workspace:*
|
|
393
|
+
version: link:../assets
|
|
394
|
+
'@pyrossh/cv':
|
|
395
|
+
specifier: workspace:*
|
|
396
|
+
version: link:../cv
|
|
397
|
+
'@pyrossh/home':
|
|
398
|
+
specifier: workspace:*
|
|
399
|
+
version: link:../home
|
|
400
|
+
'@pyrossh/not-found':
|
|
401
|
+
specifier: workspace:*
|
|
402
|
+
version: link:../not-found
|
|
403
|
+
'@pyrossh/only-bible-app-index':
|
|
404
|
+
specifier: workspace:*
|
|
405
|
+
version: link:../only-bible-app/index
|
|
406
|
+
'@pyrossh/only-bible-app-privacy':
|
|
407
|
+
specifier: workspace:*
|
|
408
|
+
version: link:../only-bible-app/privacy
|
|
409
|
+
'@pyrossh/only-bible-app-terms':
|
|
410
|
+
specifier: workspace:*
|
|
411
|
+
version: link:../only-bible-app/terms
|
|
412
|
+
'@pyrossh/posts':
|
|
413
|
+
specifier: workspace:*
|
|
414
|
+
version: link:../posts/index
|
|
415
|
+
'@pyrossh/posts-detail':
|
|
416
|
+
specifier: workspace:*
|
|
417
|
+
version: link:../posts/detail
|
|
418
|
+
'@pyrossh/repos-commits-detail':
|
|
419
|
+
specifier: workspace:*
|
|
420
|
+
version: link:../repos/commits/detail
|
|
421
|
+
'@pyrossh/repos-commits-index':
|
|
422
|
+
specifier: workspace:*
|
|
423
|
+
version: link:../repos/commits/index
|
|
424
|
+
'@pyrossh/repos-files-blame':
|
|
425
|
+
specifier: workspace:*
|
|
426
|
+
version: link:../repos/files/blame
|
|
427
|
+
'@pyrossh/repos-files-detail':
|
|
428
|
+
specifier: workspace:*
|
|
429
|
+
version: link:../repos/files/detail
|
|
430
|
+
'@pyrossh/repos-files-history':
|
|
431
|
+
specifier: workspace:*
|
|
432
|
+
version: link:../repos/files/history
|
|
433
|
+
'@pyrossh/repos-files-index':
|
|
434
|
+
specifier: workspace:*
|
|
435
|
+
version: link:../repos/files/index
|
|
436
|
+
'@pyrossh/repos-issues-detail':
|
|
437
|
+
specifier: workspace:*
|
|
438
|
+
version: link:../repos/issues/detail
|
|
439
|
+
'@pyrossh/repos-issues-index':
|
|
440
|
+
specifier: workspace:*
|
|
441
|
+
version: link:../repos/issues/index
|
|
442
|
+
'@pyrossh/repos-readme':
|
|
443
|
+
specifier: workspace:*
|
|
444
|
+
version: link:../repos/readme
|
|
445
|
+
'@pyrossh/robots':
|
|
446
|
+
specifier: workspace:*
|
|
447
|
+
version: link:../robots
|
|
448
|
+
'@pyrossh/rss':
|
|
449
|
+
specifier: workspace:*
|
|
450
|
+
version: link:../rss
|
|
451
|
+
'@pyrossh/server-error':
|
|
452
|
+
specifier: workspace:*
|
|
453
|
+
version: link:../server-error
|
|
454
|
+
|
|
455
|
+
packages/workers/home:
|
|
456
|
+
dependencies:
|
|
457
|
+
'@pyrossh/config':
|
|
458
|
+
specifier: workspace:*
|
|
459
|
+
version: link:../../shared/config
|
|
460
|
+
'@pyrossh/ui':
|
|
461
|
+
specifier: workspace:*
|
|
462
|
+
version: link:../../shared/ui
|
|
463
|
+
|
|
464
|
+
packages/workers/not-found:
|
|
465
|
+
dependencies:
|
|
466
|
+
'@pyrossh/ui':
|
|
467
|
+
specifier: workspace:*
|
|
468
|
+
version: link:../../shared/ui
|
|
469
|
+
|
|
470
|
+
packages/workers/only-bible-app/index:
|
|
471
|
+
dependencies:
|
|
472
|
+
'@pyrossh/ui':
|
|
473
|
+
specifier: workspace:*
|
|
474
|
+
version: link:../../../shared/ui
|
|
475
|
+
|
|
476
|
+
packages/workers/only-bible-app/privacy:
|
|
477
|
+
dependencies:
|
|
478
|
+
'@pyrossh/ui':
|
|
479
|
+
specifier: workspace:*
|
|
480
|
+
version: link:../../../shared/ui
|
|
481
|
+
|
|
482
|
+
packages/workers/only-bible-app/terms:
|
|
483
|
+
dependencies:
|
|
484
|
+
'@pyrossh/ui':
|
|
485
|
+
specifier: workspace:*
|
|
486
|
+
version: link:../../../shared/ui
|
|
487
|
+
|
|
488
|
+
packages/workers/posts/detail:
|
|
489
|
+
dependencies:
|
|
490
|
+
'@pyrossh/config':
|
|
491
|
+
specifier: workspace:*
|
|
492
|
+
version: link:../../../shared/config
|
|
493
|
+
'@pyrossh/core':
|
|
494
|
+
specifier: workspace:*
|
|
495
|
+
version: link:../../../shared/core
|
|
496
|
+
'@pyrossh/types':
|
|
497
|
+
specifier: workspace:*
|
|
498
|
+
version: link:../../../shared/types
|
|
499
|
+
'@pyrossh/ui':
|
|
500
|
+
specifier: workspace:*
|
|
501
|
+
version: link:../../../shared/ui
|
|
502
|
+
|
|
503
|
+
packages/workers/posts/index:
|
|
504
|
+
dependencies:
|
|
505
|
+
'@pyrossh/config':
|
|
506
|
+
specifier: workspace:*
|
|
507
|
+
version: link:../../../shared/config
|
|
508
|
+
'@pyrossh/core':
|
|
509
|
+
specifier: workspace:*
|
|
510
|
+
version: link:../../../shared/core
|
|
511
|
+
'@pyrossh/types':
|
|
512
|
+
specifier: workspace:*
|
|
513
|
+
version: link:../../../shared/types
|
|
514
|
+
'@pyrossh/ui':
|
|
515
|
+
specifier: workspace:*
|
|
516
|
+
version: link:../../../shared/ui
|
|
517
|
+
|
|
518
|
+
packages/workers/repos/commits/detail:
|
|
519
|
+
dependencies:
|
|
520
|
+
'@pyrossh/config':
|
|
521
|
+
specifier: workspace:*
|
|
522
|
+
version: link:../../../../shared/config
|
|
523
|
+
'@pyrossh/core':
|
|
524
|
+
specifier: workspace:*
|
|
525
|
+
version: link:../../../../shared/core
|
|
526
|
+
'@pyrossh/types':
|
|
527
|
+
specifier: workspace:*
|
|
528
|
+
version: link:../../../../shared/types
|
|
529
|
+
'@pyrossh/ui':
|
|
530
|
+
specifier: workspace:*
|
|
531
|
+
version: link:../../../../shared/ui
|
|
532
|
+
|
|
533
|
+
packages/workers/repos/commits/index:
|
|
534
|
+
dependencies:
|
|
535
|
+
'@pyrossh/config':
|
|
536
|
+
specifier: workspace:*
|
|
537
|
+
version: link:../../../../shared/config
|
|
538
|
+
'@pyrossh/core':
|
|
539
|
+
specifier: workspace:*
|
|
540
|
+
version: link:../../../../shared/core
|
|
541
|
+
'@pyrossh/types':
|
|
542
|
+
specifier: workspace:*
|
|
543
|
+
version: link:../../../../shared/types
|
|
544
|
+
'@pyrossh/ui':
|
|
545
|
+
specifier: workspace:*
|
|
546
|
+
version: link:../../../../shared/ui
|
|
547
|
+
|
|
548
|
+
packages/workers/repos/files/blame:
|
|
549
|
+
dependencies:
|
|
550
|
+
'@pyrossh/config':
|
|
551
|
+
specifier: workspace:*
|
|
552
|
+
version: link:../../../../shared/config
|
|
553
|
+
'@pyrossh/core':
|
|
554
|
+
specifier: workspace:*
|
|
555
|
+
version: link:../../../../shared/core
|
|
556
|
+
'@pyrossh/types':
|
|
557
|
+
specifier: workspace:*
|
|
558
|
+
version: link:../../../../shared/types
|
|
559
|
+
'@pyrossh/ui':
|
|
560
|
+
specifier: workspace:*
|
|
561
|
+
version: link:../../../../shared/ui
|
|
562
|
+
|
|
563
|
+
packages/workers/repos/files/detail:
|
|
564
|
+
dependencies:
|
|
565
|
+
'@pyrossh/config':
|
|
566
|
+
specifier: workspace:*
|
|
567
|
+
version: link:../../../../shared/config
|
|
568
|
+
'@pyrossh/core':
|
|
569
|
+
specifier: workspace:*
|
|
570
|
+
version: link:../../../../shared/core
|
|
571
|
+
'@pyrossh/types':
|
|
572
|
+
specifier: workspace:*
|
|
573
|
+
version: link:../../../../shared/types
|
|
574
|
+
'@pyrossh/ui':
|
|
575
|
+
specifier: workspace:*
|
|
576
|
+
version: link:../../../../shared/ui
|
|
577
|
+
|
|
578
|
+
packages/workers/repos/files/history:
|
|
579
|
+
dependencies:
|
|
580
|
+
'@pyrossh/config':
|
|
581
|
+
specifier: workspace:*
|
|
582
|
+
version: link:../../../../shared/config
|
|
583
|
+
'@pyrossh/core':
|
|
584
|
+
specifier: workspace:*
|
|
585
|
+
version: link:../../../../shared/core
|
|
586
|
+
'@pyrossh/types':
|
|
587
|
+
specifier: workspace:*
|
|
588
|
+
version: link:../../../../shared/types
|
|
589
|
+
'@pyrossh/ui':
|
|
590
|
+
specifier: workspace:*
|
|
591
|
+
version: link:../../../../shared/ui
|
|
592
|
+
|
|
593
|
+
packages/workers/repos/files/index:
|
|
594
|
+
dependencies:
|
|
595
|
+
'@pyrossh/config':
|
|
596
|
+
specifier: workspace:*
|
|
597
|
+
version: link:../../../../shared/config
|
|
598
|
+
'@pyrossh/core':
|
|
599
|
+
specifier: workspace:*
|
|
600
|
+
version: link:../../../../shared/core
|
|
601
|
+
'@pyrossh/types':
|
|
602
|
+
specifier: workspace:*
|
|
603
|
+
version: link:../../../../shared/types
|
|
604
|
+
'@pyrossh/ui':
|
|
605
|
+
specifier: workspace:*
|
|
606
|
+
version: link:../../../../shared/ui
|
|
607
|
+
|
|
608
|
+
packages/workers/repos/issues/detail:
|
|
609
|
+
dependencies:
|
|
610
|
+
'@pyrossh/config':
|
|
611
|
+
specifier: workspace:*
|
|
612
|
+
version: link:../../../../shared/config
|
|
613
|
+
'@pyrossh/core':
|
|
614
|
+
specifier: workspace:*
|
|
615
|
+
version: link:../../../../shared/core
|
|
616
|
+
'@pyrossh/types':
|
|
617
|
+
specifier: workspace:*
|
|
618
|
+
version: link:../../../../shared/types
|
|
619
|
+
'@pyrossh/ui':
|
|
620
|
+
specifier: workspace:*
|
|
621
|
+
version: link:../../../../shared/ui
|
|
622
|
+
|
|
623
|
+
packages/workers/repos/issues/index:
|
|
624
|
+
dependencies:
|
|
625
|
+
'@pyrossh/config':
|
|
626
|
+
specifier: workspace:*
|
|
627
|
+
version: link:../../../../shared/config
|
|
628
|
+
'@pyrossh/core':
|
|
629
|
+
specifier: workspace:*
|
|
630
|
+
version: link:../../../../shared/core
|
|
631
|
+
'@pyrossh/types':
|
|
632
|
+
specifier: workspace:*
|
|
633
|
+
version: link:../../../../shared/types
|
|
634
|
+
'@pyrossh/ui':
|
|
635
|
+
specifier: workspace:*
|
|
636
|
+
version: link:../../../../shared/ui
|
|
637
|
+
|
|
638
|
+
packages/workers/repos/readme:
|
|
639
|
+
dependencies:
|
|
640
|
+
'@pyrossh/config':
|
|
641
|
+
specifier: workspace:*
|
|
642
|
+
version: link:../../../shared/config
|
|
643
|
+
'@pyrossh/core':
|
|
644
|
+
specifier: workspace:*
|
|
645
|
+
version: link:../../../shared/core
|
|
646
|
+
'@pyrossh/types':
|
|
647
|
+
specifier: workspace:*
|
|
648
|
+
version: link:../../../shared/types
|
|
649
|
+
'@pyrossh/ui':
|
|
650
|
+
specifier: workspace:*
|
|
651
|
+
version: link:../../../shared/ui
|
|
652
|
+
|
|
653
|
+
packages/workers/robots: {}
|
|
654
|
+
|
|
655
|
+
packages/workers/rss:
|
|
656
|
+
dependencies:
|
|
657
|
+
'@pyrossh/config':
|
|
658
|
+
specifier: workspace:*
|
|
659
|
+
version: link:../../shared/config
|
|
660
|
+
'@pyrossh/core':
|
|
661
|
+
specifier: workspace:*
|
|
662
|
+
version: link:../../shared/core
|
|
663
|
+
'@pyrossh/types':
|
|
664
|
+
specifier: workspace:*
|
|
665
|
+
version: link:../../shared/types
|
|
666
|
+
|
|
667
|
+
packages/workers/server-error:
|
|
668
|
+
dependencies:
|
|
669
|
+
'@pyrossh/ui':
|
|
670
|
+
specifier: workspace:*
|
|
671
|
+
version: link:../../shared/ui
|
|
672
|
+
|
|
378
673
|
packages:
|
|
379
674
|
|
|
380
675
|
'@antfu/[email protected]':
|