index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/server/_category_.json
{ "label": "server/", "position": 3 }
7,100
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/server/index_.mdx
--- title: index.[tj]s sidebar_position: 1 --- # index.[tj]s A file that extends the Modern.js Web Server. You can add [Hooks](/apis/app/runtime/web-server/hook) or [Middleware](/apis/app/runtime/web-server/middleware) to the Web Server started by the application project in this file. You can intercept and process r...
7,101
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/server/test.mdx
--- title: test.[tj]s sidebar_position: 2 --- # test.[tj]s Custom Web Server test directory. The application supports testing custom Web Server. You can directly create files with the suffix `.test.[tj]s` under the `server/` directory of the project to write test cases. :::info Enabling unit testing and integration...
7,102
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/_category_.json
{ "label": "src/", "position": 1 }
7,103
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/app.mdx
--- title: App.[tj]sx sidebar_position: 1 --- # App.[tj]sx The identifier for the entry points when the application uses [Self-controlled Routing](/guides/basic-features/routes.html#self-controlled-routing). `App.[tj]sx` is not the actual entry. Modern.js will generate the real entry for application. The content is r...
7,104
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/index_.mdx
--- title: index.[tj]s sidebar_position: 4 --- # index.[tj]s The identifier for the entry point when the application uses custom `bootstrap`. In general, the [`App.[tj]sx`](/apis/app/hooks/src/app) hook file can already meet our needs. When we need to add custom behavior before `bootstrap` or completely take over the...
7,105
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/pages.mdx
--- title: pages/ sidebar_position: 3 --- # pages/ The identifier for the entry point when the application uses the [`Pages` entry](https://modernjs.dev/v1/docs/guides/usages/entries#pages-%E5%85%A5%E5%8F%A3) type. :::info Compatible with Modern.js 1.0 `Pages` entry. It is recommended to use [conventional routing](gu...
7,106
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/routes.mdx
--- title: routes/ sidebar_position: 2 --- # routes/ The identifier for the entry point when the application uses [Conventional Routing](guides/basic-features/routes.html#conventional-routing). Conventional routing uses `routes/` as the convention for the entry point and analyzes the files in the `src/routes` directo...
7,107
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/server.mdx
--- title: '*.[server|node].[tj]sx' sidebar_position: 8 --- # *.[server|node].[tj]sx Used in the application project to place server-side code. When `*.tsx` and `*.[server|node].tsx` coexist, SSR will prefer to use the `*.[server|node].tsx` file instead of the `*.tsx` file when rendering on the server.
7,108
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/stories.mdx
--- title: '**/*.stories.[tj]sx' sidebar_position: 7 --- # **/*.stories.[tj]sx Application project Storybook files. You can create files in the `*.stories.(js|jsx|ts|tsx|mdx)` format in the project source code directory `src/` as Storybook files. Run the `npm run dev story` command in the project to use these files ...
7,109
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/hooks/src/test.mdx
--- title: '**/*.test.[tj]sx?' sidebar_position: 6 --- # **/*.test.[tj]sx? Application project test files. The application project supports creating files with the suffix `.test.[tj]sx?` in the project source code directory (`src`) to write test cases. :::info To use unit testing and integration testing, you need t...
7,110
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/_category_.json
{ "label": "runtime", "position": 3, "collapsed": false }
7,111
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/app/_category_.json
{ "label": "APP API", "position": 4 }
7,112
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/app/define-config.mdx
--- title: defineConfig --- # defineConfig For dynamically configuring applications runtime features. ## Usage ```ts import { defineConfig } from '@modern-js/runtime'; ``` Runtime configurations can usually be configured under the `runtime` of the `modern.config.js`, such as the [router](/configure/app/runtime/rout...
7,113
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/bff/_category_.json
{ "label": "BFF API", "position": 8 }
7,114
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/bff/hook.mdx
--- title: hook --- # hook Used to add framework middleware under BFF function mode, the middleware will execute before BFF function. ## Usage according to the framework extend plugin, export from the corresponding namespace: ```ts import { hook } from '@modern-js/runtime/{namespace}'; ``` ## Function Signature `...
7,115
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/bff/use-context.mdx
--- title: useContext --- # useContext Used to get the request context in the BFF function. ## Usage according to the framework extend plugin, export from the corresponding namespace: ```ts import { useContext } from '@modern-js/runtime/{namespace}'; ``` ## Function Signature `function useContext(): any` ## Exam...
7,116
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/core/_category_.json
{ "label": "Core API", "sidebar-labale": "111", "position": 3 }
7,117
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/core/bootstrap.mdx
--- title: bootstrap --- # bootstrap Used to start and mount App, usually not manually called. This API is only required when using [Custom Bootstrap](/guides/concept/entries#custom-bootstrap). ## Usage ```ts import ReactDOM from 'react-dom/client'; import { bootstrap } from '@modern-js/runtime'; bootstrap(App, 'ro...
7,118
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/core/create-app.mdx
--- title: createApp --- # createApp Used to create custom entries, custom runtime plugins. This API is only required when using [Custom App](/guides/concept/entries#app). ## Usage ```ts import { createApp } from '@modern-js/runtime'; ``` ## Function Signature ```ts import type { Plugin } from '@modern-js/runtime'...
7,119
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/core/use-loader.mdx
--- title: useLoader --- # useLoader `useLoader` is an Isomorphic API, usually used to make asynchronous requests. During Server-Side Rendering (SSR), the server uses `useLoader` to prefetch the data, which is then reused on the client side. :::tip The `useLoader` API is currently not supported when using Rspack as t...
7,120
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/core/use-module-apps.mdx
--- title: useModuleApps --- # useModuleApps Returns the React components of all micro-front-end sub-applications, allowing for flexible control over routing. ## Usage ```tsx import { useModuleApps } from '@modern-js/plugin-garfish/runtime'; ``` ## Function Signature `function useModuleApps(): Record<string, React...
7,121
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/core/use-runtime-context.mdx
--- title: useRuntimeContext --- # useRuntimeContext Used to get the runtime context and can only be used in function components. ## Usage ```tsx import { useRuntimeContext } from '@modern-js/runtime'; export function App() { const runtimeContext = useRuntimeContext(); return <div>Hello World</div>; } ``` ## F...
7,122
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/Provider.mdx
--- sidebar_position: 8 title: Provider --- # Provider import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> `Provider` is a component that injects Reduck's Store into the application's component tree, making the Model accessible to components inside the component tree. Normally, `Provider` is de...
7,123
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/_category_.json
{ "label": "Model API", "position": 6 }
7,124
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/auto-actions.mdx
--- sidebar_position: 6 title: Auto actions --- # Auto actions import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> Reduck can automatically generate Actions according to the type of State, for easy to modify State. :::tip can use [`runtime.state.autoActions`](/configure/app/runtime/state#autoa...
7,125
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/connect.mdx
--- sidebar_position: 5 title: connect --- # connect import ReduckTip from '@site-docs-en/components/reduck-tip'; <ReduckTip /> :::tip The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see [**connect**](https://github.com/web-infra-de...
7,126
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/create-app.mdx
--- sidebar_position: 11 title: createApp --- # createApp import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> Reduck will call `createApp` to create a global application by default. If the entire application only needs one Store, then there is no need to call `createApp` manually.Only need to u...
7,127
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/create-store.mdx
--- sidebar_position: 10 title: createStore --- # createStore import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> `createStore` is used to create a Store. Reduck’s Store based on Redux's [Store](https://redux.js.org/api/store) implementatio. Used to store the state of the application and managi...
7,128
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/handle-effect.mdx
--- sidebar_position: 7 title: handleEffect --- # handleEffect import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> An asynchronous function type Effect usually has three states that need to be processed: in request, request successful, and request failed. The way to handle these states is to wr...
7,129
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/model_.mdx
--- sidebar_position: 1 title: model --- # model import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> :::tip The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see [**model**](https://github.com/web-infra-dev/reduck...
7,130
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/use-local-model.mdx
--- sidebar_position: 4 title: useLocalModel --- # useLocalModel import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> To use the State in the Model as a local state, the effect is similar to React's `useState`. `useLocalModel` API same as `useModel`. For detail, see [`useModel`](./use-model.mdx)...
7,131
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/use-model.mdx
--- sidebar_position: 2 title: useModel --- # useModel import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> :::tip The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see [**model**](https://github.com/web-infra-dev/...
7,132
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/use-static-model.mdx
--- sidebar_position: 3 title: useStaticModel --- # useStaticModel import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> If want to consume a Model in the form of React Hook in the component, and can get the current latest state at any time, but you don't want the Model state to be updated, which...
7,133
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/model/use-store.mdx
--- sidebar_position: 9 title: useStore --- # useStore import ReduckTip from "@site-docs-en/components/reduck-tip" <ReduckTip /> `useStore` Used to get the store shared by the current component tree. ## Function Signature ```ts function useStore(): ReduckStore; ``` ### Return Type - ReduckStore: Reduck Store, ty...
7,134
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/router/_category_.json
{ "label": "Router API", "position": 5 }
7,135
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/router/router.mdx
--- title: router sidebar_position: 1 --- # router :::info The router solution based on [react-router 6](https://reactrouter.com/). ::: ## hooks ### useNavigate ```ts declare function useNavigate(): NavigateFunction; interface NavigateFunction { ( to: To, options?: { replace?: boolean; stat...
7,136
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/ssr/_category_.json
{ "label": "SSR API", "position": 7 }
7,137
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/ssr/no-ssr.mdx
--- title: NoSSR --- # NoSSR The content wrapped by NoSSR will not be rendered at the server, nor will it be rendered during the client side hydrate. it will only be rendered immediately after the entire app is rendered. ## Usage ```tsx import { NoSSR } from '@modern-js/runtime/ssr'; export default () => <NoSSR>......
7,138
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/ssr/pre-render.mdx
--- title: PreRender --- # PreRender A Helmet-like HOC without content implements SPA routing-level caching, manner without additional configuration. ## Usage ```tsx import { PreRender } from '@modern-js/runtime/ssr'; export default () => ( <> <PreRender interval={5} /> </> ); ``` ## Function Signature Th...
7,139
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/testing/_category_.json
{ "label": "Testing API", "position": 11 }
7,140
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/testing/act.mdx
--- title: act --- # act Used to ensure that behaviors such as rendering, events, data fetching, etc. have been applied to the DOM. ## Usage ```ts import { act } from '@modern-js/runtime/testing'; ``` ## Function Signature `act` is the same as [react-dom/test-utils act function](https://reactjs.org/docs/testing-re...
7,141
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/testing/cleanup.mdx
--- title: cleanup sidebar_position: 3 --- # cleanup Used to uninstall all currently rendered components. ## Usage ```ts import { cleanup } from '@modenr-js/runtime/testing'; ``` ## Function Signature `function cleanup(): void` ## Example :::info Note that if you are using a testing framework that supports after...
7,142
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/testing/render.mdx
--- title: render --- # render Used to render the component in the test case. ## Usage ```ts import { render } from '@modern-js/runtime/testing'; ``` ## Function Signature ```ts type Options = { container: DOMElement; baseElement: DOMElement; hydrate: boolean; warpper: React.ComponentType<{children: ReactN...
7,143
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/testing/renderApp.mdx
--- title: renderApp --- # renderApp The `render` function is used to test normal components, and the `renderApp` function is used to test App components. ## Usage ```ts import { renderApp } from '@modern-js/runtime/testing'; ``` App components refer to components that contain some Modern.js contexts, such as App r...
7,144
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/utility/_category_.json
{ "label": "Utility API", "position": 10 }
7,145
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/utility/css-in-js.mdx
--- title: CSS-In-JS API --- # CSS-In-JS API Use Style Component to write CSS. ## Usage ```ts import styled from '@modern-js/runtime/styled'; ``` ## Function Signature see [styled-component API](https://styled-components.com/docs/api). ## Example ```tsx import styled from '@modern-js/runtime/styled'; const Butt...
7,146
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/utility/head.mdx
--- title: Head --- # Head Used to add html elements (such as title, meta, script, etc.) to the `<head>` element, supports SSR. ## Usage ```tsx import { Helmet } from '@modern-js/runtime/head'; export default () => <Helmet>...</Helmet>; ``` ## Example ```tsx import { Helmet } from '@modern-js/runtime/head'; func...
7,147
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/utility/loadable.mdx
--- title: loadable --- # loadable Used to create Loadable component ## Usage ```ts import loadable from '@modern-js/runtime/loadable'; ``` ## Function Signature ```ts type Options = { resolveComponent?: ( module: Module, props: Props, ) => React.ComponentType<Props>, fallback?: JSX.Element; ssr?: ...
7,148
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/web-server/_category_.json
{ "label": "Web Server API", "position": 9 }
7,149
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/web-server/hook.mdx
--- title: Hook --- # Hook Used to extend Modern.js built-in Web Server, all page requests are handled by these hooks. :::note For more detail, see [Extend Web Server](/guides/advanced-features/web-server). ::: ## Usage ```ts import { AfterMatchHook, AfterRenderHook } from '@modern-js/runtime/server'; export cons...
7,150
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/apis/app/runtime/web-server/middleware.mdx
--- title: Middleware --- # Middleware Used to extend the built-in Web Server of Modern.js, unlike [Hook](/apis/app/runtime/web-server/hook), Middleware can directly operate Node's origin request and response, and can be extended using the framework plugin. :::note For more detail, see [Extend Web Server](/guides/adv...
7,151
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community/contributing-guide.mdx
--- sidebar_position: 3 --- # Contributing Guide Thanks for that you are interested in contributing to Modern.js. Before starting your contribution, please take a moment to read the following guidelines. --- ## Setup the Dev Environment ### Fork the Repo [Fork](https://help.github.com/articles/fork-a-repo/) this ...
7,152
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community/releases.mdx
--- sidebar_position: 2 --- # Releases ## Changelog Please visit [GitHub - Releases](https://github.com/web-infra-dev/modern.js/releases) to see what has changed with each release of Modern.js. ## Version Specification Modern.js follows the [Semantic Versioning](https://semver.org) specification. - Major version:...
7,153
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community/showcase.mdx
--- sidebar_position: 0 --- # Showcase Welcome to the Modern.js showcase page! Here, we present a collection of websites that have been built using Modern.js. If you have built a website using Modern.js, we would love for you to share it with the community. Simply reply to the GitHub discussion thread with a link to...
7,154
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community/team.mdx
--- sidebar_position: 1 --- # Meet the Team The development of Modern.js is driven by ByteDance's Modern.js team and community contributors. ## Core Team Members The Modern.js core team members: import { RandomMemberList } from '@site/src/components/RandomMemberList'; <RandomMemberList /> ## All Contributors Th...
7,155
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community/blog/_category_.json
{ "label": "Blog", "position": 4, "collapsed": false, "collapsible": false }
7,156
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/community/blog/overview.md
--- sidebar_position: 1 --- # Overview Welcome to Modern.js blog! You can find the latest update of Modern.js and our thought processes here. Occasionally we explain the infrastructure behind it. --- ## Announcing Modern.js v2: support Rspack > Published on 16.03.2023 We are excited to announce the release of Mo...
7,157
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/bff-proxy-path-rewrite.mdx
Path rewriting can also be performed here, such as proxying the request sent to `localhost:8080/api/topics` to `https://cnodejs.org/api/v1/topics`. ```js title="modern.server-runtime.config.js" import { defineConfig } from '@modern-js/app-tools/server'; export default defineConfig({ bff: { proxy: { '/api':...
7,158
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/bff-proxy-principle.mdx
BFF Proxy uses the powerful [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware). For more advanced usage, please refer to its [documentation](https://github.com/chimurai/http-proxy-middleware#options).
7,159
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/custom-router-micro-frontend.mdx
```js title="src/App.tsx" import { useModuleApps } from '@modern-js/plugin-garfish/runtime'; import { RouterProvider, Route, createBrowserRouter, createRoutesFromElements, BrowserRouter, Link, Outlet } from '@modern-js/runtime/router'; const AppLayout = () => ( <> <div><Link to={'/table'}>Loading conventional r...
7,160
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/debug-app.mdx
Run `pnpm run dev` in the project to start the project: ```bash $ pnpm run dev > modern dev info Starting dev server... ready Client compiled in 50 ms > Local: http://localhost:8080/ > Network: http://192.168.0.1:8080/ ``` Open `http://localhost:8000/` in your browser to see the page content.
7,161
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/deploy.mdx
After local verification, you can organize the artifacts in `dist/` into the structure required by the server for deployment.
7,162
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/enable-bff-caution.mdx
:::caution Please use the [new command](/apis/app/commands#modern-new) in the root directory of the current project to enable BFF functionality first. :::
7,163
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/enable-bff.mdx
1. Execute `pnpm new` and select "Enable BFF" 2. Add the following code to `modern.config.[tj]s` according to the chosen runtime framework: import { Tabs, Tab as TabItem } from "@theme"; <Tabs> <TabItem value="express" label="Express.js" default> ```ts title="modern.config.ts" import { expressPlugin } from '@moder...
7,164
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/enable-micro-frontend.mdx
```js title="modern.config.ts" import { appTools, defineConfig } from '@modern-js/app-tools'; import { garfishPlugin } from '@modern-js/plugin-garfish'; export default defineConfig({ runtime: { router: true, state: true, masterApp: true, }, plugins: [appTools(), garfishPlugin()], }); ```
7,165
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/global-proxy-config.mdx
- **Type:** `string | Object` - **Default:** `null` This option is used to configure a global proxy based on [whistle](https://wproxy.org/whistle/) in the development environment, which can be used to view and modify HTTP/HTTPS requests, responses, and can also be used as a proxy server. ### Register Plugin Before u...
7,166
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/global-proxy.mdx
Modern.js provides an out-of-the-box global proxy plugin `@modern-js/plugin-proxy`, which is based on [whistle](https://github.com/avwo/whistle) and can be used to view and modify the requests and responses of HTTP/HTTPS, as well as be used as an HTTP proxy server. ### Setting Proxy Rules After installing the proxy p...
7,167
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/init-app.mdx
`@modern-js/create` provides an interactive Q & A interface to initialize the project based on the results, with initialization performed according to the default settings: ```bash ? Please select the type of project you want to create: Web App ? Please select the programming language: TS ? Please select the package m...
7,168
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/init-rspack-app.mdx
```bash $ npx @modern-js/create@latest myapp ? Please select the type of project you want to create: Web App ? Please select the programming language: TS ? Please select the package manager: pnpm ? Please select the bundler: Rspack ```
7,169
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/language-config.mdx
### language Question: Please select the programming language. Options: - TS -- ts - ES6+ -- js
7,170
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/micro-master-manifest-config.mdx
## manifest ```ts interface Manifest { getAppList?: () => Array<AppInfo>; } ``` ### getAppList? Through the `getAppList` configuration, you can customize how to get remote list data ```ts type GetAppList = () => Promise<Array<AppInfo>>; ```
7,171
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/micro-runtime-config.mdx
```js title="src/App.tsx" import { defineConfig } from '@modern-js/runtime'; defineConfig(App, { masterApp: { apps: [ { name: 'DashBoard', entry: 'http://127.0.0.1:8081/', }, { name: 'TableList', entry: 'http://localhost:8082', }, ], }, }); ```
7,172
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/package-manager.mdx
### packageManager Question: Please select the package manager. Options: - pnpm -- pnpm - Yarn -- yarn - npm -- npm
7,173
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/prerequisites.mdx
### Node.js import NodeVersion from '@modern-js/builder-doc/docs/en/shared/nodeVersion.md'; <NodeVersion /> ### pnpm It is recommended to use [pnpm](https://pnpm.io/installation) to manage dependencies: ```bash npm install -g pnpm@8 ``` :::note Modern.js also supports dependency management with `yarn` and `npm`. ...
7,174
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/reduck-tip.mdx
:::info information By default, the export package name for all APIs in this section is: `@modern-js/runtime/model`. If Reduck is integrated separately from Modern.js, the export package name is: `@modern-js-reduck/react`. :::
7,175
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/release-note.mdx
According to the [Release Note](https://github.com/web-infra-dev/modern.js/releases) on the official website, developers can also manually upgrade the project to the desired version.
7,176
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/tech-stack-node-framework.mdx
Modern.js supports [Express.js](https://expressjs.com/) and [Koa.js](https://koajs.com/) as optional BFF runtime frameworks. Please refer to the [BFF - Frameworks](/guides/advanced-features/bff/frameworks.html) for more information.
7,177
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/turtorials-example-list.mdx
- [Route Authorization](/tutorials/examples/csr-auth.html) - ...
7,178
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/components/ua-polyfill.mdx
### Polyfill At Runtime Modern.js also provides a runtime Polyfill solution based on browser [UA](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/User-Agent) information, which has the following advantages over Babel: - It will not be inserted into the code, reducing the code . - The same browser will shar...
7,179
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/auto-load-plugin.mdx
--- sidebar_position: 22 --- # autoLoadPlugins - **Type:** `boolean` - **Default:** `false` Used to configure whether Modern.js enables auto-registration of plugins. ### Manual Registration Plugin By default, installing the plugin requires you to register the plugin manually in the `modern.config.ts`. ```ts title...
7,180
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/builder-plugins.mdx
--- sidebar_position: 21 --- # builderPlugins - **Type:** `BuilderPlugin[]` - **Default:** `[]` Used to configure the Modern.js Builder plugin. Modern.js Builder is the build tool of Modern.js, please read [Builder](/guides/concept/builder) for background. If you want to know how to write Builder plugins, you can r...
7,181
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/plugins.mdx
--- sidebar_position: 9 --- # plugins - **Type:** `CliPlugin[]` - **Default:** `[]` Used to configure custom Modern.js framework plugins. Refer to [How to Develop Plugins](/guides/topic-detail/framework-plugin/implement) for how to write custom plugins. ## Note This option is used to configure framework plugins. ...
7,182
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/usage.mdx
--- sidebar_position: 0 --- # Configuring Modern.js There are two configurations in the Modern.js, a compile configuration and a server runtime configuration. The compile configuration can be configured in two places: - `modern.config.(ts|js|mjs)` file in the root path - `package.json` file :::info Configurations ...
7,183
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/bff/_category_.json
{ "label": "bff", "position": 2 }
7,184
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/bff/enable-handle-web.mdx
--- title: enableHandleWeb --- # bff.enableHandleWeb - **Type:** `boolean` - **Default:** `false` import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution"; <EnableBFFCaution /> By default, the BFF service can only handle requests for BFF APIs. When this value is set to `true`, page request will ...
7,185
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/bff/prefix.mdx
--- sidebar_label: prefix --- # bff.prefix - **Type:** `string` - **Default:** `/api` import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution"; <EnableBFFCaution /> By default, the prefix for accessing routes in the BFF API directory is `/api`, as shown in the following directory structure: ```b...
7,186
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/bff/proxy.mdx
--- sidebar_label: proxy --- # bff.proxy - **Type:** `Record<string, string>` - **Default:** `{}` import EnableBFFCaution from "@site-docs-en/components/enable-bff-caution"; <EnableBFFCaution /> With simple configuration, Modern.js can automatically proxy requests sent to the BFF server to the specified service. ...
7,187
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/deploy/_category_.json
{ "label": "deploy", "position": 8 }
7,188
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/deploy/microFrontend.mdx
--- sidebar_label: microFrontend --- # deploy.microFrontend - **Type:** `object` - **Default:** `{ enableHtmlEntry: true, externalBasicLibrary: false }` ```ts interface MicroFrontend { enableHtmlEntry?: boolean; externalBasicLibrary?: boolean; moduleApp?: string; } ``` Developers can configure micro-frontend ...
7,189
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/_category_.json
{ "label": "dev", "position": 1 }
7,190
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/asset-prefix.mdx
--- sidebar_label: assetPrefix --- # dev.assetPrefix import Main from '@modern-js/builder-doc/docs/en/config/dev/assetPrefix.md'; <Main />
7,191
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/before-start-url.mdx
--- sidebar_label: beforeStartUrl --- # dev.beforeStartUrl import Main from '@modern-js/builder-doc/docs/en/config/dev/beforeStartUrl.md'; <Main />
7,192
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/hmr.mdx
--- sidebar_label: hmr --- # dev.hmr import Main from '@modern-js/builder-doc/docs/en/config/dev/hmr.md'; <Main />
7,193
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/host.mdx
--- sidebar_label: host --- # dev.host import Main from '@modern-js/builder-doc/docs/en/config/dev/host.md'; <Main />
7,194
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/https.mdx
--- sidebar_label: https --- # dev.https import Main from '@modern-js/builder-doc/docs/en/config/dev/https.md'; <Main />
7,195
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/port.mdx
--- sidebar_label: port --- # dev.port import Main from '@modern-js/builder-doc/docs/en/config/dev/port.md'; <Main />
7,196
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/progress-bar.mdx
--- sidebar_label: progressBar --- # dev.progressBar import Main from '@modern-js/builder-doc/docs/en/config/dev/progressBar.md'; <Main />
7,197
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/proxy.mdx
--- sidebar_label: proxy --- # dev.proxy import GlobalProxyConfig from "@site-docs-en/components/global-proxy-config" <GlobalProxyConfig />
7,198
0
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app
petrpan-code/web-infra-dev/modern.js/packages/document/main-doc/docs/en/configure/app/dev/start-url.mdx
--- sidebar_label: startUrl --- # dev.startUrl import Main from '@modern-js/builder-doc/docs/en/config/dev/startUrl.md'; <Main />
7,199