@legendapp/spark 0.0.1-next.9 → 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 (104) 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 +2000 -3379
  4. package/skills/spark/UPGRADING.md +106 -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 +13 -2
  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/runner-install.js +4 -2
  29. package/vendor/node_modules/@legendapp/spark-cli/dist/session-status.js +7 -3
  30. package/vendor/node_modules/@legendapp/spark-cli/dist/watchman.js +12 -0
  31. package/vendor/node_modules/@legendapp/spark-cli/dist/windows-geometry.js +2 -2
  32. package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -1
  33. package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
  34. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +1 -1
  35. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +27 -25
  36. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +1 -1
  37. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +35 -33
  38. package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +29 -27
  39. package/vendor/node_modules/@legendapp/spark-clipboard/package.json +5 -5
  40. package/vendor/node_modules/@legendapp/spark-clipboard/src/index.macos.ts +1 -0
  41. package/vendor/node_modules/@legendapp/spark-codex/package.json +4 -4
  42. package/vendor/node_modules/@legendapp/spark-commands/package.json +7 -7
  43. package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -4
  44. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +7 -2
  45. package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +3 -3
  46. package/vendor/node_modules/@legendapp/spark-desktop-config/accessibility-state.cjs +2 -2
  47. package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +12 -0
  48. package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +4 -4
  49. package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +1 -1
  50. package/vendor/node_modules/@legendapp/spark-desktop-config/fabric-lifecycle.cjs +1 -1
  51. package/vendor/node_modules/@legendapp/spark-desktop-config/keyboard-events.cjs +2 -2
  52. package/vendor/node_modules/@legendapp/spark-desktop-config/macos-host.cjs +39 -0
  53. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +47 -12
  54. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +2 -1
  55. package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +8 -6
  56. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-scroll-view.cjs +2 -2
  57. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-alignment.cjs +2 -2
  58. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-input-alignment.cjs +2 -2
  59. package/vendor/node_modules/@legendapp/spark-desktop-config/text-input-accessibility.cjs +2 -2
  60. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/AppDelegate.h +6 -0
  61. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/Main.storyboard +684 -0
  62. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/main.m +5 -0
  63. package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +3 -2
  64. package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +5 -5
  65. package/vendor/node_modules/@legendapp/spark-desktop-links/src/index.macos.ts +1 -0
  66. package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +4 -4
  67. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +68 -17
  68. package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +5 -5
  69. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +2 -1
  70. package/vendor/node_modules/@legendapp/spark-documents/package.json +9 -9
  71. package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -4
  72. package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +4 -4
  73. package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +14 -5
  74. package/vendor/node_modules/@legendapp/spark-file-system/package.json +4 -4
  75. package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +1 -1
  76. package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -4
  77. package/vendor/node_modules/@legendapp/spark-html/package.json +4 -4
  78. package/vendor/node_modules/@legendapp/spark-markdown/package.json +4 -4
  79. package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +4 -4
  80. package/vendor/node_modules/@legendapp/spark-native-menu/package.json +4 -4
  81. package/vendor/node_modules/@legendapp/spark-notifications/package.json +4 -4
  82. package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +110 -19
  83. package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -4
  84. package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +17 -3
  85. package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +6 -0
  86. package/vendor/node_modules/@legendapp/spark-rich-text/package.json +4 -4
  87. package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +5 -5
  88. package/vendor/node_modules/@legendapp/spark-secure-storage/src/index.macos.ts +1 -0
  89. package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
  90. package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +6 -6
  91. package/vendor/node_modules/@legendapp/spark-sqlite/package.json +12 -5
  92. package/vendor/node_modules/@legendapp/spark-system/package.json +4 -4
  93. package/vendor/node_modules/@legendapp/spark-tray/package.json +4 -4
  94. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +82 -18
  95. package/vendor/node_modules/@legendapp/spark-ui/package.json +6 -6
  96. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +4 -0
  97. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +11 -9
  98. package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +20 -10
  99. package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +15 -10
  100. package/vendor/node_modules/@legendapp/spark-ui/src/index.macos.tsx +1 -0
  101. package/vendor/node_modules/@legendapp/spark-updates/package.json +4 -4
  102. package/vendor/node_modules/@legendapp/spark-webview/package.json +11 -4
  103. package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
  104. package/camera.ts +0 -13
