fix merge from next

This commit is contained in:
chakir qatab 2023-01-12 10:49:30 +04:00
commit a2cc8bfc29
159 changed files with 5024 additions and 10602 deletions

View File

@ -162,7 +162,7 @@ jobs:
name: Running local registry
command: |
cd code
yarn local-registry --port 6001 --open
yarn local-registry --open
background: true
- run:
name: Wait for registry
@ -203,7 +203,7 @@ jobs:
name: Running local registry
command: |
cd code
yarn local-registry --port 6001 --open
yarn local-registry --open
background: true
- run:
name: Wait for registry

View File

@ -29,7 +29,7 @@ jobs:
- name: Compile Storybook libraries
run: yarn task --task publish --start-from=auto --no-link
- name: Running local registry
run: yarn local-registry --port 6001 --open &
run: yarn local-registry --open &
working-directory: ./code
- name: Wait for registry
run: yarn wait-on http://localhost:6001

View File

@ -1,3 +1,61 @@
## 7.0.0-beta.25 (January 12, 2023)
#### Features
- Vue3: Rendering slots passed from controls [#20536](https://github.com/storybooks/storybook/pull/20536)
#### Bug Fixes
- Core: Export build from core-server instead of standalone [#20574](https://github.com/storybooks/storybook/pull/20574)
#### Maintenance
- Blocks: New Description API, introduce useOf [#20563](https://github.com/storybooks/storybook/pull/20563)
## 7.0.0-beta.24 (January 11, 2023)
#### Maintenance
- Migrations: Add `preact-vite` to new frameworks automigration [#20542](https://github.com/storybooks/storybook/pull/20542)
#### Build
- Build: remove unneeded dependencies & upgrades [#20533](https://github.com/storybooks/storybook/pull/20533)
- Build: upgrade verdaccio [#20561](https://github.com/storybooks/storybook/pull/20561)
- Build: remove usage of enzyme [#20534](https://github.com/storybooks/storybook/pull/20534)
## 7.0.0-beta.23 (January 10, 2023)
#### Features
- Composition: Add basic auth support [#20488](https://github.com/storybooks/storybook/pull/20488)
#### Bug Fixes
- UI: Fix managerEntries containing long paths with hidden folders [#20550](https://github.com/storybooks/storybook/pull/20550)
- Addon-docs: Fix attachment logic [#20531](https://github.com/storybooks/storybook/pull/20531)
#### Maintenance
- Addon-docs: Move reactPeerCheck to docs package [#20560](https://github.com/storybooks/storybook/pull/20560)
- Addon-docs: Rename `storyByModuleExport` to `resolveModuleExport` [#20517](https://github.com/storybooks/storybook/pull/20517)
- Telemetry: Filter out example stories/docs from summary [#20553](https://github.com/storybooks/storybook/pull/20553)
- Telemetry: Count play function usage [#20541](https://github.com/storybooks/storybook/pull/20541)
- Telemetry: Add pageStoryCount [#20539](https://github.com/storybooks/storybook/pull/20539)
- Vite/Vue3: Pre-bundle @vitejs/plugin-vue [#20343](https://github.com/storybooks/storybook/pull/20343)
#### Build
- Build: downgrade slash to non-ESM [#20543](https://github.com/storybooks/storybook/pull/20543)
#### Other
- Update GH action to use "linear-ghaction" label for sync [#20546](https://github.com/storybooks/storybook/pull/20546)
## 7.0.0-beta.22 (January 10, 2023)
Failed publish
## 7.0.0-beta.21 (January 9, 2023)
#### Maintenance

View File

@ -41,6 +41,7 @@
- [Docs Changes](#docs-changes)
- [Standalone docs files](#standalone-docs-files)
- [Referencing stories in docs files](#referencing-stories-in-docs-files)
- [Description block, `parameters.notes` and `parameters.info`](#description-block-parametersnotes-and-parametersinfo)
- [Autodocs](#autodocs)
- [Configuring the Docs Container](#configuring-the-docs-container)
- [External Docs](#external-docs)
@ -306,8 +307,8 @@ To opt-out of the old behavior you can set the `storyStoreV7` feature flag to `f
module.exports = {
features: {
storyStoreV7: false,
}
}
},
};
```
#### Removed global client APIs
@ -796,6 +797,13 @@ import * as SecondComponentStories from './second-component.stories';
<Story of={SecondComponentStories.standard} meta={SecondComponentStories} />
```
#### Description block, `parameters.notes` and `parameters.info`
In 6.5 the Description doc block accepted a range of different props, `markdown`, `type` and `children` as a way to customize the content.
The props have been simplified and the block now only accepts an `of` prop, which can be a reference to either a CSF file, a default export (meta) or a story export, depending on which description you want to be shown. See TDB DOCS LINK for a deeper explanation of the new prop.
`parameters.notes` and `parameters.info` have been deprecated as a way to specify descriptions. Instead use JSDoc comments above the default export or story export, or use `parameters.docs.description.story | component` directly. See TDB DOCS LINK for a deeper explanation on how to write descriptions.
#### Autodocs
In 7.0, rather than rendering each story in "docs view mode", Autodocs (formerly known as "Docs Page") operates by adding additional sidebar entries for each component. By default it uses the same template as was used in 6.x, and the entries are entitled `Docs`.
@ -3812,4 +3820,3 @@ If you **are** using these addons, it takes two steps to migrate:
```
<!-- markdown-link-check-enable -->

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-a11y",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Test component compliance with web accessibility standards",
"keywords": [
"a11y",
@ -63,16 +63,16 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addon-highlight": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/addon-highlight": "7.0.0-beta.25",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"axe-core": "^4.2.0",
"lodash": "^4.17.21",
"react-resize-detector": "^7.1.2"
@ -104,7 +104,7 @@
"./src/preview.tsx"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Accessibility",
"icon": "https://user-images.githubusercontent.com/263385/101991665-47042f80-3c7c-11eb-8f00-64b5a18f498a.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Get UI feedback when an action is performed on an interactive element",
"keywords": [
"storybook",
@ -77,14 +77,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
"polished": "^4.2.2",
@ -121,7 +121,7 @@
"./src/preview.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Actions",
"unsupportedFrameworks": [

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-backgrounds",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Switch backgrounds to view components in different settings",
"keywords": [
"addon",
@ -76,14 +76,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"memoizerific": "^1.11.3",
"ts-dedent": "^2.0.0"
},
@ -112,7 +112,7 @@
"./src/preview.tsx"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Backgrounds",
"icon": "https://user-images.githubusercontent.com/263385/101991667-479cc600-3c7c-11eb-96d3-410e936252e7.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-controls",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Interact with component inputs dynamically in the Storybook UI",
"keywords": [
"addon",
@ -68,15 +68,15 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/blocks": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/blocks": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.8",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"lodash": "^4.17.21",
"ts-dedent": "^2.0.0"
},
@ -102,7 +102,7 @@
],
"platform": "browser"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Controls",
"icon": "https://user-images.githubusercontent.com/263385/101991669-479cc600-3c7c-11eb-93d9-38b67e8371f2.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-docs",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Document component usage and properties in Markdown",
"keywords": [
"addon",
@ -103,18 +103,18 @@
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@jest/transform": "^29.3.1",
"@mdx-js/react": "^2.1.5",
"@storybook/blocks": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/csf-plugin": "7.0.0-beta.21",
"@storybook/csf-tools": "7.0.0-beta.21",
"@storybook/blocks": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/csf-plugin": "7.0.0-beta.25",
"@storybook/csf-tools": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/mdx2-csf": "next",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/postinstall": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/postinstall": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"fs-extra": "^9.0.1",
"remark-external-links": "^8.0.0",
"remark-slug": "^6.0.0",
@ -141,7 +141,7 @@
"./src/shims/mdx-react-shim.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Docs",
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",

View File

@ -7,6 +7,7 @@ import type { IndexerOptions, StoryIndexer, DocsOptions, Options } from '@storyb
import type { CsfPluginOptions } from '@storybook/csf-plugin';
import type { JSXOptions } from '@storybook/mdx2-csf';
import { loadCsf } from '@storybook/csf-tools';
import { ensureReactPeerDeps } from './ensure-react-peer-deps';
async function webpack(
webpackConfig: any = {},
@ -164,4 +165,6 @@ const webpackX = webpack as any;
const storyIndexersX = storyIndexers as any;
const docsX = docs as any;
ensureReactPeerDeps();
export { webpackX as webpack, storyIndexersX as storyIndexers, docsX as docs };

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-essentials",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Curated addons to bring out the best of Storybook",
"keywords": [
"addon",
@ -119,23 +119,23 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addon-actions": "7.0.0-beta.21",
"@storybook/addon-backgrounds": "7.0.0-beta.21",
"@storybook/addon-controls": "7.0.0-beta.21",
"@storybook/addon-docs": "7.0.0-beta.21",
"@storybook/addon-highlight": "7.0.0-beta.21",
"@storybook/addon-measure": "7.0.0-beta.21",
"@storybook/addon-outline": "7.0.0-beta.21",
"@storybook/addon-toolbars": "7.0.0-beta.21",
"@storybook/addon-viewport": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/addon-actions": "7.0.0-beta.25",
"@storybook/addon-backgrounds": "7.0.0-beta.25",
"@storybook/addon-controls": "7.0.0-beta.25",
"@storybook/addon-docs": "7.0.0-beta.25",
"@storybook/addon-highlight": "7.0.0-beta.25",
"@storybook/addon-measure": "7.0.0-beta.25",
"@storybook/addon-outline": "7.0.0-beta.25",
"@storybook/addon-toolbars": "7.0.0-beta.25",
"@storybook/addon-viewport": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/vue": "7.0.0-beta.21",
"@storybook/vue": "7.0.0-beta.25",
"typescript": "^4.9.3"
},
"peerDependencies": {
@ -166,5 +166,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-highlight",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Highlight DOM nodes within your stories",
"keywords": [
"storybook-addons",
@ -61,9 +61,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.0.0-beta.21"
"@storybook/preview-api": "7.0.0-beta.25"
},
"devDependencies": {
"@types/webpack-env": "^1.16.0",
@ -78,7 +78,7 @@
"./src/preview.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"sbmodern": "dist/modern/index.js",
"storybook": {
"displayName": "Highlight",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-interactions",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Automate, test and debug user interactions",
"keywords": [
"storybook-addons",
@ -72,16 +72,16 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/instrumenter": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/instrumenter": "7.0.0-beta.25",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"jest-mock": "^27.0.6",
"polished": "^4.2.2",
"ts-dedent": "^2.2.0"
@ -118,7 +118,7 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Interactions",
"unsupportedFrameworks": [

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-jest",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "React storybook addon that show component jest report",
"keywords": [
"addon",
@ -70,13 +70,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"react-resize-detector": "^7.1.2",
"upath": "^1.2.0"
},
@ -105,7 +105,7 @@
],
"platform": "browser"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Jest",
"icon": "https://pbs.twimg.com/profile_images/821713465245102080/mMtKIMax_400x400.jpg",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-links",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Link stories together to build demos and prototypes with your UI components",
"keywords": [
"addon",
@ -77,14 +77,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/csf": "next",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/router": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/router": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"prop-types": "^15.7.2",
"ts-dedent": "^2.0.0"
},
@ -114,7 +114,7 @@
"./src/react/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Links",
"icon": "https://user-images.githubusercontent.com/263385/101991673-48355c80-3c7c-11eb-9b6e-b627c96a75f6.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-measure",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Inspect layouts by visualizing the box model",
"keywords": [
"storybook-addons",
@ -75,13 +75,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21"
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25"
},
"devDependencies": {
"typescript": "~4.9.3"
@ -108,7 +108,7 @@
"./src/preview.tsx"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Measure",
"unsupportedFrameworks": [

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-outline",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Outline all elements with CSS to help with layout placement and alignment",
"keywords": [
"storybook-addons",
@ -78,13 +78,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
@ -112,7 +112,7 @@
"./src/preview.tsx"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Outline",
"unsupportedFrameworks": [

View File

@ -7,7 +7,6 @@ module.exports = {
'@storybook/preact',
'@storybook/vue',
'@storybook/svelte',
'enzyme',
],
},
};

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storyshots",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Take a code snapshot of every story automatically with Jest",
"keywords": [
"addon",
@ -37,12 +37,12 @@
"dependencies": {
"@jest/transform": "^29.3.1",
"@storybook/babel-plugin-require-context-hook": "1.0.1",
"@storybook/client-api": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-webpack": "7.0.0-beta.21",
"@storybook/client-api": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-webpack": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/glob": "^7.1.3",
"@types/jest-specific-snapshot": "^0.5.6",
"core-js": "^3.8.2",
@ -58,13 +58,14 @@
"@angular/core": "^13.3.6",
"@angular/platform-browser-dynamic": "^13.3.6",
"@emotion/jest": "^11.8.0",
"@storybook/addon-docs": "7.0.0-beta.21",
"@storybook/angular": "7.0.0-beta.21",
"@storybook/react": "7.0.0-beta.21",
"@storybook/vue": "7.0.0-beta.21",
"@storybook/vue3": "7.0.0-beta.21",
"@storybook/addon-docs": "7.0.0-beta.25",
"@storybook/angular": "7.0.0-beta.25",
"@storybook/react": "7.0.0-beta.25",
"@storybook/vue": "7.0.0-beta.25",
"@storybook/vue3": "7.0.0-beta.25",
"babel-loader": "^8.3.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.6.1",
"jest-preset-angular": "^8.3.2",
"jest-vue-preprocessor": "^1.7.1",
@ -142,7 +143,7 @@
"access": "public"
},
"bundler": {},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Storyshots",
"icon": "https://user-images.githubusercontent.com/263385/101991676-48cdf300-3c7c-11eb-8aa1-944dab6ab29b.png",

View File

@ -1,7 +1,11 @@
import path from 'path';
import { mount } from 'enzyme';
import { mount, configure } from 'enzyme';
// @ts-expect-error (Converted from ts-ignore)
import Adapter from 'enzyme-adapter-react-16';
import initStoryshots from '../src';
configure({ adapter: new Adapter() });
initStoryshots({
framework: 'react',
configPath: path.join(__dirname, 'exported_metadata'),

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storyshots-puppeteer",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Image snapshots addition to StoryShots based on puppeteer",
"keywords": [
"addon",
@ -36,18 +36,20 @@
"dependencies": {
"@axe-core/puppeteer": "^4.2.0",
"@storybook/csf": "next",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/jest-image-snapshot": "^5.1.0",
"jest-image-snapshot": "^6.0.0"
},
"devDependencies": {
"@types/puppeteer": "^5.4.0",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.1",
"puppeteer": "^2.0.0 || ^3.0.0",
"rimraf": "^3.0.2"
},
"peerDependencies": {
"@storybook/addon-storyshots": "7.0.0-beta.21",
"@storybook/addon-storyshots": "7.0.0-beta.25",
"puppeteer": ">=2.0.0"
},
"peerDependenciesMeta": {
@ -59,5 +61,5 @@
"access": "public"
},
"bundler": {},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storysource",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "View a storys source code to see how it works and paste into your app",
"keywords": [
"addon",
@ -54,13 +54,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/router": "7.0.0-beta.21",
"@storybook/source-loader": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/router": "7.0.0-beta.25",
"@storybook/source-loader": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"estraverse": "^5.2.0",
"prop-types": "^15.7.2",
"react-syntax-highlighter": "^15.5.0"
@ -92,7 +92,7 @@
"./src/preset.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Storysource",
"icon": "https://user-images.githubusercontent.com/263385/101991675-48cdf300-3c7c-11eb-9400-58de5ac6daa7.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-toolbars",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Create your own toolbar items that control story rendering",
"keywords": [
"addon",
@ -68,11 +68,11 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21"
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25"
},
"devDependencies": {
"typescript": "~4.9.3"
@ -99,7 +99,7 @@
],
"platform": "browser"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Toolbars",
"icon": "https://user-images.githubusercontent.com/263385/101991677-48cdf300-3c7c-11eb-93b4-19b0e3366959.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-viewport",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Build responsive components by adjusting Storybooks viewport size and orientation",
"keywords": [
"addon",
@ -73,13 +73,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"memoizerific": "^1.11.3",
"prop-types": "^15.7.2"
},
@ -109,7 +109,7 @@
"./src/preview.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77",
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec",
"storybook": {
"displayName": "Viewport",
"icon": "https://user-images.githubusercontent.com/263385/101991678-48cdf300-3c7c-11eb-9764-f8af293c1b28.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/angular",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
"keywords": [
"storybook",
@ -36,19 +36,19 @@
"prep": "../../../scripts/prepare/tsc.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-client": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/core-server": "7.0.0-beta.21",
"@storybook/core-webpack": "7.0.0-beta.21",
"@storybook/docs-tools": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-client": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/core-server": "7.0.0-beta.25",
"@storybook/core-webpack": "7.0.0-beta.25",
"@storybook/docs-tools": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/node": "^16.0.0",
"@types/react": "^16.14.34",
"@types/react-dom": "^16.9.14",
@ -127,5 +127,5 @@
"bundler": {
"tsConfig": "tsconfig.build.json"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/ember",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
"homepage": "https://github.com/storybookjs/storybook/tree/main/frameworks/ember",
"bugs": {
@ -31,13 +31,12 @@
"prep": "../../../scripts/prepare/tsc.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/docs-tools": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/docs-tools": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"read-pkg-up": "^7.0.1",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
@ -60,5 +59,5 @@
"access": "public"
},
"bundler": {},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -12,6 +12,8 @@ export default {
argTypes: {
label: { control: 'text' },
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/7.0/react/writing-docs/docs-page
tags: ['autodocs'],
};
// More on writing stories with args: https://storybook.js.org/docs/7.0/ember/writing-stories/args

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/html-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for HTML and Vite: Develop HTML in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,15 +48,15 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addons": "7.0.0-beta.21",
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/channel-postmessage": "7.0.0-beta.21",
"@storybook/channel-websocket": "7.0.0-beta.21",
"@storybook/client-api": "7.0.0-beta.21",
"@storybook/core-server": "7.0.0-beta.21",
"@storybook/html": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preview-web": "7.0.0-beta.21",
"@storybook/addons": "7.0.0-beta.25",
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/channel-postmessage": "7.0.0-beta.25",
"@storybook/channel-websocket": "7.0.0-beta.25",
"@storybook/client-api": "7.0.0-beta.25",
"@storybook/core-server": "7.0.0-beta.25",
"@storybook/html": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview-web": "7.0.0-beta.25",
"magic-string": "^0.26.1"
},
"devDependencies": {
@ -76,5 +76,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/html-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,11 +48,11 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/html": "7.0.0-beta.21",
"@storybook/preset-html-webpack": "7.0.0-beta.21",
"@storybook/html": "7.0.0-beta.25",
"@storybook/preset-html-webpack": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -76,5 +76,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/nextjs",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Next.js",
"keywords": [
"storybook",
@ -60,13 +60,13 @@
},
"dependencies": {
"@next/font": "^13.0.7",
"@storybook/addon-actions": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preset-react-webpack": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/react": "7.0.0-beta.21",
"@storybook/addon-actions": "7.0.0-beta.25",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preset-react-webpack": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/react": "7.0.0-beta.25",
"@types/node": "^16.0.0",
"find-up": "^5.0.0",
"fs-extra": "^9.0.1",
@ -123,5 +123,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preact-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Preact and Vite: Develop Preact components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,8 +48,8 @@
},
"dependencies": {
"@preact/preset-vite": "^2.0.0",
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/preact": "7.0.0-beta.21"
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/preact": "7.0.0-beta.25"
},
"devDependencies": {
"@types/node": "^16.0.0",
@ -73,5 +73,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preact-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Preact: Develop Preact Component in isolation.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preact": "7.0.0-beta.21",
"@storybook/preset-preact-webpack": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preact": "7.0.0-beta.25",
"@storybook/preset-preact-webpack": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -77,5 +77,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for React and Vite: Develop React components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -50,8 +50,8 @@
"dependencies": {
"@joshwooding/vite-plugin-react-docgen-typescript": "^0.2.1",
"@rollup/pluginutils": "^4.2.0",
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/react": "7.0.0-beta.21",
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/react": "7.0.0-beta.25",
"@vitejs/plugin-react": "^3.0.0",
"ast-types": "^0.14.2",
"magic-string": "^0.26.1",
@ -80,5 +80,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,9 +48,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/preset-react-webpack": "7.0.0-beta.21",
"@storybook/react": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/preset-react-webpack": "7.0.0-beta.25",
"@storybook/react": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -83,5 +83,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/server-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preset-server-webpack": "7.0.0-beta.21",
"@storybook/server": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preset-server-webpack": "7.0.0-beta.25",
"@storybook/server": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -74,5 +74,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/svelte-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Svelte and Vite: Develop Svelte components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,9 +48,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/svelte": "7.0.0-beta.21",
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/svelte": "7.0.0-beta.25",
"@sveltejs/vite-plugin-svelte": "^2.0.0",
"magic-string": "^0.26.1",
"svelte": "^3.0.0",
@ -80,5 +80,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/svelte-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preset-svelte-webpack": "7.0.0-beta.21",
"@storybook/svelte": "7.0.0-beta.21"
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preset-svelte-webpack": "7.0.0-beta.25",
"@storybook/svelte": "7.0.0-beta.25"
},
"devDependencies": {
"svelte": "^3.48.0",
@ -78,5 +78,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/sveltekit",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for SvelteKit",
"keywords": [
"storybook",
@ -51,9 +51,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/svelte": "7.0.0-beta.21",
"@storybook/svelte-vite": "7.0.0-beta.21"
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/svelte": "7.0.0-beta.25",
"@storybook/svelte-vite": "7.0.0-beta.25"
},
"devDependencies": {
"@types/node": "^16.0.0",
@ -76,5 +76,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Vue2 and Vite: Develop Vue2 Components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-server": "7.0.0-beta.21",
"@storybook/vue": "7.0.0-beta.21",
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-server": "7.0.0-beta.25",
"@storybook/vue": "7.0.0-beta.25",
"magic-string": "^0.26.1",
"vue-docgen-api": "^4.40.0"
},
@ -79,5 +79,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Vue: Develop Vue Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preset-vue-webpack": "7.0.0-beta.21",
"@storybook/vue": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preset-vue-webpack": "7.0.0-beta.25",
"@storybook/vue": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -83,5 +83,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue3-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Vue3 and Vite: Develop Vue3 components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,9 +48,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/core-server": "7.0.0-beta.21",
"@storybook/vue3": "7.0.0-beta.21",
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/core-server": "7.0.0-beta.25",
"@storybook/vue3": "7.0.0-beta.25",
"magic-string": "^0.26.1",
"vue-docgen-api": "^4.40.0"
},
@ -83,5 +83,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue3-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preset-vue3-webpack": "7.0.0-beta.21",
"@storybook/vue3": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preset-vue3-webpack": "7.0.0-beta.25",
"@storybook/vue3": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -80,5 +80,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/web-components-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for web-components and Vite: Develop Web Components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -48,10 +48,10 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/builder-vite": "7.0.0-beta.21",
"@storybook/core-server": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/web-components": "7.0.0-beta.21",
"@storybook/builder-vite": "7.0.0-beta.25",
"@storybook/core-server": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/web-components": "7.0.0-beta.25",
"magic-string": "^0.26.1"
},
"devDependencies": {
@ -75,5 +75,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/web-components-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.",
"keywords": [
"lit-html",
@ -51,10 +51,10 @@
},
"dependencies": {
"@babel/preset-env": "^7.20.2",
"@storybook/builder-webpack5": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preset-web-components-webpack": "7.0.0-beta.21",
"@storybook/web-components": "7.0.0-beta.21",
"@storybook/builder-webpack5": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preset-web-components-webpack": "7.0.0-beta.25",
"@storybook/web-components": "7.0.0-beta.25",
"@types/node": "^16.0.0"
},
"devDependencies": {
@ -79,5 +79,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,9 +1,6 @@
import '@testing-library/jest-dom';
// setup file
import { configure } from 'enzyme';
// @ts-expect-error (Converted from ts-ignore)
import Adapter from 'enzyme-adapter-react-16';
import registerRequireContextHook from '@storybook/babel-plugin-require-context-hook/register';
registerRequireContextHook();
@ -23,8 +20,6 @@ const localStorageMock = {
// @ts-expect-error (Converted from ts-ignore)
global.localStorage = localStorageMock;
configure({ adapter: new Adapter() });
/* Fail tests on PropType warnings
This allows us to throw an error in tests environments when there are prop-type warnings.
This should keep the tests free of warnings going forward.

View File

@ -2,5 +2,5 @@
"npmClient": "yarn",
"useWorkspaces": true,
"registry": "https://registry.npmjs.org",
"version": "7.0.0-beta.21"
"version": "7.0.0-beta.25"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addons",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook addons store",
"keywords": [
"storybook"
@ -44,9 +44,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21"
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
@ -60,5 +60,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/builder-manager",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook manager builder",
"keywords": [
"storybook"
@ -44,9 +44,9 @@
},
"dependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/manager": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/manager": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@types/ejs": "^3.1.1",
"@types/find-cache-dir": "^3.2.1",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10",
@ -73,5 +73,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,7 +1,18 @@
import findCacheDirectory from 'find-cache-dir';
import fs from 'fs-extra';
import { join, parse, relative } from 'node:path';
import { join, parse, relative, sep } from 'node:path';
import slash from 'slash';
const sanitizeBase = (path: string) => {
return path.replaceAll('.', '').replaceAll('@', '').replaceAll(sep, '-').replaceAll('/', '-');
};
const sanitizeFinal = (path: string) => {
const sections = path.split(/-?node_modules-?/);
return sections[sections.length - 1].replaceAll('storybook-addon-', '').replaceAll('dist-', '');
};
/**
* Manager entries should be **self-invoking** bits of code.
* They can of-course import from modules, and ESbuild will bundle all of that into a single file.
@ -20,7 +31,7 @@ import slash from 'slash';
*/
export async function wrapManagerEntries(entrypoints: string[]) {
return Promise.all(
entrypoints.map(async (entry) => {
entrypoints.map(async (entry, i) => {
const { name, dir } = parse(entry);
const cacheLocation = findCacheDirectory({ name: 'sb-manager' });
@ -28,7 +39,12 @@ export async function wrapManagerEntries(entrypoints: string[]) {
throw new Error('Could not create/find cache directory');
}
const location = join(cacheLocation, relative(process.cwd(), dir), `${name}-bundle.mjs`);
const base = relative(process.cwd(), dir);
const location = join(
cacheLocation,
sanitizeFinal(join(`${sanitizeBase(base)}-${i}`, `${sanitizeBase(name)}-bundle.mjs`))
);
await fs.ensureFile(location);
await fs.writeFile(location, `import '${slash(entry)}';`);

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/builder-vite",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "A plugin to run and build Storybooks with Vite",
"homepage": "https://github.com/storybookjs/storybook/tree/main/code/lib/builder-vite/#readme",
"bugs": {
@ -43,14 +43,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/csf-plugin": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/csf-plugin": "7.0.0-beta.25",
"@storybook/mdx2-csf": "next",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preview": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"browser-assert": "^1.2.1",
"es-module-lexer": "^0.9.3",
"express": "^4.17.3",
@ -95,5 +95,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/builder-webpack5",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
@ -58,25 +58,25 @@
},
"dependencies": {
"@babel/core": "^7.12.10",
"@storybook/addons": "7.0.0-beta.21",
"@storybook/api": "7.0.0-beta.21",
"@storybook/channel-postmessage": "7.0.0-beta.21",
"@storybook/channel-websocket": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-api": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/components": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/core-webpack": "7.0.0-beta.21",
"@storybook/addons": "7.0.0-beta.25",
"@storybook/api": "7.0.0-beta.25",
"@storybook/channel-postmessage": "7.0.0-beta.25",
"@storybook/channel-websocket": "7.0.0-beta.25",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-api": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/components": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/core-webpack": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preview": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/router": "7.0.0-beta.21",
"@storybook/store": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/router": "7.0.0-beta.25",
"@storybook/store": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@types/node": "^16.0.0",
"@types/semver": "^7.3.4",
"babel-loader": "^8.3.0",
@ -131,5 +131,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/channel-postmessage",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -43,9 +43,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"qs": "^6.10.0",
"telejson": "^7.0.3"
@ -61,5 +61,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/channel-websocket",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -43,8 +43,8 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"telejson": "^7.0.3"
},
@ -59,5 +59,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/channels",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -53,5 +53,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "sb",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook CLI",
"keywords": [
"storybook"
@ -21,10 +21,10 @@
"license": "MIT",
"bin": "./index.js",
"dependencies": {
"@storybook/cli": "7.0.0-beta.21"
"@storybook/cli": "7.0.0-beta.25"
},
"publishConfig": {
"access": "public"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "storybook",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook CLI",
"keywords": [
"storybook"
@ -24,10 +24,10 @@
"storybook": "./index.js"
},
"dependencies": {
"@storybook/cli": "7.0.0-beta.21"
"@storybook/cli": "7.0.0-beta.25"
},
"publishConfig": {
"access": "public"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/cli",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook's CLI - easiest method of adding storybook to your projects",
"keywords": [
"cli",
@ -43,13 +43,13 @@
"dependencies": {
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@storybook/codemod": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-server": "7.0.0-beta.21",
"@storybook/csf-tools": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/telemetry": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/codemod": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-server": "7.0.0-beta.25",
"@storybook/csf-tools": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/telemetry": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/semver": "^7.3.4",
"boxen": "^5.1.2",
"chalk": "^4.1.0",
@ -78,7 +78,7 @@
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"@storybook/client-api": "7.0.0-beta.21",
"@storybook/client-api": "7.0.0-beta.25",
"@types/cross-spawn": "^6.0.2",
"@types/prompts": "^2.0.9",
"@types/puppeteer-core": "^2.1.0",
@ -88,10 +88,6 @@
"strip-json-comments": "^3.1.1",
"typescript": "~4.9.3"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"publishConfig": {
"access": "public"
},
@ -101,5 +97,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -252,6 +252,33 @@ describe('new-frameworks fix', () => {
})
);
});
it('should update to @storybook/preact-vite', async () => {
const packageJson = {
dependencies: {
'@storybook/preact': '^7.0.0-alpha.0',
'@storybook/builder-vite': '^0.0.2',
vite: '3.0.0',
},
};
await expect(
checkNewFrameworks({
packageJson,
main: {
framework: '@storybook/preact',
core: {
builder: '@storybook/builder-vite',
},
},
})
).resolves.toEqual(
expect.objectContaining({
frameworkPackage: '@storybook/preact-vite',
dependenciesToAdd: ['@storybook/preact-vite'],
dependenciesToRemove: ['@storybook/builder-vite'],
})
);
});
});
});
});

View File

@ -18,6 +18,7 @@ const packagesMap: Record<string, { webpack5?: string; vite?: string }> = {
},
'@storybook/preact': {
webpack5: '@storybook/preact-webpack5',
vite: '@storybook/preact-vite',
},
'@storybook/server': {
webpack5: '@storybook/server-webpack5',

View File

@ -2,11 +2,8 @@ import { sync as readUpSync } from 'read-pkg-up';
import { logger } from '@storybook/node-logger';
import { buildStaticStandalone, withTelemetry } from '@storybook/core-server';
import { cache } from '@storybook/core-common';
import { ensureReactPeerDeps } from './ensure-react-peer-deps';
export const build = async (cliOptions: any) => {
ensureReactPeerDeps();
try {
const options = {
...cliOptions,

View File

@ -3,13 +3,10 @@ import { sync as readUpSync } from 'read-pkg-up';
import { logger, instance as npmLog } from '@storybook/node-logger';
import { buildDevStandalone, withTelemetry } from '@storybook/core-server';
import { cache } from '@storybook/core-common';
import { ensureReactPeerDeps } from './ensure-react-peer-deps';
export const dev = async (cliOptions: any) => {
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
ensureReactPeerDeps();
try {
const options = {
...cliOptions,

View File

@ -1,90 +1,90 @@
// auto generated file, do not edit
export default {
'@storybook/addon-a11y': '7.0.0-beta.21',
'@storybook/addon-actions': '7.0.0-beta.21',
'@storybook/addon-backgrounds': '7.0.0-beta.21',
'@storybook/addon-controls': '7.0.0-beta.21',
'@storybook/addon-docs': '7.0.0-beta.21',
'@storybook/addon-essentials': '7.0.0-beta.21',
'@storybook/addon-highlight': '7.0.0-beta.21',
'@storybook/addon-interactions': '7.0.0-beta.21',
'@storybook/addon-jest': '7.0.0-beta.21',
'@storybook/addon-links': '7.0.0-beta.21',
'@storybook/addon-measure': '7.0.0-beta.21',
'@storybook/addon-outline': '7.0.0-beta.21',
'@storybook/addon-storyshots': '7.0.0-beta.21',
'@storybook/addon-storyshots-puppeteer': '7.0.0-beta.21',
'@storybook/addon-storysource': '7.0.0-beta.21',
'@storybook/addon-toolbars': '7.0.0-beta.21',
'@storybook/addon-viewport': '7.0.0-beta.21',
'@storybook/addons': '7.0.0-beta.21',
'@storybook/angular': '7.0.0-beta.21',
'@storybook/manager-api': '7.0.0-beta.21',
'@storybook/blocks': '7.0.0-beta.21',
'@storybook/builder-manager': '7.0.0-beta.21',
'@storybook/builder-vite': '7.0.0-beta.21',
'@storybook/builder-webpack5': '7.0.0-beta.21',
'@storybook/channel-postmessage': '7.0.0-beta.21',
'@storybook/channel-websocket': '7.0.0-beta.21',
'@storybook/channels': '7.0.0-beta.21',
'@storybook/cli': '7.0.0-beta.21',
'@storybook/client-api': '7.0.0-beta.21',
'@storybook/client-logger': '7.0.0-beta.21',
'@storybook/codemod': '7.0.0-beta.21',
'@storybook/components': '7.0.0-beta.21',
'@storybook/core-client': '7.0.0-beta.21',
'@storybook/core-common': '7.0.0-beta.21',
'@storybook/core-events': '7.0.0-beta.21',
'@storybook/core-server': '7.0.0-beta.21',
'@storybook/core-webpack': '7.0.0-beta.21',
'@storybook/csf-tools': '7.0.0-beta.21',
'@storybook/docs-tools': '7.0.0-beta.21',
'@storybook/ember': '7.0.0-beta.21',
'@storybook/html': '7.0.0-beta.21',
'@storybook/html-webpack5': '7.0.0-beta.21',
'@storybook/html-vite': '7.0.0-beta.21',
'@storybook/instrumenter': '7.0.0-beta.21',
'@storybook/nextjs': '7.0.0-beta.21',
'@storybook/node-logger': '7.0.0-beta.21',
'@storybook/postinstall': '7.0.0-beta.21',
'@storybook/preact': '7.0.0-beta.21',
'@storybook/preact-vite': '7.0.0-beta.21',
'@storybook/preact-webpack5': '7.0.0-beta.21',
'@storybook/preset-html-webpack': '7.0.0-beta.21',
'@storybook/preset-preact-webpack': '7.0.0-beta.21',
'@storybook/preset-react-webpack': '7.0.0-beta.21',
'@storybook/preset-server-webpack': '7.0.0-beta.21',
'@storybook/preset-svelte-webpack': '7.0.0-beta.21',
'@storybook/preset-vue-webpack': '7.0.0-beta.21',
'@storybook/preset-vue3-webpack': '7.0.0-beta.21',
'@storybook/preset-web-components-webpack': '7.0.0-beta.21',
'@storybook/preview': '7.0.0-beta.21',
'@storybook/preview-api': '7.0.0-beta.21',
'@storybook/preview-web': '7.0.0-beta.21',
'@storybook/react': '7.0.0-beta.21',
'@storybook/react-vite': '7.0.0-beta.21',
'@storybook/react-webpack5': '7.0.0-beta.21',
'@storybook/router': '7.0.0-beta.21',
'@storybook/server': '7.0.0-beta.21',
'@storybook/server-webpack5': '7.0.0-beta.21',
'@storybook/source-loader': '7.0.0-beta.21',
'@storybook/store': '7.0.0-beta.21',
'@storybook/svelte': '7.0.0-beta.21',
'@storybook/sveltekit': '7.0.0-beta.21',
'@storybook/svelte-vite': '7.0.0-beta.21',
'@storybook/svelte-webpack5': '7.0.0-beta.21',
'@storybook/telemetry': '7.0.0-beta.21',
'@storybook/theming': '7.0.0-beta.21',
'@storybook/manager': '7.0.0-beta.21',
'@storybook/vue': '7.0.0-beta.21',
'@storybook/vue-vite': '7.0.0-beta.21',
'@storybook/vue-webpack5': '7.0.0-beta.21',
'@storybook/vue3': '7.0.0-beta.21',
'@storybook/vue3-vite': '7.0.0-beta.21',
'@storybook/vue3-webpack5': '7.0.0-beta.21',
'@storybook/web-components': '7.0.0-beta.21',
'@storybook/web-components-webpack5': '7.0.0-beta.21',
'@storybook/web-components-vite': '7.0.0-beta.21',
sb: '7.0.0-beta.21',
storybook: '7.0.0-beta.21',
'@storybook/addon-a11y': '7.0.0-beta.25',
'@storybook/addon-actions': '7.0.0-beta.25',
'@storybook/addon-backgrounds': '7.0.0-beta.25',
'@storybook/addon-controls': '7.0.0-beta.25',
'@storybook/addon-docs': '7.0.0-beta.25',
'@storybook/addon-essentials': '7.0.0-beta.25',
'@storybook/addon-highlight': '7.0.0-beta.25',
'@storybook/addon-interactions': '7.0.0-beta.25',
'@storybook/addon-jest': '7.0.0-beta.25',
'@storybook/addon-links': '7.0.0-beta.25',
'@storybook/addon-measure': '7.0.0-beta.25',
'@storybook/addon-outline': '7.0.0-beta.25',
'@storybook/addon-storyshots': '7.0.0-beta.25',
'@storybook/addon-storyshots-puppeteer': '7.0.0-beta.25',
'@storybook/addon-storysource': '7.0.0-beta.25',
'@storybook/addon-toolbars': '7.0.0-beta.25',
'@storybook/addon-viewport': '7.0.0-beta.25',
'@storybook/addons': '7.0.0-beta.25',
'@storybook/angular': '7.0.0-beta.25',
'@storybook/manager-api': '7.0.0-beta.25',
'@storybook/blocks': '7.0.0-beta.25',
'@storybook/builder-manager': '7.0.0-beta.25',
'@storybook/builder-vite': '7.0.0-beta.25',
'@storybook/builder-webpack5': '7.0.0-beta.25',
'@storybook/channel-postmessage': '7.0.0-beta.25',
'@storybook/channel-websocket': '7.0.0-beta.25',
'@storybook/channels': '7.0.0-beta.25',
'@storybook/cli': '7.0.0-beta.25',
'@storybook/client-api': '7.0.0-beta.25',
'@storybook/client-logger': '7.0.0-beta.25',
'@storybook/codemod': '7.0.0-beta.25',
'@storybook/components': '7.0.0-beta.25',
'@storybook/core-client': '7.0.0-beta.25',
'@storybook/core-common': '7.0.0-beta.25',
'@storybook/core-events': '7.0.0-beta.25',
'@storybook/core-server': '7.0.0-beta.25',
'@storybook/core-webpack': '7.0.0-beta.25',
'@storybook/csf-tools': '7.0.0-beta.25',
'@storybook/docs-tools': '7.0.0-beta.25',
'@storybook/ember': '7.0.0-beta.25',
'@storybook/html': '7.0.0-beta.25',
'@storybook/html-webpack5': '7.0.0-beta.25',
'@storybook/html-vite': '7.0.0-beta.25',
'@storybook/instrumenter': '7.0.0-beta.25',
'@storybook/nextjs': '7.0.0-beta.25',
'@storybook/node-logger': '7.0.0-beta.25',
'@storybook/postinstall': '7.0.0-beta.25',
'@storybook/preact': '7.0.0-beta.25',
'@storybook/preact-vite': '7.0.0-beta.25',
'@storybook/preact-webpack5': '7.0.0-beta.25',
'@storybook/preset-html-webpack': '7.0.0-beta.25',
'@storybook/preset-preact-webpack': '7.0.0-beta.25',
'@storybook/preset-react-webpack': '7.0.0-beta.25',
'@storybook/preset-server-webpack': '7.0.0-beta.25',
'@storybook/preset-svelte-webpack': '7.0.0-beta.25',
'@storybook/preset-vue-webpack': '7.0.0-beta.25',
'@storybook/preset-vue3-webpack': '7.0.0-beta.25',
'@storybook/preset-web-components-webpack': '7.0.0-beta.25',
'@storybook/preview': '7.0.0-beta.25',
'@storybook/preview-api': '7.0.0-beta.25',
'@storybook/preview-web': '7.0.0-beta.25',
'@storybook/react': '7.0.0-beta.25',
'@storybook/react-vite': '7.0.0-beta.25',
'@storybook/react-webpack5': '7.0.0-beta.25',
'@storybook/router': '7.0.0-beta.25',
'@storybook/server': '7.0.0-beta.25',
'@storybook/server-webpack5': '7.0.0-beta.25',
'@storybook/source-loader': '7.0.0-beta.25',
'@storybook/store': '7.0.0-beta.25',
'@storybook/svelte': '7.0.0-beta.25',
'@storybook/sveltekit': '7.0.0-beta.25',
'@storybook/svelte-vite': '7.0.0-beta.25',
'@storybook/svelte-webpack5': '7.0.0-beta.25',
'@storybook/telemetry': '7.0.0-beta.25',
'@storybook/theming': '7.0.0-beta.25',
'@storybook/manager': '7.0.0-beta.25',
'@storybook/vue': '7.0.0-beta.25',
'@storybook/vue-vite': '7.0.0-beta.25',
'@storybook/vue-webpack5': '7.0.0-beta.25',
'@storybook/vue3': '7.0.0-beta.25',
'@storybook/vue3-vite': '7.0.0-beta.25',
'@storybook/vue3-webpack5': '7.0.0-beta.25',
'@storybook/web-components': '7.0.0-beta.25',
'@storybook/web-components-webpack5': '7.0.0-beta.25',
'@storybook/web-components-vite': '7.0.0-beta.25',
sb: '7.0.0-beta.25',
storybook: '7.0.0-beta.25',
};

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/client-api",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook Client API",
"keywords": [
"storybook"
@ -42,8 +42,8 @@
"prep": "../../../scripts/prepare/facade.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21"
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25"
},
"publishConfig": {
"access": "public"
@ -54,5 +54,5 @@
],
"shim": "@storybook/preview-api/dist/client-api"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/client-logger",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -56,5 +56,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/codemod",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "A collection of codemod scripts written with JSCodeshift",
"keywords": [
"storybook"
@ -50,9 +50,9 @@
"@babel/preset-env": "^7.20.2",
"@babel/types": "^7.20.2",
"@storybook/csf": "next",
"@storybook/csf-tools": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/csf-tools": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"cross-spawn": "^7.0.3",
"globby": "^11.0.2",
"jscodeshift": "^0.13.1",
@ -85,5 +85,5 @@
"./src/transforms/upgrade-hierarchy-separators.js"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-client",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
@ -35,8 +35,8 @@
"prep": "../../../scripts/prepare/facade.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21"
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25"
},
"publishConfig": {
"access": "public"
@ -47,5 +47,5 @@
],
"shim": "@storybook/preview-api/dist/core-client"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-common",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
@ -44,8 +44,8 @@
},
"dependencies": {
"@babel/core": "^7.20.2",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/babel__core": "^7.1.20",
"@types/express": "^4.7.0",
"@types/node": "^16.0.0",
@ -83,5 +83,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-events",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Event names used in storybook core",
"keywords": [
"storybook"
@ -53,5 +53,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-server",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
@ -58,17 +58,17 @@
"dependencies": {
"@aw-web-design/x-default-browser": "1.4.88",
"@discoveryjs/json-ext": "^0.5.3",
"@storybook/builder-manager": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/builder-manager": "7.0.0-beta.25",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/csf": "next",
"@storybook/csf-tools": "7.0.0-beta.21",
"@storybook/csf-tools": "7.0.0-beta.25",
"@storybook/docs-mdx": "next",
"@storybook/global": "^5.0.0",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/telemetry": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/telemetry": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/detect-port": "^1.3.0",
"@types/node": "^16.0.0",
"@types/node-fetch": "^2.5.7",
@ -119,5 +119,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -6,3 +6,4 @@ export { getPreviewHeadTemplate, getPreviewBodyTemplate } from '@storybook/core-
export * from './build-static';
export * from './build-dev';
export * from './withTelemetry';
export { default as build } from './standalone';

View File

@ -38,6 +38,7 @@ type SpecifierStoriesCache = Record<Path, CacheEntry>;
export const AUTODOCS_TAG = 'autodocs';
export const STORIES_MDX_TAG = 'stories-mdx';
export const PLAY_FN_TAG = 'play-fn';
/** Was this docs entry generated by a .mdx file? (see discussion below) */
export function isMdxEntry({ tags }: DocsIndexEntry) {

View File

@ -0,0 +1,34 @@
import { isPageStory } from './summarizeIndex';
describe('isPageStory', () => {
describe('true positives', () => {
it.each(['pages/login', 'screens/login', 'components/LoginPage', 'components/LoginScreen'])(
'%s',
(title) => {
expect(isPageStory(title)).toBe(true);
}
);
});
describe('false positives', () => {
it.each([
'components/PagerStatus',
'components/DefectScreener',
'addons/docs/docspage/autoplay',
])('%s', (title) => {
expect(isPageStory(title)).toBe(true);
});
});
describe('true negatives', () => {
it.each(['atoms/Button', 'components/Slider'])('%s', (title) => {
expect(isPageStory(title)).toBe(false);
});
});
describe('false negatives', () => {
it.each(['flows/login', 'login-flow/forgot password'])('%s', (title) => {
expect(isPageStory(title)).toBe(false);
});
});
});

View File

@ -1,30 +1,70 @@
import type { StoryIndex } from '@storybook/types';
import type { IndexEntry, StoryIndex } from '@storybook/types';
import { STORIES_MDX_TAG, isMdxEntry, AUTODOCS_TAG } from './StoryIndexGenerator';
import { STORIES_MDX_TAG, isMdxEntry, AUTODOCS_TAG, PLAY_FN_TAG } from './StoryIndexGenerator';
const PAGE_REGEX = /(page|screen)/i;
export const isPageStory = (storyId: string) => PAGE_REGEX.test(storyId);
/**
* Filter out example stories that are generated by the CLI
*/
const isExampleEntry = (entry: IndexEntry) => {
return [
'example-introduction--docs',
'example-button--docs',
'example-button--primary',
'example-button--secondary',
'example-button--large',
'example-button--small',
'example-header--docs',
'example-header--logged-in',
'example-header--logged-out',
'example-page--logged-in',
'example-page--logged-out',
].includes(entry.id);
};
export function summarizeIndex(storyIndex: StoryIndex) {
let storyCount = 0;
let exampleStoryCount = 0;
let exampleDocsCount = 0;
let pageStoryCount = 0;
let playStoryCount = 0;
let autodocsCount = 0;
let storiesMdxCount = 0;
let mdxCount = 0;
Object.values(storyIndex.entries).forEach((entry) => {
if (entry.type === 'story') {
if (isExampleEntry(entry)) {
if (entry.type === 'story') exampleStoryCount += 1;
if (entry.type === 'docs') exampleDocsCount += 1;
} else if (entry.type === 'story') {
storyCount += 1;
if (isPageStory(entry.title)) {
pageStoryCount += 1;
}
if (entry.tags?.includes(PLAY_FN_TAG)) {
playStoryCount += 1;
}
} else if (entry.type === 'docs') {
if (isMdxEntry(entry)) {
mdxCount += 1;
} else if (entry.tags.includes(STORIES_MDX_TAG)) {
} else if (entry.tags?.includes(STORIES_MDX_TAG)) {
storiesMdxCount += 1;
} else if (entry.tags.includes(AUTODOCS_TAG)) {
} else if (entry.tags?.includes(AUTODOCS_TAG)) {
autodocsCount += 1;
}
}
});
return {
storyCount,
pageStoryCount,
playStoryCount,
autodocsCount,
storiesMdxCount,
mdxCount,
exampleStoryCount,
exampleDocsCount,
version: storyIndex.v,
};
}

View File

@ -1,3 +0,0 @@
const build = require('./dist/cjs/standalone').default;
module.exports = build;

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/core-webpack",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
@ -43,9 +43,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/node-logger": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/node-logger": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/node": "^16.0.0",
"ts-dedent": "^2.0.0"
},
@ -62,5 +62,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/csf-plugin",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Enrich CSF files via static analysis",
"keywords": [
"storybook"
@ -43,7 +43,7 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/csf-tools": "7.0.0-beta.21",
"@storybook/csf-tools": "7.0.0-beta.25",
"unplugin": "^0.10.2"
},
"devDependencies": {
@ -64,5 +64,5 @@
],
"platform": "node"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/csf-tools",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -45,7 +45,7 @@
"dependencies": {
"@babel/types": "^7.20.2",
"@storybook/csf": "next",
"@storybook/types": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.25",
"fs-extra": "^9.0.1",
"ts-dedent": "^2.0.0"
},
@ -66,5 +66,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -866,4 +866,104 @@ describe('CsfFile', () => {
).toThrow('CSF: Expected tag to be string literal');
});
});
describe('play functions', () => {
it('story csf2', () => {
expect(
parse(
dedent`
export default { title: 'foo/bar', tags: ['X'] };
export const A = () => {};
A.play = () => {};
A.tags = ['Y'];
`
)
).toMatchInlineSnapshot(`
meta:
title: foo/bar
tags:
- X
stories:
- id: foo-bar--a
name: A
tags:
- 'Y'
- play-fn
`);
});
it('story csf3', () => {
expect(
parse(
dedent`
export default { title: 'foo/bar', tags: ['X'] };
export const A = {
render: () => {},
play: () => {},
tags: ['Y'],
};
`
)
).toMatchInlineSnapshot(`
meta:
title: foo/bar
tags:
- X
stories:
- id: foo-bar--a
name: A
tags:
- 'Y'
- play-fn
`);
});
it('meta csf2', () => {
expect(
parse(
dedent`
export default { title: 'foo/bar', play: () => {}, tags: ['X'] };
export const A = {
render: () => {},
tags: ['Y'],
};
`
)
).toMatchInlineSnapshot(`
meta:
title: foo/bar
tags:
- X
- play-fn
stories:
- id: foo-bar--a
name: A
tags:
- 'Y'
`);
});
it('meta csf3', () => {
expect(
parse(
dedent`
export default { title: 'foo/bar', play: () => {}, tags: ['X'] };
export const A = () => {};
A.tags = ['Y'];
`
)
).toMatchInlineSnapshot(`
meta:
title: foo/bar
tags:
- X
- play-fn
stories:
- id: foo-bar--a
name: A
tags:
- 'Y'
`);
});
});
});

View File

@ -454,6 +454,9 @@ export class CsfFile {
// default export can come at any point in the file, so we do this post processing last
const entries = Object.entries(self._stories);
self._meta.title = this._makeTitle(self._meta.title);
if (self._metaAnnotations.play) {
self._meta.tags = [...(self._meta.tags || []), 'play-fn'];
}
self._stories = entries.reduce((acc, [key, story]) => {
if (isExportStory(key, self._meta)) {
const id = toId(self._meta.id || self._meta.title, storyNameFromExport(key));
@ -466,13 +469,16 @@ export class CsfFile {
parameters.docsOnly = true;
}
acc[key] = { ...story, id, parameters };
const { tags } = self._storyAnnotations[key];
const { tags, play } = self._storyAnnotations[key];
if (tags) {
const node = t.isIdentifier(tags)
? findVarInitialization(tags.name, this._ast.program)
: tags;
acc[key].tags = parseTags(node);
}
if (play) {
acc[key].tags = [...(acc[key].tags || []), 'play-fn'];
}
}
return acc;
}, {} as Record<string, StaticStory>);

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/docs-tools",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Shared utility functions for frameworks to implement docs",
"keywords": [
"storybook"
@ -44,9 +44,10 @@
},
"dependencies": {
"@babel/core": "^7.12.10",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"@types/doctrine": "^0.0.3",
"doctrine": "^3.0.0",
"lodash": "^4.17.21"
},
@ -63,5 +64,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/instrumenter",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -43,11 +43,11 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.25",
"core-js": "^3.8.2"
},
"devDependencies": {
@ -61,5 +61,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/api",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook Manager API (facade)",
"keywords": [
"storybook"
@ -42,8 +42,8 @@
"prep": "../../../scripts/prepare/facade.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/manager-api": "7.0.0-beta.21"
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/manager-api": "7.0.0-beta.25"
},
"publishConfig": {
"access": "public"
@ -54,5 +54,5 @@
],
"shim": "@storybook/manager-api"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/manager-api",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Core Storybook API & Context",
"keywords": [
"storybook"
@ -42,14 +42,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/csf": "next",
"@storybook/global": "^5.0.0",
"@storybook/router": "7.0.0-beta.21",
"@storybook/theming": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.21",
"@storybook/router": "7.0.0-beta.25",
"@storybook/theming": "7.0.0-beta.25",
"@storybook/types": "7.0.0-beta.25",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
"memoizerific": "^1.11.3",
@ -78,5 +78,5 @@
"./src/index.tsx"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1 +1 @@
export const version = '7.0.0-beta.21';
export const version = '7.0.0-beta.25';

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/node-logger",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -60,5 +60,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/postinstall",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "Storybook addons postinstall utilities",
"keywords": [
"api",
@ -57,5 +57,5 @@
"./src/index.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preview-api",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -67,13 +67,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/channel-postmessage": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/channel-postmessage": "7.0.0-beta.25",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/csf": "next",
"@storybook/global": "^5.0.0",
"@storybook/types": "7.0.0-beta.21",
"@storybook/types": "7.0.0-beta.25",
"@types/qs": "^6.9.5",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
@ -86,7 +86,7 @@
},
"devDependencies": {
"@jest/globals": "^26.6.2",
"@storybook/core-common": "7.0.0-beta.21",
"@storybook/core-common": "7.0.0-beta.25",
"ansi-to-html": "^0.6.11",
"react": "^16.14.0"
},
@ -103,5 +103,5 @@
"./src/store.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -642,7 +642,7 @@ describe('PreviewWeb', () => {
});
});
describe('template docs entries', () => {
describe('CSF docs entries', () => {
it('always renders in docs viewMode', async () => {
document.location.search = '?id=component-one--docs';
await createAndRenderPreview();
@ -679,7 +679,7 @@ describe('PreviewWeb', () => {
expect(importFn).toHaveBeenCalledWith('./src/ExtraComponentOne.stories.js');
});
it('renders with componentStories loaded from both story files', async () => {
it('renders with componentStories loaded from the attached CSF file', async () => {
document.location.search = '?id=component-one--docs&viewMode=docs';
await createAndRenderPreview();

View File

@ -0,0 +1,84 @@
import { Channel } from '@storybook/channels';
import type { Renderer } from '@storybook/types';
import type { StoryStore } from '../../store';
import { DocsContext } from './DocsContext';
import { csfFileParts } from './test-utils';
const channel = new Channel();
const renderStoryToElement = jest.fn();
describe('resolveModuleExport', () => {
const { story, csfFile, storyExport, metaExport, moduleExports, component } = csfFileParts();
describe('attached', () => {
const store = {
componentStoriesFromCSFFile: () => [story],
} as unknown as StoryStore<Renderer>;
const context = new DocsContext(channel, store, renderStoryToElement, [csfFile]);
context.attachCSFFile(csfFile);
it('works for story exports', () => {
expect(context.resolveModuleExport(storyExport)).toEqual({ type: 'story', story });
});
it('works for meta exports', () => {
expect(context.resolveModuleExport(metaExport)).toEqual({ type: 'meta', csfFile });
});
it('works for full module exports', () => {
expect(context.resolveModuleExport(moduleExports)).toEqual({ type: 'meta', csfFile });
});
it('works for components', () => {
expect(context.resolveModuleExport(component)).toEqual({ type: 'component', component });
});
it('finds primary story', () => {
expect(context.resolveModuleExport('story')).toEqual({ type: 'story', story });
});
it('finds attached CSF file', () => {
expect(context.resolveModuleExport('meta')).toEqual({ type: 'meta', csfFile });
});
it('finds attached component', () => {
expect(context.resolveModuleExport('component')).toEqual({ type: 'component', component });
});
});
describe('unattached', () => {
const store = {
componentStoriesFromCSFFile: () => [story],
} as unknown as StoryStore<Renderer>;
const context = new DocsContext(channel, store, renderStoryToElement, [csfFile]);
it('works for story exports', () => {
expect(context.resolveModuleExport(storyExport)).toEqual({ type: 'story', story });
});
it('works for meta exports', () => {
expect(context.resolveModuleExport(metaExport)).toEqual({ type: 'meta', csfFile });
});
it('works for full module exports', () => {
expect(context.resolveModuleExport(moduleExports)).toEqual({ type: 'meta', csfFile });
});
it('works for components', () => {
expect(context.resolveModuleExport(component)).toEqual({ type: 'component', component });
});
it('throws for primary story', () => {
expect(() => context.resolveModuleExport('story')).toThrow('No primary story attached');
});
it('throws for attached CSF file', () => {
expect(() => context.resolveModuleExport('meta')).toThrow('No CSF file attached');
});
it('throws for attached component', () => {
expect(() => context.resolveModuleExport('component')).toThrow('No CSF file attached');
});
});
});

View File

@ -7,6 +7,7 @@ import type {
StoryContextForLoaders,
StoryId,
StoryName,
ResolvedModuleExport,
} from '@storybook/types';
import type { Channel } from '@storybook/channels';
import type { StoryStore } from '../../store';
@ -18,10 +19,14 @@ export class DocsContext<TRenderer extends Renderer> implements DocsContextProps
private storyIdToCSFFile: Map<StoryId, CSFFile<TRenderer>>;
private exportToStoryId: Map<ModuleExport, StoryId>;
private exportToStory: Map<ModuleExport, PreparedStory<TRenderer>>;
private exportsToCSFFile: Map<ModuleExports, CSFFile<TRenderer>>;
private nameToStoryId: Map<StoryName, StoryId>;
private attachedCSFFile?: CSFFile<TRenderer>;
private primaryStory?: PreparedStory<TRenderer>;
constructor(
@ -29,46 +34,110 @@ export class DocsContext<TRenderer extends Renderer> implements DocsContextProps
protected store: StoryStore<TRenderer>,
public renderStoryToElement: DocsContextProps['renderStoryToElement'],
/** The CSF files known (via the index) to be refererenced by this docs file */
csfFiles: CSFFile<TRenderer>[],
componentStoriesFromAllCsfFiles = true
csfFiles: CSFFile<TRenderer>[]
) {
this.storyIdToCSFFile = new Map();
this.exportToStoryId = new Map();
this.exportToStory = new Map();
this.exportsToCSFFile = new Map();
this.nameToStoryId = new Map();
this.componentStoriesValue = [];
csfFiles.forEach((csfFile, index) => {
this.referenceCSFFile(csfFile, componentStoriesFromAllCsfFiles || index === 0);
this.referenceCSFFile(csfFile);
});
}
// This docs entry references this CSF file and can syncronously load the stories, as well
// as reference them by module export. If the CSF is part of the "component" stories, they
// can also be referenced by name and are in the componentStories list.
referenceCSFFile(csfFile: CSFFile<TRenderer>, addToComponentStories: boolean) {
referenceCSFFile(csfFile: CSFFile<TRenderer>) {
this.exportsToCSFFile.set(csfFile.moduleExports, csfFile);
// Also set the default export as the component's exports,
// to allow `import ButtonStories from './Button.stories'`
this.exportsToCSFFile.set(csfFile.moduleExports.default, csfFile);
const stories = this.store.componentStoriesFromCSFFile({ csfFile });
Object.values(csfFile.stories).forEach((annotation) => {
this.storyIdToCSFFile.set(annotation.id, csfFile);
this.exportToStoryId.set(annotation.moduleExport, annotation.id);
const story = stories.find((s) => s.id === annotation.id);
if (!story)
throw new Error(`Unexpected missing story ${annotation.id} from referenced CSF file.`);
this.exportToStory.set(annotation.moduleExport, story);
});
}
if (addToComponentStories) {
this.store.componentStoriesFromCSFFile({ csfFile }).forEach((story) => {
this.nameToStoryId.set(story.name, story.id);
this.componentStoriesValue.push(story);
if (!this.primaryStory) this.primaryStory = story;
});
attachCSFFile(csfFile: CSFFile<TRenderer>) {
if (!this.exportsToCSFFile.has(csfFile.moduleExports)) {
throw new Error('Cannot attach a CSF file that has not been referenced');
}
this.attachedCSFFile = csfFile;
const stories = this.store.componentStoriesFromCSFFile({ csfFile });
stories.forEach((story) => {
this.nameToStoryId.set(story.name, story.id);
this.componentStoriesValue.push(story);
if (!this.primaryStory) this.primaryStory = story;
});
}
setMeta(metaExports: ModuleExports) {
// Do nothing (this is really only used by external docs)
referenceMeta(metaExports: ModuleExports, attach: boolean) {
const resolved = this.resolveModuleExport(metaExports);
if (resolved.type !== 'meta')
throw new Error('Cannot reference a non-meta or module export in <Meta of={} />');
if (attach) this.attachCSFFile(resolved.csfFile);
}
storyIdByModuleExport(storyExport: ModuleExport, metaExports?: ModuleExports) {
const storyId = this.exportToStoryId.get(storyExport);
if (storyId) return storyId;
get projectAnnotations() {
const { projectAnnotations } = this.store;
if (!projectAnnotations) {
throw new Error("Can't get projectAnnotations from DocsContext before they are initialized");
}
return projectAnnotations;
}
throw new Error(`No story found with that export: ${storyExport}`);
resolveModuleExport(moduleExportOrType: ModuleExport | ResolvedModuleExport<TRenderer>['type']) {
// If passed a type, we return the attached file, component or primary story
if (moduleExportOrType === 'story') {
if (!this.primaryStory)
throw new Error(
`No primary story attached to this docs file, did you forget to use <Meta of={} />?`
);
return { type: 'story', story: this.primaryStory } as const;
}
if (moduleExportOrType === 'meta') {
if (!this.attachedCSFFile)
throw new Error(
`No CSF file attached to this docs file, did you forget to use <Meta of={} />?`
);
return { type: 'meta', csfFile: this.attachedCSFFile } as const;
}
if (moduleExportOrType === 'component') {
if (!this.attachedCSFFile)
throw new Error(
`No CSF file attached to this docs file, did you forget to use <Meta of={} />?`
);
const { component } = this.attachedCSFFile.meta;
if (!component)
throw new Error(
`Attached CSF file does not defined a component, did you forget to export one?`
);
return { type: 'component', component } as const;
}
const csfFile = this.exportsToCSFFile.get(moduleExportOrType);
if (csfFile) return { type: 'meta', csfFile } as const;
const story = this.exportToStory.get(moduleExportOrType);
if (story) return { type: 'story', story } as const;
// If the export isn't a module, default or story export, we assume it is a component
return { type: 'component', component: moduleExportOrType } as const;
}
storyIdByName = (storyName: StoryName) => {

View File

@ -0,0 +1,33 @@
import type { CSFFile, PreparedStory } from '@storybook/types';
export function csfFileParts() {
// These compose the raw exports of the CSF file
const component = {};
const metaExport = { component };
const storyExport = {};
const moduleExports = { default: metaExport, story: storyExport };
// This is the prepared story + CSF file after SB has processed them
const storyAnnotations = {
id: 'meta--story',
moduleExport: storyExport,
} as CSFFile['stories'][string];
const story = { id: 'meta--story', moduleExport: storyExport } as PreparedStory;
const meta = { id: 'meta', title: 'Meta', component, moduleExports } as CSFFile['meta'];
const csfFile = {
stories: { story: storyAnnotations },
meta,
moduleExports,
} as CSFFile;
return {
component,
metaExport,
storyExport,
moduleExports,
storyAnnotations,
story,
meta,
csfFile,
};
}

View File

@ -4,6 +4,7 @@ import type { StoryStore } from '../../store';
import { PREPARE_ABORTED } from './Render';
import { CsfDocsRender } from './CsfDocsRender';
import { csfFileParts } from '../docs-context/test-utils';
const entry = {
type: 'docs',
@ -23,28 +24,47 @@ const createGate = (): [Promise<any | undefined>, (_?: any) => void] => {
return [gate, openGate];
};
describe('CsfDocsRender', () => {
it('throws PREPARE_ABORTED if torndown during prepare', async () => {
const [importGate, openImportGate] = createGate();
const mockStore = {
loadEntry: jest.fn(async () => {
await importGate;
return {};
}),
};
it('throws PREPARE_ABORTED if torndown during prepare', async () => {
const [importGate, openImportGate] = createGate();
const mockStore = {
loadEntry: jest.fn(async () => {
await importGate;
return {};
}),
};
const render = new CsfDocsRender(
new Channel(),
mockStore as unknown as StoryStore<Renderer>,
entry
);
const render = new CsfDocsRender(
new Channel(),
mockStore as unknown as StoryStore<Renderer>,
entry
);
const preparePromise = render.prepare();
const preparePromise = render.prepare();
render.teardown();
render.teardown();
openImportGate();
openImportGate();
await expect(preparePromise).rejects.toThrowError(PREPARE_ABORTED);
});
await expect(preparePromise).rejects.toThrowError(PREPARE_ABORTED);
});
it('attached immediately', async () => {
const { story, csfFile, moduleExports } = csfFileParts();
const store = {
loadEntry: () => ({
entryExports: moduleExports,
csfFiles: [],
}),
processCSFFileWithCache: () => csfFile,
componentStoriesFromCSFFile: () => [story],
storyFromCSFFile: () => story,
} as unknown as StoryStore<Renderer>;
const render = new CsfDocsRender(new Channel(), store, entry);
await render.prepare();
const context = render.docsContext(jest.fn());
expect(context.storyById()).toEqual(story);
});

View File

@ -85,19 +85,28 @@ export class CsfDocsRender<TRenderer extends Renderer> implements Render<TRender
);
}
docsContext(renderStoryToElement: DocsContextProps['renderStoryToElement']) {
if (!this.csfFiles) throw new Error('Cannot render docs before preparing');
const docsContext = new DocsContext<TRenderer>(
this.channel,
this.store,
renderStoryToElement,
this.csfFiles
);
// All referenced CSF files should be attached for CSF docs
// - When you create two CSF files that both reference the same title, they are combined into
// a single CSF docs entry with a `storiesImport` defined.
this.csfFiles.forEach((csfFile) => docsContext.attachCSFFile(csfFile));
return docsContext;
}
async renderToElement(
canvasElement: TRenderer['canvasElement'],
renderStoryToElement: DocsContextProps['renderStoryToElement']
) {
if (!this.story || !this.csfFiles) throw new Error('Cannot render docs before preparing');
const docsContext = new DocsContext<TRenderer>(
this.channel,
this.store,
renderStoryToElement,
this.csfFiles,
true
);
const docsContext = this.docsContext(renderStoryToElement);
const { docs: docsParameter } = this.story.parameters || {};

View File

@ -4,6 +4,7 @@ import type { StoryStore } from '../../store';
import { PREPARE_ABORTED } from './Render';
import { MdxDocsRender } from './MdxDocsRender';
import { csfFileParts } from '../docs-context/test-utils';
const entry = {
type: 'docs',
@ -22,28 +23,58 @@ const createGate = (): [Promise<any | undefined>, (_?: any) => void] => {
return [gate, openGate];
};
describe('MdxDocsRender', () => {
it('throws PREPARE_ABORTED if torndown during prepare', async () => {
const [importGate, openImportGate] = createGate();
const mockStore = {
loadEntry: jest.fn(async () => {
await importGate;
return {};
}),
};
it('throws PREPARE_ABORTED if torndown during prepare', async () => {
const [importGate, openImportGate] = createGate();
const mockStore = {
loadEntry: jest.fn(async () => {
await importGate;
return {};
}),
};
const render = new MdxDocsRender(
new Channel(),
mockStore as unknown as StoryStore<Renderer>,
entry
);
const render = new MdxDocsRender(
new Channel(),
mockStore as unknown as StoryStore<Renderer>,
entry
);
const preparePromise = render.prepare();
const preparePromise = render.prepare();
render.teardown();
render.teardown();
openImportGate();
openImportGate();
await expect(preparePromise).rejects.toThrowError(PREPARE_ABORTED);
await expect(preparePromise).rejects.toThrowError(PREPARE_ABORTED);
});
describe('attaching', () => {
const { story, csfFile, moduleExports } = csfFileParts();
const store = {
loadEntry: () => ({
entryExports: moduleExports,
csfFiles: [csfFile],
}),
processCSFFileWithCache: () => csfFile,
componentStoriesFromCSFFile: () => [story],
storyFromCSFFile: () => story,
} as unknown as StoryStore<Renderer>;
it('is not attached if you do not call setMeta', async () => {
const render = new MdxDocsRender(new Channel(), store, entry);
await render.prepare();
const context = render.docsContext(jest.fn());
expect(context.storyById).toThrow('No primary story defined');
});
it('is attached if you call referenceMeta with attach=true', async () => {
const render = new MdxDocsRender(new Channel(), store, entry);
await render.prepare();
const context = render.docsContext(jest.fn());
context.referenceMeta(moduleExports, true);
expect(context.storyById()).toEqual(story);
});
});

View File

@ -69,6 +69,19 @@ export class MdxDocsRender<TRenderer extends Renderer> implements Render<TRender
);
}
docsContext(renderStoryToElement: DocsContextProps['renderStoryToElement']) {
if (!this.csfFiles) throw new Error('Cannot render docs before preparing');
// NOTE we do *not* attach any CSF file yet. We wait for `referenceMeta(..., true)`
// ie the CSF file is attached via `<Meta of={} />`
return new DocsContext<TRenderer>(
this.channel,
this.store,
renderStoryToElement,
this.csfFiles
);
}
async renderToElement(
canvasElement: TRenderer['canvasElement'],
renderStoryToElement: DocsContextProps['renderStoryToElement']
@ -76,16 +89,9 @@ export class MdxDocsRender<TRenderer extends Renderer> implements Render<TRender
if (!this.exports || !this.csfFiles || !this.store.projectAnnotations)
throw new Error('Cannot render docs before preparing');
const docsContext = new DocsContext<TRenderer>(
this.channel,
this.store,
renderStoryToElement,
this.csfFiles,
false
);
const docsContext = this.docsContext(renderStoryToElement);
const { docs } = this.store.projectAnnotations.parameters || {};
if (!docs)
throw new Error(
`Cannot render a story in viewMode=docs if \`@storybook/addon-docs\` is not installed`

View File

@ -2,137 +2,147 @@ import { expect } from '@jest/globals';
import { processCSFFile } from './processCSFFile';
describe('processCSFFile', () => {
it('returns a CSFFile object with meta and stories', () => {
const { meta, stories } = processCSFFile(
{
default: { title: 'Component' },
storyOne: { args: { a: 1 } },
storyTwo: { args: { a: 2 } },
},
'./path/to/component.js',
'Component'
);
it('returns a CSFFile object with meta and stories', () => {
const { meta, stories } = processCSFFile(
{
default: { title: 'Component' },
storyOne: { args: { a: 1 } },
storyTwo: { args: { a: 2 } },
},
'./path/to/component.js',
'Component'
);
expect(meta).toEqual({
id: 'component',
title: 'Component',
parameters: { fileName: './path/to/component.js' },
});
expect(stories).toEqual({
'component--story-one': expect.objectContaining({
id: 'component--story-one',
name: 'Story One',
args: { a: 1 },
}),
'component--story-two': expect.objectContaining({
id: 'component--story-two',
name: 'Story Two',
args: { a: 2 },
}),
});
expect(meta).toEqual({
id: 'component',
title: 'Component',
parameters: { fileName: './path/to/component.js' },
});
it('automatically sets title if undefined', () => {
const { meta } = processCSFFile(
{
default: {},
storyOne: {},
},
'./path/to/component.js',
'Prefix/to/file'
);
expect(meta).toEqual({
id: 'prefix-to-file',
title: 'Prefix/to/file',
parameters: { fileName: './path/to/component.js' },
});
});
it('ignores __namedExportsOrder', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component' },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
__namedExportsOrder: ['w', 'x', 'z', 'y'],
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual([
'component--x',
'component--y',
'component--z',
'component--w',
]);
});
it('filters exports using includeStories array', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', includeStories: ['x', 'z'] },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--x', 'component--z']);
});
it('filters exports using includeStories regex', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', includeStories: /^(x|z)$/ },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--x', 'component--z']);
});
it('filters exports using excludeStories array', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', excludeStories: ['x', 'z'] },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--y', 'component--w']);
});
it('filters exports using excludeStories regex', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', excludeStories: /^(x|z)$/ },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--y', 'component--w']);
expect(stories).toEqual({
'component--story-one': expect.objectContaining({
id: 'component--story-one',
name: 'Story One',
args: { a: 1 },
}),
'component--story-two': expect.objectContaining({
id: 'component--story-two',
name: 'Story Two',
args: { a: 2 },
}),
});
});
it('automatically sets title if undefined', () => {
const { meta } = processCSFFile(
{
default: {},
storyOne: {},
},
'./path/to/component.js',
'Prefix/to/file'
);
expect(meta).toEqual({
id: 'prefix-to-file',
title: 'Prefix/to/file',
parameters: { fileName: './path/to/component.js' },
});
});
it('ignores __namedExportsOrder', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component' },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
__namedExportsOrder: ['w', 'x', 'z', 'y'],
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual([
'component--x',
'component--y',
'component--z',
'component--w',
]);
});
it('filters exports using includeStories array', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', includeStories: ['x', 'z'] },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--x', 'component--z']);
});
it('filters exports using includeStories regex', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', includeStories: /^(x|z)$/ },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--x', 'component--z']);
});
it('filters exports using excludeStories array', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', excludeStories: ['x', 'z'] },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--y', 'component--w']);
});
it('filters exports using excludeStories regex', () => {
const { stories } = processCSFFile(
{
default: { title: 'Component', excludeStories: /^(x|z)$/ },
x: () => 0,
y: () => 0,
z: () => 0,
w: () => 0,
},
'./path/to/component.js',
'Component'
);
expect(Object.keys(stories)).toEqual(['component--y', 'component--w']);
});
describe('moduleExports', () => {
it('are carried through', () => {
const moduleExports = {
default: { title: 'Component' },
storyOne: { args: { a: 1 } },
storyTwo: { args: { a: 2 } },
};
const csfFile = processCSFFile(moduleExports, './path/to/component.js', 'Component');
expect(csfFile.moduleExports).toBe(moduleExports);
});
});

View File

@ -54,7 +54,7 @@ export function processCSFFile<TRenderer extends Renderer>(
);
checkDisallowedParameters(meta.parameters);
const csfFile: CSFFile<TRenderer> = { meta, stories: {} };
const csfFile: CSFFile<TRenderer> = { meta, stories: {}, moduleExports };
Object.keys(namedExports).forEach((key) => {
if (isExportStory(key, meta)) {

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preview-web",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -42,8 +42,8 @@
"prep": "../../../scripts/prepare/facade.ts"
},
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21"
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25"
},
"publishConfig": {
"access": "public"
@ -54,5 +54,5 @@
],
"shim": "@storybook/preview-api/dist/preview-web"
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preview",
"version": "7.0.0-beta.21",
"version": "7.0.0-beta.25",
"description": "",
"keywords": [
"storybook"
@ -57,12 +57,12 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"devDependencies": {
"@storybook/channel-postmessage": "7.0.0-beta.21",
"@storybook/channel-websocket": "7.0.0-beta.21",
"@storybook/channels": "7.0.0-beta.21",
"@storybook/client-logger": "7.0.0-beta.21",
"@storybook/core-events": "7.0.0-beta.21",
"@storybook/preview-api": "7.0.0-beta.21",
"@storybook/channel-postmessage": "7.0.0-beta.25",
"@storybook/channel-websocket": "7.0.0-beta.25",
"@storybook/channels": "7.0.0-beta.25",
"@storybook/client-logger": "7.0.0-beta.25",
"@storybook/core-events": "7.0.0-beta.25",
"@storybook/preview-api": "7.0.0-beta.25",
"typescript": "~4.9.3"
},
"publishConfig": {
@ -74,5 +74,5 @@
"./src/globals.ts"
]
},
"gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
"gitHead": "2109ab8d7c0667e686db757abf5afcbf3d48a6ec"
}

Some files were not shown because too many files have changed in this diff Show More