Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/eslint/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ const config = defineConfig([
},

{
files: ['server/**/*.ts'],
files: ['server/**/*.ts', 'server/**/*.tsx'],
languageOptions: {
parserOptions: {
project: path.resolve(projectRoot, 'server/victory-chart-renderer/tsconfig.json'),
Expand Down
42 changes: 40 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
"web:dist": "concurrently \"npm:web-proxy\" \"http-server ./dist --cors --port 8080 -P http://localhost:9000\"",
"octokit": "cd scripts && npx ts-node -i -e \"$(cat ./octokit.ts)\"",
"compress-svg": "npx ts-node scripts/compressSvg.ts --dir assets/images && npx ts-node scripts/compressSvg.ts --dir docs/assets/images",
"server:vcr:dev": "bun run server/victory-chart-renderer/src/cli.ts",
"server:vcr:build:linux": "bun build --compile --target=bun-linux-x64 server/victory-chart-renderer/src/cli.ts --outfile server/victory-chart-renderer/dist/victory-chart-renderer-linux-x64",
"server:vcr:build:macos": "bun build --compile --target=bun-darwin-arm64 server/victory-chart-renderer/src/cli.ts --outfile server/victory-chart-renderer/dist/victory-chart-renderer-darwin-arm64"
"server:vcr:dev": "bun --conditions=react-native run server/victory-chart-renderer/src/cli.tsx",
"server:vcr:build:linux": "bun build --conditions=react-native --compile --target=bun-linux-x64 server/victory-chart-renderer/src/cli.tsx --outfile server/victory-chart-renderer/dist/victory-chart-renderer-linux-x64",
"server:vcr:build:macos": "bun build --conditions=react-native --compile --target=bun-darwin-arm64 server/victory-chart-renderer/src/cli.tsx --outfile server/victory-chart-renderer/dist/victory-chart-renderer-darwin-arm64"
},
"dependencies": {
"@babel/runtime": "^7.25.0",
Expand Down Expand Up @@ -273,6 +273,7 @@
"@types/mime-db": "^1.43.5",
"@types/node": "^20.11.5",
"@types/pako": "^2.0.3",
"@types/pngjs": "^6.0.5",
"@types/pusher-js": "^5.1.0",
"@types/react": "^19.2.0",
"@types/react-collapse": "^5.0.1",
Expand Down Expand Up @@ -336,6 +337,8 @@
"openai": "^6.16.0",
"patch-package": "^8.1.0-canary.1",
"peggy": "^4.0.3",
"pixelmatch": "^7.2.0",
"pngjs": "^7.0.0",
"portfinder": "^1.0.34",
"prettier": "3.7.4",
"react-native-clean-project": "^4.0.0-alpha4.0",
Expand Down Expand Up @@ -421,6 +424,9 @@
"expo": "55.0.25"
}
},
"trustedDependencies": [
"@shopify/react-native-skia"
],
"expo": {
"autolinking": {
"exclude": [
Expand Down
21 changes: 21 additions & 0 deletions patches/@shopify+react-native-skia+2.4.14.details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @shopify/react-native-skia patch: local tsconfig for Bun headless renderer

## Why

The `server/victory-chart-renderer` Bun CLI renders Skia content without React
Native. Bun (and any other non-RN consumer) loads `@shopify/react-native-skia`'s
root entry, which transitively imports `react-native`,
`react-native-reanimated`, and `react-native/Libraries/...` subpaths. None of
those packages run in Bun.

This patch drops a minimal `tsconfig.json` inside the installed package so that
when Bun resolves imports from files in `node_modules/@shopify/react-native-skia/...`
it walks up to this `tsconfig.json` and remaps the React Native dependencies to
the stubs in `server/victory-chart-renderer/stubs/`. Metro doesn't consult
`tsconfig.json` paths, so the in-app build is unaffected.

## Remove when

We replace the Bun renderer with a different mechanism, or the Skia package
ships a `bun` export condition (or equivalent) that lets us load a stripped
entry without React Native dependencies.
25 changes: 25 additions & 0 deletions patches/@shopify+react-native-skia+2.4.14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/node_modules/@shopify/react-native-skia/tsconfig.json b/node_modules/@shopify/react-native-skia/tsconfig.json
new file mode 100644
index 0000000..50f2975
--- /dev/null
+++ b/node_modules/@shopify/react-native-skia/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "react-native": [
+ "../../../server/victory-chart-renderer/stubs/react-native.ts"
+ ],
+ "react-native/*": [
+ "../../../server/victory-chart-renderer/stubs/react-native-subpath.ts"
+ ],
+ "react-native-reanimated": [
+ "../../../server/victory-chart-renderer/stubs/react-native-reanimated.js"
+ ],
+ "react-native-gesture-handler": [
+ "../../../server/victory-chart-renderer/stubs/react-native-gesture-handler.ts"
+ ]
+ }
+ }
+}
35 changes: 35 additions & 0 deletions patches/victory-native+41.20.2.details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# victory-native patch: explicitSize + headless props

Mirrors upstream PR: <https://github.com/FormidableLabs/victory-native-xl/pull/657>

## Why

The `server/victory-chart-renderer` Bun CLI renders Expensify chart XML to PNG using
the same `CartesianChart` users see in-app, but it runs without React Native — there is no
host view to fire `onLayout`, and the existing `<Canvas>` wrapper expects to be mounted
inside one. This patch adds two opt-in props that let the CLI drive the chart with a
fixed canvas size and emit only the Skia subtree (so we can paint it onto an offscreen
surface created via `LoadSkiaWeb`):

- `explicitSize?: { width: number; height: number }` — seeds the chart's size state
immediately, skipping the `onLayout` round-trip.
- `headless?: boolean` — when paired with `explicitSize`, returns a Skia-only `<Group>`
containing the chart contents instead of wrapping them in `<Canvas>` and a gesture
handler. The chart still renders identically inside React Native when neither prop is
passed, so the in-app code path is unchanged.

The patch lives in both `src/` (consumed by Metro via the package's `react-native`
field) and `dist/` (consumed by Bun, which falls through to the `import` condition and
loads compiled JS / `.d.ts`).

A small `tsconfig.json` is also dropped into the installed package. Bun's
resolver walks up to the closest `tsconfig.json` when resolving bare specifiers
in `node_modules/victory-native/...`, so this file remaps the chart's React
Native dependencies (`react-native`, `react-native-reanimated`,
`react-native-gesture-handler`) to the stubs in
`server/victory-chart-renderer/stubs/`. Metro doesn't honor `tsconfig.json`
paths, so the in-app build is unaffected.

## Remove when

Upstream PR is merged and we upgrade `victory-native` to a release containing it.
Loading
Loading