From d078e43325eb0b5c275ca3556fcbf2209be8dd8c Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Thu, 23 Jan 2025 00:13:46 -0800 Subject: [PATCH] Add support for `engine_files` `lastmod` metadata Apropos https://github.com/curiousdannii/parchment/issues/177 --- src/common/file/browser.ts | 4 ++++ src/common/file/interface.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/file/browser.ts b/src/common/file/browser.ts index 529f7a3..f03ddbb 100644 --- a/src/common/file/browser.ts +++ b/src/common/file/browser.ts @@ -55,6 +55,10 @@ async function fetch_resource_inner(options: DownloadOptions, path: string, prog let url: URL | string try { url = new URL(path, lib_path) + const lastmod = options.engine_files?.[path] + if (lastmod) { + url.searchParams.set('lastmod', lastmod) + } } catch { url = lib_path + path diff --git a/src/common/file/interface.ts b/src/common/file/interface.ts index ea49e68..464e344 100644 --- a/src/common/file/interface.ts +++ b/src/common/file/interface.ts @@ -25,4 +25,5 @@ export interface DownloadOptions { /** Use the file proxy; if disabled may mean that some files can't be loaded */ // We could just say to exclude proxy_url instead? use_proxy?: boolean | number, -} \ No newline at end of file + engine_files?: {[key: string]: string}, +}