mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
Merge remote-tracking branch 'origin/next' into pr/Marklb/24982
This commit is contained in:
commit
f7d5d7945c
@ -4,8 +4,8 @@ parameters:
|
||||
workflow:
|
||||
description: Which workflow to run
|
||||
type: enum
|
||||
enum: ['normal', 'merged', 'daily', 'skipped', 'docs']
|
||||
default: 'skipped'
|
||||
enum: ["normal", "merged", "daily", "skipped", "docs"]
|
||||
default: "skipped"
|
||||
|
||||
executors:
|
||||
sb_node_16_classic:
|
||||
@ -13,8 +13,8 @@ executors:
|
||||
class:
|
||||
description: The Resource class
|
||||
type: enum
|
||||
enum: ['small', 'medium', 'medium+', 'large', 'xlarge']
|
||||
default: 'small'
|
||||
enum: ["small", "medium", "medium+", "large", "xlarge"]
|
||||
default: "small"
|
||||
working_directory: /tmp/storybook
|
||||
docker:
|
||||
- image: cimg/node:18.18.0
|
||||
@ -26,8 +26,8 @@ executors:
|
||||
class:
|
||||
description: The Resource class
|
||||
type: enum
|
||||
enum: ['small', 'medium', 'medium+', 'large', 'xlarge']
|
||||
default: 'small'
|
||||
enum: ["small", "medium", "medium+", "large", "xlarge"]
|
||||
default: "small"
|
||||
working_directory: /tmp/storybook
|
||||
docker:
|
||||
- image: cimg/node:18.18.0-browsers
|
||||
@ -39,8 +39,8 @@ executors:
|
||||
class:
|
||||
description: The Resource class
|
||||
type: enum
|
||||
enum: ['small', 'medium', 'medium+', 'large', 'xlarge']
|
||||
default: 'small'
|
||||
enum: ["small", "medium", "medium+", "large", "xlarge"]
|
||||
default: "small"
|
||||
working_directory: /tmp/storybook
|
||||
docker:
|
||||
- image: mcr.microsoft.com/playwright:v1.36.0-focal
|
||||
@ -56,7 +56,7 @@ orbs:
|
||||
|
||||
commands:
|
||||
cancel-workflow-on-failure:
|
||||
description: 'Cancels the entire workflow in case the previous step has failed'
|
||||
description: "Cancels the entire workflow in case the previous step has failed"
|
||||
steps:
|
||||
- run:
|
||||
name: Cancel current workflow
|
||||
@ -66,13 +66,13 @@ commands:
|
||||
echo "To execute all checks locally, please run yarn ci-tests"
|
||||
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${WORKFLOW_CANCELER}"
|
||||
report-workflow-on-failure:
|
||||
description: 'Reports failures to discord'
|
||||
description: "Reports failures to discord"
|
||||
parameters:
|
||||
template:
|
||||
description: |
|
||||
Which template to report in discord. Applicable for parallel sandbox jobs
|
||||
type: string
|
||||
default: 'none'
|
||||
default: "none"
|
||||
steps:
|
||||
- run:
|
||||
when: on_fail
|
||||
@ -88,7 +88,7 @@ jobs:
|
||||
name: sb_node_16_classic
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- restore_cache:
|
||||
name: Restore Yarn cache
|
||||
keys:
|
||||
@ -114,7 +114,7 @@ jobs:
|
||||
name: sb_node_16_classic
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- restore_cache:
|
||||
name: Restore Yarn cache
|
||||
keys:
|
||||
@ -157,7 +157,7 @@ jobs:
|
||||
name: sb_node_16_classic
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -173,7 +173,7 @@ jobs:
|
||||
name: sb_node_16_classic
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -187,7 +187,7 @@ jobs:
|
||||
executor: sb_node_16_browsers
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -215,7 +215,7 @@ jobs:
|
||||
name: sb_node_16_browsers
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -237,7 +237,7 @@ jobs:
|
||||
name: sb_node_16_browsers
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- codecov/upload
|
||||
@ -273,7 +273,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -297,7 +297,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -317,7 +317,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -356,7 +356,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -376,7 +376,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -415,7 +415,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -438,7 +438,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -461,7 +461,7 @@ jobs:
|
||||
parallelism: << parameters.parallelism >>
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
@ -483,7 +483,7 @@ jobs:
|
||||
type: string
|
||||
steps:
|
||||
- git-shallow-clone/checkout_advanced:
|
||||
clone_options: '--depth 1 --verbose'
|
||||
clone_options: "--depth 1 --verbose"
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- when:
|
||||
@ -706,22 +706,22 @@ workflows:
|
||||
requires:
|
||||
- build
|
||||
- create-sandboxes:
|
||||
parallelism: 32
|
||||
parallelism: 34
|
||||
requires:
|
||||
- build
|
||||
# - smoke-test-sandboxes: # disabled for now
|
||||
# requires:
|
||||
# - create-sandboxes
|
||||
- build-sandboxes:
|
||||
parallelism: 32
|
||||
parallelism: 34
|
||||
requires:
|
||||
- create-sandboxes
|
||||
- chromatic-sandboxes:
|
||||
parallelism: 29
|
||||
parallelism: 31
|
||||
requires:
|
||||
- build-sandboxes
|
||||
- e2e-production:
|
||||
parallelism: 27
|
||||
parallelism: 29
|
||||
requires:
|
||||
- build-sandboxes
|
||||
- e2e-dev:
|
||||
@ -729,7 +729,7 @@ workflows:
|
||||
requires:
|
||||
- create-sandboxes
|
||||
- test-runner-production:
|
||||
parallelism: 27
|
||||
parallelism: 29
|
||||
requires:
|
||||
- build-sandboxes
|
||||
|
||||
@ -744,14 +744,14 @@ workflows:
|
||||
# - "yarn1"
|
||||
# - "yarn2"
|
||||
# - "pnpm"
|
||||
template:
|
||||
template:
|
||||
- "react-vite-ts"
|
||||
- "nextjs-ts"
|
||||
- "vue-vite-ts"
|
||||
# --smoke-test is not supported for the angular builder right now
|
||||
# - "angular-cli"
|
||||
- "lit-vite-ts"
|
||||
|
||||
|
||||
# TODO: reenable once we find out the source of flakyness
|
||||
# - test-runner-dev:
|
||||
# parallelism: 4
|
||||
|
10
.github/workflows/canary-release-pr.yml
vendored
10
.github/workflows/canary-release-pr.yml
vendored
@ -1,11 +1,11 @@
|
||||
name: Publish canary release of PR
|
||||
run-name: 'Canary release: PR #${{ inputs.pr }}, triggered by ${{ github.triggering_actor }}'
|
||||
run-name: "Canary release: PR #${{ inputs.pr }}, triggered by ${{ github.triggering_actor }}"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr:
|
||||
description: 'Pull request number to create a canary release for'
|
||||
description: "Pull request number to create a canary release for"
|
||||
required: true
|
||||
type: number
|
||||
|
||||
@ -58,7 +58,7 @@ jobs:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
node-version-file: ".nvmrc"
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@ -91,10 +91,10 @@ jobs:
|
||||
with:
|
||||
githubToken: ${{ secrets.GH_TOKEN }}
|
||||
prNumber: ${{ inputs.pr }}
|
||||
find: 'CANARY_RELEASE_SECTION'
|
||||
find: "CANARY_RELEASE_SECTION"
|
||||
isHtmlCommentTag: true
|
||||
replace: |
|
||||
This pull request has been released as version [`${{ steps.version.outputs.next-version }}`](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }}). Install it by pinning all your Storybook dependencies to that version.
|
||||
This pull request has been released as version `${{ steps.version.outputs.next-version }}`. Try it out in a new sandbox by running `npx storybook@${{ steps.version.outputs.next-version }} sandbox` or in an existing project with `npx storybook@${{ steps.version.outputs.next-version }} upgrade`.
|
||||
<details>
|
||||
<summary>More information</summary>
|
||||
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
||||
run: yarn local-registry --open &
|
||||
working-directory: ./code
|
||||
- name: Wait for registry
|
||||
run: yarn wait-on http://localhost:6001
|
||||
run: yarn wait-on tcp:127.0.0.1:6001
|
||||
working-directory: ./code
|
||||
- name: Generate
|
||||
run: yarn generate-sandboxes --local-registry
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
||||
run: yarn local-registry --open &
|
||||
working-directory: ./code
|
||||
- name: Wait for registry
|
||||
run: yarn wait-on http://localhost:6001
|
||||
run: yarn wait-on tcp:127.0.0.1:6001
|
||||
working-directory: ./code
|
||||
- name: Generate
|
||||
run: yarn generate-sandboxes --local-registry --debug
|
||||
|
@ -1,3 +1,28 @@
|
||||
## 8.0.0-alpha.10
|
||||
|
||||
- API: Remove deprecations from manager and preview api - [#25536](https://github.com/storybookjs/storybook/pull/25536), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
|
||||
- Addon Controls: Remove unused hideNoControlsWarning type - [#25417](https://github.com/storybookjs/storybook/pull/25417), thanks [@yannbf](https://github.com/yannbf)!
|
||||
- Addon Remark-GFM: Upgrade remark-gfm - [#25301](https://github.com/storybookjs/storybook/pull/25301), thanks [@yannbf](https://github.com/yannbf)!
|
||||
- Addon-actions: Fix module resolution for react-native - [#25296](https://github.com/storybookjs/storybook/pull/25296), thanks [@dannyhw](https://github.com/dannyhw)!
|
||||
- Angular: Remove deprecated Story type - [#25558](https://github.com/storybookjs/storybook/pull/25558), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
|
||||
- CLI: Add addon `remove` command - [#25538](https://github.com/storybookjs/storybook/pull/25538), thanks [@shilman](https://github.com/shilman)!
|
||||
- CLI: Check optionalDependencies for storybook versions - [#25406](https://github.com/storybookjs/storybook/pull/25406), thanks [@reyronald](https://github.com/reyronald)!
|
||||
- CLI: Sandbox script should use current version to init - [#25560](https://github.com/storybookjs/storybook/pull/25560), thanks [@ndelangen](https://github.com/ndelangen)!
|
||||
- CLI: Versioned installation of monorepo packages - [#25517](https://github.com/storybookjs/storybook/pull/25517), thanks [@ndelangen](https://github.com/ndelangen)!
|
||||
- CLI: Versioned upgrade of monorepo packages - [#25553](https://github.com/storybookjs/storybook/pull/25553), thanks [@JReinhold](https://github.com/JReinhold)!
|
||||
- Core: Prevent stories lookup in node_modules - [#25214](https://github.com/storybookjs/storybook/pull/25214), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
|
||||
- Core: Refactor preview and deprecate story store - [#24926](https://github.com/storybookjs/storybook/pull/24926), thanks [@tmeasday](https://github.com/tmeasday)!
|
||||
- Doc blocks: Remove deprecated props from Primary block - [#25461](https://github.com/storybookjs/storybook/pull/25461), thanks [@yannbf](https://github.com/yannbf)!
|
||||
- Doc blocks: Remove deprecated props from Source block - [#25459](https://github.com/storybookjs/storybook/pull/25459), thanks [@yannbf](https://github.com/yannbf)!
|
||||
- Doc blocks: Remove deprecated props from Story block - [#25460](https://github.com/storybookjs/storybook/pull/25460), thanks [@yannbf](https://github.com/yannbf)!
|
||||
- Maintenance: Pin TS to >= 4.2 as typefest 2 requires it - [#25548](https://github.com/storybookjs/storybook/pull/25548), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
|
||||
- Maintenance: Upgrade to prettier 3 - [#25524](https://github.com/storybookjs/storybook/pull/25524), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
|
||||
- Remove deprecated properties from manager-api - [#25578](https://github.com/storybookjs/storybook/pull/25578), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
|
||||
- Test: Fix user event being inlined by tsup by using an interface - [#25547](https://github.com/storybookjs/storybook/pull/25547), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
|
||||
- Test: Upgrade test package to vitest 1.1.3 - [#25576](https://github.com/storybookjs/storybook/pull/25576), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
|
||||
- UI: Add configurable tags-based exclusion from sidebar/autodocs - [#25328](https://github.com/storybookjs/storybook/pull/25328), thanks [@shilman](https://github.com/shilman)!
|
||||
- Webpack: Remove deprecated standalone webpackConfig option - [#25481](https://github.com/storybookjs/storybook/pull/25481), thanks [@yannbf](https://github.com/yannbf)!
|
||||
|
||||
## 8.0.0-alpha.9
|
||||
|
||||
- AutoTitle: Fix case-insensitive trailing duplicate - [#25452](https://github.com/storybookjs/storybook/pull/25452), thanks [@ksugawara61](https://github.com/ksugawara61)!
|
||||
|
626
MIGRATION.md
626
MIGRATION.md
File diff suppressed because it is too large
Load Diff
@ -17,4 +17,4 @@ ember-output
|
||||
!.eslintrc.js
|
||||
!.eslintrc-markdown.js
|
||||
!.storybook
|
||||
|
||||
lib/core-common/templates/base-preview-head.html
|
@ -23,12 +23,6 @@ module.exports = {
|
||||
},
|
||||
plugins: ['local-rules'],
|
||||
rules: {
|
||||
// remove as shared eslint has jest rules removed
|
||||
'jest/no-standalone-expect': 'off',
|
||||
'jest/no-done-callback': 'off',
|
||||
'jest/no-deprecated-functions': 'off',
|
||||
'jest/valid-expect': 'off',
|
||||
|
||||
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
||||
'eslint-comments/no-unused-disable': 'error',
|
||||
'react-hooks/rules-of-hooks': 'off',
|
||||
@ -52,6 +46,7 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/default-param-last': 'off',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-a11y",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Test component compliance with web accessibility standards",
|
||||
"keywords": [
|
||||
"a11y",
|
||||
|
@ -3,7 +3,7 @@ import { addons } from '@storybook/preview-api';
|
||||
import { EVENTS } from './constants';
|
||||
import type { A11yParameters } from './params';
|
||||
|
||||
const { document, window: globalWindow } = global;
|
||||
const { document } = global;
|
||||
|
||||
const channel = addons.getChannel();
|
||||
// Holds axe core running state
|
||||
@ -11,22 +11,21 @@ let active = false;
|
||||
// Holds latest story we requested a run
|
||||
let activeStoryId: string | undefined;
|
||||
|
||||
const defaultParameters = { config: {}, options: {} };
|
||||
|
||||
/**
|
||||
* Handle A11yContext events.
|
||||
* Because the event are sent without manual check, we split calls
|
||||
*/
|
||||
const handleRequest = async (storyId: string) => {
|
||||
const { manual } = await getParams(storyId);
|
||||
if (!manual) {
|
||||
await run(storyId);
|
||||
const handleRequest = async (storyId: string, input: A11yParameters = defaultParameters) => {
|
||||
if (!input?.manual) {
|
||||
await run(storyId, input);
|
||||
}
|
||||
};
|
||||
|
||||
const run = async (storyId: string) => {
|
||||
const run = async (storyId: string, input: A11yParameters = defaultParameters) => {
|
||||
activeStoryId = storyId;
|
||||
try {
|
||||
const input = await getParams(storyId);
|
||||
|
||||
if (!active) {
|
||||
active = true;
|
||||
channel.emit(EVENTS.RUNNING);
|
||||
@ -69,17 +68,5 @@ const run = async (storyId: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
/** Returns story parameters or default ones. */
|
||||
const getParams = async (storyId: string): Promise<A11yParameters> => {
|
||||
const { parameters } =
|
||||
(await globalWindow.__STORYBOOK_STORY_STORE__.loadStory({ storyId })) || {};
|
||||
return (
|
||||
parameters.a11y || {
|
||||
config: {},
|
||||
options: {},
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
channel.on(EVENTS.REQUEST, handleRequest);
|
||||
channel.on(EVENTS.MANUAL, run);
|
||||
|
@ -6,7 +6,12 @@ import { ActionBar, ScrollArea } from '@storybook/components';
|
||||
import { SyncIcon, CheckIcon } from '@storybook/icons';
|
||||
|
||||
import type { AxeResults } from 'axe-core';
|
||||
import { useChannel, useParameter, useStorybookState } from '@storybook/manager-api';
|
||||
import {
|
||||
useChannel,
|
||||
useParameter,
|
||||
useStorybookApi,
|
||||
useStorybookState,
|
||||
} from '@storybook/manager-api';
|
||||
|
||||
import { Report } from './Report';
|
||||
|
||||
@ -59,6 +64,7 @@ export const A11YPanel: React.FC = () => {
|
||||
const [error, setError] = React.useState<unknown>(undefined);
|
||||
const { setResults, results } = useA11yContext();
|
||||
const { storyId } = useStorybookState();
|
||||
const api = useStorybookApi();
|
||||
|
||||
React.useEffect(() => {
|
||||
setStatus(manual ? 'manual' : 'initial');
|
||||
@ -92,7 +98,7 @@ export const A11YPanel: React.FC = () => {
|
||||
|
||||
const handleManual = useCallback(() => {
|
||||
setStatus('running');
|
||||
emit(EVENTS.MANUAL, storyId);
|
||||
emit(EVENTS.MANUAL, storyId, api.getParameters(storyId, 'a11y'));
|
||||
}, [storyId]);
|
||||
|
||||
const manualActionItems = useMemo(
|
||||
|
@ -57,6 +57,7 @@ describe('A11YPanel', () => {
|
||||
});
|
||||
|
||||
const getCurrentStoryData = vi.fn();
|
||||
const getParameters = vi.fn();
|
||||
beforeEach(() => {
|
||||
mockedApi.useChannel.mockReset();
|
||||
mockedApi.useStorybookApi.mockReset();
|
||||
@ -65,7 +66,8 @@ describe('A11YPanel', () => {
|
||||
mockedApi.useAddonState.mockImplementation((_, defaultState) => React.useState(defaultState));
|
||||
mockedApi.useChannel.mockReturnValue(vi.fn());
|
||||
getCurrentStoryData.mockReset().mockReturnValue({ id: storyId, type: 'story' });
|
||||
mockedApi.useStorybookApi.mockReturnValue({ getCurrentStoryData } as any);
|
||||
getParameters.mockReturnValue({});
|
||||
mockedApi.useStorybookApi.mockReturnValue({ getCurrentStoryData, getParameters } as any);
|
||||
});
|
||||
|
||||
it('should render children', () => {
|
||||
@ -94,7 +96,7 @@ describe('A11YPanel', () => {
|
||||
mockedApi.useChannel.mockReturnValue(emit);
|
||||
const { rerender } = render(<A11yContextProvider active={false} />);
|
||||
rerender(<A11yContextProvider active />);
|
||||
expect(emit).toHaveBeenLastCalledWith(EVENTS.REQUEST, storyId);
|
||||
expect(emit).toHaveBeenLastCalledWith(EVENTS.REQUEST, storyId, {});
|
||||
});
|
||||
|
||||
it('should emit highlight with no values when inactive', () => {
|
||||
|
@ -70,7 +70,7 @@ export const A11yContextProvider: React.FC<React.PropsWithChildren<A11yContextPr
|
||||
);
|
||||
}, []);
|
||||
const handleRun = (renderedStoryId: string) => {
|
||||
emit(EVENTS.REQUEST, renderedStoryId);
|
||||
emit(EVENTS.REQUEST, renderedStoryId, api.getParameters(renderedStoryId, 'a11y'));
|
||||
};
|
||||
const handleClearHighlights = React.useCallback(() => setHighlighted([]), []);
|
||||
const handleSetTab = React.useCallback((index: number) => {
|
||||
|
@ -63,7 +63,6 @@ interface ElementsProps {
|
||||
export const Elements: FC<ElementsProps> = ({ elements, type }) => (
|
||||
<ol>
|
||||
{elements.map((element, index) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Element element={element} key={index} type={type} />
|
||||
))}
|
||||
</ol>
|
||||
|
@ -27,7 +27,6 @@ function areAllRequiredElementsHighlighted(
|
||||
highlighted.includes(item.target[0] as any)
|
||||
).length;
|
||||
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
return highlightedCount === 0
|
||||
? CheckBoxStates.UNCHECKED
|
||||
: highlightedCount === elementsToHighlight.length
|
||||
|
@ -91,7 +91,6 @@ export const Rules: FC<RulesProps> = ({ rules }) => {
|
||||
return (
|
||||
<List>
|
||||
{rules.map((rule, index) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Rule rule={rule} key={index} />
|
||||
))}
|
||||
</List>
|
||||
|
@ -121,7 +121,6 @@ export const Tabs: React.FC<TabsProps> = ({ tabs }) => {
|
||||
<TabsWrapper>
|
||||
{tabs.map((tab, index) => (
|
||||
<Item
|
||||
/* eslint-disable-next-line react/no-array-index-key */
|
||||
key={index}
|
||||
data-index={index}
|
||||
active={activeTab === index}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-actions",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Get UI feedback when an action is performed on an interactive element",
|
||||
"keywords": [
|
||||
"storybook",
|
||||
|
@ -65,10 +65,8 @@ export default class ActionLogger extends Component<ActionLoggerProps, ActionLog
|
||||
const actions = [...prevState.actions];
|
||||
const previous = actions.length && actions[0];
|
||||
if (previous && safeDeepEqual(previous.data, action.data)) {
|
||||
// eslint-disable-next-line no-plusplus
|
||||
previous.count++;
|
||||
} else {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
action.count = 1;
|
||||
actions.unshift(action);
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ export function action(name: string, options: ActionOptions = {}): HandlerFuncti
|
||||
if (storyRenderer) {
|
||||
const deprecated = !window?.FEATURES?.disallowImplicitActionsInRenderV8;
|
||||
const error = new ImplicitActionsDuringRendering({
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
phase: storyRenderer.phase!,
|
||||
name,
|
||||
deprecated,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-backgrounds",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Switch backgrounds to view components in different settings",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-controls",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Interact with component inputs dynamically in the Storybook UI",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-docs",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Document component usage and properties in Markdown",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,2 +1 @@
|
||||
// eslint-disable-next-line import/export
|
||||
export * from './dist/preview';
|
||||
|
@ -523,7 +523,7 @@ describe('docs-mdx-compiler-plugin', () => {
|
||||
"import { Meta, Story } from '@storybook/addon-docs';",
|
||||
"import { titleFunction } from '../title-generators';",
|
||||
'',
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
|
||||
"<Meta title={`${titleFunction('template')}`} />",
|
||||
].join('\n')
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { global as globalThis } from '@storybook/global';
|
||||
import { expect } from '@storybook/jest';
|
||||
import { expect } from '@storybook/test';
|
||||
import { within } from '@storybook/testing-library';
|
||||
|
||||
export default {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-essentials",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Curated addons to bring out the best of Storybook",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { dirname, join } from 'path';
|
||||
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@storybook/addon-docs/dist/preset';
|
||||
|
||||
export const mdxLoaderOptions = async (config: any) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
config.mdxCompileOptions.providerImportSource = join(
|
||||
dirname(require.resolve('@storybook/addon-docs/package.json')),
|
||||
'/dist/shims/mdx-react-shim'
|
||||
|
@ -1,2 +1 @@
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@storybook/addon-docs/dist/preview';
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-mdx-gfm",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "GitHub Flavored Markdown in Storybook",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { dedent } from 'ts-dedent';
|
||||
import { deprecate } from '@storybook/node-logger';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-highlight",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Highlight DOM nodes within your stories",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-interactions",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Automate, test and debug user interactions",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
@ -62,7 +62,6 @@
|
||||
"@storybook/core-common": "workspace:*",
|
||||
"@storybook/core-events": "workspace:*",
|
||||
"@storybook/instrumenter": "workspace:*",
|
||||
"@storybook/jest": "next",
|
||||
"@storybook/manager-api": "workspace:*",
|
||||
"@storybook/preview-api": "workspace:*",
|
||||
"@storybook/testing-library": "next",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { StoryObj, Meta } from '@storybook/react';
|
||||
import { expect } from '@storybook/jest';
|
||||
import { expect } from '@storybook/test';
|
||||
import { CallStates } from '@storybook/instrumenter';
|
||||
import { userEvent, within } from '@storybook/testing-library';
|
||||
import { getCalls } from '../mocks';
|
||||
|
@ -3,7 +3,7 @@ import type { StoryObj, Meta } from '@storybook/react';
|
||||
import { CallStates } from '@storybook/instrumenter';
|
||||
import { styled } from '@storybook/theming';
|
||||
import { userEvent, within, waitFor } from '@storybook/testing-library';
|
||||
import { expect } from '@storybook/jest';
|
||||
import { expect } from '@storybook/test';
|
||||
import isChromatic from 'chromatic/isChromatic';
|
||||
|
||||
import { getCalls, getInteractions } from '../mocks';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import * as React from 'react';
|
||||
import { Link, Placeholder } from '@storybook/components';
|
||||
import { type Call, CallStates, type ControlStates } from '@storybook/instrumenter';
|
||||
@ -103,7 +102,6 @@ export const InteractionsPanel: React.FC<InteractionsPanelProps> = React.memo(
|
||||
controls={controls}
|
||||
controlStates={controlStates}
|
||||
status={
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
isPlaying ? CallStates.ACTIVE : hasException ? CallStates.ERROR : CallStates.DONE
|
||||
}
|
||||
storyFileName={fileName}
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import React from 'react';
|
||||
import { styled, typography } from '@storybook/theming';
|
||||
import { Node } from './MethodCall';
|
||||
|
@ -34,7 +34,7 @@ export const Args = () => (
|
||||
<Node value="Hello world" />
|
||||
<Node value="https://github.com/storybookjs/storybook/blob/next/README.md" />
|
||||
<Node value="012345678901234567890123456789012345678901234567890123456789" />
|
||||
{/* eslint-disable-next-line react/jsx-boolean-value */}
|
||||
{}
|
||||
<Node value={true} />
|
||||
<Node value={false} />
|
||||
<Node value={12345} />
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import { ObjectInspector } from '@devtools-ds/object-inspector';
|
||||
import type { Call, CallRef, ElementRef } from '@storybook/instrumenter';
|
||||
import { useTheme } from '@storybook/theming';
|
||||
|
@ -29,7 +29,7 @@ const instrumentSpies: LoaderFunction = ({ initialArgs }) => {
|
||||
const instrumented = instrument({ [key]: () => value }, { retain: true })[key];
|
||||
acc[key] = instrumented();
|
||||
// this enhancer is being called multiple times
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
|
||||
value._instrumented = true;
|
||||
return acc;
|
||||
}, {} as Args);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-jest",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "React storybook addon that show component jest report",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -79,7 +79,6 @@ export function Result(props: ResultProps) {
|
||||
{isOpen ? (
|
||||
<Fragment>
|
||||
{failureMessages.map((msg: string, i: number) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Message msg={msg} key={i} />
|
||||
))}
|
||||
</Fragment>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-links",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Link stories together to build demos and prototypes with your UI components",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -17,10 +17,6 @@ vi.mock('@storybook/global', () => ({
|
||||
search: 'search',
|
||||
},
|
||||
},
|
||||
window: global,
|
||||
__STORYBOOK_STORY_STORE__: {
|
||||
fromId: vi.fn(() => ({})),
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
|
@ -23,7 +23,6 @@ function parseQuery(queryString: string) {
|
||||
.split('&')
|
||||
.filter(Boolean);
|
||||
|
||||
// eslint-disable-next-line no-plusplus
|
||||
for (let i = 0; i < pairs.length; i++) {
|
||||
const pair = pairs[i].split('=');
|
||||
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-measure",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Inspect layouts by visualizing the box model",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { global } from '@storybook/global';
|
||||
import invariant from 'tiny-invariant';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-disable operator-assignment */
|
||||
/* eslint-disable no-param-reassign */
|
||||
type LabelType = 'margin' | 'padding' | 'border' | 'content';
|
||||
type LabelPosition = 'top' | 'right' | 'bottom' | 'left' | 'center';
|
||||
type Direction = 'top' | 'right' | 'bottom' | 'left';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable operator-assignment */
|
||||
/**
|
||||
* Based on https://gist.github.com/awestbro/e668c12662ad354f02a413205b65fce7
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-outline",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Outline all elements with CSS to help with layout placement and alignment",
|
||||
"keywords": [
|
||||
"storybook-addons",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-storysource",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "View a story’s source code to see how it works and paste into your app",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-themes",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Switch between multiple themes for you components in Storybook",
|
||||
"keywords": [
|
||||
"css",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-toolbars",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Create your own toolbar items that control story rendering",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/addon-viewport",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Build responsive components by adjusting Storybook’s viewport size and orientation",
|
||||
"keywords": [
|
||||
"addon",
|
||||
|
@ -129,7 +129,6 @@ export const ViewportTool: FC = memo(
|
||||
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
||||
|
||||
if (defaultViewport && !list.find((i) => i.id === defaultViewport)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`Cannot find "defaultViewport" of "${defaultViewport}" in addon-viewport configs, please check the "viewports" setting in the configuration.`
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/builder-manager",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Storybook manager builder",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
|
@ -20,7 +20,7 @@ import type {
|
||||
ManagerBuilder,
|
||||
StarterFunction,
|
||||
} from './types';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
|
||||
import { getData } from './utils/data';
|
||||
import { safeResolve } from './utils/safeResolve';
|
||||
import { readOrderedFiles } from './utils/files';
|
||||
@ -298,7 +298,6 @@ export const start: ManagerBuilder['start'] = async (options) => {
|
||||
let result;
|
||||
|
||||
do {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
result = await asyncIterator.next();
|
||||
} while (!result.done);
|
||||
|
||||
@ -310,7 +309,6 @@ export const build: ManagerBuilder['build'] = async (options) => {
|
||||
let result;
|
||||
|
||||
do {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
result = await asyncIterator.next();
|
||||
} while (!result.done);
|
||||
|
||||
|
@ -3,7 +3,7 @@ import type { Options } from '@storybook/types';
|
||||
import { getRefs } from '@storybook/core-common';
|
||||
|
||||
import { readTemplate } from './template';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
|
||||
import { executor, getConfig } from '../index';
|
||||
|
||||
export const getData = async (options: Options) => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/builder-vite",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "A plugin to run and build Storybooks with Vite",
|
||||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-vite/#readme",
|
||||
"bugs": {
|
||||
|
@ -66,10 +66,9 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
|
||||
|
||||
${getPreviewAnnotationsFunction}
|
||||
|
||||
window.__STORYBOOK_PREVIEW__ = window.__STORYBOOK_PREVIEW__ || new PreviewWeb();
|
||||
window.__STORYBOOK_PREVIEW__ = window.__STORYBOOK_PREVIEW__ || new PreviewWeb(importFn, getProjectAnnotations);
|
||||
|
||||
window.__STORYBOOK_STORY_STORE__ = window.__STORYBOOK_STORY_STORE__ || window.__STORYBOOK_PREVIEW__.storyStore;
|
||||
window.__STORYBOOK_PREVIEW__.initialize({ importFn, getProjectAnnotations });
|
||||
|
||||
${generateHMRHandler(frameworkName)};
|
||||
`.trim();
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
|
||||
import * as fs from 'fs';
|
||||
import type { Plugin } from 'vite';
|
||||
import type { Options } from '@storybook/types';
|
||||
|
@ -12,9 +12,8 @@ function checkName(plugin: PluginOption, names: string[]) {
|
||||
*/
|
||||
export async function hasVitePlugins(plugins: PluginOption[], names: string[]) {
|
||||
const resolvedPlugins = await Promise.all(plugins);
|
||||
// eslint-disable-next-line no-restricted-syntax -- we need to await in the loop
|
||||
|
||||
for (const plugin of resolvedPlugins) {
|
||||
// eslint-disable-next-line no-await-in-loop -- we need to await in the loop
|
||||
if (Array.isArray(plugin) && Boolean(await hasVitePlugins(plugin, names))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -10,10 +10,9 @@ export const withoutVitePlugins = async (
|
||||
): Promise<PluginOption[]> => {
|
||||
const result = [];
|
||||
const resolvedPlugins = await Promise.all(plugins);
|
||||
// eslint-disable-next-line no-restricted-syntax -- we need to await in the loop
|
||||
|
||||
for (const plugin of resolvedPlugins) {
|
||||
if (Array.isArray(plugin)) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
result.push(await withoutVitePlugins(plugin, namesToRemove));
|
||||
}
|
||||
if (plugin && 'name' in plugin && !namesToRemove.includes(plugin.name)) {
|
||||
|
@ -116,7 +116,6 @@ export async function pluginConfig(options: Options) {
|
||||
|
||||
// TODO: framework doesn't exist, should move into framework when/if built
|
||||
if (frameworkName === '@storybook/glimmerx-vite') {
|
||||
// eslint-disable-next-line global-require
|
||||
const plugin = require('vite-plugin-glimmerx/index.cjs');
|
||||
plugins.push(plugin.default());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/builder-webpack5",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Storybook framework-agnostic API",
|
||||
"keywords": [
|
||||
"storybook"
|
||||
@ -75,6 +75,7 @@
|
||||
"@types/semver": "^7.3.4",
|
||||
"browser-assert": "^1.2.1",
|
||||
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
||||
"cjs-module-lexer": "^1.2.3",
|
||||
"constants-browserify": "^1.0.0",
|
||||
"css-loader": "^6.7.1",
|
||||
"es-module-lexer": "^1.4.1",
|
||||
|
@ -312,7 +312,6 @@ export const start = async (options: BuilderStartOptions) => {
|
||||
let result;
|
||||
|
||||
do {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
result = await asyncIterator.next();
|
||||
} while (!result.done);
|
||||
|
||||
@ -324,7 +323,6 @@ export const build = async (options: BuilderStartOptions) => {
|
||||
let result;
|
||||
|
||||
do {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
result = await asyncIterator.next();
|
||||
} while (!result.done);
|
||||
|
||||
|
@ -1,34 +1,58 @@
|
||||
import { parse } from 'es-module-lexer';
|
||||
import assert from 'assert';
|
||||
import { parse as parseCjs, init as initCjsParser } from 'cjs-module-lexer';
|
||||
import { parse as parseEs } from 'es-module-lexer';
|
||||
import MagicString from 'magic-string';
|
||||
import type { LoaderContext } from 'webpack';
|
||||
|
||||
export default async function loader(this: LoaderContext<any>, source: string) {
|
||||
export default async function loader(
|
||||
this: LoaderContext<any>,
|
||||
source: string,
|
||||
map: any,
|
||||
meta: any
|
||||
) {
|
||||
const callback = this.async();
|
||||
|
||||
try {
|
||||
// Do NOT remove await here. The types are wrong! It has to be awaited,
|
||||
// otherwise it will return a Promise<Promise<...>> when wasm isn't loaded.
|
||||
const [, exports = []] = await parse(source);
|
||||
const magicString = new MagicString(source);
|
||||
|
||||
const namedExportsOrder = exports.some(
|
||||
(e) => source.substring(e.s, e.e) === '__namedExportsOrder'
|
||||
);
|
||||
// Trying to parse as ES module
|
||||
try {
|
||||
// Do NOT remove await here. The types are wrong! It has to be awaited,
|
||||
// otherwise it will return a Promise<Promise<...>> when wasm isn't loaded.
|
||||
const parseResult = await parseEs(source);
|
||||
const namedExportsOrder = (parseResult[1] || [])
|
||||
.map((e) => source.substring(e.s, e.e))
|
||||
.filter((e) => e !== 'default');
|
||||
|
||||
if (namedExportsOrder) {
|
||||
return callback(null, source);
|
||||
assert(
|
||||
namedExportsOrder.length > 0,
|
||||
'No named exports found. Very likely that this is not a ES module.'
|
||||
);
|
||||
|
||||
magicString.append(
|
||||
`;export const __namedExportsOrder = ${JSON.stringify(namedExportsOrder)};`
|
||||
);
|
||||
// Try to parse as CJS module
|
||||
} catch {
|
||||
await initCjsParser();
|
||||
const namedExportsOrder = (parseCjs(source).exports || []).filter(
|
||||
(e: string) => e !== 'default' && e !== '__esModule'
|
||||
);
|
||||
|
||||
assert(
|
||||
namedExportsOrder.length > 0,
|
||||
'No named exports found. Very likely that this is not a CJS module.'
|
||||
);
|
||||
|
||||
magicString.append(
|
||||
`;module.exports.__namedExportsOrder = ${JSON.stringify(namedExportsOrder)};`
|
||||
);
|
||||
}
|
||||
|
||||
const magicString = new MagicString(source);
|
||||
const orderedExports = exports.filter((e) => source.substring(e.s, e.e) !== 'default');
|
||||
magicString.append(
|
||||
`;export const __namedExportsOrder = ${JSON.stringify(
|
||||
orderedExports.map((e) => source.substring(e.s, e.e))
|
||||
)};`
|
||||
);
|
||||
const generatedMap = magicString.generateMap({ hires: true });
|
||||
|
||||
const map = magicString.generateMap({ hires: true });
|
||||
return callback(null, magicString.toString(), map);
|
||||
return callback(null, magicString.toString(), generatedMap, meta);
|
||||
} catch (err) {
|
||||
return callback(err as any);
|
||||
return callback(null, source, map, meta);
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,12 @@ if (global.CONFIG_TYPE === 'DEVELOPMENT'){
|
||||
window.__STORYBOOK_SERVER_CHANNEL__ = channel;
|
||||
}
|
||||
|
||||
const preview = new PreviewWeb();
|
||||
const preview = new PreviewWeb(importFn, getProjectAnnotations);
|
||||
|
||||
window.__STORYBOOK_PREVIEW__ = preview;
|
||||
window.__STORYBOOK_STORY_STORE__ = preview.storyStore;
|
||||
window.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
||||
|
||||
preview.initialize({ importFn, getProjectAnnotations });
|
||||
|
||||
if (import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept('./{{storiesFilename}}', () => {
|
||||
// importFn has changed so we need to patch the new one in
|
||||
|
@ -7,9 +7,7 @@ const templateName = process.env.STORYBOOK_TEMPLATE_NAME || '';
|
||||
|
||||
test.describe('addon-actions', () => {
|
||||
test('should trigger an action', async ({ page }) => {
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
templateName.includes('svelte') && templateName.includes('prerelease'),
|
||||
'Svelte 5 prerelase does not support automatic actions with our current example components yet'
|
||||
);
|
||||
|
@ -1,6 +1,3 @@
|
||||
/* eslint-disable jest/valid-title */
|
||||
/* eslint-disable jest/no-disabled-tests */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { test, expect } from '@playwright/test';
|
||||
import process from 'process';
|
||||
import dedent from 'ts-dedent';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable jest/no-disabled-tests,jest/valid-title */
|
||||
import { test, expect } from '@playwright/test';
|
||||
import process from 'process';
|
||||
import { SbPage } from './util';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable jest/no-disabled-tests */
|
||||
import type { Locator } from '@playwright/test';
|
||||
import { test, expect } from '@playwright/test';
|
||||
import process from 'process';
|
||||
@ -11,7 +10,6 @@ test.describe('Next.js', () => {
|
||||
// TODO: improve these E2E tests given that we have more version of Next.js to test
|
||||
// and this only tests nextjs/default-js
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
!templateName?.includes('nextjs/default-js'),
|
||||
'Only run this test for the Frameworks that support next/navigation'
|
||||
);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable jest/no-disabled-tests */
|
||||
import { test, expect } from '@playwright/test';
|
||||
import process from 'process';
|
||||
import { SbPage } from './util';
|
||||
@ -12,11 +11,7 @@ test.beforeEach(async ({ page }) => {
|
||||
});
|
||||
|
||||
test.describe('Svelte', () => {
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
!templateName?.includes('svelte'),
|
||||
'Only run this test on Svelte'
|
||||
);
|
||||
test.skip(!templateName?.includes('svelte'), 'Only run this test on Svelte');
|
||||
|
||||
test('JS story has auto-generated args table', async ({ page }) => {
|
||||
const sbPage = new SbPage(page);
|
||||
@ -28,7 +23,6 @@ test.describe('Svelte', () => {
|
||||
});
|
||||
|
||||
test('TS story has auto-generated args table', async ({ page }) => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
test.skip(!templateName?.endsWith('ts') || false, 'Only test TS story in TS templates');
|
||||
const sbPage = new SbPage(page);
|
||||
|
||||
@ -66,11 +60,7 @@ test.describe('Svelte', () => {
|
||||
});
|
||||
|
||||
test.describe('SvelteKit', () => {
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
!templateName?.includes('svelte-kit'),
|
||||
'Only run this test on SvelteKit'
|
||||
);
|
||||
test.skip(!templateName?.includes('svelte-kit'), 'Only run this test on SvelteKit');
|
||||
|
||||
test('Links are logged in Actions panel', async ({ page }) => {
|
||||
const sbPage = new SbPage(page);
|
||||
|
@ -192,12 +192,7 @@ test.describe('Manager UI', () => {
|
||||
// TODO: remove this when SSV6 templates have been removed
|
||||
// Some assertions in these tests are not compatible with SSV6
|
||||
// GIven that SSV6 will be removed before the new mobile UI released, it doesn't make sense to fix them
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
templateName?.includes('ssv6') || false,
|
||||
'Skip mobile UI tests for SSV6'
|
||||
);
|
||||
test.skip(templateName?.includes('ssv6') || false, 'Skip mobile UI tests for SSV6');
|
||||
|
||||
// standard iPhone viewport size
|
||||
test.use({ viewport: { width: 390, height: 844 } });
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable jest/no-disabled-tests */
|
||||
import { test, expect } from '@playwright/test';
|
||||
import process from 'process';
|
||||
import { SbPage } from './util';
|
||||
@ -15,7 +14,6 @@ test.describe('preview-web', () => {
|
||||
|
||||
test('should pass over shortcuts, but not from play functions, story', async ({ page }) => {
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
/^(lit)/i.test(`${templateName}`),
|
||||
`Skipping ${templateName}, which does not support addon-interactions`
|
||||
);
|
||||
@ -40,7 +38,6 @@ test.describe('preview-web', () => {
|
||||
|
||||
test('should pass over shortcuts, but not from play functions, docs', async ({ page }) => {
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
/^(lit)/i.test(`${templateName}`),
|
||||
`Skipping ${templateName}, which does not support addon-interactions`
|
||||
);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
import { toId } from '@storybook/csf';
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/angular",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
||||
"keywords": [
|
||||
"storybook",
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { vi, describe, beforeEach, expect } from 'vitest';
|
||||
import { vi, describe, beforeEach, expect, it, afterEach } from 'vitest';
|
||||
import { Architect, createBuilder } from '@angular-devkit/architect';
|
||||
import { TestingArchitectHost } from '@angular-devkit/architect/testing';
|
||||
import { schema } from '@angular-devkit/core';
|
||||
@ -35,7 +35,6 @@ vi.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
|
||||
const mockRunScript = vi.fn();
|
||||
|
||||
// Randomly fails on CI. TODO: investigate why
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
describe.skip('Build Storybook Builder', () => {
|
||||
let architect: Architect;
|
||||
let architectHost: TestingArchitectHost;
|
||||
@ -181,7 +180,6 @@ describe.skip('Build Storybook Builder', () => {
|
||||
|
||||
expect(false).toEqual('Throw expected');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
|
||||
expect(error).toEqual(
|
||||
'Broken build, fix the error above.\nYou may need to refresh the browser.'
|
||||
);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { vi, describe, expect, it, beforeEach } from 'vitest';
|
||||
import { vi, describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||
import { Architect, createBuilder } from '@angular-devkit/architect';
|
||||
import { TestingArchitectHost } from '@angular-devkit/architect/testing';
|
||||
import { schema } from '@angular-devkit/core';
|
||||
@ -34,7 +34,6 @@ vi.mock('@storybook/cli', () => ({
|
||||
}));
|
||||
|
||||
// Randomly fails on CI. TODO: investigate why
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
describe.skip('Start Storybook Builder', () => {
|
||||
let architect: Architect;
|
||||
let architectHost: TestingArchitectHost;
|
||||
@ -161,7 +160,6 @@ describe.skip('Start Storybook Builder', () => {
|
||||
|
||||
expect(false).toEqual('Throw expected');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
|
||||
expect(error).toEqual(
|
||||
'Broken build, fix the error above.\nYou may need to refresh the browser.'
|
||||
);
|
||||
|
@ -86,7 +86,7 @@ const commandBuilder: BuilderHandlerFn<StorybookBuilderOptions> = (options, cont
|
||||
configDir: 'SBCONFIG_CONFIG_DIR',
|
||||
ci: 'CI',
|
||||
});
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
|
||||
options.port = parseInt(`${options.port}`, 10);
|
||||
|
||||
const {
|
||||
|
@ -48,7 +48,6 @@ export abstract class AbstractRenderer {
|
||||
// platform should be set after enableProdMode()
|
||||
enableProdMode();
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug(e);
|
||||
}
|
||||
}
|
||||
@ -157,7 +156,6 @@ export abstract class AbstractRenderer {
|
||||
* Adds DOM element that angular will use as bootstrap component.
|
||||
*/
|
||||
protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
targetDOMNode.innerHTML = '';
|
||||
targetDOMNode.appendChild(document.createElement(targetSelector));
|
||||
}
|
||||
@ -177,7 +175,7 @@ export abstract class AbstractRenderer {
|
||||
|
||||
const currentStoryRender = {
|
||||
storyFnAngular,
|
||||
moduleMetadataSnapshot: stringify(moduleMetadata),
|
||||
moduleMetadataSnapshot: stringify(moduleMetadata, { allowFunction: false }),
|
||||
};
|
||||
|
||||
this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender);
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ArgTypes } from '@storybook/types';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { computesTemplateSourceFromComponent } from './ComputesTemplateFromComponent';
|
||||
import { ISomeInterface, ButtonAccent, InputComponent } from './__testfixtures__/input.component';
|
||||
|
||||
@ -379,9 +380,9 @@ describe('angular source decorator', () => {
|
||||
'a single quoted string with escaped \'single quotes\'',
|
||||
// eslint-disable-next-line prettier/prettier
|
||||
"a double quoted string with escaped \"double quotes\"",
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
|
||||
`a string literal with \'escaped single quotes\'`,
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
|
||||
`a string literal with \"escaped double quotes\"`,
|
||||
],
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { Component, ɵresetJitOptions } from '@angular/core';
|
||||
import { platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
@ -14,7 +14,6 @@ describe('RendererFactory', () => {
|
||||
let rendererFactory: RendererFactory;
|
||||
let rootTargetDOMNode: HTMLElement;
|
||||
let rootDocstargetDOMNode: HTMLElement;
|
||||
let storyInDocstargetDOMNode: HTMLElement;
|
||||
|
||||
beforeEach(async () => {
|
||||
rendererFactory = new RendererFactory();
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { NgModule, Type, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { NgModule, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
getComponentInputsOutputs,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { isComponentAlreadyDeclared } from './NgModulesAnalyzer';
|
||||
|
||||
const FooComponent = Component({})(class {});
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
provideNoopAnimations,
|
||||
} from '@angular/platform-browser/animations';
|
||||
import { NgModuleMetadata } from '../../types';
|
||||
import { PropertyExtractor, REMOVED_MODULES } from './PropertyExtractor';
|
||||
import { PropertyExtractor } from './PropertyExtractor';
|
||||
import { WithOfficialModule } from '../__testfixtures__/test.module';
|
||||
|
||||
const TEST_TOKEN = new InjectionToken('testToken');
|
||||
@ -18,7 +18,6 @@ const TestService = Injectable()(class {});
|
||||
const TestComponent1 = Component({})(class {});
|
||||
const TestComponent2 = Component({})(class {});
|
||||
const StandaloneTestComponent = Component({ standalone: true })(class {});
|
||||
const TestDirective = Directive({})(class {});
|
||||
const StandaloneTestDirective = Directive({ standalone: true })(class {});
|
||||
const TestModuleWithDeclarations = NgModule({ declarations: [TestComponent1] })(class {});
|
||||
const TestModuleWithImportsAndProviders = NgModule({
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
Component,
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { argsToTemplate, ArgsToTemplateOptions } from './argsToTemplate'; // adjust path
|
||||
|
||||
describe('argsToTemplate', () => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Component, Input, Output } from '@angular/core';
|
||||
import { DecoratorFunction, StoryContext } from '@storybook/types';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { componentWrapperDecorator } from './decorators';
|
||||
|
||||
import decorateStory from './decorateStory';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { Type } from '@angular/core';
|
||||
import { ApplicationConfig } from '@angular/platform-browser';
|
||||
import { DecoratorFunction, StoryContext } from '@storybook/types';
|
||||
|
@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
/* eslint-disable no-console */
|
||||
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
import {
|
||||
Component,
|
||||
|
@ -1,36 +1,10 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import tmp from 'tmp';
|
||||
import { sync as spawnSync } from 'cross-spawn';
|
||||
|
||||
import { findComponentByName, extractArgTypesFromData } from './compodoc';
|
||||
|
||||
// @ts-expect-error (Converted from ts-ignore)
|
||||
const { SNAPSHOT_OS } = global;
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// File hierarchy: __testfixtures__ / some-test-case / input.*
|
||||
const inputRegExp = /^input\..*$/;
|
||||
|
||||
const runCompodoc = (inputPath: string) => {
|
||||
const testDir = path.dirname(inputPath);
|
||||
const { name: tmpDir, removeCallback } = tmp.dirSync();
|
||||
|
||||
// FIXME: for now, this requires a tsconfig.json for each test case. Tried generating
|
||||
// one dynamically in tmpDir, but compodoc doesn't handle absolute paths properly
|
||||
// (and screwed around with relative paths as well, but couldn't get it working)
|
||||
spawnSync('yarn', ['compodoc', '-p', `${testDir}/tsconfig.json`, '-e', 'json', '-d', tmpDir], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
const output = fs.readFileSync(`${tmpDir}/documentation.json`, 'utf8');
|
||||
try {
|
||||
removeCallback();
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
describe('angular component properties', () => {
|
||||
const fixturesDir = path.join(__dirname, '__testfixtures__');
|
||||
fs.readdirSync(fixturesDir, { withFileTypes: true }).forEach((testEntry) => {
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable global-require */
|
||||
// Private angular devkit stuff
|
||||
const {
|
||||
generateI18nBrowserWebpackConfigFromContext,
|
||||
|
@ -33,7 +33,6 @@ function loadEsmModule<T>(modulePath: string): Promise<T> {
|
||||
export const runNgcc = async () => {
|
||||
let ngcc: any;
|
||||
try {
|
||||
// eslint-disable-next-line global-require
|
||||
ngcc = require('@angular/compiler-cli/ngcc');
|
||||
} catch (error) {
|
||||
ngcc = await loadEsmModule('@angular/compiler-cli/ngcc');
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
import {
|
||||
Component,
|
||||
|
@ -23,6 +23,6 @@ export class DiComponent {
|
||||
}
|
||||
|
||||
elRefStr(): string {
|
||||
return stringify(this.elRef, { maxDepth: 1 });
|
||||
return stringify(this.elRef, { maxDepth: 1, allowFunction: false });
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Meta, StoryObj, applicationConfig } from '@storybook/angular';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { within, userEvent } from '@storybook/testing-library';
|
||||
import { expect } from '@storybook/jest';
|
||||
import { expect } from '@storybook/test';
|
||||
import { importProvidersFrom } from '@angular/core';
|
||||
import { OpenCloseComponent } from '../moduleMetadata/angular-src/open-close-component/open-close.component';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Meta, StoryObj } from '@storybook/angular';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { within, userEvent } from '@storybook/testing-library';
|
||||
import { expect } from '@storybook/jest';
|
||||
import { expect } from '@storybook/test';
|
||||
import { importProvidersFrom } from '@angular/core';
|
||||
import { OpenCloseComponent } from '../moduleMetadata/angular-src/open-close-component/open-close.component';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@storybook/ember",
|
||||
"version": "8.0.0-alpha.9",
|
||||
"version": "8.0.0-alpha.10",
|
||||
"description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
|
||||
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/ember",
|
||||
"bugs": {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user