@legendapp/spark 0.0.1 → 0.0.3
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/native.d.cts +6 -3
- package/package.json +36 -28
- package/patches/dependencies.json +252 -0
- package/patches/expo-application@55.0.19.patch +54 -0
- package/patches/expo-blur@55.0.18.patch +130 -0
- package/patches/expo-device@55.0.21.patch +149 -0
- package/patches/expo-font@55.0.8.patch +55 -0
- package/patches/expo-glass-effect@55.0.11.patch +304 -0
- package/patches/expo-haptics@55.0.18.patch +54 -0
- package/patches/expo-image-manipulator@55.0.21.patch +312 -0
- package/patches/expo-image-picker@55.0.24.patch +327 -0
- package/patches/expo-image@55.0.11.patch +158 -0
- package/patches/expo-keep-awake@55.0.8.patch +41 -0
- package/patches/expo-localization@55.0.19.patch +32 -0
- package/patches/expo-location@55.1.15.patch +190 -0
- package/patches/expo-symbols@55.0.9.patch +286 -0
- package/patches/expo-system-ui@55.0.22.patch +61 -0
- package/patches/expo-web-browser@55.0.20.patch +13 -0
- package/patches/react-native-app-logs@0.3.1.patch +20 -0
- package/patches/react-native-blurhash@2.1.3.patch +318 -0
- package/patches/react-native-community-blur@4.4.1.patch +415 -0
- package/patches/react-native-community-datetimepicker@9.2.2.patch +320 -0
- package/patches/react-native-enriched-markdown@1.1.1.patch +141 -10
- package/patches/react-native-fast-image@10.9.9.patch +131 -0
- package/patches/react-native-graph@1.4.0.patch +157 -0
- package/patches/react-native-keyboard-controller@1.22.9.patch +16 -0
- package/patches/react-native-masked-view-masked-view@0.3.2.patch +140 -0
- package/patches/react-native-mmkv@4.3.2.patch +40 -0
- package/patches/react-native-nitro-fetch@1.9.0.patch +130 -0
- package/patches/react-native-nitro-zxing@0.3.0.patch +13 -0
- package/patches/react-native-quick-base64@3.0.1.patch +13 -0
- package/patches/react-native-quick-crypto@1.1.9.patch +31 -0
- package/patches/react-native-release-profiler@0.4.5.patch +37 -0
- package/patches/react-native-screen-corner-radius@0.2.3.patch +13 -0
- package/patches/react-native-screens@4.23.0.patch +160 -0
- package/patches/react-native-svg@15.15.3.patch +31 -0
- package/patches/react-native-unistyles@3.6.0.patch +203 -0
- package/patches/react-native-worklets-core@1.6.3.patch +13 -0
- package/patches/react-navigation-native-stack@7.21.0.patch +16 -0
- package/patches/sentry-react-native@8.32.0.patch +76 -0
- package/skills/spark/UPGRADING.md +122 -3
- package/vendor/node_modules/@legendapp/spark-ai/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-audio/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-audio/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-auth-session/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +17 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +8 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +45 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +15 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-preload.cjs +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +26 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +3 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +20 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +10 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +28 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/release-runner-root.js +108 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +13 -13
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/watchman.js +12 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows-geometry.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +27 -25
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +35 -33
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +29 -27
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-clipboard/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-commands/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/accessibility-state.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +12 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +7 -6
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/fabric-lifecycle.cjs +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/keyboard-events.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/macos-host.cjs +39 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +73 -20
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +8 -6
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-scroll-view.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-alignment.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-input-alignment.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/text-input-accessibility.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-host/macos/AppDelegate.h +6 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/macos/Main.storyboard +684 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/macos/main.m +5 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +68 -17
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +9 -9
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +14 -5
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-html/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +110 -19
- package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +17 -3
- package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +6 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +12 -5
- package/vendor/node_modules/@legendapp/spark-system/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-tray/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +82 -18
- package/vendor/node_modules/@legendapp/spark-ui/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +11 -9
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +20 -10
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +15 -10
- package/vendor/node_modules/@legendapp/spark-ui/src/index.macos.tsx +1 -0
- package/vendor/node_modules/@legendapp/spark-updates/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-webview/package.json +11 -4
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
- package/camera.ts +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-audio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"*.podspec"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"react": "^19.
|
|
15
|
-
"react-native": "0.
|
|
16
|
-
"expo-audio": "
|
|
14
|
+
"react": "^19.2.0",
|
|
15
|
+
"react-native": "0.83.10",
|
|
16
|
+
"expo-audio": "55.0.18"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"expo-audio": {
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"private": true,
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
50
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./desktop";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-auth-session",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@legendapp/spark-desktop-links": "0.0.
|
|
11
|
+
"@legendapp/spark-desktop-links": "0.0.3",
|
|
12
12
|
"base64-js": "1.5.1",
|
|
13
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
13
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"react-native": "0.
|
|
17
|
-
"expo-web-browser": "~
|
|
18
|
-
"expo-crypto": "~
|
|
16
|
+
"react-native": "0.83.10",
|
|
17
|
+
"expo-web-browser": "~55.0.20",
|
|
18
|
+
"expo-crypto": "~55.0.19"
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {
|
|
21
21
|
"expo-web-browser": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.ts";
|
|
@@ -58,7 +58,7 @@ export async function addDesktop(root, manifestFile) {
|
|
|
58
58
|
const req = createRequire(pkgFile);
|
|
59
59
|
const installed = (name) => readJson(req.resolve(`${name}/package.json`)).version;
|
|
60
60
|
// Never upgrade the mobile baseline as a side effect of adding desktop.
|
|
61
|
-
for (const [name, version] of Object.entries({ expo: "
|
|
61
|
+
for (const [name, version] of Object.entries({ expo: "55.0.32", "react-native": "0.83.10", react: "19.2.0" })) {
|
|
62
62
|
let actual;
|
|
63
63
|
try {
|
|
64
64
|
actual = installed(name);
|
|
@@ -161,7 +161,7 @@ export async function addDesktop(root, manifestFile) {
|
|
|
161
161
|
}
|
|
162
162
|
// Resolve local transitive SDK packages without replacing any mobile pins.
|
|
163
163
|
const vendor = ["@react-native-runtimes/core", "react-native-nitro-modules", "@op-engineering/op-sqlite", "react-native-webview"];
|
|
164
|
-
const overrides = { ...Object.fromEntries(local.map(name => [name, dependencies[name]])), "@expo/cli": "
|
|
164
|
+
const overrides = { ...Object.fromEntries(local.map(name => [name, dependencies[name]])), "@expo/cli": "55.0.37",
|
|
165
165
|
"react-native-macos": defaults.overrides["react-native-macos"], "react-native-windows": defaults.overrides["react-native-windows"] };
|
|
166
166
|
for (const name of vendor) {
|
|
167
167
|
if (archives[name]) {
|
|
@@ -8,7 +8,7 @@ import { macOSXcodeArchitecture, projectPlatform } from "./platform.js";
|
|
|
8
8
|
import { isUniversal, isExpoProject } from "@legendapp/spark-desktop-config/config.cjs";
|
|
9
9
|
import { buildWindows } from "./windows.js";
|
|
10
10
|
import { copyHelpers } from "./helpers.js";
|
|
11
|
-
import { readAppConfig } from "./project.js";
|
|
11
|
+
import { lacksMacOSPod, readAppConfig } from "./project.js";
|
|
12
12
|
import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, readdirSync, rmSync, writeFileSync, openSync, closeSync, } from "node:fs";
|
|
13
13
|
import path from "node:path";
|
|
14
14
|
import { registerRuntime } from "./local.js";
|
|
@@ -134,6 +134,11 @@ export async function analyze(root) {
|
|
|
134
134
|
].join("\n"));
|
|
135
135
|
return result;
|
|
136
136
|
}
|
|
137
|
+
export function warnExampleBundleId(config) {
|
|
138
|
+
const id = config.expo?.macos?.bundleIdentifier;
|
|
139
|
+
if (id?.startsWith("com.example."))
|
|
140
|
+
console.warn(`Warning: the bundle ID is still the placeholder ${id}. Change bundleIdentifier in desktop.config.json to an ID you own before you distribute this app.`);
|
|
141
|
+
}
|
|
137
142
|
export async function build(root, mode, force = false) {
|
|
138
143
|
assertNativePatchPreflight(root);
|
|
139
144
|
const lock = stateFile(root, "build.lock");
|
|
@@ -176,6 +181,8 @@ async function buildUnlocked(root, mode, force) {
|
|
|
176
181
|
if (projectPlatform(root) === "windows")
|
|
177
182
|
return buildWindows(root, mode, force);
|
|
178
183
|
prepareConfig(root);
|
|
184
|
+
if (mode === "release")
|
|
185
|
+
warnExampleBundleId(readAppConfig(root));
|
|
179
186
|
if (mode === "go") {
|
|
180
187
|
const issues = goConfigurationIssues(readAppConfig(root));
|
|
181
188
|
if (issues.length)
|
|
@@ -194,12 +201,17 @@ async function buildUnlocked(root, mode, force) {
|
|
|
194
201
|
if (productionHash)
|
|
195
202
|
runtime.fingerprint = digest(runtime.fingerprint + productionHash);
|
|
196
203
|
const resultFile = stateFile(root, `${mode}-build.json`);
|
|
204
|
+
// RNW's CLI config probes for PowerShell when Expo autolinking loads it on macOS.
|
|
197
205
|
const excludedNames = [...new Set([
|
|
206
|
+
"react-native-windows",
|
|
198
207
|
...(readAppConfig(root).expo.autolinking?.exclude ?? []),
|
|
199
208
|
...chosen.excluded.map((p) => p.name),
|
|
200
209
|
])];
|
|
210
|
+
// Only the macOS Podfile drops these; iOS and Android builds reading the shared config keep them.
|
|
211
|
+
const withoutMacOSPod = chosen.included.filter(lacksMacOSPod).map((p) => p.name).filter((name) => !excludedNames.includes(name));
|
|
201
212
|
writeJson(stateFile(root, "native-selection.json"), {
|
|
202
|
-
excluded: excludedNames,
|
|
213
|
+
excluded: [...excludedNames, ...withoutMacOSPod],
|
|
214
|
+
withoutMacOSPod,
|
|
203
215
|
included: chosen.included.map((p) => ({ name: p.name, root: p.root })),
|
|
204
216
|
});
|
|
205
217
|
const rnConfig = path.join(root, "react-native.config.js");
|
|
@@ -209,7 +221,7 @@ async function buildUnlocked(root, mode, force) {
|
|
|
209
221
|
!(isExpoProject(root) && readFileSync(rnConfig, "utf8").includes("// spark: existing Expo project"))))
|
|
210
222
|
throw new Error("Existing react-native.config.js is not spark-managed. Compose the native selection explicitly before building.");
|
|
211
223
|
if (!isUniversal(root))
|
|
212
|
-
writeFileSync(rnConfig, `${marker}\nconst selection = require('./.spark/native-selection.json');\nmodule.exports = { dependencies: Object.fromEntries([\n...selection.included.map(p => [p.name, { root: p.root }]),\n...selection.excluded.map(name => [name, { platforms: { ios: null, macos: null, android: null } }])\n]) };\n`);
|
|
224
|
+
writeFileSync(rnConfig, `${marker}\nconst selection = require('./.spark/native-selection.json');\nmodule.exports = { dependencies: Object.fromEntries([\n...selection.included.map(p => [p.name, { root: p.root }]),\n...selection.excluded.map(name => [name, { platforms: selection.withoutMacOSPod.includes(name) ? { macos: null } : { ios: null, macos: null, android: null } }])\n]) };\n`);
|
|
213
225
|
const pkg = readJson(path.join(root, "package.json"));
|
|
214
226
|
if (!isUniversal(root)) {
|
|
215
227
|
pkg.expo ??= {};
|
|
@@ -259,7 +271,7 @@ async function buildUnlocked(root, mode, force) {
|
|
|
259
271
|
"--platform",
|
|
260
272
|
"macos",
|
|
261
273
|
"--template",
|
|
262
|
-
"expo-desktop-template-bare-minimum@
|
|
274
|
+
"expo-desktop-template-bare-minimum@55.83.10",
|
|
263
275
|
"--no-install",
|
|
264
276
|
// Template renaming is not idempotent (HelloWorld becomes
|
|
265
277
|
// LegendHelloWorld, then LegendLegendHelloWorld). Native projects
|
|
@@ -324,7 +336,7 @@ async function buildUnlocked(root, mode, force) {
|
|
|
324
336
|
"CODE_SIGNING_ALLOWED=NO",
|
|
325
337
|
...(mode === "release" ? macOSReleaseSettings : []),
|
|
326
338
|
"-jobs",
|
|
327
|
-
"8",
|
|
339
|
+
/^\d+$/.test(process.env.SPARK_XCODEBUILD_JOBS ?? "") ? process.env.SPARK_XCODEBUILD_JOBS : "8",
|
|
328
340
|
"build",
|
|
329
341
|
], {
|
|
330
342
|
// Absolute, like analysis: Metro resolves a relative entry from its server root.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { buildMode } from "./build-mode.js";
|
|
3
3
|
const options = {
|
|
4
|
-
example: { type: "string" }, "package-manager": { type: "string" },
|
|
4
|
+
example: { type: "string" }, "package-manager": { type: "string" }, "bundle-id": { type: "string" },
|
|
5
5
|
runtime: { type: "string", multiple: true }, universal: { type: "boolean" },
|
|
6
6
|
device: { type: "string" }, project: { type: "string" }, platform: { type: "string" },
|
|
7
7
|
packages: { type: "string" }, port: { type: "string" }, runner: { type: "boolean" },
|
|
@@ -9,7 +9,7 @@ const options = {
|
|
|
9
9
|
force: { type: "boolean" }, "dry-run": { type: "boolean" }, "submission-id": { type: "string" }, help: { type: "boolean", short: "h" },
|
|
10
10
|
};
|
|
11
11
|
const commands = {
|
|
12
|
-
create: { flags: ["example", "package-manager", "universal", "platform", "packages"], arguments: [1, 1] },
|
|
12
|
+
create: { flags: ["example", "package-manager", "bundle-id", "universal", "platform", "packages"], arguments: [1, 1] },
|
|
13
13
|
"add desktop": { flags: ["project", "packages"], arguments: [0, 0] },
|
|
14
14
|
"sdk export": { flags: ["packages", "runtime"], arguments: [1, 1] },
|
|
15
15
|
"sdk import": { flags: [], arguments: [1, 1] },
|
|
@@ -53,6 +53,8 @@ export function cliArguments(args) {
|
|
|
53
53
|
throw new Error("Port must be an integer between 1 and 65535.");
|
|
54
54
|
if (values["package-manager"] && !["npm", "pnpm", "yarn", "bun"].includes(values["package-manager"]))
|
|
55
55
|
throw new Error("Package manager must be npm, pnpm, yarn, or bun.");
|
|
56
|
+
if (values["bundle-id"] !== undefined && !/^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z0-9-]+)+$/.test(values["bundle-id"]))
|
|
57
|
+
throw new Error("Bundle ID must be reverse DNS, such as com.yourcompany.myapp.");
|
|
56
58
|
if (command === "build")
|
|
57
59
|
buildMode(values);
|
|
58
60
|
if (command === "sdk build-runner" && values.project && (values.packages || values["package-manager"]))
|
|
@@ -46,7 +46,9 @@ export async function refreshLocalPackages(root, manifest, selectedManager) {
|
|
|
46
46
|
await installWithEnrichedHtmlPins(root, manager);
|
|
47
47
|
upgradeManagedEntry(root);
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
/** A placeholder ID for new apps: lowercase letters, digits and hyphens, starting with a letter. */
|
|
50
|
+
export const exampleBundleId = (name) => `com.example.${name.toLowerCase().replace(/[^a-z0-9-]/g, "").replace(/^[^a-z]+/, "") || "app"}`;
|
|
51
|
+
export async function create(root, archiveManifest, platform = hostPlatform(), universal = false, example, selectedManager, bundleId) {
|
|
50
52
|
if (!(universal || example) && !["macos", "windows"].includes(platform))
|
|
51
53
|
throw new Error("Use create --universal for mobile/web targets");
|
|
52
54
|
archiveManifest ??= creationManifest();
|
|
@@ -73,7 +75,8 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
|
|
|
73
75
|
overrides[name] = file;
|
|
74
76
|
if (pkg.dependencies[name])
|
|
75
77
|
pkg.dependencies[name] = file;
|
|
76
|
-
|
|
78
|
+
// Spark itself comes from the registry as a bare version, which npm would read as a package name.
|
|
79
|
+
if (pkg.allowScripts?.[name] && file.startsWith("file:"))
|
|
77
80
|
pkg.allowScripts[file] = true;
|
|
78
81
|
}
|
|
79
82
|
applyOverrides(pkg, overrides, manager);
|
|
@@ -94,7 +97,7 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
|
|
|
94
97
|
// Expo needs file: to distinguish Windows drive paths from npm package names.
|
|
95
98
|
const child = spawnProcess(nodeCommand(path.resolve(import.meta.dirname, ".."), "expo-desktop", "expo-desktop", [
|
|
96
99
|
"create-app", root, "--template", `file:${templateFile}`, "--yes", "--no-agents-md",
|
|
97
|
-
"--display-name", name, "--rdns",
|
|
100
|
+
"--display-name", name, "--rdns", bundleId ?? exampleBundleId(name), ...(pnp ? ["--no-install"] : []),
|
|
98
101
|
]), { cwd: process.cwd(), env: { ...process.env, PATH: `${npmBin}${path.delimiter}${process.env.PATH ?? ""}`, npm_config_user_agent: `${manager}/spark`, CI: "1", ...(pnp ? { NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ""} ${pnpWriteFile}` } : {}), ...(manager === "yarn" ? { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" } : {}) }, stdout: "pipe", stderr: "inherit" });
|
|
99
102
|
// Spark owns the next steps; Expo's final block requires an unnecessary prebuild.
|
|
100
103
|
let projectReady = false;
|
|
@@ -141,7 +144,8 @@ export async function create(root, archiveManifest, platform = hostPlatform(), u
|
|
|
141
144
|
}
|
|
142
145
|
await configureExample(root, example);
|
|
143
146
|
}
|
|
144
|
-
|
|
147
|
+
const rename = bundleId || variant === "windows" ? "" : `\n\nBefore you ship, change bundleIdentifier in desktop.config.json from ${exampleBundleId(path.basename(root))} to an ID you own.`;
|
|
148
|
+
console.log(`Created ${root}.\n\n cd ${JSON.stringify(root)}\n ${manager} run ${platform}${rename}`);
|
|
145
149
|
}
|
|
146
150
|
export function upgradeManagedEntry(root) {
|
|
147
151
|
const oldMetro = `const { makeMetroConfig } = require("expo-desktop-metro-config");
|
|
@@ -1,12 +1,56 @@
|
|
|
1
1
|
import { overridePackageName } from "./package-manager.js";
|
|
2
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
4
5
|
import ts from "typescript";
|
|
5
6
|
import { supportedPlatforms } from "@legendapp/spark-desktop-config/config.cjs";
|
|
6
7
|
const packages = ["react", "react-native", "react-native-macos", "expo"];
|
|
7
8
|
// create/refreshLocalPackages use this starter's tested compatibility matrix too.
|
|
8
9
|
const defaults = JSON.parse(readFileSync(new URL("../templates/blank-typescript/package.json", import.meta.url), "utf8"));
|
|
9
10
|
export const expectedDependencyPins = Object.fromEntries(packages.map(name => [name, defaults.dependencies[name]]));
|
|
11
|
+
/** Optional feature backends belong to the app, even when Spark supplies the API. */
|
|
12
|
+
export function optionalBackendIssues(root) {
|
|
13
|
+
const backends = {
|
|
14
|
+
"@legendapp/spark/markdown": "react-native-enriched-markdown",
|
|
15
|
+
"@legendapp/spark/html": "react-native-enriched-html",
|
|
16
|
+
"@legendapp/spark/webview": "react-native-webview",
|
|
17
|
+
"@legendapp/spark/sqlite": "@op-engineering/op-sqlite",
|
|
18
|
+
};
|
|
19
|
+
const pkg = JSON.parse(readFileSync(path.join(root, "package.json"), "utf8"));
|
|
20
|
+
const dependencies = { ...pkg.dependencies, ...pkg.devDependencies, ...pkg.optionalDependencies };
|
|
21
|
+
const platforms = supportedPlatforms(root);
|
|
22
|
+
const req = createRequire(path.join(root, "package.json"));
|
|
23
|
+
const issues = new Map();
|
|
24
|
+
function visit(directory) {
|
|
25
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
26
|
+
const file = path.join(directory, entry.name);
|
|
27
|
+
if (entry.isDirectory() && !["node_modules", ".git", ".spark", "spark-packages", "build", "dist", "Pods"].includes(entry.name))
|
|
28
|
+
visit(file);
|
|
29
|
+
else if (entry.isFile() && /\.[cm]?[jt]sx?$/.test(file)) {
|
|
30
|
+
const suffix = /\.(ios|android|macos|windows|web|native|desktop)\.[cm]?[jt]sx?$/.exec(entry.name)?.[1];
|
|
31
|
+
if (suffix && !platforms.some(platform => suffix === platform || (suffix === "native" && platform !== "web") || (suffix === "desktop" && ["macos", "windows"].includes(platform))))
|
|
32
|
+
continue;
|
|
33
|
+
const source = readFileSync(file, "utf8");
|
|
34
|
+
if (!source.includes("@legendapp/spark/"))
|
|
35
|
+
continue;
|
|
36
|
+
for (const imported of ts.preProcessFile(source, true, true).importedFiles) {
|
|
37
|
+
const name = backends[imported.fileName];
|
|
38
|
+
if (!name || issues.has(name))
|
|
39
|
+
continue;
|
|
40
|
+
const installed = req.resolve.paths(name)?.some(base => existsSync(path.join(base, name, "package.json")));
|
|
41
|
+
if (!dependencies[name] || !installed)
|
|
42
|
+
issues.set(name, {
|
|
43
|
+
package: name, found: dependencies[name] ? "(not installed)" : "(not declared)",
|
|
44
|
+
expected: defaults.overrides[name], missing: true,
|
|
45
|
+
where: ["dependencies", name, `Install for ${imported.fileName} in ${path.relative(root, file)}${["react-native-webview", "@op-engineering/op-sqlite"].includes(name) ? ", keeping the SDK archive override (spark upgrade)" : ""}`],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
visit(root);
|
|
52
|
+
return [...issues.values()];
|
|
53
|
+
}
|
|
10
54
|
export function dependencyPinIssues(pkg, platforms, expected = expectedDependencyPins) {
|
|
11
55
|
const required = [...packages, ...(expected["@legendapp/spark"] ? ["@legendapp/spark"] : [])].filter(name => name !== "react-native-macos" || platforms.includes("macos"));
|
|
12
56
|
const checked = Object.keys(expected).filter(name => name !== "react-native-macos" || platforms.includes("macos"));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { installedRelease } from "./release.js";
|
|
2
|
+
import { createRuntimeInputCache } from "./runtime-input-cache.js";
|
|
2
3
|
import { acquireRunner } from "./runner-install.js";
|
|
3
4
|
import { spawnProcess } from "./process.js";
|
|
4
5
|
import { windowsMetroPort, stopWindowsMetro } from "./windows-metro.js";
|
|
@@ -13,6 +14,7 @@ import { createRequire } from "node:module";
|
|
|
13
14
|
const { preparePatch } = createRequire(import.meta.url)("./expo-dev-patch.cjs");
|
|
14
15
|
import { findGo, readRuntime, registerRuntime } from "./local.js";
|
|
15
16
|
import { sessionStatus } from "./session-status.js";
|
|
17
|
+
import { watchmanStalls } from "./watchman.js";
|
|
16
18
|
import { assertNativePatchPreflight } from "./native-patch-preflight.js";
|
|
17
19
|
import { prepareConfig, dependencyStamp, goConfigurationIssues, incompatible, nativePackages, readJson, projectEnvironment, runtimeFor, stateFile, writeJson, } from "./project.js";
|
|
18
20
|
export async function launch(root, app, port, options = {}) {
|
|
@@ -78,9 +80,11 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
78
80
|
let restartPending = false;
|
|
79
81
|
let reopenPending = false;
|
|
80
82
|
let closing = false;
|
|
83
|
+
const runtimeInputs = createRuntimeInputCache(root);
|
|
81
84
|
// Without --no-open the session opens the desktop app itself, so a missing Runner downloads without a keypress.
|
|
82
85
|
let autoOpen = !noOpen;
|
|
83
86
|
let metro;
|
|
87
|
+
let skipWatchman;
|
|
84
88
|
let finish;
|
|
85
89
|
const finished = new Promise((resolve) => {
|
|
86
90
|
finish = resolve;
|
|
@@ -95,6 +99,11 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
95
99
|
}
|
|
96
100
|
if (closing)
|
|
97
101
|
return;
|
|
102
|
+
if (skipWatchman === undefined) {
|
|
103
|
+
skipWatchman = await watchmanStalls(root);
|
|
104
|
+
if (skipWatchman)
|
|
105
|
+
console.warn("Watchman is not responding, so Metro will scan files without it this session. To fix Watchman, run: watchman watch-del-all && watchman shutdown-server");
|
|
106
|
+
}
|
|
98
107
|
let ready;
|
|
99
108
|
const started = new Promise(resolve => { ready = resolve; });
|
|
100
109
|
const [, expo, ...args] = nodeCommand(root, "expo", "expo", [
|
|
@@ -105,7 +114,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
105
114
|
const child = spawnProcess([
|
|
106
115
|
"node", "--require", path.join(import.meta.dirname, "expo-dev-preload.cjs"), expo, ...args,
|
|
107
116
|
], {
|
|
108
|
-
cwd: root, env: { ...process.env, SPARK_PLATFORM: platform, SPARK_DEV_SESSION: "1" },
|
|
117
|
+
cwd: root, env: { ...process.env, SPARK_PLATFORM: platform, SPARK_DEV_SESSION: "1", ...(skipWatchman ? { SPARK_METRO_NO_WATCHMAN: "1" } : {}) },
|
|
109
118
|
stdin: "inherit", stdout: "inherit", stderr: "inherit", serialization: "json",
|
|
110
119
|
ipc(message, sender) {
|
|
111
120
|
if (message?.type === "spark:ready") {
|
|
@@ -171,7 +180,8 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
171
180
|
}
|
|
172
181
|
}
|
|
173
182
|
async function inspectRuntime(report) {
|
|
174
|
-
const
|
|
183
|
+
const inputs = runtimeInputs.read();
|
|
184
|
+
const native = inputs.native;
|
|
175
185
|
current = undefined;
|
|
176
186
|
if (target === "go") {
|
|
177
187
|
if (explicitGo) {
|
|
@@ -193,7 +203,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
193
203
|
}
|
|
194
204
|
const issues = current ? incompatible(current.runtime, native, platform) : [];
|
|
195
205
|
if (current && target === "dev" &&
|
|
196
|
-
current.runtime.fingerprint !== runtimeFor(root, native, "dev").fingerprint)
|
|
206
|
+
current.runtime.fingerprint !== (inputs.development ??= runtimeFor(root, native, "dev")).fingerprint)
|
|
197
207
|
issues.push("Native configuration or host changed.");
|
|
198
208
|
if (target === "go") {
|
|
199
209
|
for (let i = 0; i < issues.length; i++) {
|
|
@@ -319,6 +329,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
319
329
|
if (closing)
|
|
320
330
|
return;
|
|
321
331
|
closing = true;
|
|
332
|
+
runtimeInputs.close();
|
|
322
333
|
clearInterval(timer);
|
|
323
334
|
clearTimeout(debounce);
|
|
324
335
|
watcher.close();
|
|
@@ -366,6 +377,7 @@ export async function dev(root, goApp, expoArgs = [], noOpen = false, appArgs =
|
|
|
366
377
|
try {
|
|
367
378
|
const next = dependencyStamp(root);
|
|
368
379
|
if (next !== stamp) {
|
|
380
|
+
runtimeInputs.invalidate();
|
|
369
381
|
restartPending = true;
|
|
370
382
|
stamp = next;
|
|
371
383
|
}
|
|
@@ -14,11 +14,11 @@ export async function configureExample(root, example) {
|
|
|
14
14
|
const desktop = suffixes.map(name => name === "desktop" ? "@legendapp/spark" : `@legendapp/spark-${name}`);
|
|
15
15
|
if (!pkg.dependencies["@legendapp/spark"])
|
|
16
16
|
throw new Error("SDK example requires @legendapp/spark");
|
|
17
|
-
Object.assign(pkg.dependencies, { "expo-document-picker": "
|
|
17
|
+
Object.assign(pkg.dependencies, { "expo-document-picker": "55.0.17", "expo-file-system": "55.0.26", "expo-sharing": "55.0.25" });
|
|
18
18
|
if (example !== "document-editor")
|
|
19
19
|
pkg.dependencies["@react-native-async-storage/async-storage"] = "2.2.0";
|
|
20
20
|
if (example === "music-lite")
|
|
21
|
-
pkg.dependencies["expo-audio"] = pkg.dependencies["expo-audio"] ?? pkg.overrides?.["expo-audio"] ?? pkg.resolutions?.["expo-audio"] ?? pkg.pnpm?.overrides?.["expo-audio"] ?? "
|
|
21
|
+
pkg.dependencies["expo-audio"] = pkg.dependencies["expo-audio"] ?? pkg.overrides?.["expo-audio"] ?? pkg.resolutions?.["expo-audio"] ?? pkg.pnpm?.overrides?.["expo-audio"] ?? "55.0.18";
|
|
22
22
|
if (example === "diff-lite")
|
|
23
23
|
pkg.dependencies["diff"] = "8.0.2";
|
|
24
24
|
writeJson(path.join(root, "package.json"), pkg);
|
|
@@ -3,18 +3,18 @@ const path = require('node:path');
|
|
|
3
3
|
const { createRequire } = require('node:module');
|
|
4
4
|
const { createHash } = require('node:crypto');
|
|
5
5
|
|
|
6
|
-
const VERSION = '
|
|
6
|
+
const VERSION = '55.0.37';
|
|
7
7
|
const extension = JSON.stringify(path.join(__dirname, 'expo-dev-extension.cjs'));
|
|
8
8
|
// Process-local patches: installed Expo files remain untouched. Verify the exact
|
|
9
9
|
// upstream inputs before starting, so an Expo upgrade cannot silently lose keys.
|
|
10
10
|
const patches = [
|
|
11
|
-
['interface/commandsTable.js', '
|
|
11
|
+
['interface/commandsTable.js', '6d809faa4721fd68e86af40372e6aef7f729902afc1a1484f66cade067db4792',
|
|
12
12
|
'function logCommandsTable(ui) {',
|
|
13
13
|
`function logCommandsTable(ui) {\n ui = require(${extension}).integrateCommands(ui);`],
|
|
14
14
|
['interface/startInterface.js', 'c8e55431b18a37e1ab2be22f068c980e9cc41ffc105ea7478e34fc11b91a22bd',
|
|
15
15
|
' const onPressAsync = async (key)=>{',
|
|
16
16
|
` const onPressAsync = async (key)=>{\n try {\n if (await require(${extension}).handleKey(key)) return;\n } catch (error) {\n _log.exception(error);\n return;\n }`],
|
|
17
|
-
['startAsync.js', '
|
|
17
|
+
['startAsync.js', 'fb52b3bd7962ad13c57c1a6e4050c9cc1420197186df7d0259d74ddbd79ae46b',
|
|
18
18
|
' await (0, _profile.profile)(devServerManager.startAsync.bind(devServerManager))(startOptions);',
|
|
19
19
|
// Dependency validation can wait on the network after Metro is listening.
|
|
20
20
|
// Report actual server readiness before those optional startup checks.
|
|
@@ -6,6 +6,9 @@ const { preparePatch } = require('./expo-dev-patch.cjs');
|
|
|
6
6
|
if (!process.env.SPARK_EXPO_PRELOADED) {
|
|
7
7
|
process.env.SPARK_EXPO_PRELOADED = '1';
|
|
8
8
|
if (!process.send) throw new Error('Start the Spark Expo integration through spark dev.');
|
|
9
|
+
// Expo 55 binds --localhost to "localhost", which Node resolves to ::1 first;
|
|
10
|
+
// desktop runtimes and Spark's Metro clients connect to 127.0.0.1.
|
|
11
|
+
require('node:dns').setDefaultResultOrder('ipv4first');
|
|
9
12
|
const patches = preparePatch(process.cwd());
|
|
10
13
|
const load = Module._extensions['.js'];
|
|
11
14
|
Module._extensions['.js'] = function(module, filename) {
|
|
@@ -3,11 +3,12 @@ import { publishCustomize } from "./customize-artifacts.js";
|
|
|
3
3
|
import { nodeCommand, spawnProcess } from "./process.js";
|
|
4
4
|
import { examples } from "./examples.js";
|
|
5
5
|
import { prepareGoProfile } from "./go-profile.js";
|
|
6
|
+
import { mirrorRunner, preservedBuildState, releaseRunnerRoot, releaseRunnerStaging, rewritePathRecords, syncTree } from "./release-runner-root.js";
|
|
6
7
|
import { exportSDK, importSDK } from "./sdk-transfer.js";
|
|
7
8
|
import { hostPlatform } from "./platform.js";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import { cliArguments } from "./cli-arguments.js";
|
|
10
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
11
12
|
import { prepareConfig, readConfig, isExpoProject } from "@legendapp/spark-desktop-config/config.cjs";
|
|
12
13
|
import { prepareWindows } from "./windows.js";
|
|
13
14
|
import { create, refreshLocalPackages } from "./create.js";
|
|
@@ -22,7 +23,7 @@ import { doctor, run } from "./commands.js";
|
|
|
22
23
|
import { findFramework, findProject, sparkHome, creationManifest, packageManifest, registerRuntime } from "./local.js";
|
|
23
24
|
import { readJson, stateFile, VERSION, writeJson } from "./project.js";
|
|
24
25
|
import { devCommand } from "./dev-command.js";
|
|
25
|
-
import { printDependencyPins, upgradeDependencyPins } from "./dependency-pins.js";
|
|
26
|
+
import { optionalBackendIssues, printDependencyPins, upgradeDependencyPins } from "./dependency-pins.js";
|
|
26
27
|
import { upgrade } from "./upgrade.js";
|
|
27
28
|
import { ensureProjectVersion } from "./project-version.js";
|
|
28
29
|
import { reportError } from "./errors.js";
|
|
@@ -96,7 +97,7 @@ Windows: dev and build --dev; production builds are not yet supported.
|
|
|
96
97
|
SDK transfer: sdk export <directory> [--runtime <Spark Runner directory>], sdk import <directory>
|
|
97
98
|
SDK maintainers: sdk pack, sdk package-runner, sdk build-runner [--platform windows], sdk register <runtime directory>
|
|
98
99
|
Targets: dev/build/prebuild --platform macos|windows|ios|android|web
|
|
99
|
-
Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime path>, create --packages <manifest>, create / sdk build-runner --package-manager npm|pnpm|yarn|bun`);
|
|
100
|
+
Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime path>, create --packages <manifest>, create --bundle-id <com.yourcompany.app>, create / sdk build-runner --package-manager npm|pnpm|yarn|bun`);
|
|
100
101
|
}
|
|
101
102
|
else
|
|
102
103
|
switch (command) {
|
|
@@ -109,7 +110,7 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
|
|
|
109
110
|
case "create": {
|
|
110
111
|
if (!positionals[1])
|
|
111
112
|
throw new Error("Usage: spark create MyApp");
|
|
112
|
-
await create(path.resolve(positionals[1]), creationManifest(values.packages), platform, !!values.universal || !!values.example, values.example, values["package-manager"]);
|
|
113
|
+
await create(path.resolve(positionals[1]), creationManifest(values.packages), platform, !!values.universal || !!values.example, values.example, values["package-manager"], values["bundle-id"]);
|
|
113
114
|
break;
|
|
114
115
|
}
|
|
115
116
|
case "sdk": {
|
|
@@ -153,14 +154,20 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
|
|
|
153
154
|
}
|
|
154
155
|
case "build-runner": {
|
|
155
156
|
let root;
|
|
157
|
+
// Release builds (set by scripts/release-runner.ts) build macOS in one fixed folder so
|
|
158
|
+
// Xcode stays incremental across versions; users' builds are unchanged.
|
|
159
|
+
const fixedRoot = !projectOption && platform === "macos" && process.env.SPARK_RELEASE_FIXED_RUNNER === "1";
|
|
160
|
+
const versionRoot = path.join(sparkHome(), "sdk-builds", VERSION, ...(platform === "windows" ? ["windows"] : []), "SparkRunner");
|
|
156
161
|
if (projectOption)
|
|
157
162
|
root = project();
|
|
158
163
|
else {
|
|
159
|
-
root = path.join(sparkHome(), "sdk-builds"
|
|
164
|
+
root = fixedRoot ? releaseRunnerStaging(path.join(sparkHome(), "sdk-builds")) : versionRoot;
|
|
165
|
+
if (fixedRoot)
|
|
166
|
+
rmSync(root, { recursive: true, force: true });
|
|
160
167
|
const manifest = packageManifest(values.packages);
|
|
161
168
|
const manager = values["package-manager"];
|
|
162
169
|
if (!existsSync(path.join(root, "package.json")))
|
|
163
|
-
await create(root, manifest, platform, false, undefined, manager);
|
|
170
|
+
await create(root, manifest, platform, false, undefined, manager, "so.legend.spark.prototype.sparkrunner");
|
|
164
171
|
else
|
|
165
172
|
await refreshLocalPackages(root, manifest, manager);
|
|
166
173
|
await prepareGoProfile(root, manifest, platform, manager);
|
|
@@ -168,8 +175,20 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
|
|
|
168
175
|
const config = readJson(configFile);
|
|
169
176
|
config.version = VERSION.split("-")[0];
|
|
170
177
|
writeJson(configFile, config);
|
|
178
|
+
if (fixedRoot) {
|
|
179
|
+
const fixed = releaseRunnerRoot(path.join(sparkHome(), "sdk-builds"));
|
|
180
|
+
const changed = syncTree(root, fixed, preservedBuildState);
|
|
181
|
+
rewritePathRecords(fixed, root, fixed);
|
|
182
|
+
console.log(`Release Runner: building in ${fixed} (${changed.length} project files changed since the last release build).`);
|
|
183
|
+
rmSync(root, { recursive: true, force: true });
|
|
184
|
+
root = fixed;
|
|
185
|
+
}
|
|
171
186
|
}
|
|
172
187
|
await build(root, "go", !!values.force);
|
|
188
|
+
if (fixedRoot) {
|
|
189
|
+
mirrorRunner(root, versionRoot);
|
|
190
|
+
console.log(`Release Runner copied to ${versionRoot}.`);
|
|
191
|
+
}
|
|
173
192
|
break;
|
|
174
193
|
}
|
|
175
194
|
default: throw new Error("SDK commands: spark sdk pack, spark sdk build-runner, spark sdk register <runtime directory>");
|
|
@@ -193,7 +212,7 @@ Overrides: --project <directory>, --port <number>, dev --runner-binary <runtime
|
|
|
193
212
|
if (root) {
|
|
194
213
|
ensureProjectVersion(root);
|
|
195
214
|
try {
|
|
196
|
-
const issues = [...upgradeDependencyPins(root, true), ...enrichedHtmlPinIssues(root)];
|
|
215
|
+
const issues = [...upgradeDependencyPins(root, true), ...enrichedHtmlPinIssues(root), ...optionalBackendIssues(root)];
|
|
197
216
|
printDependencyPins(issues);
|
|
198
217
|
if (issues.length) {
|
|
199
218
|
process.exitCode = 1;
|
|
@@ -27,7 +27,9 @@ function withDesktop(config, options = {}) {
|
|
|
27
27
|
for (const platform of ["macos", "windows"]) {
|
|
28
28
|
conditions[platform] = [...new Set([...(conditions[platform] || []), "react-native"])];
|
|
29
29
|
}
|
|
30
|
-
config = { ...config, resolver: { ...config.resolver, unstable_conditionsByPlatform: conditions
|
|
30
|
+
config = { ...config, resolver: { ...config.resolver, unstable_conditionsByPlatform: conditions,
|
|
31
|
+
// spark dev found Watchman unresponsive; crawl and watch with Node instead.
|
|
32
|
+
...(process.env.SPARK_METRO_NO_WATCHMAN === "1" ? { useWatchman: false } : {}) } };
|
|
31
33
|
const root = path.resolve(config.projectRoot || process.cwd());
|
|
32
34
|
// Keep the configured workspace root so lazy imports outside the app have
|
|
33
35
|
// valid URLs. Only the prebuilt host's fixed entry URLs are app-relative.
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
const fs = require('node:fs');
|
|
3
3
|
const path = require('node:path');
|
|
4
|
-
const
|
|
4
|
+
const { createRequire } = require('node:module');
|
|
5
5
|
const upgradeNotesPath = 'node_modules/@legendapp/spark/skills/spark/UPGRADING.md';
|
|
6
6
|
|
|
7
|
+
// `spark upgrade` loads these helpers from a downloaded release without its own
|
|
8
|
+
// node_modules, so dependencies may only resolve through the app's installed Spark.
|
|
9
|
+
/** @type {typeof import('./migration-helpers.cjs').resolveDependency} */
|
|
10
|
+
function resolveDependency(root, request) {
|
|
11
|
+
try {
|
|
12
|
+
return require.resolve(request);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (/** @type {NodeJS.ErrnoException} */ (error).code !== 'MODULE_NOT_FOUND') throw error;
|
|
15
|
+
const spark = createRequire(path.join(root, 'package.json')).resolve('@legendapp/spark/package.json');
|
|
16
|
+
return createRequire(spark).resolve(request);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
/** @type {typeof import('./migration-helpers.cjs').createMigrationContext} */
|
|
8
21
|
function createMigrationContext(root, version, changes, manualSteps) {
|
|
9
22
|
root = fs.realpathSync(root);
|
|
@@ -75,6 +88,8 @@ function createMigrationContext(root, version, changes, manualSteps) {
|
|
|
75
88
|
if (!manualSteps.some(step => step.version === version && step.message === message)) manualSteps.push({ version, message, notes });
|
|
76
89
|
},
|
|
77
90
|
replaceImport(from, to, names = {}) {
|
|
91
|
+
/** @type {typeof import('typescript')} */
|
|
92
|
+
const ts = require(resolveDependency(root, 'typescript'));
|
|
78
93
|
const files = new Set();
|
|
79
94
|
/** @param {string} directory */
|
|
80
95
|
function visit(directory) {
|
|
@@ -90,7 +105,7 @@ function createMigrationContext(root, version, changes, manualSteps) {
|
|
|
90
105
|
const content = context.readFile(file);
|
|
91
106
|
if (content === null || !content.includes(from)) continue;
|
|
92
107
|
const source = ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
|
|
93
|
-
if (/** @type {
|
|
108
|
+
if (/** @type {import('typescript').SourceFile & { parseDiagnostics: readonly import('typescript').Diagnostic[] }} */ (source).parseDiagnostics.length) {
|
|
94
109
|
context.manualStep(`Update imports from ${from} in ${file}; the source could not be parsed.`);
|
|
95
110
|
continue;
|
|
96
111
|
}
|
|
@@ -98,13 +113,13 @@ function createMigrationContext(root, version, changes, manualSteps) {
|
|
|
98
113
|
const edits = [];
|
|
99
114
|
// A locally bound require is not necessarily the CommonJS loader.
|
|
100
115
|
let shadowedRequire = false;
|
|
101
|
-
/** @param {
|
|
116
|
+
/** @param {import('typescript').Node} node */
|
|
102
117
|
function findRequireBinding(node) {
|
|
103
118
|
if ((ts.isVariableDeclaration(node) || ts.isParameter(node) || ts.isBindingElement(node) || ts.isFunctionDeclaration(node) || ts.isImportSpecifier(node)) && node.name && ts.isIdentifier(node.name) && node.name.text === 'require') shadowedRequire = true;
|
|
104
119
|
ts.forEachChild(node, findRequireBinding);
|
|
105
120
|
}
|
|
106
121
|
findRequireBinding(source);
|
|
107
|
-
/** @param {
|
|
122
|
+
/** @param {import('typescript').Node} node */
|
|
108
123
|
function inspect(node) {
|
|
109
124
|
if (ts.isStringLiteralLike(node) && node.text === from) {
|
|
110
125
|
const parent = node.parent;
|
|
@@ -149,4 +164,4 @@ function createMigrationContext(root, version, changes, manualSteps) {
|
|
|
149
164
|
return context;
|
|
150
165
|
}
|
|
151
166
|
|
|
152
|
-
module.exports = { createMigrationContext, upgradeNotesPath };
|
|
167
|
+
module.exports = { createMigrationContext, resolveDependency, upgradeNotesPath };
|
|
@@ -13,3 +13,4 @@ export interface MigrationContext {
|
|
|
13
13
|
}
|
|
14
14
|
export const upgradeNotesPath: string;
|
|
15
15
|
export function createMigrationContext(root: string, version: string, changes: Map<string, FileChange>, manualSteps: ManualStep[]): MigrationContext;
|
|
16
|
+
export function resolveDependency(root: string, request: string): string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fs = require('node:fs');
|
|
3
3
|
const path = require('node:path');
|
|
4
4
|
const { createRequire } = require('node:module');
|
|
5
|
-
const { createMigrationContext } = require('./migration-helpers.cjs');
|
|
5
|
+
const { createMigrationContext, resolveDependency } = require('./migration-helpers.cjs');
|
|
6
6
|
|
|
7
7
|
const skillPath = 'node_modules/@legendapp/spark/skills/spark/SKILL.md';
|
|
8
8
|
const start = '<!-- spark:skill:start -->';
|
|
@@ -95,6 +95,14 @@ const migrations = [
|
|
|
95
95
|
planPointers(context);
|
|
96
96
|
context.manualStep('If the app uses a custom runtime, rebuild it for next.4 native dependency patches; review production module selection and affected SidebarSplitView/Windows native flows.');
|
|
97
97
|
} },
|
|
98
|
+
{ version: '0.0.2', automatic: false, breaking: true, apply(context) {
|
|
99
|
+
context.manualStep('Spark now targets Expo SDK 55 and React Native 0.83 (React 19.2). spark upgrade moves the SDK-pinned Expo, React and React Native versions; align any other Expo modules your app depends on with SDK 55, review Expo SDK 55 and React Native 0.83 changes your app code relies on, then run spark doctor and rebuild custom runtimes.');
|
|
100
|
+
context.manualStep('Apps importing @legendapp/spark/markdown, /html, /webview or /sqlite must add the corresponding optional backend to app dependencies. See the linked upgrade notes for library names and version pins; run spark doctor and rebuild custom runtimes.');
|
|
101
|
+
context.manualStep('@legendapp/spark/camera was removed. Install the camera libraries in your app; see the linked upgrade notes for exact version pins. Import camera APIs directly from react-native-vision-camera, and NitroImage / Image from react-native-nitro-image. Spark still applies its version-pinned native patches automatically when your app depends on these libraries. Rebuild custom runtimes.');
|
|
102
|
+
} },
|
|
103
|
+
{ version: '0.0.3', automatic: false, breaking: true, apply(context) {
|
|
104
|
+
context.manualStep('Apps using the default macOS react-native-mmkv@4.3.2 store must plan data migration from ~/Documents/mmkv to ~/Library/Application Support/<Spark namespace>/mmkv before deployment. Existing files are not moved automatically and the old folder can contain other apps\' data. Back up the store, preserve IDs and encryption keys, and validate values and relaunch persistence; see the linked upgrade notes.');
|
|
105
|
+
} },
|
|
98
106
|
];
|
|
99
107
|
|
|
100
108
|
/** @param {string} root */
|
|
@@ -105,7 +113,7 @@ function installedSparkVersion(root) {
|
|
|
105
113
|
|
|
106
114
|
/** @type {typeof import('./migrations.cjs').planMigrations} */
|
|
107
115
|
function planMigrations(root, version, { automatic = false, fromVersion } = {}) {
|
|
108
|
-
const { compare, valid } = createRequire(
|
|
116
|
+
const { compare, valid } = createRequire(resolveDependency(root, 'npm/package.json'))('semver');
|
|
109
117
|
const file = path.join(root, '.spark/version');
|
|
110
118
|
const previous = fs.existsSync(file) ? fs.readFileSync(file, 'utf8').trim() : fromVersion;
|
|
111
119
|
if (!valid(version) || (previous !== undefined && (!valid(previous) || compare(previous, version) > 0))) {
|