Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: simplify fastify maps plugin and add support for styled map packages #896

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Oct 8, 2024

Towards #827

Paired on much of this with @gmaclennan

Leaving as a draft because tests will fail, as the changes rely on publishing a new version of styled-map-package.

Important notes:

  • removes the StaticMapPlugin in favor of using the StyledMapPackage plugin to handle serving a local custom map
  • removes the OfflineFallbackMapPlugin in favor of using the StyledMapPackage plugin to handle serving the SMP provided by @comapeo/fallback-smp
  • simplifies implementation of the MapeoMapsPlugin due to the removal of the the other plugins.
    • one consequence of this is handling the registration of the plugin within the MapeoManager instance, as opposed to doing it externally. due to this change, a few options are added to the MapeoManager constructor, all of which are optional:
      • customMapPath: file path to a local SMP file used for the local custom map
      • fallbackMapPath: file path to a local SMP file used for the offline fallback map
      • defaultOnlineStyleUrl: url to online-hosted StyleJSON

@awana-lockfile-bot
Copy link

package-lock.json changes

Summary

Status Count
ADDED 74
UPDATED 9
Click to toggle table visibility
Name Status Previous Current
@comapeo/fallback-smp ADDED - 1.0.0
@fastify/static UPDATED 7.0.3 7.0.4
@mapbox/jsonlint-lines-primitives ADDED - 2.0.2
@mapbox/sphericalmercator ADDED - 1.2.0
@mapbox/unitbezier ADDED - 0.0.1
@maplibre/maplibre-gl-style-spec ADDED - 20.3.1
@placemarkio/check-geojson ADDED - 0.1.12
@turf/bbox ADDED - 7.1.0
@turf/helpers ADDED - 7.1.0
@turf/meta ADDED - 7.1.0
@types/geojson ADDED - 7946.0.14
ansi-diff ADDED - 1.2.0
ansi-split ADDED - 1.0.1
archiver-utils ADDED - 5.0.2
archiver ADDED - 7.0.1
arr-union ADDED - 3.1.0
assign-symbols ADDED - 1.0.0
async ADDED - 3.2.6
buffer-peek-stream ADDED - 1.1.0
bundle-name ADDED - 4.1.0
bytewise-core ADDED - 1.2.3
bytewise ADDED - 1.1.0
cli-spinners ADDED - 2.9.2
compress-commons ADDED - 6.0.2
core-util-is ADDED - 1.0.3
crc-32 ADDED - 1.2.2
crc32-stream ADDED - 6.0.0
default-browser-id ADDED - 5.0.0
default-browser ADDED - 5.2.1
defaults ADDED - 1.0.4
define-lazy-prop ADDED - 3.0.0
extend-shallow ADDED - 2.0.1
fastify UPDATED 4.26.2 4.28.1
filter-obj ADDED - 6.1.0
get-east-asian-width ADDED - 1.2.0
get-value ADDED - 2.0.6
into-stream ADDED - 8.0.1
is-docker ADDED - 3.0.0
is-extendable ADDED - 0.1.1
is-inside-container ADDED - 1.0.0
is-interactive ADDED - 2.0.0
is-plain-object ADDED - 2.0.4
is-unicode-supported ADDED - 2.1.0
is-wsl ADDED - 3.1.0
isobject ADDED - 3.0.1
json-stringify-pretty-compact ADDED - 4.0.0
ky ADDED - 1.7.2
lazystream ADDED - 1.0.1
log-symbols ADDED - 7.0.0
mimic-function ADDED - 5.0.1
minimist UPDATED 1.2.7 1.2.8
normalize-path ADDED - 3.0.0
open ADDED - 10.1.0
ora ADDED - 8.1.0
package-json-from-dist ADDED - 1.0.1
parse-ms ADDED - 4.0.0
pino-abstract-transport UPDATED 1.1.0 1.2.0
pino-std-serializers UPDATED 6.2.2 7.0.0
pino UPDATED 8.20.0 9.4.0
pretty-bytes ADDED - 6.1.1
pretty-ms ADDED - 9.1.0
process-nextick-args ADDED - 2.0.1
quickselect ADDED - 2.0.0
readdir-glob ADDED - 1.1.3
run-applescript ADDED - 7.0.0
rw ADDED - 1.3.3
safe-stable-stringify UPDATED 2.4.3 2.5.0
set-value ADDED - 2.0.1
sonic-boom UPDATED 3.8.1 4.1.0
sort-asc ADDED - 0.2.0
sort-desc ADDED - 0.2.0
sort-object ADDED - 3.0.3
split-string ADDED - 3.1.0
stdin-discarder ADDED - 0.2.2
styled-map-package ADDED - 1.0.1
thread-stream UPDATED 2.4.1 3.1.0
tinyqueue ADDED - 3.0.0
typewise-core ADDED - 1.2.0
typewise ADDED - 1.0.3
union-value ADDED - 1.0.1
wcwidth ADDED - 1.0.1
yoctocolors ADDED - 2.1.1
zip-stream ADDED - 6.0.1

Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, let's merge once tests are passing.

