brick-module 0.1.10 → 0.1.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.
@@ -31,10 +31,9 @@ function get(moduleName) {
31
31
  const nativeModuleInstance = getNativeModule();
32
32
  const moduleProxy = new Proxy({}, {
33
33
  get: (_target, property) => {
34
- if (typeof property !== "string") return void 0;
34
+ if (typeof property !== "string") return;
35
35
  if (property === "addEventListener") return (eventName, listener) => {
36
- const emitter = getEventEmitter();
37
- const subscription = emitter.addListener(`${moduleName}_${eventName}`, listener);
36
+ const subscription = getEventEmitter().addListener(`${moduleName}_${eventName}`, listener);
38
37
  return () => {
39
38
  subscription.remove();
40
39
  };
@@ -63,8 +62,7 @@ function get(moduleName) {
63
62
  * @returns Promise resolving to array of module names
64
63
  */
65
64
  function getRegisteredModules() {
66
- const nativeModuleInstance = getNativeModule();
67
- return nativeModuleInstance?.getRegisteredModules() ?? [];
65
+ return getNativeModule()?.getRegisteredModules() ?? [];
68
66
  }
69
67
  /**
70
68
  * Clears the module cache (useful for testing or hot reloading)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { BrickModule, BrickModuleInterface, BrickModuleSpec } from "./BrickModule.js";
2
+ import { AnyObject } from "./types.js";
2
3
 
3
4
  //#region src/index.d.ts
4
5
 
@@ -28,4 +29,4 @@ interface BrickCodegenConfig {
28
29
  dev?: boolean;
29
30
  }
30
31
  //#endregion
31
- export { BrickCodegenConfig, BrickModule, BrickModuleError, type BrickModuleInterface, type BrickModuleSpec };
32
+ export { AnyObject, BrickCodegenConfig, BrickModule, BrickModuleError, type BrickModuleInterface, type BrickModuleSpec };
@@ -0,0 +1,4 @@
1
+ //#region src/types.d.ts
2
+ type AnyObject = Record<string, any>;
3
+ //#endregion
4
+ export { AnyObject };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brick-module",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Better React Native native module development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -62,7 +62,7 @@
62
62
  "brick-codegen": "./bin/brick-codegen.js"
63
63
  },
64
64
  "dependencies": {
65
- "brick-codegen": "0.1.10"
65
+ "brick-codegen": "0.1.11"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": ">=18.2.0",
package/podfile_helper.rb CHANGED
@@ -20,35 +20,33 @@ def use_brick_modules!(app_path: nil)
20
20
  end
21
21
 
22
22
  begin
23
+ # Determine output path first
24
+ ios_brick_path = get_brick_ios_path(brick_root)
25
+ brick_codegen_pod_path = if Pathname.new(ios_brick_path).absolute?
26
+ ios_brick_path
27
+ else
28
+ File.expand_path(File.join(brick_root, ios_brick_path))
29
+ end
30
+ brick_codegen_podspec_path = File.join(brick_codegen_pod_path, 'BrickCodegen.podspec')
31
+
23
32
  # Run brick-codegen with real-time output and colors (iOS only)
24
33
  exit_status = system("cd #{brick_root} && FORCE_COLOR=1 npx brick-codegen --platform ios --projectRoot \"#{brick_root}\"")
25
-
26
- if exit_status
27
- # Get iOS output path from brick.json if it exists
28
- ios_brick_path = get_brick_ios_path(brick_root)
29
-
30
- # Handle relative vs absolute paths
31
- if Pathname.new(ios_brick_path).absolute?
32
- brick_codegen_pod_path = ios_brick_path
33
- else
34
- brick_codegen_pod_path = File.expand_path(File.join(brick_root, ios_brick_path))
35
- end
36
-
37
- # Add generated BrickCodegen pod if it exists
38
- brick_codegen_podspec_path = File.join(brick_codegen_pod_path, "BrickCodegen.podspec")
39
-
40
- if File.exist?(brick_codegen_podspec_path)
41
- begin
42
- pod 'BrickCodegen', :path => brick_codegen_pod_path
43
- rescue => pod_error
44
- Pod::UI.warn "[Brick] Failed to add BrickCodegen pod: #{pod_error.message}"
45
- end
46
- end
47
- else
48
- Pod::UI.warn "[Brick] brick-codegen failed to run. Please make sure it's installed: npm install brick-codegen"
34
+
35
+ unless exit_status
36
+ raise "[Brick] brick-codegen failed. Aborting pod install. Try: (cd #{brick_root} && npx brick-codegen --platform ios --debug)"
37
+ end
38
+
39
+ # Require podspec to exist after successful codegen
40
+ unless File.exist?(brick_codegen_podspec_path)
41
+ raise "[Brick] BrickCodegen.podspec not found at #{brick_codegen_pod_path} after codegen"
49
42
  end
43
+
44
+ # Link generated BrickCodegen pod
45
+ pod 'BrickCodegen', :path => brick_codegen_pod_path
46
+ Pod::UI.puts "[Brick] Linked BrickCodegen from #{brick_codegen_pod_path}"
50
47
  rescue => e
51
- Pod::UI.warn "[Brick] Error running brick-codegen: #{e.message}"
48
+ # Re-raise so CocoaPods fails the install
49
+ raise e
52
50
  end
53
51
  end
54
52
 
@@ -75,4 +73,4 @@ def get_brick_ios_path(project_root)
75
73
  end
76
74
 
77
75
  return File.expand_path(File.join(project_root, 'ios/.brick'))
78
- end
76
+ end
package/src/index.ts CHANGED
@@ -35,3 +35,4 @@ export interface BrickCodegenConfig {
35
35
  oldArchOnly?: boolean;
36
36
  dev?: boolean;
37
37
  }
38
+ export * from "./types";
package/src/types.ts ADDED
@@ -0,0 +1 @@
1
+ export type AnyObject = Record<string, any>;