@modern-js/runtime 3.8.3 → 3.9.1

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 (56) hide show
  1. package/dist/cjs/document/cli/index.js +1 -2
  2. package/dist/cjs/router/runtime/plugin.node.js +1 -2
  3. package/dist/esm/document/cli/index.mjs +2 -3
  4. package/dist/esm/router/runtime/plugin.node.mjs +1 -2
  5. package/dist/esm-node/document/cli/index.mjs +2 -3
  6. package/dist/esm-node/router/runtime/plugin.node.mjs +1 -2
  7. package/dist/types/cli/index.d.ts +4 -4
  8. package/dist/types/common.d.ts +1 -1
  9. package/dist/types/core/browser/hydrate.d.ts +1 -1
  10. package/dist/types/core/browser/index.d.ts +1 -1
  11. package/dist/types/core/compat/hooks.d.ts +1 -1
  12. package/dist/types/core/compat/index.d.ts +1 -1
  13. package/dist/types/core/compat/requestContext.d.ts +3 -3
  14. package/dist/types/core/config.d.ts +1 -1
  15. package/dist/types/core/context/index.d.ts +6 -6
  16. package/dist/types/core/context/runtime.d.ts +2 -2
  17. package/dist/types/core/context/serverPayload/index.d.ts +1 -1
  18. package/dist/types/core/index.d.ts +5 -5
  19. package/dist/types/core/plugin/index.d.ts +1 -1
  20. package/dist/types/core/plugin/types.d.ts +2 -2
  21. package/dist/types/core/react/wrapper.d.ts +1 -1
  22. package/dist/types/core/server/index.d.ts +2 -2
  23. package/dist/types/core/server/react/index.d.ts +2 -2
  24. package/dist/types/core/server/requestHandler.d.ts +1 -1
  25. package/dist/types/core/server/server.d.ts +4 -4
  26. package/dist/types/core/server/shared.d.ts +1 -1
  27. package/dist/types/core/server/stream/afterTemplate.d.ts +4 -4
  28. package/dist/types/core/server/stream/beforeTemplate.d.ts +2 -2
  29. package/dist/types/core/server/stream/createReadableStream.d.ts +1 -1
  30. package/dist/types/core/server/stream/createReadableStream.worker.d.ts +1 -1
  31. package/dist/types/core/server/stream/index.d.ts +1 -1
  32. package/dist/types/core/server/stream/shared.d.ts +3 -3
  33. package/dist/types/core/server/stream/template.d.ts +2 -2
  34. package/dist/types/core/server/string/index.d.ts +1 -1
  35. package/dist/types/core/server/string/loadable.d.ts +1 -1
  36. package/dist/types/core/server/string/ssrData.d.ts +4 -4
  37. package/dist/types/core/server/string/types.d.ts +1 -1
  38. package/dist/types/core/server/utils.d.ts +1 -1
  39. package/dist/types/core/types.d.ts +1 -1
  40. package/dist/types/document/index.d.ts +12 -12
  41. package/dist/types/exports/config-routes.d.ts +1 -1
  42. package/dist/types/index.d.ts +9 -9
  43. package/dist/types/internal.d.ts +2 -2
  44. package/dist/types/react-server.d.ts +3 -3
  45. package/dist/types/router/cli/code/getClientRoutes/index.d.ts +1 -1
  46. package/dist/types/router/cli/index.d.ts +2 -2
  47. package/dist/types/router/index.d.ts +1 -1
  48. package/dist/types/router/internal.d.ts +2 -2
  49. package/dist/types/router/runtime/hooks.d.ts +1 -1
  50. package/dist/types/router/runtime/index.d.ts +4 -4
  51. package/dist/types/router/runtime/internal.d.ts +5 -5
  52. package/dist/types/router/runtime/plugin.d.ts +3 -3
  53. package/dist/types/router/runtime/plugin.node.d.ts +3 -3
  54. package/dist/types/router/runtime/rsc-router.d.ts +2 -2
  55. package/dist/types/router/runtime/utils.d.ts +1 -1
  56. package/package.json +10 -10
@@ -146,8 +146,7 @@ const applyExternalsPlugin = (child, compiler)=>{
146
146
  ]).apply(child);
147
147
  };
