expo-beacon 0.7.9 → 0.7.11

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/build/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { default } from "./ExpoBeaconModule";
1
+ export { default } from "./ExpoBeaconModule.js";
2
2
  export type { BeaconScanResult, PairedBeacon, BeaconRegionEvent, BeaconDistanceEvent, BeaconTimeoutEvent, ExpoBeaconModuleEvents, NotificationConfig, MonitoringOptions, MonitoringConfig, MonitoredDeviceState, BeaconNotificationConfig, ForegroundServiceConfig, NotificationChannelConfig, EddystoneFrameType, EddystoneScanResult, PairedEddystone, EddystoneRegionEvent, EddystoneDistanceEvent, EddystoneTimeoutEvent, EventLogQueryOptions, EventLogEntry, } from "./ExpoBeacon.types";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,GACd,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,GACd,MAAM,oBAAoB,CAAC"}
package/build/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Native module (default export)
2
- export { default } from "./ExpoBeaconModule";
2
+ export { default } from "./ExpoBeaconModule.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["// Native module (default export)\r\nexport { default } from \"./ExpoBeaconModule\";\r\n\r\n// All public types\r\nexport type {\r\n BeaconScanResult,\r\n PairedBeacon,\r\n BeaconRegionEvent,\r\n BeaconDistanceEvent,\r\n BeaconTimeoutEvent,\r\n ExpoBeaconModuleEvents,\r\n NotificationConfig,\r\n MonitoringOptions,\r\n MonitoringConfig,\r\n MonitoredDeviceState,\r\n BeaconNotificationConfig,\r\n ForegroundServiceConfig,\r\n NotificationChannelConfig,\r\n EddystoneFrameType,\r\n EddystoneScanResult,\r\n PairedEddystone,\r\n EddystoneRegionEvent,\r\n EddystoneDistanceEvent,\r\n EddystoneTimeoutEvent,\r\n EventLogQueryOptions,\r\n EventLogEntry,\r\n} from \"./ExpoBeacon.types\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Native module (default export)\r\nexport { default } from \"./ExpoBeaconModule.js\";\r\n\r\n// All public types\r\nexport type {\r\n BeaconScanResult,\r\n PairedBeacon,\r\n BeaconRegionEvent,\r\n BeaconDistanceEvent,\r\n BeaconTimeoutEvent,\r\n ExpoBeaconModuleEvents,\r\n NotificationConfig,\r\n MonitoringOptions,\r\n MonitoringConfig,\r\n MonitoredDeviceState,\r\n BeaconNotificationConfig,\r\n ForegroundServiceConfig,\r\n NotificationChannelConfig,\r\n EddystoneFrameType,\r\n EddystoneScanResult,\r\n PairedEddystone,\r\n EddystoneRegionEvent,\r\n EddystoneDistanceEvent,\r\n EddystoneTimeoutEvent,\r\n EventLogQueryOptions,\r\n EventLogEntry,\r\n} from \"./ExpoBeacon.types\";\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-beacon",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
4
4
  "description": "Expo module for scanning, pairing, and monitoring iBeacons on Android and iOS",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -9,7 +9,9 @@
9
9
  "import": "./build/index.js",
10
10
  "require": "./build/index.js",
11
11
  "types": "./build/index.d.ts"
12
- }
12
+ },
13
+ "./app.plugin": "./app.plugin.js",
14
+ "./app.plugin.js": "./app.plugin.js"
13
15
  },
14
16
  "files": [
15
17
  "build/",
@@ -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;AA4DF,QAAA,MAAM,aAAa,EAAE,YAqCpB,CAAC;AAEF,eAAe,aAAa,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;AA0IF,QAAA,MAAM,aAAa,EAAE,YAkCpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -24,11 +24,15 @@ final class BeaconGeoPlugin: BeaconLifecycleDelegate {
24
24
  }
25
25
  }
