@sleeperhq/mini-core 1.9.3 → 1.9.5
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/index.ts +3 -2
- package/mini_packages.json +1 -1
- package/package.json +2 -1
- package/src/components/MiniLogger.ts +18 -0
- package/start.tsx +9 -6
- package/webpack.config.js +1 -1
package/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Sleeper from './src/components';
|
|
2
2
|
import DevServer from './src/dev_server';
|
|
3
3
|
import * as Types from './src/types';
|
|
4
|
-
import {Fonts, Theme} from './src/styles';
|
|
4
|
+
import { Fonts, Theme } from './src/styles';
|
|
5
|
+
import MiniLogger from './src/components/MiniLogger';
|
|
5
6
|
|
|
6
|
-
export {Sleeper, DevServer, Types, Fonts, Theme};
|
|
7
|
+
export { Sleeper, DevServer, Types, Fonts, Theme, MiniLogger };
|
package/mini_packages.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@react-navigation/native": "6.1.3",
|
|
18
18
|
"@react-navigation/stack": "6.3.12",
|
|
19
19
|
"@shopify/flash-list": "1.4.1",
|
|
20
|
-
"@sleeperhq/mini-core": "1.9.
|
|
20
|
+
"@sleeperhq/mini-core": "1.9.5",
|
|
21
21
|
"amazon-cognito-identity-js": "6.3.2",
|
|
22
22
|
"crypto-js": "3.3.0",
|
|
23
23
|
"decimal.js-light": "2.5.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleeperhq/mini-core",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5",
|
|
4
4
|
"description": "Core library frameworks for developing Sleeper Mini Apps.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"react-refresh": "0.14.0",
|
|
51
51
|
"react-test-renderer": "17.0.2",
|
|
52
52
|
"regenerator-runtime": "0.13.11",
|
|
53
|
+
"rx": "4.1.0",
|
|
53
54
|
"string-replace-loader": "3.1.0",
|
|
54
55
|
"terser-webpack-plugin": "5.3.6",
|
|
55
56
|
"webpack": "5.75.0"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Rx from 'rx';
|
|
2
|
+
|
|
3
|
+
class MiniLogger {
|
|
4
|
+
public static messages = new Rx.Subject;
|
|
5
|
+
|
|
6
|
+
static log(...args: any[]) {
|
|
7
|
+
this.messages.onNext({
|
|
8
|
+
type: 'mini_dev_server',
|
|
9
|
+
action: 'onConsoleLog',
|
|
10
|
+
message: Array.from(args).join(' '),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Add global function for mini logging
|
|
16
|
+
global.log_mini = (...args: any[]) => { MiniLogger.log(...args); }
|
|
17
|
+
|
|
18
|
+
export default MiniLogger;
|
package/start.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useCallback, useState} from 'react';
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
AppRegistry,
|
|
4
4
|
ActivityIndicator,
|
|
@@ -7,16 +7,19 @@ import {
|
|
|
7
7
|
StyleSheet,
|
|
8
8
|
SafeAreaView,
|
|
9
9
|
} from 'react-native';
|
|
10
|
-
import {DevServer, Types} from '.';
|
|
11
|
-
|
|
12
|
-
const console_modified = global.console as any;
|
|
13
|
-
console_modified.log_mini = (...args: any[]) => { console.log('[MiniLog]', ...args); }
|
|
14
|
-
global.console = console_modified;
|
|
10
|
+
import { DevServer, Types, MiniLogger } from '.';
|
|
15
11
|
|
|
16
12
|
import 'root/package_list';
|
|
17
13
|
import config from 'root/app.json';
|
|
18
14
|
import Project from 'app';
|
|
19
15
|
|
|
16
|
+
MiniLogger.messages
|
|
17
|
+
.subscribe((data: any) => {
|
|
18
|
+
if (data.action === 'onConsoleLog') {
|
|
19
|
+
console.log('[MiniLog]', data.message);
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
20
23
|
DevServer.init(config);
|
|
21
24
|
|
|
22
25
|
const Root = () => {
|