react-cosmos 6.2.4-canary.fa66419.0 → 7.0.0-beta.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.
@@ -174,8 +174,8 @@
174
174
  "description": "Path to Vite config. Set to false to disable reading it from the default path. [default: \"vite.config.js\" or \"vite.config.ts\"]",
175
175
  "anyOf": [{ "type": "string", "minLength": 1 }, { "enum": [false] }]
176
176
  },
177
- "indexPath": {
178
- "description": "Path to index module (eg. \"src/my-index.tsx\"). [default: detects common index/main module paths]",
177
+ "mainScriptUrl": {
178
+ "description": "URL to custom main script (eg. \"/src/my-main.tsx\"). [default: detect main script URL]",
179
179
  "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }]
180
180
  },
181
181
  "port": {
@@ -1,6 +1,5 @@
1
1
  import http from 'http';
2
2
  import https from 'https';
3
- import { getPlaygroundUrls } from '../shared/playgroundUrl.js';
4
3
  import { getHttpsCreds } from './httpsCreds.js';
5
4
  export async function createHttpServer(config, requestListener) {
6
5
  const server = config.https
@@ -15,8 +14,6 @@ export async function createHttpServer(config, requestListener) {
15
14
  server.listen(config.port, config.host, resolve);
16
15
  }
17
16
  });
18
- const urls = getPlaygroundUrls(config);
19
- console.log(`[Cosmos] See you at ${urls.join(' or ')}`);
20
17
  }
21
18
  async function stop() {
22
19
  await new Promise(resolve => server.close(resolve));
@@ -4,6 +4,7 @@ import { getPluginConfigs } from '../cosmosPlugin/pluginConfigs.js';
4
4
  import { applyServerConfigPlugins } from '../shared/applyServerConfigPlugins.js';
5
5
  import { getServerPlugins } from '../shared/getServerPlugins.js';
6
6
  import { logPluginInfo } from '../shared/logPluginInfo.js';
7
+ import { logPlaygroundUrls } from '../shared/playgroundUrl.js';
7
8
  import { serveStaticDir } from '../shared/staticServer.js';
8
9
  import { createExpressApp } from './expressApp.js';
9
10
  import { createHttpServer } from './httpServer.js';
@@ -60,7 +61,7 @@ export async function startDevServer(platform) {
60
61
  catch (err) {
61
62
  // Log when a plugin fails to clean up, but continue to attempt
62
63
  // to clean up the remaining plugins
63
- console.log(`[Cosmos][plugin:${plugin.name}] Dev server cleanup failed`);
64
+ console.log(`[Cosmos][${plugin.name}] Dev server cleanup failed`);
64
65
  console.log(err);
65
66
  }
66
67
  });
@@ -69,19 +70,20 @@ export async function startDevServer(platform) {
69
70
  catch (err) {
70
71
  // Abort starting server if a plugin init fails and attempt cleanup of all
71
72
  // plugins that have already initialized
72
- console.log(`[Cosmos][plugin:${plugin.name}] Dev server init failed`);
73
+ console.log(`[Cosmos][${plugin.name}] Dev server init failed`);
73
74
  cleanUp();
74
75
  throw err;
75
76
  }
76
77
  }
78
+ logPlaygroundUrls(config);
77
79
  return cleanUp;
78
80
  }
79
81
  function logCosmosConfigInfo() {
80
82
  const cosmosConfigPath = detectCosmosConfigPath();
81
83
  if (!cosmosConfigPath) {
82
- console.log(`[Cosmos] Using default cosmos config`);
84
+ console.log(`[Cosmos] Using default Cosmos config`);
83
85
  return;
84
86
  }
85
87
  const relConfigPath = path.relative(process.cwd(), cosmosConfigPath);
86
- console.log(`[Cosmos] Using cosmos config found at ${relConfigPath}`);
88
+ console.log(`[Cosmos] Using config found at ${relConfigPath}`);
87
89
  }
@@ -38,7 +38,7 @@ export async function generateExport() {
38
38
  await plugin.export({ config });
39
39
  }
40
40
  catch (err) {
41
- console.log(`[Cosmos][plugin:${plugin.name}] Export failed`);
41
+ console.log(`[Cosmos][${plugin.name}] Export failed`);
42
42
  throw err;
43
43
  }
44
44
  }