26
26
  `;
27
+ const IOS_PLUGIN_FILENAME = 'BeaconGeoPlugin.swift';
27
28
  // ─── Helpers ──────────────────────────────────────────────────────────────────
28
29
  /**
29
30
  * Finds the UUID (key) of a PBXGroup by name, handling both quoted and unquoted
30
31
  * name values produced by node-xcode's parser.
31
32
  */
33
+ function normalizePBXValue(value) {
34
+ return typeof value === 'string' ? value.replace(/^"|"$/g, '') : '';
35
+ }
32
36
  function findPBXGroupKeyByName(xcodeProject, name) {
33
37
  var _a;
34
38
  const pbxGroups = (_a = xcodeProject.hash.project.objects['PBXGroup']) !== null && _a !== void 0 ? _a : {};
@@ -36,18 +40,67 @@ function findPBXGroupKeyByName(xcodeProject, name) {
36
40
  if (key.endsWith('_comment'))
37
41
  continue;
38
42
  const group = pbxGroups[key];
39
- if (group.name === `"${name}"` || group.name === name)
43
+ if (normalizePBXValue(group.name) === name ||
44
+ normalizePBXValue(group.path) === name) {
40
45
  return key;
46
+ }
41
47
  }
42
48
  return null;
43
49
  }
44
- /** Returns true if a PBXFileReference for filename already exists (idempotency guard). */
45
- function isFileInXcodeProject(xcodeProject, filename) {
50
+ function findPBXFileReference(xcodeProject, filename) {
46
51
  var _a;
47
52
  const refs = (_a = xcodeProject.hash.project.objects['PBXFileReference']) !== null && _a !== void 0 ? _a : {};
48
- return Object.values(refs).some((f) => typeof f === 'object' &&
49
- f !== null &&
50
- (f.path === `"${filename}"` || f.path === filename));
53
+ for (const key of Object.keys(refs)) {
54
+ if (key.endsWith('_comment'))
55
+ continue;
56
+ const ref = refs[key];
57
+ if (typeof ref !== 'object' || ref === null)
58
+ continue;
59
+ const refPath = normalizePBXValue(ref.path);
60
+ const refName = normalizePBXValue(ref.name);
61
+ if (path.posix.basename(refPath) === filename ||
62
+ path.posix.basename(refName) === filename) {
63
+ return { key, ref };
64
+ }
65
+ }
66
+ return null;
67
+ }
68
+ function removeFileReferenceFromAllGroups(xcodeProject, fileRefKey) {
69
+ var _a;
70
+ const pbxGroups = (_a = xcodeProject.hash.project.objects['PBXGroup']) !== null && _a !== void 0 ? _a : {};
71
+ for (const key of Object.keys(pbxGroups)) {
72
+ if (key.endsWith('_comment'))
73
+ continue;
74
+ const group = pbxGroups[key];
75
+ if (!Array.isArray(group.children))
76
+ continue;
77
+ group.children = group.children.filter((child) => child.value !== fileRefKey);
78
+ }
79
+ }
80
+ function ensureIOSPluginSourceFile(xcodeProject, projectName) {
81
+ var _a;
82
+ const groupKey = (_a = findPBXGroupKeyByName(xcodeProject, projectName)) !== null && _a !== void 0 ? _a : undefined;
83
+ const existingFileReference = findPBXFileReference(xcodeProject, IOS_PLUGIN_FILENAME);
84
+ if (existingFileReference) {
85
+ existingFileReference.ref.name = `"${IOS_PLUGIN_FILENAME}"`;
86
+ existingFileReference.ref.sourceTree = '"<group>"';
87
+ if (groupKey) {
88
+ removeFileReferenceFromAllGroups(xcodeProject, existingFileReference.key);
89
+ xcodeProject.addToPbxGroup({
90
+ fileRef: existingFileReference.key,
91
+ basename: IOS_PLUGIN_FILENAME,
92
+ }, groupKey);
93
+ existingFileReference.ref.path = `"${IOS_PLUGIN_FILENAME}"`;
94
+ return;
95
+ }
96
+ existingFileReference.ref.path = `"${projectName}/${IOS_PLUGIN_FILENAME}"`;
97
+ return;
98
+ }
99
+ if (groupKey) {
100
+ xcodeProject.addSourceFile(IOS_PLUGIN_FILENAME, null, groupKey);
101
+ return;
102
+ }
103
+ xcodeProject.addSourceFile(`${projectName}/${IOS_PLUGIN_FILENAME}`);
51
104
  }
52
105
  function modifySwiftAppDelegate(contents) {
53
106
  // Insert `import ExpoBeacon` after the last existing import line.
@@ -71,17 +124,13 @@ function modifySwiftAppDelegate(contents) {
71
124
  const withBeaconIOS = (config) => {
72
125
  // Step 1 – write BeaconGeoPlugin.swift and add it to the Xcode project.
73
126
  config = (0, config_plugins_1.withXcodeProject)(config, (config) => {
74
- var _a;
75
127
  const xcodeProject = config.modResults;
76
128
  const { projectName, platformProjectRoot } = config.modRequest;
77
129
  if (!projectName || !platformProjectRoot)
78
130
  return config;
79
- const swiftFilePath = path.join(platformProjectRoot, projectName, 'BeaconGeoPlugin.swift');
131
+ const swiftFilePath = path.join(platformProjectRoot, projectName, IOS_PLUGIN_FILENAME);
80
132
  fs.writeFileSync(swiftFilePath, exports.IOS_PLUGIN_SWIFT);
81
- if (!isFileInXcodeProject(xcodeProject, 'BeaconGeoPlugin.swift')) {
82
- const groupKey = (_a = findPBXGroupKeyByName(xcodeProject, projectName)) !== null && _a !== void 0 ? _a : undefined;
83
- xcodeProject.addSourceFile('BeaconGeoPlugin.swift', null, groupKey !== null && groupKey !== void 0 ? groupKey : undefined);
84
- }
133
+ ensureIOSPluginSourceFile(xcodeProject, projectName);
85
134
  return config;
86
135
  });
87
136
  // Step 2 – patch AppDelegate.swift to register the plugin before super.
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Native module (default export)
2
- export { default } from "./ExpoBeaconModule";
2
+ export { default } from "./ExpoBeaconModule.js";
3
3
 
4
4
  // All public types
5
5
  export type {