Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: preserve Expo and web React compatibility under Bun
Richie McIlroya9baec461875
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex a67645a2d..40bb8c4de 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -90,6 +90,16 @@ jobs:- name: Test workspace toolingrun: node --test scripts/bun-scripts.test.mjs scripts/check-tauri-plugin-versions.test.mjs apps/web-cluster/scripts/deploy.test.mjs+ - name: Test web React compatibility+ run: >-+ bun run --cwd apps/web test+ __tests__/unit/embed-video-playback-chrome.test.ts+ __tests__/unit/homepage-demo-accessibility.test.ts+ __tests__/unit/linkified-text.test.ts+ __tests__/unit/signed-baa-card.test.ts+ __tests__/unit/summary-editor.test.ts+ __tests__/unit/sso-login-pages.test.ts+- name: Typecheckrun: bun run typecheckdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex f65b26062..4237220a0 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -33,6 +33,8 @@ Before anything else, make sure you have the following installed:### General Setup+Keep the root `react` and `react-dom` development dependencies aligned with `apps/mobile`. They keep Expo native dependencies deduplicated under Bun’s hoisted linker, while the web app retains its separately resolved React version.+Run `bun install`, then run `bun run env-setup` to generate a `.env` file configured for your environment.It will ask you which apps you intend to run, whether you'd like to use Docker to run S3 (MinIO) and MySQL locally,and allow you to provide overrides as needed.diff --git a/apps/mobile/eas.json b/apps/mobile/eas.jsonindex f9479a145..eb974ea1b 100644--- a/apps/mobile/eas.json+++ b/apps/mobile/eas.json@@ -14,19 +14,22 @@},"ios": {"simulator": true- }+ },+ "bun": "1.4.0"},"preview": {"channel": "preview","distribution": "internal",- "environment": "preview"+ "environment": "preview",+ "bun": "1.4.0"},"production": {"autoIncrement": true,"channel": "production","credentialsSource": "remote","distribution": "store",- "environment": "production"+ "environment": "production",+ "bun": "1.4.0"}},"submit": {diff --git a/apps/web-cluster/scripts/deploy.mjs b/apps/web-cluster/scripts/deploy.mjsindex ac336146b..34f9af4ef 100644--- a/apps/web-cluster/scripts/deploy.mjs+++ b/apps/web-cluster/scripts/deploy.mjs@@ -1,4 +1,5 @@import assert from "node:assert/strict";+import { existsSync } from "node:fs";import {cp,lstat,@@ -63,9 +64,19 @@ export async function deployCluster({...manifest.optionalDependencies,})) {if (!range.startsWith("workspace:")) continue;- const installed = await realpath(- path.join(dependenciesRoot, directory, "node_modules", name),- );+ let parent = path.join(dependenciesRoot, directory);+ let installedPath;+ while (true) {+ installedPath = path.join(parent, "node_modules", name);+ if (existsSync(installedPath)) break;+ assert.notEqual(+ parent,+ dependenciesRoot,+ `Missing runtime workspace ${name}`,+ );+ parent = path.dirname(parent);+ }+ const installed = await realpath(installedPath);await visit(inside(dependenciesRoot, installed));}}@@ -120,10 +131,10 @@ export async function deployCluster({path.join(buildRoot, directory, content),path.join(destination, content),);- await copy(- path.join(dependenciesRoot, directory, "node_modules"),- path.join(destination, "node_modules"),- );+ const modules = path.join(dependenciesRoot, directory, "node_modules");+ if (existsSync(modules)) {+ await copy(modules, path.join(destination, "node_modules"));+ }const published = { ...manifest, ...manifest.publishConfig };delete published.devDependencies;delete published.publishConfig;diff --git a/apps/web-cluster/scripts/deploy.test.mjs b/apps/web-cluster/scripts/deploy.test.mjsindex 4f3d7cef3..9bd515fb1 100644--- a/apps/web-cluster/scripts/deploy.test.mjs+++ b/apps/web-cluster/scripts/deploy.test.mjs@@ -162,3 +162,27 @@ test("omitted optional package links do not break an otherwise complete deployme);assert.equal(module.value, 42);});++test("hoisted workspace and external dependencies load after relocation", async (t) => {+ const f = await fixture(t);+ const modules = path.join(f.dependenciesRoot, "node_modules");+ await rm(path.join(f.dependenciesRoot, "apps/web-cluster/node_modules"), {+ recursive: true,+ });+ await rm(path.join(f.dependenciesRoot, "packages/runtime/node_modules"), {+ recursive: true,+ });+ await mkdir(path.join(modules, "@cap"));+ await symlink("../../packages/runtime", path.join(modules, "@cap/runtime"));+ await symlink(+ ".bun/[email protected]/node_modules/external",+ path.join(modules, "external"),+ );+ await deployCluster(f);+ const relocated = path.join(f.root, "relocated");+ await rename(f.outputRoot, relocated);+ const module = await import(+ pathToFileURL(path.join(relocated, "apps/web-cluster/src/index.js"))+ );+ assert.equal(module.value, 42);+});diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.tsindex e5a7e55db..4daccf50d 100644--- a/apps/web/vitest.config.ts+++ b/apps/web/vitest.config.ts@@ -6,6 +6,31 @@ export default defineConfig({jsx: "automatic",},test: {+ // Hoisted UI peers must use web React; Next CommonJS imports still need require in Node-based jsdom tests.+ server: {+ deps: {+ inline: [+ "framer-motion",+ "motion",+ /[/\\]node_modules[/\\]@radix-ui[/\\]/,+ "@tanstack/react-query",+ ],+ },+ },+ deps: {+ optimizer: {+ ssr: { enabled: true, include: ["next/link", "next/image"] },+ web: {+ enabled: true,+ include: ["next/link", "next/image"],+ esbuildOptions: {+ banner: {+ js: `import { createRequire } from "node:module"; const require = createRequire(import.meta.url);`,+ },+ },+ },+ },+ },environment: "node",include: ["__tests__/**/*.test.ts"],exclude: ["**/node_modules/**", "**/dist/**", "**/.next/**"],@@ -26,6 +51,7 @@ export default defineConfig({hookTimeout: 30000,},resolve: {+ dedupe: ["react", "react-dom"],alias: {"@/app": join(process.cwd(), "app"),"@/components": join(process.cwd(), "components"),diff --git a/bun.lock b/bun.lockindex c48640802..91a604c24 100644--- a/bun.lock+++ b/bun.lock@@ -10,6 +10,8 @@"@effect/language-service": "^0.44.0","dotenv-cli": "latest","mysql2": "^3.15.2",+ "react": "19.2.0",+ "react-dom": "19.2.0","tsdown": "^0.15.6","turbo": "^2.3.4","typescript": "^5.8.3",@@ -4807,11 +4809,11 @@"re-resizable": ["[email protected]", "", { "peerDependencies": { "react": "^16.13.1 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-2xI2P3OHs5qw7K0Ud1aLILK6MQxW50TcO+DetD9eIV58j84TqYeHoZcL9H4GXFXXIh7afhH8mv5iUCXII7OW7A=="],- "react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],+ "react": ["[email protected]", "", {}, "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ=="],"react-devtools-core": ["[email protected]", "", { "dependencies": { "shell-quote": "1.9.0", "ws": "7.5.11" } }, "sha512-ePrwPfxAnB+7hgnEr8vpKxL9cmnp7F322t8oqcPshbIQQhDKgFDW4tjhF2wjVbdXF9O/nyuy3sQWd9JGpiLPvA=="],- "react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],+ "react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.0" } }, "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ=="],"react-draggable": ["[email protected]", "", { "dependencies": { "clsx": "2.1.1", "prop-types": "15.8.1" }, "peerDependencies": { "react": ">= 16.3.0", "react-dom": ">= 16.3.0" } }, "sha512-kTpANmKWVnFXiZ76Ag2ZowiFStuBYnJ606PI1TbUsOg29/400/JNIxI9+CuenhiAqFuXWJffz6F4UI3R51kUug=="],@@ -5787,8 +5789,16 @@"@babel/traverse/@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "7.29.7", "js-tokens": "4.0.0", "picocolors": "1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="],+ "@cap/chrome-extension/react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],++ "@cap/chrome-extension/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],+"@cap/database/@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-qXRuZaOsAdXKFyOhRBg6Lqqc0yay13vN7KrIg4L7N4aaHN68ma9OK3NE1BoDFgFOTfM7zg+3/8+2n8rLUH3OKQ=="],+ "@cap/database/react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],++ "@cap/database/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],+"@cap/desktop/vite": ["[email protected]", "", { "dependencies": { "esbuild": "0.25.12", "fdir": "6.5.0", "picomatch": "4.0.4", "postcss": "8.5.16", "rollup": "4.62.2", "tinyglobby": "0.2.17" }, "optionalDependencies": { "fsevents": "2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A=="],"@cap/desktop/vitest": ["[email protected]", "", { "dependencies": { "@vitest/expect": "2.1.9", "@vitest/mocker": "2.1.9", "@vitest/pretty-format": "2.1.9", "@vitest/runner": "2.1.9", "@vitest/snapshot": "2.1.9", "@vitest/spy": "2.1.9", "@vitest/utils": "2.1.9", "chai": "5.3.3", "debug": "4.4.3", "expect-type": "1.4.0", "magic-string": "0.30.21", "pathe": "1.1.2", "std-env": "3.10.0", "tinybench": "2.9.0", "tinyexec": "0.3.2", "tinypool": "1.1.1", "tinyrainbow": "1.2.0", "vite": "5.4.21", "vite-node": "2.1.9", "why-is-node-running": "2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", "@vitest/browser": "2.1.9", "@vitest/ui": "2.1.9", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@types/node", "@vitest/browser", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "vitest.mjs" } }, "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q=="],@@ -5797,14 +5807,14 @@"@cap/env/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "6.21.0" } }, "sha512-QWlFW2wf3nTjC13/DqRnBpR4ZO36VJH/JVBkA/vcnmbTBNQIlnObqyqZE1tUR7+Ni23Lda8R1BxMfbXRpCUx5g=="],- "@cap/mobile/react": ["[email protected]", "", {}, "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ=="],-- "@cap/mobile/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.0" } }, "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ=="],-"@cap/ui/@tauri-apps/cli": ["@tauri-apps/[email protected]", "", { "dependencies": { "semver": "7.8.5" }, "optionalDependencies": { "@tauri-apps/cli-darwin-arm64": "1.6.3", "@tauri-apps/cli-darwin-x64": "1.6.3", "@tauri-apps/cli-linux-arm-gnueabihf": "1.6.3", "@tauri-apps/cli-linux-arm64-gnu": "1.6.3", "@tauri-apps/cli-linux-arm64-musl": "1.6.3", "@tauri-apps/cli-linux-x64-gnu": "1.6.3", "@tauri-apps/cli-linux-x64-musl": "1.6.3", "@tauri-apps/cli-win32-arm64-msvc": "1.6.3", "@tauri-apps/cli-win32-ia32-msvc": "1.6.3", "@tauri-apps/cli-win32-x64-msvc": "1.6.3" }, "bin": { "tauri": "tauri.js" } }, "sha512-q46umd6QLRKDd4Gg6WyZBGa2fWvk0pbeUA5vFomm4uOs1/17LIciHv2iQ4UD+2Yv5H7AO8YiE1t50V0POiEGEw=="],"@cap/ui/lucide-react": ["[email protected]", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0" } }, "sha512-V7o0/VECSGbLHn3/1O67FUgBwWB+hmzshrgDVRJQhMh8uj5D3HBuIvhuAmQTtlupILSplwIZg5FTc4tTKMA2SA=="],+ "@cap/ui/react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],++ "@cap/ui/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],+"@cap/ui/vite": ["[email protected]", "", { "dependencies": { "esbuild": "0.25.12", "fdir": "6.5.0", "picomatch": "4.0.4", "postcss": "8.5.16", "rollup": "4.62.2", "tinyglobby": "0.2.17" }, "optionalDependencies": { "fsevents": "2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A=="],"@cap/ui/vite-tsconfig-paths": ["[email protected]", "", { "dependencies": { "debug": "4.4.3", "globrex": "0.1.2", "tsconfck": "3.1.6" }, "peerDependencies": { "vite": "*" }, "optionalPeers": ["vite"] }, "sha512-0Vd/a6po6Q+86rPlntHye7F31zA2URZMbH8M3saAZ/xR9QoGN/L21bxEGfXdWmFdNkqPpRdxFT7nmNe12e9/uA=="],@@ -5813,8 +5823,16 @@"@cap/ui-solid/tailwindcss": ["[email protected]", "", {}, "sha512-WtctNNSH8A9jlMIqxzuYumOHU5uGZyRv0Q5svQl+oEPy5w84YpBxdb7MdqyiSPQge5jTJ6zFQLq0PFygdccSBA=="],+ "@cap/utils/react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],++ "@cap/utils/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],+"@cap/web/eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "4.9.1", "@eslint-community/regexpp": "4.12.2", "@eslint/config-array": "0.21.2", "@eslint/config-helpers": "0.4.2", "@eslint/core": "0.17.0", "@eslint/eslintrc": "3.3.5", "@eslint/js": "9.39.4", "@eslint/plugin-kit": "0.4.1", "@humanfs/node": "0.16.8", "@humanwhocodes/module-importer": "1.0.1", "@humanwhocodes/retry": "0.4.3", "@types/estree": "1.0.9", "ajv": "6.15.0", "chalk": "4.1.2", "cross-spawn": "7.0.6", "debug": "4.4.3", "escape-string-regexp": "4.0.0", "eslint-scope": "8.4.0", "eslint-visitor-keys": "4.2.1", "espree": "10.4.0", "esquery": "1.7.0", "esutils": "2.0.3", "fast-deep-equal": "3.1.3", "file-entry-cache": "8.0.0", "find-up": "5.0.0", "glob-parent": "6.0.2", "ignore": "5.3.2", "imurmurhash": "0.1.4", "is-glob": "4.0.3", "json-stable-stringify-without-jsonify": "1.0.1", "lodash.merge": "4.6.2", "minimatch": "3.1.5", "natural-compare": "1.4.0", "optionator": "0.9.4" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ=="],+ "@cap/web/react": ["[email protected]", "", {}, "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ=="],++ "@cap/web/react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],+"@cap/web-cluster/dotenv-cli": ["[email protected]", "", { "dependencies": { "cross-spawn": "7.0.6", "dotenv": "17.4.2", "dotenv-expand": "11.0.7", "minimist": "1.2.8" }, "bin": { "dotenv": "cli.js" } }, "sha512-lnOnttzfrzkRx2echxJHQRB6vOAMSCzzZg79IxpC00tU42wZPuZkQxNNrrwVAxaQZIIh001l4PxVlCrBxngBzA=="],"@cloudflare/unenv-preset/unenv": ["[email protected]", "", { "dependencies": { "defu": "6.1.7", "exsolve": "1.1.0", "ohash": "2.0.11", "pathe": "2.0.3", "ufo": "1.6.4" } }, "sha512-od496pShMen7nOy5VmVJCnq8rptd45vh6Nx/r2iPbrba6pa6p+tS2ywuIHRZ/OBvSbQZB0kWvpO9XBNVFXHD3Q=="],diff --git a/bunfig.toml b/bunfig.tomlindex 2f8849eeb..573829e21 100644--- a/bunfig.toml+++ b/bunfig.toml@@ -1,5 +1,5 @@[install]-linker = "isolated"+linker = "hoisted"[run]bun = falsediff --git a/package.json b/package.jsonindex 8cfd383ae..64b8a6d64 100644--- a/package.json+++ b/package.json@@ -60,7 +60,9 @@"mysql2": "^3.15.2","tsdown": "^0.15.6","turbo": "^2.3.4",- "typescript": "^5.8.3"+ "typescript": "^5.8.3",+ "react": "19.2.0",+ "react-dom": "19.2.0"},"packageManager": "[email protected]","name": "cap",diff --git a/scripts/check-bun-install.mjs b/scripts/check-bun-install.mjsindex 37e1aba97..244f3dd24 100644--- a/scripts/check-bun-install.mjs+++ b/scripts/check-bun-install.mjs@@ -1,12 +1,12 @@import assert from "node:assert/strict";import { spawnSync } from "node:child_process";-import { readFileSync } from "node:fs";+import { existsSync, readFileSync } from "node:fs";import { createRequire } from "node:module";import path from "node:path";import { fileURLToPath } from "node:url";import ts from "typescript";-const root = fileURLToPath(new URL("../", import.meta.url));+const root = path.resolve(fileURLToPath(new URL("../", import.meta.url)));const manifest = JSON.parse(readFileSync(path.join(root, "package.json"), "utf8"),);@@ -26,12 +26,19 @@ for (const [directory, workspace] of Object.entries(lock.workspaces)) {...workspace.devDependencies,};for (const name of Object.keys(dependencies)) {- const installed = JSON.parse(- readFileSync(- path.join(root, directory, "node_modules", name, "package.json"),- "utf8",- ),- );+ let location = path.join(root, directory);+ let packageFile;+ while (true) {+ packageFile = path.join(location, "node_modules", name, "package.json");+ if (existsSync(packageFile)) break;+ assert.notEqual(+ location,+ root,+ `Missing installed ${directory}: ${name}`,+ );+ location = path.dirname(location);+ }+ const installed = JSON.parse(readFileSync(packageFile, "utf8"));const entry =lock.packages[`${workspace.name}/${name}`] ?? lock.packages[name];assert.ok(entry, `Missing lockfile resolution for ${directory}: ${name}`);@@ -53,10 +60,20 @@ const nativeRequire = createRequire(mobileRequire.resolve("react-native/package.json"),);assert.equal(- nativeRequire("react/package.json").version,- mobileRequire("react/package.json").version,- "React Native must resolve the mobile React version",+ nativeRequire.resolve("react"),+ mobileRequire.resolve("react"),+ "React Native must resolve the mobile React instance",);+for (const require of [webRequire, mobileRequire]) {+ const rendererRequire = createRequire(+ require.resolve("react-dom/package.json"),+ );+ assert.equal(+ rendererRequire.resolve("react"),+ require.resolve("react"),+ "React DOM must resolve its application's React instance",+ );+}const ffmpeg = webRequire("ffmpeg-static");assert.equal(typeof ffmpeg,