@legendapp/spark 0.0.1 → 0.0.2

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 (102) hide show
  1. package/native.d.cts +6 -3
  2. package/package.json +36 -28
  3. package/patches/react-native-enriched-markdown@1.1.1.patch +141 -10
  4. package/skills/spark/UPGRADING.md +88 -3
  5. package/vendor/node_modules/@legendapp/spark-ai/package.json +5 -5
  6. package/vendor/node_modules/@legendapp/spark-audio/package.json +5 -5
  7. package/vendor/node_modules/@legendapp/spark-audio/src/index.macos.ts +1 -0
  8. package/vendor/node_modules/@legendapp/spark-auth-session/package.json +6 -6
  9. package/vendor/node_modules/@legendapp/spark-auth-session/src/index.macos.ts +1 -0
  10. package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +2 -2
  11. package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +11 -2
  12. package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -2
  13. package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +8 -4
  14. package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +45 -1
  15. package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +8 -1
  16. package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +2 -2
  17. package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +3 -3
  18. package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-preload.cjs +3 -0
  19. package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +26 -7
  20. package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +3 -1
  21. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +20 -5
  22. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +1 -0
  23. package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +7 -2
  24. package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +3 -3
  25. package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +16 -10
  26. package/vendor/node_modules/@legendapp/spark-cli/dist/release-runner-root.js +108 -0
  27. package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +13 -13
  28. package/vendor/node_modules/@legendapp/spark-cli/dist/watchman.js +12 -0
  29. package/vendor/node_modules/@legendapp/spark-cli/dist/windows-geometry.js +2 -2
  30. package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -1
  31. package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
  32. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +1 -1
  33. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +27 -25
  34. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +1 -1
  35. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +35 -33
  36. package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +29 -27
  37. package/vendor/node_modules/@legendapp/spark-clipboard/package.json +5 -5
  38. package/vendor/node_modules/@legendapp/spark-clipboard/src/index.macos.ts +1 -0
  39. package/vendor/node_modules/@legendapp/spark-codex/package.json +4 -4
  40. package/vendor/node_modules/@legendapp/spark-commands/package.json +7 -7
  41. package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -4
  42. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +7 -2
  43. package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +3 -3
  44. package/vendor/node_modules/@legendapp/spark-desktop-config/accessibility-state.cjs +2 -2
  45. package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +12 -0
  46. package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +4 -4
  47. package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +1 -1
  48. package/vendor/node_modules/@legendapp/spark-desktop-config/fabric-lifecycle.cjs +1 -1
  49. package/vendor/node_modules/@legendapp/spark-desktop-config/keyboard-events.cjs +2 -2
  50. package/vendor/node_modules/@legendapp/spark-desktop-config/macos-host.cjs +39 -0
  51. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +47 -12
  52. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +2 -1
  53. package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +8 -6
  54. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-scroll-view.cjs +2 -2
  55. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-alignment.cjs +2 -2
  56. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-input-alignment.cjs +2 -2
  57. package/vendor/node_modules/@legendapp/spark-desktop-config/text-input-accessibility.cjs +2 -2
  58. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/AppDelegate.h +6 -0
  59. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/Main.storyboard +684 -0
  60. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/main.m +5 -0
  61. package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +3 -2
  62. package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +5 -5
  63. package/vendor/node_modules/@legendapp/spark-desktop-links/src/index.macos.ts +1 -0
  64. package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +4 -4
  65. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +68 -17
  66. package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +5 -5
  67. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +2 -1
  68. package/vendor/node_modules/@legendapp/spark-documents/package.json +9 -9
  69. package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -4
  70. package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +4 -4
  71. package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +14 -5
  72. package/vendor/node_modules/@legendapp/spark-file-system/package.json +4 -4
  73. package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +1 -1
  74. package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -4
  75. package/vendor/node_modules/@legendapp/spark-html/package.json +4 -4
  76. package/vendor/node_modules/@legendapp/spark-markdown/package.json +4 -4
  77. package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +4 -4
  78. package/vendor/node_modules/@legendapp/spark-native-menu/package.json +4 -4
  79. package/vendor/node_modules/@legendapp/spark-notifications/package.json +4 -4
  80. package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +110 -19
  81. package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -4
  82. package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +17 -3
  83. package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +6 -0
  84. package/vendor/node_modules/@legendapp/spark-rich-text/package.json +4 -4
  85. package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +5 -5
  86. package/vendor/node_modules/@legendapp/spark-secure-storage/src/index.macos.ts +1 -0
  87. package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
  88. package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +6 -6
  89. package/vendor/node_modules/@legendapp/spark-sqlite/package.json +12 -5
  90. package/vendor/node_modules/@legendapp/spark-system/package.json +4 -4
  91. package/vendor/node_modules/@legendapp/spark-tray/package.json +4 -4
  92. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +82 -18
  93. package/vendor/node_modules/@legendapp/spark-ui/package.json +6 -6
  94. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +4 -0
  95. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +11 -9
  96. package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +20 -10
  97. package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +15 -10
  98. package/vendor/node_modules/@legendapp/spark-ui/src/index.macos.tsx +1 -0
  99. package/vendor/node_modules/@legendapp/spark-updates/package.json +4 -4
  100. package/vendor/node_modules/@legendapp/spark-webview/package.json +11 -4
  101. package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
  102. package/camera.ts +0 -13
@@ -46,7 +46,9 @@ export async function refreshLocalPackages(root, manifest, selectedManager) {
46
46
  await installWithEnrichedHtmlPins(root, manager);
47
47
  upgradeManagedEntry(root);
48
48
  }
