Skip to content

Commit 1831bbc

Browse files
avpeerystepankuzminmourner
authored
Cherry picks v2.8.1 (#11751)
* add missing roundZoom in CustomSource coveringTiles (#11749) * Fix CSP bundle by not mangling class names there, and add CSP tests (#11739) * fix CSP bundle by not mangling class names there * add a render tests job that uses the CSP bundle * fix lint * update patch version too Co-authored-by: Stepan Kuzmin <[email protected]> Co-authored-by: Volodymyr Agafonkin <[email protected]>
1 parent 4cc3a8d commit 1831bbc

File tree

11 files changed

+64
-9
lines changed

11 files changed

+64
-9
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ workflows:
6767
filters:
6868
tags:
6969
only: /.*/
70+
- test-render-csp:
71+
requires:
72+
- prepare
73+
filters:
74+
tags:
75+
only: /.*/
7076
- test-query:
7177
requires:
7278
- prepare
@@ -271,6 +277,18 @@ jobs:
271277
- store_artifacts:
272278
path: "test/integration/render-tests/index.html"
273279

280+
test-render-csp:
281+
<<: *defaults
282+
steps:
283+
- attach_workspace:
284+
at: ~/
285+
- browser-tools/install-chrome
286+
- run: yarn run test-render-csp
287+
- store_test_results:
288+
path: test/integration/render-tests
289+
- store_artifacts:
290+
path: "test/integration/render-tests/index.html"
291+
274292
test-query:
275293
<<: *defaults
276294
steps:

bench/rollup_config_benchmarks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const replaceConfig = {
2020
'process.env.NODE_ENV': JSON.stringify('production')
2121
};
2222

23-
const allPlugins = plugins(true, true).concat(replace(replaceConfig));
23+
const allPlugins = plugins({minified: true, production: true}).concat(replace(replaceConfig));
2424
const intro = fs.readFileSync('rollup/bundle_prelude.js', 'utf8');
2525

2626
const splitConfig = (name) => [{

build/rollup_plugins.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import replace from '@rollup/plugin-replace';
1313
// Common set of plugins/transformations shared across different rollup
1414
// builds (main mapboxgl bundle, style-spec package, benchmarks bundle)
1515

16-
export const plugins = (minified, production, test, bench) => [
16+
export const plugins = ({minified, production, test, bench, keepClassNames}) => [
1717
flow(),
1818
minifyStyleSpec(),
1919
json({
@@ -33,7 +33,8 @@ export const plugins = (minified, production, test, bench) => [
3333
compress: {
3434
pure_getters: true,
3535
passes: 3
36-
}
36+
},
37+
keep_classnames: keepClassNames
3738
}) : false,
3839
resolve({
3940
browser: true,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mapbox-gl",
33
"description": "A WebGL interactive maps library",
4-
"version": "2.8.0",
4+
"version": "2.8.1",
55
"main": "dist/mapbox-gl.js",
66
"style": "dist/mapbox-gl.css",
77
"license": "SEE LICENSE IN LICENSE.txt",
@@ -139,6 +139,7 @@
139139
"watch-query": "SUITE_NAME=query testem -f test/integration/testem/testem.js",
140140
"test-render": "SUITE_NAME=render CI=true testem ci -f test/integration/testem/testem.js",
141141
"test-render-prod": "BUILD=production SUITE_NAME=render CI=true testem ci -f test/integration/testem/testem.js",
142+
"test-render-csp": "BUILD=csp SUITE_NAME=render CI=true testem ci -f test/integration/testem/testem.js",
142143
"test-query": "SUITE_NAME=query CI=true testem ci -f test/integration/testem/testem.js",
143144
"test-expressions": "build/run-node test/expression.test.js",
144145
"test-flow": "build/run-node build/generate-flow-typed-style-spec && flow .",

rollup.config.csp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const config = (input, file, format) => ({
1515
banner
1616
},
1717
treeshake: true,
18-
plugins: plugins(true, true, false)
18+
plugins: plugins({minified: true, production: true, keepClassNames: true})
1919
});
2020

2121
export default [

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default [{
4242
chunkFileNames: 'shared.js'
4343
},
4444
treeshake: production,
45-
plugins: plugins(minified, production, false, bench)
45+
plugins: plugins({minified, production, bench})
4646
}, {
4747
// Next, bundle together the three "chunks" produced in the previous pass
4848
// into a single, final bundle. See rollup/bundle_prelude.js and

src/source/custom_source.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ class CustomSource<T> extends Evented implements Source {
358358
tileSize: this.tileSize,
359359
minzoom: this.minzoom,
360360
maxzoom: this.maxzoom,
361+
roundZoom: this.roundZoom
361362
});
362363

363364
return tileIDs.map(tileID => ({x: tileID.canonical.x, y: tileID.canonical.y, z: tileID.canonical.z}));

src/util/web_worker_transfer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ type SerializedGrid = { buffer: ArrayBuffer };
7777
(Grid: any).deserialize = function deserialize(serialized: SerializedGrid): Grid {
7878
return new Grid(serialized.buffer);
7979
};
80+
81+
Object.defineProperty(Grid, 'name', {value: 'Grid'});
82+
8083
register(Grid);
8184

8285
register(Color);

test/integration/rollup.config.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ export default {
1111
indent: false,
1212
file: `test/integration/dist/integration-test.js`
1313
},
14-
plugins: plugins(false, false, true),
14+
plugins: plugins({test: true}),
1515
external: [ 'tape', 'mapboxgl' ]
1616
};

test/integration/testem/testem.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ const suiteName = process.env.SUITE_NAME;
2424
const suitePath = `${suiteName}-tests`;
2525
const ciOutputFile = `${rootFixturePath}${suitePath}/test-results.xml`;
2626
const fixtureBuildInterval = 2000;
27-
const testPage = process.env.BUILD === "production" ? "test/integration/testem_page_prod.html" : "test/integration/testem_page_dev.html";
28-
const buildJob = process.env.BUILD === "production" ? "build-prod-min" : "build-dev";
27+
28+
const testPage = `test/integration/testem_page_${
29+
process.env.BUILD === "production" ? "prod" :
30+
process.env.BUILD === "csp" ? "csp" : "dev"
31+
}.html`;
32+
33+
const buildJob =
34+
process.env.BUILD === "production" ? "build-prod-min" :
35+
process.env.BUILD === "csp" ? "build-csp" : "build-dev";
2936

3037
let beforeHookInvoked = false;
3138
let server;

0 commit comments

Comments
 (0)