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

Fix web worker in watch mode #968

Merged
merged 5 commits into from
Feb 9, 2022

Conversation

birkskyum
Copy link
Member

@birkskyum birkskyum commented Feb 8, 2022

Currently, the web worker is only enabled if watch mode is off, because the rollup node-resolve plugin doesn't look at typescript files by default, and it was configured to the wrong path. This pr fixes that, and it can hopefully unblock #961
To test this PR, first go to the main branch and:

  1. Delete the rollup/build/tsc/src folder
  2. Run npm run start-debug
  3. Open chrome dev console, and go to "sources" tap - there will be just "top -> localhost -> local files" in the left pane, which indicates that the web worker ain't running.

Now checkout this pr, and do the same.

The sources tap should now have "top" and some web workers, like in the image

Screenshot from 2022-02-08 20-46-32.

@birkskyum birkskyum requested a review from HarelM February 8, 2022 19:47
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2022

Bundle size report:

Size Change: -335 B
Total Size Before: 194 kB
Total Size After: 194 kB

Output file Before After Change
maplibre-gl.js 185 kB 185 kB -335 B
maplibre-gl.css 9.43 kB 9.43 kB 0 B
ℹ️ View Details
Source file Before After Change
rollup/build/tsc/src/util/web_worker.js 0 B 324 B +324 B
rollup/build/tsc/src/source/worker.js 933 B 1.11 kB +174 B
node_modules/gl-matrix/esm/vec4.js 450 B 618 B +168 B
node_modules/supercluster/index.js 2.06 kB 2.08 kB +14 B
node_modules/geojson-vt/src/convert.js 851 B 860 B +9 B
node_modules/geojson-vt/src/clip.js 870 B 879 B +9 B
rollup/build/tsc/src/render/uniform_binding.js 647 B 654 B +7 B
node_modules/@mapbox/geojson-rewind/index.js 339 B 343 B +4 B
rollup/build/tsc/src/style-spec/expression/definitions/format.js 726 B 729 B +3 B
rollup/build/tsc/src/style-spec/expression/definitions/comparison.js 881 B 884 B +3 B
node_modules/geojson-vt/src/simplify.js 278 B 281 B +3 B
rollup/build/tsc/src/render/program/hillshade_program.js 880 B 883 B +3 B
node_modules/@mapbox/point-geometry/index.js 632 B 634 B +2 B
rollup/build/tsc/src/style-spec/util/color.js 324 B 326 B +2 B
rollup/build/tsc/src/style-spec/expression/definitions/slice.js 495 B 497 B +2 B
rollup/build/tsc/src/util/web_worker_transfer.js 948 B 950 B +2 B
rollup/build/tsc/src/source/rtl_text_plugin.js 905 B 907 B +2 B
rollup/build/tsc/src/util/verticalize_punctuation.js 587 B 589 B +2 B
node_modules/pbf/index.js 2.82 kB 2.83 kB +2 B
rollup/build/tsc/src/render/image_atlas.js 831 B 833 B +2 B
rollup/build/tsc/src/symbol/get_anchors.js 577 B 579 B +2 B
rollup/build/tsc/src/geo/mercator_coordinate.js 342 B 344 B +2 B
rollup/build/tsc/src/util/vectortile_to_geojson.js 380 B 382 B +2 B
node_modules/kdbush/src/within.js 332 B 334 B +2 B
node_modules/geojson-vt/src/wrap.js 464 B 466 B +2 B
rollup/build/tsc/src/style-spec/deref.js 208 B 210 B +2 B
rollup/build/tsc/src/symbol/placement.js 4.72 kB 4.72 kB +2 B
rollup/build/tsc/src/render/draw_symbol.js 2.49 kB 2.49 kB +2 B
rollup/build/tsc/src/geo/edge_insets.js 426 B 428 B +2 B
rollup/build/tsc/src/ui/popup.js 1.91 kB 1.91 kB +2 B
rollup/build/tsc/src/util/webp_supported.js 375 B 376 B +1 B
node_modules/csscolorparser/csscolorparser.js 2.05 kB 2.05 kB +1 B
rollup/build/tsc/src/style-spec/expression/definitions/literal.js 407 B 408 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/coercion.js 812 B 813 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/collator.js 436 B 437 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/within.js 1.4 kB 1.4 kB +1 B
rollup/build/tsc/src/style-spec/util/interpolate.js 174 B 175 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/interpolate.js 1.31 kB 1.32 kB +1 B
rollup/build/tsc/src/style-spec/expression/definitions/at.js 406 B 407 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/index_of.js 555 B 556 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/length.js 371 B 372 B +1 B
rollup/build/tsc/src/style-spec/expression/index.js 1.6 kB 1.6 kB +1 B
rollup/build/tsc/src/style-spec/validate/validate_string.js 123 B 124 B +1 B
rollup/build/tsc/src/style-spec/validate_style.min.js 296 B 297 B +1 B
rollup/build/tsc/src/util/is_char_in_unicode_block.js 875 B 876 B +1 B
rollup/build/tsc/src/style/properties.js 1.92 kB 1.92 kB +1 B
rollup/build/tsc/src/data/feature_position_map.js 557 B 558 B +1 B
rollup/build/tsc/src/data/load_geometry.js 251 B 252 B +1 B
rollup/build/tsc/src/data/bucket/circle_bucket.js 975 B 976 B +1 B
rollup/build/tsc/src/style/style_layer/fill_extrusion_style_layer.js 925 B 926 B +1 B
rollup/build/tsc/src/data/bucket/symbol_attributes.js 768 B 769 B +1 B
rollup/build/tsc/src/symbol/symbol_size.js 538 B 539 B +1 B
node_modules/tinyqueue/index.js 363 B 364 B +1 B
rollup/build/tsc/src/source/tile_id.js 1.1 kB 1.1 kB +1 B
node_modules/geojson-vt/src/feature.js 300 B 301 B +1 B
node_modules/geojson-vt/src/index.js 1.57 kB 1.57 kB +1 B
rollup/build/tsc/src/render/glyph_manager.js 946 B 947 B +1 B
rollup/build/tsc/src/source/geojson_source.js 1.28 kB 1.28 kB +1 B
rollup/build/tsc/src/source/source_cache.js 3.74 kB 3.74 kB +1 B
rollup/build/tsc/src/render/program/fill_extrusion_program.js 801 B 802 B +1 B
rollup/build/tsc/src/render/program/collision_program.js 725 B 726 B +1 B
rollup/build/tsc/src/gl/value.js 1.09 kB 1.09 kB +1 B
rollup/build/tsc/src/gl/color_mode.js 172 B 173 B +1 B
rollup/build/tsc/src/gl/context.js 1.28 kB 1.28 kB +1 B
rollup/build/tsc/src/render/draw_collision_debug.js 1.07 kB 1.07 kB +1 B
rollup/build/tsc/src/render/draw_fill_extrusion.js 807 B 808 B +1 B
rollup/build/tsc/src/render/draw_hillshade.js 1.09 kB 1.09 kB +1 B
rollup/build/tsc/src/render/draw_debug.js 1.11 kB 1.11 kB +1 B
rollup/build/tsc/src/geo/transform.js 3.75 kB 3.75 kB +1 B
rollup/build/tsc/src/ui/handler_inertia.js 821 B 822 B +1 B
rollup/build/tsc/src/ui/handler/touch_zoom_rotate.js 963 B 964 B +1 B
rollup/build/tsc/src/ui/handler/keyboard.js 575 B 576 B +1 B
rollup/build/tsc/src/ui/handler/scroll_zoom.js 1.25 kB 1.25 kB +1 B
rollup/build/tsc/src/ui/handler/shim/touch_zoom_rotate.js 285 B 286 B +1 B
rollup/build/tsc/src/ui/handler_manager.js 2.34 kB 2.35 kB +1 B
rollup/build/tsc/src/ui/marker.js 2.71 kB 2.71 kB +1 B
rollup/build/tsc/src/index.js 737 B 738 B +1 B
rollup/build/tsc/src/util/browser.js 447 B 446 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_constants.js 113 B 112 B -1 B
rollup/build/tsc/src/style-spec/util/unbundle_jsonlint.js 180 B 179 B -1 B
rollup/build/tsc/src/style-spec/expression/values.js 498 B 497 B -1 B
rollup/build/tsc/src/style-spec/expression/definitions/image.js 297 B 296 B -1 B
rollup/build/tsc/src/style-spec/expression/parsing_context.js 1.03 kB 1.03 kB -1 B
rollup/build/tsc/src/style-spec/expression/definitions/in.js 457 B 456 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_function.js 1.14 kB 1.14 kB -1 B
rollup/build/tsc/src/style-spec/validate/validate_expression.js 452 B 451 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_enum.js 209 B 208 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_property.js 550 B 549 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_color.js 142 B 141 B -1 B
rollup/build/tsc/src/style/zoom_history.js 186 B 185 B -1 B
rollup/build/tsc/src/style/style_layer/circle_style_layer.js 545 B 544 B -1 B
rollup/build/tsc/src/util/classify_rings.js 248 B 247 B -1 B
rollup/build/tsc/src/style/style_layer/fill_style_layer_properties.g.js 201 B 200 B -1 B
node_modules/@mapbox/vector-tile/lib/vectortilefeature.js 1.01 kB 1.01 kB -1 B
rollup/build/tsc/src/style/style_layer/fill_extrusion_style_layer_properties.g.js 192 B 191 B -1 B
rollup/build/tsc/src/symbol/collision_feature.js 379 B 378 B -1 B
rollup/build/tsc/src/style/style_layer/symbol_style_layer_properties.g.js 652 B 651 B -1 B
rollup/build/tsc/src/style/format_section_override.js 306 B 305 B -1 B
rollup/build/tsc/src/style/style_layer/symbol_style_layer.js 1.02 kB 1.01 kB -1 B
node_modules/vt-pbf/index.js 872 B 871 B -1 B
node_modules/kdbush/src/index.js 371 B 370 B -1 B
node_modules/gl-matrix/esm/vec3.js 831 B 830 B -1 B
rollup/build/tsc/src/render/texture.js 680 B 679 B -1 B
rollup/build/tsc/src/source/vector_tile_source.js 1.11 kB 1.11 kB -1 B
rollup/build/tsc/src/source/source.js 354 B 353 B -1 B
rollup/build/tsc/src/source/tile.js 1.88 kB 1.87 kB -1 B
rollup/build/tsc/src/source/source_state.js 599 B 598 B -1 B
rollup/build/tsc/src/style-spec/diff.js 1.53 kB 1.53 kB -1 B
rollup/build/tsc/src/render/program.js 917 B 916 B -1 B
rollup/build/tsc/src/render/program/raster_program.js 564 B 563 B -1 B
rollup/build/tsc/src/render/program/symbol_program.js 1.3 kB 1.3 kB -1 B
rollup/build/tsc/src/gl/vertex_buffer.js 534 B 533 B -1 B
rollup/build/tsc/src/gl/framebuffer.js 218 B 217 B -1 B
rollup/build/tsc/src/render/draw_fill.js 976 B 975 B -1 B
rollup/build/tsc/src/render/draw_heatmap.js 1.04 kB 1.04 kB -1 B
rollup/build/tsc/src/render/draw_line.js 1.01 kB 1.01 kB -1 B
rollup/build/tsc/src/render/draw_background.js 529 B 528 B -1 B
rollup/build/tsc/src/ui/control/attribution_control.js 1.01 kB 1.01 kB -1 B
rollup/build/tsc/src/ui/control/logo_control.js 594 B 593 B -1 B
rollup/build/tsc/src/style-spec/expression/compound_expression.js 767 B 765 B -2 B
rollup/build/tsc/src/style-spec/feature_filter/index.js 883 B 881 B -2 B
rollup/build/tsc/src/style-spec/validate/validate_source.js 618 B 616 B -2 B
rollup/build/tsc/src/symbol/shaping.js 3.62 kB 3.62 kB -2 B
rollup/build/tsc/src/symbol/anchor.js 169 B 167 B -2 B
rollup/build/tsc/src/symbol/clip_line.js 302 B 300 B -2 B
rollup/build/tsc/src/data/bucket/symbol_bucket.js 4.3 kB 4.3 kB -2 B
node_modules/geojson-vt/src/transform.js 276 B 274 B -2 B
node_modules/geojson-vt/src/tile.js 781 B 779 B -2 B
rollup/build/tsc/src/symbol/projection.js 1.79 kB 1.78 kB -2 B
rollup/build/tsc/src/symbol/cross_tile_symbol_index.js 1.14 kB 1.13 kB -2 B
rollup/build/tsc/src/ui/control/navigation_control.js 1.6 kB 1.6 kB -2 B
rollup/build/tsc/src/util/script_detection.js 1.65 kB 1.65 kB -3 B
rollup/build/tsc/src/data/array_types.g.js 2.76 kB 2.76 kB -4 B
node_modules/gl-matrix/esm/mat4.js 2.12 kB 2.12 kB -4 B
node_modules/vt-pbf/lib/geojson_wrapper.js 450 B 446 B -4 B
rollup/build/tsc/src/render/painter.js 3.3 kB 3.3 kB -4 B
rollup/build/tsc/src/data/program_configuration.js 2.62 kB 2.62 kB -5 B
rollup/build/tsc/src/style/create_style_layer.js 191 B 186 B -5 B
rollup/build/tsc/src/ui/map.js 6.17 kB 6.17 kB -5 B
rollup/build/tsc/src/util/primitives.js 942 B 936 B -6 B
rollup/build/tsc/src/style-spec/util/color_spaces.js 804 B 797 B -7 B
rollup/build/tsc/src/style/style.js 6.53 kB 6.52 kB -7 B
rollup/build/tsc/src/style-spec/group_by_layout.js 407 B 399 B -8 B
rollup/build/tsc/src/source/geojson_wrapper.js 379 B 370 B -9 B
rollup/build/tsc/src/style/style_layer/custom_style_layer.js 486 B 476 B -10 B
rollup/build/tsc/src/render/glyph_atlas.js 330 B 319 B -11 B
rollup/build/tsc/src/style/style_layer_index.js 467 B 452 B -15 B
rollup/build/tsc/src/style/parse_glyph_pbf.js 369 B 353 B -16 B
rollup/build/tsc/src/source/raster_dem_tile_worker_source.js 374 B 358 B -16 B
rollup/build/tsc/src/source/geojson_worker_source.js 1.54 kB 1.52 kB -22 B
rollup/build/tsc/src/source/vector_tile_worker_source.js 697 B 671 B -26 B
build/web_worker_replacement.js 42 B 0 B -42 B
rollup/build/tsc/src/util/util.js 1.98 kB 1.94 kB -47 B
rollup/build/tsc/src/data/feature_index.js 1.75 kB 1.7 kB -49 B
rollup/build/tsc/src/util/actor.js 877 B 823 B -54 B
rollup/build/tsc/src/util/worker_pool.js 411 B 357 B -54 B
rollup/build/tsc/src/source/worker_tile.js 1.28 kB 1.22 kB -58 B
rollup/build/tsc/src/util/ajax.js 2.34 kB 2.28 kB -60 B
rollup/build/tsc/src/util/performance.js 446 B 357 B -89 B
rollup/build/tsc/src/util/tile_request_cache.js 1.01 kB 861 B -148 B
rollup/build/tsc/src/symbol/symbol_layout.js 3.62 kB 3.34 kB -277 B

