@whop/cli 0.16.1 → 0.16.3

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.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * What `@tanstack/*-devtools` resolves to under `whop({ disableTanstackDevtools:
3
+ * true })`.
4
+ *
5
+ * The TanStack scaffold mounts `<TanStackDevtools>` in `__root.tsx`, which puts a
6
+ * floating panel trigger over every page. On a developer's own machine that is
7
+ * the point; on a site being watched by the person it is being built for, the
8
+ * control belongs to nobody.
9
+ *
10
+ * Aliased rather than edited out of `__root.tsx`: the app's components stay
11
+ * exactly as their author wrote them, and there is no JSX rewriting to get wrong.
12
+ * What the project does carry is the one flag that asks for this, so the missing
13
+ * panel is explained by the config rather than by the environment.
14
+ */
15
+ declare function nothing(): null;
16
+ declare const TanStackDevtools: typeof nothing;
17
+ declare const TanStackRouterDevtools: typeof nothing;
18
+ declare const TanStackRouterDevtoolsPanel: typeof nothing;
19
+ declare const ReactQueryDevtools: typeof nothing;
20
+ declare const ReactQueryDevtoolsPanel: typeof nothing;
21
+
22
+ export { ReactQueryDevtools, ReactQueryDevtoolsPanel, TanStackDevtools, TanStackRouterDevtools, TanStackRouterDevtoolsPanel, nothing as default };
@@ -0,0 +1,19 @@
1
+ // src/vite-devtools-stub.ts
2
+ function nothing() {
3
+ return null;
4
+ }
5
+ var TanStackDevtools = nothing;
6
+ var TanStackRouterDevtools = nothing;
7
+ var TanStackRouterDevtoolsPanel = nothing;
8
+ var ReactQueryDevtools = nothing;
9
+ var ReactQueryDevtoolsPanel = nothing;
10
+ var vite_devtools_stub_default = nothing;
11
+ export {
12
+ ReactQueryDevtools,
13
+ ReactQueryDevtoolsPanel,
14
+ TanStackDevtools,
15
+ TanStackRouterDevtools,
16
+ TanStackRouterDevtoolsPanel,
17
+ vite_devtools_stub_default as default
18
+ };
19
+ //# sourceMappingURL=vite-devtools-stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-devtools-stub.ts"],"sourcesContent":["/**\n * What `@tanstack/*-devtools` resolves to under `whop({ disableTanstackDevtools:\n * true })`.\n *\n * The TanStack scaffold mounts `<TanStackDevtools>` in `__root.tsx`, which puts a\n * floating panel trigger over every page. On a developer's own machine that is\n * the point; on a site being watched by the person it is being built for, the\n * control belongs to nobody.\n *\n * Aliased rather than edited out of `__root.tsx`: the app's components stay\n * exactly as their author wrote them, and there is no JSX rewriting to get wrong.\n * What the project does carry is the one flag that asks for this, so the missing\n * panel is explained by the config rather than by the environment.\n */\n\nfunction nothing(): null {\n\treturn null;\n}\n\nexport const TanStackDevtools = nothing;\nexport const TanStackRouterDevtools = nothing;\nexport const TanStackRouterDevtoolsPanel = nothing;\nexport const ReactQueryDevtools = nothing;\nexport const ReactQueryDevtoolsPanel = nothing;\n\nexport default nothing;\n"],"mappings":";AAeA,SAAS,UAAgB;AACxB,SAAO;AACR;AAEO,IAAM,mBAAmB;AACzB,IAAM,yBAAyB;AAC/B,IAAM,8BAA8B;AACpC,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAEvC,IAAO,6BAAQ;","names":[]}
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,20 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
- declare function whop(): Plugin[];
3
+ type WhopOptions = {
4
+ /**
5
+ * Resolve `@tanstack/*-devtools` to a stub, so the floating devtools panel
6
+ * never renders.
7
+ *
8
+ * Set by `whop apps init` on the projects Whop builds, where the page is
9
+ * watched by the person the site is being built for and a developer panel
10
+ * belongs to nobody. Delete it — or set it to false — to get them back.
11
+ *
12
+ * Deliberately a flag in the project rather than something inferred from the
13
+ * environment: whoever wonders where the devtools went finds the answer in the
14
+ * config they are already reading, and turning them on is one word.
15
+ */
16
+ disableTanstackDevtools?: boolean;
17
+ };
18
+ declare function whop(options?: WhopOptions): Plugin[];
4
19
 
