@multiplatform.one/core 11.1.0 → 11.1.2
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/cjs/app/CreateRootLayout.native.cjs +2 -0
- package/dist/cjs/app/CreateRootLayout.native.js +2 -0
- package/dist/cjs/app/CreateRootLayout.native.js.map +1 -1
- package/dist/cjs/app/nativeErrorLog.cjs +53 -0
- package/dist/cjs/app/nativeErrorLog.native.cjs +62 -0
- package/dist/cjs/app/nativeErrorLog.native.js +64 -0
- package/dist/cjs/app/nativeErrorLog.native.js.map +1 -0
- package/dist/esm/app/CreateRootLayout.native.js +2 -0
- package/dist/esm/app/CreateRootLayout.native.js.map +1 -1
- package/dist/esm/app/nativeErrorLog.mjs +33 -0
- package/dist/esm/app/nativeErrorLog.mjs.map +1 -0
- package/dist/esm/app/nativeErrorLog.native.js +40 -0
- package/dist/esm/app/nativeErrorLog.native.js.map +1 -0
- package/package.json +17 -17
- package/src/app/CreateRootLayout.native.tsx +3 -0
- package/src/app/nativeErrorLog.spec.ts +53 -0
- package/src/app/nativeErrorLog.ts +45 -0
- package/types/app/CreateRootLayout.native.d.ts.map +1 -1
- package/types/app/nativeErrorLog.d.ts +11 -0
- package/types/app/nativeErrorLog.d.ts.map +1 -0
|
@@ -41,7 +41,9 @@ var import_platform = require("@multiplatform.one/platform");
|
|
|
41
41
|
var import_forms = require("@multiplatform.one/forms");
|
|
42
42
|
var import_i18n = require("@multiplatform.one/i18n");
|
|
43
43
|
var import_logger = require("@multiplatform.one/logger");
|
|
44
|
+
var import_nativeErrorLog = require("./nativeErrorLog.native.js");
|
|
44
45
|
var import_useNativeDeepLinks = require("./useNativeDeepLinks.native.js");
|
|
46
|
+
(0, import_nativeErrorLog.forwardConsoleErrorToNativeLog)();
|
|
45
47
|
var styles = import_react_native.StyleSheet.create({ container: { flex: 1 } });
|
|
46
48
|
function createRootLayout(cfg) {
|
|
47
49
|
var _cfg_fonts;
|
|
@@ -41,7 +41,9 @@ var import_platform = require("@multiplatform.one/platform");
|
|
|
41
41
|
var import_forms = require("@multiplatform.one/forms");
|
|
42
42
|
var import_i18n = require("@multiplatform.one/i18n");
|
|
43
43
|
var import_logger = require("@multiplatform.one/logger");
|
|
44
|
+
var import_nativeErrorLog = require("./nativeErrorLog.native.js");
|
|
44
45
|
var import_useNativeDeepLinks = require("./useNativeDeepLinks.native.js");
|
|
46
|
+
(0, import_nativeErrorLog.forwardConsoleErrorToNativeLog)();
|
|
45
47
|
var styles = import_react_native.StyleSheet.create({ container: { flex: 1 } });
|
|
46
48
|
function createRootLayout(cfg) {
|
|
47
49
|
var _cfg_fonts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRootLayout.native.js","names":[],"sources":["cjs/app/CreateRootLayout.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar CreateRootLayout_native_exports = {};\n__export(CreateRootLayout_native_exports, {\n createRootLayout: () => createRootLayout\n});\nmodule.exports = __toCommonJS(CreateRootLayout_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_expo_font = require(\"expo-font\");\nvar import_i18next = __toESM(require(\"i18next\"));\nvar import_one = require(\"one\");\nvar import_react_native = require(\"react-native\");\nvar import_react_native_gesture_handler = require(\"react-native-gesture-handler\");\nvar import_react_native_safe_area_context = require(\"react-native-safe-area-context\");\nvar import_react_i18next = require(\"react-i18next\");\nvar import_platform = require(\"@multiplatform.one/platform\");\nvar import_forms = require(\"@multiplatform.one/forms\");\nvar import_i18n = require(\"@multiplatform.one/i18n\");\nvar import_logger = require(\"@multiplatform.one/logger\");\nvar import_useNativeDeepLinks = require(\"./useNativeDeepLinks\");\nvar styles = import_react_native.StyleSheet.create({\n container: {\n flex: 1\n }\n});\nfunction createRootLayout(cfg) {\n var _cfg_fonts;\n import_i18next.default.use(import_react_i18next.initReactI18next).init((0, import_i18n.createI18nConfig)(cfg.i18n)).catch(import_logger.logger.error);\n import_i18next.default.changeLanguage(import_platform.config.get(\"I18N_DEFAULT_LANGUAGE\", cfg.i18n.defaultLanguage));\n var { AppProvider, RootLayout } = cfg;\n function NativeRootProvider(param) {\n var { children } = param;\n var { value: systemScheme } = (0, import_one.useUserScheme)();\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppProvider, {\n systemTheme: systemScheme,\n children\n });\n }\n NativeRootProvider.displayName = \"NativeRootProvider\";\n var fontsMap = (_cfg_fonts = cfg.fonts) !== null && _cfg_fonts !== void 0 ? _cfg_fonts : {};\n function DeepLinkBridge() {\n (0, import_useNativeDeepLinks.useNativeDeepLinks)();\n return null;\n }\n DeepLinkBridge.displayName = \"DeepLinkBridge\";\n function NativeRootLayout(param) {\n var { children } = param;\n var snap = import_one.routerStore.useOneRouter();\n if (!(snap === null || snap === void 0 ? void 0 : snap.routeInfo)) return children;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RootLayout, {\n children\n });\n }\n NativeRootLayout.displayName = \"NativeRootLayout\";\n function Layout() {\n var [fontsLoaded, fontError] = (0, import_expo_font.useFonts)(fontsMap);\n if (!fontsLoaded && !fontError) return null;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, {\n style: styles.container,\n ...import_forms.pressOriginRootProps,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_safe_area_context.SafeAreaProvider, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_one.SchemeProvider, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(NativeRootProvider, {\n children: [\n cfg.deepLinks !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeepLinkBridge, {}),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeRootLayout, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_one.Slot, {})\n })\n ]\n })\n })\n })\n });\n }\n Layout.displayName = \"RootLayout\";\n return Layout;\n}\n//# sourceMappingURL=CreateRootLayout.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,kCAAkC,CAAC;AACvC,SAAS,iCAAiC,EACxC,wBAAwB,iBAC1B,CAAC;AACD,OAAO,UAAU,aAAa,+BAA+B;AAC7D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,mBAAmB,QAAQ,WAAW;AAC1C,IAAI,iBAAiB,QAAQ,QAAQ,SAAS,CAAC;AAC/C,IAAI,aAAa,QAAQ,KAAK;AAC9B,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,sCAAsC,QAAQ,8BAA8B;AAChF,IAAI,wCAAwC,QAAQ,gCAAgC;AACpF,IAAI,uBAAuB,QAAQ,eAAe;AAClD,IAAI,kBAAkB,QAAQ,6BAA6B;AAC3D,IAAI,eAAe,QAAQ,0BAA0B;AACrD,IAAI,cAAc,QAAQ,yBAAyB;AACnD,IAAI,gBAAgB,QAAQ,2BAA2B;AACvD,IAAI,4BAA4B,QAAQ,gCAAsB;
|
|
1
|
+
{"version":3,"file":"CreateRootLayout.native.js","names":[],"sources":["cjs/app/CreateRootLayout.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar CreateRootLayout_native_exports = {};\n__export(CreateRootLayout_native_exports, {\n createRootLayout: () => createRootLayout\n});\nmodule.exports = __toCommonJS(CreateRootLayout_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_expo_font = require(\"expo-font\");\nvar import_i18next = __toESM(require(\"i18next\"));\nvar import_one = require(\"one\");\nvar import_react_native = require(\"react-native\");\nvar import_react_native_gesture_handler = require(\"react-native-gesture-handler\");\nvar import_react_native_safe_area_context = require(\"react-native-safe-area-context\");\nvar import_react_i18next = require(\"react-i18next\");\nvar import_platform = require(\"@multiplatform.one/platform\");\nvar import_forms = require(\"@multiplatform.one/forms\");\nvar import_i18n = require(\"@multiplatform.one/i18n\");\nvar import_logger = require(\"@multiplatform.one/logger\");\nvar import_nativeErrorLog = require(\"./nativeErrorLog\");\nvar import_useNativeDeepLinks = require(\"./useNativeDeepLinks\");\n(0, import_nativeErrorLog.forwardConsoleErrorToNativeLog)();\nvar styles = import_react_native.StyleSheet.create({\n container: {\n flex: 1\n }\n});\nfunction createRootLayout(cfg) {\n var _cfg_fonts;\n import_i18next.default.use(import_react_i18next.initReactI18next).init((0, import_i18n.createI18nConfig)(cfg.i18n)).catch(import_logger.logger.error);\n import_i18next.default.changeLanguage(import_platform.config.get(\"I18N_DEFAULT_LANGUAGE\", cfg.i18n.defaultLanguage));\n var { AppProvider, RootLayout } = cfg;\n function NativeRootProvider(param) {\n var { children } = param;\n var { value: systemScheme } = (0, import_one.useUserScheme)();\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppProvider, {\n systemTheme: systemScheme,\n children\n });\n }\n NativeRootProvider.displayName = \"NativeRootProvider\";\n var fontsMap = (_cfg_fonts = cfg.fonts) !== null && _cfg_fonts !== void 0 ? _cfg_fonts : {};\n function DeepLinkBridge() {\n (0, import_useNativeDeepLinks.useNativeDeepLinks)();\n return null;\n }\n DeepLinkBridge.displayName = \"DeepLinkBridge\";\n function NativeRootLayout(param) {\n var { children } = param;\n var snap = import_one.routerStore.useOneRouter();\n if (!(snap === null || snap === void 0 ? void 0 : snap.routeInfo)) return children;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RootLayout, {\n children\n });\n }\n NativeRootLayout.displayName = \"NativeRootLayout\";\n function Layout() {\n var [fontsLoaded, fontError] = (0, import_expo_font.useFonts)(fontsMap);\n if (!fontsLoaded && !fontError) return null;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, {\n style: styles.container,\n ...import_forms.pressOriginRootProps,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_safe_area_context.SafeAreaProvider, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_one.SchemeProvider, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(NativeRootProvider, {\n children: [\n cfg.deepLinks !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeepLinkBridge, {}),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeRootLayout, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_one.Slot, {})\n })\n ]\n })\n })\n })\n });\n }\n Layout.displayName = \"RootLayout\";\n return Layout;\n}\n//# sourceMappingURL=CreateRootLayout.native.js.map\n"],"mappings":"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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var nativeErrorLog_exports = {};
|
|
22
|
+
__export(nativeErrorLog_exports, { forwardConsoleErrorToNativeLog: () => forwardConsoleErrorToNativeLog });
|
|
23
|
+
module.exports = __toCommonJS(nativeErrorLog_exports);
|
|
24
|
+
const errorLevel = 3;
|
|
25
|
+
const maxLength = 4e3;
|
|
26
|
+
function format(value) {
|
|
27
|
+
if (typeof value === "string") return value;
|
|
28
|
+
if (value instanceof Error) {
|
|
29
|
+
const head = `${value.name}: ${value.message}`;
|
|
30
|
+
return value.stack?.includes(value.message) ? value.stack : `${head}
|
|
31
|
+
${value.stack ?? ""}`;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
return JSON.stringify(value) ?? String(value);
|
|
35
|
+
} catch {
|
|
36
|
+
return String(value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function forwardConsoleErrorToNativeLog(target = globalThis) {
|
|
40
|
+
const hook = target.nativeLoggingHook;
|
|
41
|
+
const console = target.console;
|
|
42
|
+
if (target.__DEV__ !== false || typeof hook !== "function" || !console) return false;
|
|
43
|
+
if (console.__mpoNativeErrorLog) return false;
|
|
44
|
+
const original = console.error;
|
|
45
|
+
console.error = function error(...args) {
|
|
46
|
+
try {
|
|
47
|
+
hook(args.map(format).join(" ").slice(0, maxLength), errorLevel);
|
|
48
|
+
} catch {}
|
|
49
|
+
return original?.apply(this, args);
|
|
50
|
+
};
|
|
51
|
+
console.__mpoNativeErrorLog = true;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var nativeErrorLog_exports = {};
|
|
24
|
+
__export(nativeErrorLog_exports, { forwardConsoleErrorToNativeLog: () => forwardConsoleErrorToNativeLog });
|
|
25
|
+
module.exports = __toCommonJS(nativeErrorLog_exports);
|
|
26
|
+
var errorLevel = 3;
|
|
27
|
+
var maxLength = 4e3;
|
|
28
|
+
function format(value) {
|
|
29
|
+
if (typeof value === "string") return value;
|
|
30
|
+
if (value instanceof Error) {
|
|
31
|
+
var _value_stack;
|
|
32
|
+
var _value_stack1;
|
|
33
|
+
var head = `${value.name}: ${value.message}`;
|
|
34
|
+
return ((_value_stack1 = value.stack) === null || _value_stack1 === void 0 ? void 0 : _value_stack1.includes(value.message)) ? value.stack : `${head}
|
|
35
|
+
${(_value_stack = value.stack) !== null && _value_stack !== void 0 ? _value_stack : ""}`;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
var _JSON_stringify;
|
|
39
|
+
return (_JSON_stringify = JSON.stringify(value)) !== null && _JSON_stringify !== void 0 ? _JSON_stringify : String(value);
|
|
40
|
+
} catch (unused) {
|
|
41
|
+
return String(value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function forwardConsoleErrorToNativeLog() {
|
|
45
|
+
var target = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;
|
|
46
|
+
var hook = target.nativeLoggingHook;
|
|
47
|
+
var console = target.console;
|
|
48
|
+
if (target.__DEV__ !== false || typeof hook !== "function" || !console) return false;
|
|
49
|
+
if (console.__mpoNativeErrorLog) return false;
|
|
50
|
+
var original = console.error;
|
|
51
|
+
console.error = function error() {
|
|
52
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
|
+
args[_key] = arguments[_key];
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
hook(args.map(format).join(" ").slice(0, maxLength), errorLevel);
|
|
57
|
+
} catch (unused) {}
|
|
58
|
+
return original === null || original === void 0 ? void 0 : original.apply(this, args);
|
|
59
|
+
};
|
|
60
|
+
console.__mpoNativeErrorLog = true;
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var nativeErrorLog_exports = {};
|
|
24
|
+
__export(nativeErrorLog_exports, { forwardConsoleErrorToNativeLog: () => forwardConsoleErrorToNativeLog });
|
|
25
|
+
module.exports = __toCommonJS(nativeErrorLog_exports);
|
|
26
|
+
var errorLevel = 3;
|
|
27
|
+
var maxLength = 4e3;
|
|
28
|
+
function format(value) {
|
|
29
|
+
if (typeof value === "string") return value;
|
|
30
|
+
if (value instanceof Error) {
|
|
31
|
+
var _value_stack;
|
|
32
|
+
var _value_stack1;
|
|
33
|
+
var head = `${value.name}: ${value.message}`;
|
|
34
|
+
return ((_value_stack1 = value.stack) === null || _value_stack1 === void 0 ? void 0 : _value_stack1.includes(value.message)) ? value.stack : `${head}
|
|
35
|
+
${(_value_stack = value.stack) !== null && _value_stack !== void 0 ? _value_stack : ""}`;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
var _JSON_stringify;
|
|
39
|
+
return (_JSON_stringify = JSON.stringify(value)) !== null && _JSON_stringify !== void 0 ? _JSON_stringify : String(value);
|
|
40
|
+
} catch (unused) {
|
|
41
|
+
return String(value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function forwardConsoleErrorToNativeLog() {
|
|
45
|
+
var target = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;
|
|
46
|
+
var hook = target.nativeLoggingHook;
|
|
47
|
+
var console = target.console;
|
|
48
|
+
if (target.__DEV__ !== false || typeof hook !== "function" || !console) return false;
|
|
49
|
+
if (console.__mpoNativeErrorLog) return false;
|
|
50
|
+
var original = console.error;
|
|
51
|
+
console.error = function error() {
|
|
52
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
|
+
args[_key] = arguments[_key];
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
hook(args.map(format).join(" ").slice(0, maxLength), errorLevel);
|
|
57
|
+
} catch (unused) {}
|
|
58
|
+
return original === null || original === void 0 ? void 0 : original.apply(this, args);
|
|
59
|
+
};
|
|
60
|
+
console.__mpoNativeErrorLog = true;
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=nativeErrorLog.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeErrorLog.native.js","names":[],"sources":["cjs/app/nativeErrorLog.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar nativeErrorLog_exports = {};\n__export(nativeErrorLog_exports, {\n forwardConsoleErrorToNativeLog: () => forwardConsoleErrorToNativeLog\n});\nmodule.exports = __toCommonJS(nativeErrorLog_exports);\nvar errorLevel = 3;\nvar maxLength = 4e3;\nfunction format(value) {\n if (typeof value === \"string\") return value;\n if (value instanceof Error) {\n var _value_stack;\n var _value_stack1;\n var head = `${value.name}: ${value.message}`;\n return ((_value_stack1 = value.stack) === null || _value_stack1 === void 0 ? void 0 : _value_stack1.includes(value.message)) ? value.stack : `${head}\n${(_value_stack = value.stack) !== null && _value_stack !== void 0 ? _value_stack : \"\"}`;\n }\n try {\n var _JSON_stringify;\n return (_JSON_stringify = JSON.stringify(value)) !== null && _JSON_stringify !== void 0 ? _JSON_stringify : String(value);\n } catch (unused) {\n return String(value);\n }\n}\nfunction forwardConsoleErrorToNativeLog() {\n var target = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;\n var hook = target.nativeLoggingHook;\n var console = target.console;\n if (target.__DEV__ !== false || typeof hook !== \"function\" || !console) return false;\n if (console.__mpoNativeErrorLog) return false;\n var original = console.error;\n console.error = function error() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n try {\n hook(args.map(format).join(\" \").slice(0, maxLength), errorLevel);\n } catch (unused) {\n }\n return original === null || original === void 0 ? void 0 : original.apply(this, args);\n };\n console.__mpoNativeErrorLog = true;\n return true;\n}\n//# sourceMappingURL=nativeErrorLog.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,yBAAyB,CAAC;AAC9B,SAAS,wBAAwB,EAC/B,sCAAsC,+BACxC,CAAC;AACD,OAAO,UAAU,aAAa,sBAAsB;AACpD,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,SAAS,OAAO,OAAO;CACrB,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,iBAAiB,OAAO;EAC1B,IAAI;EACJ,IAAI;EACJ,IAAI,OAAO,GAAG,MAAM,KAAK,IAAI,MAAM;EACnC,SAAS,gBAAgB,MAAM,WAAW,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,MAAM,OAAO,KAAK,MAAM,QAAQ,GAAG,KAAK;GACtJ,eAAe,MAAM,WAAW,QAAQ,iBAAiB,KAAK,IAAI,eAAe;CAClF;CACA,IAAI;EACF,IAAI;EACJ,QAAQ,kBAAkB,KAAK,UAAU,KAAK,OAAO,QAAQ,oBAAoB,KAAK,IAAI,kBAAkB,OAAO,KAAK;CAC1H,SAAS,QAAQ;EACf,OAAO,OAAO,KAAK;CACrB;AACF;AACA,SAAS,iCAAiC;CACxC,IAAI,SAAS,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAC9E,IAAI,OAAO,OAAO;CAClB,IAAI,UAAU,OAAO;CACrB,IAAI,OAAO,YAAY,SAAS,OAAO,SAAS,cAAc,CAAC,SAAS,OAAO;CAC/E,IAAI,QAAQ,qBAAqB,OAAO;CACxC,IAAI,WAAW,QAAQ;CACvB,QAAQ,QAAQ,SAAS,QAAQ;EAC/B,KAAK,IAAI,OAAO,UAAU,QAAQ,OAAO,IAAI,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,MAAM,QAAQ;GACvF,KAAK,QAAQ,UAAU;EACzB;EACA,IAAI;GACF,KAAK,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,SAAS,GAAG,UAAU;EACjE,SAAS,QAAQ,CACjB;EACA,OAAO,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,MAAM,MAAM,IAAI;CACtF;CACA,QAAQ,sBAAsB;CAC9B,OAAO;AACT"}
|
|
@@ -10,8 +10,10 @@ import { config } from "@multiplatform.one/platform";
|
|
|
10
10
|
import { pressOriginRootProps } from "@multiplatform.one/forms";
|
|
11
11
|
import { createI18nConfig } from "@multiplatform.one/i18n";
|
|
12
12
|
import { logger } from "@multiplatform.one/logger";
|
|
13
|
+
import { forwardConsoleErrorToNativeLog } from "./nativeErrorLog.native.js";
|
|
13
14
|
import { useNativeDeepLinks } from "./useNativeDeepLinks.native.js";
|
|
14
15
|
|
|
16
|
+
forwardConsoleErrorToNativeLog();
|
|
15
17
|
var styles = StyleSheet.create({ container: { flex: 1 } });
|
|
16
18
|
function createRootLayout(cfg) {
|
|
17
19
|
var _cfg_fonts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRootLayout.native.js","names":[],"sources":["esm/app/CreateRootLayout.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useFonts } from \"expo-font\";\nimport i18n from \"i18next\";\nimport { SchemeProvider, Slot, routerStore, useUserScheme } from \"one\";\nimport { StyleSheet } from \"react-native\";\nimport { GestureHandlerRootView } from \"react-native-gesture-handler\";\nimport { SafeAreaProvider } from \"react-native-safe-area-context\";\nimport { initReactI18next } from \"react-i18next\";\nimport { config } from \"@multiplatform.one/platform\";\nimport { pressOriginRootProps } from \"@multiplatform.one/forms\";\nimport { createI18nConfig } from \"@multiplatform.one/i18n\";\nimport { logger } from \"@multiplatform.one/logger\";\nimport { useNativeDeepLinks } from \"./useNativeDeepLinks\";\nvar styles = StyleSheet.create({\n container: {\n flex: 1\n }\n});\nfunction createRootLayout(cfg) {\n var _cfg_fonts;\n i18n.use(initReactI18next).init(createI18nConfig(cfg.i18n)).catch(logger.error);\n i18n.changeLanguage(config.get(\"I18N_DEFAULT_LANGUAGE\", cfg.i18n.defaultLanguage));\n var { AppProvider, RootLayout } = cfg;\n function NativeRootProvider(param) {\n var { children } = param;\n var { value: systemScheme } = useUserScheme();\n return /* @__PURE__ */ _jsx(AppProvider, {\n systemTheme: systemScheme,\n children\n });\n }\n NativeRootProvider.displayName = \"NativeRootProvider\";\n var fontsMap = (_cfg_fonts = cfg.fonts) !== null && _cfg_fonts !== void 0 ? _cfg_fonts : {};\n function DeepLinkBridge() {\n useNativeDeepLinks();\n return null;\n }\n DeepLinkBridge.displayName = \"DeepLinkBridge\";\n function NativeRootLayout(param) {\n var { children } = param;\n var snap = routerStore.useOneRouter();\n if (!(snap === null || snap === void 0 ? void 0 : snap.routeInfo)) return children;\n return /* @__PURE__ */ _jsx(RootLayout, {\n children\n });\n }\n NativeRootLayout.displayName = \"NativeRootLayout\";\n function Layout() {\n var [fontsLoaded, fontError] = useFonts(fontsMap);\n if (!fontsLoaded && !fontError) return null;\n return /* @__PURE__ */ _jsx(GestureHandlerRootView, {\n style: styles.container,\n ...pressOriginRootProps,\n children: /* @__PURE__ */ _jsx(SafeAreaProvider, {\n children: /* @__PURE__ */ _jsx(SchemeProvider, {\n children: /* @__PURE__ */ _jsxs(NativeRootProvider, {\n children: [\n cfg.deepLinks !== false && /* @__PURE__ */ _jsx(DeepLinkBridge, {}),\n /* @__PURE__ */ _jsx(NativeRootLayout, {\n children: /* @__PURE__ */ _jsx(Slot, {})\n })\n ]\n })\n })\n })\n });\n }\n Layout.displayName = \"RootLayout\";\n return Layout;\n}\nexport {\n createRootLayout\n};\n//# sourceMappingURL=CreateRootLayout.native.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CreateRootLayout.native.js","names":[],"sources":["esm/app/CreateRootLayout.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useFonts } from \"expo-font\";\nimport i18n from \"i18next\";\nimport { SchemeProvider, Slot, routerStore, useUserScheme } from \"one\";\nimport { StyleSheet } from \"react-native\";\nimport { GestureHandlerRootView } from \"react-native-gesture-handler\";\nimport { SafeAreaProvider } from \"react-native-safe-area-context\";\nimport { initReactI18next } from \"react-i18next\";\nimport { config } from \"@multiplatform.one/platform\";\nimport { pressOriginRootProps } from \"@multiplatform.one/forms\";\nimport { createI18nConfig } from \"@multiplatform.one/i18n\";\nimport { logger } from \"@multiplatform.one/logger\";\nimport { forwardConsoleErrorToNativeLog } from \"./nativeErrorLog\";\nimport { useNativeDeepLinks } from \"./useNativeDeepLinks\";\nforwardConsoleErrorToNativeLog();\nvar styles = StyleSheet.create({\n container: {\n flex: 1\n }\n});\nfunction createRootLayout(cfg) {\n var _cfg_fonts;\n i18n.use(initReactI18next).init(createI18nConfig(cfg.i18n)).catch(logger.error);\n i18n.changeLanguage(config.get(\"I18N_DEFAULT_LANGUAGE\", cfg.i18n.defaultLanguage));\n var { AppProvider, RootLayout } = cfg;\n function NativeRootProvider(param) {\n var { children } = param;\n var { value: systemScheme } = useUserScheme();\n return /* @__PURE__ */ _jsx(AppProvider, {\n systemTheme: systemScheme,\n children\n });\n }\n NativeRootProvider.displayName = \"NativeRootProvider\";\n var fontsMap = (_cfg_fonts = cfg.fonts) !== null && _cfg_fonts !== void 0 ? _cfg_fonts : {};\n function DeepLinkBridge() {\n useNativeDeepLinks();\n return null;\n }\n DeepLinkBridge.displayName = \"DeepLinkBridge\";\n function NativeRootLayout(param) {\n var { children } = param;\n var snap = routerStore.useOneRouter();\n if (!(snap === null || snap === void 0 ? void 0 : snap.routeInfo)) return children;\n return /* @__PURE__ */ _jsx(RootLayout, {\n children\n });\n }\n NativeRootLayout.displayName = \"NativeRootLayout\";\n function Layout() {\n var [fontsLoaded, fontError] = useFonts(fontsMap);\n if (!fontsLoaded && !fontError) return null;\n return /* @__PURE__ */ _jsx(GestureHandlerRootView, {\n style: styles.container,\n ...pressOriginRootProps,\n children: /* @__PURE__ */ _jsx(SafeAreaProvider, {\n children: /* @__PURE__ */ _jsx(SchemeProvider, {\n children: /* @__PURE__ */ _jsxs(NativeRootProvider, {\n children: [\n cfg.deepLinks !== false && /* @__PURE__ */ _jsx(DeepLinkBridge, {}),\n /* @__PURE__ */ _jsx(NativeRootLayout, {\n children: /* @__PURE__ */ _jsx(Slot, {})\n })\n ]\n })\n })\n })\n });\n }\n Layout.displayName = \"RootLayout\";\n return Layout;\n}\nexport {\n createRootLayout\n};\n//# sourceMappingURL=CreateRootLayout.native.js.map\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,+BAA+B;AAC/B,IAAI,SAAS,WAAW,OAAO,EAC7B,WAAW,EACT,MAAM,EACR,EACF,CAAC;AACD,SAAS,iBAAiB,KAAK;CAC7B,IAAI;CACJ,KAAK,IAAI,gBAAgB,CAAC,CAAC,KAAK,iBAAiB,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,OAAO,KAAK;CAC9E,KAAK,eAAe,OAAO,IAAI,yBAAyB,IAAI,KAAK,eAAe,CAAC;CACjF,IAAI,EAAE,aAAa,eAAe;CAClC,SAAS,mBAAmB,OAAO;EACjC,IAAI,EAAE,aAAa;EACnB,IAAI,EAAE,OAAO,iBAAiB,cAAc;EAC5C,OAAuB,oBAAK,aAAa;GACvC,aAAa;GACb;EACF,CAAC;CACH;CACA,mBAAmB,cAAc;CACjC,IAAI,YAAY,aAAa,IAAI,WAAW,QAAQ,eAAe,KAAK,IAAI,aAAa,CAAC;CAC1F,SAAS,iBAAiB;EACxB,mBAAmB;EACnB,OAAO;CACT;CACA,eAAe,cAAc;CAC7B,SAAS,iBAAiB,OAAO;EAC/B,IAAI,EAAE,aAAa;EACnB,IAAI,OAAO,YAAY,aAAa;EACpC,IAAI,EAAE,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,YAAY,OAAO;EAC1E,OAAuB,oBAAK,YAAY,EACtC,SACF,CAAC;CACH;CACA,iBAAiB,cAAc;CAC/B,SAAS,SAAS;EAChB,IAAI,CAAC,aAAa,aAAa,SAAS,QAAQ;EAChD,IAAI,CAAC,eAAe,CAAC,WAAW,OAAO;EACvC,OAAuB,oBAAK,wBAAwB;GAClD,OAAO,OAAO;GACd,GAAG;GACH,UAA0B,oBAAK,kBAAkB,EAC/C,UAA0B,oBAAK,gBAAgB,EAC7C,UAA0B,qBAAM,oBAAoB,EAClD,UAAU,CACR,IAAI,cAAc,SAAyB,oBAAK,gBAAgB,CAAC,CAAC,GAClD,oBAAK,kBAAkB,EACrC,UAA0B,oBAAK,MAAM,CAAC,CAAC,EACzC,CAAC,CACH,EACF,CAAC,EACH,CAAC,EACH,CAAC;EACH,CAAC;CACH;CACA,OAAO,cAAc;CACrB,OAAO;AACT"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const errorLevel = 3;
|
|
2
|
+
const maxLength = 4e3;
|
|
3
|
+
function format(value) {
|
|
4
|
+
if (typeof value === "string") return value;
|
|
5
|
+
if (value instanceof Error) {
|
|
6
|
+
const head = `${value.name}: ${value.message}`;
|
|
7
|
+
return value.stack?.includes(value.message) ? value.stack : `${head}
|
|
8
|
+
${value.stack ?? ""}`;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
return JSON.stringify(value) ?? String(value);
|
|
12
|
+
} catch {
|
|
13
|
+
return String(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function forwardConsoleErrorToNativeLog(target = globalThis) {
|
|
17
|
+
const hook = target.nativeLoggingHook;
|
|
18
|
+
const console = target.console;
|
|
19
|
+
if (target.__DEV__ !== false || typeof hook !== "function" || !console) return false;
|
|
20
|
+
if (console.__mpoNativeErrorLog) return false;
|
|
21
|
+
const original = console.error;
|
|
22
|
+
console.error = function error(...args) {
|
|
23
|
+
try {
|
|
24
|
+
hook(args.map(format).join(" ").slice(0, maxLength), errorLevel);
|
|
25
|
+
} catch {}
|
|
26
|
+
return original?.apply(this, args);
|
|
27
|
+
};
|
|
28
|
+
console.__mpoNativeErrorLog = true;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { forwardConsoleErrorToNativeLog };
|
|
33
|
+
//# sourceMappingURL=nativeErrorLog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeErrorLog.js","names":[],"sources":["esm/app/nativeErrorLog.js"],"sourcesContent":["const errorLevel = 3;\nconst maxLength = 4e3;\nfunction format(value) {\n if (typeof value === \"string\") return value;\n if (value instanceof Error) {\n const head = `${value.name}: ${value.message}`;\n return value.stack?.includes(value.message) ? value.stack : `${head}\n${value.stack ?? \"\"}`;\n }\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n}\nfunction forwardConsoleErrorToNativeLog(target = globalThis) {\n const hook = target.nativeLoggingHook;\n const console = target.console;\n if (target.__DEV__ !== false || typeof hook !== \"function\" || !console) return false;\n if (console.__mpoNativeErrorLog) return false;\n const original = console.error;\n console.error = function error(...args) {\n try {\n hook(args.map(format).join(\" \").slice(0, maxLength), errorLevel);\n } catch {\n }\n return original?.apply(this, args);\n };\n console.__mpoNativeErrorLog = true;\n return true;\n}\nexport {\n forwardConsoleErrorToNativeLog\n};\n//# sourceMappingURL=nativeErrorLog.js.map\n"],"mappings":";AAAA,MAAM,aAAa;AACnB,MAAM,YAAY;AAClB,SAAS,OAAO,OAAO;CACrB,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,iBAAiB,OAAO;EAC1B,MAAM,OAAO,GAAG,MAAM,KAAK,IAAI,MAAM;EACrC,OAAO,MAAM,OAAO,SAAS,MAAM,OAAO,IAAI,MAAM,QAAQ,GAAG,KAAK;EACtE,MAAM,SAAS;CACf;CACA,IAAI;EACF,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CAC9C,QAAQ;EACN,OAAO,OAAO,KAAK;CACrB;AACF;AACA,SAAS,+BAA+B,SAAS,YAAY;CAC3D,MAAM,OAAO,OAAO;CACpB,MAAM,UAAU,OAAO;CACvB,IAAI,OAAO,YAAY,SAAS,OAAO,SAAS,cAAc,CAAC,SAAS,OAAO;CAC/E,IAAI,QAAQ,qBAAqB,OAAO;CACxC,MAAM,WAAW,QAAQ;CACzB,QAAQ,QAAQ,SAAS,MAAM,GAAG,MAAM;EACtC,IAAI;GACF,KAAK,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,SAAS,GAAG,UAAU;EACjE,QAAQ,CACR;EACA,OAAO,UAAU,MAAM,MAAM,IAAI;CACnC;CACA,QAAQ,sBAAsB;CAC9B,OAAO;AACT"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var errorLevel = 3;
|
|
2
|
+
var maxLength = 4e3;
|
|
3
|
+
function format(value) {
|
|
4
|
+
if (typeof value === "string") return value;
|
|
5
|
+
if (value instanceof Error) {
|
|
6
|
+
var _value_stack;
|
|
7
|
+
var _value_stack1;
|
|
8
|
+
var head = `${value.name}: ${value.message}`;
|
|
9
|
+
return ((_value_stack1 = value.stack) === null || _value_stack1 === void 0 ? void 0 : _value_stack1.includes(value.message)) ? value.stack : `${head}
|
|
10
|
+
${(_value_stack = value.stack) !== null && _value_stack !== void 0 ? _value_stack : ""}`;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
var _JSON_stringify;
|
|
14
|
+
return (_JSON_stringify = JSON.stringify(value)) !== null && _JSON_stringify !== void 0 ? _JSON_stringify : String(value);
|
|
15
|
+
} catch (unused) {
|
|
16
|
+
return String(value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function forwardConsoleErrorToNativeLog() {
|
|
20
|
+
var target = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;
|
|
21
|
+
var hook = target.nativeLoggingHook;
|
|
22
|
+
var console = target.console;
|
|
23
|
+
if (target.__DEV__ !== false || typeof hook !== "function" || !console) return false;
|
|
24
|
+
if (console.__mpoNativeErrorLog) return false;
|
|
25
|
+
var original = console.error;
|
|
26
|
+
console.error = function error() {
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
hook(args.map(format).join(" ").slice(0, maxLength), errorLevel);
|
|
32
|
+
} catch (unused) {}
|
|
33
|
+
return original === null || original === void 0 ? void 0 : original.apply(this, args);
|
|
34
|
+
};
|
|
35
|
+
console.__mpoNativeErrorLog = true;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { forwardConsoleErrorToNativeLog };
|
|
40
|
+
//# sourceMappingURL=nativeErrorLog.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeErrorLog.native.js","names":[],"sources":["esm/app/nativeErrorLog.native.js"],"sourcesContent":["var errorLevel = 3;\nvar maxLength = 4e3;\nfunction format(value) {\n if (typeof value === \"string\") return value;\n if (value instanceof Error) {\n var _value_stack;\n var _value_stack1;\n var head = `${value.name}: ${value.message}`;\n return ((_value_stack1 = value.stack) === null || _value_stack1 === void 0 ? void 0 : _value_stack1.includes(value.message)) ? value.stack : `${head}\n${(_value_stack = value.stack) !== null && _value_stack !== void 0 ? _value_stack : \"\"}`;\n }\n try {\n var _JSON_stringify;\n return (_JSON_stringify = JSON.stringify(value)) !== null && _JSON_stringify !== void 0 ? _JSON_stringify : String(value);\n } catch (unused) {\n return String(value);\n }\n}\nfunction forwardConsoleErrorToNativeLog() {\n var target = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;\n var hook = target.nativeLoggingHook;\n var console = target.console;\n if (target.__DEV__ !== false || typeof hook !== \"function\" || !console) return false;\n if (console.__mpoNativeErrorLog) return false;\n var original = console.error;\n console.error = function error() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n try {\n hook(args.map(format).join(\" \").slice(0, maxLength), errorLevel);\n } catch (unused) {\n }\n return original === null || original === void 0 ? void 0 : original.apply(this, args);\n };\n console.__mpoNativeErrorLog = true;\n return true;\n}\nexport {\n forwardConsoleErrorToNativeLog\n};\n//# sourceMappingURL=nativeErrorLog.js.map\n"],"mappings":";AAAA,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,SAAS,OAAO,OAAO;CACrB,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,iBAAiB,OAAO;EAC1B,IAAI;EACJ,IAAI;EACJ,IAAI,OAAO,GAAG,MAAM,KAAK,IAAI,MAAM;EACnC,SAAS,gBAAgB,MAAM,WAAW,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,SAAS,MAAM,OAAO,KAAK,MAAM,QAAQ,GAAG,KAAK;GACtJ,eAAe,MAAM,WAAW,QAAQ,iBAAiB,KAAK,IAAI,eAAe;CAClF;CACA,IAAI;EACF,IAAI;EACJ,QAAQ,kBAAkB,KAAK,UAAU,KAAK,OAAO,QAAQ,oBAAoB,KAAK,IAAI,kBAAkB,OAAO,KAAK;CAC1H,SAAS,QAAQ;EACf,OAAO,OAAO,KAAK;CACrB;AACF;AACA,SAAS,iCAAiC;CACxC,IAAI,SAAS,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAC9E,IAAI,OAAO,OAAO;CAClB,IAAI,UAAU,OAAO;CACrB,IAAI,OAAO,YAAY,SAAS,OAAO,SAAS,cAAc,CAAC,SAAS,OAAO;CAC/E,IAAI,QAAQ,qBAAqB,OAAO;CACxC,IAAI,WAAW,QAAQ;CACvB,QAAQ,QAAQ,SAAS,QAAQ;EAC/B,KAAK,IAAI,OAAO,UAAU,QAAQ,OAAO,IAAI,MAAM,IAAI,GAAG,OAAO,GAAG,OAAO,MAAM,QAAQ;GACvF,KAAK,QAAQ,UAAU;EACzB;EACA,IAAI;GACF,KAAK,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,SAAS,GAAG,UAAU;EACjE,SAAS,QAAQ,CACjB;EACA,OAAO,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,MAAM,MAAM,IAAI;CACtF;CACA,QAAQ,sBAAsB;CAC9B,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/core",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"description": "Core framework shell, provider composition, and layout factories for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@multiplatform.one/components": "^11.1.
|
|
60
|
-
"@multiplatform.one/forms": "^11.1.
|
|
61
|
-
"@multiplatform.one/i18n": "^11.1.
|
|
62
|
-
"@multiplatform.one/logger": "^11.1.
|
|
63
|
-
"@multiplatform.one/platform": "^11.1.
|
|
64
|
-
"@multiplatform.one/store": "^11.1.
|
|
65
|
-
"@multiplatform.one/theme": "^11.1.
|
|
59
|
+
"@multiplatform.one/components": "^11.1.2",
|
|
60
|
+
"@multiplatform.one/forms": "^11.1.2",
|
|
61
|
+
"@multiplatform.one/i18n": "^11.1.2",
|
|
62
|
+
"@multiplatform.one/logger": "^11.1.2",
|
|
63
|
+
"@multiplatform.one/platform": "^11.1.2",
|
|
64
|
+
"@multiplatform.one/store": "^11.1.2",
|
|
65
|
+
"@multiplatform.one/theme": "^11.1.2",
|
|
66
66
|
"@tanstack/devtools-utils": "^0.4.0",
|
|
67
67
|
"@tanstack/pacer-devtools": "1.6.0",
|
|
68
68
|
"@tanstack/react-devtools": "0.10.13",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"react-cookie": "^8.1.2"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@multiplatform.one/frappe": "11.1.
|
|
74
|
-
"@multiplatform.one/test-utils": "11.1.
|
|
75
|
-
"@multiplatform.one/web3": "11.1.
|
|
73
|
+
"@multiplatform.one/frappe": "11.1.2",
|
|
74
|
+
"@multiplatform.one/test-utils": "11.1.2",
|
|
75
|
+
"@multiplatform.one/web3": "11.1.2",
|
|
76
76
|
"@sentry/react": "^10.77.1",
|
|
77
77
|
"@tamagui/build": "3.2.3",
|
|
78
78
|
"@tanstack/react-query": "^5.104.3",
|
|
@@ -91,21 +91,21 @@
|
|
|
91
91
|
"vitest": "^4.1.12"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@multiplatform.one/frappe": "^11.1.
|
|
95
|
-
"@multiplatform.one/frappe-ui": "^11.1.
|
|
96
|
-
"@multiplatform.one/keycloak": "^11.1.
|
|
97
|
-
"@multiplatform.one/web3": "^11.1.
|
|
94
|
+
"@multiplatform.one/frappe": "^11.1.2",
|
|
95
|
+
"@multiplatform.one/frappe-ui": "^11.1.2",
|
|
96
|
+
"@multiplatform.one/keycloak": "^11.1.2",
|
|
97
|
+
"@multiplatform.one/web3": "^11.1.2",
|
|
98
98
|
"@sentry/react": "^9.0.0 || ^10.0.0",
|
|
99
99
|
"@tanstack/react-query": "^5.0.0",
|
|
100
100
|
"@tanstack/react-query-devtools": "^5.0.0",
|
|
101
|
-
"expo-font": "
|
|
101
|
+
"expo-font": "~58.0.11",
|
|
102
102
|
"i18next": "^25.0.0",
|
|
103
103
|
"one": "^2.14.1",
|
|
104
104
|
"react": "^19.1.0",
|
|
105
105
|
"react-i18next": "^16.0.0",
|
|
106
106
|
"react-native": ">=0.83.0",
|
|
107
107
|
"react-native-gesture-handler": ">=2.0.0",
|
|
108
|
-
"react-native-safe-area-context": "
|
|
108
|
+
"react-native-safe-area-context": "~5.11.1",
|
|
109
109
|
"tamagui": "^3.0.0"
|
|
110
110
|
},
|
|
111
111
|
"peerDependenciesMeta": {
|
|
@@ -10,9 +10,12 @@ import { config } from "@multiplatform.one/platform";
|
|
|
10
10
|
import { pressOriginRootProps } from "@multiplatform.one/forms";
|
|
11
11
|
import { createI18nConfig } from "@multiplatform.one/i18n";
|
|
12
12
|
import { logger } from "@multiplatform.one/logger";
|
|
13
|
+
import { forwardConsoleErrorToNativeLog } from "./nativeErrorLog";
|
|
13
14
|
import type { CreateRootLayoutConfig } from "./rootLayoutShared";
|
|
14
15
|
import { useNativeDeepLinks } from "./useNativeDeepLinks";
|
|
15
16
|
|
|
17
|
+
forwardConsoleErrorToNativeLog();
|
|
18
|
+
|
|
16
19
|
export type {
|
|
17
20
|
CreateRootLayoutConfig,
|
|
18
21
|
HeadConfig,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { forwardConsoleErrorToNativeLog } from "./nativeErrorLog";
|
|
3
|
+
|
|
4
|
+
function target(dev: boolean | undefined) {
|
|
5
|
+
const original = vi.fn();
|
|
6
|
+
const hook = vi.fn();
|
|
7
|
+
const console = { error: original } as unknown as Console;
|
|
8
|
+
return { original, hook, value: { __DEV__: dev, nativeLoggingHook: hook, console } };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe("forwardConsoleErrorToNativeLog", () => {
|
|
12
|
+
it("sends a Release console.error to the native log at error level and still calls the original", () => {
|
|
13
|
+
const { original, hook, value } = target(false);
|
|
14
|
+
expect(forwardConsoleErrorToNativeLog(value)).toBe(true);
|
|
15
|
+
const error = new Error("Cannot find native module 'ExpoLinking'");
|
|
16
|
+
value.console.error("Error loading route", "./_layout.tsx", error);
|
|
17
|
+
expect(hook).toHaveBeenCalledTimes(1);
|
|
18
|
+
const [message, level] = hook.mock.calls[0];
|
|
19
|
+
expect(level).toBe(3);
|
|
20
|
+
expect(message).toMatch(/^Error loading route \.\/_layout\.tsx /);
|
|
21
|
+
expect(message).toContain("Cannot find native module 'ExpoLinking'");
|
|
22
|
+
expect(original).toHaveBeenCalledWith("Error loading route", "./_layout.tsx", error);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("leaves a dev build alone, where console.error already reaches the log", () => {
|
|
26
|
+
const { original, value } = target(true);
|
|
27
|
+
expect(forwardConsoleErrorToNativeLog(value)).toBe(false);
|
|
28
|
+
expect(value.console.error).toBe(original);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("does nothing without a native logging hook, as on web", () => {
|
|
32
|
+
const { original, value } = target(false);
|
|
33
|
+
expect(forwardConsoleErrorToNativeLog({ ...value, nativeLoggingHook: undefined })).toBe(false);
|
|
34
|
+
expect(value.console.error).toBe(original);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("installs once, so a second call does not log twice", () => {
|
|
38
|
+
const { hook, value } = target(false);
|
|
39
|
+
forwardConsoleErrorToNativeLog(value);
|
|
40
|
+
expect(forwardConsoleErrorToNativeLog(value)).toBe(false);
|
|
41
|
+
value.console.error("once");
|
|
42
|
+
expect(hook).toHaveBeenCalledTimes(1);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("stringifies objects and survives values JSON cannot encode", () => {
|
|
46
|
+
const { hook, value } = target(false);
|
|
47
|
+
forwardConsoleErrorToNativeLog(value);
|
|
48
|
+
const cyclic: Record<string, unknown> = {};
|
|
49
|
+
cyclic.self = cyclic;
|
|
50
|
+
value.console.error({ id: 1 }, cyclic, 42);
|
|
51
|
+
expect(hook.mock.calls[0][0]).toBe('{"id":1} [object Object] 42');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// A Release React Native build drops console.error before it reaches the device
|
|
2
|
+
// log, so an error that One's route loader catches and reports there (a root
|
|
3
|
+
// layout whose import threw) left a black screen and nothing to read
|
|
4
|
+
// (FZ-13579). The native logging hook still reaches os_log and logcat at error
|
|
5
|
+
// level, so in Release console.error also goes through it.
|
|
6
|
+
|
|
7
|
+
type Hook = (message: string, level: number) => void;
|
|
8
|
+
|
|
9
|
+
interface Target {
|
|
10
|
+
__DEV__?: boolean;
|
|
11
|
+
nativeLoggingHook?: Hook;
|
|
12
|
+
console?: Console & { __mpoNativeErrorLog?: boolean };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const errorLevel = 3;
|
|
16
|
+
const maxLength = 4000;
|
|
17
|
+
|
|
18
|
+
function format(value: unknown): string {
|
|
19
|
+
if (typeof value === "string") return value;
|
|
20
|
+
if (value instanceof Error) {
|
|
21
|
+
const head = `${value.name}: ${value.message}`;
|
|
22
|
+
return value.stack?.includes(value.message) ? value.stack : `${head}\n${value.stack ?? ""}`;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return JSON.stringify(value) ?? String(value);
|
|
26
|
+
} catch {
|
|
27
|
+
return String(value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function forwardConsoleErrorToNativeLog(target: Target = globalThis as Target): boolean {
|
|
32
|
+
const hook = target.nativeLoggingHook;
|
|
33
|
+
const console = target.console;
|
|
34
|
+
if (target.__DEV__ !== false || typeof hook !== "function" || !console) return false;
|
|
35
|
+
if (console.__mpoNativeErrorLog) return false;
|
|
36
|
+
const original = console.error;
|
|
37
|
+
console.error = function error(...args: unknown[]) {
|
|
38
|
+
try {
|
|
39
|
+
hook(args.map(format).join(" ").slice(0, maxLength), errorLevel);
|
|
40
|
+
} catch {}
|
|
41
|
+
return original?.apply(this, args);
|
|
42
|
+
};
|
|
43
|
+
console.__mpoNativeErrorLog = true;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRootLayout.native.d.ts","sourceRoot":"","sources":["../../src/app/CreateRootLayout.native.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateRootLayout.native.d.ts","sourceRoot":"","sources":["../../src/app/CreateRootLayout.native.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAUtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAKjE,YAAY,EACV,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,sBAAsB,GAAG,aAAa,CA+D3E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Hook = (message: string, level: number) => void;
|
|
2
|
+
interface Target {
|
|
3
|
+
__DEV__?: boolean;
|
|
4
|
+
nativeLoggingHook?: Hook;
|
|
5
|
+
console?: Console & {
|
|
6
|
+
__mpoNativeErrorLog?: boolean;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function forwardConsoleErrorToNativeLog(target?: Target): boolean;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=nativeErrorLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeErrorLog.d.ts","sourceRoot":"","sources":["../../src/app/nativeErrorLog.ts"],"names":[],"mappings":"AAMA,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAErD,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,GAAG;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACvD;AAkBD,wBAAgB,8BAA8B,CAAC,MAAM,GAAE,MAA6B,GAAG,OAAO,CAc7F"}
|