49
- export async function create(root, archiveManifest, platform = hostPlatform(), universal = false, example, selectedManager) {
49
+ /** A placeholder ID for new apps: lowercase letters, digits and hyphens, starting with a letter. */
50
+ export const exampleBundleId = (name) => `com.example.${name.toLowerCase().replace(/[^a-z0-9-]/g, "").replace(/^[^a-z]+/, "") || "app"}`;
51
+ export async function create(root, archiveManifest, platform = hostPlatform(), universal = false, example, selectedManager, bundleId) {
50
52
  if (!(universal || example) && !["macos", "windows"].includes(platform))
51
53
  throw new Error("Use create --universal for mobile/web targets");
52
54
  archiveManifest ??= creationManifest();
@@ -73,7 +75,8 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
73
75
  overrides[name] = file;
74
76
  if (pkg.dependencies[name])
75
77
  pkg.dependencies[name] = file;
76
- if (pkg.allowScripts?.[name])
78
+ // Spark itself comes from the registry as a bare version, which npm would read as a package name.
79
+ if (pkg.allowScripts?.[name] && file.startsWith("file:"))
77
80
  pkg.allowScripts[file] = true;
78
81
  }
79
82
  applyOverrides(pkg, overrides, manager);
@@ -94,7 +97,7 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
94
97
  // Expo needs file: to distinguish Windows drive paths from npm package names.
95
98
  const child = spawnProcess(nodeCommand(path.resolve(import.meta.dirname, ".."), "expo-desktop", "expo-desktop", [
96
99
  "create-app", root, "--template", `file:${templateFile}`, "--yes", "--no-agents-md",
97
- "--display-name", name, "--rdns", `so.legend.spark.prototype.${name.toLowerCase()}`, ...(pnp ? ["--no-install"] : []),
100
+ "--display-name", name, "--rdns", bundleId ?? exampleBundleId(name), ...(pnp ? ["--no-install"] : []),
98
101
  ]), { cwd: process.cwd(), env: { ...process.env, PATH: `${npmBin}${path.delimiter}${process.env.PATH ?? ""}`, npm_config_user_agent: `${manager}/spark`, CI: "1", ...(pnp ? { NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ""} ${pnpWriteFile}` } : {}), ...(manager === "yarn" ? { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" } : {}) }, stdout: "pipe", stderr: "inherit" });
99
102
  // Spark owns the next steps; Expo's final block requires an unnecessary prebuild.
100
103
  let projectReady = false;
@@ -141,7 +144,8 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
141
144
  }
142
145
  await configureExample(root, example);
143
146
  }
144
- console.log(`Created ${root}.\n\n cd ${JSON.stringify(root)}\n ${manager} run ${platform}`);
147
+ const rename = bundleId || variant === "windows" ? "" : `\n\nBefore you ship, change bundleIdentifier in desktop.config.json from ${exampleBundleId(path.basename(root))} to an ID you own.`;
148
+ console.log(`Created ${root}.\n\n cd ${JSON.stringify(root)}\n ${manager} run ${platform}${rename}`);
145
149
  }
146
150
  export function upgradeManagedEntry(root) {
147
151
  const oldMetro = `const { makeMetroConfig } = require("expo-desktop-metro-config");
@@ -1,12 +1,56 @@
1
1
  import { overridePackageName } from "./package-manager.js";
2
- import { readFileSync, writeFileSync } from "node:fs";
2
+ import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
+ import { createRequire } from "node:module";
4
5
  import ts from "typescript";
5
6
  import { supportedPlatforms } from "@legendapp/spark-desktop-config/config.cjs";
6
7
  const packages = ["react", "react-native", "react-native-macos", "expo"];
7
8
  // create/refreshLocalPackages use this starter's tested compatibility matrix too.
8
9
  const defaults = JSON.parse(readFileSync(new URL("../templates/blank-typescript/package.json", import.meta.url), "utf8"));
9
10
  export const expectedDependencyPins = Object.fromEntries(packages.map(name => [name, defaults.dependencies[name]]));
11
+ /** Optional feature backends belong to the app, even when Spark supplies the API. */
12
+ export function optionalBackendIssues(root) {
13
+ const backends = {
14
+ "@legendapp/spark/markdown": "react-native-enriched-markdown",
15
+ "@legendapp/spark/html": "react-native-enriched-html",
16
+ "@legendapp/spark/webview": "react-native-webview",
17
+ "@legendapp/spark/sqlite": "@op-engineering/op-sqlite",
18
+ };
19
+ const pkg = JSON.parse(readFileSync(path.join(root, "package.json"), "utf8"));
20
+ const dependencies = { ...pkg.dependencies, ...pkg.devDependencies, ...pkg.optionalDependencies };
21
+ const platforms = supportedPlatforms(root);
22
+ const req = createRequire(path.join(root, "package.json"));
23
+ const issues = new Map();
24
+ function visit(directory) {
25
+ for (const entry of readdirSync(directory, { withFileTypes: true })) {
26
+ const file = path.join(directory, entry.name);
27
+ if (entry.isDirectory() && !["node_modules", ".git", ".spark", "spark-packages", "build", "dist", "Pods"].includes(entry.name))
28
+ visit(file);
29
+ else if (entry.isFile() && /\.[cm]?[jt]sx?$/.test(file)) {
30
+ const suffix = /\.(ios|android|macos|windows|web|native|desktop)\.[cm]?[jt]sx?$/.exec(entry.name)?.[1];
31
+ if (suffix && !platforms.some(platform => suffix === platform || (suffix === "native" && platform !== "web") || (suffix === "desktop" && ["macos", "windows"].includes(platform))))
32
+ continue;
33
+ const source = readFileSync(file, "utf8");
34
+ if (!source.includes("@legendapp/spark/"))
35
+ continue;
36
+ for (const imported of ts.preProcessFile(source, true, true).importedFiles) {
37
+ const name = backends[imported.fileName];
38
+ if (!name || issues.has(name))
39
+ continue;
40
+ const installed = req.resolve.paths(name)?.some(base => existsSync(path.join(base, name, "package.json")));
41
+ if (!dependencies[name] || !installed)
42
+ issues.set(name, {
43
+ package: name, found: dependencies[name] ? "(not installed)" : "(not declared)",
44
+ expected: defaults.overrides[name], missing: true,
45
+ where: ["dependencies", name, `Install for ${imported.fileName} in ${path.relative(root, file)}${["react-native-webview", "@op-engineering/op-sqlite"].includes(name) ? ", keeping the SDK archive override (spark upgrade)" : ""}`],
46
+ });
47
+ }
48
+ }
49
+ }
50
+ }
51
+ visit(root);
52
+ return [...issues.values()];
53
+ }
10
54
  export function dependencyPinIssues(pkg, platforms, expected = expectedDependencyPins) {
11
55
  const required = [...packages, ...(expected["@legendapp/spark"] ? ["@legendapp/spark"] : [])].filter(name => name !== "react-native-macos" || platforms.includes("macos"));
12
56
  const checked = Object.keys(expected).filter(name => name !== "react-native-macos" || platforms.includes("macos"));
@@ -13,6 +13,7 @@ import { createRequire } from "node:module";
13
13
  const { preparePatch } = createRequire(import.meta.url)("./expo-dev-patch.cjs");
14
14
  import { findGo, readRuntime, registerRuntime } from "./local.js";
15
15
  import { sessionStatus } from "./session-status.js";
16
+ import { watchmanStalls } from "./watchman.js";
16
17
  import { assertNativePatchPreflight } from "./native-patch-preflight.js";
17
18
  import { prepareConfig, dependencyStamp, goConfigurationIssues, incompatible, nativePackages, readJson, projectEnvironment, runtimeFor, stateFile, writeJson, } from "./project.js";
18
19
  export async function launch(root, app, port, options = {}) {
@@ -81,6 +82,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
81
82
  // Without --no-open the session opens the desktop app itself, so a missing Runner downloads without a keypress.
82
83
  let autoOpen = !noOpen;
83
84
  let metro;
85
+ let skipWatchman;
84
86
  let finish;
85
87
  const finished = new Promise((resolve) => {
86
88
  finish = resolve;
@@ -95,6 +97,11 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
95
97
  }
96
98
  if (closing)
97
99
  return;
100
+ if (skipWatchman === undefined) {
101
+ skipWatchman = await watchmanStalls(root);
102
+ if (skipWatchman)
103
+ console.warn("Watchman is not responding, so Metro will scan files without it this session. To fix Watchman, run: watchman watch-del-all && watchman shutdown-server");
104
+ }
98
105
  let ready;
99
106
  const started = new Promise(resolve => { ready = resolve; });
100
107
  const [, expo, ...args] = nodeCommand(root, "expo", "expo", [
@@ -105,7 +112,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
105
112
  const child = spawnProcess([
106
113
  "node", "--require", path.join(import.meta.dirname, "expo-dev-preload.cjs"), expo, ...args,
107
114
  ], {
108
- cwd: root, env: { ...process.env, SPARK_PLATFORM: platform, SPARK_DEV_SESSION: "1" },
115
+ cwd: root, env: { ...process.env, SPARK_PLATFORM: platform, SPARK_DEV_SESSION: "1", ...(skipWatchman ? { SPARK_METRO_NO_WATCHMAN: "1" } : {}) },
109
116
  stdin: "inherit", stdout: "inherit", stderr: "inherit", serialization: "json",
110
117
  ipc(message, sender) {
111
118
  if (message?.type === "spark:ready") {
@@ -14,11 +14,11 @@ export async function configureExample(root, example) {
14
14
  const desktop = suffixes.map(name => name === "desktop" ? "@legendapp/spark" : `@legendapp/spark-${name}`);
15
15
  if (!pkg.dependencies["@legendapp/spark"])
16
16
  throw new Error("SDK example requires @legendapp/spark");
17
- Object.assign(pkg.dependencies, { "expo-document-picker": "14.0.8", "expo-file-system": "19.0.24", "expo-sharing": "14.0.8" });
17
+ Object.assign(pkg.dependencies, { "expo-document-picker": "55.0.17", "expo-file-system": "55.0.26", "expo-sharing": "55.0.25" });
18
18
  if (example !== "document-editor")
19
19
  pkg.dependencies["@react-native-async-storage/async-storage"] = "2.2.0";
20
20
  if (example === "music-lite")
21
- pkg.dependencies["expo-audio"] = pkg.dependencies["expo-audio"] ?? pkg.overrides?.["expo-audio"] ?? pkg.resolutions?.["expo-audio"] ?? pkg.pnpm?.overrides?.["expo-audio"] ?? "1.1.1";
21
+ pkg.dependencies["expo-audio"] = pkg.dependencies["expo-audio"] ?? pkg.overrides?.["expo-audio"] ?? pkg.resolutions?.["expo-audio"] ?? pkg.pnpm?.overrides?.["expo-audio"] ?? "55.0.18";
22
22
  if (example === "diff-lite")
23
23
  pkg.dependencies["diff"] = "8.0.2";
24
24
  writeJson(path.join(root, "package.json"), pkg);
@@ -3,18 +3,18 @@ const path = require('node:path');
3
3
  const { createRequire } = require('node:module');
4
4
  const { createHash } = require('node:crypto');
5
5
 
6
- const VERSION = '54.0.27';
6
+ const VERSION = '55.0.37';
7
7
  const extension = JSON.stringify(path.join(__dirname, 'expo-dev-extension.cjs'));
8
8
  // Process-local patches: installed Expo files remain untouched. Verify the exact
9
9
  // upstream inputs before starting, so an Expo upgrade cannot silently lose keys.
10
10
  const patches = [
11
- ['interface/commandsTable.js', 'eeb1700b0ae26613bf6dedab556479a4c15d3a3c94c63ecbb5db21c4899e1645',
11
+ ['interface/commandsTable.js', '6d809faa4721fd68e86af40372e6aef7f729902afc1a1484f66cade067db4792',
12
12
  'function logCommandsTable(ui) {',
13
13
  `function logCommandsTable(ui) {\n ui = require(${extension}).integrateCommands(ui);`],
14
14
  ['interface/startInterface.js', 'c8e55431b18a37e1ab2be22f068c980e9cc41ffc105ea7478e34fc11b91a22bd',
15
15
  ' const onPressAsync = async (key)=>{',
16
16
  ` const onPressAsync = async (key)=>{\n try {\n if (await require(${extension}).handleKey(key)) return;\n } catch (error) {\n _log.exception(error);\n return;\n }`],
17
- ['startAsync.js', '0e062078e63ad6264b1393d403ad56d65a38c6430d30fdac50cd656486cd418b',
17
+ ['startAsync.js', 'fb52b3bd7962ad13c57c1a6e4050c9cc1420197186df7d0259d74ddbd79ae46b',
18
18
  ' await (0, _profile.profile)(devServerManager.startAsync.bind(devServerManager))(startOptions);',
19
19
  // Dependency validation can wait on the network after Metro is listening.
20
20
  // Report actual server readiness before those optional startup checks.
@@ -6,6 +6,9 @@ const { preparePatch } = require('./expo-dev-patch.cjs');
6
6
  if (!process.env.SPARK_EXPO_PRELOADED) {
7
7
  process.env.SPARK_EXPO_PRELOADED = '1';
8
8
  if (!process.send) throw new Error('Start the Spark Expo integration through spark dev.');
9
+ // Expo 55 binds --localhost to "localhost", which Node resolves to ::1 first;
10
+ // desktop runtimes and Spark's Metro clients connect to 127.0.0.1.
11
+ require('node:dns').setDefaultResultOrder('ipv4first');
9
12
  const patches = preparePatch(process.cwd());
10
13
  const load = Module._extensions['.js'];
11
14
  Module._extensions['.js'] = function(module, filename) {
@@ -3,11 +3,12 @@ import { publishCustomize } from "./customize-artifacts.js";
3
3
  import { nodeCommand, spawnProcess } from "./process.js";
4
4
  import { examples } from "./examples.js";
5
5
  import { prepareGoProfile } from "./go-profile.js";
6
+ import { mirrorRunner, preservedBuildState, releaseRunnerRoot, releaseRunnerStaging, rewritePathRecords, syncTree } from "./release-runner-root.js";
6
7
  import { exportSDK, importSDK } from "./sdk-transfer.js";
7
8
  import { hostPlatform } from "./platform.js";
8
9
  import path from "node:path";
9
10
  import { cliArguments } from "./cli-arguments.js";
10
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
11
+ import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
11
12
  import { prepareConfig, readConfig, isExpoProject } from "@legendapp/spark-desktop-config/config.cjs";
12
13
  import { prepareWindows } from "./windows.js";
13
14
  import { create, refreshLocalPackages } from "./create.js";
@@ -22,7 +23,7 @@ import { doctor, run } from "./commands.js";
22
23
  import { findFramework, findProject, sparkHome, creationManifest, packageManifest, registerRuntime } from "./local.js";
23
24
  import { readJson, stateFile, VERSION, writeJson } from "./project.js";
24
25
  import { devCommand } from "./dev-command.js";
25
- import { printDependencyPins, upgradeDependencyPins } from "./dependency-pins.js";
26
+ import { optionalBackendIssues, printDependencyPins, upgradeDependencyPins } from "./dependency-pins.js";
26
27
  import { upgrade } from "./upgrade.js";
27
28
  import { ensureProjectVersion } from "./project-version.js";
28
29
  import { reportError } from "./errors.js";
@@ -96,7 +97,7 @@ Windows: dev and build --dev; production builds are not yet supported.
96
97
  SDK transfer: sdk export <directory> [--runtime <Spark Runner directory>], sdk import <directory>
97
98
  SDK maintainers: sdk pack, sdk package-runner, sdk build-runner [--platform windows], sdk register <runtime directory>
98
99
  Targets: dev/build/prebuild --platform macos|windows|ios|android|web
99
- Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime path>, create --packages <manifest>, create / sdk build-runner --package-manager npm|pnpm|yarn|bun`);
100
+ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime path>, create --packages <manifest>, create --bundle-id <com.yourcompany.app>, create / sdk build-runner --package-manager npm|pnpm|yarn|bun`);
100
101
  }
101
102
  else
102
103
  switch (command) {
@@ -109,7 +110,7 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
109
110
  case "create": {
110
111
  if (!positionals[1])
111
112
  throw new Error("Usage: spark create MyApp");
112
- await create(path.resolve(positionals[1]), creationManifest(values.packages), platform, !!values.universal || !!values.example, values.example, values["package-manager"]);
113
+ await create(path.resolve(positionals[1]), creationManifest(values.packages), platform, !!values.universal || !!values.example, values.example, values["package-manager"], values["bundle-id"]);
113
114
  break;
114
115
  }
115
116
  case "sdk": {
@@ -153,14 +154,20 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
153
154
  }
154
155
  case "build-runner": {
155
156
  let root;
157
+ // Release builds (set by scripts/release-runner.ts) build macOS in one fixed folder so
158
+ // Xcode stays incremental across versions; users' builds are unchanged.
159
+ const fixedRoot = !projectOption && platform === "macos" && process.env.SPARK_RELEASE_FIXED_RUNNER === "1";
160
+ const versionRoot = path.join(sparkHome(), "sdk-builds", VERSION, ...(platform === "windows" ? ["windows"] : []), "SparkRunner");
156
161
  if (projectOption)
157
162
  root = project();
158
163
  else {
159
- root = path.join(sparkHome(), "sdk-builds", VERSION, ...(platform === "windows" ? ["windows"] : []), "SparkRunner");
164
+ root = fixedRoot ? releaseRunnerStaging(path.join(sparkHome(), "sdk-builds")) : versionRoot;
165
+ if (fixedRoot)
166
+ rmSync(root, { recursive: true, force: true });
160
167
  const manifest = packageManifest(values.packages);
161
168
  const manager = values["package-manager"];
162
169
  if (!existsSync(path.join(root, "package.json")))
163
- await create(root, manifest, platform, false, undefined, manager);
170
+ await create(root, manifest, platform, false, undefined, manager, "so.legend.spark.prototype.sparkrunner");
164
171
  else
165
172
  await refreshLocalPackages(root, manifest, manager);
166
173
  await prepareGoProfile(root, manifest, platform, manager);
@@ -168,8 +175,20 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
168
175
  const config = readJson(configFile);
169
176
  config.version = VERSION.split("-")[0];
170
177
  writeJson(configFile, config);
178
+ if (fixedRoot) {
179
+ const fixed = releaseRunnerRoot(path.join(sparkHome(), "sdk-builds"));
180
+ const changed = syncTree(root, fixed, preservedBuildState);
181
+ rewritePathRecords(fixed, root, fixed);
182
+ console.log(`Release Runner: building in ${fixed} (${changed.length} project files changed since the last release build).`);
183
+ rmSync(root, { recursive: true, force: true });
184
+ root = fixed;
185
+ }
171
186
  }
172
187
  await build(root, "go", !!values.force);
188
+ if (fixedRoot) {
189
+ mirrorRunner(root, versionRoot);
190
+ console.log(`Release Runner copied to ${versionRoot}.`);
191
+ }
173
192
  break;
174
193
  }
175
194
  default: throw new Error("SDK commands: spark sdk pack, spark sdk build-runner, spark sdk register <runtime directory>");
@@ -193,7 +212,7 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
193
212
  if (root) {
194
213
  ensureProjectVersion(root);
195
214
  try {
196
- const issues = [...upgradeDependencyPins(root, true), ...enrichedHtmlPinIssues(root)];
215
+ const issues = [...upgradeDependencyPins(root, true), ...enrichedHtmlPinIssues(root), ...optionalBackendIssues(root)];
197
216
  printDependencyPins(issues);
198
217
  if (issues.length) {
199
218
  process.exitCode = 1;
@@ -27,7 +27,9 @@ function withDesktop(config, options = {}) {
27
27
  for (const platform of ["macos", "windows"]) {
28
28
  conditions[platform] = [...new Set([...(conditions[platform] || []), "react-native"])];
29
29
  }
30
- config = { ...config, resolver: { ...config.resolver, unstable_conditionsByPlatform: conditions } };
30
+ config = { ...config, resolver: { ...config.resolver, unstable_conditionsByPlatform: conditions,
31
+ // spark dev found Watchman unresponsive; crawl and watch with Node instead.
32
+ ...(process.env.SPARK_METRO_NO_WATCHMAN === "1" ? { useWatchman: false } : {}) } };
31
33
  const root = path.resolve(config.projectRoot || process.cwd());
32
34
  // Keep the configured workspace root so lazy imports outside the app have
33
35
  // valid URLs. Only the prebuilt host's fixed entry URLs are app-relative.
@@ -1,9 +1,22 @@
1
1
  // @ts-check
2
2
  const fs = require('node:fs');
3
3
  const path = require('node:path');
4
- const ts = require('typescript');
4
+ const { createRequire } = require('node:module');
5
5
  const upgradeNotesPath = 'node_modules/@legendapp/spark/skills/spark/UPGRADING.md';
6
6
 
7
+ // `spark upgrade` loads these helpers from a downloaded release without its own
8
+ // node_modules, so dependencies may only resolve through the app's installed Spark.
9
+ /** @type {typeof import('./migration-helpers.cjs').resolveDependency} */
10
+ function resolveDependency(root, request) {
11
+ try {
12
+ return require.resolve(request);
13
+ } catch (error) {
14
+ if (/** @type {NodeJS.ErrnoException} */ (error).code !== 'MODULE_NOT_FOUND') throw error;
15
+ const spark = createRequire(path.join(root, 'package.json')).resolve('@legendapp/spark/package.json');
16
+ return createRequire(spark).resolve(request);
17
+ }
18
+ }
19
+
7
20
  /** @type {typeof import('./migration-helpers.cjs').createMigrationContext} */
8
21
  function createMigrationContext(root, version, changes, manualSteps) {
9
22
  root = fs.realpathSync(root);
@@ -75,6 +88,8 @@ function createMigrationContext(root, version, changes, manualSteps) {
75
88
  if (!manualSteps.some(step => step.version === version && step.message === message)) manualSteps.push({ version, message, notes });
76
89
  },
77
90
  replaceImport(from, to, names = {}) {
91
+ /** @type {typeof import('typescript')} */
92
+ const ts = require(resolveDependency(root, 'typescript'));
78
93
  const files = new Set();
79
94
  /** @param {string} directory */
80
95
  function visit(directory) {
@@ -90,7 +105,7 @@ function createMigrationContext(root, version, changes, manualSteps) {
90
105
  const content = context.readFile(file);
91
106
  if (content === null || !content.includes(from)) continue;
92
107
  const source = ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
93
- if (/** @type {ts.SourceFile & { parseDiagnostics: readonly ts.Diagnostic[] }} */ (source).parseDiagnostics.length) {
108
+ if (/** @type {import('typescript').SourceFile & { parseDiagnostics: readonly import('typescript').Diagnostic[] }} */ (source).parseDiagnostics.length) {
94
109
  context.manualStep(`Update imports from ${from} in ${file}; the source could not be parsed.`);
95
110
  continue;
96
111
  }
@@ -98,13 +113,13 @@ function createMigrationContext(root, version, changes, manualSteps) {
98
113
  const edits = [];
99
114
  // A locally bound require is not necessarily the CommonJS loader.
100
115
  let shadowedRequire = false;
101
- /** @param {ts.Node} node */
116
+ /** @param {import('typescript').Node} node */
102
117
  function findRequireBinding(node) {
103
118
  if ((ts.isVariableDeclaration(node) || ts.isParameter(node) || ts.isBindingElement(node) || ts.isFunctionDeclaration(node) || ts.isImportSpecifier(node)) && node.name && ts.isIdentifier(node.name) && node.name.text === 'require') shadowedRequire = true;
104
119
  ts.forEachChild(node, findRequireBinding);
105
120
  }
106
121
  findRequireBinding(source);
107
- /** @param {ts.Node} node */
122
+ /** @param {import('typescript').Node} node */
108
123
  function inspect(node) {
109
124
  if (ts.isStringLiteralLike(node) && node.text === from) {
110
125
  const parent = node.parent;
@@ -149,4 +164,4 @@ function createMigrationContext(root, version, changes, manualSteps) {
149
164
  return context;
150
165
  }
151
166
 
152
- module.exports = { createMigrationContext, upgradeNotesPath };
167
+ module.exports = { createMigrationContext, resolveDependency, upgradeNotesPath };
@@ -13,3 +13,4 @@ export interface MigrationContext {
13
13
  }
14
14
  export const upgradeNotesPath: string;
15
15
  export function createMigrationContext(root: string, version: string, changes: Map<string, FileChange>, manualSteps: ManualStep[]): MigrationContext;
16
+ export function resolveDependency(root: string, request: string): string;
@@ -2,7 +2,7 @@
2
2
  const fs = require('node:fs');
3
3
  const path = require('node:path');
4
4
  const { createRequire } = require('node:module');
5
- const { createMigrationContext } = require('./migration-helpers.cjs');
5
+ const { createMigrationContext, resolveDependency } = require('./migration-helpers.cjs');
6
6
 
7
7
  const skillPath = 'node_modules/@legendapp/spark/skills/spark/SKILL.md';
8
8
  const start = '<!-- spark:skill:start -->';
@@ -95,6 +95,11 @@ const migrations = [
95
95
  planPointers(context);
96
96
  context.manualStep('If the app uses a custom runtime, rebuild it for next.4 native dependency patches; review production module selection and affected SidebarSplitView/Windows native flows.');
97
97
  } },
98
+ { version: '0.0.2', automatic: false, breaking: true, apply(context) {
99
+ context.manualStep('Spark now targets Expo SDK 55 and React Native 0.83 (React 19.2). spark upgrade moves the SDK-pinned Expo, React and React Native versions; align any other Expo modules your app depends on with SDK 55, review Expo SDK 55 and React Native 0.83 changes your app code relies on, then run spark doctor and rebuild custom runtimes.');
100
+ context.manualStep('Apps importing @legendapp/spark/markdown, /html, /webview or /sqlite must add the corresponding optional backend to app dependencies. See the linked upgrade notes for library names and version pins; run spark doctor and rebuild custom runtimes.');
101
+ context.manualStep('@legendapp/spark/camera was removed. Install the camera libraries in your app; see the linked upgrade notes for exact version pins. Import camera APIs directly from react-native-vision-camera, and NitroImage / Image from react-native-nitro-image. Spark still applies its version-pinned native patches automatically when your app depends on these libraries. Rebuild custom runtimes.');
102
+ } },
98
103
  ];
99
104
 
100
105
  /** @param {string} root */
@@ -105,7 +110,7 @@ function installedSparkVersion(root) {
105
110
 
106
111
  /** @type {typeof import('./migrations.cjs').planMigrations} */
107
112
  function planMigrations(root, version, { automatic = false, fromVersion } = {}) {
108
- const { compare, valid } = createRequire(require.resolve('npm/package.json'))('semver');
113
+ const { compare, valid } = createRequire(resolveDependency(root, 'npm/package.json'))('semver');
109
114
  const file = path.join(root, '.spark/version');
110
115
  const previous = fs.existsSync(file) ? fs.readFileSync(file, 'utf8').trim() : fromVersion;
111
116
  if (!valid(version) || (previous !== undefined && (!valid(previous) || compare(previous, version) > 0))) {
@@ -5,8 +5,8 @@ import path from "node:path";
5
5
  import { prepareNativePatches } from "@legendapp/spark-desktop-config/native-patches.cjs";
6
6
  import { findFramework } from "./local.js";
7
7
  import { installedPackages, readJson, VERSION } from "./project.js";
8
- const required = ["@react-native-runtimes/core", "react-native-nitro-modules", "@op-engineering/op-sqlite", "react-native-webview"];
9
- const optional = ["expo-audio"];
8
+ const required = ["@react-native-runtimes/core", "react-native-nitro-modules"];
9
+ const optional = ["@op-engineering/op-sqlite", "react-native-webview", "expo-audio"];
10
10
  export function validatePackedNativePatches(packages, requirements, frameworkVersion = VERSION) {
11
11
  if (!requirements || requirements.schema !== 1 || requirements.frameworkVersion !== frameworkVersion || !requirements.packages || typeof requirements.packages !== "object")
12
12
  return [`The installed @legendapp/spark SDK does not include native patch provenance for ${frameworkVersion}. Run spark add desktop to install the matching SDK packages, then retry.`];
@@ -70,8 +70,8 @@ export function validateWorkspaceNativePatches(root, packages) {
70
70
  }
71
71
  export function assertNativePatchPreflight(root) {
72
72
  assertEnrichedHtmlPins(root);
73
- prepareNativePatches(root);
74
73
  const packages = installedPackages(root);
74
+ prepareNativePatches(root, packages);
75
75
  const framework = findFramework(root);
76
76
  let errors;
77
77
  const spark = packages.find(pkg => pkg.name === "@legendapp/spark");
@@ -1,6 +1,6 @@
1
1
  import { assertEnrichedHtmlPins } from "./enriched-html-pins.js";
2
2
  import { nativeWindowOptions } from "@legendapp/spark-window-options";
3
- import { prepareNativePatches } from "@legendapp/spark-desktop-config/native-patches.cjs";
3
+ import { prepareNativePatches, removeExpoApplicationAlias } from "@legendapp/spark-desktop-config/native-patches.cjs";
4
4
  import { macOSReleaseSettings } from "./macos-release.js";
5
5
  import { projectPlatform, architecture } from "./platform.js";
6
6
  import { resolveHelpers } from "./helpers.js";
@@ -12,7 +12,7 @@ import { existsSync, readFileSync, readdirSync, realpathSync, } from "node:fs";
12
12
  import path from "node:path";
13
13
  import { readJson, writeJson } from "./json.js";
14
14
  export { readJson, writeJson };
15
- export const VERSION = "0.0.1";
15
+ export const VERSION = "0.0.2";
16
16
  export function digest(value) {
17
17
  return createHash("sha256").update(value).digest("hex");
18
18
  }
@@ -40,6 +40,8 @@ export function installedPackages(root) {
40
40
  const names = Object.keys({
41
41
  ...Object.fromEntries((Array.isArray(bundled) ? bundled : []).map(name => [name, true])),
42
42
  ...current.json.dependencies,
43
+ ...Object.fromEntries(Object.entries(current.json.optionalDependencies ?? {})
44
+ .filter(([name]) => ["react-native-vision-camera", "react-native-nitro-image", "react-native-enriched-markdown", "react-native-enriched-html", "react-native-webview", "@op-engineering/op-sqlite"].includes(name))),
43
45
  ...(current.app ? current.json.devDependencies : {}),
44
46
  // Optional peers do not require a native module. If an application uses
45
47
  // one, its own dependency edge includes it. Resolving optional peers here
@@ -72,13 +74,13 @@ export function installedPackages(root) {
72
74
  file = path.join(dir, "package.json");
73
75
  }
74
76
  }
75
- catch {
76
- if (current.app &&
77
- (current.json.dependencies?.[name] ||
78
- current.json.devDependencies?.[name]))
79
- throw new Error(`Dependency ${name} is not installed yet. Finish the package installation, then retry.`);
80
- continue;
81
- }
77
+ catch { }
78
+ }
79
+ if (!file || !existsSync(file)) {
80
+ if (current.app &&
81
+ (current.json.dependencies?.[name] || current.json.devDependencies?.[name]))
82
+ throw new Error(`Dependency ${name} is not installed yet. Finish the package installation, then retry.`);
83
+ continue;
82
84
  }
83
85
  const dir = realpathSync(path.dirname(file));
84
86
  if (visited.has(dir))
@@ -142,10 +144,14 @@ export function hashFiles(root, entries, windows = false, excluded = [], nativeS
142
144
  }
143
145
  export function nativePackages(root, { applyExcludes = true } = {}) {
144
146
  assertEnrichedHtmlPins(root);
145
- prepareNativePatches(root);
146
147
  const installed = installedPackages(root);
148
+ prepareNativePatches(root, installed);
147
149
  if (projectPlatform(root) === "windows")
148
150
  return windowsNativePackages(root, installed);
151
+ const rootOf = (name) => installed.find(pkg => pkg.name === name)?.root;
152
+ const [macOS, expoCore] = [rootOf("react-native-macos"), rootOf("expo-modules-core")];
153
+ if (macOS && expoCore)
154
+ removeExpoApplicationAlias(macOS, expoCore);
149
155
  const excluded = ["app.json", "desktop.config.json"].some(file => existsSync(path.join(root, file)))
150
156
  ? readAppConfig(root).expo?.autolinking?.exclude ?? [] : [];
151
157
  if (!applyExcludes) {
@@ -0,0 +1,108 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
3
+ import path from "node:path";
4
+ /**
5
+ * Release Runner builds use one fixed project folder so Xcode's build database (keyed by
6
+ * absolute source paths) stays valid across versions and the build is incremental.
7
+ * Each release creates a fresh project in a staging folder exactly as before, syncs it into the
8
+ * fixed folder (only files whose bytes differ are rewritten, so unchanged sources keep their
9
+ * mtimes), builds there, then mirrors the result into sdk-builds/<version>/SparkRunner.
10
+ */
11
+ export const releaseRunnerRoot = (sdkBuilds) => path.join(sdkBuilds, "release", "SparkRunner");
12
+ export const releaseRunnerStaging = (sdkBuilds) => path.join(sdkBuilds, "release", "staging", "SparkRunner");
13
+ // Build state the fresh project never contains and the build must keep: Xcode's DerivedData,
14
+ // generated native project + Pods (prebuild regenerates the project but preserves Pods), products.
15
+ export const preservedBuildState = [".spark/DerivedData", "macos", ".spark/products", ".spark/prebuild-cache"];
16
+ function same(a, b) {
17
+ const left = lstatSync(a), right = lstatSync(b);
18
+ if (left.isSymbolicLink() || right.isSymbolicLink())
19
+ return left.isSymbolicLink() && right.isSymbolicLink() && readlinkSync(a) === readlinkSync(b);
20
+ if (left.isFile() !== right.isFile() || left.size !== right.size || (left.mode & 0o777) !== (right.mode & 0o777))
21
+ return false;
22
+ return readFileSync(a).equals(readFileSync(b));
23
+ }
24
+ /** Makes `destination` byte-identical to `source`, skipping (and keeping) `keep` paths relative to the roots. Returns rewritten paths. */
25
+ export function syncTree(source, destination, keep = [], relative = "") {
26
+ const changed = [];
27
+ mkdirSync(destination, { recursive: true });
28
+ const wanted = new Set(existsSync(source) ? readdirSync(source) : []);
29
+ for (const name of readdirSync(destination)) {
30
+ const rel = path.posix.join(relative, name);
31
+ if (wanted.has(name) || keep.includes(rel))
32
+ continue;
33
+ // A folder holding preserved state is pruned around it, never removed wholesale.
34
+ if (keep.some(entry => entry.startsWith(`${rel}/`)) && lstatSync(path.join(destination, name)).isDirectory())
35
+ changed.push(...syncTree(path.join(source, name), path.join(destination, name), keep, rel));
36
+ else {
37
+ rmSync(path.join(destination, name), { recursive: true, force: true });
38
+ changed.push(rel);
39
+ }
40
+ }
41
+ for (const name of wanted) {
42
+ const rel = path.posix.join(relative, name);
43
+ if (keep.includes(rel))
44
+ continue;
45
+ const from = path.join(source, name), to = path.join(destination, name);
46
+ const stat = lstatSync(from);
47
+ if (stat.isDirectory()) {
48
+ if (existsSync(to) && !lstatSync(to).isDirectory())
49
+ rmSync(to, { force: true });
50
+ changed.push(...syncTree(from, to, keep, rel));
51
+ continue;
52
+ }
53
+ if (existsSync(to) || isLink(to)) {
54
+ if (!lstatSync(to).isDirectory() && same(from, to))
55
+ continue;
56
+ rmSync(to, { recursive: true, force: true });
57
+ }
58
+ if (stat.isSymbolicLink())
59
+ symlinkSync(readlinkSync(from), to);
60
+ else
61
+ copyFileSync(from, to);
62
+ changed.push(rel);
63
+ }
64
+ return changed;
65
+ }
66
+ function isLink(file) { try {
67
+ return lstatSync(file).isSymbolicLink();
68
+ }
69
+ catch {
70
+ return false;
71
+ } }
72
+ // Files under the version folder that record the project's own absolute path.
73
+ export const pathRecords = [".spark/go-build.json", ".spark/native-selection.json", ".spark/native-preparation.json", "macos/Podfile", "macos/Podfile.lock"];
74
+ export function rewritePathRecords(root, from, to) {
75
+ for (const record of pathRecords) {
76
+ const file = path.join(root, record);
77
+ if (existsSync(file))
78
+ writeFileSync(file, readFileSync(file, "utf8").split(from).join(to));
79
+ }
80
+ }
81
+ /**
82
+ * Replaces sdk-builds/<version>/SparkRunner with the fixed folder's built project (minus its
83
+ * DerivedData), rewriting recorded absolute paths so signing, notarization and --resume read the
84
+ * version folder exactly as when it was built in place. An earlier notarization/packaging state
85
+ * in the version folder is kept.
86
+ */
87
+ export function mirrorRunner(fixed, version, clone = (from, to) => spawnSync("cp", ["-c", "-R", from, to]).status === 0) {
88
+ const incoming = `${version}.incoming`;
89
+ rmSync(incoming, { recursive: true, force: true });
90
+ mkdirSync(path.dirname(version), { recursive: true });
91
+ if (!clone(fixed, incoming)) {
92
+ rmSync(incoming, { recursive: true, force: true });
93
+ spawnSync("cp", ["-R", fixed, incoming]);
94
+ }
95
+ if (!existsSync(path.join(incoming, "package.json")))
96
+ throw new Error(`Copying the release Runner from ${fixed} failed.`);
97
+ rmSync(path.join(incoming, ".spark/DerivedData"), { recursive: true, force: true });
98
+ for (const kept of [".spark/packaging", ".spark/signing.json"]) {
99
+ const previous = path.join(version, kept);
100
+ if (!existsSync(previous))
101
+ continue;
102
+ rmSync(path.join(incoming, kept), { recursive: true, force: true });
103
+ renameSync(previous, path.join(incoming, kept));
104
+ }
105
+ rewritePathRecords(incoming, fixed, version);
106
+ rmSync(version, { recursive: true, force: true });
107
+ renameSync(incoming, version);
108
+ }