maplibre-gl 6.0.0-7 → 6.0.0-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/README.md +0 -2
  2. package/build/banner.ts +4 -2
  3. package/build/generate-docs.ts +28 -12
  4. package/build/generate-struct-arrays.ts +6 -6
  5. package/build/generate-style-code.ts +1 -1
  6. package/build/readme.md +1 -1
  7. package/dist/maplibre-gl-dev.mjs +1909 -1782
  8. package/dist/maplibre-gl-dev.mjs.map +1 -1
  9. package/dist/maplibre-gl-worker-dev.mjs +1633 -1581
  10. package/dist/maplibre-gl-worker-dev.mjs.map +1 -1
  11. package/dist/maplibre-gl-worker.mjs +2 -2
  12. package/dist/maplibre-gl-worker.mjs.map +1 -1
  13. package/dist/maplibre-gl.d.ts +10660 -10445
  14. package/dist/maplibre-gl.mjs +35 -35
  15. package/dist/maplibre-gl.mjs.map +1 -1
  16. package/package.json +14 -14
  17. package/src/data/array_types.g.ts +137 -137
  18. package/src/data/bucket/circle_attributes.ts +5 -3
  19. package/src/data/bucket/circle_bucket.ts +7 -7
  20. package/src/data/bucket/dash_attributes.ts +2 -2
  21. package/src/data/bucket/fill_attributes.ts +5 -3
  22. package/src/data/bucket/fill_bucket.ts +7 -7
  23. package/src/data/bucket/fill_extrusion_attributes.ts +6 -4
  24. package/src/data/bucket/fill_extrusion_bucket.ts +9 -9
  25. package/src/data/bucket/line_attributes.ts +5 -3
  26. package/src/data/bucket/line_attributes_ext.ts +5 -3
  27. package/src/data/bucket/line_bucket.ts +13 -13
  28. package/src/data/bucket/pattern_attributes.ts +2 -2
  29. package/src/data/bucket/pattern_bucket_features.ts +2 -2
  30. package/src/data/bucket/symbol_attributes.ts +14 -14
  31. package/src/data/bucket/symbol_bucket.ts +36 -35
  32. package/src/data/dem_data.ts +6 -6
  33. package/src/data/feature_index.ts +3 -3
  34. package/src/data/feature_position_map.ts +1 -1
  35. package/src/data/pos3d_attributes.ts +4 -2
  36. package/src/data/pos_attributes.ts +4 -2
  37. package/src/data/program_configuration.ts +12 -12
  38. package/src/data/raster_bounds_attributes.ts +4 -2
  39. package/src/data/segment.ts +3 -3
  40. package/src/geo/bounds.ts +2 -2
  41. package/src/geo/lng_lat.ts +1 -1
  42. package/src/geo/lng_lat_bounds.ts +2 -2
  43. package/src/geo/mercator_coordinate.ts +8 -8
  44. package/src/geo/projection/camera_helper.ts +2 -2
  45. package/src/geo/projection/globe_covering_tiles_details_provider.ts +2 -2
  46. package/src/geo/projection/globe_projection.ts +4 -4
  47. package/src/geo/projection/globe_projection_error_measurement.ts +1 -1
  48. package/src/geo/projection/globe_utils.ts +2 -2
  49. package/src/geo/projection/mercator_projection.ts +1 -1
  50. package/src/geo/projection/mercator_transform.ts +2 -2
  51. package/src/geo/projection/projection.ts +1 -1
  52. package/src/geo/projection/vertical_perspective_projection.ts +2 -2
  53. package/src/geo/transform_helper.ts +15 -15
  54. package/src/index.ts +10 -8
  55. package/src/render/fill_large_mesh_arrays.ts +1 -1
  56. package/src/render/glyph_manager.ts +5 -5
  57. package/src/render/image_atlas.ts +3 -3
  58. package/src/render/image_manager.ts +15 -15
  59. package/src/render/line_atlas.ts +8 -6
  60. package/src/render/painter.test.ts +56 -1
  61. package/src/render/painter.ts +74 -18
  62. package/src/render/render_to_texture_interface.ts +0 -1
  63. package/src/render/subdivision_granularity_settings.ts +1 -1
  64. package/src/render/terrain.ts +5 -5
  65. package/src/shaders/encode_attribute.ts +1 -1
  66. package/src/shaders/shaders.ts +40 -1
  67. package/src/source/canvas_source.ts +6 -6
  68. package/src/source/geojson_source.test.ts +28 -33
  69. package/src/source/geojson_source.ts +19 -19
  70. package/src/source/image_source.ts +5 -5
  71. package/src/source/protocol_crud.ts +3 -3
  72. package/src/source/raster_dem_tile_source.test.ts +4 -4
  73. package/src/source/raster_dem_tile_source.ts +3 -2
  74. package/src/source/raster_dem_tile_worker_source.ts +1 -1
  75. package/src/source/raster_tile_source.ts +9 -9
  76. package/src/source/rtl_text_plugin_worker.ts +4 -4
  77. package/src/source/source_state.test.ts +40 -1
  78. package/src/source/source_state.ts +17 -9
  79. package/src/source/vector_tile_overzoomed.ts +3 -3
  80. package/src/source/vector_tile_source.ts +7 -6
  81. package/src/source/video_source.ts +7 -7
  82. package/src/style/create_style_layer.ts +14 -1
  83. package/src/style/evaluation_parameters.ts +1 -1
  84. package/src/style/format_section_override.ts +2 -2
  85. package/src/style/light.ts +5 -5
  86. package/src/style/parse_glyph_pbf.ts +1 -1
  87. package/src/style/pauseable_placement.ts +4 -4
  88. package/src/style/properties.ts +8 -8
  89. package/src/style/query_utils.ts +4 -4
  90. package/src/style/sky.ts +6 -6
  91. package/src/style/style.test.ts +26 -0
  92. package/src/style/style.ts +76 -65
  93. package/src/style/style_image.ts +1 -1
  94. package/src/style/style_layer/background_style_layer_properties.g.ts +1 -1
  95. package/src/style/style_layer/circle_style_layer.ts +1 -1
  96. package/src/style/style_layer/circle_style_layer_properties.g.ts +1 -1
  97. package/src/style/style_layer/color_relief_style_layer.ts +1 -1
  98. package/src/style/style_layer/color_relief_style_layer_properties.g.ts +1 -1
  99. package/src/style/style_layer/custom_style_layer.ts +9 -9
  100. package/src/style/style_layer/fill_extrusion_style_layer.ts +2 -2
  101. package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +1 -1
  102. package/src/style/style_layer/fill_style_layer.ts +3 -3
  103. package/src/style/style_layer/fill_style_layer_properties.g.ts +1 -1
  104. package/src/style/style_layer/heatmap_style_layer.ts +5 -5
  105. package/src/style/style_layer/heatmap_style_layer_properties.g.ts +1 -1
  106. package/src/style/style_layer/hillshade_style_layer.ts +1 -1
  107. package/src/style/style_layer/hillshade_style_layer_properties.g.ts +1 -1
  108. package/src/style/style_layer/line_style_layer.ts +12 -12
  109. package/src/style/style_layer/line_style_layer_properties.g.ts +1 -1
  110. package/src/style/style_layer/raster_style_layer_properties.g.ts +1 -1
  111. package/src/style/style_layer/symbol_style_layer.ts +4 -4
  112. package/src/style/style_layer/symbol_style_layer_properties.g.ts +1 -1
  113. package/src/style/style_layer/variable_text_anchor.ts +1 -1
  114. package/src/style/style_layer.ts +17 -17
  115. package/src/style/style_layer_index.ts +2 -2
  116. package/src/style/validate_style.ts +7 -7
  117. package/src/style/zoom_history.ts +1 -1
  118. package/src/symbol/anchor.ts +1 -1
  119. package/src/symbol/check_max_angle.ts +1 -1
  120. package/src/symbol/collision_index.ts +15 -9
  121. package/src/symbol/cross_tile_symbol_index.ts +9 -9
  122. package/src/symbol/get_anchors.ts +1 -1
  123. package/src/symbol/grid_index.ts +3 -3
  124. package/src/symbol/opacity_state.ts +1 -1
  125. package/src/symbol/path_interpolator.ts +1 -1
  126. package/src/symbol/placement.ts +15 -15
  127. package/src/symbol/projection.ts +6 -6
  128. package/src/symbol/shaping.ts +1 -1
  129. package/src/symbol/symbol_layout.ts +1 -1
  130. package/src/symbol/symbol_size.ts +1 -1
  131. package/src/symbol/tagged_string.ts +7 -7
  132. package/src/tile/terrain_tile_manager.test.ts +57 -1
  133. package/src/tile/terrain_tile_manager.ts +21 -8
  134. package/src/tile/tile.test.ts +24 -0
  135. package/src/tile/tile.ts +74 -24
  136. package/src/tile/tile_bounds.ts +1 -1
  137. package/src/tile/tile_cache.ts +4 -4
  138. package/src/tile/tile_id.ts +17 -17
  139. package/src/tile/tile_manager.ts +38 -35
  140. package/src/tile/tile_manager_in_view_tiles.test.ts +22 -1
  141. package/src/tile/tile_manager_in_view_tiles.ts +7 -6
  142. package/src/tile/tile_manager_raster.ts +2 -2
  143. package/src/tile/tile_manager_raster_dem.ts +1 -1
  144. package/src/ui/anchor.ts +1 -1
  145. package/src/ui/camera.ts +13 -13
  146. package/src/ui/control/attribution_control.test.ts +4 -2
  147. package/src/ui/control/attribution_control.ts +8 -8
  148. package/src/ui/control/fullscreen_control.ts +11 -11
  149. package/src/ui/control/geolocate_control.ts +15 -15
  150. package/src/ui/control/globe_control.test.ts +4 -2
  151. package/src/ui/control/globe_control.ts +4 -4
  152. package/src/ui/control/logo_control.test.ts +3 -2
  153. package/src/ui/control/logo_control.ts +3 -3
  154. package/src/ui/control/navigation_control.ts +17 -17
  155. package/src/ui/control/scale_control.ts +6 -6
  156. package/src/ui/control/terrain_control.test.ts +5 -2
  157. package/src/ui/control/terrain_control.ts +4 -4
  158. package/src/ui/events.ts +3 -3
  159. package/src/ui/handler/box_zoom.ts +10 -10
  160. package/src/ui/handler/click_zoom.ts +7 -7
  161. package/src/ui/handler/cooperative_gestures.ts +7 -7
  162. package/src/ui/handler/drag_handler.ts +14 -14
  163. package/src/ui/handler/drag_move_state_manager.ts +23 -23
  164. package/src/ui/handler/handler_util.ts +2 -2
  165. package/src/ui/handler/keyboard.ts +8 -8
  166. package/src/ui/handler/map_event.ts +27 -27
  167. package/src/ui/handler/mouse.ts +1 -1
  168. package/src/ui/handler/scroll_zoom.ts +21 -15
  169. package/src/ui/handler/shim/dblclick_zoom.ts +4 -4
  170. package/src/ui/handler/shim/drag_pan.ts +4 -4
  171. package/src/ui/handler/shim/drag_rotate.ts +4 -4
  172. package/src/ui/handler/shim/two_fingers_touch.ts +8 -8
  173. package/src/ui/handler/tap_drag_zoom.ts +10 -10
  174. package/src/ui/handler/tap_recognizer.ts +8 -8
  175. package/src/ui/handler/tap_zoom.ts +9 -9
  176. package/src/ui/handler/touch_pan.ts +11 -11
  177. package/src/ui/handler/transform-provider.ts +4 -4
  178. package/src/ui/handler/two_fingers_touch.ts +3 -3
  179. package/src/ui/handler_inertia.ts +3 -3
  180. package/src/ui/handler_manager.ts +20 -20
  181. package/src/ui/hash.ts +9 -9
  182. package/src/ui/map.ts +39 -40
  183. package/src/ui/map_tests/map_bounds.test.ts +2 -2
  184. package/src/ui/map_tests/map_canvas.test.ts +2 -1
  185. package/src/ui/marker.ts +11 -11
  186. package/src/ui/popup.ts +10 -10
  187. package/src/util/abort_error.ts +1 -1
  188. package/src/util/actor.test.ts +17 -19
  189. package/src/util/actor.ts +11 -8
  190. package/src/util/ajax.ts +2 -2
  191. package/src/util/browser.ts +4 -2
  192. package/src/util/dictionary_coder.ts +2 -2
  193. package/src/util/dispatcher.test.ts +12 -14
  194. package/src/util/dispatcher.ts +39 -19
  195. package/src/util/dom.ts +5 -5
  196. package/src/util/evented.ts +3 -3
  197. package/src/util/find_pole_of_inaccessibility.ts +1 -1
  198. package/src/util/global_worker_pool.ts +4 -4
  199. package/src/util/image.ts +8 -8
  200. package/src/util/intersection_tests.ts +6 -6
  201. package/src/util/primitives/bounding_volume_cache.ts +1 -1
  202. package/src/util/ref_properties.ts +7 -1
  203. package/src/util/request_manager.ts +2 -2
  204. package/src/util/request_performance.ts +1 -1
  205. package/src/util/script_detection.ts +10 -10
  206. package/src/util/struct_array.ts +19 -11
  207. package/src/util/task_queue.ts +3 -3
  208. package/src/util/test/null_gl.ts +294 -292
  209. package/src/util/test/util.ts +35 -20
  210. package/src/util/throttled_invoker.ts +2 -2
  211. package/src/util/transferable_grid_index.ts +8 -8
  212. package/src/util/util.ts +6 -6
  213. package/src/util/vectortile_to_geojson.ts +1 -1
  214. package/src/util/verticalize_punctuation.ts +1 -1
  215. package/src/util/web_worker.test.ts +39 -11
  216. package/src/util/web_worker.ts +54 -4
  217. package/src/util/web_worker_transfer.test.ts +4 -0
  218. package/src/util/web_worker_transfer.ts +1 -1
  219. package/src/util/worker_pool.test.ts +11 -14
  220. package/src/util/worker_pool.ts +19 -17
  221. package/src/webgl/context.ts +13 -13
  222. package/src/webgl/draw/draw_background.ts +1 -1
  223. package/src/webgl/draw/draw_circle.ts +1 -1
  224. package/src/webgl/draw/draw_collision_debug.ts +1 -1
  225. package/src/webgl/draw/draw_color_relief.ts +1 -1
  226. package/src/webgl/draw/draw_custom.ts +1 -1
  227. package/src/webgl/draw/draw_debug.ts +2 -2
  228. package/src/webgl/draw/draw_fill.ts +1 -1
  229. package/src/webgl/draw/draw_fill_extrusion.ts +1 -1
  230. package/src/webgl/draw/draw_heatmap.ts +1 -1
  231. package/src/webgl/draw/draw_hillshade.ts +1 -1
  232. package/src/webgl/draw/draw_line.ts +1 -1
  233. package/src/webgl/draw/draw_raster.ts +1 -1
  234. package/src/webgl/draw/draw_sky.ts +2 -2
  235. package/src/webgl/draw/draw_symbol.ts +1 -1
  236. package/src/webgl/draw/draw_terrain.ts +3 -3
  237. package/src/webgl/framebuffer.ts +1 -1
  238. package/src/webgl/index_buffer.ts +3 -3
  239. package/src/webgl/program/program_uniforms.ts +55 -17
  240. package/src/webgl/program.ts +1 -1
  241. package/src/webgl/render_to_texture.test.ts +49 -10
  242. package/src/webgl/render_to_texture.ts +15 -34
  243. package/src/webgl/texture.ts +4 -4
  244. package/src/webgl/value.ts +30 -30
  245. package/src/webgl/vertex_array_object.ts +3 -3
  246. package/src/webgl/vertex_buffer.ts +5 -5
  247. package/src/webgl/render_pool.test.ts +0 -70
  248. package/src/webgl/render_pool.ts +0 -96
