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

react-cosmos-shared

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cosmos-shared - npm Package Compare versions

Comparing version 4.7.0-4 to 4.7.0-5

83

dist/fixtures-format.js

@@ -1,38 +0,27 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getNormalizedFixtureModules = getNormalizedFixtureModules;
exports.getOldSchoolFixturesFromNewStyleComponents = getOldSchoolFixturesFromNewStyleComponents;
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _objectSpread4 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectSpread"));
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
var _extends4 = require('babel-runtime/helpers/extends');
var _set = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/set"));
var _extends5 = _interopRequireDefault(_extends4);
var _importModule = require("./import-module");
var _keys = require('babel-runtime/core-js/object/keys');
var _keys2 = _interopRequireDefault(_keys);
var _set = require('babel-runtime/core-js/set');
var _set2 = _interopRequireDefault(_set);
exports.getNormalizedFixtureModules = getNormalizedFixtureModules;
exports.getOldSchoolFixturesFromNewStyleComponents = getOldSchoolFixturesFromNewStyleComponents;
var _importModule = require('./import-module');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Old fixtures don't have a `component` property. To support both old & new

@@ -45,14 +34,11 @@ // fixtures simultaneously, old style fixtures are altered on the fly by

var deprecatedComponentModules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var alteredFixtures = new _set2.default();
var invalidFixtures = new _set2.default();
var modules = (0, _keys2.default)(fixtureModules).reduce(function (acc, next) {
var fixtureModule = (0, _importModule.importModule)(fixtureModules[next]);
// Component seems to be up to date, no alteration needed
var alteredFixtures = new _set.default();
var invalidFixtures = new _set.default();
var modules = (0, _keys.default)(fixtureModules).reduce(function (acc, next) {
var fixtureModule = (0, _importModule.importModule)(fixtureModules[next]); // Component seems to be up to date, no alteration needed
// Warn: Since multi fixtures weren't supported before v3, we assume multi
// fixtures (Array default export) to be legit new style fixtures
if (Array.isArray(fixtureModule) || fixtureModule.component) {
return (0, _extends5.default)({}, acc, (0, _defineProperty3.default)({}, next, fixtureModule));
if ((0, _isArray.default)(fixtureModule) || fixtureModule.component) {
return (0, _objectSpread4.default)({}, acc, (0, _defineProperty2.default)({}, next, fixtureModule));
}

@@ -64,4 +50,5 @@

});
if (!fixtureFile) {
throw new Error('Missing fixture file for path: ' + next);
throw new Error("Missing fixture file for path: ".concat(next));
}

@@ -71,7 +58,7 @@

var _components = (0, _slicedToArray3.default)(components, 1),
var _components = (0, _slicedToArray2.default)(components, 1),
component1 = _components[0];
if (!component1 || !component1.filePath) {
throw new Error('Missing component data for fixture path: ' + next);
throw new Error("Missing component data for fixture path: ".concat(next));
}

@@ -81,6 +68,4 @@

var component = (0, _importModule.importModule)(componentModule);
alteredFixtures.add(next);
return (0, _extends5.default)({}, acc, (0, _defineProperty3.default)({}, next, (0, _extends5.default)({}, fixtureModule, {
return (0, _objectSpread4.default)({}, acc, (0, _defineProperty2.default)({}, next, (0, _objectSpread4.default)({}, fixtureModule, {
component: component

@@ -90,3 +75,2 @@ })));

invalidFixtures.add(next);
return acc;

@@ -97,3 +81,3 @@ }

if (alteredFixtures.size > 0) {
console.log('[Cosmos] Successfully read ' + alteredFixtures.size + ' old school fixtures:');
console.log("[Cosmos] Successfully read ".concat(alteredFixtures.size, " old school fixtures:"));
console.log(getPrintableListFromPaths(alteredFixtures));

@@ -103,3 +87,3 @@ }

if (invalidFixtures.size > 0) {
console.warn('[Cosmos] Failed to read ' + invalidFixtures.size + ' fixtures:');
console.warn("[Cosmos] Failed to read ".concat(invalidFixtures.size, " fixtures:"));
console.warn(getPrintableListFromPaths(invalidFixtures));

@@ -114,5 +98,3 @@ }

return modules;
}
// TEMP: The new data structures are ready on the server, but are not
} // TEMP: The new data structures are ready on the server, but are not
// yet adopted on the client. This conversion will be removed when the Loader

@@ -124,7 +106,5 @@ // and CP start working with the types from react-cosmos-voyager2

var fixtures = {};
newStyleComponents.forEach(function (c) {
var componentName = getObjectPath(c);
fixtures[componentName] = {};
c.fixtures.forEach(function (f) {

@@ -135,3 +115,2 @@ var fixtureName = getObjectPath(f);

});
return fixtures;

@@ -141,4 +120,4 @@ }

function getPrintableListFromPaths(set) {
return [].concat((0, _toConsumableArray3.default)(set.values())).map(function (f) {
return '- ' + f;
return (0, _toConsumableArray2.default)(set.values()).map(function (f) {
return "- ".concat(f);
}).join('\n');

@@ -148,3 +127,3 @@ }

function getObjectPath(obj) {
return obj.namespace ? obj.namespace + '/' + obj.name : obj.name;
return obj.namespace ? "".concat(obj.namespace, "/").concat(obj.name) : obj.name;
}

@@ -7,2 +7,3 @@ "use strict";

exports.importModule = importModule;
/**

@@ -15,3 +16,2 @@ * Normalize exported value of ES6/CommonJS modules

// https://github.com/esnext/es6-module-transpiler/issues/86
if (module.__esModule) {

@@ -18,0 +18,0 @@ return moduleName && module[moduleName] || module.default;

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

'use strict';
"use strict";

@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {

});
exports.proxyPropTypes = undefined;
exports.proxyPropTypes = void 0;
var _propTypes = require('prop-types');
var _propTypes = require("prop-types");
var proxyPropTypes = exports.proxyPropTypes = {
var proxyPropTypes = {
nextProxy: (0, _propTypes.shape)({

@@ -19,2 +19,3 @@ value: _propTypes.func,

onFixtureUpdate: _propTypes.func.isRequired
};
};
exports.proxyPropTypes = proxyPropTypes;

@@ -7,2 +7,3 @@ "use strict";

exports.moduleExists = moduleExists;
function moduleExists(modulePath) {

@@ -9,0 +10,0 @@ // This is better than fs.existsSync because it works for paths without .js

@@ -1,3 +0,5 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,20 +10,14 @@ value: true

var _path = require('path');
var _path = require("path");
var _slash = require('slash');
var _slash = _interopRequireDefault(require("slash"));
var _slash2 = _interopRequireDefault(_slash);
var _resolveFrom = require("resolve-from");
var _resolveFrom = require('resolve-from');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveUserPath(rootPath, userPath) {
// Convert Windows backslash paths to slash paths
return (0, _slash2.default)(
// An absolute path is already resolved
(0, _path.isAbsolute)(userPath) ? userPath : (0, _resolveFrom.silent)(rootPath, userPath) ||
// Final attempt to resolve path, for when relative paths that don't
return (0, _slash.default)( // An absolute path is already resolved
(0, _path.isAbsolute)(userPath) ? userPath : (0, _resolveFrom.silent)(rootPath, userPath) || // Final attempt to resolve path, for when relative paths that don't
// start with ./ and for output file paths
(0, _path.join)(rootPath, userPath));
}

@@ -1,3 +0,5 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,13 +10,18 @@ value: true

var _path = require('path');
var _path = require("path");
var _slash2 = require('slash');
var _slash2 = _interopRequireDefault(require("slash"));
var _slash3 = _interopRequireDefault(_slash2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Convert Windows backslash paths to slash paths
// Convert Windows backslash paths to slash paths.
// Context: Node uses appropriate path separators based on the platform it runs
// on. Forward slash on Unix and backward slash on Windows.
// So why normalize slashes if Node takes care of this abstraction?
// Because we use globs often. And some implementations only work with forward
// slashes: https://github.com/isaacs/node-glob#windows
// Initial encounter: https://github.com/react-cosmos/react-cosmos/issues/288
// For further study: https://github.com/micromatch/micromatch#backslashes
// Node supports either on Windows, anyway.
// https://nodejs.org/api/path.html#path_path_win32
function slash() {
return arguments.length > 1 ? (0, _slash3.default)(_path.join.apply(undefined, arguments)) : (0, _slash3.default)(arguments.length <= 0 ? undefined : arguments[0]);
return arguments.length > 1 ? (0, _slash2.default)(_path.join.apply(void 0, arguments)) : (0, _slash2.default)(arguments.length <= 0 ? undefined : arguments[0]);
}

@@ -1,18 +0,15 @@

'use strict';
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
var _keys = require('babel-runtime/core-js/object/keys');
var _keys2 = _interopRequireDefault(_keys);
exports.splitUnserializableParts = splitUnserializableParts;
var _lodash = require('lodash.isplainobject');
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
var _lodash2 = _interopRequireDefault(_lodash);
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _lodash = _interopRequireDefault(require("lodash.isplainobject"));

@@ -22,8 +19,7 @@ function splitUnserializableParts(obj) {

var unserializable = {};
(0, _keys2.default)(obj).forEach(function (key) {
(0, _keys.default)(obj).forEach(function (key) {
if (isSerializable(obj[key])) {
serializable[key] = obj[key];
} else if (key === 'props' && (0, _lodash2.default)(obj[key])) {
(0, _keys2.default)(obj.props).forEach(function (propKey) {
} else if (key === 'props' && (0, _lodash.default)(obj[key])) {
(0, _keys.default)(obj.props).forEach(function (propKey) {
var propVal = obj.props[propKey];

@@ -35,2 +31,3 @@ var propHome = isSerializable(propVal) ? serializable : unserializable;

}
propHome.props[propKey] = propVal;

@@ -42,4 +39,6 @@ });

});
return { serializable: serializable, unserializable: unserializable };
return {
serializable: serializable,
unserializable: unserializable
};
}

@@ -52,3 +51,3 @@

if (!(0, _lodash2.default)(obj) && !Array.isArray(obj)) {
if (!(0, _lodash.default)(obj) && !(0, _isArray.default)(obj)) {
return false;

@@ -58,4 +57,3 @@ }

var serializable = true;
(0, _keys2.default)(obj).forEach(function (key) {
(0, _keys.default)(obj).forEach(function (key) {
if (!isSerializable(obj[key])) {

@@ -65,4 +63,3 @@ serializable = false;

});
return serializable;
}
{
"name": "react-cosmos-shared",
"version": "4.7.0-4",
"version": "4.7.0-5",
"description": "Libs shared between React Cosmos packages",

@@ -14,3 +14,3 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/master/packages/react-cosmos-shared",

},
"gitHead": "66cc3f616083082f4bc569a2edd59b580193cb82"
"gitHead": "068cb659266c26edcc8cae6c8e906eacd5e1d723"
}
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