@legendapp/spark 0.0.1-next.2 → 0.0.1-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -4
- package/ai-codex.ts +1 -0
- package/ai.ts +1 -0
- package/app-documents.ts +1 -0
- package/camera.ts +13 -0
- package/config-plugin.d.cts +2 -0
- package/contracts.ts +2 -0
- package/diagnostics.ts +1 -0
- package/expo-config.d.cts +1 -0
- package/metro.cjs +4 -1
- package/metro.d.cts +12 -0
- package/native.cjs +3 -1
- package/native.d.cts +6 -0
- package/package.json +93 -15
- package/patches/camera/react-native-nitro-image.patch +320 -0
- package/patches/camera/react-native-nitro-modules.patch +50 -0
- package/patches/camera/react-native-vision-camera.patch +2662 -0
- package/patches/camera/upstream.json +22 -0
- package/patches/dependencies.json +8 -0
- package/patches/react-native-enriched-markdown@1.0.2.patch +8684 -0
- package/postinstall.cjs +1 -0
- package/schema.json +276 -58
- package/settings-observable.ts +1 -0
- package/settings-window.ts +1 -0
- package/shortcuts-commands.ts +1 -0
- package/shortcuts-keyboard.ts +3 -0
- package/ui-classnames.ts +1 -0
- package/ui-glass.ts +1 -0
- package/ui-search.ts +1 -0
- package/ui-sidebar.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-swipe.ts +1 -0
- package/ui-symbol.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +19 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/availability.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/index.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/invocations.ts +34 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/output.ts +62 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/run.ts +12 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/types.ts +16 -0
- package/vendor/node_modules/@legendapp/spark-audio/macos/RNSparkAudio.h +2 -1
- package/vendor/node_modules/@legendapp/spark-audio/macos/RNSparkAudio.mm +126 -24
- package/vendor/node_modules/@legendapp/spark-audio/package.json +5 -2
- package/vendor/node_modules/@legendapp/spark-audio/src/NativeSparkAudio.ts +5 -1
- package/vendor/node_modules/@legendapp/spark-audio/src/desktop.ts +36 -32
- package/vendor/node_modules/@legendapp/spark-audio/src/events.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-audio/src/hooks.ts +65 -0
- package/vendor/node_modules/@legendapp/spark-audio/src/index.web.ts +92 -33
- package/vendor/node_modules/@legendapp/spark-audio/src/media-session-unavailable.ts +6 -4
- package/vendor/node_modules/@legendapp/spark-audio/src/media-session.ts +52 -19
- package/vendor/node_modules/@legendapp/spark-audio/src/media-session.web.ts +18 -10
- package/vendor/node_modules/@legendapp/spark-audio/src/media-types.ts +40 -13
- package/vendor/node_modules/@legendapp/spark-audio/src/mobile.ts +40 -32
- package/vendor/node_modules/@legendapp/spark-audio/src/player.ts +97 -0
- package/vendor/node_modules/@legendapp/spark-audio/src/status-listeners.ts +21 -15
- package/vendor/node_modules/@legendapp/spark-audio/src/types.ts +9 -4
- package/vendor/node_modules/@legendapp/spark-audio/windows/SparkAudio/SparkAudio.h +67 -20
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-auth-session/src/core.ts +60 -42
- package/vendor/node_modules/@legendapp/spark-auth-session/src/index.ts +28 -12
- package/vendor/node_modules/@legendapp/spark-auth-session/src/mobile.ts +97 -41
- package/vendor/node_modules/@legendapp/spark-auth-session/src/types.ts +20 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +50 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/build-mode.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +145 -59
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +61 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +10 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +37 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/credentials.js +86 -25
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +132 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +13 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +13 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +100 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +4 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-metro.cjs +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-native.cjs +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-node.js +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/helpers.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +52 -44
- package/vendor/node_modules/@legendapp/spark-cli/dist/json.js +16 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/local.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +26 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-metadata.js +26 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +86 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-preparation.js +88 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/notary-profiles.js +75 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/platform.js +16 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/process.js +7 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +90 -32
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.js +86 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +23 -18
- package/vendor/node_modules/@legendapp/spark-cli/dist/runner-install.js +145 -31
- package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +4 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/universal.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/updates.js +41 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +5 -9
- package/vendor/node_modules/@legendapp/spark-cli/package.json +7 -6
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/App.tsx +6 -12
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +5 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +12 -10
- package/vendor/node_modules/@legendapp/spark-cli/templates/diff-lite/Git.macos.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/Integration.macos.tsx +23 -21
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/Integration.windows.tsx +23 -21
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/io.desktop.ts +11 -8
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/io.macos.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/Lifecycle.desktop.tsx +8 -14
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/OpenFiles.desktop.tsx +5 -10
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/io.desktop.ts +11 -8
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/io.macos.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/music-lite/assets.desktop.ts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/Activation.desktop.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/Desktop.desktop.ts +37 -15
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/session.ts +5 -6
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/window-session.ts +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +5 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/metro.config.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +14 -12
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/react-native.config.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +14 -12
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/react-native.config.js +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +10 -16
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/src/NativeDesktopClipboard.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +55 -31
- package/vendor/node_modules/@legendapp/spark-clipboard/src/expo.ts +21 -11
- package/vendor/node_modules/@legendapp/spark-clipboard/src/options.ts +8 -0
- package/vendor/node_modules/@legendapp/spark-clipboard/src/types.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-clipboard/windows/SparkClipboard/SparkClipboard.h +38 -15
- package/vendor/node_modules/@legendapp/spark-clipboard/windows/SparkClipboard/SparkClipboard.vcxproj +2 -0
- package/vendor/node_modules/@legendapp/spark-codex/RNCodex.podspec +22 -0
- package/vendor/node_modules/@legendapp/spark-codex/cpp/HybridCodexAppServer.hpp +23 -0
- package/vendor/node_modules/@legendapp/spark-codex/cpp/HybridCodexAppServer.mm +1529 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitro.json +21 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/.gitattributes +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex+autolinking.rb +62 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex-Swift-Cxx-Bridge.cpp +17 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex-Swift-Cxx-Bridge.hpp +27 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex-Swift-Cxx-Umbrella.hpp +38 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodexAutolinking.mm +35 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodexAutolinking.swift +16 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/CodexAvailability.hpp +95 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/CodexRunResult.hpp +99 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/HybridCodexAppServerSpec.cpp +24 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/HybridCodexAppServerSpec.hpp +71 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +35 -0
- package/vendor/node_modules/@legendapp/spark-codex/react-native.config.js +11 -0
- package/vendor/node_modules/@legendapp/spark-codex/src/Codex.nitro.ts +30 -0
- package/vendor/node_modules/@legendapp/spark-codex/src/index.ts +65 -0
- package/vendor/node_modules/@legendapp/spark-codex/src/native.ts +6 -0
- package/vendor/node_modules/@legendapp/spark-commands/package.json +21 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/bindings.ts +90 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/index.tsx +400 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/router.ts +138 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/storage.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-context-menu/macos/RNContextMenu.mm +7 -8
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-context-menu/src/NativeContextMenu.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-context-menu/src/index.ts +26 -26
- package/vendor/node_modules/@legendapp/spark-context-menu/windows/SparkContextMenu/SparkContextMenu.h +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/RNDesktopApp.podspec +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/cpp/SparkBinaryJSI.hpp +89 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/cpp/SparkBinaryWindows.hpp +22 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/RNDesktopApp.mm +13 -7
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkBinaryJSI.h +48 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +33 -33
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktopError.h +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkLifecycle.h +26 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkLifecycle.mm +49 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkQuitCoordinator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkQuitCoordinator.mm +70 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkWindow.mm +9 -6
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/recent-documents/RNRecentDocumentController.mm +55 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +5 -3
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/NativeDesktopApp.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/api.ts +86 -40
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/accelerator.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/index.ts +56 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/menu.ts +116 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/native-buffer.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/path.ts +24 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/events.ts +75 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/index.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/index.windows.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/open-requests.ts +43 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/restoration.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/transport.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +10 -5
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.d.cts +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +35 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +18 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +89 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/expo.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/expo.d.cts +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/lifecycle.cjs +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +106 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +7 -5
- package/vendor/node_modules/@legendapp/spark-desktop-config/schema.json +276 -58
- package/vendor/node_modules/@legendapp/spark-desktop-config/updates.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +35 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +129 -11
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-host/windows/application.inc +277 -121
- package/vendor/node_modules/@legendapp/spark-desktop-links/common/AuthLoopback.h +5 -7
- package/vendor/node_modules/@legendapp/spark-desktop-links/macos/RNDesktopLinks.mm +10 -9
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/NativeDesktopLinks.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/api.ts +27 -33
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/expo.ts +3 -4
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/native.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-links/windows/SparkLinks/SparkLinks.h +22 -22
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/RNDesktopShortcuts.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/RNDesktopShortcuts.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.h +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.mm +307 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +8 -5
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/NativeDesktopShortcuts.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/api.ts +39 -14
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/keyboard-manager/NativeKeyboardManager.ts +12 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/keyboard-manager/codes.ts +108 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/keyboard-manager/index.ts +99 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/RNDesktopWindows.podspec +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +229 -103
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/SparkWindowGeometry.h +63 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/LegendWindowRegistry.h +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/LegendWindowRegistry.mm +27 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.h +12 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +3169 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManagerStartup.mm +31 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/SidebarStartupFallbacks.mm +14 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +10 -6
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/NativeDesktopWindowManager.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +146 -70
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/diagnostics.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/index.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/index.windows.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +53 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos.ts +51 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/transport.ts +41 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +140 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +162 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/window-manager/NativeWindowManager.ts +28 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/WindowProvider.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +78 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/index.ts +6 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +34 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/types.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +18 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-documents/package.json +22 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/controller.ts +97 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/documentTransition.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/hooks.ts +139 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/index.tsx +50 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/reload.ts +39 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/requests.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +73 -18
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +58 -15
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +14 -8
- package/vendor/node_modules/@legendapp/spark-file-dialog/ios/RNFileDialog.mm +34 -121
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +12 -5
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/NativeFileDialog.ts +1 -5
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/index.ts +19 -84
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/native.ts +12 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +34 -14
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +26 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/windows/SparkFileDialog/SparkFileDialog.h +42 -58
- package/vendor/node_modules/@legendapp/spark-file-system/RNDesktopFileSystem.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +32 -21
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.h +24 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.mm +215 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScanner.h +9 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScanner.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScannerCore.h +47 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScannerCore.mm +306 -0
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +8 -6
- package/vendor/node_modules/@legendapp/spark-file-system/src/NativeDesktopFileSystem.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/src/file-scanner/NativeFileScanner.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-file-system/src/file-scanner/index.ts +93 -0
- package/vendor/node_modules/@legendapp/spark-file-system/src/handles.ts +48 -14
- package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +134 -45
- package/vendor/node_modules/@legendapp/spark-file-system/src/path.ts +1 -9
- package/vendor/node_modules/@legendapp/spark-file-system/windows/SparkFileSystem/SparkFileSystem.h +102 -26
- package/vendor/node_modules/@legendapp/spark-file-system/windows/SparkFileSystem/SparkFileSystem.vcxproj +2 -0
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/RNDesktopGlobalShortcuts.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/macos/RNDesktopGlobalShortcuts.mm +7 -4
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/src/NativeDesktopGlobalShortcuts.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/src/index.ts +39 -10
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/windows/SparkGlobalShortcuts/SparkGlobalShortcuts.h +5 -4
- package/vendor/node_modules/@legendapp/spark-message-dialog/macos/RNDesktopMessageDialog.mm +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/NativeDesktopMessageDialog.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +48 -11
- package/vendor/node_modules/@legendapp/spark-native-menu/ios/RNNativeMenu.mm +141 -609
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +9 -4
- package/vendor/node_modules/@legendapp/spark-native-menu/src/NativeMenu.ts +2 -7
- package/vendor/node_modules/@legendapp/spark-native-menu/src/api.ts +76 -121
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +97 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/src/windows-menus.ts +43 -37
- package/vendor/node_modules/@legendapp/spark-notifications/macos/RNDesktopNotifications.mm +75 -30
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-notifications/src/NativeDesktopNotifications.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-notifications/src/index.ts +130 -42
- package/vendor/node_modules/@legendapp/spark-notifications/windows/SparkNotifications/SparkNotifications.h +51 -8
- package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +94 -21
- package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-processes/src/NativeDesktopProcesses.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +124 -28
- package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +34 -0
- package/vendor/node_modules/@legendapp/spark-processes/windows/SparkProcesses/SparkProcesses.h +83 -34
- package/vendor/node_modules/@legendapp/spark-processes/windows/SparkProcesses/SparkProcesses.vcxproj +2 -0
- package/vendor/node_modules/@legendapp/spark-secure-storage/macos/RNDesktopSecureStorage.mm +49 -40
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/NativeDesktopSecureStorage.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/desktop.ts +16 -14
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/expo.ts +0 -1
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/options.ts +3 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/unavailable.ts +6 -3
- package/vendor/node_modules/@legendapp/spark-settings/package.json +10 -3
- package/vendor/node_modules/@legendapp/spark-settings/src/fileStorage.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-settings/src/index.ts +7 -9
- package/vendor/node_modules/@legendapp/spark-settings/src/storage/index.ts +142 -0
- package/vendor/node_modules/@legendapp/spark-settings/src/store.ts +63 -21
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +436 -0
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/options.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-sqlite/src/database.ts +182 -0
- package/vendor/node_modules/@legendapp/spark-sqlite/src/index.ts +19 -6
- package/vendor/node_modules/@legendapp/spark-sqlite/src/types.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-system/macos/RNDesktopSystem.mm +36 -11
- package/vendor/node_modules/@legendapp/spark-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-system/src/NativeDesktopSystem.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-system/src/index.ts +89 -32
- package/vendor/node_modules/@legendapp/spark-system/windows/SparkSystem/SparkSystem.h +8 -4
- package/vendor/node_modules/@legendapp/spark-tray/macos/RNDesktopTray.mm +20 -8
- package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-tray/src/NativeDesktopTray.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +91 -34
- package/vendor/node_modules/@legendapp/spark-tray/windows/SparkTray/SparkTray.h +45 -15
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +1419 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/glass-effect-view/RNGlassEffectView.mm +72 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +194 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +180 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +155 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.h +18 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +645 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/swipe-actions/RNSwipeActions.h +10 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/swipe-actions/RNSwipeActions.mm +422 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/text-input-search/RNTextInputSearch.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/text-input-search/RNTextInputSearch.mm +164 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +17 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkSelectNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +6 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +37 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +86 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/classnames/index.ts +8 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +42 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +56 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/glass-effect-view/index.tsx +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +35 -21
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +55 -26
- package/vendor/node_modules/@legendapp/spark-ui/src/index.tsx +1 -27
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +45 -14
- package/vendor/node_modules/@legendapp/spark-ui/src/index.windows.tsx +1 -42
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +11 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +5 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/sf-symbol/SFSymbolNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sf-symbol/index.tsx +27 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +25 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +24 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +104 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/specialized.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/swipe-actions/SwipeActionsNativeComponent.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/swipe-actions/index.tsx +41 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/text-input-search/TextInputSearchNativeComponent.ts +33 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/text-input-search/index.tsx +34 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +30 -19
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +16 -11
- package/vendor/node_modules/@legendapp/spark-updates/macos/RNDesktopUpdates.mm +21 -8
- package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-updates/src/NativeDesktopUpdates.ts +3 -2
- package/vendor/node_modules/@legendapp/spark-updates/src/index.ts +71 -15
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/src/WebView.tsx +11 -0
- package/vendor/node_modules/@legendapp/spark-webview/src/adapter.ts +55 -0
- package/vendor/node_modules/@legendapp/spark-webview/src/index.ts +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/src/types.ts +32 -0
- package/vendor/node_modules/@legendapp/spark-webview/src/view-props.ts +28 -0
- package/vendor/node_modules/@legendapp/spark-window-options/index.cjs +51 -14
- package/vendor/node_modules/@legendapp/spark-window-options/index.d.ts +21 -8
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
- package/windows-macos.ts +1 -0
- package/expo-metro.cjs +0 -1
- package/message-dialog.ts +0 -1
- package/universal.cjs +0 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/accelerator.ts +0 -22
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows-options.ts +0 -11
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/index.windows.ts +0 -15
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/src/accelerator.ts +0 -22
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkSelect.h +0 -4
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkSelect.mm +0 -53
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { creationManifest } from "./local.js";
|
|
2
|
+
import { installedRelease, materializeReleasePackages, packageSources, verifyMaterializedReleasePackages } from "./release.js";
|
|
2
3
|
import { packageManager, managerCommand, applyOverrides, localArchive } from "./package-manager.js";
|
|
3
4
|
import { packArchive } from "./pack-archive.js";
|
|
4
|
-
import { spawnProcess } from "./process.js";
|
|
5
|
+
import { nodeCommand, spawnProcess } from "./process.js";
|
|
5
6
|
import { checkExpoDesktopNode } from "./expo-node.js";
|
|
6
7
|
import { configureExample } from "./examples.js";
|
|
7
8
|
import { hostPlatform } from "./platform.js";
|
|
8
|
-
import { nodeCommand } from "./windows.js";
|
|
9
9
|
import { cpSync, existsSync, readFileSync, writeFileSync, mkdtempSync, rmSync } from "node:fs";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import os from "node:os";
|
|
12
|
-
import { readJson, writeJson } from "./
|
|
12
|
+
import { readJson, writeJson } from "./json.js";
|
|
13
13
|
import { run } from "./commands.js";
|
|
14
14
|
// Resolve relative to the installed CLI so packed consumers use the same starter.
|
|
15
15
|
const template = path.resolve(import.meta.dirname, "../templates/blank-typescript");
|
|
16
16
|
export async function refreshLocalPackages(root, manifest, selectedManager) {
|
|
17
17
|
const pkg = readJson(path.join(root, "package.json"));
|
|
18
18
|
// The template owns the tested compatibility matrix, not module inclusion.
|
|
19
|
-
const
|
|
19
|
+
const defaults = readJson(path.join(template, "package.json"));
|
|
20
|
+
const pins = { ...defaults.overrides, ...Object.fromEntries(Object.entries(defaults.dependencies)
|
|
21
|
+
.filter(([name]) => name.startsWith("expo-desktop"))) };
|
|
22
|
+
for (const [name, version] of Object.entries(pins)) {
|
|
23
|
+
if (pkg.dependencies?.[name])
|
|
24
|
+
pkg.dependencies[name] = version;
|
|
25
|
+
}
|
|
20
26
|
const manager = packageManager(root, selectedManager);
|
|
21
27
|
const overrides = { ...pins };
|
|
22
28
|
for (const [name, file] of Object.entries(readJson(manifest))) {
|
|
@@ -31,6 +37,9 @@ export async function refreshLocalPackages(root, manifest, selectedManager) {
|
|
|
31
37
|
upgradeManagedEntry(root);
|
|
32
38
|
}
|
|
33
39
|
export async function create(root, archiveManifest, platform = hostPlatform(), universal = false, example, selectedManager) {
|
|
40
|
+
if (!(universal || example) && !["macos", "windows"].includes(platform))
|
|
41
|
+
throw new Error("Use create --universal for mobile/web targets");
|
|
42
|
+
archiveManifest ??= creationManifest();
|
|
34
43
|
const manager = packageManager(process.cwd(), selectedManager);
|
|
35
44
|
await checkExpoDesktopNode(path.resolve(import.meta.dirname, ".."));
|
|
36
45
|
const variant = universal || example ? "universal" : platform === "macos" ? "blank-typescript" : "windows";
|
|
@@ -42,9 +51,12 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
|
|
|
42
51
|
try {
|
|
43
52
|
cpSync(source, temporary, { recursive: true });
|
|
44
53
|
const pkg = readJson(path.join(temporary, "package.json"));
|
|
45
|
-
const
|
|
54
|
+
const release = archiveManifest ? undefined : installedRelease();
|
|
55
|
+
const archives = packageSources(archiveManifest, release);
|
|
46
56
|
if (pkg.dependencies["@react-native-runtimes/core"] && !archives["@react-native-runtimes/core"])
|
|
47
57
|
throw new Error("This SDK lacks the patched Runtimes archive. Repack or install the complete SDK.");
|
|
58
|
+
if (release)
|
|
59
|
+
await materializeReleasePackages(release, temporary);
|
|
48
60
|
const overrides = {};
|
|
49
61
|
for (const [name, file] of Object.entries(archives)) {
|
|
50
62
|
overrides[name] = file;
|
|
@@ -58,10 +70,12 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
|
|
|
58
70
|
if (manager === "pnpm")
|
|
59
71
|
writeFileSync(path.join(temporary, ".npmrc"), "node-linker=hoisted\n");
|
|
60
72
|
await packArchive(temporary, templateFile);
|
|
73
|
+
if (release)
|
|
74
|
+
verifyMaterializedReleasePackages(release, temporary);
|
|
61
75
|
// The upstream CLI owns validation, extraction, app IDs, install, and Git setup.
|
|
62
76
|
// The templates' postinstall initializes spark configuration once.
|
|
63
77
|
const name = path.basename(root);
|
|
64
|
-
//
|
|
78
|
+
// Expo Desktop misreads npm 12's record-shaped pack metadata for a local tarball.
|
|
65
79
|
// Use the compatible npm executable for upstream extraction; the chosen manager installs.
|
|
66
80
|
const npmBin = path.join(import.meta.dirname, "npm-bin");
|
|
67
81
|
// Expo needs file: to distinguish Windows drive paths from npm package names.
|
|
@@ -75,11 +89,26 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
|
|
|
75
89
|
finally {
|
|
76
90
|
rmSync(temporary, { recursive: true, force: true });
|
|
77
91
|
}
|
|
92
|
+
if (!archiveManifest) {
|
|
93
|
+
const release = installedRelease();
|
|
94
|
+
if (release)
|
|
95
|
+
verifyMaterializedReleasePackages(release, root);
|
|
96
|
+
const ignoreFile = path.join(root, ".gitignore");
|
|
97
|
+
const ignore = existsSync(ignoreFile) ? readFileSync(ignoreFile, "utf8") : "";
|
|
98
|
+
if (!ignore.includes("!/spark-packages/**"))
|
|
99
|
+
writeFileSync(ignoreFile, `${ignore}${ignore.endsWith("\n") || !ignore ? "" : "\n"}\n# Spark verified release package inputs\n!/spark-packages/\n!/spark-packages/**\n`);
|
|
100
|
+
}
|
|
78
101
|
// Upstream can report success after an install failure. Require a usable CLI.
|
|
79
102
|
if (!existsSync(path.join(root, "node_modules/@legendapp/spark/package.json")))
|
|
80
103
|
throw new Error(`Dependency installation failed. Run ${manager} install in ${root} and retry.`);
|
|
81
|
-
if (example)
|
|
104
|
+
if (example) {
|
|
105
|
+
if (!archiveManifest) {
|
|
106
|
+
const release = installedRelease();
|
|
107
|
+
if (release)
|
|
108
|
+
verifyMaterializedReleasePackages(release, root);
|
|
109
|
+
}
|
|
82
110
|
await configureExample(root, example);
|
|
111
|
+
}
|
|
83
112
|
console.log(`Created ${root}.\n\n cd ${JSON.stringify(root)}\n ${manager} run ${platform}`);
|
|
84
113
|
}
|
|
85
114
|
export function upgradeManagedEntry(root) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { spawnProcess } from "./process.js";
|
|
2
2
|
import { readAppConfig } from "./project.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
4
|
import { createInterface } from "node:readline/promises";
|
|
6
5
|
import { run } from "./commands.js";
|
|
7
6
|
import { readJson, stateFile, writeJson } from "./project.js";
|
|
7
|
+
import { listNotaryProfiles } from "./notary-profiles.js";
|
|
8
|
+
import { isNetworkError } from "./errors.js";
|
|
8
9
|
export function parseIdentities(output) {
|
|
9
10
|
return [...output.matchAll(/\b([A-Fa-f0-9]{40})\s+"(Developer ID Application: [^"\n]+ \(([A-Z0-9]{10})\))"/g)]
|
|
10
11
|
.map((match) => ({ hash: match[1].toUpperCase(), name: match[2], teamId: match[3] }));
|
|
@@ -27,43 +28,103 @@ async function ask(question) {
|
|
|
27
28
|
input.close();
|
|
28
29
|
}
|
|
29
30
|
}
|
|
31
|
+
async function choose(question, defaultChoice, count) {
|
|
32
|
+
let choice;
|
|
33
|
+
while (choice === undefined) {
|
|
34
|
+
const answer = Number(await ask(`${question} [${defaultChoice}]: `) || String(defaultChoice));
|
|
35
|
+
if (Number.isInteger(answer) && answer >= 1 && answer <= count)
|
|
36
|
+
choice = answer;
|
|
37
|
+
else
|
|
38
|
+
console.error(`Choose a number from 1 to ${count}.`);
|
|
39
|
+
}
|
|
40
|
+
return choice;
|
|
41
|
+
}
|
|
30
42
|
export async function credentials(root, reset = false, execute = run) {
|
|
31
43
|
const file = stateFile(root, "signing.json");
|
|
32
44
|
const saved = !reset && existsSync(file) ? readJson(file) : {};
|
|
33
45
|
const config = readAppConfig(root).expo?.extra?.spark?.signing?.macos ?? {};
|
|
34
46
|
const keychain = process.env.SPARK_SIGNING_KEYCHAIN ?? saved.keychain;
|
|
35
|
-
const identity = process.env.SPARK_DEVELOPER_ID_APPLICATION ?? config.identity ?? saved.hash;
|
|
36
|
-
const teamId = process.env.SPARK_TEAM_ID ?? config.teamId ?? saved.teamId;
|
|
47
|
+
const identity = process.env.SPARK_DEVELOPER_ID_APPLICATION ?? config.identity ?? (process.stdin.isTTY ? undefined : saved.hash);
|
|
48
|
+
const teamId = process.env.SPARK_TEAM_ID ?? config.teamId ?? (process.stdin.isTTY ? undefined : saved.teamId);
|
|
37
49
|
const discovered = parseIdentities(await execute(root, ["security", "find-identity", "-v", "-p", "codesigning", ...(keychain ? [keychain] : [])], { capture: true }));
|
|
38
50
|
const matches = chooseIdentity(discovered, identity, teamId);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
const defaultChoice = Math.max(0, matches.findIndex(item => item.hash === saved.hash)) + 1;
|
|
52
|
+
let selected = matches[defaultChoice - 1];
|
|
53
|
+
if (process.stdin.isTTY) {
|
|
54
|
+
console.log("Available Developer ID signing certificates:");
|
|
43
55
|
console.log(matches.map((item, index) => `${index + 1}. ${item.name} [${item.hash}]`).join("\n"));
|
|
44
|
-
const choice =
|
|
45
|
-
if (!Number.isInteger(choice) || choice < 1 || choice > matches.length)
|
|
46
|
-
throw new Error("Invalid signing identity selection.");
|
|
56
|
+
const choice = await choose("Signing certificate", defaultChoice, matches.length);
|
|
47
57
|
selected = matches[choice - 1];
|
|
48
58
|
}
|
|
59
|
+
else if (matches.length > 1) {
|
|
60
|
+
throw new Error("Multiple signing identities are available. Set SPARK_DEVELOPER_ID_APPLICATION or run spark credentials interactively.");
|
|
61
|
+
}
|
|
49
62
|
let keychainProfile = process.env.SPARK_NOTARY_KEYCHAIN_PROFILE ?? saved.keychainProfile;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
let suggestedProfile = keychainProfile || `spark-${selected.teamId}`;
|
|
64
|
+
let result;
|
|
65
|
+
let validated = false;
|
|
66
|
+
let needsSelection = Boolean(process.stdin.isTTY);
|
|
67
|
+
while (!validated) {
|
|
68
|
+
if (needsSelection || !keychainProfile) {
|
|
69
|
+
if (!process.stdin.isTTY)
|
|
70
|
+
throw new Error("Notarization is not configured. Set SPARK_NOTARY_KEYCHAIN_PROFILE or run spark credentials interactively.");
|
|
71
|
+
const profiles = await listNotaryProfiles(root, keychain, execute);
|
|
72
|
+
const manualChoice = profiles.length + 1;
|
|
73
|
+
const createChoice = profiles.length + 2;
|
|
74
|
+
const rememberedChoice = profiles.indexOf(keychainProfile);
|
|
75
|
+
const defaultProfileChoice = rememberedChoice >= 0 ? rememberedChoice + 1 : profiles.length ? 1 : manualChoice;
|
|
76
|
+
console.log(`Available saved notarization Keychain profiles${keychain ? ` in ${keychain}` : ""}:`);
|
|
77
|
+
console.log(profiles.length ? profiles.map((profile, index) => `${index + 1}. ${profile}`).join("\n") : "No saved notarization profiles found.");
|
|
78
|
+
console.log(`${manualChoice}. Enter an existing profile name\n${createChoice}. Create a notarization Keychain profile`);
|
|
79
|
+
const choice = await choose("Notarization profile", defaultProfileChoice, createChoice);
|
|
80
|
+
if (Number.isInteger(choice) && choice >= 1 && choice <= profiles.length) {
|
|
81
|
+
keychainProfile = profiles[choice - 1];
|
|
82
|
+
}
|
|
83
|
+
else if (choice === manualChoice) {
|
|
84
|
+
keychainProfile = await ask("Existing notarization Keychain profile: ");
|
|
85
|
+
if (!keychainProfile)
|
|
86
|
+
console.error("Enter an existing profile name or select the create option.");
|
|
87
|
+
}
|
|
88
|
+
else if (choice === createChoice) {
|
|
89
|
+
keychainProfile = await ask(`New notarization Keychain profile [${suggestedProfile}]: `) || suggestedProfile;
|
|
90
|
+
console.log(`Apple’s tool will store and validate notarization credentials in Keychain as ${keychainProfile}. Secret input is handled by notarytool and is not recorded by spark.`);
|
|
91
|
+
const child = spawnProcess(["xcrun", "notarytool", "store-credentials", keychainProfile, ...(keychain ? ["--keychain", keychain] : [])], {
|
|
92
|
+
stdin: "inherit", stdout: "inherit", stderr: "inherit",
|
|
93
|
+
});
|
|
94
|
+
if (await child.exited)
|
|
95
|
+
throw new Error("Notarization credential setup failed. Run spark credentials to retry.");
|
|
96
|
+
}
|
|
97
|
+
needsSelection = !keychainProfile;
|
|
98
|
+
}
|
|
99
|
+
if (keychainProfile) {
|
|
100
|
+
result = { ...selected, keychainProfile, ...(keychain ? { keychain } : {}) };
|
|
101
|
+
// Validate the Keychain profile before native compilation or signing.
|
|
102
|
+
try {
|
|
103
|
+
await execute(root, ["xcrun", "notarytool", "history", ...notaryAuth(result), "--output-format", "json"], { capture: true });
|
|
104
|
+
validated = true;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (error instanceof Error && error.message.includes("No Keychain password item found for profile:")) {
|
|
108
|
+
const message = `Notarization Keychain profile ${JSON.stringify(keychainProfile)} was not found${keychain ? ` in ${JSON.stringify(keychain)}` : ""}. A signing certificate name does not create a notarization profile.`;
|
|
109
|
+
if (!process.stdin.isTTY)
|
|
110
|
+
throw new Error(`${message} Run spark credentials interactively to select an existing profile or explicitly create one.`, { cause: error });
|
|
111
|
+
console.error(message);
|
|
112
|
+
suggestedProfile = keychainProfile;
|
|
113
|
+
keychainProfile = undefined;
|
|
114
|
+
needsSelection = true;
|
|
115
|
+
}
|
|
116
|
+
else if (process.stdin.isTTY && isNetworkError(error)) {
|
|
117
|
+
console.error("Could not reach Apple’s notarization service. Check your internet connection or VPN.");
|
|
118
|
+
const retry = await ask("Retry validation with the same profile? [Y/n]: ");
|
|
119
|
+
if (retry && !/^y(?:es)?$/i.test(retry))
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
62
126
|
}
|
|
63
127
|
}
|
|
64
|
-
const result = { ...selected, keychainProfile, ...(keychain ? { keychain } : {}) };
|
|
65
|
-
// Validate the Keychain profile before native compilation or signing.
|
|
66
|
-
await execute(root, ["xcrun", "notarytool", "history", ...notaryAuth(result), "--output-format", "json"], { capture: true });
|
|
67
128
|
writeJson(file, result);
|
|
68
129
|
return result;
|
|
69
130
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import { supportedPlatforms } from "@legendapp/spark-desktop-config/config.cjs";
|
|
5
|
+
const packages = ["react", "react-native", "react-native-macos", "expo"];
|
|
6
|
+
// create/refreshLocalPackages use this starter's tested compatibility matrix too.
|
|
7
|
+
const defaults = JSON.parse(readFileSync(new URL("../templates/blank-typescript/package.json", import.meta.url), "utf8"));
|
|
8
|
+
export const expectedDependencyPins = Object.fromEntries(packages.map(name => [name, defaults.dependencies[name]]));
|
|
9
|
+
export function dependencyPinIssues(pkg, platforms) {
|
|
10
|
+
const required = packages.filter(name => name !== "react-native-macos" || platforms.includes("macos"));
|
|
11
|
+
const issues = [];
|
|
12
|
+
function check(name, value, where) {
|
|
13
|
+
// npm and pnpm permit an override to reference a direct dependency's spec.
|
|
14
|
+
const resolved = ["overrides", "pnpm"].includes(where[0]) && typeof value === "string" && value.startsWith("$")
|
|
15
|
+
? pkg.dependencies?.[value.slice(1)] ?? pkg.devDependencies?.[value.slice(1)] : value;
|
|
16
|
+
if (typeof resolved === "string" && /^(catalog|workspace):/.test(resolved)) {
|
|
17
|
+
console.log(`Skipping dependency pin check for ${where.join(" → ")}: ${resolved} is managed by the catalog or workspace.`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (resolved !== expectedDependencyPins[name])
|
|
21
|
+
issues.push({ package: name, found: typeof value === "string" ? value : JSON.stringify(value), expected: expectedDependencyPins[name], where });
|
|
22
|
+
}
|
|
23
|
+
for (const name of required) {
|
|
24
|
+
let present = false;
|
|
25
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
26
|
+
if (Object.hasOwn(pkg[section] ?? {}, name)) {
|
|
27
|
+
present = true;
|
|
28
|
+
check(name, pkg[section][name], [section, name]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!present)
|
|
32
|
+
issues.push({ package: name, found: "(missing)", expected: expectedDependencyPins[name], where: ["dependencies", name], missing: true });
|
|
33
|
+
}
|
|
34
|
+
function overrides(entries, where, parent) {
|
|
35
|
+
for (const [selector, value] of Object.entries(entries ?? {})) {
|
|
36
|
+
// Yarn paths/globs, version-qualified npm selectors and pnpm parent>child selectors.
|
|
37
|
+
// Comparators after @, whitespace or || belong to the version range.
|
|
38
|
+
const child = selector.split(/(?<![@\s|])>(?=[@a-zA-Z])/).at(-1);
|
|
39
|
+
const segments = child.split("/");
|
|
40
|
+
const name = selector === "." ? parent : segments.at(-2)?.startsWith("@") ? undefined : required.find(name => new RegExp(`^${name}(?:@[^/]*)?$`).test(segments.at(-1)));
|
|
41
|
+
const location = [...where, selector];
|
|
42
|
+
if (value && typeof value === "object" && !Array.isArray(value))
|
|
43
|
+
overrides(value, location, name);
|
|
44
|
+
else if (name)
|
|
45
|
+
check(name, value, location);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
overrides(pkg.overrides, ["overrides"]);
|
|
49
|
+
overrides(pkg.resolutions, ["resolutions"]);
|
|
50
|
+
overrides(pkg.pnpm?.overrides, ["pnpm", "overrides"]);
|
|
51
|
+
return issues;
|
|
52
|
+
}
|
|
53
|
+
export function printDependencyPins(issues) {
|
|
54
|
+
if (!issues.length) {
|
|
55
|
+
console.log("Dependency pins match Spark's expected versions.");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const rows = [["Package", "Found", "Expected", "Where"], ...issues.map(issue => [issue.package, issue.found, issue.expected, issue.where.join(" → ")])];
|
|
59
|
+
const widths = rows[0].map((_, column) => Math.max(...rows.map(row => row[column].length)));
|
|
60
|
+
for (const row of rows)
|
|
61
|
+
console.log(row.map((value, column) => value.padEnd(widths[column])).join(" ").trimEnd());
|
|
62
|
+
}
|
|
63
|
+
/** Edit only mismatched values and insert missing pins, preserving existing formatting. */
|
|
64
|
+
export function upgradeDependencyPins(root, dryRun = false) {
|
|
65
|
+
const file = path.join(root, "package.json");
|
|
66
|
+
let source = readFileSync(file, "utf8");
|
|
67
|
+
const pkg = JSON.parse(source);
|
|
68
|
+
const parsed = ts.parseJsonText(file, source);
|
|
69
|
+
const object = parsed.statements[0].expression;
|
|
70
|
+
function property(object, key) {
|
|
71
|
+
return object.properties.find(p => ts.isPropertyAssignment(p) && ts.isStringLiteral(p.name) && p.name.text === key);
|
|
72
|
+
}
|
|
73
|
+
function rejectDuplicates(node, where, nested = true) {
|
|
74
|
+
if (!node || !ts.isObjectLiteralExpression(node))
|
|
75
|
+
return;
|
|
76
|
+
const keys = new Set();
|
|
77
|
+
for (const entry of node.properties) {
|
|
78
|
+
if (!ts.isPropertyAssignment(entry) || !ts.isStringLiteral(entry.name))
|
|
79
|
+
continue;
|
|
80
|
+
const key = entry.name.text;
|
|
81
|
+
if (keys.has(key))
|
|
82
|
+
throw new Error(`package.json has duplicate key ${JSON.stringify(key)} in ${where.join(" → ") || "root"}. No files were changed.`);
|
|
83
|
+
keys.add(key);
|
|
84
|
+
if (nested)
|
|
85
|
+
rejectDuplicates(entry.initializer, [...where, key]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
rejectDuplicates(object, [], false);
|
|
89
|
+
for (const section of ["dependencies", "devDependencies", "overrides", "resolutions"])
|
|
90
|
+
rejectDuplicates(property(object, section)?.initializer, [section]);
|
|
91
|
+
const pnpm = property(object, "pnpm")?.initializer;
|
|
92
|
+
rejectDuplicates(pnpm, ["pnpm"], false);
|
|
93
|
+
if (pnpm && ts.isObjectLiteralExpression(pnpm))
|
|
94
|
+
rejectDuplicates(property(pnpm, "overrides")?.initializer, ["pnpm", "overrides"]);
|
|
95
|
+
const issues = dependencyPinIssues(pkg, supportedPlatforms(root));
|
|
96
|
+
if (!issues.length || dryRun)
|
|
97
|
+
return issues;
|
|
98
|
+
const edits = [];
|
|
99
|
+
const missing = issues.filter(issue => issue.missing);
|
|
100
|
+
if (missing.length) {
|
|
101
|
+
if ("dependencies" in pkg && (!pkg.dependencies || typeof pkg.dependencies !== "object" || Array.isArray(pkg.dependencies)))
|
|
102
|
+
throw new Error("package.json dependencies must be an object. No files were changed.");
|
|
103
|
+
const indent = source.match(/^[\t ]+(?=")/m)?.[0] ?? " ";
|
|
104
|
+
const newline = source.includes("\r\n") ? "\r\n" : "\n";
|
|
105
|
+
const dependencies = property(object, "dependencies")?.initializer;
|
|
106
|
+
const target = dependencies ?? object;
|
|
107
|
+
const entries = dependencies ? missing.map(issue => `${JSON.stringify(issue.package)}: ${JSON.stringify(issue.expected)}`)
|
|
108
|
+
: [`"dependencies": ${JSON.stringify(Object.fromEntries(missing.map(issue => [issue.package, issue.expected])), null, indent)}`];
|
|
109
|
+
const last = target.properties.at(-1);
|
|
110
|
+
const baseIndent = source.slice(0, target.getStart(parsed)).match(/(?:^|\n)([\t ]*)[^\n]*$/)[1];
|
|
111
|
+
const multiline = !last || source.slice(target.getStart(parsed), target.end).includes("\n");
|
|
112
|
+
const separator = multiline ? newline + baseIndent + indent : " ";
|
|
113
|
+
const text = entries.map(entry => entry.replaceAll("\n", newline + baseIndent + indent)).join("," + separator);
|
|
114
|
+
edits.push(last ? { start: last.end, end: last.end, text: "," + separator + text }
|
|
115
|
+
: { start: target.getStart(parsed) + 1, end: target.end - 1, text: separator + text + newline + baseIndent });
|
|
116
|
+
}
|
|
117
|
+
for (const issue of issues) {
|
|
118
|
+
if (issue.missing)
|
|
119
|
+
continue;
|
|
120
|
+
// Fixing the referenced direct dependency also fixes npm/pnpm's $ref override.
|
|
121
|
+
if (["overrides", "pnpm"].includes(issue.where[0]) && issue.found.startsWith("$") && issues.some(direct => ["dependencies", "devDependencies"].includes(direct.where[0]) && direct.package === issue.found.slice(1) && direct.expected === issue.expected))
|
|
122
|
+
continue;
|
|
123
|
+
let node = object;
|
|
124
|
+
for (const key of issue.where)
|
|
125
|
+
node = property(node, key).initializer;
|
|
126
|
+
edits.push({ start: node.getStart(parsed), end: node.end, text: JSON.stringify(issue.expected) });
|
|
127
|
+
}
|
|
128
|
+
for (const edit of edits.sort((a, b) => b.start - a.start))
|
|
129
|
+
source = source.slice(0, edit.start) + edit.text + source.slice(edit.end);
|
|
130
|
+
writeFileSync(file, source);
|
|
131
|
+
return issues;
|
|
132
|
+
}
|
|
@@ -4,7 +4,7 @@ import { prepareConfig, selectTarget, supportedPlatforms } from "@legendapp/spar
|
|
|
4
4
|
import { dev } from "./dev.js";
|
|
5
5
|
import { findProject } from "./local.js";
|
|
6
6
|
import { hostPlatform } from "./platform.js";
|
|
7
|
-
import { nodeCommand } from "./
|
|
7
|
+
import { nodeCommand } from "./process.js";
|
|
8
8
|
// Consume only spark options. Expo validates its flags, aliases and values.
|
|
9
9
|
export function devArguments(args) {
|
|
10
10
|
const spark = {};
|
|
@@ -17,7 +17,16 @@ export function devArguments(args) {
|
|
|
17
17
|
throw new Error("--no-open does not take a value");
|
|
18
18
|
spark.noOpen = true;
|
|
19
19
|
}
|
|
20
|
-
else if (
|
|
20
|
+
else if (key === "--app-arg") {
|
|
21
|
+
const value = inline.length ? inline.join("=") : args[++i];
|
|
22
|
+
if (value === undefined)
|
|
23
|
+
throw new Error("--app-arg needs a value");
|
|
24
|
+
(spark.appArgs ??= []).push(value);
|
|
25
|
+
}
|
|
26
|
+
else if (["--prebuilt-binary", "--go-binary"].includes(key)) {
|
|
27
|
+
throw new Error(`Unknown Spark option: ${key}; use --runner-binary`);
|
|
28
|
+
}
|
|
29
|
+
else if (["--project", "--platform", "--runner-binary"].includes(key)) {
|
|
21
30
|
const value = inline.length ? inline.join("=") : args[++i];
|
|
22
31
|
if (!value || value.startsWith("-"))
|
|
23
32
|
throw new Error(`${key} needs a value`);
|
|
@@ -44,7 +53,7 @@ export async function devCommand(args) {
|
|
|
44
53
|
const options = devArguments(args);
|
|
45
54
|
const start = path.resolve(options.project ?? process.cwd());
|
|
46
55
|
if (options.expo.includes("--help") || options.expo.includes("-h")) {
|
|
47
|
-
console.log("spark dev options:\n --project <directory> Application directory\n --platform <platform> Initial launch target; all declared platforms stay available\n --runner-binary <path> Register and use a Spark Runner\n --no-open Wait for a launch key (explicit Expo launch flags still apply)\n\nAll other options belong to expo start:\n");
|
|
56
|
+
console.log("spark dev options:\n --project <directory> Application directory\n --platform <platform> Initial launch target; all declared platforms stay available\n --runner-binary <path> Register and use a Spark Runner\n --app-arg <value> Pass a desktop launch argument (repeatable)\n --no-open Wait for a launch key (explicit Expo launch flags still apply)\n\nAll other options belong to expo start:\n");
|
|
48
57
|
const child = spawnProcess(nodeCommand(start, "expo", "expo", ["start", "--help"]), { cwd: start, stdin: "inherit", stdout: "inherit", stderr: "inherit" });
|
|
49
58
|
process.exitCode = await child.exited;
|
|
50
59
|
return;
|
|
@@ -58,7 +67,7 @@ export async function devCommand(args) {
|
|
|
58
67
|
if (!options.noOpen && ["ios", "android", "web"].includes(initial))
|
|
59
68
|
expo.push(`--${initial}`);
|
|
60
69
|
if (desktop) {
|
|
61
|
-
await dev(root, options.prebuiltBinary, expo, !!options.noOpen || initial !== desktop || (desktop === "windows" ? process.platform !== "win32" : process.platform !== "darwin"));
|
|
70
|
+
await dev(root, options.prebuiltBinary, expo, !!options.noOpen || initial !== desktop || (desktop === "windows" ? process.platform !== "win32" : process.platform !== "darwin"), options.appArgs);
|
|
62
71
|
}
|
|
63
72
|
else {
|
|
64
73
|
if (options.prebuiltBinary)
|
|
@@ -2,8 +2,8 @@ import { installedRelease } from "./release.js";
|
|
|
2
2
|
import { acquireRunner } from "./runner-install.js";
|
|
3
3
|
import { spawnProcess } from "./process.js";
|
|
4
4
|
import { windowsMetroPort, stopWindowsMetro } from "./windows-metro.js";
|
|
5
|
-
import { projectPlatform } from "./platform.js";
|
|
6
|
-
import { nodeCommand } from "./
|
|
5
|
+
import { architecture, projectPlatform } from "./platform.js";
|
|
6
|
+
import { nodeCommand } from "./process.js";
|
|
7
7
|
import { readAppConfig } from "./project.js";
|
|
8
8
|
import { existsSync, rmSync, watch } from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
@@ -13,14 +13,16 @@ 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 { assertNativePatchPreflight } from "./native-patch-preflight.js";
|
|
16
17
|
import { prepareConfig, dependencyStamp, goConfigurationIssues, incompatible, nativePackages, readJson, projectEnvironment, runtimeFor, stateFile, writeJson, } from "./project.js";
|
|
17
18
|
export async function launch(root, app, port, options = {}) {
|
|
19
|
+
assertNativePatchPreflight(root);
|
|
18
20
|
if (readRuntime(app)?.platform === "windows") {
|
|
19
21
|
if (process.platform !== "win32")
|
|
20
22
|
throw new Error("Launch the Windows runtime on Windows.");
|
|
21
23
|
const nativePort = await windowsMetroPort(root, port ?? 8081, options);
|
|
22
24
|
writeJson(stateFile(root, "windows-connection.json"), { port: nativePort, dev: options.dev ?? true });
|
|
23
|
-
return spawnProcess([path.join(app, "MyApp.exe")], { cwd: app, env: { ...process.env, ...projectEnvironment(root), SPARK_METRO_PORT: String(nativePort), SPARK_SESSION_FILE: stateFile(root, "windows-connection.json") }, stdout: "inherit", stderr: "inherit" });
|
|
25
|
+
return spawnProcess([path.join(app, "MyApp.exe"), ...(options.args ?? [])], { cwd: app, env: { ...process.env, ...projectEnvironment(root), SPARK_METRO_PORT: String(nativePort), SPARK_SESSION_FILE: stateFile(root, "windows-connection.json") }, stdout: "inherit", stderr: "inherit" });
|
|
24
26
|
}
|
|
25
27
|
const info = await run(root, [
|
|
26
28
|
"/usr/libexec/PlistBuddy",
|
|
@@ -34,7 +36,7 @@ export async function launch(root, app, port, options = {}) {
|
|
|
34
36
|
// Direct executable launch retains the exact product path and process ownership.
|
|
35
37
|
// RN's native packager websocket reads RCT_jsLocation independently of the
|
|
36
38
|
// JS bundle URL. The process argument domain avoids persistent preference edits.
|
|
37
|
-
return spawnProcess([executable, ...(port ? ["-RCT_jsLocation", `127.0.0.1:${port}`] : [])], {
|
|
39
|
+
return spawnProcess([executable, ...(port ? ["-RCT_jsLocation", `127.0.0.1:${port}`] : []), ...(options.args ?? [])], {
|
|
38
40
|
cwd: root,
|
|
39
41
|
env: {
|
|
40
42
|
...process.env,
|
|
@@ -49,7 +51,8 @@ export async function launch(root, app, port, options = {}) {
|
|
|
49
51
|
stderr: "inherit",
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
|
-
export async function dev(root, goApp, expoArgs = [], noOpen = false) {
|
|
54
|
+
export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs = []) {
|
|
55
|
+
assertNativePatchPreflight(root);
|
|
53
56
|
const platform = projectPlatform(root);
|
|
54
57
|
preparePatch(root);
|
|
55
58
|
let port;
|
|
@@ -201,7 +204,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false) {
|
|
|
201
204
|
}
|
|
202
205
|
issues.push(...goConfigurationIssues(readAppConfig(root)));
|
|
203
206
|
}
|
|
204
|
-
const view = sessionStatus(target, !!current, issues, appProcess?.exitCode === null, !!installedRelease()?.runners[`${platform}-${platform
|
|
207
|
+
const view = sessionStatus(target, !!current, issues, appProcess?.exitCode === null, !!installedRelease()?.runners[`${platform}-${architecture(platform)}`]);
|
|
205
208
|
if (view.compatible && current && appProcess?.exitCode === null &&
|
|
206
209
|
(launchedRuntime?.app !== current.app || launchedRuntime.fingerprint !== current.runtime.fingerprint)) {
|
|
207
210
|
// Discovery can find a different compatible binary after a native edit.
|
|
@@ -256,7 +259,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false) {
|
|
|
256
259
|
appProcess.kill();
|
|
257
260
|
await appProcess.exited;
|
|
258
261
|
}
|
|
259
|
-
appProcess = await launch(root, current.app, port, bundleOptions);
|
|
262
|
+
appProcess = await launch(root, current.app, port, { ...bundleOptions, args: appArgs });
|
|
260
263
|
if (closing) {
|
|
261
264
|
appProcess.kill();
|
|
262
265
|
return;
|
|
@@ -278,7 +281,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false) {
|
|
|
278
281
|
await appProcess.exited;
|
|
279
282
|
}
|
|
280
283
|
await open();
|
|
281
|
-
writeJson(settingsFile, { target, goApp });
|
|
284
|
+
writeJson(settingsFile, { ...(existsSync(settingsFile) ? readJson(settingsFile) : {}), target, goApp });
|
|
282
285
|
}
|
|
283
286
|
else if (name === "build") {
|
|
284
287
|
if ((await check()) || !canBuild)
|
|
@@ -294,7 +297,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false) {
|
|
|
294
297
|
target = "dev";
|
|
295
298
|
restartPending = true;
|
|
296
299
|
await open();
|
|
297
|
-
writeJson(settingsFile, { target, goApp });
|
|
300
|
+
writeJson(settingsFile, { ...(existsSync(settingsFile) ? readJson(settingsFile) : {}), target, goApp });
|
|
298
301
|
}
|
|
299
302
|
else if (name === "open")
|
|
300
303
|
await open();
|
|
@@ -401,7 +404,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false) {
|
|
|
401
404
|
finally {
|
|
402
405
|
busy = false;
|
|
403
406
|
}
|
|
404
|
-
writeJson(settingsFile, { target, goApp });
|
|
407
|
+
writeJson(settingsFile, { ...(existsSync(settingsFile) ? readJson(settingsFile) : {}), target, goApp });
|
|
405
408
|
await finished;
|
|
406
409
|
process.off("SIGINT", close);
|
|
407
410
|
process.off("SIGTERM", close);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// Command failures retain diagnostics without making callers parse their message.
|
|
4
|
+
export class CommandError extends Error {
|
|
5
|
+
argv;
|
|
6
|
+
code;
|
|
7
|
+
output;
|
|
8
|
+
log;
|
|
9
|
+
constructor(argv, code, output, log) {
|
|
10
|
+
super(`${argv.join(" ")} exited ${code}${log ? `. See ${log}` : ""}${output ? `\n${output.slice(-1800)}` : ""}`);
|
|
11
|
+
this.argv = argv;
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.output = output;
|
|
14
|
+
this.log = log;
|
|
15
|
+
this.name = "CommandError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function isNetworkError(error) {
|
|
19
|
+
const message = error instanceof CommandError ? error.output : error instanceof Error ? error.message : String(error);
|
|
20
|
+
return /NSURLErrorDomain Code=-(?:1001|1005|1009)|internet connection appears to be offline|\b(?:ENOTFOUND|EAI_AGAIN|ETIMEDOUT|ECONNRESET|ENETUNREACH)\b|could not resolve host|failed to connect|network is unreachable/i.test(message);
|
|
21
|
+
}
|
|
22
|
+
export function errorPresentation(error) {
|
|
23
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
24
|
+
const command = error instanceof CommandError ? error.argv.join(" ") : "";
|
|
25
|
+
const details = error instanceof CommandError ? error.output : message;
|
|
26
|
+
let summary = message.split("\n")[0] || "An unexpected error occurred.";
|
|
27
|
+
let next;
|
|
28
|
+
if (isNetworkError(error)) {
|
|
29
|
+
summary = command.includes("notarytool") ? "Could not reach Apple’s notarization service." : "Could not reach the remote service.";
|
|
30
|
+
next = "Check your internet connection or VPN, then retry the same command.";
|
|
31
|
+
}
|
|
32
|
+
else if ((/\b(?:E401|ENEEDAUTH)\b|401 Unauthorized/i.test(details) && /npm/.test(command || message)) || command === "npm whoami") {
|
|
33
|
+
summary = "npm authentication failed.";
|
|
34
|
+
next = "Run npm login, then retry the same release command.";
|
|
35
|
+
}
|
|
36
|
+
else if (command === "gh auth status" || /gh auth login/.test(details)) {
|
|
37
|
+
summary = "GitHub authentication failed.";
|
|
38
|
+
next = "Run gh auth login, then retry the same command.";
|
|
39
|
+
}
|
|
40
|
+
else if (/No Keychain password item found for profile:/.test(details)) {
|
|
41
|
+
summary = "The selected notarization Keychain profile was not found.";
|
|
42
|
+
next = "Run spark credentials to select an existing profile or explicitly create one.";
|
|
43
|
+
}
|
|
44
|
+
else if (/notarytool/.test(command) && /\b401\b|invalid credentials|authentication/i.test(details)) {
|
|
45
|
+
summary = "Apple rejected the notarization credentials.";
|
|
46
|
+
next = "Run spark credentials to select or explicitly create a valid Keychain profile.";
|
|
47
|
+
}
|
|
48
|
+
else if (error instanceof CommandError) {
|
|
49
|
+
const checks = { "bun run test": "Tests failed.", "bun run typecheck": "Type checking failed.", "bun install --frozen-lockfile": "Dependency installation failed." };
|
|
50
|
+
summary = checks[command] ?? `${command} failed (exit ${error.code}).`;
|
|
51
|
+
next = "Review the diagnostic log or output above, fix the problem, then retry the same command.";
|
|
52
|
+
}
|
|
53
|
+
return { summary, next };
|
|
54
|
+
}
|
|
55
|
+
function diagnostics(error, seen = new Set()) {
|
|
56
|
+
let result = String(error);
|
|
57
|
+
if (error instanceof Error && !seen.has(error)) {
|
|
58
|
+
seen.add(error);
|
|
59
|
+
result = error.stack ?? error.message;
|
|
60
|
+
if (error instanceof CommandError && error.output)
|
|
61
|
+
result += `\n\nCommand output:\n${error.output}`;
|
|
62
|
+
if (error.cause)
|
|
63
|
+
result += `\n\nCaused by:\n${diagnostics(error.cause, seen)}`;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
export function reportError(root, error, label = "Release") {
|
|
68
|
+
const { summary, next } = errorPresentation(error);
|
|
69
|
+
console.error(`\n${label} stopped: ${summary}`);
|
|
70
|
+
if (next)
|
|
71
|
+
console.error(`Next: ${next}`);
|
|
72
|
+
let log;
|
|
73
|
+
try {
|
|
74
|
+
const folder = path.join(root, ".spark/logs");
|
|
75
|
+
mkdirSync(folder, { recursive: true });
|
|
76
|
+
const destination = path.join(folder, `${Date.now()}-${crypto.randomUUID()}-error.log`);
|
|
77
|
+
writeFileSync(destination, diagnostics(error));
|
|
78
|
+
log = destination;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Reporting must still work when the original failure was a full disk.
|
|
82
|
+
if (error instanceof CommandError)
|
|
83
|
+
log = error.log;
|
|
84
|
+
}
|
|
85
|
+
if (log)
|
|
86
|
+
console.error(`Details: ${log}`);
|
|
87
|
+
else
|
|
88
|
+
console.error("Could not save diagnostics. Set SPARK_DEBUG=1 to print them.");
|
|
89
|
+
if (process.env.SPARK_DEBUG === "1")
|
|
90
|
+
console.error(diagnostics(error));
|
|
91
|
+
}
|
|
92
|
+
export async function releaseCommand(root, action) {
|
|
93
|
+
try {
|
|
94
|
+
await action();
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
reportError(root, error);
|
|
98
|
+
process.exitCode = 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { packageManager, managerCommand } from "./package-manager.js";
|
|
2
2
|
import { cpSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { readJson, writeJson } from "./
|
|
4
|
+
import { readJson, writeJson } from "./json.js";
|
|
5
5
|
import { run } from "./commands.js";
|
|
6
6
|
export const examples = ["document-editor", "notes-lite", "music-lite", "diff-lite"];
|
|
7
7
|
export async function configureExample(root, example) {
|
|
@@ -18,7 +18,7 @@ export async function configureExample(root, example) {
|
|
|
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"] = "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"] ?? "1.1.1";
|
|
22
22
|
if (example === "diff-lite")
|
|
23
23
|
pkg.dependencies["diff"] = "8.0.2";
|
|
24
24
|
writeJson(path.join(root, "package.json"), pkg);
|