react-native-brouter 0.0.1
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/LICENSE +20 -0
- package/README.md +125 -0
- package/android/build.gradle +110 -0
- package/android/generated/java/com/jhotadhari/reactnative/brouter/NativeBRouterSpec.java +39 -0
- package/android/generated/jni/CMakeLists.txt +28 -0
- package/android/generated/jni/RNBRouterSpec-generated.cpp +32 -0
- package/android/generated/jni/RNBRouterSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNBRouterSpec/RNBRouterSpecJSI.h +38 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/aidl/btools/routingapp/IBRouterService.aidl +47 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterClient.java +205 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterError.java +38 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterModule.java +135 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterPackage.kt +33 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/BRouterServiceConnection.java +54 -0
- package/android/src/main/java/com/jhotadhari/reactnative/brouter/ParamMapper.java +174 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/BRouterClientTest.java +247 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/BRouterErrorTest.java +48 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/BRouterModuleTest.java +137 -0
- package/android/src/test/java/com/jhotadhari/reactnative/brouter/ParamMapperTest.java +279 -0
- package/lib/module/NativeBRouter.js +5 -0
- package/lib/module/NativeBRouter.js.map +1 -0
- package/lib/module/geojson/index.js +235 -0
- package/lib/module/geojson/index.js.map +1 -0
- package/lib/module/index.js +297 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/release.config.d.ts +11 -0
- package/lib/typescript/release.config.d.ts.map +1 -0
- package/lib/typescript/src/NativeBRouter.d.ts +9 -0
- package/lib/typescript/src/NativeBRouter.d.ts.map +1 -0
- package/lib/typescript/src/geojson/index.d.ts +122 -0
- package/lib/typescript/src/geojson/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +13 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +93 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +159 -0
- package/react-native.config.js +12 -0
- package/src/NativeBRouter.ts +8 -0
- package/src/geojson/index.ts +371 -0
- package/src/index.tsx +344 -0
- package/src/types.ts +112 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoJSON-friendly API for react-native-brouter.
|
|
3
|
+
*
|
|
4
|
+
* This layer accepts GeoJSON {@link Position} arrays for waypoints and
|
|
5
|
+
* nogo areas, and returns results that integrate naturally with
|
|
6
|
+
* `@turf/turf` and other GeoJSON tooling.
|
|
7
|
+
*
|
|
8
|
+
* ## Usage
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { getRoute } from 'react-native-brouter/geojson';
|
|
12
|
+
*
|
|
13
|
+
* const result = await getRoute({
|
|
14
|
+
* waypoints: [[-71.04, -13.95], [-70.90, -13.79]],
|
|
15
|
+
* vehicle: 'bicycle',
|
|
16
|
+
* format: 'json',
|
|
17
|
+
* });
|
|
18
|
+
* // result.parsed.track → GeoJSON FeatureCollection
|
|
19
|
+
* // result.parsed.waypoints → FeatureCollection of waypoint points
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @module geojson
|
|
23
|
+
*/
|
|
24
|
+
import type { FeatureCollection, LineString, MultiPolygon, Point, Polygon, Position } from 'geojson';
|
|
25
|
+
import type { BRouterError, NogoArea, RouteResult, TrackFormat, VehicleMode } from '../types.js';
|
|
26
|
+
export type { Position };
|
|
27
|
+
export type { BRouterError, RouteResult, TrackFormat, VehicleMode };
|
|
28
|
+
export interface GeoJSONRouteRequest {
|
|
29
|
+
/**
|
|
30
|
+
* Waypoints as GeoJSON positions: `[[lng, lat], [lng, lat], ...]`.
|
|
31
|
+
*
|
|
32
|
+
* Works directly with turf's `lineString()`, `along()`, etc.
|
|
33
|
+
* Minimum 2 waypoints required.
|
|
34
|
+
*/
|
|
35
|
+
waypoints: Position[];
|
|
36
|
+
/** BRouter profile file name without .brf extension. */
|
|
37
|
+
profile?: string;
|
|
38
|
+
/** Raw profile content (overrides profile + vehicle + fast). */
|
|
39
|
+
remoteProfile?: string;
|
|
40
|
+
vehicle?: VehicleMode;
|
|
41
|
+
fast?: boolean;
|
|
42
|
+
format?: TrackFormat;
|
|
43
|
+
alternativeIndex?: 0 | 1 | 2 | 3;
|
|
44
|
+
/**
|
|
45
|
+
* Nogo areas as point+radius circles.
|
|
46
|
+
*
|
|
47
|
+
* For polygon-based nogos, use {@link polygonToNogoAreas} to convert
|
|
48
|
+
* GeoJSON Polygon / MultiPolygon geometries to the nogo format.
|
|
49
|
+
*/
|
|
50
|
+
nogos?: NogoArea[];
|
|
51
|
+
exportWaypoints?: boolean;
|
|
52
|
+
heading?: number;
|
|
53
|
+
direction?: number;
|
|
54
|
+
elevation?: boolean;
|
|
55
|
+
maxRunningTime?: number;
|
|
56
|
+
connectTimeout?: number;
|
|
57
|
+
pathToFileResult?: string;
|
|
58
|
+
acceptCompressedResult?: boolean;
|
|
59
|
+
extraParams?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
export interface RouteSummary {
|
|
62
|
+
/** Total distance in meters (available when format is 'json'). */
|
|
63
|
+
totalDistanceMeters?: number;
|
|
64
|
+
/** Total duration in seconds (available when format is 'json'). */
|
|
65
|
+
totalDurationSeconds?: number;
|
|
66
|
+
/** Ascent in meters (available when format is 'json'). */
|
|
67
|
+
ascentMeters?: number;
|
|
68
|
+
/** Descent in meters (available when format is 'json'). */
|
|
69
|
+
descentMeters?: number;
|
|
70
|
+
/** Number of track points. */
|
|
71
|
+
trackPointCount?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface GeoJSONRouteResult {
|
|
74
|
+
/** The raw track string (GPX, KML, or JSON). */
|
|
75
|
+
raw: string;
|
|
76
|
+
/** The format of the returned track. */
|
|
77
|
+
format: TrackFormat;
|
|
78
|
+
/**
|
|
79
|
+
* Parsed GeoJSON result (only populated when format is 'json').
|
|
80
|
+
*
|
|
81
|
+
* `track` is a FeatureCollection containing the route geometry as a
|
|
82
|
+
* LineString feature. `waypoints` contains the input waypoints as
|
|
83
|
+
* Point features. `summary` holds extracted statistics.
|
|
84
|
+
*/
|
|
85
|
+
parsed?: {
|
|
86
|
+
track: FeatureCollection<LineString>;
|
|
87
|
+
waypoints: FeatureCollection<Point>;
|
|
88
|
+
summary: RouteSummary;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Request a route from the BRouter Android app using GeoJSON types.
|
|
93
|
+
*
|
|
94
|
+
* Converts GeoJSON {@link Position} arrays to the internal format,
|
|
95
|
+
* calls the native BRouter service, and returns a result that
|
|
96
|
+
* includes parsed GeoJSON structures when `format` is `'json'`.
|
|
97
|
+
*
|
|
98
|
+
* @throws {BRouterError} if the request is invalid or BRouter fails.
|
|
99
|
+
*/
|
|
100
|
+
export declare function getRoute(request: GeoJSONRouteRequest): Promise<GeoJSONRouteResult>;
|
|
101
|
+
/**
|
|
102
|
+
* Convert a GeoJSON {@link Polygon} or {@link MultiPolygon} into an array
|
|
103
|
+
* of {@link NogoArea} entries suitable for use in
|
|
104
|
+
* {@link GeoJSONRouteRequest.nogos}.
|
|
105
|
+
*
|
|
106
|
+
* Uses a bounding-circle approximation: the polygon's centroid becomes
|
|
107
|
+
* the nogo center, and the farthest vertex distance becomes the radius.
|
|
108
|
+
*
|
|
109
|
+
* This is a utility for consumers — it is not called automatically.
|
|
110
|
+
*
|
|
111
|
+
* ## Usage with turf
|
|
112
|
+
*
|
|
113
|
+
* ```ts
|
|
114
|
+
* import { polygonToNogoAreas } from 'react-native-brouter/geojson';
|
|
115
|
+
* import turfBboxPolygon from '@turf/bbox-polygon';
|
|
116
|
+
*
|
|
117
|
+
* const bboxPoly = turfBboxPolygon([lng1, lat1, lng2, lat2]);
|
|
118
|
+
* const nogos = polygonToNogoAreas(bboxPoly.geometry);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function polygonToNogoAreas(geometry: Polygon | MultiPolygon, weight?: number): NogoArea[];
|
|
122
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/geojson/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EAER,WAAW,EACX,WAAW,EACX,WAAW,EAEX,MAAM,aAAU,CAAC;AAGlB,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAIpE,MAAM,WAAW,mBAAmB;IACnC;;;;;OAKG;IACH,SAAS,EAAE,QAAQ,EAAE,CAAC;IAEtB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAA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G,YAAY,EAChC,MAAM,CAAC,EAAE,MAAM,GACb,QAAQ,EAAE,CAiDZ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RouteRequest, RouteResult } from './types.js';
|
|
2
|
+
export type { Position, Waypoint, NogoArea, Polyline, Polygon, Poi, VehicleMode, TrackFormat, TurnInstructionFormat, TurnInstructionMode, RouteRequest, RouteResult, BRouterError, } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Request a route from the BRouter Android app.
|
|
5
|
+
*
|
|
6
|
+
* This is the core API entry point. It validates the request, serializes
|
|
7
|
+
* it into the AIDL wire format, calls the native module, and returns a
|
|
8
|
+
* typed {@link RouteResult}.
|
|
9
|
+
*
|
|
10
|
+
* @throws {BRouterError} if the request is invalid or BRouter fails.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getRoute(request: RouteRequest): Promise<RouteResult>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEX,YAAY,EACZ,WAAW,EAEX,MAAM,YAAS,CAAC;AAEjB,YAAY,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,GAAG,EACH,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,YAAY,GACZ,MAAM,YAAS,CAAC;AAsSjB;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAkB1E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors GeoJSON's `Position` (`[lng, lat, alt?]`).
|
|
3
|
+
*
|
|
4
|
+
* This is the same convention used by react-native-mapsforge-vtm.
|
|
5
|
+
* Uses `number` for general TypeScript compatibility; codegen specs
|
|
6
|
+
* should redeclare with `Double` where needed.
|
|
7
|
+
*/
|
|
8
|
+
export type Position = ReadonlyArray<number>;
|
|
9
|
+
export type VehicleMode = 'motorcar' | 'bicycle' | 'foot';
|
|
10
|
+
export type TrackFormat = 'kml' | 'gpx' | 'json';
|
|
11
|
+
export type TurnInstructionFormat = 'osmand' | 'locus';
|
|
12
|
+
export type TurnInstructionMode = 'none' | 'auto-choose' | 'locus' | 'osmand' | 'comment' | 'gpsies' | 'orux' | 'locus-old';
|
|
13
|
+
export interface Waypoint {
|
|
14
|
+
/** [lng, lat, alt?] */
|
|
15
|
+
position: Position;
|
|
16
|
+
/** Named waypoints are preserved in the output and not optimized away. */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** Route as a straight line from the previous waypoint to this one. */
|
|
19
|
+
direct?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface NogoArea {
|
|
22
|
+
/** [lng, lat] of the nogo center. */
|
|
23
|
+
position: Position;
|
|
24
|
+
/** Radius in meters. */
|
|
25
|
+
radiusMeters: number;
|
|
26
|
+
/** Penalty weight (optional). */
|
|
27
|
+
weight?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface Polyline {
|
|
30
|
+
/** Array of [lng, lat]* positions. */
|
|
31
|
+
positions: Position[];
|
|
32
|
+
/** Penalty weight (optional). */
|
|
33
|
+
weight?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface Polygon {
|
|
36
|
+
/** Closed ring of [lng, lat]* positions. */
|
|
37
|
+
positions: Position[];
|
|
38
|
+
/** Penalty weight (optional). */
|
|
39
|
+
weight?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface Poi {
|
|
42
|
+
/** [lng, lat] */
|
|
43
|
+
position: Position;
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
46
|
+
export interface RouteRequest {
|
|
47
|
+
/** At least 2 waypoints required. */
|
|
48
|
+
waypoints: Waypoint[];
|
|
49
|
+
/** BRouter profile file name without .brf extension. */
|
|
50
|
+
profile?: string;
|
|
51
|
+
/** Raw profile content that overrides profile + vehicle + fast. */
|
|
52
|
+
remoteProfile?: string;
|
|
53
|
+
vehicle?: VehicleMode;
|
|
54
|
+
/** Fast mode (ignored if remoteProfile is set). */
|
|
55
|
+
fast?: boolean;
|
|
56
|
+
format?: TrackFormat;
|
|
57
|
+
alternativeIndex?: 0 | 1 | 2 | 3;
|
|
58
|
+
nogos?: NogoArea[];
|
|
59
|
+
polylines?: Polyline[];
|
|
60
|
+
polygons?: Polygon[];
|
|
61
|
+
pois?: Poi[];
|
|
62
|
+
exportWaypoints?: boolean;
|
|
63
|
+
turnInstructionFormat?: TurnInstructionFormat;
|
|
64
|
+
turnInstructionMode?: TurnInstructionMode;
|
|
65
|
+
/** Start direction in degrees. */
|
|
66
|
+
heading?: number;
|
|
67
|
+
/** Recalculation start direction in degrees. */
|
|
68
|
+
direction?: number;
|
|
69
|
+
/** Request elevation data (engineMode=2). */
|
|
70
|
+
elevation?: boolean;
|
|
71
|
+
/** Routing timeout in seconds (default 60). */
|
|
72
|
+
maxRunningTime?: number;
|
|
73
|
+
/** Connection timeout in milliseconds (default 1000). */
|
|
74
|
+
connectTimeout?: number;
|
|
75
|
+
/** Save result to file instead of returning it in the promise. */
|
|
76
|
+
pathToFileResult?: string;
|
|
77
|
+
/** Compress result (gpx format only). */
|
|
78
|
+
acceptCompressedResult?: boolean;
|
|
79
|
+
/** Arbitrary key=value pairs passed to the BRouter profile. */
|
|
80
|
+
extraParams?: Record<string, string>;
|
|
81
|
+
}
|
|
82
|
+
export interface RouteResult {
|
|
83
|
+
/** The raw track string (GPX, KML, or JSON). */
|
|
84
|
+
raw: string;
|
|
85
|
+
/** The format of the returned track. */
|
|
86
|
+
format: TrackFormat;
|
|
87
|
+
}
|
|
88
|
+
/** Structured error from the BRouter native module. */
|
|
89
|
+
export interface BRouterError {
|
|
90
|
+
code: string;
|
|
91
|
+
message: string;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=types.d.ts.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D;AACvD,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-brouter",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "React native turbo module for android, to communicate with the brouter app service for offline navigation based on open data",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./geojson": {
|
|
14
|
+
"types": "./lib/typescript/src/geojson/index.d.ts",
|
|
15
|
+
"default": "./lib/module/geojson/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"lib",
|
|
22
|
+
"android",
|
|
23
|
+
"cpp",
|
|
24
|
+
"*.podspec",
|
|
25
|
+
"react-native.config.js",
|
|
26
|
+
"!android/build",
|
|
27
|
+
"!android/gradle",
|
|
28
|
+
"!android/gradlew",
|
|
29
|
+
"!android/gradlew.bat",
|
|
30
|
+
"!android/local.properties",
|
|
31
|
+
"!**/__tests__",
|
|
32
|
+
"!**/__fixtures__",
|
|
33
|
+
"!**/__mocks__",
|
|
34
|
+
"!**/.*"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"example": "yarn workspace react-native-brouter-example",
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"typecheck": "tsc",
|
|
40
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
41
|
+
"clean": "del-cli android/build example/android/build example/android/app/build lib",
|
|
42
|
+
"prepare": "bob build",
|
|
43
|
+
"format": "prettier . --write",
|
|
44
|
+
"release": "release-kit"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"react-native",
|
|
48
|
+
"android",
|
|
49
|
+
"routing",
|
|
50
|
+
"navigation",
|
|
51
|
+
"router",
|
|
52
|
+
"BRouter",
|
|
53
|
+
"gpx"
|
|
54
|
+
],
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/jhotadhari/react-native-brouter.git"
|
|
58
|
+
},
|
|
59
|
+
"author": "jhotadhari <tellme@waterproof-webdesign.de> (https://github.com/jhotadhari)",
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/jhotadhari/react-native-brouter/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/jhotadhari/react-native-brouter#readme",
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"registry": "https://registry.npmjs.org/"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
70
|
+
"@eslint/compat": "^1",
|
|
71
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
72
|
+
"@eslint/js": "^9",
|
|
73
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
74
|
+
"@jhotadhari/release-kit": "^0.0.6",
|
|
75
|
+
"@react-native-community/cli": "^20.2.0",
|
|
76
|
+
"@react-native/eslint-config": "^0.86.0",
|
|
77
|
+
"@react-native/jest-preset": "^0.86.0",
|
|
78
|
+
"@types/jest": "^30.0.0",
|
|
79
|
+
"@types/react": "^19.2.17",
|
|
80
|
+
"commitlint": "^21.2.0",
|
|
81
|
+
"del-cli": "^7.0.0",
|
|
82
|
+
"eslint": "^9",
|
|
83
|
+
"eslint-config-prettier": "^10.1.8",
|
|
84
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
85
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
86
|
+
"jest": "^30.4.2",
|
|
87
|
+
"prettier": "^3.9.4",
|
|
88
|
+
"prettier-plugin-embed": "^0.5.1",
|
|
89
|
+
"prettier-plugin-multiline-arrays": "^4.1.10",
|
|
90
|
+
"react": "^19.2.7",
|
|
91
|
+
"react-native": "^0.86.0",
|
|
92
|
+
"react-native-builder-bob": "^0.43.0",
|
|
93
|
+
"turbo": "^2.10.2",
|
|
94
|
+
"typescript": "^6.0.3"
|
|
95
|
+
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"react": "*",
|
|
98
|
+
"react-native": "*"
|
|
99
|
+
},
|
|
100
|
+
"workspaces": [
|
|
101
|
+
"example"
|
|
102
|
+
],
|
|
103
|
+
"resolutions": {
|
|
104
|
+
"@react-native/jest-preset/jest-environment-node": "^30.0.0"
|
|
105
|
+
},
|
|
106
|
+
"packageManager": "yarn@3.6.1",
|
|
107
|
+
"jest": {
|
|
108
|
+
"preset": "@react-native/jest-preset",
|
|
109
|
+
"modulePathIgnorePatterns": [
|
|
110
|
+
"<rootDir>/example/node_modules",
|
|
111
|
+
"<rootDir>/lib/"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"commitlint": {
|
|
115
|
+
"extends": [
|
|
116
|
+
"@commitlint/config-conventional"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"react-native-builder-bob": {
|
|
120
|
+
"source": "src",
|
|
121
|
+
"output": "lib",
|
|
122
|
+
"targets": [
|
|
123
|
+
"codegen",
|
|
124
|
+
[
|
|
125
|
+
"module",
|
|
126
|
+
{
|
|
127
|
+
"esm": true
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
"typescript",
|
|
132
|
+
{
|
|
133
|
+
"project": "tsconfig.build.json"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"codegenConfig": {
|
|
139
|
+
"name": "RNBRouterSpec",
|
|
140
|
+
"type": "modules",
|
|
141
|
+
"jsSrcsDir": "src",
|
|
142
|
+
"outputDir": {
|
|
143
|
+
"ios": "ios/generated",
|
|
144
|
+
"android": "android/generated"
|
|
145
|
+
},
|
|
146
|
+
"android": {
|
|
147
|
+
"javaPackageName": "com.jhotadhari.reactnative.brouter"
|
|
148
|
+
},
|
|
149
|
+
"includesGeneratedCode": true
|
|
150
|
+
},
|
|
151
|
+
"create-react-native-library": {
|
|
152
|
+
"type": "turbo-module",
|
|
153
|
+
"languages": "kotlin-objc",
|
|
154
|
+
"version": "0.49.7"
|
|
155
|
+
},
|
|
156
|
+
"dependencies": {
|
|
157
|
+
"@types/geojson": "^7946.0.16"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
getRoute(params: { [key: string]: unknown }): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('BRouter');
|