@modern-js/runtime 2.65.4 → 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.
- package/dist/types/cli/code.d.ts +1 -1
- package/dist/types/cli/index.d.ts +2 -2
- package/dist/types/cli/ssr/index.d.ts +1 -1
- package/dist/types/cli/template.d.ts +8 -8
- package/dist/types/common.d.ts +2 -2
- package/dist/types/core/compat/requestContext.d.ts +4 -7
- package/dist/types/core/context/index.d.ts +0 -1
- package/dist/types/core/context/monitors/index.server.d.ts +1 -1
- package/dist/types/core/context/runtime.d.ts +0 -1
- package/dist/types/core/loader/useLoader.d.ts +2 -2
- package/dist/types/core/plugin/base.d.ts +0 -1
- package/dist/types/core/server/shared.d.ts +0 -1
- package/dist/types/core/server/utils.d.ts +9 -1
- package/dist/types/document/Script.d.ts +0 -1
- package/dist/types/document/Title.d.ts +0 -1
- package/dist/types/document/cli/index.d.ts +1 -1
- package/dist/types/router/cli/code/index.d.ts +1 -1
- package/dist/types/router/cli/code/templates.d.ts +5 -5
- package/dist/types/router/cli/code/utils.d.ts +1 -1
- package/dist/types/router/cli/index.d.ts +1 -1
- package/dist/types/router/runtime/DeferredDataScripts.node.d.ts +0 -1
- package/dist/types/router/runtime/hooks.d.ts +2 -2
- package/dist/types/router/runtime/routeModule.d.ts +0 -1
- package/dist/types/router/runtime/types.d.ts +0 -1
- package/dist/types/router/runtime/withRouter.d.ts +1 -1
- package/dist/types/state/cli/index.d.ts +1 -1
- package/package.json +13 -14
package/dist/types/cli/code.d.ts
CHANGED
|
@@ -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<
|
|
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<
|
|
10
|
-
}) => CliPluginFuture<AppTools<
|
|
9
|
+
plugins?: CliPluginFuture<AppTools<"shared">>[];
|
|
10
|
+
}) => CliPluginFuture<AppTools<"shared">>;
|
|
11
11
|
export default runtimePlugin;
|
|
@@ -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
|
|
6
|
-
mountId?: string
|
|
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
|
|
15
|
-
customBootstrap?: string | false
|
|
16
|
-
mountId?: string
|
|
17
|
-
enableRsc?: boolean
|
|
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
|
|
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
|
|
46
|
+
customEntry?: boolean;
|
|
47
47
|
}) => string;
|
package/dist/types/common.d.ts
CHANGED
|
@@ -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
|
|
17
|
-
userAgent?: string
|
|
18
|
-
cookie?: string
|
|
19
|
-
cookieMap?: Record<string, string
|
|
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,2 +1,2 @@
|
|
|
1
1
|
import type { Monitors } from '@modern-js/types';
|
|
2
|
-
export declare const getMonitors: () => Omit<Monitors,
|
|
2
|
+
export declare const getMonitors: () => Omit<Monitors, "push">;
|
|
@@ -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
|
|
30
|
-
reload: (params?: Params
|
|
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';
|
|
@@ -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']):
|
|
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,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<
|
|
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<
|
|
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
|
|
10
|
-
nestedRoutesEntry?: string
|
|
9
|
+
ssrMode?: SSRMode;
|
|
10
|
+
nestedRoutesEntry?: string;
|
|
11
11
|
entryName: string;
|
|
12
12
|
internalDirectory: string;
|
|
13
|
-
splitRouteChunks?: boolean
|
|
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
|
|
20
|
+
nestedRoutesEntry?: string;
|
|
21
21
|
internalSrcAlias: string;
|
|
22
|
-
globalApp?: string | false
|
|
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<
|
|
4
|
+
export declare const routerPlugin: () => CliPluginFuture<AppTools<"shared">>;
|
|
5
5
|
export default routerPlugin;
|
|
@@ -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
|
|
4
|
-
declare const onBeforeCreateRoutes: import("@modern-js/plugin-v2
|
|
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;
|
|
@@ -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
|
|
10
|
+
export declare const withRouter: <Props extends WithRouterProps>(Component: React.ComponentType<Props>) => (props: Omit<Props, keyof WithRouterProps>) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
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/plugin": "2.
|
|
230
|
-
"@modern-js/plugin-
|
|
231
|
-
"@modern-js/plugin-
|
|
232
|
-
"@modern-js/render": "2.
|
|
233
|
-
"@modern-js/runtime-utils": "2.
|
|
234
|
-
"@modern-js/types": "2.
|
|
235
|
-
"@modern-js/utils": "2.
|
|
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",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
},
|
|
241
241
|
"devDependencies": {
|
|
242
242
|
"@remix-run/web-fetch": "^4.1.3",
|
|
243
|
-
"@rsbuild/core": "1.2.
|
|
243
|
+
"@rsbuild/core": "1.2.19",
|
|
244
244
|
"@testing-library/react": "^13.4.0",
|
|
245
245
|
"@types/cookie": "0.6.0",
|
|
246
246
|
"@types/invariant": "^2.2.30",
|
|
@@ -256,15 +256,14 @@
|
|
|
256
256
|
"ts-node": "^10.9.1",
|
|
257
257
|
"typescript": "^5",
|
|
258
258
|
"webpack": "^5.98.0",
|
|
259
|
-
"@modern-js/app-tools": "2.
|
|
260
|
-
"@scripts/
|
|
261
|
-
"@scripts/
|
|
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": {
|
|
265
265
|
"registry": "https://registry.npmjs.org/",
|
|
266
|
-
"access": "public"
|
|
267
|
-
"provenance": true
|
|
266
|
+
"access": "public"
|
|
268
267
|
},
|
|
269
268
|
"scripts": {
|
|
270
269
|
"dev": "modern-lib build --watch",
|