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/frameworks/react-native-web-vite/src/vite-plugin.ts | code/frameworks/react-native-web-vite/src/vite-plugin.ts | import { rnw } from 'vite-plugin-rnw';
import tsconfigPaths from 'vite-tsconfig-paths';
export const storybookReactNativeWeb = () => {
return [
tsconfigPaths(),
rnw({
jsxRuntime: 'automatic',
}),
];
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/src/types.ts | code/frameworks/react-native-web-vite/src/types.ts | import type { CompatibleString } from 'storybook/internal/types';
import type {
FrameworkOptions as FrameworkOptionsBase,
StorybookConfig as StorybookConfigBase,
} from '@storybook/react-vite';
import type { RnwOptions } from 'vite-plugin-rnw';
export type FrameworkOptions = FrameworkOptionsBase & {
/**
* M... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/src/index.ts | code/frameworks/react-native-web-vite/src/index.ts | export type { FrameworkOptions, StorybookConfig } from './types';
export { __definePreview as definePreview } from '@storybook/react';
export * from '@storybook/react';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/src/node/index.ts | code/frameworks/react-native-web-vite/src/node/index.ts | import type { StorybookConfig } from '../types';
export function defineMain(config: StorybookConfig) {
return config;
}
export type { StorybookConfig };
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/template/cli/ts/Header.stories.tsx | code/frameworks/react-native-web-vite/template/cli/ts/Header.stories.tsx | import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
import { Header } from './Header';
const meta = {
title: 'Example/Header',
component: Header,
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
}... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/template/cli/ts/Button.stories.tsx | code/frameworks/react-native-web-vite/template/cli/ts/Button.stories.tsx | import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
import { View } from 'react-native';
import { fn } from 'storybook/test';
import { Button } from './Button';
const meta = {
title: 'Example/Button',
component: Button,
decorators: [
(Story) => (
<View style={{ flex: 1, alignItems... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/template/cli/ts/Page.stories.tsx | code/frameworks/react-native-web-vite/template/cli/ts/Page.stories.tsx | import type { Meta } from '@storybook/react-native-web-vite';
import { expect, userEvent, within } from 'storybook/test';
import { Page } from './Page';
export default {
title: 'Example/Page',
component: Page,
} as Meta<typeof Page>;
export const LoggedIn = {
play: async ({ canvasElement }) => {
const can... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/template/cli/ts/Button.tsx | code/frameworks/react-native-web-vite/template/cli/ts/Button.tsx | import type { StyleProp, ViewStyle } from 'react-native';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
export interface ButtonProps {
/** Is this the principal call to action on the page? */
primary?: boolean;
/** What background color to use */
backgroundColor?: string;
/** How l... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/template/cli/ts/Page.tsx | code/frameworks/react-native-web-vite/template/cli/ts/Page.tsx | import { useState } from 'react';
import { Linking, StyleSheet, Text, View } from 'react-native';
import { Header } from './Header';
export const Page = () => {
const [user, setUser] = useState<{ name: string } | undefined>();
return (
<View>
<Header
user={user}
onLogin={() => setUser(... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-native-web-vite/template/cli/ts/Header.tsx | code/frameworks/react-native-web-vite/template/cli/ts/Header.tsx | import { StyleSheet, Text, View } from 'react-native';
import { Button } from './Button';
export type HeaderProps = {
user?: { name: string };
onLogin: () => void;
onLogout: () => void;
onCreateAccount: () => void;
};
export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => (
<V... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/vitest.config.ts | code/frameworks/ember/vitest.config.ts | import { defineConfig, mergeConfig } from 'vitest/config';
import { vitestCommonConfig } from '../../vitest.shared';
export default mergeConfig(
vitestCommonConfig,
defineConfig({
// Add custom config here
})
);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/build-config.ts | code/frameworks/ember/build-config.ts | import type { BuildEntries } from '../../../scripts/build/utils/entry-utils';
const config: BuildEntries = {
entries: {
browser: [
{
exportEntries: ['.'],
entryPoint: './src/index.ts',
},
],
node: [
{
exportEntries: ['./node'],
entryPoint: './src/node/ind... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/typings.d.ts | code/frameworks/ember/src/typings.d.ts | declare module 'ember-source/dist/ember-template-compiler.js';
declare var STORYBOOK_ENV: 'ember';
declare var STORYBOOK_NAME: any;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/util.ts | code/frameworks/ember/src/util.ts | import { dirname, join } from 'node:path';
import { getProjectRoot } from 'storybook/internal/common';
import * as pkg from 'empathic/package';
export const findDistFile = (cwd: string, relativePath: string) => {
const nearestPackageJson = pkg.up({ cwd, last: getProjectRoot() });
if (!nearestPackageJson) {
t... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/preset.ts | code/frameworks/ember/src/preset.ts | import { getProjectRoot, resolvePathInStorybookCache } from 'storybook/internal/common';
import type { PresetProperty } from 'storybook/internal/types';
import { getVirtualModules } from '@storybook/builder-webpack5';
import type { StorybookConfig } from './types';
export const addons: PresetProperty<'addons'> = [
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/types.ts | code/frameworks/ember/src/types.ts | import type { CompatibleString } from 'storybook/internal/types';
import type {
BuilderOptions,
StorybookConfigWebpack,
TypescriptOptions as TypescriptOptionsBuilder,
} from '@storybook/builder-webpack5';
import type {
StorybookConfig as StorybookConfigBase,
TypescriptOptions as TypescriptOptionsReact,
} fro... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/index.ts | code/frameworks/ember/src/index.ts | export * from './types';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/node/index.ts | code/frameworks/ember/src/node/index.ts | import type { StorybookConfig } from '../types';
export function defineMain(config: StorybookConfig) {
return config;
}
export type { StorybookConfig };
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/server/framework-preset-babel-ember.ts | code/frameworks/ember/src/server/framework-preset-babel-ember.ts | import type { PresetProperty, PresetPropertyFn } from 'storybook/internal/types';
import type { TransformOptions } from '@babel/core';
import { precompile } from 'ember-source/dist/ember-template-compiler.js';
import { findDistFile } from '../util';
let emberOptions: any;
function precompileWithPlugins(string: stri... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/client/preview/config.ts | code/frameworks/ember/src/client/preview/config.ts | import { enhanceArgTypes } from 'storybook/internal/docs-tools';
import type { ArgTypesEnhancer } from 'storybook/internal/types';
import './globals';
import { extractArgTypes, extractComponentDescription } from './jsondoc';
export { renderToCanvas } from './render';
export const parameters = {
renderer: 'ember',
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/client/preview/render.ts | code/frameworks/ember/src/client/preview/render.ts | import type { RenderContext } from 'storybook/internal/types';
import { global } from '@storybook/global';
import { dedent } from 'ts-dedent';
import type { EmberRenderer, OptionsArgs } from './types';
const { document } = global;
declare let Ember: any;
const rootEl = document.getElementById('storybook-root');
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/client/preview/jsondoc.ts | code/frameworks/ember/src/client/preview/jsondoc.ts | import { global } from '@storybook/global';
export const getJSONDoc = () => {
return global.__EMBER_GENERATED_DOC_JSON__;
};
export const extractArgTypes = (componentName: string) => {
const json = getJSONDoc();
if (!(json && json.included)) {
return null;
}
const componentDoc = json.included.find((doc:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/client/preview/types.ts | code/frameworks/ember/src/client/preview/types.ts | import type { WebRenderer } from 'storybook/internal/types';
export type { RenderContext } from 'storybook/internal/types';
export interface ShowErrorArgs {
title: string;
description: string;
}
export interface OptionsArgs {
template: any;
context: any;
element: any;
}
export interface EmberRenderer exte... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/ember/src/client/preview/globals.ts | code/frameworks/ember/src/client/preview/globals.ts | import { global } from '@storybook/global';
global.STORYBOOK_NAME = process.env.STORYBOOK_NAME;
global.STORYBOOK_ENV = 'ember';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/vitest.config.ts | code/frameworks/react-vite/vitest.config.ts | import { defineConfig, mergeConfig } from 'vitest/config';
import { vitestCommonConfig } from '../../vitest.shared';
export default mergeConfig(
vitestCommonConfig,
defineConfig({
// Add custom config here
})
);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/build-config.ts | code/frameworks/react-vite/build-config.ts | import type { BuildEntries } from '../../../scripts/build/utils/entry-utils';
const config: BuildEntries = {
entries: {
browser: [
{
exportEntries: ['.'],
entryPoint: './src/index.ts',
},
],
node: [
{
exportEntries: ['./preset'],
entryPoint: './src/preset... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/preset.ts | code/frameworks/react-vite/src/preset.ts | import type { PresetProperty } from 'storybook/internal/types';
import type { StorybookConfig } from './types';
export const core: PresetProperty<'core'> = {
builder: import.meta.resolve('@storybook/builder-vite'),
renderer: import.meta.resolve('@storybook/react/preset'),
};
export const viteFinal: NonNullable<S... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/types.ts | code/frameworks/react-vite/src/types.ts | import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
TypescriptOptions as TypescriptOptionsBase,
} from 'storybook/internal/types';
import type { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';
import type docgenTypescript from '@joshwooding/vite-plugin-react-docgen-type... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/index.ts | code/frameworks/react-vite/src/index.ts | export * from '@storybook/react';
export { __definePreview as definePreview } from '@storybook/react';
export * from './types';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/node/index.ts | code/frameworks/react-vite/src/node/index.ts | import type { StorybookConfig } from '../types';
export function defineMain(config: StorybookConfig) {
return config;
}
export type { StorybookConfig };
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/plugins/react-docgen.ts | code/frameworks/react-vite/src/plugins/react-docgen.ts | import { existsSync } from 'node:fs';
import { relative, sep } from 'node:path';
import { getProjectRoot } from 'storybook/internal/common';
import { logger } from 'storybook/internal/node-logger';
import { createFilter } from '@rollup/pluginutils';
import * as find from 'empathic/find';
import MagicString from 'magi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/plugins/react-docgen.test.ts | code/frameworks/react-vite/src/plugins/react-docgen.test.ts | import { describe, expect, it, vi } from 'vitest';
import { getReactDocgenImporter } from './react-docgen';
const reactDocgenMock = vi.hoisted(() => {
return {
makeFsImporter: vi.fn().mockImplementation((fn) => fn),
};
});
const reactDocgenResolverMock = vi.hoisted(() => {
return {
defaultLookupModule:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/plugins/docgen-resolver.ts | code/frameworks/react-vite/src/plugins/docgen-resolver.ts | import { extname } from 'node:path';
import resolve from 'resolve';
export class ReactDocgenResolveError extends Error {
// the magic string that react-docgen uses to check if a module is ignored
readonly code = 'MODULE_NOT_FOUND';
constructor(filename: string) {
super(`'${filename}' was ignored by react-d... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/src/plugins/docgen-handlers/actualNameHandler.ts | code/frameworks/react-vite/src/plugins/docgen-handlers/actualNameHandler.ts | /**
* This is heavily based on the react-docgen `displayNameHandler`
* (https://github.com/reactjs/react-docgen/blob/26c90c0dd105bf83499a83826f2a6ff7a724620d/src/handlers/displayNameHandler.ts)
* but instead defines an `actualName` property on the generated docs that is taken first from the
* component's actual nam... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/template/cli/ts/Button.stories.ts | code/frameworks/react-vite/template/cli/ts/Button.stories.ts | import type { Meta, StoryObj } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import { Button } from './Button';
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const meta = {
title: 'Example/Button',
component: Button,
parameters: {
// ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/template/cli/ts/Page.stories.ts | code/frameworks/react-vite/template/cli/ts/Page.stories.ts | import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { Page } from './Page';
const meta = {
title: 'Example/Page',
component: Page,
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-l... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/template/cli/ts/Button.tsx | code/frameworks/react-vite/template/cli/ts/Button.tsx | import React from 'react';
import './button.css';
export interface ButtonProps {
/** Is this the principal call to action on the page? */
primary?: boolean;
/** What background color to use */
backgroundColor?: string;
/** How large should the button be? */
size?: 'small' | 'medium' | 'large';
/** Butto... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/template/cli/ts/Header.stories.ts | code/frameworks/react-vite/template/cli/ts/Header.stories.ts | import type { Meta, StoryObj } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import { Header } from './Header';
const meta = {
title: 'Example/Header',
component: Header,
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autod... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/template/cli/ts/Page.tsx | code/frameworks/react-vite/template/cli/ts/Page.tsx | import React from 'react';
import { Header } from './Header';
import './page.css';
type User = {
name: string;
};
export const Page: React.FC = () => {
const [user, setUser] = React.useState<User>();
return (
<article>
<Header
user={user}
onLogin={() => setUser({ name: 'Jane Doe' })}... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/react-vite/template/cli/ts/Header.tsx | code/frameworks/react-vite/template/cli/ts/Header.tsx | import React from 'react';
import { Button } from './Button';
import './header.css';
type User = {
name: string;
};
export interface HeaderProps {
user?: User;
onLogin?: () => void;
onLogout?: () => void;
onCreateAccount?: () => void;
}
export const Header = ({ user, onLogin, onLogout, onCreateAccount }: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/vitest.config.ts | code/frameworks/nextjs/vitest.config.ts | import { defineConfig, mergeConfig } from 'vitest/config';
import { vitestCommonConfig } from '../../vitest.shared';
export default mergeConfig(
vitestCommonConfig,
defineConfig({
// Add custom config here
})
);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/build-config.ts | code/frameworks/nextjs/build-config.ts | import type { BuildEntries } from '../../../scripts/build/utils/entry-utils';
const config: BuildEntries = {
entries: {
browser: [
{
exportEntries: ['.'],
entryPoint: './src/index.ts',
},
{
exportEntries: ['./preview'],
entryPoint: './src/preview.tsx',
},
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/globals.d.ts | code/frameworks/nextjs/src/globals.d.ts | declare module 'next/dist/compiled';
declare module 'next/dist/compiled/babel/plugin-transform-modules-commonjs';
declare module 'next/dist/compiled/babel/plugin-syntax-jsx';
declare module 'next/dist/compiled/loader-utils3/index.js';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/preview.tsx | code/frameworks/nextjs/src/preview.tsx | import type { Addon_DecoratorFunction, Addon_LoaderFunction } from 'storybook/internal/types';
// We need this import to be a singleton, and because it's used in multiple entrypoints
// both in ESM and CJS, importing it via the package name instead of having a local import
// is the only way to achieve it actually bei... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/utils.ts | code/frameworks/nextjs/src/utils.ts | import { readFileSync } from 'node:fs';
import { dirname, join, sep } from 'node:path';
import { fileURLToPath } from 'node:url';
import { getProjectRoot } from 'storybook/internal/common';
import { WebpackDefinePlugin } from '@storybook/builder-webpack5';
import type { NextConfig } from 'next';
import { PHASE_DEVEL... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/image-context.ts | code/frameworks/nextjs/src/image-context.ts | import { createContext } from 'react';
import type { ImageProps, StaticImageData } from 'next/image';
import type { ImageProps as LegacyImageProps } from 'next/legacy/image';
// StaticRequire needs to be in scope for the TypeScript compiler to work.
// See: https://github.com/microsoft/TypeScript/issues/5711
// Since... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/preset.ts | code/frameworks/nextjs/src/preset.ts | // https://storybook.js.org/docs/react/addons/writing-presets
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { getProjectRoot } from 'storybook/internal/common';
import { logger } from 'storybook/internal/node-logger';
import type { PresetProper... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/next-image-loader-stub.ts | code/frameworks/nextjs/src/next-image-loader-stub.ts | import { imageSize } from 'image-size';
import { interpolateName } from 'loader-utils';
import type { NextConfig } from 'next';
import type { RawLoaderDefinition } from 'webpack';
interface LoaderOptions {
filename: string;
nextConfig: NextConfig;
}
const nextImageLoaderStub: RawLoaderDefinition<LoaderOptions> = ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/types.ts | code/frameworks/nextjs/src/types.ts | import type { CompatibleString } from 'storybook/internal/types';
import type {
BuilderOptions,
StorybookConfigWebpack,
TypescriptOptions as TypescriptOptionsBuilder,
} from '@storybook/builder-webpack5';
import type {
ReactOptions,
StorybookConfig as StorybookConfigBase,
TypescriptOptions as TypescriptOpt... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/portable-stories.ts | code/frameworks/nextjs/src/portable-stories.ts | import type {
Args,
ComposedStoryFn,
NamedOrDefaultProjectAnnotations,
NormalizedProjectAnnotations,
ProjectAnnotations,
Store_CSFExports,
StoriesWithPartialProps,
StoryAnnotationsOrFn,
} from 'storybook/internal/types';
import type { Meta, ReactRenderer } from '@storybook/react';
import {
composeCo... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/index.ts | code/frameworks/nextjs/src/index.ts | import type { AddonTypes, InferTypes, PreviewAddon } from 'storybook/internal/csf';
import type { ProjectAnnotations } from 'storybook/internal/types';
import type { ReactPreview } from '@storybook/react';
import { __definePreview } from '@storybook/react';
import type { ReactTypes } from '@storybook/react';
import *... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/webpack.ts | code/frameworks/nextjs/src/export-mocks/webpack.ts | import type { Configuration as WebpackConfig } from 'webpack';
import { getCompatibilityAliases } from '../compatibility/compatibility-map';
const mapping = {
'next/headers': '@storybook/nextjs/headers.mock',
'next/navigation': '@storybook/nextjs/navigation.mock',
'next/router': '@storybook/nextjs/router.mock',... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/index.ts | code/frameworks/nextjs/src/export-mocks/index.ts | export { getPackageAliases } from './webpack';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/cache/index.ts | code/frameworks/nextjs/src/export-mocks/cache/index.ts | import { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache.js';
import { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store.js';
import { fn } from 'storybook/test';
// mock utilities/overrides (as of Next v14.2.0)
const revalidatePath = fn().mockName('next/cache::re... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/headers/headers.ts | code/frameworks/nextjs/src/export-mocks/headers/headers.ts | import { HeadersAdapter } from 'next/dist/server/web/spec-extension/adapters/headers.js';
import { fn } from 'storybook/test';
class HeadersAdapterMock extends HeadersAdapter {
constructor() {
super({});
}
append = fn(super.append.bind(this)).mockName('next/headers::headers().append');
delete = fn(super.... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/headers/cookies.ts | code/frameworks/nextjs/src/export-mocks/headers/cookies.ts | // We need this import to be a singleton, and because it's used in multiple entrypoints
// both in ESM and CJS, importing it via the package name instead of having a local import
// is the only way to achieve it actually being a singleton
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore we mu... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/headers/index.ts | code/frameworks/nextjs/src/export-mocks/headers/index.ts | import * as headers from 'next/dist/server/request/headers.js';
import { fn } from 'storybook/test';
// re-exports of the actual module
export * from 'next/dist/server/request/headers.js';
// mock utilities/overrides (as of Next v14.2.0)
export { headers } from './headers';
export { cookies } from './cookies';
// pa... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/navigation/index.ts | code/frameworks/nextjs/src/export-mocks/navigation/index.ts | import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
import * as actual from 'next/dist/client/components/navigation.js';
import { RedirectStatusCode } from 'next/dist/client/components/redirect-status-code.js';
import { getRedirectError } from 'next/dist/client/components/redirect.js';
i... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/export-mocks/router/index.ts | code/frameworks/nextjs/src/export-mocks/router/index.ts | import { NextjsRouterMocksNotAvailable } from 'storybook/internal/preview-errors';
import singletonRouter, * as originalRouter from 'next/dist/client/router.js';
import type { NextRouter, SingletonRouter } from 'next/router';
import type { Mock } from 'storybook/test';
import { fn } from 'storybook/test';
const defau... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/styledJsx/decorator.tsx | code/frameworks/nextjs/src/styledJsx/decorator.tsx | import * as React from 'react';
import { StyleRegistry } from 'styled-jsx';
export const StyledJsxDecorator = (Story: React.FC): React.ReactNode => (
<StyleRegistry>
<Story />
</StyleRegistry>
);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/styledJsx/webpack.ts | code/frameworks/nextjs/src/styledJsx/webpack.ts | import type { Configuration as WebpackConfig } from 'webpack';
import { addScopedAlias } from '../utils';
export const configureStyledJsx = (baseConfig: WebpackConfig): void => {
addScopedAlias(baseConfig, 'styled-jsx');
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/configureNextFont.ts | code/frameworks/nextjs/src/font/webpack/configureNextFont.ts | import type { Configuration } from 'webpack';
export function configureNextFont(baseConfig: Configuration, isSWC?: boolean) {
if (isSWC) {
baseConfig.module?.rules?.push({
test: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/,
loader: '@storybook/nextjs/storybook-nextjs-font-loader',
});
} else {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/loader/storybook-nextjs-font-loader.ts | code/frameworks/nextjs/src/font/webpack/loader/storybook-nextjs-font-loader.ts | import { sep } from 'node:path';
import { getFontFaceDeclarations as getGoogleFontFaceDeclarations } from './google/get-font-face-declarations';
import { getFontFaceDeclarations as getLocalFontFaceDeclarations } from './local/get-font-face-declarations';
import type { LoaderOptions } from './types';
import { getCSSMet... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/loader/types.ts | code/frameworks/nextjs/src/font/webpack/loader/types.ts | export type LoaderOptions = {
/** Initial import name. Can be `next/font/google` or `next/font/local` */
source: string;
/** Props passed to the `next/font` function call */
props: Record<string, any>;
/** Font Family name */
fontFamily: string;
/** Filename of the issuer file, which imports `next/font/go... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/loader/utils/get-css-meta.ts | code/frameworks/nextjs/src/font/webpack/loader/utils/get-css-meta.ts | type Options = {
fontFamily: string;
styles: string[];
weights: string[];
fontFaceCSS: string;
variable?: string;
};
export function getCSSMeta(options: Options) {
const className = getClassName(options);
const style = getStylesObj(options);
const variableClassName = `__variable_${className}`;
const... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/loader/utils/set-font-declarations-in-head.ts | code/frameworks/nextjs/src/font/webpack/loader/utils/set-font-declarations-in-head.ts | type Props = {
id: string;
fontFaceCSS: string;
classNamesCSS: string;
};
export function setFontDeclarationsInHead({ id, fontFaceCSS, classNamesCSS }: Props) {
return `
if (!document.getElementById('id-${id}')) {
const fontDeclarations = \`${fontFaceCSS}\`;
const style = document.createElement... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/loader/google/get-font-face-declarations.ts | code/frameworks/nextjs/src/font/webpack/loader/google/get-font-face-declarations.ts | import {
GoogleFontsDownloadError,
GoogleFontsLoadingError,
} from 'storybook/internal/server-errors';
import { fetchCSSFromGoogleFonts } from 'next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js';
import { getFontAxes } from 'next/dist/compiled/@next/font/dist/google/get-font-axes.js';
import... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/webpack/loader/local/get-font-face-declarations.ts | code/frameworks/nextjs/src/font/webpack/loader/local/get-font-face-declarations.ts | import { dirname, join } from 'node:path';
import { getProjectRoot } from 'storybook/internal/common';
import { validateLocalFontFunctionCall } from 'next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js';
import loaderUtils from 'next/dist/compiled/loader-utils3/index.js';
import type { Load... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/babel/index.test.ts | code/frameworks/nextjs/src/font/babel/index.test.ts | import { expect, it } from 'vitest';
import { transform } from '@babel/core';
import TransformFontImports from '.';
const example = `
import { Inter, Lora as FontLora, Roboto } from 'next/font/google'
import localFont from 'next/font/local'
const myFont = localFont({ src: './my-font.woff2' })
const roboto = Roboto... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/babel/helpers.ts | code/frameworks/nextjs/src/font/babel/helpers.ts | import type * as BabelCoreNamespace from '@babel/core';
import type * as BabelTypesNamespace from '@babel/types';
type BabelTypes = typeof BabelTypesNamespace;
type PrimaryTypes = Record<string, any> | string | number | boolean | undefined | null;
export type JSReturnValue = PrimaryTypes | Array<PrimaryTypes>;
expor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/font/babel/index.ts | code/frameworks/nextjs/src/font/babel/index.ts | import type * as BabelCoreNamespace from '@babel/core';
import {
getVariableMetasBySpecifier,
isDefined,
removeTransformedVariableDeclarations,
replaceImportWithParameterImport,
} from './helpers';
type Babel = typeof BabelCoreNamespace;
/**
* Transforms "next/font" imports and usages to a webpack loader fr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/routing/app-router-provider.tsx | code/frameworks/nextjs/src/routing/app-router-provider.tsx | // We need this import to be a singleton, and because it's used in multiple entrypoints
// both in ESM and CJS, importing it via the package name instead of having a local import
// is the only way to achieve it actually being a singleton
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore we mu... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/routing/decorator.tsx | code/frameworks/nextjs/src/routing/decorator.tsx | import * as React from 'react';
import type { Addon_StoryContext } from 'storybook/internal/types';
import { RedirectBoundary } from 'next/dist/client/components/redirect-boundary.js';
import { AppRouterProvider } from './app-router-provider';
import { PageRouterProvider } from './page-router-provider';
import type ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/routing/page-router-provider.tsx | code/frameworks/nextjs/src/routing/page-router-provider.tsx | // We need this import to be a singleton, and because it's used in multiple entrypoints
// both in ESM and CJS, importing it via the package name instead of having a local import
// is the only way to achieve it actually being a singleton
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore we mu... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/routing/types.tsx | code/frameworks/nextjs/src/routing/types.tsx | export type RouteParams = {
pathname: string;
query: Record<string, string>;
[key: string]: any;
};
export type NextAppDirectory = boolean;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/fastRefresh/webpack.ts | code/frameworks/nextjs/src/fastRefresh/webpack.ts | import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
import type { Configuration as WebpackConfig } from 'webpack';
export const configureFastRefresh = (baseConfig: WebpackConfig): void => {
baseConfig.plugins = [
...(baseConfig.plugins ?? []),
// overlay is disabled as it is shown w... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/css/webpack.ts | code/frameworks/nextjs/src/css/webpack.ts | import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { NextConfig } from 'next';
import { cssFileResolve } from 'next/dist/build/webpack/config/blocks/css/loaders/file-resolve.js';
import { getCssModuleLocalIdent } from 'next/dist/build/webpack... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/node/index.ts | code/frameworks/nextjs/src/node/index.ts | import type { StorybookConfig } from '../types';
export function defineMain(config: StorybookConfig) {
return config;
}
export type { StorybookConfig };
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/head-manager/decorator.tsx | code/frameworks/nextjs/src/head-manager/decorator.tsx | import * as React from 'react';
import HeadManagerProvider from './head-manager-provider';
export const HeadManagerDecorator = (Story: React.FC): React.ReactNode => {
return (
<HeadManagerProvider>
<Story />
</HeadManagerProvider>
);
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/head-manager/head-manager-provider.tsx | code/frameworks/nextjs/src/head-manager/head-manager-provider.tsx | import type { PropsWithChildren } from 'react';
import React, { useMemo } from 'react';
import initHeadManager from 'next/dist/client/head-manager.js';
import { HeadManagerContext } from 'next/dist/shared/lib/head-manager-context.shared-runtime.js';
type HeadManagerValue = {
updateHead?: ((state: JSX.Element[]) => ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/aliases/webpack.ts | code/frameworks/nextjs/src/aliases/webpack.ts | import type { Configuration as WebpackConfig } from 'webpack';
import { resolvePackageDir } from '../../../../core/src/shared/utils/module';
import { configureCompatibilityAliases } from '../compatibility/compatibility-map';
import { configureNextExportMocks } from '../export-mocks/webpack';
export const configureAli... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/swc/next-swc-loader-patch.ts | code/frameworks/nextjs/src/swc/next-swc-loader-patch.ts | // THIS IS A PATCH over the original code from Next 14.0.0
// we use our own patch because we need to remove tracing from the original code
// which is not possible otherwise
/*
Copyright (c) 2017 The swc Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software an... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/swc/loader.ts | code/frameworks/nextjs/src/swc/loader.ts | import { join } from 'node:path';
import { getProjectRoot } from 'storybook/internal/common';
import type { Options } from 'storybook/internal/types';
import { getVirtualModules } from '@storybook/builder-webpack5';
import type { NextConfig } from 'next';
import nextJSLoadConfigModule from 'next/dist/build/load-jsco... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/nodePolyfills/webpack.ts | code/frameworks/nextjs/src/nodePolyfills/webpack.ts | import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
import type { Configuration } from 'webpack';
export const configureNodePolyfills = (baseConfig: Configuration) => {
// This is added as a way to avoid issues caused by Next.js 13.4.3
// introduced by gzip-size
baseConfig.plugins = [...(baseConfig.pl... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/config/preview.ts | code/frameworks/nextjs/src/config/preview.ts | import { setConfig } from 'next/config';
setConfig(process.env.__NEXT_RUNTIME_CONFIG);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/config/webpack.ts | code/frameworks/nextjs/src/config/webpack.ts | import { fileURLToPath } from 'node:url';
import type { NextConfig } from 'next';
import type { Configuration as WebpackConfig } from 'webpack';
import { addScopedAlias, isNextVersionGte, resolveNextConfig } from '../utils';
const isNext16orNewer = isNextVersionGte('16.0.0');
const tryResolve = (path: string) => {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/compatibility/compatibility-map.ts | code/frameworks/nextjs/src/compatibility/compatibility-map.ts | import semver from 'semver';
import type { Configuration as WebpackConfig } from 'webpack';
import { addScopedAlias, getNextjsVersion, setAlias } from '../utils';
const mapping: Record<string, Record<string, string | boolean>> = {
'<15.0.0': {
'next/dist/server/request/headers': 'next/dist/client/components/hea... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/compatibility/draft-mode.compat.ts | code/frameworks/nextjs/src/compatibility/draft-mode.compat.ts | // @ts-expect-error Compatibility for Next 14
export { draftMode } from 'next/dist/client/components/headers.js';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/images/decorator.tsx | code/frameworks/nextjs/src/images/decorator.tsx | import * as React from 'react';
import type { Addon_StoryContext } from 'storybook/internal/types';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-error (this only errors during compilation for production)
import { ImageContext as ImageContextValue } from '@storybook/nextjs/image-context'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/images/next-image.tsx | code/frameworks/nextjs/src/images/next-image.tsx | /* eslint-disable @typescript-eslint/ban-ts-comment */
import React from 'react';
// @ts-ignore-error (this only errors during compilation for production)
import { ImageContext as ImageContextValue } from '@storybook/nextjs/image-context';
import type * as _NextImage from 'next/image';
// @ts-ignore import is aliased... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/images/webpack.ts | code/frameworks/nextjs/src/images/webpack.ts | import { fileURLToPath } from 'node:url';
import type { NextConfig } from 'next';
import semver from 'semver';
import type { RuleSetRule, Configuration as WebpackConfig } from 'webpack';
import { getNextjsVersion } from '../utils';
export const configureImages = (baseConfig: WebpackConfig, nextConfig: NextConfig): v... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/images/next-image-default-loader.tsx | code/frameworks/nextjs/src/images/next-image-default-loader.tsx | import type * as _NextImage from 'next/image';
export const defaultLoader = ({ src, width, quality = 75 }: _NextImage.ImageLoaderProps) => {
const missingValues = [];
if (!src) {
missingValues.push('src');
}
if (!width) {
missingValues.push('width');
}
if (missingValues.length > 0) {
throw ne... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/images/next-legacy-image.tsx | code/frameworks/nextjs/src/images/next-legacy-image.tsx | /* eslint-disable @typescript-eslint/ban-ts-comment */
import React from 'react';
// @ts-ignore-error (this only errors during compilation for production)
import { ImageContext as ImageContextValue } from '@storybook/nextjs/image-context';
import type * as _NextLegacyImage from 'next/legacy/image';
// @ts-ignore impo... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/rsc/webpack.ts | code/frameworks/nextjs/src/rsc/webpack.ts | import { fileURLToPath } from 'node:url';
import type { Configuration as WebpackConfig } from 'webpack';
export const configureRSC = (baseConfig: WebpackConfig): void => {
const resolve = baseConfig.resolve ?? {};
resolve.alias = {
...resolve.alias,
'server-only$': fileURLToPath(import.meta.resolve('@stor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/rsc/server-only.ts | code/frameworks/nextjs/src/rsc/server-only.ts | // dummy export to make this a module
export default {};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/imports/webpack.ts | code/frameworks/nextjs/src/imports/webpack.ts | import { loadConfig } from 'tsconfig-paths';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
import type { Configuration as WebpackConfig } from 'webpack';
export const configureImports = ({
baseConfig,
configDir,
}: {
baseConfig: WebpackConfig;
configDir: string;
}): void => {
const configL... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/babel/loader.ts | code/frameworks/nextjs/src/babel/loader.ts | import { fileURLToPath } from 'node:url';
import { getProjectRoot, resolvePathInStorybookCache } from 'storybook/internal/common';
import type { Options } from 'storybook/internal/types';
import { getVirtualModules } from '@storybook/builder-webpack5';
import type { NextConfig } from 'next';
import { getNodeModules... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/babel/preset.ts | code/frameworks/nextjs/src/babel/preset.ts | import { createRequire } from 'node:module';
import { dirname } from 'node:path';
import type { PluginItem } from '@babel/core';
import ampAttributesPlugin from './plugins/amp-attributes';
// Static imports for relative requires
import jsxPragmaPlugin from './plugins/jsx-pragma';
import optimizeHookDestructuringPlugi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/babel/plugins/react-loadable-plugin.ts | code/frameworks/nextjs/src/babel/plugins/react-loadable-plugin.ts | /**
* Source:
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/babel/plugins/react-loadable-plugin.ts
*/
import { relative as relativePath } from 'node:path';
import type { types as BabelTypes, NodePath, PluginObj } from '@babel/core';
export default function ({ types: t }: { types: typeof B... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/frameworks/nextjs/src/babel/plugins/amp-attributes.ts | code/frameworks/nextjs/src/babel/plugins/amp-attributes.ts | import type { NodePath, PluginObj, types } from '@babel/core';
/**
* Source:
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/babel/plugins/amp-attributes.ts
*/
export default function AmpAttributePatcher(): PluginObj {
return {
visitor: {
JSXOpeningElement(path: NodePath<types.JS... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.