@@ -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-next.9";
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
+ }
@@ -1,42 +1,42 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "0.0.1-next.9",
4
- "revision": "c53a0a7d16ae8b39791b8b80eb3f11d45a1dae80",
3
+ "version": "0.0.2",
4
+ "revision": "d3a7eead32459f8f6baf29ef868ea732c5081e47",
5
5
  "packages": {
6
6
  "@react-native-runtimes/core": {
7
- "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.9/runtimes-4df45cb5ea74.tgz",
7
+ "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.2/runtimes-4df45cb5ea74.tgz",
8
8
  "size": 54050,
9
9
  "sha256": "3a04e0455ac44b0bc11cfa315943ad84509c445111a2b3974ca85c8ed489827c"
10
10
  },
11
11
  "react-native-nitro-modules": {
12
- "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.9/react-native-nitro-modules-0.37.0-5df8774796c4.tgz",
12
+ "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.2/react-native-nitro-modules-0.37.0-5df8774796c4.tgz",
13
13
  "size": 145600,
14
14
  "sha256": "5df8774796c48ed54d238f3fada01b64d710b14077983c37f639607eb805e066"
15
15
  },
16
16
  "@op-engineering/op-sqlite": {
17
- "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.9/op-engineering-op-sqlite-18.2.1-a14b99ecf491.tgz",
17
+ "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.2/op-engineering-op-sqlite-18.2.1-a14b99ecf491.tgz",
18
18
  "size": 5847607,
19
19
  "sha256": "a14b99ecf4911b55f586b2c5d1f58ac48b0a9d8fe4b84fa6edef1a167630646b"
20
20
  },
21
21
  "react-native-webview": {
22
- "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.9/react-native-webview-16.0.0-333e421ad38b.tgz",
22
+ "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.2/react-native-webview-16.0.0-333e421ad38b.tgz",
23
23
  "size": 116285,
24
24
  "sha256": "333e421ad38b0da2b1dc7b3306de019f257e31bfd6cdb0272d97b1bb2b129354"
25
25
  },
26
26
  "expo-audio": {
27
- "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.9/expo-audio-1.1.1-aff5604f2c4c.tgz",
28
- "size": 381841,
29
- "sha256": "aff5604f2c4cab23299a71e37e802a572b2e66e2e2250b20a261e664d5346693"
27
+ "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.2/expo-audio-55.0.18-a8d70b5b39bd.tgz",
28
+ "size": 610139,
29
+ "sha256": "a8d70b5b39bd3b69d95528011f14aa93a0fdf7ff1e6c89e0f7489329230be060"
30
30
  }
31
31
  },
32
32
  "runners": {
33
33
  "macos-arm64": {
34
- "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.1-next.9/spark-runner-macos-arm64.zip",
35
- "size": 20579682,
36
- "sha256": "35fd98244a0d4f1f6cb226b2e454994b194c57fbe04f3abb2a8a7453f5e2df16",
34
+ "url": "https://github.com/LegendApp/legend-spark/releases/download/v0.0.2/spark-runner-macos-arm64.zip",
35
+ "size": 13252497,
36
+ "sha256": "35a3051740765dcc2bec7547f56427b93c87843aa71157511b26975b44971d2c",
37
37
  "app": "SparkRunner.app",
38
38
  "teamId": "56DD97VT22",
39
- "fingerprint": "950c72708d50a5eae3cab90bcd3b6afaac1cc87594a453990d6c38005016a9b0"
39
+ "fingerprint": "4e0557cd9fe18a54c8554b09294f8e58f6c38d85db5302641acadccb6acdbadf"
40
40
  }
41
41
  }
42
42
  }
@@ -1,3 +1,4 @@
1
+ import { runnerDownloadMessage } from "./session-status.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import { closeSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
3
4
  import { spawn } from "node:child_process";
@@ -147,6 +148,7 @@ export async function acquireRunnerLock(lock, waitMs = 600_000) {
147
148
  });
148
149
  }
