From 706eb6e0471926df8d4ad089768f5459efe78237 Mon Sep 17 00:00:00 2001 From: Joxit Date: Mon, 8 Feb 2021 12:22:15 +0100 Subject: [PATCH 1/3] chore: move output files from mapbox.* to maplibre.* --- .github/workflows/analyze.yml | 2 +- build/{mapbox-gl.js.flow => maplibre-gl.js.flow} | 0 package.json | 14 +++++++------- rollup.config.csp.js | 6 +++--- rollup.config.js | 12 ++++++------ rollup/bundle_prelude.js | 6 +++--- rollup/{mapboxgl.js => maplibregl.js} | 12 ++++++------ src/css/{mapbox-gl.css => maplibre-gl.css} | 0 test/browser/fixtures/land.html | 4 ++-- test/build/dev.test.js | 4 ++-- test/build/min.test.js | 4 ++-- test/integration/testem.js | 2 +- test/integration/testem_page.html | 2 +- test/release/index.js | 4 ++-- 14 files changed, 36 insertions(+), 36 deletions(-) rename build/{mapbox-gl.js.flow => maplibre-gl.js.flow} (100%) rename rollup/{mapboxgl.js => maplibregl.js} (85%) rename src/css/{mapbox-gl.css => maplibre-gl.css} (100%) diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 7018757d9b..027deaa0ca 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -52,7 +52,7 @@ jobs: path: before repo: maplibre/maplibre-gl-js - run: yarn source-map-explorer before/mapbox-gl.js --gzip --json before.json - - run: yarn source-map-explorer after/mapbox-gl.js --gzip --json after.json + - run: yarn source-map-explorer after/maplibre-gl.js --gzip --json after.json - name: Build bundle size report run: node build/check-bundle-size.js > comment-body.txt - name: Dump bundle size report diff --git a/build/mapbox-gl.js.flow b/build/maplibre-gl.js.flow similarity index 100% rename from build/mapbox-gl.js.flow rename to build/maplibre-gl.js.flow diff --git a/package.json b/package.json index 2465a656dc..164c0a4308 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "maplibre-gl", "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library", "version": "1.13.0-rc.3", - "main": "dist/mapbox-gl.js", - "style": "dist/mapbox-gl.css", + "main": "dist/maplibre-gl.js", + "style": "dist/maplibre-gl.css", "license": "BSD-3-Clause", "repository": { "type": "git", @@ -129,10 +129,10 @@ "build-prod-min": "rollup -c --environment BUILD:production,MINIFY:true", "build-csp": "rollup -c rollup.config.csp.js", "build-query-suite": "rollup -c test/integration/rollup.config.test.js", - "build-flow-types": "mkdir -p dist && cp build/mapbox-gl.js.flow dist/mapbox-gl.js.flow && cp build/mapbox-gl.js.flow dist/mapbox-gl-dev.js.flow", - "build-css": "postcss -o dist/mapbox-gl.css src/css/mapbox-gl.css", + "build-flow-types": "mkdir -p dist && cp build/maplibre-gl.js.flow dist/maplibre-gl.js.flow && cp build/maplibre-gl.js.flow dist/maplibre-gl-dev.js.flow", + "build-css": "postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css", "build-style-spec": "cd src/style-spec && npm run build && cd ../.. && mkdir -p dist/style-spec && cp src/style-spec/dist/* dist/style-spec", - "watch-css": "postcss --watch -o dist/mapbox-gl.css src/css/mapbox-gl.css", + "watch-css": "postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css", "build-token": "node build/generate-access-token-script.js", "build-benchmarks": "BENCHMARK_VERSION=${BENCHMARK_VERSION:-\"$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --short=7 HEAD)\"} rollup -c bench/versions/rollup_config_benchmarks.js", "watch-benchmarks": "BENCHMARK_VERSION=${BENCHMARK_VERSION:-\"$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --short=7 HEAD)\"} rollup -c bench/rollup_config_benchmarks.js -w", @@ -146,7 +146,7 @@ "prepare-publish": "git clean -fdx && yarn install", "lint": "eslint --cache --ignore-path .gitignore src test bench debug/*.html", "lint-docs": "documentation lint src/index.js", - "lint-css": "stylelint 'src/css/mapbox-gl.css'", + "lint-css": "stylelint 'src/css/maplibre-gl.css'", "test": "run-s lint lint-css lint-docs test-flow test-unit", "test-suite": "run-s test-render test-query test-expressions", "test-suite-clean": "find test/integration/{render,query, expressions}-tests -mindepth 2 -type d -exec test -e \"{}/actual.png\" \\; -not \\( -exec test -e \"{}/style.json\" \\; \\) -print | xargs -t rm -r", @@ -166,7 +166,7 @@ }, "files": [ "build/", - "dist/mapbox-gl*", + "dist/maplibre-gl*", "dist/style-spec/", "flow-typed/*.js", "src/", diff --git a/rollup.config.csp.js b/rollup.config.csp.js index 8e1aee8e5e..a829145795 100644 --- a/rollup.config.csp.js +++ b/rollup.config.csp.js @@ -7,7 +7,7 @@ import banner from './build/banner'; const config = (input, file, format) => ({ input, output: { - name: 'mapboxgl', + name: 'maplibregl', file, format, sourcemap: true, @@ -19,6 +19,6 @@ const config = (input, file, format) => ({ }); export default [ - config('src/index.js', 'dist/mapbox-gl-csp.js', 'umd'), - config('src/source/worker.js', 'dist/mapbox-gl-csp-worker.js', 'iife') + config('src/index.js', 'dist/maplibre-gl-csp.js', 'umd'), + config('src/source/worker.js', 'dist/maplibre-gl-csp-worker.js', 'iife') ]; diff --git a/rollup.config.js b/rollup.config.js index b103700d52..84600f7523 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,8 +7,8 @@ const {BUILD, MINIFY} = process.env; const minified = MINIFY === 'true'; const production = BUILD === 'production'; const outputFile = - !production ? 'dist/mapbox-gl-dev.js' : - minified ? 'dist/mapbox-gl.js' : 'dist/mapbox-gl-unminified.js'; + !production ? 'dist/maplibre-gl-dev.js' : + minified ? 'dist/maplibre-gl.js' : 'dist/maplibre-gl-unminified.js'; export default [{ // First, use code splitting to bundle GL JS into three "chunks": @@ -21,7 +21,7 @@ export default [{ // sources as strings, etc. input: ['src/index.js', 'src/source/worker.js'], output: { - dir: 'rollup/build/mapboxgl', + dir: 'rollup/build/maplibregl', format: 'amd', sourcemap: 'inline', indent: false, @@ -32,10 +32,10 @@ export default [{ }, { // Next, bundle together the three "chunks" produced in the previous pass // into a single, final bundle. See rollup/bundle_prelude.js and - // rollup/mapboxgl.js for details. - input: 'rollup/mapboxgl.js', + // rollup/maplibregl.js for details. + input: 'rollup/maplibregl.js', output: { - name: 'mapboxgl', + name: 'maplibregl', file: outputFile, format: 'umd', sourcemap: production ? true : 'inline', diff --git a/rollup/bundle_prelude.js b/rollup/bundle_prelude.js index 4787f64f4d..0f8ba4da7a 100644 --- a/rollup/bundle_prelude.js +++ b/rollup/bundle_prelude.js @@ -1,6 +1,6 @@ /* eslint-disable */ -var shared, worker, mapboxgl; +var shared, worker, maplibregl; // define gets called three times: one for each chunk. we rely on the order // they're imported to know which is which function define(_, chunk) { @@ -13,9 +13,9 @@ if (!shared) { var sharedChunk = {}; shared(sharedChunk); - mapboxgl = chunk(sharedChunk); + maplibregl = chunk(sharedChunk); if (typeof window !== 'undefined') { - mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); + maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); } } } diff --git a/rollup/mapboxgl.js b/rollup/maplibregl.js similarity index 85% rename from rollup/mapboxgl.js rename to rollup/maplibregl.js index 5c13d5380c..232e6d729c 100644 --- a/rollup/mapboxgl.js +++ b/rollup/maplibregl.js @@ -1,7 +1,7 @@ // // Our custom intro provides a specialized "define()" function, called by the // AMD modules below, that sets up the worker blob URL and then executes the -// main module, storing its exported value as 'mapboxgl' +// main module, storing its exported value as 'maplibregl' // The three "chunks" imported here are produced by a first Rollup pass, // which outputs them as AMD modules. @@ -14,7 +14,7 @@ define(['exports'], function (exports) { // names rewritten to avoid collisions, etc.) }) */ -import './build/mapboxgl/shared'; +import './build/maplibregl/shared'; // Worker and its unique dependencies, i.e.: /* @@ -29,7 +29,7 @@ define(['./shared.js'], function (__shared__js) { // it gets stringified, together with the shared wrapper (using // Function.toString()), and the resulting string of code is made into a // Blob URL that gets used by the main module to create the web workers. -import './build/mapboxgl/worker'; +import './build/maplibregl/worker'; // Main module and its unique dependencies /* @@ -39,9 +39,9 @@ define(['./shared.js'], function (__shared__js) { // since all references to common deps look like, e.g., // __shared__js.shapeText(). // - // Returns the actual mapboxgl (i.e. src/index.js) + // Returns the actual maplibregl (i.e. src/index.js) }); */ -import './build/mapboxgl/index'; +import './build/maplibregl/index'; -export default mapboxgl; +export default maplibregl; diff --git a/src/css/mapbox-gl.css b/src/css/maplibre-gl.css similarity index 100% rename from src/css/mapbox-gl.css rename to src/css/maplibre-gl.css diff --git a/test/browser/fixtures/land.html b/test/browser/fixtures/land.html index 549667a274..07b4b2da94 100644 --- a/test/browser/fixtures/land.html +++ b/test/browser/fixtures/land.html @@ -4,7 +4,7 @@ Maplibre GL JS debug page - +
`) + .replace(/`) .replace('MAPBOX_ACCESS_TOKEN', process.env.MAPBOX_ACCESS_TOKEN); function waitForConsole(page) { @@ -33,8 +33,8 @@ function waitForConsole(page) { await page.setContent(benchHTML); const stats = JSON.parse(await waitForConsole(page)); - stats["bundle_size"] = mapboxGLJSSrc.length + mapboxGLCSSSrc.length; - stats["bundle_size_gz"] = zlib.gzipSync(mapboxGLJSSrc).length + zlib.gzipSync(mapboxGLCSSSrc).length; + stats["bundle_size"] = maplibreGLJSSrc.length + maplibreGLCSSSrc.length; + stats["bundle_size_gz"] = zlib.gzipSync(maplibreGLJSSrc).length + zlib.gzipSync(maplibreGLCSSSrc).length; stats.dt = execSync('git show --no-patch --no-notes --pretty=\'%cI\' HEAD').toString().substring(0, 19); stats.commit = execSync('git rev-parse --short HEAD').toString().trim(); stats.message = execSync('git show -s --format=%s HEAD').toString().trim(); diff --git a/bench/styles/benchmarks.js b/bench/styles/benchmarks.js index eb573073fc..9ca0233365 100644 --- a/bench/styles/benchmarks.js +++ b/bench/styles/benchmarks.js @@ -1,4 +1,4 @@ -import mapboxgl from '../../src'; +import maplibregl from '../../src'; import accessToken from '../lib/access_token'; import locationsWithTileID from '../lib/locations_with_tile_id'; import styleBenchmarkLocations from '@mapbox/gazetteer/benchmark/style-benchmark-locations.json'; @@ -13,7 +13,7 @@ import getWorkerPool from '../../src/util/global_worker_pool'; const locations = locationsWithTileID(styleBenchmarkLocations.features); -mapboxgl.accessToken = accessToken; +maplibregl.accessToken = accessToken; const benchmarks = window.benchmarks = []; @@ -44,4 +44,4 @@ Promise.resolve().then(() => { getWorkerPool().acquire(-1); }); -export default mapboxgl; +export default maplibregl; diff --git a/bench/styles/index.html b/bench/styles/index.html index 4344efa544..596e40c9c8 100644 --- a/bench/styles/index.html +++ b/bench/styles/index.html @@ -7,7 +7,7 @@ - + diff --git a/bench/versions/benchmarks.js b/bench/versions/benchmarks.js index 3738aded4e..f796b746a5 100644 --- a/bench/versions/benchmarks.js +++ b/bench/versions/benchmarks.js @@ -1,4 +1,4 @@ -import mapboxgl from '../../src'; +import maplibregl from '../../src'; import accessToken from '../lib/access_token'; import locationsWithTileID from '../lib/locations_with_tile_id'; import styleBenchmarkLocations from '@mapbox/gazetteer/benchmark/style-benchmark-locations.json'; @@ -25,15 +25,15 @@ import getWorkerPool from '../../src/util/global_worker_pool'; const styleLocations = locationsWithTileID(styleBenchmarkLocations.features); -mapboxgl.accessToken = accessToken; +maplibregl.accessToken = accessToken; -window.mapboxglBenchmarks = window.mapboxglBenchmarks || {}; +window.maplibreglBenchmarks = window.maplibreglBenchmarks || {}; const version = process.env.BENCHMARK_VERSION; function register(name, bench) { - window.mapboxglBenchmarks[name] = window.mapboxglBenchmarks[name] || {}; - window.mapboxglBenchmarks[name][version] = bench; + window.maplibreglBenchmarks[name] = window.maplibreglBenchmarks[name] || {}; + window.maplibreglBenchmarks[name][version] = bench; } const style = 'mapbox://styles/mapbox/streets-v10'; @@ -84,4 +84,4 @@ Promise.resolve().then(() => { getWorkerPool().acquire(-1); }); -export default mapboxgl; +export default maplibregl; diff --git a/bench/versions/index.html b/bench/versions/index.html index 81007f00aa..eeacafba91 100644 --- a/bench/versions/index.html +++ b/bench/versions/index.html @@ -7,7 +7,7 @@ - + diff --git a/debug/.eslintrc b/debug/.eslintrc index 5e8b0a0b21..62ffd8a1f1 100644 --- a/debug/.eslintrc +++ b/debug/.eslintrc @@ -22,7 +22,7 @@ "browser": true }, "globals": { - "mapboxgl": false, + "maplibregl": false, "React": false, "ReactDOM": false } diff --git a/debug/2762.html b/debug/2762.html index 753f0131a2..0176af5cff 100644 --- a/debug/2762.html +++ b/debug/2762.html @@ -4,7 +4,7 @@ Mapbox GL JS debug page - + @@ -13,11 +13,11 @@
- + + + + + + + diff --git a/debug/color_spaces.html b/debug/color_spaces.html index f3bc0164bb..6eb9c6723a 100644 --- a/debug/color_spaces.html +++ b/debug/color_spaces.html @@ -4,7 +4,7 @@ Mapbox GL JS debug page - +