chore(router): trim dependencies by inlining small single-use helpers - #8975
chore(router): trim dependencies by inlining small single-use helpers#8975gioboa wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 766741d The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
a907dfd to
406fb4c
Compare
@qwik.dev/core
@qwik.dev/router
@qwik.dev/utils
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
commit: |
d12e906 to
ec9aada
Compare
ec9aada to
b5fca24
Compare
maiieul
left a comment
There was a problem hiding this comment.
Hmmm this looks good. Thanks @gioboa! Will make maintaining deps easier for sure 👍 Can you add a small comment on each vendor helper that says which vendor it was copied from? This way it reduces the likelihood for a future PR, especially with AI, to introduce a bug into those.
|
Good idea @maiieul 👍 |
b5fca24 to
630ca10
Compare
maiieul
left a comment
There was a problem hiding this comment.
magic-string impl says "minimal replacement". Copied source code is good but half baked AI impl is risky. Let's remove it please.
|
Fair enough 👍 Reverted the custom |
- replace marked with remark-parse (already transitive via @mdx-js/mdx) for menu.md parsing - inline hast-util-to-string, hast-util-heading-rank, and github-slugger equivalents - inline set-cookie-parser's parseString in the azure-swa middleware - vendor minimal Azure Functions v3 structural types, dropping @azure/functions - inline kleur's ANSI color helpers for SSG logging - remove unused @types/mdx and @types/set-cookie-parser
630ca10 to
766741d
Compare
What
Several dependencies of
@qwik.dev/routerare used for a single function call. This PR replaces those with ~170 lines of tested, vendored code and removes dead dev-dependencies. It also bumpsmagic-stringto the maintained v1 line.Result: router goes from 26 → 17 direct dependencies. Every app installs 12 fewer packages and ~3MB less
node_modules. No behavior changes, no client-bundle impact.How
Each removed dependency was used for one small thing. Every vendored helper carries a
// Minimal inlined replacement for \`` banner so future changes can be checked against the original package's behavior:marked(932KB)menu.mdremark-parse, already installed via@mdx-js/mdx@azure/functions(472KB)github-sluggerslugger.ts(~20 lines + tests)estree-util-value-to-estreevalue-to-estree.ts(~50 lines + tests)set-cookie-parserparseStringcallparse-set-cookie.ts(~50 lines + tests)hast-util-to-string,hast-util-heading-rankhast-utils.ts(~20 lines)kleuransi-colors.ts(same NO_COLOR/TTY detection)@types/mdx,mdast-util-mdxmagic-stringstays (per review) and is updated 0.30.21 → 1.2.3 across the workspace — v1 is the maintained line; its only breaking change is pure ESM, which matches how it's consumed here.Dev-dependency cleanup: dropped
uvu(asserts migrated to vitest),tsm(unused),@types/refractor(empty stub),@types/set-cookie-parser.Verification
mdx,menu,ssg-snapshot, andresumee2e pass against a productionbuild.core— SSG HTML output is byte-identical and apps resume correctly, so heading ids, menus, cookies, and manifest injection behave exactly as beforetsc.checkclean,api.updateregenerated, lib build clean,lint.syncpackcleanKept on purpose
source-map,unified,vfile,unist-util-visitare directly imported but already installed via@mdx-js/mdx— removing them saves nothing and creates phantom deps.magic-string,mlly,yaml,csstype,launch-editor, and the remaining deps are real features, public-API types, or not worth the correctness risk.Bigger wins (
zod+valibot~4.2MB,refractor+svgo~4.5MB as optional peers) are possible but breaking — left for a separate discussion.