149
150
  export async function downloadAsset(asset, file, request = globalThis.fetch) {
151
+ console.log(runnerDownloadMessage(asset.size));
150
152
  for (let attempt = 0; attempt < 3; attempt++) {
151
153
  let handle;
152
154
  try {
@@ -164,7 +166,7 @@ export async function downloadAsset(asset, file, request = globalThis.fetch) {
164
166
  await handle.writeFile(chunk);
165
167
  const percent = Math.floor(bytes / asset.size * 10) * 10;
166
168
  if (percent !== reported) {
167
- console.log(`Downloading Spark Runner: ${percent}%`);
169
+ console.log(`Downloading Spark Runner ${"█".repeat(percent / 10)}${"░".repeat(10 - percent / 10)} ${percent}%`);
168
170
  reported = percent;
169
171
  }
170
172
  }
@@ -227,7 +229,7 @@ export async function installRunner(asset, cache = sparkHome(), deps = defaults)
227
229
  }
228
230
  releaseLock.assertAlive();
229
231
  registerRuntime(app);
230
- console.log("Spark Runner installed and verified.");
232
+ console.log("Spark Runner installed, opening your app…");
231
233
  return app;
232
234
  }
233
235
  finally {
@@ -1,10 +1,14 @@
1
- export function sessionStatus(target, available, issues, running = false, downloadable = false) {
1
+ /** Printed by the download itself, so it sits directly above the progress bar rather than before Metro output. */
2
+ export function runnerDownloadMessage(size) {
3
+ return `Downloading Spark Runner${size && size > 0 ? ` (${(size / 1e6).toFixed(1)} MB)` : ""}…`;
4
+ }
5
+ export function sessionStatus(target, available, issues, running = false, download = false) {
2
6
  if (!available && target === "go" && !issues.length)
3
7
  return {
4
8
  compatible: false,
5
9
  canBuild: false,
6
- message: downloadable ? "Spark Runner is ready to download. Press d to install and open it." : "The Spark Runner isn’t installed for this SDK.\nInstall an SDK bundle containing a matching Spark Runner (node install.mjs), or register a Spark Runner with spark sdk register <runtime directory>.",
7
- actions: downloadable ? "d Download and open Runner · g Use development build · Ctrl+C Exit" : "g Use development build · Ctrl+C Exit",
10
+ message: download ? (download.auto ? "" : "Spark Runner is ready to download. Press d to install and open it.") : "The Spark Runner isn’t installed for this SDK.\nInstall an SDK bundle containing a matching Spark Runner (node install.mjs), or register a Spark Runner with spark sdk register <runtime directory>.",
11
+ actions: download && !download.auto ? "d Download and open Runner · g Use development build · Ctrl+C Exit" : "g Use development build · Ctrl+C Exit",
8
12
  };
9
13
  if (issues.length || !available)
10
14
  return {
@@ -0,0 +1,12 @@
1
+ import { spawn } from "node:child_process";
2
+ // Metro waits on Watchman's watch-project without a timeout, so a wedged Watchman
3
+ // server leaves the app on a blank window. True when Watchman is installed but
4
+ // does not answer; a missing Watchman is Metro's ordinary Node-crawler case.
5
+ export function watchmanStalls(root, timeout = 10_000) {
6
+ return new Promise(resolve => {
7
+ const child = spawn("watchman", ["watch-project", root], { stdio: "ignore" });
8
+ const timer = setTimeout(() => { child.kill(); resolve(true); }, timeout);
9
+ const done = () => { clearTimeout(timer); resolve(false); };
10
+ child.on("error", done).on("exit", done);
11
+ });
12
+ }
@@ -21,8 +21,8 @@ export function patchWindowsGeometry(source) {
21
21
  export function prepareWindowsGeometry(root) {
22
22
  const req = createRequire(path.join(root, "package.json"));
23
23
  const manifest = req.resolve("react-native-windows/package.json");
24
- if (JSON.parse(readFileSync(manifest, "utf8")).version !== "0.81.35")
25
- throw new Error("spark's Windows geometry adapter requires react-native-windows 0.81.35");
24
+ if (JSON.parse(readFileSync(manifest, "utf8")).version !== "0.83.2")
25
+ throw new Error("spark's Windows geometry adapter requires react-native-windows 0.83.2");
26
26
  const rnw = path.dirname(manifest), source = path.join(rnw, "Microsoft.ReactNative/Fabric/ComponentView.h");
27
27
  const original = readFileSync(source, "utf8");
28
28
  const patched = patchWindowsGeometry(original);
@@ -65,7 +65,7 @@ export async function prepareWindows(root, mode) {
65
65
  const manifest = readFileSync(path.join(root, "package.json"), "utf8");
66
66
  try {
67
67
  await preserveWindowsBuildOutputs(root, async () => {
68
- await run(root, nodeCommand(root, "expo-desktop", "expo-desktop", ["prebuild", "--platform", "windows", "--template", "expo-desktop-template-bare-minimum@54.81.6", "--no-install"]), { env: { CI: "1" }, capture: true });
68
+ await run(root, nodeCommand(root, "expo-desktop", "expo-desktop", ["prebuild", "--platform", "windows", "--template", "expo-desktop-template-bare-minimum@55.83.10", "--no-install"]), { env: { CI: "1" }, capture: true });
69
69
  });
70
70
  // The beta template expands all-platform dependencies. Keep the consumer's installed graph.
71
71
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-cli",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [
@@ -11,13 +11,13 @@
11
11
  "node": ">=24.19.0"
12
12
  },
13
13
  "dependencies": {
14
- "@legendapp/spark-desktop-config": "0.0.1-next.9",
14
+ "@legendapp/spark-desktop-config": "0.0.2",
15
15
  "ws": "8.21.0",
16
16
  "expo-desktop": "1.0.6",
17
17
  "npm": "11.21.1",
18
18
  "typescript": "5.9.3",
19
19
  "cross-spawn": "7.0.6",
20
- "@legendapp/spark-window-options": "0.0.1-next.9",
20
+ "@legendapp/spark-window-options": "0.0.2",
21
21
  "diff": "8.0.4",
22
22
  "yaml": "2.9.1"
23
23
  },
@@ -10,7 +10,7 @@
10
10
  "restoreBounds": true
11
11
  },
12
12
  "macos": {
13
- "bundleIdentifier": "so.legend.spark.prototype.helloworld"
13
+ "bundleIdentifier": "com.example.helloworld"
14
14
  },
15
15
  "platforms": [
16
16
  "macos"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spark-template-blank-typescript",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "private": true,
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -13,40 +13,40 @@
13
13
  "postinstall": "node node_modules/@legendapp/spark/init-template.cjs"
14
14
  },
15
15
  "dependencies": {
16
- "@legendapp/spark": "0.0.1-next.9",
17
- "expo": "54.0.37",
16
+ "@legendapp/spark": "0.0.2",
17
+ "expo": "55.0.32",
18
18
  "expo-desktop": "1.0.6",
19
19
  "expo-desktop-prebuild-config": "1.1.3",
20
20
  "expo-desktop-config-plugins": "1.3.2",
21
- "expo-desktop-metro-config": "54.81.3",
22
- "expo-desktop-template-bare-minimum": "54.81.6",
23
- "react": "19.1.4",
24
- "react-dom": "19.1.4",
25
- "react-native": "0.81.6",
26
- "react-native-macos": "0.81.7",
21
+ "expo-desktop-metro-config": "55.83.3",
22
+ "expo-desktop-template-bare-minimum": "55.83.10",
23
+ "react": "19.2.0",
24
+ "react-dom": "19.2.0",
25
+ "react-native": "0.83.10",
26
+ "react-native-macos": "0.83.0",
27
27
  "@react-native-community/cli": "20.1.3",
28
28
  "typescript": "5.9.3",
29
- "@types/react": "19.1.10",
29
+ "@types/react": "19.2.18",
30
30
  "@react-native-runtimes/core": "0.1.0-alpha.2"
31
31
  },
32
32
  "overrides": {
33
- "expo": "54.0.37",
34
- "@expo/cli": "54.0.27",
33
+ "expo": "55.0.32",
34
+ "@expo/cli": "55.0.37",
35
35
  "react-native-nitro-modules": "0.37.0",
36
36
  "react-native-webview": "16.0.0",
37
37
  "@op-engineering/op-sqlite": "18.2.1",
38
- "expo-asset": "12.0.13",
39
- "expo-constants": "18.0.14",
40
- "expo-file-system": "19.0.24",
41
- "expo-font": "14.0.12",
42
- "expo-keep-awake": "15.0.8",
43
- "expo-modules-core": "3.0.30",
44
- "expo-desktop-modules-core": "54.0.14",
45
- "expo-desktop-stubs": "54.0.15",
46
- "react": "19.1.4",
47
- "react-native": "0.81.6",
48
- "react-native-macos": "0.81.7",
49
- "react-native-windows": "0.81.35",
38
+ "expo-asset": "55.0.20",
39
+ "expo-constants": "55.0.17",
40
+ "expo-file-system": "55.0.26",
41
+ "expo-font": "55.0.8",
42
+ "expo-keep-awake": "55.0.8",
43
+ "expo-modules-core": "55.0.27",
44
+ "expo-desktop-modules-core": "55.0.2",
45
+ "expo-desktop-stubs": "55.0.2",
46
+ "react": "19.2.0",
47
+ "react-native": "0.83.10",
48
+ "react-native-macos": "0.83.0",
49
+ "react-native-windows": "0.83.2",
50
50
  "postcss": "8.5.31",
51
51
  "dompurify": "3.4.17",
52
52
  "@tiptap/core": "3.32.0",
@@ -71,7 +71,9 @@
71
71
  "@tiptap/extension-bubble-menu": "3.32.0",
72
72
  "@tiptap/extension-floating-menu": "3.32.0",
73
73
  "fast-xml-parser": "5.11.2",
74
- "react-dom": "19.1.4"
74
+ "react-dom": "19.2.0",
75
+ "react-native-enriched-markdown": "1.1.1",
76
+ "react-native-enriched-html": "1.1.1"
75
77
  },
76
78
  "expo": {
77
79
  "install": {
@@ -10,7 +10,7 @@
10
10
  "restoreBounds": true
11
11
  },
12
12
  "macos": {
13
- "bundleIdentifier": "so.legend.spark.prototype.helloworld"
13
+ "bundleIdentifier": "com.example.helloworld"
14
14
  },
15
15
  "platforms": [
16
16
  "ios",