@modern-js/app-tools 3.9.2 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +54 -2
- package/dist/cjs/commands/build.js +1 -2
- package/dist/cjs/commands/deploy.js +1 -3
- package/dist/cjs/commands/index.js +4 -0
- package/dist/cjs/compat/hooks.js +0 -5
- package/dist/cjs/compat/index.js +0 -5
- package/dist/cjs/compat/utils.js +0 -5
- package/dist/cjs/index.js +15 -39
- package/dist/cjs/plugins/analyze/index.js +2 -2
- package/dist/cjs/plugins/analyze/utils.js +2 -3
- package/dist/cjs/plugins/initialize/index.js +3 -5
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.mjs +54 -2
- package/dist/esm/commands/build.mjs +1 -2
- package/dist/esm/commands/deploy.mjs +1 -3
- package/dist/esm/commands/index.mjs +4 -0
- package/dist/esm/compat/hooks.mjs +0 -5
- package/dist/esm/compat/index.mjs +0 -5
- package/dist/esm/compat/utils.mjs +0 -5
- package/dist/esm/index.mjs +2 -10
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +2 -3
- package/dist/esm/plugins/initialize/index.mjs +3 -5
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.mjs +54 -2
- package/dist/esm-node/commands/build.mjs +1 -2
- package/dist/esm-node/commands/deploy.mjs +1 -3
- package/dist/esm-node/commands/index.mjs +4 -0
- package/dist/esm-node/compat/hooks.mjs +0 -5
- package/dist/esm-node/compat/index.mjs +0 -5
- package/dist/esm-node/compat/utils.mjs +0 -5
- package/dist/esm-node/index.mjs +2 -10
- package/dist/esm-node/plugins/analyze/index.mjs +2 -2
- package/dist/esm-node/plugins/analyze/utils.mjs +2 -3
- package/dist/esm-node/plugins/initialize/index.mjs +3 -5
- package/dist/types/index.d.ts +1 -3
- package/dist/types/plugins/analyze/utils.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +0 -2
- package/dist/types/types/config/tools.d.ts +0 -8
- package/docs/apis/app/commands.md +2 -0
- package/docs/apis/app/hooks/api/lambda.md +2 -0
- package/docs/apis/app/hooks/config/favicon.md +2 -0
- package/docs/apis/app/hooks/config/html.md +2 -0
- package/docs/apis/app/hooks/config/icon.md +2 -0
- package/docs/apis/app/hooks/config/mock.md +2 -0
- package/docs/apis/app/hooks/config/public.md +2 -0
- package/docs/apis/app/hooks/config/upload.md +3 -3
- package/docs/apis/app/hooks/modern-config.md +2 -0
- package/docs/apis/app/hooks/server/server.md +2 -0
- package/docs/apis/app/hooks/shared.md +2 -0
- package/docs/apis/app/hooks/src/app.md +2 -0
- package/docs/apis/app/hooks/src/entry.md +2 -0
- package/docs/apis/app/hooks/src/entry.server.md +2 -0
- package/docs/apis/app/hooks/src/modern.runtime.md +2 -0
- package/docs/apis/app/hooks/src/routes.md +2 -0
- package/docs/apis/app/hooks/src/server.md +2 -0
- package/docs/apis/app/runtime/bff/use-hono-context.md +2 -0
- package/docs/apis/app/runtime/core/create-root.md +5 -1
- package/docs/apis/app/runtime/core/render.md +7 -2
- package/docs/apis/app/runtime/core/runtime-context.md +18 -16
- package/docs/apis/app/runtime/router/router.md +11 -6
- package/docs/apis/app/runtime/ssr/no-ssr.md +2 -0
- package/docs/apis/app/runtime/ssr/renderStreaming.md +2 -0
- package/docs/apis/app/runtime/ssr/renderString.md +2 -0
- package/docs/apis/app/runtime/ssr/requestHandler.md +2 -0
- package/docs/apis/app/runtime/utility/css-in-js.md +2 -0
- package/docs/apis/app/runtime/utility/head.md +2 -0
- package/docs/apis/app/runtime/utility/loadable.md +2 -0
- package/docs/community/blog/2022-0708-updates.md +2 -0
- package/docs/community/blog/2022-0910-updates.md +2 -0
- package/docs/community/blog/overview.md +2 -0
- package/docs/community/blog/v2-release-note.md +2 -0
- package/docs/community/blog/v3-release-note.md +18 -13
- package/docs/community/contributing-guide.md +17 -33
- package/docs/community/releases.md +2 -0
- package/docs/community/showcase.md +2 -0
- package/docs/community/team.md +2 -0
- package/docs/configure/app/bff/cross-project.md +2 -0
- package/docs/configure/app/bff/prefix.md +2 -0
- package/docs/configure/app/builder-plugins.md +2 -0
- package/docs/configure/app/dev/asset-prefix.md +2 -0
- package/docs/configure/app/dev/before-start-url.md +2 -0
- package/docs/configure/app/dev/client.md +2 -0
- package/docs/configure/app/dev/hmr.md +2 -0
- package/docs/configure/app/dev/host.md +2 -0
- package/docs/configure/app/dev/https.md +2 -0
- package/docs/configure/app/dev/lazy-compilation.md +19 -1
- package/docs/configure/app/dev/live-reload.md +2 -0
- package/docs/configure/app/dev/mock-dir.md +2 -0
- package/docs/configure/app/dev/progress-bar.md +2 -0
- package/docs/configure/app/dev/server.md +2 -0
- package/docs/configure/app/dev/setup-middlewares.md +2 -0
- package/docs/configure/app/dev/start-url.md +2 -0
- package/docs/configure/app/dev/watch-files.md +2 -0
- package/docs/configure/app/dev/write-to-disk.md +2 -0
- package/docs/configure/app/experiments/source-build.md +2 -0
- package/docs/configure/app/html/app-icon.md +2 -0
- package/docs/configure/app/html/crossorigin.md +2 -0
- package/docs/configure/app/html/favicon.md +2 -0
- package/docs/configure/app/html/inject.md +2 -0
- package/docs/configure/app/html/meta.md +2 -0
- package/docs/configure/app/html/mount-id.md +2 -0
- package/docs/configure/app/html/output-structure.md +2 -0
- package/docs/configure/app/html/script-loading.md +2 -0
- package/docs/configure/app/html/tags.md +2 -0
- package/docs/configure/app/html/template-parameters.md +2 -0
- package/docs/configure/app/html/template.md +2 -0
- package/docs/configure/app/html/title.md +2 -0
- package/docs/configure/app/output/asset-prefix.md +2 -0
- package/docs/configure/app/output/assets-retry.md +2 -0
- package/docs/configure/app/output/charset.md +2 -0
- package/docs/configure/app/output/clean-dist-path.md +2 -0
- package/docs/configure/app/output/convert-to-rem.md +2 -0
- package/docs/configure/app/output/copy.md +2 -0
- package/docs/configure/app/output/css-modules.md +3 -5
- package/docs/configure/app/output/data-uri-limit.md +2 -0
- package/docs/configure/app/output/disable-css-module-extension.md +2 -0
- package/docs/configure/app/output/disable-inline-runtime-chunk.md +2 -0
- package/docs/configure/app/output/disable-svgr.md +6 -0
- package/docs/configure/app/output/disable-ts-checker.md +2 -0
- package/docs/configure/app/output/dist-path.md +2 -0
- package/docs/configure/app/output/enable-asset-manifest.md +2 -0
- package/docs/configure/app/output/enable-css-module-tsdeclaration.md +2 -0
- package/docs/configure/app/output/enable-inline-route-manifests.md +2 -0
- package/docs/configure/app/output/externals.md +2 -0
- package/docs/configure/app/output/filename-hash.md +2 -0
- package/docs/configure/app/output/filename.md +2 -0
- package/docs/configure/app/output/inject-styles.md +2 -0
- package/docs/configure/app/output/inline-scripts.md +3 -2
- package/docs/configure/app/output/inline-styles.md +3 -2
- package/docs/configure/app/output/legal-comments.md +2 -0
- package/docs/configure/app/output/minify.md +2 -0
- package/docs/configure/app/output/override-browserslist.md +2 -0
- package/docs/configure/app/output/polyfill.md +2 -0
- package/docs/configure/app/output/source-map.md +2 -0
- package/docs/configure/app/output/split-route-chunks.md +3 -1
- package/docs/configure/app/output/ssg.md +2 -0
- package/docs/configure/app/output/ssgByEntries.md +2 -0
- package/docs/configure/app/output/svg-default-export.md +6 -0
- package/docs/configure/app/output/temp-dir.md +2 -0
- package/docs/configure/app/performance/build-cache.md +2 -0
- package/docs/configure/app/performance/chunk-split.md +3 -4
- package/docs/configure/app/performance/dns-prefetch.md +2 -0
- package/docs/configure/app/performance/preconnect.md +2 -0
- package/docs/configure/app/performance/prefetch.md +2 -0
- package/docs/configure/app/performance/preload.md +2 -0
- package/docs/configure/app/performance/print-file-size.md +2 -0
- package/docs/configure/app/performance/profile.md +2 -0
- package/docs/configure/app/performance/remove-console.md +2 -0
- package/docs/configure/app/performance/remove-moment-locale.md +2 -0
- package/docs/configure/app/plugins.md +2 -0
- package/docs/configure/app/resolve/alias-strategy.md +2 -0
- package/docs/configure/app/resolve/alias.md +2 -0
- package/docs/configure/app/resolve/condition-names.md +2 -0
- package/docs/configure/app/resolve/dedupe.md +2 -0
- package/docs/configure/app/resolve/extensions.md +2 -0
- package/docs/configure/app/runtime/0-intro.md +2 -0
- package/docs/configure/app/runtime/plugins.md +8 -4
- package/docs/configure/app/runtime/router.md +2 -0
- package/docs/configure/app/security/check-syntax.md +2 -0
- package/docs/configure/app/security/nonce.md +2 -0
- package/docs/configure/app/security/sri.md +2 -0
- package/docs/configure/app/server/base-url.md +2 -0
- package/docs/configure/app/server/port.md +2 -0
- package/docs/configure/app/server/public-routes.md +2 -0
- package/docs/configure/app/server/routes.md +2 -0
- package/docs/configure/app/server/rsc.md +2 -0
- package/docs/configure/app/server/ssr-by-entries.md +2 -0
- package/docs/configure/app/server/ssr.md +3 -1
- package/docs/configure/app/server/tsconfig-path.md +4 -2
- package/docs/configure/app/source/alias-strategy.md +2 -0
- package/docs/configure/app/source/alias.md +2 -0
- package/docs/configure/app/source/config-dir.md +2 -0
- package/docs/configure/app/source/decorators.md +2 -0
- package/docs/configure/app/source/define.md +2 -0
- package/docs/configure/app/source/disable-default-entries.md +2 -0
- package/docs/configure/app/source/enable-async-entry.md +2 -0
- package/docs/configure/app/source/enable-async-pre-entry.md +2 -0
- package/docs/configure/app/source/entries-dir.md +2 -0
- package/docs/configure/app/source/entries.md +2 -0
- package/docs/configure/app/source/exclude.md +2 -0
- package/docs/configure/app/source/global-vars.md +2 -0
- package/docs/configure/app/source/include.md +2 -0
- package/docs/configure/app/source/main-entry-name.md +2 -0
- package/docs/configure/app/source/pre-entry.md +2 -0
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/configure/app/source/transform-import.md +2 -0
- package/docs/configure/app/split-chunks.md +2 -0
- package/docs/configure/app/tools/autoprefixer.md +2 -0
- package/docs/configure/app/tools/bundler-chain.md +2 -0
- package/docs/configure/app/tools/css-extract.md +2 -0
- package/docs/configure/app/tools/css-loader.md +2 -0
- package/docs/configure/app/tools/dev-server.md +2 -0
- package/docs/configure/app/tools/html-plugin.md +2 -0
- package/docs/configure/app/tools/less.md +96 -19
- package/docs/configure/app/tools/lightningcss-loader.md +2 -0
- package/docs/configure/app/tools/minify-css.md +2 -0
- package/docs/configure/app/tools/postcss.md +2 -0
- package/docs/configure/app/tools/rspack.md +2 -0
- package/docs/configure/app/tools/sass.md +89 -18
- package/docs/configure/app/tools/style-loader.md +2 -0
- package/docs/configure/app/tools/svgr.md +91 -0
- package/docs/configure/app/tools/swc.md +2 -0
- package/docs/configure/app/tools/ts-checker.md +2 -0
- package/docs/configure/app/usage.md +3 -5
- package/docs/guides/advanced-features/bff/cross-project.md +6 -4
- package/docs/guides/advanced-features/bff/extend-server.md +2 -0
- package/docs/guides/advanced-features/bff/frameworks.md +2 -0
- package/docs/guides/advanced-features/bff/function.md +2 -0
- package/docs/guides/advanced-features/bff/operators.md +2 -0
- package/docs/guides/advanced-features/bff/sdk.md +2 -0
- package/docs/guides/advanced-features/bff/upload.md +2 -0
- package/docs/guides/advanced-features/bff.md +2 -0
- package/docs/guides/advanced-features/build-performance.md +2 -0
- package/docs/guides/advanced-features/compatibility.md +2 -0
- package/docs/guides/advanced-features/international/advanced.md +3 -1
- package/docs/guides/advanced-features/international/api.md +21 -13
- package/docs/guides/advanced-features/international/best-practices.md +17 -15
- package/docs/guides/advanced-features/international/configuration.md +3 -1
- package/docs/guides/advanced-features/international/locale-detection.md +15 -4
- package/docs/guides/advanced-features/international/quick-start.md +2 -0
- package/docs/guides/advanced-features/international/resource-loading.md +11 -7
- package/docs/guides/advanced-features/international/routing.md +5 -1
- package/docs/guides/advanced-features/international.md +2 -0
- package/docs/guides/advanced-features/low-level.md +2 -0
- package/docs/guides/advanced-features/page-performance/code-split.md +2 -0
- package/docs/guides/advanced-features/page-performance/inline-assets.md +2 -0
- package/docs/guides/advanced-features/page-performance/optimize-bundle.md +2 -0
- package/docs/guides/advanced-features/page-performance/react-compiler.md +2 -0
- package/docs/guides/advanced-features/server-monitor/logger.md +2 -0
- package/docs/guides/advanced-features/server-monitor/metrics.md +2 -0
- package/docs/guides/advanced-features/server-monitor/monitors.md +3 -3
- package/docs/guides/advanced-features/source-build.md +3 -1
- package/docs/guides/advanced-features/web-server.md +5 -3
- package/docs/guides/basic-features/alias.md +2 -0
- package/docs/guides/basic-features/css/css-in-js.md +2 -0
- package/docs/guides/basic-features/css/css-modules.md +2 -0
- package/docs/guides/basic-features/css/css.md +2 -0
- package/docs/guides/basic-features/css/tailwindcss.md +2 -0
- package/docs/guides/basic-features/data/data-cache.md +2 -0
- package/docs/guides/basic-features/data/data-fetch.md +3 -3
- package/docs/guides/basic-features/data/data-write.md +25 -28
- package/docs/guides/basic-features/debug/mock.md +4 -2
- package/docs/guides/basic-features/debug/proxy.md +2 -0
- package/docs/guides/basic-features/debug/rsdoctor.md +2 -0
- package/docs/guides/basic-features/debug/using-storybook.md +6 -4
- package/docs/guides/basic-features/deploy.md +2 -0
- package/docs/guides/basic-features/env-vars.md +2 -0
- package/docs/guides/basic-features/html.md +4 -3
- package/docs/guides/basic-features/output-files.md +3 -1
- package/docs/guides/basic-features/render/before-render.md +2 -0
- package/docs/guides/basic-features/render/overview.md +2 -0
- package/docs/guides/basic-features/render/rsc.md +12 -2
- package/docs/guides/basic-features/render/ssg.md +2 -0
- package/docs/guides/basic-features/render/ssr-cache.md +2 -0
- package/docs/guides/basic-features/render/ssr.md +10 -12
- package/docs/guides/basic-features/render/streaming-ssr.md +4 -1
- package/docs/guides/basic-features/routes/config-routes.md +54 -54
- package/docs/guides/basic-features/routes/routes.md +2 -0
- package/docs/guides/basic-features/static-assets/json-files.md +2 -0
- package/docs/guides/basic-features/static-assets/svg-assets.md +31 -17
- package/docs/guides/basic-features/static-assets/wasm-assets.md +2 -0
- package/docs/guides/basic-features/static-assets.md +2 -0
- package/docs/guides/basic-features/testing/playwright.md +8 -6
- package/docs/guides/basic-features/testing/rstest.md +7 -5
- package/docs/guides/concept/builder.md +2 -0
- package/docs/guides/concept/entries.md +2 -0
- package/docs/guides/concept/server.md +2 -0
- package/docs/guides/get-started/ai-coding-agents.md +5 -3
- package/docs/guides/get-started/glossary.md +2 -0
- package/docs/guides/get-started/introduction.md +2 -0
- package/docs/guides/get-started/quick-start.md +13 -5
- package/docs/guides/get-started/tech-stack.md +2 -0
- package/docs/guides/get-started/upgrade.md +2 -0
- package/docs/guides/topic-detail/module-federation/application.md +2 -0
- package/docs/guides/topic-detail/module-federation/deploy.md +4 -2
- package/docs/guides/topic-detail/module-federation/i18n.md +2 -0
- package/docs/guides/topic-detail/module-federation/introduce.md +2 -0
- package/docs/guides/topic-detail/module-federation/ssr.md +2 -0
- package/docs/guides/topic-detail/module-federation/usage.md +2 -0
- package/docs/guides/troubleshooting/builder.md +2 -0
- package/docs/guides/troubleshooting/cli.md +2 -0
- package/docs/guides/troubleshooting/dependencies.md +2 -0
- package/docs/guides/troubleshooting/hmr.md +2 -0
- package/docs/guides/upgrade/config.md +14 -0
- package/docs/guides/upgrade/entry.md +2 -0
- package/docs/guides/upgrade/other.md +2 -0
- package/docs/guides/upgrade/overview.md +2 -0
- package/docs/guides/upgrade/tailwindcss.md +2 -0
- package/docs/guides/upgrade/web-server.md +25 -6
- package/docs/index.md +2 -0
- package/docs/llms.txt +8 -7
- package/docs/plugin/cli-plugins/api.md +2 -0
- package/docs/plugin/cli-plugins/life-cycle.md +2 -0
- package/docs/plugin/introduction.md +12 -10
- package/docs/plugin/official/cli-plugins/plugin-bff.md +2 -0
- package/docs/plugin/official/cli-plugins/plugin-ssg.md +2 -0
- package/docs/plugin/official/cli-plugins/plugin-styled-components.md +2 -0
- package/docs/plugin/official/cli-plugins.md +2 -0
- package/docs/plugin/plugin-system.md +3 -3
- package/docs/plugin/runtime-plugins/api.md +2 -0
- package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
- package/docs/plugin/server-plugins/api.md +2 -0
- package/docs/plugin/server-plugins/life-cycle.md +2 -0
- package/docs/tutorials/examples/csr-auth.md +2 -0
- package/docs/tutorials/foundations/introduction.md +2 -0
- package/lib/types.d.ts +0 -1
- package/package.json +18 -19
- package/{rslib.config.mts → rstack.config.mts} +4 -4
- package/dist/cjs/types/config/testing.js +0 -18
- package/dist/esm/types/config/testing.mjs +0 -0
- package/dist/esm-node/types/config/testing.mjs +0 -1
- package/dist/types/types/config/testing.d.ts +0 -8
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Modern.js v3 Release: Focused on web framework, embracing ecosystem development
|
|
2
4
|
|
|
3
5
|
> Published on 2025.02.06
|
|
@@ -63,7 +65,7 @@ In Modern.js 3.0, simply enable RSC in the configuration:
|
|
|
63
65
|
export default defineConfig({
|
|
64
66
|
server: {
|
|
65
67
|
rsc: true,
|
|
66
|
-
}
|
|
68
|
+
},
|
|
67
69
|
});
|
|
68
70
|
```
|
|
69
71
|
|
|
@@ -151,7 +153,7 @@ import('./module').then(({ value }) => {
|
|
|
151
153
|
});
|
|
152
154
|
|
|
153
155
|
// Destructuring in function body
|
|
154
|
-
import('./module').then(
|
|
156
|
+
import('./module').then(mod => {
|
|
155
157
|
const { value } = mod;
|
|
156
158
|
console.log(value);
|
|
157
159
|
});
|
|
@@ -231,7 +233,10 @@ In practice, we found that some projects need to extend the Web Server — for e
|
|
|
231
233
|
In Modern.js 3.0, we rebuilt the Web Server using [Hono](https://hono.dev) and officially opened up server middleware and plugin capabilities. Developers can use Hono middleware to meet their needs:
|
|
232
234
|
|
|
233
235
|
```ts title="server/modern.server.ts"
|
|
234
|
-
import {
|
|
236
|
+
import {
|
|
237
|
+
defineServerConfig,
|
|
238
|
+
type MiddlewareHandler,
|
|
239
|
+
} from '@modern-js/server-runtime';
|
|
235
240
|
|
|
236
241
|
const timingMiddleware: MiddlewareHandler = async (c, next) => {
|
|
237
242
|
const start = Date.now();
|
|
@@ -244,8 +249,8 @@ const htmlMiddleware: MiddlewareHandler = async (c, next) => {
|
|
|
244
249
|
await next();
|
|
245
250
|
const html = await c.res.text();
|
|
246
251
|
const modified = html.replace(
|
|
247
|
-
|
|
248
|
-
'<head><meta name="generator" content="Modern.js">'
|
|
252
|
+
'<head>',
|
|
253
|
+
'<head><meta name="generator" content="Modern.js">',
|
|
249
254
|
);
|
|
250
255
|
c.res = c.body(modified, { status: c.res.status, headers: c.res.headers });
|
|
251
256
|
};
|
|
@@ -316,13 +321,13 @@ In Modern.js, we recommend using convention-based routing to organize code. Howe
|
|
|
316
321
|
Therefore, Modern.js 3.0 provides full config-based routing support, which can be used alongside convention-based routing or independently.
|
|
317
322
|
|
|
318
323
|
```ts title="src/modern.routes.ts"
|
|
319
|
-
import { defineRoutes } from
|
|
324
|
+
import { defineRoutes } from '@modern-js/runtime/config-routes';
|
|
320
325
|
|
|
321
326
|
export default defineRoutes(({ route, layout, page }) => {
|
|
322
327
|
return [
|
|
323
|
-
route(
|
|
324
|
-
route(
|
|
325
|
-
route(
|
|
328
|
+
route('home.tsx', '/'),
|
|
329
|
+
route('about.tsx', 'about'),
|
|
330
|
+
route('blog.tsx', 'blog/:id'),
|
|
326
331
|
];
|
|
327
332
|
});
|
|
328
333
|
```
|
|
@@ -408,19 +413,19 @@ For render cache usage, see the docs: [Render Cache](/guides/basic-features/rend
|
|
|
408
413
|
The new version provides a `cache` function that offers finer-grained data-level control compared to render cache. When multiple data requests depend on the same data, `cache` can avoid duplicate requests:
|
|
409
414
|
|
|
410
415
|
```ts title="server/loader.ts"
|
|
411
|
-
import { cache } from
|
|
412
|
-
import { fetchUserData, fetchUserProjects, fetchUserTeam } from
|
|
416
|
+
import { cache } from '@modern-js/runtime/cache';
|
|
417
|
+
import { fetchUserData, fetchUserProjects, fetchUserTeam } from './api';
|
|
413
418
|
|
|
414
419
|
// Cache user data to avoid duplicate requests
|
|
415
420
|
const getUser = cache(fetchUserData);
|
|
416
421
|
|
|
417
422
|
const getProjects = async () => {
|
|
418
|
-
const user = await getUser(
|
|
423
|
+
const user = await getUser('test-user');
|
|
419
424
|
return fetchUserProjects(user.id);
|
|
420
425
|
};
|
|
421
426
|
|
|
422
427
|
const getTeam = async () => {
|
|
423
|
-
const user = await getUser(
|
|
428
|
+
const user = await getUser('test-user'); // Reuses cache, no duplicate request
|
|
424
429
|
return fetchUserTeam(user.id);
|
|
425
430
|
};
|
|
426
431
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Contributing Guide
|
|
2
4
|
|
|
3
5
|
Thanks for that you are interested in contributing to Modern.js. Before starting your contribution, please take a moment to read the following guidelines.
|
|
@@ -32,13 +34,6 @@ nvm alias default 22
|
|
|
32
34
|
nvm use 22
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
### Install pnpm
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
# Enable pnpm with corepack, only available on Node.js >= `v14.19.0`
|
|
39
|
-
corepack enable
|
|
40
|
-
```
|
|
41
|
-
|
|
42
37
|
### Install Dependencies
|
|
43
38
|
|
|
44
39
|
```sh
|
|
@@ -53,28 +48,6 @@ What this will do:
|
|
|
53
48
|
|
|
54
49
|
> A full rebuild of all packages is generally not required after this. If a new feature you are developing requires an updated version of another package, it is usually sufficient to build the changed dependencies.
|
|
55
50
|
|
|
56
|
-
### Set Git Email
|
|
57
|
-
|
|
58
|
-
Please make sure you have your email set up in `<https://github.com/settings/emails>`. This will be needed later when you want to submit a pull request.
|
|
59
|
-
|
|
60
|
-
Check that your git client is already configured the email:
|
|
61
|
-
|
|
62
|
-
```sh
|
|
63
|
-
git config --list | grep email
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Set the email to global config:
|
|
67
|
-
|
|
68
|
-
```sh
|
|
69
|
-
git config --global user.email "SOME_EMAIL@example.com"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Set the email for local repo:
|
|
73
|
-
|
|
74
|
-
```sh
|
|
75
|
-
git config user.email "SOME_EMAIL@example.com"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
51
|
## Making Changes and Building
|
|
79
52
|
|
|
80
53
|
Once you have set up the local development environment in your forked repo, we can start development.
|
|
@@ -128,7 +101,7 @@ Modern.js uses [Rstest](https://rstest.rs/) for unit tests across the repository
|
|
|
128
101
|
Before submitting a pull request, it's important to make sure that the changes haven't introduced any regressions or bugs. You can run the unit tests for the project by executing the following command:
|
|
129
102
|
|
|
130
103
|
```sh
|
|
131
|
-
pnpm run test
|
|
104
|
+
pnpm run test:ut
|
|
132
105
|
```
|
|
133
106
|
|
|
134
107
|
Alternatively, you can run the unit tests of single package using the `--filter` option:
|
|
@@ -141,10 +114,11 @@ pnpm run --filter @modern-js/some-package test
|
|
|
141
114
|
|
|
142
115
|
In addition to the unit tests, the Modern.js also includes end-to-end (E2E) tests, which checks the functionality of the application as a whole.
|
|
143
116
|
|
|
144
|
-
|
|
117
|
+
Run the framework integration tests and Builder E2E tests with the following commands:
|
|
145
118
|
|
|
146
119
|
```sh
|
|
147
|
-
pnpm run test:
|
|
120
|
+
pnpm run test:framework
|
|
121
|
+
pnpm run test:builder
|
|
148
122
|
```
|
|
149
123
|
|
|
150
124
|
If you need to run a specified test, you can add keywords to filter:
|
|
@@ -156,7 +130,7 @@ npx rstest copy-assets
|
|
|
156
130
|
|
|
157
131
|
## Linting
|
|
158
132
|
|
|
159
|
-
To help maintain consistency and readability
|
|
133
|
+
To help maintain consistency and readability across the codebase, we use [Rstack CLI](https://rstack.rs/) for linting and formatting.
|
|
160
134
|
|
|
161
135
|
You can run the Linter by executing the following command:
|
|
162
136
|
|
|
@@ -164,6 +138,14 @@ You can run the Linter by executing the following command:
|
|
|
164
138
|
pnpm run lint
|
|
165
139
|
```
|
|
166
140
|
|
|
141
|
+
Run the formatter from the repository root:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
pnpm run format
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Append a file or directory path to either command to limit its scope.
|
|
148
|
+
|
|
167
149
|
## Benchmarking
|
|
168
150
|
|
|
169
151
|
You can input `!bench-framework` or `!bench-module` in the comment area of the PR to do benchmarking on `@modern-js/app-tools` and `@modern-js/module-tools` respectively (you need to have Collaborator and above permissions).
|
|
@@ -245,6 +227,8 @@ pnpm run prepare
|
|
|
245
227
|
pnpm run bump
|
|
246
228
|
```
|
|
247
229
|
|
|
230
|
+
After Changesets updates the package versions, this command synchronizes internal `peerDependencies` ranges to `workspace:^<dependency version>` to satisfy the changeset validation.
|
|
231
|
+
|
|
248
232
|
5. Commit the version change.
|
|
249
233
|
|
|
250
234
|
```sh
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# Showcase
|
|
2
4
|
|
|
3
5
|
Welcome to the Modern.js showcase page! Here, we present a collection of websites that have been built using Modern.js.
|
package/docs/community/team.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# dev.lazyCompilation
|
|
2
4
|
|
|
3
5
|
- **Type:**
|
|
@@ -29,10 +31,26 @@ type LazyCompilationOptions =
|
|
|
29
31
|
};
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
- **Default:**
|
|
34
|
+
- **Default:** depends on how the application renders:
|
|
35
|
+
- Pure CSR and streaming SSR applications: `{ imports: true, entries: false }`, which compiles dynamic imports on demand;
|
|
36
|
+
- Applications using string SSR (including any entry in `server.ssrByEntries` using string SSR), RSC or SSG: `false`.
|
|
33
37
|
|
|
34
38
|
Enable lazy compilation (compilation on demand), implemented based on Rspack's [lazy compilation](https://rspack.rs/guide/features/lazy-compilation) feature.
|
|
35
39
|
|
|
40
|
+
This option only takes effect in the dev server and does not affect production build output. When enabled for streaming SSR applications, route components are still compiled eagerly so that first-screen JS/CSS injection stays correct.
|
|
41
|
+
|
|
42
|
+
An explicitly configured `dev.lazyCompilation` always takes precedence over the default. To disable it:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { defineConfig } from '@modern-js/app-tools';
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
dev: {
|
|
49
|
+
lazyCompilation: false,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
36
54
|
:::info
|
|
37
55
|
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to [Rsbuild - dev.lazyCompilation](https://v2.rsbuild.dev/config/dev/lazy-compilation)。
|
|
38
56
|
In Rspack build mode,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# output.cssModules
|
|
2
4
|
|
|
3
5
|
- **Type:**
|
|
@@ -13,11 +15,7 @@ type CssModules = {
|
|
|
13
15
|
resourceFragment: string,
|
|
14
16
|
) => boolean);
|
|
15
17
|
exportLocalsConvention?:
|
|
16
|
-
| '
|
|
17
|
-
| 'camelCase'
|
|
18
|
-
| 'camelCaseOnly'
|
|
19
|
-
| 'dashes'
|
|
20
|
-
| 'dashesOnly';
|
|
18
|
+
'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
|
21
19
|
exportGlobals?: boolean;
|
|
22
20
|
localIdentName?: string;
|
|
23
21
|
mode?:
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
1
3
|
# output.disableSvgr
|
|
2
4
|
|
|
3
5
|
- **Type:** `boolean`
|
|
4
6
|
- **Default:** `false`
|
|
5
7
|
|
|
8
|
+
:::warning Deprecated
|
|
9
|
+
`output.disableSvgr` is deprecated and will be removed in the next major version. Replace `output.disableSvgr: true` with [tools.svgr](/configure/app/tools/svgr.md) set to `false`; `output.disableSvgr: false` is the default behavior and can simply be removed. When both are set, `tools.svgr` wins.
|
|
10
|
+
:::
|
|
11
|
+
|
|
6
12
|
Whether to transform SVGs into React components. If true, will treat all .svg files as assets.
|
|
7
13
|
|
|
8
14
|
By default, when an SVG resource is referenced in a JS file, Modern.js will call SVGR to convert the SVG into a React component. If you are sure that all SVG resources in your project are not being used as React components, you can turn off this conversion by setting `disableSvgr` to true to improve build performance.
|