react-cosmos 6.0.0-alpha.0 → 6.0.0-canary.1dc3b1b.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.
- package/dist/server/getFixtures/getFixtures.js +3 -3
- package/dist/server/shared/playgroundHtml.js +3 -3
- package/dist/server/shared/resolveRendererUrl.d.ts +1 -0
- package/dist/server/shared/resolveRendererUrl.js +7 -0
- package/package.json +4 -4
- package/dist/server/shared/resolveUrlPath.d.ts +0 -1
- package/dist/server/shared/resolveUrlPath.js +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { createFixtureTree, flattenFixtureTree, getDecoratedFixtureElement, getFixtureListFromExports, getSortedDecoratorsForFixturePath, stringifyPlaygroundUrlQuery, stringifyRendererUrlQuery, } from 'react-cosmos-core';
|
|
3
3
|
import { RENDERER_FILENAME } from '../shared/playgroundHtml.js';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveRendererUrl } from '../shared/resolveRendererUrl.js';
|
|
5
5
|
import { getUserModules } from '../userDeps/getUserModules.js';
|
|
6
6
|
export function getFixtures(cosmosConfig) {
|
|
7
7
|
const { fixturesDir, fixtureFileSuffix, rootDir } = cosmosConfig;
|
|
@@ -47,8 +47,8 @@ function getRendererUrl(cosmosConfig, fixtureId) {
|
|
|
47
47
|
if (rendererUrl)
|
|
48
48
|
return `${rendererUrl}?${query}`;
|
|
49
49
|
const host = getPlaygroundHost(cosmosConfig);
|
|
50
|
-
const urlPath =
|
|
51
|
-
return `${
|
|
50
|
+
const urlPath = resolveRendererUrl(publicUrl, RENDERER_FILENAME);
|
|
51
|
+
return new URL(`${urlPath}?${query}`, host).toString();
|
|
52
52
|
}
|
|
53
53
|
function getPlaygroundHost({ hostname, port, https }) {
|
|
54
54
|
return `${https ? 'https' : 'http'}://${hostname || 'localhost'}:${port}`;
|
|
@@ -3,7 +3,7 @@ import { readFile } from 'fs/promises';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { pkgUpSync } from 'pkg-up';
|
|
5
5
|
import { replaceKeys } from 'react-cosmos-core';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveRendererUrl } from './resolveRendererUrl.js';
|
|
7
7
|
import { getStaticPath } from './staticPath.js';
|
|
8
8
|
export const RENDERER_FILENAME = '_renderer.html';
|
|
9
9
|
export async function getDevPlaygroundHtml(platformType, cosmosConfig, pluginConfigs) {
|
|
@@ -39,7 +39,7 @@ async function getDevCoreConfig(platformType, cosmosConfig) {
|
|
|
39
39
|
...(await getSharedCoreConfig(cosmosConfig)),
|
|
40
40
|
devServerOn: true,
|
|
41
41
|
webRendererUrl: cosmosConfig.rendererUrl ||
|
|
42
|
-
|
|
42
|
+
resolveRendererUrl(cosmosConfig.publicUrl, RENDERER_FILENAME),
|
|
43
43
|
};
|
|
44
44
|
default:
|
|
45
45
|
throw new Error(`Invalid platform type: ${platformType}`);
|
|
@@ -49,7 +49,7 @@ async function getExportCoreConfig(cosmosConfig) {
|
|
|
49
49
|
return {
|
|
50
50
|
...(await getSharedCoreConfig(cosmosConfig)),
|
|
51
51
|
devServerOn: false,
|
|
52
|
-
webRendererUrl:
|
|
52
|
+
webRendererUrl: resolveRendererUrl(cosmosConfig.publicUrl, RENDERER_FILENAME),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
async function getSharedCoreConfig(cosmosConfig) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveRendererUrl(publicUrl: string, filename: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-canary.1dc3b1b.0+1dc3b1b",
|
|
4
4
|
"description": "Sandbox for developing and testing UI components in isolation",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"open": "^8.4.2",
|
|
18
18
|
"pem": "^1.14.6",
|
|
19
19
|
"pkg-up": "^4.0.0",
|
|
20
|
-
"react-cosmos-core": "^6.0.0-
|
|
21
|
-
"react-cosmos-ui": "^6.0.0-
|
|
20
|
+
"react-cosmos-core": "^6.0.0-canary.1dc3b1b.0+1dc3b1b",
|
|
21
|
+
"react-cosmos-ui": "^6.0.0-canary.1dc3b1b.0+1dc3b1b",
|
|
22
22
|
"ws": "^8.12.1",
|
|
23
23
|
"yargs": "^17.7.0"
|
|
24
24
|
},
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"cosmos-export": "./bin/cosmos-export.js",
|
|
28
28
|
"cosmos-native": "./bin/cosmos-native.js"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "1dc3b1b21c10e66337a35847f1e4578a41bbef3a"
|
|
31
31
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveUrlPath(base: string, urlPath: string): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// resolveUrlPath('/', '_renderer.html') => '/_renderer.html'
|
|
2
|
-
// resolveUrlPath('./', '_renderer.html') => '/_renderer.html'
|
|
3
|
-
// resolveUrlPath('http://localhost:5000', '_renderer.html') => 'http://localhost:5000/_renderer.html'
|
|
4
|
-
export function resolveUrlPath(base, urlPath) {
|
|
5
|
-
// The 'resolve://' protocol is only added when base is a relative URL.
|
|
6
|
-
const resolvedUrl = new URL(urlPath, new URL(base, 'resolve://'));
|
|
7
|
-
if (resolvedUrl.protocol === 'resolve:') {
|
|
8
|
-
const { pathname, search, hash } = resolvedUrl;
|
|
9
|
-
return pathname + search + hash;
|
|
10
|
-
}
|
|
11
|
-
return resolvedUrl.toString();
|
|
12
|
-
}
|