@tscircuit/fake-snippets 0.0.25 → 0.0.26
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/api/generated-index.js +8 -1
- package/dist/bundle.js +7 -1
- package/fake-snippets-api/routes/api/package_releases/create.ts +8 -0
- package/package.json +1 -1
- package/src/App.tsx +2 -0
- package/src/components/OptimizedImage.tsx +8 -4
- package/src/hooks/use-create-package-files-mutation.ts +76 -0
- package/src/hooks/use-create-package-mutation.ts +60 -0
- package/src/hooks/use-create-package-release-mutation.ts +57 -0
- package/src/hooks/use-fork-package-mutation.ts +103 -0
- package/src/hooks/use-package-by-package-id.ts +23 -0
- package/src/hooks/use-package-by-package-name.ts +23 -0
- package/src/hooks/use-package-files.ts +84 -0
- package/src/hooks/use-package-release.ts +51 -0
- package/src/pages/beta.tsx +184 -0
package/api/generated-index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// api/generated-index.js
|
|
1
2
|
import ky from "ky"
|
|
2
3
|
import { readFileSync } from "fs"
|
|
3
4
|
import { join, dirname } from "path"
|
|
@@ -10,7 +11,7 @@ const __dirname = dirname(__filename)
|
|
|
10
11
|
const normalIndexFile = join(__dirname, "../dist/index.html")
|
|
11
12
|
const htmlContent = readFileSync(normalIndexFile, "utf-8")
|
|
12
13
|
|
|
13
|
-
const cacheControlHeader = "public, max-age=
|
|
14
|
+
const cacheControlHeader = "public, max-age=0, must-revalidate"
|
|
14
15
|
|
|
15
16
|
function getHtmlWithModifiedSeoTags({
|
|
16
17
|
title,
|
|
@@ -77,6 +78,8 @@ async function handleCustomPackageHtml(req, res) {
|
|
|
77
78
|
|
|
78
79
|
res.setHeader("Content-Type", "text/html; charset=utf-8")
|
|
79
80
|
res.setHeader("Cache-Control", cacheControlHeader)
|
|
81
|
+
// Add ETag support for better caching
|
|
82
|
+
res.setHeader("Vary", "Accept-Encoding")
|
|
80
83
|
res.status(200).send(html)
|
|
81
84
|
}
|
|
82
85
|
|
|
@@ -97,6 +100,8 @@ async function handleCustomPage(req, res) {
|
|
|
97
100
|
|
|
98
101
|
res.setHeader("Content-Type", "text/html; charset=utf-8")
|
|
99
102
|
res.setHeader("Cache-Control", cacheControlHeader)
|
|
103
|
+
// Add ETag support for better caching
|
|
104
|
+
res.setHeader("Vary", "Accept-Encoding")
|
|
100
105
|
res.status(200).send(html)
|
|
101
106
|
}
|
|
102
107
|
|
|
@@ -117,5 +122,7 @@ export default async function handler(req, res) {
|
|
|
117
122
|
|
|
118
123
|
res.setHeader("Content-Type", "text/html; charset=utf-8")
|
|
119
124
|
res.setHeader("Cache-Control", cacheControlHeader)
|
|
125
|
+
// Add ETag support for better caching
|
|
126
|
+
res.setHeader("Vary", "Accept-Encoding")
|
|
120
127
|
res.status(200).send(htmlContent)
|
|
121
128
|
}
|