@bleedingdev/modern-js-plugin 3.8.3-ultramodern.6 → 3.9.0-ultramodern.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/runtime/api.js +2 -0
  2. package/dist/cjs/runtime/hooks.js +2 -0
  3. package/dist/esm/runtime/api.mjs +2 -0
  4. package/dist/esm/runtime/hooks.mjs +2 -0
  5. package/dist/esm-node/runtime/api.mjs +2 -0
  6. package/dist/esm-node/runtime/hooks.mjs +2 -0
  7. package/dist/types/cli/api.d.ts +4 -4
  8. package/dist/types/cli/context.d.ts +2 -2
  9. package/dist/types/cli/hooks.d.ts +27 -27
  10. package/dist/types/cli/index.d.ts +6 -6
  11. package/dist/types/cli/run/config/createLoadedConfig.d.ts +1 -1
  12. package/dist/types/cli/run/config/createResolvedConfig.d.ts +2 -2
  13. package/dist/types/cli/run/create.d.ts +7 -7
  14. package/dist/types/cli/run/index.d.ts +9 -9
  15. package/dist/types/cli/run/run.d.ts +1 -1
  16. package/dist/types/cli/run/types.d.ts +2 -2
  17. package/dist/types/cli/run/utils/createFileWatcher.d.ts +2 -2
  18. package/dist/types/cli/run/utils/mergeConfig.d.ts +1 -1
  19. package/dist/types/hooks.d.ts +1 -1
  20. package/dist/types/index.d.ts +7 -7
  21. package/dist/types/manager.d.ts +1 -1
  22. package/dist/types/runtime/api.d.ts +4 -4
  23. package/dist/types/runtime/context.d.ts +2 -2
  24. package/dist/types/runtime/hooks.d.ts +1 -1
  25. package/dist/types/runtime/index.d.ts +6 -5
  26. package/dist/types/runtime/run/create.d.ts +3 -3
  27. package/dist/types/runtime/run/index.d.ts +2 -2
  28. package/dist/types/runtime/run/types.d.ts +1 -1
  29. package/dist/types/server/api.d.ts +4 -4
  30. package/dist/types/server/context.d.ts +3 -3
  31. package/dist/types/server/hooks.d.ts +5 -5
  32. package/dist/types/server/index.d.ts +5 -4
  33. package/dist/types/server/run/create.d.ts +3 -3
  34. package/dist/types/server/run/index.d.ts +4 -4
  35. package/dist/types/server/run/types.d.ts +7 -2
  36. package/dist/types/types/cli/api.d.ts +6 -6
  37. package/dist/types/types/cli/context.d.ts +3 -3
  38. package/dist/types/types/cli/hooks.d.ts +3 -3
  39. package/dist/types/types/cli/index.d.ts +4 -4
  40. package/dist/types/types/cli/plugin.d.ts +4 -4
  41. package/dist/types/types/hooks.d.ts +1 -1
  42. package/dist/types/types/index.d.ts +4 -4
  43. package/dist/types/types/plugin.d.ts +2 -2
  44. package/dist/types/types/runtime/api.d.ts +9 -7
  45. package/dist/types/types/runtime/context.d.ts +3 -3
  46. package/dist/types/types/runtime/hooks.d.ts +105 -7
  47. package/dist/types/types/runtime/index.d.ts +4 -4
  48. package/dist/types/types/runtime/plugin.d.ts +4 -4
  49. package/dist/types/types/server/api.d.ts +5 -5
  50. package/dist/types/types/server/context.d.ts +5 -3
  51. package/dist/types/types/server/hooks.d.ts +1 -1
  52. package/dist/types/types/server/index.d.ts +4 -4
  53. package/dist/types/types/server/plugin.d.ts +4 -4
  54. package/package.json +8 -8
