Use my fork of react native svg to fix web

This commit is contained in:
Zoe Roux 2025-02-10 23:53:21 +01:00
parent 8c40e2230d
commit 23f42f247d
No known key found for this signature in database
4 changed files with 9 additions and 86 deletions

View File

@ -19,7 +19,7 @@
"react-native-mmkv": "^3.2.0", "react-native-mmkv": "^3.2.0",
"react-native-reanimated": "~3.16.7", "react-native-reanimated": "~3.16.7",
"react-native-screens": "4.6.0", "react-native-screens": "4.6.0",
"react-native-svg": "^15.11.1", "react-native-svg": "zoriya/react-native-svg#build",
"react-native-web": "^0.19.13", "react-native-web": "^0.19.13",
"yoshiki": "1.2.14", "yoshiki": "1.2.14",
"zod": "^3.24.1", "zod": "^3.24.1",
@ -37,7 +37,6 @@
}, },
"patchedDependencies": { "patchedDependencies": {
"one@1.1.437": "patches/one@1.1.437.patch", "one@1.1.437": "patches/one@1.1.437.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", "yoshiki@1.2.14": "patches/yoshiki@1.2.14.patch",
}, },
"packages": { "packages": {
@ -1713,7 +1712,7 @@
"react-native-screens": ["react-native-screens@4.6.0", "", { "dependencies": { "react-freeze": "^1.0.0", "warn-once": "^0.1.0" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-PqGtR/moJLiTMSavhfo5spKXNHZrlxffq3g5UUVPmyuu7MmazFlPvYqiAYnR2iB9tkJYgvZO6sbjYAE7619M0A=="], "react-native-screens": ["react-native-screens@4.6.0", "", { "dependencies": { "react-freeze": "^1.0.0", "warn-once": "^0.1.0" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-PqGtR/moJLiTMSavhfo5spKXNHZrlxffq3g5UUVPmyuu7MmazFlPvYqiAYnR2iB9tkJYgvZO6sbjYAE7619M0A=="],
"react-native-svg": ["react-native-svg@15.11.1", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-Qmwx/yJKt+AHUr4zjxx/Q69qwKtRfr1+uIfFMQoq3WFRhqU76aL9db1DyvPiY632DAsVGba1pHf92OZPkpjrdQ=="], "react-native-svg": ["react-native-svg@github:zoriya/react-native-svg#7d70551", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "zoriya-react-native-svg-7d70551"],
"react-native-web": ["react-native-web@0.19.13", "", { "dependencies": { "@babel/runtime": "^7.18.6", "@react-native/normalize-colors": "^0.74.1", "fbjs": "^3.0.4", "inline-style-prefixer": "^6.0.1", "memoize-one": "^6.0.0", "nullthrows": "^1.1.1", "postcss-value-parser": "^4.2.0", "styleq": "^0.1.3" }, "peerDependencies": { "react": "^18.0.0", "react-dom": "^18.0.0" } }, "sha512-etv3bN8rJglrRCp/uL4p7l8QvUNUC++QwDbdZ8CB7BvZiMvsxfFIRM1j04vxNldG3uo2puRd6OSWR3ibtmc29A=="], "react-native-web": ["react-native-web@0.19.13", "", { "dependencies": { "@babel/runtime": "^7.18.6", "@react-native/normalize-colors": "^0.74.1", "fbjs": "^3.0.4", "inline-style-prefixer": "^6.0.1", "memoize-one": "^6.0.0", "nullthrows": "^1.1.1", "postcss-value-parser": "^4.2.0", "styleq": "^0.1.3" }, "peerDependencies": { "react": "^18.0.0", "react-dom": "^18.0.0" } }, "sha512-etv3bN8rJglrRCp/uL4p7l8QvUNUC++QwDbdZ8CB7BvZiMvsxfFIRM1j04vxNldG3uo2puRd6OSWR3ibtmc29A=="],

View File

@ -28,7 +28,7 @@
"react-native-mmkv": "^3.2.0", "react-native-mmkv": "^3.2.0",
"react-native-reanimated": "~3.16.7", "react-native-reanimated": "~3.16.7",
"react-native-screens": "4.6.0", "react-native-screens": "4.6.0",
"react-native-svg": "^15.11.1", "react-native-svg": "zoriya/react-native-svg#build",
"react-native-web": "^0.19.13", "react-native-web": "^0.19.13",
"yoshiki": "1.2.14", "yoshiki": "1.2.14",
"zod": "^3.24.1" "zod": "^3.24.1"
@ -44,7 +44,6 @@
}, },
"patchedDependencies": { "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.437": "patches/one@1.1.437.patch" "one@1.1.437": "patches/one@1.1.437.patch"
} }
} }

View File

@ -1,81 +0,0 @@
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/node_modules/react-native-svg/.bun-tag-f522b4a5929fac99 b/.bun-tag-f522b4a5929fac99
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/lib/commonjs/utils/fetchData.js b/lib/commonjs/utils/fetchData.js
index 207b2937d048ca9c22b58dd7be3641b5a7262274..d6a45c9fd9b69beaf5b3676f5702f71279c7ac84 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/lib/extract/transform.js b/lib/module/lib/extract/transform.js
index 06c724b760232c93e5ed9d72266a054d5fe65512..760929ccd9ffdee5c27accaf6d3eefaa83f2e721 100644
--- a/lib/module/lib/extract/transform.js
+++ b/lib/module/lib/extract/transform.js
@@ -1478,8 +1478,6 @@ function peg$parse(input, options) {
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
}
}
-module.exports = {
- SyntaxError: peg$SyntaxError,
- parse: peg$parse
-};
+export const SyntaxError = peg$SyntaxError;
+export const parse = peg$parse;
//# sourceMappingURL=transform.js.map
diff --git a/lib/module/lib/extract/transformToRn.js b/lib/module/lib/extract/transformToRn.js
index e2a7f4ca95728be34c45e55b96ce5ec1f43d14cc..c496d600fc0f91246fb41acfd6fdf1363c193cc9 100644
--- a/lib/module/lib/extract/transformToRn.js
+++ b/lib/module/lib/extract/transformToRn.js
@@ -1148,9 +1148,7 @@ function peg$parse(input, options) {
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
}
}
-module.exports = {
- StartRules: ['start'],
- SyntaxError: peg$SyntaxError,
- parse: peg$parse
-};
+export const StartRules = ['start'];
+export const SyntaxError = peg$SyntaxError;
+export const parse = peg$parse;
//# sourceMappingURL=transformToRn.js.map
diff --git a/lib/module/utils/fetchData.js b/lib/module/utils/fetchData.js
index 12b68966cbcfd9a18cae66824dfe7aec60d14a80..dda9fab51f762500eb3b1b2f84a5a6b0b1fbd4eb 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<string | null> {
if (!uri) {

View File

@ -1,6 +1,7 @@
import { one } from "one/vite"; import { one } from "one/vite";
import type { UserConfig } from "vite"; import type { UserConfig } from "vite";
import svgr from "vite-plugin-svgr"; import svgr from "vite-plugin-svgr";
import { resolvePath } from '@vxrn/resolve'
export default { export default {
ssr: { ssr: {
@ -9,6 +10,11 @@ export default {
esbuild: { esbuild: {
include: [/.tsx?$/], include: [/.tsx?$/],
}, },
resolve: {
alias: {
'@react-native/assets-registry/registry': resolvePath('react-native-web/dist/modules/AssetRegistry/index.js'),
},
},
plugins: [ plugins: [
one({ one({
deps: { deps: {