@modern-js/runtime 2.65.5 → 2.66.0

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.
@@ -1,3 +1,3 @@
1
1
  import type { AppToolsContext, AppToolsFeatureHooks, AppToolsNormalizedConfig } from '@modern-js/app-tools';
2
2
  import type { Entrypoint } from '@modern-js/types';
3
- export declare const generateCode: (entrypoints: Entrypoint[], appContext: AppToolsContext<'shared'>, config: AppToolsNormalizedConfig, hooks: AppToolsFeatureHooks<'shared'>) => Promise<void>;
3
+ export declare const generateCode: (entrypoints: Entrypoint[], appContext: AppToolsContext<"shared">, config: AppToolsNormalizedConfig, hooks: AppToolsFeatureHooks<"shared">) => Promise<void>;
@@ -6,6 +6,6 @@ import { ssrPlugin } from './ssr';
6
6
  export { isRuntimeEntry } from './entry';
7
7
  export { statePlugin, ssrPlugin, routerPlugin, documentPlugin };
8
8
  export declare const runtimePlugin: (params?: {
9
- plugins?: CliPluginFuture<AppTools<'shared'>>[];
10
- }) => CliPluginFuture<AppTools<'shared'>>;
9
+ plugins?: CliPluginFuture<AppTools<"shared">>[];
10
+ }) => CliPluginFuture<AppTools<"shared">>;
11
11
  export default runtimePlugin;
@@ -1,3 +1,3 @@
1
1
  import type { AppTools, CliPluginFuture } from '@modern-js/app-tools';
2
- export declare const ssrPlugin: () => CliPluginFuture<AppTools<'shared'>>;
2
+ export declare const ssrPlugin: () => CliPluginFuture<AppTools<"shared">>;
3
3
  export default ssrPlugin;
@@ -2,8 +2,8 @@ import type { RuntimePluginConfig } from '@modern-js/app-tools';
2
2
  export declare const entryForCSRWithRSC: ({ metaName, entryName, urlPath, mountId, }: {
3
3
  metaName: string;
4
4
  entryName: string;
5
- urlPath?: string | undefined;
6
- mountId?: string | undefined;
5
+ urlPath?: string;
6
+ mountId?: string;
7
7
  }) => string;