bench/rollup_config_benchmarks.ts Outdated Show resolved Hide resolved
build/rollup_plugins.ts Outdated Show resolved Hide resolved
@HarelM
Copy link
Collaborator

HarelM commented Feb 8, 2022

Nice work! Keep it up!

@birkskyum birkskyum force-pushed the fix-web-worker-in-watch-mode branch from 833be41 to d2932bf Compare February 9, 2022 12:17
@birkskyum
Copy link
Member Author

birkskyum commented Feb 9, 2022

@HarelM The benchmarks are working now because of #969

@birkskyum birkskyum mentioned this pull request Feb 9, 2022
Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

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

Perfect, Thanks!

@HarelM HarelM merged commit bf3c21d into maplibre:main Feb 9, 2022
wipfli added a commit that referenced this pull request Feb 24, 2022
* Migrate expression tests to jest (#965)

* Revert "Move benchmarks to ES modules (#964)" (#969)

This reverts commit aa8ed9d.

* Migrate query tests from puppeteer to playwright (#966)

* Fix web worker in watch mode (#968)

* Fix web worker in watch mode

* Add webworker support throughout

* Don't change rollup for style-spec and benchmarks

* Revert "Don't change rollup for style-spec and benchmarks"

This reverts commit 62a7e14.

* Remove duplicate node-resolve configuration

* Simplify build pipeline (#961)

* Remove build-tsc compile step

* re-enable failing style-spec test

* cleanup

* cleanup

* fix style-spec-test

* Create codeql-analysis.yml

* Bump simple-get from 3.1.0 to 3.1.1 (#971)

Bumps [simple-get](https://github.com/feross/simple-get) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/feross/simple-get/releases)
- [Commits](feross/simple-get@v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: simple-get
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump nanoid from 3.1.30 to 3.2.0 (#973)

Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.2.0.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](ai/nanoid@3.1.30...3.2.0)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cached-path-relative from 1.0.2 to 1.1.0 (#972)

Bumps [cached-path-relative](https://github.com/ashaffer/cached-path-relative) from 1.0.2 to 1.1.0.
- [Release notes](https://github.com/ashaffer/cached-path-relative/releases)
- [Commits](https://github.com/ashaffer/cached-path-relative/commits)

---
updated-dependencies:
- dependency-name: cached-path-relative
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Move browser test to playwright (#974)

* Bump ts-node for 3x faster postinstall (#975)

* Remove web worker replacement (#976)

* Attribution default open for osm (#795)

* Update CHANGELOG.md

* Revert "Update CHANGELOG.md"

This reverts commit 0b81a41.

* attribution fixes (from astridx)

a1272d9

b9b0370

* Update .gitignore

* fix missing new line lint complained about

* Revert "attribution fixes (from astridx)"

This reverts commit 2031d8e.

* Default compact to be open by default

Default compact button to be open by default, to make OpenStreetMap attibutions to show by default like mentioned in ( #205 )

This uses an idea from ( #205 (comment) ) to show compact open by default, but close it when dragged.

* remove test string I forgot to remove

* fix compact button showing when there are no attributions

* update whitespace trim to es6 syntax

* fixes after testing various states of compact

* revert back so it is open when starting in fullscreen

* revert .gitignore

* fix lint errors

* fix tests

Most of these fails because I made the compact button not show if attributes are empty.

The other test fail because when switching between >640 and <=640 the open attribute is now added

* lint

* Update package-lock.json

* Update package-lock.json

* Update CHANGELOG.md

* delete problematic files

* put back deleted files

* test/integration/assets/sprites/icon-text-fit-1x@2x.json

* restore files

Co-authored-by: acalcutt <acalcutt@worcester.edu>

* Fix benchmarks (#984)

* Move bench under `test` folder (#979)

* Add typeof guard to performance variable (#986)

* Fixes #768

* Fix comment and add changelog

* Release 2.1.2 Version (#987)

* Release 2.1.2 Version

* Fix changelog according to comments

* Fix release.yml due to bench folder move (#988)

* lint function-url-quotes/ (#983)

* Bump to v2.1.3 - Fix postinstall error `ts-node` not found in non-dev installs (#991)

* Bump to v2.1.4 - Fix missing `postinstall.js` file in npm publish (#992)

* Bump to v2.1.5-pre.1 - Publish empty `postinstall.js` file (#994)

* Bump to v2.1.5 (#996)

* Bump to v2.1.6-pre.1 - Fix `dist/package.json` (#998)

* Bump to v2.1.6 (#999)

* prefix (#1004)

* correct done (#1006)

* Add adjustment to rendering glyphs (#1005)

* add topAdjustment for glyph

* add topAdjustment for glyph

* update changelog

* add issue number

* add alphabet and cjk text test #1002

* fix lint error

* Simplify render tests (#1003)

Fixes #1008 

* Initial commit - half of the tests are failing

* Missing file

* Remove template rendering

* Fix usage of localizeUrls

* Move harness and server to render folder, simplify render code to be sepcific.

* Move function outside and add some typings

* lint

* Add typings, move compare results outside

* Remove server usage and replace it by file system reading.

* Move xhr mocking to main flow

* Move functions outside the render function

* Move creation of tests to render.ts, added more typings

* Move suite implementation into main flow file, add some typings.

* lint

* Moved all logic to a single file that runs the render tests

* remove color from harness

* Remove jest run command

* Small fixes

* lint

* Cleanup

* More cleanup

* Remove harness and move it to a single file. Remove the jest version.

* Remove ignore related code and tests

* Remove ignore, add types

* Add more types

* lint

* Migrate actual image generation to not use Buffer

* lint

* Fix CI run

* Fix CI properly this time...

* Revert png change

* Revert only buffer usage

* Revert png and buffer

* Simplify png in mock file

* Move to use uint8array and change throshold

* Added diff info

* remove specific threshold from test as it fails

* Fix typo

* Fix according to code review

* Husky pre-commit do not fix lint (#1019)

* Fix css

* Use main package-lock.json

Co-authored-by: Birk Skyum <74932975+birkskyum@users.noreply.github.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Harel M <harel.mazor@gmail.com>
Co-authored-by: Andrew Calcutt <acalcutt@techidiots.net>
Co-authored-by: acalcutt <acalcutt@worcester.edu>
Co-authored-by: vanilla-lake <95251033+vanilla-lake@users.noreply.github.com>
Co-authored-by: Astrid <astridx@users.noreply.github.com>
Co-authored-by: Kanahiro Iguchi <mediterranean1769@gmail.com>
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