@webview-bridge/web 1.7.4 → 1.7.6
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/index.cjs +9 -6
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -413,8 +413,8 @@ var __publicField = function(obj, key, value) {
|
|
|
413
413
|
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
414
414
|
};
|
|
415
415
|
// src/index.ts
|
|
416
|
-
var
|
|
417
|
-
__export(
|
|
416
|
+
var index_exports = {};
|
|
417
|
+
__export(index_exports, {
|
|
418
418
|
MethodNotFoundError: function() {
|
|
419
419
|
return MethodNotFoundError;
|
|
420
420
|
},
|
|
@@ -428,7 +428,7 @@ __export(src_exports, {
|
|
|
428
428
|
return registerWebMethod;
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
|
-
module.exports = __toCommonJS(
|
|
431
|
+
module.exports = __toCommonJS(index_exports);
|
|
432
432
|
// src/error.ts
|
|
433
433
|
var MethodNotFoundError = /*#__PURE__*/ function(Error1) {
|
|
434
434
|
_inherits(MethodNotFoundError, Error1);
|
|
@@ -733,7 +733,8 @@ var BridgeInstance = /*#__PURE__*/ function() {
|
|
|
733
733
|
var linkBridge = function() {
|
|
734
734
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
735
735
|
timeout: 2e3,
|
|
736
|
-
throwOnError: false
|
|
736
|
+
throwOnError: false,
|
|
737
|
+
debug: false
|
|
737
738
|
};
|
|
738
739
|
if (typeof window === "undefined") {
|
|
739
740
|
var _options_initialBridge;
|
|
@@ -758,7 +759,7 @@ var linkBridge = function() {
|
|
|
758
759
|
store: mockStore(options === null || options === void 0 ? void 0 : options.initialBridge)
|
|
759
760
|
};
|
|
760
761
|
}
|
|
761
|
-
if (!window.ReactNativeWebView) {
|
|
762
|
+
if (options.debug && !window.ReactNativeWebView) {
|
|
762
763
|
console.warn("[WebViewBridge] Not in a WebView environment");
|
|
763
764
|
}
|
|
764
765
|
var bridgeId = (0, import_utils3.createRandomId)();
|
|
@@ -797,7 +798,9 @@ var linkBridge = function() {
|
|
|
797
798
|
return Promise.reject(new MethodNotFoundError(methodName));
|
|
798
799
|
};
|
|
799
800
|
}
|
|
800
|
-
|
|
801
|
+
if (options.debug) {
|
|
802
|
+
console.warn("[WebViewBridge] ".concat(methodName, " is not defined, using fallback."));
|
|
803
|
+
}
|
|
801
804
|
return function() {
|
|
802
805
|
return Promise.resolve();
|
|
803
806
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParserSchema, KeyOfOrString, Parser, AsyncFunction, BridgeStore, Bridge, ExtractStore, ExcludePrimitive } from '@webview-bridge/types';
|
|
2
2
|
export * from '@webview-bridge/types';
|
|
3
3
|
|
|
4
4
|
declare class MethodNotFoundError extends Error {
|
|
@@ -23,6 +23,11 @@ type LinkBridge<T, U, V extends ParserSchema<any>> = {
|
|
|
23
23
|
} & T;
|
|
24
24
|
|
|
25
25
|
interface LinkBridgeOptions<T extends BridgeStore<T extends Bridge ? T : any>, V extends ParserSchema<any>> {
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, console warnings will be displayed.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
debug?: boolean;
|
|
26
31
|
/**
|
|
27
32
|
* It is possible to configure `initialBridge` to operate in a non-React Native environment.
|
|
28
33
|
* Prioritize applying the bridge of the React Native WebView, and if it is unavailable, apply the `initialBridge`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParserSchema, KeyOfOrString, Parser, AsyncFunction, BridgeStore, Bridge, ExtractStore, ExcludePrimitive } from '@webview-bridge/types';
|
|
2
2
|
export * from '@webview-bridge/types';
|
|
3
3
|
|
|
4
4
|
declare class MethodNotFoundError extends Error {
|
|
@@ -23,6 +23,11 @@ type LinkBridge<T, U, V extends ParserSchema<any>> = {
|
|
|
23
23
|
} & T;
|
|
24
24
|
|
|
25
25
|
interface LinkBridgeOptions<T extends BridgeStore<T extends Bridge ? T : any>, V extends ParserSchema<any>> {
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, console warnings will be displayed.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
debug?: boolean;
|
|
26
31
|
/**
|
|
27
32
|
* It is possible to configure `initialBridge` to operate in a non-React Native environment.
|
|
28
33
|
* Prioritize applying the bridge of the React Native WebView, and if it is unavailable, apply the `initialBridge`.
|
package/dist/index.js
CHANGED
|
@@ -673,7 +673,8 @@ var BridgeInstance = /*#__PURE__*/ function() {
|
|
|
673
673
|
var linkBridge = function() {
|
|
674
674
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
675
675
|
timeout: 2e3,
|
|
676
|
-
throwOnError: false
|
|
676
|
+
throwOnError: false,
|
|
677
|
+
debug: false
|
|
677
678
|
};
|
|
678
679
|
if (typeof window === "undefined") {
|
|
679
680
|
var _options_initialBridge;
|
|
@@ -698,7 +699,7 @@ var linkBridge = function() {
|
|
|
698
699
|
store: mockStore(options === null || options === void 0 ? void 0 : options.initialBridge)
|
|
699
700
|
};
|
|
700
701
|
}
|
|
701
|
-
if (!window.ReactNativeWebView) {
|
|
702
|
+
if (options.debug && !window.ReactNativeWebView) {
|
|
702
703
|
console.warn("[WebViewBridge] Not in a WebView environment");
|
|
703
704
|
}
|
|
704
705
|
var bridgeId = createRandomId2();
|
|
@@ -737,7 +738,9 @@ var linkBridge = function() {
|
|
|
737
738
|
return Promise.reject(new MethodNotFoundError(methodName));
|
|
738
739
|
};
|
|
739
740
|
}
|
|
740
|
-
|
|
741
|
+
if (options.debug) {
|
|
742
|
+
console.warn("[WebViewBridge] ".concat(methodName, " is not defined, using fallback."));
|
|
743
|
+
}
|
|
741
744
|
return function() {
|
|
742
745
|
return Promise.resolve();
|
|
743
746
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webview-bridge/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.6",
|
|
5
5
|
"description": "Fully Type-Safe Integration for React Native WebView and Web",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@webview-bridge/utils": "1.7.
|
|
30
|
-
"@webview-bridge/types": "1.7.
|
|
29
|
+
"@webview-bridge/utils": "1.7.6",
|
|
30
|
+
"@webview-bridge/types": "1.7.6"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "tsup
|
|
33
|
+
"build": "tsup --config ./tsup.config.ts",
|
|
34
34
|
"test:type": "tsc --noEmit",
|
|
35
35
|
"lint": "biome check"
|
|
36
36
|
}
|