5
- export { whop as default, whop };
20
+ export { type WhopOptions, whop as default, whop };
package/dist/vite.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  writeFileSync
10
10
  } from "fs";
11
11
  import { basename, join, relative, sep } from "path";
12
+ import { fileURLToPath } from "url";
12
13
 
13
14
  // ../../node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/index.mjs
14
15
  import { createRequire } from "module";
@@ -724,6 +725,7 @@ function zipSync(data, opts) {
724
725
  }
725
726
 
726
727
  // src/vite.ts
728
+ import { version as viteVersion } from "vite";
727
729
  var OUTPUT_ZIP = "whop-build.zip";
728
730
  var ALWAYS_IGNORED = /* @__PURE__ */ new Set([".DS_Store", ".assetsignore"]);
729
731
  var SERVER_IGNORED = /* @__PURE__ */ new Set(["wrangler.json"]);
@@ -788,7 +790,18 @@ function pack(distDir) {
788
790
  `[whop] packed ${client.length + server.length} files \u2192 dist/${OUTPUT_ZIP} (sha256 ${checksum.slice(0, 12)}\u2026)`
789
791
  );
790
792
  }
791
- function whopDevServer() {
793
+ var DEVTOOLS_PACKAGES = [
794
+ "@tanstack/react-devtools",
795
+ "@tanstack/react-router-devtools",
796
+ "@tanstack/react-query-devtools"
797
+ ];
798
+ function devtoolsAliases() {
799
+ const stub = fileURLToPath(
800
+ new URL("./vite-devtools-stub.js", import.meta.url)
801
+ );
802
+ return Object.fromEntries(DEVTOOLS_PACKAGES.map((name) => [name, stub]));
803
+ }
804
+ function whopDevServer(options) {
792
805
  return {
793
806
  name: "whop-dev-server",
794
807
  apply: "serve",
@@ -796,6 +809,7 @@ function whopDevServer() {
796
809
  const port = Number(process.env.WHOP_DEV_PORT);
797
810
  const publicOrigin = process.env.WHOP_DEV_PUBLIC_ORIGIN;
798
811
  const server = {};
812
+ const hmr = {};
799
813
  if (Number.isFinite(port) && port > 0) {
800
814
  server.port = port;
801
815
  server.strictPort = true;
@@ -810,14 +824,25 @@ function whopDevServer() {
810
824
  }
811
825
  if (parsed) {
812
826
  server.allowedHosts = [parsed.hostname];
813
- server.hmr = {
827
+ const connection = {
814
828
  protocol: parsed.protocol === "https:" ? "wss" : "ws",
815
829
  host: parsed.hostname,
816
830
  clientPort: parsed.port ? Number(parsed.port) : parsed.protocol === "https:" ? 443 : 80
817
831
  };
832
+ if (Number.parseInt(viteVersion, 10) >= 8) {
833
+ server.ws = connection;
834
+ } else {
835
+ Object.assign(hmr, connection);
836
+ }
837
+ hmr.overlay = false;
838
+ server.hmr = hmr;
818
839
  }
819
840
  }
820
- return Object.keys(server).length > 0 ? { server } : {};
841
+ const resolve = options.disableTanstackDevtools ? { alias: devtoolsAliases() } : void 0;
842
+ return {
843
+ ...Object.keys(server).length > 0 ? { server } : {},
844
+ ...resolve ? { resolve } : {}
845
+ };
821
846
  }
822
847
  };
823
848
  }
@@ -836,8 +861,8 @@ function whopPack() {
836
861
  }
837
862
  };
838
863
  }
839
- function whop() {
840
- return [whopDevServer(), whopPack()];
864
+ function whop(options = {}) {
865
+ return [whopDevServer(options), whopPack()];
841
866
  }
842
867
  var vite_default = whop;
843
868
  export {