@rork-ai/toolkit-sdk 0.2.54 → 0.3.1

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.
Files changed (90) hide show
  1. package/README.md +7 -1
  2. package/lib/module/agent.js +73 -76
  3. package/lib/module/agent.js.map +1 -1
  4. package/lib/module/analytics-client.js +35 -0
  5. package/lib/module/analytics-client.js.map +1 -0
  6. package/lib/module/analytics-provider.js +29 -0
  7. package/lib/module/analytics-provider.js.map +1 -0
  8. package/lib/module/analytics.js +2 -59
  9. package/lib/module/analytics.js.map +1 -1
  10. package/lib/module/dev/error-boundary.js +38 -17
  11. package/lib/module/dev/error-boundary.js.map +1 -1
  12. package/lib/module/dev/safe-insets-content.web.js +6 -5
  13. package/lib/module/dev/safe-insets-content.web.js.map +1 -1
  14. package/lib/module/dev/sdk53/index.js.map +1 -1
  15. package/lib/module/dev/sdk53/inspector.js +71 -168
  16. package/lib/module/dev/sdk53/inspector.js.map +1 -1
  17. package/lib/module/dev/sdk53/inspector.web.js.map +1 -1
  18. package/lib/module/dev/sdk54/index.js.map +1 -1
  19. package/lib/module/dev/sdk54/inspector.js +71 -45
  20. package/lib/module/dev/sdk54/inspector.js.map +1 -1
  21. package/lib/module/dev/sdk54/inspector.web.js.map +1 -1
  22. package/lib/module/index.js +1 -2
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/polyfills/fetch.js +6 -10
  25. package/lib/module/polyfills/fetch.js.map +1 -1
  26. package/lib/module/polyfills/haptics.web.js.map +1 -1
  27. package/lib/module/polyfills/maps.web-component.js +27 -0
  28. package/lib/module/polyfills/maps.web-component.js.map +1 -0
  29. package/lib/module/polyfills/maps.web-values.js +19 -0
  30. package/lib/module/polyfills/maps.web-values.js.map +1 -0
  31. package/lib/module/polyfills/maps.web.js +2 -34
  32. package/lib/module/polyfills/maps.web.js.map +1 -1
  33. package/lib/module/polyfills/refresh-control-component.js +48 -42
  34. package/lib/module/polyfills/refresh-control-component.js.map +1 -1
  35. package/lib/module/polyfills/secure-store.web.js.map +1 -1
  36. package/lib/typescript/src/agent.d.ts +34 -30
  37. package/lib/typescript/src/agent.d.ts.map +1 -1
  38. package/lib/typescript/src/analytics-client.d.ts +10 -0
  39. package/lib/typescript/src/analytics-client.d.ts.map +1 -0
  40. package/lib/typescript/src/analytics-provider.d.ts +3 -0
  41. package/lib/typescript/src/analytics-provider.d.ts.map +1 -0
  42. package/lib/typescript/src/analytics.d.ts +2 -6
  43. package/lib/typescript/src/analytics.d.ts.map +1 -1
  44. package/lib/typescript/src/dev/error-boundary.d.ts +6 -6
  45. package/lib/typescript/src/dev/error-boundary.d.ts.map +1 -1
  46. package/lib/typescript/src/dev/safe-insets-content.d.ts +1 -1
  47. package/lib/typescript/src/dev/safe-insets-content.d.ts.map +1 -1
  48. package/lib/typescript/src/dev/safe-insets-content.web.d.ts +1 -1
  49. package/lib/typescript/src/dev/safe-insets-content.web.d.ts.map +1 -1
  50. package/lib/typescript/src/dev/sdk53/index.d.ts +3 -2
  51. package/lib/typescript/src/dev/sdk53/index.d.ts.map +1 -1
  52. package/lib/typescript/src/dev/sdk53/inspector.d.ts +25 -5
  53. package/lib/typescript/src/dev/sdk53/inspector.d.ts.map +1 -1
  54. package/lib/typescript/src/dev/sdk53/inspector.web.d.ts +2 -3
  55. package/lib/typescript/src/dev/sdk53/inspector.web.d.ts.map +1 -1
  56. package/lib/typescript/src/dev/sdk54/index.d.ts +2 -3
  57. package/lib/typescript/src/dev/sdk54/index.d.ts.map +1 -1
  58. package/lib/typescript/src/dev/sdk54/inspector.d.ts +25 -5
  59. package/lib/typescript/src/dev/sdk54/inspector.d.ts.map +1 -1
  60. package/lib/typescript/src/dev/sdk54/inspector.web.d.ts +2 -3
  61. package/lib/typescript/src/dev/sdk54/inspector.web.d.ts.map +1 -1
  62. package/lib/typescript/src/index.d.ts +1 -2
  63. package/lib/typescript/src/index.d.ts.map +1 -1
  64. package/lib/typescript/src/polyfills/alert.web.d.ts.map +1 -1
  65. package/lib/typescript/src/polyfills/fetch.d.ts.map +1 -1
  66. package/lib/typescript/src/polyfills/haptics.web.d.ts.map +1 -1
  67. package/lib/typescript/src/polyfills/maps.web-component.d.ts +10 -0
  68. package/lib/typescript/src/polyfills/maps.web-component.d.ts.map +1 -0
  69. package/lib/typescript/src/polyfills/maps.web-values.d.ts +4 -0
  70. package/lib/typescript/src/polyfills/maps.web-values.d.ts.map +1 -0
  71. package/lib/typescript/src/polyfills/maps.web.d.ts +2 -6
  72. package/lib/typescript/src/polyfills/maps.web.d.ts.map +1 -1
  73. package/lib/typescript/src/polyfills/refresh-control-component.d.ts +3 -3
  74. package/lib/typescript/src/polyfills/refresh-control-component.d.ts.map +1 -1
  75. package/lib/typescript/src/polyfills/secure-store.web.d.ts.map +1 -1
  76. package/metro/index.js +15 -29
  77. package/metro/transformer.js +41 -46
  78. package/package.json +79 -92
  79. package/lib/module/api.js +0 -9
  80. package/lib/module/api.js.map +0 -1
  81. package/lib/module/bridge.js +0 -38
  82. package/lib/module/bridge.js.map +0 -1
  83. package/lib/module/integrations.js +0 -45
  84. package/lib/module/integrations.js.map +0 -1
  85. package/lib/typescript/src/api.d.ts +0 -3
  86. package/lib/typescript/src/api.d.ts.map +0 -1
  87. package/lib/typescript/src/bridge.d.ts +0 -5
  88. package/lib/typescript/src/bridge.d.ts.map +0 -1
  89. package/lib/typescript/src/integrations.d.ts +0 -18
  90. package/lib/typescript/src/integrations.d.ts.map +0 -1
