feat(publish): auto-localize Leaflet CDN to platform assets
Memind CI / Test, build, and release guards (push) Failing after 3m57s

Ship Leaflet 1.9.4 under public/assets/leaflet and rewrite common CDN script/stylesheet URLs during publish and public HTML delivery, matching the existing Chart.js guard pattern.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-25 16:05:50 +08:00
parent 9332bacabd
commit 1ec971515b
14 changed files with 796 additions and 9 deletions
+4
View File
@@ -9,9 +9,13 @@ const SCRIPT_SRC_PATTERN = /\bsrc\s*=\s*(['"])([^'"]+)\1/i;
const TRUSTED_SCRIPT_SRC_PATTERNS = [
/^\/assets\/page-data-client\.js(?:[?#].*)?$/i,
/^\/assets\/chart\.umd\.min\.js(?:[?#].*)?$/i,
/^\/assets\/leaflet\/leaflet\.js(?:[?#].*)?$/i,
/^https:\/\/cdn\.jsdelivr\.net\/npm\/chart\.js(?:@[^/]+)?\/dist\/chart\.(?:umd\.)?min\.js(?:[?#].*)?$/i,
/^https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs\/Chart\.js\/[^/]+\/chart\.(?:umd\.)?min\.js(?:[?#].*)?$/i,
/^https:\/\/unpkg\.com\/chart\.js(?:@[^/]+)?\/dist\/chart\.(?:umd\.)?min\.js(?:[?#].*)?$/i,
/^https:\/\/cdn\.jsdelivr\.net\/npm\/leaflet(?:@[^/]+)?\/dist\/leaflet\.js(?:[?#].*)?$/i,
/^https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs\/leaflet\/[^/]+\/leaflet\.js(?:[?#].*)?$/i,
/^https:\/\/unpkg\.com\/leaflet(?:@[^/]+)?\/dist\/leaflet\.js(?:[?#].*)?$/i,
];
const MAX_ZIP_COMPRESSION_RATIO = 100;