From d3893dff7602e0f27b4fa13fa805efe437dc5dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lipinsk=C3=BD?= <6032558+Mr-Tao@users.noreply.github.com> Date: Sat, 29 Aug 2026 19:50:46 +0200 Subject: [PATCH] chore(player): tighten shim dependency handling --- .github/codeql-config-js.yml | 9 +- .../browser_compatibility_test.go | 9 +- pkg/service/soundtouchweb/static/index.html | 8 +- .../static/lib/LICENSES/README.md | 15 ++ .../lib/LICENSES/es-module-shims-LICENSE | 10 + .../static/lib/LICENSES/htm-LICENSE | 202 ++++++++++++++++++ .../static/lib/LICENSES/package-lock.json | 49 +++++ .../static/lib/LICENSES/preact-LICENSE | 21 ++ .../static_compatibility_test.go | 25 ++- scripts/update-static-deps.sh | 23 +- 10 files changed, 339 insertions(+), 32 deletions(-) create mode 100644 pkg/service/soundtouchweb/static/lib/LICENSES/README.md create mode 100644 pkg/service/soundtouchweb/static/lib/LICENSES/es-module-shims-LICENSE create mode 100644 pkg/service/soundtouchweb/static/lib/LICENSES/htm-LICENSE create mode 100644 pkg/service/soundtouchweb/static/lib/LICENSES/package-lock.json create mode 100644 pkg/service/soundtouchweb/static/lib/LICENSES/preact-LICENSE diff --git a/.github/codeql-config-js.yml b/.github/codeql-config-js.yml index 47d5a0f8..ef5c8572 100644 --- a/.github/codeql-config-js.yml +++ b/.github/codeql-config-js.yml @@ -12,8 +12,7 @@ queries: # Paths to exclude from analysis paths-ignore: - "**/node_modules/**" - # Vendored third-party libraries (preact, htm, es-module-shims), copied - # verbatim from npm by scripts/update-static-deps.sh. We don't modify or - # control their internals, so findings here aren't actionable from this - # repo -- report upstream instead. - - "pkg/service/soundtouchweb/static/lib/**" + # The minified es-module-shims distribution currently triggers findings in + # third-party code. Keep this exception file-specific so Preact, HTM, and + # future files under static/lib remain covered. + - "pkg/service/soundtouchweb/static/lib/es-module-shims.js" diff --git a/pkg/service/soundtouchweb/browser_compatibility_test.go b/pkg/service/soundtouchweb/browser_compatibility_test.go index 6e336b17..5ea05f5b 100644 --- a/pkg/service/soundtouchweb/browser_compatibility_test.go +++ b/pkg/service/soundtouchweb/browser_compatibility_test.go @@ -74,10 +74,11 @@ func TestPlayerRendersNatively(t *testing.T) { } } -// TestPlayerRendersUnderForcedShimMode exercises the actual old-Safari code -// path -- es-module-shims resolving the same import map and vendored files -// the real app uses -- without needing physical iPadOS 15 hardware. It -// serves a variant of index.html that forces es-module-shims into shimMode +// TestPlayerRendersUnderForcedShimMode exercises es-module-shims resolving the +// same import map and vendored files the real app uses. It does not emulate +// Safari or the production feature-detection loader; those require a target- +// browser canary. The test serves a page that forces es-module-shims into +// shimMode // (see the library's README: shimMode is triggered by // window.esmsInitOptions.shimMode or by using importmap-shim/module-shim // script types), which routes every browser -- including this ordinary diff --git a/pkg/service/soundtouchweb/static/index.html b/pkg/service/soundtouchweb/static/index.html index 94f80daf..9ddef7a2 100644 --- a/pkg/service/soundtouchweb/static/index.html +++ b/pkg/service/soundtouchweb/static/index.html @@ -17,10 +17,10 @@ that already support import maps natively. Feature-detect instead, so only a browser that actually lacks support ever fetches it. Inserted via the DOM rather than document.write (deprecated, and - subject to browser interventions that can silently drop it), with - async explicitly set to false so it still executes before the - deferred `type="module"` script below runs, without blocking the - parser for the vast majority that never reach this branch. + subject to browser interventions that can silently drop it). + After initialization, es-module-shims inspects module graphs that fail + static linking, so browsers without import maps can resolve the bare + imports below without penalizing native-capable ones. -->