Repository navigation
feat(pwa): open and export offline; installable app - #1857
Merged
Merged
Conversation
A service worker (public/sw.js) precaches the static export, using a list and version hash that scripts/build-sw-manifest.mjs writes into the built sw.js, and keeps the FFmpeg cores from jsDelivr in their own cache the first time they download (still SRI-checked). Pages come from the network first and from the cache offline, with the headers they were served with, so isolation and the multi-threaded engine behave as online. The footer says when the editor works offline, which needs every file of the engine this page loads; a new version shows a Reload notice and never reloads by itself. A web app manifest and icons make it installable. sw.js is served with no-cache on every host.
✅ Deploy Preview for reframe-os ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
# Conflicts: # docs/DATADOG.md # src/lib/featureTelemetry.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 5, item 8: offline support and installing as an app. There are no new dependencies.
What users get
How it works
public/sw.jsis hand-written.ignoreSearchhandles Next's?_rsc=page data.@ffmpeg/core@/core-mt@on jsDelivr): cache-first in their own cache, filled the first time they download. They're CORS responses, so the worker's SRI checks still apply.blob:URLs and never reach the worker.scripts/build-sw-manifest.mjsruns at the end ofbun run build. It writes the list and a content hash intoout/sw.jsin place of a placeholder. Every deploy that changes the site therefore changessw.js, which is how browsers detect updates. Activating removes old app caches. Source maps,_headersandsw.jsare excluded.ffmpeg-core.worker.jsfor the multi-threaded core. The e2e test caught an earlier version that reported ready on the.wasmalone; the multi-threaded engine then failed offline because its worker script hadn't been cached yet.src/lib/engineUrls.ts, shared by the engine worker and the offline check. A unit test checks thatsw.jsroutes every one of them to the engine cache./sw.jsis served withCache-Control: no-cacheinnetlify.toml,public/_headersandvercel.json. The COOP/COEP rules are unchanged.Storage and memory
Telemetry
pwa(installed, offline_ready once per browser, update). Documented indocs/DATADOG.md.Tests
serviceWorker.test.ts):sw.js.sw.jsrouting (engine, page, asset, network) and page lookup.deployConfig.test.ts): updated for the shared engine URL module.test/e2e/offline.spec.tsruns on both projects:navigator.onLineis false, andcrossOriginIsolatedis the same as online (true on the isolated server).Docs
docs/USAGE.md: new "Offline and installing" section.docs/DEPLOYMENT.md: new "Offline support" section.