package/README.md CHANGED
@@ -29,8 +29,6 @@ Include the following code in the `<body>` of your HTML file.
29
29
  <script type='module'>
30
30
  import * as maplibregl from 'https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.mjs';
31
31
 
32
- maplibregl.setWorkerUrl('https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl-worker.mjs');
33
-
34
32
  const map = new maplibregl.Map({
35
33
  container: 'map',
36
34
  style: 'https://demotiles.maplibre.org/style.json', // stylesheet location
package/build/banner.ts CHANGED
@@ -5,8 +5,10 @@ import {dirname, join} from 'path';
5
5
  const packageJSONPath = join(dirname(fileURLToPath(import.meta.url)), '../package.json');
6
6
  const packageJSON = JSON.parse(readFileSync(packageJSONPath, 'utf8'));
7
7
 
8
- export default
9
- `/**
8
+ const banner: string =
9
+ `/**
10
10
  * MapLibre GL JS
11
11
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v${packageJSON.version}/LICENSE.txt
12
12
  */`;
13
+
14
+ export default banner;
@@ -95,28 +95,44 @@ function generateMarkdownForExample(title: string, description: string, file: st
95
95
 
96
96
  ${description}
97
97
 
98
- <iframe src="../${file}" width="100%" style="border:none; height:400px"></iframe>
98
+ <iframe src="${file}" width="100%" style="border:none; height:400px"></iframe>
99
99
 
100
100
  ${codeBlock}
101
101
  `;
102
102
  }
103
103
 
104
- async function generateMarkdownIndexFileOfAllExamplesAndPackImages(indexArray: HtmlDoc[]): Promise<string> {
105
- let indexMarkdown = '# Overview \n\n';
104
+ /**
105
+ * This method converts png files to webp files in order to improve performance of docs,
106
+ * This is considered a build artifact and should not be checked in, but generated as part of the docs generation process.
107
+ */
108
+ async function packImages(indexArray: HtmlDoc[]) {
106
109
  const promises: Array<Promise<any>> = [];
107
110
  for (const indexArrayItem of indexArray) {
108
111
  const imagePath = `docs/assets/examples/${indexArrayItem.mdFileName.replace('.md', '.png')}`;
109
112
  const outputPath = imagePath.replace('.png', '.webp');
110
113
  promises.push(sharp(imagePath).webp({quality: 90, lossless: false}).toFile(outputPath));
111
- indexMarkdown += `
112
- ## [${indexArrayItem.title}](./${indexArrayItem.mdFileName})
113
-
114
- ![${indexArrayItem.description}](${outputPath.replace('docs/', '../')}){ loading=lazy }
114
+ }
115
+ await Promise.all(promises);
116
+ }
115
117
 
116
- ${indexArrayItem.description}
118
+ function generateMarkdownIndexFileOfAllExamples(indexArray: HtmlDoc[]): string {
119
+ let indexMarkdown = '# Overview\n\n<div class="examples-grid">\n';
120
+ for (const indexArrayItem of indexArray) {
121
+ const cardImg = `../assets/examples/${indexArrayItem.mdFileName.replace('.md', '.webp')}`;
122
+ const desc = indexArrayItem.description || '';
123
+ const cardFileName = indexArrayItem.mdFileName.replace(/.md$/, '/');
124
+ indexMarkdown += `<a class="example-card" href="./${cardFileName}">
125
+ <div class="example-card-image">
126
+ <img src="${cardImg}" loading="lazy" alt="${desc}">
127
+ ${indexArrayItem.isNew ? '<span class="example-card-badge">new</span>' : ''}
128
+ </div>
129
+ <div class="example-card-content">
130
+ <h3>${indexArrayItem.title}</h3>
131
+ <p>${desc}</p>
132
+ </div>
133
+ </a>
117
134
  `;
118
135
  }
119
- await Promise.all(promises);
120
136
  return indexMarkdown;
121
137
  }
122
138
 
@@ -169,8 +185,8 @@ async function generateExamplesFolder() {
169
185
  const exampleMarkdown = generateMarkdownForExample(title, description, file, htmlContent, isNew);
170
186
  fs.writeFileSync(path.join(examplesDocsFolder, mdFileName), exampleMarkdown);
171
187
  }
172
-
173
- const indexMarkdown = await generateMarkdownIndexFileOfAllExamplesAndPackImages(indexArray);
188
+ await packImages(indexArray);
189
+ const indexMarkdown = generateMarkdownIndexFileOfAllExamples(indexArray);
174
190
  fs.writeFileSync(path.join(examplesDocsFolder, 'index.md'), indexMarkdown);
175
191
  }
176
192
 
@@ -235,7 +251,7 @@ function updateMapLibreVersionForUNPKG() {
235
251
  let indexContent = fs.readFileSync(indexPath, 'utf-8');
236
252
 
237
253
  // Replace the version number
238
- indexContent = indexContent.replace(/unpkg\.com\/maplibre-gl@\^(\d+\.\d+\.\d+)/g, `unpkg.com/maplibre-gl@^${packageJson.version}`);
254
+ indexContent = indexContent.replace(/unpkg\.com\/maplibre-gl@\^[^/'"]+/g, `unpkg.com/maplibre-gl@^${packageJson.version}`);
239
255
 
240
256
  // Save index.md
241
257
  fs.writeFileSync(indexPath, indexContent);
@@ -247,7 +247,7 @@ class ${structArrayLayoutClass} extends StructArray {`);
247
247
  }
248
248
 
249
249
  output.push(`
250
- _refreshViews() {`);
250
+ _refreshViews(): void {`);
251
251
 
252
252
  for (const type of usedTypes) {
253
253
  output.push(
@@ -279,13 +279,13 @@ class ${structArrayLayoutClass} extends StructArray {`);
279
279
 
280
280
  output.push(
281
281
  `
282
- public emplaceBack(${argNamesTyped.join(', ')}) {
282
+ public emplaceBack(${argNamesTyped.join(', ')}): number {
283
283
  const i = this.length;
284
284
  this.resize(i + 1);
285
285
  return this.emplace(i, ${argNames.join(', ')});
286
286
  }
287
287
 
288
- public emplace(i: number, ${argNamesTyped.join(', ')}) {`);
288
+ public emplace(i: number, ${argNamesTyped.join(', ')}): number {`);
289
289
 
290
290
  for (const size of usedTypeSizes) {
291
291
  output.push(
@@ -361,7 +361,7 @@ class ${structTypeClass} extends Struct {
361
361
  const componentAccess = `this._structArray.${member.view}[${index}]`;
362
362
 
363
363
  output.push(
364
- ` get ${name}() { return ${componentAccess}; }`);
364
+ ` get ${name}(): number { return ${componentAccess}; }`);
365
365
 
366
366
  // generate setters for properties that are updated during runtime symbol placement; others are read-only
367
367
  if (name === 'crossTileID' || name === 'placedOrientation' || name === 'hidden') {
@@ -373,7 +373,7 @@ class ${structTypeClass} extends Struct {
373
373
  // Special case used for the CollisionBoxArray type
374
374
  if (hasAnchorPoint) {
375
375
  output.push(
376
- ' get anchorPoint() { return new Point(this.anchorPointX, this.anchorPointY); }');
376
+ ' get anchorPoint(): Point { return new Point(this.anchorPointX, this.anchorPointY); }');
377
377
  }
378
378
 
379
379
  output.push(
@@ -400,7 +400,7 @@ export class ${structArrayClass} extends ${structArrayLayoutClass} {`);
400
400
  const componentOffset = (member.offset / member.size + c).toFixed(0);
401
401
  const componentStride = size / member.size;
402
402
  output.push(
403
- ` ${name}(index: number) { return this.${member.view}[index * ${componentStride} + ${componentOffset}]; }`);
403
+ ` ${name}(index: number): number { return this.${member.view}[index * ${componentStride} + ${componentOffset}]; }`);
404
404
  }
