@solidnative-dev/cli 0.0.0-stage → 0.1.0-alpha.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.
Files changed (184) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +841 -2
  3. package/dist/android-apk-signing.d.ts +36 -0
  4. package/dist/android-apk-signing.d.ts.map +1 -0
  5. package/dist/android-apk-signing.js +292 -0
  6. package/dist/android-apk-signing.js.map +1 -0
  7. package/dist/android-bundle-signing.d.ts +34 -0
  8. package/dist/android-bundle-signing.d.ts.map +1 -0
  9. package/dist/android-bundle-signing.js +167 -0
  10. package/dist/android-bundle-signing.js.map +1 -0
  11. package/dist/android-causal-debug.d.ts +38 -0
  12. package/dist/android-causal-debug.d.ts.map +1 -0
  13. package/dist/android-causal-debug.js +239 -0
  14. package/dist/android-causal-debug.js.map +1 -0
  15. package/dist/android-device-proof.d.ts +58 -0
  16. package/dist/android-device-proof.d.ts.map +1 -0
  17. package/dist/android-device-proof.js +554 -0
  18. package/dist/android-device-proof.js.map +1 -0
  19. package/dist/android-logs.d.ts +50 -0
  20. package/dist/android-logs.d.ts.map +1 -0
  21. package/dist/android-logs.js +253 -0
  22. package/dist/android-logs.js.map +1 -0
  23. package/dist/android-release-signing.d.ts +12 -0
  24. package/dist/android-release-signing.d.ts.map +1 -0
  25. package/dist/android-release-signing.js +165 -0
  26. package/dist/android-release-signing.js.map +1 -0
  27. package/dist/android-run-lease.d.ts +15 -0
  28. package/dist/android-run-lease.d.ts.map +1 -0
  29. package/dist/android-run-lease.js +333 -0
  30. package/dist/android-run-lease.js.map +1 -0
  31. package/dist/android-run-preflight.d.ts +45 -0
  32. package/dist/android-run-preflight.d.ts.map +1 -0
  33. package/dist/android-run-preflight.js +183 -0
  34. package/dist/android-run-preflight.js.map +1 -0
  35. package/dist/android-signing-shared.d.ts +38 -0
  36. package/dist/android-signing-shared.d.ts.map +1 -0
  37. package/dist/android-signing-shared.js +210 -0
  38. package/dist/android-signing-shared.js.map +1 -0
  39. package/dist/bin.d.ts +3 -0
  40. package/dist/bin.d.ts.map +1 -0
  41. package/dist/bin.js +4530 -0
  42. package/dist/bin.js.map +1 -0
  43. package/dist/bundle-artifacts.d.ts +48 -0
  44. package/dist/bundle-artifacts.d.ts.map +1 -0
  45. package/dist/bundle-artifacts.js +427 -0
  46. package/dist/bundle-artifacts.js.map +1 -0
  47. package/dist/causal-debug-compare.d.ts +81 -0
  48. package/dist/causal-debug-compare.d.ts.map +1 -0
  49. package/dist/causal-debug-compare.js +238 -0
  50. package/dist/causal-debug-compare.js.map +1 -0
  51. package/dist/causal-debug-report.d.ts +33 -0
  52. package/dist/causal-debug-report.d.ts.map +1 -0
  53. package/dist/causal-debug-report.js +979 -0
  54. package/dist/causal-debug-report.js.map +1 -0
  55. package/dist/causal-debug-watch.d.ts +33 -0
  56. package/dist/causal-debug-watch.d.ts.map +1 -0
  57. package/dist/causal-debug-watch.js +92 -0
  58. package/dist/causal-debug-watch.js.map +1 -0
  59. package/dist/causal-debug.d.ts +131 -0
  60. package/dist/causal-debug.d.ts.map +1 -0
  61. package/dist/causal-debug.js +503 -0
  62. package/dist/causal-debug.js.map +1 -0
  63. package/dist/compatibility-catalog.d.ts +88 -0
  64. package/dist/compatibility-catalog.d.ts.map +1 -0
  65. package/dist/compatibility-catalog.js +344 -0
  66. package/dist/compatibility-catalog.js.map +1 -0
  67. package/dist/deep-link.d.ts +90 -0
  68. package/dist/deep-link.d.ts.map +1 -0
  69. package/dist/deep-link.js +346 -0
  70. package/dist/deep-link.js.map +1 -0
  71. package/dist/device-proof-signatures.d.ts +307 -0
  72. package/dist/device-proof-signatures.d.ts.map +1 -0
  73. package/dist/device-proof-signatures.js +1024 -0
  74. package/dist/device-proof-signatures.js.map +1 -0
  75. package/dist/fingerprint.d.ts +35 -0
  76. package/dist/fingerprint.d.ts.map +1 -0
  77. package/dist/fingerprint.js +454 -0
  78. package/dist/fingerprint.js.map +1 -0
  79. package/dist/index.d.ts +388 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +2996 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/ios-causal-debug.d.ts +39 -0
  84. package/dist/ios-causal-debug.d.ts.map +1 -0
  85. package/dist/ios-causal-debug.js +318 -0
  86. package/dist/ios-causal-debug.js.map +1 -0
  87. package/dist/ios-logs.d.ts +58 -0
  88. package/dist/ios-logs.d.ts.map +1 -0
  89. package/dist/ios-logs.js +269 -0
  90. package/dist/ios-logs.js.map +1 -0
  91. package/dist/ios-process.d.ts +69 -0
  92. package/dist/ios-process.d.ts.map +1 -0
  93. package/dist/ios-process.js +389 -0
  94. package/dist/ios-process.js.map +1 -0
  95. package/dist/ios-run-preflight.d.ts +35 -0
  96. package/dist/ios-run-preflight.d.ts.map +1 -0
  97. package/dist/ios-run-preflight.js +172 -0
  98. package/dist/ios-run-preflight.js.map +1 -0
  99. package/dist/live-causal-debug-report.d.ts +49 -0
  100. package/dist/live-causal-debug-report.d.ts.map +1 -0
  101. package/dist/live-causal-debug-report.js +123 -0
  102. package/dist/live-causal-debug-report.js.map +1 -0
  103. package/dist/local-symbolication.d.ts +35 -0
  104. package/dist/local-symbolication.d.ts.map +1 -0
  105. package/dist/local-symbolication.js +89 -0
  106. package/dist/local-symbolication.js.map +1 -0
  107. package/dist/native-archive.d.ts +15 -0
  108. package/dist/native-archive.d.ts.map +1 -0
  109. package/dist/native-archive.js +441 -0
  110. package/dist/native-archive.js.map +1 -0
  111. package/dist/native-test.d.ts +43 -0
  112. package/dist/native-test.d.ts.map +1 -0
  113. package/dist/native-test.js +209 -0
  114. package/dist/native-test.js.map +1 -0
  115. package/dist/package-add.d.ts +56 -0
  116. package/dist/package-add.d.ts.map +1 -0
  117. package/dist/package-add.js +764 -0
  118. package/dist/package-add.js.map +1 -0
  119. package/dist/react-native-upgrade.d.ts +96 -0
  120. package/dist/react-native-upgrade.d.ts.map +1 -0
  121. package/dist/react-native-upgrade.js +882 -0
  122. package/dist/react-native-upgrade.js.map +1 -0
  123. package/dist/release-device-correlation.d.ts +40 -0
  124. package/dist/release-device-correlation.d.ts.map +1 -0
  125. package/dist/release-device-correlation.js +113 -0
  126. package/dist/release-device-correlation.js.map +1 -0
  127. package/dist/release-signatures.d.ts +168 -0
  128. package/dist/release-signatures.d.ts.map +1 -0
  129. package/dist/release-signatures.js +677 -0
  130. package/dist/release-signatures.js.map +1 -0
  131. package/dist/release.d.ts +88 -0
  132. package/dist/release.d.ts.map +1 -0
  133. package/dist/release.js +771 -0
  134. package/dist/release.js.map +1 -0
  135. package/dist/signature-utilities.d.ts +16 -0
  136. package/dist/signature-utilities.d.ts.map +1 -0
  137. package/dist/signature-utilities.js +114 -0
  138. package/dist/signature-utilities.js.map +1 -0
  139. package/dist/solid-diagnostics-correlation.d.ts +11 -0
  140. package/dist/solid-diagnostics-correlation.d.ts.map +1 -0
  141. package/dist/solid-diagnostics-correlation.js +78 -0
  142. package/dist/solid-diagnostics-correlation.js.map +1 -0
  143. package/dist/solid-diagnostics-debug.d.ts +15 -0
  144. package/dist/solid-diagnostics-debug.d.ts.map +1 -0
  145. package/dist/solid-diagnostics-debug.js +93 -0
  146. package/dist/solid-diagnostics-debug.js.map +1 -0
  147. package/dist/solid-diagnostics-inspection.d.ts +41 -0
  148. package/dist/solid-diagnostics-inspection.d.ts.map +1 -0
  149. package/dist/solid-diagnostics-inspection.js +196 -0
  150. package/dist/solid-diagnostics-inspection.js.map +1 -0
  151. package/dist/source-map.d.ts +36 -0
  152. package/dist/source-map.d.ts.map +1 -0
  153. package/dist/source-map.js +488 -0
  154. package/dist/source-map.js.map +1 -0
  155. package/dist/stack-symbolication.d.ts +56 -0
  156. package/dist/stack-symbolication.d.ts.map +1 -0
  157. package/dist/stack-symbolication.js +310 -0
  158. package/dist/stack-symbolication.js.map +1 -0
  159. package/dist/symbolication.d.ts +27 -0
  160. package/dist/symbolication.d.ts.map +1 -0
  161. package/dist/symbolication.js +75 -0
  162. package/dist/symbolication.js.map +1 -0
  163. package/dist/tree-debug.d.ts +53 -0
  164. package/dist/tree-debug.d.ts.map +1 -0
  165. package/dist/tree-debug.js +283 -0
  166. package/dist/tree-debug.js.map +1 -0
  167. package/dist/versions.d.ts +13 -0
  168. package/dist/versions.d.ts.map +1 -0
  169. package/dist/versions.js +14 -0
  170. package/dist/versions.js.map +1 -0
  171. package/package.json +46 -3
  172. package/templates/react-native-0.88/README.md +328 -0
  173. package/templates/react-native-0.88/android/CMakeLists.txt +27 -0
  174. package/templates/react-native-0.88/android/MainActivity.kt +123 -0
  175. package/templates/react-native-0.88/android/MainApplication.kt +43 -0
  176. package/templates/react-native-0.88/android/OnLoad.cpp +60 -0
  177. package/templates/react-native-0.88/index.js +1 -0
  178. package/templates/react-native-0.88/ios/AppDelegate.swift +190 -0
  179. package/templates/react-native-0.88/metro.config.js +16 -0
  180. package/templates/react-native-0.88/specs/NativeSolidNativeDebug.ts +16 -0
  181. package/templates/react-native-0.88/specs/NativeSolidNativePlatformAndroid.ts +14 -0
  182. package/templates/react-native-0.88/src/App.tsx +161 -0
  183. package/templates/react-native-0.88/src/main.tsx +88 -0
  184. package/templates/react-native-0.88/test/App.test.tsx +152 -0
