Six entries hand-rolled the RTL text plugin; the library already installs it
Every one of these bundle entries carried its own copy of
if (window.mapboxgl?.setRTLTextPlugin) { setRTLTextPlugin(url, null, true) }
which is a strict SUBSET of what library/maps/rtl-text.js already does, so the
copies could not be covering anything the library misses:
- useMapInstance calls installRtlTextPlugin(gl) at line 450, before it builds a
map at 537/567 -- registration still precedes construction, the one ordering
Mapbox cares about.
- the call is identical in effect: same v0.3.0 URL, same null callback, same
lazy flag.
- the block is mapboxgl-only. The library installs on MapLibre too, so every
keyless embed was covered by the library and never by these blocks.
- the single raw `new gl.Map` site (upg-100-list.vue:1894) installs for itself
at 1835 and never depended on its entry.
I first justified this as deleting DEAD code, on the theory that the engine is
injected lazily so window.mapboxgl would not exist when an entry runs. That is
wrong and the measurement says so: every leaf index.html loads mapbox-gl.js as a
blocking <head> script while ./index.js is a deferred module, so the guard did
pass and the blocks were live. The reason to delete them is redundancy, which is
the weaker and truer claim.
A three-line pointer replaces each block so the next reader does not re-add a
Mapbox-only copy.
This commit is contained in:
parent
0f52e9ef08
commit
1c63481832
6 changed files with 18 additions and 68 deletions
|
|
@ -42,18 +42,9 @@ const profileModules = import.meta.glob('./*.vue')
|
|||
// where _registry.js discovers them for every bundle, and src/colors/ holds no .js at all. The glob
|
||||
// matched nothing, so leaving it would be dead code that reads as a deliberate override.
|
||||
|
||||
// ─── Mapbox RTL text plugin — load ONCE before any map instance ──────────────
|
||||
if (typeof window !== 'undefined' && window.mapboxgl?.setRTLTextPlugin) {
|
||||
try {
|
||||
window.mapboxgl.setRTLTextPlugin(
|
||||
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js',
|
||||
null,
|
||||
true // lazy
|
||||
)
|
||||
} catch (_) {
|
||||
// Plugin already set in this session — ignore.
|
||||
}
|
||||
}
|
||||
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
|
||||
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
|
||||
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
|
||||
|
||||
/**
|
||||
* Each instance gets its own Pinia + i18n so multiple embeds on one page never
|
||||
|
|
|
|||
|
|
@ -32,18 +32,9 @@ const profileModules = import.meta.glob('./*.vue')
|
|||
// where _registry.js discovers them for every bundle, and src/colors/ holds no .js at all. The glob
|
||||
// matched nothing, so leaving it would be dead code that reads as a deliberate override.
|
||||
|
||||
// ─── Mapbox RTL text plugin — load ONCE before any map instance ──────────────
|
||||
if (typeof window !== 'undefined' && window.mapboxgl?.setRTLTextPlugin) {
|
||||
try {
|
||||
window.mapboxgl.setRTLTextPlugin(
|
||||
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js',
|
||||
null,
|
||||
true // lazy
|
||||
)
|
||||
} catch (_) {
|
||||
// Already set in this session — ignore.
|
||||
}
|
||||
}
|
||||
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
|
||||
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
|
||||
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
|
||||
|
||||
/**
|
||||
* Build a fresh defineCustomElement-wrapped class. Each instance gets its own
|
||||
|
|
|
|||
|
|
@ -48,20 +48,9 @@ const profileModules = import.meta.glob('./*.vue')
|
|||
// No-op today: doxa-simple-map ships no local strategies (empty glob).
|
||||
registerStrategies(import.meta.glob('./src/colors/*.js', { eager: true }))
|
||||
|
||||
// ─── Mapbox RTL text plugin — load ONCE before any map instance ──────────────
|
||||
// Required for proper rendering of Arabic text on the basemap.
|
||||
// Lazy = plugin loads only when RTL text is first encountered.
|
||||
if (typeof window !== 'undefined' && window.mapboxgl?.setRTLTextPlugin) {
|
||||
try {
|
||||
window.mapboxgl.setRTLTextPlugin(
|
||||
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js',
|
||||
null,
|
||||
true // lazy
|
||||
)
|
||||
} catch (_) {
|
||||
// Plugin already set in this session — ignore.
|
||||
}
|
||||
}
|
||||
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
|
||||
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
|
||||
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
|
||||
|
||||
/**
|
||||
* Build a fresh defineCustomElement-wrapped class.
|
||||
|
|
|
|||
|
|
@ -38,20 +38,9 @@ import { createAppI18n } from '@map/i18n/index.js'
|
|||
// app.provide('profileModules', ...) below.
|
||||
const profileModules = import.meta.glob('./*.vue')
|
||||
|
||||
// ─── Mapbox RTL text plugin — load ONCE before any map instance ──────────────
|
||||
// Required for proper rendering of Arabic text on the basemap.
|
||||
// Lazy = plugin loads only when RTL text is first encountered.
|
||||
if (typeof window !== 'undefined' && window.mapboxgl?.setRTLTextPlugin) {
|
||||
try {
|
||||
window.mapboxgl.setRTLTextPlugin(
|
||||
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js',
|
||||
null,
|
||||
true // lazy
|
||||
)
|
||||
} catch (_) {
|
||||
// Plugin already set in this session — ignore.
|
||||
}
|
||||
}
|
||||
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
|
||||
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
|
||||
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
|
||||
|
||||
/**
|
||||
* Build the defineCustomElement-wrapped class for this bundle.
|
||||
|
|
|
|||
|
|
@ -12,14 +12,9 @@ import { createAppI18n } from '@map/i18n/index.js'
|
|||
|
||||
const profileModules = import.meta.glob('./*.vue')
|
||||
|
||||
if (typeof window !== 'undefined' && window.mapboxgl?.setRTLTextPlugin) {
|
||||
try {
|
||||
window.mapboxgl.setRTLTextPlugin(
|
||||
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js',
|
||||
null, true
|
||||
)
|
||||
} catch (_) { /* already set this session */ }
|
||||
}
|
||||
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
|
||||
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
|
||||
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
|
||||
|
||||
const El = defineCustomElement(ProfileLoader, {
|
||||
configureApp(app) {
|
||||
|
|
|
|||
|
|
@ -14,14 +14,9 @@ import { createAppI18n } from '@map/i18n/index.js'
|
|||
|
||||
const profileModules = import.meta.glob('./*.vue')
|
||||
|
||||
if (typeof window !== 'undefined' && window.mapboxgl?.setRTLTextPlugin) {
|
||||
try {
|
||||
window.mapboxgl.setRTLTextPlugin(
|
||||
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.3.0/mapbox-gl-rtl-text.js',
|
||||
null, true
|
||||
)
|
||||
} catch (_) { /* already set this session */ }
|
||||
}
|
||||
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
|
||||
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
|
||||
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
|
||||
|
||||
const El = defineCustomElement(ProfileLoader, {
|
||||
configureApp(app) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue