@tscircuit/fake-snippets 0.0.90 → 0.0.91

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.
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input"
8
8
  import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
9
9
  import { useAxios } from "@/hooks/use-axios"
10
10
  import { useGlobalStore } from "@/hooks/use-global-store"
11
- import { useSnippetsBaseApiUrl } from "@/hooks/use-snippets-base-api-url"
11
+ import { usePackagesBaseApiUrl } from "@/hooks/use-packages-base-api-url"
12
12
  import { GitHubLogoIcon } from "@radix-ui/react-icons"
13
13
  import type { Package } from "fake-snippets-api/lib/db/schema"
14
14
  import type React from "react"
@@ -95,7 +95,7 @@ export const UserProfilePage = () => {
95
95
  },
96
96
  )
97
97
 
98
- const baseUrl = useSnippetsBaseApiUrl()
98
+ const baseUrl = usePackagesBaseApiUrl()
99
99
 
100
100
  if (accountError) {
101
101
  return <NotFoundPage heading="User Not Found" />
package/vite.config.ts CHANGED
@@ -3,7 +3,6 @@ import { defineConfig, Plugin, UserConfig } from "vite"
3
3
  import type { PluginOption } from "vite"
4
4
  import path, { extname } from "path"
5
5
  import { readFileSync } from "fs"
6
- import { execSync } from "child_process"
7
6
  import react from "@vitejs/plugin-react"
8
7
  import { ViteImageOptimizer } from "vite-plugin-image-optimizer"
9
8
  import { getNodeHandler } from "winterspec/adapters/node"
@@ -119,23 +118,6 @@ function vercelSsrDevPlugin(): Plugin {
119
118
  }
120
119
  }
121
120
 
122
- function buildIdPlugin(): Plugin {
123
- return {
124
- name: "build-id",
125
- transformIndexHtml(html) {
126
- try {
127
- const hash = execSync("git rev-parse --short HEAD").toString().trim()
128
- return html.replace(
129
- /<\/head>/i,
130
- ` <meta name="tscircuit-build" content="${hash}"></head>`,
131
- )
132
- } catch {
133
- return html
134
- }
135
- },
136
- }
137
- }
138
-
139
121
  export default defineConfig(async (): Promise<UserConfig> => {
140
122
  let proxyConfig: Record<string, any> | undefined
141
123
 
@@ -169,7 +151,6 @@ export default defineConfig(async (): Promise<UserConfig> => {
169
151
  },
170
152
  }),
171
153
  vercelSsrDevPlugin(),
172
- buildIdPlugin(),
173
154
  ]
174
155
 
175
156
  if (process.env.VITE_BUNDLE_ANALYZE === "true" || 1) {
@@ -1,52 +0,0 @@
1
- import { toast } from "sonner"
2
-
3
- export function setupBuildWatcher() {
4
- const meta = document.querySelector<HTMLMetaElement>(
5
- 'meta[name="tscircuit-build"]',
6
- )
7
- const currentId = meta?.content || ""
8
- ;(window as any).TSC_BUILD_ID = currentId
9
-
10
- async function fetchBuildId(): Promise<string | null> {
11
- try {
12
- const res = await fetch("/api/generated-index", { cache: "no-store" })
13
- const text = await res.text()
14
- const match = text.match(
15
- /<meta name="tscircuit-build" content="([^"]+)"/i,
16
- )
17
- return match ? match[1] : null
18
- } catch (err) {
19
- console.error("Failed to fetch build identifier", err)
20
- return null
21
- }
22
- }
23
-
24
- let updateToastShown = false
25
-
26
- async function checkForUpdate() {
27
- const serverId = await fetchBuildId()
28
- if (
29
- serverId &&
30
- serverId !== (window as any).TSC_BUILD_ID &&
31
- !updateToastShown
32
- ) {
33
- updateToastShown = true
34
- toast("A new version of tscircuit.com is available.", {
35
- action: {
36
- label: "Reload",
37
- onClick: () => window.location.reload(),
38
- },
39
- duration: Infinity,
40
- position: "bottom-left",
41
- })
42
- }
43
- }
44
-
45
- document.addEventListener("visibilitychange", () => {
46
- if (document.visibilityState === "visible") {
47
- checkForUpdate()
48
- }
49
- })
50
-
51
- setInterval(checkForUpdate, 5 * 60 * 1000)
52
- }
package/src/global.d.ts DELETED
@@ -1,3 +0,0 @@
1
- interface Window {
2
- TSC_BUILD_ID?: string
3
- }