Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Addons, core: Make react and Storybook packages devDependencies where possible #24676

Merged
merged 28 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1ad0785
move react and @storybook from peer deps to dev deps
JReinhold Oct 31, 2023
c2b2b1a
globalize packages when bundling
JReinhold Oct 31, 2023
ab399bd
use separate bundling technique for addons, manager packages
JReinhold Nov 2, 2023
51f2cf9
update eslint rules
JReinhold Nov 2, 2023
c841f89
Merge branch 'next' of github.com:storybookjs/storybook into experime…
JReinhold Nov 2, 2023
d1b9518
fix blocks dep
JReinhold Nov 2, 2023
1388c64
move Vite deps otimization to presets
JReinhold Nov 2, 2023
f2a0396
Merge branch 'next' into experiment-addon-peer-dep
ndelangen Nov 2, 2023
d43b004
fixes for types check
ndelangen Nov 2, 2023
642cfd7
fix
ndelangen Nov 2, 2023
0149d22
fix
ndelangen Nov 2, 2023
88e116a
remove need for prop-types in preact
ndelangen Nov 2, 2023
c596b98
fix event-log-checker
ndelangen Nov 3, 2023
4ea32f3
Discard changes to scripts/event-log-checker.ts
ndelangen Nov 3, 2023
1d9cc82
fix
ndelangen Nov 3, 2023
a7a0b23
Merge branch 'experiment-addon-peer-dep' of github.com:storybookjs/st…
ndelangen Nov 3, 2023
7120771
fix types export from manager-api
JReinhold Nov 3, 2023
0551bec
rename optimizeDeps > optimizeViteDeps
JReinhold Nov 3, 2023
c31f632
refactor and simplify preview globalization
JReinhold Nov 3, 2023
4e59075
refactor manager+preview bundling and globals
JReinhold Nov 5, 2023
54ab656
Merge branch 'next' of github.com:storybookjs/storybook into experime…
JReinhold Nov 5, 2023
fdee9bf
reword missing react error
JReinhold Nov 5, 2023
765dbb1
make global types more strict
JReinhold Nov 5, 2023
b5a5307
keep SB packages as regular dependencies of manager-api
JReinhold Nov 7, 2023
5f8223c
fix ts-dedent missing from svelte renderer
JReinhold Nov 7, 2023
7d703fa
Merge branch 'next' into experiment-addon-peer-dep
JReinhold Nov 7, 2023
214a6f8
add import entry to globals exports
JReinhold Nov 8, 2023
94abc13
Merge branch 'next' into experiment-addon-peer-dep
JReinhold Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/addons/docs/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ const docsX = docs as any;

ensureReactPeerDeps();

const optimizeDeps = [
const optimizeViteDeps = [
'@mdx-js/react',
'@storybook/addon-docs > acorn-jsx',
'@storybook/addon-docs',
'@storybook/addon-essentials/docs/mdx-react-shim',
'markdown-to-jsx',
];

export { webpackX as webpack, indexersX as experimental_indexers, docsX as docs, optimizeDeps };
export { webpackX as webpack, indexersX as experimental_indexers, docsX as docs, optimizeViteDeps };
4 changes: 2 additions & 2 deletions code/builders/builder-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { pnpPlugin } from '@yarnpkg/esbuild-plugin-pnp';
import aliasPlugin from 'esbuild-plugin-alias';

import { stringifyProcessEnvs } from '@storybook/core-common';
import { globalsModuleInfoMap } from '@storybook/manager/globals-module-info';
import { getTemplatePath, renderHTML } from './utils/template';
import { definitions } from './utils/globals';
import { wrapManagerEntries } from './utils/managerEntries';
import type {
BuilderBuildResult,
Expand Down Expand Up @@ -89,7 +89,7 @@ export const getConfig: ManagerBuilder['getConfig'] = async (options) => {
util: require.resolve('util/util.js'),
assert: require.resolve('browser-assert'),
}),
globalExternals(definitions),
globalExternals(globalsModuleInfoMap),
pnpPlugin(),
],

