Skip to content

Commit

Permalink
Merge pull request #29300 from storybookjs/version-non-patch-from-8.4…
Browse files Browse the repository at this point in the history
….0-alpha.5

Release: Prerelease 8.4.0-alpha.6
  • Loading branch information
JReinhold authored Oct 9, 2024
2 parents 54b0b3c + 7c9d69b commit 59ab525
Show file tree
Hide file tree
Showing 39 changed files with 97 additions and 144 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 8.4.0-alpha.6

- Addon-docs, blocks: Prebundle dependencies - [#29301](https://github.com/storybookjs/storybook/pull/29301), thanks @JReinhold!
- React: Prebundle all of `renderers/react`'s dependencies - [#29298](https://github.com/storybookjs/storybook/pull/29298), thanks @ndelangen!
- Vite: Cleanup and prebundle dependencies - [#29302](https://github.com/storybookjs/storybook/pull/29302), thanks @JReinhold!

## 8.4.0-alpha.5

- Core: Migrate from `express` to `polka` - [#29230](https://github.com/storybookjs/storybook/pull/29230), thanks @43081j!
Expand Down
3 changes: 1 addition & 2 deletions code/addons/docs/angular/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-underscore-dangle */
import { global } from '@storybook/global';

export const setCompodocJson = (compodocJson) => {
// @ts-expect-error (Converted from ts-ignore)
global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
globalThis.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
};
3 changes: 1 addition & 2 deletions code/addons/docs/ember/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-underscore-dangle */
import { global } from '@storybook/global';

export const setJSONDoc = (jsondoc) => {
global.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
globalThis.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
};
7 changes: 3 additions & 4 deletions code/addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,19 @@
"@mdx-js/react": "^3.0.0",
"@storybook/blocks": "workspace:*",
"@storybook/csf-plugin": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/react-dom-shim": "workspace:*",
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"rehype-external-links": "^3.0.0",
"rehype-slug": "^6.0.0",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@mdx-js/mdx": "^3.0.0",
"@rollup/pluginutils": "^5.0.2",
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rehype-external-links": "^3.0.0",
"rehype-slug": "^6.0.0",
"typescript": "^5.3.2",
"vite": "^4.0.4"
},
Expand Down
4 changes: 1 addition & 3 deletions code/addons/docs/src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { PreparedStory } from 'storybook/internal/types';

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

const excludeTags = Object.entries(global.TAGS_OPTIONS ?? {}).reduce(
const excludeTags = Object.entries(globalThis.TAGS_OPTIONS ?? {}).reduce(
(acc, entry) => {
const [tag, option] = entry;
if ((option as any).excludeFromDocsStories) {
Expand Down
2 changes: 0 additions & 2 deletions code/addons/docs/template/stories/docs2/button.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
title: 'Multiple CSF Files Same Title',
component: globalThis.Components.Html,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
title: 'Multiple CSF Files Same Title',
component: globalThis.Components.Html,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { global as globalThis } from '@storybook/global';
import { expect, within } from '@storybook/test';

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { global as globalThis } from '@storybook/global';
import { fn } from '@storybook/test';

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
subcomponents: {
Expand Down
2 changes: 0 additions & 2 deletions code/addons/docs/template/stories/docspage/error.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs', '!test', '!vitest'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
2 changes: 0 additions & 2 deletions code/addons/docs/template/stories/docspage/iframe.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Pre,
tags: ['autodocs'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

// FIXME: do this using basic React functions for multi-framework
// once sandbox linking is working
//
Expand Down
2 changes: 0 additions & 2 deletions code/addons/docs/template/stories/docspage/source.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { StoryContext } from 'storybook/internal/types';

import { global as globalThis } from '@storybook/global';

import { dedent } from 'ts-dedent';

export default {
Expand Down
3 changes: 0 additions & 3 deletions code/addons/docs/template/stories/toc/basic.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { global as globalThis } from '@storybook/global';
import { fn } from '@storybook/test';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
2 changes: 0 additions & 2 deletions code/addons/docs/template/stories/toc/custom-title.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
Expand Down
25 changes: 5 additions & 20 deletions code/builders/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,24 @@
},
"dependencies": {
"@storybook/csf-plugin": "workspace:*",
"@types/find-cache-dir": "^3.2.1",
"browser-assert": "^1.2.1",
"es-module-lexer": "^1.5.0",
"find-cache-dir": "^3.0.0",
"magic-string": "^0.30.0",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@types/find-cache-dir": "^3.2.1",
"@types/node": "^22.0.0",
"es-module-lexer": "^1.5.0",
"find-cache-dir": "^3.0.0",
"glob": "^10.0.0",
"magic-string": "^0.30.0",
"polka": "^1.0.0-next.28",
"sirv": "^2.0.4",
"slash": "^5.0.0",
"typescript": "^5.3.2",
"vite": "^4.0.4"
},
"peerDependencies": {
"@preact/preset-vite": "*",
"storybook": "workspace:^",
"typescript": ">= 4.3.x",
"vite": "^4.0.0 || ^5.0.0",
"vite-plugin-glimmerx": "*"
},
"peerDependenciesMeta": {
"@preact/preset-vite": {
"optional": true
},
"typescript": {
"optional": true
},
"vite-plugin-glimmerx": {
"optional": true
}
"vite": "^4.0.0 || ^5.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 0 additions & 6 deletions code/builders/builder-vite/src/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,5 @@ export async function pluginConfig(options: Options) {
pluginWebpackStats({ workingDir: process.cwd() }),
] as PluginOption[];

// TODO: framework doesn't exist, should move into framework when/if built
if (frameworkName === '@storybook/glimmerx-vite') {
const plugin = require('vite-plugin-glimmerx/index.cjs');
plugins.push(plugin.default());
}

return plugins;
}
17 changes: 7 additions & 10 deletions code/lib/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,21 @@
},
"dependencies": {
"@storybook/csf": "^0.1.11",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.10",
"color-convert": "^2.0.1",
"dequal": "^2.0.2",
"markdown-to-jsx": "^7.4.5",
"memoizerific": "^1.11.3",
"polished": "^4.2.2",
"react-colorful": "^5.1.2",
"telejson": "^7.2.0",
"ts-dedent": "^2.0.0",
"util-deprecate": "^1.0.2"
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/addon-actions": "workspace:*",
"@storybook/react": "workspace:*",
"@storybook/test": "workspace:*",
"@types/color-convert": "^2.0.0",
"color-convert": "^2.0.1",
"es-toolkit": "^1.21.0",
"markdown-to-jsx": "^7.4.5",
"memoizerific": "^1.11.3",
"polished": "^4.2.2",
"react-colorful": "^5.1.2",
"telejson": "^7.2.0",
"tocbot": "^4.20.1"
},
"peerDependencies": {
Expand Down
4 changes: 1 addition & 3 deletions code/lib/blocks/src/blocks/DocsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import type { ThemeVars } from 'storybook/internal/theming';
import { ThemeProvider, ensure as ensureTheme } from 'storybook/internal/theming';
import type { Renderer } from 'storybook/internal/types';

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

import { DocsPageWrapper } from '../components';
import { TableOfContents } from '../components/TableOfContents';
import type { DocsContextProps } from './DocsContext';
import { DocsContext } from './DocsContext';
import { SourceContainer } from './SourceContainer';
import { scrollToElement } from './utils';

const { document, window: globalWindow } = global;
const { document, window: globalWindow } = globalThis;

export interface DocsContainerProps<TFramework extends Renderer = Renderer> {
context: DocsContextProps<TFramework>;
Expand Down
12 changes: 5 additions & 7 deletions code/lib/blocks/src/blocks/DocsContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ import { createContext } from 'react';

import type { DocsContextProps, Renderer } from 'storybook/internal/types';

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

export type { DocsContextProps };

// We add DocsContext to window. The reason is that in case DocsContext.ts is
// imported multiple times (maybe once directly, and another time from a minified bundle)
// we will have multiple DocsContext definitions - leading to lost context in
// the React component tree.
// This was specifically a problem with the Vite builder.
if (global && global.__DOCS_CONTEXT__ === undefined) {
global.__DOCS_CONTEXT__ = createContext(null);
global.__DOCS_CONTEXT__.displayName = 'DocsContext';
if (globalThis && globalThis.__DOCS_CONTEXT__ === undefined) {
globalThis.__DOCS_CONTEXT__ = createContext(null);
globalThis.__DOCS_CONTEXT__.displayName = 'DocsContext';
}

export const DocsContext: Context<DocsContextProps<Renderer>> = global
? global.__DOCS_CONTEXT__
export const DocsContext: Context<DocsContextProps<Renderer>> = globalThis
? globalThis.__DOCS_CONTEXT__
: createContext(null);
3 changes: 1 addition & 2 deletions code/lib/blocks/src/blocks/mdx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import { Code, components, nameSpaceClassNames } from 'storybook/internal/compon
import { NAVIGATE_URL } from 'storybook/internal/core-events';
import { styled } from 'storybook/internal/theming';

import { global } from '@storybook/global';
import { LinkIcon } from '@storybook/icons';

import { Source } from '../components';
import type { DocsContextProps } from './DocsContext';
import { DocsContext } from './DocsContext';

const { document } = global;
const { document } = globalThis;

// Hacky utility for asserting identifiers in MDX Story elements
export const assertIsFn = (val: any) => {
Expand Down
4 changes: 1 addition & 3 deletions code/lib/blocks/src/components/IFrame.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { Component } from 'react';

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

const { window: globalWindow } = global;
const { window: globalWindow } = globalThis;

interface IFrameProps {
id: string;
Expand Down
4 changes: 1 addition & 3 deletions code/lib/blocks/src/components/Preview.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { Button, Spaced } from 'storybook/internal/components';
import { styled } from 'storybook/internal/theming';
import type { DocsContextProps, ModuleExport } from 'storybook/internal/types';

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

import * as ButtonStories from '../examples/Button.stories';
import { Preview, PreviewSkeleton } from './Preview';
import * as sourceStories from './Source.stories';
Expand Down Expand Up @@ -251,7 +249,7 @@ export const WithAdditionalActions = (
{
title: 'Open on GitHub',
onClick: () => {
global.location.href =
globalThis.location.href =
'https://github.com/storybookjs/storybook/blob/next/code/lib/blocks/src/components/Preview.stories.tsx#L165-L186';
},
},
Expand Down
4 changes: 1 addition & 3 deletions code/lib/blocks/src/components/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { ActionBar, Zoom } from 'storybook/internal/components';
import type { ActionItem } from 'storybook/internal/components';
import { styled } from 'storybook/internal/theming';

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

import { darken } from 'polished';

import type { SourceProps } from '.';
Expand Down Expand Up @@ -204,7 +202,7 @@ export const Preview: FC<PreviewProps> = ({
);
const actionItems = [...defaultActionItems, ...additionalActionItems];

const { window: globalWindow } = global;
const { window: globalWindow } = globalThis;

const copyToClipboard = useCallback(async (text: string) => {
const { createCopyToClipboardFunction } = await import('storybook/internal/components');
Expand Down
4 changes: 1 addition & 3 deletions code/lib/blocks/src/components/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import { ErrorFormatter, Loader, getStoryHref } from 'storybook/internal/compone
import { styled } from 'storybook/internal/theming';
import type { DocsContextProps, PreparedStory } from 'storybook/internal/types';

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

import { IFrame } from './IFrame';
import { ZoomContext } from './ZoomContext';

const { PREVIEW_URL } = global;
const { PREVIEW_URL } = globalThis;
const BASE_URL = PREVIEW_URL || 'iframe.html';

interface CommonProps {
Expand Down
3 changes: 1 addition & 2 deletions code/lib/blocks/src/controls/Object.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Button, Form, IconButton } from 'storybook/internal/components';
import { type Theme, styled, useTheme } from 'storybook/internal/theming';

import { global } from '@storybook/global';
import { AddIcon, EyeCloseIcon, EyeIcon, SubtractIcon } from '@storybook/icons';

import { cloneDeep } from 'es-toolkit/compat';
Expand All @@ -13,7 +12,7 @@ import { getControlId, getControlSetterButtonId } from './helpers';
import { JsonTree } from './react-editable-json-tree';
import type { ControlProps, ObjectConfig, ObjectValue } from './types';

const { window: globalWindow } = global;
const { window: globalWindow } = globalThis;

type JsonTreeProps = ComponentProps<typeof JsonTree>;

Expand Down
Loading

0 comments on commit 59ab525

Please sign in to comment.