From 071b365a9bf668c09a88e45def2a349ab303e5e1 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 9 Feb 2025 00:46:19 +0100 Subject: [PATCH] Patch dependencies --- front/app/_layout.tsx | 3 +- front/bun.lock | 2 + front/package.json | 4 +- front/patches/one@1.1.426.patch | 76 ++++++++++++++++++++ front/patches/react-native-svg@15.11.1.patch | 46 ++++++++++++ front/src/ui/errors/unauthorized.tsx | 2 + front/vite.config.ts | 20 +++--- 7 files changed, 140 insertions(+), 13 deletions(-) create mode 100644 front/patches/one@1.1.426.patch create mode 100644 front/patches/react-native-svg@15.11.1.patch diff --git a/front/app/_layout.tsx b/front/app/_layout.tsx index d62a799c..912f21b3 100644 --- a/front/app/_layout.tsx +++ b/front/app/_layout.tsx @@ -1,6 +1,5 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; -import { Slot } from "one"; -import { useServerHeadInsertion } from "one"; +import { Slot, useServerHeadInsertion } from "one"; import { StyleRegistryProvider, createStyleRegistry } from "yoshiki/web"; import { Providers } from "~/providers"; diff --git a/front/bun.lock b/front/bun.lock index ca078209..5c9427a6 100644 --- a/front/bun.lock +++ b/front/bun.lock @@ -36,6 +36,8 @@ }, }, "patchedDependencies": { + "one@1.1.426": "patches/one@1.1.426.patch", + "react-native-svg@15.11.1": "patches/react-native-svg@15.11.1.patch", "yoshiki@1.2.14": "patches/yoshiki@1.2.14.patch", }, "packages": { diff --git a/front/package.json b/front/package.json index 1e2aefe2..840388d6 100644 --- a/front/package.json +++ b/front/package.json @@ -44,6 +44,8 @@ "vite-plugin-svgr": "^4.3.0" }, "patchedDependencies": { - "yoshiki@1.2.14": "patches/yoshiki@1.2.14.patch" + "yoshiki@1.2.14": "patches/yoshiki@1.2.14.patch", + "react-native-svg@15.11.1": "patches/react-native-svg@15.11.1.patch", + "one@1.1.426": "patches/one@1.1.426.patch" } } diff --git a/front/patches/one@1.1.426.patch b/front/patches/one@1.1.426.patch new file mode 100644 index 00000000..240d8c05 --- /dev/null +++ b/front/patches/one@1.1.426.patch @@ -0,0 +1,76 @@ +diff --git a/node_modules/one/.bun-tag-2de151ab6f27ae4d b/.bun-tag-2de151ab6f27ae4d +new file mode 100644 +index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +diff --git a/dist/cjs/vite/one-server-only.cjs b/dist/cjs/vite/one-server-only.cjs +index d15e8f68d97a261ffb203fe31a6733fd9ff7a38c..a70727b8491e5b6890e7e37d893ea89d602812da 100644 +--- a/dist/cjs/vite/one-server-only.cjs ++++ b/dist/cjs/vite/one-server-only.cjs +@@ -109,6 +109,5 @@ function setServerData(key2, value) { + } else throw new Error(`Cannot setServerData in ${process.env.VITE_ENVIRONMENT} environment!`); + } + function getServerData(key2) { +- if (process.env.VITE_ENVIRONMENT === "ssr") throw new Error("Cannot getServerData on the server"); +- if (process.env.VITE_ENVIRONMENT !== "ssr") return getServerContext()?.postRenderData?.[key2]; ++ return getServerContext()?.postRenderData?.[key2]; + } +diff --git a/dist/cjs/vite/one-server-only.js b/dist/cjs/vite/one-server-only.js +index 6fc1e3823184d2947823c0461edd2812adf01c98..b67b608a5a5960e4078093df861611a573a2d0d8 100644 +--- a/dist/cjs/vite/one-server-only.js ++++ b/dist/cjs/vite/one-server-only.js +@@ -100,9 +100,6 @@ function setServerData(key2, value) { + throw new Error(`Cannot setServerData in ${process.env.VITE_ENVIRONMENT} environment!`); + } + function getServerData(key2) { +- if (process.env.VITE_ENVIRONMENT === "ssr") +- throw new Error("Cannot getServerData on the server"); +- if (process.env.VITE_ENVIRONMENT !== "ssr") +- return getServerContext()?.postRenderData?.[key2]; ++ return getServerContext()?.postRenderData?.[key2]; + } + //# sourceMappingURL=one-server-only.js.map +diff --git a/dist/esm/vite/one-server-only.js b/dist/esm/vite/one-server-only.js +index 5d52c4efe4dacb19dfa581d85d828d4a95f9edd4..c140a0bdb62a3c94dc74634ecded861a35a54f38 100644 +--- a/dist/esm/vite/one-server-only.js ++++ b/dist/esm/vite/one-server-only.js +@@ -72,10 +72,7 @@ function setServerData(key2, value) { + throw new Error(`Cannot setServerData in ${process.env.VITE_ENVIRONMENT} environment!`); + } + function getServerData(key2) { +- if (process.env.VITE_ENVIRONMENT === "ssr") +- throw new Error("Cannot getServerData on the server"); +- if (process.env.VITE_ENVIRONMENT !== "ssr") +- return getServerContext()?.postRenderData?.[key2]; ++ return getServerContext()?.postRenderData?.[key2]; + } + export { + asyncHeadersCache, +diff --git a/dist/esm/vite/one-server-only.mjs b/dist/esm/vite/one-server-only.mjs +index a24223c8f62a491407999783be8124941c36cd6e..8010cb4941b545ad171b8c4e8d29053f0d65684c 100644 +--- a/dist/esm/vite/one-server-only.mjs ++++ b/dist/esm/vite/one-server-only.mjs +@@ -74,8 +74,7 @@ function setServerData(key2, value) { + } else throw new Error(`Cannot setServerData in ${process.env.VITE_ENVIRONMENT} environment!`); + } + function getServerData(key2) { +- if (process.env.VITE_ENVIRONMENT === "ssr") throw new Error("Cannot getServerData on the server"); +- if (process.env.VITE_ENVIRONMENT !== "ssr") return getServerContext()?.postRenderData?.[key2]; ++ return getServerContext()?.postRenderData?.[key2]; + } + export { asyncHeadersCache, ensureAsyncLocalID, getServerContext, getServerData, mergeHeaders, requestAsyncLocalStore, runWithAsyncLocalContext, setResponseHeaders, setServerContext, setServerData, useServerContext }; + //# sourceMappingURL=one-server-only.mjs.map +diff --git a/src/vite/one-server-only.tsx b/src/vite/one-server-only.tsx +index c54dcae3445da6681abd004f94897d86fc6c1b0e..3b0d3e9496597358c2c4b3d25559b3e775bfa38c 100644 +--- a/src/vite/one-server-only.tsx ++++ b/src/vite/one-server-only.tsx +@@ -142,10 +142,5 @@ export function setServerData( + * For getting data set by setServerData on the server. + */ + export function getServerData(key: keyof One.ClientData) { +- if (process.env.VITE_ENVIRONMENT === 'ssr') { +- throw new Error(`Cannot getServerData on the server`) +- } +- if (process.env.VITE_ENVIRONMENT !== 'ssr') { +- return getServerContext()?.postRenderData?.[key] +- } ++ return getServerContext()?.postRenderData?.[key] + } diff --git a/front/patches/react-native-svg@15.11.1.patch b/front/patches/react-native-svg@15.11.1.patch new file mode 100644 index 00000000..aa9e7177 --- /dev/null +++ b/front/patches/react-native-svg@15.11.1.patch @@ -0,0 +1,46 @@ +diff --git a/node_modules/react-native-svg/.bun-tag-55c72d773cdb59fb b/.bun-tag-55c72d773cdb59fb +new file mode 100644 +index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +diff --git a/lib/commonjs/utils/fetchData.js b/lib/commonjs/utils/fetchData.js +index 207b2937d048ca9c22b58dd7be3641b5a7262274..385556e71e6bf0ea1c843c40065520131be59907 100644 +--- a/lib/commonjs/utils/fetchData.js ++++ b/lib/commonjs/utils/fetchData.js +@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { + }); + exports.fetchText = fetchText; + var _reactNative = require("react-native"); +-var _buffer = require("buffer"); ++ + async function fetchText(uri) { + if (!uri) { + return null; +@@ -23,7 +23,7 @@ const decodeBase64Image = uri => { + const splitContent = decoded.split(';')[1].split(','); + const dataType = splitContent[0]; + const content = splitContent.slice(1).join(','); +- return _buffer.Buffer.from(content, dataType).toString('utf-8'); ++ return Buffer.from(content, dataType).toString('utf-8'); + }; + function dataUriToXml(uri) { + try { +diff --git a/lib/module/utils/fetchData.js b/lib/module/utils/fetchData.js +index 12b68966cbcfd9a18cae66824dfe7aec60d14a80..3d2698c3a982e90b795c35c05cf5efb2910e02c9 100644 +--- a/lib/module/utils/fetchData.js ++++ b/lib/module/utils/fetchData.js +@@ -1,5 +1,5 @@ + import { Platform } from 'react-native'; +-import { Buffer } from 'buffer'; ++ + export async function fetchText(uri) { + if (!uri) { + return null; +diff --git a/src/utils/fetchData.ts b/src/utils/fetchData.ts +index d141be31c924bd1d3ec287ad4e291db018b4bb72..0dc3d95ca382151a45af41f8ed499d1403a1f65c 100644 +--- a/src/utils/fetchData.ts ++++ b/src/utils/fetchData.ts +@@ -1,5 +1,4 @@ + import { Platform } from 'react-native'; +-import { Buffer } from 'buffer'; + + export async function fetchText(uri?: string): Promise { + if (!uri) { diff --git a/front/src/ui/errors/unauthorized.tsx b/front/src/ui/errors/unauthorized.tsx index 7d6c44bd..9f215766 100644 --- a/front/src/ui/errors/unauthorized.tsx +++ b/front/src/ui/errors/unauthorized.tsx @@ -5,6 +5,8 @@ import { useYoshiki } from "yoshiki/native"; import { Button, Icon, Link, P, ts } from "~/primitives"; import { useAccount } from "~/providers/account-provider"; +console.log(Register); + export const Unauthorized = ({ missing }: { missing: string[] }) => { const { t } = useTranslation(); const { css } = useYoshiki(); diff --git a/front/vite.config.ts b/front/vite.config.ts index 92656ac4..e445f8ea 100644 --- a/front/vite.config.ts +++ b/front/vite.config.ts @@ -6,16 +6,6 @@ export default { ssr: { noExternal: ["@tanstack/react-query", "@tanstack/react-query-devtools"], }, - server: { - proxy: { - "/api": { - target: process.env.KYOO_URL ?? "http://back/api", - changeOrigin: true, - // without this we have two /api at the start - rewrite: (path) => path.replace(/^\/api/, ""), - }, - }, - }, plugins: [ one({ deps: { @@ -35,4 +25,14 @@ export default { }, }), ], + server: { + proxy: { + "/api": { + target: process.env.KYOO_URL ?? "http://back/api", + changeOrigin: true, + // without this we have two /api at the start + rewrite: (path) => path.replace(/^\/api/, ""), + }, + }, + }, } satisfies UserConfig;