Repository navigation
v0.14.1 fix: widen typescript dependency range to dedupe with TS 6 - #75
Conversation
The dependency was pinned to `^5.9.3` (>=5.9.3 <6.0.0), so consumers on TypeScript 6 could not dedupe: npm/bun installed a second nested 5.9.3 copy alongside the host's 6.x. Widen to `>=5.0.0-0 <7.0.0-0`: - floor 5.0.0 covers every API used (getModifiers/getDecorators et al. exist since 4.8); prerelease-tagged (`-0`) bounds so 6.0.0-beta satisfies the range and dedupes. - upper cap excludes TS 7: the native (Go) rewrite changed the package exports, so `import ts from "typescript"` resolves to a stub and `ts.SyntaxKind` is undefined at runtime — dry-ts genuinely does not run on 7 yet. Verified: build + 198 tests pass on 6.0.0-beta, both fail on 7.0.2. Standalone installs still resolve to stable 5.9.3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe package manifest broadens the TypeScript dependency constraint from ChangesTypeScript Dependency
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 58: Update the TypeScript dependency range in package.json to explicitly
include TypeScript 6 prereleases, while retaining support for the existing
TypeScript 5 through 6 stable versions and the upper bound below 7.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d942d17a-406f-49f7-b457-7610a23f07f3
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
package.json
| "dependencies": { | ||
| "ignore": "^7.0.5", | ||
| "typescript": "^5.9.3" | ||
| "typescript": ">=5.0.0-0 <7.0.0-0" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
bun -e 'const r = ">=5.0.0-0 <7.0.0-0"; for (const v of ["5.9.3", "6.0.0-beta", "6.0.0"]) console.log(v, Bun.semver.satisfies(v, r))'Repository: Dominik-O22/dry-ts
Length of output: 197
🌐 Web query:
Bun semver prerelease version ranges documentation node-semver prerelease requirements
💡 Result:
Bun’s Bun.semver API is designed to be compatible with node-semver [1]. It provides a built-in semantic versioning parser that mimics the behavior found in npm [2]. Prerelease Version Requirements In both Bun and node-semver, prerelease versions (e.g., 1.2.3-alpha.3) are treated as unstable and are excluded from range-matching by default [3][4][5]. A version with a prerelease tag will only satisfy a range if at least one comparator within that range (or the comparator set) also carries a prerelease tag with the same major, minor, and patch tuple [3][5]. For example, a range such as >1.2.3-alpha.3 will not be satisfied by 3.4.5-alpha.9, because the range lacks a prerelease comparator for that specific version set, even though 3.4.5-alpha.9 is technically higher [5]. Bun.semver API Bun offers two primary functions in its Bun.semver namespace: 1. Bun.semver.satisfies(version, range): Returns true if the provided version satisfies the given range [1][6]. It follows the same default behavior as node-semver, where prerelease versions are excluded unless explicitly matched [7][3]. 2. Bun.semver.order(versionA, versionB): Returns 0 if versions are equal, 1 if versionA is greater, or -1 if versionA is less than versionB [1][6]. Compliance and Differences Bun consistently works to match npm’s version resolution logic [8]. While Bun is significantly faster than node-semver, it is explicitly built to pass the node-semver test suite [2]. Updates to Bun, such as those related to peer dependency validation, have been implemented to ensure that Bun's internal handling of prerelease versions aligns with expected npm semantics [9]. If you require behavior where prerelease versions are treated as normal versions, standard node-semver practice (which Bun follows) typically requires utilizing an includePrerelease flag or explicit opt-in mechanisms during range parsing [3][4][5].
Citations:
- 1: https://bun.com/docs/runtime/semver
- 2: https://bun.com/blog/bun-v1.0.11
- 3: https://github.com/npm/node-semver
- 4: https://www.npmjs.com/package/semver
- 5: https://docs.npmjs.com/cli/v6/using-npm/semver/
- 6: https://bun.com/reference/bun/semver
- 7: Fix(semver): fix matching with pre-release version oven-sh/bun#4412
- 8: install: match npm's version resolution for prerelease ranges, || groups, and
*oven-sh/bun#32843 - 9: fix(install): use includePrerelease semantics for peer dep validation oven-sh/bun#27085
🌐 Web query:
npm semver prerelease range same major minor patch tuple documentation
💡 Result:
In npm's semver implementation, prerelease versions are excluded from range matching by default to prevent unstable, rapidly changing versions from being accidentally installed [1][2]. For a version with a prerelease tag (e.g., 1.2.3-alpha.3) to satisfy a range, the range must explicitly include a comparator with the same major, minor, and patch tuple that also contains a prerelease tag [3][1]. Key behavior details: - Matching Requirement: If a version has a prerelease tag, it will only satisfy a comparator set if at least one comparator in that set shares the same [major, minor, patch] tuple and also includes a prerelease tag [1][2]. - Example: The range >1.2.3-alpha.3 can match 1.2.3-alpha.7, but it will not match 3.4.5-alpha.9, even though the latter is technically greater [3][1]. The version 3.4.5 (without a tag) would satisfy the range because it is greater than 1.2.3-alpha.7 [1]. - Suppressing Behavior: This default behavior can be overridden by setting the includePrerelease flag to true in the options object of semver functions that perform range matching [4][1]. When enabled, prerelease versions are treated as if they were normal (stable) versions for the purpose of matching [1][2]. This design serves two main purposes: it prevents users from automatically pulling in unstable prereleases they did not intend to use, and it ensures that users who explicitly opt into a specific set of prerelease versions are not automatically upgraded to subsequent, potentially unrelated prerelease sets [1][2].
Citations:
- 1: https://github.com/npm/node-semver
- 2: https://github.com/npm/node-semver?tab=readme-ov-file
- 3: https://docs.npmjs.com/cli/v6/using-npm/semver/
- 4: https://raw.githubusercontent.com/npm/node-semver/master/README.md
🏁 Script executed:
node -e 'const semver = require("semver"); for (const r of [">=5.0.0-0 <7.0.0-0", ">=5.0.0-0 <6.0.0-0 || >=6.0.0-0 <7.0.0-0"]) { console.log("range", r); for (const v of ["5.9.3", "6.0.0-beta", "6.0.0"]) { console.log(" ", v, semver.satisfies(v, r)); } }'Repository: Dominik-O22/dry-ts
Length of output: 1008
Include TypeScript 6 prereleases explicitly.
>=5.0.0-0 <7.0.0-0 does not satisfy 6.0.0-beta because prereleases are accepted only when a comparator shares the same major/minor/patch tuple. Add an explicit TypeScript 6 prerelease range, e.g.:
Proposed fix
- "typescript": ">=5.0.0-0 <7.0.0-0"
+ "typescript": ">=5.0.0-0 <6.0.0-0 || >=6.0.0-0 <7.0.0-0"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "typescript": ">=5.0.0-0 <7.0.0-0" | |
| "typescript": ">=5.0.0-0 <6.0.0-0 || >=6.0.0-0 <7.0.0-0" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` at line 58, Update the TypeScript dependency range in
package.json to explicitly include TypeScript 6 prereleases, while retaining
support for the existing TypeScript 5 through 6 stable versions and the upper
bound below 7.
Source: MCP tools
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
typescriptwas pinned to^5.9.3(=>=5.9.3 <6.0.0). Consumers already on TypeScript 6 can't dedupe against that range, so npm/bun install a second nestedtypescript@5.9.3beside the host's 6.x — the reported double-bundle.Fix
Widen the dependency range to
>=5.0.0-0 <7.0.0-0:5.0.0— every compiler API dry-ts uses (getModifiers,getDecorators,canHave*,createSourceFile,SyntaxKind, …) has existed since TS 4.8, so 5.0 is a safe, generous floor.-0) — makes6.0.0-betasatisfy the range (plain>=5.0.0excludes prereleases by semver rule), so it dedupes with a TS 6 host.<7.0.0-0— TS 7 is the native (Go)typescript-gorewrite. Its package exports changed:import ts from "typescript"resolves to a stub,ts.SyntaxKindisundefinedat runtime. dry-ts genuinely does not run on 7 yet, so it's excluded rather than silently broken.Verification
ts.SyntaxKindundefined at runtimeStandalone/fresh installs still resolve to stable 5.9.3.
bun run checkpasses (lint + build + 198 tests + self-dupe check).Ships as v0.14.1 (PATCH) — VERSION + package.json + CHANGELOG bumped.
Follow-up (not in this PR)
Supporting TS 7 needs code changes for the typescript-go export shape (
import * as ts+ entrypoint verification, possibly a compat shim). Bump the upper cap alongside that work.🤖 Generated with Claude Code