Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-cosmos-core

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cosmos-core - npm Package Compare versions

Comparing version 6.1.2-canary.fbe721b.0 to 6.2.0

dist/utils/data.d.ts

3

dist/fixtureState/createValues.d.ts

@@ -1,3 +0,4 @@

import { FixtureStateValue, FixtureStateValues, ObjectData } from './types.js';
import { ObjectData } from '../utils/data.js';
import { FixtureStateValue, FixtureStateValues } from './types.js';
export declare function createValues(obj: ObjectData): FixtureStateValues;
export declare function createValue(data: unknown): FixtureStateValue;
import { isElement } from 'react-is';
import { isArray, isObject, isPrimitiveData } from './shared.js';
import { isArray, isObject, isPrimitiveData, } from '../utils/data.js';
export function createValues(obj) {

@@ -35,2 +35,5 @@ const values = {};

function stringifyUnserializableData(data) {
if (typeof data === 'function') {
return stringifyFunction(data);
}
// NOTE: We used to use the react-element-to-jsx-string package but it added

@@ -41,1 +44,10 @@ // bloat and complicated ESM support. We might go back to something similar

}
const emptyFnRegex = /^\(\) => \{.+\}$/s;
function stringifyFunction(data) {
// This clears space from empty function bodies. It originates as a fix for
// Vitest tests that needed to create deterministic fixture state values, but
// it cleans up how stringified functions look in the Cosmos UI as well.
// Potential improvement: Remove all extra indentation from function bodies
// to match the root-level function header indentation.
return String(data).replace(emptyFnRegex, '() => {}');
}

@@ -1,3 +0,4 @@

import { FixtureStateValue, FixtureStateValues, ObjectData } from './types.js';
import { ObjectData } from '../utils/data.js';
import { FixtureStateValue, FixtureStateValues } from './types.js';
export declare function extendWithValues(obj: ObjectData, values: FixtureStateValues): ObjectData;
export declare function extendWithValue(data: unknown, value: FixtureStateValue): unknown;

@@ -1,2 +0,2 @@

import { isArray, isObject } from './shared.js';
import { isArray, isObject } from '../utils/data.js';
// Use fixture state for serializable values and fall back to base values

@@ -3,0 +3,0 @@ export function extendWithValues(obj, values) {

@@ -0,1 +1,2 @@

import { PrimitiveData } from '../utils/data.js';
import { StateUpdater } from '../utils/state.js';

@@ -11,5 +12,2 @@ export type FixtureDecoratorId = string;

};
export type PrimitiveData = string | number | boolean | null | undefined;
export type ObjectData = Record<string, unknown>;
export type ArrayData = unknown[];
export type FixtureStatePrimitiveValue = {

@@ -16,0 +14,0 @@ type: 'primitive';

@@ -33,9 +33,10 @@ export * from './fixtureState/classState.js';

export * from './utils/array.js';
export * from './utils/data.js';
export * from './utils/keys.js';
export * from './utils/queryString.js';
export * from './utils/react/ClassStateMock.js';
export * from './utils/react/areNodesEqual.js';
export * from './utils/react/DelayRender.js';
export * from './utils/react/areNodesEqual.js';
export * from './utils/react/getComponentName.js';
export * from './utils/react/isReactElement.js';
export * from './utils/serializable.js';
export * from './utils/state.js';

@@ -42,0 +43,0 @@ export * from './utils/string.js';

@@ -33,9 +33,10 @@ export * from './fixtureState/classState.js';

export * from './utils/array.js';
export * from './utils/data.js';
export * from './utils/keys.js';
export * from './utils/queryString.js';
export * from './utils/react/ClassStateMock.js';
export * from './utils/react/areNodesEqual.js';
export * from './utils/react/DelayRender.js';
export * from './utils/react/areNodesEqual.js';
export * from './utils/react/getComponentName.js';
export * from './utils/react/isReactElement.js';
export * from './utils/serializable.js';
export * from './utils/state.js';

@@ -42,0 +43,0 @@ export * from './utils/string.js';

@@ -61,2 +61,3 @@ import { FixtureState } from '../fixtureState/types.js';

fixture: FixtureListItem;
fixtureOptions: {};
};

@@ -63,0 +64,0 @@ };

@@ -8,2 +8,3 @@ import { ComponentType, ReactNode } from 'react';

default: FixtureExport<FixtureType>;
options?: {};
};

@@ -22,8 +23,9 @@ type ModuleWrapper<ModuleType> = {

export type LazyReactFixtureWrapper = LazyModuleWrapper<ReactFixtureModule>;
export type ReactDecoratorProps = {
export type DecoratorProps<T = {}> = {
children: ReactNode;
options: T;
};
export type ReactDecorator = ComponentType<ReactDecoratorProps>;
export type ReactDecorator<T = {}> = ComponentType<DecoratorProps<T>>;
export type ReactDecoratorModule = {
default: ReactDecorator;
default: ReactDecorator<any> | ReactDecorator<any>[];
};

@@ -30,0 +32,0 @@ export type ReactDecoratorWrapper = ModuleWrapper<ReactDecoratorModule>;

{
"name": "react-cosmos-core",
"version": "6.1.2-canary.fbe721b.0+fbe721b",
"version": "6.2.0",
"description": "React Cosmos Core",

@@ -13,5 +13,5 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-core",

"lodash-es": "4.17.21",
"react-is": "18.2.0"
"react-is": "18.3.1"
},
"gitHead": "fbe721b177adcb666317b6d1f4e4890d85de269b"
"gitHead": "965bf0e13230324699560be6eabb642c51c6d945"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc