@modern-js/runtime 2.58.2-alpha.0 → 2.58.3

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 (197) hide show
  1. package/dist/cjs/cli/code.js +1 -1
  2. package/dist/cjs/cli/index.js +11 -14
  3. package/dist/cjs/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
  4. package/dist/cjs/cli/ssr/index.js +14 -1
  5. package/dist/cjs/cli/template.js +1 -1
  6. package/dist/cjs/core/browser/hydrate.js +1 -1
  7. package/dist/cjs/core/browser/index.js +36 -17
  8. package/dist/cjs/core/compatible.js +4 -4
  9. package/dist/cjs/core/context/runtime.js +1 -1
  10. package/dist/cjs/core/loader/loaderManager.js +1 -1
  11. package/dist/cjs/core/loader/useLoader.js +1 -1
  12. package/dist/cjs/core/server/react/prerender/index.js +1 -1
  13. package/dist/cjs/core/server/requestHandler.js +14 -6
  14. package/dist/cjs/core/server/stream/afterTemplate.js +1 -1
  15. package/dist/cjs/core/server/stream/beforeTemplate.js +3 -3
  16. package/dist/cjs/core/server/stream/createReadableStream.js +2 -2
  17. package/dist/cjs/core/server/stream/createReadableStream.worker.js +2 -2
  18. package/dist/cjs/core/server/stream/shared.js +1 -1
  19. package/dist/cjs/core/server/stream/template.js +1 -1
  20. package/dist/cjs/core/server/string/index.js +29 -29
  21. package/dist/cjs/core/server/string/prefetch.js +5 -5
  22. package/dist/cjs/core/server/string/ssrData.js +1 -1
  23. package/dist/cjs/document/Body.js +1 -1
  24. package/dist/cjs/document/Head.js +1 -1
  25. package/dist/cjs/document/Root.js +1 -1
  26. package/dist/cjs/document/cli/index.js +2 -2
  27. package/dist/cjs/router/cli/code/getClientRoutes/getRoutes.js +1 -1
  28. package/dist/cjs/router/cli/code/getClientRoutes/getRoutesLegacy.js +1 -1
  29. package/dist/cjs/router/cli/code/index.js +6 -6
  30. package/dist/cjs/router/cli/code/templates.js +15 -8
  31. package/dist/cjs/router/cli/code/utils.js +1 -1
  32. package/dist/cjs/router/cli/handler.js +2 -2
  33. package/dist/cjs/router/runtime/DeferredDataScripts.node.js +2 -2
  34. package/dist/cjs/router/runtime/PrefetchLink.js +1 -1
  35. package/dist/cjs/router/runtime/plugin.js +4 -4
  36. package/dist/cjs/router/runtime/plugin.node.js +6 -6
  37. package/dist/cjs/router/runtime/utils.js +2 -2
  38. package/dist/cjs/state/plugins.js +1 -1
  39. package/dist/cjs/state/runtime/plugin.js +6 -6
  40. package/dist/esm/cli/code.js +3 -4
  41. package/dist/esm/cli/index.js +7 -10
  42. package/dist/esm/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
  43. package/dist/esm/cli/ssr/index.js +16 -1
  44. package/dist/esm/cli/template.js +1 -1
  45. package/dist/esm/core/browser/hydrate.js +1 -1
  46. package/dist/esm/core/browser/index.js +33 -14
  47. package/dist/esm/core/browser/withCallback.js +1 -1
  48. package/dist/esm/core/compatible.js +4 -4
  49. package/dist/esm/core/context/runtime.js +1 -1
  50. package/dist/esm/core/loader/loaderManager.js +3 -1
  51. package/dist/esm/core/loader/useLoader.js +1 -1
  52. package/dist/esm/core/plugin/base.js +1 -1
  53. package/dist/esm/core/plugin/index.js +1 -1
  54. package/dist/esm/core/server/react/prerender/index.js +2 -2
  55. package/dist/esm/core/server/requestHandler.js +13 -6
  56. package/dist/esm/core/server/stream/afterTemplate.js +1 -1
  57. package/dist/esm/core/server/stream/beforeTemplate.js +3 -3
  58. package/dist/esm/core/server/stream/createReadableStream.js +2 -2
  59. package/dist/esm/core/server/stream/createReadableStream.worker.js +2 -2
  60. package/dist/esm/core/server/stream/shared.js +1 -1
  61. package/dist/esm/core/server/stream/template.js +1 -1
  62. package/dist/esm/core/server/string/index.js +12 -15
  63. package/dist/esm/core/server/string/prefetch.js +2 -2
  64. package/dist/esm/core/server/string/ssrData.js +1 -1
  65. package/dist/esm/document/Body.js +1 -1
  66. package/dist/esm/document/Comment.js +1 -1
  67. package/dist/esm/document/Head.js +1 -1
  68. package/dist/esm/document/Root.js +1 -1
  69. package/dist/esm/document/Script.js +1 -1
  70. package/dist/esm/document/Style.js +1 -1
  71. package/dist/esm/document/cli/index.js +3 -3
  72. package/dist/esm/router/cli/code/getClientRoutes/getRoutes.js +2 -2
  73. package/dist/esm/router/cli/code/getClientRoutes/getRoutesLegacy.js +2 -2
  74. package/dist/esm/router/cli/code/getClientRoutes/utils.js +2 -2
  75. package/dist/esm/router/cli/code/index.js +4 -4
  76. package/dist/esm/router/cli/code/nestedRoutes.js +1 -1
  77. package/dist/esm/router/cli/code/templates.js +2 -2
  78. package/dist/esm/router/cli/code/utils.js +2 -2
  79. package/dist/esm/router/cli/entry.js +1 -1
  80. package/dist/esm/router/cli/handler.js +2 -2
  81. package/dist/esm/router/cli/index.js +1 -1
  82. package/dist/esm/router/runtime/DeferredDataScripts.node.js +2 -2
  83. package/dist/esm/router/runtime/PrefetchLink.js +1 -1
  84. package/dist/esm/router/runtime/plugin.js +4 -4
  85. package/dist/esm/router/runtime/plugin.node.js +6 -6
  86. package/dist/esm/router/runtime/utils.js +2 -2
  87. package/dist/esm/state/plugins.js +1 -1
  88. package/dist/esm/state/runtime/plugin.js +4 -4
  89. package/dist/esm-node/cli/code.js +3 -3
  90. package/dist/esm-node/cli/index.js +7 -10
  91. package/dist/esm-node/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
  92. package/dist/esm-node/cli/ssr/index.js +14 -1
  93. package/dist/esm-node/cli/template.js +1 -1
  94. package/dist/esm-node/core/browser/hydrate.js +1 -1
  95. package/dist/esm-node/core/browser/index.js +36 -17
  96. package/dist/esm-node/core/browser/withCallback.js +1 -1
  97. package/dist/esm-node/core/compatible.js +4 -4
  98. package/dist/esm-node/core/context/runtime.js +1 -1
  99. package/dist/esm-node/core/loader/loaderManager.js +1 -1
  100. package/dist/esm-node/core/loader/useLoader.js +1 -1
  101. package/dist/esm-node/core/plugin/base.js +1 -1
  102. package/dist/esm-node/core/plugin/index.js +1 -1
  103. package/dist/esm-node/core/server/react/prerender/index.js +2 -2
  104. package/dist/esm-node/core/server/requestHandler.js +13 -5
  105. package/dist/esm-node/core/server/stream/afterTemplate.js +1 -1
  106. package/dist/esm-node/core/server/stream/beforeTemplate.js +3 -3
  107. package/dist/esm-node/core/server/stream/createReadableStream.js +2 -2
  108. package/dist/esm-node/core/server/stream/createReadableStream.worker.js +2 -2
  109. package/dist/esm-node/core/server/stream/shared.js +1 -1
  110. package/dist/esm-node/core/server/stream/template.js +1 -1
  111. package/dist/esm-node/core/server/string/index.js +21 -21
  112. package/dist/esm-node/core/server/string/prefetch.js +2 -2
  113. package/dist/esm-node/core/server/string/ssrData.js +1 -1
  114. package/dist/esm-node/document/Body.js +1 -1
  115. package/dist/esm-node/document/Comment.js +1 -1
  116. package/dist/esm-node/document/Head.js +1 -1
  117. package/dist/esm-node/document/Root.js +1 -1
  118. package/dist/esm-node/document/Script.js +1 -1
  119. package/dist/esm-node/document/Style.js +1 -1
  120. package/dist/esm-node/document/cli/index.js +3 -3
  121. package/dist/esm-node/router/cli/code/getClientRoutes/getRoutes.js +2 -2
  122. package/dist/esm-node/router/cli/code/getClientRoutes/getRoutesLegacy.js +2 -2
  123. package/dist/esm-node/router/cli/code/getClientRoutes/utils.js +2 -2
  124. package/dist/esm-node/router/cli/code/index.js +4 -4
  125. package/dist/esm-node/router/cli/code/nestedRoutes.js +1 -1
  126. package/dist/esm-node/router/cli/code/templates.js +16 -9
  127. package/dist/esm-node/router/cli/code/utils.js +2 -2
  128. package/dist/esm-node/router/cli/entry.js +1 -1
  129. package/dist/esm-node/router/cli/handler.js +2 -2
  130. package/dist/esm-node/router/cli/index.js +1 -1
  131. package/dist/esm-node/router/runtime/DeferredDataScripts.node.js +2 -2
  132. package/dist/esm-node/router/runtime/PrefetchLink.js +1 -1
  133. package/dist/esm-node/router/runtime/plugin.js +4 -4
  134. package/dist/esm-node/router/runtime/plugin.node.js +6 -6
  135. package/dist/esm-node/router/runtime/utils.js +2 -2
  136. package/dist/esm-node/state/plugins.js +1 -1
  137. package/dist/esm-node/state/runtime/plugin.js +4 -4
  138. package/dist/types/cli/alias.d.ts +1 -1
  139. package/dist/types/cli/code.d.ts +1 -1
  140. package/dist/types/cli/index.d.ts +3 -3
  141. package/dist/types/cli/ssr/index.d.ts +1 -1
  142. package/dist/types/common.d.ts +1 -1
  143. package/dist/types/config.d.ts +1 -1
  144. package/dist/types/core/browser/hydrate.d.ts +3 -3
  145. package/dist/types/core/browser/index.d.ts +1 -1
  146. package/dist/types/core/browser/withCallback.d.ts +1 -1
  147. package/dist/types/core/compatible.d.ts +3 -3
  148. package/dist/types/core/config.d.ts +1 -1
  149. package/dist/types/core/context/index.d.ts +1 -1
  150. package/dist/types/core/context/runtime.d.ts +5 -5
  151. package/dist/types/core/loader/loaderManager.d.ts +2 -2
  152. package/dist/types/core/plugin/base.d.ts +2 -2
  153. package/dist/types/core/plugin/index.d.ts +1 -1
  154. package/dist/types/core/plugin/runner.d.ts +1 -1
  155. package/dist/types/core/react/index.d.ts +1 -1
  156. package/dist/types/core/react/wrapper.d.ts +1 -1
  157. package/dist/types/core/server/helmet.d.ts +1 -1
  158. package/dist/types/core/server/index.d.ts +1 -1
  159. package/dist/types/core/server/react/nossr/index.d.ts +1 -1
  160. package/dist/types/core/server/react/prerender/util.d.ts +1 -1
  161. package/dist/types/core/server/requestHandler.d.ts +3 -3
  162. package/dist/types/core/server/stream/afterTemplate.d.ts +4 -4
  163. package/dist/types/core/server/stream/beforeTemplate.d.ts +2 -2
  164. package/dist/types/core/server/stream/createReadableStream.d.ts +1 -1
  165. package/dist/types/core/server/stream/createReadableStream.worker.d.ts +1 -1
  166. package/dist/types/core/server/stream/shared.d.ts +3 -3
  167. package/dist/types/core/server/stream/template.d.ts +1 -1
  168. package/dist/types/core/server/string/index.d.ts +1 -1
  169. package/dist/types/core/server/string/loadable.d.ts +2 -2
  170. package/dist/types/core/server/string/prefetch.d.ts +5 -5
  171. package/dist/types/core/server/string/ssrData.d.ts +4 -4
  172. package/dist/types/core/server/string/styledComponent.d.ts +1 -1
  173. package/dist/types/core/server/string/types.d.ts +2 -2
  174. package/dist/types/core/server/utils.d.ts +3 -3
  175. package/dist/types/core/types.d.ts +2 -2
  176. package/dist/types/document/DocumentStructureContext.d.ts +1 -1
  177. package/dist/types/document/cli/index.d.ts +2 -2
  178. package/dist/types/exports/server.d.ts +1 -1
  179. package/dist/types/index.d.ts +2 -2
  180. package/dist/types/router/cli/code/index.d.ts +2 -2
  181. package/dist/types/router/cli/code/templates.d.ts +1 -1
  182. package/dist/types/router/cli/entry.d.ts +1 -1
  183. package/dist/types/router/cli/handler.d.ts +3 -3
  184. package/dist/types/router/cli/index.d.ts +1 -1
  185. package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +1 -1
  186. package/dist/types/router/runtime/PrefetchLink.d.ts +1 -1
  187. package/dist/types/router/runtime/hooks.d.ts +1 -1
  188. package/dist/types/router/runtime/index.d.ts +1 -1
  189. package/dist/types/router/runtime/plugin.d.ts +1 -1
  190. package/dist/types/router/runtime/routeModule.d.ts +1 -1
  191. package/dist/types/router/runtime/types.d.ts +2 -2
  192. package/dist/types/router/runtime/utils.d.ts +4 -4
  193. package/dist/types/router/runtime/withRouter.d.ts +1 -1
  194. package/dist/types/state/cli/index.d.ts +1 -1
  195. package/package.json +13 -12
  196. package/types/index.d.ts +1 -1
  197. package/types/router.d.ts +1 -1
@@ -1,7 +1,7 @@
1
- import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
- import { statePlugin } from '../state/cli';
3
- import { routerPlugin } from '../router/cli';
1
+ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
4
2
  import { documentPlugin } from '../document/cli';
3
+ import { routerPlugin } from '../router/cli';
4
+ import { statePlugin } from '../state/cli';
5
5
  import { ssrPlugin } from './ssr';
6
6
  export { isRuntimeEntry } from './entry';
7
7
  export { statePlugin, ssrPlugin, routerPlugin, documentPlugin };
@@ -1,3 +1,3 @@
1
- import type { CliPlugin, AppTools } from '@modern-js/app-tools';
1
+ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
2
  export declare const ssrPlugin: () => CliPlugin<AppTools>;
3
3
  export default ssrPlugin;
@@ -1,5 +1,5 @@
1
- import type { StateConfig } from './state';
2
1
  import type { Plugin } from './core/plugin';
2
+ import type { StateConfig } from './state';
3
3
  export declare const isBrowser: () => boolean;
4
4
  export interface AppConfig {
5
5
  state?: StateConfig | boolean;
@@ -1,5 +1,5 @@
1
- import type { StateConfig } from './state';
2
1
  import type { RouterConfig } from './router';
2
+ import type { StateConfig } from './state';
3
3
  export interface RuntimeUserConfig {
4
4
  runtime?: {
5
5
  state?: boolean | StateConfig;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { Root } from 'react-dom/client';
3
- import { RuntimeContext } from '../context';
1
+ import type React from 'react';
2
+ import type { Root } from 'react-dom/client';
3
+ import type { RuntimeContext } from '../context';
4
4
  export declare const isReact18: () => boolean;
5
5
  export declare function hydrateRoot(App: React.ReactElement, context: RuntimeContext, ModernRender: (App: React.ReactElement) => Promise<HTMLElement | Root>, ModernHydrate: (App: React.ReactElement, callback?: () => void) => Promise<HTMLElement | Root>): Promise<HTMLElement | Root>;
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  export type RenderFunc = typeof render;
3
3
  export declare function render(App: React.ReactElement, id?: HTMLElement | string): Promise<HTMLElement | import("react-dom/client").Root>;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  export declare const WithCallback: React.FC<{
3
3
  callback: () => void;
4
4
  children: React.ReactElement;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { Renderer } from 'react-dom';
3
- import type { hydrateRoot, createRoot } from 'react-dom/client';
4
- import { RuntimeContext, TRuntimeContext } from './context/runtime';
5
- import { Plugin, runtime } from './plugin';
3
+ import type { createRoot, hydrateRoot } from 'react-dom/client';
4
+ import { type RuntimeContext, type TRuntimeContext } from './context/runtime';
5
+ import { type Plugin, type runtime } from './plugin';
6
6
  export type CreateAppOptions = {
7
7
  plugins: Plugin[];
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import { AppConfig, RuntimeConfig } from '../common';
2
+ import type { AppConfig, RuntimeConfig } from '../common';
3
3
  export declare const getConfig: (Component: React.ComponentType<any>) => AppConfig | undefined;
4
4
  /**
5
5
  * @deprecated
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { NestedRoute, PageRoute } from '@modern-js/types';
3
- import { AppConfig } from '../../common';
3
+ import type { AppConfig } from '../../common';
4
4
  export { RuntimeReactContext, type RuntimeContext, getInitialContext, } from './runtime';
5
5
  interface GlobalContext {
6
6
  /**
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Store } from '@modern-js-reduck/store';
3
- import { type StaticHandlerContext, type Router, type RouterState } from '@modern-js/runtime-utils/remix-router';
2
+ import type { Store } from '@modern-js-reduck/store';
3
+ import type { Router, RouterState, StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
4
+ import type { RouteManifest } from '../../router/runtime/types';
4
5
  import { createLoaderManager } from '../loader/loaderManager';
5
- import { PluginRunner, runtime } from '../plugin';
6
- import { RouteManifest } from '../../router/runtime/types';
7
- import { SSRServerContext } from '../types';
6
+ import type { PluginRunner, runtime } from '../plugin';
7
+ import type { SSRServerContext } from '../types';
8
8
  export interface BaseRuntimeContext {
9
9
  initialData?: Record<string, unknown>;
10
10
  loaderManager: ReturnType<typeof createLoaderManager>;
@@ -1,4 +1,4 @@
1
- import { LoaderOptions } from './useLoader';
1
+ import type { LoaderOptions } from './useLoader';
2
2
  export declare enum LoaderStatus {
3
3
  idle = 0,
4
4
  loading = 1,
@@ -12,7 +12,7 @@ export type LoaderResult = {
12
12
  error: any;
13
13
  _error?: any;
14
14
  };
15
- declare const createLoader: (id: string, initialData: Partial<LoaderResult> | undefined, loaderFn: () => Promise<any>, skip?: boolean) => {
15
+ declare const createLoader: (id: string, initialData?: Partial<LoaderResult>, loaderFn?: () => Promise<any>, skip?: boolean) => {
16
16
  readonly result: {
17
17
  loading: boolean;
18
18
  reloading: boolean;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { PluginOptions, Setup } from '@modern-js/plugin';
3
- import { RuntimeContext, TRuntimeContext } from '../context/runtime';
2
+ import { type PluginOptions, type Setup } from '@modern-js/plugin';
3
+ import type { RuntimeContext, TRuntimeContext } from '../context/runtime';
4
4
  import type { RuntimeConfig } from './index';
5
5
  export declare const RuntimeConfigContext: import("@modern-js/plugin").Context<RuntimeConfig>;
6
6
  export declare const useRuntimeConfigContext: () => RuntimeConfig;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { runtime, Plugin } from './base';
2
+ import { type Plugin, runtime } from './base';
3
3
  export * from './base';
4
4
  export interface RuntimeConfig {
5
5
  plugins?: Plugin[];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { PluginRunner } from './base';
2
+ import { type PluginRunner } from './base';
3
3
  export declare function setGlobalRunner(runner: PluginRunner): void;
4
4
  export declare function getGlobalRunner(): import("@modern-js/plugin").ToRunners<{
5
5
  beforeRender: import("@modern-js/plugin").AsyncInterruptWorkflow<import("..").RuntimeContext, void>;
@@ -1,2 +1,2 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  export declare function createRoot(UserApp?: React.ComponentType | null): React.ComponentType<any>;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { RuntimeContext } from '../context';
2
+ import { type RuntimeContext } from '../context';
3
3
  export declare function wrapRuntimeContextProvider(App: React.ReactElement, contextValue: RuntimeContext): React.FunctionComponentElement<React.ProviderProps<RuntimeContext>>;
@@ -1,3 +1,3 @@
1
- import { HelmetData } from 'react-helmet';
1
+ import type { HelmetData } from 'react-helmet';
2
2
  export declare function createReplaceHelemt(helmetData?: HelmetData): (template: string) => string;
3
3
  export declare function helmetReplace(content: string, helmetData: HelmetData): string;
@@ -1,4 +1,4 @@
1
- import { Plugin } from '../plugin';
1
+ import type { Plugin } from '../plugin';
2
2
  export { PreRender, NoSSR } from './react';
3
3
  export declare const ssr: (_config: any) => Plugin;
4
4
  export default ssr;
@@ -1,4 +1,4 @@
1
- import React, { ReactElement } from 'react';
1
+ import React, { type ReactElement } from 'react';
2
2
  export declare const NoSSR: (props: React.PropsWithChildren<{
3
3
  fallback?: ReactElement | string;
4
4
  }>) => React.FunctionComponentElement<{
@@ -1,4 +1,4 @@
1
- import { GeneralizedProps, MetaKeyMap, MetaKeyMatch } from './type';
1
+ import type { GeneralizedProps, MetaKeyMap, MetaKeyMatch } from './type';
2
2
  export declare const getInnermostProperty: (propsList: GeneralizedProps[], propName: string) => any;
3
3
  export declare const getOutermostProperty: (propsList: GeneralizedProps[], propName: string) => any;
4
4
  export declare const aggKeysFromPropsList: (propsList: GeneralizedProps[], propName: string) => MetaKeyMap;
@@ -1,6 +1,6 @@
1
- import { RequestHandler, RequestHandlerOptions } from '@modern-js/app-tools';
2
- import React from 'react';
3
- import { RuntimeContext } from '../context';
1
+ import type { RequestHandler, RequestHandlerOptions } from '@modern-js/app-tools';
2
+ import type React from 'react';
3
+ import { type RuntimeContext } from '../context';
4
4
  export type { RequestHandlerConfig as HandleRequestConfig } from '@modern-js/app-tools';
5
5
  export type HandleRequestOptions = Exclude<RequestHandlerOptions, 'staticGenerate'> & {
6
6
  runtimeContext: RuntimeContext;
@@ -1,7 +1,7 @@
1
- import { SSRConfig } from '../shared';
2
- import { RenderLevel } from '../../constants';
3
- import { HandleRequestConfig } from '../requestHandler';
4
- import { RuntimeContext } from '../../context';
1
+ import type { RenderLevel } from '../../constants';
2
+ import type { RuntimeContext } from '../../context';
3
+ import type { HandleRequestConfig } from '../requestHandler';
4
+ import { type SSRConfig } from '../shared';
5
5
  export type BuildShellAfterTemplateOptions = {
6
6
  runtimeContext: RuntimeContext;
7
7
  renderLevel: RenderLevel;
@@ -1,5 +1,5 @@
1
- import { RuntimeContext } from '../../context';
2
- import { HandleRequestConfig } from '../requestHandler';
1
+ import type { RuntimeContext } from '../../context';
2
+ import type { HandleRequestConfig } from '../requestHandler';
3
3
  export interface BuildShellBeforeTemplateOptions {
4
4
  runtimeContext: RuntimeContext;
5
5
  entryName: string;
@@ -1,2 +1,2 @@
1
- import { CreateReadableStreamFromElement } from './shared';
1
+ import { type CreateReadableStreamFromElement } from './shared';
2
2
  export declare const createReadableStreamFromElement: CreateReadableStreamFromElement;
@@ -1,2 +1,2 @@
1
- import { CreateReadableStreamFromElement } from './shared';
1
+ import { type CreateReadableStreamFromElement } from './shared';
2
2
  export declare const createReadableStreamFromElement: CreateReadableStreamFromElement;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { RuntimeContext } from '../../context';
3
- import { HandleRequestConfig } from '../requestHandler';
1
+ import type React from 'react';
2
+ import type { RuntimeContext } from '../../context';
3
+ import type { HandleRequestConfig } from '../requestHandler';
4
4
  import type { RenderStreaming, SSRConfig } from '../shared';
5
5
  export type CreateReadableStreamFromElementOptions = {
6
6
  runtimeContext: RuntimeContext;
@@ -1,5 +1,5 @@
1
- import { type BuildShellBeforeTemplateOptions } from './beforeTemplate';
2
1
  import { type BuildShellAfterTemplateOptions } from './afterTemplate';
2
+ import { type BuildShellBeforeTemplateOptions } from './beforeTemplate';
3
3
  export type InjectTemplate = {
4
4
  shellBefore: string;
5
5
  shellAfter: string;
@@ -1,2 +1,2 @@
1
- import { RenderString } from '../shared';
1
+ import { type RenderString } from '../shared';
2
2
  export declare const renderString: RenderString;
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import type { Collector, ChunkSet } from './types';
1
+ import type { ReactElement } from 'react';
2
+ import type { ChunkSet, Collector } from './types';
3
3
  declare module '@loadable/server' {
4
4
  interface ChunkExtractor {
5
5
  chunks: Chunk;
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { LoaderResult } from '../../loader/loaderManager';
3
- import { HandleRequestOptions } from '../requestHandler';
4
- import { Tracer } from '../tracer';
5
- import { SSRConfig } from '../shared';
1
+ import type React from 'react';
2
+ import type { LoaderResult } from '../../loader/loaderManager';
3
+ import type { HandleRequestOptions } from '../requestHandler';
4
+ import type { SSRConfig } from '../shared';
5
+ import { type Tracer } from '../tracer';
6
6
  export declare const prefetch: (App: React.ReactElement, request: Request, options: HandleRequestOptions, ssrConfig: SSRConfig, { onError, onTiming }: Tracer) => Promise<{
7
7
  initialData: Record<string, unknown> | undefined;
8
8
  i18nData: any;
@@ -1,7 +1,7 @@
1
- import { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
2
- import { SSRConfig } from '../shared';
3
- import { SSRServerContext } from '../../types';
4
- import { Collector, ChunkSet } from './types';
1
+ import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
2
+ import type { SSRServerContext } from '../../types';
3
+ import type { SSRConfig } from '../shared';
4
+ import type { ChunkSet, Collector } from './types';
5
5
  export interface SSRDataCreatorOptions {
6
6
  request: Request;
7
7
  prefetchData: Record<string, any>;
@@ -1,5 +1,5 @@
1
+ import type { ReactElement } from 'react';
1
2
  import { ServerStyleSheet } from 'styled-components';
2
- import { ReactElement } from 'react';
3
3
  import type { ChunkSet, Collector } from './types';
4
4
  export declare class StyledCollector implements Collector {
5
5
  #private;
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { RenderLevel } from '../../constants';
1
+ import type { ReactElement } from 'react';
2
+ import type { RenderLevel } from '../../constants';
3
3
  export interface Collector {
4
4
  collect?: (comopnent: ReactElement) => ReactElement;
5
5
  effect: () => void | Promise<void>;
@@ -1,6 +1,6 @@
1
- import { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
2
- import { ServerUserConfig } from '@modern-js/app-tools';
3
- import { SSRConfig } from './shared';
1
+ import type { ServerUserConfig } from '@modern-js/app-tools';
2
+ import { type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
3
+ import type { SSRConfig } from './shared';
4
4
  export declare function attributesToString(attributes: Record<string, any>): string;
5
5
  /**
6
6
  * @param source
@@ -1,6 +1,6 @@
1
- import { BaseSSRServerContext } from '@modern-js/types';
2
- import type { LoaderResult } from './loader/loaderManager';
1
+ import type { BaseSSRServerContext } from '@modern-js/types';
3
2
  import type { RenderLevel } from './constants';
3
+ import type { LoaderResult } from './loader/loaderManager';
4
4
  declare global {
5
5
  interface Window {
6
6
  _SSR_DATA?: SSRContainer;
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
2
  type DocumentStructureContextProps = {
3
3
  hasSetHead?: boolean;
4
4
  hasSetScripts?: boolean;
@@ -1,5 +1,5 @@
1
- import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
- import { Entrypoint } from '@modern-js/types/cli';
1
+ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
+ import type { Entrypoint } from '@modern-js/types/cli';
3
3
  export declare const getDocumenByEntryName: (entrypoints: Entrypoint[], entryName: string, fallbackDir?: string) => string | undefined;
4
4
  export declare const documentPlugin: () => CliPlugin<AppTools>;
5
5
  export default documentPlugin;
@@ -1,4 +1,4 @@
1
- import { AfterMatchContext, AfterRenderContext, MiddlewareContext, NextFunction } from '@modern-js/types';
1
+ import type { AfterMatchContext, AfterRenderContext, MiddlewareContext, NextFunction } from '@modern-js/types';
2
2
  export type { Container, CacheControl, CacheOptionProvider, CacheOption, UnstableMiddlewareContext, UnstableMiddleware, UnstableNext, MonitorEvent, Monitors, CoreMonitor, LogEvent, LogLevel, TimingEvent, } from '@modern-js/types';
3
3
  export declare const hook: (attacher: ({ addMiddleware, afterMatch, afterRender, }: {
4
4
  addMiddleware: (mid: Middleware) => void;
@@ -1,9 +1,9 @@
1
- import type { StateConfig } from './state';
2
1
  import type { RouterConfig } from './router';
2
+ import type { StateConfig } from './state';
3
3
  export type { Plugin } from './core';
4
4
  export type { AppConfig, RuntimeConfig } from './common';
5
5
  export { isBrowser } from './common';
6
6
  export type { BaseRuntimeContext, RuntimeContext, BaseTRuntimeContext, } from './core/context/runtime';
7
7
  export type { RuntimeUserConfig } from './config';
8
8
  export { createApp, useLoader, bootstrap, RuntimeReactContext, defineConfig, defineRuntimeConfig, useRuntimeContext, } from './core';
9
- export { StateConfig, RouterConfig };
9
+ export type { StateConfig, RouterConfig };
@@ -1,5 +1,5 @@
1
- import { IAppContext, PluginAPI } from '@modern-js/core';
1
+ import type { AppNormalizedConfig, AppTools } from '@modern-js/app-tools';
2
+ import type { IAppContext, PluginAPI } from '@modern-js/core';
2
3
  import type { Entrypoint } from '@modern-js/types';
3
- import { AppNormalizedConfig, AppTools } from '@modern-js/app-tools';
4
4
  export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
5
5
  export declare function generatorRegisterCode(internalDirectory: string, entryName: string, code: string): void;
@@ -1,5 +1,5 @@
1
- import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
2
1
  import type { AppNormalizedConfig, IAppContext } from '@modern-js/app-tools';
2
+ import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
3
3
  export declare const routesForServer: ({ routesForServerLoaderMatches, }: {
4
4
  routesForServerLoaderMatches: (NestedRouteForCli | PageRoute)[];
5
5
  }) => string;
@@ -1,4 +1,4 @@
1
- import { Entrypoint } from '@modern-js/types';
1
+ import type { Entrypoint } from '@modern-js/types';
2
2
  export declare const hasPages: (dir: string) => boolean;
3
3
  export declare const hasNestedRoutes: (dir: string) => boolean;
4
4
  export declare const isRouteEntry: (dir: string) => string | false;
@@ -1,6 +1,6 @@
1
- import { Entrypoint } from '@modern-js/types';
2
- import { PluginAPI } from '@modern-js/core';
3
- import { AppTools } from '@modern-js/app-tools';
1
+ import type { AppTools } from '@modern-js/app-tools';
2
+ import type { PluginAPI } from '@modern-js/core';
3
+ import type { Entrypoint } from '@modern-js/types';
4
4
  export declare function handleModifyEntrypoints(api: PluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
5
5
  export declare function handleGeneratorEntryCode(api: PluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
6
6
  export declare function handleFileChange(api: PluginAPI<AppTools<'shared'>>, e: any): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { CliPlugin, AppTools } from '@modern-js/app-tools';
1
+ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
2
  export { isRouteEntry } from './entry';
3
3
  export { handleFileChange, handleModifyEntrypoints } from './handler';
4
4
  export declare const routerPlugin: () => CliPlugin<AppTools<'shared'>>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
2
+ import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
3
3
  /**
4
4
  * DeferredDataScripts only renders in server side,
5
5
  * it doesn't need to be hydrated in client side.
@@ -1,5 +1,5 @@
1
+ import { type LinkProps as RouterLinkProps, type NavLinkProps as RouterNavLinkProps } from '@modern-js/runtime-utils/router';
1
2
  import React from 'react';
2
- import { LinkProps as RouterLinkProps, NavLinkProps as RouterNavLinkProps } from '@modern-js/runtime-utils/router';
3
3
  export declare function composeEventHandlers<EventType extends React.SyntheticEvent | Event>(theirHandler: ((event: EventType) => any) | undefined, ourHandler: (event: EventType) => any): (event: EventType) => any;
4
4
  /**
5
5
  * Modified from https://github.com/remix-run/remix/blob/9a0601bd704d2f3ee622e0ddacab9b611eb0c5bc/packages/remix-react/components.tsx#L218
@@ -1,3 +1,3 @@
1
- import { RouteObject } from '@modern-js/runtime-utils/router';
1
+ import type { RouteObject } from '@modern-js/runtime-utils/router';
2
2
  declare const modifyRoutes: import("@modern-js/plugin").Waterfall<RouteObject[]>;
3
3
  export { modifyRoutes };
@@ -1,6 +1,6 @@
1
1
  import { useRouteLoaderData as useRouteData } from '@modern-js/runtime-utils/router';
2
2
  import { routerPlugin } from './plugin';
3
- import type { SingleRouteConfig, RouterConfig } from './types';
3
+ import type { RouterConfig, SingleRouteConfig } from './types';
4
4
  export * from '@modern-js/runtime-utils/router';
5
5
  export type { SingleRouteConfig, RouterConfig };
6
6
  export { renderRoutes } from './utils';
@@ -1,4 +1,4 @@
1
- import { Plugin } from '../../core';
1
+ import { type Plugin } from '../../core';
2
2
  import type { RouterConfig, Routes } from './types';
3
3
  export declare let finalRouteConfig: RouterConfig['routesConfig'];
4
4
  export declare let beforeCreateRouter: boolean;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type Module from 'module';
3
- import { ShouldRevalidateFunction } from '@modern-js/runtime-utils/remix-router';
3
+ import type { ShouldRevalidateFunction } from '@modern-js/runtime-utils/remix-router';
4
4
  export declare const createShouldRevalidate: (routeId: string) => ShouldRevalidateFunction;
5
5
  export declare const handleRouteModule: (routeModule: Module, routeId: string) => Module;
6
6
  export declare const handleRouteModuleError: (error: Error) => null;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import type { RouteProps, RouteObject, Params } from '@modern-js/runtime-utils/router';
3
- import { PageRoute, NestedRoute } from '@modern-js/types';
4
2
  import type { RequestContext } from '@modern-js/runtime-utils/node';
3
+ import type { Params, RouteObject, RouteProps } from '@modern-js/runtime-utils/router';
4
+ import type { NestedRoute, PageRoute } from '@modern-js/types';
5
5
  declare global {
6
6
  interface Window {
7
7
  _SERVER_DATA?: {
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import type { Reporter, NestedRoute, PageRoute, SSRMode } from '@modern-js/types';
3
- import { type StaticHandlerContext, type Router } from '@modern-js/runtime-utils/remix-router';
4
- import { RouterConfig } from './types';
1
+ import { type Router, type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
2
+ import type { NestedRoute, PageRoute, Reporter, SSRMode } from '@modern-js/types';
3
+ import type React from 'react';
4
+ import type { RouterConfig } from './types';
5
5
  export declare function getRouteComponents(routes: (NestedRoute | PageRoute)[], { globalApp, ssrMode, props, reporter, }: {
6
6
  globalApp?: React.ComponentType<any>;
7
7
  ssrMode?: SSRMode;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { useLocation, useNavigate } from '@modern-js/runtime-utils/router';
2
+ import type React from 'react';
3
3
  export interface WithRouterProps {
4
4
  location: ReturnType<typeof useLocation>;
5
5
  params: Record<string, string>;
@@ -1,3 +1,3 @@
1
- import type { CliPlugin, AppTools } from '@modern-js/app-tools';
1
+ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
2
  export declare const statePlugin: () => CliPlugin<AppTools>;
3
3
  export default statePlugin;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.58.2-alpha.0",
18
+ "version": "2.58.3",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -199,11 +199,11 @@
199
199
  "react-is": "^18",
200
200
  "react-side-effect": "^2.1.1",
201
201
  "styled-components": "^5.3.1",
202
- "@modern-js/plugin": "2.58.1",
203
- "@modern-js/plugin-data-loader": "2.58.1",
204
- "@modern-js/types": "2.58.1",
205
- "@modern-js/utils": "2.58.1",
206
- "@modern-js/runtime-utils": "2.58.1"
202
+ "@modern-js/plugin": "2.58.3",
203
+ "@modern-js/plugin-data-loader": "2.58.3",
204
+ "@modern-js/types": "2.58.3",
205
+ "@modern-js/runtime-utils": "2.58.3",
206
+ "@modern-js/utils": "2.58.3"
207
207
  },
208
208
  "peerDependencies": {
209
209
  "react": ">=17",
@@ -211,7 +211,7 @@
211
211
  },
212
212
  "devDependencies": {
213
213
  "@remix-run/web-fetch": "^4.1.3",
214
- "@rsbuild/core": "1.0.1-beta.13",
214
+ "@rsbuild/core": "1.0.1-beta.14",
215
215
  "@testing-library/react": "^13.4.0",
216
216
  "@types/cookie": "0.5.1",
217
217
  "@types/invariant": "^2.2.30",
@@ -226,15 +226,16 @@
226
226
  "ts-jest": "^29.1.0",
227
227
  "typescript": "^5",
228
228
  "webpack": "^5.93.0",
229
- "@modern-js/app-tools": "2.58.1",
230
- "@modern-js/core": "2.58.1",
231
- "@scripts/build": "2.58.1",
232
- "@scripts/jest-config": "2.58.1"
229
+ "@modern-js/app-tools": "2.58.3",
230
+ "@scripts/jest-config": "2.58.3",
231
+ "@scripts/build": "2.58.3",
232
+ "@modern-js/core": "2.58.3"
233
233
  },
234
234
  "sideEffects": false,
235
235
  "publishConfig": {
236
236
  "registry": "https://registry.npmjs.org/",
237
- "access": "public"
237
+ "access": "public",
238
+ "provenance": true
238
239
  },
239
240
  "scripts": {
240
241
  "dev": "modern-lib build --watch",
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StateConfig } from '../dist/types';
1
+ import type { StateConfig } from '../dist/types';
2
2
 
3
3
  declare module '@modern-js/app-tools' {
4
4
  interface RuntimeUserConfig {
package/types/router.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { RouterConfig } from '../dist/types';
1
+ import type { RouterConfig } from '../dist/types';
2
2
  import '../dist/types/router';
3
3
 
4
4
  declare module '@modern-js/app-tools' {