Skip to content

Commit 03dd770

Browse files
committed
refactor: use import type for type-only imports across all packages
Add explicit `type` annotations to all type-only imports and exports. This is a pure TypeScript syntax change with no runtime effect -- the compiled JavaScript output is identical. It prepares for Node 24's type stripping, which requires `import type` for type-only imports since they are erased at runtime. 93 files changed across dev-server, test-runner, rollup-plugin, and storybook packages. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ce7a735 commit 03dd770

File tree

85 files changed

+219
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+219
-192
lines changed

packages/dev-server-core/src/plugins/Plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { FSWatcher } from 'chokidar';
22
import Koa, { Context } from 'koa';
3-
import { Server } from 'net';
3+
import { type Server } from 'net';
44

5-
import { DevServerCoreConfig } from '../server/DevServerCoreConfig';
6-
import { Logger } from '../logger/Logger';
5+
import type { DevServerCoreConfig } from '../server/DevServerCoreConfig';
6+
import type { Logger } from '../logger/Logger';
77
import { WebSocketsManager } from '../web-sockets/WebSocketsManager';
88

99
export type ServeResult =

packages/dev-server-core/src/server/createServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import http2Server from 'http2';
66
import fs from 'fs';
77
import net, { Server, Socket, ListenOptions } from 'net';
88

9-
import { DevServerCoreConfig } from './DevServerCoreConfig.js';
9+
import type { DevServerCoreConfig } from './DevServerCoreConfig.js';
1010
import { createMiddleware } from './createMiddleware.js';
11-
import { Logger } from '../logger/Logger.js';
11+
import type { Logger } from '../logger/Logger.js';
1212
import { addPlugins } from './addPlugins.js';
1313

1414
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { RollupNodeResolveOptions, nodeResolve } from '@rollup/plugin-node-resolve';
1+
export { type RollupNodeResolveOptions, nodeResolve } from '@rollup/plugin-node-resolve';
22
export { fromRollup } from './fromRollup.js';
33
export { rollupAdapter } from './rollupAdapter.js';
44
export { rollupBundlePlugin } from './rollupBundlePlugin.js';

packages/dev-server-storybook/src/build/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { buildAndWrite } from './rollup/buildAndWrite.js';
66
import { createManagerHtml } from '../shared/html/createManagerHtml.js';
77
import { createPreviewHtml } from '../shared/html/createPreviewHtml.js';
88
import { findStories } from '../shared/stories/findStories.js';
9-
import { StorybookPluginConfig } from '../shared/config/StorybookPluginConfig.js';
10-
import { StorybookConfig } from '../shared/config/StorybookConfig.js';
9+
import { type StorybookPluginConfig } from '../shared/config/StorybookPluginConfig.js';
10+
import { type StorybookConfig } from '../shared/config/StorybookConfig.js';
1111

1212
interface BuildPreviewParams {
1313
type: string;

packages/dev-server-storybook/src/build/rollup/buildAndWrite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rollup, RollupOptions } from 'rollup';
1+
import { rollup, type RollupOptions } from 'rollup';
22

33
export async function buildAndWrite(options: RollupOptions) {
44
const bundle = await rollup(options);

packages/dev-server-storybook/src/build/rollup/createRollupConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createRequire } from 'node:module';
2-
import { Plugin, RollupOptions, RollupLog } from 'rollup';
2+
import { type Plugin, type RollupOptions, type RollupLog } from 'rollup';
33

44
import { nodeResolve as resolve } from '@rollup/plugin-node-resolve';
55
import { babel } from '@rollup/plugin-babel';

packages/dev-server-storybook/src/build/rollup/injectExportsOrderPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin } from 'rollup';
1+
import { type Plugin } from 'rollup';
22
import { injectExportsOrder } from '../../shared/stories/injectExportsOrder.js';
33

44
export function injectExportsOrderPlugin(storyFilePaths: string[]): Plugin {

packages/dev-server-storybook/src/build/rollup/mdjsPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin } from 'rollup';
1+
import { type Plugin } from 'rollup';
22
import { mdjsToCsf } from 'storybook-addon-markdown-docs';
33

44
export function mdjsPlugin(type: string): Plugin {

packages/dev-server-storybook/src/build/rollup/mdxPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin } from 'rollup';
1+
import { type Plugin } from 'rollup';
22
import { transformMdxToCsf } from '../../shared/mdx/transformMdxToCsf.js';
33

44
export function mdxPlugin(): Plugin {

packages/dev-server-storybook/src/serve/storybookPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @ts-ignore
2-
import { DevServerCoreConfig, getRequestFilePath, Plugin } from '@web/dev-server-core';
2+
import { type DevServerCoreConfig, getRequestFilePath, type Plugin } from '@web/dev-server-core';
33
import { mdjsToCsf } from 'storybook-addon-markdown-docs';
44

5-
import { StorybookPluginConfig } from '../shared/config/StorybookPluginConfig.js';
5+
import { type StorybookPluginConfig } from '../shared/config/StorybookPluginConfig.js';
66
import { createManagerHtml } from '../shared/html/createManagerHtml.js';
77
import { createPreviewHtml } from '../shared/html/createPreviewHtml.js';
88
import { readStorybookConfig } from '../shared/config/readStorybookConfig.js';

0 commit comments

Comments
 (0)