@rnmapbox/maps 10.0.0-beta.60 → 10.0.0-beta.62

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.
Files changed (63) hide show
  1. package/android/rctmgl/build.gradle +1 -1
  2. package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +0 -55
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +2 -1
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +0 -55
  5. package/index.d.ts +7 -0
  6. package/ios/RCTMGL/RCTMGLStyle.h +0 -5
  7. package/ios/RCTMGL/RCTMGLStyle.m +0 -35
  8. package/ios/RCTMGL-v10/MGLModule.swift +1 -0
  9. package/ios/RCTMGL-v10/RCTMGLAtmosphere.swift +3 -2
  10. package/ios/RCTMGL-v10/RCTMGLCircleLayer.swift +3 -3
  11. package/ios/RCTMGL-v10/RCTMGLEvent.swift +1 -0
  12. package/ios/RCTMGL-v10/RCTMGLFillExtrustionLayer.swift +4 -4
  13. package/ios/RCTMGL-v10/RCTMGLFillLayer.swift +4 -3
  14. package/ios/RCTMGL-v10/RCTMGLHeatmapLayer.swift +5 -4
  15. package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +4 -2
  16. package/ios/RCTMGL-v10/RCTMGLMapView.swift +27 -2
  17. package/ios/RCTMGL-v10/RCTMGLRasterLayer.swift +3 -2
  18. package/ios/RCTMGL-v10/RCTMGLStyle.swift +0 -35
  19. package/ios/RCTMGL-v10/RCTMGLSymbolLayer.swift +1 -1
  20. package/ios/RCTMGL-v10/RCTMGLTerrain.swift +3 -2
  21. package/ios/RCTMGL.xcodeproj/project.pbxproj +1 -0
  22. package/javascript/components/UserLocation.js +2 -2
  23. package/javascript/index.js +3 -0
  24. package/javascript/modules/location/locationManager.js +13 -1
  25. package/javascript/utils/MapboxStyles.d.ts +27 -31
  26. package/javascript/utils/{filterUtils.tsx → filterUtils.ts} +0 -0
  27. package/javascript/utils/getAnnotationsLayerID.ts +16 -0
  28. package/javascript/utils/styleMap.ts +0 -45
  29. package/lib/commonjs/components/UserLocation.js +1 -1
  30. package/lib/commonjs/components/UserLocation.js.map +1 -1
  31. package/lib/commonjs/index.js +8 -0
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/modules/location/locationManager.js +8 -1
  34. package/lib/commonjs/modules/location/locationManager.js.map +1 -1
  35. package/lib/commonjs/utils/filterUtils.js.map +1 -1
  36. package/lib/commonjs/utils/getAnnotationsLayerID.js +21 -0
  37. package/lib/commonjs/utils/getAnnotationsLayerID.js.map +1 -0
  38. package/lib/commonjs/utils/styleMap.js +1 -41
  39. package/lib/commonjs/utils/styleMap.js.map +1 -1
  40. package/lib/commonjs/web/UnimplementedComponent.js.map +1 -1
  41. package/lib/module/components/UserLocation.js +1 -1
  42. package/lib/module/components/UserLocation.js.map +1 -1
  43. package/lib/module/index.js +3 -1
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/module/modules/location/locationManager.js +8 -1
  46. package/lib/module/modules/location/locationManager.js.map +1 -1
  47. package/lib/module/utils/filterUtils.js.map +1 -1
  48. package/lib/module/utils/getAnnotationsLayerID.js +15 -0
  49. package/lib/module/utils/getAnnotationsLayerID.js.map +1 -0
  50. package/lib/module/utils/styleMap.js +1 -41
  51. package/lib/module/utils/styleMap.js.map +1 -1
  52. package/lib/module/web/UnimplementedComponent.js.map +1 -1
  53. package/lib/typescript/utils/filterUtils.d.ts.map +1 -1
  54. package/lib/typescript/utils/getAnnotationsLayerID.d.ts +2 -0
  55. package/lib/typescript/utils/getAnnotationsLayerID.d.ts.map +1 -0
  56. package/lib/typescript/utils/styleMap.d.ts +0 -40
  57. package/lib/typescript/utils/styleMap.d.ts.map +1 -1
  58. package/package.json +2 -2
  59. package/plugin/build/withMapbox.d.ts +1 -1
  60. package/plugin/build/withMapbox.js +46 -59
  61. package/plugin/src/withMapbox.ts +62 -65
  62. package/react-native.config.js +0 -3
  63. package/rnmapbox-maps.podspec +1 -1
@@ -13,7 +13,12 @@ import {
13
13
  withAppBuildGradle,
14
14
  } from 'expo/config-plugins';
15
15
 
16
- import { mergeContents, removeGeneratedContents } from './generateCode';
16
+ import {
17
+ mergeContents,
18
+ createGeneratedHeaderComment,
19
+ removeGeneratedContents,
20
+ MergeResults,
21
+ } from './generateCode';
17
22
 
18
23
  let pkg: { name: string; version?: string } = {
19
24
  name: '@rnmapbox/maps',
@@ -266,74 +271,66 @@ const addLibCppFilter = (appBuildGradle: string): string => {
266
271
  }).contents;
267
272
  };
268
273
 
