@maplibre/maplibre-react-native 10.0.0-beta.15 → 10.0.0-beta.17
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/README.md +2 -2
- package/android/build.gradle +29 -6
- package/android/gradle.properties +11 -6
- package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +7 -11
- package/android/src/main/java/org/maplibre/reactnative/location/engine/DefaultLocationEngineProvider.java +18 -0
- package/android/src/main/java/org/maplibre/reactnative/location/engine/LocationEngineProvidable.java +9 -0
- package/android/src/main/location-engine-default/org/maplibre/reactnative/location/engine/LocationEngineProvider.java +12 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineImpl.java +151 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/GoogleLocationEngineProvider.java +24 -0
- package/android/src/main/location-engine-google/org/maplibre/reactnative/location/engine/LocationEngineProvider.java +12 -0
- package/lib/commonjs/plugin/ios.js +97 -0
- package/lib/commonjs/plugin/ios.js.map +1 -0
- package/lib/commonjs/plugin/withMapLibre.js +7 -130
- package/lib/commonjs/plugin/withMapLibre.js.map +1 -1
- package/lib/module/plugin/ios.js +93 -0
- package/lib/module/plugin/ios.js.map +1 -0
- package/lib/module/plugin/withMapLibre.js +8 -126
- package/lib/module/plugin/withMapLibre.js.map +1 -1
- package/lib/typescript/commonjs/src/plugin/ios.d.ts +13 -0
- package/lib/typescript/commonjs/src/plugin/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts +1 -10
- package/lib/typescript/commonjs/src/plugin/withMapLibre.d.ts.map +1 -1
- package/lib/typescript/module/src/plugin/ios.d.ts +13 -0
- package/lib/typescript/module/src/plugin/ios.d.ts.map +1 -0
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts +1 -10
- package/lib/typescript/module/src/plugin/withMapLibre.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/plugin/ios.ts +112 -0
- package/src/plugin/withMapLibre.ts +10 -167
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { withPodfile, withXcodeProject } from "@expo/config-plugins";
|
|
4
|
+
import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Only the post-install block is required, the post installer block is used for SPM (Swift Package Manager) which Expo
|
|
8
|
+
* doesn't currently support.
|
|
9
|
+
*/
|
|
10
|
+
export function applyPodfilePostInstall(contents) {
|
|
11
|
+
const result = mergeContents({
|
|
12
|
+
tag: `@maplibre/maplibre-react-native-post_installer`,
|
|
13
|
+
src: contents,
|
|
14
|
+
newSrc: ` $MLRN.post_install(installer)`,
|
|
15
|
+
anchor: new RegExp(`post_install do \\|installer\\|`),
|
|
16
|
+
offset: 1,
|
|
17
|
+
comment: "#"
|
|
18
|
+
});
|
|
19
|
+
if (result.didMerge || result.didClear) {
|
|
20
|
+
return result.contents;
|
|
21
|
+
}
|
|
22
|
+
return contents;
|
|
23
|
+
}
|
|
24
|
+
const withPodfilePostInstall = config => {
|
|
25
|
+
return withPodfile(config, c => {
|
|
26
|
+
c.modResults.contents = applyPodfilePostInstall(c.modResults.contents);
|
|
27
|
+
return c;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
33
|
+
* Without this, production builds targeting simulators will fail.
|
|
34
|
+
*/
|
|
35
|
+
function setExcludedArchitectures(project) {
|
|
36
|
+
const configurations = project.pbxXCBuildConfigurationSection();
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
for (const {
|
|
40
|
+
name,
|
|
41
|
+
buildSettings
|
|
42
|
+
} of Object.values(configurations || {})) {
|
|
43
|
+
// Guessing that this is the best way to emulate Xcode.
|
|
44
|
+
// Using `project.addToBuildSettings` modifies too many targets.
|
|
45
|
+
if (name === "Release" && typeof buildSettings?.PRODUCT_NAME !== "undefined") {
|
|
46
|
+
buildSettings['"EXCLUDED_ARCHS[sdk=iphonesimulator*]"'] = '"arm64"';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return project;
|
|
50
|
+
}
|
|
51
|
+
const withoutSignatures = config => {
|
|
52
|
+
return withXcodeProject(config, async c => {
|
|
53
|
+
c.modResults.addBuildPhase([], "PBXShellScriptBuildPhase", "Remove signature files (Xcode workaround)", null, {
|
|
54
|
+
shellPath: "/bin/sh",
|
|
55
|
+
shellScript: `
|
|
56
|
+
echo "Remove signature files (Xcode workaround)";
|
|
57
|
+
rm -rf "$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature";
|
|
58
|
+
`
|
|
59
|
+
});
|
|
60
|
+
return c;
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Set the Debug Information Format to DWARF with dSYM File during EAS Build for Managed App
|
|
66
|
+
* https://github.com/expo/eas-cli/issues/968
|
|
67
|
+
*
|
|
68
|
+
* Set `artifactPath` in `eas.json`:
|
|
69
|
+
* ```json
|
|
70
|
+
* "ios": {
|
|
71
|
+
* "artifactPath": "ios/build/*"
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
const withDwarfDsym = config => {
|
|
76
|
+
return withXcodeProject(config, async c => {
|
|
77
|
+
c.modResults.debugInformationFormat = "dwarf-with-dsym";
|
|
78
|
+
return c;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const withExcludedSimulatorArchitectures = config => {
|
|
82
|
+
return withXcodeProject(config, c => {
|
|
83
|
+
c.modResults = setExcludedArchitectures(c.modResults);
|
|
84
|
+
return c;
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
export const ios = {
|
|
88
|
+
withPodfilePostInstall,
|
|
89
|
+
withoutSignatures,
|
|
90
|
+
withDwarfDsym,
|
|
91
|
+
withExcludedSimulatorArchitectures
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withPodfile","withXcodeProject","mergeContents","applyPodfilePostInstall","contents","result","tag","src","newSrc","anchor","RegExp","offset","comment","didMerge","didClear","withPodfilePostInstall","config","c","modResults","setExcludedArchitectures","project","configurations","pbxXCBuildConfigurationSection","name","buildSettings","Object","values","PRODUCT_NAME","withoutSignatures","addBuildPhase","shellPath","shellScript","withDwarfDsym","debugInformationFormat","withExcludedSimulatorArchitectures","ios"],"sourceRoot":"../../../src","sources":["plugin/ios.ts"],"mappings":";;AAAA,SAEEA,WAAW,EACXC,gBAAgB,QAEX,sBAAsB;AAC7B,SAASC,aAAa,QAAQ,+CAA+C;;AAE7E;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,QAAgB,EAAU;EAChE,MAAMC,MAAM,GAAGH,aAAa,CAAC;IAC3BI,GAAG,EAAE,gDAAgD;IACrDC,GAAG,EAAEH,QAAQ;IACbI,MAAM,EAAE,mCAAmC;IAC3CC,MAAM,EAAE,IAAIC,MAAM,CAAC,iCAAiC,CAAC;IACrDC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACX,CAAC,CAAC;EAEF,IAAIP,MAAM,CAACQ,QAAQ,IAAIR,MAAM,CAACS,QAAQ,EAAE;IACtC,OAAOT,MAAM,CAACD,QAAQ;EACxB;EAEA,OAAOA,QAAQ;AACjB;AAEA,MAAMW,sBAAoC,GAAIC,MAAM,IAAK;EACvD,OAAOhB,WAAW,CAACgB,MAAM,EAAGC,CAAC,IAAK;IAChCA,CAAC,CAACC,UAAU,CAACd,QAAQ,GAAGD,uBAAuB,CAACc,CAAC,CAACC,UAAU,CAACd,QAAQ,CAAC;IAEtE,OAAOa,CAAC;EACV,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA,SAASE,wBAAwBA,CAACC,OAAqB,EAAgB;EACrE,MAAMC,cAAc,GAAGD,OAAO,CAACE,8BAA8B,CAAC,CAAC;EAC/D;EACA;EACA,KAAK,MAAM;IAAEC,IAAI;IAAEC;EAAc,CAAC,IAAIC,MAAM,CAACC,MAAM,CAACL,cAAc,IAAI,CAAC,CAAC,CAAC,EAAE;IACzE;IACA;IACA,IACEE,IAAI,KAAK,SAAS,IAClB,OAAOC,aAAa,EAAEG,YAAY,KAAK,WAAW,EAClD;MACAH,aAAa,CAAC,wCAAwC,CAAC,GAAG,SAAS;IACrE;EACF;EAEA,OAAOJ,OAAO;AAChB;AAEA,MAAMQ,iBAA+B,GAAIZ,MAAM,IAAK;EAClD,OAAOf,gBAAgB,CAACe,MAAM,EAAE,MAAOC,CAAC,IAAK;IAC3CA,CAAC,CAACC,UAAU,CAACW,aAAa,CACxB,EAAE,EACF,0BAA0B,EAC1B,2CAA2C,EAC3C,IAAI,EACJ;MACEC,SAAS,EAAE,SAAS;MACpBC,WAAW,EAAE;AACrB;AACA;AACA;IACM,CACF,CAAC;IAED,OAAOd,CAAC;EACV,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMe,aAA2B,GAAIhB,MAAM,IAAK;EAC9C,OAAOf,gBAAgB,CAACe,MAAM,EAAE,MAAOC,CAAC,IAAK;IAC3CA,CAAC,CAACC,UAAU,CAACe,sBAAsB,GAAG,iBAAiB;IAEvD,OAAOhB,CAAC;EACV,CAAC,CAAC;AACJ,CAAC;AAED,MAAMiB,kCAAgD,GAAIlB,MAAM,IAAK;EACnE,OAAOf,gBAAgB,CAACe,MAAM,EAAGC,CAAC,IAAK;IACrCA,CAAC,CAACC,UAAU,GAAGC,wBAAwB,CAACF,CAAC,CAACC,UAAU,CAAC;IAErD,OAAOD,CAAC;EACV,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMkB,GAAG,GAAG;EACjBpB,sBAAsB;EACtBa,iBAAiB;EACjBI,aAAa;EACbE;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { createRunOncePlugin
|
|
4
|
-
import {
|
|
5
|
-
import { promises } from "node:fs";
|
|
6
|
-
import path from "node:path";
|
|
3
|
+
import { createRunOncePlugin } from "@expo/config-plugins";
|
|
4
|
+
import { ios } from "./ios.js";
|
|
7
5
|
let pkg = {
|
|
8
6
|
name: "@maplibre/maplibre-react-native"
|
|
9
7
|
};
|
|
@@ -12,129 +10,13 @@ try {
|
|
|
12
10
|
} catch {
|
|
13
11
|
// empty catch block
|
|
14
12
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Dangerously adds the custom installer hooks to the Podfile.
|
|
17
|
-
* In the future this should be removed in favor of some custom hooks provided by Expo autolinking.
|
|
18
|
-
*
|
|
19
|
-
* https://github.com/maplibre/maplibre-react-native/blob/main/docs/guides/setup/iOS.md
|
|
20
|
-
*/
|
|
21
|
-
const withCocoaPodsInstallerBlocks = c => {
|
|
22
|
-
return withDangerousMod(c, ["ios",
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
24
|
-
async config => {
|
|
25
|
-
const file = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
26
|
-
const contents = await promises.readFile(file, "utf8");
|
|
27
|
-
await promises.writeFile(file, applyCocoaPodsModifications(contents), "utf-8");
|
|
28
|
-
return config;
|
|
29
|
-
}]);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// Only the post-install block is required, the post installer block is
|
|
33
|
-
// used for spm (swift package manager) which Expo doesn't currently support.
|
|
34
|
-
export function applyCocoaPodsModifications(contents) {
|
|
35
|
-
// Ensure installer blocks exist
|
|
36
|
-
let src = addInstallerBlock(contents, "post");
|
|
37
|
-
src = addMapLibreInstallerBlock(src, "post");
|
|
38
|
-
return src;
|
|
39
|
-
}
|
|
40
|
-
export function addInstallerBlock(src, blockName) {
|
|
41
|
-
const matchBlock = new RegExp(`${blockName}_install do \\|installer\\|`);
|
|
42
|
-
const tag = `${blockName}_installer`;
|
|
43
|
-
for (const line of src.split("\n")) {
|
|
44
|
-
const contents = line.trim();
|
|
45
|
-
// Ignore comments
|
|
46
|
-
if (!contents.startsWith("#")) {
|
|
47
|
-
// Prevent adding the block if it exists outside of comments.
|
|
48
|
-
if (contents.match(matchBlock)) {
|
|
49
|
-
// This helps to still allow revisions, since we enabled the block previously.
|
|
50
|
-
// Only continue if the generated block exists...
|
|
51
|
-
const modified = removeGeneratedContents(src, tag);
|
|
52
|
-
if (!modified) {
|
|
53
|
-
return src;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return mergeContents({
|
|
59
|
-
tag,
|
|
60
|
-
src,
|
|
61
|
-
newSrc: [` ${blockName}_install do |installer|`, " end"].join("\n"),
|
|
62
|
-
anchor: /use_react_native/,
|
|
63
|
-
// We can't go after the use_react_native block because it might have parameters, causing it to be multi-line (see react-native template).
|
|
64
|
-
offset: 0,
|
|
65
|
-
comment: "#"
|
|
66
|
-
}).contents;
|
|
67
|
-
}
|
|
68
|
-
export function addMapLibreInstallerBlock(src, blockName) {
|
|
69
|
-
return mergeContents({
|
|
70
|
-
tag: `@maplibre/maplibre-react-native-${blockName}_installer`,
|
|
71
|
-
src,
|
|
72
|
-
newSrc: ` $MLRN.${blockName}_install(installer)`,
|
|
73
|
-
anchor: new RegExp(`${blockName}_install do \\|installer\\|`),
|
|
74
|
-
offset: 1,
|
|
75
|
-
comment: "#"
|
|
76
|
-
}).contents;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
81
|
-
* Without this, production builds targeting simulators will fail.
|
|
82
|
-
*/
|
|
83
|
-
export function setExcludedArchitectures(project) {
|
|
84
|
-
const configurations = project.pbxXCBuildConfigurationSection();
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
86
|
-
// @ts-ignore
|
|
87
|
-
for (const {
|
|
88
|
-
name,
|
|
89
|
-
buildSettings
|
|
90
|
-
} of Object.values(configurations || {})) {
|
|
91
|
-
// Guessing that this is the best way to emulate Xcode.
|
|
92
|
-
// Using `project.addToBuildSettings` modifies too many targets.
|
|
93
|
-
if (name === "Release" && typeof buildSettings?.PRODUCT_NAME !== "undefined") {
|
|
94
|
-
buildSettings['"EXCLUDED_ARCHS[sdk=iphonesimulator*]"'] = '"arm64"';
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return project;
|
|
98
|
-
}
|
|
99
|
-
const withoutSignatures = config => {
|
|
100
|
-
const shellScript = `
|
|
101
|
-
echo "Remove signature files (Xcode workaround)";
|
|
102
|
-
rm -rf "$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature";
|
|
103
|
-
`;
|
|
104
|
-
return withXcodeProject(config, async config => {
|
|
105
|
-
const xcodeProject = config.modResults;
|
|
106
|
-
xcodeProject.addBuildPhase([], "PBXShellScriptBuildPhase", "Remove signature files (Xcode workaround)", null, {
|
|
107
|
-
shellPath: "/bin/sh",
|
|
108
|
-
shellScript
|
|
109
|
-
});
|
|
110
|
-
return config;
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Set the Debug Information Format to DWARF with dSYM File during EAS Build for Managed App
|
|
116
|
-
* https://github.com/expo/eas-cli/issues/968
|
|
117
|
-
* // Set artifactPath in eas.json
|
|
118
|
-
* "ios": {
|
|
119
|
-
* "artifactPath": "ios/build/*"
|
|
120
|
-
* }
|
|
121
|
-
*/
|
|
122
|
-
const withDwarfDsym = config => {
|
|
123
|
-
return withXcodeProject(config, async config => {
|
|
124
|
-
const xcodeProject = config.modResults;
|
|
125
|
-
xcodeProject.debugInformationFormat = "dwarf-with-dsym";
|
|
126
|
-
return config;
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
const withExcludedSimulatorArchitectures = c => {
|
|
130
|
-
return withXcodeProject(c, config => {
|
|
131
|
-
config.modResults = setExcludedArchitectures(config.modResults);
|
|
132
|
-
return config;
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
13
|
const withMapLibre = config => {
|
|
136
|
-
|
|
137
|
-
|
|
14
|
+
// iOS
|
|
15
|
+
config = ios.withExcludedSimulatorArchitectures(config);
|
|
16
|
+
config = ios.withDwarfDsym(config);
|
|
17
|
+
config = ios.withoutSignatures(config);
|
|
18
|
+
config = ios.withPodfilePostInstall(config);
|
|
19
|
+
return config;
|
|
138
20
|
};
|
|
139
21
|
export default createRunOncePlugin(withMapLibre, pkg.name, pkg.version);
|
|
140
22
|
//# sourceMappingURL=withMapLibre.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRunOncePlugin","
|
|
1
|
+
{"version":3,"names":["createRunOncePlugin","ios","pkg","name","require","withMapLibre","config","withExcludedSimulatorArchitectures","withDwarfDsym","withoutSignatures","withPodfilePostInstall","version"],"sourceRoot":"../../../src","sources":["plugin/withMapLibre.ts"],"mappings":";;AAAA,SAA4BA,mBAAmB,QAAQ,sBAAsB;AAE7E,SAASC,GAAG,QAAQ,UAAO;AAE3B,IAAIC,GAAuC,GAAG;EAC5CC,IAAI,EAAE;AACR,CAAC;AACD,IAAI;EACFD,GAAG,GAAGE,OAAO,CAAC,8CAA8C,CAAC;AAC/D,CAAC,CAAC,MAAM;EACN;AAAA;AAGF,MAAMC,YAA0B,GAAIC,MAAM,IAAK;EAC7C;EACAA,MAAM,GAAGL,GAAG,CAACM,kCAAkC,CAACD,MAAM,CAAC;EACvDA,MAAM,GAAGL,GAAG,CAACO,aAAa,CAACF,MAAM,CAAC;EAClCA,MAAM,GAAGL,GAAG,CAACQ,iBAAiB,CAACH,MAAM,CAAC;EACtCA,MAAM,GAAGL,GAAG,CAACS,sBAAsB,CAACJ,MAAM,CAAC;EAE3C,OAAOA,MAAM;AACf,CAAC;AAED,eAAeN,mBAAmB,CAACK,YAAY,EAAEH,GAAG,CAACC,IAAI,EAAED,GAAG,CAACS,OAAO,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ConfigPlugin } from "@expo/config-plugins";
|
|
2
|
+
/**
|
|
3
|
+
* Only the post-install block is required, the post installer block is used for SPM (Swift Package Manager) which Expo
|
|
4
|
+
* doesn't currently support.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyPodfilePostInstall(contents: string): string;
|
|
7
|
+
export declare const ios: {
|
|
8
|
+
withPodfilePostInstall: ConfigPlugin;
|
|
9
|
+
withoutSignatures: ConfigPlugin;
|
|
10
|
+
withDwarfDsym: ConfigPlugin;
|
|
11
|
+
withExcludedSimulatorArchitectures: ConfigPlugin;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAehE;AA+ED,eAAO,MAAM,GAAG;;;;;CAKf,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { type ConfigPlugin
|
|
2
|
-
type InstallerBlockName = "pre" | "post";
|
|
3
|
-
export declare function applyCocoaPodsModifications(contents: string): string;
|
|
4
|
-
export declare function addInstallerBlock(src: string, blockName: InstallerBlockName): string;
|
|
5
|
-
export declare function addMapLibreInstallerBlock(src: string, blockName: InstallerBlockName): string;
|
|
6
|
-
/**
|
|
7
|
-
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
8
|
-
* Without this, production builds targeting simulators will fail.
|
|
9
|
-
*/
|
|
10
|
-
export declare function setExcludedArchitectures(project: XcodeProject): XcodeProject;
|
|
1
|
+
import { type ConfigPlugin } from "@expo/config-plugins";
|
|
11
2
|
declare const _default: ConfigPlugin<void>;
|
|
12
3
|
export default _default;
|
|
13
4
|
//# sourceMappingURL=withMapLibre.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMapLibre.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/withMapLibre.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"withMapLibre.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/withMapLibre.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,sBAAsB,CAAC;;AAuB9E,wBAAwE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ConfigPlugin } from "@expo/config-plugins";
|
|
2
|
+
/**
|
|
3
|
+
* Only the post-install block is required, the post installer block is used for SPM (Swift Package Manager) which Expo
|
|
4
|
+
* doesn't currently support.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyPodfilePostInstall(contents: string): string;
|
|
7
|
+
export declare const ios: {
|
|
8
|
+
withPodfilePostInstall: ConfigPlugin;
|
|
9
|
+
withoutSignatures: ConfigPlugin;
|
|
10
|
+
withDwarfDsym: ConfigPlugin;
|
|
11
|
+
withExcludedSimulatorArchitectures: ConfigPlugin;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAehE;AA+ED,eAAO,MAAM,GAAG;;;;;CAKf,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { type ConfigPlugin
|
|
2
|
-
type InstallerBlockName = "pre" | "post";
|
|
3
|
-
export declare function applyCocoaPodsModifications(contents: string): string;
|
|
4
|
-
export declare function addInstallerBlock(src: string, blockName: InstallerBlockName): string;
|
|
5
|
-
export declare function addMapLibreInstallerBlock(src: string, blockName: InstallerBlockName): string;
|
|
6
|
-
/**
|
|
7
|
-
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
8
|
-
* Without this, production builds targeting simulators will fail.
|
|
9
|
-
*/
|
|
10
|
-
export declare function setExcludedArchitectures(project: XcodeProject): XcodeProject;
|
|
1
|
+
import { type ConfigPlugin } from "@expo/config-plugins";
|
|
11
2
|
declare const _default: ConfigPlugin<void>;
|
|
12
3
|
export default _default;
|
|
13
4
|
//# sourceMappingURL=withMapLibre.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMapLibre.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/withMapLibre.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"withMapLibre.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/withMapLibre.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,sBAAsB,CAAC;;AAuB9E,wBAAwE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-react-native",
|
|
3
3
|
"description": "React Native library for creating maps with MapLibre Native for Android & iOS",
|
|
4
|
-
"version": "10.0.0-beta.
|
|
4
|
+
"version": "10.0.0-beta.17",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": true
|
|
@@ -165,6 +165,7 @@
|
|
|
165
165
|
"react-native-builder-bob": "^0.34.0",
|
|
166
166
|
"react-test-renderer": "18.3.1",
|
|
167
167
|
"semantic-release": "^24.2.0",
|
|
168
|
+
"snapshot-diff": "^0.10.0",
|
|
168
169
|
"ts-node": "^10.9.2",
|
|
169
170
|
"tsx": "^4.19.2",
|
|
170
171
|
"typescript": "^5.7.2"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ConfigPlugin,
|
|
3
|
+
withPodfile,
|
|
4
|
+
withXcodeProject,
|
|
5
|
+
type XcodeProject,
|
|
6
|
+
} from "@expo/config-plugins";
|
|
7
|
+
import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Only the post-install block is required, the post installer block is used for SPM (Swift Package Manager) which Expo
|
|
11
|
+
* doesn't currently support.
|
|
12
|
+
*/
|
|
13
|
+
export function applyPodfilePostInstall(contents: string): string {
|
|
14
|
+
const result = mergeContents({
|
|
15
|
+
tag: `@maplibre/maplibre-react-native-post_installer`,
|
|
16
|
+
src: contents,
|
|
17
|
+
newSrc: ` $MLRN.post_install(installer)`,
|
|
18
|
+
anchor: new RegExp(`post_install do \\|installer\\|`),
|
|
19
|
+
offset: 1,
|
|
20
|
+
comment: "#",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (result.didMerge || result.didClear) {
|
|
24
|
+
return result.contents;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return contents;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const withPodfilePostInstall: ConfigPlugin = (config) => {
|
|
31
|
+
return withPodfile(config, (c) => {
|
|
32
|
+
c.modResults.contents = applyPodfilePostInstall(c.modResults.contents);
|
|
33
|
+
|
|
34
|
+
return c;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
40
|
+
* Without this, production builds targeting simulators will fail.
|
|
41
|
+
*/
|
|
42
|
+
function setExcludedArchitectures(project: XcodeProject): XcodeProject {
|
|
43
|
+
const configurations = project.pbxXCBuildConfigurationSection();
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
for (const { name, buildSettings } of Object.values(configurations || {})) {
|
|
47
|
+
// Guessing that this is the best way to emulate Xcode.
|
|
48
|
+
// Using `project.addToBuildSettings` modifies too many targets.
|
|
49
|
+
if (
|
|
50
|
+
name === "Release" &&
|
|
51
|
+
typeof buildSettings?.PRODUCT_NAME !== "undefined"
|
|
52
|
+
) {
|
|
53
|
+
buildSettings['"EXCLUDED_ARCHS[sdk=iphonesimulator*]"'] = '"arm64"';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return project;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const withoutSignatures: ConfigPlugin = (config) => {
|
|
61
|
+
return withXcodeProject(config, async (c) => {
|
|
62
|
+
c.modResults.addBuildPhase(
|
|
63
|
+
[],
|
|
64
|
+
"PBXShellScriptBuildPhase",
|
|
65
|
+
"Remove signature files (Xcode workaround)",
|
|
66
|
+
null,
|
|
67
|
+
{
|
|
68
|
+
shellPath: "/bin/sh",
|
|
69
|
+
shellScript: `
|
|
70
|
+
echo "Remove signature files (Xcode workaround)";
|
|
71
|
+
rm -rf "$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature";
|
|
72
|
+
`,
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return c;
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set the Debug Information Format to DWARF with dSYM File during EAS Build for Managed App
|
|
82
|
+
* https://github.com/expo/eas-cli/issues/968
|
|
83
|
+
*
|
|
84
|
+
* Set `artifactPath` in `eas.json`:
|
|
85
|
+
* ```json
|
|
86
|
+
* "ios": {
|
|
87
|
+
* "artifactPath": "ios/build/*"
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
const withDwarfDsym: ConfigPlugin = (config) => {
|
|
92
|
+
return withXcodeProject(config, async (c) => {
|
|
93
|
+
c.modResults.debugInformationFormat = "dwarf-with-dsym";
|
|
94
|
+
|
|
95
|
+
return c;
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const withExcludedSimulatorArchitectures: ConfigPlugin = (config) => {
|
|
100
|
+
return withXcodeProject(config, (c) => {
|
|
101
|
+
c.modResults = setExcludedArchitectures(c.modResults);
|
|
102
|
+
|
|
103
|
+
return c;
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const ios = {
|
|
108
|
+
withPodfilePostInstall,
|
|
109
|
+
withoutSignatures,
|
|
110
|
+
withDwarfDsym,
|
|
111
|
+
withExcludedSimulatorArchitectures,
|
|
112
|
+
};
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
withDangerousMod,
|
|
5
|
-
withXcodeProject,
|
|
6
|
-
type XcodeProject,
|
|
7
|
-
} from "@expo/config-plugins";
|
|
8
|
-
import {
|
|
9
|
-
mergeContents,
|
|
10
|
-
removeGeneratedContents,
|
|
11
|
-
} from "@expo/config-plugins/build/utils/generateCode";
|
|
12
|
-
import { promises } from "node:fs";
|
|
13
|
-
import path from "node:path";
|
|
1
|
+
import { type ConfigPlugin, createRunOncePlugin } from "@expo/config-plugins";
|
|
2
|
+
|
|
3
|
+
import { ios } from "./ios";
|
|
14
4
|
|
|
15
5
|
let pkg: { name: string; version?: string } = {
|
|
16
6
|
name: "@maplibre/maplibre-react-native",
|
|
@@ -21,161 +11,14 @@ try {
|
|
|
21
11
|
// empty catch block
|
|
22
12
|
}
|
|
23
13
|
|
|
24
|
-
type InstallerBlockName = "pre" | "post";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Dangerously adds the custom installer hooks to the Podfile.
|
|
28
|
-
* In the future this should be removed in favor of some custom hooks provided by Expo autolinking.
|
|
29
|
-
*
|
|
30
|
-
* https://github.com/maplibre/maplibre-react-native/blob/main/docs/guides/setup/iOS.md
|
|
31
|
-
*/
|
|
32
|
-
const withCocoaPodsInstallerBlocks: ConfigPlugin = (c) => {
|
|
33
|
-
return withDangerousMod(c, [
|
|
34
|
-
"ios",
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
36
|
-
async (config) => {
|
|
37
|
-
const file = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
38
|
-
|
|
39
|
-
const contents = await promises.readFile(file, "utf8");
|
|
40
|
-
|
|
41
|
-
await promises.writeFile(
|
|
42
|
-
file,
|
|
43
|
-
applyCocoaPodsModifications(contents),
|
|
44
|
-
"utf-8",
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
return config;
|
|
48
|
-
},
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// Only the post-install block is required, the post installer block is
|
|
53
|
-
// used for spm (swift package manager) which Expo doesn't currently support.
|
|
54
|
-
export function applyCocoaPodsModifications(contents: string): string {
|
|
55
|
-
// Ensure installer blocks exist
|
|
56
|
-
let src = addInstallerBlock(contents, "post");
|
|
57
|
-
src = addMapLibreInstallerBlock(src, "post");
|
|
58
|
-
|
|
59
|
-
return src;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function addInstallerBlock(
|
|
63
|
-
src: string,
|
|
64
|
-
blockName: InstallerBlockName,
|
|
65
|
-
): string {
|
|
66
|
-
const matchBlock = new RegExp(`${blockName}_install do \\|installer\\|`);
|
|
67
|
-
const tag = `${blockName}_installer`;
|
|
68
|
-
for (const line of src.split("\n")) {
|
|
69
|
-
const contents = line.trim();
|
|
70
|
-
// Ignore comments
|
|
71
|
-
if (!contents.startsWith("#")) {
|
|
72
|
-
// Prevent adding the block if it exists outside of comments.
|
|
73
|
-
if (contents.match(matchBlock)) {
|
|
74
|
-
// This helps to still allow revisions, since we enabled the block previously.
|
|
75
|
-
// Only continue if the generated block exists...
|
|
76
|
-
const modified = removeGeneratedContents(src, tag);
|
|
77
|
-
if (!modified) {
|
|
78
|
-
return src;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return mergeContents({
|
|
85
|
-
tag,
|
|
86
|
-
src,
|
|
87
|
-
newSrc: [` ${blockName}_install do |installer|`, " end"].join("\n"),
|
|
88
|
-
anchor: /use_react_native/,
|
|
89
|
-
// We can't go after the use_react_native block because it might have parameters, causing it to be multi-line (see react-native template).
|
|
90
|
-
offset: 0,
|
|
91
|
-
comment: "#",
|
|
92
|
-
}).contents;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export function addMapLibreInstallerBlock(
|
|
96
|
-
src: string,
|
|
97
|
-
blockName: InstallerBlockName,
|
|
98
|
-
): string {
|
|
99
|
-
return mergeContents({
|
|
100
|
-
tag: `@maplibre/maplibre-react-native-${blockName}_installer`,
|
|
101
|
-
src,
|
|
102
|
-
newSrc: ` $MLRN.${blockName}_install(installer)`,
|
|
103
|
-
anchor: new RegExp(`${blockName}_install do \\|installer\\|`),
|
|
104
|
-
offset: 1,
|
|
105
|
-
comment: "#",
|
|
106
|
-
}).contents;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Exclude building for arm64 on simulator devices in the pbxproj project.
|
|
111
|
-
* Without this, production builds targeting simulators will fail.
|
|
112
|
-
*/
|
|
113
|
-
export function setExcludedArchitectures(project: XcodeProject): XcodeProject {
|
|
114
|
-
const configurations = project.pbxXCBuildConfigurationSection();
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
for (const { name, buildSettings } of Object.values(configurations || {})) {
|
|
118
|
-
// Guessing that this is the best way to emulate Xcode.
|
|
119
|
-
// Using `project.addToBuildSettings` modifies too many targets.
|
|
120
|
-
if (
|
|
121
|
-
name === "Release" &&
|
|
122
|
-
typeof buildSettings?.PRODUCT_NAME !== "undefined"
|
|
123
|
-
) {
|
|
124
|
-
buildSettings['"EXCLUDED_ARCHS[sdk=iphonesimulator*]"'] = '"arm64"';
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return project;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const withoutSignatures: ConfigPlugin = (config) => {
|
|
131
|
-
const shellScript = `
|
|
132
|
-
echo "Remove signature files (Xcode workaround)";
|
|
133
|
-
rm -rf "$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature";
|
|
134
|
-
`;
|
|
135
|
-
return withXcodeProject(config, async (config) => {
|
|
136
|
-
const xcodeProject = config.modResults;
|
|
137
|
-
xcodeProject.addBuildPhase(
|
|
138
|
-
[],
|
|
139
|
-
"PBXShellScriptBuildPhase",
|
|
140
|
-
"Remove signature files (Xcode workaround)",
|
|
141
|
-
null,
|
|
142
|
-
{
|
|
143
|
-
shellPath: "/bin/sh",
|
|
144
|
-
shellScript,
|
|
145
|
-
},
|
|
146
|
-
);
|
|
147
|
-
return config;
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Set the Debug Information Format to DWARF with dSYM File during EAS Build for Managed App
|
|
153
|
-
* https://github.com/expo/eas-cli/issues/968
|
|
154
|
-
* // Set artifactPath in eas.json
|
|
155
|
-
* "ios": {
|
|
156
|
-
* "artifactPath": "ios/build/*"
|
|
157
|
-
* }
|
|
158
|
-
*/
|
|
159
|
-
const withDwarfDsym: ConfigPlugin = (config) => {
|
|
160
|
-
return withXcodeProject(config, async (config) => {
|
|
161
|
-
const xcodeProject = config.modResults;
|
|
162
|
-
xcodeProject.debugInformationFormat = "dwarf-with-dsym";
|
|
163
|
-
return config;
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const withExcludedSimulatorArchitectures: ConfigPlugin = (c) => {
|
|
168
|
-
return withXcodeProject(c, (config) => {
|
|
169
|
-
config.modResults = setExcludedArchitectures(config.modResults);
|
|
170
|
-
return config;
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
|
|
174
14
|
const withMapLibre: ConfigPlugin = (config) => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
);
|
|
178
|
-
|
|
15
|
+
// iOS
|
|
16
|
+
config = ios.withExcludedSimulatorArchitectures(config);
|
|
17
|
+
config = ios.withDwarfDsym(config);
|
|
18
|
+
config = ios.withoutSignatures(config);
|
|
19
|
+
config = ios.withPodfilePostInstall(config);
|
|
20
|
+
|
|
21
|
+
return config;
|
|
179
22
|
};
|
|
180
23
|
|
|
181
24
|
export default createRunOncePlugin(withMapLibre, pkg.name, pkg.version);
|