Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Move CSF to monorepo #30488

Merged
merged 187 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 182 commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
4757376
Port from monorepo
shilman Dec 9, 2019
168ddc6
types of csf properties
atanasster Jan 23, 2020
17ddd7f
add parameters to CSFStory
atanasster Jan 23, 2020
a2dc364
field types as enum
atanasster Jan 23, 2020
1ca8a10
updated interfaces
atanasster Jan 24, 2020
13aedba
move placeholder to text variable
atanasster Jan 24, 2020
76c7352
rename defaultValue to value
atanasster Jan 24, 2020
09c659a
renamed StoryMetadata
atanasster Jan 24, 2020
7885f22
remove unused
atanasster Jan 24, 2020
b0e456e
removed array type, sb specific
atanasster Jan 24, 2020
11fd0f9
added Array field type
atanasster Jan 24, 2020
c0d96f2
date field
atanasster Jan 24, 2020
72ce652
remove storyvalues
atanasster Jan 25, 2020
e2be313
fixed typos
atanasster Jan 25, 2020
1db0d6f
typo
atanasster Jan 25, 2020
b8d9224
datePicker, timePicker
atanasster Jan 25, 2020
5c5a97e
added maxRows to text type
atanasster Jan 28, 2020
d1f13a8
added order fied
atanasster Jan 29, 2020
7bcb7f1
apply @BeInLife 's comment about generic type for StoryPropertyOptions
ndelangen Jan 30, 2020
3fd17a7
types of csf properties (#3)
shilman Jan 30, 2020
a153358
Revert "types of csf properties (#3)"
wKich Apr 8, 2020
aae5e7e
add first proposal types for kind/story meta
wKich Apr 9, 2020
e9640be
add right type for `subcomponents` field
wKich Apr 9, 2020
8c78ed4
improve parameters typings
wKich Apr 10, 2020
3dc8b62
add exports, revert parameters to be less strict
wKich Apr 12, 2020
2156f57
rewrite types without tricky infer part
wKich Apr 14, 2020
d40d389
add tests for story meta types
wKich Apr 14, 2020
bd014a0
return generic for parameters type
wKich Apr 14, 2020
7857919
update babel to support optional chaining syntax
wKich Apr 14, 2020
44e440d
add more kinds/stories to test typings
wKich May 1, 2020
d30e471
Merge pull request #5 from wKich/csf-types
shilman May 1, 2020
3b0a4a5
Use 'toId' without story
unematiii Oct 15, 2020
00561e0
First attempt at bringing new types over
tmeasday Aug 23, 2021
7e3280d
Fix types after discussions with @shilman
tmeasday Aug 23, 2021
39bc8b5
Don't use async
tmeasday Aug 23, 2021
3937383
Add `applyDecorators` to `GlobalAnnotations`
tmeasday Aug 23, 2021
7233010
`argType.x.type` can be a string/enum too
tmeasday Aug 24, 2021
bb8a422
Update InputTypes to have strict versions
tmeasday Aug 25, 2021
3408a13
Fix up StrictInputTypes.
tmeasday Aug 25, 2021
18a5ed9
Update enhancer to use StrictArgTypes
tmeasday Aug 25, 2021
6af7987
Allow *any* key on StoryContextUpdates
tmeasday Aug 31, 2021
7fd05d3
`args`+`globals` are optional on `StoryContextUpdate`
tmeasday Sep 1, 2021
175c1c6
Rename Framework => AnyFramewokr
tmeasday Sep 3, 2021
641b542
Use TArgs annotation right down the stack
tmeasday Sep 6, 2021
01222b3
Separate user story annotations and internal story annotations
tmeasday Sep 6, 2021
2f5b8ad
ArgTypes are allowed to be partial too
tmeasday Sep 6, 2021
019e087
Rename `GlobalAnnotations` => `ProjectAnnotations`
tmeasday Sep 7, 2021
e875225
Add context arg to play function
ghengeveld Sep 8, 2021
cdffa02
Fix busted `StoryFn` types
tmeasday Sep 7, 2021
dd83e89
Add symbol to SB types
tmeasday Sep 8, 2021
fcd17b3
Default `TFramework` to `AnyFramework`
tmeasday Sep 11, 2021
f38d812
Don't pass anything to `play()` for now
tmeasday Sep 13, 2021
43be735
Export a couple of extra types
tmeasday Sep 20, 2021
c219bde
Add context arg to play function
ghengeveld Sep 8, 2021
ca7f203
Allow empty string for story
ghengeveld Oct 1, 2021
63194f9
Merge branch 'next' into 6-4-new-types
ghengeveld Oct 1, 2021
407e966
Remove canvasElement fram framework
shilman Oct 5, 2021
8a9ea3c
Only make `TArgs` parameterize `args` and `argTypes` in our default a…
tmeasday Dec 6, 2021
41bafd4
Tighten up types again.
tmeasday Dec 8, 2021
e150d66
Play function can only be set at the story level
tmeasday Dec 8, 2021
043cf25
Merge pull request #33 from ComponentDriven/16843-relax-TArgs-to-only…
shilman Dec 15, 2021
728d58d
Add conditional arg types and metadata
shilman Feb 18, 2022
d4a95e2
Add tests
shilman Feb 18, 2022
fb79db7
Rename includeIf/excludeIf to addIf/removeIf
shilman Feb 24, 2022
68f54e9
Revert "Play function can only be set at the story level"
wKich Mar 30, 2022
54c72d4
Richer conditional args
shilman Apr 5, 2022
794a0db
Fix build
shilman Apr 5, 2022
c0bc879
Implicit test for truthiness
shilman Apr 5, 2022
3e5a24d
Add truthy test to conditional args
shilman Apr 5, 2022
08796f6
Re-apply `TArgs` to CSF `render` type
tmeasday Apr 12, 2022
4ec8ef3
Add no arg/global specified test
shilman Apr 12, 2022
16b964d
Add step to play context and `runStep` to project annotations
tmeasday Jul 8, 2022
73d1191
Update re: @ghengeveld
tmeasday Jul 9, 2022
e8bb156
Need to parameterize `runStep`
tmeasday Jul 9, 2022
8e405b4
Step functions are allowed to be async of course
tmeasday Jul 9, 2022
bf7e1e8
Merge branch 'feat/conditional-args' into 41-tighten-render-type
shilman Oct 10, 2022
387eafd
Merge branch '41-tighten-render-type' into add-step
shilman Oct 10, 2022
5865ae8
SB-738: Sound arg types
kasperpeulen Oct 4, 2022
64ee46a
Use HKT's instead
kasperpeulen Oct 6, 2022
612a5db
update the test
kasperpeulen Oct 6, 2022
f71793e
explain usage for higher kinded T
kasperpeulen Oct 6, 2022
29169d6
make T optional
kasperpeulen Oct 6, 2022
8c64e8a
rename TArgsAnnotations -> TRequiredArgs
kasperpeulen Oct 10, 2022
32afba5
fix subcomponents regression
kasperpeulen Oct 10, 2022
9dcfacc
ArgsFromMeta utility and generic ArgsStoryFn RT
kasperpeulen Oct 18, 2022
06e47d6
use tsup and upgrade dependencies
kasperpeulen Oct 18, 2022
738f4c7
add type test for ArgsFromMeta
kasperpeulen Oct 19, 2022
f0ca9bc
Merge pull request #51 from ComponentDriven/kasper/csf-3-improvements
shilman Oct 22, 2022
d262cd9
Merge pull request #49 from ComponentDriven/kasper/sb-738/csf-3
shilman Oct 22, 2022
e952787
Merge pull request #48 from ComponentDriven/add-step
shilman Oct 22, 2022
39d90ff
Merge pull request #43 from ComponentDriven/41-tighten-render-type
shilman Oct 22, 2022
14b6243
Merge pull request #36 from ComponentDriven/feat/conditional-args
shilman Oct 22, 2022
fea7665
Merge branch '6-4-new-types' into 6-4-new-types
shilman Oct 22, 2022
536b5ef
Merge pull request #40 from wKich/6-4-new-types
shilman Oct 22, 2022
c23fd58
Add tag annotation at all levels
tmeasday Oct 26, 2022
7f8ddee
Don't allow tags at the project level (for now)
tmeasday Oct 26, 2022
ed2f780
Merge pull request #52 from ComponentDriven/tom/sb-827-add-basic-stor…
tmeasday Oct 27, 2022
b2d9219
Rework Framework type to contain `canvasElement`
tmeasday Nov 4, 2022
2261621
Fix linting
tmeasday Nov 4, 2022
8674bb9
Merge pull request #53 from ComponentDriven/tom/sb-850-add-canvasElem…
shilman Nov 4, 2022
af8d0e6
Rename Framework -> Renderer
kasperpeulen Nov 9, 2022
3995bf8
Run test as ESM modules and some other boy scouting
kasperpeulen Nov 9, 2022
e338d6a
Merge pull request #54 from ComponentDriven/kasper/rename-framework-t…
kasperpeulen Nov 10, 2022
051138c
Revert stricter parameters
kasperpeulen Nov 11, 2022
c5267ed
Merge pull request #56 from ComponentDriven/kasper/revert-stricter-pa…
kasperpeulen Nov 11, 2022
a6dcf83
Add strict variants
kasperpeulen Nov 11, 2022
0085a76
Merge pull request #57 from ComponentDriven/kasper/stricter-variants
kasperpeulen Nov 14, 2022
a8f6c64
Make sure that index signatures (used in decorators) don't cause unex…
kasperpeulen Nov 14, 2022
082a29a
Merge pull request #58 from ComponentDriven/kasper/remove-index-signa…
kasperpeulen Nov 14, 2022
e96a7e4
Fix bug with meta not working well as generic parameter for StoryObj
kasperpeulen Dec 8, 2022
3038c8b
Merge pull request #60 from ComponentDriven/kasper/sb-1071-fix-ts-bug…
shilman Dec 8, 2022
03dacb4
replace lodash
ndelangen Feb 3, 2023
7c2689d
fix
ndelangen Feb 3, 2023
20df700
improvements
ndelangen Feb 3, 2023
2eaf7e7
trim and add tests
ndelangen Feb 3, 2023
e4bd8f7
Update src/toStartCaseStr.test.ts
ndelangen Feb 14, 2023
3d13945
fix
ndelangen Feb 14, 2023
443243e
Merge pull request #62 from ComponentDriven/norbert/no-lodash
shilman Feb 16, 2023
63a2958
add more test, and fix an issue or 2
ndelangen Feb 16, 2023
746bd7b
Merge branch 'next' into norbert/fix-startcase
ndelangen Feb 16, 2023
c604bb9
Merge pull request #64 from ComponentDriven/norbert/fix-startcase
ndelangen Feb 16, 2023
9392597
Turn Args interfaces into types when passed to decorator
kasperpeulen Mar 30, 2023
20d41cc
Merge pull request #65 from ComponentDriven/kasper/decorator-with-int…
shilman Mar 31, 2023
520a8bb
Allow loaders to be synchronous or void
kasperpeulen Nov 20, 2023
6cfa85d
Allow single loader as well
kasperpeulen Nov 20, 2023
5691c7f
Allow single decorators as well
kasperpeulen Nov 22, 2023
c4aa6ab
Merge pull request #71 from ComponentDriven/kasper/improve-loaders
kasperpeulen Nov 22, 2023
caf44e7
Improve InputType
Shinigami92 Feb 1, 2024
9cf7abb
Update links to Storybook documentation
nkabrown Mar 1, 2024
a4941ca
Improve control types with discriminated union
shilman Mar 14, 2024
d61a8d2
Merge pull request #75 from Shinigami92/improve-input-type
shilman Mar 14, 2024
2f950e5
Fix linting
shilman Mar 14, 2024
8656cd1
Merge pull request #78 from ComponentDriven/shilman/fix-linting
shilman Mar 16, 2024
f9cd5ea
Add utility for tag combination & negation
shilman Mar 24, 2024
7c403d7
Change negation from `-` to `!`
shilman Mar 26, 2024
08907fe
Add project level tags
shilman Mar 29, 2024
dfbaa53
Fix combineTags to respect tag order
shilman Apr 5, 2024
935793a
Fix control type
kasperpeulen Apr 11, 2024
a562a75
Merge pull request #83 from ComponentDriven/kasper/fix-control-type
kasperpeulen Apr 12, 2024
c1179c8
Add the beforeEach hook
kasperpeulen Apr 10, 2024
a482f84
Export CleanupCallback type
kasperpeulen Apr 11, 2024
656a058
Change type
kasperpeulen Apr 11, 2024
f100389
fix: better handle readonly InputType options
Cherry Apr 22, 2024
0f82d1e
Merge pull request #85 from Cherry/fix/story-InputType-options
kasperpeulen Apr 25, 2024
af4da7e
chore: resolve eslint issues
Cherry Apr 25, 2024
5be6ddd
Merge pull request #87 from Cherry/fix/lint
kasperpeulen Apr 25, 2024
9778f36
Change argument type of BeforeEach function from StoryContextForLoade…
kasperpeulen Apr 30, 2024
f7f9430
Merge pull request #82 from ComponentDriven/kasper/before-each
kasperpeulen Apr 30, 2024
d434dd8
Merge pull request #80 from ComponentDriven/shilman/add-combine-tags
shilman May 6, 2024
ac3306f
Add project initialGlobals and deprecate globals
shilman Jun 3, 2024
0014145
Add globals annotation to component/story
shilman Jun 3, 2024
c016ebb
Merge pull request #92 from ComponentDriven/shilman/initial-globals
shilman Jun 3, 2024
2c7f5ab
Add beforeAll hook to CSF types
ghengeveld Jun 21, 2024
e4b199b
Extend explanation of beforeAll hook
ghengeveld Jun 24, 2024
a7117d5
Merge pull request #96 from ComponentDriven/add-beforeAll-hook
shilman Jun 24, 2024
49b756d
Consolidate loader, play and render context and add a self referencin…
kasperpeulen Jun 25, 2024
29d584b
Fix types to interfaces
kasperpeulen Jun 26, 2024
ccbf651
Add canvas property to context that can be implemented by addons such…
kasperpeulen Jun 26, 2024
0c9ba2c
Disable unnecessary eslint rule
kasperpeulen Jun 27, 2024
b444ddb
Add mount to csf
kasperpeulen Jun 28, 2024
6a2a3dc
Merge pull request #99 from ComponentDriven/kasper/canvas
kasperpeulen Jul 2, 2024
90a5619
Merge pull request #98 from ComponentDriven/kasper/context-consolidation
kasperpeulen Jul 2, 2024
3ca2578
Merge pull request #100 from ComponentDriven/kasper/mount
kasperpeulen Jul 2, 2024
459f980
Merge pull request #77 from nkabrown/update-storybook-links
ndelangen Jul 24, 2024
dd75176
Add ReportingAPI interface and reporting property to StoryContext
valentinpalkovic Nov 13, 2024
7ee0fcb
Add the afterEach hook
kasperpeulen Nov 7, 2024
057957e
Fix typo
kasperpeulen Nov 12, 2024
b4e2f39
Update type for reporting api
valentinpalkovic Nov 25, 2024
e11c1df
Update Report interface to use 'type' instead of 'id' and rename afte…
valentinpalkovic Nov 29, 2024
a1fe9e7
Rename afterEach to experimental_afterEach in story test cases
valentinpalkovic Nov 29, 2024
0c8ef0f
Merge pull request #110 from ComponentDriven/valentin/add-reporting-api
kasperpeulen Nov 29, 2024
0d68f51
Use any for generic of Renderer
kasperpeulen Jan 28, 2025
8926d6f
Merge remote-tracking branch 'csf3/kasper/csf-factories' into kasper/…
kasperpeulen Feb 6, 2025
edff9f0
Move CSF package to monorepo
kasperpeulen Feb 6, 2025
57a8edd
Change usage in core package
kasperpeulen Feb 6, 2025
d5bd041
Change usage outside of core package
kasperpeulen Feb 6, 2025
b1850a7
Eslint
kasperpeulen Feb 6, 2025
0c3c48a
Fix build
kasperpeulen Feb 6, 2025
cfc2b59
Fix tests
kasperpeulen Feb 6, 2025
6a325db
Fix tests
kasperpeulen Feb 6, 2025
a1b216d
Fix build
kasperpeulen Feb 6, 2025
0dc0d0c
Fix eslint
kasperpeulen Feb 6, 2025
68f742a
Apply suggestions from code review
shilman Feb 6, 2025
329d5b6
Fix test
kasperpeulen Feb 6, 2025
c71d283
Remove @storybook/csf from package.json
kasperpeulen Feb 7, 2025
1d5017f
Merge remote-tracking branch 'origin/next' into kasper/csf-in-monorepo
kasperpeulen Feb 7, 2025
43f0399
Add csf back to svelte, workaround for addon-svelte-csf needing it wi…
kasperpeulen Feb 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/addons/a11y/src/preview.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @vitest-environment happy-dom
import { beforeEach, describe, expect, it, vi } from 'vitest';

import type { StoryContext } from '@storybook/csf';
import type { StoryContext } from 'storybook/internal/csf';

import { run } from './a11yRunner';
import { A11Y_TEST_TAG } from './constants';
Expand Down
3 changes: 1 addition & 2 deletions code/addons/controls/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
SaveStoryResponsePayload,
} from 'storybook/internal/core-events';
import { SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE } from 'storybook/internal/core-events';
import type { Args } from 'storybook/internal/csf';
import {
addons,
experimental_requestResponse,
Expand All @@ -15,8 +16,6 @@ import {
} from 'storybook/internal/manager-api';
import { color } from 'storybook/internal/theming';

import type { Args } from '@storybook/csf';

import { dequal as deepEqual } from 'dequal';

import { ControlsPanel } from './ControlsPanel';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/links/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SELECT_STORY, STORY_CHANGED } from 'storybook/internal/core-events';
import { toId } from 'storybook/internal/csf';
import { addons, makeDecorator } from 'storybook/internal/preview-api';
import type { ComponentTitle, StoryId, StoryKind, StoryName } from 'storybook/internal/types';

