@legendapp/spark 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native.d.cts +6 -3
- package/package.json +36 -28
- package/patches/react-native-enriched-markdown@1.1.1.patch +141 -10
- package/skills/spark/UPGRADING.md +88 -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 +11 -2
- 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 +8 -1
- 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 +7 -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 +16 -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/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/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 +4 -4
- 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 +47 -12
- 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,4 +1,4 @@
|
|
|
1
|
-
// Expo
|
|
1
|
+
// Expo's file scanner ignores Bun file: dependencies' symlinked podspecs.
|
|
2
2
|
const fs = require("node:fs");
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const before = ` return (await fs_1.default.promises.readdir(targetPath, { withFileTypes: true }))
|
|
@@ -22,7 +22,7 @@ function patchAutolinkingSource(source) {
|
|
|
22
22
|
function installAutolinkingPatch(root) {
|
|
23
23
|
const manifest = require.resolve("expo-modules-autolinking/package.json", { paths: [root] });
|
|
24
24
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
25
|
-
if (version !== "
|
|
25
|
+
if (version !== "55.0.28") throw new Error(`spark's autolinking patch requires expo-modules-autolinking@55.0.28; found ${version}.`);
|
|
26
26
|
const file = path.join(path.dirname(manifest), "build/utils.js");
|
|
27
27
|
const source = fs.readFileSync(file, "utf8");
|
|
28
28
|
const patched = patchAutolinkingSource(source);
|
|
@@ -32,8 +32,8 @@ function installAutolinkingPatch(root) {
|
|
|
32
32
|
fs.renameSync(temporary, file); // Do not modify package-cache hardlinks.
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
//
|
|
36
|
-
// react-native.config.js
|
|
35
|
+
// Packages such as Codex declare iOS for the desktop autolinker in their own
|
|
36
|
+
// react-native.config.js, so pass the native selection's exclusions to its CLI.
|
|
37
37
|
function excludeNativeModules(podfile, excluded) {
|
|
38
38
|
const call = /use_native_modules!\(config_command(?: \+ \[[^\]]*\])?\)/;
|
|
39
39
|
if (!call.test(podfile)) throw new Error("The macOS Podfile no longer calls use_native_modules!(config_command); review spark's native selection.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExpoConfig } from "
|
|
1
|
+
import type { ExpoConfig } from "expo/config";
|
|
2
2
|
import type { WindowConfiguration } from "@legendapp/spark-window-options";
|
|
3
3
|
export type { WindowConfiguration } from "@legendapp/spark-window-options";
|
|
4
4
|
export type SparkPlatform = "macos" | "windows" | "ios" | "android" | "web";
|
|
@@ -112,7 +112,7 @@ function patchSurface(source) {
|
|
|
112
112
|
function installSurfaceLifecyclePatch(root) {
|
|
113
113
|
const manifest = require.resolve("react-native-macos/package.json", { paths: [root] });
|
|
114
114
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
115
|
-
if (version !== "0.
|
|
115
|
+
if (version !== "0.83.0") throw new Error(`spark's Fabric lifecycle patch requires react-native-macos@0.83.0; found ${version}.`);
|
|
116
116
|
const file = path.join(path.dirname(manifest), "React/Fabric/Surface/RCTFabricSurface.mm");
|
|
117
117
|
const before = fs.readFileSync(file, "utf8"), after = patchSurface(before);
|
|
118
118
|
if (before !== after) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// RN macOS 0.
|
|
1
|
+
// RN macOS 0.83.0 legacy views embedded in Fabric can have no React tag.
|
|
2
2
|
const fs = require("node:fs");
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const replacements = {
|
|
@@ -28,7 +28,7 @@ function patchKeyboardSource(file, source) {
|
|
|
28
28
|
function installKeyboardEventsPatch(root) {
|
|
29
29
|
const manifest = require.resolve("react-native-macos/package.json", { paths: [root] });
|
|
30
30
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
31
|
-
if (version !== "0.
|
|
31
|
+
if (version !== "0.83.0") throw new Error(`spark's keyboard patch requires react-native-macos@0.83.0; found ${version}.`);
|
|
32
32
|
// Validate all targets before changing either file.
|
|
33
33
|
const changes = Object.keys(replacements).map(relative => {
|
|
34
34
|
const file = path.join(path.dirname(manifest), relative);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Expo Desktop 55's template hosts React Native in a SwiftUI App. Spark keeps its AppKit
|
|
2
|
+
// host: AppDelegate.mm replaces the Swift delegate, with main.m and the menu storyboard.
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const { IOSConfig } = require("@expo/config-plugins");
|
|
6
|
+
|
|
7
|
+
function installHostFiles(platformRoot) {
|
|
8
|
+
for (const swift of fs.readdirSync(platformRoot).map((name) => path.join(platformRoot, name, "AppDelegate.swift")).filter((file) => fs.existsSync(file))) {
|
|
9
|
+
for (const name of ["AppDelegate.h", "main.m", "Main.storyboard"])
|
|
10
|
+
fs.copyFileSync(require.resolve(`@legendapp/spark-desktop-host/macos/${name}`), path.join(path.dirname(swift), name));
|
|
11
|
+
// Upstream AppDelegate mods expect an Objective-C delegate; Spark's withAppDelegate owns its final contents.
|
|
12
|
+
fs.copyFileSync(require.resolve("@legendapp/spark-desktop-host/AppDelegate.mm"), path.join(path.dirname(swift), "AppDelegate.mm"));
|
|
13
|
+
fs.rmSync(swift);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function installHostProject(project) {
|
|
18
|
+
const objects = project.hash.project.objects, references = project.pbxFileReferenceSection(), builds = project.pbxBuildFileSection();
|
|
19
|
+
const key = Object.keys(references).find((id) => references[id].path === "AppDelegate.swift");
|
|
20
|
+
if (!key) return project;
|
|
21
|
+
Object.assign(references[key], { path: "AppDelegate.mm", lastKnownFileType: "sourcecode.cpp.objcpp" });
|
|
22
|
+
references[`${key}_comment`] = "AppDelegate.mm";
|
|
23
|
+
const build = Object.keys(builds).find((id) => builds[id].fileRef === key);
|
|
24
|
+
Object.assign(builds[build], { fileRef_comment: "AppDelegate.mm" });
|
|
25
|
+
builds[`${build}_comment`] = "AppDelegate.mm in Sources";
|
|
26
|
+
const group = Object.values(objects.PBXGroup).find((entry) => entry.children?.some((child) => child.value === key));
|
|
27
|
+
group.children.find((child) => child.value === key).comment = "AppDelegate.mm";
|
|
28
|
+
for (const phase of Object.values(objects.PBXSourcesBuildPhase)) for (const file of phase.files ?? []) if (file.value === build) file.comment = "AppDelegate.mm in Sources";
|
|
29
|
+
// The template also has an iOS target; add the host to the target that compiled the Swift delegate.
|
|
30
|
+
const targetUuid = Object.keys(objects.PBXNativeTarget).find((id) => objects.PBXNativeTarget[id].buildPhases?.some((phase) =>
|
|
31
|
+
objects.PBXSourcesBuildPhase[phase.value]?.files?.some((file) => file.value === build)));
|
|
32
|
+
IOSConfig.XcodeUtils.addBuildSourceFileToGroup({ filepath: "main.m", groupName: group.path.replaceAll('"', ""), project, targetUuid });
|
|
33
|
+
IOSConfig.XcodeUtils.addResourceFileToGroup({ filepath: "Main.storyboard", groupName: group.path.replaceAll('"', ""), project, isBuildFile: true, targetUuid });
|
|
34
|
+
const storyboard = Object.keys(references).find((id) => references[id].path === '"Main.storyboard"');
|
|
35
|
+
references[storyboard].lastKnownFileType = "file.storyboard";
|
|
36
|
+
return project;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { installHostFiles, installHostProject };
|
|
@@ -3,23 +3,33 @@ const fs = require("node:fs");
|
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const { createRequire } = require("node:module");
|
|
5
5
|
|
|
6
|
+
const optionalBackends = ["react-native-enriched-markdown", "react-native-enriched-html", "react-native-webview", "@op-engineering/op-sqlite"];
|
|
6
7
|
const cameraPackages = ["react-native-nitro-image", "react-native-vision-camera"];
|
|
7
8
|
|
|
8
|
-
function
|
|
9
|
+
function readManifest(file) {
|
|
10
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function prepareNativePatches(root, installed = []) {
|
|
9
14
|
const manifestFile = path.join(root, "package.json");
|
|
10
15
|
if (!fs.existsSync(manifestFile)) return {};
|
|
11
|
-
const app =
|
|
16
|
+
const app = readManifest(manifestFile);
|
|
12
17
|
if (app.name !== "@legendapp/spark" && !app.dependencies?.["@legendapp/spark"] && !app.devDependencies?.["@legendapp/spark"]) return {};
|
|
13
18
|
const appRequire = createRequire(manifestFile);
|
|
14
19
|
let sparkFile;
|
|
15
20
|
try { sparkFile = appRequire.resolve("@legendapp/spark/package.json"); }
|
|
16
21
|
catch (error) { if (error.code === "MODULE_NOT_FOUND") return {}; throw error; }
|
|
17
|
-
const spark =
|
|
22
|
+
const spark = readManifest(sparkFile);
|
|
18
23
|
const directory = path.dirname(sparkFile);
|
|
19
24
|
const patchesRoot = spark.spark?.bundledModuleRoot
|
|
20
25
|
? path.join(directory, "patches") : path.resolve(__dirname, "../../patches");
|
|
26
|
+
const dependencies = { ...spark.dependencies, ...app.dependencies, ...app.devDependencies };
|
|
27
|
+
for (const name of [...cameraPackages, ...optionalBackends]) {
|
|
28
|
+
if (app.optionalDependencies?.[name] || installed.some(pkg => pkg.name === name)) dependencies[name] = true;
|
|
29
|
+
}
|
|
30
|
+
const hasCamera = cameraPackages.some(name => dependencies[name]);
|
|
21
31
|
const pins = {};
|
|
22
|
-
if (
|
|
32
|
+
if (hasCamera) {
|
|
23
33
|
const cameraPins = JSON.parse(fs.readFileSync(path.join(patchesRoot, "camera/upstream.json"), "utf8"));
|
|
24
34
|
for (const name of ["react-native-nitro-modules", ...cameraPackages]) {
|
|
25
35
|
pins[name] = { ...cameraPins[name], patch: `camera/${name}.patch`,
|
|
@@ -28,30 +38,36 @@ function prepareNativePatches(root) {
|
|
|
28
38
|
}
|
|
29
39
|
const integrations = path.join(patchesRoot, "dependencies.json");
|
|
30
40
|
if (fs.existsSync(integrations)) Object.assign(pins, JSON.parse(fs.readFileSync(integrations, "utf8")));
|
|
31
|
-
const active = Object.keys(pins).filter(name =>
|
|
41
|
+
const active = Object.keys(pins).filter(name => dependencies[name] ||
|
|
42
|
+
(hasCamera && name === "react-native-nitro-modules") ||
|
|
43
|
+
(dependencies["react-native-vision-camera"] && name === "react-native-nitro-image"));
|
|
32
44
|
if (!active.length) return {};
|
|
33
45
|
const { parsePatch, applyPatch, reversePatch } = require("diff");
|
|
34
|
-
const queue = [appRequire, createRequire(sparkFile)];
|
|
46
|
+
const queue = [appRequire, createRequire(sparkFile)].map(req => ({ req, optionalOnly: false }));
|
|
47
|
+
if (hasCamera || optionalBackends.some(name => dependencies[name])) queue.push(...installed.map(pkg => ({ req: createRequire(path.join(pkg.root, "package.json")), optionalOnly: true })));
|
|
35
48
|
const visited = new Set();
|
|
36
49
|
const packages = {};
|
|
37
|
-
for (const req of queue) {
|
|
50
|
+
for (const { req, optionalOnly } of queue) {
|
|
38
51
|
for (const name of active) {
|
|
52
|
+
if (optionalOnly && name !== "react-native-nitro-modules" && !cameraPackages.includes(name) && !optionalBackends.includes(name)) continue;
|
|
39
53
|
let file;
|
|
40
54
|
try { file = req.resolve(`${name}/package.json`); }
|
|
41
55
|
catch (error) {
|
|
42
56
|
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
43
|
-
|
|
44
|
-
throw new Error(`Spark needs ${name}@${pins[name].version}. Finish installing dependencies before native preparation.`);
|
|
57
|
+
continue;
|
|
45
58
|
}
|
|
46
59
|
if (!fs.existsSync(file)) throw new Error(`Spark needs ${name}@${pins[name].version}. Finish installing dependencies before native preparation.`);
|
|
47
60
|
const packageRoot = fs.realpathSync(path.dirname(file));
|
|
48
61
|
if (visited.has(packageRoot)) continue;
|
|
49
62
|
visited.add(packageRoot);
|
|
50
63
|
packages[name] = { root: packageRoot };
|
|
51
|
-
queue.push(createRequire(file));
|
|
64
|
+
queue.push({ req: createRequire(file), optionalOnly });
|
|
52
65
|
const manifest = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
53
66
|
const pin = pins[name];
|
|
54
|
-
if (manifest.version !== pin.version)
|
|
67
|
+
if (manifest.version !== pin.version) {
|
|
68
|
+
const owner = readManifest(req.resolve("./package.json"));
|
|
69
|
+
throw new Error(`Spark needs ${name}@${pin.version}; found ${manifest.version} at ${packageRoot}, required by ${owner.name ?? root}. Add an override/resolution for the pinned version.`);
|
|
70
|
+
}
|
|
55
71
|
const bytes = fs.readFileSync(path.join(patchesRoot, pin.patch));
|
|
56
72
|
const writes = [];
|
|
57
73
|
for (const patch of parsePatch(bytes.toString("utf8"))) {
|
|
@@ -93,6 +109,8 @@ function prepareNativePatches(root) {
|
|
|
93
109
|
}
|
|
94
110
|
patched.spark.dependencyPatch = { schema: 1, version: pin.version,
|
|
95
111
|
patchHash: createHash("sha256").update(bytes).digest("hex"), upstreamIntegrity: pin.integrity };
|
|
112
|
+
const pkg = installed.find(pkg => pkg.root === packageRoot);
|
|
113
|
+
if (pkg) pkg.json = patched;
|
|
96
114
|
const serialized = JSON.stringify(patched, null, 2) + "\n";
|
|
97
115
|
if (fs.readFileSync(file, "utf8") !== serialized) {
|
|
98
116
|
const temporary = `${file}.spark-${process.pid}.tmp`;
|
|
@@ -100,7 +118,24 @@ function prepareNativePatches(root) {
|
|
|
100
118
|
}
|
|
101
119
|
}
|
|
102
120
|
}
|
|
121
|
+
for (const name of active) {
|
|
122
|
+
if (!packages[name]) throw new Error(`Spark needs ${name}@${pins[name].version}. Finish installing dependencies before native preparation.`);
|
|
123
|
+
}
|
|
103
124
|
return packages;
|
|
104
125
|
}
|
|
105
126
|
|
|
106
|
-
|
|
127
|
+
// RN macOS 0.83 declares UIApplication itself, so Expo's guarded duplicate breaks the build.
|
|
128
|
+
// The 55 template's Podfile removes it during pod install, after Spark fingerprints
|
|
129
|
+
// expo-modules-core; remove it first so the native fingerprint stays stable.
|
|
130
|
+
const applicationAlias = "#ifndef UIApplication\n@compatibility_alias UIApplication NSApplication;\n#endif";
|
|
131
|
+
function removeExpoApplicationAlias(rn, expo) {
|
|
132
|
+
const file = path.join(expo, "ios/Platform/Platform.h"), compat = path.join(rn, "ReactApple/Libraries/RCTUIKit/RCTUIKitCompat.h");
|
|
133
|
+
if (!fs.existsSync(file) || !fs.existsSync(compat) || !fs.readFileSync(compat, "utf8").includes("@compatibility_alias UIApplication NSApplication;")) return;
|
|
134
|
+
const source = fs.readFileSync(file, "utf8");
|
|
135
|
+
if (!source.includes(applicationAlias)) return;
|
|
136
|
+
const temporary = `${file}.spark-${process.pid}.tmp`;
|
|
137
|
+
fs.writeFileSync(temporary, source.replace(applicationAlias, ""));
|
|
138
|
+
fs.renameSync(temporary, file); // Preserve package-manager cache hardlinks.
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
module.exports = { prepareNativePatches, removeExpoApplicationAlias };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export function prepareNativePatches(root: string): Record<string, { root: string }>;
|
|
1
|
+
export function prepareNativePatches(root: string, installed?: { name: string; root: string; json: any }[]): Record<string, { root: string }>;
|
|
2
|
+
export function removeExpoApplicationAlias(reactNativeMacOSRoot: string, expoModulesCoreRoot: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "app.plugin.cjs",
|
|
6
6
|
"files": [
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"expo-desktop-config-plugins": "1.3.2",
|
|
14
|
-
"@legendapp/spark-desktop-host": "0.0.
|
|
15
|
-
"@legendapp/spark-window-options": "0.0.
|
|
16
|
-
"@expo/config-plugins": "
|
|
17
|
-
"@expo/config-types": "54.0.10",
|
|
14
|
+
"@legendapp/spark-desktop-host": "0.0.2",
|
|
15
|
+
"@legendapp/spark-window-options": "0.0.2",
|
|
16
|
+
"@expo/config-plugins": "55.0.12",
|
|
18
17
|
"diff": "8.0.4"
|
|
19
18
|
},
|
|
20
|
-
"private": true
|
|
19
|
+
"private": true,
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@expo/config-types": "55.0.6"
|
|
22
|
+
}
|
|
21
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// RN macOS 0.
|
|
1
|
+
// RN macOS 0.83.0 Fabric mirrors ScrollView content in RTL: it flips the content container with a
|
|
2
2
|
// layer transform, but the scroll view flip that cancels it on iOS is iOS-only. AppKit ignores layer
|
|
3
3
|
// transforms when it scrolls NSClipView and routes events, so macOS flips nothing (Yoga already
|
|
4
4
|
// places RTL content), reports offsets unconverted, and anchors RTL content to its right end.
|
|
@@ -132,7 +132,7 @@ function patchScrollViewSource(source) {
|
|
|
132
132
|
function installRTLScrollViewPatch(root) {
|
|
133
133
|
const manifest = require.resolve("react-native-macos/package.json", { paths: [root] });
|
|
134
134
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
135
|
-
if (version !== "0.
|
|
135
|
+
if (version !== "0.83.0") throw new Error(`spark's RTL scroll patch requires react-native-macos@0.83.0; found ${version}.`);
|
|
136
136
|
const target = path.join(path.dirname(manifest), file);
|
|
137
137
|
const before = fs.readFileSync(target, "utf8"), after = patchScrollViewSource(before);
|
|
138
138
|
if (before !== after) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// RN macOS 0.
|
|
1
|
+
// RN macOS 0.83.0 Fabric leaves natural ("auto" or unset) textAlign as NSTextAlignmentNatural. TextKit resolves that
|
|
2
2
|
// from the user's language, not the Yoga layout direction, so text in an RTL subtree of an LTR-localized app aligns
|
|
3
3
|
// left. The patch resolves natural alignment from the layout direction. "left" and "right" keep the upstream
|
|
4
4
|
// behavior, shared with iOS: they swap in RTL.
|
|
@@ -48,7 +48,7 @@ function patchTextAlignmentSource(source) {
|
|
|
48
48
|
function installRTLTextAlignmentPatch(root) {
|
|
49
49
|
const manifest = require.resolve("react-native-macos/package.json", { paths: [root] });
|
|
50
50
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
51
|
-
if (version !== "0.
|
|
51
|
+
if (version !== "0.83.0") throw new Error(`spark's RTL text alignment patch requires react-native-macos@0.83.0; found ${version}.`);
|
|
52
52
|
const target = path.join(path.dirname(manifest), file);
|
|
53
53
|
const source = fs.readFileSync(target, "utf8"), patched = patchTextAlignmentSource(source);
|
|
54
54
|
if (source !== patched) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// RN macOS 0.
|
|
1
|
+
// RN macOS 0.83.0 Fabric gives a TextInput no layout direction: its text attributes have none, and the iOS
|
|
2
2
|
// semanticContentAttribute that makes UIKit's natural alignment follow it isn't set on macOS. TextKit resolves
|
|
3
3
|
// NSTextAlignmentNatural from the user's language, so in an RTL layout a TextInput with natural ("auto" or unset)
|
|
4
4
|
// textAlign draws its text and placeholder from the left. The patch aligns them to the leading edge of the input's
|
|
@@ -100,7 +100,7 @@ function patchTextInputAlignmentSource(source) {
|
|
|
100
100
|
function installRTLTextInputAlignmentPatch(root) {
|
|
101
101
|
const manifest = require.resolve("react-native-macos/package.json", { paths: [root] });
|
|
102
102
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
103
|
-
if (version !== "0.
|
|
103
|
+
if (version !== "0.83.0") throw new Error(`spark's RTL TextInput alignment patch requires react-native-macos@0.83.0; found ${version}.`);
|
|
104
104
|
const target = path.join(path.dirname(manifest), file);
|
|
105
105
|
const source = fs.readFileSync(target, "utf8"), patched = patchTextInputAlignmentSource(source);
|
|
106
106
|
if (source !== patched) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// RN macOS 0.
|
|
1
|
+
// RN macOS 0.83.0 Fabric sets a TextInput's accessibilityLabel on its accessibilityElement, the backed text input view.
|
|
2
2
|
// A multiline input's backed view is RCTWrappedTextView, a plain view around a scroll view, while the NSTextView inside
|
|
3
3
|
// it is the accessibility element, so VoiceOver announces a labelled multiline input without its label. The patch
|
|
4
4
|
// keeps the label on that text view.
|
|
@@ -35,7 +35,7 @@ function patchTextInputAccessibilitySource(source) {
|
|
|
35
35
|
function installTextInputAccessibilityPatch(root) {
|
|
36
36
|
const manifest = require.resolve("react-native-macos/package.json", { paths: [root] });
|
|
37
37
|
const version = JSON.parse(fs.readFileSync(manifest, "utf8")).version;
|
|
38
|
-
if (version !== "0.
|
|
38
|
+
if (version !== "0.83.0") throw new Error(`spark's TextInput accessibility patch requires react-native-macos@0.83.0; found ${version}.`);
|
|
39
39
|
const target = path.join(path.dirname(manifest), file);
|
|
40
40
|
const source = fs.readFileSync(target, "utf8"), patched = patchTextInputAccessibilitySource(source);
|
|
41
41
|
if (source !== patched) {
|