maplibre-gl 2.0.0-pre.6 → 2.0.3
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.
- package/README.md +10 -1
- package/build/generate-struct-arrays.ts +4 -4
- package/build/generate-style-spec.ts +29 -9
- package/build/glsl_to_js.js +12 -0
- package/build/post-ts-build.js +3 -11
- package/build/release-notes.js +11 -35
- package/build/rollup_plugins.js +24 -2
- package/dist/maplibre-gl.d.ts +2916 -2959
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +29 -24
- package/src/data/array_types.ts +21 -21
- package/src/data/bucket/circle_bucket.ts +1 -1
- package/src/data/bucket/fill_bucket.test.ts +2 -2
- package/src/data/bucket/fill_bucket.ts +1 -1
- package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
- package/src/data/bucket/line_bucket.test.ts +2 -2
- package/src/data/bucket/line_bucket.ts +1 -1
- package/src/data/bucket/symbol_bucket.ts +1 -1
- package/src/data/bucket.ts +1 -1
- package/src/data/evaluation_feature.ts +1 -1
- package/src/data/feature_index.ts +3 -3
- package/src/data/load_geometry.ts +1 -1
- package/src/geo/edge_insets.ts +1 -1
- package/src/geo/lng_lat.ts +2 -2
- package/src/geo/transform.test.ts +1 -1
- package/src/geo/transform.ts +1 -1
- package/src/index.ts +11 -15
- package/src/render/draw_symbol.ts +1 -1
- package/src/render/glyph_manager.ts +1 -1
- package/src/source/geojson_source.test.ts +380 -0
- package/src/source/geojson_source.ts +35 -50
- package/src/source/geojson_worker_source.test.ts +277 -0
- package/src/source/geojson_wrapper.ts +1 -1
- package/src/source/image_source.ts +4 -4
- package/src/source/query_features.test.ts +1 -1
- package/src/source/query_features.ts +1 -1
- package/src/source/raster_dem_tile_source.test.ts +152 -0
- package/src/source/raster_dem_tile_worker_source.test.ts +38 -0
- package/src/source/raster_tile_source.test.ts +141 -0
- package/src/source/source.ts +3 -3
- package/src/source/source_cache.test.ts +1594 -0
- package/src/source/source_cache.ts +1 -1
- package/src/source/tile.ts +1 -1
- package/src/source/tile_id.ts +1 -1
- package/src/source/vector_tile_source.test.ts +7 -19
- package/src/source/vector_tile_source.ts +4 -4
- package/src/source/vector_tile_worker_source.test.ts +306 -0
- package/src/source/video_source.test.ts +64 -0
- package/src/source/video_source.ts +1 -1
- package/src/source/worker_tile.test.ts +102 -0
- package/src/style/load_glyph_range.test.ts +45 -0
- package/src/style/query_utils.ts +1 -1
- package/src/style/style.test.ts +2119 -0
- package/src/style/style.ts +3 -3
- package/src/style/style_layer/circle_style_layer.ts +1 -1
- package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -1
- package/src/style/style_layer/fill_style_layer.ts +1 -1
- package/src/style/style_layer/line_style_layer.ts +1 -1
- package/src/style/style_layer.ts +13 -16
- package/src/style-spec/CHANGELOG.md +6 -0
- package/src/style-spec/expression/index.ts +1 -1
- package/src/style-spec/feature_filter/convert.ts +11 -11
- package/src/style-spec/feature_filter/feature_filter.test.ts +5 -5
- package/src/style-spec/format.ts +2 -2
- package/src/style-spec/migrate/v8.test.ts +507 -0
- package/src/style-spec/migrate/v9.test.ts +76 -0
- package/src/style-spec/migrate.test.ts +112 -0
- package/src/style-spec/package.json +1 -1
- package/src/style-spec/reference/v8.json +11 -11
- package/src/style-spec/style-spec.ts +0 -3
- package/src/style-spec/types.ts +29 -9
- package/src/style-spec/validate_spec.test.ts +29 -0
- package/src/style-spec/validate_style.min.ts +1 -1
- package/src/symbol/anchor.ts +1 -1
- package/src/symbol/check_max_angle.test.ts +1 -1
- package/src/symbol/check_max_angle.ts +1 -1
- package/src/symbol/clip_line.test.ts +1 -1
- package/src/symbol/clip_line.ts +1 -1
- package/src/symbol/collision_feature.test.ts +1 -1
- package/src/symbol/collision_feature.ts +1 -1
- package/src/symbol/collision_index.ts +13 -7
- package/src/symbol/get_anchors.test.ts +1 -1
- package/src/symbol/get_anchors.ts +1 -1
- package/src/symbol/grid_index.test.ts +4 -4
- package/src/symbol/grid_index.ts +113 -69
- package/src/symbol/mergelines.test.ts +1 -1
- package/src/symbol/path_interpolator.test.ts +1 -1
- package/src/symbol/path_interpolator.ts +1 -1
- package/src/symbol/placement.ts +30 -25
- package/src/symbol/projection.ts +1 -1
- package/src/symbol/quads.ts +1 -1
- package/src/symbol/shaping.test.ts +1 -1
- package/src/symbol/symbol_layout.ts +27 -20
- package/src/ui/camera.test.ts +1875 -0
- package/src/ui/camera.ts +6 -5
- package/src/ui/control/attribution_control.test.ts +178 -102
- package/src/ui/control/attribution_control.ts +18 -18
- package/src/ui/control/control.ts +1 -1
- package/src/ui/control/navigation_control.ts +1 -1
- package/src/ui/events.ts +15 -6
- package/src/ui/handler/box_zoom.ts +1 -1
- package/src/ui/handler/click_zoom.ts +1 -1
- package/src/ui/handler/dblclick_zoom.test.ts +181 -0
- package/src/ui/handler/drag_pan.test.ts +488 -0
- package/src/ui/handler/drag_rotate.test.ts +861 -0
- package/src/ui/handler/handler_util.ts +1 -1
- package/src/ui/handler/keyboard.test.ts +237 -0
- package/src/ui/handler/map_event.test.ts +96 -0
- package/src/ui/handler/map_event.ts +1 -1
- package/src/ui/handler/mouse.ts +1 -1
- package/src/ui/handler/mouse_rotate.test.ts +64 -0
- package/src/ui/handler/scroll_zoom.test.ts +275 -0
- package/src/ui/handler/scroll_zoom.ts +1 -1
- package/src/ui/handler/tap_drag_zoom.ts +1 -1
- package/src/ui/handler/tap_recognizer.ts +1 -1
- package/src/ui/handler/tap_zoom.ts +1 -1
- package/src/ui/handler/touch_pan.ts +1 -1
- package/src/ui/handler/touch_zoom_rotate.test.ts +285 -0
- package/src/ui/handler/touch_zoom_rotate.ts +1 -1
- package/src/ui/handler_inertia.ts +1 -1
- package/src/ui/handler_manager.ts +1 -1
- package/src/ui/map/requestRenderFrame.test.ts +41 -0
- package/src/ui/map.test.ts +2063 -0
- package/src/ui/map.ts +99 -104
- package/src/ui/map_events.test.ts +617 -0
- package/src/ui/marker.test.ts +774 -0
- package/src/ui/marker.ts +3 -2
- package/src/ui/popup.test.ts +739 -0
- package/src/ui/popup.ts +4 -4
- package/src/util/actor.test.ts +73 -0
- package/src/util/ajax.ts +10 -6
- package/src/util/browser.test.ts +1 -1
- package/src/util/classify_rings.test.ts +1 -1
- package/src/util/classify_rings.ts +1 -1
- package/src/util/dispatcher.test.ts +54 -0
- package/src/util/dom.ts +1 -1
- package/src/util/evented.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.ts +1 -1
- package/src/util/intersection_tests.ts +1 -1
- package/src/util/smart_wrap.ts +1 -1
- package/src/util/test/util.ts +27 -4
- package/src/util/tile_request_cache.test.ts +101 -0
- package/src/util/transferable_grid_index.test.ts +56 -0
- package/src/util/transferable_grid_index.ts +216 -0
- package/src/util/util.test.ts +309 -0
- package/src/util/util.ts +1 -1
- package/src/util/web_worker_transfer.test.ts +80 -0
- package/src/util/web_worker_transfer.ts +1 -17
- package/CHANGELOG.md +0 -2568
- package/dist/package.json +0 -1
- package/src/types/non-typed-modules.d.ts +0 -47
- package/src/util/point.ts +0 -349
package/README.md
CHANGED
|
@@ -17,6 +17,15 @@ Use
|
|
|
17
17
|
|
|
18
18
|
if it is important to you that the behaviour is similar to `mapbox-gl` version 1.x.
|
|
19
19
|
|
|
20
|
+
If you are OK with changes that integrate non-backward compatible features, install `maplibre-gl` version 2:
|
|
21
|
+
|
|
22
|
+
```diff
|
|
23
|
+
"dependencies": {
|
|
24
|
+
- "mapbox-gl": "^1.13.0"
|
|
25
|
+
+ "maplibre-gl": ">=2.0.0"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
20
29
|
And replace `mapboxgl` with `maplibregl` in your JavaScript and optionally in your HTML/CSS code:
|
|
21
30
|
|
|
22
31
|
> MapLibre GL JS is distributed via [unpkg.com](https://unpkg.com). For more informations please see [MapLibre GL is on unpkg.com](./docs/README-unpkg.md#maplibre-gl-on-unpkgcom).
|
|
@@ -66,7 +75,7 @@ If you depend on a free software alternative to `mapbox-gl-js`, please consider
|
|
|
66
75
|
|
|
67
76
|
### Thank you Mapbox 🙏🏽
|
|
68
77
|
|
|
69
|
-
We'd like to acknowledge the amazing work Mapbox has contributed to open source. The open source community is sad to part ways with them, but we simultaneously feel grateful for everything they already contributed. `mapbox-gl-js` 1.x is an open source
|
|
78
|
+
We'd like to acknowledge the amazing work Mapbox has contributed to open source. The open source community is sad to part ways with them, but we simultaneously feel grateful for everything they already contributed. `mapbox-gl-js` 1.x is an open source achievement which now lives on as `maplibre-gl`. We're proud to develop on the shoulders of giants, thank you Mapbox 🙇🏽♀️.
|
|
70
79
|
|
|
71
80
|
Please keep in mind: Unauthorized backports are the biggest threat to the MapLibre project. It is unacceptable to backport code from mapbox-gl-js, which is not covered by the former BSD-3 license. If you are unsure about this issue, [please ask](https://github.com/maplibre/maplibre-gl-js/discussions)!
|
|
72
81
|
|
|
@@ -87,7 +87,7 @@ function createStructArrayType(name: string, layout: StructArrayLayout, includeS
|
|
|
87
87
|
includeStructAccessors
|
|
88
88
|
});
|
|
89
89
|
} else {
|
|
90
|
-
arrayTypeEntries.add(
|
|
90
|
+
arrayTypeEntries.add(`export class ${arrayClass} extends ${layoutClass} {}`);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -428,12 +428,12 @@ fs.writeFileSync('src/data/array_types.ts',
|
|
|
428
428
|
import assert from 'assert';
|
|
429
429
|
import {Struct, StructArray} from '../util/struct_array';
|
|
430
430
|
import {register} from '../util/web_worker_transfer';
|
|
431
|
-
import Point from '
|
|
431
|
+
import Point from '@mapbox/point-geometry';
|
|
432
432
|
|
|
433
433
|
${layouts.map(emitStructArrayLayout).join('\n')}
|
|
434
434
|
${arraysWithStructAccessors.map(emitStructArray).join('\n')}
|
|
435
|
+
${[...arrayTypeEntries].join('\n')}
|
|
435
436
|
export {
|
|
436
|
-
${layouts.map(layout => layout.className).join(',\n ')}
|
|
437
|
-
${[...arrayTypeEntries].join(',\n ')}
|
|
437
|
+
${layouts.map(layout => layout.className).join(',\n ')}
|
|
438
438
|
};
|
|
439
439
|
`);
|
|
@@ -125,16 +125,36 @@ export type ResolvedImageSpecification = string;
|
|
|
125
125
|
|
|
126
126
|
export type PromoteIdSpecification = {[_: string]: string} | string;
|
|
127
127
|
|
|
128
|
+
export type FilterSpecificationInputType = string | number | boolean;
|
|
128
129
|
export type FilterSpecification =
|
|
129
|
-
|
|
130
|
-
| ['
|
|
131
|
-
| ['
|
|
132
|
-
| ['
|
|
133
|
-
| ['
|
|
134
|
-
| ['
|
|
135
|
-
| ['
|
|
136
|
-
| ['
|
|
137
|
-
|
|
130
|
+
// Lookup
|
|
131
|
+
| ['at', number, (number |string)[]]
|
|
132
|
+
| ['get', string, Record<string, unknown>?]
|
|
133
|
+
| ['has', string, Record<string, unknown>?]
|
|
134
|
+
| ['in', ...FilterSpecificationInputType[], FilterSpecificationInputType | FilterSpecificationInputType[]]
|
|
135
|
+
| ['index-of', FilterSpecificationInputType, FilterSpecificationInputType | FilterSpecificationInputType[]]
|
|
136
|
+
| ['length', string | string[]]
|
|
137
|
+
| ['slice', string | string[], number]
|
|
138
|
+
// Decision
|
|
139
|
+
| ['!', FilterSpecification]
|
|
140
|
+
| ['!=', string | FilterSpecification, FilterSpecificationInputType]
|
|
141
|
+
| ['<', string | FilterSpecification, FilterSpecificationInputType]
|
|
142
|
+
| ['<=', string | FilterSpecification, FilterSpecificationInputType]
|
|
143
|
+
| ['==', string | FilterSpecification, FilterSpecificationInputType]
|
|
144
|
+
| ['>', string | FilterSpecification, FilterSpecificationInputType]
|
|
145
|
+
| ['>=', string | FilterSpecification, FilterSpecificationInputType]
|
|
146
|
+
| ["all", ...FilterSpecification[], FilterSpecificationInputType]
|
|
147
|
+
| ["any", ...FilterSpecification[], FilterSpecificationInputType]
|
|
148
|
+
| ["case", ...FilterSpecification[], FilterSpecificationInputType]
|
|
149
|
+
| ["coalesce", ...FilterSpecification[], FilterSpecificationInputType]
|
|
150
|
+
| ["match", ...FilterSpecification[], FilterSpecificationInputType]
|
|
151
|
+
| ["within", ...FilterSpecification[], FilterSpecificationInputType]
|
|
152
|
+
// Used in convert.ts
|
|
153
|
+
| ["!in", ...FilterSpecification[], FilterSpecificationInputType]
|
|
154
|
+
| ["!has", ...FilterSpecification[], FilterSpecificationInputType]
|
|
155
|
+
| ["none", ...FilterSpecification[], FilterSpecificationInputType]
|
|
156
|
+
// Fallbak for others
|
|
157
|
+
| Array<string | FilterSpecification>
|
|
138
158
|
|
|
139
159
|
export type TransitionSpecification = {
|
|
140
160
|
duration?: number,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function glsl_to_js(code, minify) {
|
|
2
|
+
if (minify) {
|
|
3
|
+
code = code.trim() // strip whitespace at the start/end
|
|
4
|
+
.replace(/\s*\/\/[^\n]*\n/g, '\n') // strip double-slash comments
|
|
5
|
+
.replace(/\n+/g, '\n') // collapse multi line breaks
|
|
6
|
+
.replace(/\n\s+/g, '\n') // strip identation
|
|
7
|
+
.replace(/\s?([+-\/*=,])\s?/g, '$1') // strip whitespace around operators
|
|
8
|
+
.replace(/([;\(\),\{\}])\n(?=[^#])/g, '$1'); // strip more line breaks
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
return `export default ${JSON.stringify(code)};`;
|
|
12
|
+
}
|
package/build/post-ts-build.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import glob from 'glob';
|
|
3
3
|
import child_process from 'child_process';
|
|
4
|
+
import glsl_to_js from './glsl_to_js.js';
|
|
4
5
|
|
|
5
6
|
let args = process.argv.slice(2);
|
|
6
7
|
let outputBaseDir = args[0];
|
|
@@ -19,17 +20,7 @@ console.log(`Copying glsl files to ${outputBaseDir}, minify: ${minify}`);
|
|
|
19
20
|
glob("./src/**/*.glsl", null, (err, files) => {
|
|
20
21
|
for (let file of files) {
|
|
21
22
|
let code = fs.readFileSync(file, 'utf8');
|
|
22
|
-
|
|
23
|
-
if (minify) {
|
|
24
|
-
code = code.trim() // strip whitespace at the start/end
|
|
25
|
-
.replace(/\s*\/\/[^\n]*\n/g, '\n') // strip double-slash comments
|
|
26
|
-
.replace(/\n+/g, '\n') // collapse multi line breaks
|
|
27
|
-
.replace(/\n\s+/g, '\n') // strip identation
|
|
28
|
-
.replace(/\s?([+-\/*=,])\s?/g, '$1') // strip whitespace around operators
|
|
29
|
-
.replace(/([;\(\),\{\}])\n(?=[^#])/g, '$1'); // strip more line breaks
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
let content = `export default ${JSON.stringify(code)};`
|
|
23
|
+
let content = glsl_to_js(code, minify);
|
|
33
24
|
let fileName = outputBaseDir + '/' + file.split('/').splice(-1) + ".js";
|
|
34
25
|
fs.writeFileSync(fileName, content);
|
|
35
26
|
}
|
|
@@ -44,6 +35,7 @@ console.log(`Starting bundling types`);
|
|
|
44
35
|
const outputFile = "./dist/maplibre-gl.d.ts";
|
|
45
36
|
child_process.execSync(`dts-bundle-generator --no-check --umd-module-name=maplibregl -o ${outputFile} ./src/index.ts`);
|
|
46
37
|
let types = fs.readFileSync(outputFile, 'utf8');
|
|
38
|
+
// Classes are not exported but should be since this is exported as UMD - fixing...
|
|
47
39
|
types = types.replace(/declare class/g, "export declare class");
|
|
48
40
|
fs.writeFileSync(outputFile, types);
|
|
49
41
|
console.log(`Finished bundling types`);
|
package/build/release-notes.js
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const _ = require('lodash');
|
|
7
|
-
const semver = require('semver');
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as ejs from 'ejs';
|
|
5
|
+
import semver from 'semver';
|
|
8
6
|
|
|
9
7
|
const changelogPath = 'CHANGELOG.md';
|
|
10
8
|
const changelog = fs.readFileSync(changelogPath, 'utf8');
|
|
11
9
|
|
|
12
|
-
let currentVersion = execSync('git describe --tags --match=v*.*.* --abbrev=0')
|
|
13
|
-
.toString()
|
|
14
|
-
.trim()
|
|
15
|
-
.replace('v', '');
|
|
16
|
-
|
|
17
|
-
let gitTags = execSync('git tag --list v*.*.*')
|
|
18
|
-
.toString()
|
|
19
|
-
.split('\n')
|
|
20
|
-
.map(function(tag) {
|
|
21
|
-
tag = tag.replace('v', '').trim();
|
|
22
|
-
return semver.clean(tag);
|
|
23
|
-
});
|
|
24
|
-
let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion, { includePrerelease: false });
|
|
25
|
-
|
|
26
10
|
/*
|
|
27
11
|
Parse the raw changelog text and split it into individual releases.
|
|
28
12
|
|
|
@@ -33,9 +17,10 @@ let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion, { incl
|
|
|
33
17
|
- Groups the changelog content.
|
|
34
18
|
- Ends when another "## x.x.x" is found.
|
|
35
19
|
*/
|
|
36
|
-
const regex = /^## (\d+\.\d+\.\d
|
|
20
|
+
const regex = /^## (\d+\.\d+\.\d+.*?)\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms;
|
|
37
21
|
|
|
38
22
|
let releaseNotes = [];
|
|
23
|
+
let match;
|
|
39
24
|
// eslint-disable-next-line no-cond-assign
|
|
40
25
|
while (match = regex.exec(changelog)) {
|
|
41
26
|
releaseNotes.push({
|
|
@@ -44,17 +29,8 @@ while (match = regex.exec(changelog)) {
|
|
|
44
29
|
});
|
|
45
30
|
}
|
|
46
31
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
const versionsInReleaseNotes = _.map(releaseNotes, 'version');
|
|
51
|
-
const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion);
|
|
52
|
-
const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion });
|
|
53
|
-
|
|
54
|
-
if (!currentReleaseNotes) {
|
|
55
|
-
console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "main" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]);
|
|
56
|
-
process.exit(1); // eslint-disable-line no-process-exit
|
|
57
|
-
}
|
|
32
|
+
const latest = releaseNotes[0];
|
|
33
|
+
const previous = releaseNotes[1];
|
|
58
34
|
|
|
59
35
|
/*
|
|
60
36
|
Fill and print the release notes template.
|
|
@@ -62,10 +38,10 @@ if (!currentReleaseNotes) {
|
|
|
62
38
|
let templatedReleaseNotes;
|
|
63
39
|
|
|
64
40
|
templatedReleaseNotes = ejs.render(fs.readFileSync('build/release-notes.md.ejs', 'utf8'), {
|
|
65
|
-
'CURRENTVERSION':
|
|
66
|
-
'PREVIOUSVERSION':
|
|
67
|
-
'CHANGELOG':
|
|
68
|
-
'isPrerelease': semver.prerelease(
|
|
41
|
+
'CURRENTVERSION': latest.version,
|
|
42
|
+
'PREVIOUSVERSION': previous.version,
|
|
43
|
+
'CHANGELOG': latest.changelog,
|
|
44
|
+
'isPrerelease': semver.prerelease(latest.version)
|
|
69
45
|
});
|
|
70
46
|
templatedReleaseNotes = templatedReleaseNotes.trimEnd();
|
|
71
47
|
|
package/build/rollup_plugins.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
3
|
import resolve from '@rollup/plugin-node-resolve';
|
|
3
4
|
import replace from '@rollup/plugin-replace';
|
|
4
5
|
import commonjs from '@rollup/plugin-commonjs';
|
|
@@ -6,12 +7,14 @@ import unassert from 'rollup-plugin-unassert';
|
|
|
6
7
|
import json from '@rollup/plugin-json';
|
|
7
8
|
import {terser} from 'rollup-plugin-terser';
|
|
8
9
|
import minifyStyleSpec from './rollup_plugin_minify_style_spec.js';
|
|
10
|
+
import {createFilter} from 'rollup-pluginutils';
|
|
9
11
|
import strip from '@rollup/plugin-strip';
|
|
12
|
+
import glsl_to_js from './glsl_to_js.js';
|
|
10
13
|
|
|
11
14
|
// Common set of plugins/transformations shared across different rollup
|
|
12
15
|
// builds (main maplibre bundle, style-spec package, benchmarks bundle)
|
|
13
16
|
|
|
14
|
-
export const plugins = (minified, production) => [
|
|
17
|
+
export const plugins = (minified, production, watch) => [
|
|
15
18
|
minifyStyleSpec(),
|
|
16
19
|
json(),
|
|
17
20
|
// https://github.com/zaach/jison/issues/351
|
|
@@ -26,20 +29,39 @@ export const plugins = (minified, production) => [
|
|
|
26
29
|
sourceMap: true,
|
|
27
30
|
functions: ['PerformanceUtils.*', 'Debug.*']
|
|
28
31
|
}) : false,
|
|
32
|
+
glsl('**/*.glsl', production),
|
|
29
33
|
minified ? terser({
|
|
30
34
|
compress: {
|
|
31
35
|
pure_getters: true,
|
|
32
36
|
passes: 3
|
|
33
37
|
}
|
|
34
38
|
}) : false,
|
|
35
|
-
production ? unassert(
|
|
39
|
+
production ? unassert({
|
|
40
|
+
include: ['**/*'], // by default, unassert only includes .js files
|
|
41
|
+
}) : false,
|
|
36
42
|
resolve({
|
|
37
43
|
browser: true,
|
|
38
44
|
preferBuiltins: false
|
|
39
45
|
}),
|
|
46
|
+
watch ? typescript() : false,
|
|
40
47
|
commonjs({
|
|
41
48
|
// global keyword handling causes Webpack compatibility issues, so we disabled it:
|
|
42
49
|
// https://github.com/mapbox/mapbox-gl-js/pull/6956
|
|
43
50
|
ignoreGlobal: true
|
|
44
51
|
})
|
|
45
52
|
].filter(Boolean);
|
|
53
|
+
|
|
54
|
+
// Using this instead of rollup-plugin-string to add minification
|
|
55
|
+
function glsl(include, minify) {
|
|
56
|
+
const filter = createFilter(include);
|
|
57
|
+
return {
|
|
58
|
+
name: 'glsl',
|
|
59
|
+
transform(code, id) {
|
|
60
|
+
if (!filter(id)) return;
|
|
61
|
+
return {
|
|
62
|
+
code: glsl_to_js(code, minify),
|
|
63
|
+
map: {mappings: ''}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|