I do agree with the original intention of keeping the plugin outside of MapeoManager, for the sake of separation of concerns, however in practice that would mean more of a tangle to expose getMapStyleJsonUrl() to the client. We're going to swap this out anyway for MapManager in the future, so I think it's more practical to take the easy route (e.g. code in this PR) for now, and deal with separation of concerns once we have the map manager.

@awana-lockfile-bot
Copy link

package-lock.json changes

Summary

Status Count
ADDED 74
UPDATED 9
Click to toggle table visibility
Name Status Previous Current
@comapeo/fallback-smp ADDED - 1.0.0
@fastify/static UPDATED 7.0.3 7.0.4
@mapbox/jsonlint-lines-primitives ADDED - 2.0.2
@mapbox/sphericalmercator ADDED - 1.2.0
@mapbox/unitbezier ADDED - 0.0.1
@maplibre/maplibre-gl-style-spec ADDED - 20.3.1
@placemarkio/check-geojson ADDED - 0.1.12
@turf/bbox ADDED - 7.1.0
@turf/helpers ADDED - 7.1.0
@turf/meta ADDED - 7.1.0
@types/geojson ADDED - 7946.0.14
ansi-diff ADDED - 1.2.0
ansi-split ADDED - 1.0.1
archiver-utils ADDED - 5.0.2
archiver ADDED - 7.0.1
arr-union ADDED - 3.1.0
assign-symbols ADDED - 1.0.0
async ADDED - 3.2.6
buffer-peek-stream ADDED - 1.1.0
bundle-name ADDED - 4.1.0
bytewise-core ADDED - 1.2.3
bytewise ADDED - 1.1.0
cli-spinners ADDED - 2.9.2
compress-commons ADDED - 6.0.2
core-util-is ADDED - 1.0.3
crc-32 ADDED - 1.2.2
crc32-stream ADDED - 6.0.0
default-browser-id ADDED - 5.0.0
default-browser ADDED - 5.2.1
defaults ADDED - 1.0.4
define-lazy-prop ADDED - 3.0.0
extend-shallow ADDED - 2.0.1
fastify UPDATED 4.26.2 4.28.1
filter-obj ADDED - 6.1.0
get-east-asian-width ADDED - 1.2.0
get-value ADDED - 2.0.6
into-stream ADDED - 8.0.1
is-docker ADDED - 3.0.0
is-extendable ADDED - 0.1.1
is-inside-container ADDED - 1.0.0
is-interactive ADDED - 2.0.0
is-plain-object ADDED - 2.0.4
is-unicode-supported ADDED - 2.1.0
is-wsl ADDED - 3.1.0
isobject ADDED - 3.0.1
json-stringify-pretty-compact ADDED - 4.0.0
ky ADDED - 1.7.2
lazystream ADDED - 1.0.1
log-symbols ADDED - 7.0.0
mimic-function ADDED - 5.0.1
minimist UPDATED 1.2.7 1.2.8
normalize-path ADDED - 3.0.0
open ADDED - 10.1.0
ora ADDED - 8.1.0
package-json-from-dist ADDED - 1.0.1
parse-ms ADDED - 4.0.0
pino-abstract-transport UPDATED 1.1.0 1.2.0
pino-std-serializers UPDATED 6.2.2 7.0.0
pino UPDATED 8.20.0 9.4.0
pretty-bytes ADDED - 6.1.1
pretty-ms ADDED - 9.1.0
process-nextick-args ADDED - 2.0.1
quickselect ADDED - 2.0.0
readdir-glob ADDED - 1.1.3
run-applescript ADDED - 7.0.0
rw ADDED - 1.3.3
safe-stable-stringify UPDATED 2.4.3 2.5.0
set-value ADDED - 2.0.1
sonic-boom UPDATED 3.8.1 4.1.0
sort-asc ADDED - 0.2.0
sort-desc ADDED - 0.2.0
sort-object ADDED - 3.0.3
split-string ADDED - 3.1.0
stdin-discarder ADDED - 0.2.2
styled-map-package ADDED - 1.1.0
thread-stream UPDATED 2.4.1 3.1.0
tinyqueue ADDED - 3.0.0
typewise-core ADDED - 1.2.0
typewise ADDED - 1.0.3
union-value ADDED - 1.0.1
wcwidth ADDED - 1.0.1
yoctocolors ADDED - 2.1.1
zip-stream ADDED - 6.0.1