Expand Down
1 change: 0 additions & 1 deletion code/builders/builder-manager/src/utils/globals.ts

This file was deleted.

10 changes: 1 addition & 9 deletions code/builders/builder-vite/src/optimizeDeps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@ const INCLUDE_CANDIDATES = [
'@emotion/core',
'@emotion/is-prop-valid',
'@emotion/styled',
'@storybook/channels',
'@storybook/client-api',
'@storybook/client-logger',
'@storybook/core/client',
'@storybook/global',
'@storybook/preview-api',
'@storybook/preview-web',
'@storybook/react > acorn-jsx',
'@storybook/react',
'@storybook/svelte',
'@storybook/types',
'@storybook/vue3',
'acorn-jsx',
'acorn-walk',
Expand Down Expand Up @@ -121,7 +113,7 @@ const asyncFilter = async (arr: string[], predicate: (val: string) => Promise<bo
Promise.all(arr.map(predicate)).then((results) => arr.filter((_v, index) => results[index]));

export async function getOptimizeDeps(config: ViteInlineConfig, options: Options) {
const extraOptimizeDeps = await options.presets.apply('optimizeDeps', []);
const extraOptimizeDeps = await options.presets.apply('optimizeViteDeps', []);

const { root = process.cwd() } = config;
const { normalizePath, resolveConfig } = await import('vite');
Expand Down
4 changes: 2 additions & 2 deletions code/builders/builder-vite/src/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
InlineConfig,
} from 'vite';
import { isPreservingSymlinks, getFrameworkName, getBuilderOptions } from '@storybook/core-common';
import { globals } from '@storybook/preview/globals';
import { globalsNameReferenceMap } from '@storybook/preview/globals';
import type { Options } from '@storybook/types';
import {
codeGeneratorPlugin,
Expand Down Expand Up @@ -96,7 +96,7 @@ export async function pluginConfig(options: Options) {
}
},
},
await externalGlobalsPlugin(globals),
await externalGlobalsPlugin(globalsNameReferenceMap),
] as PluginOption[];

// TODO: framework doesn't exist, should move into framework when/if built
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import slash from 'slash';

import type { Options, CoreConfig, DocsOptions, PreviewAnnotation } from '@storybook/types';
import { globals } from '@storybook/preview/globals';
import { globalsNameReferenceMap } from '@storybook/preview/globals';
import {
getBuilderOptions,
getRendererName,
Expand Down Expand Up @@ -235,7 +235,7 @@ export default async (
watchOptions: {
ignored: /node_modules/,
},
externals: globals,
externals: globalsNameReferenceMap,
ignoreWarnings: [
{
message: /export '\S+' was not found in 'global'/,
Expand Down
13 changes: 12 additions & 1 deletion code/lib/manager-api/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ import * as whatsnew from './modules/whatsnew';
import * as globals from './modules/globals';
import type { ModuleFn } from './lib/types';

import { types } from './lib/addons';

export * from './lib/shortcut';

const { ActiveTabs } = layout;
Expand Down Expand Up @@ -506,5 +508,14 @@ export function useArgTypes(): ArgTypes {

export { addons } from './lib/addons';

/**
* We need to rename this so it's not compiled to a straight re-export
* Our globalization plugin can't handle an import and export of the same name in different lines
* @deprecated
*/
const typesX = types;

export { typesX as types };

/* deprecated */
export { mockChannel, types, type Addon, type AddonStore } from './lib/addons';
export { mockChannel, type Addon, type AddonStore } from './lib/addons';
1 change: 0 additions & 1 deletion code/lib/preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"access": "public"
},
"bundler": {
"pre": "./scripts/generate-exports-file.ts",
"browserEntries": [
"./src/runtime.ts"
],
Expand Down
71 changes: 0 additions & 71 deletions code/lib/preview/scripts/generate-exports-file.ts

This file was deleted.

2 changes: 1 addition & 1 deletion code/lib/preview/src/globals.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './globals/types';
export * from './globals/globals';
37 changes: 0 additions & 37 deletions code/lib/preview/src/globals/definitions.ts

This file was deleted.

Loading