import type { ServiceWorkerConfig } from 'janux'; /** The worker's URL. Root of the output, so its scope is the whole site. */ export declare const SERVICE_WORKER_FILE = "sw.js"; /** * Every file in the built client worth precaching, as the URL paths a page * requests them by — sorted, so the version below is a function of the output * and not of the order the filesystem happened to answer in. */ export declare function serviceWorkerAssets(outDir: string): string[]; /** * This build's id: a hash of every precached file's name AND bytes. * * Names alone would be tempting — they carry content hashes already — but * `public/` files and `/styles.css` do not, so an app whose only change was an * image would ship a new build under the old version and every visitor would * keep the old copy forever. Bytes make the version mean what it claims. */ export declare function serviceWorkerVersion(outDir: string, assets: string[]): string; /** * The URL `janux start` registers, or nothing. * * Nothing has three causes, all of them ordinary: the app has no `src/sw.ts`, * the app has one but has not been built yet, or the app asked to register the * worker itself (`serviceWorker: { register: false }`) — in which case the file * is still built and served, and only the automatic sign-up is withheld. */ /** * Deletes a worker the app no longer has a `src/sw.ts` for. Returns whether * there was one. * * Deleting the source has to be enough to be rid of it. A build that only ever * *adds* would keep serving and registering the last one — and a worker still * running because nobody swept the output directory is exactly the surprise * this feature is careful about. It is also how a browser retires a worker it * already installed: the update check 404s, and the registration goes. */ export declare function retireServiceWorker(outDir: string): boolean; export declare function builtServiceWorker(outDir: string, config: ServiceWorkerConfig | undefined): string | undefined;