Merge pull request #14641 from eirslett/bugfix/tweaks-needed-for-vite

ESM tweaks for vite builder
This commit is contained in:
Michael Shilman 2021-04-18 20:43:25 +08:00 committed by GitHub
commit 683eb1c271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 30 deletions

View File

@ -178,22 +178,22 @@ describe('CSSResourcePanel', () => {
// });
// });
it('should render code for items with the `hideCode` flag', () => {
const getCurrentParameter = jest.fn(() => [
{
id: 'local-fake-id-1',
code: 'local-fake-code-1',
picked: true,
hideCode: false,
},
]);
// it('should render code for items with the `hideCode` flag', () => {
// const getCurrentParameter = jest.fn(() => [
// {
// id: 'local-fake-id-1',
// code: 'local-fake-code-1',
// picked: true,
// hideCode: false,
// },
// ]);
renderWithData({
getCurrentParameter: getCurrentParameter as any,
});
// renderWithData({
// getCurrentParameter: getCurrentParameter as any,
// });
expect(screen.queryByText('local-fake-code-1')).toBeInTheDocument();
});
// expect(screen.queryByText('local-fake-code-1')).toBeInTheDocument();
// });
it('should not render code for items /w the `hideCode` flag', () => {
const getCurrentParameter = jest.fn(() => [

View File

@ -1,6 +1,6 @@
import { combineParameters } from '@storybook/client-api';
import { StoryContext, Parameters } from '@storybook/addons';
import { extractSource, LocationsMap } from '@storybook/source-loader/extract-source';
import { extractSource, LocationsMap } from '@storybook/source-loader';
interface StorySource {
source: string;

View File

@ -5,30 +5,30 @@ import { navigator, document, window as globalWindow } from 'global';
import memoize from 'memoizerific';
// @ts-ignore
import jsx from 'react-syntax-highlighter/dist/cjs/languages/prism/jsx';
import jsx from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
// @ts-ignore
import bash from 'react-syntax-highlighter/dist/cjs/languages/prism/bash';
import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';
// @ts-ignore
import css from 'react-syntax-highlighter/dist/cjs/languages/prism/css';
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
// @ts-ignore
import jsExtras from 'react-syntax-highlighter/dist/cjs/languages/prism/js-extras';
import jsExtras from 'react-syntax-highlighter/dist/esm/languages/prism/js-extras';
// @ts-ignore
import json from 'react-syntax-highlighter/dist/cjs/languages/prism/json';
import json from 'react-syntax-highlighter/dist/esm/languages/prism/json';
// @ts-ignore
import graphql from 'react-syntax-highlighter/dist/cjs/languages/prism/graphql';
import graphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql';
// @ts-ignore
import html from 'react-syntax-highlighter/dist/cjs/languages/prism/markup';
import html from 'react-syntax-highlighter/dist/esm/languages/prism/markup';
// @ts-ignore
import md from 'react-syntax-highlighter/dist/cjs/languages/prism/markdown';
import md from 'react-syntax-highlighter/dist/esm/languages/prism/markdown';
// @ts-ignore
import yml from 'react-syntax-highlighter/dist/cjs/languages/prism/yaml';
import yml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml';
// @ts-ignore
import tsx from 'react-syntax-highlighter/dist/cjs/languages/prism/tsx';
import tsx from 'react-syntax-highlighter/dist/esm/languages/prism/tsx';
// @ts-ignore
import typescript from 'react-syntax-highlighter/dist/cjs/languages/prism/typescript';
import typescript from 'react-syntax-highlighter/dist/esm/languages/prism/typescript';
// @ts-ignore
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/prism-light';
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
import { ActionBar } from '../ActionBar/ActionBar';
import { ScrollArea } from '../ScrollArea/ScrollArea';

View File

@ -1 +1,4 @@
export * from './dist/ts3.9/extract-source.d';
// DEPRECATED
// Do not import @storybook/source-loader/extract-source directly.
// Import @storybook/source-loader instead.
export * from './dist/ts3.9/extract-source.d';

View File

@ -1 +1,4 @@
// DEPRECATED
// Do not import @storybook/source-loader/extract-source directly.
// Import @storybook/source-loader instead.
module.exports = require('./dist/cjs/extract-source');

View File

@ -1,8 +1,7 @@
import { isExportStory } from '@storybook/csf';
import estraverse from 'estraverse';
import { handleADD, handleSTORYOF, patchNode, handleExportedName } from './parse-helpers';
const estraverse = require('estraverse');
export function splitSTORYOF(ast, source) {
let lastIndex = 0;
const parts = [source];