@mpen/rerouter 0.1.9 → 0.3.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.
Files changed (89) hide show
  1. package/README.md +80 -18
  2. package/cli/bin.test.ts +221 -0
  3. package/cli/bin.ts +342 -0
  4. package/cli/fixtures/bin/kitchen-sink.tsx +15 -0
  5. package/cli/fixtures/bin/optional.tsx +3 -0
  6. package/cli/fixtures/bin/pages/Home.tsx +3 -0
  7. package/cli/fixtures/bin/pages/KitchenSink.tsx +3 -0
  8. package/cli/fixtures/bin/pages/Login.tsx +3 -0
  9. package/cli/fixtures/bin/pages/Match.tsx +3 -0
  10. package/cli/fixtures/bin/pages/NotFound.tsx +3 -0
  11. package/cli/fixtures/bin/pages/Optional.tsx +3 -0
  12. package/cli/fixtures/bin/regexp-groups.tsx +11 -0
  13. package/cli/fixtures/bin/simple.tsx +1 -0
  14. package/cli/fixtures/bin/unnamed.tsx +4 -0
  15. package/cli/tsconfig.json +9 -0
  16. package/dist/acorn-k7ED_tOl.js +4968 -0
  17. package/dist/angular--Iqdw9UJ.js +4057 -0
  18. package/dist/babel-hfWAujRY.js +9878 -0
  19. package/dist/bin.d.ts +29 -0
  20. package/dist/bin.js +233 -0
  21. package/dist/estree-C1Zjnvlw.js +7266 -0
  22. package/dist/flow-BaD9LyIP.js +52912 -0
  23. package/dist/glimmer-CvCjW_1V.js +7541 -0
  24. package/dist/graphql-BdtzBuWh.js +1945 -0
  25. package/dist/html-DkZtUVbo.js +7137 -0
  26. package/dist/index.d.ts +278 -0
  27. package/dist/index.js +247 -0
  28. package/dist/markdown-Z8Vrc69e.js +6876 -0
  29. package/dist/meriyah-DeO4stuH.js +7590 -0
  30. package/dist/postcss-BmgGJ0E5.js +6777 -0
  31. package/dist/prettier-BT_F8kIx.js +15629 -0
  32. package/dist/routes-PW-bNm8e.js +135 -0
  33. package/dist/typescript-DtIxStjy.js +22936 -0
  34. package/dist/yaml-CWOPBY0q.js +5281 -0
  35. package/examples/App.tsx +80 -0
  36. package/examples/dist/BlogPost-c10d9w2p.js +1 -0
  37. package/examples/dist/FetchLoading-534mdrgz.js +1 -0
  38. package/examples/dist/FetchLoading-sbxbdkre.js +1 -0
  39. package/examples/dist/Home-a1258p25.js +1 -0
  40. package/examples/dist/KitchenSink-821mjg0h.js +1 -0
  41. package/examples/dist/Login-wywx6bp7.js +1 -0
  42. package/examples/dist/Match-1e72jm5w.js +1 -0
  43. package/examples/dist/NotFound-smxj24jw.js +1 -0
  44. package/examples/dist/SlowLoading-59xxmbfk.js +1 -0
  45. package/examples/dist/index-0d4kj0rv.js +2 -0
  46. package/examples/dist/index-3x197sbt.js +9 -0
  47. package/examples/dist/index-a2hkfx1n.js +9 -0
  48. package/examples/dist/index-d21me1mc.js +9 -0
  49. package/examples/dist/index-ktqdknsn.js +2 -0
  50. package/examples/dist/index-p53qxxzd.js +2 -0
  51. package/examples/dist/index.html +67 -0
  52. package/examples/index.html +67 -0
  53. package/examples/pages/BlogPost.tsx +17 -0
  54. package/examples/pages/FetchLoading.tsx +53 -0
  55. package/examples/pages/FetchLoadingItem.tsx +45 -0
  56. package/examples/pages/Home.tsx +3 -0
  57. package/examples/pages/KitchenSink.tsx +23 -0
  58. package/examples/pages/Login.tsx +3 -0
  59. package/examples/pages/Match.tsx +5 -0
  60. package/examples/pages/NotFound.tsx +3 -0
  61. package/examples/pages/SlowLoading.tsx +8 -0
  62. package/examples/routes.gen.ts +105 -0
  63. package/examples/routes.ts +40 -0
  64. package/examples/server/serve-dist.ts +33 -0
  65. package/examples/server/tsconfig.json +9 -0
  66. package/package.json +41 -31
  67. package/src/components/Link.test.tsx +139 -0
  68. package/src/components/Link.tsx +89 -0
  69. package/src/components/NavLink.test.tsx +119 -0
  70. package/src/components/NavLink.tsx +71 -0
  71. package/src/components/Router.test.tsx +183 -0
  72. package/src/components/Router.tsx +207 -0
  73. package/src/hooks/index.ts +1 -0
  74. package/src/hooks/useUrl.ts +22 -0
  75. package/src/index.ts +6 -0
  76. package/src/lib/mergeSearch.test.ts +37 -0
  77. package/src/lib/mergeSearch.ts +21 -0
  78. package/src/lib/routes.test.ts +67 -0
  79. package/src/lib/routes.ts +247 -0
  80. package/src/lib/url.ts +9 -0
  81. package/tsconfig.json +10 -0
  82. package/tsdown.config.ts +21 -0
  83. package/LICENSE +0 -21
  84. package/dist/bundle.cjs +0 -422
  85. package/dist/bundle.d.ts +0 -2
  86. package/dist/bundle.mjs +0 -420
  87. package/dist/dev.d.ts +0 -1
  88. package/dist/log.d.ts +0 -1
  89. package/dist/uri-template.d.ts +0 -56
@@ -0,0 +1,3 @@
1
+ export default function Home() {
2
+ return null
3
+ }
@@ -0,0 +1,3 @@
1
+ export default function KitchenSink() {
2
+ return null
3
+ }
@@ -0,0 +1,3 @@
1
+ export default function Login() {
2
+ return null
3
+ }
@@ -0,0 +1,3 @@
1
+ export default function Match() {
2
+ return null
3
+ }
@@ -0,0 +1,3 @@
1
+ export default function NotFound() {
2
+ return null
3
+ }
@@ -0,0 +1,3 @@
1
+ export default function Optional() {
2
+ return null
3
+ }
@@ -0,0 +1,11 @@
1
+ import type { RouteObject } from '@mpen/rerouter'
2
+
3
+ const ROUTES: readonly RouteObject[] = [
4
+ {
5
+ name: 'blogPost',
6
+ pattern: '/blog/:id(\\d+){-:title}?',
7
+ component: () => import('./pages/Match'),
8
+ },
9
+ ]
10
+
11
+ export default ROUTES
@@ -0,0 +1 @@
1
+ export default [{ name: 'home', pattern: '/', component: () => import('./pages/Home') }]
@@ -0,0 +1,4 @@
1
+ export default [
2
+ { name: 'home', pattern: '/', component: () => import('./pages/Home') },
3
+ { pattern: '/layout/:id', component: () => import('./pages/Home') },
4
+ ]
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
5
+ "types": ["node"]
6
+ },
7
+ "include": ["**/*"],
8
+ "exclude": ["**/*.test.*"]
9
+ }