diff --git a/code/lib/core-common/src/utils/__tests__/normalize-stories.test.ts b/code/lib/core-common/src/utils/__tests__/normalize-stories.test.ts index 8bf64a548ed5..9cefd9052bf4 100644 --- a/code/lib/core-common/src/utils/__tests__/normalize-stories.test.ts +++ b/code/lib/core-common/src/utils/__tests__/normalize-stories.test.ts @@ -42,172 +42,172 @@ const options = { describe('normalizeStoriesEntry', () => { it('direct file path', () => { - const specifier = normalizeStoriesEntry('../path/to/file.stories.mdx', options); + const specifier = normalizeStoriesEntry('../path/to/file.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": "./path/to", - "files": "file.stories.mdx", + "files": "file.stories.jsx", "importPathMatcher": {} } `); - expect(specifier.importPathMatcher).toMatchPaths(['./path/to/file.stories.mdx']); + expect(specifier.importPathMatcher).toMatchPaths(['./path/to/file.stories.jsx']); expect(specifier.importPathMatcher).not.toMatchPaths([ './path/to/file.stories.js', - './file.stories.mdx', - '../file.stories.mdx', + './file.stories.jsx', + '../file.stories.jsx', ]); }); it('story in config dir', () => { - const specifier = normalizeStoriesEntry('./file.stories.mdx', options); + const specifier = normalizeStoriesEntry('./file.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": "./.storybook", - "files": "file.stories.mdx", + "files": "file.stories.jsx", "importPathMatcher": {} } `); - expect(specifier.importPathMatcher).toMatchPaths(['./.storybook/file.stories.mdx']); + expect(specifier.importPathMatcher).toMatchPaths(['./.storybook/file.stories.jsx']); expect(specifier.importPathMatcher).not.toMatchPaths([ - '.storybook/file.stories.mdx', - './file.stories.mdx', - '../file.stories.mdx', + '.storybook/file.stories.jsx', + './file.stories.jsx', + '../file.stories.jsx', ]); }); it('non-recursive files glob', () => { - const specifier = normalizeStoriesEntry('../*/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../*/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": ".", - "files": "*/*.stories.mdx", + "files": "*/*.stories.jsx", "importPathMatcher": {} } `); expect(specifier.importPathMatcher).toMatchPaths([ - './path/file.stories.mdx', - './second-path/file.stories.mdx', + './path/file.stories.jsx', + './second-path/file.stories.jsx', ]); expect(specifier.importPathMatcher).not.toMatchPaths([ './path/file.stories.js', - './path/to/file.stories.mdx', - './file.stories.mdx', - '../file.stories.mdx', + './path/to/file.stories.jsx', + './file.stories.jsx', + '../file.stories.jsx', ]); }); it('double non-recursive directory/files glob', () => { - const specifier = normalizeStoriesEntry('../*/*/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../*/*/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": ".", - "files": "*/*/*.stories.mdx", + "files": "*/*/*.stories.jsx", "importPathMatcher": {} } `); expect(specifier.importPathMatcher).toMatchPaths([ - './path/to/file.stories.mdx', - './second-path/to/file.stories.mdx', + './path/to/file.stories.jsx', + './second-path/to/file.stories.jsx', ]); expect(specifier.importPathMatcher).not.toMatchPaths([ - './file.stories.mdx', - './path/file.stories.mdx', - './path/to/third/file.stories.mdx', + './file.stories.jsx', + './path/file.stories.jsx', + './path/to/third/file.stories.jsx', './path/to/file.stories.js', - '../file.stories.mdx', + '../file.stories.jsx', ]); }); it('directory/files glob', () => { - const specifier = normalizeStoriesEntry('../**/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../**/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": ".", - "files": "**/*.stories.mdx", + "files": "**/*.stories.jsx", "importPathMatcher": {} } `); expect(specifier.importPathMatcher).toMatchPaths([ - './file.stories.mdx', - './path/file.stories.mdx', - './path/to/file.stories.mdx', - './path/to/third/file.stories.mdx', + './file.stories.jsx', + './path/file.stories.jsx', + './path/to/file.stories.jsx', + './path/to/third/file.stories.jsx', ]); expect(specifier.importPathMatcher).not.toMatchPaths([ './file.stories.js', - '../file.stories.mdx', + '../file.stories.jsx', ]); }); it('double stars glob', () => { - const specifier = normalizeStoriesEntry('../**/foo/**/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../**/foo/**/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": ".", - "files": "**/foo/**/*.stories.mdx", + "files": "**/foo/**/*.stories.jsx", "importPathMatcher": {} } `); expect(specifier.importPathMatcher).toMatchPaths([ - './foo/file.stories.mdx', - './path/to/foo/file.stories.mdx', - './path/to/foo/third/fourth/file.stories.mdx', + './foo/file.stories.jsx', + './path/to/foo/file.stories.jsx', + './path/to/foo/third/fourth/file.stories.jsx', ]); expect(specifier.importPathMatcher).not.toMatchPaths([ - './file.stories.mdx', + './file.stories.jsx', './file.stories.js', - '../file.stories.mdx', + '../file.stories.jsx', ]); }); it('intermediate directory glob', () => { - const specifier = normalizeStoriesEntry('../**/foo/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../**/foo/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": ".", - "files": "**/foo/*.stories.mdx", + "files": "**/foo/*.stories.jsx", "importPathMatcher": {} } `); expect(specifier.importPathMatcher).toMatchPaths([ - './path/to/foo/file.stories.mdx', - './foo/file.stories.mdx', + './path/to/foo/file.stories.jsx', + './foo/file.stories.jsx', ]); expect(specifier.importPathMatcher).not.toMatchPaths([ - './file.stories.mdx', + './file.stories.jsx', './file.stories.js', - './path/to/foo/third/fourth/file.stories.mdx', - '../file.stories.mdx', + './path/to/foo/third/fourth/file.stories.jsx', + '../file.stories.jsx', ]); }); it('directory outside of working dir', () => { - const specifier = normalizeStoriesEntry('../../src/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../../src/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": "../src", - "files": "*.stories.mdx", + "files": "*.stories.jsx", "importPathMatcher": {} } `); - expect(specifier.importPathMatcher).toMatchPaths(['../src/file.stories.mdx']); + expect(specifier.importPathMatcher).toMatchPaths(['../src/file.stories.jsx']); expect(specifier.importPathMatcher).not.toMatchPaths([ - './src/file.stories.mdx', + './src/file.stories.jsx', '../src/file.stories.js', ]); }); @@ -237,11 +237,11 @@ describe('normalizeStoriesEntry', () => { }); it('directory/files specifier', () => { - const specifier = normalizeStoriesEntry({ directory: '..', files: '*.stories.mdx' }, options); + const specifier = normalizeStoriesEntry({ directory: '..', files: '*.stories.jsx' }, options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", - "files": "*.stories.mdx", + "files": "*.stories.jsx", "directory": ".", "importPathMatcher": {} } @@ -262,13 +262,13 @@ describe('normalizeStoriesEntry', () => { it('directory/titlePrefix/files specifier', () => { const specifier = normalizeStoriesEntry( - { directory: '..', titlePrefix: 'atoms', files: '*.stories.mdx' }, + { directory: '..', titlePrefix: 'atoms', files: '*.stories.jsx' }, options ); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "atoms", - "files": "*.stories.mdx", + "files": "*.stories.jsx", "directory": ".", "importPathMatcher": {} } @@ -276,25 +276,25 @@ describe('normalizeStoriesEntry', () => { }); it('globs with negation', () => { - const specifier = normalizeStoriesEntry('../!(negation)/*.stories.mdx', options); + const specifier = normalizeStoriesEntry('../!(negation)/*.stories.jsx', options); expect(specifier).toMatchInlineSnapshot(` { "titlePrefix": "", "directory": ".", - "files": "!(negation)/*.stories.mdx", + "files": "!(negation)/*.stories.jsx", "importPathMatcher": {} } `); expect(specifier.importPathMatcher).toMatchPaths([ - './path/file.stories.mdx', - './second-path/file.stories.mdx', + './path/file.stories.jsx', + './second-path/file.stories.jsx', ]); expect(specifier.importPathMatcher).not.toMatchPaths([ './path/file.stories.js', - './path/to/file.stories.mdx', - './file.stories.mdx', - '../file.stories.mdx', + './path/to/file.stories.jsx', + './file.stories.jsx', + '../file.stories.jsx', ]); }); }); diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index fd1eb40c9496..487447d18f4f 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -54,9 +54,8 @@ 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 UNATTACHED_MDX_TAG = 'unattached-mdx'; export const PLAY_FN_TAG = 'play-fn'; /** Was this docs entry generated by a .mdx file? (see discussion below) */ @@ -84,12 +83,11 @@ const makeAbsolute = (otherImport: Path, normalizedPath: Path, workingDir: Path) * * A stories file is indexed by an indexer (passed in), which produces a list of stories. * - If the stories have the `parameters.docsOnly` setting, they are disregarded. - * - If the stories have the 'stories-mdx' tag (i.e. were generated by a .stories.mdx file), - * OR autodocs is enabled, a docs entry is added pointing to the story file. + * - If the stories have autodocs enabled, a docs entry is added pointing to the story file. * * A (modern) docs (.mdx) file is indexed, a docs entry is added. * - * In the preview, a docs entry with either the `autodocs` or `stories-mdx` tags will be rendered + * In the preview, a docs entry with the `autodocs` tag will be rendered * as a CSF file that exports an MDX template on the `docs.page` parameter, whereas * other docs entries are rendered as MDX files directly. * @@ -366,11 +364,10 @@ export class StoryIndexGenerator { }); // We need a docs entry attached to the CSF file if either: - // a) we have autodocs enabled for this file - // b) it is a stories.mdx transpiled to CSF + // a) autodocs is globally enabled + // b) we have autodocs enabled for this file const hasAutodocsTag = entries.some((entry) => entry.tags.includes(AUTODOCS_TAG)); - const isStoriesMdx = entries.some((entry) => entry.tags.includes(STORIES_MDX_TAG)); - const createDocEntry = (hasAutodocsTag && this.options.docs.autodocs !== false) || isStoriesMdx; + const createDocEntry = hasAutodocsTag && this.options.docs.autodocs !== false; if (createDocEntry && this.options.build?.test?.disableAutoDocs !== true) { const name = this.options.docs.defaultName ?? 'Docs'; @@ -390,12 +387,8 @@ export class StoryIndexGenerator { }); } - const entriesWithoutDocsOnlyStories = entries.filter( - (entry) => !(entry.type === 'story' && entry.tags.includes('stories-mdx-docsOnly')) - ); - return { - entries: entriesWithoutDocsOnlyStories, + entries, dependents: [], type: 'stories', }; diff --git a/code/lib/core-server/src/utils/__tests__/autoName.test.ts b/code/lib/core-server/src/utils/__tests__/autoName.test.ts index 9aefb7ec3eed..64954fc55d17 100644 --- a/code/lib/core-server/src/utils/__tests__/autoName.test.ts +++ b/code/lib/core-server/src/utils/__tests__/autoName.test.ts @@ -2,9 +2,9 @@ import { it, expect } from 'vitest'; import { autoName } from '../autoName'; it('pulls name from named MDX files', () => { - expect(autoName('Conventions.mdx', 'Button.stories.mdx', 'Docs')).toEqual('Conventions'); + expect(autoName('Conventions.mdx', 'Button.mdx', 'Docs')).toEqual('Conventions'); }); it('falls back for default named MDX files', () => { - expect(autoName('Button.mdx', 'Button.stories.mdx', 'Docs')).toEqual('Docs'); + expect(autoName('Button.mdx', 'Button.stories.jsx', 'Docs')).toEqual('Docs'); }); 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 00d644f07409..9ab35f518034 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 @@ -8,7 +8,7 @@ import { normalizeStoriesEntry } from '@storybook/core-common'; import type { NormalizedStoriesSpecifier } from '@storybook/types'; import type { StoryIndexGeneratorOptions } from '../StoryIndexGenerator'; -import { AUTODOCS_TAG, STORIES_MDX_TAG, StoryIndexGenerator } from '../StoryIndexGenerator'; +import { AUTODOCS_TAG, StoryIndexGenerator } from '../StoryIndexGenerator'; vi.mock('@storybook/node-logger'); @@ -525,65 +525,4 @@ describe('docs entries from story extraction', () => { } `); }); - it(`adds docs entry when an entry has the "${STORIES_MDX_TAG}" tag`, async () => { - const relativePath = './src/A.stories.js'; - const absolutePath = path.join(options.workingDir, relativePath); - const specifier: NormalizedStoriesSpecifier = normalizeStoriesEntry(relativePath, options); - - const generator = new StoryIndexGenerator([specifier], { - ...options, - docs: { defaultName: 'docs', autodocs: false }, - indexers: [ - { - test: /\.stories\.(m?js|ts)x?$/, - createIndex: async (fileName) => [ - { - exportName: 'StoryOne', - __id: 'a--story-one', - name: 'Story One', - title: 'A', - tags: [STORIES_MDX_TAG, 'story-tag-from-indexer'], - importPath: fileName, - type: 'story', - }, - ], - }, - ], - }); - const result = await generator.extractStories(specifier, absolutePath); - - expect(result).toMatchInlineSnapshot(` - { - "dependents": [], - "entries": [ - { - "id": "a--docs", - "importPath": "./src/A.stories.js", - "name": "docs", - "storiesImports": [], - "tags": [ - "stories-mdx", - "story-tag-from-indexer", - ], - "title": "A", - "type": "docs", - }, - { - "componentPath": undefined, - "id": "a--story-one", - "importPath": "./src/A.stories.js", - "metaId": undefined, - "name": "Story One", - "tags": [ - "stories-mdx", - "story-tag-from-indexer", - ], - "title": "A", - "type": "story", - }, - ], - "type": "stories", - } - `); - }); }); diff --git a/code/lib/core-server/src/utils/summarizeIndex.test.ts b/code/lib/core-server/src/utils/summarizeIndex.test.ts index 8d71317f3918..e1be61027c22 100644 --- a/code/lib/core-server/src/utils/summarizeIndex.test.ts +++ b/code/lib/core-server/src/utils/summarizeIndex.test.ts @@ -144,7 +144,6 @@ describe('summarizeIndex', () => { "onboardingStoryCount": 0, "pageStoryCount": 0, "playStoryCount": 0, - "storiesMdxCount": 0, "storyCount": 0, "version": 5, } @@ -202,7 +201,6 @@ describe('summarizeIndex', () => { "onboardingStoryCount": 1, "pageStoryCount": 0, "playStoryCount": 0, - "storiesMdxCount": 0, "storyCount": 0, "version": 5, } @@ -258,7 +256,6 @@ describe('summarizeIndex', () => { "onboardingStoryCount": 0, "pageStoryCount": 0, "playStoryCount": 0, - "storiesMdxCount": 0, "storyCount": 4, "version": 5, } @@ -315,69 +312,11 @@ describe('summarizeIndex', () => { "onboardingStoryCount": 0, "pageStoryCount": 1, "playStoryCount": 1, - "storiesMdxCount": 0, "storyCount": 1, "version": 5, } `); }); - it('storiesMdx', () => { - expect( - summarizeIndex({ - v: 5, - entries: { - 'stories-renderers-react-react-mdx--docs': { - id: 'stories-renderers-react-react-mdx--docs', - title: 'stories/renderers/react/react-mdx', - name: 'Docs', - importPath: './src/stories/renderers/react/react-mdx.stories.mdx', - type: 'docs', - tags: ['stories-mdx', 'docs'], - storiesImports: [], - }, - 'stories-renderers-react-react-mdx--primary': { - id: 'stories-renderers-react-react-mdx--primary', - title: 'stories/renderers/react/react-mdx', - name: 'Primary', - importPath: './src/stories/renderers/react/react-mdx.stories.mdx', - tags: ['stories-mdx', 'story'], - type: 'story', - }, - 'stories-renderers-react-react-mdx--secondary': { - id: 'stories-renderers-react-react-mdx--secondary', - title: 'stories/renderers/react/react-mdx', - name: 'Secondary', - importPath: './src/stories/renderers/react/react-mdx.stories.mdx', - tags: ['stories-mdx', 'story'], - type: 'story', - }, - 'stories-renderers-react-react-mdx--from-template': { - id: 'stories-renderers-react-react-mdx--from-template', - title: 'stories/renderers/react/react-mdx', - name: 'From Template', - importPath: './src/stories/renderers/react/react-mdx.stories.mdx', - tags: ['stories-mdx', 'story'], - type: 'story', - }, - }, - }) - ).toMatchInlineSnapshot(` - { - "autodocsCount": 0, - "componentCount": 1, - "exampleDocsCount": 0, - "exampleStoryCount": 0, - "mdxCount": 0, - "onboardingDocsCount": 0, - "onboardingStoryCount": 0, - "pageStoryCount": 0, - "playStoryCount": 0, - "storiesMdxCount": 1, - "storyCount": 3, - "version": 5, - } - `); - }); it('autodocs', () => { expect( summarizeIndex({ @@ -430,7 +369,6 @@ describe('summarizeIndex', () => { "onboardingStoryCount": 0, "pageStoryCount": 0, "playStoryCount": 0, - "storiesMdxCount": 0, "storyCount": 0, "version": 5, } @@ -481,7 +419,6 @@ describe('summarizeIndex', () => { "onboardingStoryCount": 0, "pageStoryCount": 0, "playStoryCount": 0, - "storiesMdxCount": 0, "storyCount": 0, "version": 5, } diff --git a/code/lib/core-server/src/utils/summarizeIndex.ts b/code/lib/core-server/src/utils/summarizeIndex.ts index 091038cdaccf..8b74ad8b7f5f 100644 --- a/code/lib/core-server/src/utils/summarizeIndex.ts +++ b/code/lib/core-server/src/utils/summarizeIndex.ts @@ -1,6 +1,6 @@ import type { IndexEntry, StoryIndex } from '@storybook/types'; -import { STORIES_MDX_TAG, isMdxEntry, AUTODOCS_TAG, PLAY_FN_TAG } from './StoryIndexGenerator'; +import { isMdxEntry, AUTODOCS_TAG, PLAY_FN_TAG } from './StoryIndexGenerator'; const PAGE_REGEX = /(page|screen)/i; @@ -44,7 +44,6 @@ export function summarizeIndex(storyIndex: StoryIndex) { let pageStoryCount = 0; let playStoryCount = 0; let autodocsCount = 0; - let storiesMdxCount = 0; let mdxCount = 0; Object.values(storyIndex.entries).forEach((entry) => { if (isCLIExampleEntry(entry)) { @@ -65,8 +64,6 @@ export function summarizeIndex(storyIndex: StoryIndex) { } else if (entry.type === 'docs') { if (isMdxEntry(entry)) { mdxCount += 1; - } else if (entry.tags?.includes(STORIES_MDX_TAG)) { - storiesMdxCount += 1; } else if (entry.tags?.includes(AUTODOCS_TAG)) { autodocsCount += 1; } @@ -79,7 +76,6 @@ export function summarizeIndex(storyIndex: StoryIndex) { pageStoryCount, playStoryCount, autodocsCount, - storiesMdxCount, mdxCount, exampleStoryCount, exampleDocsCount, diff --git a/code/lib/core-server/src/utils/watch-story-specifiers.test.ts b/code/lib/core-server/src/utils/watch-story-specifiers.test.ts index 22d3e0901de8..4026de15fa11 100644 --- a/code/lib/core-server/src/utils/watch-story-specifiers.test.ts +++ b/code/lib/core-server/src/utils/watch-story-specifiers.test.ts @@ -83,7 +83,7 @@ describe('watchStorySpecifiers', () => { }); it('watches single file globs', async () => { - const specifier = normalizeStoriesEntry('../src/nested/Button.stories.mdx', options); + const specifier = normalizeStoriesEntry('../src/nested/Button.mdx', options); const onInvalidate = vi.fn(); close = watchStorySpecifiers([specifier], { workingDir }, onInvalidate); @@ -98,33 +98,33 @@ describe('watchStorySpecifiers', () => { // File changed, matching onInvalidate.mockClear(); - await onChange('src/nested/Button.stories.mdx', 1234); - expect(onInvalidate).toHaveBeenCalledWith(specifier, `./src/nested/Button.stories.mdx`, false); + await onChange('src/nested/Button.mdx', 1234); + expect(onInvalidate).toHaveBeenCalledWith(specifier, `./src/nested/Button.mdx`, false); // File changed, NOT matching onInvalidate.mockClear(); - await onChange('src/nested/Button.mdx', 1234); + await onChange('src/nested/Button.tsx', 1234); expect(onInvalidate).not.toHaveBeenCalled(); // File removed, matching onInvalidate.mockClear(); - await onRemove('src/nested/Button.stories.mdx'); - expect(onInvalidate).toHaveBeenCalledWith(specifier, `./src/nested/Button.stories.mdx`, true); + await onRemove('src/nested/Button.mdx'); + expect(onInvalidate).toHaveBeenCalledWith(specifier, `./src/nested/Button.mdx`, true); // File removed, NOT matching onInvalidate.mockClear(); - await onRemove('src/nested/Button.mdx'); + await onRemove('src/nested/Button.tsx'); expect(onInvalidate).not.toHaveBeenCalled(); // File moved out, matching onInvalidate.mockClear(); - await onChange('src/nested/Button.stories.mdx', null); - expect(onInvalidate).toHaveBeenCalledWith(specifier, `./src/nested/Button.stories.mdx`, true); + await onChange('src/nested/Button.mdx', null); + expect(onInvalidate).toHaveBeenCalledWith(specifier, `./src/nested/Button.mdx`, true); }); it('multiplexes between two specifiers on the same directory', async () => { const globSpecifier = normalizeStoriesEntry('../src/**/*.stories.@(ts|js)', options); - const fileSpecifier = normalizeStoriesEntry('../src/nested/Button.stories.mdx', options); + const fileSpecifier = normalizeStoriesEntry('../src/nested/Button.mdx', options); const onInvalidate = vi.fn(); close = watchStorySpecifiers([globSpecifier, fileSpecifier], { workingDir }, onInvalidate); @@ -145,11 +145,7 @@ describe('watchStorySpecifiers', () => { ); onInvalidate.mockClear(); - await onChange('src/nested/Button.stories.mdx', 1234); - expect(onInvalidate).toHaveBeenCalledWith( - fileSpecifier, - `./src/nested/Button.stories.mdx`, - false - ); + await onChange('src/nested/Button.mdx', 1234); + expect(onInvalidate).toHaveBeenCalledWith(fileSpecifier, `./src/nested/Button.mdx`, false); }); }); diff --git a/code/lib/core-webpack/src/to-require-context.test.ts b/code/lib/core-webpack/src/to-require-context.test.ts index 90fab1d15f97..e6dbd3c8a90a 100644 --- a/code/lib/core-webpack/src/to-require-context.test.ts +++ b/code/lib/core-webpack/src/to-require-context.test.ts @@ -61,21 +61,21 @@ const testCases = [ }, // INVALID GLOB { - glob: '../src/stories/**/*.stories.(js|mdx)', + glob: '../src/stories/**/*.stories.(js|ts)', recursive: true, validPaths: [ '../src/stories/components/Icon.stories.js', '../src/stories/Icon.stories.js', - '../src/stories/Icon.stories.mdx', + '../src/stories/Icon.stories.ts', '../src/stories/components/Icon/Icon.stories.js', - '../src/stories/components/Icon.stories/Icon.stories.mdx', + '../src/stories/components/Icon.stories/Icon.stories.ts', ], invalidPaths: [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', - '../src/stories/components/Icon/Icon.stories.ts', + '../src/Icon.stories.ts', + '../src/stories/components/Icon/Icon.stories.tsx', '../src/stories/components/Icon/Icon.mdx', ], }, @@ -89,59 +89,59 @@ const testCases = [ invalidPaths: ['./dirname/../stories.js', './dirname/../App.stories.js'], }, { - glob: '../src/stories/**/@(*.stories.js|*.stories.mdx)', + glob: '../src/stories/**/@(*.stories.js|*.stories.ts)', recursive: true, validPaths: [ '../src/stories/components/Icon.stories.js', '../src/stories/Icon.stories.js', - '../src/stories/Icon.stories.mdx', + '../src/stories/Icon.stories.ts', '../src/stories/components/Icon/Icon.stories.js', - '../src/stories/components/Icon.stories/Icon.stories.mdx', + '../src/stories/components/Icon.stories/Icon.stories.ts', ], invalidPaths: [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', - '../src/stories/components/Icon/Icon.stories.ts', + '../src/Icon.stories.ts', + '../src/stories/components/Icon/Icon.stories.tsx', '../src/stories/components/Icon/Icon.mdx', ], }, { - glob: '../src/stories/**/*.stories.+(js|mdx)', + glob: '../src/stories/**/*.stories.+(js|ts)', recursive: true, validPaths: [ '../src/stories/components/Icon.stories.js', '../src/stories/Icon.stories.js', - '../src/stories/Icon.stories.mdx', + '../src/stories/Icon.stories.ts', '../src/stories/components/Icon/Icon.stories.js', - '../src/stories/components/Icon.stories/Icon.stories.mdx', + '../src/stories/components/Icon.stories/Icon.stories.ts', ], invalidPaths: [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', - '../src/stories/components/Icon/Icon.stories.ts', + '../src/Icon.stories.tsx', + '../src/stories/components/Icon/Icon.stories.tsx', '../src/stories/components/Icon/Icon.mdx', ], }, { - glob: '../src/stories/**/*.stories.*(js|mdx)', + glob: '../src/stories/**/*.stories.*(js|ts)', recursive: true, validPaths: [ '../src/stories/components/Icon.stories.js', '../src/stories/Icon.stories.js', - '../src/stories/Icon.stories.mdx', + '../src/stories/Icon.stories.ts', '../src/stories/components/Icon/Icon.stories.js', - '../src/stories/components/Icon.stories/Icon.stories.mdx', + '../src/stories/components/Icon.stories/Icon.stories.ts', ], invalidPaths: [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', - '../src/stories/components/Icon/Icon.stories.ts', + '../src/Icon.stories.ts', + '../src/stories/components/Icon/Icon.stories.tsx', '../src/stories/components/Icon/Icon.mdx', ], }, @@ -150,13 +150,13 @@ const testCases = [ recursive: false, validPaths: ['../src/stories/components/Icon.stories.js'], invalidPaths: [ - '../src/Icon.stories.mdx', - '../src/stories/components/Icon.stories/Icon.stories.mdx', + '../src/Icon.stories.tsx', + '../src/stories/components/Icon.stories/Icon.stories.tsx', '../src/stories/components/Icon/Icon.mdx', '../src/stories/components/Icon/Icon.stories.js', '../src/stories/components/Icon/Icon.stories.ts', '../src/stories/Icon.stories.js', - '../src/stories/Icon.stories.mdx', + '../src/stories/Icon.stories.tsx', './Icon.stories.js', './src/stories/Icon.stories.js', './stories.js', @@ -191,7 +191,7 @@ const testCases = [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', + '../src/Icon.stories.tsx', '../src/stories/components/Icon/Icon.stories.ts', '../src/stories/components/Icon/Icon.mdx', ], @@ -205,7 +205,7 @@ const testCases = [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', + '../src/Icon.stories.tsx', '../src/stories/components/Icon/Icon.stories.ts', '../src/stories/components/Icon/Icon.mdx', ], @@ -219,7 +219,7 @@ const testCases = [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', + '../src/Icon.stories.tsx', '../components/icon/Icon.stories.js', '../components/basics/simple/icon/Icon.stories.js', '../src/stories/components/Icon/Icon.stories.ts', @@ -235,7 +235,7 @@ const testCases = [ './stories.js', './src/stories/Icon.stories.js', './Icon.stories.js', - '../src/Icon.stories.mdx', + '../src/Icon.stories.tsx', '../src/stories/components/Icon/Icon.stories.ts', '../src/stories/components/Icon/Icon.mdx', ], diff --git a/code/lib/csf-tools/src/CsfFile.test.ts b/code/lib/csf-tools/src/CsfFile.test.ts index 1c0ccc08f711..4c87576d2474 100644 --- a/code/lib/csf-tools/src/CsfFile.test.ts +++ b/code/lib/csf-tools/src/CsfFile.test.ts @@ -442,7 +442,7 @@ describe('CsfFile', () => { export const TestControl = () => _jsx("p", { children: "Hello" }); - export default { title: 'foo/bar', tags: ['stories-mdx'], includeStories: ["__page"] }; + export default { title: 'foo/bar', includeStories: ["__page"] }; export const __page = () => {}; __page.parameters = { docsOnly: true }; `, @@ -451,8 +451,6 @@ describe('CsfFile', () => { ).toMatchInlineSnapshot(` meta: title: foo/bar - tags: - - stories-mdx includeStories: - __page stories: diff --git a/code/lib/manager-api/src/tests/mockStoriesEntries.ts b/code/lib/manager-api/src/tests/mockStoriesEntries.ts index 703b6e6efb76..a820307f4ef2 100644 --- a/code/lib/manager-api/src/tests/mockStoriesEntries.ts +++ b/code/lib/manager-api/src/tests/mockStoriesEntries.ts @@ -53,7 +53,6 @@ export const docsEntries: StoryIndex['entries'] = { name: 'Docs', importPath: './path/to/component-b.ts', storiesImports: [], - tags: ['stories-mdx'], }, 'component-c--story-4': { type: 'story', 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 193a5f52358a..9b1a8ed9348a 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx @@ -53,7 +53,6 @@ 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'; diff --git a/code/lib/preview-api/src/modules/preview-web/render/CsfDocsRender.ts b/code/lib/preview-api/src/modules/preview-web/render/CsfDocsRender.ts index 019d43d97893..0be1ce5821c3 100644 --- a/code/lib/preview-api/src/modules/preview-web/render/CsfDocsRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/CsfDocsRender.ts @@ -25,8 +25,6 @@ import { DocsContext } from '../docs-context/DocsContext'; * * Use cases: * - Autodocs, where there is no story, and we fall back to the globally defined template. - * - *.stories.mdx files, where the MDX compiler produces a CSF file with a `.parameter.docs.page` - * parameter containing the compiled content of the MDX file. */ export class CsfDocsRender implements Render { public readonly type: RenderType = 'docs'; diff --git a/docs/configure/telemetry.md b/docs/configure/telemetry.md index 291fa53e18d3..bd86f613ff0a 100644 --- a/docs/configure/telemetry.md +++ b/docs/configure/telemetry.md @@ -71,7 +71,6 @@ Will generate the following output: "pageStoryCount": 0, "playStoryCount": 0, "autodocsCount": 0, - "storiesMdxCount": 0, "mdxCount": 0, "exampleStoryCount": 8, "exampleDocsCount": 3,