@sleeperhq/mini-core 1.8.4 → 1.8.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/bin/build_mini.js CHANGED
@@ -46,7 +46,7 @@ const getCommands = (projectName) => {
46
46
  --reset-cache \
47
47
  --bundle-output "${bundleOutputPath[platform]}" \
48
48
  --sourcemap-output "${sourcemapOutputPath[platform]}" \
49
- --minify false \
49
+ --minify true \
50
50
  --assets-dest "${assetsDestPath[platform]}" \
51
51
  --webpackConfig ./node_modules/@sleeperhq/mini-core/webpack.config.js`;
52
52
  };
@@ -112,8 +112,10 @@ const getInput = (message, fallback) => {
112
112
  const result = name.trim();
113
113
  if (!result) {
114
114
  resolve(fallback);
115
+ } else {
116
+ resolve(name.trim());
115
117
  }
116
- resolve(name.trim());
118
+ interface.close();
117
119
  });
118
120
  });
119
121
  };
@@ -10,14 +10,14 @@
10
10
  "@react-native-community/datetimepicker": "2.6.2",
11
11
  "@react-native-community/hooks": "2.8.0",
12
12
  "@react-native-community/netinfo": "9.3.7",
13
- "@react-native-masked-view/masked-view": "0.2.8",
13
+ "@react-native-masked-view/masked-view": "0.3.1",
14
14
  "@react-native-picker/picker": "1.16.8",
15
15
  "@react-navigation/bottom-tabs": "6.5.4",
16
16
  "@react-navigation/compat": "5.3.20",
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.8.4",
20
+ "@sleeperhq/mini-core": "1.8.6",
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.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "Core library frameworks for developing Sleeper Mini Apps.",
5
5
  "main": "index.ts",
6
6
  "types": "index.d.ts",
@@ -62,7 +62,7 @@
62
62
  "@babel/core": "7.15.8",
63
63
  "@babel/preset-typescript": "7.21.4",
64
64
  "@react-native-community/eslint-config": "^2.0.0",
65
- "@types/react": "18.0.24",
65
+ "@types/react": "18.2.31",
66
66
  "@types/react-native": "0.72.7",
67
67
  "@typescript-eslint/eslint-plugin": "^5.31.0",
68
68
  "@typescript-eslint/parser": "^5.31.0",
@@ -1,7 +1,7 @@
1
1
  import React, {useEffect, useRef, useState} from 'react';
2
- import {Platform} from 'react-native';
2
+ import {Platform, NativeModules} from 'react-native';
3
3
  import {Config, SocketMessage} from '../types';
4
- import { ScriptLocatorResolver, ScriptManager, Federated } from '@callstack/repack/client';
4
+ import { ScriptLocatorResolver, ScriptManager } from '@callstack/repack/client';
5
5
  import NetInfo, { NetInfoState } from '@react-native-community/netinfo';
6
6
  import TcpSocket from 'react-native-tcp-socket';
7
7
  import { fetchMainVersionMap, getMainUrl } from './url_resolver';
@@ -187,6 +187,10 @@ const DevServer = props => {
187
187
  // @ts-ignore
188
188
  const ipAddress = netInfoDetails?.ipAddress;
189
189
 
190
+ const scriptURL = NativeModules.SourceCode.scriptURL;
191
+ const address = scriptURL.split('://')[1].split('/')[0];
192
+ const packagerIP = address.split(':')[0];
193
+
190
194
  if (!netInfoDetails || !('ipAddress' in netInfoDetails)) {
191
195
  console.error('[Sleeper] Failed to determine local IP address.');
192
196
  return stopSocket();
@@ -200,7 +204,7 @@ const DevServer = props => {
200
204
  }, () => {
201
205
  // When we establish a connection, send some data to the server
202
206
  const message: SocketMessage = {
203
- _ip: ipAddress,
207
+ _ip: packagerIP,
204
208
  _name: config.name,
205
209
  _entitlements: config.entitlements,
206
210
  _headerOptions: config.headerOptions,
package/webpack.config.js CHANGED
@@ -185,7 +185,7 @@ module.exports = env => {
185
185
  options: {
186
186
  presets: [
187
187
  'module:metro-react-native-babel-preset',
188
- '@babel/preset-typescript',
188
+ ['@babel/preset-typescript', { allowDeclareFields: true }],
189
189
  ],
190
190
  babelrc: false,
191
191
  cacheDirectory: true,
@@ -206,7 +206,7 @@ module.exports = env => {
206
206
  options: {
207
207
  presets: [
208
208
  'module:metro-react-native-babel-preset',
209
- '@babel/preset-typescript',
209
+ ['@babel/preset-typescript', { allowDeclareFields: true }],
210
210
  ],
211
211
  // sourceType: "unambiguous",
212
212
  /** Add React Refresh transform only when HMR is enabled. */