@whop/react-native 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -31,6 +31,12 @@ var import_find_up2 = require("find-up");
31
31
  var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
32
32
  var import_rimraf = require("rimraf");
33
33
 
34
+ // src/cli/env-bool.ts
35
+ function envBool(name) {
36
+ const value = process.env[name]?.toLowerCase();
37
+ return value === "1" || value === "true" || value === "yes";
38
+ }
39
+
34
40
  // src/cli/mobile.ts
35
41
  var import_node_fs2 = require("fs");
36
42
  var import_promises2 = require("fs/promises");
@@ -148,6 +154,9 @@ async function bundle(root, platform) {
148
154
  platform,
149
155
  "main_js_bundle"
150
156
  );
157
+ const cacheDir = process.env.WRN_METRO_CACHE_DIRECTORY || import_node_path3.default.join(root, "build", "cache");
158
+ const isCacheDisabled = envBool("WRN_DISABLE_METRO_CACHE");
159
+ const remoteCacheUrl = process.env.WRN_REMOTE_METRO_CACHE_URL;
151
160
  await (0, import_promises2.mkdir)(import_node_path3.default.dirname(outputFile), { recursive: true });
152
161
  const babelLocation = require.resolve("@babel/runtime/package");
153
162
  const bableNodeModules = await (0, import_find_up.findUp)("node_modules", {
@@ -165,7 +174,19 @@ async function bundle(root, platform) {
165
174
  transformer: {
166
175
  babelTransformerPath: require.resolve("./whop-react-native-babel-transformer.js")
167
176
  },
168
- cacheStores: [],
177
+ cacheStores: ({ FileStore, HttpStore }) => {
178
+ if (isCacheDisabled) return [];
179
+ const caches = [
180
+ new FileStore({
181
+ root: cacheDir
182
+ })
183
+ ];
184
+ if (remoteCacheUrl) {
185
+ caches.push(new HttpStore({ endpoint: remoteCacheUrl }));
186
+ }
187
+ return caches;
188
+ },
189
+ cacheVersion: process.env.WRN_METRO_CACHE_VERSION,
169
190
  watchFolders: [root, import_node_path3.default.resolve(root, "node_modules"), bableNodeModules],
170
191
  reporter: new CustomReporter(),
171
192
  resolver: {
@@ -504,7 +525,8 @@ async function bundleWeb(root) {
504
525
  ".tsx",
505
526
  ".ts",
506
527
  ".jsx",
507
- ".js"
528
+ ".js",
529
+ ".mjs"
508
530
  ],
509
531
  loader: {
510
532
  ".png": "dataurl",
@@ -515,7 +537,8 @@ async function bundleWeb(root) {
515
537
  ".woff": "dataurl",
516
538
  ".woff2": "dataurl",
517
539
  ".js": "jsx",
518
- ".jsx": "jsx"
540
+ ".jsx": "jsx",
541
+ ".mjs": "jsx"
519
542
  },
520
543
  plugins: [
521
544
  forceSingleReact(),
@@ -681,7 +704,11 @@ async function main() {
681
704
  }
682
705
  const root = await getRootProjectDirectory();
683
706
  if (shouldClean) {
684
- await cleanBuildDirectory(root);
707
+ if (envBool("WRN_FULL_CLEAN")) {
708
+ await cleanBuildDirectory(root);
709
+ } else {
710
+ await cleanEntrypointsDirectory(root);
711
+ }
685
712
  }
686
713
  const didProvidePlatform = args.values.ios || args.values.android || args.values.web;
687
714
  const opts = { shouldBuild, shouldUpload };
@@ -704,6 +731,13 @@ async function cleanBuildDirectory(root) {
704
731
  }
705
732
  console.log(" \u2714\uFE0E cleaned build directory");
706
733
  }
734
+ async function cleanEntrypointsDirectory(root) {
735
+ const buildDirectory = import_node_path5.default.join(root, "build", "entrypoints");
736
+ if ((0, import_node_fs3.existsSync)(buildDirectory)) {
737
+ await (0, import_rimraf.rimraf)(buildDirectory);
738
+ }
739
+ console.log(" \u2714\uFE0E cleaned build entrypoints directory");
740
+ }
707
741
  async function getRootProjectDirectory() {
708
742
  const file = await (0, import_find_up2.findUp)("package.json", { cwd: process.cwd() });
709
743
  if (!file) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tawait cleanBuildDirectory(root);\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: [],\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nconst BASE_URL = process.env.WHOP_BASE_URL;\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n\tapiOrigin: BASE_URL ? new URL(BASE_URL).origin : undefined,\n});\n\nexport const whopSdk = new Whop({\n\tappID: APP_ID,\n\tbaseURL: BASE_URL ? new URL(\"/api/v1\", BASE_URL).href : undefined,\n});\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out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AQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AACf,CAAC,EACA,KAAK,MAAM;AACX,UAAQ,KAAK,CAAC;AACf,CAAC;","names":["import_node_fs","import_node_path","import_find_up","import_node_fs","import_promises","import_node_path","import_metro","Whop","fs","path","import_node_path","path","path","build","JSZip","import_promises","import_node_path","fs","path","fs","path","babel","path","buildAndPublish","build","buildAndPublish","path","qrcode"]}
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/env-bool.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { envBool } from \"./env-bool\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tif (envBool(\"WRN_FULL_CLEAN\")) {\n\t\t\tawait cleanBuildDirectory(root);\n\t\t} else {\n\t\t\tawait cleanEntrypointsDirectory(root);\n\t\t}\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function cleanEntrypointsDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\", \"entrypoints\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build entrypoints directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","/**\n * Check if an environment variable is set to a truthy value.\n * Accepts: \"1\", \"true\", \"yes\" (case-insensitive)\n */\nexport function envBool(name: string): boolean {\n\tconst value = process.env[name]?.toLowerCase();\n\treturn value === \"1\" || value === \"true\" || value === \"yes\";\n}\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { envBool } from \"./env-bool\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tconst cacheDir =\n\t\tprocess.env.WRN_METRO_CACHE_DIRECTORY || path.join(root, \"build\", \"cache\");\n\tconst isCacheDisabled = envBool(\"WRN_DISABLE_METRO_CACHE\");\n\tconst remoteCacheUrl = process.env.WRN_REMOTE_METRO_CACHE_URL;\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: ({ FileStore, HttpStore }) => {\n\t\t\tif (isCacheDisabled) return [];\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: types are cooked here\n\t\t\tconst caches: any[] = [\n\t\t\t\tnew FileStore({\n\t\t\t\t\troot: cacheDir,\n\t\t\t\t}),\n\t\t\t];\n\t\t\tif (remoteCacheUrl) {\n\t\t\t\tcaches.push(new HttpStore({ endpoint: remoteCacheUrl }));\n\t\t\t}\n\t\t\treturn caches;\n\t\t},\n\t\tcacheVersion: process.env.WRN_METRO_CACHE_VERSION,\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nconst BASE_URL = process.env.WHOP_BASE_URL;\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n\tapiOrigin: BASE_URL ? new URL(BASE_URL).origin : undefined,\n});\n\nexport const whopSdk = new Whop({\n\tappID: APP_ID,\n\tbaseURL: BASE_URL ? new URL(\"/api/v1\", BASE_URL).href : undefined,\n});\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t\t\".mjs\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t\t\".mjs\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out!.code!, loader: \"jsx\" };\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAA2B;AAC3B,IAAAC,oBAAiB;AACjB,uBAA0B;AAC1B,IAAAC,kBAAuB;AACvB,6BAAmB;AACnB,oBAAuB;;;ACDhB,SAAS,QAAQ,MAAuB;AAC9C,QAAM,QAAQ,QAAQ,IAAI,IAAI,GAAG,YAAY;AAC7C,SAAO,UAAU,OAAO,UAAU,UAAU,UAAU;AACvD;;;ACPA,IAAAC,kBAAgE;AAChE,IAAAC,mBAAyC;AACzC,IAAAC,oBAAiB;AACjB,0BAA8C;AAC9C,qBAAuB;AACvB,mBAAkB;AAClB,IAAAC,gBAA8D;;;ACN9D,yBAA2B;;;ACA3B,iBAA8B;AAC9B,iBAAiB;AACjB,oBAAuB;AAAA,IAEvB,sBAAO;AAAA,EACN,MAAM,CAAC,QAAQ,cAAc,oBAAoB,iBAAiB;AACnE,CAAC;AAEM,SAAS,IAAI,KAAa;AAChC,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,MAAM,iCAAiC,GAAG,EAAE;AAAA,EACvD;AACA,SAAO;AACR;AAEA,IAAM,WAAW,QAAQ,IAAI;AAEtB,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,SAAS,IAAI,yBAAyB;AAC5C,IAAM,eAAe,QAAQ,IAAI;AAEjC,IAAM,iBAA4B,0BAAc;AAAA,EACtD,WAAW,IAAI,cAAc;AA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CAAC;AACf,CAAC;","names":["import_node_fs","import_node_path","import_find_up","import_node_fs","import_promises","import_node_path","import_metro","Whop","fs","path","import_node_path","path","path","build","JSZip","import_promises","import_node_path","fs","path","fs","path","babel","path","buildAndPublish","build","buildAndPublish","path","qrcode"]}
@@ -11,6 +11,12 @@ import { findUp as findUp2 } from "find-up";
11
11
  import qrcode from "qrcode-terminal";
12
12
  import { rimraf } from "rimraf";
13
13
 
14
+ // src/cli/env-bool.ts
15
+ function envBool(name) {
16
+ const value = process.env[name]?.toLowerCase();
17
+ return value === "1" || value === "true" || value === "yes";
18
+ }
19
+
14
20
  // src/cli/mobile.ts
15
21
  import { existsSync, readFileSync, readdirSync, statSync } from "fs";
16
22
  import { mkdir, rename, writeFile } from "fs/promises";
@@ -128,6 +134,9 @@ async function bundle(root, platform) {
128
134
  platform,
129
135
  "main_js_bundle"
130
136
  );
137
+ const cacheDir = process.env.WRN_METRO_CACHE_DIRECTORY || path3.join(root, "build", "cache");
138
+ const isCacheDisabled = envBool("WRN_DISABLE_METRO_CACHE");
139
+ const remoteCacheUrl = process.env.WRN_REMOTE_METRO_CACHE_URL;
131
140
  await mkdir(path3.dirname(outputFile), { recursive: true });
132
141
  const babelLocation = __require.resolve("@babel/runtime/package");
133
142
  const bableNodeModules = await findUp("node_modules", {
@@ -147,7 +156,19 @@ async function bundle(root, platform) {
147
156
  "./whop-react-native-babel-transformer.js"
148
157
  )
149
158
  },
150
- cacheStores: [],
159
+ cacheStores: ({ FileStore, HttpStore }) => {
160
+ if (isCacheDisabled) return [];
161
+ const caches = [
162
+ new FileStore({
163
+ root: cacheDir
164
+ })
165
+ ];
166
+ if (remoteCacheUrl) {
167
+ caches.push(new HttpStore({ endpoint: remoteCacheUrl }));
168
+ }
169
+ return caches;
170
+ },
171
+ cacheVersion: process.env.WRN_METRO_CACHE_VERSION,
151
172
  watchFolders: [root, path3.resolve(root, "node_modules"), bableNodeModules],
152
173
  reporter: new CustomReporter(),
153
174
  resolver: {
@@ -486,7 +507,8 @@ async function bundleWeb(root) {
486
507
  ".tsx",
487
508
  ".ts",
488
509
  ".jsx",
489
- ".js"
510
+ ".js",
511
+ ".mjs"
490
512
  ],
491
513
  loader: {
492
514
  ".png": "dataurl",
@@ -497,7 +519,8 @@ async function bundleWeb(root) {
497
519
  ".woff": "dataurl",
498
520
  ".woff2": "dataurl",
499
521
  ".js": "jsx",
500
- ".jsx": "jsx"
522
+ ".jsx": "jsx",
523
+ ".mjs": "jsx"
501
524
  },
502
525
  plugins: [
503
526
  forceSingleReact(),
@@ -663,7 +686,11 @@ async function main() {
663
686
  }
664
687
  const root = await getRootProjectDirectory();
665
688
  if (shouldClean) {
666
- await cleanBuildDirectory(root);
689
+ if (envBool("WRN_FULL_CLEAN")) {
690
+ await cleanBuildDirectory(root);
691
+ } else {
692
+ await cleanEntrypointsDirectory(root);
693
+ }
667
694
  }
668
695
  const didProvidePlatform = args.values.ios || args.values.android || args.values.web;
669
696
  const opts = { shouldBuild, shouldUpload };
@@ -686,6 +713,13 @@ async function cleanBuildDirectory(root) {
686
713
  }
687
714
  console.log(" \u2714\uFE0E cleaned build directory");
688
715
  }
716
+ async function cleanEntrypointsDirectory(root) {
717
+ const buildDirectory = path7.join(root, "build", "entrypoints");
718
+ if (existsSync2(buildDirectory)) {
719
+ await rimraf(buildDirectory);
720
+ }
721
+ console.log(" \u2714\uFE0E cleaned build entrypoints directory");
722
+ }
689
723
  async function getRootProjectDirectory() {
690
724
  const file = await findUp2("package.json", { cwd: process.cwd() });
691
725
  if (!file) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tawait cleanBuildDirectory(root);\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: [],\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nconst BASE_URL = process.env.WHOP_BASE_URL;\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n\tapiOrigin: BASE_URL ? new URL(BASE_URL).origin : undefined,\n});\n\nexport const whopSdk = new Whop({\n\tappID: APP_ID,\n\tbaseURL: BASE_URL ? new URL(\"/api/v1\", BASE_URL).href : undefined,\n});\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out!.code!, loader: \"jsx\" };\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;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","path","path","path","build","mkdir","readFile","writeFile","path","fs","path","fs","path","babel","path","readFile","mkdir","writeFile","buildAndPublish","build","buildAndPublish","path","existsSync","findUp"]}
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/env-bool.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { envBool } from \"./env-bool\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tif (envBool(\"WRN_FULL_CLEAN\")) {\n\t\t\tawait cleanBuildDirectory(root);\n\t\t} else {\n\t\t\tawait cleanEntrypointsDirectory(root);\n\t\t}\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function cleanEntrypointsDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\", \"entrypoints\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build entrypoints directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","/**\n * Check if an environment variable is set to a truthy value.\n * Accepts: \"1\", \"true\", \"yes\" (case-insensitive)\n */\nexport function envBool(name: string): boolean {\n\tconst value = process.env[name]?.toLowerCase();\n\treturn value === \"1\" || value === \"true\" || value === \"yes\";\n}\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { envBool } from \"./env-bool\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tconst cacheDir =\n\t\tprocess.env.WRN_METRO_CACHE_DIRECTORY || path.join(root, \"build\", \"cache\");\n\tconst isCacheDisabled = envBool(\"WRN_DISABLE_METRO_CACHE\");\n\tconst remoteCacheUrl = process.env.WRN_REMOTE_METRO_CACHE_URL;\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: ({ FileStore, HttpStore }) => {\n\t\t\tif (isCacheDisabled) return [];\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: types are cooked here\n\t\t\tconst caches: any[] = [\n\t\t\t\tnew FileStore({\n\t\t\t\t\troot: cacheDir,\n\t\t\t\t}),\n\t\t\t];\n\t\t\tif (remoteCacheUrl) {\n\t\t\t\tcaches.push(new HttpStore({ endpoint: remoteCacheUrl }));\n\t\t\t}\n\t\t\treturn caches;\n\t\t},\n\t\tcacheVersion: process.env.WRN_METRO_CACHE_VERSION,\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nconst BASE_URL = process.env.WHOP_BASE_URL;\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n\tapiOrigin: BASE_URL ? new URL(BASE_URL).origin : undefined,\n});\n\nexport const whopSdk = new Whop({\n\tappID: APP_ID,\n\tbaseURL: BASE_URL ? new URL(\"/api/v1\", BASE_URL).href : undefined,\n});\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t\t\".mjs\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t\t\".mjs\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t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BAAmB,MAAM,IAAI,CAAC;AAAA,EAC7C;AAEA,QAAM,QAAQ,IAAI,QAAQ;AAC3B;AAEA,eAAe,oBAAoB,MAAc;AAChD,QAAM,iBAAiBC,MAAK,KAAK,MAAM,OAAO;AAC9C,MAAIC,YAAW,cAAc,GAAG;AAC/B,UAAM,OAAO,cAAc;AAAA,EAC5B;AACA,UAAQ,IAAI,uCAA6B;AAC1C;AAEA,eAAe,0BAA0B,MAAc;AACtD,QAAM,iBAAiBD,MAAK,KAAK,MAAM,SAAS,aAAa;AAC7D,MAAIC,YAAW,cAAc,GAAG;AAC/B,UAAM,OAAO,cAAc;AAAA,EAC5B;AACA,UAAQ,IAAI,mDAAyC;AACtD;AAEA,eAAe,0BAA0B;AACxC,QAAM,OAAO,MAAMC,QAAO,gBAAgB,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC;AAChE,MAAI,CAAC,MAAM;AACV,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,QAAM,OAAOF,MAAK,QAAQ,IAAI;AAC9B,SAAO;AACR;AAEA,eAAe,gBAAgB;AAC9B,QAAM,QAAQ,IAAI,yBAAyB;AAC3C,QAAM,cAAc,yBAAyB,KAAK;AAElD,UAAQ,IAAI;AAAA;AAAA,EAEX,WAAW;AAAA;AAAA;AAAA,EAGX;AAED,SAAO,SAAS,aAAa,EAAE,OAAO,KAAK,CAAC;AAC7C;AAEA,KAAK,EACH,MAAM,CAAC,QAAQ;AACf,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AACf,CAAC,EACA,KAAK,MAAM;AACX,UAAQ,KAAK,CAAC;AACf,CAAC;","names":["existsSync","path","findUp","path","path","path","build","mkdir","readFile","writeFile","path","fs","path","fs","path","babel","path","readFile","mkdir","writeFile","buildAndPublish","build","buildAndPublish","path","existsSync","findUp"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whop/react-native",
3
3
  "description": "React Native SDK for building embedded apps on Whop",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/whopio/whop-sdk-ts",