@modern-js/runtime 2.58.2 → 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/index.js +11 -14
- package/dist/cjs/cli/ssr/babel-plugin-ssr-loader-id.js +1 -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 +2 -2
- package/dist/cjs/core/compatible.js +4 -4
- package/dist/cjs/core/context/runtime.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 +8 -3
- 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 +18 -18
- 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 +1 -1
- 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/template.js +1 -1
- package/dist/esm/core/browser/hydrate.js +1 -1
- package/dist/esm/core/browser/index.js +2 -2
- 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/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 +8 -4
- 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 +8 -8
- 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 +1 -1
- 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/template.js +1 -1
- package/dist/esm-node/core/browser/hydrate.js +1 -1
- package/dist/esm-node/core/browser/index.js +2 -2
- 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/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 +8 -3
- 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 +8 -8
- 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/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/compatible.d.ts +1 -1
- package/dist/types/core/context/runtime.d.ts +2 -2
- package/dist/types/core/plugin/index.d.ts +1 -1
- package/dist/types/core/server/stream/afterTemplate.d.ts +2 -2
- package/dist/types/core/server/stream/template.d.ts +1 -1
- package/dist/types/core/server/string/loadable.d.ts +1 -1
- package/dist/types/core/server/string/prefetch.d.ts +1 -1
- package/dist/types/core/server/string/ssrData.d.ts +2 -2
- package/dist/types/core/server/string/styledComponent.d.ts +1 -1
- package/dist/types/core/server/utils.d.ts +1 -1
- package/dist/types/core/types.d.ts +1 -1
- package/dist/types/document/cli/index.d.ts +1 -1
- package/dist/types/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 +1 -1
- package/dist/types/router/cli/handler.d.ts +2 -2
- package/dist/types/router/cli/index.d.ts +1 -1
- package/dist/types/router/runtime/PrefetchLink.d.ts +1 -1
- package/dist/types/router/runtime/index.d.ts +1 -1
- package/dist/types/router/runtime/types.d.ts +2 -2
- package/dist/types/router/runtime/utils.d.ts +2 -2
- package/dist/types/router/runtime/withRouter.d.ts +1 -1
- package/dist/types/state/cli/index.d.ts +1 -1
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { findExists, formatImportPath,
|
|
2
|
+
import { fs, findExists, formatImportPath, getEntryOptions, isSSGEntry, slash } from "@modern-js/utils";
|
|
3
3
|
import { ROUTE_MODULES } from "@modern-js/utils/universal/constants";
|
|
4
4
|
import { APP_CONFIG_NAME, APP_INIT_EXPORTED, TEMP_LOADERS_DIR } from "../constants";
|
|
5
5
|
import { getPathWithoutExt, getServerLoadersFile, parseModule, replaceWithAlias } from "./utils";
|
|
@@ -332,14 +332,21 @@ function ssrLoaderCombinedModule(entrypoints, entrypoint, config, appContext) {
|
|
|
332
332
|
if (!config.source.enableAsyncEntry) {
|
|
333
333
|
return combinedModule;
|
|
334
334
|
}
|
|
335
|
-
return `
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
335
|
+
return `
|
|
336
|
+
async function loadModules() {
|
|
337
|
+
const [moduleA, moduleB] = await Promise.all([
|
|
338
|
+
import("${slash(serverLoaderRuntime)}"),
|
|
339
|
+
import("${slash(serverLoadersFile)}")
|
|
340
|
+
]);
|
|
341
|
+
|
|
342
|
+
return {
|
|
343
|
+
...moduleA,
|
|
344
|
+
...moduleB
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export { loadModules };
|
|
349
|
+
`;
|
|
343
350
|
}
|
|
344
351
|
return null;
|
|
345
352
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import { transform } from "esbuild";
|
|
3
|
+
import { JS_EXTENSIONS, fs as fse, normalizeToPosixPath } from "@modern-js/utils";
|
|
5
4
|
import { parse } from "es-module-lexer";
|
|
5
|
+
import { transform } from "esbuild";
|
|
6
6
|
import { ACTION_EXPORT_NAME, LOADER_EXPORT_NAME } from "../constants";
|
|
7
7
|
const walkDirectory = (dir) => fs.readdirSync(dir).reduce((previous, filename) => {
|
|
8
8
|
const filePath = path.join(dir, filename);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { JS_EXTENSIONS, findExists,
|
|
2
|
+
import { fs, JS_EXTENSIONS, findExists, isRouterV5 } from "@modern-js/utils";
|
|
3
3
|
import { hasApp } from "../../cli/entry";
|
|
4
4
|
import { FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT, NESTED_ROUTES_DIR, PAGES_DIR_NAME } from "./constants";
|
|
5
5
|
const hasPages = (dir) => fs.existsSync(path.join(dir, PAGES_DIR_NAME));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
3
|
-
import { modifyEntrypoints } from "./entry";
|
|
4
|
-
import { isPageComponentFile } from "./code/utils";
|
|
5
3
|
import * as templates from "./code/templates";
|
|
4
|
+
import { isPageComponentFile } from "./code/utils";
|
|
5
|
+
import { modifyEntrypoints } from "./entry";
|
|
6
6
|
let originEntrypoints = [];
|
|
7
7
|
async function handleModifyEntrypoints(api, entrypoints) {
|
|
8
8
|
const config = api.useResolvedConfigContext();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { createRuntimeExportsUtils, filterRoutesForServer,
|
|
2
|
+
import { fs, NESTED_ROUTE_SPEC_FILE, createRuntimeExportsUtils, filterRoutesForServer, getEntryOptions, isRouterV5 as isV5 } from "@modern-js/utils";
|
|
3
3
|
import { isRouteEntry } from "./entry";
|
|
4
4
|
import { handleFileChange, handleGeneratorEntryCode, handleModifyEntrypoints } from "./handler";
|
|
5
5
|
import { isRouteEntry as isRouteEntry2 } from "./entry";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense, useEffect, useRef, useMemo } from "react";
|
|
3
|
-
import { Await, useAsyncError } from "@modern-js/runtime-utils/router";
|
|
4
2
|
import { serializeJson } from "@modern-js/runtime-utils/node";
|
|
3
|
+
import { Await, useAsyncError } from "@modern-js/runtime-utils/router";
|
|
4
|
+
import { Suspense, useEffect, useMemo, useRef } from "react";
|
|
5
5
|
import { serializeErrors } from "./utils";
|
|
6
6
|
const setupFnStr = `function s(r,e){_ROUTER_DATA.r=_ROUTER_DATA.r||{},_ROUTER_DATA.r[r]=_ROUTER_DATA.r[r]||{};return new Promise((function(A,R){_ROUTER_DATA.r[r][e]={resolve:A,reject:R}}))};`;
|
|
7
7
|
const resolveFnStr = `function r(e,r,o,A){A?_ROUTER_DATA.r[e][r].reject(A):_ROUTER_DATA.r[e][r].resolve(o)};`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Link as RouterLink, NavLink as RouterNavLink, matchRoutes, useHref, useMatches, useResolvedPath } from "@modern-js/runtime-utils/router";
|
|
2
3
|
import React, { useContext, useMemo } from "react";
|
|
3
|
-
import { Link as RouterLink, matchRoutes, useResolvedPath, useHref, useMatches, NavLink as RouterNavLink } from "@modern-js/runtime-utils/router";
|
|
4
4
|
import { RuntimeReactContext } from "../../core";
|
|
5
5
|
function composeEventHandlers(theirHandler, ourHandler) {
|
|
6
6
|
return (event) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useMemo } from "react";
|
|
3
|
-
import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements, useMatches, useLocation, useHref } from "@modern-js/runtime-utils/router";
|
|
4
|
-
import { parsedJSONFromElement } from "@modern-js/runtime-utils/parsed";
|
|
5
2
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
6
|
-
import {
|
|
3
|
+
import { parsedJSONFromElement } from "@modern-js/runtime-utils/parsed";
|
|
4
|
+
import { RouterProvider, createBrowserRouter, createHashRouter, createRoutesFromElements, useHref, useLocation, useMatches } from "@modern-js/runtime-utils/router";
|
|
5
|
+
import { useContext, useMemo } from "react";
|
|
7
6
|
import { RuntimeReactContext } from "../../core";
|
|
7
|
+
import { getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
8
8
|
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
9
9
|
import { deserializeErrors, renderRoutes, urlJoin } from "./utils";
|
|
10
10
|
let finalRouteConfig = {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { merge } from "@modern-js/runtime-utils/merge";
|
|
3
|
+
import { createRequestContext, reporterCtx } from "@modern-js/runtime-utils/node";
|
|
4
|
+
import { StaticRouterProvider, createStaticRouter } from "@modern-js/runtime-utils/node/router";
|
|
3
5
|
import { createStaticHandler } from "@modern-js/runtime-utils/remix-router";
|
|
4
|
-
import { createStaticRouter, StaticRouterProvider } from "@modern-js/runtime-utils/node/router";
|
|
5
6
|
import { createRoutesFromElements } from "@modern-js/runtime-utils/router";
|
|
6
|
-
import { reporterCtx, createRequestContext } from "@modern-js/runtime-utils/node";
|
|
7
7
|
import { time } from "@modern-js/runtime-utils/time";
|
|
8
8
|
import { LOADER_REPORTER_NAME } from "@modern-js/utils/universal/constants";
|
|
9
|
-
import {
|
|
9
|
+
import { useContext } from "react";
|
|
10
10
|
import { JSX_SHELL_STREAM_END_MARK } from "../../common";
|
|
11
11
|
import { RuntimeReactContext } from "../../core";
|
|
12
12
|
import { getGlobalLayoutApp, getGlobalRoutes } from "../../core/context";
|
|
13
|
-
import { renderRoutes, urlJoin } from "./utils";
|
|
14
|
-
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
15
13
|
import DeferredDataScripts from "./DeferredDataScripts.node";
|
|
14
|
+
import { modifyRoutes as modifyRoutesHook } from "./hooks";
|
|
15
|
+
import { renderRoutes, urlJoin } from "./utils";
|
|
16
16
|
function createRemixReuqest(request) {
|
|
17
17
|
const method = "GET";
|
|
18
18
|
const { headers } = request;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Route, isRouteErrorResponse } from "@modern-js/runtime-utils/router";
|
|
3
|
-
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@modern-js/runtime-utils/remix-router";
|
|
4
2
|
import { renderNestedRoute } from "@modern-js/runtime-utils/browser";
|
|
3
|
+
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@modern-js/runtime-utils/remix-router";
|
|
4
|
+
import { Route, isRouteErrorResponse } from "@modern-js/runtime-utils/router";
|
|
5
5
|
import { DefaultNotFound } from "./DefaultNotFound";
|
|
6
6
|
import DeferredDataScripts from "./DeferredDataScripts";
|
|
7
7
|
function getRouteComponents(routes, { globalApp, ssrMode, props, reporter }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { plugin as effectsPlugin } from "@modern-js-reduck/plugin-effects";
|
|
2
1
|
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
|
2
|
+
import { plugin as effectsPlugin } from "@modern-js-reduck/plugin-effects";
|
|
3
3
|
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
|
4
4
|
import { default as default2 } from "@modern-js-reduck/plugin-devtools";
|
|
5
5
|
const effects = () => effectsPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import { createStore } from "@modern-js-reduck/store";
|
|
4
2
|
import { Provider } from "@modern-js-reduck/react";
|
|
3
|
+
import { createStore } from "@modern-js-reduck/store";
|
|
5
4
|
import { merge } from "@modern-js/runtime-utils/merge";
|
|
6
|
-
import {
|
|
7
|
-
import { RuntimeReactContext } from "../../core";
|
|
5
|
+
import { useContext } from "react";
|
|
8
6
|
import { isBrowser } from "../../common";
|
|
7
|
+
import { RuntimeReactContext } from "../../core";
|
|
8
|
+
import { autoActions, devtools, effects, immer } from "../plugins";
|
|
9
9
|
const StatePluginHandleMap = {
|
|
10
10
|
immer,
|
|
11
11
|
effects,
|
package/dist/types/cli/code.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppTools, IAppContext, NormalizedConfig, RuntimePlugin } from '@modern-js/app-tools';
|
|
2
|
-
import type { Entrypoint } from '@modern-js/types';
|
|
3
2
|
import type { MaybeAsync } from '@modern-js/plugin';
|
|
3
|
+
import type { Entrypoint } from '@modern-js/types';
|
|
4
4
|
export declare const generateCode: (entrypoints: Entrypoint[], appContext: IAppContext, config: NormalizedConfig<AppTools>, onCollectRuntimePlugins: (params: {
|
|
5
5
|
entrypoint: Entrypoint;
|
|
6
6
|
plugins: RuntimePlugin[];
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Renderer } from 'react-dom';
|
|
3
|
-
import type {
|
|
3
|
+
import type { createRoot, hydrateRoot } from 'react-dom/client';
|
|
4
4
|
import { type RuntimeContext, type TRuntimeContext } from './context/runtime';
|
|
5
5
|
import { type Plugin, type runtime } from './plugin';
|
|
6
6
|
export type CreateAppOptions = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Store } from '@modern-js-reduck/store';
|
|
3
|
-
import type {
|
|
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
6
|
import type { PluginRunner, runtime } from '../plugin';
|
|
6
|
-
import type { RouteManifest } from '../../router/runtime/types';
|
|
7
7
|
import type { SSRServerContext } from '../types';
|
|
8
8
|
export interface BaseRuntimeContext {
|
|
9
9
|
initialData?: Record<string, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type SSRConfig } from '../shared';
|
|
2
1
|
import type { RenderLevel } from '../../constants';
|
|
3
|
-
import type { HandleRequestConfig } from '../requestHandler';
|
|
4
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 { 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,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { LoaderResult } from '../../loader/loaderManager';
|
|
3
3
|
import type { HandleRequestOptions } from '../requestHandler';
|
|
4
|
-
import { type Tracer } from '../tracer';
|
|
5
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
1
|
import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
2
|
-
import type { SSRConfig } from '../shared';
|
|
3
2
|
import type { SSRServerContext } from '../../types';
|
|
4
|
-
import type {
|
|
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 { ServerStyleSheet } from 'styled-components';
|
|
2
1
|
import type { ReactElement } from 'react';
|
|
2
|
+
import { ServerStyleSheet } from 'styled-components';
|
|
3
3
|
import type { ChunkSet, Collector } from './types';
|
|
4
4
|
export declare class StyledCollector implements Collector {
|
|
5
5
|
#private;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
2
1
|
import type { ServerUserConfig } from '@modern-js/app-tools';
|
|
2
|
+
import { type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
3
3
|
import type { SSRConfig } from './shared';
|
|
4
4
|
export declare function attributesToString(attributes: Record<string, any>): string;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseSSRServerContext } from '@modern-js/types';
|
|
2
|
-
import type { LoaderResult } from './loader/loaderManager';
|
|
3
2
|
import type { RenderLevel } from './constants';
|
|
3
|
+
import type { LoaderResult } from './loader/loaderManager';
|
|
4
4
|
declare global {
|
|
5
5
|
interface Window {
|
|
6
6
|
_SSR_DATA?: SSRContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppTools, CliPlugin } 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
4
|
export declare const documentPlugin: () => CliPlugin<AppTools>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StateConfig } from './state';
|
|
2
1
|
import type { RouterConfig } from './router';
|
|
2
|
+
import type { StateConfig } from './state';
|
|
3
3
|
export type { Plugin } from './core';
|
|
4
4
|
export type { AppConfig, RuntimeConfig } from './common';
|
|
5
5
|
export { isBrowser } from './common';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AppNormalizedConfig, AppTools } from '@modern-js/app-tools';
|
|
1
2
|
import type { IAppContext, PluginAPI } from '@modern-js/core';
|
|
2
3
|
import type { Entrypoint } from '@modern-js/types';
|
|
3
|
-
import type { 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,6 +1,6 @@
|
|
|
1
|
-
import type { Entrypoint } from '@modern-js/types';
|
|
2
|
-
import type { PluginAPI } from '@modern-js/core';
|
|
3
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
|
-
import React from 'react';
|
|
2
1
|
import { type LinkProps as RouterLinkProps, type NavLinkProps as RouterNavLinkProps } from '@modern-js/runtime-utils/router';
|
|
2
|
+
import React from 'react';
|
|
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,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { RouteProps, RouteObject, Params } from '@modern-js/runtime-utils/router';
|
|
3
|
-
import type { 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,6 +1,6 @@
|
|
|
1
|
+
import { type Router, type StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
2
|
+
import type { NestedRoute, PageRoute, Reporter, SSRMode } from '@modern-js/types';
|
|
1
3
|
import type React from 'react';
|
|
2
|
-
import type { Reporter, NestedRoute, PageRoute, SSRMode } from '@modern-js/types';
|
|
3
|
-
import { type StaticHandlerContext, type Router } from '@modern-js/runtime-utils/remix-router';
|
|
4
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>;
|
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/
|
|
205
|
-
"@modern-js/
|
|
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",
|
|
@@ -226,10 +226,10 @@
|
|
|
226
226
|
"ts-jest": "^29.1.0",
|
|
227
227
|
"typescript": "^5",
|
|
228
228
|
"webpack": "^5.93.0",
|
|
229
|
-
"@modern-js/
|
|
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": {
|