react-cosmos-native 6.0.0-canary.fdbaa56.0 → 6.0.0

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.
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { FixtureId, RendererConfig, UserModuleWrappers } from 'react-cosmos-core';
3
3
  type Props = {
4
4
  rendererConfig: RendererConfig;
5
5
  moduleWrappers: UserModuleWrappers;
6
6
  initialFixtureId?: FixtureId;
7
7
  };
8
- export declare function NativeFixtureLoader({ rendererConfig, moduleWrappers, initialFixtureId, }: Props): JSX.Element;
8
+ export declare function NativeFixtureLoader({ rendererConfig, moduleWrappers, initialFixtureId, }: Props): React.JSX.Element;
9
9
  export {};
@@ -5,5 +5,5 @@ type Props = {
5
5
  rendererConfig: RendererConfig;
6
6
  initialFixtureId?: FixtureId | null;
7
7
  };
8
- export declare function NativeRendererProvider({ children, rendererConfig, initialFixtureId, }: Props): JSX.Element;
8
+ export declare function NativeRendererProvider({ children, rendererConfig, initialFixtureId, }: Props): React.JSX.Element;
9
9
  export {};
@@ -4,8 +4,10 @@ export function getSocketUrl(playgroundUrl) {
4
4
  // The URL module isn't implemented fully in React Native and I don't want to
5
5
  // bring in another dependency just for this.
6
6
  const scriptURL = NativeModules.SourceCode.scriptURL;
7
- const [, hostname] = scriptURL.match(/:\/\/(.+?)(:|\/)/);
8
- const portMatch = playgroundUrl.match(/:(\d+)(\/|$)/);
9
- const port = portMatch ? portMatch[1] : '80';
10
- return `ws://${hostname}:${port}`;
7
+ // https://stackoverflow.com/a/27755/1332513
8
+ const urlRegex = /^(.*:)\/\/([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$/;
9
+ const [, _protocol, host] = scriptURL.match(urlRegex) || [];
10
+ const [_url, protocol, _host, port = ':80'] = playgroundUrl.match(urlRegex) || [];
11
+ const wsProtocol = protocol === 'https:' ? 'wss' : 'ws';
12
+ return `${wsProtocol}://${host}${port}`;
11
13
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "react-cosmos-native",
3
- "version": "6.0.0-canary.fdbaa56.0+fdbaa56",
3
+ "version": "6.0.0",
4
4
  "description": "React Cosmos Native",
5
5
  "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-native",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "./dist/index.js",
9
9
  "dependencies": {
10
- "react-cosmos-core": "6.0.0-canary.fdbaa56.0+fdbaa56",
11
- "react-cosmos-renderer": "6.0.0-canary.fdbaa56.0+fdbaa56"
10
+ "react-cosmos-core": "^6.0.0",
11
+ "react-cosmos-renderer": "^6.0.0"
12
12
  },
13
- "gitHead": "fdbaa565382e2685f7ac21aecec25f2d78c7b8ab"
13
+ "gitHead": "db4fd8fd917598f1f16d4c291be76217436422ee"
14
14
  }