Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/export-setup-ts-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@modern-js/app-tools': patch
---

feat(app-tools): export `setupTsRuntime` and `resolveTsRuntimeRegisterMode` from the public entry

The server TypeScript runtime setup app-tools' own dev/build commands use
(ts-node when the project depends on it, Node.js native TypeScript as the
fallback, plus tsconfig-paths/alias registration) is now part of the public
API, so frameworks composing app-tools in-process (running their own command
actions instead of app-tools') can register the same runtime without keeping
a private copy of the logic. Also exports the `TsRuntimeRegisterMode` and
`TsRuntimeSetupOptions` types.
6 changes: 6 additions & 0 deletions packages/solutions/app-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ export { dev } from './commands/dev';
export { serve } from './commands/serve';
export type { DevOptions } from './utils/types';
export { generateWatchFiles } from './utils/generateWatchFiles';
export {
resolveTsRuntimeRegisterMode,
setupTsRuntime,
type TsRuntimeRegisterMode,
type TsRuntimeSetupOptions,
} from './utils/register';
export {
resolveModernRsbuildConfig,
type ResolveModernRsbuildConfigOptions,
Expand Down
4 changes: 2 additions & 2 deletions packages/solutions/app-tools/src/utils/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
} from '@modern-js/utils';
import type { ConfigChain } from '@rsbuild/core';

type TsRuntimeRegisterMode = 'ts-node' | 'node-loader' | 'unsupported';
export type TsRuntimeRegisterMode = 'ts-node' | 'node-loader' | 'unsupported';

interface TsRuntimeSetupOptions {
export interface TsRuntimeSetupOptions {
moduleType?: string;
/**
* User-configured `server.tsconfigPath`. Forwarded into the shared
Expand Down
Loading