expo-beacon 0.7.12 → 0.7.13
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/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withBeaconIOS.d.ts","sourceRoot":"","sources":["../src/withBeaconIOS.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,sBAAsB,CAAC;AAM9B,eAAO,MAAM,gBAAgB,mvBAkB5B,CAAC;
|
|
1
|
+
{"version":3,"file":"withBeaconIOS.d.ts","sourceRoot":"","sources":["../src/withBeaconIOS.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,sBAAsB,CAAC;AAM9B,eAAO,MAAM,gBAAgB,mvBAkB5B,CAAC;AAoQF,QAAA,MAAM,aAAa,EAAE,YAkCpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -36,16 +36,21 @@ function normalizePBXValue(value) {
|
|
|
36
36
|
function findPBXGroupKeyByName(xcodeProject, name) {
|
|
37
37
|
var _a;
|
|
38
38
|
const pbxGroups = (_a = xcodeProject.hash.project.objects['PBXGroup']) !== null && _a !== void 0 ? _a : {};
|
|
39
|
+
// Prefer a group whose `path` equals the name — that group IS the filesystem
|
|
40
|
+
// directory. A group matched only by `name` may be a virtual (path-less)
|
|
41
|
+
// container whose children resolve relative to its parent, not itself.
|
|
42
|
+
let nameMatch = null;
|
|
39
43
|
for (const key of Object.keys(pbxGroups)) {
|
|
40
44
|
if (key.endsWith('_comment'))
|
|
41
45
|
continue;
|
|
42
46
|
const group = pbxGroups[key];
|
|
43
|
-
if (normalizePBXValue(group.
|
|
44
|
-
normalizePBXValue(group.path) === name) {
|
|
47
|
+
if (normalizePBXValue(group.path) === name)
|
|
45
48
|
return key;
|
|
49
|
+
if (normalizePBXValue(group.name) === name && nameMatch === null) {
|
|
50
|
+
nameMatch = key;
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
return
|
|
53
|
+
return nameMatch;
|
|
49
54
|
}
|
|
50
55
|
function findPBXFileReferences(xcodeProject, filename) {
|
|
51
56
|
var _a;
|
|
@@ -135,8 +140,16 @@ function removePBXFileReferences(xcodeProject, fileReferences) {
|
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
function ensureIOSPluginSourceFile(xcodeProject, projectName) {
|
|
138
|
-
var _a;
|
|
143
|
+
var _a, _b, _c;
|
|
139
144
|
const groupKey = (_a = findPBXGroupKeyByName(xcodeProject, projectName)) !== null && _a !== void 0 ? _a : undefined;
|
|
145
|
+
// A virtual (name-only) PBXGroup has no `path`. Files added to it with
|
|
146
|
+
// `<group>` sourceTree resolve relative to the group's *parent*, not the
|
|
147
|
+
// group itself, so `BeaconGeoPlugin.swift` would land at `ios/` not
|
|
148
|
+
// `ios/<AppName>/`. Only treat the group as a physical directory group when
|
|
149
|
+
// its `path` actually equals the project name.
|
|
150
|
+
const pbxGroups = (_b = xcodeProject.hash.project.objects['PBXGroup']) !== null && _b !== void 0 ? _b : {};
|
|
151
|
+
const groupHasPhysicalPath = groupKey != null &&
|
|
152
|
+
normalizePBXValue((_c = pbxGroups[groupKey]) === null || _c === void 0 ? void 0 : _c.path) === projectName;
|
|
140
153
|
const existingFileReferences = findPBXFileReferences(xcodeProject, IOS_PLUGIN_FILENAME);
|
|
141
154
|
const existingBuildFileKeys = findPBXBuildFileKeys(xcodeProject, existingFileReferences.map(({ key }) => key), IOS_PLUGIN_FILENAME);
|
|
142
155
|
if (existingFileReferences.length === 1 &&
|
|
@@ -150,7 +163,11 @@ function ensureIOSPluginSourceFile(xcodeProject, projectName) {
|
|
|
150
163
|
fileRef: existingFileReference.key,
|
|
151
164
|
basename: IOS_PLUGIN_FILENAME,
|
|
152
165
|
}, groupKey);
|
|
153
|
-
|
|
166
|
+
// If the group is virtual (no path), the file reference path must include
|
|
167
|
+
// the project name so Xcode resolves it to ios/<AppName>/BeaconGeoPlugin.swift.
|
|
168
|
+
existingFileReference.ref.path = groupHasPhysicalPath
|
|
169
|
+
? `"${IOS_PLUGIN_FILENAME}"`
|
|
170
|
+
: `"${projectName}/${IOS_PLUGIN_FILENAME}"`;
|
|
154
171
|
return;
|
|
155
172
|
}
|
|
156
173
|
existingFileReference.ref.path = `"${projectName}/${IOS_PLUGIN_FILENAME}"`;
|
|
@@ -162,10 +179,14 @@ function ensureIOSPluginSourceFile(xcodeProject, projectName) {
|
|
|
162
179
|
removeFileReferenceFromAllGroups(xcodeProject, existingFileReferences.map(({ key }) => key));
|
|
163
180
|
removePBXFileReferences(xcodeProject, existingFileReferences);
|
|
164
181
|
}
|
|
165
|
-
if (groupKey) {
|
|
182
|
+
if (groupKey && groupHasPhysicalPath) {
|
|
183
|
+
// Physical group (path = projectName): add with just the filename; Xcode
|
|
184
|
+
// resolves it through the group's directory chain to ios/<AppName>/file.
|
|
166
185
|
xcodeProject.addSourceFile(IOS_PLUGIN_FILENAME, null, groupKey);
|
|
167
186
|
return;
|
|
168
187
|
}
|
|
188
|
+
// Virtual group (name-only, no path) or no group found: use an explicit
|
|
189
|
+
// SOURCE_ROOT-relative path so Xcode always finds ios/<AppName>/file.
|
|
169
190
|
xcodeProject.addSourceFile(`${projectName}/${IOS_PLUGIN_FILENAME}`);
|
|
170
191
|
}
|
|
171
192
|
function modifySwiftAppDelegate(contents) {
|