148
148
  const generateEntryCode = (docPath, _entryName)=>{
149
- const runtimeAPI = require.resolve('../');
150
- const esmRuntimeAPI = runtimeAPI.replace("cjs", "esm").replace(/.js$/, '.mjs');
149
+ const esmRuntimeAPI = require.resolve('@modern-js/runtime/document');
151
150
  return `import React from 'react';
152
151
  import ReactDomServer from 'react-dom/server';
153
152
  import Document from ${JSON.stringify(docPath)};
@@ -57,11 +57,10 @@ const external_utils_js_namespaceObject = require("./utils.js");
57
57
  function createRemixRequest(request) {
58
58
  const method = 'GET';
59
59
  const { headers } = request;
60
- const controller = new AbortController();
61
60
  return new Request(request.url, {
62
61
  method,
63
62
  headers,
64
- signal: controller.signal
63
+ signal: request.signal
65
64
  });
66
65
  }
67
66
  const routerPlugin = (userConfig = {})=>({
@@ -48,7 +48,7 @@ const processCommentPlaceholders = (html)=>{
48
48
  return html.replace(new RegExp(`${DOCUMENT_COMMENT_PLACEHOLDER_START}([\\s\\S]*?)${DOCUMENT_COMMENT_PLACEHOLDER_END}`, 'g'), (_scriptStr, $1)=>`${decodeHtmlEntities(decodeURIComponent($1))}`);
49
49
  };
50
50
  const requireFromString = (code, filename)=>{
51
- const m = new module_0.Module(filename, module.parent);
51
+ const m = new module_0.Module(filename, void 0);
52
52
  m.filename = filename;
53
53
  m.paths = module_0.Module._nodeModulePaths(path.dirname(filename));
54
54
  m._compile(code, filename);
@@ -101,8 +101,7 @@ const applyExternalsPlugin = (child, compiler)=>{
101
101
  ]).apply(child);
102
102
  };
103
103
  const generateEntryCode = (docPath, _entryName)=>{
104
- const runtimeAPI = require.resolve('../');
105
- const esmRuntimeAPI = runtimeAPI.replace("cjs", "esm").replace(/.js$/, '.mjs');
104
+ const esmRuntimeAPI = require.resolve('@modern-js/runtime/document');
106
105
  return `import React from 'react';
107
106
  import ReactDomServer from 'react-dom/server';
108
107
  import Document from ${JSON.stringify(docPath)};
@@ -14,11 +14,10 @@ import { createRouteObjectsFromConfig, renderRoutes, urlJoin } from "./utils.mjs
14
14
  function createRemixRequest(request) {
15
15
  const method = 'GET';
16
16
  const { headers } = request;
17
- const controller = new AbortController();
18
17
  return new Request(request.url, {
19
18
  method,
20
19
  headers,
21
- signal: controller.signal
20
+ signal: request.signal
22
21
  });
23
22
  }
24
23
  const routerPlugin = (userConfig = {})=>({
@@ -50,7 +50,7 @@ const processCommentPlaceholders = (html)=>{
50
50
  return html.replace(new RegExp(`${DOCUMENT_COMMENT_PLACEHOLDER_START}([\\s\\S]*?)${DOCUMENT_COMMENT_PLACEHOLDER_END}`, 'g'), (_scriptStr, $1)=>`${decodeHtmlEntities(decodeURIComponent($1))}`);
51
51
  };
52
52
  const requireFromString = (code, filename)=>{
53
- const m = new module_0.Module(filename, module.parent);
53
+ const m = new module_0.Module(filename, void 0);
54
54
  m.filename = filename;
55
55
  m.paths = module_0.Module._nodeModulePaths(path.dirname(filename));
56
56
  m._compile(code, filename);
@@ -103,8 +103,7 @@ const applyExternalsPlugin = (child, compiler)=>{
103
103
  ]).apply(child);
104
104
  };
105
105
  const generateEntryCode = (docPath, _entryName)=>{
106
- const runtimeAPI = require.resolve('../');
107
- const esmRuntimeAPI = runtimeAPI.replace("cjs", "esm").replace(/.js$/, '.mjs');
106
+ const esmRuntimeAPI = require.resolve('@modern-js/runtime/document');
108
107
  return `import React from 'react';
109
108
  import ReactDomServer from 'react-dom/server';
110
109
  import Document from ${JSON.stringify(docPath)};
@@ -15,11 +15,10 @@ import { createRouteObjectsFromConfig, renderRoutes, urlJoin } from "./utils.mjs
15
15
  function createRemixRequest(request) {
16
16
  const method = 'GET';
17
17
  const { headers } = request;
18
- const controller = new AbortController();
19
18
  return new Request(request.url, {
20
19
  method,
21
20
  headers,
22
- signal: controller.signal
21
+ signal: request.signal
23
22
  });
24
23
  }
25
24
  const routerPlugin = (userConfig = {})=>({
@@ -1,8 +1,8 @@
1
1
  import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
- import { documentPlugin } from '../document/cli';
3
- import { routerPlugin } from '../router/cli';
4
- import { ssrPlugin } from './ssr';
5
- export { isRuntimeEntry } from './entry';
2
+ import { documentPlugin } from '../document/cli/index.js';
3
+ import { routerPlugin } from '../router/cli/index.js';
4
+ import { ssrPlugin } from './ssr/index.js';
5
+ export { isRuntimeEntry } from './entry.js';
6
6
  export { ssrPlugin, routerPlugin, documentPlugin };
7
7
  export declare const runtimePlugin: (params?: {
8
8
  plugins?: CliPlugin<AppTools>[];
@@ -1,4 +1,4 @@
1
- import type { RuntimePlugin } from './core/plugin';
1
+ import type { RuntimePlugin } from './core/plugin/index.js';
2
2
  export declare const isBrowser: () => boolean;
3
3
  export interface RuntimeConfig {
4
4
  plugins?: RuntimePlugin[];
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
2
  import { type Root } from 'react-dom/client';
3
- import type { TRuntimeContext } from '../context/runtime';
3
+ import type { TRuntimeContext } from '../context/runtime.js';
4
4
  export declare function hydrateWithReact(App: React.ReactElement, rootElement: HTMLElement): Promise<Root>;
5
5
  export declare function hydrateRoot(App: React.ReactElement, context: TRuntimeContext, ModernRender: (App: React.ReactElement) => Promise<HTMLElement | Root>, ModernHydrate: (App: React.ReactElement) => Promise<HTMLElement | Root>): Promise<HTMLElement | Root>;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import { hydrateWithReact } from './hydrate';
2
+ import { hydrateWithReact } from './hydrate.js';
3
3
  export { hydrateWithReact };
4
4
  export type RenderFunc = typeof render;
5
5
  export declare function render(App: React.ReactElement<{
@@ -1,4 +1,4 @@
1
- import type { TInternalRuntimeContext } from '../context';
1
+ import type { TInternalRuntimeContext } from '../context/index.js';
2
2
  export declare function transformHookRunner(hookRunnerName: string): string;
3
3
  export declare function handleSetupResult(setupResult: Record<string, (...args: any) => any>, api: Record<string, any>): void;
4
4
  export declare function getHookRunners(runtimeContext: TInternalRuntimeContext): Record<string, any>;
@@ -1,2 +1,2 @@
1
- import type { RuntimePlugin } from '../plugin/types';
1
+ import type { RuntimePlugin } from '../plugin/types.js';
2
2
  export declare const compatPlugin: () => RuntimePlugin;
@@ -1,5 +1,5 @@
1
- import type { TInternalRuntimeContext } from '../context';
2
- import type { RuntimePlugin } from '../plugin/types';
3
- import type { RequestContext } from '../types';
1
+ import type { TInternalRuntimeContext } from '../context/index.js';
2
+ import type { RuntimePlugin } from '../plugin/types.js';
3
+ import type { RequestContext } from '../types.js';
4
4
  export declare const makeRequestContext: (context: TInternalRuntimeContext) => RequestContext;
5
5
  export declare const requestContextPlugin: () => RuntimePlugin;
@@ -1,4 +1,4 @@
1
- import type { RuntimeConfig } from '../common';
1
+ import type { RuntimeConfig } from '../common.js';
2
2
  /**
3
3
  * This function helps you to autocomplete configuration types.
4
4
  * It accepts a direct config object, or a function that returns a config.
@@ -1,10 +1,10 @@
1
1
  import type { InternalRuntimeContext } from '@modern-js/plugin';
2
2
  import type { NestedRoute, PageRoute } from '@modern-js/types';
3
3
  import type React from 'react';
4
- import type { RuntimeExtends } from '../plugin/types';
5
- import type { ServerPayload } from './serverPayload/index';
6
- export { type TRuntimeContext, type TInternalRuntimeContext, RuntimeContext, InternalRuntimeContext, getInitialContext, } from './runtime';
7
- export type { ServerPayload, PayloadRoute } from './serverPayload/index';
4
+ import type { RuntimeExtends } from '../plugin/types.js';
5
+ import type { ServerPayload } from './serverPayload/index.js';
6
+ export { type TRuntimeContext, type TInternalRuntimeContext, RuntimeContext, InternalRuntimeContext, getInitialContext, } from './runtime.js';
7
+ export type { ServerPayload, PayloadRoute } from './serverPayload/index.js';
8
8
  interface GlobalContext {
9
9
  entryName?: string;
10
10
  /**
@@ -36,14 +36,14 @@ interface GlobalContext {
36
36
  serverPayload?: ServerPayload;
37
37
  enableRsc?: boolean;
38
38
  }
39
- export { getServerPayload, setServerPayload, } from './serverPayload/index';
39
+ export { getServerPayload, setServerPayload, } from './serverPayload/index.js';
40
40
  export declare function getGlobalIsRscClient(): boolean | undefined;
41
41
  export declare function getGlobalEnableRsc(): boolean | undefined;
42
42
  export declare function setGlobalContext(context: Omit<GlobalContext, 'internalRuntimeContext'>): void;
43
43
  export declare function getCurrentEntryName(): string | undefined;
44
44
  export declare function getGlobalRSCRoot(): React.ComponentType<{}> | undefined;
45
45
  export declare function setGlobalInternalRuntimeContext(context: InternalRuntimeContext<RuntimeExtends>): void;
46
- export declare function getGlobalInternalRuntimeContext(): InternalRuntimeContext<Required<import("@modern-js/plugin").RuntimePluginExtends<import("../plugin/types").RuntimeConfig, import("./runtime").TInternalRuntimeContext, {}, {}>>>;
46
+ export declare function getGlobalInternalRuntimeContext(): InternalRuntimeContext<Required<import("@modern-js/plugin").RuntimePluginExtends<import("../plugin/types.js").RuntimeConfig, import("./runtime.js").TInternalRuntimeContext, {}, {}>>>;
47
47
  export declare function getGlobalApp(): React.ComponentType<{}> | undefined;
48
48
  export declare function getGlobalRoutes(): undefined | (NestedRoute | PageRoute)[];
49
49
  export declare function getGlobalLayoutApp(): React.ComponentType<{}> | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { RouteObject } from '@modern-js/runtime-utils/router';
2
2
  import type { StaticHandlerContext } from '@modern-js/runtime-utils/router';
3
- import type { RouteManifest } from '../../router/runtime/types';
4
- import type { RequestContext, SSRServerContext } from '../types';
3
+ import type { RouteManifest } from '../../router/runtime/types.js';
4
+ import type { RequestContext, SSRServerContext } from '../types.js';
5
5
  export interface TRuntimeContext {
6
6
  initialData?: Record<string, unknown>;
7
7
  isBrowser: boolean;
@@ -1,4 +1,4 @@
1
- import type { PayloadRoute, ServerPayload } from './index.server';
1
+ import type { PayloadRoute, ServerPayload } from './index.server.js';
2
2
  export type { ServerPayload, PayloadRoute };
3
3
  export declare const getServerPayload: () => ServerPayload | undefined;
4
4
  export declare const setServerPayload: (payload: ServerPayload) => void;
@@ -1,5 +1,5 @@
1
- export type { RuntimePlugin } from './plugin';
2
- export { defineRuntimeConfig } from './config';
3
- export type { TRuntimeContext } from './context/runtime';
4
- export { RuntimeContext, useRuntimeContext, } from './context/runtime';
5
- export type { SSRData, SSRContainer } from './types';
1
+ export type { RuntimePlugin } from './plugin/index.js';
2
+ export { defineRuntimeConfig } from './config.js';
3
+ export type { TRuntimeContext } from './context/runtime.js';
4
+ export { RuntimeContext, useRuntimeContext, } from './context/runtime.js';
5
+ export type { SSRData, SSRContainer } from './types.js';
@@ -1,4 +1,4 @@
1
- import type { RuntimeConfig, RuntimePlugin } from './types';
1
+ import type { RuntimeConfig, RuntimePlugin } from './types.js';
2
2
  export type { RuntimePlugin };
3
3
  export declare function registerPlugin(internalPlugins: RuntimePlugin[], runtimeConfig?: RuntimeConfig): {
4
4
  hooks: import("@modern-js/plugin/runtime").Hooks<{} | undefined, import("@modern-js/plugin/runtime").RuntimeContext>;
@@ -1,7 +1,7 @@
1
1
  import type { RuntimePlugin as BaseRuntimePlugin, RuntimePluginExtends } from '@modern-js/plugin';
2
2
  import type { Hooks } from '@modern-js/plugin/runtime';
3
- import type { RuntimeConfig as BaseRuntimeConfig } from '../../common';
4
- import type { TInternalRuntimeContext } from '../context/runtime';
3
+ import type { RuntimeConfig as BaseRuntimeConfig } from '../../common.js';
4
+ import type { TInternalRuntimeContext } from '../context/runtime.js';
5
5
  export type RuntimeHooks = Hooks<RuntimeConfig, TInternalRuntimeContext>;
6
6
  export type RuntimeExtends = Required<RuntimePluginExtends<RuntimeConfig, TInternalRuntimeContext, {}, {}>>;
7
7
  export type RuntimePlugin<Extends extends RuntimePluginExtends = {}> = BaseRuntimePlugin<RuntimeExtends & Extends>;
@@ -1,3 +1,3 @@
1
1
  import type React from 'react';
2
- import { type TRuntimeContext } from '../context';
2
+ import { type TRuntimeContext } from '../context/index.js';
3
3
  export declare function wrapRuntimeContextProvider(App: React.ReactElement, contextValue: TRuntimeContext): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { RuntimePlugin } from '../plugin';
2
- export { NoSSR, NoSSRCache } from './react';
1
+ import type { RuntimePlugin } from '../plugin/index.js';
2
+ export { NoSSR, NoSSRCache } from './react/index.js';
3
3
  export declare const ssr: (_config: any) => RuntimePlugin;
4
4
  export default ssr;
@@ -1,2 +1,2 @@
1
- export { NoSSR } from './nossr';
2
- export { NoSSRCache } from './no-ssr-cache';
1
+ export { NoSSR } from './nossr/index.js';
2
+ export { NoSSRCache } from './no-ssr-cache/index.js';
@@ -1,6 +1,6 @@
1
1
  import type { RequestHandler, RequestHandlerOptions } from '@modern-js/app-tools';
2
2
  import React from 'react';
3
- import { type TInternalRuntimeContext } from '../context';
3
+ import { type TInternalRuntimeContext } from '../context/index.js';
4
4
  export type { RequestHandlerConfig as HandleRequestConfig } from '@modern-js/app-tools';
5
5
  export type HandleRequestOptions = Exclude<RequestHandlerOptions, 'staticGenerate'> & {
6
6
  runtimeContext: TInternalRuntimeContext;
@@ -1,4 +1,4 @@
1
- export { renderString } from './string';
2
- export { renderStreaming } from './stream';
3
- export { createRequestHandler, type HandleRequest, type HandleRequestOptions, type HandleRequestConfig, type CreateRequestHandler, } from './requestHandler';
4
- export type { RenderStreaming, RenderString, RenderOptions } from './shared';
1
+ export { renderString } from './string/index.js';
2
+ export { renderStreaming } from './stream/index.js';
3
+ export { createRequestHandler, type HandleRequest, type HandleRequestOptions, type HandleRequestConfig, type CreateRequestHandler, } from './requestHandler.js';
4
+ export type { RenderStreaming, RenderString, RenderOptions } from './shared.js';
@@ -1,5 +1,5 @@
1
1
  import type { ServerUserConfig } from '@modern-js/app-tools';
2
- import type { HandleRequestOptions } from './requestHandler';
2
+ import type { HandleRequestOptions } from './requestHandler.js';
3
3
  export type RenderOptions = HandleRequestOptions;
4
4
  export type SSRConfig = NonNullable<ServerUserConfig['ssr']>;
5
5
  export type RenderStreaming = (request: Request, serverRoot: React.ReactElement, optinos: RenderOptions) => Promise<ReadableStream>;
@@ -1,7 +1,7 @@
1
- import { type RenderLevel } from '../../constants';
2
- import type { TInternalRuntimeContext } from '../../context';
3
- import type { HandleRequestConfig } from '../requestHandler';
4
- import { type SSRConfig } from '../shared';
1
+ import { type RenderLevel } from '../../constants.js';
2
+ import type { TInternalRuntimeContext } from '../../context/index.js';
3
+ import type { HandleRequestConfig } from '../requestHandler.js';
4
+ import { type SSRConfig } from '../shared.js';
5
5
  export type BuildShellAfterTemplateOptions = {
6
6
  runtimeContext: TInternalRuntimeContext;
7
7
  renderLevel: RenderLevel;
@@ -1,5 +1,5 @@
1
- import type { TInternalRuntimeContext } from '../../context';
2
- import type { HandleRequestConfig } from '../requestHandler';
1
+ import type { TInternalRuntimeContext } from '../../context/index.js';
2
+ import type { HandleRequestConfig } from '../requestHandler.js';
3
3
  export interface BuildShellBeforeTemplateOptions {
4
4
  runtimeContext: TInternalRuntimeContext;
5
5
  entryName: string;
@@ -1,2 +1,2 @@
1
- import { type CreateReadableStreamFromElement } from './shared';
1
+ import { type CreateReadableStreamFromElement } from './shared.js';
2
2
  export declare const createReadableStreamFromElement: CreateReadableStreamFromElement;
@@ -1,2 +1,2 @@
1
- import { type CreateReadableStreamFromElement } from './shared';
1
+ import { type CreateReadableStreamFromElement } from './shared.js';
2
2
  export declare const createReadableStreamFromElement: CreateReadableStreamFromElement;
@@ -1 +1 @@
1
- export declare const renderStreaming: import("../shared").RenderStreaming;
1
+ export declare const renderStreaming: import("../shared.js").RenderStreaming;
@@ -1,9 +1,9 @@
1
1
  import type { OnError } from '@modern-js/app-tools';
2
2
  import type { ClientManifest as RscClientManifest, SSRManifest as RscSSRManifest, ServerManifest as RscServerManifest } from '@modern-js/types/server';
3
3
  import type React from 'react';
4
- import type { TRuntimeContext } from '../../context';
5
- import type { HandleRequestConfig } from '../requestHandler';
6
- import type { RenderStreaming, SSRConfig } from '../shared';
4
+ import type { TRuntimeContext } from '../../context/index.js';
5
+ import type { HandleRequestConfig } from '../requestHandler.js';
6
+ import type { RenderStreaming, SSRConfig } from '../shared.js';
7
7
  export type CreateReadableStreamFromElementOptions = {
8
8
  runtimeContext: TRuntimeContext;
9
9
  config: HandleRequestConfig;
@@ -1,5 +1,5 @@
1
- import { type BuildShellAfterTemplateOptions } from './afterTemplate';
2
- import { type BuildShellBeforeTemplateOptions } from './beforeTemplate';
1
+ import { type BuildShellAfterTemplateOptions } from './afterTemplate.js';
2
+ import { type BuildShellBeforeTemplateOptions } from './beforeTemplate.js';
3
3
  export type InjectTemplate = {
4
4
  shellBefore: string;
5
5
  shellAfter: string;
@@ -1,2 +1,2 @@
1
- import { type RenderString } from '../shared';
1
+ import { type RenderString } from '../shared.js';
2
2
  export declare const renderString: RenderString;
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement } from 'react';
2
- import type { ChunkSet, Collector } from './types';
2
+ import type { ChunkSet, Collector } from './types.js';
3
3
  declare module '@loadable/server' {
4
4
  interface ChunkExtractor {
5
5
  chunks: string[];
@@ -1,8 +1,8 @@
1
1
  import type { StaticHandlerContext } from '@modern-js/runtime-utils/router';
2
- import type { TRuntimeContext } from '../../context';
3
- import type { SSRServerContext } from '../../types';
4
- import type { SSRConfig } from '../shared';
5
- import type { ChunkSet, Collector } from './types';
2
+ import type { TRuntimeContext } from '../../context/index.js';
3
+ import type { SSRServerContext } from '../../types.js';
4
+ import type { SSRConfig } from '../shared.js';
5
+ import type { ChunkSet, Collector } from './types.js';
6
6
  export interface SSRDataCreatorOptions {
7
7
  runtimeContext: TRuntimeContext;
8
8
  request: Request;
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement } from 'react';
2
- import type { RenderLevel } from '../../constants';
2
+ import type { RenderLevel } from '../../constants.js';
3
3
  export interface Collector {
4
4
  collect?: (comopnent: ReactElement) => ReactElement;
5
5
  effect: () => void | Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import type { ServerUserConfig } from '@modern-js/app-tools';
2
2
  import { type StaticHandlerContext } from '@modern-js/runtime-utils/router';
3
- import type { SSRConfig } from './shared';
3
+ import type { SSRConfig } from './shared.js';
4
4
  export declare function attributesToString(attributes: Record<string, any>): string;
5
5
  /**
6
6
  * @param source
@@ -1,6 +1,6 @@
1
1
  import type { OnError, OnTiming } from '@modern-js/app-tools';
2
2
  import type { BaseSSRServerContext } from '@modern-js/types';
3
- import type { RenderLevel } from './constants';
3
+ import type { RenderLevel } from './constants.js';
4
4
  declare global {
5
5
  interface Window {
6
6
  _SSR_DATA?: SSRContainer;
@@ -1,12 +1,12 @@
1
- export * from './Html';
2
- export * from './DocumentContext';
3
- export * from './DocumentStructureContext';
4
- export * from './Head';
5
- export * from './Body';
6
- export * from './Root';
7
- export * from './Links';
8
- export * from './Comment';
9
- export * from './Style';
10
- export * from './Scripts';
11
- export * from './Script';
12
- export * from './constants';
1
+ export * from './Html.js';
2
+ export * from './DocumentContext.js';
3
+ export * from './DocumentStructureContext.js';
4
+ export * from './Head.js';
5
+ export * from './Body.js';
6
+ export * from './Root.js';
7
+ export * from './Links.js';
8
+ export * from './Comment.js';
9
+ export * from './Style.js';
10
+ export * from './Scripts.js';
11
+ export * from './Script.js';
12
+ export * from './constants.js';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Type definitions for config-based routing
3
3
  */
4
- import type { DefineRoutesFunction, LayoutFunction, PageFunction, RouteConfig, RouteFunction, RouteFunctions, WildcardFunction } from '../router/cli/config-routes/parseRouteConfig';
4
+ import type { DefineRoutesFunction, LayoutFunction, PageFunction, RouteConfig, RouteFunction, RouteFunctions, WildcardFunction } from '../router/cli/config-routes/parseRouteConfig.js';
5
5
  export type { RouteConfig, RouteFunction, LayoutFunction, PageFunction, WildcardFunction, RouteFunctions, DefineRoutesFunction, };
6
6
  /**
7
7
  * defineRoutes - main function to define route configurations
@@ -1,10 +1,10 @@
1
- import type { RouterConfig } from './router/internal';
2
- export type { RuntimePlugin } from './core';
3
- export type { RuntimeConfig } from './common';
4
- export { isBrowser } from './common';
5
- export type { TRuntimeContext } from './core/context/runtime';
6
- export { getMonitors } from './core/context/monitors';
7
- export { getRequest } from './core/context/request';
8
- export { setHeaders, setStatus, redirect } from './core/context/response';
9
- export { RuntimeContext, defineRuntimeConfig, useRuntimeContext, } from './core';
1
+ import type { RouterConfig } from './router/internal.js';
2
+ export type { RuntimePlugin } from './core/index.js';
3
+ export type { RuntimeConfig } from './common.js';
4
+ export { isBrowser } from './common.js';
5
+ export type { TRuntimeContext } from './core/context/runtime.js';
6
+ export { getMonitors } from './core/context/monitors/index.js';
7
+ export { getRequest } from './core/context/request/index.js';
8
+ export { setHeaders, setStatus, redirect } from './core/context/response/index.js';
9
+ export { RuntimeContext, defineRuntimeConfig, useRuntimeContext, } from './core/index.js';
10
10
  export type { RouterConfig };
@@ -1,2 +1,2 @@
1
- export type { SSRServerContext } from './core/types';
2
- export { InternalRuntimeContext, type TInternalRuntimeContext, } from './core/context/runtime';
1
+ export type { SSRServerContext } from './core/types.js';
2
+ export { InternalRuntimeContext, type TInternalRuntimeContext, } from './core/context/runtime.js';
@@ -1,3 +1,3 @@
1
- export { getRequest } from './core/context/request';
2
- export { getMonitors } from './core/context/monitors';
3
- export { setHeaders, setStatus, redirect } from './core/context/response';
1
+ export { getRequest } from './core/context/request/index.js';
2
+ export { getMonitors } from './core/context/monitors/index.js';
3
+ export { setHeaders, setStatus, redirect } from './core/context/response/index.js';
@@ -1 +1 @@
1
- export { getClientRoutes } from './getRoutes';
1
+ export { getClientRoutes } from './getRoutes.js';
@@ -1,5 +1,5 @@
1
1
  import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
- export { isRouteEntry } from './entry';
3
- export { handleFileChange, handleModifyEntrypoints } from './handler';
2
+ export { isRouteEntry } from './entry.js';
3
+ export { handleFileChange, handleModifyEntrypoints } from './handler.js';
4
4
  export declare const routerPlugin: () => CliPlugin<AppTools>;
5
5
  export default routerPlugin;
@@ -1 +1 @@
1
- export * from './runtime';
1
+ export * from './runtime/index.js';
@@ -1,2 +1,2 @@
1
- export * from './runtime/internal';
2
- export { routerPlugin as default } from './runtime/internal';
1
+ export * from './runtime/internal.js';
2
+ export { routerPlugin as default } from './runtime/internal.js';
@@ -1,5 +1,5 @@
1
1
  import type { RouteObject } from '@modern-js/runtime-utils/router';
2
- import type { TRuntimeContext } from '../../core/context/runtime';
2
+ import type { TRuntimeContext } from '../../core/context/runtime.js';
3
3
  declare const modifyRoutes: import("@modern-js/plugin").SyncHook<(routes: RouteObject[]) => RouteObject[]>;
4
4
  declare const onBeforeCreateRoutes: import("@modern-js/plugin").SyncHook<(context: TRuntimeContext) => void>;
5
5
  export { modifyRoutes, onBeforeCreateRoutes };
@@ -1,7 +1,7 @@
1
1
  import { useRouteLoaderData as useRouteData } from '@modern-js/runtime-utils/router';
2
2
  export * from '@modern-js/runtime-utils/router';
3
- export { Link, NavLink } from './PrefetchLink';
4
- export type { LinkProps, NavLinkProps } from './PrefetchLink';
3
+ export { Link, NavLink } from './PrefetchLink.js';
4
+ export type { LinkProps, NavLinkProps } from './PrefetchLink.js';
5
5
  export declare const useRouteLoaderData: typeof useRouteData;
6
- export * from './withRouter';
7
- export type { LoaderFunction, LoaderFunctionArgs } from './types';
6
+ export * from './withRouter.js';
7
+ export type { LoaderFunction, LoaderFunctionArgs } from './types.js';
@@ -1,8 +1,8 @@
1
- import { routerPlugin } from './plugin';
2
- import type { RouterConfig, SingleRouteConfig } from './types';
1
+ import { routerPlugin } from './plugin.js';
2
+ import type { RouterConfig, SingleRouteConfig } from './types.js';
3
3
  export { routerPlugin };
4
4
  export default routerPlugin;
5
5
  export type { SingleRouteConfig, RouterConfig };
6
- export type { RouterExtendsHooks } from './hooks';
7
- export { renderRoutes } from './utils';
8
- export { modifyRoutes } from './plugin';
6
+ export type { RouterExtendsHooks } from './hooks.js';
7
+ export { renderRoutes } from './utils.js';
8
+ export { modifyRoutes } from './plugin.js';
@@ -1,6 +1,6 @@
1
- import { type RuntimePlugin } from '../../core';
2
- import { type RouterExtendsHooks } from './hooks';
3
- import type { RouterConfig, Routes } from './types';
1
+ import { type RuntimePlugin } from '../../core/index.js';
2
+ import { type RouterExtendsHooks } from './hooks.js';
3
+ import type { RouterConfig, Routes } from './types.js';
4
4
  export declare let finalRouteConfig: RouterConfig['routesConfig'];
5
5
  export declare let beforeCreateRouter: boolean;
6
6
  export declare function modifyRoutes(modifyFunction: (routes: Routes) => Routes): void;
@@ -1,6 +1,6 @@
1
- import type { RuntimePlugin } from '../../core';
2
- import { type RouterExtendsHooks } from './hooks';
3
- import type { RouterConfig } from './types';
1
+ import type { RuntimePlugin } from '../../core/index.js';
2
+ import { type RouterExtendsHooks } from './hooks.js';
3
+ import type { RouterConfig } from './types.js';
4
4
  export declare const routerPlugin: (userConfig?: Partial<RouterConfig>) => RuntimePlugin<{
5
5
  extendHooks: RouterExtendsHooks;
6
6
  }>;
@@ -1,7 +1,7 @@
1
1
  import { type RouteObject, type StaticHandlerContext } from '@modern-js/runtime-utils/router';
2
2
  import React from 'react';
3
- import type { ServerPayload } from '../../core/context';
4
- import type { RouteManifest } from './types';
3
+ import type { ServerPayload } from '../../core/context/index.js';
4
+ import type { RouteManifest } from './types.js';
5
5
  declare global {
6
6
  interface Window {
7
7
  _MODERNJS_ROUTE_MANIFEST?: RouteManifest;
@@ -3,7 +3,7 @@ import type { DataRouter } from '@modern-js/runtime-utils/router';
3
3
  import { type RouteObject } from '@modern-js/runtime-utils/router';
4
4
  import type { NestedRoute, PageRoute, SSRMode } from '@modern-js/types';
5
5
  import React from 'react';
6
- import type { RouterConfig } from './types';
6
+ import type { RouterConfig } from './types.js';
7
7
  export declare function getRouteComponents(routes: (NestedRoute | PageRoute)[], { globalApp, ssrMode, props, }: {
8
8
  globalApp?: React.ComponentType<GlobalAppProps>;
9
9
  ssrMode?: SSRMode;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.8.3",
18
+ "version": "3.9.1",
19
19
  "engines": {
20
20
  "node": ">=20"
21
21
  },
@@ -215,12 +215,12 @@
215
215
  "isbot": "3.8.0",
216
216
  "react-helmet": "^6.1.0",
217
217
  "react-is": "^18.3.1",
218
- "@modern-js/plugin": "3.8.3",
219
- "@modern-js/runtime-utils": "3.8.3",
220
- "@modern-js/render": "3.8.3",
221
- "@modern-js/utils": "3.8.3",
222
- "@modern-js/types": "3.8.3",
223
- "@modern-js/plugin-data-loader": "3.8.3"
218
+ "@modern-js/plugin": "3.9.1",
219
+ "@modern-js/runtime-utils": "3.9.1",
220
+ "@modern-js/plugin-data-loader": "3.9.1",
221
+ "@modern-js/types": "3.9.1",
222
+ "@modern-js/render": "3.9.1",
223
+ "@modern-js/utils": "3.9.1"
224
224
  },
225
225
  "peerDependencies": {
226
226
  "react": ">=18.3.1",
@@ -228,8 +228,8 @@
228
228
  },
229
229
  "devDependencies": {
230
230
  "@remix-run/web-fetch": "^4.1.3",
231
- "@rsbuild/core": "2.2.0-rc.0",
232
- "@rslib/core": "0.23.2",
231
+ "@rsbuild/core": "2.2.4",
232
+ "@rslib/core": "1.0.0",
233
233
  "@testing-library/dom": "^10.4.1",
234
234
  "@testing-library/react": "^16.3.2",
235
235
  "@types/cookie": "0.6.0",
@@ -240,7 +240,7 @@
240
240
  "react-dom": "^19.2.8",
241
241
  "ts-node": "^10.9.2",
242
242
  "typescript": "^5",
243
- "@modern-js/app-tools": "3.8.3",
243
+ "@modern-js/app-tools": "3.9.1",
244
244
  "@modern-js/rslib": "2.68.10",
245
245
  "@scripts/rstest-config": "2.66.0"
246
246
  },