@@ -5,7 +5,7 @@ export async function applyServerConfigPlugins({ config, serverPlugins, mode, pl
5
5
  config = await plugin.config({ config, mode, platform });
6
6
  }
7
7
  catch (err) {
8
- console.log(`[Cosmos][plugin:${plugin.name}] Config hook failed`);
8
+ console.log(`[Cosmos][${plugin.name}] Config hook failed`);
9
9
  throw err;
10
10
  }
11
11
  }
@@ -1,2 +1,3 @@
1
1
  import { CosmosConfig } from '../cosmosConfig/types.js';
2
2
  export declare function getPlaygroundUrls(config: CosmosConfig): string[];
3
+ export declare function logPlaygroundUrls(config: CosmosConfig): void;
@@ -9,3 +9,7 @@ export function getPlaygroundUrls(config) {
9
9
  `${protocol}://${getServerHost(config)}:${config.port}`,
10
10
  ];
11
11
  }
12
+ export function logPlaygroundUrls(config) {
13
+ const urls = getPlaygroundUrls(config);
14
+ console.log(`[Cosmos] See you at ${urls.join(' or ')}`);
15
+ }
@@ -7,10 +7,17 @@ export async function mockConsole(cb) {
7
7
  origConsoleLog(...args);
8
8
  }
9
9
  });
10
- const cbReturn = await cb({
11
- expectLog: (msg) => expectedLogs.push(msg),
12
- });
13
- expectedLogs.forEach(msg => expect(console.log).toBeCalledWith(msg));
14
- console.log = origConsoleLog;
15
- return cbReturn;
10
+ try {
11
+ const cbReturn = await cb({
12
+ expectLog: (msg) => expectedLogs.push(msg),
13
+ });
14
+ expectedLogs.forEach(msg => expect(console.log).toBeCalledWith(msg));
15
+ return cbReturn;
16
+ }
17
+ catch (err) {
18
+ throw err;
19
+ }
20
+ finally {
21
+ console.log = origConsoleLog;
22
+ }
16
23
  }
