Closed kwhitley closed 3 years ago
Latest commit: |
e0dda8e
|
Status: | ✅ Deploy successful! |
Preview URL: | https://05c33027.itty-router-y9b5.pages.dev |
@taralx
:+1:
:+1: still
Gonna document a bit and cut it loose (hopefully tonight). BTW, any idea how to cut the size bundlephobia sees? We're getting 479 bytes gzipped (not really relevant) and minified (definitely relevant)... but I get ~408 bytes testing locally.
What is bundlephobia?
Analyzes bundle size... basically the real cost of adding a module to your project.
I poked at bundlephobia, and they're using webpack to "build" the package. I suspect it's measuring some webpack overhead.
Notable Changes
options
are now:base?: string
- optional base pathroutes?: any[]
- optional array of routes (for introspection or preloading with advanced regex)Request
definition to address #47router.routes
array. Pretty sick!Example of manual loading routes:
DISCUSSION: If we change
r
toroutes
, and prevent the prebuild.js from mangling it, the filesize does grow (405b --> 409b), but so does the legibility around this weird introspection. Thoughts? I'm all for absolute minimum filesize, but... legibility. Torn. Don't think we would have to count the decision on this one as a breaking change (if we opt for "routes"), because the existing pattern isn't documented, and is hopefully only used in debugging patterns at most. Regardless of the path chosen here, documentation will be added to disclose this functionality.UPDATE: unless there's strong objection, I'm opting for readability over ultimate filesize...
router.routes
it isFilesize Comparison (pretty sure this includes the type declaration, so appears artificially inflated a bit)