@achou11 achou11 marked this pull request as ready for review October 9, 2024 17:25
@awana-lockfile-bot
Copy link

package-lock.json changes

Summary

Status Count
ADDED 74
UPDATED 9
Click to toggle table visibility
Name Status Previous Current
@comapeo/fallback-smp ADDED - 1.0.0
@fastify/static UPDATED 7.0.3 7.0.4
@mapbox/jsonlint-lines-primitives ADDED - 2.0.2
@mapbox/sphericalmercator ADDED - 1.2.0
@mapbox/unitbezier ADDED - 0.0.1
@maplibre/maplibre-gl-style-spec ADDED - 20.3.1
@placemarkio/check-geojson ADDED - 0.1.12
@turf/bbox ADDED - 7.1.0
@turf/helpers ADDED - 7.1.0
@turf/meta ADDED - 7.1.0
@types/geojson ADDED - 7946.0.14
ansi-diff ADDED - 1.2.0
ansi-split ADDED - 1.0.1
archiver-utils ADDED - 5.0.2
archiver ADDED - 7.0.1
arr-union ADDED - 3.1.0
assign-symbols ADDED - 1.0.0
async ADDED - 3.2.6
buffer-peek-stream ADDED - 1.1.0
bundle-name ADDED - 4.1.0
bytewise-core ADDED - 1.2.3
bytewise ADDED - 1.1.0
cli-spinners ADDED - 2.9.2
compress-commons ADDED - 6.0.2
core-util-is ADDED - 1.0.3
crc-32 ADDED - 1.2.2
crc32-stream ADDED - 6.0.0
default-browser-id ADDED - 5.0.0
default-browser ADDED - 5.2.1
defaults ADDED - 1.0.4
define-lazy-prop ADDED - 3.0.0
extend-shallow ADDED - 2.0.1
fastify UPDATED 4.26.2 4.28.1
filter-obj ADDED - 6.1.0
get-east-asian-width ADDED - 1.2.0
get-value ADDED - 2.0.6
into-stream ADDED - 8.0.1
is-docker ADDED - 3.0.0
is-extendable ADDED - 0.1.1
is-inside-container ADDED - 1.0.0
is-interactive ADDED - 2.0.0
is-plain-object ADDED - 2.0.4
is-unicode-supported ADDED - 2.1.0
is-wsl ADDED - 3.1.0
isobject ADDED - 3.0.1
json-stringify-pretty-compact ADDED - 4.0.0
ky ADDED - 1.7.2
lazystream ADDED - 1.0.1
log-symbols ADDED - 7.0.0
mimic-function ADDED - 5.0.1
minimist UPDATED 1.2.7 1.2.8
normalize-path ADDED - 3.0.0
open ADDED - 10.1.0
ora ADDED - 8.1.0
package-json-from-dist ADDED - 1.0.1
parse-ms ADDED - 4.0.0
pino-abstract-transport UPDATED 1.1.0 1.2.0
pino-std-serializers UPDATED 6.2.2 7.0.0
pino UPDATED 8.20.0 9.4.0
pretty-bytes ADDED - 6.1.1
pretty-ms ADDED - 9.1.0
process-nextick-args ADDED - 2.0.1
quickselect ADDED - 2.0.0
readdir-glob ADDED - 1.1.3
run-applescript ADDED - 7.0.0
rw ADDED - 1.3.3
safe-stable-stringify UPDATED 2.4.3 2.5.0
set-value ADDED - 2.0.1
sonic-boom UPDATED 3.8.1 4.1.0
sort-asc ADDED - 0.2.0
sort-desc ADDED - 0.2.0
sort-object ADDED - 3.0.3
split-string ADDED - 3.1.0
stdin-discarder ADDED - 0.2.2
styled-map-package ADDED - 1.1.0
thread-stream UPDATED 2.4.1 3.1.0
tinyqueue ADDED - 3.0.0
typewise-core ADDED - 1.2.0
typewise ADDED - 1.0.3
union-value ADDED - 1.0.1
wcwidth ADDED - 1.0.1
yoctocolors ADDED - 2.1.1
zip-stream ADDED - 6.0.1