@@ -1 +1 @@
1
- {"root":["../src/client.ts","../src/index.ts","../src/vitest.ts","../src/@types/launch-editor.d.ts","../src/@types/mdx.d.ts","../src/@types/yargs.d.ts","../src/corePlugins/fixtureWatcherPlugin.ts","../src/corePlugins/fixturesJsonPlugin.ts","../src/corePlugins/httpProxyPlugin.ts","../src/corePlugins/index.ts","../src/corePlugins/openFilePlugin.ts","../src/corePlugins/pluginEndpointPlugin.ts","../src/corePlugins/portRetryPlugin.ts","../src/corePlugins/remoteRendererUrlPlugin.ts","../src/cosmosConfig/createCosmosConfig.ts","../src/cosmosConfig/detectCosmosConfig.ts","../src/cosmosConfig/getCosmosConfigAtPath.ts","../src/cosmosConfig/shared.ts","../src/cosmosConfig/types.ts","../src/cosmosPlugin/findCosmosPluginConfigs.ts","../src/cosmosPlugin/pluginConfigs.ts","../src/cosmosPlugin/readCosmosPluginConfig.ts","../src/cosmosPlugin/types.ts","../src/devServer/expressApp.ts","../src/devServer/httpServer.ts","../src/devServer/httpsCreds.ts","../src/devServer/messageHandler.ts","../src/devServer/startDevServer.ts","../src/export/generateExport.ts","../src/getFixtures/getFixtures.ts","../src/getFixtures/importUserModules.ts","../src/shared/applyServerConfigPlugins.ts","../src/shared/findNextAvailablePort.ts","../src/shared/getServerPlugins.ts","../src/shared/importServerPlugins.ts","../src/shared/logPluginInfo.ts","../src/shared/playgroundHtml.ts","../src/shared/playgroundUrl.ts","../src/shared/remoteRendererUrl.ts","../src/shared/serverAddress.ts","../src/shared/serverFixtureList.ts","../src/shared/staticPath.ts","../src/shared/staticServer.ts","../src/shared/webSocketUrl.ts","../src/userModules/findUserModulePaths.ts","../src/userModules/fixtureWatcher.ts","../src/userModules/generateUserImports.ts","../src/userModules/shared.ts","../src/userModules/userImportsLazyTemplate.ts","../src/userModules/userImportsTemplate.ts","../src/utils/cli.ts","../src/utils/findUp.ts","../src/utils/fs.ts","../src/utils/isNodeError.ts","../src/utils/json.ts","../src/utils/requireModule.ts","../src/utils/resolve.ts","../src/utils/resolveLoose.ts","../src/utils/resolveSilent.ts","../src/utils/slash.ts"],"version":"5.7.3"}
1
+ {"root":["../src/client.ts","../src/index.ts","../src/vitest.ts","../src/@types/launch-editor.d.ts","../src/@types/mdx.d.ts","../src/@types/yargs.d.ts","../src/coreplugins/fixturewatcherplugin.ts","../src/coreplugins/fixturesjsonplugin.ts","../src/coreplugins/httpproxyplugin.ts","../src/coreplugins/index.ts","../src/coreplugins/openfileplugin.ts","../src/coreplugins/pluginendpointplugin.ts","../src/coreplugins/portretryplugin.ts","../src/coreplugins/remoterendererurlplugin.ts","../src/cosmosconfig/createcosmosconfig.ts","../src/cosmosconfig/detectcosmosconfig.ts","../src/cosmosconfig/getcosmosconfigatpath.ts","../src/cosmosconfig/shared.ts","../src/cosmosconfig/types.ts","../src/cosmosplugin/findcosmospluginconfigs.ts","../src/cosmosplugin/pluginconfigs.ts","../src/cosmosplugin/readcosmospluginconfig.ts","../src/cosmosplugin/types.ts","../src/devserver/expressapp.ts","../src/devserver/httpserver.ts","../src/devserver/httpscreds.ts","../src/devserver/messagehandler.ts","../src/devserver/startdevserver.ts","../src/export/generateexport.ts","../src/getfixtures/getfixtures.ts","../src/getfixtures/importusermodules.ts","../src/shared/applyserverconfigplugins.ts","../src/shared/findnextavailableport.ts","../src/shared/getserverplugins.ts","../src/shared/importserverplugins.ts","../src/shared/logplugininfo.ts","../src/shared/playgroundhtml.ts","../src/shared/playgroundurl.ts","../src/shared/remoterendererurl.ts","../src/shared/serveraddress.ts","../src/shared/serverfixturelist.ts","../src/shared/staticpath.ts","../src/shared/staticserver.ts","../src/shared/websocketurl.ts","../src/usermodules/findusermodulepaths.ts","../src/usermodules/fixturewatcher.ts","../src/usermodules/generateuserimports.ts","../src/usermodules/shared.ts","../src/usermodules/userimportslazytemplate.ts","../src/usermodules/userimportstemplate.ts","../src/utils/cli.ts","../src/utils/findup.ts","../src/utils/fs.ts","../src/utils/isnodeerror.ts","../src/utils/json.ts","../src/utils/requiremodule.ts","../src/utils/resolve.ts","../src/utils/resolveloose.ts","../src/utils/resolvesilent.ts","../src/utils/slash.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cosmos",
3
- "version": "6.2.4-canary.fa66419.0+fa66419",
3
+ "version": "7.0.0-beta.0",
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",
@@ -11,15 +11,15 @@
11
11
  "chokidar": "3.6.0",
12
12
  "express": "4.21.2",
13
13
  "glob": "10.4.5",
14
- "http-proxy-middleware": "2.0.7",
14
+ "http-proxy-middleware": "2.0.9",
15
15
  "lodash-es": "4.17.21",
16
16
  "micromatch": "4.0.8",
17
- "open": "10.1.0",
17
+ "open": "10.1.1",
18
18
  "pem": "1.15.1",
19
- "react-cosmos-core": "6.2.4-canary.fa66419.0+fa66419",
20
- "react-cosmos-renderer": "6.2.4-canary.fa66419.0+fa66419",
21
- "react-cosmos-ui": "6.2.4-canary.fa66419.0+fa66419",
22
- "ws": "8.18.0",
19
+ "react-cosmos-core": "7.0.0-beta.0",
20
+ "react-cosmos-renderer": "7.0.0-beta.0",
21
+ "react-cosmos-ui": "7.0.0-beta.0",
22
+ "ws": "8.18.1",
23
23
  "yargs": "17.7.2"
24
24
  },
25
25
  "bin": {
@@ -27,5 +27,5 @@
27
27
  "cosmos-export": "./bin/cosmos-export.js",
28
28
  "cosmos-native": "./bin/cosmos-native.js"
29
29
  },
30
- "gitHead": "fa66419918274f7fac6da86521f44cf097eb17b9"
30
+ "gitHead": "c01fecbf8b3342846f24d5860bf2d5146801ae3e"
31
31
  }