269
- const addMapboxMavenRepo = (projectBuildGradle: string): string => {
270
- if (projectBuildGradle.includes('api.mapbox.com/downloads/v2/releases/maven'))
271
- return projectBuildGradle;
272
-
273
- /*
274
- Should look like this:
275
-
276
- allprojects {
277
- configurations.all {
278
- resolutionStrategy {
279
- force \\"com.facebook.react:react-native:\\" + REACT_NATIVE_VERSION
280
- }
274
+ // Because we need the package to be added AFTER the React and Google maven packages, we create a new allprojects.
275
+ // It's ok to have multiple allprojects.repositories, so we create a new one since it's cheaper than tokenizing
276
+ // the existing block to find the correct place to insert our mapbox maven.
277
+ const gradleMaven = `
278
+ allprojects {
279
+ repositories {
280
+ maven {
281
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
282
+ authentication { basic(BasicAuthentication) }
283
+ credentials {
284
+ username = 'mapbox'
285
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
286
+ }
281
287
  }
288
+ }
289
+ }
290
+ `;
291
+
292
+ // Fork of config-plugins mergeContents, but appends the contents to the end of the file.
293
+ function appendContents({
294
+ src,
295
+ newSrc,
296
+ tag,
297
+ comment,
298
+ }: {
299
+ src: string;
300
+ newSrc: string;
301
+ tag: string;
302
+ comment: string;
303
+ }): MergeResults {
304
+ const header = createGeneratedHeaderComment(newSrc, tag, comment);
305
+ if (!src.includes(header)) {
306
+ // Ensure the old generated contents are removed.
307
+ const sanitizedTarget = removeGeneratedContents(src, tag);
308
+ const contentsToAdd = [
309
+ // @something
310
+ header,
311
+ // contents
312
+ newSrc,
313
+ // @end
314
+ `${comment} @generated end ${tag}`,
315
+ ].join('\n');
316
+
317
+ return {
318
+ contents: sanitizedTarget ?? src + contentsToAdd,
319
+ didMerge: true,
320
+ didClear: !!sanitizedTarget,
321
+ };
322
+ }
323
+ return { contents: src, didClear: false, didMerge: false };
324
+ }
282
325
 
283
- repositories {
284
- maven {
285
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
286
- authentication { basic(BasicAuthentication) }
287
- credentials {
288
- username = 'mapbox'
289
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
290
- }
291
- }
292
- mavenLocal()
293
- maven {
294
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
295
- url(new File(['node', '--print', \\"require.resolve('react-native/package.json')\\"].execute(null, rootDir).text.trim(), '../android'))
296
- }
297
- // ...
298
- */
299
-
300
- /*
301
- Since mergeContents checks the anchor for each line, we can't do a "correct"
302
- RegExp for allprojects...repositories.
303
- Instead, we check for the first `allprojects`, and then count the # of lines to the next `repositories` block.
304
- */
305
- let offset = 0;
306
- const anchor = new RegExp(`^\\s*allprojects\\s*{`, 'gm');
307
- // hack to count offset
308
- const allProjectSplit = projectBuildGradle.split(anchor);
309
- if (allProjectSplit.length <= 1)
310
- throw new Error('Could not find `allprojects` block');
311
-
312
- const allProjectLines =
313
- allProjectSplit[allProjectSplit.length - 1].split('\n');
314
- const allProjectReposOffset = allProjectLines.findIndex((line) =>
315
- line.includes('repositories'),
316
- );
317
- anchor.lastIndex = 0;
318
- offset = allProjectReposOffset + 1;
319
-
320
- return mergeContents({
321
- tag: `@rnmapbox/maps-v2-maven`,
322
- src: projectBuildGradle,
323
- newSrc: `
324
- maven {
325
- url 'https://api.mapbox.com/downloads/v2/releases/maven'
326
- authentication { basic(BasicAuthentication) }
327
- credentials {
328
- username = 'mapbox'
329
- password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
330
- }
331
- }\n`,
332
- anchor,
333
- offset,
326
+ export function addMapboxMavenRepo(src: string): string {
327
+ return appendContents({
328
+ tag: '@rnmapbox/maps-v2-maven',
329
+ src,
330
+ newSrc: gradleMaven,
334
331
  comment: '//',
335
332
  }).contents;
336
- };
333
+ }
337
334
 
338
335
  const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config) => {
339
336
  return withAppBuildGradle(config, ({ modResults, ...config }) => {
@@ -1,9 +1,6 @@
1
1
  module.exports = {
2
2
  dependency: {
3
3
  platforms: {
4
- ios: {
5
- project: 'true',
6
- },
7
4
  android: {
8
5
  sourceDir: './android/rctmgl',
9
6
  },
@@ -20,7 +20,7 @@ require 'json'
20
20
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
21
21
 
22
22
  ## Warning: these lines are scanned by autogenerate.js
23
- rnMapboxMapsDefaultMapboxVersion = '~> 10.9.1'
23
+ rnMapboxMapsDefaultMapboxVersion = '~> 10.10.0'
24
24
  rnMapboxMapsDefaultMapboxGLVersion = '~> 5.9.0'
25
25
  rnMapboxMapsDefaultMapLibreVersion = 'exactVersion 5.12.1'
26
26