Skip to content
Source
Sign inSign up
TanStack/intent

perf: bundle only the semver functions that stale uses #323

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/323/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

Showing 2 changed files with 18 additions and 8 deletions.

x
0 of 2 viewed, 2 left
5 additions and 0 deletions.changeset/semver-function-imports.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/intent': patch
+---
+​
+Make the installed package 35 kB smaller. `intent stale` now bundles only the `semver` functions it uses instead of the whole library; behavior does not change.
13 additions and 8 deletionspackages/intent/src/staleness/check.tsModified
View file
@@ -1,6 +1,11 @@
import { readFileSync } from 'node:fs'
import { isAbsolute, join, relative, resolve } from 'node:path'
-import semver from 'semver'
+import coerce from 'semver/functions/coerce.js'
+import diff from 'semver/functions/diff.js'
+import eq from 'semver/functions/eq.js'
+import gt from 'semver/functions/gt.js'
+import parse from 'semver/functions/parse.js'
+import valid from 'semver/functions/valid.js'
import { createIntentFsCache } from '../discovery/fs-cache.js'
import {
parseFrontmatter,
@@ -36,11 +41,11 @@
const newVersion = normalizeVersion(newVer)
​
if (!oldVersion || !newVersion) return null