@awana-lockfile-bot
Copy link

package-lock.json changes

Summary

Status Count
ADDED 74
UPDATED 9
Click to toggle table visibility
Name Status Previous Current
@comapeo/fallback-smp ADDED - 1.0.0
@fastify/static UPDATED 7.0.3 7.0.4
@mapbox/jsonlint-lines-primitives ADDED - 2.0.2
@mapbox/sphericalmercator ADDED - 1.2.0
@mapbox/unitbezier ADDED - 0.0.1
@maplibre/maplibre-gl-style-spec ADDED - 20.3.1
@placemarkio/check-geojson ADDED - 0.1.12
@turf/bbox ADDED - 7.1.0
@turf/helpers ADDED - 7.1.0
@turf/meta ADDED - 7.1.0
@types/geojson ADDED - 7946.0.14
ansi-diff ADDED - 1.2.0
ansi-split ADDED - 1.0.1
archiver-utils ADDED - 5.0.2
archiver ADDED - 7.0.1
arr-union ADDED - 3.1.0
assign-symbols ADDED - 1.0.0
async ADDED - 3.2.6
buffer-peek-stream ADDED - 1.1.0
bundle-name ADDED - 4.1.0
bytewise-core ADDED - 1.2.3
bytewise ADDED - 1.1.0
cli-spinners ADDED - 2.9.2
compress-commons ADDED - 6.0.2
core-util-is ADDED - 1.0.3
crc-32 ADDED - 1.2.2
crc32-stream ADDED - 6.0.0
default-browser-id ADDED - 5.0.0
default-browser ADDED - 5.2.1
defaults ADDED - 1.0.4
define-lazy-prop ADDED - 3.0.0
extend-shallow ADDED - 2.0.1
fastify UPDATED 4.26.2 4.28.1
filter-obj ADDED - 6.1.0
get-east-asian-width ADDED - 1.2.0
get-value ADDED - 2.0.6
into-stream ADDED - 8.0.1
is-docker ADDED - 3.0.0
is-extendable ADDED - 0.1.1
is-inside-container ADDED - 1.0.0
is-interactive ADDED - 2.0.0
is-plain-object ADDED - 2.0.4
is-unicode-supported ADDED - 2.1.0
is-wsl ADDED - 3.1.0
isobject ADDED - 3.0.1
json-stringify-pretty-compact ADDED - 4.0.0
ky ADDED - 1.7.2
lazystream ADDED - 1.0.1
log-symbols ADDED - 7.0.0
mimic-function ADDED - 5.0.1
minimist UPDATED 1.2.7 1.2.8
normalize-path ADDED - 3.0.0
open ADDED - 10.1.0
ora ADDED - 8.1.0
package-json-from-dist ADDED - 1.0.1
parse-ms ADDED - 4.0.0
pino-abstract-transport UPDATED 1.1.0 1.2.0
pino-std-serializers UPDATED 6.2.2 7.0.0
pino UPDATED 8.20.0 9.4.0
pretty-bytes ADDED - 6.1.1
pretty-ms ADDED - 9.1.0
process-nextick-args ADDED - 2.0.1
quickselect ADDED - 2.0.0
readdir-glob ADDED - 1.1.3
run-applescript ADDED - 7.0.0
rw ADDED - 1.3.3
safe-stable-stringify UPDATED 2.4.3 2.5.0
set-value ADDED - 2.0.1
sonic-boom UPDATED 3.8.1 4.1.0
sort-asc ADDED - 0.2.0
sort-desc ADDED - 0.2.0
sort-object ADDED - 3.0.3
split-string ADDED - 3.1.0
stdin-discarder ADDED - 0.2.2
styled-map-package ADDED - 1.1.0
thread-stream UPDATED 2.4.1 3.1.0
tinyqueue ADDED - 3.0.0
typewise-core ADDED - 1.2.0
typewise ADDED - 1.0.3
union-value ADDED - 1.0.1
wcwidth ADDED - 1.0.1
yoctocolors ADDED - 2.1.1
zip-stream ADDED - 6.0.1