@@ -74,7 +74,9 @@ function initPluginAPI({ context, plugins }) {
74
74
  config: hooks.config.tap,
75
75
  onBeforeRender: hooks.onBeforeRender.tap,
76
76
  wrapRoot: hooks.wrapRoot.tap,
77
+ resolveComponent: hooks.resolveComponent.tap,
77
78
  pickContext: hooks.pickContext.tap,
79
+ transformRuntimeContext: hooks.transformRuntimeContext.tap,
78
80
  extendStringSSRCollectors: hooks.extendStringSSRCollectors.tap,
79
81
  extendStreamSSR: hooks.extendStreamSSR.tap,
80
82
  ...extendsPluginApi
@@ -35,7 +35,9 @@ function initHooks() {
35
35
  return {
36
36
  onBeforeRender: (0, external_hooks_js_namespaceObject.createAsyncInterruptHook)(),
37
37
  wrapRoot: (0, external_hooks_js_namespaceObject.createSyncHook)(),
38
+ resolveComponent: (0, external_hooks_js_namespaceObject.createSyncHook)(),
38
39
  pickContext: (0, external_hooks_js_namespaceObject.createSyncHook)(),
40
+ transformRuntimeContext: (0, external_hooks_js_namespaceObject.createSyncHook)(),
39
41
  config: (0, external_hooks_js_namespaceObject.createCollectSyncHook)(),
40
42
  extendStringSSRCollectors: (0, external_hooks_js_namespaceObject.createCollectSyncHook)(),
41
43
  extendStreamSSR: (0, external_hooks_js_namespaceObject.createCollectSyncHook)()
@@ -42,7 +42,9 @@ function initPluginAPI({ context, plugins }) {
42
42
  config: hooks.config.tap,
43
43
  onBeforeRender: hooks.onBeforeRender.tap,
44
44
  wrapRoot: hooks.wrapRoot.tap,
45
+ resolveComponent: hooks.resolveComponent.tap,
45
46
  pickContext: hooks.pickContext.tap,
47
+ transformRuntimeContext: hooks.transformRuntimeContext.tap,
46
48
  extendStringSSRCollectors: hooks.extendStringSSRCollectors.tap,
47
49
  extendStreamSSR: hooks.extendStreamSSR.tap,
48
50
  ...extendsPluginApi
@@ -3,7 +3,9 @@ function initHooks() {
3
3
  return {
4
4
  onBeforeRender: createAsyncInterruptHook(),
5
5
  wrapRoot: createSyncHook(),
6
+ resolveComponent: createSyncHook(),
6
7
  pickContext: createSyncHook(),
8
+ transformRuntimeContext: createSyncHook(),
7
9
  config: createCollectSyncHook(),
8
10
  extendStringSSRCollectors: createCollectSyncHook(),
9
11
  extendStreamSSR: createCollectSyncHook()
@@ -43,7 +43,9 @@ function initPluginAPI({ context, plugins }) {
43
43
  config: hooks.config.tap,
44
44
  onBeforeRender: hooks.onBeforeRender.tap,
45
45
  wrapRoot: hooks.wrapRoot.tap,
46
+ resolveComponent: hooks.resolveComponent.tap,
46
47
  pickContext: hooks.pickContext.tap,
48
+ transformRuntimeContext: hooks.transformRuntimeContext.tap,
47
49
  extendStringSSRCollectors: hooks.extendStringSSRCollectors.tap,
48
50
  extendStreamSSR: hooks.extendStreamSSR.tap,
49
51
  ...extendsPluginApi
@@ -4,7 +4,9 @@ function initHooks() {
4
4
  return {
5
5
  onBeforeRender: createAsyncInterruptHook(),
6
6
  wrapRoot: createSyncHook(),
7
+ resolveComponent: createSyncHook(),
7
8
  pickContext: createSyncHook(),
9
+ transformRuntimeContext: createSyncHook(),
8
10
  config: createCollectSyncHook(),
9
11
  extendStringSSRCollectors: createCollectSyncHook(),
10
12
  extendStreamSSR: createCollectSyncHook()
@@ -1,7 +1,7 @@
1
- import type { CLIPluginAPI } from '../types/cli/api';
2
- import type { InternalContext } from '../types/cli/context';
3
- import type { CLIPluginExtends } from '../types/cli/plugin';
4
- import type { PluginManager } from '../types/plugin';
1
+ import type { CLIPluginAPI } from '../types/cli/api.js';
2
+ import type { InternalContext } from '../types/cli/context.js';
3
+ import type { CLIPluginExtends } from '../types/cli/plugin.js';
4
+ import type { PluginManager } from '../types/plugin.js';
5
5
  export declare function initPluginAPI<Extends extends CLIPluginExtends>({ context, pluginManager, }: {
6
6
  context: InternalContext<Extends>;
7
7
  pluginManager: PluginManager;
@@ -1,5 +1,5 @@
1
- import type { AppContext, InternalContext } from '../types/cli/context';
2
- import type { CLIPlugin, CLIPluginExtends } from '../types/cli/plugin';
1
+ import type { AppContext, InternalContext } from '../types/cli/context.js';
2
+ import type { CLIPlugin, CLIPluginExtends } from '../types/cli/plugin.js';
3
3
  interface ContextParams<Extends extends CLIPluginExtends> {
4
4
  appContext: AppContext<Extends>;
5
5
  config: Extends['config'];
@@ -1,42 +1,42 @@
1
1
  import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn } from '@rsbuild/core';
2
- import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn, RuntimePluginConfig, ServerPluginConfig } from '../types/cli/hooks';
3
- import type { DeepPartial } from '../types/utils';
2
+ import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn, RuntimePluginConfig, ServerPluginConfig } from '../types/cli/hooks.js';
3
+ import type { DeepPartial } from '../types/utils.js';
4
4
  export type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnDevCompileDoneFn, OnFileChangedFn, OnPrepareFn, RuntimePluginConfig, ServerPluginConfig, };
5
5
  export declare function initHooks<Config, NormalizedConfig, ExtendBuildUtils, ExtendConfigUtils>(): {
6
6
  /**
7
7
  * add config for this cli plugin
8
8
  */
9
- config: import("..").CollectAsyncHook<ConfigFn<DeepPartial<Config>>>;
9
+ config: import("../index.js").CollectAsyncHook<ConfigFn<DeepPartial<Config>>>;
10
10
  /**
11
11
  * @private
12
12
  * modify config for this cli plugin
13
13
  */
14
- modifyConfig: import("..").AsyncHook<ModifyConfigFn<Config, ExtendConfigUtils>>;
14
+ modifyConfig: import("../index.js").AsyncHook<ModifyConfigFn<Config, ExtendConfigUtils>>;
15
15
  /**
16
16
  * modify final config
17
17
  */
18
- modifyResolvedConfig: import("..").AsyncHook<ModifyResolvedConfigFn<NormalizedConfig, ExtendConfigUtils>>;
19
- modifyRsbuildConfig: import("..").AsyncHook<ModifyRsbuildConfigFn<ExtendBuildUtils>>;
20
- modifyBundlerChain: import("..").AsyncHook<ModifyBundlerChainFn<ExtendBuildUtils>>;
21
- modifyRspackConfig: import("..").AsyncHook<ModifyRspackConfigFn<ExtendBuildUtils>>;
22
- modifyHtmlPartials: import("..").AsyncHook<ModifyHtmlPartialsFn>;
23
- addCommand: import("..").AsyncHook<AddCommandFn>;
24
- addWatchFiles: import("..").CollectAsyncHook<AddWatchFilesFn>;
25
- onPrepare: import("..").AsyncHook<OnPrepareFn>;
26
- onFileChanged: import("..").AsyncHook<OnFileChangedFn>;
27
- onBeforeRestart: import("..").AsyncHook<OnBeforeRestartFn>;
28
- onBeforeCreateCompiler: import("..").AsyncHook<OnBeforeCreateCompilerFn>;
29
- onAfterCreateCompiler: import("..").AsyncHook<OnAfterCreateCompilerFn>;
30
- onDevCompileDone: import("..").AsyncHook<import("@rsbuild/core").OnAfterDevCompileFn>;
31
- onBeforeBuild: import("..").AsyncHook<OnBeforeBuildFn>;
32
- onAfterBuild: import("..").AsyncHook<OnAfterBuildFn>;
33
- onBeforeDev: import("..").AsyncHook<OnBeforeDevFn>;
34
- onAfterDev: import("..").AsyncHook<OnAfterDevFn>;
35
- onBeforeDeploy: import("..").AsyncHook<OnBeforeDeployFn>;
36
- onAfterDeploy: import("..").AsyncHook<OnAfterDeployFn>;
37
- onBeforeExit: import("..").AsyncHook<OnBeforeExitFn>;
38
- _internalRuntimePlugins: import("..").AsyncHook<InternalRuntimePluginsFn>;
39
- _internalServerPlugins: import("..").AsyncHook<InternalServerPluginsFn>;
40
- modifyServerRoutes: import("..").AsyncHook<ModifyServerRoutesFn>;
18
+ modifyResolvedConfig: import("../index.js").AsyncHook<ModifyResolvedConfigFn<NormalizedConfig, ExtendConfigUtils>>;
19
+ modifyRsbuildConfig: import("../index.js").AsyncHook<ModifyRsbuildConfigFn<ExtendBuildUtils>>;
20
+ modifyBundlerChain: import("../index.js").AsyncHook<ModifyBundlerChainFn<ExtendBuildUtils>>;
21
+ modifyRspackConfig: import("../index.js").AsyncHook<ModifyRspackConfigFn<ExtendBuildUtils>>;
22
+ modifyHtmlPartials: import("../index.js").AsyncHook<ModifyHtmlPartialsFn>;
23
+ addCommand: import("../index.js").AsyncHook<AddCommandFn>;
24
+ addWatchFiles: import("../index.js").CollectAsyncHook<AddWatchFilesFn>;
25
+ onPrepare: import("../index.js").AsyncHook<OnPrepareFn>;
26
+ onFileChanged: import("../index.js").AsyncHook<OnFileChangedFn>;
27
+ onBeforeRestart: import("../index.js").AsyncHook<OnBeforeRestartFn>;
28
+ onBeforeCreateCompiler: import("../index.js").AsyncHook<OnBeforeCreateCompilerFn>;
29
+ onAfterCreateCompiler: import("../index.js").AsyncHook<OnAfterCreateCompilerFn>;
30
+ onDevCompileDone: import("../index.js").AsyncHook<import("@rsbuild/core").OnAfterDevCompileFn>;
31
+ onBeforeBuild: import("../index.js").AsyncHook<OnBeforeBuildFn>;
32
+ onAfterBuild: import("../index.js").AsyncHook<OnAfterBuildFn>;
33
+ onBeforeDev: import("../index.js").AsyncHook<OnBeforeDevFn>;
34
+ onAfterDev: import("../index.js").AsyncHook<OnAfterDevFn>;
35
+ onBeforeDeploy: import("../index.js").AsyncHook<OnBeforeDeployFn>;
36
+ onAfterDeploy: import("../index.js").AsyncHook<OnAfterDeployFn>;
37
+ onBeforeExit: import("../index.js").AsyncHook<OnBeforeExitFn>;
38
+ _internalRuntimePlugins: import("../index.js").AsyncHook<InternalRuntimePluginsFn>;
39
+ _internalServerPlugins: import("../index.js").AsyncHook<InternalServerPluginsFn>;
40
+ modifyServerRoutes: import("../index.js").AsyncHook<ModifyServerRoutesFn>;
41
41
  };
42
42
  export type Hooks<Config, NormalizedConfig, ExtendBuildUtils, ExtendConfigUtils> = ReturnType<typeof initHooks<Config, NormalizedConfig, ExtendBuildUtils, ExtendConfigUtils>>;
@@ -1,6 +1,6 @@
1
- export { initPluginAPI } from './api';
2
- export { createContext, initAppContext } from './context';
3
- export { type AddCommandFn, type AddWatchFilesFn, type ConfigFn, type Hooks, type InternalRuntimePluginsFn, type InternalServerPluginsFn, initHooks, type ModifyBundlerChainFn, type ModifyConfigFn, type ModifyHtmlPartialsFn, type ModifyResolvedConfigFn, type ModifyRsbuildConfigFn, type ModifyRspackConfigFn, type ModifyServerRoutesFn, type OnAfterBuildFn, type OnAfterCreateCompilerFn, type OnAfterDeployFn, type OnAfterDevFn, type OnBeforeBuildFn, type OnBeforeCreateCompilerFn, type OnBeforeDeployFn, type OnBeforeDevFn, type OnBeforeExitFn, type OnBeforeRestartFn, type OnDevCompileDoneFn, type OnFileChangedFn, type OnPrepareFn, type RuntimePluginConfig, type ServerPluginConfig, } from './hooks';
4
- export { cli, createCli, createLoadedConfig, initAppDir } from './run';
5
- export { createConfigOptions, createStorybookOptions } from './run/create';
6
- export { mergeConfig } from './run/utils/mergeConfig';
1
+ export { initPluginAPI } from './api.js';
2
+ export { createContext, initAppContext } from './context.js';
3
+ export { type AddCommandFn, type AddWatchFilesFn, type ConfigFn, type Hooks, type InternalRuntimePluginsFn, type InternalServerPluginsFn, initHooks, type ModifyBundlerChainFn, type ModifyConfigFn, type ModifyHtmlPartialsFn, type ModifyResolvedConfigFn, type ModifyRsbuildConfigFn, type ModifyRspackConfigFn, type ModifyServerRoutesFn, type OnAfterBuildFn, type OnAfterCreateCompilerFn, type OnAfterDeployFn, type OnAfterDevFn, type OnBeforeBuildFn, type OnBeforeCreateCompilerFn, type OnBeforeDeployFn, type OnBeforeDevFn, type OnBeforeExitFn, type OnBeforeRestartFn, type OnDevCompileDoneFn, type OnFileChangedFn, type OnPrepareFn, type RuntimePluginConfig, type ServerPluginConfig, } from './hooks.js';
4
+ export { cli, createCli, createLoadedConfig, initAppDir } from './run/index.js';
5
+ export { createConfigOptions, createStorybookOptions } from './run/create.js';
6
+ export { mergeConfig } from './run/utils/mergeConfig.js';
@@ -1,2 +1,2 @@
1
- import type { LoadedConfig } from '../types';
1
+ import type { LoadedConfig } from '../types.js';
2
2
  export declare function createLoadedConfig<T>(appDirectory: string, configFilePath: string | false, otherConfig?: T): Promise<LoadedConfig<T>>;
@@ -1,3 +1,3 @@
1
- import type { DeepPartial } from '../../../types/utils';
2
- import type { LoadedConfig } from '../types';
1
+ import type { DeepPartial } from '../../../types/utils.js';
2
+ import type { LoadedConfig } from '../types.js';
3
3
  export declare const createResolveConfig: <Config, NormalizedConfig>(loaded: LoadedConfig<Config>, configs: DeepPartial<Config>[]) => Promise<NormalizedConfig>;
@@ -1,6 +1,6 @@
1
- import type { InternalContext } from '../../types/cli/context';
2
- import type { CLIPluginExtends } from '../../types/cli/plugin';
3
- import type { CLIRunOptions } from './types';
1
+ import type { InternalContext } from '../../types/cli/context.js';
2
+ import type { CLIPluginExtends } from '../../types/cli/plugin.js';
3
+ import type { CLIRunOptions } from './types.js';
4
4
  export declare const createCli: <Extends extends CLIPluginExtends>() => {
5
5
  init: (options: CLIRunOptions<Extends>) => Promise<{
6
6
  appContext: InternalContext<Extends>;
@@ -14,11 +14,11 @@ type CreateConfigOption<Extends extends CLIPluginExtends> = Omit<CLIRunOptions<E
14
14
  modifyModernConfig?: (config: Extends['config']) => Extends['config'] | Promise<Extends['config']>;
15
15
  };
16
16
  export declare const createConfigOptions: <Extends extends CLIPluginExtends>(options: CreateConfigOption<Extends>) => Promise<{
17
- config: Awaited<Extends["normalizedConfig"]> | NonNullable<Awaited<import("../../types/utils").UnwrapPromise<Extends["normalizedConfig"]>>>;
18
- getAppContext: () => Readonly<import("../..").AppContext<Extends> & Extends["extendContext"]>;
17
+ config: Awaited<Extends["normalizedConfig"]> | NonNullable<Awaited<import("../../types/utils.js").UnwrapPromise<Extends["normalizedConfig"]>>>;
18
+ getAppContext: () => Readonly<import("../../index.js").AppContext<Extends> & Extends["extendContext"]>;
19
19
  }>;
20
20
  export declare const createStorybookOptions: <Extends extends CLIPluginExtends>(options: Omit<CreateConfigOption<Extends>, 'command'>) => Promise<{
21
- config: Awaited<Extends["normalizedConfig"]> | NonNullable<Awaited<import("../../types/utils").UnwrapPromise<Extends["normalizedConfig"]>>>;
22
- getAppContext: () => Readonly<import("../..").AppContext<Extends> & Extends["extendContext"]>;
21
+ config: Awaited<Extends["normalizedConfig"]> | NonNullable<Awaited<import("../../types/utils.js").UnwrapPromise<Extends["normalizedConfig"]>>>;
22
+ getAppContext: () => Readonly<import("../../index.js").AppContext<Extends> & Extends["extendContext"]>;
23
23
  }>;
24
24
  export {};
@@ -1,13 +1,13 @@
1
- import { createCli } from './create';
2
- export { createLoadedConfig } from './config/createLoadedConfig';
3
- export { loadTypeScriptFile } from './config/loadConfig';
4
- export { run } from './run';
5
- export { initAppDir } from './utils/initAppDir';
1
+ import { createCli } from './create.js';
2
+ export { createLoadedConfig } from './config/createLoadedConfig.js';
3
+ export { loadTypeScriptFile } from './config/loadConfig.js';
4
+ export { run } from './run.js';
5
+ export { initAppDir } from './utils/initAppDir.js';
6
6
  export { createCli };
7
7
  export declare const cli: {
8
- init: (options: import("./types").CLIRunOptions<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>) => Promise<{
9
- appContext: import("../..").InternalContext<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>;
8
+ init: (options: import("./types.js").CLIRunOptions<import("../../index.js").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>) => Promise<{
9
+ appContext: import("../../index.js").InternalContext<import("../../index.js").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>;
10
10
  }>;
11
- run: (options: import("./types").CLIRunOptions<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>) => Promise<void>;
12
- getPrevInitOptions: () => import("./types").CLIRunOptions<import("../..").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>;
11
+ run: (options: import("./types.js").CLIRunOptions<import("../../index.js").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>) => Promise<void>;
12
+ getPrevInitOptions: () => import("./types.js").CLIRunOptions<import("../../index.js").CLIPluginExtends<{}, {}, {}, {}, {}, {}, {}>>;
13
13
  };
@@ -1,2 +1,2 @@
1
- import type { CLIOptions } from './types';
1
+ import type { CLIOptions } from './types.js';
2
2
  export declare const run: (options: CLIOptions) => Promise<void>;
@@ -1,5 +1,5 @@
1
- import type { CLIPluginExtends } from '../../types/cli';
2
- import type { Plugin } from '../../types/plugin';
1
+ import type { CLIPluginExtends } from '../../types/cli/index.js';
2
+ import type { Plugin } from '../../types/plugin.js';
3
3
  export interface CLIOptions<Extends extends CLIPluginExtends = {
4
4
  config: {};
5
5
  }> {
@@ -1,5 +1,5 @@
1
- import type { InternalContext } from '../../../types';
2
- import type { CLIPluginExtends } from '../../../types/cli/plugin';
1
+ import type { InternalContext } from '../../../types/index.js';
2
+ import type { CLIPluginExtends } from '../../../types/cli/plugin.js';
3
3
  /**
4
4
  * Editor temp files (e.g. `page.tsx.tmp.<pid>.<hash>`) can be created and
5
5
  * deleted within a few milliseconds. chokidar may still deliver a
@@ -1,2 +1,2 @@
1
- import type { DeepPartial } from '../../../types/utils';
1
+ import type { DeepPartial } from '../../../types/utils.js';
2
2
  export declare const mergeConfig: <Config, NormalizedConfig>(configs: Array<DeepPartial<Config>>) => NormalizedConfig;
@@ -1,4 +1,4 @@
1
- import type { AsyncHook, AsyncInterruptHook, AsyncPipelineHook, CollectAsyncHook, CollectSyncHook, SyncHook } from './types/hooks';
1
+ import type { AsyncHook, AsyncInterruptHook, AsyncPipelineHook, CollectAsyncHook, CollectSyncHook, SyncHook } from './types/hooks.js';
2
2
  export declare function createAsyncInterruptHook<Callback extends (...args: any[]) => any>(): AsyncInterruptHook<Callback>;
3
3
  export declare function createSyncHook<Callback extends (...args: any[]) => any>(): SyncHook<Callback>;
4
4
  export declare function createAsyncHook<Callback extends (...args: any[]) => any>(): AsyncHook<Callback>;
@@ -1,7 +1,7 @@
1
- export { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createSyncHook, } from './hooks';
2
- export { createPluginManager } from './manager';
3
- export type { AppContext, CLIPlugin, CLIPluginAPI, CLIPluginExtends, Entrypoint, InternalContext, RuntimePluginConfig, ServerPluginConfig, } from './types/cli';
4
- export type { AsyncHook, AsyncInterruptHook, AsyncPipelineHook, CollectAsyncHook, CollectSyncHook, PluginHook, PluginHookTap, SyncHook, } from './types/hooks';
5
- export type { Plugin, PluginManager, TransformFunction, } from './types/plugin';
6
- export type { InternalRuntimeContext, RuntimeContext, RuntimePlugin, RuntimePluginAPI, RuntimePluginExtends, } from './types/runtime';
7
- export type { FileChangeEvent, InternalServerContext, ResetEvent, ServerContext, ServerPlugin, ServerPluginAPI, ServerPluginExtends, } from './types/server';
1
+ export { createAsyncHook, createAsyncInterruptHook, createAsyncPipelineHook, createCollectAsyncHook, createCollectSyncHook, createSyncHook, } from './hooks.js';
2
+ export { createPluginManager } from './manager.js';
3
+ export type { AppContext, CLIPlugin, CLIPluginAPI, CLIPluginExtends, Entrypoint, InternalContext, RuntimePluginConfig, ServerPluginConfig, } from './types/cli/index.js';
4
+ export type { AsyncHook, AsyncInterruptHook, AsyncPipelineHook, CollectAsyncHook, CollectSyncHook, PluginHook, PluginHookTap, SyncHook, } from './types/hooks.js';
5
+ export type { Plugin, PluginManager, TransformFunction, } from './types/plugin.js';
6
+ export type { InternalRuntimeContext, RuntimeContext, RuntimePlugin, RuntimePluginAPI, RuntimePluginExtends, } from './types/runtime/index.js';
7
+ export type { FileChangeEvent, InternalServerContext, ResetEvent, ServerContext, ServerPlugin, ServerPluginAPI, ServerPluginExtends, } from './types/server/index.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * NOTE: This file will be used in both Node.js and runtime environments. Please avoid importing Node.js-specific APIs.
3
3
  */
4
- import type { PluginManager } from './types/plugin';
4
+ import type { PluginManager } from './types/plugin.js';
5
5
  export declare function createPluginManager(): PluginManager;
@@ -1,7 +1,7 @@
1
- import type { PluginManager } from '../types/plugin';
2
- import type { RuntimePluginAPI } from '../types/runtime/api';
3
- import type { InternalRuntimeContext } from '../types/runtime/context';
4
- import type { RuntimePlugin, RuntimePluginExtends } from '../types/runtime/plugin';
1
+ import type { PluginManager } from '../types/plugin.js';
2
+ import type { RuntimePluginAPI } from '../types/runtime/api.js';
3
+ import type { InternalRuntimeContext } from '../types/runtime/context.js';
4
+ import type { RuntimePlugin, RuntimePluginExtends } from '../types/runtime/plugin.js';
5
5
  export declare function initPluginAPI<Extends extends RuntimePluginExtends>({ context, plugins, }: {
6
6
  context: InternalRuntimeContext<Extends>;
7
7
  pluginManager: PluginManager;
@@ -1,5 +1,5 @@
1
- import type { InternalRuntimeContext, RuntimeContext } from '../types/runtime/context';
2
- import type { RuntimePlugin, RuntimePluginExtends } from '../types/runtime/plugin';
1
+ import type { InternalRuntimeContext, RuntimeContext } from '../types/runtime/context.js';
2
+ import type { RuntimePlugin, RuntimePluginExtends } from '../types/runtime/plugin.js';
3
3
  export interface RuntimeConfig<Extends extends RuntimePluginExtends> {
4
4
  plugins?: RuntimePlugin<Extends>[];
5
5
  }
@@ -1,2 +1,2 @@
1
- import type { Hooks } from '../types/runtime/hooks';
1
+ import type { Hooks } from '../types/runtime/hooks.js';
2
2
  export declare function initHooks<RuntimeConfig, RuntimeContext>(): Hooks<RuntimeConfig, RuntimeContext>;
@@ -1,5 +1,6 @@
1
- export type { Hooks, InternalRuntimeContext, RuntimeContext, RuntimePlugin, RuntimePluginAPI, RuntimePluginExtends, } from '../types/runtime';
2
- export { initPluginAPI } from './api';
3
- export { createRuntimeContext, initRuntimeContext } from './context';
4
- export { initHooks } from './hooks';
5
- export { runtime } from './run';
1
+ export type { Hooks, InternalRuntimeContext, RuntimeContext, RuntimePlugin, RuntimePluginAPI, RuntimePluginExtends, } from '../types/runtime/index.js';
2
+ export type { Collector, ExtendStreamSSRFn, ResolveComponentFn, RuntimeContextProjection, SSRAssetGroup, SSRAssetTransformInfo, SSRHeadData, SSRHeadPart, SSRHtmlFormatting, SSRRenderAsset, SSRRenderInfo, SSRRenderLifecycle, SSRRenderTerminal, SSRRouterData, SSRTemplateChunk, StreamSSRExtender, StreamSSRInfo, StringSSRCollectorsInfo, TransformRuntimeContextFn, } from '../types/runtime/hooks.js';
3
+ export { initPluginAPI } from './api.js';
4
+ export { createRuntimeContext, initRuntimeContext } from './context.js';
5
+ export { initHooks } from './hooks.js';
6
+ export { runtime } from './run/index.js';
@@ -1,7 +1,7 @@
1
- import type { RuntimePluginExtends } from '../../types/runtime/plugin';
2
- import type { RuntimeRunOptions } from './types';
1
+ import type { RuntimePluginExtends } from '../../types/runtime/plugin.js';
2
+ import type { RuntimeRunOptions } from './types.js';
3
3
  export declare const createRuntime: <Extends extends RuntimePluginExtends>() => {
4
4
  run: (options: RuntimeRunOptions) => {
5
- runtimeContext: import("..").InternalRuntimeContext<Extends>;
5
+ runtimeContext: import("../index.js").InternalRuntimeContext<Extends>;
6
6
  };
7
7
  };
@@ -1,5 +1,5 @@
1
1
  export declare const runtime: {
2
- run: (options: import("./types").RuntimeRunOptions) => {
3
- runtimeContext: import("..").InternalRuntimeContext<import("..").RuntimePluginExtends<{}, {}, {}, {}>>;
2
+ run: (options: import("./types.js").RuntimeRunOptions) => {
3
+ runtimeContext: import("../index.js").InternalRuntimeContext<import("../index.js").RuntimePluginExtends<{}, {}, {}, {}>>;
4
4
  };
5
5
  };
@@ -1,4 +1,4 @@
1
- import type { Plugin } from '../../types/plugin';
1
+ import type { Plugin } from '../../types/plugin.js';
2
2
  export type RuntimeRunOptions = {
3
3
  config: Record<string, any>;
4
4
  plugins: Plugin[];
@@ -1,8 +1,8 @@
1
1
  import { createDebugger } from '@modern-js/utils';
2
- import type { PluginManager } from '../types/plugin';
3
- import type { ServerPluginAPI } from '../types/server/api';
4
- import type { InternalServerContext } from '../types/server/context';
5
- import type { ServerPluginExtends } from '../types/server/plugin';
2
+ import type { PluginManager } from '../types/plugin.js';
3
+ import type { ServerPluginAPI } from '../types/server/api.js';
4
+ import type { InternalServerContext } from '../types/server/context.js';
5
+ import type { ServerPluginExtends } from '../types/server/plugin.js';
6
6
  export declare const debug: ReturnType<typeof createDebugger>;
7
7
  export declare function initPluginAPI<Extends extends ServerPluginExtends>({ context, pluginManager, }: {
8
8
  context: InternalServerContext<Extends>;
@@ -1,6 +1,6 @@
1
- import type { InternalServerContext, ServerContext } from '../types/server/context';
2
- import type { ServerPlugin, ServerPluginExtends } from '../types/server/plugin';
3
- import type { ServerCreateOptions } from './run/types';
1
+ import type { InternalServerContext, ServerContext } from '../types/server/context.js';
2
+ import type { ServerPlugin, ServerPluginExtends } from '../types/server/plugin.js';
3
+ import type { ServerCreateOptions } from './run/types.js';
4
4
  interface ContextParams<Extends extends ServerPluginExtends> {
5
5
  serverContext: ServerContext<Extends>;
6
6
  config: Extends['config'];
@@ -1,9 +1,9 @@
1
- import type { ModifyConfigFn, OnPrepareFn, OnResetFn } from '../types/server/hooks';
2
- import type { DeepPartial } from '../types/utils';
1
+ import type { ModifyConfigFn, OnPrepareFn, OnResetFn } from '../types/server/hooks.js';
2
+ import type { DeepPartial } from '../types/utils.js';
3
3
  export type { ModifyConfigFn, OnPrepareFn, OnResetFn };
4
4
  export declare function initHooks<Config>(): {
5
- modifyConfig: import("..").AsyncHook<ModifyConfigFn<DeepPartial<Config>>>;
6
- onPrepare: import("..").AsyncHook<OnPrepareFn>;
7
- onReset: import("..").AsyncHook<OnResetFn>;
5
+ modifyConfig: import("../index.js").AsyncHook<ModifyConfigFn<DeepPartial<Config>>>;
6
+ onPrepare: import("../index.js").AsyncHook<OnPrepareFn>;
7
+ onReset: import("../index.js").AsyncHook<OnResetFn>;
8
8
  };
9
9
  export type Hooks<Config> = ReturnType<typeof initHooks<Config>>;
@@ -1,4 +1,5 @@
1
- export { initPluginAPI } from './api';
2
- export { createServerContext, initServerContext } from './context';
3
- export { type Hooks, initHooks, type ModifyConfigFn, type OnPrepareFn, type OnResetFn, } from './hooks';
4
- export { createServer, type ServerCreateOptions, server } from './run';
1
+ export { initPluginAPI } from './api.js';
2
+ export { createServerContext, initServerContext } from './context.js';
3
+ export { type Hooks, initHooks, type ModifyConfigFn, type OnPrepareFn, type OnResetFn, } from './hooks.js';
4
+ export { createServer, type ServerCreateOptions, server } from './run/index.js';
5
+ export type { BffRuntimeFramework, BffRuntimeRegistry } from './run/types.js';
@@ -1,7 +1,7 @@
1
- import type { ServerPluginExtends } from '../../types/server/plugin';
2
- import type { ServerRunOptions } from './types';
1
+ import type { ServerPluginExtends } from '../../types/server/plugin.js';
2
+ import type { ServerRunOptions } from './types.js';
3
3
  export declare const createServer: <Extends extends ServerPluginExtends>() => {
4
4
  run: (options: ServerRunOptions) => Promise<{
5
- serverContext: import("../..").InternalServerContext<Extends>;
5
+ serverContext: import("../../index.js").InternalServerContext<Extends>;
6
6
  }>;
7
7
  };
@@ -1,8 +1,8 @@
1
- import { createServer } from './create';
1
+ import { createServer } from './create.js';
2
2
  export declare const server: {
3
- run: (options: import("./types").ServerRunOptions) => Promise<{
4
- serverContext: import("../..").InternalServerContext<import("../..").ServerPluginExtends<{}, {}, {}, {}>>;
3
+ run: (options: import("./types.js").ServerRunOptions) => Promise<{
4
+ serverContext: import("../../index.js").InternalServerContext<import("../../index.js").ServerPluginExtends<{}, {}, {}, {}>>;
5
5
  }>;
6
6
  };
7
- export type { ServerCreateOptions } from './types';
7
+ export type { ServerCreateOptions } from './types.js';
8
8
  export { createServer };
@@ -1,5 +1,10 @@
1
1
  import type { ServerRoute } from '@modern-js/types';
2
- import type { Plugin } from '../../types/plugin';
2
+ import type { Plugin } from '../../types/plugin.js';
3
+ /** Registered BFF runtimes. Runtime packages extend this interface. */
4
+ export interface BffRuntimeRegistry {
5
+ hono: true;
6
+ }
7
+ export type BffRuntimeFramework = keyof BffRuntimeRegistry;
3
8
  export type ServerCreateOptions = {
4
9
  /** server working directory, and then also dist directory */
5
10
  pwd: string;
@@ -11,7 +16,7 @@ export type ServerCreateOptions = {
11
16
  sharedDirectory?: string;
12
17
  apiDirectory?: string;
13
18
  lambdaDirectory?: string;
14
- bffRuntimeFramework?: 'hono' | 'effect';
19
+ bffRuntimeFramework?: BffRuntimeFramework;
15
20
  };
16
21
  };
17
22
  export type ServerRunOptions = {
@@ -1,10 +1,10 @@
1
1
  import type { OnAfterBuildFn, OnAfterCreateCompilerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn } from '@rsbuild/core';
2
- import type { Hooks } from '../../cli/hooks';
3
- import type { PluginHook, PluginHookTap } from '../hooks';
4
- import type { DeepPartial } from '../utils';
5
- import type { AppContext } from './context';
6
- import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn } from './hooks';
7
- import type { CLIPluginExtends } from './plugin';
2
+ import type { Hooks } from '../../cli/hooks.js';
3
+ import type { PluginHook, PluginHookTap } from '../hooks.js';
4
+ import type { DeepPartial } from '../utils.js';
5
+ import type { AppContext } from './context.js';
6
+ import type { AddCommandFn, AddWatchFilesFn, ConfigFn, InternalRuntimePluginsFn, InternalServerPluginsFn, ModifyBundlerChainFn, ModifyConfigFn, ModifyHtmlPartialsFn, ModifyResolvedConfigFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyServerRoutesFn, OnAfterDeployFn, OnAfterDevFn, OnBeforeDeployFn, OnBeforeDevFn, OnBeforeExitFn, OnBeforeRestartFn, OnFileChangedFn, OnPrepareFn } from './hooks.js';
7
+ import type { CLIPluginExtends } from './plugin.js';
8
8
  /**
9
9
  * Define a generic CLI plugin API that provider can extend as needed.
10
10
  */
@@ -1,8 +1,8 @@
1
1
  import type { BuilderInstance } from '@modern-js/builder';
2
2
  import type { ServerRoute } from '@modern-js/types';
3
- import type { Hooks } from '../../cli/hooks';
4
- import type { CLIPluginAPI } from './api';
5
- import type { CLIPlugin, CLIPluginExtends } from './plugin';
3
+ import type { Hooks } from '../../cli/hooks.js';
4
+ import type { CLIPluginAPI } from './api.js';
5
+ import type { CLIPlugin, CLIPluginExtends } from './plugin.js';
6
6
  export interface Entrypoint {
7
7
  isMainEntry?: boolean;
8
8
  entryName: string;
@@ -1,9 +1,9 @@
1
1
  import type { ServerPlugin as ServerPluginConfig, ServerRoute } from '@modern-js/types';
2
2
  import type { Command } from '@modern-js/utils/commander';
3
3
  import type { ModifyBundlerChainUtils, ModifyRspackConfigUtils, RsbuildConfig, Rspack, RspackChain } from '@rsbuild/core';
4
- import type { TransformFunction } from '../plugin';
5
- import type { MaybePromise } from '../utils';
6
- import type { Entrypoint } from './context';
4
+ import type { TransformFunction } from '../plugin.js';
5
+ import type { MaybePromise } from '../utils.js';
6
+ import type { Entrypoint } from './context.js';
7
7
  declare module '@modern-js/utils/commander' {
8
8
  interface Command {
9
9
  commandsMap: Map<string, Command>;
@@ -1,4 +1,4 @@
1
- export type { CLIPluginAPI } from './api';
2
- export type { AppContext, Entrypoint, InternalContext } from './context';
3
- export type { RuntimePluginConfig, ServerPluginConfig } from './hooks';
4
- export type { CLIPlugin, CLIPluginExtends } from './plugin';
1
+ export type { CLIPluginAPI } from './api.js';
2
+ export type { AppContext, Entrypoint, InternalContext } from './context.js';
3
+ export type { RuntimePluginConfig, ServerPluginConfig } from './hooks.js';
4
+ export type { CLIPlugin, CLIPluginExtends } from './plugin.js';
@@ -1,7 +1,7 @@
1
- import type { PluginHook } from '../hooks';
2
- import type { Plugin } from '../plugin';
3
- import type { CLIPluginAPI } from './api';
4
- import type { AppContext } from './context';
1
+ import type { PluginHook } from '../hooks.js';
2
+ import type { Plugin } from '../plugin.js';
3
+ import type { CLIPluginAPI } from './api.js';
4
+ import type { AppContext } from './context.js';
5
5
  export interface CLIPluginExtends<Config extends Record<string, any> = {}, NormalizedConfig extends Record<string, any> = {}, ExtendContext extends Record<string, any> = {}, ExtendAPI extends Record<string, any> = {}, ExtendHook extends Record<string, PluginHook<(...args: any[]) => any>> = {}, ExtendBuildUtils extends Record<string, any> = {}, ExtendConfigUtils extends Record<string, any> = {}> {
6
6
  config?: Config;
7
7
  normalizedConfig?: NormalizedConfig;
@@ -1,4 +1,4 @@
1
- import type { Tail, UnwrapPromise } from './utils';
1
+ import type { Tail, UnwrapPromise } from './utils.js';
2
2
  export type SyncHook<Callback extends (...args: any[]) => any> = {
3
3
  tap: (cb: Callback) => void;
4
4
  call: (...args: Parameters<Callback>) => ReturnType<Callback>;
@@ -1,4 +1,4 @@
1
- export type { AppContext, CLIPlugin, CLIPluginAPI, Entrypoint, InternalContext, } from './cli';
2
- export type { AsyncHook, CollectAsyncHook, PluginHook, PluginHookTap, } from './hooks';
3
- export type { Plugin, PluginManager, TransformFunction, } from './plugin';
4
- export type { InternalRuntimeContext, RuntimeContext, RuntimePlugin, RuntimePluginAPI, } from './runtime';
1
+ export type { AppContext, CLIPlugin, CLIPluginAPI, Entrypoint, InternalContext, } from './cli/index.js';
2
+ export type { AsyncHook, CollectAsyncHook, PluginHook, PluginHookTap, } from './hooks.js';
3
+ export type { Plugin, PluginManager, TransformFunction, } from './plugin.js';
4
+ export type { InternalRuntimeContext, RuntimeContext, RuntimePlugin, RuntimePluginAPI, } from './runtime/index.js';
@@ -1,5 +1,5 @@
1
- import type { PluginHook } from './hooks';
2
- import type { Falsy, MaybePromise } from './utils';
1
+ import type { PluginHook } from './hooks.js';
2
+ import type { Falsy, MaybePromise } from './utils.js';
3
3
  export type TransformFunction<T> = (arg: T) => T | Promise<T>;
4
4
  export type Plugin<PluginAPI = {}, Context = {}> = {
5
5
  /**
@@ -1,18 +1,20 @@
1
- import type { PluginHook, PluginHookTap } from '../hooks';
2
- import type { DeepPartial } from '../utils';
3
- import type { RuntimeContext } from './context';
4
- import type { ConfigFn, ExtendStreamSSRFn, ExtendStringSSRCollectorsFn, Hooks, OnBeforeRenderFn, PickContextFn, StringSSRCollectorsInfo, WrapRootFn } from './hooks';
5
- import type { RuntimePluginExtends } from './plugin';
1
+ import type { PluginHook, PluginHookTap } from '../hooks.js';
2
+ import type { DeepPartial } from '../utils.js';
3
+ import type { RuntimeContext } from './context.js';
4
+ import type { ConfigFn, ExtendStreamSSRFn, ExtendStringSSRCollectorsFn, Hooks, OnBeforeRenderFn, PickContextFn, ResolveComponentFn, StringSSRCollectorsInfo, TransformRuntimeContextFn, WrapRootFn } from './hooks.js';
5
+ import type { RuntimePluginExtends } from './plugin.js';
6
6
  export type RuntimePluginAPI<Extends extends RuntimePluginExtends> = Readonly<{
7
7
  updateRuntimeContext: (updateContext: DeepPartial<RuntimeContext>) => void;
8
8
  getHooks: () => Readonly<Hooks<Extends['config'], RuntimeContext & Extends['extendContext']> & Extends['extendHooks']>;
9
9
  getRuntimeConfig: () => Readonly<Extends['config']>;
10
10
  onBeforeRender: PluginHookTap<OnBeforeRenderFn<Extends['extendContext']>>;
11
11
  wrapRoot: PluginHookTap<WrapRootFn>;
12
+ resolveComponent: PluginHookTap<ResolveComponentFn>;
12
13
  pickContext: PluginHookTap<PickContextFn<RuntimeContext>>;
14
+ transformRuntimeContext: PluginHookTap<TransformRuntimeContextFn<RuntimeContext & Extends['extendContext']>>;
13
15
  config: PluginHookTap<ConfigFn<Extends['config']>>;
14
- extendStringSSRCollectors: PluginHookTap<ExtendStringSSRCollectorsFn<StringSSRCollectorsInfo>>;
15
- extendStreamSSR: PluginHookTap<ExtendStreamSSRFn>;
16
+ extendStringSSRCollectors: PluginHookTap<ExtendStringSSRCollectorsFn<StringSSRCollectorsInfo<RuntimeContext & Extends['extendContext']>>>;
17
+ extendStreamSSR: PluginHookTap<ExtendStreamSSRFn<RuntimeContext & Extends['extendContext']>>;
16
18
  } & RuntimePluginExtendsAPI<Extends>>;
17
19
  export type RuntimePluginExtendsAPI<Extends extends RuntimePluginExtends> = {
18
20
  [K in keyof Extends['extendHooks']]: PluginHookTap<Extends['extendHooks'][K] extends PluginHook<infer Args> ? Args extends (...args: any[]) => any ? Args : (...args: any[]) => any : (...args: any[]) => any>;
@@ -1,6 +1,6 @@
1
- import type { RuntimePluginAPI } from './api';
2
- import type { Hooks } from './hooks';
3
- import type { RuntimePluginExtends } from './plugin';
1
+ import type { RuntimePluginAPI } from './api.js';
2
+ import type { Hooks } from './hooks.js';
3
+ import type { RuntimePluginExtends } from './plugin.js';
4
4
  export type RuntimeContext = {};
5
5
  export type InternalRuntimeContext<Extends extends RuntimePluginExtends> = RuntimeContext & {
6
6
  /** All hooks. */
@@ -5,18 +5,98 @@ export type ChunkSet = {
5
5
  jsChunk: string;
6
6
  cssChunk: string;
7
7
  };
8
- export type Collector = {
8
+ export type SSRRenderInfo<RuntimeContext = object> = {
9
+ /** The original request context, before public or RSC projection. */
10
+ runtimeContext: RuntimeContext;
11
+ request: Request;
12
+ platform: 'node' | 'web';
13
+ mode: 'string' | 'stream';
14
+ isRsc: boolean;
15
+ /** Original renderer resource and configuration; interpreted by extensions. */
16
+ resource?: object;
17
+ config?: object;
18
+ };
19
+ export type SSRHeadPart = {
20
+ toString(): string;
21
+ };
22
+ export type SSRHeadData = Record<'htmlAttributes' | 'bodyAttributes' | 'title' | 'base' | 'link' | 'meta' | 'noscript' | 'script' | 'style', SSRHeadPart> & {
23
+ priority?: SSRHeadPart;
24
+ };
25
+ export type SSRRenderTerminal = {
26
+ status: 'complete';
27
+ } | {
28
+ status: 'fallback';
29
+ error: unknown;
30
+ } | {
31
+ status: 'error';
32
+ error: unknown;
33
+ } | {
34
+ status: 'cancelled';
35
+ reason: unknown;
36
+ };
37
+ export type SSRRenderAsset = {
38
+ url?: string;
39
+ filename?: string;
40
+ };
41
+ export type SSRAssetGroup<T extends SSRRenderAsset> = {
42
+ name: string;
43
+ assets: readonly T[];
44
+ };
45
+ export type SSRAssetTransformInfo<T extends SSRRenderAsset> = {
46
+ kind: 'style' | 'script';
47
+ source: 'loadable' | 'template';
48
+ template: string;
49
+ groups: readonly SSRAssetGroup<T>[];
50
+ createAsset: (url: string) => T;
51
+ };
52
+ export type SSRTemplateChunk = {
53
+ name: 'styles' | 'scripts' | 'data';
54
+ template: string;
55
+ placeholder: string;
56
+ content: string;
57
+ emittedAssets?: readonly string[];
58
+ attributes?: Readonly<Record<string, unknown>>;
59
+ };
60
+ export type SSRHtmlFormatting = {
61
+ attributesToString: (attributes: Record<string, unknown>) => string;
62
+ hasStylesheetLink: (template: string, href: string) => boolean | undefined;
63
+ };
64
+ export type SSRRouterData = {
65
+ loaderData?: unknown;
66
+ errors?: Record<string, unknown> | null;
67
+ };
68
+ export interface SSRRenderLifecycle {
69
+ /** Native asset objects keep their identity and are formatted after this hook. */
70
+ transformAssets?: <T extends SSRRenderAsset>(assets: readonly T[], info: SSRAssetTransformInfo<T>) => readonly T[];
71
+ /** Runs on each prepared chunk before native placeholder substitution. */
72
+ transformTemplateChunk?: (chunk: SSRTemplateChunk, formatting: SSRHtmlFormatting) => SSRTemplateChunk;
73
+ /** Raw router data is serialized by the native renderer; undefined uses its fallback. */
74
+ getRouterData?: () => SSRRouterData | undefined;
75
+ beforeReact?: () => void;
76
+ /** Runs before the completed body or shell's head data is read. */
77
+ completedBody?: (html: string, info: {
78
+ phase: 'complete' | 'shell';
79
+ }) => string;
80
+ getHeadData?: () => SSRHeadData | undefined;
81
+ /** Exactly one notification for this render attempt. */
82
+ onTerminal?: (terminal: SSRRenderTerminal) => void;
83
+ }
84
+ export type Collector = SSRRenderLifecycle & {
9
85
  collect?: (component: React.ReactElement) => React.ReactElement;
10
86
  effect: () => void | Promise<void>;
11
87
  };
12
88
  import type React from 'react';
13
- import type { AsyncInterruptHook, CollectSyncHook, SyncHook } from '../hooks';
89
+ import type { AsyncInterruptHook, CollectSyncHook, SyncHook } from '../hooks.js';
14
90
  export type OnBeforeRenderFn<RuntimeContext> = (context: RuntimeContext, interrupt: (info: any) => any) => Promise<any> | any;
15
91
  export type ExtendStringSSRCollectorsFn<RuntimeContext> = (context: RuntimeContext) => Collector;
16
- export type StringSSRCollectorsInfo = {
92
+ export type StringSSRCollectorsInfo<RuntimeContext = object> = {
17
93
  chunkSet: ChunkSet;
94
+ render: SSRRenderInfo<RuntimeContext>;
95
+ };
96
+ export type StreamSSRInfo<RuntimeContext = object> = SSRRenderInfo<RuntimeContext> & {
97
+ terminalMarker: string;
18
98
  };
19
- export interface StreamSSRExtender {
99
+ export interface StreamSSRExtender extends SSRRenderLifecycle {
20
100
  init?: (params: {
21
101
  rootElement: React.ReactElement;
22
102
  forceStream2String: boolean;
@@ -24,16 +104,34 @@ export interface StreamSSRExtender {
24
104
  modifyRootElement?: (rootElement: React.ReactElement) => React.ReactElement;
25
105
  getStyleTags?: () => string;
26
106
  processStream?: (stream: NodeJS.ReadWriteStream) => NodeJS.ReadWriteStream;
107
+ processReadableStream?: (stream: ReadableStream<Uint8Array>) => ReadableStream<Uint8Array>;
108
+ /** Body transforms run after all render transforms, preserving order in each phase. */
109
+ streamPhase?: 'render' | 'body';
27
110
  }
28
- export type ExtendStreamSSRFn = () => StreamSSRExtender;
111
+ export type ExtendStreamSSRFn<RuntimeContext = object> = (info: StreamSSRInfo<RuntimeContext>) => StreamSSRExtender;
29
112
  export type WrapRootFn = (root: React.ComponentType<any>) => React.ComponentType<any>;
113
+ export type ResolveComponentFn = (component: React.ComponentType<any>, options: {
114
+ name: string;
115
+ }) => React.ComponentType<any>;
30
116
  export type PickContextFn<RuntimeContext> = (context: RuntimeContext) => RuntimeContext;
117
+ export type RuntimeContextProjection<RuntimeContext> = {
118
+ internalContext: RuntimeContext;
119
+ publicContext: RuntimeContext;
120
+ };
121
+ export type TransformRuntimeContextFn<RuntimeContext> = (projection: RuntimeContextProjection<RuntimeContext>, options: {
122
+ /** Original request context, unchanged across callbacks in the pipeline. */
123
+ context: RuntimeContext;
124
+ /** Whether the application's RSC mode is enabled. */
125
+ isRsc: boolean;
126
+ }) => RuntimeContextProjection<RuntimeContext>;
31
127
  export type ConfigFn<RuntimeConfig> = () => RuntimeConfig;
32
128
  export type Hooks<RuntimeConfig, RuntimeContext> = {
33
129
  onBeforeRender: AsyncInterruptHook<OnBeforeRenderFn<RuntimeContext>>;
34
130
  wrapRoot: SyncHook<WrapRootFn>;
131
+ resolveComponent: SyncHook<ResolveComponentFn>;
35
132
  pickContext: SyncHook<PickContextFn<RuntimeContext>>;
133
+ transformRuntimeContext: SyncHook<TransformRuntimeContextFn<RuntimeContext>>;
36
134
  config: CollectSyncHook<ConfigFn<RuntimeConfig>>;
37
- extendStringSSRCollectors: CollectSyncHook<ExtendStringSSRCollectorsFn<StringSSRCollectorsInfo>>;
38
- extendStreamSSR: CollectSyncHook<ExtendStreamSSRFn>;
135
+ extendStringSSRCollectors: CollectSyncHook<ExtendStringSSRCollectorsFn<StringSSRCollectorsInfo<RuntimeContext>>>;
136
+ extendStreamSSR: CollectSyncHook<ExtendStreamSSRFn<RuntimeContext>>;
39
137
  };
@@ -1,4 +1,4 @@
1
- export type { RuntimePluginAPI } from './api';
2
- export type { InternalRuntimeContext, RuntimeContext } from './context';
3
- export type { Hooks } from './hooks';
4
- export type { RuntimePlugin, RuntimePluginExtends } from './plugin';
1
+ export type { RuntimePluginAPI } from './api.js';
2
+ export type { InternalRuntimeContext, RuntimeContext } from './context.js';
3
+ export type { Hooks } from './hooks.js';
4
+ export type { RuntimePlugin, RuntimePluginExtends } from './plugin.js';
@@ -1,7 +1,7 @@
1
- import type { PluginHook } from '../hooks';
2
- import type { Plugin } from '../plugin';
3
- import type { RuntimePluginAPI } from './api';
4
- import type { RuntimeContext } from './context';
1
+ import type { PluginHook } from '../hooks.js';
2
+ import type { Plugin } from '../plugin.js';
3
+ import type { RuntimePluginAPI } from './api.js';
4
+ import type { RuntimeContext } from './context.js';
5
5
  export interface RuntimePluginExtends<Config extends Record<string, any> = {}, ExtendContext extends Record<string, any> = {}, ExtendAPI extends Record<string, any> = {}, ExtendHook extends Record<string, PluginHook<(...args: any[]) => any>> = {}> {
6
6
  config?: Config;
7
7
  extendContext?: ExtendContext;
@@ -1,8 +1,8 @@
1
- import type { PluginHook, PluginHookTap } from '../hooks';
2
- import type { DeepPartial } from '../utils';
3
- import type { ServerContext } from './context';
4
- import type { Hooks, ModifyConfigFn, OnPrepareFn, OnResetFn } from './hooks';
5
- import type { ServerPluginExtends } from './plugin';
1
+ import type { PluginHook, PluginHookTap } from '../hooks.js';
2
+ import type { DeepPartial } from '../utils.js';
3
+ import type { ServerContext } from './context.js';
4
+ import type { Hooks, ModifyConfigFn, OnPrepareFn, OnResetFn } from './hooks.js';
5
+ import type { ServerPluginExtends } from './plugin.js';
6
6
  export type ServerPluginAPI<Extends extends ServerPluginExtends> = Readonly<{
7
7
  getServerContext: () => Readonly<ServerContext<Extends> & Extends['extendContext']>;
8
8
  updateServerContext: (updateContext: DeepPartial<ServerContext<Extends> & Extends['extendContext']>) => void;
@@ -1,7 +1,8 @@
1
1
  import type { ServerRoute } from '@modern-js/types';
2
- import type { ServerPluginAPI } from './api';
3
- import type { Hooks } from './hooks';
4
- import type { ServerPlugin, ServerPluginExtends } from './plugin';
2
+ import type { BffRuntimeFramework } from '../../server/run/types.js';
3
+ import type { ServerPluginAPI } from './api.js';
4
+ import type { Hooks } from './hooks.js';
5
+ import type { ServerPlugin, ServerPluginExtends } from './plugin.js';
5
6
  export interface Middleware {
6
7
  name: string;
7
8
  }
@@ -11,6 +12,7 @@ export type ServerContext<Extends extends ServerPluginExtends> = {
11
12
  appDirectory: string;
12
13
  apiDirectory?: string;
13
14
  lambdaDirectory?: string;
15
+ bffRuntimeFramework?: BffRuntimeFramework;
14
16
  internalDirectory?: string;
15
17
  sharedDirectory?: string;
16
18
  distDirectory?: string;
@@ -1,4 +1,4 @@
1
- import type { AsyncHook } from '../hooks';
1
+ import type { AsyncHook } from '../hooks.js';
2
2
  export type ModifyConfigFn<ServerConfig> = (arg: ServerConfig) => ServerConfig | Promise<ServerConfig>;
3
3
  export type OnPrepareFn = () => Promise<void> | void;
4
4
  export type ChangeEvent = 'add' | 'change' | 'unlink';
@@ -1,4 +1,4 @@
1
- export type { ServerPluginAPI } from './api';
2
- export type { InternalServerContext, ServerContext } from './context';
3
- export type { FileChangeEvent, Hooks, ResetEvent } from './hooks';
4
- export type { ServerPlugin, ServerPluginExtends } from './plugin';
1
+ export type { ServerPluginAPI } from './api.js';
2
+ export type { InternalServerContext, ServerContext } from './context.js';
3
+ export type { FileChangeEvent, Hooks, ResetEvent } from './hooks.js';
4
+ export type { ServerPlugin, ServerPluginExtends } from './plugin.js';
@@ -1,7 +1,7 @@
1
- import type { PluginHook } from '../hooks';
2
- import type { Plugin } from '../plugin';
3
- import type { ServerPluginAPI } from './api';
4
- import type { ServerContext } from './context';
1
+ import type { PluginHook } from '../hooks.js';
2
+ import type { Plugin } from '../plugin.js';
3
+ import type { ServerPluginAPI } from './api.js';
4
+ import type { ServerContext } from './context.js';
5
5
  export interface ServerPluginExtends<Config extends Record<string, any> = {}, ExtendContext extends Record<string, any> = {}, ExtendAPI extends Record<string, any> = {}, ExtendHook extends Record<string, PluginHook<(...args: any[]) => any>> = {}> {
6
6
  config?: Config;
7
7
  extendContext?: ExtendContext;
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.8.3-ultramodern.6",
20
+ "version": "3.9.0-ultramodern.10",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -79,17 +79,17 @@
79
79
  }
80
80
  },
81
81
  "dependencies": {
82
- "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.8.3-ultramodern.6",
83
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.3-ultramodern.6",
84
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.3-ultramodern.6",
85
- "@rsbuild/core": "2.2.0",
82
+ "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.10",
83
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.10",
84
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.10",
85
+ "@rsbuild/core": "2.2.3",
86
86
  "@swc/helpers": "^0.5.23",
87
87
  "jiti": "^2.7.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.8.3-ultramodern.6",
91
- "@rslib/core": "0.23.2",
92
- "@types/node": "^26.2.0",
90
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.10",
91
+ "@rslib/core": "1.0.0",
92
+ "@types/node": "^26.4.1",
93
93
  "@types/react": "^19.2.18",
94
94
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
95
95
  "typescript": "^7.0.2"