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.
- package/dist/BrickModule.js +3 -5
- package/dist/index.d.ts +2 -1
- package/dist/types.d.ts +4 -0
- package/package.json +2 -2
- package/podfile_helper.rb +24 -26
- package/src/index.ts +1 -0
- package/src/types.ts +1 -0
package/dist/BrickModule.js
CHANGED
|
@@ -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
|
|
34
|
+
if (typeof property !== "string") return;
|
|
35
35
|
if (property === "addEventListener") return (eventName, listener) => {
|
|
36
|
-
const
|
|
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
|
-
|
|
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 };
|
package/dist/types.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brick-module",
|
|
3
|
-
"version": "0.1.
|
|
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.
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
package/src/types.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AnyObject = Record<string, any>;
|