@@ -1,3 +1,3 @@
1
1
  import type { PropsWithChildren } from "react";
2
- export declare function RorkSafeInsets({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
2
+ export declare function RorkSafeInsets({ children }: PropsWithChildren): import("react").JSX.Element;
3
3
  //# sourceMappingURL=safe-insets-content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe-insets-content.d.ts","sourceRoot":"","sources":["../../../../src/dev/safe-insets-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAI7D"}
1
+ {"version":3,"file":"safe-insets-content.d.ts","sourceRoot":"","sources":["../../../../src/dev/safe-insets-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAI7D"}
@@ -1,3 +1,3 @@
1
1
  import { type PropsWithChildren } from "react";
2
- export declare function RorkSafeInsets({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
2
+ export declare function RorkSafeInsets({ children }: PropsWithChildren): import("react").JSX.Element;
3
3
  //# sourceMappingURL=safe-insets-content.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe-insets-content.web.d.ts","sourceRoot":"","sources":["../../../../src/dev/safe-insets-content.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAcpE,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CA0C7D"}
1
+ {"version":3,"file":"safe-insets-content.web.d.ts","sourceRoot":"","sources":["../../../../src/dev/safe-insets-content.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAWpE,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAwC7D"}
@@ -1,4 +1,5 @@
1
+ import type { ReactNode } from "react";
1
2
  export declare function RorkDevWrapper({ children }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/index.tsx"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAQnE"}
@@ -1,7 +1,26 @@
1
1
  import { type EventSubscription } from "expo-modules-core";
2
2
  import type { PropsWithChildren } from "react";
3
+ import React from "react";
3
4
  import type { ViewStyle } from "react-native";
4
- import type { InspectorData, TouchedViewDataAtPoint } from "react-native/Libraries/Renderer/shims/ReactNativeTypes";
5
+ import type { InspectorData } from "react-native/Libraries/Renderer/shims/ReactNativeTypes";
6
+ type BridgeMessage = Record<string, unknown>;
7
+ type InspectorHierarchyEntry = Readonly<{
8
+ name?: string | null;
9
+ }>;
10
+ type TouchedViewDataAtPoint = Readonly<{
11
+ pointerY: number;
12
+ frame: Readonly<{
13
+ left: number;
14
+ top: number;
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ props: Readonly<{
19
+ style?: ViewStyle;
20
+ }>;
21
+ componentStack?: string;
22
+ hierarchy?: readonly InspectorHierarchyEntry[];
23
+ }>;
5
24
  export type InspectedElementFrame = TouchedViewDataAtPoint["frame"];
6
25
  export type InspectedElement = Readonly<{
7
26
  frame: InspectedElementFrame;
@@ -13,11 +32,12 @@ export type BundleInspectorRef = {
13
32
  };
14
33
  export type BundleInspectorProps = PropsWithChildren<{}>;
15
34
  export declare function isRorkSandbox(): boolean;
16
- export declare function sendBridgeMessage(type: "inspector-element" | "merge-inspector-state" | "runtime-ready" | "runtime-error", data?: Record<string, any>): any;
17
- export declare function addBridgeListener(listener: (data: Record<string, any>) => void): EventSubscription;
35
+ export declare function sendBridgeMessage(type: "inspector-element" | "merge-inspector-state" | "runtime-ready" | "runtime-error", data?: BridgeMessage): unknown;
36
+ export declare function addBridgeListener(listener: (data: BridgeMessage) => void): EventSubscription;
18
37
  export declare function useBridge(): {
19
- disableInspector: () => void;
20
38
  inspectorEnabled: boolean;
39
+ disableInspector: () => void;
21
40
  };
22
- export declare function BundleInspector(props: BundleInspectorProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function BundleInspector(props: BundleInspectorProps): React.JSX.Element;
42
+ export {};
23
43
  //# sourceMappingURL=inspector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/inspector.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAe9C,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EAEvB,MAAM,wDAAwD,CAAC;AAWhE,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG;IAAE,sBAAsB,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AACxE,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAIzD,wBAAgB,aAAa,YAE5B;AAeD,wBAAgB,iBAAiB,CAC/B,IAAI,EACA,mBAAmB,GACnB,uBAAuB,GACvB,eAAe,G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CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG;IAAE,sBAAsB,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AACxE,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAuBzD,wBAAgB,aAAa,YAE5B;AAkBD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,eAAe,GAAG,eAAe,EACvF,IAAI,CAAC,EAAE,aAAa,WAOrB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,GAAG,iBAAiB,CAa5F;AAED,wBAAgB,SAAS;;;EA6BxB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAsH1D"}
@@ -1,4 +1,3 @@
1
- export declare function BundleInspector({ children }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
1
+ import type { PropsWithChildren } from "react";
2
+ export declare function BundleInspector({ children }: PropsWithChildren): import("react").JSX.Element;
4
3
  //# sourceMappingURL=inspector.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.web.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/inspector.web.tsx"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAE1E"}
1
+ {"version":3,"file":"inspector.web.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/inspector.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAE9D"}
@@ -1,4 +1,3 @@
1
- export declare function RorkDevWrapper({ children }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
1
+ import type { PropsWithChildren } from "react";
2
+ export declare function RorkDevWrapper({ children }: PropsWithChildren): import("react").JSX.Element;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/index.tsx"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAM/C,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAQ7D"}
@@ -1,7 +1,26 @@
1
1
  import { type EventSubscription } from "expo-modules-core";
2
2
  import type { PropsWithChildren } from "react";
3
+ import React from "react";
3
4
  import type { ViewStyle } from "react-native";
4
- import type { InspectorData, TouchedViewDataAtPoint } from "react-native/Libraries/Renderer/shims/ReactNativeTypes";
5
+ import type { InspectorData } from "react-native/Libraries/Renderer/shims/ReactNativeTypes";
6
+ type BridgeMessage = Record<string, unknown>;
7
+ type InspectorHierarchyEntry = Readonly<{
8
+ name?: string | null;
9
+ }>;
10
+ type TouchedViewDataAtPoint = Readonly<{
11
+ pointerY: number;
12
+ frame: Readonly<{
13
+ left: number;
14
+ top: number;
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ props: Readonly<{
19
+ style?: ViewStyle;
20
+ }>;
21
+ componentStack?: string;
22
+ hierarchy?: readonly InspectorHierarchyEntry[];
23
+ }>;
5
24
  export type InspectedElementFrame = TouchedViewDataAtPoint["frame"];
6
25
  export type InspectedElement = Readonly<{
7
26
  frame: InspectedElementFrame;
@@ -13,11 +32,12 @@ export type BundleInspectorRef = {
13
32
  };
14
33
  export type BundleInspectorProps = PropsWithChildren<{}>;
15
34
  export declare function isRorkSandbox(): boolean;
16
- export declare function sendBridgeMessage(type: "inspector-element" | "merge-inspector-state" | "runtime-ready" | "runtime-error", data?: Record<string, any>): any;
17
- export declare function addBridgeListener(listener: (data: Record<string, any>) => void): EventSubscription;
35
+ export declare function sendBridgeMessage(type: "inspector-element" | "merge-inspector-state" | "runtime-ready" | "runtime-error", data?: BridgeMessage): unknown;
36
+ export declare function addBridgeListener(listener: (data: BridgeMessage) => void): EventSubscription;
18
37
  export declare function useBridge(): {
19
- disableInspector: () => void;
20
38
  inspectorEnabled: boolean;
39
+ disableInspector: () => void;
21
40
  };
22
- export declare function BundleInspector(props: BundleInspectorProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function BundleInspector(props: BundleInspectorProps): React.JSX.Element;
42
+ export {};
23
43
  //# sourceMappingURL=inspector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/inspector.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAgB9C,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EAEvB,MAAM,wDAAwD,CAAC;AAWhE,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAA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declare function BundleInspector({ children }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
1
+ import type { PropsWithChildren } from "react";
2
+ export declare function BundleInspector({ children }: PropsWithChildren): import("react").JSX.Element;
4
3
  //# sourceMappingURL=inspector.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.web.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/inspector.web.tsx"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAE1E"}
1
+ {"version":3,"file":"inspector.web.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/inspector.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAE9D"}
@@ -1,4 +1,3 @@
1
- export * from "./agent";
2
- export * from "./integrations";
3
1
  export * from "./analytics";
2
+ export { createRorkTool, generateText, generateObject, useRorkAgent } from "./agent";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"alert.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/alert.web.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AAExD,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"alert.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/alert.web.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,kCAAkC,CAAC;eAEzC,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/fetch.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/fetch.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"haptics.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/haptics.web.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AA2BD,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAKpD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,GAAE,wBAA2D,GAChE,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,WAAW,CAC/B,KAAK,GAAE,mBAAgD,GACtD,OAAO,CAAC,IAAI,CAAC,CAKf"}
1
+ {"version":3,"file":"haptics.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/haptics.web.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAoBD,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAKpD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,GAAE,wBAA2D,GAChE,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,WAAW,CAAC,KAAK,GAAE,mBAAgD,GAAG,OAAO,CAAC,IAAI,CAAC,CAKxG"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ declare function MapView({ ref, ...props }: {
3
+ [x: string]: any;
4
+ ref: any;
5
+ }): React.JSX.Element;
6
+ declare namespace MapView {
7
+ var displayName: string;
8
+ }
9
+ export default MapView;
10
+ //# sourceMappingURL=maps.web-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maps.web-component.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/maps.web-component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,iBAAS,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE;;;CAAA,qBAEjC;kBAFQ,OAAO;;;eAYD,OAAO"}
@@ -0,0 +1,4 @@
1
+ export declare const PROVIDER_GOOGLE = "google";
2
+ export declare const PROVIDER_DEFAULT: undefined;
3
+ export declare const Marker: any, Callout: any, Polyline: any, Polygon: any, Circle: any, Overlay: any, Heatmap: any, UrlTile: any, WMSTile: any, LocalTile: any;
4
+ //# sourceMappingURL=maps.web-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maps.web-values.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/maps.web-values.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,gBAAgB,WAAY,CAAC;AAE1C,eAAO,MAAQ,MAAM,OAAE,OAAO,OAAE,QAAQ,OAAE,OAAO,OAAE,MAAM,OAAE,OAAO,OAAE,OAAO,OAAE,OAAO,OAAE,OAAO,OAAE,SAAS,KAAY,CAAC"}
@@ -1,7 +1,3 @@
1
- import React from "react";
2
- export declare const PROVIDER_GOOGLE = "google";
3
- export declare const PROVIDER_DEFAULT: undefined;
4
- declare const MapView: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
5
- export declare const Marker: any, Callout: any, Polyline: any, Polygon: any, Circle: any, Overlay: any, Heatmap: any, UrlTile: any, WMSTile: any, LocalTile: any;
6
- export default MapView;
1
+ export { default } from "./maps.web-component";
2
+ export * from "./maps.web-values";
7
3
  //# sourceMappingURL=maps.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"maps.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/maps.web.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,gBAAgB,WAAY,CAAC;AAI1C,QAAA,MAAM,OAAO,+DASX,CAAC;AAUH,eAAO,MACL,MAAM,OACN,OAAO,OACP,QAAQ,OACR,OAAO,OACP,MAAM,OACN,OAAO,OACP,OAAO,OACP,OAAO,OACP,OAAO,OACP,SAAS,KACA,CAAC;AAEZ,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"maps.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/maps.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,cAAc,mBAAmB,CAAC"}
@@ -1,9 +1,9 @@
1
- import React from "react";
1
+ import type { ReactNode } from "react";
2
2
  import { type RefreshControlProps, type StyleProp, type ViewStyle } from "react-native-web";
3
3
  interface WebRefreshControlProps extends Omit<RefreshControlProps, "style"> {
4
- children?: React.ReactNode;
4
+ children?: ReactNode;
5
5
  style?: StyleProp<ViewStyle>;
6
6
  }
7
- export default function WebRefreshControl({ refreshing, tintColor, colors, style, progressViewOffset, children, onRefresh, enabled, }: WebRefreshControlProps): import("react/jsx-runtime").JSX.Element;
7
+ export default function WebRefreshControl({ refreshing, tintColor, colors, style, progressViewOffset, children, onRefresh, enabled, }: WebRefreshControlProps): import("react").JSX.Element;
8
8
  export {};
9
9
  //# sourceMappingURL=refresh-control-component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-control-component.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/refresh-control-component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAE1B,UAAU,sBAAuB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACzE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,SAAS,EACT,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB,2CAqKxB"}
1
+ {"version":3,"file":"refresh-control-component.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/refresh-control-component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpE,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAE1B,UAAU,sBAAuB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACzE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAKD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,SAAS,EACT,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB,+BA8IxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"secure-store.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/secure-store.web.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACnD,eAAO,MACL,kBAAkB,UAClB,mCAAmC,UACnC,MAAM,UACN,kCAAkC,UAClC,uBAAuB,UACvB,aAAa,UACb,8BAA8B,QACV,CAAC;AAEvB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,6BAA6B,CAAC;CACpD,CAAC;AAmBF,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAYzD;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,kBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,kBAAuB,GAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAExB;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,kBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,kBAAuB,GAChC,IAAI,CAON;AAED,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,kBAAuB,GAChC,MAAM,GAAG,IAAI,CAEf;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD"}
1
+ {"version":3,"file":"secure-store.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/secure-store.web.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACnD,eAAO,MACL,kBAAkB,UAClB,mCAAmC,UACnC,MAAM,UACN,kCAAkC,UAClC,uBAAuB,UACvB,aAAa,UACb,8BAA8B,QACV,CAAC;AAEvB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,6BAA6B,CAAC;CACpD,CAAC;AAmBF,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAYzD;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnG;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEzG;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAO/G;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAAuB,GAAG,IAAI,CAO3F;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAAuB,GAAG,MAAM,GAAG,IAAI,CAErF;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD"}
package/metro/index.js CHANGED
@@ -15,12 +15,19 @@ function withRorkMetro(config) {
15
15
  ...config,
16
16
  transformer: {
17
17
  ...config.transformer,
18
- babelTransformerPath: require.resolve(
19
- "@rork-ai/toolkit-sdk/metro-transformer",
20
- ),
18
+ babelTransformerPath: require.resolve("@rork-ai/toolkit-sdk/metro-transformer"),
21
19
  },
22
20
  resolver: {
23
21
  ...config.resolver,
22
+ // Expo SDK 56+ neutralizes `useWatchman` to null and @expo/metro-file-map
23
+ // defaults null to false, so Metro silently switches to the Node fs.watch
24
+ // fallback watcher. That watcher exhausts inotify watches on large projects
25
+ // (Metro crashes with ENOSPC at startup) and ignores the watchman
26
+ // `rork-ai` defer-state lock below. Watchman is installed in Rork
27
+ // sandboxes; when it is unavailable (e.g. an exported project run
28
+ // locally), Metro's capability check falls back to the Node watcher on
29
+ // its own. `??` keeps an explicit `useWatchman: false` opt-out working.
30
+ useWatchman: config.resolver?.useWatchman ?? true,
24
31
  extraNodeModules: {
25
32
  // whenever some lib does `require("assert")`
26
33
  // it will get this package
@@ -53,25 +60,16 @@ function withRorkMetro(config) {
53
60
 
54
61
  // Redirect react-native to our web polyfill on web platform
55
62
  // This replaces RefreshControl with our web implementation
56
- if (
57
- moduleName === "react-native-web/dist/exports/RefreshControl" &&
58
- platform === "web"
59
- ) {
63
+ if (moduleName === "react-native-web/dist/exports/RefreshControl" && platform === "web") {
60
64
  return {
61
- filePath: path.resolve(
62
- libPath,
63
- "polyfills/refresh-control-component.js",
64
- ),
65
+ filePath: path.resolve(libPath, "polyfills/refresh-control-component.js"),
65
66
  type: "sourceFile",
66
67
  };
67
68
  }
68
69
 
69
70
  // Redirect react-native to our web polyfill on web platform
70
71
  // This replaces RefreshControl with our web implementation
71
- if (
72
- moduleName === "react-native-web/dist/exports/Alert" &&
73
- platform === "web"
74
- ) {
72
+ if (moduleName === "react-native-web/dist/exports/Alert" && platform === "web") {
75
73
  return {
76
74
  filePath: path.resolve(libPath, "polyfills/alert.web.js"),
77
75
  type: "sourceFile",
@@ -87,22 +85,10 @@ function withRorkMetro(config) {
87
85
  },
88
86
  watcher: {
89
87
  ...config.watcher,
90
- additionalExts: Array.from(
91
- new Set([
92
- ...(config.watcher?.additionalExts ?? []),
93
- "env",
94
- "local",
95
- "development",
96
- ]),
97
- ),
88
+ additionalExts: Array.from(new Set([...(config.watcher?.additionalExts ?? []), "env", "local", "development"])),
98
89
  watchman: {
99
90
  ...config.watcher?.watchman,
100
- deferStates: Array.from(
101
- new Set([
102
- ...(config.watcher?.watchman?.deferStates ?? []),
103
- "rork-ai",
104
- ]),
105
- ),
91
+ deferStates: Array.from(new Set([...(config.watcher?.watchman?.deferStates ?? []), "rork-ai"])),
106
92
  },
107
93
  },
108
94
  };
@@ -3,36 +3,40 @@
3
3
  * Uses simple string transformations to inject wrappers
4
4
  */
5
5
 
6
- const fs = require("fs");
7
- const path = require("path");
6
+ const fs = require("fs/promises");
7
+ const { createRequire } = require("module");
8
8
 
9
- const upstreamTransformer = require("@expo/metro-config/babel-transformer");
9
+ const DEV_ENTRY_POINTS = new Map([
10
+ ["53", "v53"],
11
+ ["54", "v54"],
12
+ ["57", "v57"],
13
+ ]);
14
+
15
+ const TOOLKIT_WEB_AUTH_SENTINEL = "rork_web_delegated_auth";
16
+ const TOOLKIT_SECRET_ACCESS_PATTERN =
17
+ /process\.env(?:\.EXPO_PUBLIC_RORK_TOOLKIT_SECRET_KEY|\[["']EXPO_PUBLIC_RORK_TOOLKIT_SECRET_KEY["']\])/g;
18
+
19
+ /**
20
+ * Native bundles retain the project secret until attestation ships. Expo web
21
+ * previews instead compile a truthy non-secret placeholder; the HTML bootstrap
22
+ * replaces it with a short-lived delegated token before network calls.
23
+ */
24
+ function replaceToolkitSecretForWeb(src, platform) {
25
+ if (platform !== "web") return src;
26
+ return src.replace(TOOLKIT_SECRET_ACCESS_PATTERN, JSON.stringify(TOOLKIT_WEB_AUTH_SENTINEL));
27
+ }
10
28
 
11
29
  /**
12
- * Detects the Expo SDK version from the installed expo package
13
- * This approach works with all package managers (npm, yarn, pnpm)
30
+ * Selects the dev wrapper for the project's installed Expo SDK.
14
31
  */
15
- function detectExpoVersion() {
32
+ async function getDevEntryPoint(expoPackagePath) {
16
33
  try {
17
- // Read version from installed expo package (works with pnpm, npm, yarn)
18
- const expoPackagePath = path.join(
19
- process.cwd(),
20
- "node_modules",
21
- "expo",
22
- "package.json",
23
- );
24
- if (fs.existsSync(expoPackagePath)) {
25
- const expoPackage = JSON.parse(fs.readFileSync(expoPackagePath, "utf8"));
26
- const version = expoPackage.version;
27
- if (version) {
28
- if (version.startsWith("54.")) return "54";
29
- if (version.startsWith("53.")) return "53";
30
- }
31
- }
34
+ const expoPackage = JSON.parse(await fs.readFile(expoPackagePath, "utf8"));
35
+ const sdk = /^(\d+)\./.exec(expoPackage.version)?.[1];
36
+ return DEV_ENTRY_POINTS.get(sdk) ?? "v53";
32
37
  } catch {
33
- // Ignore parsing errors
38
+ return "v53";
34
39
  }
35
- return null;
36
40
  }
37
41
 
38
42
  /**
@@ -40,16 +44,14 @@ function detectExpoVersion() {
40
44
  */
41
45
  function isRootLayout(filename) {
42
46
  return (
43
- (filename.includes("app/_layout.tsx") ||
44
- filename.includes("app/_layout.js")) &&
45
- !filename.includes("app/(") // Exclude grouped layouts
47
+ (filename.includes("app/_layout.tsx") || filename.includes("app/_layout.js")) && !filename.includes("app/(") // Exclude grouped layouts
46
48
  );
47
49
  }
48
50
 
49
51
  /**
50
52
  * Wraps the layout component with Rork providers
51
53
  */
52
- function wrapLayoutWithProviders(src, environment) {
54
+ async function wrapLayoutWithProviders(src, environment, expoPackagePath) {
53
55
  // Find the default export function
54
56
  const defaultExportPattern = /export\s+default\s+function\s+(\w+)/;
55
57
  const match = src.match(defaultExportPattern);
@@ -61,24 +63,16 @@ function wrapLayoutWithProviders(src, environment) {
61
63
  const originalFunctionName = match[1];
62
64
 
63
65
  // Remove the default keyword from the original function
64
- let transformed = src.replace(
65
- defaultExportPattern,
66
- `function ${originalFunctionName}`,
67
- );
66
+ let transformed = src.replace(defaultExportPattern, `function ${originalFunctionName}`);
68
67
 
69
68
  const wrappers = [];
70
69
 
71
70
  // Add RorkDevWrapper for development environment
72
71
  if (environment === "development") {
73
- // Detect Expo SDK version - default to v53 if not detected
74
- const version = detectExpoVersion() || "53";
75
- const devImport =
76
- version === "54"
77
- ? "import { RorkDevWrapper } from '@rork-ai/toolkit-sdk/v54';"
78
- : "import { RorkDevWrapper } from '@rork-ai/toolkit-sdk/v53';";
72
+ const entryPoint = await getDevEntryPoint(expoPackagePath);
79
73
 
80
74
  wrappers.push({
81
- import: devImport,
75
+ import: `import { RorkDevWrapper } from '@rork-ai/toolkit-sdk/${entryPoint}';`,
82
76
  name: "RorkDevWrapper",
83
77
  });
84
78
  }
@@ -115,18 +109,19 @@ export default function RorkRootLayoutWrapper() {
115
109
  }
116
110
 
117
111
  async function transform(props) {
118
- const environment =
119
- (props.options?.dev ?? process.env.NODE_ENV === "development")
120
- ? "development"
121
- : "production";
112
+ const expoPackagePath = require.resolve("expo/package.json", {
113
+ paths: [props.options?.projectRoot ?? process.cwd()],
114
+ });
115
+ const upstreamTransformer = createRequire(expoPackagePath)("@expo/metro-config/babel-transformer");
116
+ const environment = (props.options?.dev ?? process.env.NODE_ENV === "development") ? "development" : "production";
117
+ const secretSafeSrc = replaceToolkitSecretForWeb(props.src, props.options?.platform);
122
118
 
123
119
  if (isRootLayout(props.filename)) {
124
- const transformedSrc = wrapLayoutWithProviders(props.src, environment);
120
+ const transformedSrc = await wrapLayoutWithProviders(secretSafeSrc, environment, expoPackagePath);
125
121
  return upstreamTransformer.transform({ ...props, src: transformedSrc });
126
122
  }
127
123
 
128
- return upstreamTransformer.transform(props);
124
+ return upstreamTransformer.transform({ ...props, src: secretSafeSrc });
129
125
  }
130
126
 
131
- module.exports = { transform };
132
-
127
+ module.exports = { replaceToolkitSecretForWeb, transform };