From 32e854a5a89d9c3353d458ca1027bd61dfd27584 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 24 Mar 2024 23:35:44 +0800 Subject: [PATCH 01/30] Add metaTags, tag removal --- code/addons/links/package.json | 2 +- code/lib/codemod/package.json | 2 +- code/lib/core-server/package.json | 2 +- .../src/utils/StoryIndexGenerator.ts | 23 +++++++--- code/lib/csf-tools/package.json | 2 +- code/lib/manager-api/package.json | 2 +- code/lib/preview-api/package.json | 2 +- .../src/modules/store/csf/prepareStory.ts | 8 +++- .../template/stories/tags.stories.ts | 4 ++ code/lib/source-loader/package.json | 2 +- code/lib/types/package.json | 2 +- code/lib/types/src/modules/indexer.ts | 1 + code/package.json | 2 +- code/renderers/server/package.json | 2 +- code/ui/blocks/package.json | 2 +- code/ui/components/package.json | 2 +- code/yarn.lock | 42 +++++++++---------- 17 files changed, 62 insertions(+), 40 deletions(-) diff --git a/code/addons/links/package.json b/code/addons/links/package.json index ed71883923f1..6a135b3c576a 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -67,7 +67,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts" }, "dependencies": { - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/global": "^5.0.0", "ts-dedent": "^2.0.0" }, diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 1213fe7dd30f..8c355eb93454 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -57,7 +57,7 @@ "@babel/core": "^7.23.2", "@babel/preset-env": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/csf-tools": "workspace:*", "@storybook/node-logger": "workspace:*", "@storybook/types": "workspace:*", diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index b1c6880972ad..1526c391dff0 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -62,7 +62,7 @@ "@storybook/channels": "workspace:*", "@storybook/core-common": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/csf-tools": "workspace:*", "@storybook/docs-mdx": "3.0.0", "@storybook/global": "^5.0.0", diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index a650f04c1ffa..0e036f685355 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -23,7 +23,7 @@ import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/preview- import { commonGlobOptions, normalizeStoryPath } from '@storybook/core-common'; import { logger, once } from '@storybook/node-logger'; import { getStorySortParameter } from '@storybook/csf-tools'; -import { storyNameFromExport, toId } from '@storybook/csf'; +import { storyNameFromExport, toId, combineTags } from '@storybook/csf'; import { analyze } from '@storybook/docs-mdx'; import dedent from 'ts-dedent'; import { autoName } from './autoName'; @@ -55,6 +55,7 @@ export type StoryIndexGeneratorOptions = { }; export const AUTODOCS_TAG = 'autodocs'; +export const NO_AUTODOCS_TAG = `-${AUTODOCS_TAG}`; export const STORIES_MDX_TAG = 'stories-mdx'; export const PLAY_FN_TAG = 'play-fn'; @@ -291,7 +292,7 @@ export class StoryIndexGenerator { const title = input.title ?? defaultMakeTitle(); // eslint-disable-next-line no-underscore-dangle const id = input.__id ?? toId(input.metaId ?? title, storyNameFromExport(input.exportName)); - const tags = (input.tags || []).concat('story'); + const tags = combineTags(...(input.tags ?? []), ...(input.metaTags ?? []), 'story'); return { type: 'story', @@ -300,6 +301,7 @@ export class StoryIndexGenerator { name, title, importPath, + metaTags: input.metaTags ?? [], tags, }; }); @@ -312,7 +314,9 @@ export class StoryIndexGenerator { const hasAutodocsTag = entries.some((entry) => entry.tags.includes(AUTODOCS_TAG)); const isStoriesMdx = entries.some((entry) => entry.tags.includes(STORIES_MDX_TAG)); const createDocEntry = - autodocs === true || (autodocs === 'tag' && hasAutodocsTag) || isStoriesMdx; + (autodocs === true && !entries.some((entry) => entry.tags.includes(NO_AUTODOCS_TAG))) || + (autodocs === 'tag' && hasAutodocsTag) || + isStoriesMdx; if (createDocEntry && this.options.build?.test?.disableAutoDocs !== true) { const name = this.options.docs.defaultName ?? 'Docs'; @@ -326,7 +330,12 @@ export class StoryIndexGenerator { name, importPath, type: 'docs', - tags: [...metaTags, 'docs', ...(!hasAutodocsTag && !isStoriesMdx ? [AUTODOCS_TAG] : [])], + metaTags, + tags: combineTags( + ...metaTags, + 'docs', + ...(!hasAutodocsTag && !isStoriesMdx ? [AUTODOCS_TAG] : []) + ), storiesImports: [], }); } @@ -433,7 +442,11 @@ export class StoryIndexGenerator { storiesImports: sortedDependencies.map((dep) => dep.entries[0].importPath), type: 'docs', // FIXME: update this to use the index entry's metaTags once we update this to run on `IndexInputs` - tags: [...(result.tags || []), csfEntry ? 'attached-mdx' : 'unattached-mdx', 'docs'], + tags: combineTags( + ...(result.tags || []), + csfEntry ? 'attached-mdx' : 'unattached-mdx', + 'docs' + ), }; return docsEntry; } catch (err) { diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 7aff878d6a68..39d063d32d01 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -46,7 +46,7 @@ "@babel/parser": "^7.23.0", "@babel/traverse": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/types": "workspace:*", "fs-extra": "^11.1.0", "recast": "^0.23.5", diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index d9b7b6b39cf2..9fd9941ef00f 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/router": "workspace:*", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 8c64089acdec..23bd408491db 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/global": "^5.0.0", "@storybook/types": "workspace:*", "@types/qs": "^6.9.5", diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 0e5ea37500cd..ad35eff50f07 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -20,7 +20,7 @@ import type { StoryContextForLoaders, StrictArgTypes, } from '@storybook/types'; -import { includeConditionalArg } from '@storybook/csf'; +import { includeConditionalArg, combineTags } from '@storybook/csf'; import { applyHooks } from '../../addons'; import { combineParameters } from '../parameters'; @@ -140,7 +140,11 @@ function preparePartialAnnotations( // anything at render time. The assumption is that as we don't load all the stories at once, this // will have a limited cost. If this proves misguided, we can refactor it. - const tags = [...(storyAnnotations?.tags || componentAnnotations.tags || []), 'story']; + const tags = combineTags( + ...(storyAnnotations?.tags ?? []), + ...(componentAnnotations.tags ?? []), + 'story' + ); const parameters: Parameters = combineParameters( projectAnnotations.parameters, diff --git a/code/lib/preview-api/template/stories/tags.stories.ts b/code/lib/preview-api/template/stories/tags.stories.ts index 61ffe8811429..9af5be843d5f 100644 --- a/code/lib/preview-api/template/stories/tags.stories.ts +++ b/code/lib/preview-api/template/stories/tags.stories.ts @@ -37,3 +37,7 @@ export const TestOnly = { export const DevOnly = { tags: ['dev-only'], }; + +export const TagRemoval = { + tags: ['-component-two'], +}; diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index dca73497297f..c0578007e242 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -45,7 +45,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/types": "workspace:*", "estraverse": "^5.2.0", "lodash": "^4.17.21", diff --git a/code/lib/types/package.json b/code/lib/types/package.json index c936f0d7514d..c09dfb384b39 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -49,7 +49,7 @@ "file-system-cache": "2.3.0" }, "devDependencies": { - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@types/fs-extra": "^11.0.1", "@types/node": "^18.0.0", "typescript": "^5.3.2" diff --git a/code/lib/types/src/modules/indexer.ts b/code/lib/types/src/modules/indexer.ts index 1064354eefe0..42f0e21640e8 100644 --- a/code/lib/types/src/modules/indexer.ts +++ b/code/lib/types/src/modules/indexer.ts @@ -73,6 +73,7 @@ export interface BaseIndexEntry { id: StoryId; name: StoryName; title: ComponentTitle; + metaTags?: Tag[]; tags?: Tag[]; importPath: Path; } diff --git a/code/package.json b/code/package.json index 6e2885c0d0c1..c882ef4cf53d 100644 --- a/code/package.json +++ b/code/package.json @@ -127,7 +127,7 @@ "@storybook/core-events": "workspace:*", "@storybook/core-server": "workspace:*", "@storybook/core-webpack": "workspace:*", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/csf-plugin": "workspace:*", "@storybook/csf-tools": "workspace:*", "@storybook/docs-tools": "workspace:*", diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 321308cbbf11..5a18737a65ca 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -46,7 +46,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/csf-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/preview-api": "workspace:*", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index 683c5fbf25d7..a7b11a866577 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -48,7 +48,7 @@ "@storybook/client-logger": "workspace:*", "@storybook/components": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/docs-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", diff --git a/code/ui/components/package.json b/code/ui/components/package.json index 56a624b9e90c..1160d1a0d126 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -61,7 +61,7 @@ "dependencies": { "@radix-ui/react-slot": "^1.0.2", "@storybook/client-logger": "workspace:*", - "@storybook/csf": "^0.1.2", + "@storybook/csf": "0.1.4--canary.80.632d12b.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/theming": "workspace:*", diff --git a/code/yarn.lock b/code/yarn.lock index 664e1ed4eb15..e8d2a6a1df31 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5256,7 +5256,7 @@ __metadata: dependencies: "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/global": "npm:^5.0.0" "@storybook/manager-api": "workspace:*" "@storybook/preview-api": "workspace:*" @@ -5524,7 +5524,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/components": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/docs-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" @@ -5755,7 +5755,7 @@ __metadata: "@babel/core": "npm:^7.23.2" "@babel/preset-env": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/csf-tools": "workspace:*" "@storybook/node-logger": "workspace:*" "@storybook/types": "workspace:*" @@ -5791,7 +5791,7 @@ __metadata: "@radix-ui/react-scroll-area": "npm:^1.0.5" "@radix-ui/react-slot": "npm:^1.0.2" "@storybook/client-logger": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/test": "workspace:*" @@ -5884,7 +5884,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/csf-tools": "workspace:*" "@storybook/docs-mdx": "npm:3.0.0" "@storybook/global": "npm:^5.0.0" @@ -5964,7 +5964,7 @@ __metadata: "@babel/parser": "npm:^7.23.0" "@babel/traverse": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/types": "workspace:*" "@types/fs-extra": "npm:^11.0.1" "@types/js-yaml": "npm:^4.0.5" @@ -5976,6 +5976,15 @@ __metadata: languageName: unknown linkType: soft +"@storybook/csf@npm:0.1.4--canary.80.632d12b.0": + version: 0.1.4--canary.80.632d12b.0 + resolution: "@storybook/csf@npm:0.1.4--canary.80.632d12b.0" + dependencies: + type-fest: "npm:^2.19.0" + checksum: 10c0/8e2c9562d874ea78ad578eac3132bcc0dc4116e52a0cea7921888796ffa4225f106d4286bce92655584ae1ad1cf5150fd891af6cec5eb261a2e5ba5ecc4fa879 + languageName: node + linkType: hard + "@storybook/csf@npm:^0.0.1": version: 0.0.1 resolution: "@storybook/csf@npm:0.0.1" @@ -5985,15 +5994,6 @@ __metadata: languageName: node linkType: hard -"@storybook/csf@npm:^0.1.2": - version: 0.1.2 - resolution: "@storybook/csf@npm:0.1.2" - dependencies: - type-fest: "npm:^2.19.0" - checksum: 10c0/b51a55292e5d2af8b1d135a28ecaa94f8860ddfedcb393adfa2cca1ee23853156066f737d8be1cb5412f572781aa525dc0b2f6e4a6f6ce805489f0149efe837c - languageName: node - linkType: hard - "@storybook/docs-mdx@npm:3.0.0": version: 3.0.0 resolution: "@storybook/docs-mdx@npm:3.0.0" @@ -6161,7 +6161,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/router": "workspace:*" @@ -6493,7 +6493,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/global": "npm:^5.0.0" "@storybook/types": "workspace:*" "@types/qs": "npm:^6.9.5" @@ -6678,7 +6678,7 @@ __metadata: "@storybook/core-events": "workspace:*" "@storybook/core-server": "workspace:*" "@storybook/core-webpack": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/csf-plugin": "workspace:*" "@storybook/csf-tools": "workspace:*" "@storybook/docs-tools": "workspace:*" @@ -6833,7 +6833,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/server@workspace:renderers/server" dependencies: - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/csf-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/preview-api": "workspace:*" @@ -6850,7 +6850,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/source-loader@workspace:lib/source-loader" dependencies: - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@storybook/types": "workspace:*" estraverse: "npm:^5.2.0" lodash: "npm:^4.17.21" @@ -7028,7 +7028,7 @@ __metadata: resolution: "@storybook/types@workspace:lib/types" dependencies: "@storybook/channels": "workspace:*" - "@storybook/csf": "npm:^0.1.2" + "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" "@types/express": "npm:^4.7.0" "@types/fs-extra": "npm:^11.0.1" "@types/node": "npm:^18.0.0" From ab64211167ab223a01c06d119f6084e056ce817d Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 26 Mar 2024 13:12:56 +0800 Subject: [PATCH 02/30] Switch tag removal prefix from `-` to `!` --- code/addons/links/package.json | 2 +- code/lib/codemod/package.json | 2 +- code/lib/core-server/package.json | 2 +- .../src/utils/StoryIndexGenerator.ts | 2 +- code/lib/csf-tools/package.json | 2 +- code/lib/manager-api/package.json | 2 +- code/lib/preview-api/package.json | 2 +- .../template/stories/tags.stories.ts | 2 +- code/lib/source-loader/package.json | 2 +- code/lib/types/package.json | 2 +- code/package.json | 2 +- code/renderers/server/package.json | 2 +- code/ui/blocks/package.json | 2 +- code/ui/components/package.json | 2 +- code/yarn.lock | 32 +++++++++---------- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/code/addons/links/package.json b/code/addons/links/package.json index 6a135b3c576a..6718bb96b849 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -67,7 +67,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/global": "^5.0.0", "ts-dedent": "^2.0.0" }, diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 8c355eb93454..954ed90c5aa3 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -57,7 +57,7 @@ "@babel/core": "^7.23.2", "@babel/preset-env": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/csf-tools": "workspace:*", "@storybook/node-logger": "workspace:*", "@storybook/types": "workspace:*", diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 1526c391dff0..8a785c9d4e3e 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -62,7 +62,7 @@ "@storybook/channels": "workspace:*", "@storybook/core-common": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/csf-tools": "workspace:*", "@storybook/docs-mdx": "3.0.0", "@storybook/global": "^5.0.0", diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 0e036f685355..8b1fbbe738d7 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -55,7 +55,7 @@ export type StoryIndexGeneratorOptions = { }; export const AUTODOCS_TAG = 'autodocs'; -export const NO_AUTODOCS_TAG = `-${AUTODOCS_TAG}`; +export const NO_AUTODOCS_TAG = `!${AUTODOCS_TAG}`; export const STORIES_MDX_TAG = 'stories-mdx'; export const PLAY_FN_TAG = 'play-fn'; diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 39d063d32d01..bc45285b5242 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -46,7 +46,7 @@ "@babel/parser": "^7.23.0", "@babel/traverse": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/types": "workspace:*", "fs-extra": "^11.1.0", "recast": "^0.23.5", diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index 9fd9941ef00f..51621f8445d1 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/router": "workspace:*", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 23bd408491db..c3705da914f7 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/global": "^5.0.0", "@storybook/types": "workspace:*", "@types/qs": "^6.9.5", diff --git a/code/lib/preview-api/template/stories/tags.stories.ts b/code/lib/preview-api/template/stories/tags.stories.ts index 9af5be843d5f..b6b89c37ec6c 100644 --- a/code/lib/preview-api/template/stories/tags.stories.ts +++ b/code/lib/preview-api/template/stories/tags.stories.ts @@ -39,5 +39,5 @@ export const DevOnly = { }; export const TagRemoval = { - tags: ['-component-two'], + tags: ['!component-two'], }; diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index c0578007e242..624a582ef899 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -45,7 +45,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/types": "workspace:*", "estraverse": "^5.2.0", "lodash": "^4.17.21", diff --git a/code/lib/types/package.json b/code/lib/types/package.json index c09dfb384b39..fe29111a2043 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -49,7 +49,7 @@ "file-system-cache": "2.3.0" }, "devDependencies": { - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@types/fs-extra": "^11.0.1", "@types/node": "^18.0.0", "typescript": "^5.3.2" diff --git a/code/package.json b/code/package.json index c882ef4cf53d..44ed3a2544ad 100644 --- a/code/package.json +++ b/code/package.json @@ -127,7 +127,7 @@ "@storybook/core-events": "workspace:*", "@storybook/core-server": "workspace:*", "@storybook/core-webpack": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/csf-plugin": "workspace:*", "@storybook/csf-tools": "workspace:*", "@storybook/docs-tools": "workspace:*", diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 5a18737a65ca..70fda2b74aff 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -46,7 +46,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/csf-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/preview-api": "workspace:*", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index a7b11a866577..f93dfeeb03d1 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -48,7 +48,7 @@ "@storybook/client-logger": "workspace:*", "@storybook/components": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/docs-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", diff --git a/code/ui/components/package.json b/code/ui/components/package.json index 1160d1a0d126..470a71dda15d 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -61,7 +61,7 @@ "dependencies": { "@radix-ui/react-slot": "^1.0.2", "@storybook/client-logger": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.632d12b.0", + "@storybook/csf": "0.1.4--canary.80.aedde7f.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/theming": "workspace:*", diff --git a/code/yarn.lock b/code/yarn.lock index e8d2a6a1df31..6faa6a67ad53 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5256,7 +5256,7 @@ __metadata: dependencies: "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/global": "npm:^5.0.0" "@storybook/manager-api": "workspace:*" "@storybook/preview-api": "workspace:*" @@ -5524,7 +5524,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/components": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/docs-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" @@ -5755,7 +5755,7 @@ __metadata: "@babel/core": "npm:^7.23.2" "@babel/preset-env": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/csf-tools": "workspace:*" "@storybook/node-logger": "workspace:*" "@storybook/types": "workspace:*" @@ -5791,7 +5791,7 @@ __metadata: "@radix-ui/react-scroll-area": "npm:^1.0.5" "@radix-ui/react-slot": "npm:^1.0.2" "@storybook/client-logger": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/test": "workspace:*" @@ -5884,7 +5884,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/csf-tools": "workspace:*" "@storybook/docs-mdx": "npm:3.0.0" "@storybook/global": "npm:^5.0.0" @@ -5964,7 +5964,7 @@ __metadata: "@babel/parser": "npm:^7.23.0" "@babel/traverse": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/types": "workspace:*" "@types/fs-extra": "npm:^11.0.1" "@types/js-yaml": "npm:^4.0.5" @@ -5976,12 +5976,12 @@ __metadata: languageName: unknown linkType: soft -"@storybook/csf@npm:0.1.4--canary.80.632d12b.0": - version: 0.1.4--canary.80.632d12b.0 - resolution: "@storybook/csf@npm:0.1.4--canary.80.632d12b.0" +"@storybook/csf@npm:0.1.4--canary.80.aedde7f.0": + version: 0.1.4--canary.80.aedde7f.0 + resolution: "@storybook/csf@npm:0.1.4--canary.80.aedde7f.0" dependencies: type-fest: "npm:^2.19.0" - checksum: 10c0/8e2c9562d874ea78ad578eac3132bcc0dc4116e52a0cea7921888796ffa4225f106d4286bce92655584ae1ad1cf5150fd891af6cec5eb261a2e5ba5ecc4fa879 + checksum: 10c0/14bf5d4f7cb44a2534a2ea37e88350a44d43e33218184d57e7cfcf1e029967454fb16118e21ce5ebce21e1d783fe807723d8d8babf7b2cc806207e2345033748 languageName: node linkType: hard @@ -6161,7 +6161,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/router": "workspace:*" @@ -6493,7 +6493,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/global": "npm:^5.0.0" "@storybook/types": "workspace:*" "@types/qs": "npm:^6.9.5" @@ -6678,7 +6678,7 @@ __metadata: "@storybook/core-events": "workspace:*" "@storybook/core-server": "workspace:*" "@storybook/core-webpack": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/csf-plugin": "workspace:*" "@storybook/csf-tools": "workspace:*" "@storybook/docs-tools": "workspace:*" @@ -6833,7 +6833,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/server@workspace:renderers/server" dependencies: - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/csf-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/preview-api": "workspace:*" @@ -6850,7 +6850,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/source-loader@workspace:lib/source-loader" dependencies: - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@storybook/types": "workspace:*" estraverse: "npm:^5.2.0" lodash: "npm:^4.17.21" @@ -7028,7 +7028,7 @@ __metadata: resolution: "@storybook/types@workspace:lib/types" dependencies: "@storybook/channels": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.632d12b.0" + "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" "@types/express": "npm:^4.7.0" "@types/fs-extra": "npm:^11.0.1" "@types/node": "npm:^18.0.0" From b5b17f5dee27f16fcfc2cf51eec7d2dbd27d5486 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 29 Mar 2024 21:39:17 +0800 Subject: [PATCH 03/30] Add project-level tags --- code/addons/links/package.json | 2 +- code/lib/codemod/package.json | 2 +- code/lib/core-server/package.json | 2 +- .../src/utils/StoryIndexGenerator.ts | 57 ++++++++++++------- code/lib/csf-tools/package.json | 2 +- code/lib/manager-api/package.json | 2 +- code/lib/preview-api/package.json | 2 +- .../src/modules/store/csf/composeConfigs.ts | 1 + .../src/modules/store/csf/prepareStory.ts | 7 ++- code/lib/source-loader/package.json | 2 +- code/lib/types/package.json | 2 +- code/package.json | 2 +- code/renderers/server/package.json | 2 +- code/ui/blocks/package.json | 2 +- code/ui/components/package.json | 2 +- code/yarn.lock | 32 +++++------ 16 files changed, 73 insertions(+), 48 deletions(-) diff --git a/code/addons/links/package.json b/code/addons/links/package.json index 6718bb96b849..8a2c600d574c 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -67,7 +67,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/global": "^5.0.0", "ts-dedent": "^2.0.0" }, diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 954ed90c5aa3..35e5ebab28c9 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -57,7 +57,7 @@ "@babel/core": "^7.23.2", "@babel/preset-env": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/csf-tools": "workspace:*", "@storybook/node-logger": "workspace:*", "@storybook/types": "workspace:*", diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 8a785c9d4e3e..6e88034f3591 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -62,7 +62,7 @@ "@storybook/channels": "workspace:*", "@storybook/core-common": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/csf-tools": "workspace:*", "@storybook/docs-mdx": "3.0.0", "@storybook/global": "^5.0.0", diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 8b1fbbe738d7..0aaba41efd67 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -22,7 +22,7 @@ import type { import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/preview-api'; import { commonGlobOptions, normalizeStoryPath } from '@storybook/core-common'; import { logger, once } from '@storybook/node-logger'; -import { getStorySortParameter } from '@storybook/csf-tools'; +import { getStorySortParameter, loadConfig } from '@storybook/csf-tools'; import { storyNameFromExport, toId, combineTags } from '@storybook/csf'; import { analyze } from '@storybook/docs-mdx'; import dedent from 'ts-dedent'; @@ -156,8 +156,11 @@ export class StoryIndexGenerator { this.specifierToCache.set(specifier, cache) ); + const previewCode = await this.getPreviewCode(); + const projectTags = previewCode && this.getProjectTags(previewCode); + // Extract stories for each file - await this.ensureExtracted(); + await this.ensureExtracted({ projectTags }); } /** @@ -211,7 +214,11 @@ export class StoryIndexGenerator { return /(? { + async ensureExtracted({ + projectTags, + }: { + projectTags?: Tag[]; + }): Promise<(IndexEntry | ErrorEntry)[]> { // First process all the story files. Then, in a second pass, // process the docs files. The reason for this is that the docs // files may use the `` syntax, which requires @@ -234,19 +241,26 @@ export class StoryIndexGenerator { ); return Object.values(cache).flatMap((entry): (IndexEntry | ErrorEntry)[] => { if (!entry) return []; - if (entry.type === 'docs') return [entry]; + if (entry.type === 'docs') return [this.addProjectTags(entry, projectTags)]; if (entry.type === 'error') return [entry]; return entry.entries.map((item) => { - if (item.type === 'docs') return item; + if (item.type === 'docs') return this.addProjectTags(item, projectTags); // Drop the meta id as it isn't part of the index, we just used it for record keeping in `extractDocs` const { metaId, ...existing } = item; - return existing; + return this.addProjectTags(existing, projectTags); }); }); }); } + addProjectTags(entry: IndexEntry, projectTags?: Tag[]) { + return { + ...entry, + metaTags: combineTags(...(projectTags || []), ...(entry.metaTags || [])), + }; + } + findDependencies(absoluteImports: Path[]) { return [...this.specifierToCache.values()].flatMap((cache: SpecifierStoriesCache) => Object.entries(cache) @@ -535,10 +549,8 @@ export class StoryIndexGenerator { return betterEntry; } - async sortStories(entries: StoryIndex['entries']) { + async sortStories(entries: StoryIndex['entries'], storySortParameter: any) { const sortableStories = Object.values(entries); - - const storySortParameter = await this.getStorySortParameter(); const fileNameOrder = this.storyFileNames(); sortStoriesV7(sortableStories, storySortParameter, fileNameOrder); @@ -555,9 +567,12 @@ export class StoryIndexGenerator { if (this.lastIndex) return this.lastIndex; if (this.lastError) throw this.lastError; + const previewCode = await this.getPreviewCode(); + const projectTags = previewCode && this.getProjectTags(previewCode); + // Extract any entries that are currently missing // Pull out each file's stories into a list of stories, to be composed and sorted - const storiesList = await this.ensureExtracted(); + const storiesList = await this.ensureExtracted({ projectTags }); try { const errorEntries = storiesList.filter((entry) => entry.type === 'error'); @@ -581,7 +596,10 @@ export class StoryIndexGenerator { }); if (duplicateErrors.length) throw new MultipleIndexingError(duplicateErrors); - const sorted = await this.sortStories(indexEntries); + const sorted = await this.sortStories( + indexEntries, + previewCode && getStorySortParameter(previewCode) + ); this.lastIndex = { v: 4, @@ -641,17 +659,18 @@ export class StoryIndexGenerator { this.lastError = null; } - async getStorySortParameter() { - const previewFile = ['js', 'jsx', 'ts', 'tsx', 'mjs', 'cjs'] + async getPreviewCode() { + const previewFile = ['js', 'jsx', 'ts', 'tsx', 'mjs', 'cjs', 'mts'] .map((ext) => path.join(this.options.configDir, `preview.${ext}`)) .find((fname) => fs.existsSync(fname)); - let storySortParameter; - if (previewFile) { - const previewCode = (await fs.readFile(previewFile, 'utf-8')).toString(); - storySortParameter = await getStorySortParameter(previewCode); - } - return storySortParameter; + return previewFile && (await fs.readFile(previewFile, 'utf-8')).toString(); + } + + getProjectTags(previewCode: string) { + const projectAnnotations = loadConfig(previewCode).parse(); + const projectTags = projectAnnotations.getFieldValue(['tags']); + return projectTags; } // Get the story file names in "imported order" diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index bc45285b5242..1f8b41d7b51b 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -46,7 +46,7 @@ "@babel/parser": "^7.23.0", "@babel/traverse": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/types": "workspace:*", "fs-extra": "^11.1.0", "recast": "^0.23.5", diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index 51621f8445d1..abced2447faf 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/router": "workspace:*", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index c3705da914f7..cb995ab59c37 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/global": "^5.0.0", "@storybook/types": "workspace:*", "@types/qs": "^6.9.5", diff --git a/code/lib/preview-api/src/modules/store/csf/composeConfigs.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.ts index e5785a6a3f01..29823816beaf 100644 --- a/code/lib/preview-api/src/modules/store/csf/composeConfigs.ts +++ b/code/lib/preview-api/src/modules/store/csf/composeConfigs.ts @@ -63,5 +63,6 @@ export function composeConfigs( renderToDOM: getSingletonField(moduleExportList, 'renderToDOM'), // deprecated applyDecorators: getSingletonField(moduleExportList, 'applyDecorators'), runStep: composeStepRunners(stepRunners), + tags: getArrayField(moduleExportList, 'tags'), }; } diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index ad35eff50f07..4b8035f606d3 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -125,6 +125,10 @@ export function prepareMeta( projectAnnotations: NormalizedProjectAnnotations, moduleExport: ModuleExport ): PreparedMeta { + console.log('prepareMeta', { + metaTags: componentAnnotations.tags, + projectAnnotations, + }); return { ...preparePartialAnnotations(undefined, componentAnnotations, projectAnnotations), moduleExport, @@ -141,8 +145,9 @@ function preparePartialAnnotations( // will have a limited cost. If this proves misguided, we can refactor it. const tags = combineTags( - ...(storyAnnotations?.tags ?? []), + ...(projectAnnotations.tags ?? []), ...(componentAnnotations.tags ?? []), + ...(storyAnnotations?.tags ?? []), 'story' ); diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index 624a582ef899..5f1ac102b5d6 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -45,7 +45,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/types": "workspace:*", "estraverse": "^5.2.0", "lodash": "^4.17.21", diff --git a/code/lib/types/package.json b/code/lib/types/package.json index fe29111a2043..f9eb319420b7 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -49,7 +49,7 @@ "file-system-cache": "2.3.0" }, "devDependencies": { - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@types/fs-extra": "^11.0.1", "@types/node": "^18.0.0", "typescript": "^5.3.2" diff --git a/code/package.json b/code/package.json index 44ed3a2544ad..454f5b0dd84a 100644 --- a/code/package.json +++ b/code/package.json @@ -127,7 +127,7 @@ "@storybook/core-events": "workspace:*", "@storybook/core-server": "workspace:*", "@storybook/core-webpack": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/csf-plugin": "workspace:*", "@storybook/csf-tools": "workspace:*", "@storybook/docs-tools": "workspace:*", diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 70fda2b74aff..54c669fac08a 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -46,7 +46,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/csf-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/preview-api": "workspace:*", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index f93dfeeb03d1..a28714a17228 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -48,7 +48,7 @@ "@storybook/client-logger": "workspace:*", "@storybook/components": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/docs-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", diff --git a/code/ui/components/package.json b/code/ui/components/package.json index 470a71dda15d..6569d692d59a 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -61,7 +61,7 @@ "dependencies": { "@radix-ui/react-slot": "^1.0.2", "@storybook/client-logger": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.aedde7f.0", + "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/theming": "workspace:*", diff --git a/code/yarn.lock b/code/yarn.lock index 6faa6a67ad53..30fe40584238 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5256,7 +5256,7 @@ __metadata: dependencies: "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/global": "npm:^5.0.0" "@storybook/manager-api": "workspace:*" "@storybook/preview-api": "workspace:*" @@ -5524,7 +5524,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/components": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/docs-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" @@ -5755,7 +5755,7 @@ __metadata: "@babel/core": "npm:^7.23.2" "@babel/preset-env": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/csf-tools": "workspace:*" "@storybook/node-logger": "workspace:*" "@storybook/types": "workspace:*" @@ -5791,7 +5791,7 @@ __metadata: "@radix-ui/react-scroll-area": "npm:^1.0.5" "@radix-ui/react-slot": "npm:^1.0.2" "@storybook/client-logger": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/test": "workspace:*" @@ -5884,7 +5884,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/csf-tools": "workspace:*" "@storybook/docs-mdx": "npm:3.0.0" "@storybook/global": "npm:^5.0.0" @@ -5964,7 +5964,7 @@ __metadata: "@babel/parser": "npm:^7.23.0" "@babel/traverse": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/types": "workspace:*" "@types/fs-extra": "npm:^11.0.1" "@types/js-yaml": "npm:^4.0.5" @@ -5976,12 +5976,12 @@ __metadata: languageName: unknown linkType: soft -"@storybook/csf@npm:0.1.4--canary.80.aedde7f.0": - version: 0.1.4--canary.80.aedde7f.0 - resolution: "@storybook/csf@npm:0.1.4--canary.80.aedde7f.0" +"@storybook/csf@npm:0.1.4--canary.80.f469755.0": + version: 0.1.4--canary.80.f469755.0 + resolution: "@storybook/csf@npm:0.1.4--canary.80.f469755.0" dependencies: type-fest: "npm:^2.19.0" - checksum: 10c0/14bf5d4f7cb44a2534a2ea37e88350a44d43e33218184d57e7cfcf1e029967454fb16118e21ce5ebce21e1d783fe807723d8d8babf7b2cc806207e2345033748 + checksum: 10c0/a5b2dfe1c2d02b6ab072c7ca0b3918f24ac3093ec740cd79a44f178b583d02ad1f838bfd77cd30ea486c92e7a9b37a921d2e0807e3b1a7cc26f57c62a446ed24 languageName: node linkType: hard @@ -6161,7 +6161,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/router": "workspace:*" @@ -6493,7 +6493,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/global": "npm:^5.0.0" "@storybook/types": "workspace:*" "@types/qs": "npm:^6.9.5" @@ -6678,7 +6678,7 @@ __metadata: "@storybook/core-events": "workspace:*" "@storybook/core-server": "workspace:*" "@storybook/core-webpack": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/csf-plugin": "workspace:*" "@storybook/csf-tools": "workspace:*" "@storybook/docs-tools": "workspace:*" @@ -6833,7 +6833,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/server@workspace:renderers/server" dependencies: - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/csf-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/preview-api": "workspace:*" @@ -6850,7 +6850,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/source-loader@workspace:lib/source-loader" dependencies: - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/types": "workspace:*" estraverse: "npm:^5.2.0" lodash: "npm:^4.17.21" @@ -7028,7 +7028,7 @@ __metadata: resolution: "@storybook/types@workspace:lib/types" dependencies: "@storybook/channels": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.aedde7f.0" + "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@types/express": "npm:^4.7.0" "@types/fs-extra": "npm:^11.0.1" "@types/node": "npm:^18.0.0" From c52d9438e5654559a8b787300d650f4812ce37a4 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sat, 30 Mar 2024 00:29:57 +0800 Subject: [PATCH 04/30] Deprecate main.js docs.autodocs in favor of tags --- .../src/utils/StoryIndexGenerator.ts | 35 ++++++++++++------- .../src/modules/store/csf/prepareStory.ts | 4 --- code/lib/types/src/modules/core-common.ts | 2 ++ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 0aaba41efd67..fae54d3f9372 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -55,7 +55,6 @@ export type StoryIndexGeneratorOptions = { }; export const AUTODOCS_TAG = 'autodocs'; -export const NO_AUTODOCS_TAG = `!${AUTODOCS_TAG}`; export const STORIES_MDX_TAG = 'stories-mdx'; export const PLAY_FN_TAG = 'play-fn'; @@ -254,10 +253,18 @@ export class StoryIndexGenerator { }); } + getExtraTags() { + return this.options.docs.autodocs === true ? [AUTODOCS_TAG] : []; + } + addProjectTags(entry: IndexEntry, projectTags?: Tag[]) { return { ...entry, - metaTags: combineTags(...(projectTags || []), ...(entry.metaTags || [])), + metaTags: combineTags( + ...this.getExtraTags(), + ...(projectTags ?? []), + ...(entry.metaTags ?? []) + ), }; } @@ -306,7 +313,13 @@ export class StoryIndexGenerator { const title = input.title ?? defaultMakeTitle(); // eslint-disable-next-line no-underscore-dangle const id = input.__id ?? toId(input.metaId ?? title, storyNameFromExport(input.exportName)); - const tags = combineTags(...(input.tags ?? []), ...(input.metaTags ?? []), 'story'); + const extraTags = this.getExtraTags(); + const tags = combineTags( + ...extraTags, + ...(input.metaTags ?? []), + ...(input.tags ?? []), + 'story' + ); return { type: 'story', @@ -320,23 +333,18 @@ export class StoryIndexGenerator { }; }); - const { autodocs } = this.options.docs; // We need a docs entry attached to the CSF file if either: - // a) autodocs is globally enabled - // b) we have autodocs enabled for this file - // c) it is a stories.mdx transpiled to CSF + // a) we have autodocs enabled for this file + // b) it is a stories.mdx transpiled to CSF const hasAutodocsTag = entries.some((entry) => entry.tags.includes(AUTODOCS_TAG)); const isStoriesMdx = entries.some((entry) => entry.tags.includes(STORIES_MDX_TAG)); - const createDocEntry = - (autodocs === true && !entries.some((entry) => entry.tags.includes(NO_AUTODOCS_TAG))) || - (autodocs === 'tag' && hasAutodocsTag) || - isStoriesMdx; + const createDocEntry = (hasAutodocsTag && this.options.docs.autodocs !== false) || isStoriesMdx; if (createDocEntry && this.options.build?.test?.disableAutoDocs !== true) { const name = this.options.docs.defaultName ?? 'Docs'; const { metaId } = indexInputs[0]; const { title } = entries[0]; - const metaTags = indexInputs[0].metaTags || []; + const metaTags = indexInputs[0].metaTags ?? []; const id = toId(metaId ?? title, name); entries.unshift({ id, @@ -457,7 +465,8 @@ export class StoryIndexGenerator { type: 'docs', // FIXME: update this to use the index entry's metaTags once we update this to run on `IndexInputs` tags: combineTags( - ...(result.tags || []), + ...this.getExtraTags(), + ...(result.tags ?? []), csfEntry ? 'attached-mdx' : 'unattached-mdx', 'docs' ), diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 4b8035f606d3..f7bb302c0d74 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -125,10 +125,6 @@ export function prepareMeta( projectAnnotations: NormalizedProjectAnnotations, moduleExport: ModuleExport ): PreparedMeta { - console.log('prepareMeta', { - metaTags: componentAnnotations.tags, - projectAnnotations, - }); return { ...preparePartialAnnotations(undefined, componentAnnotations, projectAnnotations), moduleExport, diff --git a/code/lib/types/src/modules/core-common.ts b/code/lib/types/src/modules/core-common.ts index c4aeeacbcf1f..0e8dd7f002cd 100644 --- a/code/lib/types/src/modules/core-common.ts +++ b/code/lib/types/src/modules/core-common.ts @@ -280,6 +280,8 @@ export type DocsOptions = { * Should we generate a docs entry per CSF file? * Set to 'tag' (the default) to generate an entry for every CSF file with the * 'autodocs' tag. + * + * @deprecated Use `tags: ['autodocs']` in .storybook/preview.js instead */ autodocs?: boolean | 'tag'; /** From ebce0807d1b1ad53334fef14b8ddfad70ea22511 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sat, 30 Mar 2024 01:00:51 +0800 Subject: [PATCH 05/30] Add autodocs tag in preview if docs.autodics is true --- code/lib/preview-api/src/modules/store/csf/prepareStory.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index f7bb302c0d74..3350a32e3fe3 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -21,6 +21,7 @@ import type { StrictArgTypes, } from '@storybook/types'; import { includeConditionalArg, combineTags } from '@storybook/csf'; +import { global as globalThis } from '@storybook/global'; import { applyHooks } from '../../addons'; import { combineParameters } from '../parameters'; @@ -140,7 +141,10 @@ function preparePartialAnnotations( // anything at render time. The assumption is that as we don't load all the stories at once, this // will have a limited cost. If this proves misguided, we can refactor it. + const extraTags = globalThis.DOCS_OPTIONS?.autodocs === true ? ['autodocs'] : []; + const tags = combineTags( + ...extraTags, ...(projectAnnotations.tags ?? []), ...(componentAnnotations.tags ?? []), ...(storyAnnotations?.tags ?? []), From f54b030b80ef7cc10e0490e66303aa2d94385e26 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 4 Apr 2024 21:22:40 +0800 Subject: [PATCH 06/30] Always apply dev/docs/test tags --- code/lib/core-server/package.json | 2 +- .../src/utils/StoryIndexGenerator.ts | 100 ++++++++---------- .../src/modules/store/csf/prepareStory.ts | 2 + .../template/stories/tags.stories.ts | 2 +- code/yarn.lock | 10 +- 5 files changed, 52 insertions(+), 64 deletions(-) diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 6e88034f3591..562e76e0a022 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -64,7 +64,7 @@ "@storybook/core-events": "workspace:*", "@storybook/csf": "0.1.4--canary.80.f469755.0", "@storybook/csf-tools": "workspace:*", - "@storybook/docs-mdx": "3.0.0", + "@storybook/docs-mdx": "3.1.0-next.0", "@storybook/global": "^5.0.0", "@storybook/manager": "workspace:*", "@storybook/manager-api": "workspace:*", diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index fae54d3f9372..bd8ebe25d105 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -9,13 +9,11 @@ import type { IndexEntry, StoryIndexEntry, DocsIndexEntry, - ComponentTitle, NormalizedStoriesSpecifier, DocsOptions, Path, Tag, StoryIndex, - StoryName, Indexer, StorybookConfigRaw, } from '@storybook/types'; @@ -156,7 +154,7 @@ export class StoryIndexGenerator { ); const previewCode = await this.getPreviewCode(); - const projectTags = previewCode && this.getProjectTags(previewCode); + const projectTags = previewCode ? this.getProjectTags(previewCode) : []; // Extract stories for each file await this.ensureExtracted({ projectTags }); @@ -223,11 +221,13 @@ export class StoryIndexGenerator { // files may use the `` syntax, which requires // that the story file that contains the meta be processed first. await this.updateExtracted(async (specifier, absolutePath) => - this.isDocsMdx(absolutePath) ? false : this.extractStories(specifier, absolutePath) + this.isDocsMdx(absolutePath) + ? false + : this.extractStories(specifier, absolutePath, projectTags) ); await this.updateExtracted(async (specifier, absolutePath) => - this.extractDocs(specifier, absolutePath) + this.extractDocs(specifier, absolutePath, projectTags) ); return this.specifiers.flatMap((specifier) => { @@ -240,34 +240,19 @@ export class StoryIndexGenerator { ); return Object.values(cache).flatMap((entry): (IndexEntry | ErrorEntry)[] => { if (!entry) return []; - if (entry.type === 'docs') return [this.addProjectTags(entry, projectTags)]; + if (entry.type === 'docs') return [entry]; if (entry.type === 'error') return [entry]; return entry.entries.map((item) => { - if (item.type === 'docs') return this.addProjectTags(item, projectTags); + if (item.type === 'docs') return item; // Drop the meta id as it isn't part of the index, we just used it for record keeping in `extractDocs` const { metaId, ...existing } = item; - return this.addProjectTags(existing, projectTags); + return existing; }); }); }); } - getExtraTags() { - return this.options.docs.autodocs === true ? [AUTODOCS_TAG] : []; - } - - addProjectTags(entry: IndexEntry, projectTags?: Tag[]) { - return { - ...entry, - metaTags: combineTags( - ...this.getExtraTags(), - ...(projectTags ?? []), - ...(entry.metaTags ?? []) - ), - }; - } - findDependencies(absoluteImports: Path[]) { return [...this.specifierToCache.values()].flatMap((cache: SpecifierStoriesCache) => Object.entries(cache) @@ -288,7 +273,8 @@ export class StoryIndexGenerator { async extractStories( specifier: NormalizedStoriesSpecifier, - absolutePath: Path + absolutePath: Path, + projectTags: Tag[] = [] ): Promise { const relativePath = path.relative(this.options.workingDir, absolutePath); const importPath = slash(normalizeStoryPath(relativePath)); @@ -313,13 +299,8 @@ export class StoryIndexGenerator { const title = input.title ?? defaultMakeTitle(); // eslint-disable-next-line no-underscore-dangle const id = input.__id ?? toId(input.metaId ?? title, storyNameFromExport(input.exportName)); - const extraTags = this.getExtraTags(); - const tags = combineTags( - ...extraTags, - ...(input.metaTags ?? []), - ...(input.tags ?? []), - 'story' - ); + const metaTags = combineTags(...projectTags, ...(input.metaTags ?? [])); + const tags = combineTags(...metaTags, ...(input.tags ?? [])); return { type: 'story', @@ -328,7 +309,7 @@ export class StoryIndexGenerator { name, title, importPath, - metaTags: input.metaTags ?? [], + metaTags, tags, }; }); @@ -344,8 +325,10 @@ export class StoryIndexGenerator { const name = this.options.docs.defaultName ?? 'Docs'; const { metaId } = indexInputs[0]; const { title } = entries[0]; - const metaTags = indexInputs[0].metaTags ?? []; const id = toId(metaId ?? title, name); + const metaTags = combineTags(...projectTags, ...(indexInputs[0].metaTags ?? [])); + const tags = combineTags(...metaTags, ...(indexInputs[0].tags ?? [])); + entries.unshift({ id, title, @@ -353,11 +336,7 @@ export class StoryIndexGenerator { importPath, type: 'docs', metaTags, - tags: combineTags( - ...metaTags, - 'docs', - ...(!hasAutodocsTag && !isStoriesMdx ? [AUTODOCS_TAG] : []) - ), + tags, storiesImports: [], }); } @@ -373,7 +352,11 @@ export class StoryIndexGenerator { }; } - async extractDocs(specifier: NormalizedStoriesSpecifier, absolutePath: Path) { + async extractDocs( + specifier: NormalizedStoriesSpecifier, + absolutePath: Path, + projectTags: Tag[] = [] + ) { const relativePath = path.relative(this.options.workingDir, absolutePath); try { const normalizedPath = normalizeStoryPath(relativePath); @@ -381,14 +364,7 @@ export class StoryIndexGenerator { const content = await fs.readFile(absolutePath, 'utf8'); - const result: { - title?: ComponentTitle; - of?: Path; - name?: StoryName; - isTemplate?: boolean; - imports?: Path[]; - tags?: Tag[]; - } = analyze(content); + const result = analyze(content); // Templates are not indexed if (result.isTemplate) return false; @@ -454,8 +430,21 @@ export class StoryIndexGenerator { const name = result.name || (csfEntry ? autoName(importPath, csfEntry.importPath, defaultName) : defaultName); + const id = toId(csfEntry?.metaId || title, name); + const metaTags = combineTags( + ...projectTags, + ...(result.metaTags ?? []), + ...(csfEntry?.metaTags ?? []) + ); + const tags = combineTags( + ...metaTags, + ...(csfEntry?.tags ?? []), + csfEntry ? 'attached-mdx' : 'unattached-mdx' + ); + console.log({ projectTags, metaTags, tags }); + const docsEntry: DocsCacheEntry = { id, title, @@ -463,13 +452,8 @@ export class StoryIndexGenerator { importPath, storiesImports: sortedDependencies.map((dep) => dep.entries[0].importPath), type: 'docs', - // FIXME: update this to use the index entry's metaTags once we update this to run on `IndexInputs` - tags: combineTags( - ...this.getExtraTags(), - ...(result.tags ?? []), - csfEntry ? 'attached-mdx' : 'unattached-mdx', - 'docs' - ), + metaTags, + tags, }; return docsEntry; } catch (err) { @@ -577,7 +561,7 @@ export class StoryIndexGenerator { if (this.lastError) throw this.lastError; const previewCode = await this.getPreviewCode(); - const projectTags = previewCode && this.getProjectTags(previewCode); + const projectTags = previewCode ? this.getProjectTags(previewCode) : []; // Extract any entries that are currently missing // Pull out each file's stories into a list of stories, to be composed and sorted @@ -678,8 +662,10 @@ export class StoryIndexGenerator { getProjectTags(previewCode: string) { const projectAnnotations = loadConfig(previewCode).parse(); - const projectTags = projectAnnotations.getFieldValue(['tags']); - return projectTags; + const defaultTags = ['dev', 'docs', 'test']; + const extraTags = this.options.docs.autodocs === true ? [AUTODOCS_TAG] : []; + const projectTags = projectAnnotations.getFieldValue(['tags']) ?? []; + return [...defaultTags, ...projectTags, ...extraTags]; } // Get the story file names in "imported order" diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 3350a32e3fe3..bd4a4fc33d1d 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -141,9 +141,11 @@ function preparePartialAnnotations( // anything at render time. The assumption is that as we don't load all the stories at once, this // will have a limited cost. If this proves misguided, we can refactor it. + const defaultTags = ['dev', 'docs', 'test']; const extraTags = globalThis.DOCS_OPTIONS?.autodocs === true ? ['autodocs'] : []; const tags = combineTags( + ...defaultTags, ...extraTags, ...(projectAnnotations.tags ?? []), ...(componentAnnotations.tags ?? []), diff --git a/code/lib/preview-api/template/stories/tags.stories.ts b/code/lib/preview-api/template/stories/tags.stories.ts index b6b89c37ec6c..f86b36f08491 100644 --- a/code/lib/preview-api/template/stories/tags.stories.ts +++ b/code/lib/preview-api/template/stories/tags.stories.ts @@ -4,7 +4,7 @@ import { within, expect } from '@storybook/test'; export default { component: globalThis.Components.Pre, - tags: ['component-one', 'component-two', 'autodocs'], + tags: ['component-one', 'component-two', '!autodocs'], decorators: [ (storyFn: PartialStoryFn, context: StoryContext) => { return storyFn({ diff --git a/code/yarn.lock b/code/yarn.lock index 30fe40584238..b284385e5ec3 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5886,7 +5886,7 @@ __metadata: "@storybook/core-events": "workspace:*" "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" "@storybook/csf-tools": "workspace:*" - "@storybook/docs-mdx": "npm:3.0.0" + "@storybook/docs-mdx": "npm:3.1.0-next.0" "@storybook/global": "npm:^5.0.0" "@storybook/manager": "workspace:*" "@storybook/manager-api": "workspace:*" @@ -5994,10 +5994,10 @@ __metadata: languageName: node linkType: hard -"@storybook/docs-mdx@npm:3.0.0": - version: 3.0.0 - resolution: "@storybook/docs-mdx@npm:3.0.0" - checksum: 10c0/4f4242fc05b57e8dc239204c71fd0d1481c9abbf20d12dd0f3dace74f77a7ff7cbe0bd07d7d785873b45747be64cad273423d3dc0cf89b52e9f117592a4b054f +"@storybook/docs-mdx@npm:3.1.0-next.0": + version: 3.1.0-next.0 + resolution: "@storybook/docs-mdx@npm:3.1.0-next.0" + checksum: 10c0/7622d7c6318e842c90a71c1836d68531236c31fff7081c885803eddfafb7e3f8998689f612eaa0292209ada8352a36657dcacb5d3ef4632b8e8b8a283c39602e languageName: node linkType: hard From fea9c2e44bba9437d32cb813e4affa34e9f6443a Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 5 Apr 2024 10:04:01 +0800 Subject: [PATCH 07/30] Fix tag precedence in CSF combineTags util --- code/addons/links/package.json | 2 +- code/lib/codemod/package.json | 2 +- code/lib/core-server/package.json | 2 +- code/lib/csf-tools/package.json | 2 +- code/lib/manager-api/package.json | 2 +- code/lib/preview-api/package.json | 2 +- code/lib/source-loader/package.json | 2 +- code/lib/types/package.json | 2 +- code/package.json | 2 +- code/renderers/server/package.json | 2 +- code/ui/blocks/package.json | 2 +- code/ui/components/package.json | 2 +- code/yarn.lock | 32 ++++++++++++++--------------- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/code/addons/links/package.json b/code/addons/links/package.json index 8a2c600d574c..8d0cb0156fc6 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -67,7 +67,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/global": "^5.0.0", "ts-dedent": "^2.0.0" }, diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 35e5ebab28c9..494aefdeae80 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -57,7 +57,7 @@ "@babel/core": "^7.23.2", "@babel/preset-env": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/csf-tools": "workspace:*", "@storybook/node-logger": "workspace:*", "@storybook/types": "workspace:*", diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 562e76e0a022..3eab0e705596 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -62,7 +62,7 @@ "@storybook/channels": "workspace:*", "@storybook/core-common": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/csf-tools": "workspace:*", "@storybook/docs-mdx": "3.1.0-next.0", "@storybook/global": "^5.0.0", diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 1f8b41d7b51b..70f557e61717 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -46,7 +46,7 @@ "@babel/parser": "^7.23.0", "@babel/traverse": "^7.23.2", "@babel/types": "^7.23.0", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/types": "workspace:*", "fs-extra": "^11.1.0", "recast": "^0.23.5", diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index abced2447faf..1bd4b13a2894 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/router": "workspace:*", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index cb995ab59c37..18d14c1dc6e6 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -47,7 +47,7 @@ "@storybook/channels": "workspace:*", "@storybook/client-logger": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/global": "^5.0.0", "@storybook/types": "workspace:*", "@types/qs": "^6.9.5", diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index 5f1ac102b5d6..d6e881699e63 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -45,7 +45,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/types": "workspace:*", "estraverse": "^5.2.0", "lodash": "^4.17.21", diff --git a/code/lib/types/package.json b/code/lib/types/package.json index f9eb319420b7..5beadddb167c 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -49,7 +49,7 @@ "file-system-cache": "2.3.0" }, "devDependencies": { - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@types/fs-extra": "^11.0.1", "@types/node": "^18.0.0", "typescript": "^5.3.2" diff --git a/code/package.json b/code/package.json index 454f5b0dd84a..fa57cc16f825 100644 --- a/code/package.json +++ b/code/package.json @@ -127,7 +127,7 @@ "@storybook/core-events": "workspace:*", "@storybook/core-server": "workspace:*", "@storybook/core-webpack": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/csf-plugin": "workspace:*", "@storybook/csf-tools": "workspace:*", "@storybook/docs-tools": "workspace:*", diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 54c669fac08a..ee1d7500c933 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -46,7 +46,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/csf-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/preview-api": "workspace:*", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index a28714a17228..6af6b19568c2 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -48,7 +48,7 @@ "@storybook/client-logger": "workspace:*", "@storybook/components": "workspace:*", "@storybook/core-events": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/docs-tools": "workspace:*", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", diff --git a/code/ui/components/package.json b/code/ui/components/package.json index 6569d692d59a..82dbd87d5f3e 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -61,7 +61,7 @@ "dependencies": { "@radix-ui/react-slot": "^1.0.2", "@storybook/client-logger": "workspace:*", - "@storybook/csf": "0.1.4--canary.80.f469755.0", + "@storybook/csf": "0.1.4--canary.80.ba37fd5.0", "@storybook/global": "^5.0.0", "@storybook/icons": "^1.2.5", "@storybook/theming": "workspace:*", diff --git a/code/yarn.lock b/code/yarn.lock index b284385e5ec3..a8a50005249a 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5256,7 +5256,7 @@ __metadata: dependencies: "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/global": "npm:^5.0.0" "@storybook/manager-api": "workspace:*" "@storybook/preview-api": "workspace:*" @@ -5524,7 +5524,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/components": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/docs-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" @@ -5755,7 +5755,7 @@ __metadata: "@babel/core": "npm:^7.23.2" "@babel/preset-env": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/csf-tools": "workspace:*" "@storybook/node-logger": "workspace:*" "@storybook/types": "workspace:*" @@ -5791,7 +5791,7 @@ __metadata: "@radix-ui/react-scroll-area": "npm:^1.0.5" "@radix-ui/react-slot": "npm:^1.0.2" "@storybook/client-logger": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/test": "workspace:*" @@ -5884,7 +5884,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/csf-tools": "workspace:*" "@storybook/docs-mdx": "npm:3.1.0-next.0" "@storybook/global": "npm:^5.0.0" @@ -5964,7 +5964,7 @@ __metadata: "@babel/parser": "npm:^7.23.0" "@babel/traverse": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/types": "workspace:*" "@types/fs-extra": "npm:^11.0.1" "@types/js-yaml": "npm:^4.0.5" @@ -5976,12 +5976,12 @@ __metadata: languageName: unknown linkType: soft -"@storybook/csf@npm:0.1.4--canary.80.f469755.0": - version: 0.1.4--canary.80.f469755.0 - resolution: "@storybook/csf@npm:0.1.4--canary.80.f469755.0" +"@storybook/csf@npm:0.1.4--canary.80.ba37fd5.0": + version: 0.1.4--canary.80.ba37fd5.0 + resolution: "@storybook/csf@npm:0.1.4--canary.80.ba37fd5.0" dependencies: type-fest: "npm:^2.19.0" - checksum: 10c0/a5b2dfe1c2d02b6ab072c7ca0b3918f24ac3093ec740cd79a44f178b583d02ad1f838bfd77cd30ea486c92e7a9b37a921d2e0807e3b1a7cc26f57c62a446ed24 + checksum: 10c0/88518cff77be4b8a714fdfa091686455e3cbe0023116ca4b9bce2b72cc5e0659c6fd6b5a4920a31e51db0050fb622bbcb0f32fffb09c9b84a068df92cb0b0585 languageName: node linkType: hard @@ -6161,7 +6161,7 @@ __metadata: "@storybook/channels": "workspace:*" "@storybook/client-logger": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/global": "npm:^5.0.0" "@storybook/icons": "npm:^1.2.5" "@storybook/router": "workspace:*" @@ -6493,7 +6493,7 @@ __metadata: "@storybook/client-logger": "workspace:*" "@storybook/core-common": "workspace:*" "@storybook/core-events": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/global": "npm:^5.0.0" "@storybook/types": "workspace:*" "@types/qs": "npm:^6.9.5" @@ -6678,7 +6678,7 @@ __metadata: "@storybook/core-events": "workspace:*" "@storybook/core-server": "workspace:*" "@storybook/core-webpack": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/csf-plugin": "workspace:*" "@storybook/csf-tools": "workspace:*" "@storybook/docs-tools": "workspace:*" @@ -6833,7 +6833,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/server@workspace:renderers/server" dependencies: - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/csf-tools": "workspace:*" "@storybook/global": "npm:^5.0.0" "@storybook/preview-api": "workspace:*" @@ -6850,7 +6850,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/source-loader@workspace:lib/source-loader" dependencies: - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@storybook/types": "workspace:*" estraverse: "npm:^5.2.0" lodash: "npm:^4.17.21" @@ -7028,7 +7028,7 @@ __metadata: resolution: "@storybook/types@workspace:lib/types" dependencies: "@storybook/channels": "workspace:*" - "@storybook/csf": "npm:0.1.4--canary.80.f469755.0" + "@storybook/csf": "npm:0.1.4--canary.80.ba37fd5.0" "@types/express": "npm:^4.7.0" "@types/fs-extra": "npm:^11.0.1" "@types/node": "npm:^18.0.0" From bcd3da875a7e3c716576cdcf25b54965c9366271 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 5 Apr 2024 11:40:35 +0800 Subject: [PATCH 08/30] Remove metaTags concept --- .../src/utils/StoryIndexGenerator.test.ts | 225 +++++++++++++----- .../src/utils/StoryIndexGenerator.ts | 19 +- .../utils/__tests__/index-extraction.test.ts | 34 +-- .../src/utils/stories-json.test.ts | 52 +++- code/lib/csf-tools/src/CsfFile.test.ts | 10 - code/lib/csf-tools/src/CsfFile.ts | 5 +- .../modules/preview-web/PreviewWeb.test.ts | 12 + .../src/modules/store/StoryStore.test.ts | 30 +++ code/lib/types/src/modules/indexer.ts | 3 - 9 files changed, 266 insertions(+), 124 deletions(-) diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts index ad4aafd4a26e..ed9ed2a20b2c 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts @@ -79,9 +79,11 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -110,8 +112,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/F.story.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "F", "type": "story", @@ -140,8 +144,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "stories", "type": "story", @@ -170,8 +176,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/nested/Button.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", - "story", ], "title": "nested/Button", "type": "story", @@ -181,7 +189,9 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/second-nested/G.stories.ts", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "second-nested/G", "type": "story", @@ -210,9 +220,11 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -222,8 +234,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/B.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "B", "type": "story", @@ -233,8 +247,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/D.stories.jsx", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "D", "type": "story", @@ -244,7 +260,9 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/first-nested/deeply/F.stories.js", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "first-nested/deeply/F", "type": "story", @@ -254,8 +272,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/H.stories.mjs", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "H", "type": "story", @@ -265,8 +285,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/nested/Button.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", - "story", ], "title": "nested/Button", "type": "story", @@ -276,7 +298,9 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/second-nested/G.stories.ts", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "second-nested/G", "type": "story", @@ -310,9 +334,11 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -323,8 +349,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "B", "type": "docs", @@ -334,8 +362,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/B.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "B", "type": "story", @@ -346,8 +376,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "D", "type": "docs", @@ -357,8 +389,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/D.stories.jsx", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "D", "type": "story", @@ -368,7 +402,9 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/first-nested/deeply/F.stories.js", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "first-nested/deeply/F", "type": "story", @@ -379,8 +415,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "H", "type": "docs", @@ -390,8 +428,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/H.stories.mjs", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "H", "type": "story", @@ -401,8 +441,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/nested/Button.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", - "story", ], "title": "nested/Button", "type": "story", @@ -412,7 +454,9 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/second-nested/G.stories.ts", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "second-nested/G", "type": "story", @@ -535,8 +579,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "B", "type": "docs", @@ -549,8 +595,11 @@ describe('StoryIndexGenerator', () => { "./src/B.stories.ts", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "autodocs", + "attached-mdx", ], "title": "B", "type": "docs", @@ -560,8 +609,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/B.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "B", "type": "story", @@ -594,8 +645,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "B", "type": "docs", @@ -608,8 +661,11 @@ describe('StoryIndexGenerator', () => { "./src/B.stories.ts", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "autodocs", + "attached-mdx", ], "title": "B", "type": "docs", @@ -619,8 +675,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/B.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "B", "type": "story", @@ -653,14 +711,19 @@ describe('StoryIndexGenerator', () => { "entries": { "a--docs": { "id": "a--docs", - "importPath": "./errors/A.mdx", + "importPath": "./src/A.stories.js", "name": "docs", "storiesImports": [ + "./errors/A.mdx", "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "autodocs", + "component-tag", + "story-tag", ], "title": "A", "type": "docs", @@ -670,9 +733,12 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", + "autodocs", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -703,8 +769,10 @@ describe('StoryIndexGenerator', () => { "./duplicate/SecondA.stories.js", ], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "duplicate/A", "type": "docs", @@ -714,8 +782,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./duplicate/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "duplicate/A", "type": "story", @@ -725,8 +795,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./duplicate/SecondA.stories.js", "name": "Story Two", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "duplicate/A", "type": "story", @@ -773,8 +845,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "autodocs", + "dev", "docs", + "test", + "autodocs", ], "title": "A", "type": "docs", @@ -784,8 +858,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./docs-id-generation/A.stories.jsx", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "A", "type": "story", @@ -813,8 +889,12 @@ describe('StoryIndexGenerator', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "component-tag", + "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -827,8 +907,12 @@ describe('StoryIndexGenerator', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "component-tag", + "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -838,9 +922,11 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -851,8 +937,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "ComponentReference", "type": "docs", @@ -863,8 +951,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "docs2/Yabbadabbadooo", "type": "docs", @@ -875,8 +965,10 @@ describe('StoryIndexGenerator', () => { "name": "docs", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "NoTitle", "type": "docs", @@ -936,8 +1028,12 @@ describe('StoryIndexGenerator', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "component-tag", + "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -950,8 +1046,12 @@ describe('StoryIndexGenerator', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "component-tag", + "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -961,9 +1061,11 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -974,8 +1076,10 @@ describe('StoryIndexGenerator', () => { "name": "Info", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "ComponentReference", "type": "docs", @@ -986,8 +1090,10 @@ describe('StoryIndexGenerator', () => { "name": "Info", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "docs2/Yabbadabbadooo", "type": "docs", @@ -998,8 +1104,10 @@ describe('StoryIndexGenerator', () => { "name": "Info", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "NoTitle", "type": "docs", @@ -1028,9 +1136,11 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -1040,8 +1150,10 @@ describe('StoryIndexGenerator', () => { "importPath": "./src/B.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "B", "type": "story", @@ -1055,8 +1167,11 @@ describe('StoryIndexGenerator', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "autodocs", + "attached-mdx", ], "title": "B", "type": "docs", @@ -1092,8 +1207,10 @@ describe('StoryIndexGenerator', () => { "./docs-id-generation/B.stories.jsx", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "attached-mdx", ], "title": "B", "type": "docs", @@ -1103,7 +1220,9 @@ describe('StoryIndexGenerator', () => { "importPath": "./docs-id-generation/B.stories.jsx", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "B", "type": "story", diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index bd8ebe25d105..ae97d6acfb11 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -299,8 +299,7 @@ export class StoryIndexGenerator { const title = input.title ?? defaultMakeTitle(); // eslint-disable-next-line no-underscore-dangle const id = input.__id ?? toId(input.metaId ?? title, storyNameFromExport(input.exportName)); - const metaTags = combineTags(...projectTags, ...(input.metaTags ?? [])); - const tags = combineTags(...metaTags, ...(input.tags ?? [])); + const tags = combineTags(...projectTags, ...(input.tags ?? [])); return { type: 'story', @@ -309,7 +308,6 @@ export class StoryIndexGenerator { name, title, importPath, - metaTags, tags, }; }); @@ -326,8 +324,7 @@ export class StoryIndexGenerator { const { metaId } = indexInputs[0]; const { title } = entries[0]; const id = toId(metaId ?? title, name); - const metaTags = combineTags(...projectTags, ...(indexInputs[0].metaTags ?? [])); - const tags = combineTags(...metaTags, ...(indexInputs[0].tags ?? [])); + const tags = combineTags(...projectTags, ...(indexInputs[0].tags ?? [])); entries.unshift({ id, @@ -335,7 +332,6 @@ export class StoryIndexGenerator { name, importPath, type: 'docs', - metaTags, tags, storiesImports: [], }); @@ -433,17 +429,13 @@ export class StoryIndexGenerator { const id = toId(csfEntry?.metaId || title, name); - const metaTags = combineTags( - ...projectTags, - ...(result.metaTags ?? []), - ...(csfEntry?.metaTags ?? []) - ); const tags = combineTags( - ...metaTags, + ...projectTags, ...(csfEntry?.tags ?? []), + ...(result.metaTags ?? []), csfEntry ? 'attached-mdx' : 'unattached-mdx' ); - console.log({ projectTags, metaTags, tags }); + console.log({ projectTags, tags }); const docsEntry: DocsCacheEntry = { id, @@ -452,7 +444,6 @@ export class StoryIndexGenerator { importPath, storiesImports: sortedDependencies.map((dep) => dep.entries[0].importPath), type: 'docs', - metaTags, tags, }; return docsEntry; diff --git a/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts b/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts index a1936c6719dd..a7bc19ae8ab9 100644 --- a/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts +++ b/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts @@ -70,7 +70,6 @@ describe('story extraction', () => { "name": "Story One", "tags": [ "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -82,7 +81,6 @@ describe('story extraction', () => { "name": "Another Story Name", "tags": [ "story-tag-from-indexer", - "story", ], "title": "Custom Title", "type": "story", @@ -124,9 +122,7 @@ describe('story extraction', () => { "importPath": "./src/first-nested/deeply/F.stories.js", "metaId": undefined, "name": "Story One", - "tags": [ - "story", - ], + "tags": [], "title": "F", "type": "story", }, @@ -173,7 +169,6 @@ describe('story extraction', () => { "name": "Story One", "tags": [ "story-tag-from-indexer", - "story", ], "title": "F", "type": "story", @@ -221,7 +216,6 @@ describe('story extraction', () => { "name": "Story One", "tags": [ "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -287,7 +281,6 @@ describe('story extraction', () => { "name": "Story One", "tags": [ "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -299,7 +292,6 @@ describe('story extraction', () => { "name": "Custom Name For Second Story", "tags": [ "story-tag-from-indexer", - "story", ], "title": "Custom Title", "type": "story", @@ -311,7 +303,6 @@ describe('story extraction', () => { "name": "Story Three", "tags": [ "story-tag-from-indexer", - "story", ], "title": "Custom Title", "type": "story", @@ -356,7 +347,6 @@ describe('story extraction', () => { "name": "Story One", "tags": [ "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -399,18 +389,6 @@ describe('docs entries from story extraction', () => { { "dependents": [], "entries": [ - { - "id": "a--docs", - "importPath": "./src/A.stories.js", - "name": "docs", - "storiesImports": [], - "tags": [ - "docs", - "autodocs", - ], - "title": "A", - "type": "docs", - }, { "id": "a--story-one", "importPath": "./src/A.stories.js", @@ -418,7 +396,6 @@ describe('docs entries from story extraction', () => { "name": "Story One", "tags": [ "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -465,7 +442,8 @@ describe('docs entries from story extraction', () => { "name": "docs", "storiesImports": [], "tags": [ - "docs", + "autodocs", + "story-tag-from-indexer", ], "title": "A", "type": "docs", @@ -478,7 +456,6 @@ describe('docs entries from story extraction', () => { "tags": [ "autodocs", "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -527,7 +504,6 @@ describe('docs entries from story extraction', () => { "tags": [ "autodocs", "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", @@ -574,7 +550,8 @@ describe('docs entries from story extraction', () => { "name": "docs", "storiesImports": [], "tags": [ - "docs", + "stories-mdx", + "story-tag-from-indexer", ], "title": "A", "type": "docs", @@ -587,7 +564,6 @@ describe('docs entries from story extraction', () => { "tags": [ "stories-mdx", "story-tag-from-indexer", - "story", ], "title": "A", "type": "story", diff --git a/code/lib/core-server/src/utils/stories-json.test.ts b/code/lib/core-server/src/utils/stories-json.test.ts index a621f5443ce3..81fd7b8bfa3a 100644 --- a/code/lib/core-server/src/utils/stories-json.test.ts +++ b/code/lib/core-server/src/utils/stories-json.test.ts @@ -113,8 +113,12 @@ describe('useStoriesJson', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "component-tag", + "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -127,8 +131,12 @@ describe('useStoriesJson', () => { "./src/A.stories.js", ], "tags": [ - "attached-mdx", + "dev", "docs", + "test", + "component-tag", + "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -138,9 +146,11 @@ describe('useStoriesJson', () => { "importPath": "./src/A.stories.js", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", "story-tag", - "story", ], "title": "A", "type": "story", @@ -150,8 +160,10 @@ describe('useStoriesJson', () => { "importPath": "./src/B.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "B", "type": "story", @@ -161,8 +173,10 @@ describe('useStoriesJson', () => { "importPath": "./src/D.stories.jsx", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "D", "type": "story", @@ -173,8 +187,10 @@ describe('useStoriesJson', () => { "name": "docs", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "docs2/ComponentReference", "type": "docs", @@ -185,8 +201,10 @@ describe('useStoriesJson', () => { "name": "docs", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "docs2/NoTitle", "type": "docs", @@ -197,8 +215,10 @@ describe('useStoriesJson', () => { "name": "docs", "storiesImports": [], "tags": [ - "unattached-mdx", + "dev", "docs", + "test", + "unattached-mdx", ], "title": "docs2/Yabbadabbadooo", "type": "docs", @@ -208,7 +228,9 @@ describe('useStoriesJson', () => { "importPath": "./src/first-nested/deeply/F.stories.js", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "first-nested/deeply/F", "type": "story", @@ -218,8 +240,10 @@ describe('useStoriesJson', () => { "importPath": "./src/H.stories.mjs", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "autodocs", - "story", ], "title": "H", "type": "story", @@ -229,8 +253,10 @@ describe('useStoriesJson', () => { "importPath": "./src/nested/Button.stories.ts", "name": "Story One", "tags": [ + "dev", + "docs", + "test", "component-tag", - "story", ], "title": "nested/Button", "type": "story", @@ -240,7 +266,9 @@ describe('useStoriesJson', () => { "importPath": "./src/second-nested/G.stories.ts", "name": "Story One", "tags": [ - "story", + "dev", + "docs", + "test", ], "title": "second-nested/G", "type": "story", diff --git a/code/lib/csf-tools/src/CsfFile.test.ts b/code/lib/csf-tools/src/CsfFile.test.ts index 21e902cce52f..cfc650e30e2e 100644 --- a/code/lib/csf-tools/src/CsfFile.test.ts +++ b/code/lib/csf-tools/src/CsfFile.test.ts @@ -1104,8 +1104,6 @@ describe('CsfFile', () => { - component-tag - story-tag - play-fn - metaTags: &ref_0 - - component-tag __id: component-id--a - type: story importPath: foo/bar.stories.js @@ -1117,7 +1115,6 @@ describe('CsfFile', () => { - component-tag - story-tag - play-fn - metaTags: *ref_0 __id: component-id--b `); }); @@ -1147,8 +1144,6 @@ describe('CsfFile', () => { metaId: component-id tags: - component-tag - metaTags: - - component-tag __id: custom-story-id `); }); @@ -1180,11 +1175,6 @@ describe('CsfFile', () => { - inherit-tag-dup - story-tag - story-tag-dup - metaTags: - - component-tag - - component-tag-dup - - component-tag-dup - - inherit-tag-dup __id: custom-foo-title--a `); }); diff --git a/code/lib/csf-tools/src/CsfFile.ts b/code/lib/csf-tools/src/CsfFile.ts index 4516a293b1cc..dc0270b72804 100644 --- a/code/lib/csf-tools/src/CsfFile.ts +++ b/code/lib/csf-tools/src/CsfFile.ts @@ -8,7 +8,7 @@ import * as generate from '@babel/generator'; import * as recast from 'recast'; import * as traverse from '@babel/traverse'; -import { toId, isExportStory, storyNameFromExport } from '@storybook/csf'; +import { toId, isExportStory, storyNameFromExport, combineTags } from '@storybook/csf'; import type { Tag, StoryAnnotations, @@ -559,7 +559,7 @@ export class CsfFile { } return Object.entries(this._stories).map(([exportName, story]) => { // combine meta and story tags, removing any duplicates - const tags = Array.from(new Set([...(this._meta?.tags ?? []), ...(story.tags ?? [])])); + const tags = combineTags(...(this._meta?.tags ?? []), ...(story.tags ?? [])); return { type: 'story', importPath: this._fileName, @@ -568,7 +568,6 @@ export class CsfFile { title: this.meta?.title, metaId: this.meta?.id, tags, - metaTags: this.meta?.tags, __id: story.id, }; }); diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index e20af13752a6..d0d9ed357704 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -3625,7 +3625,10 @@ describe('PreviewWeb', () => { "story": "A", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -3672,7 +3675,10 @@ describe('PreviewWeb', () => { "story": "B", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -3697,7 +3703,10 @@ describe('PreviewWeb', () => { "story": "E", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -3732,7 +3741,10 @@ describe('PreviewWeb', () => { "story": "C", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component Two", }, diff --git a/code/lib/preview-api/src/modules/store/StoryStore.test.ts b/code/lib/preview-api/src/modules/store/StoryStore.test.ts index 65f225c8ef6e..5bb56dc106d9 100644 --- a/code/lib/preview-api/src/modules/store/StoryStore.test.ts +++ b/code/lib/preview-api/src/modules/store/StoryStore.test.ts @@ -311,7 +311,10 @@ describe('StoryStore', () => { "story": "A", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -476,7 +479,10 @@ describe('StoryStore', () => { "story": "A", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -514,7 +520,10 @@ describe('StoryStore', () => { "story": "B", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -552,7 +561,10 @@ describe('StoryStore', () => { "story": "C", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component Two", }, @@ -659,6 +671,9 @@ describe('StoryStore', () => { "storyFn": [Function], "subcomponents": undefined, "tags": [ + "dev", + "docs", + "test", "story", ], "title": "Component One", @@ -704,6 +719,9 @@ describe('StoryStore', () => { "storyFn": [Function], "subcomponents": undefined, "tags": [ + "dev", + "docs", + "test", "story", ], "title": "Component One", @@ -749,6 +767,9 @@ describe('StoryStore', () => { "storyFn": [Function], "subcomponents": undefined, "tags": [ + "dev", + "docs", + "test", "story", ], "title": "Component Two", @@ -810,7 +831,10 @@ describe('StoryStore', () => { "story": "A", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -848,7 +872,10 @@ describe('StoryStore', () => { "story": "B", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component One", }, @@ -886,7 +913,10 @@ describe('StoryStore', () => { "story": "C", "subcomponents": undefined, "tags": [ + "dev", + "docs", "story", + "test", ], "title": "Component Two", }, diff --git a/code/lib/types/src/modules/indexer.ts b/code/lib/types/src/modules/indexer.ts index 42f0e21640e8..56d435cdb533 100644 --- a/code/lib/types/src/modules/indexer.ts +++ b/code/lib/types/src/modules/indexer.ts @@ -73,7 +73,6 @@ export interface BaseIndexEntry { id: StoryId; name: StoryName; title: ComponentTitle; - metaTags?: Tag[]; tags?: Tag[]; importPath: Path; } @@ -108,8 +107,6 @@ export type BaseIndexInput = { metaId?: MetaId; /** Tags for filtering entries in Storybook and its tools. */ tags?: Tag[]; - /** Tags from the meta for filtering entries in Storybook and its tools. */ - metaTags?: Tag[]; /** * The id of the entry, auto-generated from {@link title}/{@link metaId} and {@link exportName} if unspecified. * If specified, the story in the CSF file _must_ have a matching id set at `parameters.__id`, to be correctly matched. From f6771152c702b75fb6e61a4478f8cb22feb5cf67 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 5 May 2024 05:29:14 +0800 Subject: [PATCH 09/30] Add preview.js watcher for project tags --- .../src/utils/StoryIndexGenerator.ts | 15 ++++++++-- .../src/utils/getStoryIndexGenerator.ts | 4 ++- .../lib/core-server/src/utils/stories-json.ts | 13 +++++++++ code/lib/core-server/src/utils/watchConfig.ts | 28 +++++++++++++++++++ .../src/modules/store/csf/prepareStory.ts | 5 ++-- 5 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 code/lib/core-server/src/utils/watchConfig.ts diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 5ad352d84cba..46b5fc296930 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -602,6 +602,16 @@ export class StoryIndexGenerator { } } + invalidateAll() { + this.specifierToCache.forEach((cache) => { + Object.keys(cache).forEach((key) => { + cache[key] = false; + }); + }); + this.lastIndex = null; + this.lastError = null; + } + invalidate(specifier: NormalizedStoriesSpecifier, importPath: Path, removed: boolean) { const absolutePath = slash(path.resolve(this.options.workingDir, importPath)); const cache = this.specifierToCache.get(specifier); @@ -656,10 +666,9 @@ export class StoryIndexGenerator { getProjectTags(previewCode: string) { const projectAnnotations = loadConfig(previewCode).parse(); - const defaultTags = ['dev', 'docs', 'test']; const extraTags = this.options.docs.autodocs === true ? [AUTODOCS_TAG] : []; - const projectTags = projectAnnotations.getFieldValue(['tags']) ?? []; - return [...defaultTags, ...projectTags, ...extraTags]; + const projectTags = projectAnnotations.getFieldValue(['tags']) ?? ['dev', 'docs', 'test']; + return [...projectTags, ...extraTags]; } // Get the story file names in "imported order" diff --git a/code/lib/core-server/src/utils/getStoryIndexGenerator.ts b/code/lib/core-server/src/utils/getStoryIndexGenerator.ts index f8c1bc97f615..9c2a32385db9 100644 --- a/code/lib/core-server/src/utils/getStoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/getStoryIndexGenerator.ts @@ -13,8 +13,9 @@ export async function getStoryIndexGenerator( serverChannel: ServerChannel ): Promise { const workingDir = process.cwd(); + const configDir = options.configDir; const directories = { - configDir: options.configDir, + configDir, workingDir, }; const stories = options.presets.apply('stories'); @@ -37,6 +38,7 @@ export async function getStoryIndexGenerator( normalizedStories, serverChannel, workingDir, + configDir, }); return initializedStoryIndexGenerator; diff --git a/code/lib/core-server/src/utils/stories-json.ts b/code/lib/core-server/src/utils/stories-json.ts index 074c0248cb0c..71b29a54a30b 100644 --- a/code/lib/core-server/src/utils/stories-json.ts +++ b/code/lib/core-server/src/utils/stories-json.ts @@ -1,3 +1,4 @@ +import { basename } from 'path'; import type { Router, Request, Response } from 'express'; import { writeJSON } from 'fs-extra'; @@ -7,6 +8,7 @@ import debounce from 'lodash/debounce.js'; import { STORY_INDEX_INVALIDATED } from '@storybook/core-events'; import type { StoryIndexGenerator } from './StoryIndexGenerator'; import { watchStorySpecifiers } from './watch-story-specifiers'; +import { watchConfig } from './watchConfig'; import type { ServerChannel } from './get-server-channel'; export const DEBOUNCE = 100; @@ -25,6 +27,7 @@ export function useStoriesJson({ router, initializedStoryIndexGenerator, workingDir = process.cwd(), + configDir, serverChannel, normalizedStories, }: { @@ -32,6 +35,7 @@ export function useStoriesJson({ initializedStoryIndexGenerator: Promise; serverChannel: ServerChannel; workingDir?: string; + configDir?: string; normalizedStories: NormalizedStoriesSpecifier[]; }) { const maybeInvalidate = debounce(() => serverChannel.emit(STORY_INDEX_INVALIDATED), DEBOUNCE, { @@ -42,6 +46,15 @@ export function useStoriesJson({ generator.invalidate(specifier, path, removed); maybeInvalidate(); }); + if (configDir) { + watchConfig(configDir, async (filePath) => { + if (basename(filePath).startsWith('preview')) { + const generator = await initializedStoryIndexGenerator; + generator.invalidateAll(); + maybeInvalidate(); + } + }); + } router.use('/index.json', async (req: Request, res: Response) => { try { diff --git a/code/lib/core-server/src/utils/watchConfig.ts b/code/lib/core-server/src/utils/watchConfig.ts new file mode 100644 index 000000000000..14b925f1c1d8 --- /dev/null +++ b/code/lib/core-server/src/utils/watchConfig.ts @@ -0,0 +1,28 @@ +import Watchpack from 'watchpack'; +import type { Path } from '@storybook/types'; + +// copied from './watch-story-specifiers.ts' +/** Watch the .storybook dir for changes */ +export function watchConfig( + configDir: Path, + onInvalidate: (path: Path, removed: boolean) => Promise +) { + const wp = new Watchpack({ + followSymlinks: false, + ignored: ['**/.git', '**/node_modules'], + }); + + console.log('watching previewjs', configDir); + wp.watch({ + directories: [configDir], + }); + wp.on('change', async (filePath: Path, mtime: Date, explanation: string) => { + const removed = !mtime; + await onInvalidate(filePath, removed); + }); + wp.on('remove', async (filePath: Path, explanation: string) => { + await onInvalidate(filePath, true); + }); + + return () => wp.close(); +} diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 3c477a22180f..e13adec15e00 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -141,13 +141,12 @@ function preparePartialAnnotations( // anything at render time. The assumption is that as we don't load all the stories at once, this // will have a limited cost. If this proves misguided, we can refactor it. - const defaultTags = ['dev', 'docs', 'test']; + const projectTags = projectAnnotations.tags ?? ['dev', 'docs', 'test']; const extraTags = globalThis.DOCS_OPTIONS?.autodocs === true ? ['autodocs'] : []; const tags = combineTags( - ...defaultTags, + ...projectTags, ...extraTags, - ...(projectAnnotations.tags ?? []), ...(componentAnnotations.tags ?? []), ...(storyAnnotations?.tags ?? []), 'story' From 5dfa56b05621c3c5e3d32b828d5f0e5712e60f96 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 5 May 2024 07:49:08 +0800 Subject: [PATCH 10/30] Restore dev/docs/test default tags --- code/lib/core-server/src/utils/StoryIndexGenerator.ts | 5 +++-- code/lib/preview-api/src/modules/store/csf/prepareStory.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 46b5fc296930..476e0cf4795a 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -666,9 +666,10 @@ export class StoryIndexGenerator { getProjectTags(previewCode: string) { const projectAnnotations = loadConfig(previewCode).parse(); + const defaultTags = ['dev', 'docs', 'test']; const extraTags = this.options.docs.autodocs === true ? [AUTODOCS_TAG] : []; - const projectTags = projectAnnotations.getFieldValue(['tags']) ?? ['dev', 'docs', 'test']; - return [...projectTags, ...extraTags]; + const projectTags = projectAnnotations.getFieldValue(['tags']) ?? []; + return [...defaultTags, ...projectTags, ...extraTags]; } // Get the story file names in "imported order" diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index e13adec15e00..3c477a22180f 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -141,12 +141,13 @@ function preparePartialAnnotations( // anything at render time. The assumption is that as we don't load all the stories at once, this // will have a limited cost. If this proves misguided, we can refactor it. - const projectTags = projectAnnotations.tags ?? ['dev', 'docs', 'test']; + const defaultTags = ['dev', 'docs', 'test']; const extraTags = globalThis.DOCS_OPTIONS?.autodocs === true ? ['autodocs'] : []; const tags = combineTags( - ...projectTags, + ...defaultTags, ...extraTags, + ...(projectAnnotations.tags ?? []), ...(componentAnnotations.tags ?? []), ...(storyAnnotations?.tags ?? []), 'story' From 31603542c82d945353491dc35225e22959501a56 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 5 May 2024 08:41:02 +0800 Subject: [PATCH 11/30] Preserver negated tags for index --- code/lib/csf-tools/src/CsfFile.test.ts | 3 +++ code/lib/csf-tools/src/CsfFile.ts | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/lib/csf-tools/src/CsfFile.test.ts b/code/lib/csf-tools/src/CsfFile.test.ts index cfc650e30e2e..669109d268ac 100644 --- a/code/lib/csf-tools/src/CsfFile.test.ts +++ b/code/lib/csf-tools/src/CsfFile.test.ts @@ -1172,9 +1172,12 @@ describe('CsfFile', () => { tags: - component-tag - component-tag-dup + - component-tag-dup - inherit-tag-dup - story-tag - story-tag-dup + - story-tag-dup + - inherit-tag-dup __id: custom-foo-title--a `); }); diff --git a/code/lib/csf-tools/src/CsfFile.ts b/code/lib/csf-tools/src/CsfFile.ts index dc0270b72804..cac931501eec 100644 --- a/code/lib/csf-tools/src/CsfFile.ts +++ b/code/lib/csf-tools/src/CsfFile.ts @@ -8,7 +8,7 @@ import * as generate from '@babel/generator'; import * as recast from 'recast'; import * as traverse from '@babel/traverse'; -import { toId, isExportStory, storyNameFromExport, combineTags } from '@storybook/csf'; +import { toId, isExportStory, storyNameFromExport } from '@storybook/csf'; import type { Tag, StoryAnnotations, @@ -557,9 +557,10 @@ export class CsfFile { Either add the fileName option when creating the CsfFile instance, or create the index inputs manually.` ); } + return Object.entries(this._stories).map(([exportName, story]) => { - // combine meta and story tags, removing any duplicates - const tags = combineTags(...(this._meta?.tags ?? []), ...(story.tags ?? [])); + // don't remove any duplicates or negations -- tags will be combined in the index + const tags = [...(this._meta?.tags ?? []), ...(story.tags ?? [])]; return { type: 'story', importPath: this._fileName, From a9c0730f55124f6cce7bc40b2cab7916f10fd555 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 5 May 2024 08:41:42 +0800 Subject: [PATCH 12/30] Remove auto-generated story tag, update tests --- .../src/modules/store/csf/prepareStory.test.ts | 14 +++++++++++--- .../src/modules/store/csf/prepareStory.ts | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts index b05485e5a506..893fc2133eb3 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts @@ -44,7 +44,15 @@ describe('prepareStory', () => { { render } ); - expect(tags).toEqual(['story-1', 'story-2', 'story']); + expect(tags).toEqual([ + 'dev', + 'docs', + 'test', + 'component-1', + 'component-2', + 'story-1', + 'story-2', + ]); }); it('component tags work if story are unset', () => { @@ -58,13 +66,13 @@ describe('prepareStory', () => { { render } ); - expect(tags).toEqual(['component-1', 'component-2', 'story']); + expect(tags).toEqual(['dev', 'docs', 'test', 'component-1', 'component-2']); }); it('sets a value even if annotations do not have tags', () => { const { tags } = prepareStory({ id, name, moduleExport }, { id, title }, { render }); - expect(tags).toEqual(['story']); + expect(tags).toEqual(['dev', 'docs', 'test']); }); }); diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 3c477a22180f..769147ecd5ac 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -149,8 +149,7 @@ function preparePartialAnnotations( ...extraTags, ...(projectAnnotations.tags ?? []), ...(componentAnnotations.tags ?? []), - ...(storyAnnotations?.tags ?? []), - 'story' + ...(storyAnnotations?.tags ?? []) ); const parameters: Parameters = combineParameters( From ca88bcace2cafb61a9e3e21885fd8a2153ce566f Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 5 May 2024 09:36:02 +0800 Subject: [PATCH 13/30] Add dev/docs tag behaviors --- code/addons/docs/src/preview.ts | 4 +++- code/lib/core-server/src/presets/common-manager.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/addons/docs/src/preview.ts b/code/addons/docs/src/preview.ts index 991a7811b472..0e6dcbfed2fd 100644 --- a/code/addons/docs/src/preview.ts +++ b/code/addons/docs/src/preview.ts @@ -22,7 +22,9 @@ export const parameters: any = { filter: (story: PreparedStory) => { const tags = story.tags || []; return ( - tags.filter((tag) => excludeTags[tag]).length === 0 && !story.parameters.docs?.disable + tags.includes('docs') && + tags.filter((tag) => excludeTags[tag]).length === 0 && + !story.parameters.docs?.disable ); }, }, diff --git a/code/lib/core-server/src/presets/common-manager.ts b/code/lib/core-server/src/presets/common-manager.ts index 0564f8e00b92..c3dfbd8d6fb8 100644 --- a/code/lib/core-server/src/presets/common-manager.ts +++ b/code/lib/core-server/src/presets/common-manager.ts @@ -18,7 +18,7 @@ addons.register(STATIC_FILTER, (api) => { ); api.experimental_setFilter(STATIC_FILTER, (item) => { - const tags = item.tags || []; - return tags.filter((tag) => excludeTags[tag]).length === 0; + const tags = item.tags ?? []; + return tags.includes('dev') && tags.filter((tag) => excludeTags[tag]).length === 0; }); }); From d89ff2e0643e9ead04541877d368681e6199571d Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 5 May 2024 10:45:31 +0800 Subject: [PATCH 14/30] Deprecate main.js `docs.autodocs` and remove from CLI template --- MIGRATION.md | 40 ++++++++++++++++++- code/lib/cli/src/generators/baseGenerator.ts | 1 - .../src/modules/store/csf/prepareStory.ts | 11 ++++- code/lib/types/src/modules/core-common.ts | 2 +- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 34c0ca87c685..d8b631e557b2 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,8 +1,9 @@

Migration

- [From version 8.0 to 8.1.0](#from-version-80-to-810) + - [main.js `docs.autodocs` is deprecated](#mainjs-docsautodocs-is-deprecated) - [Subtitle block and `parameters.componentSubtitle`](#subtitle-block-and-parameterscomponentsubtitle) - - [Title block](#title-block) + - [Title block `of` prop](#title-block-of-prop) - [From version 7.x to 8.0.0](#from-version-7x-to-800) - [Portable stories](#portable-stories) - [Project annotations are now merged instead of overwritten in composeStory](#project-annotations-are-now-merged-instead-of-overwritten-in-composestory) @@ -408,13 +409,48 @@ ## From version 8.0 to 8.1.0 +### main.js `docs.autodocs` is deprecated + +The `docs.autodocs` setting in `main.js` is deprecated in 8.1 and will be removed in 9.0. + +It has been replaced with a tags-based system which is more flexible than before. + +`docs.autodocs` takes three values: +- `true`: generate autodocs for every component +- `false`: don't generate autodocs at all +- `tag`: generate autodocs for components that have been tagged `'autodocs'`. + +Starting in 8.1, to generate autodocs for every component (`docs.autodocs = true`), add the following code to `.storybook/preview.js`: + +```js +// .storybook/preview.js +export default { + tags: ['autodocs'], +} +``` + +Tags cascade, so setting `'autodocs'` at the project level automatically propagates to every component and story. If you set autodocs globally and want to opt-out for a particular component, you can remove the `'autodocs'` tag for a component like this: + +```js +// Button.stories.ts +export default { + component: Button, + tags: ['!autodocs'], +} +``` + +If you had set `docs.autodocs = 'tag'`, the default setting, you can remove the setting from `.storybook/main.js`. That is now the default behavior. + +If you had set `docs.autodocs = false`, this still works in 8.x, but will go away in 9.0 as a breaking change. If you don't want autodocs at all, simply remove the `'autodocs'` tag throughout your Storybook and autodocs will not be created. + + ### Subtitle block and `parameters.componentSubtitle` The `Subtitle` block now accepts an `of` prop, which can be a reference to a CSF file or a default export (meta). `parameters.componentSubtitle` has been deprecated to be consistent with other parameters related to autodocs, instead use `parameters.docs.subtitle`. -##### Title block +### Title block `of` prop The `Title` block now accepts an `of` prop, which can be a reference to a CSF file or a default export (meta). diff --git a/code/lib/cli/src/generators/baseGenerator.ts b/code/lib/cli/src/generators/baseGenerator.ts index 2f85d0af4549..44f1214c0aa6 100644 --- a/code/lib/cli/src/generators/baseGenerator.ts +++ b/code/lib/cli/src/generators/baseGenerator.ts @@ -354,7 +354,6 @@ export async function baseGenerator( }, prefixes, storybookConfigFolder, - docs: { autodocs: 'tag' }, addons: shouldApplyRequireWrapperOnPackageNames ? addons.map((addon) => applyRequireWrapper(addon)) : addons, diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 769147ecd5ac..78b6319c4abc 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-loop-func,no-underscore-dangle */ -import { global } from '@storybook/global'; +import { dedent } from 'ts-dedent'; +import { global } from '@storybook/global'; import type { Args, ArgsStoryFn, @@ -22,6 +23,7 @@ import type { } from '@storybook/types'; import { includeConditionalArg, combineTags } from '@storybook/csf'; import { global as globalThis } from '@storybook/global'; +import { once } from '@storybook/client-logger'; import { applyHooks } from '../../addons'; import { combineParameters } from '../parameters'; @@ -142,6 +144,13 @@ function preparePartialAnnotations( // will have a limited cost. If this proves misguided, we can refactor it. const defaultTags = ['dev', 'docs', 'test']; + if (typeof globalThis.DOCS_OPTIONS?.autodocs !== 'undefined') { + once.warn(dedent` + The \`docs.autodocs\` setting in '.storybook/main.js' is deprecated. Use \`tags: ['autodocs']\` in \`.storybook/preview.js\` instead. + + For more info see: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#mainjs-docsautodocs-is-deprecated + `); + } const extraTags = globalThis.DOCS_OPTIONS?.autodocs === true ? ['autodocs'] : []; const tags = combineTags( diff --git a/code/lib/types/src/modules/core-common.ts b/code/lib/types/src/modules/core-common.ts index 0e8dd7f002cd..9a3106931053 100644 --- a/code/lib/types/src/modules/core-common.ts +++ b/code/lib/types/src/modules/core-common.ts @@ -281,7 +281,7 @@ export type DocsOptions = { * Set to 'tag' (the default) to generate an entry for every CSF file with the * 'autodocs' tag. * - * @deprecated Use `tags: ['autodocs']` in .storybook/preview.js instead + * @deprecated Use `tags: ['autodocs']` in `.storybook/preview.js` instead */ autodocs?: boolean | 'tag'; /** From 149dd068007da38224d69e6cce76fe9436c63612 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 16:32:41 +0800 Subject: [PATCH 15/30] Replace `docs` tag by `autodocs` --- code/addons/docs/src/preview.ts | 2 +- .../core-server/src/utils/StoryIndexGenerator.ts | 2 +- .../src/modules/store/csf/prepareStory.test.ts | 14 +++----------- .../src/modules/store/csf/prepareStory.ts | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/code/addons/docs/src/preview.ts b/code/addons/docs/src/preview.ts index 0e6dcbfed2fd..7a352b15b0a6 100644 --- a/code/addons/docs/src/preview.ts +++ b/code/addons/docs/src/preview.ts @@ -22,7 +22,7 @@ export const parameters: any = { filter: (story: PreparedStory) => { const tags = story.tags || []; return ( - tags.includes('docs') && + tags.includes('autodocs') && tags.filter((tag) => excludeTags[tag]).length === 0 && !story.parameters.docs?.disable ); diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 476e0cf4795a..11b063b6fb5e 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -666,7 +666,7 @@ export class StoryIndexGenerator { getProjectTags(previewCode: string) { const projectAnnotations = loadConfig(previewCode).parse(); - const defaultTags = ['dev', 'docs', 'test']; + const defaultTags = ['dev', 'test']; const extraTags = this.options.docs.autodocs === true ? [AUTODOCS_TAG] : []; const projectTags = projectAnnotations.getFieldValue(['tags']) ?? []; return [...defaultTags, ...projectTags, ...extraTags]; diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts index 893fc2133eb3..b5ab8b9fb407 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts @@ -44,15 +44,7 @@ describe('prepareStory', () => { { render } ); - expect(tags).toEqual([ - 'dev', - 'docs', - 'test', - 'component-1', - 'component-2', - 'story-1', - 'story-2', - ]); + expect(tags).toEqual(['dev', 'test', 'component-1', 'component-2', 'story-1', 'story-2']); }); it('component tags work if story are unset', () => { @@ -66,13 +58,13 @@ describe('prepareStory', () => { { render } ); - expect(tags).toEqual(['dev', 'docs', 'test', 'component-1', 'component-2']); + expect(tags).toEqual(['dev', 'test', 'component-1', 'component-2']); }); it('sets a value even if annotations do not have tags', () => { const { tags } = prepareStory({ id, name, moduleExport }, { id, title }, { render }); - expect(tags).toEqual(['dev', 'docs', 'test']); + expect(tags).toEqual(['dev', 'test']); }); }); diff --git a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts index 78b6319c4abc..ae976d19ac5e 100644 --- a/code/lib/preview-api/src/modules/store/csf/prepareStory.ts +++ b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts @@ -143,7 +143,7 @@ function preparePartialAnnotations( // anything at render time. The assumption is that as we don't load all the stories at once, this // will have a limited cost. If this proves misguided, we can refactor it. - const defaultTags = ['dev', 'docs', 'test']; + const defaultTags = ['dev', 'test']; if (typeof globalThis.DOCS_OPTIONS?.autodocs !== 'undefined') { once.warn(dedent` The \`docs.autodocs\` setting in '.storybook/main.js' is deprecated. Use \`tags: ['autodocs']\` in \`.storybook/preview.js\` instead. From 5fc32eed2cf74064c15b454b68469b4cc805174d Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 16:54:28 +0800 Subject: [PATCH 16/30] Fix MDX detection now that MDX can inherit autodocs tags --- code/lib/core-server/src/utils/StoryIndexGenerator.ts | 4 +++- .../src/modules/preview-web/PreviewWithSelection.tsx | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 11b063b6fb5e..4c1de76651fc 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -53,11 +53,13 @@ export type StoryIndexGeneratorOptions = { export const AUTODOCS_TAG = 'autodocs'; export const STORIES_MDX_TAG = 'stories-mdx'; +export const UNATTACHED_MDX_TAG = 'unattached-mdx'; +export const ATTACHED_MDX_TAG = 'attached-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) { - return !tags?.includes(AUTODOCS_TAG) && !tags?.includes(STORIES_MDX_TAG); + return tags?.includes(UNATTACHED_MDX_TAG) || tags?.includes(ATTACHED_MDX_TAG); } const makeAbsolute = (otherImport: Path, normalizedPath: Path, workingDir: Path) => diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx b/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx index b183a7488ba9..6480d4d4b9f8 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx @@ -55,10 +55,11 @@ function focusInInput(event: Event) { export const AUTODOCS_TAG = 'autodocs'; export const STORIES_MDX_TAG = 'stories-mdx'; export const ATTACHED_MDX_TAG = 'attached-mdx'; +export const UNATTACHED_MDX_TAG = 'unattached-mdx'; /** Was this docs entry generated by a .mdx file? (see discussion below) */ export function isMdxEntry({ tags }: DocsIndexEntry) { - return !tags?.includes(AUTODOCS_TAG) && !tags?.includes(STORIES_MDX_TAG); + return tags?.includes(UNATTACHED_MDX_TAG) || tags?.includes(ATTACHED_MDX_TAG); } type PossibleRender = From 8f7d5695b7b3892dcfe77af227e23831f44d8fe1 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 17:31:32 +0800 Subject: [PATCH 17/30] Update snapshots --- MIGRATION.md | 4 ++ .../src/utils/StoryIndexGenerator.test.ts | 56 +------------------ .../src/utils/stories-json.test.ts | 12 ---- .../src/utils/summarizeIndex.test.ts | 4 +- .../modules/preview-web/PreviewWeb.test.ts | 8 --- .../src/modules/store/StoryStore.test.ts | 20 ------- 6 files changed, 8 insertions(+), 96 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index d8b631e557b2..bd3e3869cfee 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -2,6 +2,7 @@ - [From version 8.0 to 8.1.0](#from-version-80-to-810) - [main.js `docs.autodocs` is deprecated](#mainjs-docsautodocs-is-deprecated) + - [`docs` and `story` system tags removed](#docs-and-story-system-tags-removed) - [Subtitle block and `parameters.componentSubtitle`](#subtitle-block-and-parameterscomponentsubtitle) - [Title block `of` prop](#title-block-of-prop) - [From version 7.x to 8.0.0](#from-version-7x-to-800) @@ -443,6 +444,9 @@ If you had set `docs.autodocs = 'tag'`, the default setting, you can remove the If you had set `docs.autodocs = false`, this still works in 8.x, but will go away in 9.0 as a breaking change. If you don't want autodocs at all, simply remove the `'autodocs'` tag throughout your Storybook and autodocs will not be created. +### `docs` and `story` system tags removed + +Storybook automatically added the tag `'docs'` to any docs entry in the index and `'story'` to any story entry in the index. This behavior was undocumented, and in an effort to reduce the number of tags we've removed them in 8.1. If you depended on these tags, please file an issue on the [Storybook monorepo](https://github.com/storybookjs/storybook) and let us know! ### Subtitle block and `parameters.componentSubtitle` diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts index ed9ed2a20b2c..0e51a725470a 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts @@ -80,7 +80,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -113,7 +112,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -145,7 +143,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -177,7 +174,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", ], @@ -190,7 +186,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "second-nested/G", @@ -221,7 +216,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -235,7 +229,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -248,7 +241,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -261,7 +253,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "first-nested/deeply/F", @@ -273,7 +264,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -286,7 +276,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", ], @@ -299,7 +288,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "second-nested/G", @@ -335,7 +323,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -350,7 +337,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -363,7 +349,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -377,7 +362,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -390,7 +374,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -403,7 +386,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "first-nested/deeply/F", @@ -416,7 +398,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -429,7 +410,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -442,7 +422,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", ], @@ -455,7 +434,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "second-nested/G", @@ -580,7 +558,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -596,7 +573,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "autodocs", "attached-mdx", @@ -610,7 +586,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -646,7 +621,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -662,7 +636,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "autodocs", "attached-mdx", @@ -676,7 +649,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -711,19 +683,18 @@ describe('StoryIndexGenerator', () => { "entries": { "a--docs": { "id": "a--docs", - "importPath": "./src/A.stories.js", + "importPath": "./errors/A.mdx", "name": "docs", "storiesImports": [ - "./errors/A.mdx", "./src/A.stories.js", ], "tags": [ "dev", - "docs", "test", "autodocs", "component-tag", "story-tag", + "attached-mdx", ], "title": "A", "type": "docs", @@ -734,7 +705,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", "component-tag", @@ -770,7 +740,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -783,7 +752,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -796,7 +764,6 @@ describe('StoryIndexGenerator', () => { "name": "Story Two", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -846,7 +813,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -859,7 +825,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -890,7 +855,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -908,7 +872,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -923,7 +886,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -938,7 +900,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -952,7 +913,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -966,7 +926,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -1029,7 +988,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -1047,7 +1005,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -1062,7 +1019,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -1077,7 +1033,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -1091,7 +1046,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -1105,7 +1059,6 @@ describe('StoryIndexGenerator', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -1137,7 +1090,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -1151,7 +1103,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -1168,7 +1119,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "autodocs", "attached-mdx", @@ -1208,7 +1158,6 @@ describe('StoryIndexGenerator', () => { ], "tags": [ "dev", - "docs", "test", "attached-mdx", ], @@ -1221,7 +1170,6 @@ describe('StoryIndexGenerator', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "B", diff --git a/code/lib/core-server/src/utils/stories-json.test.ts b/code/lib/core-server/src/utils/stories-json.test.ts index 81fd7b8bfa3a..cece84537367 100644 --- a/code/lib/core-server/src/utils/stories-json.test.ts +++ b/code/lib/core-server/src/utils/stories-json.test.ts @@ -114,7 +114,6 @@ describe('useStoriesJson', () => { ], "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -132,7 +131,6 @@ describe('useStoriesJson', () => { ], "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -147,7 +145,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", "story-tag", @@ -161,7 +158,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -174,7 +170,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -188,7 +183,6 @@ describe('useStoriesJson', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -202,7 +196,6 @@ describe('useStoriesJson', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -216,7 +209,6 @@ describe('useStoriesJson', () => { "storiesImports": [], "tags": [ "dev", - "docs", "test", "unattached-mdx", ], @@ -229,7 +221,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "first-nested/deeply/F", @@ -241,7 +232,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "autodocs", ], @@ -254,7 +244,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", "component-tag", ], @@ -267,7 +256,6 @@ describe('useStoriesJson', () => { "name": "Story One", "tags": [ "dev", - "docs", "test", ], "title": "second-nested/G", diff --git a/code/lib/core-server/src/utils/summarizeIndex.test.ts b/code/lib/core-server/src/utils/summarizeIndex.test.ts index 8647c007463b..a2702a38a704 100644 --- a/code/lib/core-server/src/utils/summarizeIndex.test.ts +++ b/code/lib/core-server/src/utils/summarizeIndex.test.ts @@ -457,7 +457,7 @@ describe('summarizeIndex', () => { importPath: './template-stories/addons/docs/docs2/NoTitle.mdx', storiesImports: [], type: 'docs', - tags: ['docs'], + tags: ['docs', 'attached-mdx'], }, 'addons-docs-yabbadabbadooo--docs': { id: 'addons-docs-yabbadabbadooo--docs', @@ -466,7 +466,7 @@ describe('summarizeIndex', () => { importPath: './template-stories/addons/docs/docs2/Title.mdx', storiesImports: [], type: 'docs', - tags: ['docs'], + tags: ['docs', 'attached-mdx'], }, }, }) diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 276f6da66bc4..1654772bbe3a 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -3619,8 +3619,6 @@ describe('PreviewWeb', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -3669,8 +3667,6 @@ describe('PreviewWeb', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -3697,8 +3693,6 @@ describe('PreviewWeb', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -3735,8 +3729,6 @@ describe('PreviewWeb', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component Two", diff --git a/code/lib/preview-api/src/modules/store/StoryStore.test.ts b/code/lib/preview-api/src/modules/store/StoryStore.test.ts index 5bb56dc106d9..7dee9f321cd1 100644 --- a/code/lib/preview-api/src/modules/store/StoryStore.test.ts +++ b/code/lib/preview-api/src/modules/store/StoryStore.test.ts @@ -312,8 +312,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -480,8 +478,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -521,8 +517,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -562,8 +556,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component Two", @@ -672,9 +664,7 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", "test", - "story", ], "title": "Component One", "unboundStoryFn": [Function], @@ -720,9 +710,7 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", "test", - "story", ], "title": "Component One", "unboundStoryFn": [Function], @@ -768,9 +756,7 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", "test", - "story", ], "title": "Component Two", "unboundStoryFn": [Function], @@ -832,8 +818,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -873,8 +857,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component One", @@ -914,8 +896,6 @@ describe('StoryStore', () => { "subcomponents": undefined, "tags": [ "dev", - "docs", - "story", "test", ], "title": "Component Two", From 5b467170f49077f0ffaf0e88737c41ae054e74fb Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 18:12:09 +0800 Subject: [PATCH 18/30] Fix portable stories tests --- .../src/modules/store/csf/composeConfigs.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts index bfad2ebe5f21..ba9ead34d119 100644 --- a/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts +++ b/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts @@ -23,6 +23,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -48,6 +49,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -77,6 +79,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -112,6 +115,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -150,6 +154,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -179,6 +184,7 @@ describe('composeConfigs', () => { loaders: ['1', '2', '3', '4'], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -208,6 +214,7 @@ describe('composeConfigs', () => { loaders: ['1', '2', '3'], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -233,6 +240,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -259,6 +267,7 @@ describe('composeConfigs', () => { loaders: [], beforeEach: [], runStep: expect.any(Function), + tags: [], }); }); @@ -291,6 +300,7 @@ describe('composeConfigs', () => { renderToCanvas: 'renderToCanvas-2', applyDecorators: 'applyDecorators-2', runStep: expect.any(Function), + tags: [], }); }); From f5447a33dc4a57b563ffa7685e46e4665c09f25f Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 18:43:43 +0800 Subject: [PATCH 19/30] Fix tags inheritance story --- code/lib/preview-api/template/stories/tags.stories.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/preview-api/template/stories/tags.stories.ts b/code/lib/preview-api/template/stories/tags.stories.ts index f86b36f08491..64e715b1e0f7 100644 --- a/code/lib/preview-api/template/stories/tags.stories.ts +++ b/code/lib/preview-api/template/stories/tags.stories.ts @@ -20,7 +20,7 @@ export const Inheritance = { play: async ({ canvasElement }: PlayFunctionContext) => { const canvas = within(canvasElement); await expect(JSON.parse(canvas.getByTestId('pre').innerText)).toEqual({ - tags: ['story-one', 'story-two', 'story'], + tags: ['dev', 'test', 'component-one', 'component-two', 'story-one', 'story-two'], }); }, parameters: { chromatic: { disable: false } }, From 01923cdc081a2af54a46d5704ad40062c09ec180 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 21:54:21 +0800 Subject: [PATCH 20/30] Remove bogus console.log --- code/lib/core-server/src/utils/StoryIndexGenerator.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 4c1de76651fc..7e65fc75dfca 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -440,7 +440,6 @@ export class StoryIndexGenerator { ...(result.metaTags ?? []), csfEntry ? 'attached-mdx' : 'unattached-mdx' ); - console.log({ projectTags, tags }); const docsEntry: DocsCacheEntry = { id, From dc28521b68c7d4824a51b2387783ffb952821aab Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 21:55:06 +0800 Subject: [PATCH 21/30] Try clearing the webpack mock --- code/lib/core-server/src/utils/stories-json.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/code/lib/core-server/src/utils/stories-json.test.ts b/code/lib/core-server/src/utils/stories-json.test.ts index cece84537367..21a901ada040 100644 --- a/code/lib/core-server/src/utils/stories-json.test.ts +++ b/code/lib/core-server/src/utils/stories-json.test.ts @@ -75,6 +75,7 @@ describe('useStoriesJson', () => { send.mockClear(); write.mockClear(); vi.mocked(debounce).mockImplementation((cb) => cb as any); + Watchpack.mockClear(); }); const request: Request = { From d810f8e209fead6aaee0494371a8a249b455c455 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 23:06:03 +0800 Subject: [PATCH 22/30] Try to fix CI --- code/lib/core-server/src/utils/watchConfig.ts | 1 - code/renderers/react/src/__test__/portable-stories.test.tsx | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/core-server/src/utils/watchConfig.ts b/code/lib/core-server/src/utils/watchConfig.ts index 14b925f1c1d8..99b85fe62e2a 100644 --- a/code/lib/core-server/src/utils/watchConfig.ts +++ b/code/lib/core-server/src/utils/watchConfig.ts @@ -12,7 +12,6 @@ export function watchConfig( ignored: ['**/.git', '**/node_modules'], }); - console.log('watching previewjs', configDir); wp.watch({ directories: [configDir], }); diff --git a/code/renderers/react/src/__test__/portable-stories.test.tsx b/code/renderers/react/src/__test__/portable-stories.test.tsx index 15e953c3fecb..aab2585743d5 100644 --- a/code/renderers/react/src/__test__/portable-stories.test.tsx +++ b/code/renderers/react/src/__test__/portable-stories.test.tsx @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ import React from 'react'; import { vi, it, expect, afterEach, describe } from 'vitest'; import { render, screen, cleanup } from '@testing-library/react'; From bdbd3322f794ce61fa38c22147273719c1f7df48 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 6 May 2024 23:13:14 +0800 Subject: [PATCH 23/30] Fix bad merge --- code/lib/codemod/package.json | 6 +++--- code/yarn.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 3d30ffe9ab47..651182b854fc 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -54,9 +54,9 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@babel/core": "^7.23.2", - "@babel/preset-env": "^7.23.2", - "@babel/types": "^7.23.0", + "@babel/core": "^7.24.4", + "@babel/preset-env": "^7.24.4", + "@babel/types": "^7.24.0", "@storybook/csf": "^0.1.7", "@storybook/csf-tools": "workspace:*", "@storybook/node-logger": "workspace:*", diff --git a/code/yarn.lock b/code/yarn.lock index d37cc3db6007..d559b86e7189 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5994,9 +5994,9 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/codemod@workspace:lib/codemod" dependencies: - "@babel/core": "npm:^7.23.2" - "@babel/preset-env": "npm:^7.23.2" - "@babel/types": "npm:^7.23.0" + "@babel/core": "npm:^7.24.4" + "@babel/preset-env": "npm:^7.24.4" + "@babel/types": "npm:^7.24.0" "@storybook/csf": "npm:^0.1.7" "@storybook/csf-tools": "workspace:*" "@storybook/node-logger": "workspace:*" From 31ae4d625a174bb40467fa05d8d662d5d92acee0 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 17:05:22 +0800 Subject: [PATCH 24/30] Fix yarn.lock --- code/yarn.lock | 725 ++++++++++--------------------------------------- 1 file changed, 151 insertions(+), 574 deletions(-) diff --git a/code/yarn.lock b/code/yarn.lock index b7a4e604c38b..301f30f4b09a 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -19,7 +19,7 @@ __metadata: languageName: node linkType: hard -"@ampproject/remapping@npm:2.3.0": +"@ampproject/remapping@npm:2.3.0, @ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1": version: 2.3.0 resolution: "@ampproject/remapping@npm:2.3.0" dependencies: @@ -29,16 +29,6 @@ __metadata: languageName: node linkType: hard -"@ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1": - version: 2.2.1 - resolution: "@ampproject/remapping@npm:2.2.1" - dependencies: - "@jridgewell/gen-mapping": "npm:^0.3.0" - "@jridgewell/trace-mapping": "npm:^0.3.9" - checksum: 10c0/92ce5915f8901d8c7cd4f4e6e2fe7b9fd335a29955b400caa52e0e5b12ca3796ada7c2f10e78c9c5b0f9c2539dff0ffea7b19850a56e1487aa083531e1e46d43 - languageName: node - linkType: hard - "@analogjs/vite-plugin-angular@npm:^0.2.24": version: 0.2.28 resolution: "@analogjs/vite-plugin-angular@npm:0.2.28" @@ -456,7 +446,7 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:7.23.6, @babel/generator@npm:^7.23.0": +"@babel/generator@npm:7.23.6": version: 7.23.6 resolution: "@babel/generator@npm:7.23.6" dependencies: @@ -480,6 +470,18 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.23.0, @babel/generator@npm:^7.24.5": + version: 7.24.5 + resolution: "@babel/generator@npm:7.24.5" + dependencies: + "@babel/types": "npm:^7.24.5" + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.25" + jsesc: "npm:^2.5.1" + checksum: 10c0/0d64f880150e7dfb92ceff2b4ac865f36aa1e295120920246492ffd0146562dabf79ba8699af1c8833f8a7954818d4d146b7b02f808df4d6024fb99f98b2f78d + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:7.22.5, @babel/helper-annotate-as-pure@npm:^7.18.6, @babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -530,25 +532,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.24.0": - version: 7.24.0 - resolution: "@babel/helper-create-class-features-plugin@npm:7.24.0" - dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.22.5" - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-member-expression-to-functions": "npm:^7.23.0" - "@babel/helper-optimise-call-expression": "npm:^7.22.5" - "@babel/helper-replace-supers": "npm:^7.22.20" - "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.22.5" - "@babel/helper-split-export-declaration": "npm:^7.22.6" - semver: "npm:^6.3.1" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/341548496df202805489422a160bba75b111d994c64d788a397c35f01784632af48bf06023af8aa2fe72c2c254f8c885b4e0f7f3df5ef17a37370f2feaf80328 - languageName: node - linkType: hard - "@babel/helper-create-regexp-features-plugin@npm:^7.18.6, @babel/helper-create-regexp-features-plugin@npm:^7.22.15, @babel/helper-create-regexp-features-plugin@npm:^7.22.5": version: 7.22.15 resolution: "@babel/helper-create-regexp-features-plugin@npm:7.22.15" @@ -577,21 +560,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-define-polyfill-provider@npm:^0.6.0": - version: 0.6.0 - resolution: "@babel/helper-define-polyfill-provider@npm:0.6.0" - dependencies: - "@babel/helper-compilation-targets": "npm:^7.22.6" - "@babel/helper-plugin-utils": "npm:^7.22.5" - debug: "npm:^4.1.1" - lodash.debounce: "npm:^4.0.8" - resolve: "npm:^1.14.2" - peerDependencies: - "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 - checksum: 10c0/bf6af52fadbbebc5bf71166b91eac4fc21431ec9b0d2a94063f3a3d900ed44aa1384ad23e920a85e7a657fcf3e80edb2eaaac9d902bd1e632f3b50c836b45c53 - languageName: node - linkType: hard - "@babel/helper-define-polyfill-provider@npm:^0.6.1, @babel/helper-define-polyfill-provider@npm:^0.6.2": version: 0.6.2 resolution: "@babel/helper-define-polyfill-provider@npm:0.6.2" @@ -633,7 +601,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.22.15, @babel/helper-member-expression-to-functions@npm:^7.23.0": +"@babel/helper-member-expression-to-functions@npm:^7.23.0": version: 7.23.0 resolution: "@babel/helper-member-expression-to-functions@npm:7.23.0" dependencies: @@ -642,16 +610,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-imports@npm:^7.16.7, @babel/helper-module-imports@npm:^7.22.15, @babel/helper-module-imports@npm:^7.8.3": - version: 7.22.15 - resolution: "@babel/helper-module-imports@npm:7.22.15" - dependencies: - "@babel/types": "npm:^7.22.15" - checksum: 10c0/4e0d7fc36d02c1b8c8b3006dfbfeedf7a367d3334a04934255de5128115ea0bafdeb3e5736a2559917f0653e4e437400d54542da0468e08d3cbc86d3bbfa8f30 - languageName: node - linkType: hard - -"@babel/helper-module-imports@npm:^7.24.1, @babel/helper-module-imports@npm:^7.24.3": +"@babel/helper-module-imports@npm:^7.16.7, @babel/helper-module-imports@npm:^7.22.15, @babel/helper-module-imports@npm:^7.24.1, @babel/helper-module-imports@npm:^7.24.3, @babel/helper-module-imports@npm:^7.8.3": version: 7.24.3 resolution: "@babel/helper-module-imports@npm:7.24.3" dependencies: @@ -684,14 +643,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": - version: 7.22.5 - resolution: "@babel/helper-plugin-utils@npm:7.22.5" - checksum: 10c0/d2c4bfe2fa91058bcdee4f4e57a3f4933aed7af843acfd169cd6179fab8d13c1d636474ecabb2af107dc77462c7e893199aa26632bac1c6d7e025a17cbb9d20d - languageName: node - linkType: hard - -"@babel/helper-plugin-utils@npm:^7.24.0": +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.24.0, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": version: 7.24.0 resolution: "@babel/helper-plugin-utils@npm:7.24.0" checksum: 10c0/90f41bd1b4dfe7226b1d33a4bb745844c5c63e400f9e4e8bf9103a7ceddd7d425d65333b564d9daba3cebd105985764d51b4bd4c95822b97c2e3ac1201a8a5da @@ -711,19 +663,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-replace-supers@npm:^7.22.20": - version: 7.22.20 - resolution: "@babel/helper-replace-supers@npm:7.22.20" - dependencies: - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-member-expression-to-functions": "npm:^7.22.15" - "@babel/helper-optimise-call-expression": "npm:^7.22.5" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/6b0858811ad46873817c90c805015d63300e003c5a85c147a17d9845fa2558a02047c3cc1f07767af59014b2dd0fa75b503e5bc36e917f360e9b67bb6f1e79f4 - languageName: node - linkType: hard - "@babel/helper-replace-supers@npm:^7.24.1": version: 7.24.1 resolution: "@babel/helper-replace-supers@npm:7.24.1" @@ -764,10 +703,19 @@ __metadata: languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.23.4": - version: 7.23.4 - resolution: "@babel/helper-string-parser@npm:7.23.4" - checksum: 10c0/f348d5637ad70b6b54b026d6544bd9040f78d24e7ec245a0fc42293968181f6ae9879c22d89744730d246ce8ec53588f716f102addd4df8bbc79b73ea10004ac +"@babel/helper-split-export-declaration@npm:^7.24.5": + version: 7.24.5 + resolution: "@babel/helper-split-export-declaration@npm:7.24.5" + dependencies: + "@babel/types": "npm:^7.24.5" + checksum: 10c0/d7a812d67d031a348f3fb0e6263ce2dbe6038f81536ba7fb16db385383bcd6542b71833194303bf6d3d0e4f7b6b584c9c8fae8772122e2ce68fc9bdf07f4135d + languageName: node + linkType: hard + +"@babel/helper-string-parser@npm:^7.23.4, @babel/helper-string-parser@npm:^7.24.1": + version: 7.24.1 + resolution: "@babel/helper-string-parser@npm:7.24.1" + checksum: 10c0/2f9bfcf8d2f9f083785df0501dbab92770111ece2f90d120352fda6dd2a7d47db11b807d111e6f32aa1ba6d763fe2dc6603d153068d672a5d0ad33ca802632b2 languageName: node linkType: hard @@ -778,7 +726,14 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-option@npm:^7.22.15, @babel/helper-validator-option@npm:^7.23.5": +"@babel/helper-validator-identifier@npm:^7.24.5": + version: 7.24.5 + resolution: "@babel/helper-validator-identifier@npm:7.24.5" + checksum: 10c0/05f957229d89ce95a137d04e27f7d0680d84ae48b6ad830e399db0779341f7d30290f863a93351b4b3bde2166737f73a286ea42856bb07c8ddaa95600d38645c + languageName: node + linkType: hard + +"@babel/helper-validator-option@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-validator-option@npm:7.23.5" checksum: 10c0/af45d5c0defb292ba6fd38979e8f13d7da63f9623d8ab9ededc394f67eb45857d2601278d151ae9affb6e03d5d608485806cd45af08b4468a0515cf506510e94 @@ -819,30 +774,21 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.4, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.6, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6": - version: 7.23.9 - resolution: "@babel/parser@npm:7.23.9" - bin: - parser: ./bin/babel-parser.js - checksum: 10c0/7df97386431366d4810538db4b9ec538f4377096f720c0591c7587a16f6810e62747e9fbbfa1ff99257fd4330035e4fb1b5b77c7bd3b97ce0d2e3780a6618975 - languageName: node - linkType: hard - -"@babel/parser@npm:^7.24.0": - version: 7.24.0 - resolution: "@babel/parser@npm:7.24.0" +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.4, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.6, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.24.0, @babel/parser@npm:^7.24.1, @babel/parser@npm:^7.24.4, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6": + version: 7.24.4 + resolution: "@babel/parser@npm:7.24.4" bin: parser: ./bin/babel-parser.js - checksum: 10c0/77593d0b9de9906823c4d653bb6cda1c7593837598516330f655f70cba6224a37def7dbe5b4dad0038482d407d8d209eb8be5f48ca9a13357d769f829c5adb8e + checksum: 10c0/8381e1efead5069cb7ed2abc3a583f4a86289b2f376c75cecc69f59a8eb36df18274b1886cecf2f97a6a0dff5334b27330f58535be9b3e4e26102cc50e12eac8 languageName: node linkType: hard -"@babel/parser@npm:^7.24.1, @babel/parser@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/parser@npm:7.24.4" +"@babel/parser@npm:^7.24.5": + version: 7.24.5 + resolution: "@babel/parser@npm:7.24.5" bin: parser: ./bin/babel-parser.js - checksum: 10c0/8381e1efead5069cb7ed2abc3a583f4a86289b2f376c75cecc69f59a8eb36df18274b1886cecf2f97a6a0dff5334b27330f58535be9b3e4e26102cc50e12eac8 + checksum: 10c0/8333a6ad5328bad34fa0e12bcee147c3345ea9a438c0909e7c68c6cfbea43c464834ffd7eabd1cbc1c62df0a558e22ffade9f5b29440833ba7b33d96a71f88c0 languageName: node linkType: hard @@ -907,15 +853,15 @@ __metadata: linkType: hard "@babel/plugin-proposal-decorators@npm:^7.13.5, @babel/plugin-proposal-decorators@npm:^7.22.7": - version: 7.24.0 - resolution: "@babel/plugin-proposal-decorators@npm:7.24.0" + version: 7.24.1 + resolution: "@babel/plugin-proposal-decorators@npm:7.24.1" dependencies: - "@babel/helper-create-class-features-plugin": "npm:^7.24.0" + "@babel/helper-create-class-features-plugin": "npm:^7.24.1" "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/plugin-syntax-decorators": "npm:^7.24.0" + "@babel/plugin-syntax-decorators": "npm:^7.24.1" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/6bf16cb2b5b2f1b63b5ea964853cd3b3419c8285296b5bf64a64127c9d5c1b2e6829e84bd92734e4b71df67686d8f36fb01bb8a45fc52bcece7503b73bc42ec7 + checksum: 10c0/ffe49522ada6581f1c760b777dbd913afcd204e11e6907c4f2c293ce6d30961449ac19d9960250d8743a1f60e21cb667e51a3af15992dfe7627105e039c46a9b languageName: node linkType: hard @@ -1023,14 +969,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-decorators@npm:^7.24.0": - version: 7.24.0 - resolution: "@babel/plugin-syntax-decorators@npm:7.24.0" +"@babel/plugin-syntax-decorators@npm:^7.24.1": + version: 7.24.1 + resolution: "@babel/plugin-syntax-decorators@npm:7.24.1" dependencies: "@babel/helper-plugin-utils": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/6c11801e062772d4e1b0b418a4732574128b1dfc13193a2909fa93937346746aaa7046f88f6026ff3c80777c967d0fe2e4bb19a1d3fb399e8349c81741e4f471 + checksum: 10c0/14028a746f86efbdd47e4961456bb53d656e9e3461890f66b1b01032151d15fda5ba99fcaa60232a229a33aa9e73b11c2597b706d5074c520155757e372cd17b languageName: node linkType: hard @@ -1056,14 +1002,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-flow@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/plugin-syntax-flow@npm:7.22.5" +"@babel/plugin-syntax-flow@npm:^7.24.1": + version: 7.24.1 + resolution: "@babel/plugin-syntax-flow@npm:7.24.1" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/07afc7df02141597968532bfbfa3f6c0ad21a2bdd885d0e5e035dcf60fdf35f0995631c9750b464e1a6f2feea14160a82787f914e88e8f7115dc99f09853e43e + checksum: 10c0/618de04360a96111408abdaafaba2efbaef0d90faad029d50e0281eaad5d7c7bd2ce4420bbac0ee27ad84c2b7bbc3e48f782064f81ed5bc40c398637991004c7 languageName: node linkType: hard @@ -1309,18 +1255,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-block-scoping@npm:^7.23.4, @babel/plugin-transform-block-scoping@npm:^7.8.3": - version: 7.23.4 - resolution: "@babel/plugin-transform-block-scoping@npm:7.23.4" - dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 10c0/83006804dddf980ab1bcd6d67bc381e24b58c776507c34f990468f820d0da71dba3697355ca4856532fa2eeb2a1e3e73c780f03760b5507a511cbedb0308e276 - languageName: node - linkType: hard - -"@babel/plugin-transform-block-scoping@npm:^7.24.4": +"@babel/plugin-transform-block-scoping@npm:^7.23.4, @babel/plugin-transform-block-scoping@npm:^7.24.4, @babel/plugin-transform-block-scoping@npm:^7.8.3": version: 7.24.4 resolution: "@babel/plugin-transform-block-scoping@npm:7.24.4" dependencies: @@ -1456,15 +1391,15 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-flow-strip-types@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/plugin-transform-flow-strip-types@npm:7.22.5" +"@babel/plugin-transform-flow-strip-types@npm:^7.24.1": + version: 7.24.1 + resolution: "@babel/plugin-transform-flow-strip-types@npm:7.24.1" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" - "@babel/plugin-syntax-flow": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/plugin-syntax-flow": "npm:^7.24.1" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/5949a8e5214e3fc65d31dab0551423cea9d9eef35faa5d0004707ba7347baf96166aa400907ce7498f754db4e1e9d039ca434a508546b0dc9fdae9a42e814c1a + checksum: 10c0/e6aa9cbad0441867598d390d4df65bc8c6b797574673e4eedbdae0cc528e81e00f4b2cd38f7d138b0f04bcdd2540384a9812d5d76af5abfa06aee1c7fc20ca58 languageName: node linkType: hard @@ -1638,13 +1573,13 @@ __metadata: linkType: hard "@babel/plugin-transform-object-assign@npm:^7.8.3": - version: 7.22.5 - resolution: "@babel/plugin-transform-object-assign@npm:7.22.5" + version: 7.24.1 + resolution: "@babel/plugin-transform-object-assign@npm:7.24.1" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/c80ca956ccc45c68a6f35e8aea80e08c0a653e4baf243727d4258f242d312d71be20e3fad35a1f2cd9d58b30dcbb5cdf5f8d6c6614a3f8c6079d90f9b1dadee6 + checksum: 10c0/eb30beac71a5930ecdfc8740b184f22dd2043b1ac6f9f6818fb2e10ddfbdd6536b4ddb0d00af2c9f4a375823f52a566915eb598bea0633484aa5ff5db4e547fd languageName: node linkType: hard @@ -1770,24 +1705,24 @@ __metadata: linkType: hard "@babel/plugin-transform-react-jsx-self@npm:^7.18.6": - version: 7.22.5 - resolution: "@babel/plugin-transform-react-jsx-self@npm:7.22.5" + version: 7.24.1 + resolution: "@babel/plugin-transform-react-jsx-self@npm:7.24.1" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/263091bdede1f448cb2c59b84eb69972c15d3f022c929a75337bd20d8b65551ac38cd26dad1946eaa93289643506b10ddaea3445a28cb8fca5a773a22a0df90b + checksum: 10c0/ea362ff94b535c753f560eb1f5e063dc72bbbca17ed58837a949a7b289d5eacc7b0a28296d1932c94429b168d6040cdee5484a59b9e3c021f169e0ee137e6a27 languageName: node linkType: hard "@babel/plugin-transform-react-jsx-source@npm:^7.19.6": - version: 7.22.5 - resolution: "@babel/plugin-transform-react-jsx-source@npm:7.22.5" + version: 7.24.1 + resolution: "@babel/plugin-transform-react-jsx-source@npm:7.24.1" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/defc9debb76b4295e3617ef7795a0533dbbecef6f51bf5ba4bfc162df892a84fd39e14d5f1b9a5aad7b09b97074fef4c6756f9d2036eef5a9874acabe198f75a + checksum: 10c0/ea8e3263c0dc51fbc97c156cc647150a757cc56de10781287353d0ce9b2dcd6b6d93d573c0142d7daf5d6fb554c74fa1971ae60764924ea711161d8458739b63 languageName: node linkType: hard @@ -2182,15 +2117,15 @@ __metadata: linkType: hard "@babel/preset-flow@npm:^7.13.13, @babel/preset-flow@npm:^7.22.15": - version: 7.22.15 - resolution: "@babel/preset-flow@npm:7.22.15" + version: 7.24.1 + resolution: "@babel/preset-flow@npm:7.24.1" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" - "@babel/helper-validator-option": "npm:^7.22.15" - "@babel/plugin-transform-flow-strip-types": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-validator-option": "npm:^7.23.5" + "@babel/plugin-transform-flow-strip-types": "npm:^7.24.1" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/7eef0c84ec1889d6c4f7a67d7d1a81703420eed123a8c23f25af148eead77907f0bd701f3e729fdb37d3ddb2a373bf43938b36a9ba17f546111ddb9521466b92 + checksum: 10c0/e2209158d68a456b8f9d6cd6c810e692f3ab8ca28edba99afcecaacd657ace7cc905e566f84d6da06e537836a2f830bc6ddf4cb34006d57303ff9a40a94fa433 languageName: node linkType: hard @@ -2239,17 +2174,17 @@ __metadata: linkType: hard "@babel/register@npm:^7.13.16, @babel/register@npm:^7.22.15": - version: 7.22.15 - resolution: "@babel/register@npm:7.22.15" + version: 7.23.7 + resolution: "@babel/register@npm:7.23.7" dependencies: clone-deep: "npm:^4.0.1" find-cache-dir: "npm:^2.0.0" make-dir: "npm:^2.1.0" - pirates: "npm:^4.0.5" + pirates: "npm:^4.0.6" source-map-support: "npm:^0.5.16" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/895cc773c3b3eae909478ea2a9735ef6edd634b04b4aaaad2ce576fd591c2b3c70ff8c90423e769a291bee072186e7e4801480c1907e31ba3053c6cdba5571cb + checksum: 10c0/b2466e41a4394e725b57e139ba45c3f61b88546d3cb443e84ce46cb34071b60c6cdb706a14c58a1443db530691a54f51da1f0c97f6c1aecbb838a2fb7eb5dbb9 languageName: node linkType: hard @@ -2261,12 +2196,12 @@ __metadata: linkType: hard "@babel/runtime-corejs3@npm:^7.10.2": - version: 7.23.1 - resolution: "@babel/runtime-corejs3@npm:7.23.1" + version: 7.24.4 + resolution: "@babel/runtime-corejs3@npm:7.24.4" dependencies: core-js-pure: "npm:^3.30.2" regenerator-runtime: "npm:^0.14.0" - checksum: 10c0/6e2c2b11779ff56c88b1f3a8742498640f7271ad4fcf9cfd24052bbb236a5e7c4c7c8d81cda751da3b4effa678736303deb78441c5752e63bfb90d6453fd870f + checksum: 10c0/121bec9a0b505e2995c4b71cf480167e006e8ee423f77bccc38975bfbfbfdb191192ff03557c18fad6de8f2b85c12c49aaa4b92d1d5fe0c0e136da664129be1e languageName: node linkType: hard @@ -2297,16 +2232,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": - version: 7.23.6 - resolution: "@babel/runtime@npm:7.23.6" - dependencies: - regenerator-runtime: "npm:^0.14.0" - checksum: 10c0/d886954e985ef8e421222f7a2848884d96a752e0020d3078b920dd104e672fdf23bcc6f51a44313a048796319f1ac9d09c2c88ec8cbb4e1f09174bcd3335b9ff - languageName: node - linkType: hard - -"@babel/runtime@npm:^7.22.15, @babel/runtime@npm:^7.22.6, @babel/runtime@npm:^7.24.4, @babel/runtime@npm:^7.7.2": +"@babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.22.15, @babel/runtime@npm:^7.22.6, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.24.4, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": version: 7.24.4 resolution: "@babel/runtime@npm:7.24.4" dependencies: @@ -2335,79 +2261,61 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.23.9, @babel/traverse@npm:^7.4.5": - version: 7.23.9 - resolution: "@babel/traverse@npm:7.23.9" - dependencies: - "@babel/code-frame": "npm:^7.23.5" - "@babel/generator": "npm:^7.23.6" - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-hoist-variables": "npm:^7.22.5" - "@babel/helper-split-export-declaration": "npm:^7.22.6" - "@babel/parser": "npm:^7.23.9" - "@babel/types": "npm:^7.23.9" - debug: "npm:^4.3.1" - globals: "npm:^11.1.0" - checksum: 10c0/d1615d1d02f04d47111a7ea4446a1a6275668ca39082f31d51f08380de9502e19862be434eaa34b022ce9a17dbb8f9e2b73a746c654d9575f3a680a7ffdf5630 - languageName: node - linkType: hard - -"@babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.24.0": - version: 7.24.0 - resolution: "@babel/traverse@npm:7.24.0" +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.23.9, @babel/traverse@npm:^7.24.0, @babel/traverse@npm:^7.24.1, @babel/traverse@npm:^7.4.5": + version: 7.24.1 + resolution: "@babel/traverse@npm:7.24.1" dependencies: - "@babel/code-frame": "npm:^7.23.5" - "@babel/generator": "npm:^7.23.6" + "@babel/code-frame": "npm:^7.24.1" + "@babel/generator": "npm:^7.24.1" "@babel/helper-environment-visitor": "npm:^7.22.20" "@babel/helper-function-name": "npm:^7.23.0" "@babel/helper-hoist-variables": "npm:^7.22.5" "@babel/helper-split-export-declaration": "npm:^7.22.6" - "@babel/parser": "npm:^7.24.0" + "@babel/parser": "npm:^7.24.1" "@babel/types": "npm:^7.24.0" debug: "npm:^4.3.1" globals: "npm:^11.1.0" - checksum: 10c0/55ffd2b0ce0fbd0a09051edc4def4fb1e96f35e0b100c0dc2a7429df569971ae312c290e980e423471f350961705698a257c7eea8c8304918024cc26f02468ba + checksum: 10c0/c087b918f6823776537ba246136c70e7ce0719fc05361ebcbfd16f4e6f2f6f1f8f4f9167f1d9b675f27d12074839605189cc9d689de20b89a85e7c140f23daab languageName: node linkType: hard -"@babel/traverse@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/traverse@npm:7.24.1" +"@babel/traverse@npm:^7.23.2": + version: 7.24.5 + resolution: "@babel/traverse@npm:7.24.5" dependencies: - "@babel/code-frame": "npm:^7.24.1" - "@babel/generator": "npm:^7.24.1" + "@babel/code-frame": "npm:^7.24.2" + "@babel/generator": "npm:^7.24.5" "@babel/helper-environment-visitor": "npm:^7.22.20" "@babel/helper-function-name": "npm:^7.23.0" "@babel/helper-hoist-variables": "npm:^7.22.5" - "@babel/helper-split-export-declaration": "npm:^7.22.6" - "@babel/parser": "npm:^7.24.1" - "@babel/types": "npm:^7.24.0" + "@babel/helper-split-export-declaration": "npm:^7.24.5" + "@babel/parser": "npm:^7.24.5" + "@babel/types": "npm:^7.24.5" debug: "npm:^4.3.1" globals: "npm:^11.1.0" - checksum: 10c0/c087b918f6823776537ba246136c70e7ce0719fc05361ebcbfd16f4e6f2f6f1f8f4f9167f1d9b675f27d12074839605189cc9d689de20b89a85e7c140f23daab + checksum: 10c0/3f22534bc2b2ed9208e55ef48af3b32939032b23cb9dc4037447cb108640df70bbb0b9fea86e9c58648949fdc2cb14e89aa79ffa3c62a5dd43459a52fe8c01d1 languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.4, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.23.9, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6": - version: 7.23.9 - resolution: "@babel/types@npm:7.23.9" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.4, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.23.9, @babel/types@npm:^7.24.0, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6": + version: 7.24.0 + resolution: "@babel/types@npm:7.24.0" dependencies: "@babel/helper-string-parser": "npm:^7.23.4" "@babel/helper-validator-identifier": "npm:^7.22.20" to-fast-properties: "npm:^2.0.0" - checksum: 10c0/edc7bb180ce7e4d2aea10c6972fb10474341ac39ba8fdc4a27ffb328368dfdfbf40fca18e441bbe7c483774500d5c05e222cec276c242e952853dcaf4eb884f7 + checksum: 10c0/777a0bb5dbe038ca4c905fdafb1cdb6bdd10fe9d63ce13eca0bd91909363cbad554a53dc1f902004b78c1dcbc742056f877f2c99eeedff647333b1fadf51235d languageName: node linkType: hard -"@babel/types@npm:^7.24.0": - version: 7.24.0 - resolution: "@babel/types@npm:7.24.0" +"@babel/types@npm:^7.24.5": + version: 7.24.5 + resolution: "@babel/types@npm:7.24.5" dependencies: - "@babel/helper-string-parser": "npm:^7.23.4" - "@babel/helper-validator-identifier": "npm:^7.22.20" + "@babel/helper-string-parser": "npm:^7.24.1" + "@babel/helper-validator-identifier": "npm:^7.24.5" to-fast-properties: "npm:^2.0.0" - checksum: 10c0/777a0bb5dbe038ca4c905fdafb1cdb6bdd10fe9d63ce13eca0bd91909363cbad554a53dc1f902004b78c1dcbc742056f877f2c99eeedff647333b1fadf51235d + checksum: 10c0/e1284eb046c5e0451b80220d1200e2327e0a8544a2fe45bb62c952e5fdef7099c603d2336b17b6eac3cc046b7a69bfbce67fe56e1c0ea48cd37c65cb88638f2a languageName: node linkType: hard @@ -2945,13 +2853,6 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:8.56.0": - version: 8.56.0 - resolution: "@eslint/js@npm:8.56.0" - checksum: 10c0/60b3a1cf240e2479cec9742424224465dc50e46d781da1b7f5ef240501b2d1202c225bd456207faac4b34a64f4765833345bc4ddffd00395e1db40fa8c426f5a - languageName: node - linkType: hard - "@eslint/js@npm:8.57.0": version: 8.57.0 resolution: "@eslint/js@npm:8.57.0" @@ -3457,7 +3358,7 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.13, @humanwhocodes/config-array@npm:^0.11.14": +"@humanwhocodes/config-array@npm:^0.11.14": version: 0.11.14 resolution: "@humanwhocodes/config-array@npm:0.11.14" dependencies: @@ -3808,17 +3709,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.9": - version: 0.3.19 - resolution: "@jridgewell/trace-mapping@npm:0.3.19" - dependencies: - "@jridgewell/resolve-uri": "npm:^3.1.0" - "@jridgewell/sourcemap-codec": "npm:^1.4.14" - checksum: 10c0/845e6c6efca621b2b85e4d13fd25c319b6e4ab1ea78d4385ff6c0f78322ea0fcdfec8ac763aa4b56e8378c96d7bef101a2638c7a1a076f7d62f6376230c940a7 - languageName: node - linkType: hard - -"@jridgewell/trace-mapping@npm:^0.3.20, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.20, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.25 resolution: "@jridgewell/trace-mapping@npm:0.3.25" dependencies: @@ -10726,7 +10617,7 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs2@npm:^0.4.10": +"babel-plugin-polyfill-corejs2@npm:^0.4.10, babel-plugin-polyfill-corejs2@npm:^0.4.8": version: 0.4.11 resolution: "babel-plugin-polyfill-corejs2@npm:0.4.11" dependencies: @@ -10739,19 +10630,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs2@npm:^0.4.8": - version: 0.4.9 - resolution: "babel-plugin-polyfill-corejs2@npm:0.4.9" - dependencies: - "@babel/compat-data": "npm:^7.22.6" - "@babel/helper-define-polyfill-provider": "npm:^0.6.0" - semver: "npm:^6.3.1" - peerDependencies: - "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 - checksum: 10c0/2cd47af763eb40aa41f1d6d9cbf1bdd217ff6c28f614b057c0328ee42a4d82cbcdcbc7d081d93e2a2d80446c899f25c3ebec048a63d260ef65a0a364134f71cd - languageName: node - linkType: hard - "babel-plugin-polyfill-corejs3@npm:^0.10.1, babel-plugin-polyfill-corejs3@npm:^0.10.4": version: 0.10.4 resolution: "babel-plugin-polyfill-corejs3@npm:0.10.4" @@ -11406,20 +11284,6 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.14.5": - version: 4.22.2 - resolution: "browserslist@npm:4.22.2" - dependencies: - caniuse-lite: "npm:^1.0.30001565" - electron-to-chromium: "npm:^1.4.601" - node-releases: "npm:^2.0.14" - update-browserslist-db: "npm:^1.0.13" - bin: - browserslist: cli.js - checksum: 10c0/2a331aab90503130043ca41dd5d281fa1e89d5e076d07a2d75e76bf4d693bd56e73d5abcd8c4f39119da6328d450578c216cf1cd5c99b82d8a90a2ae6271b465 - languageName: node - linkType: hard - "browserslist@npm:^4.21.10, browserslist@npm:^4.21.5, browserslist@npm:^4.22.2, browserslist@npm:^4.23.0": version: 4.23.0 resolution: "browserslist@npm:4.23.0" @@ -11726,27 +11590,13 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001565": - version: 1.0.30001581 - resolution: "caniuse-lite@npm:1.0.30001581" - checksum: 10c0/34b048156514eab5932212807428905cbecdef918f7c3d2153d5e8b6885d929e5c0b649f9e135cb1e03e413fbad8e00d1f24ed04cbcca52adc660ef98cad9032 - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001579, caniuse-lite@npm:^1.0.30001591": +"caniuse-lite@npm:^1.0.30001579, caniuse-lite@npm:^1.0.30001587, caniuse-lite@npm:^1.0.30001591": version: 1.0.30001598 resolution: "caniuse-lite@npm:1.0.30001598" checksum: 10c0/7d4a1eecfe9e26a4ee5414dbcbf46dd02910d93dd6458ffe1ae146b7c2159af9bf159d7d75d897a1b72a62c1b7f5cef46b4c1f315574a11b0529c7d06bc55849 languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001587": - version: 1.0.30001597 - resolution: "caniuse-lite@npm:1.0.30001597" - checksum: 10c0/32dc315ffafacc8167286c95b05f41b3ce2818314ea913ffed6ceb7b58c64c38365ec250114d1ecceac34f1c77e5af089479e54b160c4a89b88fd25a98851b78 - languageName: node - linkType: hard - "case-sensitive-paths-webpack-plugin@npm:^2.4.0": version: 2.4.0 resolution: "case-sensitive-paths-webpack-plugin@npm:2.4.0" @@ -12836,7 +12686,7 @@ __metadata: languageName: node linkType: hard -"css-loader@npm:6.10.0": +"css-loader@npm:6.10.0, css-loader@npm:^6.7.1, css-loader@npm:^6.7.3": version: 6.10.0 resolution: "css-loader@npm:6.10.0" dependencies: @@ -12860,24 +12710,6 @@ __metadata: languageName: node linkType: hard -"css-loader@npm:^6.7.1, css-loader@npm:^6.7.3": - version: 6.8.1 - resolution: "css-loader@npm:6.8.1" - dependencies: - icss-utils: "npm:^5.1.0" - postcss: "npm:^8.4.21" - postcss-modules-extract-imports: "npm:^3.0.0" - postcss-modules-local-by-default: "npm:^4.0.3" - postcss-modules-scope: "npm:^3.0.0" - postcss-modules-values: "npm:^4.0.0" - postcss-value-parser: "npm:^4.2.0" - semver: "npm:^7.3.8" - peerDependencies: - webpack: ^5.0.0 - checksum: 10c0/a6e23de4ec1d2832f10b8ca3cfec6b6097a97ca3c73f64338ae5cd110ac270f1b218ff0273d39f677a7a561f1a9d9b0d332274664d0991bcfafaae162c2669c4 - languageName: node - linkType: hard - "css-select@npm:^4.1.3": version: 4.3.0 resolution: "css-select@npm:4.3.0" @@ -13828,13 +13660,6 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.4.601": - version: 1.4.601 - resolution: "electron-to-chromium@npm:1.4.601" - checksum: 10c0/345226e9edff5b72bd431b5bec1eaabc3c85e430fa0171586b539c64e5bde7c161cad6387e657ab8e0f197a894c1679f19c60f687baad12118a06e1db543cf95 - languageName: node - linkType: hard - "electron-to-chromium@npm:^1.4.668": version: 1.4.699 resolution: "electron-to-chromium@npm:1.4.699" @@ -14891,7 +14716,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.0.0": +"eslint@npm:^8.0.0, eslint@npm:^8.56.0": version: 8.57.0 resolution: "eslint@npm:8.57.0" dependencies: @@ -14939,54 +14764,6 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.56.0": - version: 8.56.0 - resolution: "eslint@npm:8.56.0" - dependencies: - "@eslint-community/eslint-utils": "npm:^4.2.0" - "@eslint-community/regexpp": "npm:^4.6.1" - "@eslint/eslintrc": "npm:^2.1.4" - "@eslint/js": "npm:8.56.0" - "@humanwhocodes/config-array": "npm:^0.11.13" - "@humanwhocodes/module-importer": "npm:^1.0.1" - "@nodelib/fs.walk": "npm:^1.2.8" - "@ungap/structured-clone": "npm:^1.2.0" - ajv: "npm:^6.12.4" - chalk: "npm:^4.0.0" - cross-spawn: "npm:^7.0.2" - debug: "npm:^4.3.2" - doctrine: "npm:^3.0.0" - escape-string-regexp: "npm:^4.0.0" - eslint-scope: "npm:^7.2.2" - eslint-visitor-keys: "npm:^3.4.3" - espree: "npm:^9.6.1" - esquery: "npm:^1.4.2" - esutils: "npm:^2.0.2" - fast-deep-equal: "npm:^3.1.3" - file-entry-cache: "npm:^6.0.1" - find-up: "npm:^5.0.0" - glob-parent: "npm:^6.0.2" - globals: "npm:^13.19.0" - graphemer: "npm:^1.4.0" - ignore: "npm:^5.2.0" - imurmurhash: "npm:^0.1.4" - is-glob: "npm:^4.0.0" - is-path-inside: "npm:^3.0.3" - js-yaml: "npm:^4.1.0" - json-stable-stringify-without-jsonify: "npm:^1.0.1" - levn: "npm:^0.4.1" - lodash.merge: "npm:^4.6.2" - minimatch: "npm:^3.1.2" - natural-compare: "npm:^1.4.0" - optionator: "npm:^0.9.3" - strip-ansi: "npm:^6.0.1" - text-table: "npm:^0.2.0" - bin: - eslint: bin/eslint.js - checksum: 10c0/2be598f7da1339d045ad933ffd3d4742bee610515cd2b0d9a2b8b729395a01d4e913552fff555b559fccaefd89d7b37632825789d1b06470608737ae69ab43fb - languageName: node - linkType: hard - "esm-env@npm:^1.0.0": version: 1.0.0 resolution: "esm-env@npm:1.0.0" @@ -17456,7 +17233,7 @@ __metadata: languageName: node linkType: hard -"https-proxy-agent@npm:7.0.4": +"https-proxy-agent@npm:7.0.4, https-proxy-agent@npm:^7.0.1, https-proxy-agent@npm:^7.0.2": version: 7.0.4 resolution: "https-proxy-agent@npm:7.0.4" dependencies: @@ -17476,16 +17253,6 @@ __metadata: languageName: node linkType: hard -"https-proxy-agent@npm:^7.0.1, https-proxy-agent@npm:^7.0.2": - version: 7.0.2 - resolution: "https-proxy-agent@npm:7.0.2" - dependencies: - agent-base: "npm:^7.0.2" - debug: "npm:4" - checksum: 10c0/7735eb90073db087e7e79312e3d97c8c04baf7ea7ca7b013382b6a45abbaa61b281041a98f4e13c8c80d88f843785bcc84ba189165b4b4087b1e3496ba656d77 - languageName: node - linkType: hard - "human-signals@npm:^2.1.0": version: 2.1.0 resolution: "human-signals@npm:2.1.0" @@ -17727,7 +17494,7 @@ __metadata: languageName: node linkType: hard -"ini@npm:4.1.2": +"ini@npm:4.1.2, ini@npm:^4.1.0": version: 4.1.2 resolution: "ini@npm:4.1.2" checksum: 10c0/e0ffe587038e26ca1debfece6f5e52fd17f4e65be59bb481bb24b89cd2be31a71f619465918da215916b4deba7d1134c228c58fe5e0db66a71a472dee9b8f99c @@ -17741,13 +17508,6 @@ __metadata: languageName: node linkType: hard -"ini@npm:^4.1.0": - version: 4.1.1 - resolution: "ini@npm:4.1.1" - checksum: 10c0/7fddc8dfd3e63567d4fdd5d999d1bf8a8487f1479d0b34a1d01f28d391a9228d261e19abc38e1a6a1ceb3400c727204fce05725d5eb598dfcf2077a1e3afe211 - languageName: node - linkType: hard - "inline-style-parser@npm:0.1.1": version: 0.1.1 resolution: "inline-style-parser@npm:0.1.1" @@ -19810,7 +19570,7 @@ __metadata: languageName: node linkType: hard -"magic-string@npm:0.30.8": +"magic-string@npm:0.30.8, magic-string@npm:^0.30.0, magic-string@npm:^0.30.4, magic-string@npm:^0.30.5": version: 0.30.8 resolution: "magic-string@npm:0.30.8" dependencies: @@ -19837,15 +19597,6 @@ __metadata: languageName: node linkType: hard -"magic-string@npm:^0.30.0, magic-string@npm:^0.30.4, magic-string@npm:^0.30.5": - version: 0.30.5 - resolution: "magic-string@npm:0.30.5" - dependencies: - "@jridgewell/sourcemap-codec": "npm:^1.4.15" - checksum: 10c0/38ac220ca7539e96da7ea2f38d85796bdf5c69b6bcae728c4bc2565084e6dc326b9174ee9770bea345cf6c9b3a24041b767167874fab5beca874d2356a9d1520 - languageName: node - linkType: hard - "magicast@npm:^0.3.3": version: 0.3.3 resolution: "magicast@npm:0.3.3" @@ -23216,7 +22967,7 @@ __metadata: languageName: node linkType: hard -"pirates@npm:^4.0.5": +"pirates@npm:^4.0.6": version: 4.0.6 resolution: "pirates@npm:4.0.6" checksum: 10c0/00d5fa51f8dded94d7429700fb91a0c1ead00ae2c7fd27089f0c5b63e6eca36197fe46384631872690a66f390c5e27198e99006ab77ae472692ab9c2ca903f36 @@ -23434,19 +23185,6 @@ __metadata: languageName: node linkType: hard -"postcss-modules-local-by-default@npm:^4.0.3": - version: 4.0.3 - resolution: "postcss-modules-local-by-default@npm:4.0.3" - dependencies: - icss-utils: "npm:^5.0.0" - postcss-selector-parser: "npm:^6.0.2" - postcss-value-parser: "npm:^4.1.0" - peerDependencies: - postcss: ^8.1.0 - checksum: 10c0/be49b86efbfb921f42287e227584aac91af9826fc1083db04958ae283dfe215ca539421bfba71f9da0f0b10651f28e95a64b5faca7166f578a1933b8646051f7 - languageName: node - linkType: hard - "postcss-modules-local-by-default@npm:^4.0.4": version: 4.0.4 resolution: "postcss-modules-local-by-default@npm:4.0.4" @@ -23470,17 +23208,6 @@ __metadata: languageName: node linkType: hard -"postcss-modules-scope@npm:^3.0.0": - version: 3.0.0 - resolution: "postcss-modules-scope@npm:3.0.0" - dependencies: - postcss-selector-parser: "npm:^6.0.4" - peerDependencies: - postcss: ^8.1.0 - checksum: 10c0/60af503910363689568c2c3701cb019a61b58b3d739391145185eec211bea5d50ccb6ecbe6955b39d856088072fd50ea002e40a52b50e33b181ff5c41da0308a - languageName: node - linkType: hard - "postcss-modules-scope@npm:^3.1.1": version: 3.1.1 resolution: "postcss-modules-scope@npm:3.1.1" @@ -23590,17 +23317,6 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.21": - version: 8.4.32 - resolution: "postcss@npm:8.4.32" - dependencies: - nanoid: "npm:^3.3.7" - picocolors: "npm:^1.0.0" - source-map-js: "npm:^1.0.2" - checksum: 10c0/39308a9195fa34d4dbdd7b58a896cff0c7809f84f7a4ac1b95b68ca86c9138a395addff33075668ed3983d41b90aac05754c445237a9365eb1c3a5602ebd03ad - languageName: node - linkType: hard - "preact@npm:^10.5.13": version: 10.19.3 resolution: "preact@npm:10.19.3" @@ -26030,7 +25746,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.6.0, semver@npm:^7.6.0": +"semver@npm:7.6.0, semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.2.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0": version: 7.6.0 resolution: "semver@npm:7.6.0" dependencies: @@ -26050,17 +25766,6 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.2.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4": - version: 7.5.4 - resolution: "semver@npm:7.5.4" - dependencies: - lru-cache: "npm:^6.0.0" - bin: - semver: bin/semver.js - checksum: 10c0/5160b06975a38b11c1ab55950cb5b8a23db78df88275d3d8a42ccf1f29e55112ac995b3a26a522c36e3b5f76b0445f1eef70d696b8c7862a2b4303d7b0e7609e - languageName: node - linkType: hard - "send@npm:0.18.0": version: 0.18.0 resolution: "send@npm:0.18.0" @@ -27586,29 +27291,7 @@ __metadata: languageName: node linkType: hard -"terser-webpack-plugin@npm:*, terser-webpack-plugin@npm:^5.3.1, terser-webpack-plugin@npm:^5.3.7": - version: 5.3.9 - resolution: "terser-webpack-plugin@npm:5.3.9" - dependencies: - "@jridgewell/trace-mapping": "npm:^0.3.17" - jest-worker: "npm:^27.4.5" - schema-utils: "npm:^3.1.1" - serialize-javascript: "npm:^6.0.1" - terser: "npm:^5.16.8" - peerDependencies: - webpack: ^5.1.0 - peerDependenciesMeta: - "@swc/core": - optional: true - esbuild: - optional: true - uglify-js: - optional: true - checksum: 10c0/8a757106101ea1504e5dc549c722506506e7d3f0d38e72d6c8108ad814c994ca0d67ac5d0825ba59704a4b2b04548201b2137f198bfce897b09fe9e36727a1e9 - languageName: node - linkType: hard - -"terser-webpack-plugin@npm:^5.3.10": +"terser-webpack-plugin@npm:*, terser-webpack-plugin@npm:^5.3.1, terser-webpack-plugin@npm:^5.3.10": version: 5.3.10 resolution: "terser-webpack-plugin@npm:5.3.10" dependencies: @@ -27630,7 +27313,7 @@ __metadata: languageName: node linkType: hard -"terser@npm:5.29.1, terser@npm:^5.26.0": +"terser@npm:5.29.1, terser@npm:^5.10.0, terser@npm:^5.26.0": version: 5.29.1 resolution: "terser@npm:5.29.1" dependencies: @@ -27644,20 +27327,6 @@ __metadata: languageName: node linkType: hard -"terser@npm:^5.10.0, terser@npm:^5.16.8": - version: 5.26.0 - resolution: "terser@npm:5.26.0" - dependencies: - "@jridgewell/source-map": "npm:^0.3.3" - acorn: "npm:^8.8.2" - commander: "npm:^2.20.0" - source-map-support: "npm:~0.5.20" - bin: - terser: bin/terser - checksum: 10c0/3906289c6bacd75804a47a583cdafefbd76c5edb39435369755c7b1592e57586fb2f4bddf6eb37a807d6e782171dbf0aa7bbdc80fd5b77b2f2b62196cac49b62 - languageName: node - linkType: hard - "test-exclude@npm:^6.0.0": version: 6.0.0 resolution: "test-exclude@npm:6.0.0" @@ -28285,23 +27954,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.0.3, typescript@npm:^5.3.2, typescript@npm:~5.3.2": - version: 5.3.3 - resolution: "typescript@npm:5.3.3" +"typescript@npm:^5.0.3, typescript@npm:^5.3.2, typescript@npm:^5.4.3": + version: 5.4.3 + resolution: "typescript@npm:5.4.3" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/e33cef99d82573624fc0f854a2980322714986bc35b9cb4d1ce736ed182aeab78e2cb32b385efa493b2a976ef52c53e20d6c6918312353a91850e2b76f1ea44f + checksum: 10c0/22443a8760c3668e256c0b34b6b45c359ef6cecc10c42558806177a7d500ab1a7d7aac1f976d712e26989ddf6731d2fbdd3212b7c73290a45127c1c43ba2005a languageName: node linkType: hard -"typescript@npm:^5.4.3": - version: 5.4.3 - resolution: "typescript@npm:5.4.3" +"typescript@npm:~5.3.2": + version: 5.3.3 + resolution: "typescript@npm:5.3.3" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/22443a8760c3668e256c0b34b6b45c359ef6cecc10c42558806177a7d500ab1a7d7aac1f976d712e26989ddf6731d2fbdd3212b7c73290a45127c1c43ba2005a + checksum: 10c0/e33cef99d82573624fc0f854a2980322714986bc35b9cb4d1ce736ed182aeab78e2cb32b385efa493b2a976ef52c53e20d6c6918312353a91850e2b76f1ea44f languageName: node linkType: hard @@ -28315,23 +27984,23 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.0.3#optional!builtin, typescript@patch:typescript@npm%3A^5.3.2#optional!builtin, typescript@patch:typescript@npm%3A~5.3.2#optional!builtin": - version: 5.3.3 - resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin::version=5.3.3&hash=e012d7" +"typescript@patch:typescript@npm%3A^5.0.3#optional!builtin, typescript@patch:typescript@npm%3A^5.3.2#optional!builtin, typescript@patch:typescript@npm%3A^5.4.3#optional!builtin": + version: 5.4.3 + resolution: "typescript@patch:typescript@npm%3A5.4.3#optional!builtin::version=5.4.3&hash=5adc0c" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/1d0a5f4ce496c42caa9a30e659c467c5686eae15d54b027ee7866744952547f1be1262f2d40de911618c242b510029d51d43ff605dba8fb740ec85ca2d3f9500 + checksum: 10c0/6e51f8b7e6ec55b897b9e56b67e864fe8f44e30f4a14357aad5dc0f7432db2f01efc0522df0b6c36d361c51f2dc3dcac5c832efd96a404cfabf884e915d38828 languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.4.3#optional!builtin": - version: 5.4.3 - resolution: "typescript@patch:typescript@npm%3A5.4.3#optional!builtin::version=5.4.3&hash=5adc0c" +"typescript@patch:typescript@npm%3A~5.3.2#optional!builtin": + version: 5.3.3 + resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin::version=5.3.3&hash=e012d7" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/6e51f8b7e6ec55b897b9e56b67e864fe8f44e30f4a14357aad5dc0f7432db2f01efc0522df0b6c36d361c51f2dc3dcac5c832efd96a404cfabf884e915d38828 + checksum: 10c0/1d0a5f4ce496c42caa9a30e659c467c5686eae15d54b027ee7866744952547f1be1262f2d40de911618c242b510029d51d43ff605dba8fb740ec85ca2d3f9500 languageName: node linkType: hard @@ -29217,7 +28886,7 @@ __metadata: languageName: node linkType: hard -"vite@npm:5.1.5": +"vite@npm:5.1.5, vite@npm:^5.0.0": version: 5.1.5 resolution: "vite@npm:5.1.5" dependencies: @@ -29297,46 +28966,6 @@ __metadata: languageName: node linkType: hard -"vite@npm:^5.0.0": - version: 5.0.10 - resolution: "vite@npm:5.0.10" - dependencies: - esbuild: "npm:^0.19.3" - fsevents: "npm:~2.3.3" - postcss: "npm:^8.4.32" - rollup: "npm:^4.2.0" - peerDependencies: - "@types/node": ^18.0.0 || >=20.0.0 - less: "*" - lightningcss: ^1.21.0 - sass: "*" - stylus: "*" - sugarss: "*" - terser: ^5.4.0 - dependenciesMeta: - fsevents: - optional: true - peerDependenciesMeta: - "@types/node": - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - bin: - vite: bin/vite.js - checksum: 10c0/d666b2760d2a7ea1d0d35f67c042053e562144f80554be4e4dc58e607fd5f62193cd203d73ab2e315df66830d8b9d9a2e3509d0208bdef1b2e92e0a5c364df84 - languageName: node - linkType: hard - "vitefu@npm:^0.2.5": version: 0.2.5 resolution: "vitefu@npm:0.2.5" @@ -29908,44 +29537,7 @@ __metadata: languageName: node linkType: hard -"webpack@npm:5, webpack@npm:^5, webpack@npm:^5.65.0": - version: 5.89.0 - resolution: "webpack@npm:5.89.0" - dependencies: - "@types/eslint-scope": "npm:^3.7.3" - "@types/estree": "npm:^1.0.0" - "@webassemblyjs/ast": "npm:^1.11.5" - "@webassemblyjs/wasm-edit": "npm:^1.11.5" - "@webassemblyjs/wasm-parser": "npm:^1.11.5" - acorn: "npm:^8.7.1" - acorn-import-assertions: "npm:^1.9.0" - browserslist: "npm:^4.14.5" - chrome-trace-event: "npm:^1.0.2" - enhanced-resolve: "npm:^5.15.0" - es-module-lexer: "npm:^1.2.1" - eslint-scope: "npm:5.1.1" - events: "npm:^3.2.0" - glob-to-regexp: "npm:^0.4.1" - graceful-fs: "npm:^4.2.9" - json-parse-even-better-errors: "npm:^2.3.1" - loader-runner: "npm:^4.2.0" - mime-types: "npm:^2.1.27" - neo-async: "npm:^2.6.2" - schema-utils: "npm:^3.2.0" - tapable: "npm:^2.1.1" - terser-webpack-plugin: "npm:^5.3.7" - watchpack: "npm:^2.4.0" - webpack-sources: "npm:^3.2.3" - peerDependenciesMeta: - webpack-cli: - optional: true - bin: - webpack: bin/webpack.js - checksum: 10c0/2562bf48788d651634fb7db6a5378c2fe3fce7f66831af38468da3944bd98756d68efea94a6909593993fb57b2d14cf802cbef2c83c6ef0047f7f606d59bec50 - languageName: node - linkType: hard - -"webpack@npm:5.90.3": +"webpack@npm:5, webpack@npm:5.90.3, webpack@npm:^5, webpack@npm:^5.65.0": version: 5.90.3 resolution: "webpack@npm:5.90.3" dependencies: @@ -30288,22 +29880,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.13.0, ws@npm:^8.14.2, ws@npm:^8.2.3": - version: 8.15.1 - resolution: "ws@npm:8.15.1" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ">=5.0.2" - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 10c0/9964360dd5ab35c7376bd7c4295a3c8bd44ea0838c9413742548a6fb3ec371fc6c18552d5b8e76bdc21536db1909765612815bae072674b5ec69971605395a96 - languageName: node - linkType: hard - -"ws@npm:^8.16.0": +"ws@npm:^8.13.0, ws@npm:^8.14.2, ws@npm:^8.16.0, ws@npm:^8.2.3": version: 8.16.0 resolution: "ws@npm:8.16.0" peerDependencies: From 1a4bd14c8500b5aabca419920ef9ebb57e25ed3a Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 17:32:40 +0800 Subject: [PATCH 25/30] Update csf-tools babel deps --- code/lib/csf-tools/package.json | 8 ++++---- code/yarn.lock | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index e640c8f69f72..aa898d54fc4a 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -42,10 +42,10 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@babel/generator": "^7.23.0", - "@babel/parser": "^7.23.0", - "@babel/traverse": "^7.23.2", - "@babel/types": "^7.23.0", + "@babel/generator": "^7.24.5", + "@babel/parser": "^7.24.5", + "@babel/traverse": "^7.24.5", + "@babel/types": "^7.24.5", "@storybook/csf": "^0.1.7", "@storybook/types": "workspace:*", "fs-extra": "^11.1.0", diff --git a/code/yarn.lock b/code/yarn.lock index 301f30f4b09a..e8117c89983c 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -470,7 +470,7 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.23.0, @babel/generator@npm:^7.24.5": +"@babel/generator@npm:^7.24.5": version: 7.24.5 resolution: "@babel/generator@npm:7.24.5" dependencies: @@ -2279,7 +2279,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.23.2": +"@babel/traverse@npm:^7.24.5": version: 7.24.5 resolution: "@babel/traverse@npm:7.24.5" dependencies: @@ -6108,10 +6108,10 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/csf-tools@workspace:lib/csf-tools" dependencies: - "@babel/generator": "npm:^7.23.0" - "@babel/parser": "npm:^7.23.0" - "@babel/traverse": "npm:^7.23.2" - "@babel/types": "npm:^7.23.0" + "@babel/generator": "npm:^7.24.5" + "@babel/parser": "npm:^7.24.5" + "@babel/traverse": "npm:^7.24.5" + "@babel/types": "npm:^7.24.5" "@storybook/csf": "npm:^0.1.7" "@storybook/types": "workspace:*" "@types/fs-extra": "npm:^11.0.1" From 8b35e06f3b0fc850f45b517c33bced6f3e0df9d6 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 17:47:38 +0800 Subject: [PATCH 26/30] Another attempt to fix yarn.lock --- code/lib/csf-tools/package.json | 8 ++-- code/yarn.lock | 76 +++------------------------------ 2 files changed, 9 insertions(+), 75 deletions(-) diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index aa898d54fc4a..0526a70658c3 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -42,10 +42,10 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@babel/generator": "^7.24.5", - "@babel/parser": "^7.24.5", - "@babel/traverse": "^7.24.5", - "@babel/types": "^7.24.5", + "@babel/generator": "^7.24.4", + "@babel/parser": "^7.24.4", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0", "@storybook/csf": "^0.1.7", "@storybook/types": "workspace:*", "fs-extra": "^11.1.0", diff --git a/code/yarn.lock b/code/yarn.lock index e8117c89983c..5ac9e46eac23 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -470,18 +470,6 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.24.5": - version: 7.24.5 - resolution: "@babel/generator@npm:7.24.5" - dependencies: - "@babel/types": "npm:^7.24.5" - "@jridgewell/gen-mapping": "npm:^0.3.5" - "@jridgewell/trace-mapping": "npm:^0.3.25" - jsesc: "npm:^2.5.1" - checksum: 10c0/0d64f880150e7dfb92ceff2b4ac865f36aa1e295120920246492ffd0146562dabf79ba8699af1c8833f8a7954818d4d146b7b02f808df4d6024fb99f98b2f78d - languageName: node - linkType: hard - "@babel/helper-annotate-as-pure@npm:7.22.5, @babel/helper-annotate-as-pure@npm:^7.18.6, @babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -703,16 +691,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-split-export-declaration@npm:^7.24.5": - version: 7.24.5 - resolution: "@babel/helper-split-export-declaration@npm:7.24.5" - dependencies: - "@babel/types": "npm:^7.24.5" - checksum: 10c0/d7a812d67d031a348f3fb0e6263ce2dbe6038f81536ba7fb16db385383bcd6542b71833194303bf6d3d0e4f7b6b584c9c8fae8772122e2ce68fc9bdf07f4135d - languageName: node - linkType: hard - -"@babel/helper-string-parser@npm:^7.23.4, @babel/helper-string-parser@npm:^7.24.1": +"@babel/helper-string-parser@npm:^7.23.4": version: 7.24.1 resolution: "@babel/helper-string-parser@npm:7.24.1" checksum: 10c0/2f9bfcf8d2f9f083785df0501dbab92770111ece2f90d120352fda6dd2a7d47db11b807d111e6f32aa1ba6d763fe2dc6603d153068d672a5d0ad33ca802632b2 @@ -726,13 +705,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.5": - version: 7.24.5 - resolution: "@babel/helper-validator-identifier@npm:7.24.5" - checksum: 10c0/05f957229d89ce95a137d04e27f7d0680d84ae48b6ad830e399db0779341f7d30290f863a93351b4b3bde2166737f73a286ea42856bb07c8ddaa95600d38645c - languageName: node - linkType: hard - "@babel/helper-validator-option@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-validator-option@npm:7.23.5" @@ -783,15 +755,6 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.24.5": - version: 7.24.5 - resolution: "@babel/parser@npm:7.24.5" - bin: - parser: ./bin/babel-parser.js - checksum: 10c0/8333a6ad5328bad34fa0e12bcee147c3345ea9a438c0909e7c68c6cfbea43c464834ffd7eabd1cbc1c62df0a558e22ffade9f5b29440833ba7b33d96a71f88c0 - languageName: node - linkType: hard - "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.24.4": version: 7.24.4 resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.24.4" @@ -2279,24 +2242,6 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.24.5": - version: 7.24.5 - resolution: "@babel/traverse@npm:7.24.5" - dependencies: - "@babel/code-frame": "npm:^7.24.2" - "@babel/generator": "npm:^7.24.5" - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-hoist-variables": "npm:^7.22.5" - "@babel/helper-split-export-declaration": "npm:^7.24.5" - "@babel/parser": "npm:^7.24.5" - "@babel/types": "npm:^7.24.5" - debug: "npm:^4.3.1" - globals: "npm:^11.1.0" - checksum: 10c0/3f22534bc2b2ed9208e55ef48af3b32939032b23cb9dc4037447cb108640df70bbb0b9fea86e9c58648949fdc2cb14e89aa79ffa3c62a5dd43459a52fe8c01d1 - languageName: node - linkType: hard - "@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.4, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.23.9, @babel/types@npm:^7.24.0, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6": version: 7.24.0 resolution: "@babel/types@npm:7.24.0" @@ -2308,17 +2253,6 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.24.5": - version: 7.24.5 - resolution: "@babel/types@npm:7.24.5" - dependencies: - "@babel/helper-string-parser": "npm:^7.24.1" - "@babel/helper-validator-identifier": "npm:^7.24.5" - to-fast-properties: "npm:^2.0.0" - checksum: 10c0/e1284eb046c5e0451b80220d1200e2327e0a8544a2fe45bb62c952e5fdef7099c603d2336b17b6eac3cc046b7a69bfbce67fe56e1c0ea48cd37c65cb88638f2a - languageName: node - linkType: hard - "@base2/pretty-print-object@npm:1.0.1": version: 1.0.1 resolution: "@base2/pretty-print-object@npm:1.0.1" @@ -6108,10 +6042,10 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/csf-tools@workspace:lib/csf-tools" dependencies: - "@babel/generator": "npm:^7.24.5" - "@babel/parser": "npm:^7.24.5" - "@babel/traverse": "npm:^7.24.5" - "@babel/types": "npm:^7.24.5" + "@babel/generator": "npm:^7.24.4" + "@babel/parser": "npm:^7.24.4" + "@babel/traverse": "npm:^7.24.1" + "@babel/types": "npm:^7.24.0" "@storybook/csf": "npm:^0.1.7" "@storybook/types": "workspace:*" "@types/fs-extra": "npm:^11.0.1" From 15d7ef9149d1d472479d2aeffa5b2e1e036565e1 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 18:33:55 +0800 Subject: [PATCH 27/30] Continue to show autodocs even when primary story is !dev --- code/lib/core-server/src/presets/common-manager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/lib/core-server/src/presets/common-manager.ts b/code/lib/core-server/src/presets/common-manager.ts index c3dfbd8d6fb8..bbc5432eeb31 100644 --- a/code/lib/core-server/src/presets/common-manager.ts +++ b/code/lib/core-server/src/presets/common-manager.ts @@ -19,6 +19,10 @@ addons.register(STATIC_FILTER, (api) => { api.experimental_setFilter(STATIC_FILTER, (item) => { const tags = item.tags ?? []; - return tags.includes('dev') && tags.filter((tag) => excludeTags[tag]).length === 0; + return ( + // we can filter out the primary story, but we still want to show autodocs + (tags.includes('dev') || item.type === 'docs') && + tags.filter((tag) => excludeTags[tag]).length === 0 + ); }); }); From 83639e0f72a20c10015817f3ac2e77c1ab5102ea Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 20:28:32 +0800 Subject: [PATCH 28/30] Add e2e tests for new tags behavior --- code/e2e-tests/tags.spec.ts | 92 +++++++++++++------ .../template/stories/tags-add.stories.ts | 39 ++++++++ ...tags.stories.ts => tags-config.stories.ts} | 2 +- .../template/stories/tags-remove.stories.ts | 39 ++++++++ .../template/stories/test-only-tag.stories.ts | 11 --- 5 files changed, 145 insertions(+), 38 deletions(-) create mode 100644 code/lib/preview-api/template/stories/tags-add.stories.ts rename code/lib/preview-api/template/stories/{tags.stories.ts => tags-config.stories.ts} (95%) create mode 100644 code/lib/preview-api/template/stories/tags-remove.stories.ts delete mode 100644 code/lib/preview-api/template/stories/test-only-tag.stories.ts diff --git a/code/e2e-tests/tags.spec.ts b/code/e2e-tests/tags.spec.ts index 8302a9a6a338..078c0fd360ff 100644 --- a/code/e2e-tests/tags.spec.ts +++ b/code/e2e-tests/tags.spec.ts @@ -9,56 +9,96 @@ test.describe('tags', () => { await new SbPage(page).waitUntilLoaded(); }); - test('@flaky: should correctly filter dev-only, docs-only, test-only stories', async ({ - page, - }) => { + test('should correctly filter dev-only, docs-only, test-only stories', async ({ page }) => { const sbPage = new SbPage(page); - await sbPage.navigateToStory('lib/preview-api/tags', 'docs'); + await sbPage.navigateToStory('lib/preview-api/tags-config', 'docs'); // Sidebar should include dev-only and exclude docs-only and test-only - const devOnlyEntry = await page.locator('#lib-preview-api-tags--dev-only').all(); + const devOnlyEntry = await page.locator('#lib-preview-api-tags-config--dev-only').all(); expect(devOnlyEntry.length).toBe(1); - const docsOnlyEntry = await page.locator('#lib-preview-api-tags--docs-only').all(); + const docsOnlyEntry = await page.locator('#lib-preview-api-tags-config--docs-only').all(); expect(docsOnlyEntry.length).toBe(0); - const testOnlyEntry = await page.locator('#lib-preview-api-tags--test-only').all(); + const testOnlyEntry = await page.locator('#lib-preview-api-tags-config--test-only').all(); expect(testOnlyEntry.length).toBe(0); // Autodocs should include docs-only and exclude dev-only and test-only const root = sbPage.previewRoot(); - const devOnlyAnchor = await root.locator('#anchor--lib-preview-api-tags--dev-only').all(); + const devOnlyAnchor = await root + .locator('#anchor--lib-preview-api-tags-config--dev-only') + .all(); expect(devOnlyAnchor.length).toBe(0); - const docsOnlyAnchor = await root.locator('#anchor--lib-preview-api-tags--docs-only').all(); + const docsOnlyAnchor = await root + .locator('#anchor--lib-preview-api-tags-config--docs-only') + .all(); expect(docsOnlyAnchor.length).toBe(1); - const testOnlyAnchor = await root.locator('#anchor--lib-preview-api-tags--test-only').all(); + const testOnlyAnchor = await root + .locator('#anchor--lib-preview-api-tags-config--test-only') + .all(); expect(testOnlyAnchor.length).toBe(0); }); - test('should correctly filter out test-only autodocs pages', async ({ page }) => { + test('should correctly add dev, autodocs, test stories', async ({ page }) => { const sbPage = new SbPage(page); - await sbPage.selectToolbar('#lib-preview-api'); + await sbPage.navigateToStory('lib/preview-api/tags-add', 'docs'); - // Sidebar should exclude test-only stories and their docs - const componentEntry = await page.locator('#lib-preview-api-test-only-tag').all(); - expect(componentEntry.length).toBe(0); + // Sidebar should include dev and exclude inheritance, autodocs, test + const devEntry = await page.locator('#lib-preview-api-tags-add--dev').all(); + expect(devEntry.length).toBe(1); - // Even though test-only autodocs not sidebar, it is still in the preview - // Even though the test-only story is filtered out of the stories, it is still the primary story (should it be?) - await sbPage.deepLinkToStory(storybookUrl, 'lib/preview-api/test-only-tag', 'docs'); - await sbPage.waitUntilLoaded(); - const docsButton = await sbPage.previewRoot().locator('button', { hasText: 'Button' }); - await expect(docsButton).toBeVisible(); + const autodocsEntry = await page.locator('#lib-preview-api-tags-add--autodocs').all(); + expect(autodocsEntry.length).toBe(0); - // Even though test-only story not sidebar, it is still in the preview - await sbPage.deepLinkToStory(storybookUrl, 'lib/preview-api/test-only-tag', 'default'); - await sbPage.waitUntilLoaded(); - const storyButton = await sbPage.previewRoot().locator('button', { hasText: 'Button' }); - await expect(storyButton).toBeVisible(); + const testOnlyEntry = await page.locator('#lib-preview-api-tags-add--test').all(); + expect(testOnlyEntry.length).toBe(0); + + // Autodocs should include autodocs and exclude dev, test + const root = sbPage.previewRoot(); + + const devAnchor = await root.locator('#anchor--lib-preview-api-tags-add--dev').all(); + expect(devAnchor.length).toBe(0); + + // NOTE: shows as primary story and also in stories + const autodocsAnchor = await root.locator('#anchor--lib-preview-api-tags-add--autodocs').all(); + expect(autodocsAnchor.length).toBe(2); + + const testAnchor = await root.locator('#anchor--lib-preview-api-tags-add--test').all(); + expect(testAnchor.length).toBe(0); + }); + + test('should correctly remove dev, autodocs, test stories', async ({ page }) => { + const sbPage = new SbPage(page); + + await sbPage.navigateToStory('lib/preview-api/tags-remove', 'docs'); + + // Sidebar should include inheritance, no-autodocs, no-test. and exclude no-dev + const noDevEntry = await page.locator('#lib-preview-api-tags-remove--no-dev').all(); + expect(noDevEntry.length).toBe(0); + + const noAutodocsEntry = await page.locator('#lib-preview-api-tags-remove--no-autodocs').all(); + expect(noAutodocsEntry.length).toBe(1); + + const noTestEntry = await page.locator('#lib-preview-api-tags-remove--no-test').all(); + expect(noTestEntry.length).toBe(1); + + // Autodocs should include inheritance, no-dev, no-test. and exclude no-autodocs + const root = sbPage.previewRoot(); + + const noDevAnchor = await root.locator('#anchor--lib-preview-api-tags-remove--no-dev').all(); + expect(noDevAnchor.length).toBe(1); + + const noAutodocsAnchor = await root + .locator('#anchor--lib-preview-api-tags-remove--no-autodocs') + .all(); + expect(noAutodocsAnchor.length).toBe(0); + + const noTestAnchor = await root.locator('#anchor--lib-preview-api-tags-remove--no-test').all(); + expect(noTestAnchor.length).toBe(1); }); }); diff --git a/code/lib/preview-api/template/stories/tags-add.stories.ts b/code/lib/preview-api/template/stories/tags-add.stories.ts new file mode 100644 index 000000000000..6302085e5c19 --- /dev/null +++ b/code/lib/preview-api/template/stories/tags-add.stories.ts @@ -0,0 +1,39 @@ +import { global as globalThis } from '@storybook/global'; +import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types'; +import { within, expect } from '@storybook/test'; + +export default { + component: globalThis.Components.Pre, + tags: ['!dev', '!autodocs', '!test'], + decorators: [ + (storyFn: PartialStoryFn, context: StoryContext) => { + return storyFn({ + args: { object: { tags: context.tags } }, + }); + }, + ], + parameters: { chromatic: { disable: true } }, +}; + +export const Inheritance = { + tags: ['story-one'], + play: async ({ canvasElement }: PlayFunctionContext) => { + const canvas = within(canvasElement); + await expect(JSON.parse(canvas.getByTestId('pre').innerText)).toEqual({ + tags: ['story-one'], + }); + }, + parameters: { chromatic: { disable: false } }, +}; + +export const Dev = { + tags: ['dev'], +}; + +export const Autodocs = { + tags: ['autodocs'], +}; + +export const Test = { + tags: ['test'], +}; diff --git a/code/lib/preview-api/template/stories/tags.stories.ts b/code/lib/preview-api/template/stories/tags-config.stories.ts similarity index 95% rename from code/lib/preview-api/template/stories/tags.stories.ts rename to code/lib/preview-api/template/stories/tags-config.stories.ts index 64e715b1e0f7..a73a08954784 100644 --- a/code/lib/preview-api/template/stories/tags.stories.ts +++ b/code/lib/preview-api/template/stories/tags-config.stories.ts @@ -4,7 +4,7 @@ import { within, expect } from '@storybook/test'; export default { component: globalThis.Components.Pre, - tags: ['component-one', 'component-two', '!autodocs'], + tags: ['component-one', 'component-two', 'autodocs'], decorators: [ (storyFn: PartialStoryFn, context: StoryContext) => { return storyFn({ diff --git a/code/lib/preview-api/template/stories/tags-remove.stories.ts b/code/lib/preview-api/template/stories/tags-remove.stories.ts new file mode 100644 index 000000000000..3d05b98d2dbf --- /dev/null +++ b/code/lib/preview-api/template/stories/tags-remove.stories.ts @@ -0,0 +1,39 @@ +import { global as globalThis } from '@storybook/global'; +import type { PartialStoryFn, PlayFunctionContext, StoryContext } from '@storybook/types'; +import { within, expect } from '@storybook/test'; + +export default { + component: globalThis.Components.Pre, + tags: ['component-one', 'autodocs'], + decorators: [ + (storyFn: PartialStoryFn, context: StoryContext) => { + return storyFn({ + args: { object: { tags: context.tags } }, + }); + }, + ], + parameters: { chromatic: { disable: true } }, +}; + +export const Inheritance = { + tags: ['story-one'], + play: async ({ canvasElement }: PlayFunctionContext) => { + const canvas = within(canvasElement); + await expect(JSON.parse(canvas.getByTestId('pre').innerText)).toEqual({ + tags: ['dev', 'test', 'component-one', 'story-one', 'autodocs'], + }); + }, + parameters: { chromatic: { disable: false } }, +}; + +export const NoDev = { + tags: ['!dev'], +}; + +export const NoAutodocs = { + tags: ['!autodocs'], +}; + +export const NoTest = { + tags: ['!test'], +}; diff --git a/code/lib/preview-api/template/stories/test-only-tag.stories.ts b/code/lib/preview-api/template/stories/test-only-tag.stories.ts deleted file mode 100644 index 138f221d3ff7..000000000000 --- a/code/lib/preview-api/template/stories/test-only-tag.stories.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { global as globalThis } from '@storybook/global'; - -export default { - component: globalThis.Components.Button, - tags: ['autodocs', 'test-only'], - parameters: { chromatic: { disable: true } }, -}; - -export const Default = { - args: { label: 'Button' }, -}; From aad8a11dfbdced32e02a0ac3625997294088e9b5 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 20:56:52 +0800 Subject: [PATCH 29/30] Fix CI? --- code/e2e-tests/tags.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/e2e-tests/tags.spec.ts b/code/e2e-tests/tags.spec.ts index 078c0fd360ff..da3637deb7e9 100644 --- a/code/e2e-tests/tags.spec.ts +++ b/code/e2e-tests/tags.spec.ts @@ -64,9 +64,9 @@ test.describe('tags', () => { const devAnchor = await root.locator('#anchor--lib-preview-api-tags-add--dev').all(); expect(devAnchor.length).toBe(0); - // NOTE: shows as primary story and also in stories + // FIXME: shows as primary story and also in stories, inconsistent btw dev/CI? const autodocsAnchor = await root.locator('#anchor--lib-preview-api-tags-add--autodocs').all(); - expect(autodocsAnchor.length).toBe(2); + expect(autodocsAnchor.length).not.toBe(0); const testAnchor = await root.locator('#anchor--lib-preview-api-tags-add--test').all(); expect(testAnchor.length).toBe(0); From 14f86ecbe076b4f4db138362219c06329eb4aff8 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 7 May 2024 22:17:23 +0800 Subject: [PATCH 30/30] Fix tags stories --- code/lib/preview-api/template/stories/tags-config.stories.ts | 4 ++-- code/lib/preview-api/template/stories/tags-remove.stories.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/lib/preview-api/template/stories/tags-config.stories.ts b/code/lib/preview-api/template/stories/tags-config.stories.ts index a73a08954784..e36784304d39 100644 --- a/code/lib/preview-api/template/stories/tags-config.stories.ts +++ b/code/lib/preview-api/template/stories/tags-config.stories.ts @@ -16,11 +16,11 @@ export default { }; export const Inheritance = { - tags: ['story-one', 'story-two'], + tags: ['story-one'], play: async ({ canvasElement }: PlayFunctionContext) => { const canvas = within(canvasElement); await expect(JSON.parse(canvas.getByTestId('pre').innerText)).toEqual({ - tags: ['dev', 'test', 'component-one', 'component-two', 'story-one', 'story-two'], + tags: ['dev', 'test', 'component-one', 'component-two', 'autodocs', 'story-one'], }); }, parameters: { chromatic: { disable: false } }, diff --git a/code/lib/preview-api/template/stories/tags-remove.stories.ts b/code/lib/preview-api/template/stories/tags-remove.stories.ts index 3d05b98d2dbf..852d4f63585d 100644 --- a/code/lib/preview-api/template/stories/tags-remove.stories.ts +++ b/code/lib/preview-api/template/stories/tags-remove.stories.ts @@ -20,7 +20,7 @@ export const Inheritance = { play: async ({ canvasElement }: PlayFunctionContext) => { const canvas = within(canvasElement); await expect(JSON.parse(canvas.getByTestId('pre').innerText)).toEqual({ - tags: ['dev', 'test', 'component-one', 'story-one', 'autodocs'], + tags: ['dev', 'test', 'component-one', 'autodocs', 'story-one'], }); }, parameters: { chromatic: { disable: false } },