GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode/packages/app/vite.pwa.ts at dev · drpr/opencode

Expand file tree

/

vite.pwa.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
56 lines (53 loc) · 2.44 KB
/

vite.pwa.ts

Copy path

File metadata and controls

56 lines (53 loc) · 2.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { createHash } from "node:crypto"
import { readFile } from "node:fs/promises"
import { resolve } from "node:path"
import { VitePWA } from "vite-plugin-pwa"
// The Office previews' engines and fonts (about 52 MB) load only when an Office file opens, so they stay out of the
// precache. The app's own fonts have no hyphenated name, such as `assets/Inter.ttf`.
const officeAsset =
/(?:^|\/)(?:(?:docx_\w+|ooxml_opc|pptx_wasm|xlsx_wasm)_bg-[\w-]+\.wasm|residentEngineWorker-[\w-]+\.js|(?:Carlito|Caladea|LiberationSans|LiberationSerif|LiberationMono|NotoSansArabic|NotoNaskhArabic|NotoSansHebrew|Gelasio|ComicRelief|Inter|Roboto|SourceSans3|DMSans|DMSerifDisplay|OpenSans|Montserrat|Poppins|Oswald|Heebo)-[\w-]+\.ttf)$/
/** Whether a built file loads on demand instead of being precached. */
export function onDemandAsset(path: string) {
return officeAsset.test(path)
}
export function serviceWorker(directory: string) {
return VitePWA({
strategies: "generateSW",
registerType: "prompt",
injectRegister: false,
manifest: false,
workbox: {
// Workbox runs after Sentry's upload and cleanup, so do not publish an unuploaded map.
sourcemap: false,
globDirectory: directory,
clientsClaim: false,
// Keep each open tab on its complete build until all old clients close.
skipWaiting: false,
inlineWorkboxRuntime: true,
navigateFallback: "/index.html",
// Pairing links must reach the server so it can set the session cookie.
navigateFallbackDenylist: [/^\/(?:api|auth)(?:\/|$)/, /^\/(?:_assets|assets)(?:\/|$)/],
// Include lazy chunks and non-JS dependencies, not just the startup bundle.
globPatterns: ["**/*"],
globIgnores: ["**/*.map", "_headers", "_redirects"],
maximumFileSizeToCacheInBytes: Number.MAX_SAFE_INTEGER,
manifestTransforms: [
async (entries) => ({
manifest: await Promise.all(
entries
.filter((entry) => !onDemandAsset(entry.url))
.map(async (entry) => ({
...entry,
// A revision labels a cache entry; integrity rejects mixed deployments
// and HTML fallback responses instead of installing a broken build.
integrity: `sha256-${createHash("sha256")
.update(await readFile(resolve(directory, entry.url)))
.digest("base64")}`,
})),
),
warnings: [],
}),
],
},
})
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.