repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/getDiff.ts | code/core/src/core-server/utils/save-story/getDiff.ts | import { diffLines } from 'diff';
/**
* Get a diff between two strings
*
* @example
*
* ```ts
* const before = 'foo\nbar\nbaz';
* const after = 'foo\nbaz';
* const diff = getDiff(before, after);
* console.log(diff);
* // foo
* // - bar
* // baz
* ```
*
* @param before The original string
* @param a... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/mocks/export-variances.stories.tsx | code/core/src/core-server/utils/save-story/mocks/export-variances.stories.tsx | import React from 'react';
import type { FC } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
export default {
title: 'MyComponent',
args: {
initial: 'foo',
},
} satisfies Meta<typeof MyComponent>;
type Story = StoryObj<typeof MyComponent>;
// dummy component
const MyComponent: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/mocks/typescript-constructs.stories.tsx | code/core/src/core-server/utils/save-story/mocks/typescript-constructs.stories.tsx | import React from 'react';
import type { FC } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
export default {
title: 'MyComponent',
args: {
initial: 'foo',
},
} satisfies Meta<typeof MyComponent>;
type Story = StoryObj<typeof MyComponent>;
// dummy component
const MyComponent: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/mocks/data-variances.stories.tsx | code/core/src/core-server/utils/save-story/mocks/data-variances.stories.tsx | import React from 'react';
import type { FC } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
export default {
title: 'MyComponent',
args: {
myString: 'foo',
},
} satisfies Meta<typeof MyComponent>;
type Story = StoryObj<typeof MyComponent>;
// dummy component
const MyComponent:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/mocks/csf4-variances.stories.tsx | code/core/src/core-server/utils/save-story/mocks/csf4-variances.stories.tsx | // @ts-expect-error this is just a mock file
import preview from '#.storybook/preview';
const meta = preview.meta({
title: 'MyComponent',
args: {
initial: 'foo',
},
});
export const Empty = meta.story({});
export const WithArgs = meta.story({
args: {
foo: 'bar',
},
});
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/mocks/unsupported-csf-variances.stories.tsx | code/core/src/core-server/utils/save-story/mocks/unsupported-csf-variances.stories.tsx | import React from 'react';
import type { FC } from 'react';
import type { Meta } from '@storybook/react-vite';
export default {
title: 'MyComponent',
args: {
initial: 'foo',
},
} satisfies Meta<typeof MyComponent>;
// dummy component
const MyComponent: FC<{ absolute: boolean; bordered: boolean; initial: st... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/save-story/mocks/csf-variances.stories.tsx | code/core/src/core-server/utils/save-story/mocks/csf-variances.stories.tsx | import React from 'react';
import type { FC } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
export default {
title: 'MyComponent',
args: {
initial: 'foo',
},
} satisfies Meta<typeof MyComponent>;
type Story = StoryObj<typeof MyComponent>;
// dummy component
const MyComponent: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/E.stories.ts | code/core/src/core-server/utils/__mockdata__/E.stories.ts | const component = {};
export default {
component,
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/errors/NoMeta.stories.ts | code/core/src/core-server/utils/__mockdata__/errors/NoMeta.stories.ts | /* eslint-disable storybook/default-exports */
// no default export
// e.g. https://github.com/storybookjs/storybook/issues/16421
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/errors/NoStories.stories.ts | code/core/src/core-server/utils/__mockdata__/errors/NoStories.stories.ts | /* eslint-disable storybook/story-exports */
const component = {};
export default {
component,
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/Button.stories.ts | code/core/src/core-server/utils/__mockdata__/src/Button.stories.ts | const component = {};
export default {
title: 'Example/Button',
component,
tags: ['foobar'],
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/B.stories.ts | code/core/src/core-server/utils/__mockdata__/src/B.stories.ts | const component = {};
export default {
component,
tags: ['autodocs'],
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/stories.ts | code/core/src/core-server/utils/__mockdata__/src/stories.ts | const component = {};
export default {
component,
tags: ['autodocs'],
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/F.story.ts | code/core/src/core-server/utils/__mockdata__/src/F.story.ts | const component = {};
export default {
component,
tags: ['autodocs'],
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/second-nested/G.stories.ts | code/core/src/core-server/utils/__mockdata__/src/second-nested/G.stories.ts | const component = {};
export default {
component,
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/nested/Button.stories.ts | code/core/src/core-server/utils/__mockdata__/src/nested/Button.stories.ts | const component = {};
export default {
component,
tags: ['component-tag'],
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/src/nested/Button.ts | code/core/src/core-server/utils/__mockdata__/src/nested/Button.ts | export const Button = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__mockdata__/deeply/nested/single/File.stories.ts | code/core/src/core-server/utils/__mockdata__/deeply/nested/single/File.stories.ts | export default {
component: {},
};
export const StoryOne = {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/server-address.test.ts | code/core/src/core-server/utils/__tests__/server-address.test.ts | import os, { type NetworkInterfaceInfoIPv4 } from 'node:os';
import { describe, expect, it, vi } from 'vitest';
import { getServerAddresses } from '../server-address';
const mockedNetworkAddress: NetworkInterfaceInfoIPv4 = {
address: '192.168.0.5',
netmask: '255.255.255.0',
family: 'IPv4',
mac: '01:02:03:0a:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/server-channel.test.ts | code/core/src/core-server/utils/__tests__/server-channel.test.ts | import { describe, expect, it, vi } from 'vitest';
import { Channel } from 'storybook/internal/channels';
import { EventEmitter } from 'events';
import type { Server } from 'http';
import { stringify } from 'telejson';
import { ServerChannelTransport, getServerChannel } from '../get-server-channel';
describe('getSe... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/index-extraction.test.ts | code/core/src/core-server/utils/__tests__/index-extraction.test.ts | import { join } from 'node:path';
import { describe, expect, it, vi } from 'vitest';
import { normalizeStoriesEntry } from 'storybook/internal/common';
import type { NormalizedStoriesSpecifier } from 'storybook/internal/types';
import type { StoryIndexGeneratorOptions } from '../StoryIndexGenerator';
import { AUTODO... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/IndexingError.test.ts | code/core/src/core-server/utils/__tests__/IndexingError.test.ts | import { describe, expect, it } from 'vitest';
import { IndexingError, MultipleIndexingError } from '../IndexingError';
it('formats single file errors', () => {
const error = new IndexingError('parse error', ['./stories/File.stories.ts']);
expect(error.toString()).toMatchInlineSnapshot(`"./stories/File.stories.t... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/server-statics.test.ts | code/core/src/core-server/utils/__tests__/server-statics.test.ts | import fs from 'node:fs';
import { resolve } from 'node:path';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { onlyWindows, skipWindows } from '../../../../../vitest.helpers';
import { parseStaticDir, prepareNestedSvg } from '../server-statics';
vi.mock('node:fs');
const existsSyncMock = vi.m... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/remove-mdx-stories.test.ts | code/core/src/core-server/utils/__tests__/remove-mdx-stories.test.ts | import { join } from 'node:path';
import { describe, expect, it, vi } from 'vitest';
import { normalizeStoriesEntry } from 'storybook/internal/common';
import { type StoriesEntry } from 'storybook/internal/types';
// eslint-disable-next-line depend/ban-dependencies
import { glob as globOriginal } from 'glob';
// esl... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__tests__/autoName.test.ts | code/core/src/core-server/utils/__tests__/autoName.test.ts | import { expect, it } from 'vitest';
import { autoName } from '../autoName';
it('pulls name from named MDX files', () => {
expect(autoName('Conventions.mdx', 'Button.mdx', 'Docs')).toEqual('Conventions');
});
it('falls back for default named MDX files', () => {
expect(autoName('Button.mdx', 'Button.stories.jsx',... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__search-files-tests__/src/tests/some.spec.ts | code/core/src/core-server/utils/__search-files-tests__/src/tests/some.spec.ts | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false | |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__search-files-tests__/src/tests/some.test.ts | code/core/src/core-server/utils/__search-files-tests__/src/tests/some.test.ts | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false | |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.ts | code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.ts | export default function () {
return 'default';
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.tsx | code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.tsx | export default function () {
return 'default';
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/parser/generic-parser.ts | code/core/src/core-server/utils/parser/generic-parser.ts | import { parser, types as t } from 'storybook/internal/babel';
import type { Parser, ParserResult } from './types';
/** A generic parser that can parse both ES and CJS modules. */
export class GenericParser implements Parser {
/**
* Parse the content of a file and return the exports
*
* @param content The ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/parser/generic-parser.test.ts | code/core/src/core-server/utils/parser/generic-parser.test.ts | import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { describe, expect, it } from 'vitest';
import { GenericParser } from './generic-parser';
const genericParser = new GenericParser();
const TEST_DIR = join(__dirname, '..', '__search-files-tests__');
describe('generic-parser', () => {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/parser/types.ts | code/core/src/core-server/utils/parser/types.ts | export type ParserResult = {
exports: Array<{
name: string;
default: boolean;
}>;
};
/** A parser that can parse the exports of a file */
export interface Parser {
/**
* Parse the content of a file and return the exports
*
* @param content The content of the file
* @returns The result of the ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/parser/index.ts | code/core/src/core-server/utils/parser/index.ts | import type { SupportedRenderer } from 'storybook/internal/types';
import { GenericParser } from './generic-parser';
import type { Parser } from './types';
/**
* Get the parser for a given renderer
*
* @param renderer The renderer to get the parser for
* @returns The parser for the renderer
*/
export function ge... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/manifests/render-components-manifest.ts | code/core/src/core-server/utils/manifests/render-components-manifest.ts | import path from 'node:path';
import { groupBy } from 'storybook/internal/common';
import type { ComponentManifest, ComponentsManifest } from '../../../types';
// AI generated manifests/components.html page
// Only HTML/CSS no JS
export function renderComponentsManifest(manifest: ComponentsManifest) {
const entrie... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/manifests/manifests.ts | code/core/src/core-server/utils/manifests/manifests.ts | import { mkdir, writeFile } from 'node:fs/promises';
import { logger } from 'storybook/internal/node-logger';
import type { ComponentsManifest, Manifests, Presets } from 'storybook/internal/types';
import { join } from 'pathe';
import type { Polka } from 'polka';
import invariant from 'tiny-invariant';
import { rend... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/utils/manifests/manifests.test.ts | code/core/src/core-server/utils/manifests/manifests.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import { logger } from 'storybook/internal/node-logger';
import type { ComponentsManifest, Manifests, Presets, StoryIndex } from 'storybook/internal/types';
import { vol } from 'memfs';
import type { Polka, Request, Response } from 'polka';
import { regi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/file-search-channel.ts | code/core/src/core-server/server-channel/file-search-channel.ts | import { readFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import type { Channel } from 'storybook/internal/channels';
import { extractRenderer, getFrameworkName, getProjectRoot } from 'storybook/internal/common';
import type {
FileComponentSearchRequestPayload,
FileComponentSearchResp... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/create-new-story-channel.test.ts | code/core/src/core-server/server-channel/create-new-story-channel.test.ts | import { join } from 'node:path';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { ChannelTransport } from 'storybook/internal/channels';
import { Channel } from 'storybook/internal/channels';
import type { CreateNewStoryRequestPayload, RequestData } from 'storybook/internal/core-events';
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/preview-initialized-channel.ts | code/core/src/core-server/server-channel/preview-initialized-channel.ts | import type { Channel } from 'storybook/internal/channels';
import { PREVIEW_INITIALIZED } from 'storybook/internal/core-events';
import { type InitPayload, telemetry } from 'storybook/internal/telemetry';
import { type CacheEntry, getLastEvents } from 'storybook/internal/telemetry';
import { getSessionId } from 'story... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/file-search-channel.test.ts | code/core/src/core-server/server-channel/file-search-channel.test.ts | // @vitest-environment happy-dom
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { Channel } from 'storybook/internal/channels';
import type { ChannelTransport } from 'storybook/internal/channels';
import * as common from 'storybook/internal/common';
import type {
FileComponentSearchRequestPayl... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/open-in-editor-channel.ts | code/core/src/core-server/server-channel/open-in-editor-channel.ts | import type { Channel } from 'storybook/internal/channels';
import type {
OpenInEditorRequestPayload,
OpenInEditorResponsePayload,
} from 'storybook/internal/core-events';
import { OPEN_IN_EDITOR_REQUEST, OPEN_IN_EDITOR_RESPONSE } from 'storybook/internal/core-events';
import { telemetry } from 'storybook/internal/... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/create-new-story-channel.ts | code/core/src/core-server/server-channel/create-new-story-channel.ts | import { existsSync } from 'node:fs';
import { writeFile } from 'node:fs/promises';
import { relative } from 'node:path';
import type { Channel } from 'storybook/internal/channels';
import { getStoryId } from 'storybook/internal/common';
import type {
CreateNewStoryErrorPayload,
CreateNewStoryRequestPayload,
Cre... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/server-channel/preview-initialized-channel.test.ts | code/core/src/core-server/server-channel/preview-initialized-channel.test.ts | import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { makePayload } from './preview-initialized-channel';
describe('makePayload', () => {
beforeEach(() => {
vi.useFakeTimers();
vi.setSystemTime(new Date('2024-01-01T00:00:00Z'));
});
afterEach(() => {
vi.useRealTimers();
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/__for-testing__/main.ts | code/core/src/core-server/__for-testing__/main.ts | /// <reference types="node" />
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import type { StorybookConfig } from '@storybook/react-webpack5';
const config: StorybookConfig = {
stories: [
'../../core/src/manager/**/*.stories.@(ts|tsx|js|jsx|mdx)',
'../../core/src/components/**/*... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/presets/common-override-preset.ts | code/core/src/core-server/presets/common-override-preset.ts | import type { PresetProperty, TestBuildFlags } from 'storybook/internal/types';
import { removeMDXEntries } from '../utils/remove-mdx-entries';
export const framework: PresetProperty<'framework'> = async (config) => {
// This will get called with the values from the user's main config, but before
// framework pre... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/presets/common-manager.ts | code/core/src/core-server/presets/common-manager.ts | /* these imports are in the exact order in which the panels need to be registered */
import { global } from '@storybook/global';
import { addons } from 'storybook/manager-api';
// THE ORDER OF THESE IMPORTS MATTERS! IT DEFINES THE ORDER OF PANELS AND TOOLS!
import controlsManager from '../../controls/manager';
import... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/presets/common-preset.ts | code/core/src/core-server/presets/common-preset.ts | import { existsSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
import type { Channel } from 'storybook/internal/channels';
import { normalizeStories, optionalEnvToBoolean } from 'storybook/internal/common';
import {
JsPackageManagerFactory,
type RemoveAddonOptions,
getDirectoryFromWorkingDir,... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/core-server/presets/favicon.test.ts | code/core/src/core-server/presets/favicon.test.ts | import * as fs from 'node:fs';
import { expect, it, vi } from 'vitest';
import { logger } from 'storybook/internal/node-logger';
import { type Presets } from 'storybook/internal/types';
import { dirname, join, normalize } from 'pathe';
import * as m from './common-preset';
// mock src/core-server/utils/constants.t... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/client-logger/index.test.ts | code/core/src/client-logger/index.test.ts | import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { logger } from '.';
vi.mock('@storybook/global', () => ({ global: { ...global, LOGLEVEL: 'debug' } }));
describe('client-logger default LOGLEVEL', () => {
const initialConsole = { ...global.console };
beforeEach(() => {
global.c... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/client-logger/index.ts | code/core/src/client-logger/index.ts | import { global } from '@storybook/global';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { LOGLEVEL } = global;
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
const levels: Record<LogLevel, number> = {
trace: 1,
debug: 2,
info: 3,
warn: 4,
err... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/preview-navigator.stories.tsx | code/core/src/preview/preview-navigator.stories.tsx | import type { StoryIndex } from 'storybook/internal/types';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import { setupPreviewNavigator, teardownPreviewNavigator } from './preview-navigator';
const meta: Meta = {
parameters: {
layout: 'fullscreen',
},
r... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/preview-navigator.ts | code/core/src/preview/preview-navigator.ts | import type { StoryIndex } from 'storybook/internal/types';
type LeafNode = {
name: string;
href: string;
id: string;
isActive: boolean;
};
type BranchNode = {
title: string;
entries: Record<string, BranchNode | LeafNode>;
isActive: boolean;
};
export async function maybeSetupPreviewNavigator() {
con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/typings.d.ts | code/core/src/preview/typings.d.ts | declare var LOGLEVEL: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | undefined;
declare var __STORYBOOK_ADDONS_CHANNEL__: any;
declare var __STORYBOOK_MODULE_CORE_EVENTS_PREVIEW_ERRORS__: any;
declare var sendTelemetryError: (error: any) => void;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/utils.ts | code/core/src/preview/utils.ts | import { global } from '@storybook/global';
import type { BrowserInfo } from 'browser-dtector';
import BrowserDetector from 'browser-dtector';
let browserInfo: BrowserInfo | undefined;
function getBrowserInfo() {
if (!browserInfo) {
browserInfo = new BrowserDetector(global.navigator?.userAgent).getBrowserInfo(... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/runtime.ts | code/core/src/preview/runtime.ts | import { MANAGER_INERT_ATTRIBUTE_CHANGED, TELEMETRY_ERROR } from 'storybook/internal/core-events';
import { global } from '@storybook/global';
import { globalPackages, globalsNameReferenceMap } from './globals/globals';
import { globalsNameValueMap } from './globals/runtime';
import { maybeSetupPreviewNavigator } fro... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/globals.ts | code/core/src/preview/globals.ts | export * from './globals/globals';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/globals/runtime.ts | code/core/src/preview/globals/runtime.ts | import * as CHANNELS from 'storybook/internal/channels';
import * as CLIENT_LOGGER from 'storybook/internal/client-logger';
import * as CORE_EVENTS from 'storybook/internal/core-events';
import * as CORE_EVENTS_PREVIEW_ERRORS from 'storybook/internal/preview-errors';
import * as TYPES from 'storybook/internal/types';
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview/globals/globals.ts | code/core/src/preview/globals/globals.ts | // Here we map the name of a module to their REFERENCE in the global scope.
export const globalsNameReferenceMap = {
'@storybook/global': '__STORYBOOK_MODULE_GLOBAL__',
'storybook/test': '__STORYBOOK_MODULE_TEST__',
'storybook/actions': '__STORYBOOK_MODULE_ACTIONS__',
'storybook/preview-api': '__STORYBOOK_MOD... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/global.ts | code/core/src/theming/global.ts | import memoize from 'memoizerific';
import type { Background, Color, Typography } from './types';
type Value = string | number;
interface Return {
[key: string]: {
[key: string]: Value;
};
}
export const createReset = memoize(1)(
({ typography }: { typography: Typography }): Return => ({
body: {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/utils.ts | code/core/src/theming/utils.ts | import { logger } from 'storybook/internal/client-logger';
import { global } from '@storybook/global';
import { darken, lighten, rgba } from 'polished';
const { window: globalWindow } = global;
export const mkColor = (color: string) => ({ color });
// Check if it is a string. This is for the sake of warning users
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/create.ts | code/core/src/theming/create.ts | // This generates theme variables in the correct shape for the UI
import darkThemeVars from './themes/dark';
import lightThemeVars from './themes/light';
import type { ThemeVars, ThemeVarsPartial } from './types';
import { getPreferredColorScheme } from './utils';
interface Themes {
light: ThemeVars;
dark: ThemeVa... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/convert.ts | code/core/src/theming/convert.ts | import { opacify } from 'polished';
import { animation, easing } from './animation';
import { background, color, tokens, typography } from './base';
import { themes } from './create';
import { chromeDark, chromeLight, create as createSyntax } from './modules/syntax';
import type { Color, StorybookTheme, ThemeVars, The... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/base.ts | code/core/src/theming/base.ts | export const color = {
// Official color palette
primary: '#FF4785', // coral
secondary: '#006DEB', // ocean
tertiary: '#FAFBFC',
ancillary: '#22a699',
// Complimentary
orange: '#FC521F',
gold: '#FFAE00',
green: '#66BF3C',
seafoam: '#37D5D3',
purple: '#6F2CAC',
ultraviolet: '#2A0481',
// Mon... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/ensure.ts | code/core/src/theming/ensure.ts | import { logger } from 'storybook/internal/client-logger';
import { deletedDiff } from 'deep-object-diff';
import { dedent } from 'ts-dedent';
import { convert } from './convert';
import light from './themes/light';
import type { StorybookTheme, ThemeVars } from './types';
export const ensure = (input: ThemeVars): S... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/types.ts | code/core/src/theming/types.ts | import type { animation, easing } from './animation';
import type { background, color, tokens, typography } from './base';
export interface ThemeVars extends ThemeVarsBase, ThemeVarsColors {}
export interface ThemeVarsPartial extends ThemeVarsBase, Partial<ThemeVarsColors> {}
interface ThemeVarsBase {
base: 'light... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/index.ts | code/core/src/theming/index.ts | /// <reference path="../typings.d.ts" />
import type { FunctionInterpolation, Interpolation } from '@emotion/react';
import type { StorybookTheme } from './types';
export { default as styled } from '@emotion/styled';
export type { StyledComponent } from '@emotion/styled';
export {
CacheProvider,
ClassNames,
c... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/animation.ts | code/core/src/theming/animation.ts | import type { Keyframes, SerializedStyles } from '@emotion/react';
import { css, keyframes } from '@emotion/react';
export const easing = {
rubber: 'cubic-bezier(0.175, 0.885, 0.335, 1.05)',
};
const rotate360: Keyframes = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;
co... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/modules/syntax.ts | code/core/src/theming/modules/syntax.ts | import { mkColor } from '../utils';
interface ColorsHash {
[key: string]: string;
}
interface ColorsObjectsHash {
[key: string]: {
color: string;
};
}
export const chromeDark = {
BASE_FONT_FAMILY: 'Menlo, monospace',
BASE_FONT_SIZE: '11px',
BASE_LINE_HEIGHT: 1.2,
BASE_BACKGROUND_COLOR: 'rgb(36, 36,... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/themes/dark.ts | code/core/src/theming/themes/dark.ts | import { color, typography } from '../base';
import type { ThemeVars } from '../types';
const theme: ThemeVars = {
base: 'dark',
// Storybook-specific color palette
colorPrimary: '#FF4785', // coral
colorSecondary: '#479DFF',
// UI
appBg: '#1B1C1D',
appContentBg: '#222325',
appHoverBg: '#233952',
a... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/theming/themes/light.ts | code/core/src/theming/themes/light.ts | import { background, color, typography } from '../base';
import type { ThemeVars } from '../types';
const theme: ThemeVars = {
base: 'light',
// Storybook-specific color palette
colorPrimary: color.primary,
colorSecondary: color.secondary,
// UI
appBg: background.app,
appContentBg: color.lightest,
ap... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/index.test.ts | code/core/src/node-logger/index.test.ts | import { describe, expect, it, vi } from 'vitest';
import npmlog from 'npmlog';
import { logger } from '.';
import * as loggerRaw from './logger/logger';
vi.mock('./logger/logger', () => ({
log: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
debug: vi.fn(),
info: vi.fn(),
setLogLevel: vi.fn(),
}));
const logge... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/tasks.test.ts | code/core/src/node-logger/tasks.test.ts | import { describe, expect, it, vi } from 'vitest';
// eslint-disable-next-line depend/ban-dependencies
import type { ResultPromise } from 'execa';
import { executeTaskWithSpinner } from './tasks';
// Create a minimal fake ResultPromise
const makeChild = (onStart?: (cp: Partial<ResultPromise>) => void): ResultPromise... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/tasks.ts | code/core/src/node-logger/tasks.ts | // eslint-disable-next-line depend/ban-dependencies
import type { ResultPromise } from 'execa';
import { CLI_COLORS, log } from './logger';
import { logTracker } from './logger/log-tracker';
import { spinner } from './prompts/prompt-functions';
type ChildProcessFactory = (signal?: AbortSignal) => ResultPromise;
inte... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/wrap-utils.ts | code/core/src/node-logger/wrap-utils.ts | import { S_BAR } from '@clack/prompts';
import { cyan, dim, reset } from 'picocolors';
import wrapAnsi from 'wrap-ansi';
// Text wrapping utility for Clack output
function getTerminalWidth(): number {
// Default terminal width, fallback for when we can't determine it
const defaultWidth = 80;
try {
// Use pr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/wrap-utils.test.ts | code/core/src/node-logger/wrap-utils.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
// eslint-disable-next-line depend/ban-dependencies
import { execaSync } from 'execa';
import {
getTerminalWidth,
protectUrls,
wrapTextForClack,
wrapTextForClackHint,
} from './wrap-utils';
// Mock dependencies at the top with spy: true option
vi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/index.ts | code/core/src/node-logger/index.ts | /// <reference types="node" />
import npmLog from 'npmlog';
import prettyTime from 'pretty-hrtime';
import * as newLogger from './logger/logger';
export { prompt } from './prompts';
export { logTracker } from './logger/log-tracker';
export type { SpinnerInstance, TaskLogInstance } from './prompts/prompt-provider-base... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/logger/log-tracker.ts | code/core/src/node-logger/logger/log-tracker.ts | import { promises as fs } from 'node:fs';
import { join } from 'node:path';
import type { LogLevel } from './logger';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Metadata = Record<string, any>;
export interface LogEntry {
timestamp: Date;
level: LogLevel | 'prompt';
message: string;
me... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/logger/colors.ts | code/core/src/node-logger/logger/colors.ts | import picocolors from 'picocolors';
export const CLI_COLORS = {
success: picocolors.green,
error: picocolors.red,
warning: picocolors.yellow,
// Improve contrast on dark terminals by using cyan for info on all platforms
info: picocolors.cyan,
debug: picocolors.gray,
// Only color a link if it is the pri... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/logger/logger.ts | code/core/src/node-logger/logger/logger.ts | import * as clack from '@clack/prompts';
import { isClackEnabled } from '../prompts/prompt-config';
import { getCurrentTaskLog } from '../prompts/prompt-provider-clack';
import { wrapTextForClack } from '../wrap-utils';
import { CLI_COLORS } from './colors';
import { logTracker } from './log-tracker';
const createLog... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/logger/console.ts | code/core/src/node-logger/logger/console.ts | import picocolors from 'picocolors';
import { debug, error, log, warn } from './logger';
interface ConsoleLoggerOptions {
prefix: string;
color:
| 'bgBlack'
| 'bgRed'
| 'bgGreen'
| 'bgYellow'
| 'bgBlue'
| 'bgMagenta'
| 'bgCyan'
| 'bgWhite'
| 'bgBlackBright'
| 'bgRedBright'
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/logger/index.ts | code/core/src/node-logger/logger/index.ts | export * from './logger';
export * from './log-tracker';
export * from './colors';
export * from './console';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/prompts/prompt-functions.ts | code/core/src/node-logger/prompts/prompt-functions.ts | import { error, log, shouldLog } from '../logger';
import { wrapTextForClack, wrapTextForClackHint } from '../wrap-utils';
import { getPromptProvider } from './prompt-config';
import type {
BasePromptOptions,
ConfirmPromptOptions,
MultiSelectPromptOptions,
Option,
PromptOptions,
SelectPromptOptions,
Spinn... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/prompts/prompt-provider-base.ts | code/core/src/node-logger/prompts/prompt-provider-base.ts | type Primitive = Readonly<string | boolean | number>;
export type Option<T> = T extends Primitive
? {
value: T;
label?: string;
hint?: string;
}
: {
value: T;
label: string;
hint?: string;
};
export interface BasePromptOptions {
message: string;
}
export interface Te... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/prompts/prompt-provider-clack.ts | code/core/src/node-logger/prompts/prompt-provider-clack.ts | import * as clack from '@clack/prompts';
import { logTracker } from '../logger/log-tracker';
import { wrapTextForClackHint } from '../wrap-utils';
import type {
ConfirmPromptOptions,
MultiSelectPromptOptions,
PromptOptions,
SelectPromptOptions,
SpinnerInstance,
SpinnerOptions,
TaskLogInstance,
TaskLogO... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/prompts/index.ts | code/core/src/node-logger/prompts/index.ts | import { executeTask, executeTaskWithSpinner } from '../tasks';
import * as promptConfig from './prompt-config';
import * as promptFunctions from './prompt-functions';
export const prompt = {
...promptFunctions,
...promptConfig,
executeTask,
executeTaskWithSpinner,
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/prompts/storage.ts | code/core/src/node-logger/prompts/storage.ts | import { AsyncLocalStorage } from 'node:async_hooks';
const asyncLocalStorage = new AsyncLocalStorage();
export { asyncLocalStorage };
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/node-logger/prompts/prompt-config.ts | code/core/src/node-logger/prompts/prompt-config.ts | import type { PromptProvider } from './prompt-provider-base';
import { ClackPromptProvider } from './prompt-provider-clack';
type PromptLibrary = 'clack';
const PROVIDERS = {
clack: new ClackPromptProvider(),
} as const;
let currentPromptLibrary: PromptLibrary = 'clack';
export const setPromptLibrary = (library: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/extract.test.ts | code/core/src/mocking-utils/extract.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import { parse } from '@babel/parser';
import { readFileSync } from 'fs';
import * as extractModule from './extract';
import * as resolveModule from './resolve';
vi.mock('fs', async () => {
const actual = await vi.importActual<typeof import('fs')>('fs'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/extract.ts | code/core/src/mocking-utils/extract.ts | import { readFileSync } from 'node:fs';
import { generate, parser, types as t } from 'storybook/internal/babel';
import { logger } from 'storybook/internal/node-logger';
import { telemetry } from 'storybook/internal/telemetry';
import type { CoreConfig } from 'storybook/internal/types';
import { transformSync } from ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/esmWalker.ts | code/core/src/mocking-utils/esmWalker.ts | // TODO: Remove as soon as https://github.com/vitest-dev/vitest/pull/8301 is released and we use it
/**
* Copyright (c) Vitest
* https://github.com/vitest-dev/vitest/blob/v3.2.4/packages/mocker/src/node/esmWalker.ts MIT
* License
*
* Copyright (c) 2021-Present Vitest Team
*
* Permission is hereby granted, free o... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/runtime.ts | code/core/src/mocking-utils/runtime.ts | import { resolvePackageDir } from 'storybook/internal/common';
import { buildSync } from 'esbuild';
import { join } from 'pathe';
const runtimeTemplatePath = join(
resolvePackageDir('storybook'),
'assets',
'server',
'mocker-runtime.template.js'
);
export function getMockerRuntime() {
// Use esbuild to bund... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/resolve.ts | code/core/src/mocking-utils/resolve.ts | import { readFileSync, realpathSync } from 'node:fs';
import { createRequire } from 'node:module';
import { dirname, isAbsolute, join, resolve } from 'pathe';
import { exports as resolveExports } from 'resolve.exports';
import { isModuleDirectory } from './extract';
const require = createRequire(import.meta.url);
/... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/automock.ts | code/core/src/mocking-utils/automock.ts | import type {
Declaration,
ExportDefaultDeclaration,
ExportNamedDeclaration,
Expression,
Pattern,
Program,
} from 'estree';
import MagicString from 'magic-string';
import { type Positioned, getArbitraryModuleIdentifier } from './esmWalker';
type ParseFn = (code: string) => Program;
export const __STORYBO... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/mocking-utils/index.ts | code/core/src/mocking-utils/index.ts | export * from './automock';
export * from './extract';
export * from './resolve';
export * from './esmWalker';
export * from './runtime';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/csf-tools/findVarInitialization.ts | code/core/src/csf-tools/findVarInitialization.ts | import { types as t } from 'storybook/internal/babel';
export const findVarInitialization = (identifier: string, program: t.Program): t.Expression => {
let init: t.Expression = null as any;
let declarations: t.VariableDeclarator[] = null as any;
program.body.find((node: t.Node) => {
if (t.isVariableDeclarati... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/csf-tools/enrichCsf.test.ts | code/core/src/csf-tools/enrichCsf.test.ts | import { describe, expect, it } from 'vitest';
import { dedent } from 'ts-dedent';
import { formatCsf, loadCsf } from './CsfFile';
import type { EnrichCsfOptions } from './enrichCsf';
import { enrichCsf, extractSource } from './enrichCsf';
expect.addSnapshotSerializer({
print: (val: any) => val.replace(/\\r\\n/gm,... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/csf-tools/getStorySortParameter.ts | code/core/src/csf-tools/getStorySortParameter.ts | import { babelParse, generate, types as t, traverse } from 'storybook/internal/babel';
import { logger } from 'storybook/internal/node-logger';
import { dedent } from 'ts-dedent';
import { findVarInitialization } from './findVarInitialization';
const getValue = (obj: t.ObjectExpression, key: string) => {
let value... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/csf-tools/PrintResultType.ts | code/core/src/csf-tools/PrintResultType.ts | export interface PrintResultType {
code: string;
map?: any;
toString(): string;
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/csf-tools/storyIndexer.test.ts | code/core/src/csf-tools/storyIndexer.test.ts | import { describe, expect, it } from 'vitest';
import { loadCsf } from './CsfFile';
const getIndex = (code: string) => {
const inputs = loadCsf(code, { makeTitle: () => 'title', fileName: 'a.stories.ts' }).parse()
.indexInputs;
return {
raw: inputs,
entries: inputs.map((i) => i.name),
};
};
descri... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/csf-tools/ConfigFile.test.ts | code/core/src/csf-tools/ConfigFile.test.ts | import { describe, expect, it } from 'vitest';
import { babelPrint } from 'storybook/internal/babel';
import { dedent } from 'ts-dedent';
import { loadConfig, printConfig } from './ConfigFile';
expect.addSnapshotSerializer({
serialize: (val: any) => (typeof val === 'string' ? val : val.toString()),
test: (val) ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.