8
8
  export declare const index: ({ srcDirectory, internalSrcAlias, metaName, entry, entryName, customEntry, customBootstrap, mountId, enableRsc, }: {
9
9
  srcDirectory: string;
@@ -11,10 +11,10 @@ export declare const index: ({ srcDirectory, internalSrcAlias, metaName, entry,
11
11
  metaName: string;
12
12
  entry: string;
13
13
  entryName: string;
14
- customEntry?: boolean | undefined;
15
- customBootstrap?: string | false | undefined;
16
- mountId?: string | undefined;
17
- enableRsc?: boolean | undefined;
14
+ customEntry?: boolean;
15
+ customBootstrap?: string | false;
16
+ mountId?: string;
17
+ enableRsc?: boolean;
18
18
  }) => string;
19
19
  export declare const register: () => string;
20
20
  export declare const runtimeRegister: ({ entryName, srcDirectory, internalSrcAlias, metaName, runtimeConfigFile, runtimePlugins, }: {
@@ -31,7 +31,7 @@ export declare const runtimeGlobalContext: ({ entryName, srcDirectory, internalS
31
31
  internalSrcAlias: string;
32
32
  metaName: string;
33
33
  entry: string;
34
- customEntry?: boolean | undefined;
34
+ customEntry?: boolean;
35
35
  }) => string;
36
36
  export declare const runtimeGlobalContextForRSCServer: ({ metaName, }: {
37
37
  metaName: string;
@@ -43,5 +43,5 @@ export declare const AppProxyForRSC: ({ srcDirectory, internalSrcAlias, entry, c
43
43
  srcDirectory: string;
44
44
  internalSrcAlias: string;
45
45
  entry: string;
46
- customEntry?: boolean | undefined;
46
+ customEntry?: boolean;
47
47
  }) => string;
@@ -1,4 +1,4 @@
1
- import type { Plugin } from './core/plugin';
1
+ import type { Plugin, RuntimePluginFuture } from './core/plugin';
2
2
  import type { RouterConfig } from './router';
3
3
  import type { StateConfig } from './state';
4
4
  export declare const isBrowser: () => boolean;
@@ -12,7 +12,7 @@ export interface RuntimeConfig {
12
12
  stateByEntries?: {
13
13
  [name: string]: StateConfig;
14
14
  };
15
- plugins?: Plugin[];
15
+ plugins?: (Plugin | RuntimePluginFuture)[];
16
16
  [key: string]: any;
17
17
  }
18
18
  export declare const JSX_SHELL_STREAM_END_MARK = "<!--<?- SHELL_STREAM_END ?>-->";
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node/http" />
3
- /// <reference types="types" />
4
1
  import type { RuntimeContext } from '../context';
5
2
  import type { RuntimePluginFuture } from '../plugin/types';
6
3
  export declare const makeRequestContext: (context: RuntimeContext) => import("../types").ServerContext | import("../types").ClientContext | {
@@ -13,10 +10,10 @@ export declare const makeRequestContext: (context: RuntimeContext) => import("..
13
10
  headers: import("http").IncomingHttpHeaders;
14
11
  host: string;
15
12
  url: string;
16
- referer?: string | undefined;
17
- userAgent?: string | undefined;
18
- cookie?: string | undefined;
19
- cookieMap?: Record<string, string> | undefined;
13
+ referer?: string;
14
+ userAgent?: string;
15
+ cookie?: string;
16
+ cookieMap?: Record<string, string>;
20
17
  } & {
21
18
  baseUrl: string;
22
19
  raw: Request;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { InternalRuntimeContext } from '@modern-js/plugin-v2';
3
2
  import type { NestedRoute, PageRoute } from '@modern-js/types';
4
3
  import type { AppConfig } from '../../common';
@@ -1,2 +1,2 @@
1
1
  import type { Monitors } from '@modern-js/types';
2
- export declare const getMonitors: () => Omit<Monitors, 'push'>;
2
+ export declare const getMonitors: () => Omit<Monitors, "push">;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Store } from '@modern-js-reduck/store';
3
2
  import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
4
3
  import type { RouteManifest } from '../../router/runtime/types';
@@ -26,8 +26,8 @@ export interface LoaderOptions<Params = any, TData = any, TError extends Error =
26
26
  */
27
27
  static?: boolean;
28
28
  }
29
- declare const useLoader: <TData = any, Params = any, E = any>(loaderFn: LoaderFn<Params, TData>, options?: LoaderOptions<Params, any, any>) => {
30
- reload: (params?: Params | undefined) => Promise<any> | undefined;
29
+ declare const useLoader: <TData = any, Params = any, E = any>(loaderFn: LoaderFn<Params, TData>, options?: LoaderOptions<Params>) => {
30
+ reload: (params?: Params) => Promise<any> | undefined;
31
31
  loading: boolean;
32
32
  reloading: boolean;
33
33
  data: TData;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { AsyncInterruptWorkflow, PluginOptions, Setup, SyncParallelWorkflow, Waterfall } from '@modern-js/plugin';
3
2
  import type { RuntimeContext, TRuntimeContext } from '../context/runtime';
4
3
  import type { RuntimeConfig } from './types';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ServerUserConfig } from '@modern-js/app-tools';
3
2
  import type { HandleRequestOptions } from './requestHandler';
4
3
  export type RenderOptions = HandleRequestOptions;
@@ -15,5 +15,13 @@ export declare function checkIsNode(): boolean;
15
15
  * license at https://github.com/remix-run/remix/blob/main/LICENSE.md
16
16
  */
17
17
  export declare function serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'];
18
- export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserConfig['ssr'], ssrByEntries?: ServerUserConfig['ssrByEntries']): import("@modern-js/app-tools").SSR;
18
+ export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserConfig['ssr'], ssrByEntries?: ServerUserConfig['ssrByEntries']): true | {
19
+ forceCSR?: boolean;
20
+ mode?: import("@modern-js/types").SSRMode;
21
+ inlineScript?: boolean;
22
+ disablePrerender?: boolean;
23
+ unsafeHeaders?: string[];
24
+ scriptLoading?: "defer" | "blocking" | "module" | "async";
25
+ loaderFailureMode?: "clientRender" | "errorBoundary";
26
+ };
19
27
  export declare function getSSRMode(ssrConfig?: SSRConfig): 'string' | 'stream' | false;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function Script(props: DocumentScriptProps): import("react").JSX.Element;
3
2
  export interface DocumentScriptProps extends Omit<React.ScriptHTMLAttributes<HTMLScriptElement>, 'content'> {
4
3
  content?: () => void;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare function Title(): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import type { AppTools, CliPluginFuture } from '@modern-js/app-tools';
2
2
  import type { Entrypoint } from '@modern-js/types/cli';
3
3
  export declare const getDocumenByEntryName: (entrypoints: Entrypoint[], entryName: string, fallbackDir?: string) => string | undefined;
4
- export declare const documentPlugin: () => CliPluginFuture<AppTools<'shared'>>;
4
+ export declare const documentPlugin: () => CliPluginFuture<AppTools<"shared">>;
5
5
  export default documentPlugin;
@@ -1,5 +1,5 @@
1
1
  import type { AppNormalizedConfig, AppTools, AppToolsContext } from '@modern-js/app-tools';
2
2
  import type { CLIPluginAPI } from '@modern-js/plugin-v2';
3
3
  import type { Entrypoint } from '@modern-js/types';
4
- export declare const generateCode: (appContext: AppToolsContext<'shared'>, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: CLIPluginAPI<AppTools<'shared'>>) => Promise<void>;
4
+ export declare const generateCode: (appContext: AppToolsContext<"shared">, config: AppNormalizedConfig<"shared">, entrypoints: Entrypoint[], api: CLIPluginAPI<AppTools<"shared">>) => Promise<void>;
5
5
  export declare function generatorRegisterCode(internalDirectory: string, entryName: string, code: string): void;
@@ -6,18 +6,18 @@ export declare const routesForServer: ({ routesForServerLoaderMatches, }: {
6
6
  export declare const fileSystemRoutes: ({ metaName, routes, ssrMode, nestedRoutesEntry, entryName, internalDirectory, splitRouteChunks, }: {
7
7
  metaName: string;
8
8
  routes: RouteLegacy[] | (NestedRouteForCli | PageRoute)[];
9
- ssrMode?: SSRMode | undefined;
10
- nestedRoutesEntry?: string | undefined;
9
+ ssrMode?: SSRMode;
10
+ nestedRoutesEntry?: string;
11
11
  entryName: string;
12
12
  internalDirectory: string;
13
- splitRouteChunks?: boolean | undefined;
13
+ splitRouteChunks?: boolean;
14
14
  }) => Promise<string>;
15
15
  export declare function ssrLoaderCombinedModule(entrypoints: Entrypoint[], entrypoint: Entrypoint, config: AppNormalizedConfig<'shared'>, appContext: AppToolsContext<'shared'>): string | null;
16
16
  export declare const runtimeGlobalContext: ({ entryName, metaName, srcDirectory, nestedRoutesEntry, internalSrcAlias, globalApp, }: {
17
17
  entryName: string;
18
18
  metaName: string;
19
19
  srcDirectory: string;
20
- nestedRoutesEntry?: string | undefined;
20
+ nestedRoutesEntry?: string;
21
21
  internalSrcAlias: string;
22
- globalApp?: string | false | undefined;
22
+ globalApp?: string | false;
23
23
  }) => Promise<string>;
@@ -4,7 +4,7 @@ export declare const replaceWithAlias: (base: string, filePath: string, alias: s
4
4
  export declare const parseModule: ({ source, filename, }: {
5
5
  source: string;
6
6
  filename: string;
7
- }) => Promise<readonly [imports: readonly import("es-module-lexer").ImportSpecifier[], exports: readonly import("es-module-lexer").ExportSpecifier[], facade: boolean]>;
7
+ }) => Promise<readonly [imports: readonly import("es-module-lexer").ImportSpecifier[], exports: readonly import("es-module-lexer").ExportSpecifier[], facade: boolean, hasModuleSyntax: boolean]>;
8
8
  export declare const hasLoader: (filename: string, source?: string) => Promise<boolean>;
9
9
  export declare const hasAction: (filename: string, source?: string) => Promise<boolean>;
10
10
  export declare const getServerLoadersFile: (internalDirectory: string, entryName: string) => string;
@@ -1,5 +1,5 @@
1
1
  import type { AppTools, CliPluginFuture } from '@modern-js/app-tools';
2
2
  export { isRouteEntry } from './entry';
3
3
  export { handleFileChange, handleModifyEntrypoints } from './handler';
4
- export declare const routerPlugin: () => CliPluginFuture<AppTools<'shared'>>;
4
+ export declare const routerPlugin: () => CliPluginFuture<AppTools<"shared">>;
5
5
  export default routerPlugin;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
3
2
  /**
4
3
  * DeferredDataScripts only renders in server side,
@@ -1,7 +1,7 @@
1
1
  import type { RouteObject } from '@modern-js/runtime-utils/router';
2
2
  import type { RuntimeContext } from '../../core';
3
- declare const modifyRoutes: import("@modern-js/plugin-v2/src/types/hooks").SyncHook<(routes: RouteObject[]) => RouteObject[]>;
4
- declare const onBeforeCreateRoutes: import("@modern-js/plugin-v2/src/types/hooks").SyncHook<(context: RuntimeContext) => void>;
3
+ declare const modifyRoutes: import("@modern-js/plugin-v2").SyncHook<(routes: RouteObject[]) => RouteObject[]>;
4
+ declare const onBeforeCreateRoutes: import("@modern-js/plugin-v2").SyncHook<(context: RuntimeContext) => void>;
5
5
  export { modifyRoutes, onBeforeCreateRoutes };
6
6
  export type RouterExtendsHooks = {
7
7
  modifyRoutes: typeof modifyRoutes;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type Module from 'module';
3
2
  import type { ShouldRevalidateFunction } from '@modern-js/runtime-utils/remix-router';
4
3
  export declare const createShouldRevalidate: (routeId: string) => ShouldRevalidateFunction;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { RequestContext } from '@modern-js/runtime-utils/node';
3
2
  import type { Params, RouteObject, RouteProps } from '@modern-js/runtime-utils/router';
4
3
  import type { NestedRoute, PageRoute } from '@modern-js/types';
@@ -7,4 +7,4 @@ export interface WithRouterProps<Params extends {
7
7
  params: Params;
8
8
  navigate: ReturnType<typeof useNavigate>;
9
9
  }
10
- export declare const withRouter: <Props extends WithRouterProps<{}>>(Component: React.ComponentType<Props>) => (props: Omit<Props, keyof WithRouterProps<{}>>) => React.JSX.Element;
10
+ export declare const withRouter: <Props extends WithRouterProps>(Component: React.ComponentType<Props>) => (props: Omit<Props, keyof WithRouterProps>) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import type { AppTools, CliPluginFuture } from '@modern-js/app-tools';
2
- export declare const statePlugin: () => CliPluginFuture<AppTools<'shared'>>;
2
+ export declare const statePlugin: () => CliPluginFuture<AppTools<"shared">>;
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.65.5",
18
+ "version": "2.66.0",
19
19
  "engines": {
20
20
  "node": ">=14.17.6"
21
21
  },
@@ -226,13 +226,13 @@
226
226
  "react-is": "^18",
227
227
  "react-side-effect": "^2.1.1",
228
228
  "styled-components": "^5.3.1",
229
- "@modern-js/render": "2.65.5",
230
- "@modern-js/runtime-utils": "2.65.5",
231
- "@modern-js/plugin-v2": "2.65.5",
232
- "@modern-js/types": "2.65.5",
233
- "@modern-js/plugin": "2.65.5",
234
- "@modern-js/utils": "2.65.5",
235
- "@modern-js/plugin-data-loader": "2.65.5"
229
+ "@modern-js/plugin": "2.66.0",
230
+ "@modern-js/plugin-v2": "2.66.0",
231
+ "@modern-js/plugin-data-loader": "2.66.0",
232
+ "@modern-js/render": "2.66.0",
233
+ "@modern-js/runtime-utils": "2.66.0",
234
+ "@modern-js/types": "2.66.0",
235
+ "@modern-js/utils": "2.66.0"
236
236
  },
237
237
  "peerDependencies": {
238
238
  "react": ">=17",
@@ -256,9 +256,9 @@
256
256
  "ts-node": "^10.9.1",
257
257
  "typescript": "^5",
258
258
  "webpack": "^5.98.0",
259
- "@scripts/build": "2.65.5",
260
- "@scripts/jest-config": "2.65.5",
261
- "@modern-js/app-tools": "2.65.5"
259
+ "@modern-js/app-tools": "2.66.0",
260
+ "@scripts/jest-config": "2.66.0",
261
+ "@scripts/build": "2.66.0"
262
262
  },
263
263
  "sideEffects": false,
264
264
  "publishConfig": {