@@ -0,0 +1,764 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { access, link, lstat, mkdir, readFile, realpath, rename, rm, writeFile, } from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { SOLID_NATIVE_CLI_VERSION, VERIFIED_PACKAGE_MANAGER, VERIFIED_REACT_NATIVE_PACKAGE_VERSION, VERIFIED_REACT_NATIVE_SCREENS_VERSION, } from "./versions.js";
6
+ const MAX_MANIFEST_BYTES = 1024 * 1024;
7
+ const MAX_BACKEND_CONTRACT_BYTES = 32 * 1024;
8
+ const MAX_PATCH_BYTES = 1024 * 1024;
9
+ const MAX_INSTALLED_BACKEND_FILE_BYTES = 2 * 1024 * 1024;
10
+ const MAX_INSTALLED_BACKEND_FILES = 16;
11
+ const PACKAGE_MANAGER = VERIFIED_PACKAGE_MANAGER;
12
+ const NAVIGATION_PACKAGE = "@solidnative-dev/navigation";
13
+ const SCREENS_PACKAGE = "react-native-screens";
14
+ const NAVIGATION_BACKEND_CONTRACT = `backend/react-native-screens-${VERIFIED_REACT_NATIVE_SCREENS_VERSION}.json`;
15
+ const NAVIGATION_PATCH_RELATIVE_PATH = `patches/react-native-screens@${VERIFIED_REACT_NATIVE_SCREENS_VERSION}.patch`;
16
+ const NAVIGATION_PATCH_KEY = `${SCREENS_PACKAGE}@${VERIFIED_REACT_NATIVE_SCREENS_VERSION}`;
17
+ const SHA256_PATTERN = /^[a-f0-9]{64}$/u;
18
+ const EXACT_VERSION_PATTERN = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u;
19
+ function isObject(value) {
20
+ return value !== null && typeof value === "object" && !Array.isArray(value);
21
+ }
22
+ async function pathExists(target) {
23
+ try {
24
+ await access(target);
25
+ return true;
26
+ }
27
+ catch {
28
+ return false;
29
+ }
30
+ }
31
+ async function readBoundedText(target, maximumBytes, label) {
32
+ const source = await readFile(target);
33
+ if (source.byteLength > maximumBytes) {
34
+ throw new TypeError(`${label} exceeds the ${String(maximumBytes)}-byte limit.`);
35
+ }
36
+ return source.toString("utf8");
37
+ }
38
+ async function readBoundedBytes(target, maximumBytes, label) {
39
+ const source = await readFile(target);
40
+ if (source.byteLength > maximumBytes) {
41
+ throw new TypeError(`${label} exceeds the ${String(maximumBytes)}-byte limit.`);
42
+ }
43
+ return source;
44
+ }
45
+ function parseObject(source, label) {
46
+ let value;
47
+ try {
48
+ value = JSON.parse(source);
49
+ }
50
+ catch (error) {
51
+ const message = error instanceof Error ? error.message : String(error);
52
+ throw new TypeError(`${label} is not valid JSON: ${message}`);
53
+ }
54
+ if (!isObject(value)) {
55
+ throw new TypeError(`${label} must contain an object.`);
56
+ }
57
+ return value;
58
+ }
59
+ function stringRecord(value, label) {
60
+ if (value === undefined)
61
+ return {};
62
+ if (!isObject(value)) {
63
+ throw new TypeError(`${label} must be an object.`);
64
+ }
65
+ const result = {};
66
+ for (const [name, entry] of Object.entries(value)) {
67
+ if (typeof entry !== "string") {
68
+ throw new TypeError(`${label}.${name} must be a string.`);
69
+ }
70
+ result[name] = entry;
71
+ }
72
+ return result;
73
+ }
74
+ function declaredDependency(manifest, packageName) {
75
+ const matches = ["dependencies", "devDependencies", "peerDependencies"]
76
+ .map((section) => ({
77
+ section,
78
+ version: stringRecord(manifest[section], `package.json ${section}`)[packageName],
79
+ }))
80
+ .filter((entry) => entry.version !== undefined);
81
+ if (matches.length > 1) {
82
+ throw new TypeError(`${packageName} is declared in multiple package.json dependency sections.`);
83
+ }
84
+ return matches[0];
85
+ }
86
+ function assertDeclaration(manifest, packageName, expectedVersion) {
87
+ const declaration = declaredDependency(manifest, packageName);
88
+ if (declaration === undefined)
89
+ return;
90
+ if (declaration.section !== "dependencies" ||
91
+ declaration.version !== expectedVersion) {
92
+ throw new TypeError(`${packageName} must be an exact application dependency at ${expectedVersion}; found ${declaration.version} in ${declaration.section}.`);
93
+ }
94
+ }
95
+ async function findProjectRoot(start) {
96
+ let current = await realpath(path.resolve(start));
97
+ while (true) {
98
+ if (await pathExists(path.join(current, "package.json")))
99
+ return current;
100
+ const parent = path.dirname(current);
101
+ if (parent === current)
102
+ return undefined;
103
+ current = parent;
104
+ }
105
+ }
106
+ async function findPackageManager(start) {
107
+ let current = start;
108
+ while (true) {
109
+ const manifestPath = path.join(current, "package.json");
110
+ if (await pathExists(manifestPath)) {
111
+ const manifest = parseObject(await readBoundedText(manifestPath, MAX_MANIFEST_BYTES, `${manifestPath}`), manifestPath);
112
+ if (typeof manifest.packageManager === "string") {
113
+ return manifest.packageManager;
114
+ }
115
+ }
116
+ const parent = path.dirname(current);
117
+ if (parent === current)
118
+ return undefined;
119
+ current = parent;
120
+ }
121
+ }
122
+ function containedPath(root, candidate, label) {
123
+ const relative = path.relative(root, candidate);
124
+ if (relative === "" ||
125
+ relative === ".." ||
126
+ relative.startsWith(`..${path.sep}`) ||
127
+ path.isAbsolute(relative)) {
128
+ throw new TypeError(`${label} must stay inside ${root}.`);
129
+ }
130
+ return candidate;
131
+ }
132
+ async function regularContainedFile(root, candidate, label) {
133
+ containedPath(root, candidate, label);
134
+ const status = await lstat(candidate);
135
+ if (status.isSymbolicLink() || !status.isFile()) {
136
+ throw new TypeError(`${label} must be a regular file.`);
137
+ }
138
+ const canonical = await realpath(candidate);
139
+ containedPath(root, canonical, label);
140
+ if (canonical !== candidate) {
141
+ throw new TypeError(`${label} must not be redirected through a symbolic link.`);
142
+ }
143
+ return canonical;
144
+ }
145
+ function sha256(source) {
146
+ return createHash("sha256").update(source, "utf8").digest("hex");
147
+ }
148
+ function sha256Bytes(source) {
149
+ return createHash("sha256").update(source).digest("hex");
150
+ }
151
+ /** Creates an inspectable exact-package plan without changing the application. */
152
+ export async function createNativePackageAddPlan(options) {
153
+ if (options.capability !== "navigation") {
154
+ throw new TypeError(`Unsupported Solid Native capability ${String(options.capability)}.`);
155
+ }
156
+ const projectRoot = await findProjectRoot(options.cwd ?? process.cwd());
157
+ if (projectRoot === undefined) {
158
+ throw new TypeError("No package.json was found at or above the target.");
159
+ }
160
+ const manifestPath = path.join(projectRoot, "package.json");
161
+ const manifest = parseObject(await readBoundedText(manifestPath, MAX_MANIFEST_BYTES, "Application package.json"), "Application package.json");
162
+ const packageManager = await findPackageManager(projectRoot);
163
+ if (packageManager !== PACKAGE_MANAGER) {
164
+ throw new TypeError(`solid-native add requires ${PACKAGE_MANAGER}; found ${packageManager ?? "no packageManager declaration"}.`);
165
+ }
166
+ const reactNative = declaredDependency(manifest, "react-native");
167
+ if (reactNative?.section !== "dependencies" ||
168
+ reactNative.version !== VERIFIED_REACT_NATIVE_PACKAGE_VERSION) {
169
+ throw new TypeError(`solid-native add requires react-native ${VERIFIED_REACT_NATIVE_PACKAGE_VERSION} as an exact application dependency.`);
170
+ }
171
+ const solidNativeVersion = SOLID_NATIVE_CLI_VERSION;
172
+ if (!EXACT_VERSION_PATTERN.test(solidNativeVersion)) {
173
+ throw new TypeError("The Solid Native recipe version must be one exact semantic version.");
174
+ }
175
+ const core = declaredDependency(manifest, "@solidnative-dev/core");
176
+ if (core?.section !== "dependencies" ||
177
+ (core.version !== solidNativeVersion &&
178
+ core.version !== `^${solidNativeVersion}`)) {
179
+ throw new TypeError(`solid-native add requires @solidnative-dev/core ${solidNativeVersion} (or its compatible caret declaration) in application dependencies.`);
180
+ }
181
+ assertDeclaration(manifest, NAVIGATION_PACKAGE, solidNativeVersion);
182
+ assertDeclaration(manifest, SCREENS_PACKAGE, VERIFIED_REACT_NATIVE_SCREENS_VERSION);
183
+ const installMode = declaredDependency(manifest, NAVIGATION_PACKAGE) !== undefined &&
184
+ declaredDependency(manifest, SCREENS_PACKAGE) !== undefined
185
+ ? "install"
186
+ : "add";
187
+ const targetPath = containedPath(projectRoot, path.resolve(projectRoot, NAVIGATION_PATCH_RELATIVE_PATH), "Navigation patch target");
188
+ return {
189
+ schemaVersion: 0,
190
+ operation: "add",
191
+ capability: options.capability,
192
+ installMode,
193
+ projectRoot,
194
+ packageManager: PACKAGE_MANAGER,
195
+ packages: [
196
+ { name: NAVIGATION_PACKAGE, version: solidNativeVersion },
197
+ {
198
+ name: SCREENS_PACKAGE,
199
+ version: VERIFIED_REACT_NATIVE_SCREENS_VERSION,
200
+ },
201
+ ],
202
+ installCommand: {
203
+ projectRoot,
204
+ command: "pnpm",
205
+ args: installMode === "add"
206
+ ? [
207
+ "add",
208
+ "--save-exact",
209
+ "--ignore-workspace-root-check",
210
+ `${NAVIGATION_PACKAGE}@${solidNativeVersion}`,
211
+ `${SCREENS_PACKAGE}@${VERIFIED_REACT_NATIVE_SCREENS_VERSION}`,
212
+ ]
213
+ : ["install", "--no-frozen-lockfile"],
214
+ },
215
+ patch: {
216
+ packageName: SCREENS_PACKAGE,
217
+ packageVersion: VERIFIED_REACT_NATIVE_SCREENS_VERSION,
218
+ key: NAVIGATION_PATCH_KEY,
219
+ sourcePackage: NAVIGATION_PACKAGE,
220
+ sourceContractPath: NAVIGATION_BACKEND_CONTRACT,
221
+ targetPath,
222
+ },
223
+ finalizeCommand: {
224
+ projectRoot,
225
+ command: "pnpm",
226
+ args: ["install", "--no-frozen-lockfile"],
227
+ },
228
+ };
229
+ }
230
+ function parseNavigationContract(source) {
231
+ const contract = parseObject(source, "Navigation backend contract");
232
+ const patch = contract.patch;
233
+ if (contract.schemaVersion !== 1 ||
234
+ contract.packageName !== SCREENS_PACKAGE ||
235
+ contract.packageVersion !== VERIFIED_REACT_NATIVE_SCREENS_VERSION ||
236
+ contract.reactNativeVersion !== VERIFIED_REACT_NATIVE_PACKAGE_VERSION ||
237
+ !isObject(patch) ||
238
+ patch.path !== NAVIGATION_PATCH_RELATIVE_PATH ||
239
+ typeof patch.sha256 !== "string" ||
240
+ !SHA256_PATTERN.test(patch.sha256) ||
241
+ !Array.isArray(contract.installedFiles) ||
242
+ contract.installedFiles.length === 0 ||
243
+ contract.installedFiles.length > MAX_INSTALLED_BACKEND_FILES) {
244
+ throw new TypeError("The installed navigation backend contract does not match the verified Solid Native recipe.");
245
+ }
246
+ const seenPaths = new Set();
247
+ const installedFiles = contract.installedFiles.map((entry, index) => {
248
+ if (!isObject(entry) ||
249
+ typeof entry.path !== "string" ||
250
+ entry.path.length === 0 ||
251
+ path.isAbsolute(entry.path) ||
252
+ entry.path.split(/[\\/]/u).includes("..") ||
253
+ typeof entry.sha256 !== "string" ||
254
+ !SHA256_PATTERN.test(entry.sha256) ||
255
+ seenPaths.has(entry.path)) {
256
+ throw new TypeError(`Navigation backend installed file ${String(index)} is invalid.`);
257
+ }
258
+ seenPaths.add(entry.path);
259
+ return { path: entry.path, sha256: entry.sha256 };
260
+ });
261
+ return {
262
+ patchPath: patch.path,
263
+ patchSha256: patch.sha256,
264
+ installedFiles,
265
+ };
266
+ }
267
+ async function installPatchFile(projectRoot, targetPath, source, expectedSha256) {
268
+ if (sha256(source) !== expectedSha256) {
269
+ throw new TypeError("The installed navigation patch does not match its backend contract digest.");
270
+ }
271
+ await mkdir(path.dirname(targetPath), { recursive: true });
272
+ const targetParent = await realpath(path.dirname(targetPath));
273
+ if (targetParent !== path.dirname(targetPath)) {
274
+ throw new TypeError(`The application navigation patch directory must not be redirected through a symbolic link: ${path.dirname(targetPath)}.`);
275
+ }
276
+ containedPath(projectRoot, targetParent, "Navigation patch directory");
277
+ if (await pathExists(targetPath)) {
278
+ const targetStatus = await lstat(targetPath);
279
+ if (targetStatus.isSymbolicLink() || !targetStatus.isFile()) {
280
+ throw new TypeError(`The application navigation patch target must be a regular file: ${targetPath}.`);
281
+ }
282
+ const existing = await readBoundedText(targetPath, MAX_PATCH_BYTES, "Existing application navigation patch");
283
+ if (sha256(existing) !== expectedSha256) {
284
+ throw new TypeError(`Refusing to overwrite the different application-owned patch at ${targetPath}.`);
285
+ }
286
+ return;
287
+ }
288
+ const temporaryPath = `${targetPath}.solid-native-${randomUUID()}.tmp`;
289
+ try {
290
+ await writeFile(temporaryPath, source, {
291
+ encoding: "utf8",
292
+ flag: "wx",
293
+ mode: 0o644,
294
+ });
295
+ await link(temporaryPath, targetPath);
296
+ }
297
+ catch (error) {
298
+ if (error?.code === "EEXIST") {
299
+ const targetStatus = await lstat(targetPath);
300
+ if (targetStatus.isSymbolicLink() || !targetStatus.isFile()) {
301
+ throw new TypeError(`The application navigation patch target must be a regular file: ${targetPath}.`);
302
+ }
303
+ const existing = await readBoundedText(targetPath, MAX_PATCH_BYTES, "Existing application navigation patch");
304
+ if (sha256(existing) === expectedSha256)
305
+ return;
306
+ throw new TypeError(`Refusing to overwrite the different application-owned patch at ${targetPath}.`);
307
+ }
308
+ throw error;
309
+ }
310
+ finally {
311
+ await rm(temporaryPath, { force: true });
312
+ }
313
+ }
314
+ function stripYamlInlineComment(value) {
315
+ let inSingleQuote = false;
316
+ let inDoubleQuote = false;
317
+ for (let index = 0; index < value.length; index += 1) {
318
+ const character = value[index];
319
+ if (inDoubleQuote) {
320
+ if (character === "\\") {
321
+ index += 1;
322
+ continue;
323
+ }
324
+ if (character === '"')
325
+ inDoubleQuote = false;
326
+ continue;
327
+ }
328
+ if (inSingleQuote) {
329
+ if (character === "'" && value[index + 1] === "'") {
330
+ index += 1;
331
+ continue;
332
+ }
333
+ if (character === "'")
334
+ inSingleQuote = false;
335
+ continue;
336
+ }
337
+ if (character === '"') {
338
+ inDoubleQuote = true;
339
+ }
340
+ else if (character === "'") {
341
+ inSingleQuote = true;
342
+ }
343
+ else if (character === "#" &&
344
+ (index === 0 || value[index - 1] === " " || value[index - 1] === "\t")) {
345
+ return value.slice(0, index).trimEnd();
346
+ }
347
+ }
348
+ return value.trimEnd();
349
+ }
350
+ function parseYamlScalar(raw, label) {
351
+ const trimmed = stripYamlInlineComment(raw).trim();
352
+ if (trimmed.length === 0) {
353
+ throw new TypeError(`${label} must not be empty.`);
354
+ }
355
+ if (trimmed.startsWith('"')) {
356
+ let parsed;
357
+ try {
358
+ parsed = JSON.parse(trimmed);
359
+ }
360
+ catch {
361
+ throw new TypeError(`${label} contains an invalid double-quoted YAML string.`);
362
+ }
363
+ if (typeof parsed !== "string") {
364
+ throw new TypeError(`${label} must be a string.`);
365
+ }
366
+ return parsed;
367
+ }
368
+ if (trimmed.startsWith("'")) {
369
+ if (!trimmed.endsWith("'") || trimmed.length < 2) {
370
+ throw new TypeError(`${label} contains an unterminated single-quoted YAML string.`);
371
+ }
372
+ return trimmed.slice(1, -1).replaceAll("''", "'");
373
+ }
374
+ if (/^[&*[\]{}|>!%@`]/u.test(trimmed)) {
375
+ throw new TypeError(`${label} uses unsupported YAML syntax.`);
376
+ }
377
+ return trimmed;
378
+ }
379
+ function parseYamlMappingLine(trimmedLine, label) {
380
+ let colonIndex = -1;
381
+ if (trimmedLine.startsWith('"')) {
382
+ let escaped = false;
383
+ for (let index = 1; index < trimmedLine.length; index += 1) {
384
+ const character = trimmedLine[index];
385
+ if (escaped) {
386
+ escaped = false;
387
+ continue;
388
+ }
389
+ if (character === "\\") {
390
+ escaped = true;
391
+ continue;
392
+ }
393
+ if (character === '"') {
394
+ const afterQuote = trimmedLine.slice(index + 1);
395
+ const match = /^\s*:/u.exec(afterQuote);
396
+ if (match !== null) {
397
+ colonIndex = index + 1 + match[0].length - 1;
398
+ }
399
+ break;
400
+ }
401
+ }
402
+ }
403
+ else if (trimmedLine.startsWith("'")) {
404
+ for (let index = 1; index < trimmedLine.length; index += 1) {
405
+ if (trimmedLine[index] === "'") {
406
+ if (trimmedLine[index + 1] === "'") {
407
+ index += 1;
408
+ continue;
409
+ }
410
+ const afterQuote = trimmedLine.slice(index + 1);
411
+ const match = /^\s*:/u.exec(afterQuote);
412
+ if (match !== null) {
413
+ colonIndex = index + 1 + match[0].length - 1;
414
+ }
415
+ break;
416
+ }
417
+ }
418
+ }
419
+ else {
420
+ for (let index = 0; index < trimmedLine.length; index += 1) {
421
+ if (trimmedLine[index] === ":" &&
422
+ (index + 1 === trimmedLine.length ||
423
+ trimmedLine[index + 1] === " " ||
424
+ trimmedLine[index + 1] === "\t")) {
425
+ colonIndex = index;
426
+ break;
427
+ }
428
+ }
429
+ }
430
+ if (colonIndex <= 0) {
431
+ throw new TypeError(`${label} contains an invalid YAML mapping entry.`);
432
+ }
433
+ const key = parseYamlScalar(trimmedLine.slice(0, colonIndex), `${label} key`);
434
+ const rawValue = trimmedLine.slice(colonIndex + 1);
435
+ return { key, rawValue };
436
+ }
437
+ function mergePnpmWorkspacePatchConfig(source, patchKey, patchRelativePath) {
438
+ const newline = source.includes("\r\n") ? "\r\n" : "\n";
439
+ const hadTrailingNewline = source.endsWith("\n");
440
+ const rawLines = source.length === 0 ? [] : source.split(/\r?\n/u);
441
+ if (hadTrailingNewline)
442
+ rawLines.pop();
443
+ let headerIndex = -1;
444
+ for (let index = 0; index < rawLines.length; index += 1) {
445
+ const line = rawLines[index] ?? "";
446
+ const trimmed = line.trim();
447
+ if (trimmed === "" || trimmed.startsWith("#"))
448
+ continue;
449
+ if (trimmed === "---" || trimmed === "...") {
450
+ throw new TypeError("pnpm-workspace.yaml multi-document YAML is not supported by solid-native add.");
451
+ }
452
+ if (/^[ \t]/u.test(line))
453
+ continue;
454
+ const { key } = parseYamlMappingLine(line, "pnpm-workspace.yaml");
455
+ if (key === "patchedDependencies") {
456
+ if (headerIndex !== -1) {
457
+ throw new TypeError("pnpm-workspace.yaml contains duplicate patchedDependencies entries.");
458
+ }
459
+ headerIndex = index;
460
+ }
461
+ }
462
+ if (headerIndex === -1) {
463
+ const nextLines = [
464
+ ...rawLines,
465
+ "patchedDependencies:",
466
+ ` ${patchKey}: ${patchRelativePath}`,
467
+ ];
468
+ return `${nextLines.join(newline)}${newline}`;
469
+ }
470
+ const headerLine = rawLines[headerIndex] ?? "";
471
+ const { rawValue: headerRemainder } = parseYamlMappingLine(headerLine, "pnpm-workspace.yaml");
472
+ const normalizedRemainder = stripYamlInlineComment(headerRemainder).trim();
473
+ if (normalizedRemainder === "{}") {
474
+ const nextLines = [
475
+ ...rawLines.slice(0, headerIndex),
476
+ "patchedDependencies:",
477
+ ` ${patchKey}: ${patchRelativePath}`,
478
+ ...rawLines.slice(headerIndex + 1),
479
+ ];
480
+ return `${nextLines.join(newline)}${newline}`;
481
+ }
482
+ if (normalizedRemainder !== "") {
483
+ throw new TypeError("pnpm-workspace.yaml patchedDependencies must be a YAML block mapping.");
484
+ }
485
+ let sectionIndent;
486
+ let lastEntryIndex = headerIndex;
487
+ let matchedCount = 0;
488
+ for (let index = headerIndex + 1; index < rawLines.length; index += 1) {
489
+ const line = rawLines[index] ?? "";
490
+ const trimmed = line.trim();
491
+ if (trimmed === "" || trimmed.startsWith("#"))
492
+ continue;
493
+ const indentMatch = /^([ ]+)/u.exec(line);
494
+ if (indentMatch === null) {
495
+ if (line.startsWith("\t")) {
496
+ throw new TypeError("pnpm-workspace.yaml patchedDependencies must use spaces for indentation.");
497
+ }
498
+ break;
499
+ }
500
+ const indent = indentMatch[1] ?? " ";
501
+ if (sectionIndent === undefined) {
502
+ sectionIndent = indent;
503
+ }
504
+ else if (indent !== sectionIndent) {
505
+ throw new TypeError("pnpm-workspace.yaml patchedDependencies contains unsupported nested or misaligned entries.");
506
+ }
507
+ const { key, rawValue } = parseYamlMappingLine(trimmed, "pnpm-workspace.yaml patchedDependencies");
508
+ const value = parseYamlScalar(rawValue, `pnpm-workspace.yaml patchedDependencies.${key}`);
509
+ if (key === patchKey) {
510
+ if (value !== patchRelativePath) {
511
+ throw new TypeError(`Refusing to replace the existing ${patchKey} patch mapping ${value}.`);
512
+ }
513
+ matchedCount += 1;
514
+ }
515
+ lastEntryIndex = index;
516
+ }
517
+ if (matchedCount > 1) {
518
+ throw new TypeError(`pnpm-workspace.yaml patchedDependencies contains duplicate ${patchKey} entries.`);
519
+ }
520
+ if (matchedCount === 1) {
521
+ return source;
522
+ }
523
+ const entryIndent = sectionIndent ?? " ";
524
+ const nextLines = [
525
+ ...rawLines.slice(0, lastEntryIndex + 1),
526
+ `${entryIndent}${patchKey}: ${patchRelativePath}`,
527
+ ...rawLines.slice(lastEntryIndex + 1),
528
+ ];
529
+ return `${nextLines.join(newline)}${newline}`;
530
+ }
531
+ async function updateApplicationManifest(plan) {
532
+ const manifestPath = path.join(plan.projectRoot, "package.json");
533
+ const manifestStatus = await lstat(manifestPath);
534
+ if (manifestStatus.isSymbolicLink() || !manifestStatus.isFile()) {
535
+ throw new TypeError("The application package.json must be a regular file before solid-native add can update it.");
536
+ }
537
+ const original = await readBoundedText(manifestPath, MAX_MANIFEST_BYTES, "Application package.json");
538
+ const manifest = parseObject(original, "Application package.json");
539
+ assertDeclaration(manifest, NAVIGATION_PACKAGE, plan.packages[0].version);
540
+ assertDeclaration(manifest, SCREENS_PACKAGE, VERIFIED_REACT_NATIVE_SCREENS_VERSION);
541
+ const navigation = declaredDependency(manifest, NAVIGATION_PACKAGE);
542
+ const screens = declaredDependency(manifest, SCREENS_PACKAGE);
543
+ if (navigation?.section !== "dependencies" ||
544
+ navigation.version !== plan.packages[0].version ||
545
+ screens?.section !== "dependencies" ||
546
+ screens.version !== VERIFIED_REACT_NATIVE_SCREENS_VERSION) {
547
+ throw new TypeError("The package manager did not install the exact navigation recipe dependencies.");
548
+ }
549
+ const pnpm = manifest.pnpm;
550
+ if (pnpm !== undefined) {
551
+ if (!isObject(pnpm)) {
552
+ throw new TypeError("package.json pnpm must be an object.");
553
+ }
554
+ const legacyPatches = stringRecord(pnpm.patchedDependencies, "package.json pnpm.patchedDependencies");
555
+ const legacyPatch = legacyPatches[plan.patch.key];
556
+ if (legacyPatch !== undefined &&
557
+ legacyPatch !== NAVIGATION_PATCH_RELATIVE_PATH) {
558
+ throw new TypeError(`Refusing to replace the existing ${plan.patch.key} patch mapping ${legacyPatch}.`);
559
+ }
560
+ }
561
+ const workspaceConfigPath = path.join(plan.projectRoot, "pnpm-workspace.yaml");
562
+ const exists = await pathExists(workspaceConfigPath);
563
+ if (!exists) {
564
+ const next = mergePnpmWorkspacePatchConfig("", plan.patch.key, NAVIGATION_PATCH_RELATIVE_PATH);
565
+ const temporaryPath = `${workspaceConfigPath}.solid-native-${randomUUID()}.tmp`;
566
+ try {
567
+ await writeFile(temporaryPath, next, {
568
+ encoding: "utf8",
569
+ flag: "wx",
570
+ mode: 0o644,
571
+ });
572
+ await link(temporaryPath, workspaceConfigPath);
573
+ return;
574
+ }
575
+ catch (error) {
576
+ if (error?.code !== "EEXIST") {
577
+ throw error;
578
+ }
579
+ throw new TypeError("pnpm-workspace.yaml was created while solid-native add was configuring the navigation patch; no workspace update was written.");
580
+ }
581
+ finally {
582
+ await rm(temporaryPath, { force: true });
583
+ }
584
+ }
585
+ const workspaceStatus = await lstat(workspaceConfigPath);
586
+ if (workspaceStatus.isSymbolicLink() || !workspaceStatus.isFile()) {
587
+ throw new TypeError("The application pnpm-workspace.yaml must be a regular file before solid-native add can update it.");
588
+ }
589
+ const originalWorkspace = await readBoundedText(workspaceConfigPath, MAX_MANIFEST_BYTES, "Application pnpm-workspace.yaml");
590
+ const nextWorkspace = mergePnpmWorkspacePatchConfig(originalWorkspace, plan.patch.key, NAVIGATION_PATCH_RELATIVE_PATH);
591
+ if (nextWorkspace === originalWorkspace)
592
+ return;
593
+ const temporaryPath = `${workspaceConfigPath}.solid-native-${randomUUID()}.tmp`;
594
+ try {
595
+ await writeFile(temporaryPath, nextWorkspace, {
596
+ encoding: "utf8",
597
+ flag: "wx",
598
+ mode: workspaceStatus.mode & 0o777,
599
+ });
600
+ const currentWorkspace = await readFile(workspaceConfigPath, "utf8");
601
+ if (currentWorkspace !== originalWorkspace) {
602
+ throw new TypeError("pnpm-workspace.yaml changed while solid-native add was configuring the navigation patch; no workspace update was written.");
603
+ }
604
+ await rename(temporaryPath, workspaceConfigPath);
605
+ }
606
+ finally {
607
+ await rm(temporaryPath, { force: true });
608
+ }
609
+ }
610
+ async function installedPackageRoot(projectRoot, packageName, expectedVersion) {
611
+ const packageRoot = await realpath(path.join(projectRoot, "node_modules", packageName));
612
+ const manifestPath = await regularContainedFile(packageRoot, path.join(packageRoot, "package.json"), `Installed ${packageName} package.json`);
613
+ const manifest = parseObject(await readBoundedText(manifestPath, MAX_MANIFEST_BYTES, `Installed ${packageName} package.json`), `Installed ${packageName} package.json`);
614
+ if (manifest.name !== packageName || manifest.version !== expectedVersion) {
615
+ throw new TypeError(`The installed ${packageName} identity does not match ${expectedVersion}.`);
616
+ }
617
+ return packageRoot;
618
+ }
619
+ async function loadNavigationContract(navigationPackageRoot, relativePath) {
620
+ const contractPath = await regularContainedFile(navigationPackageRoot, path.resolve(navigationPackageRoot, relativePath), "Navigation backend contract");
621
+ return parseNavigationContract(await readBoundedText(contractPath, MAX_BACKEND_CONTRACT_BYTES, "Navigation backend contract"));
622
+ }
623
+ async function configureNavigationPatch(plan) {
624
+ await installedPackageRoot(plan.projectRoot, "@solidnative-dev/core", plan.packages[0].version);
625
+ const navigationPackageRoot = await installedPackageRoot(plan.projectRoot, NAVIGATION_PACKAGE, plan.packages[0].version);
626
+ await installedPackageRoot(plan.projectRoot, SCREENS_PACKAGE, VERIFIED_REACT_NATIVE_SCREENS_VERSION);
627
+ const contract = await loadNavigationContract(navigationPackageRoot, plan.patch.sourceContractPath);
628
+ const patchPath = await regularContainedFile(navigationPackageRoot, path.resolve(navigationPackageRoot, contract.patchPath), "Navigation patch source");
629
+ const patchSource = await readBoundedText(patchPath, MAX_PATCH_BYTES, "Installed navigation patch");
630
+ await installPatchFile(plan.projectRoot, plan.patch.targetPath, patchSource, contract.patchSha256);
631
+ await updateApplicationManifest(plan);
632
+ }
633
+ async function verifyInstalledNavigationBackend(plan) {
634
+ await installedPackageRoot(plan.projectRoot, "@solidnative-dev/core", plan.packages[0].version);
635
+ const navigationPackageRoot = await installedPackageRoot(plan.projectRoot, NAVIGATION_PACKAGE, plan.packages[0].version);
636
+ const screensPackageRoot = await installedPackageRoot(plan.projectRoot, SCREENS_PACKAGE, VERIFIED_REACT_NATIVE_SCREENS_VERSION);
637
+ const contract = await loadNavigationContract(navigationPackageRoot, plan.patch.sourceContractPath);
638
+ const applicationPatchPath = await regularContainedFile(plan.projectRoot, plan.patch.targetPath, "Application navigation patch");
639
+ const applicationPatch = await readBoundedText(applicationPatchPath, MAX_PATCH_BYTES, "Application navigation patch");
640
+ if (sha256(applicationPatch) !== contract.patchSha256) {
641
+ throw new TypeError("The application navigation patch changed before backend verification.");
642
+ }
643
+ const mismatches = [];
644
+ for (const entry of contract.installedFiles) {
645
+ const installedPath = await regularContainedFile(screensPackageRoot, path.resolve(screensPackageRoot, entry.path), `Installed ${SCREENS_PACKAGE} file ${entry.path}`);
646
+ const source = await readBoundedBytes(installedPath, MAX_INSTALLED_BACKEND_FILE_BYTES, `Installed ${SCREENS_PACKAGE} file ${entry.path}`);
647
+ if (sha256Bytes(source) !== entry.sha256)
648
+ mismatches.push(entry.path);
649
+ }
650
+ if (mismatches.length > 0) {
651
+ throw new TypeError(`The package manager did not apply the verified navigation patch to: ${mismatches.join(", ")}.`);
652
+ }
653
+ }
654
+ export const defaultNativePackageAddExecutor = (command, context) => new Promise((resolve, reject) => {
655
+ const forwardedSignals = new Map();
656
+ let forwardedSignal;
657
+ const child = spawn(command.command, [...command.args], {
658
+ cwd: command.projectRoot,
659
+ env: context.env,
660
+ stdio: "inherit",
661
+ });
662
+ const removeSignalHandlers = () => {
663
+ for (const [signal, handler] of forwardedSignals) {
664
+ process.removeListener(signal, handler);
665
+ }
666
+ forwardedSignals.clear();
667
+ };
668
+ for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {
669
+ const handler = () => {
670
+ forwardedSignal ??= signal;
671
+ child.kill(signal);
672
+ };
673
+ forwardedSignals.set(signal, handler);
674
+ process.on(signal, handler);
675
+ }
676
+ child.once("error", (error) => {
677
+ removeSignalHandlers();
678
+ reject(error);
679
+ });
680
+ child.once("close", (exitCode, signal) => {
681
+ removeSignalHandlers();
682
+ if (forwardedSignal !== undefined) {
683
+ resolve(forwardedSignal === "SIGHUP"
684
+ ? 129
685
+ : forwardedSignal === "SIGINT"
686
+ ? 130
687
+ : 143);
688
+ return;
689
+ }
690
+ if (exitCode !== null) {
691
+ resolve(exitCode);
692
+ return;
693
+ }
694
+ resolve(signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 1);
695
+ });
696
+ });
697
+ function assertNativePackageAddPlan(plan) {
698
+ const version = plan.packages[0]?.version;
699
+ const expectedTarget = path.resolve(plan.projectRoot, NAVIGATION_PATCH_RELATIVE_PATH);
700
+ const expectedInstallArgs = [
701
+ "add",
702
+ "--save-exact",
703
+ "--ignore-workspace-root-check",
704
+ `${NAVIGATION_PACKAGE}@${version}`,
705
+ `${SCREENS_PACKAGE}@${VERIFIED_REACT_NATIVE_SCREENS_VERSION}`,
706
+ ];
707
+ const expectedExistingInstallArgs = ["install", "--no-frozen-lockfile"];
708
+ if (plan.schemaVersion !== 0 ||
709
+ plan.operation !== "add" ||
710
+ plan.capability !== "navigation" ||
711
+ (plan.installMode !== "add" && plan.installMode !== "install") ||
712
+ plan.packageManager !== PACKAGE_MANAGER ||
713
+ !path.isAbsolute(plan.projectRoot) ||
714
+ version === undefined ||
715
+ version !== SOLID_NATIVE_CLI_VERSION ||
716
+ plan.packages.length !== 2 ||
717
+ plan.packages[0].name !== NAVIGATION_PACKAGE ||
718
+ plan.packages[1].name !== SCREENS_PACKAGE ||
719
+ plan.packages[1].version !== VERIFIED_REACT_NATIVE_SCREENS_VERSION ||
720
+ plan.patch.packageName !== SCREENS_PACKAGE ||
721
+ plan.patch.packageVersion !== VERIFIED_REACT_NATIVE_SCREENS_VERSION ||
722
+ plan.patch.key !== NAVIGATION_PATCH_KEY ||
723
+ plan.patch.sourcePackage !== NAVIGATION_PACKAGE ||
724
+ plan.patch.sourceContractPath !== NAVIGATION_BACKEND_CONTRACT ||
725
+ plan.patch.targetPath !== expectedTarget ||
726
+ plan.installCommand.projectRoot !== plan.projectRoot ||
727
+ plan.installCommand.command !== "pnpm" ||
728
+ JSON.stringify(plan.installCommand.args) !==
729
+ JSON.stringify(plan.installMode === "add"
730
+ ? expectedInstallArgs
731
+ : expectedExistingInstallArgs) ||
732
+ plan.finalizeCommand.projectRoot !== plan.projectRoot ||
733
+ plan.finalizeCommand.command !== "pnpm" ||
734
+ JSON.stringify(plan.finalizeCommand.args) !==
735
+ JSON.stringify(["install", "--no-frozen-lockfile"])) {
736
+ throw new TypeError("The Solid Native package-add plan is invalid.");
737
+ }
738
+ }
739
+ /** Installs, configures, and reapplies one reviewed package recipe. */
740
+ export async function executeNativePackageAddPlan(plan, options = {}) {
741
+ assertNativePackageAddPlan(plan);
742
+ if ((await realpath(plan.projectRoot)) !== plan.projectRoot) {
743
+ throw new TypeError("The Solid Native package-add project root is not canonical.");
744
+ }
745
+ const executor = options.executor ?? defaultNativePackageAddExecutor;
746
+ const context = { env: options.env ?? process.env };
747
+ const installStatus = await executor(plan.installCommand, context);
748
+ if (installStatus !== 0)
749
+ return installStatus;
750
+ await configureNavigationPatch(plan);
751
+ const finalizeStatus = await executor(plan.finalizeCommand, context);
752
+ if (finalizeStatus !== 0)
753
+ return finalizeStatus;
754
+ await verifyInstalledNavigationBackend(plan);
755
+ return 0;
756
+ }
757
+ export function formatNativePackageAddPlan(plan) {
758
+ const quote = (value) => /^[A-Za-z0-9_./:@^+=,-]+$/u.test(value)
759
+ ? value
760
+ : `'${value.replaceAll("'", `'\\''`)}'`;
761
+ const formatCommand = (command) => [command.command, ...command.args].map(quote).join(" ");
762
+ return `${formatCommand(plan.installCommand)}\nCopy verified patch to ${quote(path.relative(plan.projectRoot, plan.patch.targetPath))}\n${formatCommand(plan.finalizeCommand)}`;
763
+ }
764
+ //# sourceMappingURL=package-add.js.map