Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): restore thread links in the Hermes build #28768

ClosedPixPMusic(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/28768/headopened View on GitHub

Showing 2 changed files with 75 additions and 1 deletion.

x
0 of 2 viewed, 2 left
68 additions and 0 deletionsapps/mobile/src/lib/threadLinks.test.tsAdded
View file
@@ -0,0 +1,68 @@
+import * as NodeModule from "node:module";
+import * as NodeURL from "node:url";
+import * as NodeVM from "node:vm";
+import * as Contracts from "@t3tools/contracts";
+import * as Option from "effect/Option";
+import * as Schema from "effect/Schema";
+import { expect, it } from "vite-plus/test";
+​
+const require = NodeModule.createRequire(import.meta.url);
+const babel: {
+ transformFileSync: (
+ filename: string,
+ options: Record<string, unknown>,
+ ) => { code?: string | null } | null;
+} = require("@babel/core");
+​
+it("extracts thread links when Hermes clones Babel's named-group regex for matchAll", () => {
+ const compiled = babel.transformFileSync(
+ NodeURL.fileURLToPath(
+ new URL("../../../../packages/shared/src/threadLinks.ts", import.meta.url),
+ ),
+ {
+ babelrc: false,
+ configFile: false,
+ presets: [[require.resolve("babel-preset-expo"), { enableBabelRuntime: false }]],
+ caller: {
+ name: "metro",
+ bundler: "metro",
+ platform: "android",
+ isDev: false,