405
405
  }
406
406
  } else if (includeStructAccessors) { // get(i)
@@ -278,7 +278,7 @@ const getPaint = () => paint = paint || new Properties({`);
278
278
  output.push(
279
279
  `});
280
280
 
281
- export default ({ get paint() { return getPaint() }${layoutProperties.length ? ', get layout() { return getLayout() }' : ''} });`);
281
+ export default ({ get paint(): Properties<${layerType}PaintProps> { return getPaint() }${layoutProperties.length ? `, get layout(): Properties<${layerType}LayoutProps> { return getLayout() }` : ''} });`);
282
282
 
283
283
  return output.join('\n');
284
284
  }
package/build/readme.md CHANGED
@@ -16,7 +16,7 @@ These commands will use [rolldown](https://rolldown.rs/) to bundle the code as E
16
16
  - `dist/maplibre-gl.mjs` (main bundle, entry: `src/index.ts`)
17
17
  - `dist/maplibre-gl-worker.mjs` (worker bundle, entry: `src/source/worker.ts`)
18
18
 
19
- The main bundle creates the worker via `new Worker(url, {type: 'module'})`, where the URL is whatever the consumer passes to `setWorkerUrl()`.
19
+ The main bundle creates the worker via `new Worker(url, {type: 'module'})`. The URL defaults to a sibling of the loaded module (resolved via `import.meta.url`) and can be overridden by calling `setWorkerUrl()`. Cross-origin URLs are fetched via CORS and laundered through a same-origin Blob URL, since the `Worker` constructor rejects cross-origin URLs even when CORS allows the fetch.
20
20
 
21
21
  `banner.ts` is used to create a banner at the beginning of the output file.
22
22