expo-modules-core 2.3.3 → 2.3.4

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/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.3.4 — 2025-04-11
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Change registerWebModule to work with minified classes. ([#35946](https://github.com/expo/expo/pull/35946) by [@aleqsio](https://github.com/aleqsio))
18
+
13
19
  ## 2.3.3 — 2025-04-11
14
20
 
15
21
  _This version does not introduce any user-facing changes._
@@ -23,7 +23,7 @@ if (KOTLIN_MAJOR_VERSION >= 2) {
23
23
  }
24
24
 
25
25
  group = 'host.exp.exponent'
26
- version = '2.3.3'
26
+ version = '2.3.4'
27
27
 
28
28
  // List of features that are required by linked modules
29
29
  def coreFeatures = project.findProperty("coreFeatures") ?: []
@@ -76,7 +76,7 @@ android {
76
76
  defaultConfig {
77
77
  consumerProguardFiles 'proguard-rules.pro'
78
78
  versionCode 1
79
- versionName "2.3.3"
79
+ versionName "2.3.4"
80
80
  buildConfigField "String", "EXPO_MODULES_CORE_VERSION", "\"${versionName}\""
81
81
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
82
82
 
@@ -2,7 +2,8 @@ import type { NativeModule } from './ts-declarations/NativeModule';
2
2
  /**
3
3
  * Registers a web module.
4
4
  * @param moduleImplementation A class that extends `NativeModule`. The class is registered under `globalThis.expo.modules[className]`.
5
+ * @param moduleName – a name to register the module under `globalThis.expo.modules[className]`.
5
6
  * @returns A singleton instance of the class passed into arguments.
6
7
  */
7
- export declare function registerWebModule<EventsMap extends Record<never, never>, ModuleType extends typeof NativeModule<EventsMap>>(moduleImplementation: ModuleType): ModuleType;
8
+ export declare function registerWebModule<EventsMap extends Record<never, never>, ModuleType extends typeof NativeModule<EventsMap>>(moduleImplementation: ModuleType, moduleName: string): ModuleType;
8
9
  //# sourceMappingURL=registerWebModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerWebModule.d.ts","sourceRoot":"","sources":["../src/registerWebModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAC/B,SAAS,SAAS,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACtC,UAAU,SAAS,OAAO,YAAY,CAAC,SAAS,CAAC,EACjD,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAe9C"}
1
+ {"version":3,"file":"registerWebModule.d.ts","sourceRoot":"","sources":["../src/registerWebModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAC/B,SAAS,SAAS,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACtC,UAAU,SAAS,OAAO,YAAY,CAAC,SAAS,CAAC,EACjD,oBAAoB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAiBlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "src/index.ts",
6
6
  "types": "build/index.d.ts",
@@ -44,5 +44,5 @@
44
44
  "@testing-library/react-native": "^13.1.0",
45
45
  "expo-module-scripts": "^4.1.1"
46
46
  },
47
- "gitHead": "c81263062bf24ad09e51e019f1d7dc29fa651c55"
47
+ "gitHead": "dd2c7150fd75c56505aa6d3f805c14e255649c5d"
48
48
  }
@@ -4,18 +4,21 @@ import type { NativeModule } from './ts-declarations/NativeModule';
4
4
  /**
5
5
  * Registers a web module.
6
6
  * @param moduleImplementation A class that extends `NativeModule`. The class is registered under `globalThis.expo.modules[className]`.
7
+ * @param moduleName – a name to register the module under `globalThis.expo.modules[className]`.
7
8
  * @returns A singleton instance of the class passed into arguments.
8
9
  */
9
10
 
10
11
  export function registerWebModule<
11
12
  EventsMap extends Record<never, never>,
12
13
  ModuleType extends typeof NativeModule<EventsMap>,
13
- >(moduleImplementation: ModuleType): ModuleType {
14
+ >(moduleImplementation: ModuleType, moduleName: string): ModuleType {
14
15
  ensureNativeModulesAreInstalled();
15
16
 
16
- const moduleName = moduleImplementation.name;
17
+ moduleName = moduleName ?? moduleImplementation.name;
17
18
  if (!moduleName) {
18
- throw new Error('Module implementation must be a class');
19
+ throw new Error(
20
+ 'Web module implementation is missing a name - it is either not a class or has been minified. Pass the name as a second argument to the `registerWebModule` function.'
21
+ );
19
22
  }
20
23
  if (!globalThis?.expo?.modules) {
21
24
  globalThis.expo.modules = {};