import { toId } from '@storybook/csf';
import { global } from '@storybook/global';

import { PARAM_KEY } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/src/components/TestProviderRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {
type TestProviderConfig,
type TestProviderState,
} from 'storybook/internal/core-events';
import type { Tag } from 'storybook/internal/csf';
import { addons, useStorybookState } from 'storybook/internal/manager-api';
import type { API } from 'storybook/internal/manager-api';
import { styled, useTheme } from 'storybook/internal/theming';

import type { Tag } from '@storybook/csf';
import {
AccessibilityIcon,
EditIcon,
Expand Down
3 changes: 1 addition & 2 deletions code/addons/test/src/vitest-plugin/viewports.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable no-underscore-dangle */
import type { Globals, Parameters } from 'storybook/internal/csf';
import { UnsupportedViewportDimensionError } from 'storybook/internal/preview-errors';

import type { Globals, Parameters } from '@storybook/csf';

import { MINIMAL_VIEWPORTS } from '../../../viewport/src/defaults';
import type { ViewportMap, ViewportStyles } from '../../../viewport/src/types';

Expand Down
9 changes: 9 additions & 0 deletions code/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
"import": "./dist/csf-tools/index.js",
"require": "./dist/csf-tools/index.cjs"
},
"./csf": {
"types": "./dist/csf/index.d.ts",
"import": "./dist/csf/index.js",
"require": "./dist/csf/index.cjs"
},
"./common": {
"types": "./dist/common/index.d.ts",
"import": "./dist/common/index.js",
Expand Down Expand Up @@ -219,6 +224,9 @@
"csf-tools": [
"./dist/csf-tools/index.d.ts"
],
"csf": [
"./dist/csf/index.d.ts"
],
"common": [
"./dist/common/index.d.ts"
],
Expand Down Expand Up @@ -303,6 +311,7 @@
"@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@ndelangen/get-tarball": "^3.0.7",
"@ngard/tiny-isequal": "^1.1.0",
"@polka/compression": "^1.0.0-next.28",
"@popperjs/core": "^2.6.0",
"@radix-ui/react-dialog": "^1.1.2",
Expand Down
1 change: 1 addition & 0 deletions code/core/scripts/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const getEntries = (cwd: string) => {
define('src/channels/index.ts', ['browser', 'node'], true),
define('src/types/index.ts', ['browser', 'node'], true, ['react']),
define('src/csf-tools/index.ts', ['node'], true),
define('src/csf/index.ts', ['browser', 'node'], true),
define('src/common/index.ts', ['node'], true),
define('src/builder-manager/index.ts', ['node'], true),
define('src/telemetry/index.ts', ['node'], true),
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/common/utils/get-story-id.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { relative } from 'node:path';

import { normalizeStories, normalizeStoryPath } from '@storybook/core/common';
import { sanitize, storyNameFromExport, toId } from '@storybook/core/csf';
import type { Options, StoriesEntry } from '@storybook/core/types';
import { sanitize, storyNameFromExport, toId } from '@storybook/csf';

import { userOrAutoTitleFromSpecifier } from '@storybook/core/preview-api';

Expand Down
2 changes: 1 addition & 1 deletion code/core/src/components/components/tabs/tabs.hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';

import { sanitize } from '@storybook/core/csf';
import { styled } from '@storybook/core/theming';
import { sanitize } from '@storybook/csf';

import useResizeObserver from 'use-resize-observer';

Expand Down
2 changes: 1 addition & 1 deletion code/core/src/components/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { FC, PropsWithChildren, ReactElement, ReactNode, SyntheticEvent } from 'react';
import React, { Component, memo, useMemo } from 'react';

import { sanitize } from '@storybook/core/csf';
import { styled } from '@storybook/core/theming';
import type { Addon_RenderOptions } from '@storybook/core/types';
import { sanitize } from '@storybook/csf';

import { FlexBar } from '../bar/bar';
import { TabButton } from '../bar/button';
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/core-events/data/argtypes-info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ArgTypes } from '@storybook/csf';
import type { ArgTypes } from '@storybook/core/csf';

export interface ArgTypesRequestPayload {
storyId: string;
Expand Down
6 changes: 3 additions & 3 deletions code/core/src/core-server/utils/StoryIndexGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { join } from 'node:path';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import { normalizeStoriesEntry } from '@storybook/core/common';
import { toId } from '@storybook/core/csf';
import type { NormalizedStoriesSpecifier, StoryIndexEntry } from '@storybook/core/types';
import { toId } from '@storybook/csf';

import { getStorySortParameter, readCsf } from '@storybook/core/csf-tools';
import { logger, once } from '@storybook/core/node-logger';
Expand All @@ -14,8 +14,8 @@ import { csfIndexer } from '../presets/common-preset';
import type { StoryIndexGeneratorOptions } from './StoryIndexGenerator';
import { StoryIndexGenerator } from './StoryIndexGenerator';

vi.mock('@storybook/csf', async (importOriginal) => {
const csf = await importOriginal<typeof import('@storybook/csf')>();
vi.mock('@storybook/core/csf', async (importOriginal) => {
const csf = await importOriginal<typeof import('@storybook/core/csf')>();
return {
...csf,
toId: vi.fn(csf.toId),
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/core-server/utils/StoryIndexGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { readFile } from 'node:fs/promises';
import { dirname, extname, join, normalize, relative, resolve, sep } from 'node:path';

import { commonGlobOptions, normalizeStoryPath } from '@storybook/core/common';
import { combineTags, storyNameFromExport, toId } from '@storybook/core/csf';
import type {
DocsIndexEntry,
DocsOptions,
Expand All @@ -17,7 +18,6 @@ import type {
StorybookConfigRaw,
Tag,
} from '@storybook/core/types';
import { combineTags, storyNameFromExport, toId } from '@storybook/csf';

import { getStorySortParameter, loadConfig } from '@storybook/core/csf-tools';
import { logger, once } from '@storybook/core/node-logger';
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/core-server/utils/save-story/save-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { basename, join } from 'node:path';

import type { Channel } from '@storybook/core/channels';
import { formatFileContent } from '@storybook/core/common';
import { storyNameFromExport, toId } from '@storybook/core/csf';
import { isExampleStoryId, telemetry } from '@storybook/core/telemetry';
import type { CoreConfig, Options } from '@storybook/core/types';
import { storyNameFromExport, toId } from '@storybook/csf';

import type {
RequestData,
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/csf-tools/CsfFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
types as t,
traverse,
} from '@storybook/core/babel';
import { isExportStory, storyNameFromExport, toId } from '@storybook/core/csf';
import type {
ComponentAnnotations,
IndexInput,
Expand All @@ -19,7 +20,6 @@ import type {
StoryAnnotations,
Tag,
} from '@storybook/core/types';
import { isExportStory, storyNameFromExport, toId } from '@storybook/csf';

import { dedent } from 'ts-dedent';

Expand Down
2 changes: 1 addition & 1 deletion code/core/src/csf-tools/vitest-plugin/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* eslint-disable no-underscore-dangle */
import { types as t } from '@storybook/core/babel';
import { getStoryTitle } from '@storybook/core/common';
import { combineTags } from '@storybook/core/csf';
import type { StoriesEntry, Tag } from '@storybook/core/types';
import { combineTags } from '@storybook/csf';

import { dedent } from 'ts-dedent';

Expand Down
42 changes: 42 additions & 0 deletions code/core/src/csf/SBType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
interface SBBaseType {
required?: boolean;
raw?: string;
}
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: SBBaseType interface should be exported since it's used by other exported types

Suggested change
interface SBBaseType {
required?: boolean;
raw?: string;
}
export interface SBBaseType {
required?: boolean;
raw?: string;
}


export type SBScalarType = SBBaseType & {
name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
};

export type SBArrayType = SBBaseType & {
name: 'array';
value: SBType;
};
export type SBObjectType = SBBaseType & {
name: 'object';
value: Record<string, SBType>;
};
export type SBEnumType = SBBaseType & {
name: 'enum';
value: (string | number)[];
};
export type SBIntersectionType = SBBaseType & {
name: 'intersection';
value: SBType[];
};
export type SBUnionType = SBBaseType & {
name: 'union';
value: SBType[];
};
export type SBOtherType = SBBaseType & {
name: 'other';
value: string;
};

export type SBType =
| SBScalarType
| SBEnumType
| SBArrayType
| SBObjectType
| SBIntersectionType
| SBUnionType
| SBOtherType;
Loading