Socket
Socket
Sign inDemoInstall

@storybook/addons

Package Overview
Dependencies
Maintainers
12
Versions
1495
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addons - npm Package Compare versions

Comparing version 4.0.0-alpha.1 to 4.0.0-alpha.2

dist/storybook-channel-mock.js

29

dist/index.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.AddonStore = undefined;
exports.AddonStore = exports.mockChannel = undefined;

@@ -21,4 +21,15 @@ var _keys = require('babel-runtime/core-js/object/keys');

var _global = require('global');
var _global2 = _interopRequireDefault(_global);
var _storybookChannelMock = require('./storybook-channel-mock');
var _storybookChannelMock2 = _interopRequireDefault(_storybookChannelMock);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Resolves to window in browser and to global in node
exports.mockChannel = _storybookChannelMock2.default;
var AddonStore = exports.AddonStore = function () {

@@ -38,4 +49,3 @@ function AddonStore() {

value: function getChannel() {
// this.channel should get overwritten by setChannel if package versions are
// correct and AddonStore is a proper singleton. If not, throw.
// this.channel should get overwritten by setChannel. If it wasn't called (e.g. in non-browser environment), throw.
if (!this.channel) {

@@ -101,2 +111,13 @@ throw new Error('Accessing nonexistent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel');

exports.default = new AddonStore();
// Enforce addons store to be a singleton
var KEY = '__STORYBOOK_ADDONS';
function getAddonsStore() {
if (!_global2.default[KEY]) {
_global2.default[KEY] = new AddonStore();
}
return _global2.default[KEY];
}
exports.default = getAddonsStore();
{
"name": "@storybook/addons",
"version": "4.0.0-alpha.1",
"version": "4.0.0-alpha.2",
"description": "Storybook addons store",

@@ -21,3 +21,7 @@ "keywords": [

"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/channels": "4.0.0-alpha.2",
"global": "^4.3.2"
}
}

@@ -0,1 +1,6 @@

// Resolves to window in browser and to global in node
import global from 'global';
export mockChannel from './storybook-channel-mock';
export class AddonStore {

@@ -11,4 +16,3 @@ constructor() {

getChannel() {
// this.channel should get overwritten by setChannel if package versions are
// correct and AddonStore is a proper singleton. If not, throw.
// this.channel should get overwritten by setChannel. If it wasn't called (e.g. in non-browser environment), throw.
if (!this.channel) {

@@ -61,2 +65,11 @@ throw new Error(

export default new AddonStore();
// Enforce addons store to be a singleton
const KEY = '__STORYBOOK_ADDONS';
function getAddonsStore() {
if (!global[KEY]) {
global[KEY] = new AddonStore();
}
return global[KEY];
}
export default getAddonsStore();
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