@legendapp/spark 0.0.4 → 0.0.6

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 (79) hide show
  1. package/package.json +4 -4
  2. package/skills/spark/UPGRADING.md +105 -0
  3. package/skills/spark/storage-settings.md +2 -28
  4. package/skills/spark/ui.md +27 -1
  5. package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
  6. package/vendor/node_modules/@legendapp/spark-audio/package.json +2 -2
  7. package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
  8. package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +47 -25
  9. package/vendor/node_modules/@legendapp/spark-cli/dist/expo-desktop-template-bare-minimum-55.83.10.tgz +0 -0
  10. package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +6 -0
  11. package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -8
  12. package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +5 -3
  13. package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +40 -0
  14. package/vendor/node_modules/@legendapp/spark-cli/dist/release-app.js +139 -0
  15. package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +21 -21
  16. package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +61 -41
  17. package/vendor/node_modules/@legendapp/spark-cli/package.json +4 -4
  18. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
  19. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
  20. package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
  21. package/vendor/node_modules/@legendapp/spark-clipboard/package.json +2 -2
  22. package/vendor/node_modules/@legendapp/spark-codex/package.json +2 -2
  23. package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
  24. package/vendor/node_modules/@legendapp/spark-context-menu/package.json +2 -2
  25. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.h +2 -0
  26. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +1 -0
  27. package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +1 -1
  28. package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +1 -0
  29. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +15 -1
  30. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +1 -0
  31. package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
  32. package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.cjs +20 -0
  33. package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.d.cts +1 -0
  34. package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +16 -5
  35. package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
  36. package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
  37. package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +2 -2
  38. package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +3 -3
  39. package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
  40. package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +2 -2
  41. package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +4 -4
  42. package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +2 -2
  43. package/vendor/node_modules/@legendapp/spark-file-system/package.json +2 -2
  44. package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +2 -2
  45. package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
  46. package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
  47. package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +2 -2
  48. package/vendor/node_modules/@legendapp/spark-native-menu/package.json +2 -2
  49. package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
  50. package/vendor/node_modules/@legendapp/spark-processes/package.json +2 -2
  51. package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
  52. package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
  53. package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
  54. package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +5 -5
  55. package/vendor/node_modules/@legendapp/spark-settings-ui/src/heading.tsx +14 -0
  56. package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +132 -332
  57. package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +185 -0
  58. package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
  59. package/vendor/node_modules/@legendapp/spark-system/package.json +2 -2
  60. package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
  61. package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +29 -0
  62. package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +17 -1
  63. package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +20 -0
  64. package/vendor/node_modules/@legendapp/spark-ui/package.json +2 -2
  65. package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +2 -1
  66. package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +1 -1
  67. package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +15 -12
  68. package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +7 -6
  69. package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +10 -9
  70. package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +6 -4
  71. package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +2 -1
  72. package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +1 -0
  73. package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +4 -0
  74. package/vendor/node_modules/@legendapp/spark-ui/src/switch.tsx +13 -0
  75. package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +16 -4
  76. package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
  77. package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
  78. package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
  79. /package/{settings-window.ts → ui-settings.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,11 +64,11 @@
64
64
  "./ui/swipe": "./ui-swipe.ts",
65
65
  "./ui/symbol": "./ui-symbol.ts",
66
66
  "./ui/popover": "./ui-popover.ts",
67
+ "./ui/settings": "./ui-settings.ts",
67
68
  "./ui/sheet": "./ui-sheet.ts",
68
69
  "./ui/table": "./ui-table.ts",
69
70
  "./ui/progress": "./ui-progress.ts",
70
71
  "./ui/search": "./ui-search.ts",
71
- "./settings/window": "./settings-window.ts",
72
72
  "./settings/observable": "./settings-observable.ts",
73
73
  "./ui/classnames": "./ui-classnames.ts",
74
74
  "./contracts": "./contracts.ts",
@@ -127,7 +127,7 @@
127
127
  "react-native-enriched-html": "1.1.1",
128
128
  "expo-linking": "~55.0.17",
129
129
  "expo-secure-store": "~55.0.18",
130
- "@legendapp/list": ">=3.3.0",
130
+ "@legendapp/list": ">=3.3.4",
131
131
  "@op-engineering/op-sqlite": "18.2.1",
132
132
  "@expo/ui": "55.0.17",
133
133
  "uniwind": "^1.6.3",
@@ -188,7 +188,7 @@
188
188
  "spark": {
189
189
  "nativePatchRequirements": {
190
190
  "schema": 1,
191
- "frameworkVersion": "0.0.4",
191
+ "frameworkVersion": "0.0.6",
192
192
  "packages": {
193
193
  "@react-native-runtimes/core": {
194
194
  "version": "0.1.0-alpha.2",
@@ -554,3 +554,108 @@ inactive-target configuration remains accepted.
554
554
 
555
555
  The SecureStore original-import adapter remains held for verification and is not
556
556
  included in 0.0.4.
557
+
558
+ ## 0.0.5
559
+
560
+ Breaking: yes. macOS settings windows move from
561
+ `@legendapp/spark/settings/window` to `@legendapp/spark/ui/settings` (#561).
562
+
563
+ 1. Change settings window imports and re-exports to the new path. Install
564
+ `@legendapp/list` in the app if it is missing. Keep the window registration
565
+ with `createSettingsWindowOptions()` and pass the registered `windowId`.
566
+ 2. Replace the `pages` array and render callbacks with `SettingsPage` children.
567
+ Keep each page's ID and title, and add an SF Symbol name as `icon`. Remove any
568
+ `backgroundClassName`, `contentBackgroundClassName`, `contentMinWidth`,
569
+ `sidebarMinWidth` and `estimatedItemSize` props from the window. Move any page
570
+ actions into the page content.
571
+ 3. Place rows in `SettingsSection` cards in place of `SettingsCard` and
572
+ `SettingsRowGroup`. Change row `title` to `label` and put custom controls in
573
+ the row's children in place of `control`. Built-in switch, select, segmented
574
+ and image choice rows take the app's `value` and `onValueChange`.
575
+
576
+ **Before**
577
+
578
+ ```tsx
579
+ import { SettingsRow, SettingsWindow } from "@legendapp/spark/settings/window";
580
+
581
+ <SettingsWindow windowId="settings" pages={[
582
+ { id: "general", title: "General", render: () => <SettingsRow title="Theme" control={<ThemePicker />} /> },
583
+ ]} />
584
+ ```
585
+
586
+ **After**
587
+
588
+ ```tsx
589
+ import { SettingsPage, SettingsRow, SettingsSection, SettingsWindow } from "@legendapp/spark/ui/settings";
590
+
591
+ <SettingsWindow windowId="settings">
592
+ <SettingsPage id="general" title="General" icon="gearshape">
593
+ <SettingsSection title="Appearance">
594
+ <SettingsRow label="Theme"><ThemePicker /></SettingsRow>
595
+ </SettingsSection>
596
+ </SettingsPage>
597
+ </SettingsWindow>
598
+ ```
599
+
600
+ Standalone forms can import `Switch` from `@legendapp/spark/ui` with a boolean
601
+ `value`, `onValueChange` and an accessibility label. Use
602
+ `Select variant="borderless"` on macOS and web.
603
+
604
+ Run `spark upgrade`, `spark doctor`, and the app's typecheck and tests. Rebuild
605
+ custom macOS hosts and check sidebar selection, scrolling between pages, and
606
+ settings value persistence after reopening the window.
607
+
608
+ - macOS driver flows isolate app state and reattach after the main React host
609
+ reloads. Use the per-flow failure bundle to diagnose errors (#560).
610
+ - macOS packaging verifies the signed app's load paths, signing settings and
611
+ bundle contents. Check apps with custom native dependencies using
612
+ `bun run release:check <project-directory> <signed.app>` from the Spark
613
+ source checkout. Local rebuilds keep the last complete output available until
614
+ the new app is ready (#562).
615
+
616
+ ## 0.0.6
617
+
618
+ Breaking: yes. macOS settings windows require `@legendapp/list` 3.3.4 or later in
619
+ the app's dependencies (#568). Upgrade the app's pin and lockfile if needed.
620
+
621
+ Settings pages now fit their content, and the sidebar and native window title
622
+ follow the visible page. The in-pane heading defaults to the page's `title`.
623
+ Pass a string to customize it, or `heading={false}` if the page already renders
624
+ its own heading. The sidebar and window still use `title`. The default in-pane
625
+ heading uses the SF title2 style (17/22 pt regular) so it stands apart from
626
+ 13/16 pt semibold card section headers (#569).
627
+
628
+ **Before**
629
+
630
+ ```tsx
631
+ <SettingsPage id="general" title="General" icon="gearshape">
632
+ <GeneralHeading />
633
+ <GeneralSettings />
634
+ </SettingsPage>
635
+ ```
636
+
637
+ **After**
638
+
639
+ ```tsx
640
+ <SettingsPage id="general" title="General" icon="gearshape" heading={false}>
641
+ <GeneralHeading />
642
+ <GeneralSettings />
643
+ </SettingsPage>
644
+ ```
645
+
646
+ - Recheck settings rows that use fixed widths or spacing. Segmented controls
647
+ using fit distribution size to their labels, and row and section spacing
648
+ matches Journal (#563, #565, #566).
649
+ - Expo Constants reports the local computer name as `hostName` on macOS.
650
+ Review consumers that expect a DNS hostname. macOS prebuild uses a bundled
651
+ template, so template generation works offline. Installing Pods can still
652
+ require network access (#563).
653
+ - The build output swap helper uses a full Xcode installation and its matching
654
+ SDK. If Command Line Tools are selected, Spark looks for standard Xcode.
655
+ Select a full installation with `DEVELOPER_DIR` on custom build hosts (#564).
656
+ - The Kitchen Sink driver answers Metro's `/status` probe during one-shot bundle
657
+ tests. The app's Metro setup needs no change (#567).
658
+
659
+ Run `spark upgrade`, `spark doctor`, and the app's typecheck and tests. Rebuild
660
+ custom macOS hosts and verify startup, segmented controls, and that scrolling
661
+ and clicking the sidebar keep the visible page and native title in sync.
@@ -1,6 +1,6 @@
1
1
  # Storage and settings
2
2
 
3
- Exports: `@legendapp/spark/settings`, `/settings/observable`, `/settings/window`, `/secure-storage`, `/sqlite`.
3
+ Exports: `@legendapp/spark/settings`, `/settings/observable`, `/secure-storage`, `/sqlite`.
4
4
 
5
5
  ## Pick the right store
6
6
 
@@ -52,33 +52,7 @@ try {
52
52
  }
53
53
  ```
54
54
 
55
- ## Settings window UI
56
-
57
- `/settings/window` builds a macOS-style preferences window: a sidebar of pages (`SettingsWindow`, or `VirtualizedSettingsWindow` for long pages) whose content is `SettingsPage` > `SettingsSection` > `SettingsRow` (`title`, optional `description`, and a `control`). Register the window with `createSettingsWindowOptions()`: it opens hidden and `SettingsWindow` shows it once its native layout is ready. `windowId` must match the registered ID and cannot change while mounted. Selection is uncontrolled (`defaultPageId`) or controlled (`selectedPageId` + `onSelectionChange`). Requires the `@legendapp/list` peer.
58
-
59
- ```tsx
60
- import { SettingsPage, SettingsRow, SettingsSection, SettingsWindow, createSettingsWindowOptions } from '@legendapp/spark/settings/window';
61
- import { createWindowsNavigator } from '@legendapp/spark/windows';
62
- import { Switch } from 'react-native';
63
-
64
- function General() {
65
- return (
66
- <SettingsPage>
67
- <SettingsSection title="Startup" first>
68
- <SettingsRow title="Open at login" control={<Switch value={false} onValueChange={() => {}} />} />
69
- </SettingsSection>
70
- </SettingsPage>
71
- );
72
- }
73
-
74
- function Settings() {
75
- return <SettingsWindow windowId="settings" pages={[{ id: 'general', title: 'General', render: () => <General /> }]} />;
76
- }
77
-
78
- export const windows = createWindowsNavigator({
79
- settings: { id: 'settings', component: Settings, options: createSettingsWindowOptions() },
80
- });
81
- ```
55
+ For settings window composition, see `/ui/settings` in [UI components](ui.md).
82
56
 
83
57
  ## Platforms
84
58
 
@@ -1,6 +1,6 @@
1
1
  # UI components
2
2
 
3
- Exports: `@legendapp/spark/ui`, `/ui/uniwind`, `/ui/classnames`, `/ui/search`, `/ui/sidebar`, `/ui/split-view`, `/ui/swipe`, `/ui/glass`, `/ui/symbol`, `/ui/progress`, `/ui/popover`, `/ui/table`, `/ui/sheet`, `/webview`, `/markdown`, `/html`.
3
+ Exports: `@legendapp/spark/ui`, `/ui/uniwind`, `/ui/classnames`, `/ui/search`, `/ui/sidebar`, `/ui/split-view`, `/ui/swipe`, `/ui/glass`, `/ui/symbol`, `/ui/progress`, `/ui/popover`, `/ui/table`, `/ui/sheet`, `/ui/settings`, `/webview`, `/markdown`, `/html`.
4
4
 
5
5
  ## Rules
6
6
 
@@ -8,6 +8,8 @@ Exports: `@legendapp/spark/ui`, `/ui/uniwind`, `/ui/classnames`, `/ui/search`, `
8
8
  - `Button`, `TextInput`, `Select` and `SegmentedControl` (from `/ui`, or `/ui/uniwind` for className styling) render native AppKit/WinUI controls and work on iOS/Android/web through Expo UI or React Native.
9
9
  - `Checkbox` (`value`/`onValueChange`, string label children) is macOS, Windows (WinUI `CheckBox`) and web; check `getControlAvailability('checkbox')`. `Button variant="disclosure"` (requires `expanded`) is macOS and web only. `RadioGroup` (`options`/`value`/`onValueChange` like Select, `orientation` `vertical`/`horizontal`, `size` `regular`/`small`/`mini`) is macOS (`NSButton` radios) and web only; check `getControlAvailability('radio-group')`. On macOS, buttons and checkboxes size themselves; give no fixed width unless you want one.
10
10
  - `Button` takes `symbol` (an SF Symbol before the title; macOS only) and `size` (`regular`/`small`/`mini`; macOS, and web as smaller text). Elsewhere they report `E_UNSUPPORTED_PLATFORM` and render the disabled fallback; a symbol missing on the running macOS reports `E_NOT_FOUND`.
11
+ - `Switch` takes a boolean `value` and `onValueChange`. It uses the platform React Native switch, including `NSSwitch` on macOS. Label it with `accessibilityLabel`.
12
+ - `Select variant="borderless"` removes the bezel on macOS and web. Windows, iOS and Android report `E_UNSUPPORTED_PLATFORM` and show the current value in a disabled fallback.
11
13
  - `SegmentedControl` takes `size` (`regular`/`small`) and `distribution` (`fit`/`fill`). `Sidebar` takes `listStyle="plain"` for lists inside content.
12
14
  - `TextInput` is single-line unless `multiline` (an `NSTextView` on macOS; Return inserts a newline) and takes `placeholder`. It is either controlled (`value`) or uncontrolled (`defaultValue`), never both; switching needs a remount.
13
15
  - `Select`/`SegmentedControl` never auto-select the first option when `value` is missing. Values are unique strings.
@@ -42,6 +44,30 @@ export function Preferences() {
42
44
  }
43
45
  ```
44
46
 
47
+ ## Settings windows on macOS
48
+
49
+ Use `@legendapp/spark/ui/settings` with `@legendapp/list` installed. Register a hidden window with `createSettingsWindowOptions()` and pass the registered `windowId` to `SettingsWindow` (also exported as `VirtualizedSettingsWindow`). The sidebar scrolls the shared list and follows its current page. Use `defaultPageId` or `selectedPageId` with `onSelectionChange`. Other platforms throw `E_UNSUPPORTED_PLATFORM` on render.
50
+
51
+ ```tsx
52
+ import { useState } from 'react';
53
+ import { SettingsPage, SettingsSection, SettingsSwitchRow, SettingsWindow } from '@legendapp/spark/ui/settings';
54
+
55
+ export function Preferences() {
56
+ const [wrap, setWrap] = useState(false);
57
+ return (
58
+ <SettingsWindow windowId="settings">
59
+ <SettingsPage id="editor" title="Editor" icon="square.and.pencil">
60
+ <SettingsSection title="Reading">
61
+ <SettingsSwitchRow label="Wrap long lines" value={wrap} onValueChange={setWrap} />
62
+ </SettingsSection>
63
+ </SettingsPage>
64
+ </SettingsWindow>
65
+ );
66
+ }
67
+ ```
68
+
69
+ Add `SettingsSelectRow`, `SettingsSegmentedRow`, or `SettingsImageChoiceRow` for controlled choices. Each image option has a `label`, `value`, and one React Native `image` source. Rows accept an optional `description` and `info` tooltip. Pass a custom control as children of `SettingsRow`, or put a full-width custom element directly in a section.
70
+
45
71
  ## WebView, Markdown and HTML
46
72
 
47
73
  - `/webview` is a Spark-owned subset over `react-native-webview@16.0.0` (WebKit on macOS, not Chromium). Upstream platform-specific props reject; import `react-native-webview` directly if you need its full surface. Nothing native is exposed to pages: define a navigation policy and expose only intended message handlers.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@legendapp/spark-ai",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "private": true,
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
7
7
  "dependencies": {
8
- "@legendapp/spark-desktop-app": "0.0.4",
9
- "@legendapp/spark-processes": "0.0.4"
8
+ "@legendapp/spark-desktop-app": "0.0.6",
9
+ "@legendapp/spark-processes": "0.0.6"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "react": "^19.2.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-audio",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "main": "src/index",
6
6
  "react-native": "src/index",
@@ -37,6 +37,6 @@
37
37
  },
38
38
  "private": true,
39
39
  "dependencies": {
40
- "@legendapp/spark-desktop-app": "0.0.4"
40
+ "@legendapp/spark-desktop-app": "0.0.6"
41
41
  }
42
42
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-auth-session",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "main": "src/index",
6
6
  "react-native": "src/index",
@@ -8,9 +8,9 @@
8
8
  "src"
9
9
  ],
10
10
  "dependencies": {
11
- "@legendapp/spark-desktop-links": "0.0.4",
11
+ "@legendapp/spark-desktop-links": "0.0.6",
12
12
  "base64-js": "1.5.1",
13
- "@legendapp/spark-desktop-app": "0.0.4"
13
+ "@legendapp/spark-desktop-app": "0.0.6"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "react-native": "0.83.10",
@@ -12,7 +12,8 @@ import { copyHelpers } from "./helpers.js";
12
12
  import { lacksMacOSPod, readAppConfig } from "./project.js";
13
13
  import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, readdirSync, rmSync, writeFileSync, openSync, closeSync, } from "node:fs";
14
14
  import path from "node:path";
15
- import { registerRuntime } from "./local.js";
15
+ import { readRuntime, registerRuntime } from "./local.js";
16
+ import { publishDirectory } from "./publish-directory.js";
16
17
  import { binary, doctor, run } from "./commands.js";
17
18
  import { prepareConfig, entryFile, digest, hashFiles, nativePreparationInputs, nativeProjectFingerprint, localSigningIdentity, nativePackages, readJson, runtimeFor, selection, stateFile, writeJson, validateBuildModules, goConfigurationIssues, } from "./project.js";
18
19
  export async function analyze(root) {
@@ -223,11 +224,12 @@ async function buildUnlocked(root, mode, force) {
223
224
  const resultFile = stateFile(root, `${mode}-build.json`);
224
225
  const { preparation, nativeConfig, nativeRoot, workspace } = await prepareMacOS(root, chosen, force);
225
226
  const existing = existsSync(resultFile) ? readJson(resultFile) : undefined;
227
+ const publishedRuntime = existing && readRuntime(existing.app);
226
228
  if (!force && existing) {
227
229
  if (existing.runtime.fingerprint === runtime.fingerprint &&
228
230
  existing.preparation?.fingerprint === preparation.fingerprint &&
229
231
  existing.product === path.basename(existing.app) &&
230
- existsSync(existing.app)) {
232
+ publishedRuntime?.fingerprint === runtime.fingerprint) {
231
233
  console.log(`Reusing ${existing.app}`);
232
234
  return existing;
233
235
  }
@@ -235,7 +237,7 @@ async function buildUnlocked(root, mode, force) {
235
237
  const reasons = force ? ["forced build"] : !existing ? ["no cached app"] : [
236
238
  ...preparationChanges(existing.preparation, preparation),
237
239
  ...(existing.runtime.fingerprint !== runtime.fingerprint ? ["runtime inputs changed"] : []),
238
- ...(!existsSync(existing.app) ? ["cached app missing"] : []),
240
+ ...(publishedRuntime?.fingerprint !== existing.runtime.fingerprint ? ["published app does not match its receipt"] : []),
239
241
  ...(existing.product !== path.basename(existing.app) ? ["cached app product is unverified"] : []),
240
242
  ];
241
243
  console.log(`Building ${mode} runtime: ${reasons.join("; ")}.`);
@@ -273,14 +275,6 @@ async function buildUnlocked(root, mode, force) {
273
275
  if (!existsSync(path.join(products, product)))
274
276
  throw new Error(`Build completed without ${product}.`);
275
277
  const destination = stateFile(root, `products/macos-${runtime.arch}/${mode}/${product}`);
276
- rmSync(path.dirname(destination), { recursive: true, force: true });
277
- mkdirSync(path.dirname(destination), { recursive: true });
278
- cpSync(path.join(products, product), destination, { recursive: true, verbatimSymlinks: true });
279
- if (mode === "release" &&
280
- !existsSync(path.join(destination, "Contents/Resources/main.jsbundle")))
281
- throw new Error("Standalone build is missing its JavaScript bundle.");
282
- if (mode === "release")
283
- checkReleaseTestDriver(destination, nativeConfig.macos?.testDriverInRelease === true);
284
278
  const result = {
285
279
  app: destination,
286
280
  // Older receipts may record a stale bundle selected from DerivedData.
@@ -295,20 +289,45 @@ async function buildUnlocked(root, mode, force) {
295
289
  }
296
290
  if (productionHash)
297
291
  result.runtime.fingerprint = digest(result.runtime.fingerprint + productionHash);
298
- // prebuild can update package/config fields; cache the actual post-generation inputs.
299
- writeJson(path.join(destination, "Contents/Resources/spark-runtime.json"), result.runtime);
300
- if (mode === "release")
301
- await prepareCustomizeArtifacts(root, result.runtime, destination);
302
- copyHelpers(root, destination, readAppConfig(root).expo?.extra?.spark?.helpers);
303
- if (mode === "release") {
304
- // Hermes is prebuilt, so Xcode's app/Pod compiler settings cannot strip it.
305
- const hermes = path.join(destination, "Contents/Frameworks/hermes.framework/Versions/Current/hermes");
306
- if (existsSync(hermes))
307
- await run(root, ["strip", "-S", "-x", hermes], { capture: true });
292
+ const target = path.dirname(destination);
293
+ const staging = `${target}.staging`;
294
+ const stagedApp = path.join(staging, product);
295
+ rmSync(staging, { recursive: true, force: true });
296
+ mkdirSync(staging, { recursive: true });
297
+ try {
298
+ cpSync(path.join(products, product), stagedApp, { recursive: true, verbatimSymlinks: true });
299
+ if (mode === "release") {
300
+ if (!existsSync(path.join(stagedApp, "Contents/Resources/main.jsbundle")))
301
+ throw new Error("Standalone build is missing its JavaScript bundle.");
302
+ checkReleaseTestDriver(stagedApp, nativeConfig.macos?.testDriverInRelease === true);
303
+ const plist = path.join(stagedApp, "Contents/Info.plist");
304
+ const info = JSON.parse(await run(root, ["plutil", "-convert", "json", "-o", "-", plist], { capture: true }));
305
+ const ats = info.NSAppTransportSecurity;
306
+ if (ats && "NSAllowsLocalNetworking" in ats) {
307
+ const key = Object.keys(ats).length === 1
308
+ ? "NSAppTransportSecurity" : "NSAppTransportSecurity.NSAllowsLocalNetworking";
309
+ await run(root, ["plutil", "-remove", key, plist], { capture: true });
310
+ }
311
+ }
312
+ // prebuild can update package/config fields; cache the actual post-generation inputs.
313
+ writeJson(path.join(stagedApp, "Contents/Resources/spark-runtime.json"), result.runtime);
314
+ if (mode === "release")
315
+ await prepareCustomizeArtifacts(root, result.runtime, stagedApp);
316
+ copyHelpers(root, stagedApp, readAppConfig(root).expo?.extra?.spark?.helpers);
317
+ if (mode === "release") {
318
+ // Hermes is prebuilt, so Xcode's app/Pod compiler settings cannot strip it.
319
+ const hermes = path.join(stagedApp, "Contents/Frameworks/hermes.framework/Versions/Current/hermes");
320
+ if (existsSync(hermes))
321
+ await run(root, ["strip", "-S", "-x", hermes], { capture: true });
322
+ }
323
+ // Development apps can opt into a local identity for same-team native plugins.
324
+ // Standalone outputs remain ad-hoc until `spark package` signs its staging copy.
325
+ await run(root, ["codesign", "--force", "--deep", "--sign", localSigningIdentity(root, mode), stagedApp], { capture: true });
326
+ publishDirectory(staging, target, stateFile(root, "tools"));
327
+ }
328
+ finally {
329
+ rmSync(staging, { recursive: true, force: true });
308
330
  }
309
- // Development apps can opt into a local identity for same-team native plugins.
310
- // Standalone outputs remain ad-hoc until `spark package` signs its staging copy.
311
- await run(root, ["codesign", "--force", "--deep", "--sign", localSigningIdentity(root, mode), destination], { capture: true });
312
331
  writeJson(resultFile, result);
313
332
  console.log(`Built ${destination}`);
314
333
  return result;
@@ -362,6 +381,9 @@ async function prepareMacOS(root, chosen, force) {
362
381
  if (needsPreparation || missing.length)
363
382
  rmSync(preparedFile, { force: true });
364
383
  if (needsProject) {
384
+ const template = path.join(import.meta.dirname, "expo-desktop-template-bare-minimum-55.83.10.tgz");
385
+ if (!existsSync(template))
386
+ throw new Error("Spark's bundled macOS prebuild template is missing. Reinstall Spark and retry.");
365
387
  console.log(`Preparing native project (preserving CocoaPods cache): ${force ? "forced build" : !hasNativeProject ? "native project missing" : preparationChanges(prepared, preparation).join("; ") || "native project provenance missing"}.`);
366
388
  const manifest = readFileSync(path.join(root, "package.json"), "utf8");
367
389
  const appJson = path.join(root, "app.json");
@@ -373,7 +395,7 @@ async function prepareMacOS(root, chosen, force) {
373
395
  "--platform",
374
396
  "macos",
375
397
  "--template",
376
- "expo-desktop-template-bare-minimum@55.83.10",
398
+ template,
377
399
  "--no-install",
378
400
  // Template renaming is not idempotent (HelloWorld becomes
379
401
  // LegendHelloWorld, then LegendLegendHelloWorld). Native projects
@@ -106,6 +106,12 @@ const migrations = [
106
106
  { version: '0.0.4', automatic: false, breaking: true, apply(context) {
107
107
  context.manualStep('Quit older builds, back up macOS file/MMKV data, keep bundle identifiers stable, and rebuild custom hosts. First launch automatically migrates owned legacy data to ~/Library/Application Support/<bundle id>/Spark; ambiguous sources and IO errors stop startup. Review any reported conflict without overwriting data, then verify file/MMKV values and relaunch persistence; see the linked upgrade notes.');
108
108
  } },
109
+ { version: '0.0.5', automatic: false, breaking: true, apply(context) {
110
+ context.manualStep('For macOS settings windows, replace @legendapp/spark/settings/window with @legendapp/spark/ui/settings, install @legendapp/list if missing, and migrate the pages and rows to the new JSX API. See the linked upgrade notes and verify the settings window after rebuilding custom macOS hosts.');
111
+ } },
112
+ { version: '0.0.6', automatic: false, breaking: true, apply(context) {
113
+ context.manualStep('For macOS settings windows, upgrade @legendapp/list to 3.3.4 or later and review the new in-pane SettingsPage heading. Set heading={false} on pages that already render their own heading. See the linked upgrade notes.');
114
+ } },
109
115
  ];
110
116
 
111
117
  /** @param {string} root */
@@ -7,7 +7,7 @@ import path from "node:path";
7
7
  import { build } from "./build.js";
8
8
  import { credentials, notaryAuth } from "./credentials.js";
9
9
  import { run } from "./commands.js";
10
- import { appEntitlements, distributionEntitlements, signApp, validateApp } from "./signing.js";
10
+ import { releaseAppExpectation, signApp, validateApp } from "./signing.js";
11
11
  import { digest, readJson, stateFile, writeJson } from "./project.js";
12
12
  export function artifactHash(file) {
13
13
  const hash = createHash("sha256");
@@ -68,14 +68,9 @@ async function packageUnlocked(root, options, deps) {
68
68
  const config = readAppConfig(root).expo;
69
69
  if (config.extra?.spark?.updates && !result.runtime.modules["@legendapp/spark-updates"])
70
70
  throw new Error("Updates are configured but the module was pruned. Import @legendapp/spark/updates from the app entry.");
71
- const entitlements = distributionEntitlements(appEntitlements(root, result.runtime.modules));
72
- if (!config.macos?.bundleIdentifier || !config.version)
73
- throw new Error("Packaging requires macos.bundleIdentifier and version");
74
- const byPath = config.extra?.spark?.signing?.macos?.entitlementsByPath ?? {};
75
71
  const info = JSON.parse(await execute(root, ["plutil", "-convert", "json", "-o", "-", path.join(result.app, "Contents/Info.plist")], { capture: true }));
76
- const expected = { arch: result.runtime.arch, runner: options.runner, bundleId: config.macos.bundleIdentifier, version: config.version, buildVersion: info.CFBundleVersion, entitlements, byPath };
77
- if (!expected.bundleId || !expected.version || !expected.buildVersion)
78
- throw new Error("Bundle identifier and release version metadata must be configured before packaging.");
72
+ const expected = releaseAppExpectation(root, result.runtime, config, info.CFBundleVersion);
73
+ const { entitlements, byPath } = expected;
79
74
  const inputHash = artifactHash(result.app);
80
75
  const key = digest(JSON.stringify({ recipe: 1, inputHash, identity: identity.hash, entitlements, byPath }));
81
76
  const folder = stateFile(root, `packaging/${key}`);
@@ -90,6 +85,7 @@ async function packageUnlocked(root, options, deps) {
90
85
  if (!existsSync(app) || artifactHash(app) !== state.stagedHash || !existsSync(upload) || createHash("sha256").update(readFileSync(upload)).digest("hex") !== state.archiveHash) {
91
86
  throw new Error(`The staged notarization artifacts changed. Preserve ${statePath} for submission recovery; rebuild from clean inputs before retrying.`);
92
87
  }
88
+ await validateApp(root, app, identity, expected, false, execute);
93
89
  }
94
90
  else {
95
91
  rmSync(app, { recursive: true, force: true });
@@ -2,7 +2,7 @@ import { patchSourceSHA } from "@legendapp/spark-desktop-config/patch-registry.c
2
2
  import { SparkError, validatePackageSettings } from "@legendapp/spark-desktop-config/validation.cjs";
3
3
  import { assertEnrichedHtmlPins } from "./enriched-html-pins.js";
4
4
  import { nativeWindowOptions } from "@legendapp/spark-window-options";
5
- import { prepareNativePatches, removeExpoApplicationAlias } from "@legendapp/spark-desktop-config/native-patches.cjs";
5
+ import { prepareNativePatches, removeExpoApplicationAlias, patchExpoComputerName } from "@legendapp/spark-desktop-config/native-patches.cjs";
6
6
  import { macOSReleaseSettings } from "./macos-release.js";
7
7
  import { projectPlatform, architecture } from "./platform.js";
8
8
  import { resolveHelpers } from "./helpers.js";
@@ -14,7 +14,7 @@ import { existsSync, readFileSync, readdirSync, realpathSync, } from "node:fs";
14
14
  import path from "node:path";
15
15
  import { readJson, writeJson } from "./json.js";
16
16
  export { readJson, writeJson };
17
- export const VERSION = "0.0.4";
17
+ export const VERSION = "0.0.6";
18
18
  export function digest(value) {
19
19
  return createHash("sha256").update(value).digest("hex");
20
20
  }
@@ -155,8 +155,10 @@ export function nativePackages(root, { applyExcludes = true } = {}) {
155
155
  return windowsNativePackages(root, installed);
156
156
  const rootOf = (name) => installed.find(pkg => pkg.name === name)?.root;
157
157
  const [macOS, expoCore] = [rootOf("react-native-macos"), rootOf("expo-modules-core")];
158
- if (macOS && expoCore)
158
+ if (macOS && expoCore) {
159
159
  removeExpoApplicationAlias(macOS, expoCore);
160
+ patchExpoComputerName(expoCore);
161
+ }
160
162
  const excluded = ["app.json", "desktop.config.json"].some(file => existsSync(path.join(root, file)))
161
163
  ? readAppConfig(root).expo?.autolinking?.exclude ?? [] : [];
162
164
  if (!applyExcludes) {
@@ -0,0 +1,40 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { existsSync, mkdirSync, renameSync, rmSync } from "node:fs";
4
+ import path from "node:path";
5
+ // Node's rename cannot replace a nonempty directory. macOS can exchange their names.
6
+ const source = `#include <stdio.h>
7
+ int main(int argc, char **argv) {
8
+ if (argc != 3) return 2;
9
+ if (renamex_np(argv[1], argv[2], RENAME_SWAP) == 0) return 0;
10
+ perror("Cannot swap Spark build directories");
11
+ return 1;
12
+ }
13
+ `;
14
+ export function swapToolchainEnv(selected = process.env.DEVELOPER_DIR || execFileSync("xcode-select", ["-p"], { encoding: "utf8" }).trim()) {
15
+ const developerDir = selected.endsWith("/CommandLineTools") ? "/Applications/Xcode.app/Contents/Developer" : selected;
16
+ return { ...process.env, DEVELOPER_DIR: developerDir };
17
+ }
18
+ export function swapSdkPath(env = swapToolchainEnv()) {
19
+ return execFileSync("xcrun", ["--sdk", "macosx", "--show-sdk-path"], { env, encoding: "utf8" }).trim();
20
+ }
21
+ export function publishDirectory(staged, target, tools) {
22
+ if (!existsSync(target)) {
23
+ renameSync(staged, target);
24
+ return;
25
+ }
26
+ const tool = path.join(tools, `swap-${createHash("sha256").update(source).digest("hex").slice(0, 16)}`);
27
+ if (!existsSync(tool)) {
28
+ mkdirSync(tools, { recursive: true });
29
+ const pending = `${tool}.${process.pid}.tmp`;
30
+ try {
31
+ const env = swapToolchainEnv();
32
+ execFileSync("xcrun", ["clang", "-isysroot", swapSdkPath(env), "-x", "c", "-o", pending, "-"], { input: source, env });
33
+ renameSync(pending, tool);
34
+ }
35
+ finally {
36
+ rmSync(pending, { force: true });
37
+ }
38
+ }
39
+ execFileSync(tool, [staged, target]);
40
+ }