fix(ios): use version range instead of deleted 8.0.0 branch for capacitor-swift-pm - #698
Conversation
…itor-swift-pm Package.swift declared the Capacitor dependency with `branch: "8.0.0"`. A branch requirement overrides every version requirement elsewhere in the dependency graph, so an app asking for @capacitor/ios 8.5.0 still silently resolved Capacitor to 8.0.0 and lost access to newer APIs such as the UIScene adoption Xcode 27 requires. The branch has also been deleted upstream, so fresh package resolution fails outright; only checkouts with an existing Package.resolved kept building. Switch to `from: "8.0.0"` (>= 8.0.0, < 9.0.0), matching how the first-party Capacitor plugins declare the dependency. The 8.0.0 tag still exists upstream, so the floor is unchanged. Fixes capacitor-community#697 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`npm audit` reported 13 advisories (1 critical, 6 high, 6 moderate), all reachable only through devDependencies -- the published package's runtime dependency set is unaffected, so no consumer was exposed. Still worth clearing for toolchain hygiene and to keep CI audit output actionable. `npm audit fix` (no --force, no package.json range changes) brings the count to 0. Notable resolutions: node-tar (critical, file smuggling via PAX header handling) through @capacitor/cli, js-yaml and brace-expansion DoS through eslint, lodash/lodash-es prototype pollution through java-parser, and @xmldom/xmldom XML injection through plist. The lockfile bump moves prettier-plugin-java from 2.8.1 to 2.10.3, whose newer formatter drops redundant parentheses. The accompanying Java changes are that reformatting only -- 16 lines, semantically identical -- applied so `npm run lint` stays green. Verified with `npm run build`, `npm run build-electron`, `npm run lint`, and `./gradlew clean build test`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The lockfile update introduces stricter Node engine requirements in the resolved dependency tree that conflict with the repo’s declared Node support policy and should be reconciled to avoid contributor install breakage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR fixes Swift Package Manager dependency resolution for the iOS package by switching the Capacitor SPM dependency from a deleted branch pin to a semantic version range, and also updates the npm lockfile via npm audit fix to clear devDependency advisories.
Changes:
- Update
Package.swiftto depend oncapacitor-swift-pmviafrom: "8.0.0"instead ofbranch: "8.0.0". - Apply
npm audit fixchanges topackage-lock.json. - Accept formatter-driven Java parenthesis cleanups in a few Android sources (no intended behavioral changes).
File summaries
| File | Description |
|---|---|
| Package.swift | Replaces deleted branch pin with a version-range dependency for Capacitor’s SPM package. |
| package-lock.json | Updates resolved devDependency graph to address npm audit advisories. |
| android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLite.java | Formatter-only parentheses simplification in byte conversion loop. |
| android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLCipher.java | Formatter-only parentheses removal in enum returns. |
| android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsMigrate.java | Formatter-only parentheses removal around method arguments. |
| android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsFile.java | Formatter-only parentheses removal around method argument. |
| android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/JsonIndex.java | Formatter-only parentheses simplification in type check/compare. |
| android/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLitePlugin.java | Formatter-only boolean expression simplification. |
Review details
- Files reviewed: 7/8 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
I don't think the lockfile is the source of this. I diffed every
So the mismatch with There is a real gap underneath, though: the toolchain needs Node 20+ but nothing says so - |
Fixes #697
The problem
Package.swiftdeclared the Capacitor dependency with a branch requirement:Two consequences, as reported in #697:
@capacitor/ios8.5.0 still silently resolved Capacitor to 8.0.0, losing access to newer APIs such as the UIScene adoption Xcode 27 requires.refs/heads/8.0.0no longer exists upstream, so fresh package resolution fails outright. Only checkouts with an existingPackage.resolvedkept building.The fix
from:means>= 8.0.0, < 9.0.0— the same major-version floor the plugin already assumed, and the approach the first-party Capacitor plugins use. The8.0.0tag still exists upstream, so the floor is genuinely unchanged.Verified:
swift package resolvewith noPackage.resolvedpresent now succeeds and picks capacitor-swift-pm 8.5.0.Second commit: npm audit
Separate commit, happy to drop it if you would rather keep this PR to the one-line fix.
npm auditreported 13 advisories (1 critical, 6 high, 6 moderate), all reachable only through devDependencies — the published package's runtime dependency set was never affected, so no consumer was exposed. Cleared with plainnpm audit fix(no--force, nopackage.jsonrange changes), leaving 0 vulnerabilities. Notable ones: node-tar (critical, file smuggling via PAX header handling) through@capacitor/cli, js-yaml and brace-expansion DoS througheslint, lodash prototype pollution throughjava-parser,@xmldom/xmldomXML injection throughplist.One side effect worth flagging: the lockfile moves
prettier-plugin-java2.8.1 → 2.10.3, and the newer formatter drops redundant parentheses. That is why 6 Java files show up in the diff — 16 lines, purelyreturn (State.UNKNOWN);→return State.UNKNOWN;style changes, no semantic difference. Applied sonpm run lintstays green. Confirmed this churn is caused by the bump and is not pre-existing (master formats clean under 2.8.1).Verification
swift package resolve— resolves capacitor-swift-pm 8.5.0npm audit— 0 vulnerabilitiesnpm run build,npm run build-electron— passnpm run lint— eslint, prettier, swiftlint all pass (0 serious; the swiftlint warnings are pre-existing)cd android && ./gradlew clean build test— passes🤖 Generated with Claude Code