react-cosmos 6.0.0-alpha.14 → 6.0.0-alpha.16

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.
@@ -156,17 +156,36 @@
156
156
  }
157
157
  }
158
158
  },
159
+ "vite": {
160
+ "description": "Vite-related options",
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "properties": {
164
+ "configPath": {
165
+ "description": "Path to Vite config. Set to false to disable reading it from the default path. [default: \"vite.config.js\"]",
166
+ "anyOf": [{ "type": "string", "minLength": 1 }, { "enum": [false] }]
167
+ },
168
+ "indexPath": {
169
+ "description": "Path to index module (eg. \"src/my-index.tsx\"). [default: matches common index/main module paths]",
170
+ "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }]
171
+ },
172
+ "port": {
173
+ "description": "Vite renderer port. [default: 5050]",
174
+ "type": "number"
175
+ }
176
+ }
177
+ },
159
178
  "webpack": {
160
179
  "description": "Webpack-related options",
161
180
  "type": "object",
162
181
  "additionalProperties": false,
163
182
  "properties": {
164
183
  "configPath": {
165
- "description": "Path to an existing webpack config, which Cosmos will reuse to build your code. Set to null to disable this behavior. [default \"webpack.config.js\"]",
184
+ "description": "Path to an existing webpack config, which Cosmos will reuse to build your code. Set to null to disable this behavior. [default: \"webpack.config.js\"]",
166
185
  "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }]
167
186
  },
168
187
  "overridePath": {
169
- "description": "Path to a user module that customizes the webpack config used by Cosmos. Set to null to disable this behavior. [default \"webpack.override.js\"]",
188
+ "description": "Path to a user module that customizes the webpack config used by Cosmos. Set to null to disable this behavior. [default: \"webpack.override.js\"]",
170
189
  "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }]
171
190
  },
172
191
  "includeHashInOutputFilename": {
@@ -26,7 +26,10 @@ export const openFileServerPlugin = {
26
26
  // when the editor app is already open, but is favorable because it can
27
27
  // open a code file on a specific line & column.
28
28
  .catch(err => open(absFilePath))
29
- .catch(err => res.status(500).send('Failed to open file'))
29
+ .catch(err => {
30
+ console.log(err);
31
+ res.status(500).send('Failed to open file');
32
+ })
30
33
  .then(() => res.send());
31
34
  });
32
35
  },
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import { resolveSilent } from '../utils/resolveSilent.js';
3
3
  export const pluginEndpointServerPlugin = {
4
4
  name: 'pluginEndpoint',
5
- devServer({ cosmosConfig, expressApp }) {
5
+ devServer({ expressApp }) {
6
6
  expressApp.get('/_plugin/*.js', (req, res) => {
7
7
  const modulePath = req.params['0'];
8
8
  if (!modulePath) {
@@ -1,4 +1,4 @@
1
- import glob from 'glob';
1
+ import { globSync } from 'glob';
2
2
  import { readCosmosPluginConfig } from './readCosmosPluginConfig.js';
3
3
  export async function findCosmosPluginConfigs({ rootDir, relativePaths, ignore, }) {
4
4
  const configPaths = findCosmosPluginConfigPaths(rootDir, ignore);
@@ -6,7 +6,7 @@ export async function findCosmosPluginConfigs({ rootDir, relativePaths, ignore,
6
6
  }
7
7
  const defaultIgnore = ['**/node_modules/**'];
8
8
  function findCosmosPluginConfigPaths(rootDir, ignore = defaultIgnore) {
9
- return glob.sync('**/cosmos.plugin.json', {
9
+ return globSync('**/cosmos.plugin.json', {
10
10
  cwd: rootDir,
11
11
  absolute: true,
12
12
  ignore,
@@ -1,8 +1,8 @@
1
- import glob from 'glob';
1
+ import { globSync } from 'glob';
2
2
  import micromatch from 'micromatch';
3
3
  import { getDecoratorPatterns, getFixturePatterns } from './shared.js';
4
4
  export function findUserModulePaths({ rootDir, fixturesDir, fixtureFileSuffix, ignore, }) {
5
- const paths = glob.sync('**/*', {
5
+ const paths = globSync('**/*', {
6
6
  cwd: rootDir,
7
7
  absolute: true,
8
8
  ignore,
@@ -1,5 +1,5 @@
1
1
  export declare function importModule<T>(filePath: string): Promise<T>;
2
2
  export declare function importJson<T>(filePath: string): Promise<T>;
3
- export declare function moduleExists(moduleId: string): boolean | "";
3
+ export declare function moduleExists(moduleId: string): boolean;
4
4
  export declare function fileExists(filePath: string): boolean;
5
5
  export declare function dirExists(dirPath: string): boolean;
package/dist/utils/fs.js CHANGED
@@ -13,7 +13,8 @@ export async function importJson(filePath) {
13
13
  // Better than fs.exists because it works for module paths without an extension
14
14
  export function moduleExists(moduleId) {
15
15
  try {
16
- return resolve(moduleId) && true;
16
+ resolve(moduleId);
17
+ return true;
17
18
  }
18
19
  catch (err) {
19
20
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cosmos",
3
- "version": "6.0.0-alpha.14",
3
+ "version": "6.0.0-alpha.16",
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",
@@ -10,16 +10,16 @@
10
10
  "@skidding/launch-editor": "^2.2.3",
11
11
  "chokidar": "^3.5.3",
12
12
  "express": "^4.18.2",
13
- "glob": "^8.1.0",
13
+ "glob": "^10.2.2",
14
14
  "http-proxy-middleware": "^2.0.6",
15
15
  "lodash-es": "^4.17.21",
16
16
  "micromatch": "^4.0.5",
17
17
  "open": "^8.4.2",
18
- "pem": "^1.14.6",
18
+ "pem": "^1.14.7",
19
19
  "pkg-up": "^4.0.0",
20
- "react-cosmos-core": "6.0.0-alpha.14",
21
- "react-cosmos-ui": "6.0.0-alpha.14",
22
- "ws": "^8.12.1",
20
+ "react-cosmos-core": "6.0.0-alpha.16",
21
+ "react-cosmos-ui": "6.0.0-alpha.16",
22
+ "ws": "^8.13.0",
23
23
  "yargs": "^17.7.1"
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": "ed13194534675df091da3ceaef4202572ddeed12"
30
+ "gitHead": "2a4ec3107303a4a47e09d63e557cee5f8cceb972"
31
31
  }