diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b5138c8757..e45b46aba3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### 🐞 Bug fixes - *...Add new stuff here...* +- Remove dependency on `@rollup/plugin-json`, which was in conflict with `rollup-plugin-import-assert` - Remove dependency on `@mapbox/gazetteer` which caused some build warnings ([#1898](https://github.com/maplibre/maplibre-gl-js/pull/1757)[#1898](https://github.com/maplibre/maplibre-gl-js/pull/1898)) - Fix `getElevation()` causing uncaught error ([#1650](https://github.com/maplibre/maplibre-gl-js/issues/1650)). - Add dev version for csp build ([#1730](https://github.com/maplibre/maplibre-gl-js/pull/1730)) diff --git a/build/rollup_plugins.ts b/build/rollup_plugins.ts index 1d62ed53f53..1f4c89a3718 100644 --- a/build/rollup_plugins.ts +++ b/build/rollup_plugins.ts @@ -3,7 +3,6 @@ import typescript from '@rollup/plugin-typescript'; import resolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; import {terser} from 'rollup-plugin-terser'; import minifyStyleSpec from './rollup_plugin_minify_style_spec'; import strip from '@rollup/plugin-strip'; @@ -21,7 +20,6 @@ export const nodeResolve = resolve({ export const plugins = (production: boolean): Plugin[] => [ minifyStyleSpec(), importAssertionsPlugin(), - json(), // https://github.com/zaach/jison/issues/351 replace({ preventAssignment: true, diff --git a/package-lock.json b/package-lock.json index bceb51894a2..97a8babafcf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,6 @@ "@mapbox/mapbox-gl-rtl-text": "^0.2.3", "@mapbox/mvt-fixtures": "^3.10.0", "@rollup/plugin-commonjs": "^23.0.3", - "@rollup/plugin-json": "^5.0.2", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.1", "@rollup/plugin-strip": "^3.0.1", @@ -65,7 +64,6 @@ "@types/react": "^18.0.26", "@types/react-dom": "^18.0.9", "@types/request": "^2.48.8", - "@types/rollup-plugin-json": "^3.0.3", "@types/shuffle-seed": "^1.1.0", "@types/supercluster": "^7.1.0", "@types/window-or-global": "^1.0.4", @@ -1512,54 +1510,6 @@ "node": ">=12" } }, - "node_modules/@rollup/plugin-json": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-5.0.2.tgz", - "integrity": "sha512-D1CoOT2wPvadWLhVcmpkDnesTzjhNIQRWLsc3fA49IFOP2Y84cFOOJ+nKGYedvXHKUsPeq07HR4hXpBBr+CHlA==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^5.0.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-json/node_modules/@rollup/pluginutils": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", - "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-json/node_modules/@types/estree": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", - "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", - "dev": true - }, "node_modules/@rollup/plugin-node-resolve": { "version": "15.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz", @@ -2563,27 +2513,6 @@ "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", "dev": true }, - "node_modules/@types/rollup-plugin-json": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "rollup": "^0.63.4" - } - }, - "node_modules/@types/rollup-plugin-json/node_modules/rollup": { - "version": "0.63.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "0.0.39", - "@types/node": "*" - }, - "bin": { - "rollup": "bin/rollup" - } - }, "node_modules/@types/scheduler": { "version": "0.16.2", "dev": true, @@ -18088,34 +18017,6 @@ } } }, - "@rollup/plugin-json": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-5.0.2.tgz", - "integrity": "sha512-D1CoOT2wPvadWLhVcmpkDnesTzjhNIQRWLsc3fA49IFOP2Y84cFOOJ+nKGYedvXHKUsPeq07HR4hXpBBr+CHlA==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^5.0.1" - }, - "dependencies": { - "@rollup/pluginutils": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", - "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", - "dev": true, - "requires": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^2.3.1" - } - }, - "@types/estree": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", - "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", - "dev": true - } - } - }, "@rollup/plugin-node-resolve": { "version": "15.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz", @@ -18977,24 +18878,6 @@ "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", "dev": true }, - "@types/rollup-plugin-json": { - "version": "3.0.3", - "dev": true, - "requires": { - "@types/node": "*", - "rollup": "^0.63.4" - }, - "dependencies": { - "rollup": { - "version": "0.63.5", - "dev": true, - "requires": { - "@types/estree": "0.0.39", - "@types/node": "*" - } - } - } - }, "@types/scheduler": { "version": "0.16.2", "dev": true diff --git a/package.json b/package.json index 0dbf9e9c9b7..d864c4575fe 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "@mapbox/mapbox-gl-rtl-text": "^0.2.3", "@mapbox/mvt-fixtures": "^3.10.0", "@rollup/plugin-commonjs": "^23.0.3", - "@rollup/plugin-json": "^5.0.2", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-replace": "^5.0.1", "@rollup/plugin-strip": "^3.0.1", @@ -68,7 +67,6 @@ "@types/react": "^18.0.26", "@types/react-dom": "^18.0.9", "@types/request": "^2.48.8", - "@types/rollup-plugin-json": "^3.0.3", "@types/shuffle-seed": "^1.1.0", "@types/supercluster": "^7.1.0", "@types/window-or-global": "^1.0.4", diff --git a/rollup.config.style-spec.ts b/rollup.config.style-spec.ts index f1c2d0dc5a5..dcfa3436d3e 100644 --- a/rollup.config.style-spec.ts +++ b/rollup.config.style-spec.ts @@ -1,7 +1,6 @@ import path, {dirname} from 'path'; import replace from '@rollup/plugin-replace'; import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; import {fileURLToPath, pathToFileURL} from 'url'; import {RollupOptions} from 'rollup'; import {nodeResolve} from './build/rollup_plugins'; @@ -49,7 +48,6 @@ const config: RollupOptions[] = [{ } }), importAssertionsPlugin(), - json(), nodeResolve, typescript(), commonjs() diff --git a/src/data/bucket/symbol_bucket.test.ts b/src/data/bucket/symbol_bucket.test.ts index 5ab91689a43..af7b45c7dba 100644 --- a/src/data/bucket/symbol_bucket.test.ts +++ b/src/data/bucket/symbol_bucket.test.ts @@ -16,7 +16,7 @@ import {RGBAImage} from '../../util/image'; import {ImagePosition} from '../../render/image_atlas'; import {IndexedFeature, PopulateParameters} from '../bucket'; import {StyleImage} from '../../style/style_image'; -import glyphs from '../../../test/unit/assets/fontstack-glyphs.json'; +import glyphs from '../../../test/unit/assets/fontstack-glyphs.json' assert {type: 'json'}; import {StyleGlyph} from '../../style/style_glyph'; // Load a point feature from fixture tile. diff --git a/src/source/vector_tile_source.test.ts b/src/source/vector_tile_source.test.ts index faa422ba70d..79b6388f5ec 100644 --- a/src/source/vector_tile_source.test.ts +++ b/src/source/vector_tile_source.test.ts @@ -5,7 +5,7 @@ import Tile from './tile'; import {OverscaledTileID} from './tile_id'; import {Evented} from '../util/evented'; import {RequestManager} from '../util/request_manager'; -import fixturesSource from '../../test/unit/assets/source.json'; +import fixturesSource from '../../test/unit/assets/source.json' assert {type: 'json'}; import {getMockDispatcher, getWrapDispatcher} from '../util/test/util'; import Map from '../ui/map'; diff --git a/src/style-spec/expression/expression.test.ts b/src/style-spec/expression/expression.test.ts index 75daf94e844..05ed84926b3 100644 --- a/src/style-spec/expression/expression.test.ts +++ b/src/style-spec/expression/expression.test.ts @@ -1,6 +1,6 @@ import {createPropertyExpression, Feature, GlobalProperties, StylePropertyExpression} from '../expression'; import definitions from './definitions'; -import v8 from '../reference/v8.json'; +import v8 from '../reference/v8.json' assert {type: 'json'}; import {StylePropertySpecification} from '../style-spec'; import ParsingError from './parsing_error'; diff --git a/src/style-spec/migrate.test.ts b/src/style-spec/migrate.test.ts index 56141dc3b1c..fcb8bbb085d 100644 --- a/src/style-spec/migrate.test.ts +++ b/src/style-spec/migrate.test.ts @@ -1,6 +1,6 @@ import migrate from './migrate'; import * as spec from './style-spec'; -import v8 from './reference/v8.json'; +import v8 from './reference/v8.json' assert {type: 'json'}; import validate from './validate_style'; describe('migrate', () => { diff --git a/src/style-spec/validate/validate_terrain.test.ts b/src/style-spec/validate/validate_terrain.test.ts index 7cbbfeb4f4c..ee0da6b3432 100644 --- a/src/style-spec/validate/validate_terrain.test.ts +++ b/src/style-spec/validate/validate_terrain.test.ts @@ -1,5 +1,5 @@ import validateTerrain from './validate_terrain'; -import v8 from '../reference/v8.json'; +import v8 from '../reference/v8.json' assert {type: 'json'}; describe('Validate Terrain', () => { test('Should return error in case terrain is not an object', () => { diff --git a/src/style-spec/validate/validate_terrain.ts b/src/style-spec/validate/validate_terrain.ts index f75153c87ea..9efc742bcc0 100644 --- a/src/style-spec/validate/validate_terrain.ts +++ b/src/style-spec/validate/validate_terrain.ts @@ -2,7 +2,7 @@ import ValidationError from '../error/validation_error'; import getType from '../util/get_type'; import validate from './validate'; import type {StyleSpecification, TerrainSpecification} from '../types.g'; -import type v8 from '../reference/v8.json'; +import v8 from '../reference/v8.json' assert {type: 'json'}; export default function validateTerrain( options: {value: TerrainSpecification; styleSpec: typeof v8; style: StyleSpecification} diff --git a/src/style-spec/visit.ts b/src/style-spec/visit.ts index fbca1024a58..9a452e54130 100644 --- a/src/style-spec/visit.ts +++ b/src/style-spec/visit.ts @@ -1,4 +1,4 @@ -import Reference from './reference/v8.json'; +import Reference from './reference/v8.json' assert {type: 'json'}; import type {StylePropertySpecification} from './style-spec'; import type { StyleSpecification, diff --git a/test/bench/benchmarks/filter_create.ts b/test/bench/benchmarks/filter_create.ts index 8e831f7a626..8130f570faf 100644 --- a/test/bench/benchmarks/filter_create.ts +++ b/test/bench/benchmarks/filter_create.ts @@ -1,7 +1,7 @@ import Benchmark from '../lib/benchmark'; import createFilter from '../../../src/style-spec/feature_filter'; -import filters from '../data/filters.json'; +import filters from '../data/filters.json' assert {type: 'json'}; export default class FilterCreate extends Benchmark { bench() { diff --git a/test/bench/benchmarks/filter_evaluate.ts b/test/bench/benchmarks/filter_evaluate.ts index f9c2dfc4a70..f11816dd09b 100644 --- a/test/bench/benchmarks/filter_evaluate.ts +++ b/test/bench/benchmarks/filter_evaluate.ts @@ -3,7 +3,7 @@ import Benchmark from '../lib/benchmark'; import {VectorTile} from '@mapbox/vector-tile'; import Pbf from 'pbf'; import createFilter from '../../../src/style-spec/feature_filter'; -import filters from '../data/filters.json'; +import filters from '../data/filters.json' assert {type: 'json'}; export default class FilterEvaluate extends Benchmark { layers: any[]; diff --git a/test/bench/benchmarks/layers.ts b/test/bench/benchmarks/layers.ts index 27014e8ba6d..9ea4406b513 100644 --- a/test/bench/benchmarks/layers.ts +++ b/test/bench/benchmarks/layers.ts @@ -1,7 +1,7 @@ import Benchmark from '../lib/benchmark'; import createMap from '../lib/create_map'; -import style from '../data/empty.json'; +import style from '../data/empty.json' assert {type: 'json'}; const width = 1024; const height = 768; diff --git a/test/bench/benchmarks/paint_states.ts b/test/bench/benchmarks/paint_states.ts index fbbada02aec..2426b58097a 100644 --- a/test/bench/benchmarks/paint_states.ts +++ b/test/bench/benchmarks/paint_states.ts @@ -1,5 +1,5 @@ -import emptystyle from '../data/empty.json'; +import emptystyle from '../data/empty.json' assert {type: 'json'}; import Benchmark from '../lib/benchmark'; import createMap from '../lib/create_map'; diff --git a/test/bench/benchmarks/remove_paint_state.ts b/test/bench/benchmarks/remove_paint_state.ts index 30d817b8366..6c8ff4b8ba5 100644 --- a/test/bench/benchmarks/remove_paint_state.ts +++ b/test/bench/benchmarks/remove_paint_state.ts @@ -1,5 +1,5 @@ -import emptystyle from '../data/empty.json'; +import emptystyle from '../data/empty.json' assert {type: 'json'}; import Benchmark from '../lib/benchmark'; import createMap from '../lib/create_map'; diff --git a/test/bench/styles/benchmarks.ts b/test/bench/styles/benchmarks.ts index 7ab0ee316a2..7764865898a 100644 --- a/test/bench/styles/benchmarks.ts +++ b/test/bench/styles/benchmarks.ts @@ -1,6 +1,6 @@ import maplibregl from '../../../src'; import locationsWithTileID from '../lib/locations_with_tile_id'; -import styleBenchmarkLocations from '../data/style-benchmark-locations.json'; +import styleBenchmarkLocations from '../data/style-benchmark-locations.json' assert {type: 'json'}; import StyleLayerCreate from '../benchmarks/style_layer_create'; import Validate from '../benchmarks/style_validate'; import Layout from '../benchmarks/layout'; diff --git a/test/bench/versions/benchmarks.ts b/test/bench/versions/benchmarks.ts index c6dd0430c35..04d31a40bb8 100644 --- a/test/bench/versions/benchmarks.ts +++ b/test/bench/versions/benchmarks.ts @@ -1,6 +1,6 @@ import maplibregl from '../../../src'; import locationsWithTileID from '../lib/locations_with_tile_id'; -import styleBenchmarkLocations from '../data/style-benchmark-locations.json'; +import styleBenchmarkLocations from '../data/style-benchmark-locations.json' assert {type: 'json'}; import Layout from '../benchmarks/layout'; import Placement from '../benchmarks/placement'; import SymbolLayout from '../benchmarks/symbol_layout'; diff --git a/test/build/min.test.ts b/test/build/min.test.ts index 59d255b639d..074b62110e6 100644 --- a/test/build/min.test.ts +++ b/test/build/min.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import reference from '../../src/style-spec/reference/latest'; -import packageJson from '../../package.json'; +import packageJson from '../../package.json' assert {type: 'json'}; const minBundle = fs.readFileSync('dist/maplibre-gl.js', 'utf8'); diff --git a/test/build/style-spec.test.ts b/test/build/style-spec.test.ts index a47c1f2fd22..ece09c39a40 100644 --- a/test/build/style-spec.test.ts +++ b/test/build/style-spec.test.ts @@ -1,7 +1,7 @@ import isBuiltin from 'is-builtin-module'; import * as rollup from 'rollup'; import rollupConfig from '../../rollup.config.style-spec'; -import styleSpecPackage from '../../src/style-spec/package.json'; +import styleSpecPackage from '../../src/style-spec/package.json' assert {type: 'json'}; import * as spec from '../../dist/style-spec/index.cjs'; import {importAssertions} from 'acorn-import-assertions'; /* eslint-disable import/namespace */ diff --git a/test/integration/query/query.test.ts b/test/integration/query/query.test.ts index 17e7ad44495..2fda612346a 100644 --- a/test/integration/query/query.test.ts +++ b/test/integration/query/query.test.ts @@ -3,7 +3,7 @@ // refer build/generate-query-test-fixtures.ts import {Browser, chromium, Page} from 'playwright'; -import fixtures from './dist/fixtures.json'; +import fixtures from './dist/fixtures.json' assert {type: 'json'}; import {deepEqual} from '../lib/json-diff'; import st from 'st'; import http from 'http'; diff --git a/test/integration/symbol-shaping/shaping.test.ts b/test/integration/symbol-shaping/shaping.test.ts index 4ef08da1ec3..6841c0ce412 100644 --- a/test/integration/symbol-shaping/shaping.test.ts +++ b/test/integration/symbol-shaping/shaping.test.ts @@ -3,7 +3,7 @@ import path from 'path'; import {WritingMode, shapeIcon, shapeText, fitIconToText, PositionedIcon, Shaping} from '../../../src/symbol/shaping'; import Formatted, {FormattedSection} from '../../../src/style-spec/expression/types/formatted'; import ResolvedImage from '../../../src/style-spec/expression/types/resolved_image'; -import expectedJson from './tests/text-shaping-linebreak.json'; +import expectedJson from './tests/text-shaping-linebreak.json' assert {type: 'json'}; import {ImagePosition} from '../../../src/render/image_atlas'; import {StyleImage} from '../../../src/style/style_image';