From 23da639ffc85501466ae0029fcc38a17208e9e29 Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Sun, 16 Feb 2020 00:30:47 +0200 Subject: [PATCH 1/6] added ability to skip dispose call in clientApi --- lib/client-api/src/client_api.test.ts | 92 +++++++++++++++++---------- lib/client-api/src/client_api.ts | 14 +++- lib/client-api/src/types.ts | 1 + 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/lib/client-api/src/client_api.test.ts b/lib/client-api/src/client_api.test.ts index 3d5454eb7bd4..c6e86cd0168f 100644 --- a/lib/client-api/src/client_api.test.ts +++ b/lib/client-api/src/client_api.test.ts @@ -5,11 +5,11 @@ import ClientApi from './client_api'; import ConfigApi from './config_api'; import StoryStore from './story_store'; -const getContext = (() => decorateStory => { +const getContext = ({ decorateStory = undefined, disableAddStoryDispose = false } = {}) => { const channel = mockChannel(); addons.setChannel(channel); const storyStore = new StoryStore({ channel }); - const clientApi = new ClientApi({ storyStore, decorateStory }); + const clientApi = new ClientApi({ storyStore, decorateStory, disableAddStoryDispose }); const { clearDecorators } = clientApi; const configApi = new ConfigApi({ clearDecorators, storyStore, channel, clientApi }); @@ -19,7 +19,7 @@ const getContext = (() => decorateStory => { channel, clientApi, }; -})(); +}; jest.mock('@storybook/client-logger', () => ({ logger: { warn: jest.fn(), log: jest.fn() }, @@ -27,13 +27,13 @@ jest.mock('@storybook/client-logger', () => ({ describe('preview.client_api', () => { afterEach(() => { - const { clientApi } = getContext(undefined); + const { clientApi } = getContext(); clientApi.clearDecorators(); clientApi.clearParameters(); }); describe('setAddon', () => { it('should register addons', () => { - const { clientApi } = getContext(undefined); + const { clientApi } = getContext(); let data; clientApi.setAddon({ @@ -47,7 +47,7 @@ describe('preview.client_api', () => { }); it('should not remove previous addons', () => { - const { clientApi } = getContext(undefined); + const { clientApi } = getContext(); const data = []; clientApi.setAddon({ @@ -70,7 +70,7 @@ describe('preview.client_api', () => { }); it('should call with the clientApi context', () => { - const { clientApi } = getContext(undefined); + const { clientApi } = getContext(); let data; clientApi.setAddon({ @@ -84,7 +84,7 @@ describe('preview.client_api', () => { }); it('should be able to access addons added previously', () => { - const { clientApi } = getContext(undefined); + const { clientApi } = getContext(); let data; clientApi.setAddon({ @@ -104,7 +104,7 @@ describe('preview.client_api', () => { }); it('should be able to access the current kind', () => { - const { clientApi } = getContext(undefined); + const { clientApi } = getContext(); const kind = 'dfdwf3e3'; let data; @@ -121,7 +121,7 @@ describe('preview.client_api', () => { describe('addParameters', () => { it('should add parameters', () => { - const { clientApi, storyStore } = getContext(undefined); + const { clientApi, storyStore } = getContext(); const { storiesOf } = clientApi; clientApi.addParameters({ a: 1 }); @@ -135,7 +135,7 @@ describe('preview.client_api', () => { }); it('should merge options', () => { - const { clientApi, storyStore } = getContext(undefined); + const { clientApi, storyStore } = getContext(); const { storiesOf } = clientApi; clientApi.addParameters({ options: { a: '1' } }); @@ -151,7 +151,7 @@ describe('preview.client_api', () => { }); it('should override specific properties in options', () => { - const { clientApi, storyStore } = getContext(undefined); + const { clientApi, storyStore } = getContext(); const { storiesOf } = clientApi; clientApi.addParameters({ backgrounds: ['value'], options: { a: '1', b: '3' } }); @@ -169,7 +169,7 @@ describe('preview.client_api', () => { }); it('should replace top level properties and override specific properties in options', () => { - const { clientApi, storyStore } = getContext(undefined); + const { clientApi, storyStore } = getContext(); const { storiesOf } = clientApi; clientApi.addParameters({ backgrounds: ['value'], options: { a: '1', b: '3' } }); @@ -187,7 +187,7 @@ describe('preview.client_api', () => { }); it('should deep merge in options', () => { - const { clientApi, storyStore } = getContext(undefined); + const { clientApi, storyStore } = getContext(); const { storiesOf } = clientApi; clientApi.addParameters({ options: { a: '1', b: '2', theming: { c: '3' } } }); @@ -208,7 +208,7 @@ describe('preview.client_api', () => { const { clientApi: { storiesOf }, storyStore, - } = getContext(undefined); + } = getContext(); storiesOf('kind', module) .addDecorator(fn => `aa-${fn()}`) @@ -221,7 +221,7 @@ describe('preview.client_api', () => { const { clientApi: { addDecorator, storiesOf }, storyStore, - } = getContext(undefined); + } = getContext(); addDecorator(fn => `bb-${fn()}`); @@ -235,7 +235,7 @@ describe('preview.client_api', () => { const { clientApi: { addDecorator, storiesOf }, storyStore, - } = getContext(undefined); + } = getContext(); addDecorator(fn => `aa-${fn()}`); @@ -250,7 +250,7 @@ describe('preview.client_api', () => { const { clientApi: { storiesOf }, storyStore, - } = getContext(undefined); + } = getContext(); storiesOf('kind', module) .addDecorator(fn => `aa-${fn()}`) @@ -264,7 +264,7 @@ describe('preview.client_api', () => { const { clientApi: { storiesOf }, storyStore, - } = getContext(undefined); + } = getContext(); storiesOf('kind', module) .addDecorator((fn, { kind, name }) => `${kind}-${name}-${fn()}`) @@ -277,7 +277,7 @@ describe('preview.client_api', () => { describe('clearDecorators', () => { it('should remove all global decorators', () => { - const { clientApi, storyStore } = getContext(undefined); + const { clientApi, storyStore } = getContext(); const { storiesOf } = clientApi; clientApi.addDecorator(() => 'foo'); @@ -294,7 +294,7 @@ describe('preview.client_api', () => { it('should transform the storybook to an array with filenames', () => { const { clientApi: { getStorybook, storiesOf }, - } = getContext(undefined); + } = getContext(); let book; @@ -347,7 +347,7 @@ describe('preview.client_api', () => { it('returns values set via parameters', () => { const { clientApi: { getSeparators, storiesOf, addParameters }, - } = getContext(undefined); + } = getContext(); const options = { hierarchySeparator: /a/, hierarchyRootSeparator: 'b' }; addParameters({ options }); @@ -358,7 +358,7 @@ describe('preview.client_api', () => { it('returns old defaults if kind uses old separators', () => { const { clientApi: { getSeparators, storiesOf }, - } = getContext(undefined); + } = getContext(); storiesOf('kind|1', module).add('name 1', () => '1'); expect(getSeparators()).toEqual({ @@ -370,7 +370,7 @@ describe('preview.client_api', () => { it('returns new values if showRoots is set', () => { const { clientApi: { getSeparators, storiesOf, addParameters }, - } = getContext(undefined); + } = getContext(); addParameters({ options: { showRoots: false } }); storiesOf('kind|1', module).add('name 1', () => '1'); @@ -380,7 +380,7 @@ describe('preview.client_api', () => { it('returns new values if kind does not use old separators', () => { const { clientApi: { getSeparators, storiesOf }, - } = getContext(undefined); + } = getContext(); storiesOf('kind/1', module).add('name 1', () => '1'); expect(getSeparators()).toEqual({ hierarchySeparator: '/' }); @@ -390,7 +390,7 @@ describe('preview.client_api', () => { it('reads filename from module', () => { const { clientApi: { getStorybook, storiesOf }, - } = getContext(undefined); + } = getContext(); const fn = jest.fn(); storiesOf('kind', { id: 'foo.js' }).add('name', fn); @@ -414,7 +414,7 @@ describe('preview.client_api', () => { it('should stringify ids from module', () => { const { clientApi: { getStorybook, storiesOf }, - } = getContext(undefined); + } = getContext(); const fn = jest.fn(); storiesOf('kind', { id: 1211 }).add('name', fn); @@ -455,7 +455,7 @@ describe('preview.client_api', () => { const { storyStore, clientApi: { storiesOf }, - } = getContext(undefined); + } = getContext(); const module = new MockModule(); expect(storyStore.getRevision()).toEqual(0); @@ -470,7 +470,7 @@ describe('preview.client_api', () => { it('should replace a kind when the module reloads', () => { const { clientApi: { storiesOf, getStorybook }, - } = getContext(undefined); + } = getContext(); const module = new MockModule(); const stories = [jest.fn(), jest.fn()]; @@ -513,7 +513,7 @@ describe('preview.client_api', () => { const { clientApi: { storiesOf, getStorybook }, channel, - } = getContext(undefined); + } = getContext(); const module0 = new MockModule(); const module1 = new MockModule(); const module2 = new MockModule(); @@ -548,6 +548,32 @@ describe('preview.client_api', () => { expect(Object.values(args.stories).map(v => v.kind)).toEqual(['kind0', 'kind1', 'kind2']); expect(getStorybook().map(story => story.kind)).toEqual(['kind1', 'kind2']); }); + + it('should bind dispose inside add and soriesOf by default', () => { + const module = new MockModule(); + module.hot.dispose = jest.fn(); + + const { + clientApi: { storiesOf, getStorybook }, + } = getContext(); + + storiesOf('kind', module).add('story', jest.fn()); + + expect(module.hot.dispose.calls.length).toEqual(2); + }); + + it('should not bind dispose inside add when disableAddStoryDispose is true', () => { + const module = new MockModule(); + module.hot.dispose = jest.fn(); + + const { + clientApi: { storiesOf, getStorybook }, + } = getContext({ disableAddStoryDispose: true }); + + storiesOf('kind', module).add('story', jest.fn()); + + expect(module.hot.dispose.calls.length).toEqual(1); + }); }); describe('parameters', () => { @@ -555,7 +581,7 @@ describe('preview.client_api', () => { const { storyStore, clientApi: { storiesOf, addParameters }, - } = getContext(undefined); + } = getContext(); addParameters({ a: 'global', b: 'global', c: 'global' }); @@ -578,7 +604,7 @@ describe('preview.client_api', () => { const { storyStore, clientApi: { storiesOf, addParameters }, - } = getContext(undefined); + } = getContext(); addParameters({ addon1: 'global string value', @@ -638,7 +664,7 @@ describe('preview.client_api', () => { const { clientApi: { storiesOf, getStorybook }, - } = getContext(undefined); + } = getContext(); expect(getStorybook()).toEqual([]); diff --git a/lib/client-api/src/client_api.ts b/lib/client-api/src/client_api.ts index d5cf2685d105..86a68b63a2e3 100644 --- a/lib/client-api/src/client_api.ts +++ b/lib/client-api/src/client_api.ts @@ -86,10 +86,19 @@ export default class ClientApi { private _decorateStory: (storyFn: StoryFn, decorators: DecoratorFunction[]) => any; - constructor({ storyStore, decorateStory = defaultDecorateStory }: ClientApiParams) { + // React Native Fast refresh doesn't allow multiple dispose calls + private _disableAddStoryDispose: boolean; + + constructor({ + storyStore, + decorateStory = defaultDecorateStory, + disableAddStoryDispose, + }: ClientApiParams) { this._storyStore = storyStore; this._addons = {}; + this._disableAddStoryDispose = disableAddStoryDispose || false; + this._decorateStory = decorateStory; if (!storyStore) { @@ -206,7 +215,8 @@ export default class ClientApi { if (typeof storyName !== 'string') { throw new Error(`Invalid or missing storyName provided for a "${kind}" story.`); } - if (m && m.hot && m.hot.dispose) { + + if (!this._disableAddStoryDispose && m && m.hot && m.hot.dispose) { m.hot.dispose(() => { const { _storyStore } = this; _storyStore.remove(id); diff --git a/lib/client-api/src/types.ts b/lib/client-api/src/types.ts index fef374f91e0a..76cf4ad70d67 100644 --- a/lib/client-api/src/types.ts +++ b/lib/client-api/src/types.ts @@ -29,6 +29,7 @@ export interface StoreData { export interface ClientApiParams { storyStore: StoryStore; decorateStory?: (storyFn: any, decorators: any) => any; + disableAddStoryDispose?: boolean; } export type ClientApiReturnFn = (...args: any[]) => StoryApi; From 7753bfac8091b151be5ad79e9f7f2d3be6a759e3 Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Sun, 16 Feb 2020 09:29:32 +0200 Subject: [PATCH 2/6] updated config name, added comment, fixed tests --- lib/client-api/src/client_api.test.ts | 15 +++++++++------ lib/client-api/src/client_api.ts | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/client-api/src/client_api.test.ts b/lib/client-api/src/client_api.test.ts index c6e86cd0168f..27871fd67b49 100644 --- a/lib/client-api/src/client_api.test.ts +++ b/lib/client-api/src/client_api.test.ts @@ -5,11 +5,14 @@ import ClientApi from './client_api'; import ConfigApi from './config_api'; import StoryStore from './story_store'; -const getContext = ({ decorateStory = undefined, disableAddStoryDispose = false } = {}) => { +const getContext = ({ + decorateStory = undefined, + noStoryModuleAddMethodHotDispose = false, +} = {}) => { const channel = mockChannel(); addons.setChannel(channel); const storyStore = new StoryStore({ channel }); - const clientApi = new ClientApi({ storyStore, decorateStory, disableAddStoryDispose }); + const clientApi = new ClientApi({ storyStore, decorateStory, noStoryModuleAddMethodHotDispose }); const { clearDecorators } = clientApi; const configApi = new ConfigApi({ clearDecorators, storyStore, channel, clientApi }); @@ -559,20 +562,20 @@ describe('preview.client_api', () => { storiesOf('kind', module).add('story', jest.fn()); - expect(module.hot.dispose.calls.length).toEqual(2); + expect(module.hot.dispose.mock.calls.length).toEqual(2); }); - it('should not bind dispose inside add when disableAddStoryDispose is true', () => { + it('should not call `module.hot.dispose` inside add when noStoryModuleAddMethodHotDispose is true', () => { const module = new MockModule(); module.hot.dispose = jest.fn(); const { clientApi: { storiesOf, getStorybook }, - } = getContext({ disableAddStoryDispose: true }); + } = getContext({ noStoryModuleAddMethodHotDispose: true }); storiesOf('kind', module).add('story', jest.fn()); - expect(module.hot.dispose.calls.length).toEqual(1); + expect(module.hot.dispose.mock.calls.length).toEqual(1); }); }); diff --git a/lib/client-api/src/client_api.ts b/lib/client-api/src/client_api.ts index 86a68b63a2e3..f77bf21f0271 100644 --- a/lib/client-api/src/client_api.ts +++ b/lib/client-api/src/client_api.ts @@ -92,12 +92,12 @@ export default class ClientApi { constructor({ storyStore, decorateStory = defaultDecorateStory, - disableAddStoryDispose, + noStoryModuleAddMethodHotDispose, }: ClientApiParams) { this._storyStore = storyStore; this._addons = {}; - this._disableAddStoryDispose = disableAddStoryDispose || false; + this._disableAddStoryDispose = noStoryModuleAddMethodHotDispose || false; this._decorateStory = decorateStory; From b2e8d0d1087174b500470b3701de07f3b577e2c8 Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Sun, 16 Feb 2020 18:37:59 +0200 Subject: [PATCH 3/6] Update lib/client-api/src/client_api.test.ts Co-Authored-By: Tom Coleman --- lib/client-api/src/client_api.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client-api/src/client_api.test.ts b/lib/client-api/src/client_api.test.ts index 27871fd67b49..3a04eacce4fa 100644 --- a/lib/client-api/src/client_api.test.ts +++ b/lib/client-api/src/client_api.test.ts @@ -552,7 +552,7 @@ describe('preview.client_api', () => { expect(getStorybook().map(story => story.kind)).toEqual(['kind1', 'kind2']); }); - it('should bind dispose inside add and soriesOf by default', () => { + it('should call `module.hot.dispose` inside add and soriesOf by default', () => { const module = new MockModule(); module.hot.dispose = jest.fn(); From 9df7afce00f9f749a747791b5b3d53036baa3976 Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Sun, 16 Feb 2020 18:39:06 +0200 Subject: [PATCH 4/6] Update client_api.ts --- lib/client-api/src/client_api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client-api/src/client_api.ts b/lib/client-api/src/client_api.ts index f77bf21f0271..10fc2bbec3cc 100644 --- a/lib/client-api/src/client_api.ts +++ b/lib/client-api/src/client_api.ts @@ -87,7 +87,7 @@ export default class ClientApi { private _decorateStory: (storyFn: StoryFn, decorators: DecoratorFunction[]) => any; // React Native Fast refresh doesn't allow multiple dispose calls - private _disableAddStoryDispose: boolean; + private _noStoryModuleAddMethodHotDispose: boolean; constructor({ storyStore, @@ -97,7 +97,7 @@ export default class ClientApi { this._storyStore = storyStore; this._addons = {}; - this._disableAddStoryDispose = noStoryModuleAddMethodHotDispose || false; + this._noStoryModuleAddMethodHotDispose = noStoryModuleAddMethodHotDispose || false; this._decorateStory = decorateStory; @@ -216,7 +216,7 @@ export default class ClientApi { throw new Error(`Invalid or missing storyName provided for a "${kind}" story.`); } - if (!this._disableAddStoryDispose && m && m.hot && m.hot.dispose) { + if (!this._noStoryModuleAddMethodHotDispose && m && m.hot && m.hot.dispose) { m.hot.dispose(() => { const { _storyStore } = this; _storyStore.remove(id); From 83ec145b732c731f187c3cd521d2cc46bb6d9240 Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Wed, 19 Feb 2020 12:42:28 +0200 Subject: [PATCH 5/6] yarn.lock --- yarn.lock | 336 +----------------------------------------------------- 1 file changed, 1 insertion(+), 335 deletions(-) diff --git a/yarn.lock b/yarn.lock index 82ac4831e004..a845dcab33d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3368,19 +3368,6 @@ global "^4.3.2" util-deprecate "^1.0.2" -"@storybook/addons@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-6.0.0-alpha.11.tgz#2f9168f8ff9d19fff5b05981e86839c12dd84cc0" - integrity sha512-8HvQOnz/I6UclgqNtesPrrCGNXwa/3zVVuumCoSksIWWfnLbs7UIpC3PMGd1NDdZ4mhdIjhRA0FM255/ov3HIg== - dependencies: - "@storybook/api" "6.0.0-alpha.11" - "@storybook/channels" "6.0.0-alpha.11" - "@storybook/client-logger" "6.0.0-alpha.11" - "@storybook/core-events" "6.0.0-alpha.11" - core-js "^3.0.1" - global "^4.3.2" - util-deprecate "^1.0.2" - "@storybook/api@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.0.0-alpha.0.tgz#9b612f8c41fb8b1f9bbd3c990b5a1b3beb0eb82a" @@ -3407,32 +3394,6 @@ telejson "^3.2.0" util-deprecate "^1.0.2" -"@storybook/api@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.0.0-alpha.11.tgz#c4d11c4d69a481a6c540b0d008ff66f6150bc68b" - integrity sha512-sdzOaUppRNRSga3BxA6QnF1MfiDQHiaW1vHddbF8Cn6JD8Q9OtUZpLjJ+7IF61wodANln4fmMtiSE20WCer/jQ== - dependencies: - "@reach/router" "^1.2.1" - "@storybook/channels" "6.0.0-alpha.11" - "@storybook/client-logger" "6.0.0-alpha.11" - "@storybook/core-events" "6.0.0-alpha.11" - "@storybook/csf" "0.0.1" - "@storybook/router" "6.0.0-alpha.11" - "@storybook/theming" "6.0.0-alpha.11" - "@types/reach__router" "^1.2.3" - core-js "^3.0.1" - fast-deep-equal "^3.1.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - prop-types "^15.6.2" - react "^16.8.3" - semver "^6.0.0" - shallow-equal "^1.1.0" - store2 "^2.7.1" - telejson "^3.2.0" - util-deprecate "^1.0.2" - "@storybook/channel-postmessage@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-6.0.0-alpha.0.tgz#dec7245e9be7b1303c8bd60e664134a56639ae54" @@ -3444,17 +3405,6 @@ global "^4.3.2" telejson "^3.2.0" -"@storybook/channel-postmessage@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-6.0.0-alpha.11.tgz#16e032c5394714d0af3a70d144c8864d07b65b53" - integrity sha512-ylaoQFUx7tnv9ShmKmsAPTfENRSlOGNHyey6QkXMN9TOnBdfuTXL/KGSDOffU4U8WzeOdbJMeEiMlxcptpTamQ== - dependencies: - "@storybook/channels" "6.0.0-alpha.11" - "@storybook/client-logger" "6.0.0-alpha.11" - core-js "^3.0.1" - global "^4.3.2" - telejson "^3.2.0" - "@storybook/channel-websocket@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/channel-websocket/-/channel-websocket-6.0.0-alpha.0.tgz#81d10287250b76b0ab5856cb96c4827714f31875" @@ -3472,13 +3422,6 @@ dependencies: core-js "^3.0.1" -"@storybook/channels@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-6.0.0-alpha.11.tgz#d0562305f3abda28d77990653a3f0c1a800937a4" - integrity sha512-lUpHhEz+/fbnbijl6g507YgVKYo/oq2fHZPDQLGO7lGlPVrMpC4oM898sYwyfCIFWzuhF6nA9nltlfvCa3Ckog== - dependencies: - core-js "^3.0.1" - "@storybook/client-api@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-6.0.0-alpha.0.tgz#9a6766a9878ee1f41b35debd93d480fef50506c2" @@ -3502,29 +3445,6 @@ ts-dedent "^1.1.0" util-deprecate "^1.0.2" -"@storybook/client-api@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-6.0.0-alpha.11.tgz#92c1df63db8a4c025ac9ac8462e3ac46bb228ddc" - integrity sha512-+iiPy+pbGHkfevll6X1CUjiGEvpPYQQ+gyj43h6K5/X8ASOfZrR3mlrlNUO8zCj8/c4S9qpb2R2UpLxX3qsKyQ== - dependencies: - "@storybook/addons" "6.0.0-alpha.11" - "@storybook/channel-postmessage" "6.0.0-alpha.11" - "@storybook/channels" "6.0.0-alpha.11" - "@storybook/client-logger" "6.0.0-alpha.11" - "@storybook/core-events" "6.0.0-alpha.11" - "@storybook/csf" "0.0.1" - "@types/webpack-env" "^1.15.1" - core-js "^3.0.1" - eventemitter3 "^4.0.0" - global "^4.3.2" - is-plain-object "^3.0.0" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - stable "^0.1.8" - ts-dedent "^1.1.1" - util-deprecate "^1.0.2" - "@storybook/client-logger@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.0.0-alpha.0.tgz#c8dd075d5a4a78158f6acb8ace14cf0492f2af16" @@ -3532,39 +3452,6 @@ dependencies: core-js "^3.0.1" -"@storybook/client-logger@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.0.0-alpha.11.tgz#fe3e294e02578d9c397cb1ff28b39d6e546f1490" - integrity sha512-0LVv/0grLVvIJZa8XDEi91G4BEAzIbtiYL/luy9NYb4x+1stMZ51gcTonRJOSU1XdLFYoRC7vf0UJuPhXL385Q== - dependencies: - core-js "^3.0.1" - -"@storybook/components@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-6.0.0-alpha.11.tgz#a4dd7e2eb4852f2c3ea2833001da9103e389ad3e" - integrity sha512-0scYwtNAbEAanYixYjw2p6XePmHVtDs20ShecgT0DQHqeidDsiR/i33NFc5J5v92LKlCdAzexF/osCScwjQ6hA== - dependencies: - "@storybook/client-logger" "6.0.0-alpha.11" - "@storybook/theming" "6.0.0-alpha.11" - "@types/react-textarea-autosize" "^4.3.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - markdown-to-jsx "^6.9.1" - memoizerific "^1.11.3" - polished "^3.4.4" - popper.js "^1.14.7" - prop-types "^15.7.2" - react "^16.8.3" - react-dom "^16.8.3" - react-focus-lock "^2.1.0" - react-helmet-async "^1.0.2" - react-popper-tooltip "^2.8.3" - react-syntax-highlighter "^11.0.2" - react-textarea-autosize "^7.1.0" - simplebar-react "^1.0.0-alpha.6" - ts-dedent "^1.1.1" - "@storybook/core-events@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.0.0-alpha.0.tgz#a35d2f96f6d38aba080d7f5f1ec67799325728de" @@ -3572,97 +3459,6 @@ dependencies: core-js "^3.0.1" -"@storybook/core-events@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.0.0-alpha.11.tgz#58ec5590f4507099dc82088368239bc1de3407ff" - integrity sha512-iVZiR8qXGkyB+QGvD4iW4miU7sbFP3dIf0a0PEvqieKxgRQweQzlrVREhHVbbVE9MZu3Ytke9qNQiLGKStDScA== - dependencies: - core-js "^3.0.1" - -"@storybook/core@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/core/-/core-6.0.0-alpha.11.tgz#9413620cb1a560de7dd58e92a0634282fbbcaa1a" - integrity sha512-pNSgAD1M05FV43eigUb0jRf/jmxPLNx+bX+hEvHjF+hs/hRPgZbkhr4Od1DWfQbzGZ5HxnEauZR0FI1l+iScrg== - dependencies: - "@babel/plugin-proposal-class-properties" "^7.8.3" - "@babel/plugin-proposal-export-default-from" "^7.8.3" - "@babel/plugin-proposal-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - "@babel/plugin-transform-react-constant-elements" "^7.2.0" - "@babel/preset-env" "^7.8.4" - "@babel/preset-react" "^7.8.3" - "@babel/preset-typescript" "^7.8.3" - "@storybook/addons" "6.0.0-alpha.11" - "@storybook/channel-postmessage" "6.0.0-alpha.11" - "@storybook/client-api" "6.0.0-alpha.11" - "@storybook/client-logger" "6.0.0-alpha.11" - "@storybook/core-events" "6.0.0-alpha.11" - "@storybook/csf" "0.0.1" - "@storybook/node-logger" "6.0.0-alpha.11" - "@storybook/router" "6.0.0-alpha.11" - "@storybook/theming" "6.0.0-alpha.11" - "@storybook/ui" "6.0.0-alpha.11" - airbnb-js-shims "^2.2.1" - ansi-to-html "^0.6.11" - autoprefixer "^9.7.2" - babel-loader "^8.0.6" - babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-emotion "^10.0.20" - babel-plugin-macros "^2.8.0" - babel-preset-minify "^0.5.0 || 0.6.0-alpha.5" - boxen "^4.1.0" - case-sensitive-paths-webpack-plugin "^2.2.0" - chalk "^3.0.0" - cli-table3 "0.5.1" - commander "^4.0.1" - core-js "^3.0.1" - corejs-upgrade-webpack-plugin "^3.0.1" - css-loader "^3.0.0" - detect-port "^1.3.0" - dotenv-webpack "^1.7.0" - ejs "^3.0.1" - express "^4.17.0" - file-loader "^5.0.2" - file-system-cache "^1.0.5" - find-cache-dir "^3.0.0" - find-up "^4.1.0" - fs-extra "^8.0.1" - glob-base "^0.3.0" - global "^4.3.2" - html-webpack-plugin "^4.0.0-beta.2" - inquirer "^7.0.0" - interpret "^2.0.0" - ip "^1.1.5" - json5 "^2.1.1" - lazy-universal-dotenv "^3.0.1" - micromatch "^4.0.2" - node-fetch "^2.6.0" - open "^7.0.1" - pkg-dir "^4.2.0" - pnp-webpack-plugin "1.6.0" - postcss-flexbugs-fixes "^4.1.0" - postcss-loader "^3.0.0" - pretty-hrtime "^1.0.3" - qs "^6.6.0" - raw-loader "^4.0.0" - react-dev-utils "^10.0.0" - regenerator-runtime "^0.13.3" - resolve "^1.11.0" - resolve-from "^5.0.0" - semver "^6.0.0" - serve-favicon "^2.5.0" - shelljs "^0.8.3" - style-loader "^1.0.0" - terser-webpack-plugin "^2.3.4" - ts-dedent "^1.1.1" - unfetch "^4.1.0" - url-loader "^3.0.0" - util-deprecate "^1.0.2" - webpack "^4.33.0" - webpack-dev-middleware "^3.7.0" - webpack-hot-middleware "^2.25.0" - webpack-virtual-modules "^0.2.0" - "@storybook/csf@0.0.1": version "0.0.1" resolved "https://registry.yarnpkg.com/@storybook/csf/-/csf-0.0.1.tgz#95901507dc02f0bc6f9ac8ee1983e2fc5bb98ce6" @@ -3708,18 +3504,6 @@ remark-lint "^6.0.4" remark-preset-lint-recommended "^3.0.2" -"@storybook/node-logger@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-6.0.0-alpha.11.tgz#eb2dcc1bbb66f5d546cdd8cfd0190517d054b519" - integrity sha512-zH3+VK8dmtm4DMqfoDNzdj3NspZ+I7df/btChAwplq/RrtVkqwnkMT/FNEO0RHHhCpsqAA+nhJa4fkl+qd48WQ== - dependencies: - "@types/npmlog" "^4.1.2" - chalk "^3.0.0" - core-js "^3.0.1" - npmlog "^4.1.2" - pretty-hrtime "^1.0.3" - regenerator-runtime "^0.13.3" - "@storybook/node-logger@^5.2.0", "@storybook/node-logger@^5.2.8": version "5.3.12" resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.12.tgz#df25b725583cb5aa799b6c5b8103a8ea0921d3ba" @@ -3758,33 +3542,6 @@ emotion-theming "^10.0.19" react-native-swipe-gestures "^1.0.4" -"@storybook/react@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/react/-/react-6.0.0-alpha.11.tgz#90fa2e430746e2f506b3cb11f8b9f6f5cd1c7f97" - integrity sha512-SJ1UDtiFEEzN6aXWXkJA8dEzynd7n3sF4fbsJwHPiUoE0n/SAlTAP4jN3KG7pZ/usLFDvNwfm4n9UjJv8THfwg== - dependencies: - "@babel/plugin-transform-react-constant-elements" "^7.6.3" - "@babel/preset-flow" "^7.0.0" - "@babel/preset-react" "^7.0.0" - "@storybook/addons" "6.0.0-alpha.11" - "@storybook/core" "6.0.0-alpha.11" - "@storybook/node-logger" "6.0.0-alpha.11" - "@svgr/webpack" "^5.1.0" - "@types/webpack-env" "^1.15.1" - babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-named-asset-import "^0.3.1" - babel-plugin-react-docgen "^4.0.0" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - mini-css-extract-plugin "^0.9.0" - prop-types "^15.7.2" - react-dev-utils "^10.0.0" - regenerator-runtime "^0.13.3" - semver "^6.0.0" - ts-dedent "^1.1.1" - webpack "^4.33.0" - "@storybook/router@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.0.0-alpha.0.tgz#c2b9da6c7eba0dccf32228a72e23ecf8875aacac" @@ -3800,21 +3557,6 @@ qs "^6.6.0" util-deprecate "^1.0.2" -"@storybook/router@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.0.0-alpha.11.tgz#34991d5fcb5e609f2de6ecd88e291a9fa06e7f04" - integrity sha512-Sn6gEGELNLm9KNXtKbXUqVSWUzY3SErXiVIssMtFHEh+wgyVhKSSy9TrLyPIWQ08+sl2wf50zLogDPFyD47FFg== - dependencies: - "@reach/router" "^1.2.1" - "@storybook/csf" "0.0.1" - "@types/reach__router" "^1.2.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - util-deprecate "^1.0.2" - "@storybook/theming@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.0.0-alpha.0.tgz#0a9580cecb1c9609e070c8db7737bd121faf56c3" @@ -3834,82 +3576,6 @@ resolve-from "^5.0.0" ts-dedent "^1.1.0" -"@storybook/theming@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.0.0-alpha.11.tgz#0eff2fc72754f9de941e16769f5e5759ad8c762f" - integrity sha512-TltXJJ9/mBOjVnCbaRf0SmXoAnj0DFcir4/2jhEnqBLWFvhP0vVoy6BNLnWVP6fxaonrt8IwA0l72jzAOd4qPQ== - dependencies: - "@emotion/core" "^10.0.20" - "@emotion/is-prop-valid" "^0.8.6" - "@emotion/styled" "^10.0.17" - "@storybook/client-logger" "6.0.0-alpha.11" - core-js "^3.0.1" - deep-object-diff "^1.1.0" - emotion-theming "^10.0.19" - global "^4.3.2" - memoizerific "^1.11.3" - polished "^3.4.4" - prop-types "^15.7.2" - resolve-from "^5.0.0" - ts-dedent "^1.1.1" - -"@storybook/ui@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-6.0.0-alpha.11.tgz#8d67209c5cbf129881758927764d7e2106f6b0d0" - integrity sha512-Rs0dBVTfxt7GcKuRY2Zf7jd7j7cgLSxj7QBwqyD+MhlCky/v+3IsHsyLEJ0RdlIzZBvxW9eFJG9oXLTdxemv0Q== - dependencies: - "@emotion/core" "^10.0.20" - "@storybook/addons" "6.0.0-alpha.11" - "@storybook/api" "6.0.0-alpha.11" - "@storybook/channels" "6.0.0-alpha.11" - "@storybook/client-logger" "6.0.0-alpha.11" - "@storybook/components" "6.0.0-alpha.11" - "@storybook/core-events" "6.0.0-alpha.11" - "@storybook/router" "6.0.0-alpha.11" - "@storybook/theming" "6.0.0-alpha.11" - "@types/markdown-to-jsx" "^6.9.1" - copy-to-clipboard "^3.0.8" - core-js "^3.0.1" - core-js-pure "^3.0.1" - emotion-theming "^10.0.19" - fast-deep-equal "^3.1.1" - fuse.js "^3.4.6" - global "^4.3.2" - lodash "^4.17.15" - markdown-to-jsx "^6.9.3" - memoizerific "^1.11.3" - polished "^3.4.4" - prop-types "^15.7.2" - qs "^6.6.0" - react "^16.8.3" - react-dom "^16.8.3" - react-draggable "^4.0.3" - react-helmet-async "^1.0.2" - react-hotkeys "2.0.0" - react-sizeme "^2.6.7" - regenerator-runtime "^0.13.2" - resolve-from "^5.0.0" - semver "^6.0.0" - store2 "^2.7.1" - telejson "^3.2.0" - util-deprecate "^1.0.2" - -"@storybook/web-components@6.0.0-alpha.11": - version "6.0.0-alpha.11" - resolved "https://registry.yarnpkg.com/@storybook/web-components/-/web-components-6.0.0-alpha.11.tgz#7dad3774c94defac61bff4e2b1155e8debec11e8" - integrity sha512-T+Yx5ti18BiCJBuIFgkqcvoBxRGuHCiHcIX/O5jvduBn8AUX8LVVkpURauPNejJAzwR8cp1Wpnu5Nty8osCf0Q== - dependencies: - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-import-meta" "^7.2.0" - "@storybook/addons" "6.0.0-alpha.11" - "@storybook/core" "6.0.0-alpha.11" - "@types/webpack-env" "^1.15.1" - babel-plugin-bundled-import-meta "^0.3.1" - core-js "^3.0.1" - global "^4.3.2" - regenerator-runtime "^0.13.3" - ts-dedent "^1.1.1" - "@stroncium/procfs@^1.0.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@stroncium/procfs/-/procfs-1.1.1.tgz#6ae4b4938cf3b6c3fb957f3063b2c0a8b26ee599" @@ -6542,7 +6208,7 @@ babel-plugin-named-asset-import@^0.3.1, babel-plugin-named-asset-import@^0.3.2, resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz#c9750a1b38d85112c9e166bf3ef7c5dbc605f4be" integrity sha512-1aGDUfL1qOOIoqk9QKGIo2lANk+C7ko/fqH0uIyC71x3PEGz0uVP8ISgfEsFuG+FKmjHTvFK/nNM8dowpmUxLA== -babel-plugin-react-docgen@^4.0.0, babel-plugin-react-docgen@^4.1.0: +babel-plugin-react-docgen@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/babel-plugin-react-docgen/-/babel-plugin-react-docgen-4.1.0.tgz#1dfa447dac9ca32d625a123df5733a9e47287c26" integrity sha512-vzpnBlfGv8XOhJM2zbPyyqw2OLEbelgZZsaaRRTpVwNKuYuc+pUg4+dy7i9gCRms0uOQn4osX571HRcCJMJCmA== From fe1d45830f3285a822aae0296535d4dde483c55a Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Wed, 19 Feb 2020 13:04:47 +0200 Subject: [PATCH 6/6] Update types.ts --- lib/client-api/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client-api/src/types.ts b/lib/client-api/src/types.ts index 76cf4ad70d67..6f0b5733763f 100644 --- a/lib/client-api/src/types.ts +++ b/lib/client-api/src/types.ts @@ -29,7 +29,7 @@ export interface StoreData { export interface ClientApiParams { storyStore: StoryStore; decorateStory?: (storyFn: any, decorators: any) => any; - disableAddStoryDispose?: boolean; + noStoryModuleAddMethodHotDispose?: boolean; } export type ClientApiReturnFn = (...args: any[]) => StoryApi;