@awana-lockfile-bot
Copy link

package-lock.json changes

Summary

Status Count
ADDED 74
UPDATED 9
REMOVED 1
Click to toggle table visibility
Name Status Previous Current
@comapeo/fallback-smp ADDED - 1.0.0
@electron/asar REMOVED 3.2.9 -
@fastify/static UPDATED 7.0.3 7.0.4
@mapbox/jsonlint-lines-primitives ADDED - 2.0.2
@mapbox/sphericalmercator ADDED - 1.2.0
@mapbox/unitbezier ADDED - 0.0.1
@maplibre/maplibre-gl-style-spec ADDED - 20.3.1
@placemarkio/check-geojson ADDED - 0.1.12
@turf/bbox ADDED - 7.1.0
@turf/helpers ADDED - 7.1.0
@turf/meta ADDED - 7.1.0
@types/geojson ADDED - 7946.0.14
ansi-diff ADDED - 1.2.0
ansi-split ADDED - 1.0.1
archiver-utils ADDED - 5.0.2
archiver ADDED - 7.0.1
arr-union ADDED - 3.1.0
assign-symbols ADDED - 1.0.0
async ADDED - 3.2.6
buffer-peek-stream ADDED - 1.1.0
bundle-name ADDED - 4.1.0
bytewise-core ADDED - 1.2.3
bytewise ADDED - 1.1.0
cli-spinners ADDED - 2.9.2
compress-commons ADDED - 6.0.2
core-util-is ADDED - 1.0.3
crc-32 ADDED - 1.2.2
crc32-stream ADDED - 6.0.0
default-browser-id ADDED - 5.0.0
default-browser ADDED - 5.2.1
defaults ADDED - 1.0.4
define-lazy-prop ADDED - 3.0.0
extend-shallow ADDED - 2.0.1
fastify UPDATED 4.26.2 4.28.1
filter-obj ADDED - 6.1.0
get-east-asian-width ADDED - 1.2.0
get-value ADDED - 2.0.6
into-stream ADDED - 8.0.1
is-docker ADDED - 3.0.0
is-extendable ADDED - 0.1.1
is-inside-container ADDED - 1.0.0
is-interactive ADDED - 2.0.0
is-plain-object ADDED - 2.0.4
is-unicode-supported ADDED - 2.1.0
is-wsl ADDED - 3.1.0
isobject ADDED - 3.0.1
json-stringify-pretty-compact ADDED - 4.0.0
ky ADDED - 1.7.2
lazystream ADDED - 1.0.1
log-symbols ADDED - 7.0.0
mimic-function ADDED - 5.0.1
minimist UPDATED 1.2.7 1.2.8
normalize-path ADDED - 3.0.0
open ADDED - 10.1.0
ora ADDED - 8.1.0
package-json-from-dist ADDED - 1.0.1
parse-ms ADDED - 4.0.0
pino-abstract-transport UPDATED 1.1.0 1.2.0
pino-std-serializers UPDATED 6.2.2 7.0.0
pino UPDATED 8.20.0 9.4.0
pretty-bytes ADDED - 6.1.1
pretty-ms ADDED - 9.1.0
process-nextick-args ADDED - 2.0.1
quickselect ADDED - 2.0.0
readdir-glob ADDED - 1.1.3
run-applescript ADDED - 7.0.0
rw ADDED - 1.3.3
safe-stable-stringify UPDATED 2.4.3 2.5.0
set-value ADDED - 2.0.1
sonic-boom UPDATED 3.8.1 4.1.0
sort-asc ADDED - 0.2.0
sort-desc ADDED - 0.2.0
sort-object ADDED - 3.0.3
split-string ADDED - 3.1.0
stdin-discarder ADDED - 0.2.2
styled-map-package ADDED - 1.1.0
thread-stream UPDATED 2.4.1 3.1.0
tinyqueue ADDED - 3.0.0
typewise-core ADDED - 1.2.0
typewise ADDED - 1.0.3
union-value ADDED - 1.0.1
wcwidth ADDED - 1.0.1
yoctocolors ADDED - 2.1.1
zip-stream ADDED - 6.0.1

@achou11 achou11 merged commit f21a675 into main Oct 9, 2024
8 checks passed
@achou11 achou11 deleted the maps-plugin-refactor branch October 9, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants