@capgo/capacitor-patch 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -130,6 +130,12 @@ Catalog entries use this shape:
|
|
|
130
130
|
|
|
131
131
|
For generated native project files, use `"phase": "native"` and `"target": { "type": "native" }`. Diff paths are relative to the app root. For package patches, diff paths are relative to the target package root.
|
|
132
132
|
|
|
133
|
+
### Built-in patches
|
|
134
|
+
|
|
135
|
+
| ID | Source | Target | Description |
|
|
136
|
+
| -------------------------------------- | ------------------------------------------------------------------ | ------------------- | --------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| `capacitor-cli-spm-ios-minor-platform` | [Capacitor+ #38](https://github.com/Cap-go/capacitor-plus/pull/38) | `@capacitor/cli` v8 | Keeps iOS SPM `Package.swift` generation from truncating deployment targets such as `15.5` to `15`. |
|
|
138
|
+
|
|
133
139
|
## Compatibility
|
|
134
140
|
|
|
135
141
|
| Plugin version | Capacitor compatibility | Maintained |
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
diff --git a/dist/ios/common.js b/dist/ios/common.js
|
|
2
|
+
--- a/dist/ios/common.js
|
|
3
|
+
+++ b/dist/ios/common.js
|
|
4
|
+
@@ -124,3 +124,28 @@ function getMajoriOSVersion(config) {
|
|
5
|
+
return iosVersion;
|
|
6
|
+
}
|
|
7
|
+
exports.getMajoriOSVersion = getMajoriOSVersion;
|
|
8
|
+
+function getMajorMinoriOSVersion(config) {
|
|
9
|
+
+ const pbx = (0, fs_extra_1.readFileSync)((0, path_1.join)(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'utf-8');
|
|
10
|
+
+ const searchString = 'IPHONEOS_DEPLOYMENT_TARGET = ';
|
|
11
|
+
+ const startIndex = pbx.indexOf(searchString);
|
|
12
|
+
+ if (startIndex === -1) {
|
|
13
|
+
+ return '';
|
|
14
|
+
+ }
|
|
15
|
+
+ const valueStart = startIndex + searchString.length;
|
|
16
|
+
+ const endIndex = pbx.indexOf(';', valueStart);
|
|
17
|
+
+ const newlineIndex = pbx.indexOf('\n', valueStart);
|
|
18
|
+
+ const actualEnd = endIndex !== -1 && newlineIndex !== -1
|
|
19
|
+
+ ? Math.min(endIndex, newlineIndex)
|
|
20
|
+
+ : endIndex !== -1
|
|
21
|
+
+ ? endIndex
|
|
22
|
+
+ : newlineIndex !== -1
|
|
23
|
+
+ ? newlineIndex
|
|
24
|
+
+ : pbx.length;
|
|
25
|
+
+ let iosVersion = pbx.substring(valueStart, actualEnd).trim();
|
|
26
|
+
+ if (iosVersion.endsWith('.0')) {
|
|
27
|
+
+ iosVersion = iosVersion.slice(0, -2);
|
|
28
|
+
+ }
|
|
29
|
+
+ return iosVersion;
|
|
30
|
+
+}
|
|
31
|
+
+exports.getMajorMinoriOSVersion = getMajorMinoriOSVersion;
|
|
32
|
+
diff --git a/dist/util/spm.js b/dist/util/spm.js
|
|
33
|
+
--- a/dist/util/spm.js
|
|
34
|
+
+++ b/dist/util/spm.js
|
|
35
|
+
@@ -89,1 +89,1 @@
|
|
36
|
+
- const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
|
37
|
+
+ const iosVersion = (0, common_2.getMajorMinoriOSVersion)(config);
|
|
38
|
+
@@ -98,1 +98,1 @@
|
|
39
|
+
- platforms: [.iOS(.v${iosVersion})],
|
|
40
|
+
+ platforms: [.iOS(${iosVersion.includes('.') ? `"${iosVersion}"` : `.v${iosVersion}`})],
|
package/patches/catalog.json
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "capacitor-cli-spm-ios-minor-platform",
|
|
4
|
+
"title": "Generate SPM Package.swift with the full iOS deployment target",
|
|
5
|
+
"recommended": true,
|
|
6
|
+
"phase": "package",
|
|
7
|
+
"target": {
|
|
8
|
+
"type": "package",
|
|
9
|
+
"packageName": "@capacitor/cli",
|
|
10
|
+
"versionRange": ">=8.0.0 <9.0.0"
|
|
11
|
+
},
|
|
12
|
+
"source": {
|
|
13
|
+
"capacitorPlusPr": "https://github.com/Cap-go/capacitor-plus/pull/38",
|
|
14
|
+
"author": "WcaleNieWolny",
|
|
15
|
+
"mergedAt": "2025-12-16T13:50:22Z"
|
|
16
|
+
},
|
|
17
|
+
"upstream": {
|
|
18
|
+
"status": "not-merged-as-of-2026-05-12",
|
|
19
|
+
"officialRepository": "https://github.com/ionic-team/capacitor"
|
|
20
|
+
},
|
|
21
|
+
"patchFile": "patches/capacitor-cli-spm-ios-minor-platform.patch"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
@@ -76,7 +76,7 @@ export function parseUnifiedDiff(diffText) {
|
|
|
76
76
|
index += 1;
|
|
77
77
|
const hunks = [];
|
|
78
78
|
|
|
79
|
-
while (index < lines.length && !lines[index].startsWith('--- ')) {
|
|
79
|
+
while (index < lines.length && !lines[index].startsWith('--- ') && !lines[index].startsWith('diff --git ')) {
|
|
80
80
|
if (!lines[index].startsWith('@@ ')) {
|
|
81
81
|
index += 1;
|
|
82
82
|
continue;
|
|
@@ -89,7 +89,12 @@ export function parseUnifiedDiff(diffText) {
|
|
|
89
89
|
|
|
90
90
|
index += 1;
|
|
91
91
|
const hunkLines = [];
|
|
92
|
-
while (
|
|
92
|
+
while (
|
|
93
|
+
index < lines.length &&
|
|
94
|
+
!lines[index].startsWith('@@ ') &&
|
|
95
|
+
!lines[index].startsWith('--- ') &&
|
|
96
|
+
!lines[index].startsWith('diff --git ')
|
|
97
|
+
) {
|
|
93
98
|
if (lines[index].startsWith('\\')) {
|
|
94
99
|
index += 1;
|
|
95
100
|
continue;
|
|
@@ -152,11 +157,12 @@ function applyHunks(content, hunks, reverse, relativePath) {
|
|
|
152
157
|
}
|
|
153
158
|
}
|
|
154
159
|
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
const preferredStart = Math.max(0, (reverse ? hunk.newStart : hunk.oldStart) - 1 + offset);
|
|
161
|
+
const start = resolveHunkStart(lines, preferredStart, expected, relativePath);
|
|
162
|
+
if (start === -1) {
|
|
163
|
+
throw new PatchApplyError(`Patch hunk does not match ${relativePath} at line ${preferredStart + 1}.`, {
|
|
158
164
|
file: relativePath,
|
|
159
|
-
line:
|
|
165
|
+
line: preferredStart + 1,
|
|
160
166
|
});
|
|
161
167
|
}
|
|
162
168
|
|
|
@@ -208,6 +214,31 @@ function matchesAt(lines, start, expected) {
|
|
|
208
214
|
return expected.every((line, index) => lines[start + index] === line);
|
|
209
215
|
}
|
|
210
216
|
|
|
217
|
+
function resolveHunkStart(lines, preferredStart, expected, relativePath) {
|
|
218
|
+
if (matchesAt(lines, preferredStart, expected)) {
|
|
219
|
+
return preferredStart;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const matches = [];
|
|
223
|
+
for (let index = 0; index <= lines.length - expected.length; index += 1) {
|
|
224
|
+
if (index !== preferredStart && matchesAt(lines, index, expected)) {
|
|
225
|
+
matches.push(index);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (matches.length === 1) {
|
|
230
|
+
return matches[0];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (matches.length > 1) {
|
|
234
|
+
throw new PatchApplyError(`Patch hunk matches multiple locations in ${relativePath}.`, {
|
|
235
|
+
file: relativePath,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return -1;
|
|
240
|
+
}
|
|
241
|
+
|
|
211
242
|
function assertInsideRoot(rootDir, absolutePath) {
|
|
212
243
|
const relative = path.relative(path.resolve(rootDir), absolutePath);
|
|
213
244
|
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|