@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.
- package/dist/cjs/cli/code.js +1 -1
- package/dist/cjs/cli/index.js +11 -14
- package/dist/cjs/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
- package/dist/cjs/cli/ssr/index.js +14 -1
- package/dist/cjs/cli/template.js +1 -1
- package/dist/cjs/core/browser/hydrate.js +1 -1
- package/dist/cjs/core/browser/index.js +36 -17
- package/dist/cjs/core/compatible.js +4 -4
- package/dist/cjs/core/context/runtime.js +1 -1
- package/dist/cjs/core/loader/loaderManager.js +1 -1
- package/dist/cjs/core/loader/useLoader.js +1 -1
- package/dist/cjs/core/server/react/prerender/index.js +1 -1
- package/dist/cjs/core/server/requestHandler.js +14 -6
- package/dist/cjs/core/server/stream/afterTemplate.js +1 -1
- package/dist/cjs/core/server/stream/beforeTemplate.js +3 -3
- package/dist/cjs/core/server/stream/createReadableStream.js +2 -2
- package/dist/cjs/core/server/stream/createReadableStream.worker.js +2 -2
- package/dist/cjs/core/server/stream/shared.js +1 -1
- package/dist/cjs/core/server/stream/template.js +1 -1
- package/dist/cjs/core/server/string/index.js +29 -29
- package/dist/cjs/core/server/string/prefetch.js +5 -5
- package/dist/cjs/core/server/string/ssrData.js +1 -1
- package/dist/cjs/document/Body.js +1 -1
- package/dist/cjs/document/Head.js +1 -1
- package/dist/cjs/document/Root.js +1 -1
- package/dist/cjs/document/cli/index.js +2 -2
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutes.js +1 -1
- package/dist/cjs/router/cli/code/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/cjs/router/cli/code/index.js +6 -6
- package/dist/cjs/router/cli/code/templates.js +15 -8
- package/dist/cjs/router/cli/code/utils.js +1 -1
- package/dist/cjs/router/cli/handler.js +2 -2
- package/dist/cjs/router/runtime/DeferredDataScripts.node.js +2 -2
- package/dist/cjs/router/runtime/PrefetchLink.js +1 -1
- package/dist/cjs/router/runtime/plugin.js +4 -4
- package/dist/cjs/router/runtime/plugin.node.js +6 -6
- package/dist/cjs/router/runtime/utils.js +2 -2
- package/dist/cjs/state/plugins.js +1 -1
- package/dist/cjs/state/runtime/plugin.js +6 -6
- package/dist/esm/cli/code.js +3 -4
- package/dist/esm/cli/index.js +7 -10
- package/dist/esm/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
- package/dist/esm/cli/ssr/index.js +16 -1
- package/dist/esm/cli/template.js +1 -1
- package/dist/esm/core/browser/hydrate.js +1 -1
- package/dist/esm/core/browser/index.js +33 -14
- package/dist/esm/core/browser/withCallback.js +1 -1
- package/dist/esm/core/compatible.js +4 -4
- package/dist/esm/core/context/runtime.js +1 -1
- package/dist/esm/core/loader/loaderManager.js +3 -1
- package/dist/esm/core/loader/useLoader.js +1 -1
- package/dist/esm/core/plugin/base.js +1 -1
- package/dist/esm/core/plugin/index.js +1 -1
- package/dist/esm/core/server/react/prerender/index.js +2 -2
- package/dist/esm/core/server/requestHandler.js +13 -6
- package/dist/esm/core/server/stream/afterTemplate.js +1 -1
- package/dist/esm/core/server/stream/beforeTemplate.js +3 -3
- package/dist/esm/core/server/stream/createReadableStream.js +2 -2
- package/dist/esm/core/server/stream/createReadableStream.worker.js +2 -2
- package/dist/esm/core/server/stream/shared.js +1 -1
- package/dist/esm/core/server/stream/template.js +1 -1
- package/dist/esm/core/server/string/index.js +12 -15
- package/dist/esm/core/server/string/prefetch.js +2 -2
- package/dist/esm/core/server/string/ssrData.js +1 -1
- package/dist/esm/document/Body.js +1 -1
- package/dist/esm/document/Comment.js +1 -1
- package/dist/esm/document/Head.js +1 -1
- package/dist/esm/document/Root.js +1 -1
- package/dist/esm/document/Script.js +1 -1
- package/dist/esm/document/Style.js +1 -1
- package/dist/esm/document/cli/index.js +3 -3
- package/dist/esm/router/cli/code/getClientRoutes/getRoutes.js +2 -2
- package/dist/esm/router/cli/code/getClientRoutes/getRoutesLegacy.js +2 -2
- package/dist/esm/router/cli/code/getClientRoutes/utils.js +2 -2
- package/dist/esm/router/cli/code/index.js +4 -4
- package/dist/esm/router/cli/code/nestedRoutes.js +1 -1
- package/dist/esm/router/cli/code/templates.js +2 -2
- package/dist/esm/router/cli/code/utils.js +2 -2
- package/dist/esm/router/cli/entry.js +1 -1
- package/dist/esm/router/cli/handler.js +2 -2
- package/dist/esm/router/cli/index.js +1 -1
- package/dist/esm/router/runtime/DeferredDataScripts.node.js +2 -2
- package/dist/esm/router/runtime/PrefetchLink.js +1 -1
- package/dist/esm/router/runtime/plugin.js +4 -4
- package/dist/esm/router/runtime/plugin.node.js +6 -6
- package/dist/esm/router/runtime/utils.js +2 -2
- package/dist/esm/state/plugins.js +1 -1
- package/dist/esm/state/runtime/plugin.js +4 -4
- package/dist/esm-node/cli/code.js +3 -3
- package/dist/esm-node/cli/index.js +7 -10
- package/dist/esm-node/cli/ssr/babel-plugin-ssr-loader-id.js +1 -1
- package/dist/esm-node/cli/ssr/index.js +14 -1
- package/dist/esm-node/cli/template.js +1 -1
- package/dist/esm-node/core/browser/hydrate.js +1 -1
- package/dist/esm-node/core/browser/index.js +36 -17
- package/dist/esm-node/core/browser/withCallback.js +1 -1
- package/dist/esm-node/core/compatible.js +4 -4
- package/dist/esm-node/core/context/runtime.js +1 -1
- package/dist/esm-node/core/loader/loaderManager.js +1 -1
- package/dist/esm-node/core/loader/useLoader.js +1 -1
- package/dist/esm-node/core/plugin/base.js +1 -1
- package/dist/esm-node/core/plugin/index.js +1 -1
- package/dist/esm-node/core/server/react/prerender/index.js +2 -2
- package/dist/esm-node/core/server/requestHandler.js +13 -5
- package/dist/esm-node/core/server/stream/afterTemplate.js +1 -1
- package/dist/esm-node/core/server/stream/beforeTemplate.js +3 -3
- package/dist/esm-node/core/server/stream/createReadableStream.js +2 -2
- package/dist/esm-node/core/server/stream/createReadableStream.worker.js +2 -2
- package/dist/esm-node/core/server/stream/shared.js +1 -1
- package/dist/esm-node/core/server/stream/template.js +1 -1
- package/dist/esm-node/core/server/string/index.js +21 -21
- package/dist/esm-node/core/server/string/prefetch.js +2 -2
- package/dist/esm-node/core/server/string/ssrData.js +1 -1
- package/dist/esm-node/document/Body.js +1 -1
- package/dist/esm-node/document/Comment.js +1 -1
- package/dist/esm-node/document/Head.js +1 -1
- package/dist/esm-node/document/Root.js +1 -1
- package/dist/esm-node/document/Script.js +1 -1
- package/dist/esm-node/document/Style.js +1 -1
- package/dist/esm-node/document/cli/index.js +3 -3
- package/dist/esm-node/router/cli/code/getClientRoutes/getRoutes.js +2 -2
- package/dist/esm-node/router/cli/code/getClientRoutes/getRoutesLegacy.js +2 -2
- package/dist/esm-node/router/cli/code/getClientRoutes/utils.js +2 -2
- package/dist/esm-node/router/cli/code/index.js +4 -4
- package/dist/esm-node/router/cli/code/nestedRoutes.js +1 -1
- package/dist/esm-node/router/cli/code/templates.js +16 -9
- package/dist/esm-node/router/cli/code/utils.js +2 -2
- package/dist/esm-node/router/cli/entry.js +1 -1
- package/dist/esm-node/router/cli/handler.js +2 -2
- package/dist/esm-node/router/cli/index.js +1 -1
- package/dist/esm-node/router/runtime/DeferredDataScripts.node.js +2 -2
- package/dist/esm-node/router/runtime/PrefetchLink.js +1 -1
- package/dist/esm-node/router/runtime/plugin.js +4 -4
- package/dist/esm-node/router/runtime/plugin.node.js +6 -6
- package/dist/esm-node/router/runtime/utils.js +2 -2
- package/dist/esm-node/state/plugins.js +1 -1
- package/dist/esm-node/state/runtime/plugin.js +4 -4
- package/dist/types/cli/alias.d.ts +1 -1
- package/dist/types/cli/code.d.ts +1 -1
- package/dist/types/cli/index.d.ts +3 -3
- package/dist/types/cli/ssr/index.d.ts +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/core/browser/hydrate.d.ts +3 -3
- package/dist/types/core/browser/index.d.ts +1 -1
- package/dist/types/core/browser/withCallback.d.ts +1 -1
- package/dist/types/core/compatible.d.ts +3 -3
- package/dist/types/core/config.d.ts +1 -1
- package/dist/types/core/context/index.d.ts +1 -1
- package/dist/types/core/context/runtime.d.ts +5 -5
- package/dist/types/core/loader/loaderManager.d.ts +2 -2
- package/dist/types/core/plugin/base.d.ts +2 -2
- package/dist/types/core/plugin/index.d.ts +1 -1
- package/dist/types/core/plugin/runner.d.ts +1 -1
- package/dist/types/core/react/index.d.ts +1 -1
- package/dist/types/core/react/wrapper.d.ts +1 -1
- package/dist/types/core/server/helmet.d.ts +1 -1
- package/dist/types/core/server/index.d.ts +1 -1
- package/dist/types/core/server/react/nossr/index.d.ts +1 -1
- package/dist/types/core/server/react/prerender/util.d.ts +1 -1
- package/dist/types/core/server/requestHandler.d.ts +3 -3
- package/dist/types/core/server/stream/afterTemplate.d.ts +4 -4
- package/dist/types/core/server/stream/beforeTemplate.d.ts +2 -2
- package/dist/types/core/server/stream/createReadableStream.d.ts +1 -1
- package/dist/types/core/server/stream/createReadableStream.worker.d.ts +1 -1
- package/dist/types/core/server/stream/shared.d.ts +3 -3
- package/dist/types/core/server/stream/template.d.ts +1 -1
- package/dist/types/core/server/string/index.d.ts +1 -1
- package/dist/types/core/server/string/loadable.d.ts +2 -2
- package/dist/types/core/server/string/prefetch.d.ts +5 -5
- package/dist/types/core/server/string/ssrData.d.ts +4 -4
- package/dist/types/core/server/string/styledComponent.d.ts +1 -1
- package/dist/types/core/server/string/types.d.ts +2 -2
- package/dist/types/core/server/utils.d.ts +3 -3
- package/dist/types/core/types.d.ts +2 -2
- package/dist/types/document/DocumentStructureContext.d.ts +1 -1
- package/dist/types/document/cli/index.d.ts +2 -2
- package/dist/types/exports/server.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/router/cli/code/index.d.ts +2 -2
- package/dist/types/router/cli/code/templates.d.ts +1 -1
- package/dist/types/router/cli/entry.d.ts +1 -1
- package/dist/types/router/cli/handler.d.ts +3 -3
- package/dist/types/router/cli/index.d.ts +1 -1
- package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +1 -1
- package/dist/types/router/runtime/PrefetchLink.d.ts +1 -1
- package/dist/types/router/runtime/hooks.d.ts +1 -1
- package/dist/types/router/runtime/index.d.ts +1 -1
- package/dist/types/router/runtime/plugin.d.ts +1 -1
- package/dist/types/router/runtime/routeModule.d.ts +1 -1
- package/dist/types/router/runtime/types.d.ts +2 -2
- package/dist/types/router/runtime/utils.d.ts +4 -4
- package/dist/types/router/runtime/withRouter.d.ts +1 -1
- package/dist/types/state/cli/index.d.ts +1 -1
- package/package.json +13 -12
- package/types/index.d.ts +1 -1
- package/types/router.d.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
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 };
|
package/dist/types/common.d.ts
CHANGED
package/dist/types/config.d.ts
CHANGED
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Renderer } from 'react-dom';
|
|
3
|
-
import type {
|
|
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,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
|
|
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 {
|
|
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
|
|
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 { 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 { 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 {
|
|
2
|
-
import {
|
|
3
|
-
import { HandleRequestConfig } from '../requestHandler';
|
|
4
|
-
import {
|
|
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 {
|
|
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 {
|
|
5
|
-
import {
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 { 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 {
|
|
2
|
-
import {
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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 {
|
|
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 {
|
|
2
|
-
import { PluginAPI } from '@modern-js/core';
|
|
3
|
-
import {
|
|
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 {
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { useRouteLoaderData as useRouteData } from '@modern-js/runtime-utils/router';
|
|
2
2
|
import { routerPlugin } from './plugin';
|
|
3
|
-
import type {
|
|
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,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
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
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;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.58.
|
|
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.
|
|
203
|
-
"@modern-js/plugin-data-loader": "2.58.
|
|
204
|
-
"@modern-js/types": "2.58.
|
|
205
|
-
"@modern-js/utils": "2.58.
|
|
206
|
-
"@modern-js/
|
|
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.
|
|
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.
|
|
230
|
-
"@
|
|
231
|
-
"@scripts/build": "2.58.
|
|
232
|
-
"@
|
|
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
package/types/router.d.ts
CHANGED