react-cosmos-core 6.1.1 → 6.1.2-canary.4cc91ba.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,5 +1,6 @@
1
1
  import { get, set } from 'lodash-es';
2
2
  import { addTreeNodeChild } from '../../utils/tree.js';
3
+ import { removeFixtureNameExtension } from '../fixtureUtils.js';
3
4
  export function createRawFixtureTree(fixtures) {
4
5
  const rootNode = {
5
6
  data: { type: 'fileDir' },
@@ -37,9 +38,6 @@ function parseFixturePath(fixturePath) {
37
38
  fileName: removeFixtureNameExtension(rawFixtureName),
38
39
  };
39
40
  }
40
- function removeFixtureNameExtension(fixtureName) {
41
- return fixtureName.replace(/\.(js|jsx|ts|tsx|md|mdx)$/, '');
42
- }
43
41
  function injectNode(rootNode, parents, childName, childNode) {
44
42
  if (parents.length === 0)
45
43
  return addTreeNodeChild(rootNode, childName, childNode);
@@ -1,3 +1,4 @@
1
+ import { removeFixtureNameSuffix } from '../fixtureUtils.js';
1
2
  export function hideFixtureSuffix(treeNode, suffix) {
2
3
  const { children } = treeNode;
3
4
  if (!children)
@@ -19,6 +20,3 @@ export function hideFixtureSuffix(treeNode, suffix) {
19
20
  }, {}),
20
21
  };
21
22
  }
22
- function removeFixtureNameSuffix(fixtureNameWithoutExtension, suffix) {
23
- return fixtureNameWithoutExtension.replace(new RegExp(`\\.${suffix}$`), '');
24
- }
@@ -0,0 +1,2 @@
1
+ export declare function removeFixtureNameExtension(fixtureName: string): string;
2
+ export declare function removeFixtureNameSuffix(fixtureNameWithoutExtension: string, suffix: string): string;
@@ -0,0 +1,6 @@
1
+ export function removeFixtureNameExtension(fixtureName) {
2
+ return fixtureName.replace(/\.(js|jsx|ts|tsx|md|mdx)$/, '');
3
+ }
4
+ export function removeFixtureNameSuffix(fixtureNameWithoutExtension, suffix) {
5
+ return fixtureNameWithoutExtension.replace(new RegExp(`\\.${suffix}$`), '');
6
+ }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './fixtureState/propsTypes.js';
9
9
  export * from './fixtureState/types.js';
10
10
  export * from './fixtureState/viewport.js';
11
11
  export * from './fixtureTree/createFixtureTree/index.js';
12
+ export * from './fixtureTree/fixtureUtils.js';
12
13
  export * from './fixtureTree/flattenFixtureTree.js';
13
14
  export * from './fixtureTree/types.js';
14
15
  export * from './message/serverMessage.js';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from './fixtureState/propsTypes.js';
9
9
  export * from './fixtureState/types.js';
10
10
  export * from './fixtureState/viewport.js';
11
11
  export * from './fixtureTree/createFixtureTree/index.js';
12
+ export * from './fixtureTree/fixtureUtils.js';
12
13
  export * from './fixtureTree/flattenFixtureTree.js';
13
14
  export * from './fixtureTree/types.js';
14
15
  export * from './message/serverMessage.js';
@@ -1,9 +1,10 @@
1
1
  import { CosmosCommand } from '../server/serverTypes.js';
2
2
  import { FixtureId } from '../userModules/fixtureTypes.js';
3
- export declare function createRendererUrl(rendererUrl: string, fixtureId?: FixtureId, locked?: boolean): string;
4
- export declare function pickRendererUrl(rendererUrl: undefined | null | string | {
3
+ export type CosmosRendererUrl = null | string | {
5
4
  dev: string;
6
5
  export: string;
7
- }, command: CosmosCommand): null | string;
6
+ };
7
+ export declare function createRendererUrl(rendererUrl: string, fixtureId?: FixtureId, locked?: boolean): string;
8
+ export declare function pickRendererUrl(rendererUrl: undefined | CosmosRendererUrl, command: CosmosCommand): null | string;
8
9
  export declare function encodeRendererUrlFixture(fixtureId: FixtureId): string;
9
10
  export declare function decodeRendererUrlFixture(fixture: string): FixtureId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cosmos-core",
3
- "version": "6.1.1",
3
+ "version": "6.1.2-canary.4cc91ba.0+4cc91ba",
4
4
  "description": "React Cosmos Core",
5
5
  "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-core",
6
6
  "license": "MIT",
@@ -12,5 +12,5 @@
12
12
  "lodash-es": "4.17.21",
13
13
  "react-is": "18.2.0"
14
14
  },
15
- "gitHead": "f83799a26584a3f34914ce4ebf5c427df1df3c25"
15
+ "gitHead": "4cc91ba199e81a366a8bf8100c26a60d630f2a4e"
16
16
  }