mirror of https://github.com/alibaba/ice.git
feat: support set router basename (#195)
* feat: basename * chore: remove routeMatch in server render middleware * fix: use webpack-dev-server instead of express * chore: remove resolutions * chore: devDependencies order * refactor: routeModules * chore: lock * fix: types * chore: lock * fix: comment * fix: comment * chore: remove webpack
This commit is contained in:
parent
d1d5912394
commit
51d0ac263a
|
|
@ -7,7 +7,7 @@
|
|||
"description": "A universal framework based on React",
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"setup": " rm -rf node_modules packages/*/node_modules && pnpm install && pnpm run prebundle && pnpm run build",
|
||||
"setup": "rm -rf node_modules packages/*/node_modules && pnpm install && pnpm run prebundle && pnpm run build",
|
||||
"rebuild": "pnpm install && pnpm run build",
|
||||
"watch": "esmo ./scripts/watch.ts",
|
||||
"build": "esmo ./scripts/build.ts",
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
"homepage": "https://next.ice.work",
|
||||
"dependencies": {
|
||||
"@ice/bundles": "^0.1.0",
|
||||
"@ice/types": "^1.0.0",
|
||||
"@ice/runtime": "^1.0.0",
|
||||
"@ice/route-manifest": "^1.0.0",
|
||||
"@ice/runtime": "^1.0.0",
|
||||
"@ice/types": "^1.0.0",
|
||||
"@ice/webpack-config": "^1.0.0",
|
||||
"address": "^1.1.2",
|
||||
"body-parser": "^1.20.0",
|
||||
|
|
@ -47,11 +47,11 @@
|
|||
"find-up": "^5.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"less": "^4.1.2",
|
||||
"open": "^8.4.0",
|
||||
"path-to-regexp": "^6.2.0",
|
||||
"micromatch": "^4.0.5",
|
||||
"mrmime": "^1.0.0",
|
||||
"multer": "^1.4.4",
|
||||
"open": "^8.4.0",
|
||||
"path-to-regexp": "^6.2.0",
|
||||
"prettier": "^2.5.1",
|
||||
"react-router": "^6.3.0",
|
||||
"sass": "^1.49.9",
|
||||
|
|
@ -61,7 +61,6 @@
|
|||
"webpack-dev-server": "^4.7.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"express": "^4.18.0",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/ejs": "^3.1.0",
|
||||
"@types/less": "^3.0.3",
|
||||
|
|
@ -71,8 +70,8 @@
|
|||
"@types/temp": "^0.9.1",
|
||||
"chokidar": "^3.5.3",
|
||||
"react": "^18.0.0",
|
||||
"webpack": "^5.72.0",
|
||||
"unplugin": "^0.3.2"
|
||||
"unplugin": "^0.3.2",
|
||||
"webpack": "^5.72.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18.0.0",
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ const webPlugin: Plugin = ({ registerTask, context, onHook, watch }) => {
|
|||
name: 'document-render-server',
|
||||
middleware: setupRenderServer({
|
||||
serverCompiler,
|
||||
routeManifest,
|
||||
ssg,
|
||||
ssr,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { RequestHandler, Request } from 'express';
|
||||
import type { ExpressRequestHandler, Request } from 'webpack-dev-server';
|
||||
import { pathToRegexp } from 'path-to-regexp';
|
||||
import type { Key } from 'path-to-regexp';
|
||||
import bodyParser from 'body-parser';
|
||||
|
|
@ -7,7 +7,7 @@ import type { MockConfig } from './getConfigs';
|
|||
|
||||
export default function createMiddleware(
|
||||
context: { mockConfigs: MockConfig[] },
|
||||
): RequestHandler {
|
||||
): ExpressRequestHandler {
|
||||
return (req, res, next) => {
|
||||
const matchResult = matchPath(req, context.mockConfigs);
|
||||
if (matchResult) {
|
||||
|
|
@ -51,7 +51,10 @@ export default function createMiddleware(
|
|||
};
|
||||
}
|
||||
|
||||
function matchPath(req: Request, mockConfigs: MockConfig[]): undefined | { keys: Key[]; mockConfig: MockConfig; match: RegExpExecArray } {
|
||||
function matchPath(
|
||||
req: Request,
|
||||
mockConfigs: MockConfig[],
|
||||
): undefined | { keys: Key[]; mockConfig: MockConfig; match: RegExpExecArray } {
|
||||
for (const mockConfig of mockConfigs) {
|
||||
const keys = [];
|
||||
if (req.method.toLocaleUpperCase() === mockConfig.method) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as path from 'path';
|
||||
import type { IncomingMessage } from 'http';
|
||||
import type { Request } from 'webpack-dev-server';
|
||||
import fse from 'fs-extra';
|
||||
import consola from 'consola';
|
||||
import type { ServerContext } from '@ice/runtime';
|
||||
|
|
@ -44,7 +44,7 @@ export default async function generateHTML(options: Options) {
|
|||
};
|
||||
|
||||
const serverContext: ServerContext = {
|
||||
req: req as IncomingMessage,
|
||||
req: req as Request,
|
||||
};
|
||||
|
||||
const documentOnly = !(ssg || ssr);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import * as fs from 'fs';
|
||||
import type { ExpressRequestHandler } from 'webpack-dev-server';
|
||||
import type { ServerContext } from '@ice/runtime';
|
||||
import matchRoutes from '../../../utils/matchRoutes.js';
|
||||
|
||||
interface Options {
|
||||
routeManifest: string;
|
||||
serverCompiler: () => Promise<string>;
|
||||
ssg: boolean;
|
||||
ssr: boolean;
|
||||
|
|
@ -12,23 +10,12 @@ interface Options {
|
|||
|
||||
export function setupRenderServer(options: Options): ExpressRequestHandler {
|
||||
const {
|
||||
routeManifest,
|
||||
serverCompiler,
|
||||
ssg,
|
||||
ssr,
|
||||
} = options;
|
||||
|
||||
return async (req, res, next) => {
|
||||
// Read the latest routes info.
|
||||
const routes = JSON.parse(fs.readFileSync(routeManifest, 'utf8'));
|
||||
|
||||
// If not match pages routes, hand over to webpack dev server for processing
|
||||
let matches = matchRoutes(routes, req.url);
|
||||
if (matches.length === 0) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
return async (req, res) => {
|
||||
const entry = await serverCompiler();
|
||||
|
||||
let serverEntry;
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
import { matchRoutes as originMatchRoutes } from 'react-router';
|
||||
|
||||
const matchRoutes: typeof originMatchRoutes = function (routes, location) {
|
||||
let matches = originMatchRoutes(routes, location);
|
||||
if (!matches) return [];
|
||||
|
||||
return matches.map(({ params, pathname, pathnameBase, route }) => ({
|
||||
params,
|
||||
pathname,
|
||||
route,
|
||||
pathnameBase,
|
||||
}));
|
||||
};
|
||||
|
||||
export default matchRoutes;
|
||||
|
|
@ -4,7 +4,7 @@ import type { Navigator } from 'react-router-dom';
|
|||
import AppErrorBoundary from './AppErrorBoundary.js';
|
||||
import { useAppContext } from './AppContext.js';
|
||||
import { createRouteElements } from './routes.js';
|
||||
import type { RouteWrapperConfig, AppRouterProps } from './types';
|
||||
import type { RouteWrapperConfig, AppRouterProps, RouteModules } from './types';
|
||||
|
||||
interface Props {
|
||||
action: Action;
|
||||
|
|
@ -49,6 +49,7 @@ export default function App(props: Props) {
|
|||
navigator={navigator}
|
||||
static={staticProp}
|
||||
routes={routes}
|
||||
basename={appConfig?.router?.basename}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ import { RouterSingle, useRoutesSingle } from './utils/history-single.js';
|
|||
import type { AppRouterProps } from './types.js';
|
||||
|
||||
const AppRouter: React.ComponentType<AppRouterProps> = (props) => {
|
||||
const { action, location, navigator, static: staticProps, routes } = props;
|
||||
const { action, location, navigator, static: staticProps, routes, basename } = props;
|
||||
const IceRouter = process.env.ICE_CORE_ROUTER === 'true' ? Router : RouterSingle;
|
||||
|
||||
return (
|
||||
<IceRouter
|
||||
basename={basename}
|
||||
navigationType={action}
|
||||
location={location}
|
||||
navigator={navigator}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export function Links() {
|
|||
}
|
||||
|
||||
export function Scripts() {
|
||||
const { routesData, routesConfig, matches, assetsManifest, documentOnly } = useAppContext();
|
||||
const { routesData, routesConfig, matches, assetsManifest, documentOnly, routeModules } = useAppContext();
|
||||
const appData = useAppData();
|
||||
|
||||
const routeScripts = getScripts(matches, routesConfig);
|
||||
|
|
@ -81,6 +81,7 @@ export function Scripts() {
|
|||
assetsManifest,
|
||||
appConfig: {},
|
||||
matchedIds,
|
||||
routeModules,
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -5,33 +5,33 @@ import { matchRoutes as originMatchRoutes } from 'react-router-dom';
|
|||
import { matchRoutesSingle } from './utils/history-single.js';
|
||||
import RouteWrapper from './RouteWrapper.js';
|
||||
import type { RouteItem, RouteModules, RouteWrapperConfig, RouteMatch, RequestContext, RoutesConfig, RoutesData } from './types';
|
||||
|
||||
// global route modules cache
|
||||
const routeModules: RouteModules = {};
|
||||
import { useAppContext } from './AppContext.js';
|
||||
|
||||
type RouteModule = Pick<RouteItem, 'id' | 'load'>;
|
||||
|
||||
export async function loadRouteModule(route: RouteModule) {
|
||||
export async function loadRouteModule(route: RouteModule, routeModulesCache: RouteModules) {
|
||||
const { id, load } = route;
|
||||
if (
|
||||
typeof window !== 'undefined' && // Don't use module cache and should load again in ssr. Ref: https://github.com/ice-lab/ice-next/issues/82
|
||||
id in routeModules
|
||||
id in routeModulesCache
|
||||
) {
|
||||
return routeModules[id];
|
||||
return routeModulesCache[id];
|
||||
}
|
||||
|
||||
try {
|
||||
const routeModule = await load();
|
||||
routeModules[id] = routeModule;
|
||||
routeModulesCache[id] = routeModule;
|
||||
return routeModule;
|
||||
} catch (error) {
|
||||
console.error('loadRouteModule', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadRouteModules(routes: RouteModule[]) {
|
||||
export async function loadRouteModules(routes: RouteModule[], originRouteModules: RouteModules = {}) {
|
||||
const routeModules = { ...originRouteModules };
|
||||
for (const route of routes) {
|
||||
await loadRouteModule(route);
|
||||
const routeModule = await loadRouteModule(route, routeModules);
|
||||
routeModules[route.id] = routeModule;
|
||||
}
|
||||
return routeModules;
|
||||
}
|
||||
|
|
@ -39,7 +39,11 @@ export async function loadRouteModules(routes: RouteModule[]) {
|
|||
/**
|
||||
* get data for the matched routes.
|
||||
*/
|
||||
export async function loadRoutesData(matches: RouteMatch[], requestContext: RequestContext): Promise<RoutesData> {
|
||||
export async function loadRoutesData(
|
||||
matches: RouteMatch[],
|
||||
requestContext: RequestContext,
|
||||
routeModules: RouteModules,
|
||||
): Promise<RoutesData> {
|
||||
const routesData: RoutesData = {};
|
||||
|
||||
const hasGlobalLoader = typeof window !== 'undefined' && (window as any).__ICE_DATA_LOADER__;
|
||||
|
|
@ -75,7 +79,11 @@ export async function loadRoutesData(matches: RouteMatch[], requestContext: Requ
|
|||
/**
|
||||
* Get page config for matched routes.
|
||||
*/
|
||||
export function getRoutesConfig(matches: RouteMatch[], routesData: RoutesData): RoutesConfig {
|
||||
export function getRoutesConfig(
|
||||
matches: RouteMatch[],
|
||||
routesData: RoutesData,
|
||||
routeModules: RouteModules,
|
||||
): RoutesConfig {
|
||||
const routesConfig: RoutesConfig = {};
|
||||
|
||||
matches.forEach(async (match) => {
|
||||
|
|
@ -100,7 +108,10 @@ export function getRoutesConfig(matches: RouteMatch[], routesData: RoutesData):
|
|||
/**
|
||||
* Create elements in routes which will be consumed by react-router-dom
|
||||
*/
|
||||
export function createRouteElements(routes: RouteItem[], RouteWrappers?: RouteWrapperConfig[]) {
|
||||
export function createRouteElements(
|
||||
routes: RouteItem[],
|
||||
RouteWrappers?: RouteWrapperConfig[],
|
||||
) {
|
||||
return routes.map((routeItem: RouteItem) => {
|
||||
let { path, children, index, id, layout, element, ...rest } = routeItem;
|
||||
|
||||
|
|
@ -126,8 +137,9 @@ export function createRouteElements(routes: RouteItem[], RouteWrappers?: RouteWr
|
|||
});
|
||||
}
|
||||
|
||||
function RouteComponent({ id, ...props }: { id: string }) {
|
||||
function RouteComponent({ id }: { id: string }) {
|
||||
// get current route component from latest routeModules
|
||||
const { routeModules } = useAppContext();
|
||||
const { default: Component } = routeModules[id];
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (!Component) {
|
||||
|
|
@ -137,7 +149,7 @@ function RouteComponent({ id, ...props }: { id: string }) {
|
|||
);
|
||||
}
|
||||
}
|
||||
return <Component {...props} />;
|
||||
return <Component />;
|
||||
}
|
||||
|
||||
export function matchRoutes(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { AppContextProvider } from './AppContext.js';
|
|||
import { AppDataProvider, getAppData } from './AppData.js';
|
||||
import type {
|
||||
AppContext, AppEntry, RouteItem, AppRouterProps, RoutesData, RoutesConfig,
|
||||
RouteWrapperConfig, RuntimeModules, RouteMatch, ComponentWithChildren,
|
||||
RouteWrapperConfig, RuntimeModules, RouteMatch, ComponentWithChildren, RouteModules,
|
||||
} from './types';
|
||||
import { loadRouteModules, loadRoutesData, getRoutesConfig, matchRoutes, filterMatchesToLoad } from './routes.js';
|
||||
import { updateRoutesConfig } from './routesConfig.js';
|
||||
|
|
@ -31,9 +31,6 @@ export default async function runClientApp(options: RunClientAppOptions) {
|
|||
Document,
|
||||
} = options;
|
||||
|
||||
const matches = matchRoutes(routes, window.location);
|
||||
await loadRouteModules(matches.map(({ route: { id, load } }) => ({ id, load })));
|
||||
|
||||
const appContextFromServer: AppContext = (window as any).__ICE_APP_CONTEXT__ || {};
|
||||
let { appData, routesData, routesConfig, assetsManifest } = appContextFromServer;
|
||||
|
||||
|
|
@ -42,15 +39,16 @@ export default async function runClientApp(options: RunClientAppOptions) {
|
|||
if (!appData) {
|
||||
appData = await getAppData(app, requestContext);
|
||||
}
|
||||
|
||||
const appConfig = getAppConfig(app, appData);
|
||||
|
||||
if (!routesData) {
|
||||
routesData = await loadRoutesData(matches, requestContext);
|
||||
}
|
||||
const matches = matchRoutes(routes, window.location, appConfig?.router?.basename);
|
||||
const routeModules = await loadRouteModules(matches.map(({ route: { id, load } }) => ({ id, load })));
|
||||
|
||||
if (!routesData) {
|
||||
routesData = await loadRoutesData(matches, requestContext, routeModules);
|
||||
}
|
||||
if (!routesConfig) {
|
||||
routesConfig = getRoutesConfig(matches, routesConfig);
|
||||
routesConfig = getRoutesConfig(matches, routesConfig, routeModules);
|
||||
}
|
||||
|
||||
const appContext: AppContext = {
|
||||
|
|
@ -61,6 +59,7 @@ export default async function runClientApp(options: RunClientAppOptions) {
|
|||
routesConfig,
|
||||
assetsManifest,
|
||||
matches,
|
||||
routeModules,
|
||||
};
|
||||
|
||||
const runtime = new Runtime(appContext);
|
||||
|
|
@ -117,43 +116,64 @@ interface BrowserEntryProps {
|
|||
interface HistoryState {
|
||||
action: Action;
|
||||
location: Location;
|
||||
}
|
||||
|
||||
interface RouteState {
|
||||
routesData: RoutesData;
|
||||
routesConfig: RoutesConfig;
|
||||
matches: RouteMatch[];
|
||||
routeModules: RouteModules;
|
||||
}
|
||||
|
||||
function BrowserEntry({ history, appContext, Document, ...rest }: BrowserEntryProps) {
|
||||
function BrowserEntry({
|
||||
history,
|
||||
appContext,
|
||||
Document,
|
||||
...rest
|
||||
}: BrowserEntryProps) {
|
||||
const {
|
||||
routes, matches: originMatches, routesData: initialRoutesData,
|
||||
routesConfig: initialRoutesConfig, appData,
|
||||
routes,
|
||||
matches: originMatches,
|
||||
routesData: initialRoutesData,
|
||||
routesConfig: initialRoutesConfig,
|
||||
appData,
|
||||
appConfig,
|
||||
routeModules: initialRouteModules,
|
||||
} = appContext;
|
||||
|
||||
const [historyState, setHistoryState] = useState<HistoryState>({
|
||||
action: history.action,
|
||||
location: history.location,
|
||||
});
|
||||
const [routeState, setRouteState] = useState<RouteState>({
|
||||
routesData: initialRoutesData,
|
||||
routesConfig: initialRoutesConfig,
|
||||
matches: originMatches,
|
||||
routeModules: initialRouteModules,
|
||||
});
|
||||
|
||||
const { action, location, routesData, routesConfig, matches } = historyState;
|
||||
const { action, location } = historyState;
|
||||
const { routesData, routesConfig, matches, routeModules } = routeState;
|
||||
|
||||
// listen the history change and update the state which including the latest action and location
|
||||
useLayoutEffect(() => {
|
||||
if (history) {
|
||||
history.listen(({ action, location }) => {
|
||||
const currentMatches = matchRoutes(routes, location);
|
||||
const currentMatches = matchRoutes(routes, location, appConfig?.router?.basename);
|
||||
if (!currentMatches.length) {
|
||||
throw new Error(`Routes not found in location ${location.pathname}.`);
|
||||
}
|
||||
|
||||
loadNextPage(currentMatches, historyState).then(({ routesData, routesConfig }) => {
|
||||
loadNextPage(currentMatches, routeState).then(({ routesData, routesConfig, routeModules }) => {
|
||||
setHistoryState({
|
||||
action,
|
||||
location,
|
||||
});
|
||||
setRouteState({
|
||||
routesData,
|
||||
routesConfig,
|
||||
matches: currentMatches,
|
||||
routeModules,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -167,6 +187,7 @@ function BrowserEntry({ history, appContext, Document, ...rest }: BrowserEntryPr
|
|||
matches,
|
||||
routesData,
|
||||
routesConfig,
|
||||
routeModules,
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
@ -187,18 +208,25 @@ function BrowserEntry({ history, appContext, Document, ...rest }: BrowserEntryPr
|
|||
* Prepare for the next pages.
|
||||
* Load modules、getPageData and preLoad the custom assets.
|
||||
*/
|
||||
async function loadNextPage(currentMatches: RouteMatch[], prevHistoryState: HistoryState) {
|
||||
async function loadNextPage(
|
||||
currentMatches: RouteMatch[],
|
||||
preRouteState: RouteState,
|
||||
) {
|
||||
const {
|
||||
matches: preMatches,
|
||||
routesData: preRoutesData,
|
||||
} = prevHistoryState;
|
||||
routeModules: preRouteModules,
|
||||
} = preRouteState;
|
||||
|
||||
await loadRouteModules(currentMatches.map(({ route: { id, load } }) => ({ id, load })));
|
||||
const routeModules = await loadRouteModules(
|
||||
currentMatches.map(({ route: { id, load } }) => ({ id, load })),
|
||||
preRouteModules,
|
||||
);
|
||||
|
||||
// load data for changed route.
|
||||
const initialContext = getRequestContext(window.location);
|
||||
const matchesToLoad = filterMatchesToLoad(preMatches, currentMatches);
|
||||
const data = await loadRoutesData(matchesToLoad, initialContext);
|
||||
const data = await loadRoutesData(matchesToLoad, initialContext, routeModules);
|
||||
|
||||
const routesData: RoutesData = {};
|
||||
// merge page data.
|
||||
|
|
@ -207,11 +235,12 @@ async function loadNextPage(currentMatches: RouteMatch[], prevHistoryState: Hist
|
|||
routesData[id] = data[id] || preRoutesData[id];
|
||||
});
|
||||
|
||||
const routesConfig = getRoutesConfig(currentMatches, routesData);
|
||||
const routesConfig = getRoutesConfig(currentMatches, routesData, routeModules);
|
||||
await updateRoutesConfig(currentMatches, routesConfig);
|
||||
|
||||
return {
|
||||
routesData,
|
||||
routesConfig,
|
||||
routeModules,
|
||||
};
|
||||
}
|
||||
|
|
@ -17,6 +17,11 @@ import type {
|
|||
AppContext, RouteItem, ServerContext,
|
||||
AppEntry, RuntimePlugin, CommonJsRuntime, AssetsManifest,
|
||||
ComponentWithChildren,
|
||||
RouteMatch,
|
||||
RequestContext,
|
||||
AppData,
|
||||
AppConfig,
|
||||
RouteModules,
|
||||
} from './types';
|
||||
import getRequestContext from './requestContext.js';
|
||||
|
||||
|
|
@ -41,8 +46,8 @@ interface RenderResult {
|
|||
/**
|
||||
* Render and return the result as html string.
|
||||
*/
|
||||
export async function renderToHTML(requestContext: ServerContext, options: RenderOptions): Promise<RenderResult> {
|
||||
const result = await doRender(requestContext, options);
|
||||
export async function renderToHTML(requestContext: ServerContext, renderOptions: RenderOptions): Promise<RenderResult> {
|
||||
const result = await doRender(requestContext, renderOptions);
|
||||
|
||||
const { value } = result;
|
||||
|
||||
|
|
@ -70,9 +75,9 @@ export async function renderToHTML(requestContext: ServerContext, options: Rende
|
|||
/**
|
||||
* Render and send the result to ServerResponse.
|
||||
*/
|
||||
export async function renderToResponse(requestContext: ServerContext, options: RenderOptions) {
|
||||
export async function renderToResponse(requestContext: ServerContext, renderOptions: RenderOptions) {
|
||||
const { res } = requestContext;
|
||||
const result = await doRender(requestContext, options);
|
||||
const result = await doRender(requestContext, renderOptions);
|
||||
|
||||
const { value } = result;
|
||||
|
||||
|
|
@ -107,40 +112,51 @@ async function sendResult(res: ServerResponse, result: RenderResult) {
|
|||
/**
|
||||
* Send stream result to ServerResponse.
|
||||
*/
|
||||
function pipeToResponse(res, pipe: NodeWritablePiper) {
|
||||
function pipeToResponse(res: ServerResponse, pipe: NodeWritablePiper) {
|
||||
return new Promise((resolve, reject) => {
|
||||
pipe(res, (err) => (err ? reject(err) : resolve(null)));
|
||||
});
|
||||
}
|
||||
|
||||
async function doRender(serverContext: ServerContext, options: RenderOptions): Promise<RenderResult> {
|
||||
async function doRender(serverContext: ServerContext, renderOptions: RenderOptions): Promise<RenderResult> {
|
||||
const { req } = serverContext;
|
||||
|
||||
const {
|
||||
routes,
|
||||
documentOnly,
|
||||
} = options;
|
||||
|
||||
const { routes, documentOnly, app } = renderOptions;
|
||||
const location = getLocation(req.url);
|
||||
const matches = matchRoutes(routes, location);
|
||||
|
||||
const requestContext = getRequestContext(location, serverContext);
|
||||
let appData = {};
|
||||
// don't need to execute getAppData in CSR
|
||||
if (!documentOnly) {
|
||||
appData = await getAppData(app, requestContext);
|
||||
}
|
||||
const appConfig = getAppConfig(app, appData);
|
||||
const matches = matchRoutes(routes, location, appConfig?.router?.basename);
|
||||
|
||||
if (!matches.length) {
|
||||
return render404();
|
||||
}
|
||||
|
||||
if (documentOnly) {
|
||||
return renderDocument(matches, options);
|
||||
return renderDocument(matches, renderOptions, {});
|
||||
}
|
||||
|
||||
// FIXME: 原来是在 renderDocument 之前执行这段逻辑。
|
||||
// 现在为了避免 CSR 时把页面组件都加载进来导致资源(比如 css)加载报错,带来的问题是调用 renderHTML 的时候 getConfig 失效了
|
||||
await loadRouteModules(matches.map(({ route: { id, load } }) => ({ id, load })));
|
||||
const routeModules = await loadRouteModules(matches.map(({ route: { id, load } }) => ({ id, load })));
|
||||
|
||||
try {
|
||||
return await renderServerEntry(serverContext, options, matches, location);
|
||||
return await renderServerEntry({
|
||||
requestContext,
|
||||
renderOptions,
|
||||
matches,
|
||||
location,
|
||||
appConfig,
|
||||
appData,
|
||||
routeModules,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Warning: render server entry error, downgrade to csr.', err);
|
||||
return renderDocument(matches, options);
|
||||
return renderDocument(matches, renderOptions, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,32 +171,44 @@ function render404(): RenderResult {
|
|||
/**
|
||||
* Render App by SSR.
|
||||
*/
|
||||
export async function renderServerEntry(
|
||||
serverContext: ServerContext, options: RenderOptions, matches, location,
|
||||
async function renderServerEntry(
|
||||
{
|
||||
requestContext,
|
||||
matches,
|
||||
location,
|
||||
appData,
|
||||
appConfig,
|
||||
renderOptions,
|
||||
routeModules,
|
||||
}: {
|
||||
requestContext: RequestContext;
|
||||
renderOptions: RenderOptions;
|
||||
matches: RouteMatch[];
|
||||
location: Location;
|
||||
appData: AppData;
|
||||
appConfig: AppConfig;
|
||||
routeModules: RouteModules;
|
||||
},
|
||||
): Promise<RenderResult> {
|
||||
const {
|
||||
assetsManifest,
|
||||
app,
|
||||
runtimeModules,
|
||||
routes,
|
||||
Document,
|
||||
} = options;
|
||||
} = renderOptions;
|
||||
|
||||
const requestContext = getRequestContext(location, serverContext);
|
||||
|
||||
const appData = await getAppData(app, requestContext);
|
||||
const appConfig = getAppConfig(app, appData);
|
||||
const routesData = await loadRoutesData(matches, requestContext);
|
||||
const routesConfig = getRoutesConfig(matches, routesData);
|
||||
const routesData = await loadRoutesData(matches, requestContext, routeModules);
|
||||
const routesConfig = getRoutesConfig(matches, routesData, routeModules);
|
||||
|
||||
const appContext: AppContext = {
|
||||
appConfig,
|
||||
assetsManifest,
|
||||
appData,
|
||||
appConfig,
|
||||
routesData,
|
||||
routesConfig,
|
||||
matches,
|
||||
routes,
|
||||
routeModules,
|
||||
};
|
||||
|
||||
const runtime = new Runtime(appContext);
|
||||
|
|
@ -218,10 +246,10 @@ export async function renderServerEntry(
|
|||
</AppContextProvider>
|
||||
);
|
||||
|
||||
const pipe = await renderToNodeStream(element, false);
|
||||
const pipe = renderToNodeStream(element, false);
|
||||
|
||||
const fallback = () => {
|
||||
renderDocument(matches, options);
|
||||
renderDocument(matches, renderOptions, routeModules);
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
@ -235,7 +263,7 @@ export async function renderServerEntry(
|
|||
/**
|
||||
* Render Document for CSR.
|
||||
*/
|
||||
export function renderDocument(matches, options: RenderOptions): RenderResult {
|
||||
function renderDocument(matches: RouteMatch[], options: RenderOptions, routeModules: RouteModules): RenderResult {
|
||||
const {
|
||||
routes,
|
||||
assetsManifest,
|
||||
|
|
@ -247,7 +275,7 @@ export function renderDocument(matches, options: RenderOptions): RenderResult {
|
|||
const appData = null;
|
||||
const routesData = null;
|
||||
const appConfig = getAppConfig(app, appData);
|
||||
const routesConfig = getRoutesConfig(matches, {});
|
||||
const routesConfig = getRoutesConfig(matches, {}, routeModules);
|
||||
|
||||
const appContext: AppContext = {
|
||||
assetsManifest,
|
||||
|
|
@ -258,6 +286,7 @@ export function renderDocument(matches, options: RenderOptions): RenderResult {
|
|||
matches,
|
||||
routes,
|
||||
documentOnly: true,
|
||||
routeModules,
|
||||
};
|
||||
|
||||
const documentContext = {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export type GetConfig = (args: { data: RouteData }) => RouteConfig;
|
|||
export interface AppConfig extends Record<string, any> {
|
||||
app?: App;
|
||||
router?: {
|
||||
type: 'hash' | 'browser';
|
||||
type?: 'hash' | 'browser';
|
||||
basename?: string;
|
||||
};
|
||||
}
|
||||
|
|
@ -63,6 +63,7 @@ export interface AppContext {
|
|||
routesData: RoutesData;
|
||||
routesConfig: RoutesConfig;
|
||||
appData: any;
|
||||
routeModules: RouteModules;
|
||||
matches?: RouteMatch[];
|
||||
routes?: RouteItem[];
|
||||
documentOnly?: boolean;
|
||||
|
|
@ -160,6 +161,7 @@ export interface AppRouterProps {
|
|||
navigator: Navigator;
|
||||
routes: RouteItem[];
|
||||
static?: boolean;
|
||||
basename?: string;
|
||||
}
|
||||
|
||||
export interface AppRouteProps {
|
||||
|
|
|
|||
225
pnpm-lock.yaml
225
pnpm-lock.yaml
|
|
@ -1,4 +1,4 @@
|
|||
lockfileVersion: 5.3
|
||||
lockfileVersion: 5.4
|
||||
|
||||
importers:
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ importers:
|
|||
typescript: ^4.5.5
|
||||
vitest: ^0.9.2
|
||||
devDependencies:
|
||||
'@applint/spec': 1.2.3_04b393dbabf8d680487f0b791513144d
|
||||
'@applint/spec': 1.2.3_aszzhw5l7dliasd7bn4rkeyuju
|
||||
'@commitlint/cli': 16.2.3
|
||||
'@ice/bundles': link:packages/bundles
|
||||
'@types/eslint': 8.4.1
|
||||
|
|
@ -62,7 +62,7 @@ importers:
|
|||
husky: 7.0.4
|
||||
ice-npm-utils: 3.0.2
|
||||
prettier: 2.6.2
|
||||
prettier-plugin-organize-imports: 2.3.4_prettier@2.6.2+typescript@4.6.3
|
||||
prettier-plugin-organize-imports: 2.3.4_xp3cljvn455ahqo6v4wsh6zy64
|
||||
prettier-plugin-packagejson: 2.2.17_prettier@2.6.2
|
||||
puppeteer: 13.6.0
|
||||
react: 18.0.0
|
||||
|
|
@ -228,13 +228,13 @@ importers:
|
|||
cssnano: 5.1.7_postcss@8.4.12
|
||||
es-module-lexer: 0.10.5
|
||||
eslint: 8.14.0
|
||||
eslint-webpack-plugin: 3.1.1_eslint@8.14.0+webpack@5.72.0
|
||||
fork-ts-checker-webpack-plugin: 7.2.6_typescript@4.6.4+webpack@5.72.0
|
||||
eslint-webpack-plugin: 3.1.1_7obbsy7bvh46ulalj3j352unry
|
||||
fork-ts-checker-webpack-plugin: 7.2.6_dgip6vjrhmffcc4ihrseicj6om
|
||||
fs-extra: 10.1.0
|
||||
less-loader: 10.2.0_less@4.1.2+webpack@5.72.0
|
||||
lodash: 4.17.21
|
||||
mini-css-extract-plugin: 2.6.0_webpack@5.72.0
|
||||
postcss-loader: 6.2.1_postcss@8.4.12+webpack@5.72.0
|
||||
postcss-loader: 6.2.1_ophkbroklgd6jdvupnp5h6xq4i
|
||||
postcss-modules: 4.3.1_postcss@8.4.12
|
||||
postcss-nested: 5.0.6_postcss@8.4.12
|
||||
postcss-plugin-rpx2vw: 0.0.3
|
||||
|
|
@ -242,7 +242,7 @@ importers:
|
|||
sass-loader: 12.6.0_sass@1.50.0+webpack@5.72.0
|
||||
tapable: 2.2.1
|
||||
terser: 5.12.1
|
||||
terser-webpack-plugin: 5.3.1_@swc+core@1.2.168+webpack@5.72.0
|
||||
terser-webpack-plugin: 5.3.1_eepmasjpgx7gwhmdtn6pf7sr5m
|
||||
typescript: 4.6.4
|
||||
webpack: 5.72.0_@swc+core@1.2.168
|
||||
webpack-bundle-analyzer: 4.5.0
|
||||
|
|
@ -277,7 +277,6 @@ importers:
|
|||
ejs: ^3.1.6
|
||||
esbuild: ^0.14.23
|
||||
esbuild-register: ^3.3.2
|
||||
express: ^4.18.0
|
||||
fast-glob: ^3.2.11
|
||||
find-up: ^5.0.0
|
||||
fs-extra: ^10.0.0
|
||||
|
|
@ -341,9 +340,8 @@ importers:
|
|||
'@types/sass': 1.43.1
|
||||
'@types/temp': 0.9.1
|
||||
chokidar: 3.5.3
|
||||
express: 4.18.0
|
||||
react: 18.0.0
|
||||
unplugin: 0.3.3_esbuild@0.14.38+webpack@5.72.0
|
||||
unplugin: 0.3.3_7m4vrr5pcg6juvld3psuif5zsi
|
||||
webpack: 5.72.0_esbuild@0.14.38
|
||||
|
||||
packages/plugin-auth:
|
||||
|
|
@ -369,7 +367,7 @@ importers:
|
|||
regenerator-runtime: ^0.13.9
|
||||
dependencies:
|
||||
history: 5.3.0
|
||||
react-router-dom: 6.3.0_react-dom@18.0.0+react@18.0.0
|
||||
react-router-dom: 6.3.0_zpnidt7m3osuk7shl3s4oenomq
|
||||
devDependencies:
|
||||
'@types/react': 18.0.8
|
||||
'@types/react-dom': 18.0.3
|
||||
|
|
@ -398,12 +396,12 @@ importers:
|
|||
build-scripts: 2.0.0-17
|
||||
esbuild: 0.14.38
|
||||
eslint: 8.14.0
|
||||
eslint-webpack-plugin: 3.1.1_eslint@8.14.0+webpack@5.72.0
|
||||
fork-ts-checker-webpack-plugin: 7.2.6_typescript@4.6.4+webpack@5.72.0
|
||||
eslint-webpack-plugin: 3.1.1_7obbsy7bvh46ulalj3j352unry
|
||||
fork-ts-checker-webpack-plugin: 7.2.6_dgip6vjrhmffcc4ihrseicj6om
|
||||
react: 18.0.0
|
||||
terser: 5.12.1
|
||||
typescript: 4.6.4
|
||||
unplugin: 0.3.3_esbuild@0.14.38+webpack@5.72.0
|
||||
unplugin: 0.3.3_7m4vrr5pcg6juvld3psuif5zsi
|
||||
webpack: 5.72.0_esbuild@0.14.38
|
||||
webpack-dev-server: 4.8.1_webpack@5.72.0
|
||||
|
||||
|
|
@ -429,7 +427,7 @@ importers:
|
|||
dependencies:
|
||||
'@builder/swc': 0.1.3
|
||||
'@ice/bundles': link:../bundles
|
||||
'@pmmmwh/react-refresh-webpack-plugin': 0.5.5_71ded90fc5f197eeccab1f0382e7a4aa
|
||||
'@pmmmwh/react-refresh-webpack-plugin': 0.5.5_ohpnsd6f6gl65tfld4byfz5evi
|
||||
'@rollup/pluginutils': 4.2.1
|
||||
browserslist: 4.20.3
|
||||
consola: 2.15.3
|
||||
|
|
@ -461,7 +459,7 @@ packages:
|
|||
conventional-changelog-conventionalcommits: 4.6.3
|
||||
dev: true
|
||||
|
||||
/@applint/eslint-config/1.1.7_d474cfae4223bbaa57e9e20795d97f9c:
|
||||
/@applint/eslint-config/1.1.7_2r2m7lsceo52uv7j4idzlwl7tq:
|
||||
resolution: {integrity: sha512-cyw8zAxgao9gBscoXT8LMyD/oKv3zerg6L6Y9GMaZDt99awdeGObyIDFb7tFxrgYeM3c+TUGrwNMjl8J4qzRiw==}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/eslint-plugin': '>=5.0.0'
|
||||
|
|
@ -472,10 +470,10 @@ packages:
|
|||
eslint-plugin-react: '>=7.26.1'
|
||||
eslint-plugin-react-hooks: '>=4.2.0'
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 5.21.0_829e74f28e9c9eb05edda582d47d45b8
|
||||
'@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.6.3
|
||||
'@typescript-eslint/eslint-plugin': 5.21.0_qkphj4uotsplaxw5uwbni7kfxa
|
||||
'@typescript-eslint/parser': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
eslint: 8.14.0
|
||||
eslint-plugin-import: 2.26.0_eslint@8.14.0
|
||||
eslint-plugin-import: 2.26.0_5yvnzvdwzksrnum37j3gumwy4y
|
||||
eslint-plugin-jsx-a11y: 6.5.1_eslint@8.14.0
|
||||
eslint-plugin-jsx-plus: 0.1.0
|
||||
eslint-plugin-react: 7.29.4_eslint@8.14.0
|
||||
|
|
@ -489,7 +487,7 @@ packages:
|
|||
resolution: {integrity: sha512-E9j36XUQQ61ghAzosPORABOB8GGMtZ/ZRHOBjsQ7Cr4PgU7zhNbClsoaie6wimRSZfOt9OUR/rAPR4u3rY43Hg==}
|
||||
dev: true
|
||||
|
||||
/@applint/spec/1.2.3_04b393dbabf8d680487f0b791513144d:
|
||||
/@applint/spec/1.2.3_aszzhw5l7dliasd7bn4rkeyuju:
|
||||
resolution: {integrity: sha512-6Wx4FHYB71NYywVi7zu1JAkRCGP73bH1mjQIHVhTp0JWenC0bs1210ofjrjwJntuRYMc+JF22XA1YVwbiRmXbw==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
peerDependencies:
|
||||
|
|
@ -497,18 +495,18 @@ packages:
|
|||
stylelint: '>=14.0.0'
|
||||
dependencies:
|
||||
'@applint/commitlint-config': 1.0.2
|
||||
'@applint/eslint-config': 1.1.7_d474cfae4223bbaa57e9e20795d97f9c
|
||||
'@applint/eslint-config': 1.1.7_2r2m7lsceo52uv7j4idzlwl7tq
|
||||
'@applint/prettier-config': 1.0.1
|
||||
'@applint/stylelint-config': 1.0.2_43b4330f7521963bf235751cac3b06fb
|
||||
'@applint/stylelint-config': 1.0.2_io2dgd3vegldx4rvouokyoyg7m
|
||||
'@babel/core': 7.17.9
|
||||
'@babel/eslint-parser': 7.17.0_@babel+core@7.17.9+eslint@8.14.0
|
||||
'@babel/eslint-parser': 7.17.0_emkcycn4rehlrwjob5s3c77k2i
|
||||
'@babel/preset-react': 7.16.7_@babel+core@7.17.9
|
||||
'@typescript-eslint/eslint-plugin': 5.21.0_829e74f28e9c9eb05edda582d47d45b8
|
||||
'@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.6.3
|
||||
'@typescript-eslint/eslint-plugin': 5.21.0_qkphj4uotsplaxw5uwbni7kfxa
|
||||
'@typescript-eslint/parser': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
deepmerge: 4.2.2
|
||||
eslint: 8.14.0
|
||||
eslint-config-ali: 13.1.0_eslint@8.14.0
|
||||
eslint-plugin-import: 2.26.0_eslint@8.14.0
|
||||
eslint-plugin-import: 2.26.0_5yvnzvdwzksrnum37j3gumwy4y
|
||||
eslint-plugin-jsx-a11y: 6.5.1_eslint@8.14.0
|
||||
eslint-plugin-jsx-plus: 0.1.0
|
||||
eslint-plugin-rax-compile-time-miniapp: 1.0.0
|
||||
|
|
@ -523,11 +521,13 @@ packages:
|
|||
stylelint-scss: 4.2.0_stylelint@14.7.1
|
||||
vue-eslint-parser: 8.3.0_eslint@8.14.0
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
- typescript
|
||||
dev: true
|
||||
|
||||
/@applint/stylelint-config/1.0.2_43b4330f7521963bf235751cac3b06fb:
|
||||
/@applint/stylelint-config/1.0.2_io2dgd3vegldx4rvouokyoyg7m:
|
||||
resolution: {integrity: sha512-qJGy/91OIj2YA6mF21UC0O7Ab1TT28fUt4OgZXZ/kdrgvEHek7/2njoN1f4RRNM9Q0R/+fQYjfGc2mrN+M47Kw==}
|
||||
peerDependencies:
|
||||
postcss: '>=8.0.0'
|
||||
|
|
@ -584,7 +584,7 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@babel/eslint-parser/7.17.0_@babel+core@7.17.9+eslint@8.14.0:
|
||||
/@babel/eslint-parser/7.17.0_emkcycn4rehlrwjob5s3c77k2i:
|
||||
resolution: {integrity: sha512-PUEJ7ZBXbRkbq3qqM/jZ2nIuakUBqCYc7Qf52Lj7dlZ6zERnqisdHioL0l4wwQZnmskMeasqUNzLBFKs3nylXA==}
|
||||
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
|
||||
peerDependencies:
|
||||
|
|
@ -725,6 +725,8 @@ packages:
|
|||
resolution: {integrity: sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@babel/types': 7.17.0
|
||||
dev: true
|
||||
|
||||
/@babel/plugin-syntax-jsx/7.16.7_@babel+core@7.17.9:
|
||||
|
|
@ -975,7 +977,7 @@ packages:
|
|||
'@types/node': 17.0.27
|
||||
chalk: 4.1.2
|
||||
cosmiconfig: 7.0.1
|
||||
cosmiconfig-typescript-loader: 1.0.9_237e4226c9260fe57b2f293b24795fca
|
||||
cosmiconfig-typescript-loader: 1.0.9_en7eejwjeyh6k6zpfe5si6k7zi
|
||||
lodash: 4.17.21
|
||||
resolve-from: 5.0.0
|
||||
typescript: 4.6.3
|
||||
|
|
@ -1223,7 +1225,7 @@ packages:
|
|||
'@nodelib/fs.scandir': 2.1.5
|
||||
fastq: 1.13.0
|
||||
|
||||
/@pmmmwh/react-refresh-webpack-plugin/0.5.5_71ded90fc5f197eeccab1f0382e7a4aa:
|
||||
/@pmmmwh/react-refresh-webpack-plugin/0.5.5_ohpnsd6f6gl65tfld4byfz5evi:
|
||||
resolution: {integrity: sha512-RbG7h6TuP6nFFYKJwbcToA1rjC1FyPg25NR2noAZ0vKI+la01KTSRPkuVPE+U88jXv7javx2JHglUcL1MHcshQ==}
|
||||
engines: {node: '>= 10.13'}
|
||||
peerDependencies:
|
||||
|
|
@ -1722,7 +1724,7 @@ packages:
|
|||
dev: true
|
||||
optional: true
|
||||
|
||||
/@typescript-eslint/eslint-plugin/5.21.0_829e74f28e9c9eb05edda582d47d45b8:
|
||||
/@typescript-eslint/eslint-plugin/5.21.0_qkphj4uotsplaxw5uwbni7kfxa:
|
||||
resolution: {integrity: sha512-fTU85q8v5ZLpoZEyn/u1S2qrFOhi33Edo2CZ0+q1gDaWWm0JuPh3bgOyU8lM0edIEYgKLDkPFiZX2MOupgjlyg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
|
|
@ -1733,10 +1735,10 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.6.3
|
||||
'@typescript-eslint/parser': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
'@typescript-eslint/scope-manager': 5.21.0
|
||||
'@typescript-eslint/type-utils': 5.21.0_eslint@8.14.0+typescript@4.6.3
|
||||
'@typescript-eslint/utils': 5.21.0_eslint@8.14.0+typescript@4.6.3
|
||||
'@typescript-eslint/type-utils': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
'@typescript-eslint/utils': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
debug: 4.3.4
|
||||
eslint: 8.14.0
|
||||
functional-red-black-tree: 1.0.1
|
||||
|
|
@ -1749,7 +1751,7 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/parser/5.21.0_eslint@8.14.0+typescript@4.6.3:
|
||||
/@typescript-eslint/parser/5.21.0_5wsz2tb7zzudmaqxfve53vbauu:
|
||||
resolution: {integrity: sha512-8RUwTO77hstXUr3pZoWZbRQUxXcSXafZ8/5gpnQCfXvgmP9gpNlRGlWzvfbEQ14TLjmtU8eGnONkff8U2ui2Eg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
|
|
@ -1777,7 +1779,7 @@ packages:
|
|||
'@typescript-eslint/visitor-keys': 5.21.0
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/type-utils/5.21.0_eslint@8.14.0+typescript@4.6.3:
|
||||
/@typescript-eslint/type-utils/5.21.0_5wsz2tb7zzudmaqxfve53vbauu:
|
||||
resolution: {integrity: sha512-MxmLZj0tkGlkcZCSE17ORaHl8Th3JQwBzyXL/uvC6sNmu128LsgjTX0NIzy+wdH2J7Pd02GN8FaoudJntFvSOw==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
|
|
@ -1787,7 +1789,7 @@ packages:
|
|||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 5.21.0_eslint@8.14.0+typescript@4.6.3
|
||||
'@typescript-eslint/utils': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
debug: 4.3.4
|
||||
eslint: 8.14.0
|
||||
tsutils: 3.21.0_typescript@4.6.3
|
||||
|
|
@ -1822,7 +1824,7 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@typescript-eslint/utils/5.21.0_eslint@8.14.0+typescript@4.6.3:
|
||||
/@typescript-eslint/utils/5.21.0_5wsz2tb7zzudmaqxfve53vbauu:
|
||||
resolution: {integrity: sha512-q/emogbND9wry7zxy7VYri+7ydawo2HDZhRZ5k6yggIvXa7PvBbAAZ4PFH/oZLem72ezC4Pr63rJvDK/sTlL8Q==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
|
|
@ -2338,6 +2340,8 @@ packages:
|
|||
raw-body: 2.5.1
|
||||
type-is: 1.6.18
|
||||
unpipe: 1.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/bonjour-service/1.0.12:
|
||||
resolution: {integrity: sha512-pMmguXYCu63Ug37DluMKEHdxc+aaIf/ay4YbF8Gxtba+9d3u+rmEWy61VK3Z3hp8Rskok3BunHYnG0dUHAsblw==}
|
||||
|
|
@ -2660,6 +2664,8 @@ packages:
|
|||
on-headers: 1.0.2
|
||||
safe-buffer: 5.1.2
|
||||
vary: 1.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
|
||||
|
|
@ -2766,7 +2772,7 @@ packages:
|
|||
/core-util-is/1.0.3:
|
||||
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
|
||||
|
||||
/cosmiconfig-typescript-loader/1.0.9_237e4226c9260fe57b2f293b24795fca:
|
||||
/cosmiconfig-typescript-loader/1.0.9_en7eejwjeyh6k6zpfe5si6k7zi:
|
||||
resolution: {integrity: sha512-tRuMRhxN4m1Y8hP9SNYfz7jRwt8lZdWxdjg/ohg5esKmsndJIn4yT96oJVcf5x0eA11taXl+sIp+ielu529k6g==}
|
||||
engines: {node: '>=12', npm: '>=6'}
|
||||
peerDependencies:
|
||||
|
|
@ -2775,7 +2781,7 @@ packages:
|
|||
dependencies:
|
||||
'@types/node': 17.0.27
|
||||
cosmiconfig: 7.0.1
|
||||
ts-node: 10.7.0_237e4226c9260fe57b2f293b24795fca
|
||||
ts-node: 10.7.0_en7eejwjeyh6k6zpfe5si6k7zi
|
||||
typescript: 4.6.3
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
|
|
@ -3022,11 +3028,21 @@ packages:
|
|||
|
||||
/debug/2.6.9:
|
||||
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.0.0
|
||||
|
||||
/debug/3.2.7:
|
||||
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
|
|
@ -3152,6 +3168,8 @@ packages:
|
|||
dependencies:
|
||||
address: 1.1.2
|
||||
debug: 2.6.9
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/detective/5.2.0:
|
||||
|
|
@ -3619,29 +3637,54 @@ packages:
|
|||
dependencies:
|
||||
debug: 3.2.7
|
||||
resolve: 1.22.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-module-utils/2.7.3:
|
||||
/eslint-module-utils/2.7.3_siwxndurugrzrndocd3gqxwhna:
|
||||
resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint-import-resolver-node: '*'
|
||||
eslint-import-resolver-typescript: '*'
|
||||
eslint-import-resolver-webpack: '*'
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
eslint-import-resolver-node:
|
||||
optional: true
|
||||
eslint-import-resolver-typescript:
|
||||
optional: true
|
||||
eslint-import-resolver-webpack:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
debug: 3.2.7
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
find-up: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.26.0_eslint@8.14.0:
|
||||
/eslint-plugin-import/2.26.0_5yvnzvdwzksrnum37j3gumwy4y:
|
||||
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.21.0_5wsz2tb7zzudmaqxfve53vbauu
|
||||
array-includes: 3.1.4
|
||||
array.prototype.flat: 1.3.0
|
||||
debug: 2.6.9
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.14.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-module-utils: 2.7.3
|
||||
eslint-module-utils: 2.7.3_siwxndurugrzrndocd3gqxwhna
|
||||
has: 1.0.3
|
||||
is-core-module: 2.9.0
|
||||
is-glob: 4.0.3
|
||||
|
|
@ -3649,6 +3692,10 @@ packages:
|
|||
object.values: 1.1.5
|
||||
resolve: 1.22.0
|
||||
tsconfig-paths: 3.14.1
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-jsx-a11y/6.5.1_eslint@8.14.0:
|
||||
|
|
@ -3772,7 +3819,7 @@ packages:
|
|||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dev: true
|
||||
|
||||
/eslint-webpack-plugin/3.1.1_eslint@8.14.0+webpack@5.72.0:
|
||||
/eslint-webpack-plugin/3.1.1_7obbsy7bvh46ulalj3j352unry:
|
||||
resolution: {integrity: sha512-xSucskTN9tOkfW7so4EaiFIkulWLXwCB/15H917lR6pTv0Zot6/fetFucmENRb7J5whVSFKIvwnrnsa78SG2yg==}
|
||||
engines: {node: '>= 12.13.0'}
|
||||
peerDependencies:
|
||||
|
|
@ -3940,8 +3987,8 @@ packages:
|
|||
clone-regexp: 2.2.0
|
||||
dev: true
|
||||
|
||||
/express/4.18.0:
|
||||
resolution: {integrity: sha512-EJEXxiTQJS3lIPrU1AE2vRuT7X7E+0KBbpm5GSoK524yl0K8X+er8zS2P14E64eqsVNoWbMCT7MpmQ+ErAhgRg==}
|
||||
/express/4.18.1:
|
||||
resolution: {integrity: sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==}
|
||||
engines: {node: '>= 0.10.0'}
|
||||
dependencies:
|
||||
accepts: 1.3.8
|
||||
|
|
@ -3975,6 +4022,8 @@ packages:
|
|||
type-is: 1.6.18
|
||||
utils-merge: 1.0.1
|
||||
vary: 1.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/external-editor/3.1.0:
|
||||
resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==}
|
||||
|
|
@ -4077,6 +4126,8 @@ packages:
|
|||
parseurl: 1.3.3
|
||||
statuses: 2.0.1
|
||||
unpipe: 1.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/find-up/2.1.0:
|
||||
resolution: {integrity: sha1-RdG35QbHF93UgndaK3eSCjwMV6c=}
|
||||
|
|
@ -4140,7 +4191,7 @@ packages:
|
|||
signal-exit: 3.0.7
|
||||
dev: true
|
||||
|
||||
/fork-ts-checker-webpack-plugin/7.2.6_typescript@4.6.4+webpack@5.72.0:
|
||||
/fork-ts-checker-webpack-plugin/7.2.6_dgip6vjrhmffcc4ihrseicj6om:
|
||||
resolution: {integrity: sha512-q5rdvy7CaqEWyK3ly/AjSMQ+e3DGkjuqP0pkTwJcg+PHLhQfTJXqkmRIeA2y0TPfX4U00Et+AxS2ObAsVcm0hQ==}
|
||||
engines: {node: '>=12.13.0', yarn: '>=1.0.0'}
|
||||
peerDependencies:
|
||||
|
|
@ -5167,6 +5218,8 @@ packages:
|
|||
mime: 1.6.0
|
||||
needle: 2.9.1
|
||||
source-map: 0.6.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/levn/0.4.1:
|
||||
|
|
@ -5562,6 +5615,8 @@ packages:
|
|||
debug: 3.2.7
|
||||
iconv-lite: 0.4.24
|
||||
sax: 1.2.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
|
|
@ -5959,6 +6014,8 @@ packages:
|
|||
async: 2.6.4
|
||||
debug: 3.2.7
|
||||
mkdirp: 0.5.6
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/postcss-attribute-case-insensitive/5.0.0_postcss@8.4.12:
|
||||
resolution: {integrity: sha512-b4g9eagFGq9T5SWX4+USfVyjIb3liPnjhHHRMP7FMB2kFVpYyfEscV0wP3eaXhKlcHKUut8lt5BGoeylWA/dBQ==}
|
||||
|
|
@ -6213,7 +6270,7 @@ packages:
|
|||
postcss: 8.4.12
|
||||
dev: true
|
||||
|
||||
/postcss-loader/6.2.1_postcss@8.4.12+webpack@5.72.0:
|
||||
/postcss-loader/6.2.1_ophkbroklgd6jdvupnp5h6xq4i:
|
||||
resolution: {integrity: sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==}
|
||||
engines: {node: '>= 12.13.0'}
|
||||
peerDependencies:
|
||||
|
|
@ -6710,7 +6767,7 @@ packages:
|
|||
engines: {node: '>= 0.8.0'}
|
||||
dev: true
|
||||
|
||||
/prettier-plugin-organize-imports/2.3.4_prettier@2.6.2+typescript@4.6.3:
|
||||
/prettier-plugin-organize-imports/2.3.4_xp3cljvn455ahqo6v4wsh6zy64:
|
||||
resolution: {integrity: sha512-R8o23sf5iVL/U71h9SFUdhdOEPsi3nm42FD/oDYIZ2PQa4TNWWuWecxln6jlIQzpZTDMUeO1NicJP6lLn2TtRw==}
|
||||
peerDependencies:
|
||||
prettier: '>=2.0'
|
||||
|
|
@ -6862,7 +6919,7 @@ packages:
|
|||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/react-router-dom/6.3.0_react-dom@18.0.0+react@18.0.0:
|
||||
/react-router-dom/6.3.0_zpnidt7m3osuk7shl3s4oenomq:
|
||||
resolution: {integrity: sha512-uaJj7LKytRxZNQV8+RbzJWnJ8K2nPsOOEuX7aQstlMZKQT0164C+X2w6bnkqU3sjtLvpd5ojrezAyfZ1+0sStw==}
|
||||
peerDependencies:
|
||||
react: '>=16.8'
|
||||
|
|
@ -7236,6 +7293,8 @@ packages:
|
|||
on-finished: 2.4.1
|
||||
range-parser: 1.2.1
|
||||
statuses: 2.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/serialize-javascript/6.0.0:
|
||||
resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==}
|
||||
|
|
@ -7254,6 +7313,8 @@ packages:
|
|||
http-errors: 1.6.3
|
||||
mime-types: 2.1.35
|
||||
parseurl: 1.3.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/serve-static/1.15.0:
|
||||
resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==}
|
||||
|
|
@ -7263,6 +7324,8 @@ packages:
|
|||
escape-html: 1.0.3
|
||||
parseurl: 1.3.3
|
||||
send: 0.18.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/set-blocking/2.0.0:
|
||||
resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=}
|
||||
|
|
@ -7741,32 +7804,7 @@ packages:
|
|||
rimraf: 2.6.3
|
||||
dev: false
|
||||
|
||||
/terser-webpack-plugin/5.3.1_@swc+core@1.2.168+webpack@5.72.0:
|
||||
resolution: {integrity: sha512-GvlZdT6wPQKbDNW/GDQzZFg/j4vKU96yl2q6mcUkzKOgW4gwf1Z8cZToUCrz31XHlPWH8MVb1r2tFtdDtTGJ7g==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
peerDependencies:
|
||||
'@swc/core': '*'
|
||||
esbuild: '*'
|
||||
uglify-js: '*'
|
||||
webpack: ^5.1.0
|
||||
peerDependenciesMeta:
|
||||
'@swc/core':
|
||||
optional: true
|
||||
esbuild:
|
||||
optional: true
|
||||
uglify-js:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@swc/core': 1.2.168
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 3.1.1
|
||||
serialize-javascript: 6.0.0
|
||||
source-map: 0.6.1
|
||||
terser: 5.12.1
|
||||
webpack: 5.72.0_@swc+core@1.2.168
|
||||
dev: true
|
||||
|
||||
/terser-webpack-plugin/5.3.1_esbuild@0.14.38+webpack@5.72.0:
|
||||
/terser-webpack-plugin/5.3.1_7m4vrr5pcg6juvld3psuif5zsi:
|
||||
resolution: {integrity: sha512-GvlZdT6wPQKbDNW/GDQzZFg/j4vKU96yl2q6mcUkzKOgW4gwf1Z8cZToUCrz31XHlPWH8MVb1r2tFtdDtTGJ7g==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
peerDependencies:
|
||||
|
|
@ -7791,6 +7829,31 @@ packages:
|
|||
webpack: 5.72.0_esbuild@0.14.38
|
||||
dev: true
|
||||
|
||||
/terser-webpack-plugin/5.3.1_eepmasjpgx7gwhmdtn6pf7sr5m:
|
||||
resolution: {integrity: sha512-GvlZdT6wPQKbDNW/GDQzZFg/j4vKU96yl2q6mcUkzKOgW4gwf1Z8cZToUCrz31XHlPWH8MVb1r2tFtdDtTGJ7g==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
peerDependencies:
|
||||
'@swc/core': '*'
|
||||
esbuild: '*'
|
||||
uglify-js: '*'
|
||||
webpack: ^5.1.0
|
||||
peerDependenciesMeta:
|
||||
'@swc/core':
|
||||
optional: true
|
||||
esbuild:
|
||||
optional: true
|
||||
uglify-js:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@swc/core': 1.2.168
|
||||
jest-worker: 27.5.1
|
||||
schema-utils: 3.1.1
|
||||
serialize-javascript: 6.0.0
|
||||
source-map: 0.6.1
|
||||
terser: 5.12.1
|
||||
webpack: 5.72.0_@swc+core@1.2.168
|
||||
dev: true
|
||||
|
||||
/terser-webpack-plugin/5.3.1_webpack@5.72.0:
|
||||
resolution: {integrity: sha512-GvlZdT6wPQKbDNW/GDQzZFg/j4vKU96yl2q6mcUkzKOgW4gwf1Z8cZToUCrz31XHlPWH8MVb1r2tFtdDtTGJ7g==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
|
|
@ -7922,7 +7985,7 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
/ts-node/10.7.0_237e4226c9260fe57b2f293b24795fca:
|
||||
/ts-node/10.7.0_en7eejwjeyh6k6zpfe5si6k7zi:
|
||||
resolution: {integrity: sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
|
|
@ -8071,7 +8134,7 @@ packages:
|
|||
resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
/unplugin/0.3.3_esbuild@0.14.38+webpack@5.72.0:
|
||||
/unplugin/0.3.3_7m4vrr5pcg6juvld3psuif5zsi:
|
||||
resolution: {integrity: sha512-WjZWpUqqcYPQ/efR00Zm2m1+J1LitwoZ4uhHV4VdZ+IpW0Nh/qnDYtVf+nLhozXdGxslMPecOshVR7NiWFl4gA==}
|
||||
peerDependencies:
|
||||
esbuild: '>=0.13'
|
||||
|
|
@ -8321,7 +8384,7 @@ packages:
|
|||
compression: 1.7.4
|
||||
connect-history-api-fallback: 1.6.0
|
||||
default-gateway: 6.0.3
|
||||
express: 4.18.0
|
||||
express: 4.18.1
|
||||
graceful-fs: 4.2.10
|
||||
html-entities: 2.3.3
|
||||
http-proxy-middleware: 2.0.6_@types+express@4.17.13
|
||||
|
|
@ -8423,7 +8486,7 @@ packages:
|
|||
neo-async: 2.6.2
|
||||
schema-utils: 3.1.1
|
||||
tapable: 2.2.1
|
||||
terser-webpack-plugin: 5.3.1_@swc+core@1.2.168+webpack@5.72.0
|
||||
terser-webpack-plugin: 5.3.1_eepmasjpgx7gwhmdtn6pf7sr5m
|
||||
watchpack: 2.3.1
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
|
|
@ -8463,7 +8526,7 @@ packages:
|
|||
neo-async: 2.6.2
|
||||
schema-utils: 3.1.1
|
||||
tapable: 2.2.1
|
||||
terser-webpack-plugin: 5.3.1_esbuild@0.14.38+webpack@5.72.0
|
||||
terser-webpack-plugin: 5.3.1_7m4vrr5pcg6juvld3psuif5zsi
|
||||
watchpack: 2.3.1
|
||||
webpack-sources: 3.2.3
|
||||
transitivePeerDependencies:
|
||||
|
|
|
|||
Loading…
Reference in New Issue