Refactor package.json and related files to remove toolbar entries, update TypeScript definitions, and adjust imports for better integration. Ensure consistency in external dependencies and improve code organization.

This commit is contained in:
Norbert de Langen 2025-03-20 21:03:05 +01:00
parent f2df3e0013
commit 7d09876cf7
7 changed files with 6 additions and 25 deletions

View File

@ -134,16 +134,6 @@
"types": "./dist/controls/decorator.d.ts",
"import": "./dist/controls/decorator.js"
},
"./internal/toolbar": {
"types": "./dist/toolbar/index.d.ts",
"import": "./dist/toolbar/index.js",
"require": "./dist/toolbar/index.cjs"
},
"./internal/toolbar/preview": {
"types": "./dist/toolbar/preview.d.ts",
"import": "./dist/toolbar/preview.js",
"require": "./dist/toolbar/preview.cjs"
},
"./internal/toolbar/manager": {
"import": "./dist/toolbar/manager.js"
},
@ -369,12 +359,6 @@
"internal/controls/decorator": [
"./dist/controls/decorator.d.ts"
],
"internal/toolbar": [
"./dist/toolbar/index.d.ts"
],
"internal/toolbar/preview": [
"./dist/toolbar/preview.d.ts"
],
"internal/core-events": [
"./dist/core-events/index.d.ts"
],

View File

@ -27,6 +27,7 @@ async function run() {
'storybook/test/spy',
'storybook/test/preview',
'storybook/internal/toolbar/manager',
'storybook/actions',
'storybook/actions/preview',
'storybook/actions/manager',

View File

@ -27,8 +27,6 @@ export const getEntries = (cwd: string) => {
define('src/controls/manager.tsx', ['browser'], false, ['react']),
define('src/controls/decorator.ts', ['browser'], true, ['react']),
define('src/toolbar/index.ts', ['browser', 'node'], true, ['react']),
define('src/toolbar/preview.ts', ['browser', 'node'], true, ['react']),
define('src/toolbar/manager.tsx', ['browser'], false, ['react']),
define('src/core-events/index.ts', ['browser', 'node'], true),

View File

@ -1,5 +1,4 @@
import type { ComponentProps, ReactNode, SyntheticEvent } from 'react';
import React from 'react';
import React, { type ComponentProps, type ReactNode, type SyntheticEvent } from 'react';
import memoize from 'memoizerific';
import { styled } from 'storybook/theming';

View File

@ -1,5 +1,4 @@
import type { FC } from 'react';
import React from 'react';
import React, { type FC } from 'react';
import { Separator } from 'storybook/internal/components';

View File

@ -1,5 +1,4 @@
import type { FC } from 'react';
import React from 'react';
import React, { type FC } from 'react';
import { IconButton, Icons, type IconsProps } from 'storybook/internal/components';

View File

@ -31,7 +31,7 @@ export const dts = async (entry: string, externals: string[], tsconfig: string)
const dir = dirname(entry).replace('src', 'dist');
const out = await rollup.rollup({
input: entry,
external: [...externals, 'ast-types'].map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
external: [...externals, 'ast-types', 'react'].map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
output: { file: entry.replace('src', 'dist').replace('.ts', '.d.ts'), format: 'es' },
plugins: [
rpd.dts({
@ -40,6 +40,7 @@ export const dts = async (entry: string, externals: string[], tsconfig: string)
compilerOptions: {
esModuleInterop: true,
baseUrl: '.',
jsx: ts.JsxEmit.React,
declaration: true,
noEmit: false,
emitDeclarationOnly: true,